diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index c11654b08aa7..93a8761ea975 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -7,7 +7,7 @@ export { Constructor, ConnectionType, Dictionary, PrimaryKeyType, PrimaryKeyProp, Primary, IPrimaryKey, ObjectQuery, FilterQuery, IWrappedEntity, EntityName, EntityData, Highlighter, AnyEntity, EntityClass, EntityProperty, EntityMetadata, QBFilterQuery, PopulateOptions, Populate, Loaded, New, LoadedReference, LoadedCollection, IMigrator, IMigrationGenerator, GetRepository, EntityRepositoryType, MigrationObject, DeepPartial, PrimaryProperty, Cast, IsUnknown, EntityDictionary, EntityDTO, MigrationDiff, - IEntityGenerator, ISeedManager, EntityClassGroup, OptionalProps, RequiredEntityData, CheckCallback, SimpleColumnMeta, + IEntityGenerator, ISeedManager, EntityClassGroup, OptionalProps, RequiredEntityData, CheckCallback, SimpleColumnMeta, Rel, Ref, } from './typings'; export * from './enums'; export * from './errors'; diff --git a/packages/core/src/typings.ts b/packages/core/src/typings.ts index 35b5a0c93a31..9eed4a2fe0e3 100644 --- a/packages/core/src/typings.ts +++ b/packages/core/src/typings.ts @@ -199,6 +199,13 @@ export type EntityDictionary = EntityData & Dictionary; type Relation = { [P in keyof T as T[P] extends unknown[] | Record ? P : never]?: T[P] }; + +/** Identity type that can be used to get around issues with cycles in bidirectional relations. */ +export type Rel = T; + +/** Shortcut for `IdentifiedReference`. */ +export type Ref> = IdentifiedReference; + export type EntityDTOProp = T extends Scalar ? T : T extends LoadedReference