Support for `Relation`.
Opened this issue · 0 comments
haejunejung commented
It provides support for Relation
.
It wrappers type for relation type definitions in entities. It is used to circumvent ESM modules circular dependency issue caused by reflection metadata saving the type of the property.
@link
https://github.com/typeorm/typeorm/blob/master/src/common/RelationType.ts
import { Entity, PrimaryGeneratedColumn, OneToOne } from "typeorm";
@Entity
export class Profile {
@PrimaryGeneratedColumn()
id: number;
@OneToOne(() => User, user => user.profile)
user: Relation<User>;
}
@Entity
export class User {
@PrimaryGeneratedColumn()
id: number;
@OneToOne(() => Profile, profile => profile.user)
profile: Relation<Profile>
}