UNPKG

9.81 kBTypeScriptView Raw
1import ts from 'typescript';
2declare type TypedNode = ts.Node & {
3 readonly type?: ts.TypeNode;
4};
5declare type MaybeTypedNode = ts.Node & {
6 readonly type?: ts.TypeNode;
7};
8export declare function getTypeNode(node: TypedNode): ts.TypeNode;
9export declare function getTypeNode(node: MaybeTypedNode): ts.TypeNode | undefined;
10export declare function getTypeNodeOrThrow(node: MaybeTypedNode): ts.TypeNode;
11export declare function getContextualType(typeChecker: ts.TypeChecker, node: ts.Expression): ts.Type | undefined;
12export declare function getTypeFromTypeNode(typeChecker: ts.TypeChecker, typeNode: ts.TypeNode): ts.Type;
13export declare function getType(typeChecker: ts.TypeChecker, node: ts.Node): ts.Type;
14export declare function getConstraint(type: ts.Type): ts.Type | undefined;
15export declare function getTypeAtLocation(typeChecker: ts.TypeChecker, symbol: ts.Symbol, node: ts.Node): ts.Type;
16export declare function typeToTypeNode(typeChecker: ts.TypeChecker, type: ts.Type, node?: ts.Declaration): ts.TypeNode | undefined;
17export declare function typeToTypeNodeOrThrow(typeChecker: ts.TypeChecker, type: ts.Type, node?: ts.Declaration): ts.TypeNode;
18export declare function getSymbol(type: ts.Type): ts.Symbol | undefined;
19export declare function getAliasSymbol(type: ts.Type): ts.Symbol | undefined;
20export declare function getAliasTypeArguments(type: ts.Type): readonly ts.Type[] | undefined;
21export declare function getAliasTypeArgumentsArray(type: ts.Type): readonly ts.Type[];
22export declare function getSymbolOrThrow(type: ts.Type): ts.Symbol;
23export declare function getProperties(type: ts.Type): readonly ts.Symbol[];
24export declare function getConstructSignatures(type: ts.Type): readonly ts.Signature[];
25export declare function getProperty(type: ts.Type, name: string): ts.Symbol | undefined;
26export declare function getText(typeChecker: ts.TypeChecker, type: ts.Type, node?: ts.Node, flags?: ts.TypeFormatFlags): string;
27export declare function getBaseTypes(type: ts.Type): readonly ts.Type[] | undefined;
28export declare function getBaseTypesArray(type: ts.Type): readonly ts.Type[];
29export declare function getAllTypes(type: ts.Type): readonly ts.Type[];
30export declare function getTypes(type: ts.Type, isType: (type: ts.Type) => boolean): readonly ts.Type[];
31export declare function isSymbolic(type: ts.Type): boolean;
32export declare function isObjectType(type: ts.Type): type is ts.ObjectType;
33export declare function isTypeReference(type: ts.Type): type is ts.TypeReference;
34export declare function isTupleType(type: ts.Type): type is ts.TupleType;
35export declare function isTuple(type: ts.Type): type is ts.TupleTypeReference;
36export declare function hasTuple(type: ts.Type): boolean;
37export declare function getTupleTypes(type: ts.Type): readonly ts.Type[];
38export declare function getTupleElements(type: ts.Type): readonly ts.Type[] | undefined;
39export declare function getTypeArguments(type: ts.Type): readonly ts.Type[] | undefined;
40export declare function getTypeArgumentsArray(type: ts.Type): readonly ts.Type[];
41export declare function getTypeArgumentsOrThrow(type: ts.Type): readonly ts.Type[];
42export declare function isAny(type: ts.Type): boolean;
43export declare function isErrorType(type: ts.Type): boolean;
44export declare function isUnion(type: ts.Type): type is ts.UnionType;
45export declare function getUnionTypes(type: ts.Type): readonly ts.Type[] | undefined;
46export declare function getUnionTypesArray(type: ts.Type): readonly ts.Type[];
47export declare function isIntersection(type: ts.Type): type is ts.IntersectionType;
48export declare function getIntersectionTypes(type: ts.Type): readonly ts.Type[] | undefined;
49export declare function getIntersectionTypesArray(type: ts.Type): readonly ts.Type[];
50export declare function hasUnionType(type: ts.Type, isType: (type: ts.Type) => boolean): boolean;
51export declare function hasIntersectionType(type: ts.Type, isType: (type: ts.Type) => boolean): boolean;
52export declare function hasType(type: ts.Type, isType: (type: ts.Type) => boolean): boolean;
53export declare function isOnlyType(type: ts.Type, isType: (type: ts.Type) => boolean): boolean;
54export declare function isSame(a: ts.Type | undefined, b: ts.Type | undefined): boolean;
55export declare function isOnly(type: ts.Type): boolean;
56export declare function isNull(type: ts.Type): boolean;
57export declare function isOnlyNull(type: ts.Type): boolean;
58export declare function hasNull(type: ts.Type): boolean;
59export declare function isUndefined(type: ts.Type): boolean;
60export declare function isOnlyUndefined(type: ts.Type): boolean;
61export declare function hasUndefined(type: ts.Type): boolean;
62export declare function isUndefinedish(type: ts.Type): boolean;
63export declare function isOnlyUndefinedish(type: ts.Type): boolean;
64export declare function hasUndefinedish(type: ts.Type): boolean;
65export declare function isNullable(type: ts.Type): boolean;
66export declare function isNumber(type: ts.Type): boolean;
67export declare function isOnlyNumber(type: ts.Type): boolean;
68export declare function hasNumber(type: ts.Type): boolean;
69export declare function isNumberLike(type: ts.Type): boolean;
70export declare function isOnlyNumberLike(type: ts.Type): boolean;
71export declare function hasNumberLike(type: ts.Type): boolean;
72export declare function isNumberLiteral(type: ts.Type): boolean;
73export declare function isOnlyNumberLiteral(type: ts.Type): boolean;
74export declare function hasNumberLiteral(type: ts.Type): boolean;
75export declare function isNumberish(type: ts.Type): boolean;
76export declare function isOnlyNumberish(type: ts.Type): boolean;
77export declare function hasNumberish(type: ts.Type): boolean;
78export declare function isString(type: ts.Type): boolean;
79export declare function isOnlyString(type: ts.Type): boolean;
80export declare function hasString(type: ts.Type): boolean;
81export declare function isStringLike(type: ts.Type): boolean;
82export declare function isOnlyStringLike(type: ts.Type): boolean;
83export declare function hasStringLike(type: ts.Type): boolean;
84export declare function isStringLiteral(type: ts.Type): boolean;
85export declare function isOnlyStringLiteral(type: ts.Type): boolean;
86export declare function hasStringLiteral(type: ts.Type): boolean;
87export declare function isStringish(type: ts.Type): boolean;
88export declare function isOnlyStringish(type: ts.Type): boolean;
89export declare function hasStringish(type: ts.Type): boolean;
90export declare function isBoolean(type: ts.Type): boolean;
91export declare function isOnlyBoolean(type: ts.Type): boolean;
92export declare function hasBoolean(type: ts.Type): boolean;
93export declare function isBooleanLike(type: ts.Type): boolean;
94export declare function isOnlyBooleanLike(type: ts.Type): boolean;
95export declare function hasBooleanLike(type: ts.Type): boolean;
96export declare function isBooleanLiteral(type: ts.Type): boolean;
97export declare function isOnlyBooleanLiteral(type: ts.Type): boolean;
98export declare function hasBooleanLiteral(type: ts.Type): boolean;
99export declare function isBooleanFalse(type: ts.Type): boolean;
100export declare function isOnlyBooleanFalse(type: ts.Type): boolean;
101export declare function hasBooleanFalse(type: ts.Type): boolean;
102export declare function isBooleanish(type: ts.Type): boolean;
103export declare function isOnlyBooleanish(type: ts.Type): boolean;
104export declare function hasBooleanish(type: ts.Type): boolean;
105export declare function isSymbol(type: ts.Type): boolean;
106export declare function isOnlySymbol(type: ts.Type): boolean;
107export declare function hasSymbol(type: ts.Type): boolean;
108export declare function isSymbolLike(type: ts.Type): boolean;
109export declare function isOnlySymbolLike(type: ts.Type): boolean;
110export declare function hasSymbolLike(type: ts.Type): boolean;
111export declare function isSymbolish(type: ts.Type): boolean;
112export declare function isOnlySymbolish(type: ts.Type): boolean;
113export declare function hasSymbolish(type: ts.Type): boolean;
114export declare function isPrimitive(type: ts.Type): boolean;
115export declare function isOnlyPrimitive(type: ts.Type): boolean;
116export declare function hasPrimitive(type: ts.Type): boolean;
117export declare function isPrimitiveLike(type: ts.Type): boolean;
118export declare function isOnlyPrimitiveLike(type: ts.Type): boolean;
119export declare function hasPrimitiveLike(type: ts.Type): boolean;
120export declare function isPrimitiveish(type: ts.Type): boolean;
121export declare function isOnlyPrimitiveish(type: ts.Type): boolean;
122export declare function hasPrimitiveish(type: ts.Type): boolean;
123export declare function isOnlyObject(type: ts.Type): boolean;
124export declare function isArray(type: ts.Type): boolean;
125export declare function isOnlyArray(type: ts.Type): boolean;
126export declare function hasArray(type: ts.Type): boolean;
127export declare function isArrayish(type: ts.Type): boolean;
128export declare function isOnlyArrayish(type: ts.Type): boolean;
129export declare function hasArrayish(type: ts.Type): boolean;
130export declare function getArrayType(type: ts.Type): ts.Type | undefined;
131export declare function getArrayTypeOrThrow(type: ts.Type): ts.Type;
132export declare function getArrayTypes(type: ts.Type): readonly ts.Type[];
133export declare function isVoid(type: ts.Type): boolean;
134export declare function isOnlyVoid(type: ts.Type): boolean;
135export declare function hasVoid(type: ts.Type): boolean;
136export declare function isVoidish(type: ts.Type): boolean;
137export declare function isOnlyVoidish(type: ts.Type): boolean;
138export declare function hasVoidish(type: ts.Type): boolean;
139export declare function getCallSignatures(type: ts.Type): readonly ts.Signature[];
140export declare function getNonNullableType(type: ts.Type): ts.Type;
141export declare function filterUnion(checker: ts.TypeChecker, type: ts.Type, filter: (type: ts.Type) => boolean): ts.Type;
142export {};