@tslite/checker 1.9.0 → 1.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +55 -0
- package/NOTICE +14 -0
- package/dist/_namespaces/ts.d.ts +9 -0
- package/dist/_namespaces/ts.js +12 -0
- package/dist/_namespaces/ts.moduleSpecifiers.d.ts +1 -0
- package/dist/_namespaces/ts.moduleSpecifiers.js +2 -0
- package/dist/check.d.ts +75 -0
- package/dist/check.js +316 -0
- package/dist/checker.d.ts +5 -0
- package/dist/checker.js +20881 -0
- package/dist/index.d.ts +1 -1132
- package/dist/index.js +4 -1
- package/dist/moduleSpecifiers.d.ts +12 -0
- package/dist/moduleSpecifiers.js +104 -0
- package/dist/symbolWalker.d.ts +3 -0
- package/dist/symbolWalker.js +167 -0
- package/dist/types.d.ts +864 -0
- package/dist/types.js +355 -0
- package/dist/utilities.d.ts +34 -0
- package/dist/utilities.js +157 -0
- package/lib/lib.tslite.d.ts +56 -0
- package/package.json +28 -49
- package/dist/chunk-NXZILQOD.js +0 -1
- package/dist/index.cjs +0 -1
- package/dist/index.d.cts +0 -1132
- package/dist/types/index.cjs +0 -1
- package/dist/types/index.d.cts +0 -1135
- package/dist/types/index.d.ts +0 -1135
- package/dist/types/index.js +0 -1
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,864 @@
|
|
|
1
|
+
import { Map, SymbolFlags, SyntaxKind } from "./_namespaces/ts.js";
|
|
2
|
+
import type { AnyImportSyntax, ArrayTypeNode, BindingElement, CallLikeExpression, CommentDirective, CompilerOptions, ConditionalTypeNode, Declaration, DestructuringPattern, Diagnostic, DiagnosticWithLocation, EmitTextWriter, ExportSpecifier, Expression, Identifier, ImportCall, ImportDeclaration, ImportTypeNode, IndexSignatureDeclaration, JsxAttribute, JsxAttributeLike, JsxAttributes, JsxSpreadAttribute, MappedTypeNode, ModuleSpecifierResolutionHost, Node, NodeArray, ObjectLiteralElementLike, ObjectLiteralExpression, ParameterDeclaration, PropertyAccessExpression, PseudoBigInt, QualifiedName, SignatureDeclaration, SourceFile, Symbol, SymbolTable, SymbolTracker, TupleTypeNode, TypeNode, TypeOnlyCompatibleAliasDeclaration, TypeParameterDeclaration, TypeReferenceNode, __String } from "./_namespaces/ts.js";
|
|
3
|
+
declare module "@tslite/parser" {
|
|
4
|
+
interface Node {
|
|
5
|
+
contextualType?: Type;
|
|
6
|
+
inferenceContext?: InferenceContext;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export declare enum JsxFlags {
|
|
10
|
+
None = 0,
|
|
11
|
+
/** An element from a named property of the JSX.IntrinsicElements interface */
|
|
12
|
+
IntrinsicNamedElement = 1,
|
|
13
|
+
/** An element inferred from the string index signature of the JSX.IntrinsicElements interface */
|
|
14
|
+
IntrinsicIndexedElement = 2,
|
|
15
|
+
IntrinsicElement = 3
|
|
16
|
+
}
|
|
17
|
+
export declare enum RelationComparisonResult {
|
|
18
|
+
None = 0,
|
|
19
|
+
Succeeded = 1,// Should be truthy
|
|
20
|
+
Failed = 2,
|
|
21
|
+
Reported = 4,
|
|
22
|
+
ReportsUnmeasurable = 8,
|
|
23
|
+
ReportsUnreliable = 16,
|
|
24
|
+
ReportsMask = 24
|
|
25
|
+
}
|
|
26
|
+
export interface SyntheticExpression extends Expression {
|
|
27
|
+
kind: SyntaxKind.SyntheticExpression;
|
|
28
|
+
isSpread: boolean;
|
|
29
|
+
type: Type;
|
|
30
|
+
}
|
|
31
|
+
export type FlowType = Type | IncompleteType;
|
|
32
|
+
export interface IncompleteType {
|
|
33
|
+
flags: TypeFlags;
|
|
34
|
+
type: Type;
|
|
35
|
+
}
|
|
36
|
+
export declare class OperationCanceledException {
|
|
37
|
+
}
|
|
38
|
+
export interface CancellationToken {
|
|
39
|
+
isCancellationRequested(): boolean;
|
|
40
|
+
/** @throws OperationCanceledException if isCancellationRequested is true */
|
|
41
|
+
throwIfCancellationRequested(): void;
|
|
42
|
+
}
|
|
43
|
+
export interface TypeCheckerHost extends ModuleSpecifierResolutionHost {
|
|
44
|
+
getCompilerOptions(): CompilerOptions;
|
|
45
|
+
getSourceFiles(): readonly SourceFile[];
|
|
46
|
+
getSourceFile(fileName: string): SourceFile | undefined;
|
|
47
|
+
}
|
|
48
|
+
export interface TypeChecker {
|
|
49
|
+
getPropertiesOfType(type: Type): Symbol[];
|
|
50
|
+
getSignaturesOfType(type: Type): readonly Signature[];
|
|
51
|
+
getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[];
|
|
52
|
+
getSymbolAtLocation(node: Node): Symbol | undefined;
|
|
53
|
+
getTypeAtLocation(node: Node): Type;
|
|
54
|
+
typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string;
|
|
55
|
+
symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): string;
|
|
56
|
+
getAugmentedPropertiesOfType(type: Type): Symbol[];
|
|
57
|
+
getContextualType(node: Expression, contextFlags?: ContextFlags): Type | undefined;
|
|
58
|
+
isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName | ImportTypeNode, propertyName: string): boolean;
|
|
59
|
+
isTypeAssignableTo(source: Type, target: Type): boolean;
|
|
60
|
+
getTypeOfSymbolAtLocation(symbol: Symbol, location: Node): Type;
|
|
61
|
+
getPropertyOfType(type: Type, propertyName: string): Symbol | undefined;
|
|
62
|
+
getIndexTypeOfType(type: Type, kind: IndexKind): Type | undefined;
|
|
63
|
+
/** O tipo que a promise entrega: o argumento do `Promise<T>`, ou o valor do `then` de um thenable. */
|
|
64
|
+
getPromisedTypeOfPromise(promise: Type): Type | undefined;
|
|
65
|
+
isNullableType(type: Type): boolean;
|
|
66
|
+
getNonNullableType(type: Type): Type;
|
|
67
|
+
/** O tipo sem o `undefined` que marca o membro opcional. */
|
|
68
|
+
getNonOptionalType(type: Type): Type;
|
|
69
|
+
getTypeArguments(type: TypeReference): readonly Type[];
|
|
70
|
+
getBaseConstraintOfType(type: Type): Type | undefined;
|
|
71
|
+
getDefaultFromTypeParameter(type: Type): Type | undefined;
|
|
72
|
+
getReturnTypeOfSignature(signature: Signature): Type;
|
|
73
|
+
getStringType(): Type;
|
|
74
|
+
getNumberType(): Type;
|
|
75
|
+
getBooleanType(): Type;
|
|
76
|
+
isUndefinedSymbol(symbol: Symbol): boolean;
|
|
77
|
+
getMergedSymbol(symbol: Symbol): Symbol;
|
|
78
|
+
getDeclaredTypeOfSymbol(symbol: Symbol): Type;
|
|
79
|
+
getTypeFromTypeNode(node: TypeNode): Type;
|
|
80
|
+
getParameterType(signature: Signature, parameterIndex: number): Type;
|
|
81
|
+
symbolToTypeParameterDeclarations(symbol: Symbol, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): NodeArray<TypeParameterDeclaration> | undefined;
|
|
82
|
+
typeParameterToDeclaration(parameter: TypeParameter, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): TypeParameterDeclaration | undefined;
|
|
83
|
+
/** Na tag, também o `kind`, que imprimia a construct signature (CK-02). */
|
|
84
|
+
writeSignature(signature: Signature, enclosingDeclaration?: Node, flags?: TypeFormatFlags, writer?: EmitTextWriter): string;
|
|
85
|
+
writeType(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags, writer?: EmitTextWriter): string;
|
|
86
|
+
writeSymbol(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags, writer?: EmitTextWriter): string;
|
|
87
|
+
getRootSymbols(symbol: Symbol): readonly Symbol[];
|
|
88
|
+
getContextualTypeForArgumentAtIndex(call: CallLikeExpression, argIndex: number): Type | undefined;
|
|
89
|
+
getContextualTypeForJsxAttribute(attribute: JsxAttribute | JsxSpreadAttribute): Type | undefined;
|
|
90
|
+
getResolvedSignature(node: CallLikeExpression, candidatesOutArray?: Signature[], argumentCount?: number): Signature | undefined;
|
|
91
|
+
isValidPropertyAccessForCompletions(node: PropertyAccessExpression | ImportTypeNode | QualifiedName, type: Type, property: Symbol): boolean;
|
|
92
|
+
getSignatureFromDeclaration(declaration: SignatureDeclaration): Signature | undefined;
|
|
93
|
+
getImmediateAliasedSymbol(symbol: Symbol): Symbol | undefined;
|
|
94
|
+
getAliasedSymbol(symbol: Symbol): Symbol;
|
|
95
|
+
getExportsOfModule(moduleSymbol: Symbol): Symbol[];
|
|
96
|
+
getExportsAndPropertiesOfModule(moduleSymbol: Symbol): Symbol[];
|
|
97
|
+
getJsxIntrinsicTagNamesAt(location: Node): Symbol[];
|
|
98
|
+
tryGetMemberInModuleExports(memberName: string, moduleSymbol: Symbol): Symbol | undefined;
|
|
99
|
+
/** Como o `tryGetMemberInModuleExports`. Na tag, também a propriedade do valor do `export =` (CK-03). */
|
|
100
|
+
tryGetMemberInModuleExportsAndProperties(memberName: string, moduleSymbol: Symbol): Symbol | undefined;
|
|
101
|
+
getUnionType(types: Type[], subtypeReduction?: UnionReduction): Type;
|
|
102
|
+
isArrayLikeType(type: Type): boolean;
|
|
103
|
+
isTypeInvalidDueToUnionDiscriminant(contextualType: Type, obj: ObjectLiteralExpression | JsxAttributes): boolean;
|
|
104
|
+
getAllPossiblePropertiesOfTypes(type: readonly Type[]): Symbol[];
|
|
105
|
+
/**
|
|
106
|
+
* @param useOnlyExternalAliasing sem ele, qualquer alias em escopo dá o nome; com ele, nenhum. Na tag, com ele, só o
|
|
107
|
+
* alias do `import x = require()`, que saiu (CK-03).
|
|
108
|
+
*/
|
|
109
|
+
getAccessibleSymbolChain(symbol: Symbol, enclosingDeclaration: Node | undefined, meaning: SymbolFlags, useOnlyExternalAliasing: boolean): Symbol[] | undefined;
|
|
110
|
+
getTypeArgumentConstraint(node: TypeNode): Type | undefined;
|
|
111
|
+
runWithCancellationToken<T>(token: CancellationToken, cb: (checker: TypeChecker) => T): T;
|
|
112
|
+
/** O valor a que o nome de uma propriedade abreviada (`{ x }`) se refere: o símbolo local, e não a propriedade. */
|
|
113
|
+
getShorthandAssignmentValueSymbol(location: Node): Symbol | undefined;
|
|
114
|
+
/** O alvo de um export specifier, sem seguir os aliases. */
|
|
115
|
+
getExportSpecifierLocalTargetSymbol(location: ExportSpecifier): Symbol | undefined;
|
|
116
|
+
/** A propriedade a que o nome de uma atribuição por desestruturação corresponde. */
|
|
117
|
+
getPropertySymbolOfDestructuringAssignment(location: Identifier): Symbol | undefined;
|
|
118
|
+
/** O nome do símbolo com os contêineres dele: o `N.x` de um membro de namespace. */
|
|
119
|
+
getFullyQualifiedName(symbol: Symbol): string;
|
|
120
|
+
/** Se o símbolo é o que o checker dá ao nome que não resolve. */
|
|
121
|
+
isUnknownSymbol(symbol: Symbol): boolean;
|
|
122
|
+
getIndexInfoOfType(type: Type, kind: IndexKind): IndexInfo | undefined;
|
|
123
|
+
/** Se a declaração é visível de fora do lugar em que está: exportada, ou no escopo global. */
|
|
124
|
+
isDeclarationVisible(node: Declaration | AnyImportSyntax): boolean;
|
|
125
|
+
/**
|
|
126
|
+
* O `getResolvedSignature` do signature help: a vírgula final da chamada conta como mais um argumento, e só servem os
|
|
127
|
+
* overloads que o aceitam.
|
|
128
|
+
*/
|
|
129
|
+
getResolvedSignatureForSignatureHelp(node: CallLikeExpression, candidatesOutArray?: Signature[], argumentCount?: number): Signature | undefined;
|
|
130
|
+
symbolToParameterDeclaration(symbol: Symbol, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): ParameterDeclaration | undefined;
|
|
131
|
+
/** Na tag, também o predicado do `this` (CK-02). */
|
|
132
|
+
writeTypePredicate(predicate: TypePredicate, enclosingDeclaration?: Node, flags?: TypeFormatFlags, writer?: EmitTextWriter): string;
|
|
133
|
+
/** Os parâmetros da assinatura, com o rest de tupla aberto em um parâmetro por elemento. */
|
|
134
|
+
getExpandedParameters(sig: Signature): readonly Symbol[];
|
|
135
|
+
hasEffectiveRestParameter(sig: Signature): boolean;
|
|
136
|
+
isOptionalParameter(node: ParameterDeclaration): boolean;
|
|
137
|
+
getTypePredicateOfSignature(signature: Signature): TypePredicate | undefined;
|
|
138
|
+
/** Os parâmetros de tipo do alias. Na tag, também os da classe e os da interface (CK-02, CK-48). */
|
|
139
|
+
getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol: Symbol): readonly TypeParameter[] | undefined;
|
|
140
|
+
typeToTypeNode(type: Type, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): TypeNode | undefined;
|
|
141
|
+
typeToTypeNode(type: Type, enclosingDeclaration: Node | undefined, flags: NodeBuilderFlags | undefined, tracker?: SymbolTracker): TypeNode | undefined;
|
|
142
|
+
/** Na tag, também os aliases a tornar visíveis, que o declaration emit calculava (CK-03, P03). */
|
|
143
|
+
isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node | undefined, meaning: SymbolFlags): SymbolAccessibilityResult;
|
|
144
|
+
getTypeOfPropertyOfType(type: Type, propertyName: string): Type | undefined;
|
|
145
|
+
getBaseTypeOfLiteralType(type: Type): Type;
|
|
146
|
+
getWidenedType(type: Type): Type;
|
|
147
|
+
getAnyType(): Type;
|
|
148
|
+
getVoidType(): Type;
|
|
149
|
+
getUndefinedType(): Type;
|
|
150
|
+
createArrayType(elementType: Type): Type;
|
|
151
|
+
getElementTypeOfArrayType(arrayType: Type): Type | undefined;
|
|
152
|
+
createPromiseType(type: Type): Type;
|
|
153
|
+
/** Na tag, também as construct signatures (CK-02). */
|
|
154
|
+
createAnonymousType(symbol: Symbol | undefined, members: SymbolTable, callSignatures: Signature[], stringIndexInfo: IndexInfo | undefined, numberIndexInfo: IndexInfo | undefined): Type;
|
|
155
|
+
/** Na tag, também o parâmetro `this` (CK-02). */
|
|
156
|
+
createSignature(declaration: SignatureDeclaration, typeParameters: TypeParameter[] | undefined, parameters: Symbol[], resolvedReturnType: Type, typePredicate: TypePredicate | undefined, minArgumentCount: number, flags: SignatureFlags): Signature;
|
|
157
|
+
createSymbol(flags: SymbolFlags, name: __String): TransientSymbol;
|
|
158
|
+
createIndexInfo(type: Type, isReadonly: boolean, declaration?: SignatureDeclaration): IndexInfo;
|
|
159
|
+
/** Na tag, o nome podia ser também um `#private` (CK-02). */
|
|
160
|
+
getSuggestedSymbolForNonexistentProperty(name: Identifier | string, containingType: Type): Symbol | undefined;
|
|
161
|
+
getSuggestedSymbolForNonexistentSymbol(location: Node, name: string, meaning: SymbolFlags): Symbol | undefined;
|
|
162
|
+
getSuggestedSymbolForNonexistentModule(node: Identifier, target: Symbol): Symbol | undefined;
|
|
163
|
+
/** O símbolo que o nome alcança a partir do lugar, com o significado pedido; com o `excludeGlobals`, sem os globais. */
|
|
164
|
+
resolveName(name: string, location: Node | undefined, meaning: SymbolFlags, excludeGlobals: boolean): Symbol | undefined;
|
|
165
|
+
isArrayType(type: Type): boolean;
|
|
166
|
+
isTupleType(type: Type): boolean;
|
|
167
|
+
/** Na tag, também o método de um object literal (CK-02). */
|
|
168
|
+
isContextSensitive(node: Expression | ObjectLiteralElementLike | JsxAttributeLike): boolean;
|
|
169
|
+
getSymbolWalker(accept?: (symbol: Symbol) => boolean): SymbolWalker;
|
|
170
|
+
/**
|
|
171
|
+
* O tipo está adiado por um parâmetro de tipo que não foi instanciado: o próprio parâmetro, o acesso indexado e o
|
|
172
|
+
* conditional sobre ele, e o mapped sobre um `keyof` genérico; a união e a interseção, quando um membro está. O
|
|
173
|
+
* `keyof T` não está: é um tipo primitivo, e não objeto.
|
|
174
|
+
*/
|
|
175
|
+
isGenericObjectType(type: Type): boolean;
|
|
176
|
+
/**
|
|
177
|
+
* O tipo `source` é comparável ao `target`: a relação da igualdade (o TS2367), do `case` contra o `switch` e da
|
|
178
|
+
* asserção (o TS2352), que pergunta se os dois podem ser o mesmo valor, e não se um cabe no outro. A relação simples
|
|
179
|
+
* (o primitivo, o literal, o `any`, o `unknown`) vale nos dois sentidos, e a estrutural, não: o objeto com mais
|
|
180
|
+
* propriedades é comparável ao que tem menos, e não o contrário. A igualdade aceita os dois quando um dos sentidos
|
|
181
|
+
* aceita. O literal não se alarga: o `as` alarga o da expressão antes de perguntar.
|
|
182
|
+
*/
|
|
183
|
+
isTypeComparableTo(source: Type, target: Type): boolean;
|
|
184
|
+
getDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[];
|
|
185
|
+
getGlobalDiagnostics(): Diagnostic[];
|
|
186
|
+
/**
|
|
187
|
+
* Does *not* get *all* suggestion diagnostics, just the ones that were convenient to report in the checker.
|
|
188
|
+
* Others are added in computeSuggestionDiagnostics.
|
|
189
|
+
*/
|
|
190
|
+
getSuggestionDiagnostics(file: SourceFile, cancellationToken?: CancellationToken): readonly DiagnosticWithLocation[];
|
|
191
|
+
}
|
|
192
|
+
export interface SymbolWalker {
|
|
193
|
+
/** Note: Return values are not ordered. */
|
|
194
|
+
walkType(root: Type): {
|
|
195
|
+
visitedTypes: readonly Type[];
|
|
196
|
+
visitedSymbols: readonly Symbol[];
|
|
197
|
+
};
|
|
198
|
+
/** Note: Return values are not ordered. */
|
|
199
|
+
walkSymbol(root: Symbol): {
|
|
200
|
+
visitedTypes: readonly Type[];
|
|
201
|
+
visitedSymbols: readonly Symbol[];
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
export declare enum UnionReduction {
|
|
205
|
+
None = 0,
|
|
206
|
+
Literal = 1,
|
|
207
|
+
Subtype = 2
|
|
208
|
+
}
|
|
209
|
+
export declare enum ContextFlags {
|
|
210
|
+
None = 0,
|
|
211
|
+
Signature = 1,// Obtaining contextual signature
|
|
212
|
+
NoConstraints = 2,// Don't obtain type variable constraints
|
|
213
|
+
Completions = 4
|
|
214
|
+
}
|
|
215
|
+
export declare enum NodeBuilderFlags {
|
|
216
|
+
None = 0,
|
|
217
|
+
NoTruncation = 1,// Don't truncate result
|
|
218
|
+
WriteArrayAsGenericType = 2,// Write Array<T> instead T[]
|
|
219
|
+
GenerateNamesForShadowedTypeParams = 4,// When a type parameter T is shadowing another T, generate a name for it so it can still be referenced
|
|
220
|
+
UseStructuralFallback = 8,// When an alias cannot be named by its symbol, rather than report an error, fallback to a structural printout if possible
|
|
221
|
+
ForbidIndexedAccessSymbolReferences = 16,// Forbid references like `I["a"]["b"]` - print `typeof I.a<x>.b<y>` instead
|
|
222
|
+
WriteTypeArgumentsOfSignature = 32,// Write the type arguments instead of type parameters of the signature
|
|
223
|
+
UseFullyQualifiedType = 64,// Write out the fully qualified type name (eg. Module.Type, instead of Type)
|
|
224
|
+
UseOnlyExternalAliasing = 128,// Only use external aliases for a symbol
|
|
225
|
+
SuppressAnyReturnType = 256,// If the return type is any-like, don't offer a return type.
|
|
226
|
+
WriteTypeParametersInQualifiedName = 512,
|
|
227
|
+
MultilineObjectLiterals = 1024,// Always write object literals across multiple lines
|
|
228
|
+
UseTypeOfFunction = 4096,// Build using typeof instead of function type literal
|
|
229
|
+
OmitParameterModifiers = 8192,// Omit modifiers on parameters
|
|
230
|
+
UseAliasDefinedOutsideCurrentScope = 16384,// Allow non-visible aliases
|
|
231
|
+
UseSingleQuotesForStringLiteralType = 268435456,// Use single quotes for string literal type
|
|
232
|
+
NoTypeReduction = 536870912,// Don't call getReducedType
|
|
233
|
+
AllowQualifedNameInPlaceOfIdentifier = 65536,
|
|
234
|
+
AllowAnonymousIdentifier = 131072,
|
|
235
|
+
AllowEmptyUnionOrIntersection = 262144,
|
|
236
|
+
AllowEmptyTuple = 524288,
|
|
237
|
+
AllowUniqueESSymbolType = 1048576,
|
|
238
|
+
AllowEmptyIndexInfoType = 2097152,
|
|
239
|
+
AllowNodeModulesRelativePaths = 67108864,
|
|
240
|
+
DoNotIncludeSymbolChain = 134217728,// Skip looking up and printing an accessible symbol chain
|
|
241
|
+
IgnoreErrors = 70189056,
|
|
242
|
+
InTypeAlias = 8388608,// Writing type in type alias declaration
|
|
243
|
+
InInitialEntityName = 16777216,// Set when writing the LHS of an entity name or entity name expression
|
|
244
|
+
InReverseMappedType = 33554432
|
|
245
|
+
}
|
|
246
|
+
export declare enum TypeFormatFlags {
|
|
247
|
+
None = 0,
|
|
248
|
+
NoTruncation = 1,// Don't truncate typeToString result
|
|
249
|
+
WriteArrayAsGenericType = 2,// Write Array<T> instead T[]
|
|
250
|
+
UseStructuralFallback = 8,// When an alias cannot be named by its symbol, rather than report an error, fallback to a structural printout if possible
|
|
251
|
+
WriteTypeArgumentsOfSignature = 32,// Write the type arguments instead of type parameters of the signature
|
|
252
|
+
UseFullyQualifiedType = 64,// Write out the fully qualified type name (eg. Module.Type, instead of Type)
|
|
253
|
+
SuppressAnyReturnType = 256,// If the return type is any-like, don't offer a return type.
|
|
254
|
+
MultilineObjectLiterals = 1024,// Always print object literals across multiple lines (only used to map into node builder flags)
|
|
255
|
+
UseTypeOfFunction = 4096,// Write typeof instead of function type literal
|
|
256
|
+
OmitParameterModifiers = 8192,// Omit modifiers on parameters
|
|
257
|
+
UseAliasDefinedOutsideCurrentScope = 16384,// For a `type T = ... ` defined in a different file, write `T` instead of its value, even though `T` can't be accessed in the current scope.
|
|
258
|
+
UseSingleQuotesForStringLiteralType = 268435456,// Use single quotes for string literal type
|
|
259
|
+
NoTypeReduction = 536870912,// Don't call getReducedType
|
|
260
|
+
AllowUniqueESSymbolType = 1048576,// This is bit 20 to align with the same bit in `NodeBuilderFlags`
|
|
261
|
+
AddUndefined = 131072,// Add undefined to types of initialized, non-optional parameters
|
|
262
|
+
WriteArrowStyleSignature = 262144,// Write arrow style signature
|
|
263
|
+
InArrayType = 524288,// Writing an array element type
|
|
264
|
+
InElementType = 2097152,// Writing an array or union element type
|
|
265
|
+
InFirstTypeArgument = 4194304,// Writing first type argument of the instantiated type
|
|
266
|
+
InTypeAlias = 8388608,// Writing type in type alias declaration
|
|
267
|
+
/** @deprecated */ WriteOwnNameForAnyLike = 0,// Does nothing
|
|
268
|
+
NodeBuilderFlagsMask = 814773611
|
|
269
|
+
}
|
|
270
|
+
export declare enum SymbolFormatFlags {
|
|
271
|
+
None = 0,
|
|
272
|
+
WriteTypeParametersOrArguments = 1,
|
|
273
|
+
UseOnlyExternalAliasing = 2,
|
|
274
|
+
AllowAnyNodeKind = 4,
|
|
275
|
+
UseAliasDefinedOutsideCurrentScope = 8,
|
|
276
|
+
DoNotIncludeSymbolChain = 16
|
|
277
|
+
}
|
|
278
|
+
export declare enum SymbolAccessibility {
|
|
279
|
+
Accessible = 0,
|
|
280
|
+
NotAccessible = 1,
|
|
281
|
+
CannotBeNamed = 2
|
|
282
|
+
}
|
|
283
|
+
export declare enum TypePredicateKind {
|
|
284
|
+
Identifier = 0,
|
|
285
|
+
AssertsIdentifier = 1
|
|
286
|
+
}
|
|
287
|
+
export interface TypePredicateBase {
|
|
288
|
+
kind: TypePredicateKind;
|
|
289
|
+
type: Type | undefined;
|
|
290
|
+
}
|
|
291
|
+
export interface IdentifierTypePredicate extends TypePredicateBase {
|
|
292
|
+
kind: TypePredicateKind.Identifier;
|
|
293
|
+
parameterName: string;
|
|
294
|
+
parameterIndex: number;
|
|
295
|
+
type: Type;
|
|
296
|
+
}
|
|
297
|
+
export interface AssertsIdentifierTypePredicate extends TypePredicateBase {
|
|
298
|
+
kind: TypePredicateKind.AssertsIdentifier;
|
|
299
|
+
parameterName: string;
|
|
300
|
+
parameterIndex: number;
|
|
301
|
+
type: Type | undefined;
|
|
302
|
+
}
|
|
303
|
+
export type TypePredicate = IdentifierTypePredicate | AssertsIdentifierTypePredicate;
|
|
304
|
+
export interface SymbolVisibilityResult {
|
|
305
|
+
accessibility: SymbolAccessibility;
|
|
306
|
+
}
|
|
307
|
+
export interface SymbolAccessibilityResult extends SymbolVisibilityResult {
|
|
308
|
+
}
|
|
309
|
+
export interface SymbolLinks {
|
|
310
|
+
immediateTarget?: Symbol;
|
|
311
|
+
target?: Symbol;
|
|
312
|
+
type?: Type;
|
|
313
|
+
nameType?: Type;
|
|
314
|
+
declaredType?: Type;
|
|
315
|
+
typeParameters?: TypeParameter[];
|
|
316
|
+
outerTypeParameters?: TypeParameter[];
|
|
317
|
+
instantiations?: Map<Type>;
|
|
318
|
+
inferredClassSymbol?: Map<TransientSymbol>;
|
|
319
|
+
mapper?: TypeMapper;
|
|
320
|
+
containingType?: UnionOrIntersectionType;
|
|
321
|
+
leftSpread?: Symbol;
|
|
322
|
+
rightSpread?: Symbol;
|
|
323
|
+
syntheticOrigin?: Symbol;
|
|
324
|
+
isDiscriminantProperty?: boolean;
|
|
325
|
+
resolvedExports?: SymbolTable;
|
|
326
|
+
resolvedMembers?: SymbolTable;
|
|
327
|
+
exportsChecked?: boolean;
|
|
328
|
+
isDeclarationWithCollidingName?: boolean;
|
|
329
|
+
bindingElement?: BindingElement;
|
|
330
|
+
exportsSomeValue?: boolean;
|
|
331
|
+
originatingImport?: ImportDeclaration | ImportCall;
|
|
332
|
+
lateSymbol?: Symbol;
|
|
333
|
+
specifierCache?: Map<string>;
|
|
334
|
+
extendedContainers?: Symbol[];
|
|
335
|
+
extendedContainersByFile?: Map<Symbol[]>;
|
|
336
|
+
variances?: VarianceFlags[];
|
|
337
|
+
deferralConstituents?: Type[];
|
|
338
|
+
deferralParent?: Type;
|
|
339
|
+
cjsExportMerged?: Symbol;
|
|
340
|
+
typeOnlyDeclaration?: TypeOnlyCompatibleAliasDeclaration | false;
|
|
341
|
+
}
|
|
342
|
+
export declare enum CheckFlags {
|
|
343
|
+
None = 0,
|
|
344
|
+
Instantiated = 1,// Instantiated symbol
|
|
345
|
+
SyntheticProperty = 2,// Property in union or intersection type
|
|
346
|
+
SyntheticMethod = 4,// Method in union or intersection type
|
|
347
|
+
Readonly = 8,// Readonly transient symbol
|
|
348
|
+
ReadPartial = 16,// Synthetic property present in some but not all constituents
|
|
349
|
+
WritePartial = 32,// Synthetic property present in some but only satisfied by an index signature in others
|
|
350
|
+
HasNonUniformType = 64,// Synthetic property with non-uniform type in constituents
|
|
351
|
+
HasLiteralType = 128,// Synthetic property with at least one literal type in constituents
|
|
352
|
+
Late = 4096,// Late-bound symbol for a computed property with a dynamic name
|
|
353
|
+
ReverseMapped = 8192,// Property of reverse-inferred homomorphic mapped type
|
|
354
|
+
OptionalParameter = 16384,// Optional parameter
|
|
355
|
+
RestParameter = 32768,// Rest parameter
|
|
356
|
+
DeferredType = 65536,// Calculation of the type of this symbol is deferred due to processing costs, should be fetched with `getTypeOfSymbolWithDeferredType`
|
|
357
|
+
HasNeverType = 131072,// Synthetic property with at least one never type in constituents
|
|
358
|
+
Mapped = 262144,// Property of mapped type
|
|
359
|
+
StripOptional = 524288,// Strip optionality in mapped property
|
|
360
|
+
Synthetic = 6,
|
|
361
|
+
Discriminant = 192,
|
|
362
|
+
Partial = 48
|
|
363
|
+
}
|
|
364
|
+
export interface TransientSymbol extends Symbol, SymbolLinks {
|
|
365
|
+
checkFlags: CheckFlags;
|
|
366
|
+
}
|
|
367
|
+
export interface MappedSymbol extends TransientSymbol {
|
|
368
|
+
mappedType: MappedType;
|
|
369
|
+
mapper: TypeMapper;
|
|
370
|
+
}
|
|
371
|
+
export interface ReverseMappedSymbol extends TransientSymbol {
|
|
372
|
+
propertyType: Type;
|
|
373
|
+
mappedType: MappedType;
|
|
374
|
+
constraintType: IndexType;
|
|
375
|
+
}
|
|
376
|
+
export declare enum NodeCheckFlags {
|
|
377
|
+
None = 0,
|
|
378
|
+
TypeChecked = 1,// Node has been type checked
|
|
379
|
+
CaptureNewTarget = 8,// Lexical 'new.target' used in body
|
|
380
|
+
ContextChecked = 1024,// Contextual types have been assigned
|
|
381
|
+
CaptureArguments = 8192,// Lexical 'arguments' used in body
|
|
382
|
+
LoopWithCapturedBlockScopedBinding = 65536,// Loop that contains block scoped variable captured in closure
|
|
383
|
+
ContainsCapturedBlockScopeBinding = 131072,// Part of a loop that contains block scoped variable captured in closure
|
|
384
|
+
CapturedBlockScopedBinding = 262144,// Block-scoped binding that is captured in some function
|
|
385
|
+
BlockScopedBindingInLoop = 524288,// Block-scoped binding with declaration nested inside iteration statement
|
|
386
|
+
NeedsLoopOutParameter = 4194304,// Block scoped binding whose value should be explicitly copied outside of the converted loop
|
|
387
|
+
AssignmentsMarked = 8388608
|
|
388
|
+
}
|
|
389
|
+
export interface NodeLinks {
|
|
390
|
+
flags: NodeCheckFlags;
|
|
391
|
+
resolvedType?: Type;
|
|
392
|
+
resolvedSignature?: Signature;
|
|
393
|
+
resolvedSymbol?: Symbol;
|
|
394
|
+
resolvedIndexInfo?: IndexInfo;
|
|
395
|
+
effectsSignature?: Signature;
|
|
396
|
+
isVisible?: boolean;
|
|
397
|
+
containsArgumentsReference?: boolean;
|
|
398
|
+
hasReportedStatementInAmbientContext?: boolean;
|
|
399
|
+
jsxFlags: JsxFlags;
|
|
400
|
+
resolvedJsxElementAttributesType?: Type;
|
|
401
|
+
resolvedJsxElementAllAttributesType?: Type;
|
|
402
|
+
switchTypes?: Type[];
|
|
403
|
+
contextFreeType?: Type;
|
|
404
|
+
deferredNodes?: Map<Node>;
|
|
405
|
+
capturedBlockScopeBindings?: Symbol[];
|
|
406
|
+
outerTypeParameters?: TypeParameter[];
|
|
407
|
+
instantiations?: Map<Type>;
|
|
408
|
+
isExhaustive?: boolean;
|
|
409
|
+
skipDirectInference?: true;
|
|
410
|
+
}
|
|
411
|
+
export declare enum TypeFlags {
|
|
412
|
+
None = 0,
|
|
413
|
+
Any = 1,
|
|
414
|
+
Unknown = 2,
|
|
415
|
+
String = 4,
|
|
416
|
+
Number = 8,
|
|
417
|
+
Boolean = 16,
|
|
418
|
+
BigInt = 64,
|
|
419
|
+
StringLiteral = 128,
|
|
420
|
+
NumberLiteral = 256,
|
|
421
|
+
BooleanLiteral = 512,
|
|
422
|
+
BigIntLiteral = 2048,
|
|
423
|
+
ESSymbol = 4096,// Type of symbol primitive introduced in ES6
|
|
424
|
+
Void = 16384,
|
|
425
|
+
Undefined = 32768,
|
|
426
|
+
Null = 65536,
|
|
427
|
+
Never = 131072,// Never type
|
|
428
|
+
TypeParameter = 262144,// Type parameter
|
|
429
|
+
Object = 524288,// Object type
|
|
430
|
+
Union = 1048576,// Union (T | U)
|
|
431
|
+
Intersection = 2097152,// Intersection (T & U)
|
|
432
|
+
Index = 4194304,// keyof T
|
|
433
|
+
IndexedAccess = 8388608,// T[K]
|
|
434
|
+
Conditional = 16777216,// T extends U ? X : Y
|
|
435
|
+
Substitution = 33554432,// Type parameter substitution
|
|
436
|
+
NonPrimitive = 67108864,// intrinsic object type
|
|
437
|
+
AnyOrUnknown = 3,
|
|
438
|
+
Nullable = 98304,
|
|
439
|
+
Literal = 2944,
|
|
440
|
+
Unit = 101248,
|
|
441
|
+
StringOrNumberLiteral = 384,
|
|
442
|
+
DefinitelyFalsy = 117632,
|
|
443
|
+
PossiblyFalsy = 117724,
|
|
444
|
+
Intrinsic = 67359327,
|
|
445
|
+
Primitive = 121820,
|
|
446
|
+
StringLike = 132,
|
|
447
|
+
NumberLike = 264,
|
|
448
|
+
BigIntLike = 2112,
|
|
449
|
+
BooleanLike = 528,
|
|
450
|
+
ESSymbolLike = 4096,
|
|
451
|
+
VoidLike = 49152,
|
|
452
|
+
DisjointDomains = 67230684,
|
|
453
|
+
UnionOrIntersection = 3145728,
|
|
454
|
+
StructuredType = 3670016,
|
|
455
|
+
TypeVariable = 8650752,
|
|
456
|
+
InstantiableNonPrimitive = 58982400,
|
|
457
|
+
InstantiablePrimitive = 4194304,
|
|
458
|
+
Instantiable = 63176704,
|
|
459
|
+
StructuredOrInstantiable = 66846720,
|
|
460
|
+
ObjectFlagsType = 3899393,
|
|
461
|
+
Simplifiable = 25165824,
|
|
462
|
+
Substructure = 66584576,
|
|
463
|
+
Narrowable = 133962719,
|
|
464
|
+
NotUnionOrUnit = 67637251,
|
|
465
|
+
NotPrimitiveUnion = 66994179,
|
|
466
|
+
IncludesMask = 71031775,
|
|
467
|
+
IncludesStructuredOrInstantiable = 262144,
|
|
468
|
+
IncludesNonWideningType = 4194304,
|
|
469
|
+
IncludesWildcard = 8388608,
|
|
470
|
+
IncludesEmptyObject = 16777216
|
|
471
|
+
}
|
|
472
|
+
export interface Type {
|
|
473
|
+
flags: TypeFlags;
|
|
474
|
+
id: number;
|
|
475
|
+
checker: TypeChecker;
|
|
476
|
+
symbol: Symbol;
|
|
477
|
+
pattern?: DestructuringPattern;
|
|
478
|
+
aliasSymbol?: Symbol;
|
|
479
|
+
aliasTypeArguments?: readonly Type[];
|
|
480
|
+
aliasTypeArgumentsContainsMarker?: boolean;
|
|
481
|
+
permissiveInstantiation?: Type;
|
|
482
|
+
restrictiveInstantiation?: Type;
|
|
483
|
+
immediateBaseConstraint?: Type;
|
|
484
|
+
widened?: Type;
|
|
485
|
+
}
|
|
486
|
+
export interface IntrinsicType extends Type {
|
|
487
|
+
intrinsicName: string;
|
|
488
|
+
objectFlags: ObjectFlags;
|
|
489
|
+
}
|
|
490
|
+
export interface NullableType extends IntrinsicType {
|
|
491
|
+
objectFlags: ObjectFlags;
|
|
492
|
+
}
|
|
493
|
+
export interface FreshableIntrinsicType extends IntrinsicType {
|
|
494
|
+
freshType: IntrinsicType;
|
|
495
|
+
regularType: IntrinsicType;
|
|
496
|
+
}
|
|
497
|
+
export type FreshableType = LiteralType | FreshableIntrinsicType;
|
|
498
|
+
export interface LiteralType extends Type {
|
|
499
|
+
value: string | number | PseudoBigInt;
|
|
500
|
+
freshType: LiteralType;
|
|
501
|
+
regularType: LiteralType;
|
|
502
|
+
}
|
|
503
|
+
export interface StringLiteralType extends LiteralType {
|
|
504
|
+
value: string;
|
|
505
|
+
}
|
|
506
|
+
export interface NumberLiteralType extends LiteralType {
|
|
507
|
+
value: number;
|
|
508
|
+
}
|
|
509
|
+
export interface BigIntLiteralType extends LiteralType {
|
|
510
|
+
value: PseudoBigInt;
|
|
511
|
+
}
|
|
512
|
+
export declare enum ObjectFlags {
|
|
513
|
+
None = 0,
|
|
514
|
+
Interface = 2,// Interface
|
|
515
|
+
Reference = 4,// Generic type reference
|
|
516
|
+
Tuple = 8,// Synthesized generic tuple type
|
|
517
|
+
Anonymous = 16,// Anonymous
|
|
518
|
+
Mapped = 32,// Mapped
|
|
519
|
+
Instantiated = 64,// Instantiated anonymous or mapped type
|
|
520
|
+
ObjectLiteral = 128,// Originates in an object literal
|
|
521
|
+
EvolvingArray = 256,// Evolving array type
|
|
522
|
+
ObjectLiteralPatternWithComputedProperties = 512,// Object literal pattern with computed properties
|
|
523
|
+
ContainsSpread = 1024,// Object literal contains spread operation
|
|
524
|
+
ReverseMapped = 2048,// Object contains a property from a reverse-mapped type
|
|
525
|
+
JsxAttributes = 4096,// Jsx attributes type
|
|
526
|
+
MarkerType = 8192,// Marker type used for variance probing
|
|
527
|
+
JSLiteral = 16384,// Object type declared in JS - disables errors on read/write of nonexisting members
|
|
528
|
+
FreshLiteral = 32768,// Fresh object literal
|
|
529
|
+
ArrayLiteral = 65536,// Originates in an array literal
|
|
530
|
+
ObjectRestType = 131072,// Originates in object rest declaration
|
|
531
|
+
PrimitiveUnion = 262144,// Union of only primitive types
|
|
532
|
+
ContainsWideningType = 524288,// Type is or contains undefined or null widening type
|
|
533
|
+
ContainsObjectOrArrayLiteral = 1048576,// Type is or contains object literal type
|
|
534
|
+
NonInferrableType = 2097152,// Type is or contains anyFunctionType or silentNeverType
|
|
535
|
+
IsGenericObjectTypeComputed = 4194304,// IsGenericObjectType flag has been computed
|
|
536
|
+
IsGenericObjectType = 8388608,// Union or intersection contains generic object type
|
|
537
|
+
IsGenericIndexTypeComputed = 16777216,// IsGenericIndexType flag has been computed
|
|
538
|
+
IsGenericIndexType = 33554432,// Union or intersection contains generic index type
|
|
539
|
+
CouldContainTypeVariablesComputed = 67108864,// CouldContainTypeVariables flag has been computed
|
|
540
|
+
CouldContainTypeVariables = 134217728,// Type could contain a type variable
|
|
541
|
+
ContainsIntersections = 268435456,// Union contains intersections
|
|
542
|
+
IsNeverIntersectionComputed = 268435456,// IsNeverLike flag has been computed
|
|
543
|
+
IsNeverIntersection = 536870912,// Intersection reduces to never
|
|
544
|
+
ClassOrInterface = 2,
|
|
545
|
+
RequiresWidening = 1572864,
|
|
546
|
+
PropagatingFlags = 3670016
|
|
547
|
+
}
|
|
548
|
+
export type ObjectFlagsType = NullableType | ObjectType | UnionType | IntersectionType;
|
|
549
|
+
export interface ObjectType extends Type {
|
|
550
|
+
objectFlags: ObjectFlags;
|
|
551
|
+
members?: SymbolTable;
|
|
552
|
+
properties?: Symbol[];
|
|
553
|
+
callSignatures?: readonly Signature[];
|
|
554
|
+
stringIndexInfo?: IndexInfo;
|
|
555
|
+
numberIndexInfo?: IndexInfo;
|
|
556
|
+
}
|
|
557
|
+
/** Class and interface types (ObjectFlags.Class and ObjectFlags.Interface). */
|
|
558
|
+
export interface InterfaceType extends ObjectType {
|
|
559
|
+
typeParameters: TypeParameter[] | undefined;
|
|
560
|
+
outerTypeParameters: TypeParameter[] | undefined;
|
|
561
|
+
localTypeParameters: TypeParameter[] | undefined;
|
|
562
|
+
resolvedBaseTypes: BaseType[];
|
|
563
|
+
}
|
|
564
|
+
export type BaseType = ObjectType | IntersectionType | TypeVariable;
|
|
565
|
+
export interface InterfaceTypeWithDeclaredMembers extends InterfaceType {
|
|
566
|
+
declaredProperties: Symbol[];
|
|
567
|
+
declaredCallSignatures: Signature[];
|
|
568
|
+
declaredStringIndexInfo?: IndexInfo;
|
|
569
|
+
declaredNumberIndexInfo?: IndexInfo;
|
|
570
|
+
}
|
|
571
|
+
/**
|
|
572
|
+
* A referência a um tipo genérico (`ObjectFlags.Reference`): o alvo e os argumentos de tipo, um para cada parâmetro de
|
|
573
|
+
* tipo do alvo, na ordem.
|
|
574
|
+
*/
|
|
575
|
+
export interface TypeReference extends ObjectType {
|
|
576
|
+
target: GenericType;
|
|
577
|
+
node?: TypeReferenceNode | ArrayTypeNode | TupleTypeNode;
|
|
578
|
+
mapper?: TypeMapper;
|
|
579
|
+
resolvedTypeArguments?: readonly Type[];
|
|
580
|
+
literalType?: TypeReference;
|
|
581
|
+
}
|
|
582
|
+
export interface DeferredTypeReference extends TypeReference {
|
|
583
|
+
node: TypeReferenceNode | ArrayTypeNode | TupleTypeNode;
|
|
584
|
+
mapper?: TypeMapper;
|
|
585
|
+
}
|
|
586
|
+
export declare enum VarianceFlags {
|
|
587
|
+
Invariant = 0,// Neither covariant nor contravariant
|
|
588
|
+
Covariant = 1,// Covariant
|
|
589
|
+
Contravariant = 2,// Contravariant
|
|
590
|
+
Bivariant = 3,// Both covariant and contravariant
|
|
591
|
+
Independent = 4,// Unwitnessed type parameter
|
|
592
|
+
VarianceMask = 7,// Mask containing all measured variances without the unmeasurable flag
|
|
593
|
+
Unmeasurable = 8,// Variance result is unusable - relationship relies on structural comparisons which are not reflected in generic relationships
|
|
594
|
+
Unreliable = 16,// Variance result is unreliable - checking may produce false negatives, but not false positives
|
|
595
|
+
AllowsStructuralFallback = 24
|
|
596
|
+
}
|
|
597
|
+
export interface GenericType extends InterfaceType, TypeReference {
|
|
598
|
+
instantiations: Map<TypeReference>;
|
|
599
|
+
variances?: VarianceFlags[];
|
|
600
|
+
}
|
|
601
|
+
export interface TupleType extends GenericType {
|
|
602
|
+
minLength: number;
|
|
603
|
+
hasRestElement: boolean;
|
|
604
|
+
readonly: boolean;
|
|
605
|
+
associatedNames?: __String[];
|
|
606
|
+
}
|
|
607
|
+
export interface TupleTypeReference extends TypeReference {
|
|
608
|
+
target: TupleType;
|
|
609
|
+
}
|
|
610
|
+
export interface UnionOrIntersectionType extends Type {
|
|
611
|
+
types: Type[];
|
|
612
|
+
objectFlags: ObjectFlags;
|
|
613
|
+
propertyCache: SymbolTable;
|
|
614
|
+
resolvedProperties: Symbol[];
|
|
615
|
+
resolvedIndexType: IndexType;
|
|
616
|
+
resolvedBaseConstraint: Type;
|
|
617
|
+
}
|
|
618
|
+
export interface UnionType extends UnionOrIntersectionType {
|
|
619
|
+
resolvedReducedType: Type;
|
|
620
|
+
regularType: UnionType;
|
|
621
|
+
}
|
|
622
|
+
export interface IntersectionType extends UnionOrIntersectionType {
|
|
623
|
+
resolvedApparentType: Type;
|
|
624
|
+
}
|
|
625
|
+
export type StructuredType = ObjectType | UnionType | IntersectionType;
|
|
626
|
+
export interface AnonymousType extends ObjectType {
|
|
627
|
+
target?: AnonymousType;
|
|
628
|
+
mapper?: TypeMapper;
|
|
629
|
+
/**
|
|
630
|
+
* Num tipo que o checker monta sem declaração (o membro de um embutido, CK-48): os parâmetros de tipo de fora, que o
|
|
631
|
+
* do programa tira da declaração, e o cache das instanciações por eles, que o do programa guarda nos links dela.
|
|
632
|
+
*/
|
|
633
|
+
outerTypeParameters?: TypeParameter[];
|
|
634
|
+
instantiations?: Map<Type>;
|
|
635
|
+
}
|
|
636
|
+
export interface MappedType extends AnonymousType {
|
|
637
|
+
declaration: MappedTypeNode;
|
|
638
|
+
typeParameter?: TypeParameter;
|
|
639
|
+
constraintType?: Type;
|
|
640
|
+
templateType?: Type;
|
|
641
|
+
modifiersType?: Type;
|
|
642
|
+
resolvedApparentType?: Type;
|
|
643
|
+
}
|
|
644
|
+
export interface EvolvingArrayType extends ObjectType {
|
|
645
|
+
elementType: Type;
|
|
646
|
+
finalArrayType?: Type;
|
|
647
|
+
}
|
|
648
|
+
export interface ReverseMappedType extends ObjectType {
|
|
649
|
+
source: Type;
|
|
650
|
+
mappedType: MappedType;
|
|
651
|
+
constraintType: IndexType;
|
|
652
|
+
}
|
|
653
|
+
export interface ResolvedType extends ObjectType, UnionOrIntersectionType {
|
|
654
|
+
members: SymbolTable;
|
|
655
|
+
properties: Symbol[];
|
|
656
|
+
callSignatures: readonly Signature[];
|
|
657
|
+
}
|
|
658
|
+
export interface FreshObjectLiteralType extends ResolvedType {
|
|
659
|
+
regularType: ResolvedType;
|
|
660
|
+
}
|
|
661
|
+
export interface IterationTypes {
|
|
662
|
+
readonly yieldType: Type;
|
|
663
|
+
readonly returnType: Type;
|
|
664
|
+
readonly nextType: Type;
|
|
665
|
+
}
|
|
666
|
+
export interface IterableOrIteratorType extends ObjectType, UnionType {
|
|
667
|
+
iterationTypesOfIterable?: IterationTypes;
|
|
668
|
+
iterationTypesOfAsyncIterable?: IterationTypes;
|
|
669
|
+
}
|
|
670
|
+
export interface PromiseOrAwaitableType extends ObjectType, UnionType {
|
|
671
|
+
promiseTypeOfPromiseConstructor?: Type;
|
|
672
|
+
promisedTypeOfPromise?: Type;
|
|
673
|
+
awaitedTypeOfType?: Type;
|
|
674
|
+
}
|
|
675
|
+
export interface InstantiableType extends Type {
|
|
676
|
+
resolvedBaseConstraint?: Type;
|
|
677
|
+
resolvedIndexType?: IndexType;
|
|
678
|
+
}
|
|
679
|
+
export interface TypeParameter extends InstantiableType {
|
|
680
|
+
/** Retrieve using getConstraintFromTypeParameter */
|
|
681
|
+
constraint?: Type;
|
|
682
|
+
default?: Type;
|
|
683
|
+
target?: TypeParameter;
|
|
684
|
+
mapper?: TypeMapper;
|
|
685
|
+
resolvedDefaultType?: Type;
|
|
686
|
+
}
|
|
687
|
+
export interface IndexedAccessType extends InstantiableType {
|
|
688
|
+
objectType: Type;
|
|
689
|
+
indexType: Type;
|
|
690
|
+
constraint?: Type;
|
|
691
|
+
simplifiedForReading?: Type;
|
|
692
|
+
simplifiedForWriting?: Type;
|
|
693
|
+
}
|
|
694
|
+
export type TypeVariable = TypeParameter | IndexedAccessType;
|
|
695
|
+
export interface IndexType extends InstantiableType {
|
|
696
|
+
type: InstantiableType | UnionOrIntersectionType;
|
|
697
|
+
}
|
|
698
|
+
export interface ConditionalRoot {
|
|
699
|
+
node: ConditionalTypeNode;
|
|
700
|
+
checkType: Type;
|
|
701
|
+
extendsType: Type;
|
|
702
|
+
trueType: Type;
|
|
703
|
+
falseType: Type;
|
|
704
|
+
isDistributive: boolean;
|
|
705
|
+
inferTypeParameters?: TypeParameter[];
|
|
706
|
+
outerTypeParameters?: TypeParameter[];
|
|
707
|
+
instantiations?: Map<Type>;
|
|
708
|
+
aliasSymbol?: Symbol;
|
|
709
|
+
aliasTypeArguments?: Type[];
|
|
710
|
+
}
|
|
711
|
+
export interface ConditionalType extends InstantiableType {
|
|
712
|
+
root: ConditionalRoot;
|
|
713
|
+
checkType: Type;
|
|
714
|
+
extendsType: Type;
|
|
715
|
+
resolvedTrueType: Type;
|
|
716
|
+
resolvedFalseType: Type;
|
|
717
|
+
resolvedInferredTrueType?: Type;
|
|
718
|
+
resolvedDefaultConstraint?: Type;
|
|
719
|
+
mapper?: TypeMapper;
|
|
720
|
+
combinedMapper?: TypeMapper;
|
|
721
|
+
}
|
|
722
|
+
export interface SubstitutionType extends InstantiableType {
|
|
723
|
+
baseType: Type;
|
|
724
|
+
substitute: Type;
|
|
725
|
+
}
|
|
726
|
+
export declare enum JsxReferenceKind {
|
|
727
|
+
Function = 0,
|
|
728
|
+
Mixed = 1
|
|
729
|
+
}
|
|
730
|
+
export declare enum SignatureFlags {
|
|
731
|
+
None = 0,
|
|
732
|
+
HasRestParameter = 1,// Indicates last parameter is rest parameter
|
|
733
|
+
HasLiteralTypes = 2,// Indicates signature is specialized
|
|
734
|
+
IsInnerCallChain = 4,// Indicates signature comes from a CallChain nested in an outer OptionalChain
|
|
735
|
+
IsOuterCallChain = 8,// Indicates signature comes from a CallChain that is the outermost chain of an optional expression
|
|
736
|
+
PropagatingFlags = 3,
|
|
737
|
+
CallChainFlags = 12
|
|
738
|
+
}
|
|
739
|
+
export interface Signature {
|
|
740
|
+
flags: SignatureFlags;
|
|
741
|
+
checker?: TypeChecker;
|
|
742
|
+
declaration?: SignatureDeclaration;
|
|
743
|
+
typeParameters?: readonly TypeParameter[];
|
|
744
|
+
parameters: readonly Symbol[];
|
|
745
|
+
resolvedReturnType?: Type;
|
|
746
|
+
resolvedTypePredicate?: TypePredicate;
|
|
747
|
+
minArgumentCount: number;
|
|
748
|
+
target?: Signature;
|
|
749
|
+
mapper?: TypeMapper;
|
|
750
|
+
unionSignatures?: Signature[];
|
|
751
|
+
erasedSignatureCache?: Signature;
|
|
752
|
+
canonicalSignatureCache?: Signature;
|
|
753
|
+
optionalCallSignatureCache?: {
|
|
754
|
+
inner?: Signature;
|
|
755
|
+
outer?: Signature;
|
|
756
|
+
};
|
|
757
|
+
isolatedSignatureType?: ObjectType;
|
|
758
|
+
instantiations?: Map<Signature>;
|
|
759
|
+
}
|
|
760
|
+
export declare enum IndexKind {
|
|
761
|
+
String = 0,
|
|
762
|
+
Number = 1
|
|
763
|
+
}
|
|
764
|
+
export interface IndexInfo {
|
|
765
|
+
type: Type;
|
|
766
|
+
isReadonly: boolean;
|
|
767
|
+
declaration?: IndexSignatureDeclaration;
|
|
768
|
+
}
|
|
769
|
+
export declare enum TypeMapKind {
|
|
770
|
+
Simple = 0,
|
|
771
|
+
Array = 1,
|
|
772
|
+
Function = 2,
|
|
773
|
+
Composite = 3,
|
|
774
|
+
Merged = 4
|
|
775
|
+
}
|
|
776
|
+
export type TypeMapper = {
|
|
777
|
+
kind: TypeMapKind.Simple;
|
|
778
|
+
source: Type;
|
|
779
|
+
target: Type;
|
|
780
|
+
} | {
|
|
781
|
+
kind: TypeMapKind.Array;
|
|
782
|
+
sources: readonly Type[];
|
|
783
|
+
targets: readonly Type[] | undefined;
|
|
784
|
+
} | {
|
|
785
|
+
kind: TypeMapKind.Function;
|
|
786
|
+
func: (t: Type) => Type;
|
|
787
|
+
} | {
|
|
788
|
+
kind: TypeMapKind.Composite | TypeMapKind.Merged;
|
|
789
|
+
mapper1: TypeMapper;
|
|
790
|
+
mapper2: TypeMapper;
|
|
791
|
+
};
|
|
792
|
+
export declare enum InferencePriority {
|
|
793
|
+
None = 0,
|
|
794
|
+
NakedTypeVariable = 1,// Naked type variable in union or intersection type
|
|
795
|
+
HomomorphicMappedType = 2,// Reverse inference for homomorphic mapped type
|
|
796
|
+
PartialHomomorphicMappedType = 4,// Partial reverse inference for homomorphic mapped type
|
|
797
|
+
MappedTypeConstraint = 8,// Reverse inference for mapped type
|
|
798
|
+
ContravariantConditional = 16,// Conditional type in contravariant position
|
|
799
|
+
ReturnType = 32,// Inference made from return type of generic function
|
|
800
|
+
LiteralKeyof = 64,// Inference made from a string literal to a keyof T
|
|
801
|
+
NoConstraints = 128,// Don't infer from constraints of instantiable types
|
|
802
|
+
AlwaysStrict = 256,// Always use strict rules for contravariant inferences
|
|
803
|
+
MaxValue = 512,// Seed for inference priority tracking
|
|
804
|
+
PriorityImpliesCombination = 104,// These priorities imply that the resulting type should be a combination of all candidates
|
|
805
|
+
Circularity = -1
|
|
806
|
+
}
|
|
807
|
+
export interface InferenceInfo {
|
|
808
|
+
typeParameter: TypeParameter;
|
|
809
|
+
candidates: Type[] | undefined;
|
|
810
|
+
contraCandidates: Type[] | undefined;
|
|
811
|
+
inferredType?: Type;
|
|
812
|
+
priority?: InferencePriority;
|
|
813
|
+
topLevel: boolean;
|
|
814
|
+
isFixed: boolean;
|
|
815
|
+
}
|
|
816
|
+
export declare enum InferenceFlags {
|
|
817
|
+
None = 0,// No special inference behaviors
|
|
818
|
+
NoDefault = 1,// Infer unknownType for no inferences (otherwise anyType or emptyObjectType)
|
|
819
|
+
AnyDefault = 2,// Infer anyType for no inferences (otherwise emptyObjectType)
|
|
820
|
+
SkippedGenericFunction = 4
|
|
821
|
+
}
|
|
822
|
+
/**
|
|
823
|
+
* Ternary values are defined such that
|
|
824
|
+
* x & y is False if either x or y is False.
|
|
825
|
+
* x & y is Maybe if either x or y is Maybe, but neither x or y is False.
|
|
826
|
+
* x & y is True if both x and y are True.
|
|
827
|
+
* x | y is False if both x and y are False.
|
|
828
|
+
* x | y is Maybe if either x or y is Maybe, but neither x or y is True.
|
|
829
|
+
* x | y is True if either x or y is True.
|
|
830
|
+
*/
|
|
831
|
+
export declare enum Ternary {
|
|
832
|
+
False = 0,
|
|
833
|
+
Maybe = 1,
|
|
834
|
+
True = -1
|
|
835
|
+
}
|
|
836
|
+
export type TypeComparer = (s: Type, t: Type, reportErrors?: boolean) => Ternary;
|
|
837
|
+
export interface InferenceContext {
|
|
838
|
+
inferences: InferenceInfo[];
|
|
839
|
+
signature?: Signature;
|
|
840
|
+
flags: InferenceFlags;
|
|
841
|
+
compareTypes: TypeComparer;
|
|
842
|
+
mapper: TypeMapper;
|
|
843
|
+
nonFixingMapper: TypeMapper;
|
|
844
|
+
returnMapper?: TypeMapper;
|
|
845
|
+
inferredTypeParameters?: readonly TypeParameter[];
|
|
846
|
+
}
|
|
847
|
+
export interface WideningContext {
|
|
848
|
+
parent?: WideningContext;
|
|
849
|
+
propertyName?: __String;
|
|
850
|
+
siblings?: Type[];
|
|
851
|
+
resolvedProperties?: Symbol[];
|
|
852
|
+
}
|
|
853
|
+
export interface DiagnosticCollection {
|
|
854
|
+
add(diagnostic: Diagnostic): void;
|
|
855
|
+
lookup(diagnostic: Diagnostic): Diagnostic | undefined;
|
|
856
|
+
getGlobalDiagnostics(): Diagnostic[];
|
|
857
|
+
getDiagnostics(): Diagnostic[];
|
|
858
|
+
getDiagnostics(fileName: string): DiagnosticWithLocation[];
|
|
859
|
+
reattachFileDiagnostics(newFile: SourceFile): void;
|
|
860
|
+
}
|
|
861
|
+
export interface CommentDirectivesMap {
|
|
862
|
+
getUnusedExpectations(): CommentDirective[];
|
|
863
|
+
markUsed(matchedLine: number): boolean;
|
|
864
|
+
}
|