import { Entity } from "../EntityManager" ; import { isCollection } from "./Collection" ; import { isReference } from "./Reference" ; export const RelationT = Symbol ( ) ; export const RelationU = Symbol ( ) ; /** A relationship from `T` to `U`, could be any of many-to-one, one-to-many, or many-to-many. */ export interface Relation < T extends Entity , U extends Entity > { [ RelationT ] : T ; [ RelationU ] : U ; } /** Type guard utility for determining if an entity field is a Relation. */ export function isRelation ( maybeRelation ) { return isReference ( maybeRelation ) || isCollection ( maybeRelation ) ; }