import { GraphQLType } from 'graphql' ; import { TypeExpression } from '../type-expression/TypeExpression' ; import { Instantiator } from '../types' ; import { MetadataStorage } from './MetadataStorage' ; export interface ReferenceConfig { source : Object ; target : TypeExpression ; } export type ReferenceKind = 'input' | 'output' ; export abstract class Reference < TConfig extends ReferenceConfig = ReferenceConfig > { protected abstract kind : ReferenceKind ; public constructor ( protected config ) { } public get source ( ) { return this . config . source ; } public get target ( ) { return this . config . target ; } public resolveType ( storage ) { return this . target . getType ( { storage , kind : this . kind } ) ; } public buildInstantiator ( storage ) { return this . target . getInstantiator ( { storage , kind : this . kind } ) ; } }