import { FunctionInfo } from "./descriptions/function-type"; import { IndexInfo } from "./descriptions/IndexInfo"; import type { MetadataStore } from "./meta-stores"; import { ConstructorInfo, MethodInfo } from "./descriptions/methodInfo"; import { Decorator } from "./descriptions/decorator"; import { IndexedAccessType } from "./descriptions/indexed-access-type"; import { ConditionalType } from "./descriptions/conditional-type"; import { ConstructorImport } from "./descriptions/constructor-import"; import { PropertyInfo } from "./descriptions/propertyInfo"; import { EnumInfo } from "./descriptions/enum-info"; import { TypeKind } from "./enums"; export declare type TypeProvider = () => Type; export declare class LazyType { private resolvedType?; private readonly typeResolver; get type(): Type; constructor(type: Type | (() => Type)); } /** * Object representing TypeScript type in memory */ export declare class Type { static readonly Object: Type; static readonly Unknown: Type; static readonly Any: Type; static readonly Void: Type; static readonly String: Type; static readonly Number: Type; static readonly BigInt: Type; static readonly Boolean: Type; static readonly Date: Type; static readonly Null: Type; static readonly Undefined: Type; static readonly Never: Type; /** * Returns information about generic conditional type. */ get condition(): ConditionalType | undefined; /** * Returns information about indexed access type. */ get indexedAccessType(): IndexedAccessType | undefined; /** * List of underlying types in case Type is union or intersection */ get types(): ReadonlyArray; /** * Get meta for the module of the defined constructor * This data is not set when the config mode is set to "universal" */ get constructorDescription(): ConstructorImport | undefined; /** * Get definition of a generic type. */ get genericTypeDefinition(): Type | undefined; /** * Base type * @description Base type from which this type extends from or undefined if type is Object. */ get baseType(): Type | undefined; /** * Interface which this type implements */ get interface(): Type | undefined; /** * Get type full-name * @description Contains file path base to project root */ get fullName(): string; /** * Get type name */ get name(): string; /** * Get kind of type */ get kind(): TypeKind; /** * Underlying value in case of literal type */ get literalValue(): any; /** * Generic type constrains */ get genericTypeConstraint(): Type | undefined; /** * Generic type default value */ get genericTypeDefault(): any; /** * Search the type store for a specific type * * Runs the provided filter callback on each type. If your filter returns true, it returns this type. * * @param {(type: Type) => boolean} filter * @returns {Type | undefined} */ static find(filter: (type: Type) => boolean): Type | undefined; /** * Returns all Types contained in metadata. * This method is quite useless with reflection.metadata.type = "inline"; Use "typelib" type. */ static getTypes(): Type[]; static get store(): MetadataStore; /** * Returns true if types are equals * @param type */ is(type: Type): boolean; /** * Returns a value indicating whether the Type is container for unified Types or not */ isUnion(): boolean; /** * Returns a value indicating whether the Type is container for intersecting Types or not */ isIntersection(): boolean; /** * Returns true whether current Type is a class with any constructor. */ isInstantiable(): boolean; /** * Returns a value indicating whether the Type is a class or not */ isClass(): boolean; /** * Returns a value indicating whether the Type is a interface or not */ isInterface(): boolean; /** * Returns a value indicating whether the Type is an literal or not */ isLiteral(): boolean; /** * Returns a value indicating whether the Type is an object literal or not */ isObjectLiteral(): boolean; /** * Returns true if type is union or intersection of types */ isUnionOrIntersection(): boolean; /** * Check if this is a native type ("string", "number", "boolean", "Array" etc.) */ isNative(): boolean; /** * Check whether the type is generic. */ isGenericType(): boolean; /** * Check if this is a primitive type ("string", "number", "boolean" etc.) */ isPrimitive(): boolean; /** * Check if this type is a string */ isString(): boolean; /** * Check if this type is a number */ isNumber(): boolean; /** * Check if this type is a symbol */ isSymbol(): boolean; /** * Check if this type is a boolean */ isBoolean(): boolean; /** * Check if this type is an array */ isArray(): boolean; /** * Check if this type is a promise */ isPromise(): boolean; /** * Check if this type is a Tuple */ isTuple(): boolean; /** * Check if this type is an any */ isAny(): boolean; /** * Check if this type is a "unknown". */ isUnknown(): boolean; /** * Check if this type is a "undefined" literal. */ isUndefined(): boolean; /** * Check if this type is a "null" literal. */ isNull(): boolean; /** * Check if this type is a "true" literal. */ isTrue(): boolean; /** * Check if this type is a "false" literal. */ isFalse(): boolean; /** * * @return {boolean} */ isObjectLike(): boolean; /** * Determines whether the object represented by the current Type is an Enum. * @return {boolean} */ isEnum(): boolean; /** * Returns information about the enumerable elements. */ getEnum(): EnumInfo | undefined; /** * Constructor function in case Type is class */ getCtor(): Promise<{ new (...args: any[]): any; } | undefined>; /** * Returns array of function call signatures. */ getSignatures(): ReadonlyArray; /** * Returns array of type parameters. */ getTypeParameters(): ReadonlyArray; /** * Returns type arguments in case of generic type */ getTypeArguments(): ReadonlyArray; /** * Returns constructor description when Type is a class */ getConstructors(): ReadonlyArray | undefined; /** * Returns array of properties */ getProperties(): ReadonlyArray; /** * Returns array of indexes */ getIndexes(): ReadonlyArray; /** * Returns array of methods */ getMethods(): ReadonlyArray; /** * Returns array of decorators */ getDecorators(): ReadonlyArray; /** * Returns object with all methods and properties from current Type and all methods and properties inherited from base types and interfaces to this Type. * @return {{properties: {[p: string]: PropertyInfo}, methods: {[p: string]: MethodInfo}}} */ flattenInheritedMembers(): { properties: { [propertyName: string]: PropertyInfo; }; methods: { [methodName: string]: MethodInfo; }; }; /** * Determines whether the class represented by the current Type derives from the class represented by the specified Type * @param {Type} classType */ isSubclassOf(classType: Type): boolean; /** * Determines whether the current Type derives from the specified Type * @param {Type} targetType */ isDerivedFrom(targetType: Type): boolean; /** * Determines whether the Object represented by the current Type is structurally compatible and assignable to the Object represented by the specified Type * @param {Type} target * @return {boolean} * @private */ isStructurallyAssignableTo(target: Type): boolean; /** * Determines whether an instance of the current Type can be assigned to an instance of the specified Type. * @description This is fulfilled by derived types or compatible types. * @param target */ isAssignableTo(target: Type): boolean; /** * Returns string representation of the type. */ toString(): string; }