Closed
Description
First I thought the problem in reflect-metadata
component I used, but now I think the issue is with typescript decorators themself. I described that issue there: microsoft/reflect-metadata#12
You can understand what is problem from my code out run output:
import {Person} from "./Person";
import {Relation} from "./Relation";
export class PersonInfo {
@Relation(Person)
info: string;
}
import {Relation} from "./Relation";
import {PersonInfo} from "./PersonInfo";
export class Person {
name: string;
@Relation(PersonInfo)
info: string;
}
export function Relation(cls) {
return function () {
console.log(cls);
}
}
import {Person} from "./Person";
let person = new Person();
result:
undefined
[Function: PersonInfo]
expected result:
[Function: Person]
[Function: PersonInfo]
From generated sources I found that Person_1.Person is undefined here:
__decorate([
Relation_1.Relation(Person_1.Person),
__metadata('design:type', String)
], PersonInfo.prototype, "info");