UNPKG

2.63 kBSource Map (JSON)View Raw
1{"version":3,"file":"reflection.js","sourceRoot":"","sources":["../../../../src/lib/models/types/reflection.ts"],"names":[],"mappings":";;AACA,yCAAkC;AASlC,MAAa,cAAe,SAAQ,eAAI;IAgBpC,YAAY,WAAkC;QAC1C,KAAK,EAAE,CAAC;QARH,SAAI,GAAW,YAAY,CAAC;QASjC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACnC,CAAC;IAOD,KAAK;QACD,OAAO,IAAI,cAAc,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAChD,CAAC;IAQD,MAAM,CAAC,IAAoB;QACvB,OAAO,IAAI,KAAK,IAAI,CAAC;IACzB,CAAC;IAMD,QAAQ;QACJ,MAAM,MAAM,GAAQ,KAAK,CAAC,QAAQ,EAAE,CAAC;QAErC,IAAI,IAAI,CAAC,WAAW,EAAE;YAClB,MAAM,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC;SACpD;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;IAKD,QAAQ;QACJ,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,IAAI,IAAI,CAAC,WAAW,CAAC,UAAU,EAAE;YAC3D,OAAO,UAAU,CAAC;SACrB;aAAM;YACH,OAAO,QAAQ,CAAC;SACnB;IACL,CAAC;CACJ;AAhED,wCAgEC","sourcesContent":["import { DeclarationReflection } from '../reflections/declaration';\nimport { Type } from './abstract';\n\n/**\n * Represents a type which has it's own reflection like literal types.\n *\n * ~~~\n * let value: {subValueA;subValueB;subValueC;};\n * ~~~\n */\nexport class ReflectionType extends Type {\n /**\n * The reflection of the type.\n */\n declaration: DeclarationReflection;\n\n /**\n * The type name identifier.\n */\n readonly type: string = 'reflection';\n\n /**\n * Create a new instance of ReflectionType.\n *\n * @param declaration The reflection of the type.\n */\n constructor(declaration: DeclarationReflection) {\n super();\n this.declaration = declaration;\n }\n\n /**\n * Clone this type.\n *\n * @return A clone of this type.\n */\n clone(): Type {\n return new ReflectionType(this.declaration);\n }\n\n /**\n * Test whether this type equals the given type.\n *\n * @param type The type that should be checked for equality.\n * @returns TRUE if the given type equals this type, FALSE otherwise.\n */\n equals(type: ReflectionType): boolean {\n return type === this;\n }\n\n /**\n * Return a raw object representation of this type.\n * @deprecated Use serializers instead\n */\n toObject(): any {\n const result: any = super.toObject();\n\n if (this.declaration) {\n result.declaration = this.declaration.toObject();\n }\n\n return result;\n }\n\n /**\n * Return a string representation of this type.\n */\n toString() {\n if (!this.declaration.children && this.declaration.signatures) {\n return 'function';\n } else {\n return 'object';\n }\n }\n}\n"]}
\No newline at end of file