@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.js
ADDED
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
export var JsxFlags;
|
|
2
|
+
(function (JsxFlags) {
|
|
3
|
+
JsxFlags[JsxFlags["None"] = 0] = "None";
|
|
4
|
+
/** An element from a named property of the JSX.IntrinsicElements interface */
|
|
5
|
+
JsxFlags[JsxFlags["IntrinsicNamedElement"] = 1] = "IntrinsicNamedElement";
|
|
6
|
+
/** An element inferred from the string index signature of the JSX.IntrinsicElements interface */
|
|
7
|
+
JsxFlags[JsxFlags["IntrinsicIndexedElement"] = 2] = "IntrinsicIndexedElement";
|
|
8
|
+
JsxFlags[JsxFlags["IntrinsicElement"] = 3] = "IntrinsicElement";
|
|
9
|
+
})(JsxFlags || (JsxFlags = {}));
|
|
10
|
+
export var RelationComparisonResult;
|
|
11
|
+
(function (RelationComparisonResult) {
|
|
12
|
+
RelationComparisonResult[RelationComparisonResult["None"] = 0] = "None";
|
|
13
|
+
RelationComparisonResult[RelationComparisonResult["Succeeded"] = 1] = "Succeeded";
|
|
14
|
+
RelationComparisonResult[RelationComparisonResult["Failed"] = 2] = "Failed";
|
|
15
|
+
RelationComparisonResult[RelationComparisonResult["Reported"] = 4] = "Reported";
|
|
16
|
+
RelationComparisonResult[RelationComparisonResult["ReportsUnmeasurable"] = 8] = "ReportsUnmeasurable";
|
|
17
|
+
RelationComparisonResult[RelationComparisonResult["ReportsUnreliable"] = 16] = "ReportsUnreliable";
|
|
18
|
+
RelationComparisonResult[RelationComparisonResult["ReportsMask"] = 24] = "ReportsMask";
|
|
19
|
+
})(RelationComparisonResult || (RelationComparisonResult = {}));
|
|
20
|
+
export class OperationCanceledException {
|
|
21
|
+
}
|
|
22
|
+
export var UnionReduction;
|
|
23
|
+
(function (UnionReduction) {
|
|
24
|
+
UnionReduction[UnionReduction["None"] = 0] = "None";
|
|
25
|
+
UnionReduction[UnionReduction["Literal"] = 1] = "Literal";
|
|
26
|
+
UnionReduction[UnionReduction["Subtype"] = 2] = "Subtype";
|
|
27
|
+
})(UnionReduction || (UnionReduction = {}));
|
|
28
|
+
export var ContextFlags;
|
|
29
|
+
(function (ContextFlags) {
|
|
30
|
+
ContextFlags[ContextFlags["None"] = 0] = "None";
|
|
31
|
+
ContextFlags[ContextFlags["Signature"] = 1] = "Signature";
|
|
32
|
+
ContextFlags[ContextFlags["NoConstraints"] = 2] = "NoConstraints";
|
|
33
|
+
ContextFlags[ContextFlags["Completions"] = 4] = "Completions";
|
|
34
|
+
})(ContextFlags || (ContextFlags = {}));
|
|
35
|
+
// NOTE: If modifying this enum, must modify `TypeFormatFlags` too!
|
|
36
|
+
export var NodeBuilderFlags;
|
|
37
|
+
(function (NodeBuilderFlags) {
|
|
38
|
+
NodeBuilderFlags[NodeBuilderFlags["None"] = 0] = "None";
|
|
39
|
+
// Options
|
|
40
|
+
NodeBuilderFlags[NodeBuilderFlags["NoTruncation"] = 1] = "NoTruncation";
|
|
41
|
+
NodeBuilderFlags[NodeBuilderFlags["WriteArrayAsGenericType"] = 2] = "WriteArrayAsGenericType";
|
|
42
|
+
NodeBuilderFlags[NodeBuilderFlags["GenerateNamesForShadowedTypeParams"] = 4] = "GenerateNamesForShadowedTypeParams";
|
|
43
|
+
NodeBuilderFlags[NodeBuilderFlags["UseStructuralFallback"] = 8] = "UseStructuralFallback";
|
|
44
|
+
NodeBuilderFlags[NodeBuilderFlags["ForbidIndexedAccessSymbolReferences"] = 16] = "ForbidIndexedAccessSymbolReferences";
|
|
45
|
+
NodeBuilderFlags[NodeBuilderFlags["WriteTypeArgumentsOfSignature"] = 32] = "WriteTypeArgumentsOfSignature";
|
|
46
|
+
NodeBuilderFlags[NodeBuilderFlags["UseFullyQualifiedType"] = 64] = "UseFullyQualifiedType";
|
|
47
|
+
NodeBuilderFlags[NodeBuilderFlags["UseOnlyExternalAliasing"] = 128] = "UseOnlyExternalAliasing";
|
|
48
|
+
NodeBuilderFlags[NodeBuilderFlags["SuppressAnyReturnType"] = 256] = "SuppressAnyReturnType";
|
|
49
|
+
NodeBuilderFlags[NodeBuilderFlags["WriteTypeParametersInQualifiedName"] = 512] = "WriteTypeParametersInQualifiedName";
|
|
50
|
+
NodeBuilderFlags[NodeBuilderFlags["MultilineObjectLiterals"] = 1024] = "MultilineObjectLiterals";
|
|
51
|
+
NodeBuilderFlags[NodeBuilderFlags["UseTypeOfFunction"] = 4096] = "UseTypeOfFunction";
|
|
52
|
+
NodeBuilderFlags[NodeBuilderFlags["OmitParameterModifiers"] = 8192] = "OmitParameterModifiers";
|
|
53
|
+
NodeBuilderFlags[NodeBuilderFlags["UseAliasDefinedOutsideCurrentScope"] = 16384] = "UseAliasDefinedOutsideCurrentScope";
|
|
54
|
+
NodeBuilderFlags[NodeBuilderFlags["UseSingleQuotesForStringLiteralType"] = 268435456] = "UseSingleQuotesForStringLiteralType";
|
|
55
|
+
NodeBuilderFlags[NodeBuilderFlags["NoTypeReduction"] = 536870912] = "NoTypeReduction";
|
|
56
|
+
// Error handling
|
|
57
|
+
NodeBuilderFlags[NodeBuilderFlags["AllowQualifedNameInPlaceOfIdentifier"] = 65536] = "AllowQualifedNameInPlaceOfIdentifier";
|
|
58
|
+
NodeBuilderFlags[NodeBuilderFlags["AllowAnonymousIdentifier"] = 131072] = "AllowAnonymousIdentifier";
|
|
59
|
+
NodeBuilderFlags[NodeBuilderFlags["AllowEmptyUnionOrIntersection"] = 262144] = "AllowEmptyUnionOrIntersection";
|
|
60
|
+
NodeBuilderFlags[NodeBuilderFlags["AllowEmptyTuple"] = 524288] = "AllowEmptyTuple";
|
|
61
|
+
NodeBuilderFlags[NodeBuilderFlags["AllowUniqueESSymbolType"] = 1048576] = "AllowUniqueESSymbolType";
|
|
62
|
+
NodeBuilderFlags[NodeBuilderFlags["AllowEmptyIndexInfoType"] = 2097152] = "AllowEmptyIndexInfoType";
|
|
63
|
+
// Errors (cont.)
|
|
64
|
+
NodeBuilderFlags[NodeBuilderFlags["AllowNodeModulesRelativePaths"] = 67108864] = "AllowNodeModulesRelativePaths";
|
|
65
|
+
NodeBuilderFlags[NodeBuilderFlags["DoNotIncludeSymbolChain"] = 134217728] = "DoNotIncludeSymbolChain";
|
|
66
|
+
NodeBuilderFlags[NodeBuilderFlags["IgnoreErrors"] = 70189056] = "IgnoreErrors";
|
|
67
|
+
// State
|
|
68
|
+
NodeBuilderFlags[NodeBuilderFlags["InTypeAlias"] = 8388608] = "InTypeAlias";
|
|
69
|
+
NodeBuilderFlags[NodeBuilderFlags["InInitialEntityName"] = 16777216] = "InInitialEntityName";
|
|
70
|
+
NodeBuilderFlags[NodeBuilderFlags["InReverseMappedType"] = 33554432] = "InReverseMappedType";
|
|
71
|
+
})(NodeBuilderFlags || (NodeBuilderFlags = {}));
|
|
72
|
+
// Ensure the shared flags between this and `NodeBuilderFlags` stay in alignment
|
|
73
|
+
export var TypeFormatFlags;
|
|
74
|
+
(function (TypeFormatFlags) {
|
|
75
|
+
TypeFormatFlags[TypeFormatFlags["None"] = 0] = "None";
|
|
76
|
+
TypeFormatFlags[TypeFormatFlags["NoTruncation"] = 1] = "NoTruncation";
|
|
77
|
+
TypeFormatFlags[TypeFormatFlags["WriteArrayAsGenericType"] = 2] = "WriteArrayAsGenericType";
|
|
78
|
+
// hole because there's a hole in node builder flags
|
|
79
|
+
TypeFormatFlags[TypeFormatFlags["UseStructuralFallback"] = 8] = "UseStructuralFallback";
|
|
80
|
+
// hole because there's a hole in node builder flags
|
|
81
|
+
TypeFormatFlags[TypeFormatFlags["WriteTypeArgumentsOfSignature"] = 32] = "WriteTypeArgumentsOfSignature";
|
|
82
|
+
TypeFormatFlags[TypeFormatFlags["UseFullyQualifiedType"] = 64] = "UseFullyQualifiedType";
|
|
83
|
+
// hole because `UseOnlyExternalAliasing` is here in node builder flags, but functions which take old flags use `SymbolFormatFlags` instead
|
|
84
|
+
TypeFormatFlags[TypeFormatFlags["SuppressAnyReturnType"] = 256] = "SuppressAnyReturnType";
|
|
85
|
+
// hole because `WriteTypeParametersInQualifiedName` is here in node builder flags, but functions which take old flags use `SymbolFormatFlags` for this instead
|
|
86
|
+
TypeFormatFlags[TypeFormatFlags["MultilineObjectLiterals"] = 1024] = "MultilineObjectLiterals";
|
|
87
|
+
TypeFormatFlags[TypeFormatFlags["UseTypeOfFunction"] = 4096] = "UseTypeOfFunction";
|
|
88
|
+
TypeFormatFlags[TypeFormatFlags["OmitParameterModifiers"] = 8192] = "OmitParameterModifiers";
|
|
89
|
+
TypeFormatFlags[TypeFormatFlags["UseAliasDefinedOutsideCurrentScope"] = 16384] = "UseAliasDefinedOutsideCurrentScope";
|
|
90
|
+
TypeFormatFlags[TypeFormatFlags["UseSingleQuotesForStringLiteralType"] = 268435456] = "UseSingleQuotesForStringLiteralType";
|
|
91
|
+
TypeFormatFlags[TypeFormatFlags["NoTypeReduction"] = 536870912] = "NoTypeReduction";
|
|
92
|
+
// Error Handling
|
|
93
|
+
TypeFormatFlags[TypeFormatFlags["AllowUniqueESSymbolType"] = 1048576] = "AllowUniqueESSymbolType";
|
|
94
|
+
// TypeFormatFlags exclusive
|
|
95
|
+
TypeFormatFlags[TypeFormatFlags["AddUndefined"] = 131072] = "AddUndefined";
|
|
96
|
+
TypeFormatFlags[TypeFormatFlags["WriteArrowStyleSignature"] = 262144] = "WriteArrowStyleSignature";
|
|
97
|
+
// State
|
|
98
|
+
TypeFormatFlags[TypeFormatFlags["InArrayType"] = 524288] = "InArrayType";
|
|
99
|
+
TypeFormatFlags[TypeFormatFlags["InElementType"] = 2097152] = "InElementType";
|
|
100
|
+
TypeFormatFlags[TypeFormatFlags["InFirstTypeArgument"] = 4194304] = "InFirstTypeArgument";
|
|
101
|
+
TypeFormatFlags[TypeFormatFlags["InTypeAlias"] = 8388608] = "InTypeAlias";
|
|
102
|
+
/** @deprecated */ TypeFormatFlags[TypeFormatFlags["WriteOwnNameForAnyLike"] = 0] = "WriteOwnNameForAnyLike";
|
|
103
|
+
TypeFormatFlags[TypeFormatFlags["NodeBuilderFlagsMask"] = 814773611] = "NodeBuilderFlagsMask";
|
|
104
|
+
})(TypeFormatFlags || (TypeFormatFlags = {}));
|
|
105
|
+
export var SymbolFormatFlags;
|
|
106
|
+
(function (SymbolFormatFlags) {
|
|
107
|
+
SymbolFormatFlags[SymbolFormatFlags["None"] = 0] = "None";
|
|
108
|
+
// Write symbols's type argument if it is instantiated symbol
|
|
109
|
+
// eg. class C<T> { p: T } <-- Show p as C<T>.p here
|
|
110
|
+
// var a: C<number>;
|
|
111
|
+
// var p = a.p; <--- Here p is property of C<number> so show it as C<number>.p instead of just C.p
|
|
112
|
+
SymbolFormatFlags[SymbolFormatFlags["WriteTypeParametersOrArguments"] = 1] = "WriteTypeParametersOrArguments";
|
|
113
|
+
// Use only external alias information to get the symbol name in the given context
|
|
114
|
+
// eg. module m { export class c { } } import x = m.c;
|
|
115
|
+
// When this flag is specified m.c will be used to refer to the class instead of alias symbol x
|
|
116
|
+
SymbolFormatFlags[SymbolFormatFlags["UseOnlyExternalAliasing"] = 2] = "UseOnlyExternalAliasing";
|
|
117
|
+
// Build symbol name using any nodes needed, instead of just components of an entity name
|
|
118
|
+
SymbolFormatFlags[SymbolFormatFlags["AllowAnyNodeKind"] = 4] = "AllowAnyNodeKind";
|
|
119
|
+
// Prefer aliases which are not directly visible
|
|
120
|
+
SymbolFormatFlags[SymbolFormatFlags["UseAliasDefinedOutsideCurrentScope"] = 8] = "UseAliasDefinedOutsideCurrentScope";
|
|
121
|
+
// Skip building an accessible symbol chain
|
|
122
|
+
SymbolFormatFlags[SymbolFormatFlags["DoNotIncludeSymbolChain"] = 16] = "DoNotIncludeSymbolChain";
|
|
123
|
+
})(SymbolFormatFlags || (SymbolFormatFlags = {}));
|
|
124
|
+
export var SymbolAccessibility;
|
|
125
|
+
(function (SymbolAccessibility) {
|
|
126
|
+
SymbolAccessibility[SymbolAccessibility["Accessible"] = 0] = "Accessible";
|
|
127
|
+
SymbolAccessibility[SymbolAccessibility["NotAccessible"] = 1] = "NotAccessible";
|
|
128
|
+
SymbolAccessibility[SymbolAccessibility["CannotBeNamed"] = 2] = "CannotBeNamed";
|
|
129
|
+
})(SymbolAccessibility || (SymbolAccessibility = {}));
|
|
130
|
+
export var TypePredicateKind;
|
|
131
|
+
(function (TypePredicateKind) {
|
|
132
|
+
TypePredicateKind[TypePredicateKind["Identifier"] = 0] = "Identifier";
|
|
133
|
+
TypePredicateKind[TypePredicateKind["AssertsIdentifier"] = 1] = "AssertsIdentifier";
|
|
134
|
+
})(TypePredicateKind || (TypePredicateKind = {}));
|
|
135
|
+
export var CheckFlags;
|
|
136
|
+
(function (CheckFlags) {
|
|
137
|
+
CheckFlags[CheckFlags["None"] = 0] = "None";
|
|
138
|
+
CheckFlags[CheckFlags["Instantiated"] = 1] = "Instantiated";
|
|
139
|
+
CheckFlags[CheckFlags["SyntheticProperty"] = 2] = "SyntheticProperty";
|
|
140
|
+
CheckFlags[CheckFlags["SyntheticMethod"] = 4] = "SyntheticMethod";
|
|
141
|
+
CheckFlags[CheckFlags["Readonly"] = 8] = "Readonly";
|
|
142
|
+
CheckFlags[CheckFlags["ReadPartial"] = 16] = "ReadPartial";
|
|
143
|
+
CheckFlags[CheckFlags["WritePartial"] = 32] = "WritePartial";
|
|
144
|
+
CheckFlags[CheckFlags["HasNonUniformType"] = 64] = "HasNonUniformType";
|
|
145
|
+
CheckFlags[CheckFlags["HasLiteralType"] = 128] = "HasLiteralType";
|
|
146
|
+
CheckFlags[CheckFlags["Late"] = 4096] = "Late";
|
|
147
|
+
CheckFlags[CheckFlags["ReverseMapped"] = 8192] = "ReverseMapped";
|
|
148
|
+
CheckFlags[CheckFlags["OptionalParameter"] = 16384] = "OptionalParameter";
|
|
149
|
+
CheckFlags[CheckFlags["RestParameter"] = 32768] = "RestParameter";
|
|
150
|
+
CheckFlags[CheckFlags["DeferredType"] = 65536] = "DeferredType";
|
|
151
|
+
CheckFlags[CheckFlags["HasNeverType"] = 131072] = "HasNeverType";
|
|
152
|
+
CheckFlags[CheckFlags["Mapped"] = 262144] = "Mapped";
|
|
153
|
+
CheckFlags[CheckFlags["StripOptional"] = 524288] = "StripOptional";
|
|
154
|
+
CheckFlags[CheckFlags["Synthetic"] = 6] = "Synthetic";
|
|
155
|
+
CheckFlags[CheckFlags["Discriminant"] = 192] = "Discriminant";
|
|
156
|
+
CheckFlags[CheckFlags["Partial"] = 48] = "Partial";
|
|
157
|
+
})(CheckFlags || (CheckFlags = {}));
|
|
158
|
+
export var NodeCheckFlags;
|
|
159
|
+
(function (NodeCheckFlags) {
|
|
160
|
+
NodeCheckFlags[NodeCheckFlags["None"] = 0] = "None";
|
|
161
|
+
NodeCheckFlags[NodeCheckFlags["TypeChecked"] = 1] = "TypeChecked";
|
|
162
|
+
NodeCheckFlags[NodeCheckFlags["CaptureNewTarget"] = 8] = "CaptureNewTarget";
|
|
163
|
+
NodeCheckFlags[NodeCheckFlags["ContextChecked"] = 1024] = "ContextChecked";
|
|
164
|
+
NodeCheckFlags[NodeCheckFlags["CaptureArguments"] = 8192] = "CaptureArguments";
|
|
165
|
+
NodeCheckFlags[NodeCheckFlags["LoopWithCapturedBlockScopedBinding"] = 65536] = "LoopWithCapturedBlockScopedBinding";
|
|
166
|
+
NodeCheckFlags[NodeCheckFlags["ContainsCapturedBlockScopeBinding"] = 131072] = "ContainsCapturedBlockScopeBinding";
|
|
167
|
+
NodeCheckFlags[NodeCheckFlags["CapturedBlockScopedBinding"] = 262144] = "CapturedBlockScopedBinding";
|
|
168
|
+
NodeCheckFlags[NodeCheckFlags["BlockScopedBindingInLoop"] = 524288] = "BlockScopedBindingInLoop";
|
|
169
|
+
NodeCheckFlags[NodeCheckFlags["NeedsLoopOutParameter"] = 4194304] = "NeedsLoopOutParameter";
|
|
170
|
+
NodeCheckFlags[NodeCheckFlags["AssignmentsMarked"] = 8388608] = "AssignmentsMarked";
|
|
171
|
+
})(NodeCheckFlags || (NodeCheckFlags = {}));
|
|
172
|
+
export var TypeFlags;
|
|
173
|
+
(function (TypeFlags) {
|
|
174
|
+
TypeFlags[TypeFlags["None"] = 0] = "None";
|
|
175
|
+
TypeFlags[TypeFlags["Any"] = 1] = "Any";
|
|
176
|
+
TypeFlags[TypeFlags["Unknown"] = 2] = "Unknown";
|
|
177
|
+
TypeFlags[TypeFlags["String"] = 4] = "String";
|
|
178
|
+
TypeFlags[TypeFlags["Number"] = 8] = "Number";
|
|
179
|
+
TypeFlags[TypeFlags["Boolean"] = 16] = "Boolean";
|
|
180
|
+
TypeFlags[TypeFlags["BigInt"] = 64] = "BigInt";
|
|
181
|
+
TypeFlags[TypeFlags["StringLiteral"] = 128] = "StringLiteral";
|
|
182
|
+
TypeFlags[TypeFlags["NumberLiteral"] = 256] = "NumberLiteral";
|
|
183
|
+
TypeFlags[TypeFlags["BooleanLiteral"] = 512] = "BooleanLiteral";
|
|
184
|
+
TypeFlags[TypeFlags["BigIntLiteral"] = 2048] = "BigIntLiteral";
|
|
185
|
+
TypeFlags[TypeFlags["ESSymbol"] = 4096] = "ESSymbol";
|
|
186
|
+
TypeFlags[TypeFlags["Void"] = 16384] = "Void";
|
|
187
|
+
TypeFlags[TypeFlags["Undefined"] = 32768] = "Undefined";
|
|
188
|
+
TypeFlags[TypeFlags["Null"] = 65536] = "Null";
|
|
189
|
+
TypeFlags[TypeFlags["Never"] = 131072] = "Never";
|
|
190
|
+
TypeFlags[TypeFlags["TypeParameter"] = 262144] = "TypeParameter";
|
|
191
|
+
TypeFlags[TypeFlags["Object"] = 524288] = "Object";
|
|
192
|
+
TypeFlags[TypeFlags["Union"] = 1048576] = "Union";
|
|
193
|
+
TypeFlags[TypeFlags["Intersection"] = 2097152] = "Intersection";
|
|
194
|
+
TypeFlags[TypeFlags["Index"] = 4194304] = "Index";
|
|
195
|
+
TypeFlags[TypeFlags["IndexedAccess"] = 8388608] = "IndexedAccess";
|
|
196
|
+
TypeFlags[TypeFlags["Conditional"] = 16777216] = "Conditional";
|
|
197
|
+
TypeFlags[TypeFlags["Substitution"] = 33554432] = "Substitution";
|
|
198
|
+
TypeFlags[TypeFlags["NonPrimitive"] = 67108864] = "NonPrimitive";
|
|
199
|
+
TypeFlags[TypeFlags["AnyOrUnknown"] = 3] = "AnyOrUnknown";
|
|
200
|
+
TypeFlags[TypeFlags["Nullable"] = 98304] = "Nullable";
|
|
201
|
+
TypeFlags[TypeFlags["Literal"] = 2944] = "Literal";
|
|
202
|
+
TypeFlags[TypeFlags["Unit"] = 101248] = "Unit";
|
|
203
|
+
TypeFlags[TypeFlags["StringOrNumberLiteral"] = 384] = "StringOrNumberLiteral";
|
|
204
|
+
TypeFlags[TypeFlags["DefinitelyFalsy"] = 117632] = "DefinitelyFalsy";
|
|
205
|
+
TypeFlags[TypeFlags["PossiblyFalsy"] = 117724] = "PossiblyFalsy";
|
|
206
|
+
TypeFlags[TypeFlags["Intrinsic"] = 67359327] = "Intrinsic";
|
|
207
|
+
TypeFlags[TypeFlags["Primitive"] = 121820] = "Primitive";
|
|
208
|
+
TypeFlags[TypeFlags["StringLike"] = 132] = "StringLike";
|
|
209
|
+
TypeFlags[TypeFlags["NumberLike"] = 264] = "NumberLike";
|
|
210
|
+
TypeFlags[TypeFlags["BigIntLike"] = 2112] = "BigIntLike";
|
|
211
|
+
TypeFlags[TypeFlags["BooleanLike"] = 528] = "BooleanLike";
|
|
212
|
+
TypeFlags[TypeFlags["ESSymbolLike"] = 4096] = "ESSymbolLike";
|
|
213
|
+
TypeFlags[TypeFlags["VoidLike"] = 49152] = "VoidLike";
|
|
214
|
+
TypeFlags[TypeFlags["DisjointDomains"] = 67230684] = "DisjointDomains";
|
|
215
|
+
TypeFlags[TypeFlags["UnionOrIntersection"] = 3145728] = "UnionOrIntersection";
|
|
216
|
+
TypeFlags[TypeFlags["StructuredType"] = 3670016] = "StructuredType";
|
|
217
|
+
TypeFlags[TypeFlags["TypeVariable"] = 8650752] = "TypeVariable";
|
|
218
|
+
TypeFlags[TypeFlags["InstantiableNonPrimitive"] = 58982400] = "InstantiableNonPrimitive";
|
|
219
|
+
TypeFlags[TypeFlags["InstantiablePrimitive"] = 4194304] = "InstantiablePrimitive";
|
|
220
|
+
TypeFlags[TypeFlags["Instantiable"] = 63176704] = "Instantiable";
|
|
221
|
+
TypeFlags[TypeFlags["StructuredOrInstantiable"] = 66846720] = "StructuredOrInstantiable";
|
|
222
|
+
TypeFlags[TypeFlags["ObjectFlagsType"] = 3899393] = "ObjectFlagsType";
|
|
223
|
+
TypeFlags[TypeFlags["Simplifiable"] = 25165824] = "Simplifiable";
|
|
224
|
+
TypeFlags[TypeFlags["Substructure"] = 66584576] = "Substructure";
|
|
225
|
+
// 'Narrowable' types are types where narrowing actually narrows.
|
|
226
|
+
// This *should* be every type other than null, undefined, void, and never
|
|
227
|
+
TypeFlags[TypeFlags["Narrowable"] = 133962719] = "Narrowable";
|
|
228
|
+
TypeFlags[TypeFlags["NotUnionOrUnit"] = 67637251] = "NotUnionOrUnit";
|
|
229
|
+
TypeFlags[TypeFlags["NotPrimitiveUnion"] = 66994179] = "NotPrimitiveUnion";
|
|
230
|
+
// The following flags are aggregated during union and intersection type construction
|
|
231
|
+
TypeFlags[TypeFlags["IncludesMask"] = 71031775] = "IncludesMask";
|
|
232
|
+
// The following flags are used for different purposes during union and intersection type construction
|
|
233
|
+
TypeFlags[TypeFlags["IncludesStructuredOrInstantiable"] = 262144] = "IncludesStructuredOrInstantiable";
|
|
234
|
+
TypeFlags[TypeFlags["IncludesNonWideningType"] = 4194304] = "IncludesNonWideningType";
|
|
235
|
+
TypeFlags[TypeFlags["IncludesWildcard"] = 8388608] = "IncludesWildcard";
|
|
236
|
+
TypeFlags[TypeFlags["IncludesEmptyObject"] = 16777216] = "IncludesEmptyObject";
|
|
237
|
+
})(TypeFlags || (TypeFlags = {}));
|
|
238
|
+
export var ObjectFlags;
|
|
239
|
+
(function (ObjectFlags) {
|
|
240
|
+
ObjectFlags[ObjectFlags["None"] = 0] = "None";
|
|
241
|
+
ObjectFlags[ObjectFlags["Interface"] = 2] = "Interface";
|
|
242
|
+
ObjectFlags[ObjectFlags["Reference"] = 4] = "Reference";
|
|
243
|
+
ObjectFlags[ObjectFlags["Tuple"] = 8] = "Tuple";
|
|
244
|
+
ObjectFlags[ObjectFlags["Anonymous"] = 16] = "Anonymous";
|
|
245
|
+
ObjectFlags[ObjectFlags["Mapped"] = 32] = "Mapped";
|
|
246
|
+
ObjectFlags[ObjectFlags["Instantiated"] = 64] = "Instantiated";
|
|
247
|
+
ObjectFlags[ObjectFlags["ObjectLiteral"] = 128] = "ObjectLiteral";
|
|
248
|
+
ObjectFlags[ObjectFlags["EvolvingArray"] = 256] = "EvolvingArray";
|
|
249
|
+
ObjectFlags[ObjectFlags["ObjectLiteralPatternWithComputedProperties"] = 512] = "ObjectLiteralPatternWithComputedProperties";
|
|
250
|
+
ObjectFlags[ObjectFlags["ContainsSpread"] = 1024] = "ContainsSpread";
|
|
251
|
+
ObjectFlags[ObjectFlags["ReverseMapped"] = 2048] = "ReverseMapped";
|
|
252
|
+
ObjectFlags[ObjectFlags["JsxAttributes"] = 4096] = "JsxAttributes";
|
|
253
|
+
ObjectFlags[ObjectFlags["MarkerType"] = 8192] = "MarkerType";
|
|
254
|
+
ObjectFlags[ObjectFlags["JSLiteral"] = 16384] = "JSLiteral";
|
|
255
|
+
ObjectFlags[ObjectFlags["FreshLiteral"] = 32768] = "FreshLiteral";
|
|
256
|
+
ObjectFlags[ObjectFlags["ArrayLiteral"] = 65536] = "ArrayLiteral";
|
|
257
|
+
ObjectFlags[ObjectFlags["ObjectRestType"] = 131072] = "ObjectRestType";
|
|
258
|
+
ObjectFlags[ObjectFlags["PrimitiveUnion"] = 262144] = "PrimitiveUnion";
|
|
259
|
+
ObjectFlags[ObjectFlags["ContainsWideningType"] = 524288] = "ContainsWideningType";
|
|
260
|
+
ObjectFlags[ObjectFlags["ContainsObjectOrArrayLiteral"] = 1048576] = "ContainsObjectOrArrayLiteral";
|
|
261
|
+
ObjectFlags[ObjectFlags["NonInferrableType"] = 2097152] = "NonInferrableType";
|
|
262
|
+
ObjectFlags[ObjectFlags["IsGenericObjectTypeComputed"] = 4194304] = "IsGenericObjectTypeComputed";
|
|
263
|
+
ObjectFlags[ObjectFlags["IsGenericObjectType"] = 8388608] = "IsGenericObjectType";
|
|
264
|
+
ObjectFlags[ObjectFlags["IsGenericIndexTypeComputed"] = 16777216] = "IsGenericIndexTypeComputed";
|
|
265
|
+
ObjectFlags[ObjectFlags["IsGenericIndexType"] = 33554432] = "IsGenericIndexType";
|
|
266
|
+
ObjectFlags[ObjectFlags["CouldContainTypeVariablesComputed"] = 67108864] = "CouldContainTypeVariablesComputed";
|
|
267
|
+
ObjectFlags[ObjectFlags["CouldContainTypeVariables"] = 134217728] = "CouldContainTypeVariables";
|
|
268
|
+
ObjectFlags[ObjectFlags["ContainsIntersections"] = 268435456] = "ContainsIntersections";
|
|
269
|
+
ObjectFlags[ObjectFlags["IsNeverIntersectionComputed"] = 268435456] = "IsNeverIntersectionComputed";
|
|
270
|
+
ObjectFlags[ObjectFlags["IsNeverIntersection"] = 536870912] = "IsNeverIntersection";
|
|
271
|
+
ObjectFlags[ObjectFlags["ClassOrInterface"] = 2] = "ClassOrInterface";
|
|
272
|
+
ObjectFlags[ObjectFlags["RequiresWidening"] = 1572864] = "RequiresWidening";
|
|
273
|
+
ObjectFlags[ObjectFlags["PropagatingFlags"] = 3670016] = "PropagatingFlags";
|
|
274
|
+
})(ObjectFlags || (ObjectFlags = {}));
|
|
275
|
+
export var VarianceFlags;
|
|
276
|
+
(function (VarianceFlags) {
|
|
277
|
+
VarianceFlags[VarianceFlags["Invariant"] = 0] = "Invariant";
|
|
278
|
+
VarianceFlags[VarianceFlags["Covariant"] = 1] = "Covariant";
|
|
279
|
+
VarianceFlags[VarianceFlags["Contravariant"] = 2] = "Contravariant";
|
|
280
|
+
VarianceFlags[VarianceFlags["Bivariant"] = 3] = "Bivariant";
|
|
281
|
+
VarianceFlags[VarianceFlags["Independent"] = 4] = "Independent";
|
|
282
|
+
VarianceFlags[VarianceFlags["VarianceMask"] = 7] = "VarianceMask";
|
|
283
|
+
VarianceFlags[VarianceFlags["Unmeasurable"] = 8] = "Unmeasurable";
|
|
284
|
+
VarianceFlags[VarianceFlags["Unreliable"] = 16] = "Unreliable";
|
|
285
|
+
VarianceFlags[VarianceFlags["AllowsStructuralFallback"] = 24] = "AllowsStructuralFallback";
|
|
286
|
+
})(VarianceFlags || (VarianceFlags = {}));
|
|
287
|
+
export var JsxReferenceKind;
|
|
288
|
+
(function (JsxReferenceKind) {
|
|
289
|
+
JsxReferenceKind[JsxReferenceKind["Function"] = 0] = "Function";
|
|
290
|
+
JsxReferenceKind[JsxReferenceKind["Mixed"] = 1] = "Mixed";
|
|
291
|
+
})(JsxReferenceKind || (JsxReferenceKind = {}));
|
|
292
|
+
export var SignatureFlags;
|
|
293
|
+
(function (SignatureFlags) {
|
|
294
|
+
SignatureFlags[SignatureFlags["None"] = 0] = "None";
|
|
295
|
+
SignatureFlags[SignatureFlags["HasRestParameter"] = 1] = "HasRestParameter";
|
|
296
|
+
SignatureFlags[SignatureFlags["HasLiteralTypes"] = 2] = "HasLiteralTypes";
|
|
297
|
+
SignatureFlags[SignatureFlags["IsInnerCallChain"] = 4] = "IsInnerCallChain";
|
|
298
|
+
SignatureFlags[SignatureFlags["IsOuterCallChain"] = 8] = "IsOuterCallChain";
|
|
299
|
+
// We do not propagate `IsInnerCallChain` to instantiated signatures, as that would result in us
|
|
300
|
+
// attempting to add `| undefined` on each recursive call to `getReturnTypeOfSignature` when
|
|
301
|
+
// instantiating the return type.
|
|
302
|
+
SignatureFlags[SignatureFlags["PropagatingFlags"] = 3] = "PropagatingFlags";
|
|
303
|
+
SignatureFlags[SignatureFlags["CallChainFlags"] = 12] = "CallChainFlags";
|
|
304
|
+
})(SignatureFlags || (SignatureFlags = {}));
|
|
305
|
+
export var IndexKind;
|
|
306
|
+
(function (IndexKind) {
|
|
307
|
+
IndexKind[IndexKind["String"] = 0] = "String";
|
|
308
|
+
IndexKind[IndexKind["Number"] = 1] = "Number";
|
|
309
|
+
})(IndexKind || (IndexKind = {}));
|
|
310
|
+
export var TypeMapKind;
|
|
311
|
+
(function (TypeMapKind) {
|
|
312
|
+
TypeMapKind[TypeMapKind["Simple"] = 0] = "Simple";
|
|
313
|
+
TypeMapKind[TypeMapKind["Array"] = 1] = "Array";
|
|
314
|
+
TypeMapKind[TypeMapKind["Function"] = 2] = "Function";
|
|
315
|
+
TypeMapKind[TypeMapKind["Composite"] = 3] = "Composite";
|
|
316
|
+
TypeMapKind[TypeMapKind["Merged"] = 4] = "Merged";
|
|
317
|
+
})(TypeMapKind || (TypeMapKind = {}));
|
|
318
|
+
export var InferencePriority;
|
|
319
|
+
(function (InferencePriority) {
|
|
320
|
+
InferencePriority[InferencePriority["None"] = 0] = "None";
|
|
321
|
+
InferencePriority[InferencePriority["NakedTypeVariable"] = 1] = "NakedTypeVariable";
|
|
322
|
+
InferencePriority[InferencePriority["HomomorphicMappedType"] = 2] = "HomomorphicMappedType";
|
|
323
|
+
InferencePriority[InferencePriority["PartialHomomorphicMappedType"] = 4] = "PartialHomomorphicMappedType";
|
|
324
|
+
InferencePriority[InferencePriority["MappedTypeConstraint"] = 8] = "MappedTypeConstraint";
|
|
325
|
+
InferencePriority[InferencePriority["ContravariantConditional"] = 16] = "ContravariantConditional";
|
|
326
|
+
InferencePriority[InferencePriority["ReturnType"] = 32] = "ReturnType";
|
|
327
|
+
InferencePriority[InferencePriority["LiteralKeyof"] = 64] = "LiteralKeyof";
|
|
328
|
+
InferencePriority[InferencePriority["NoConstraints"] = 128] = "NoConstraints";
|
|
329
|
+
InferencePriority[InferencePriority["AlwaysStrict"] = 256] = "AlwaysStrict";
|
|
330
|
+
InferencePriority[InferencePriority["MaxValue"] = 512] = "MaxValue";
|
|
331
|
+
InferencePriority[InferencePriority["PriorityImpliesCombination"] = 104] = "PriorityImpliesCombination";
|
|
332
|
+
InferencePriority[InferencePriority["Circularity"] = -1] = "Circularity";
|
|
333
|
+
})(InferencePriority || (InferencePriority = {}));
|
|
334
|
+
export var InferenceFlags;
|
|
335
|
+
(function (InferenceFlags) {
|
|
336
|
+
InferenceFlags[InferenceFlags["None"] = 0] = "None";
|
|
337
|
+
InferenceFlags[InferenceFlags["NoDefault"] = 1] = "NoDefault";
|
|
338
|
+
InferenceFlags[InferenceFlags["AnyDefault"] = 2] = "AnyDefault";
|
|
339
|
+
InferenceFlags[InferenceFlags["SkippedGenericFunction"] = 4] = "SkippedGenericFunction";
|
|
340
|
+
})(InferenceFlags || (InferenceFlags = {}));
|
|
341
|
+
/**
|
|
342
|
+
* Ternary values are defined such that
|
|
343
|
+
* x & y is False if either x or y is False.
|
|
344
|
+
* x & y is Maybe if either x or y is Maybe, but neither x or y is False.
|
|
345
|
+
* x & y is True if both x and y are True.
|
|
346
|
+
* x | y is False if both x and y are False.
|
|
347
|
+
* x | y is Maybe if either x or y is Maybe, but neither x or y is True.
|
|
348
|
+
* x | y is True if either x or y is True.
|
|
349
|
+
*/
|
|
350
|
+
export var Ternary;
|
|
351
|
+
(function (Ternary) {
|
|
352
|
+
Ternary[Ternary["False"] = 0] = "False";
|
|
353
|
+
Ternary[Ternary["Maybe"] = 1] = "Maybe";
|
|
354
|
+
Ternary[Ternary["True"] = -1] = "True";
|
|
355
|
+
})(Ternary || (Ternary = {}));
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as ts from "./_namespaces/ts.js";
|
|
2
|
+
import { CheckFlags, ObjectFlags, SignatureFlags, TypeFlags } from "./_namespaces/ts.js";
|
|
3
|
+
import type { CommentDirective, CommentDirectivesMap, DiagnosticCollection, IdentifierTypePredicate, IndexInfo, Signature, SourceFile, Symbol, Type, TypeChecker, TypePredicate } from "./_namespaces/ts.js";
|
|
4
|
+
/** Os construtores de `Type` e de `Signature`, que o `objectAllocator` da parse tree não tem: só o checker os cria. */
|
|
5
|
+
export interface TypeObjectAllocator {
|
|
6
|
+
getTypeConstructor(): new (checker: TypeChecker, flags: TypeFlags) => Type;
|
|
7
|
+
getSignatureConstructor(): new (checker: TypeChecker, flags: SignatureFlags) => Signature;
|
|
8
|
+
}
|
|
9
|
+
declare function Type(this: Type, checker: TypeChecker, flags: TypeFlags): void;
|
|
10
|
+
declare function Signature(this: Signature, checker: TypeChecker, flags: SignatureFlags): void;
|
|
11
|
+
export declare let typeObjectAllocator: TypeObjectAllocator;
|
|
12
|
+
/**
|
|
13
|
+
* Troca os construtores de `Type` e de `Signature`: o par do `setObjectAllocator` da árvore, que na tag trocava os
|
|
14
|
+
* dois junto com os do nó, num alocador só (CK-64). O language service troca os dois pelos dele, com os métodos que os
|
|
15
|
+
* serviços chamam (`type.isUnion()`, `signature.getDocumentationComment()`), ao carregar. Vale para o checker criado
|
|
16
|
+
* depois da troca.
|
|
17
|
+
*/
|
|
18
|
+
export declare function setTypeObjectAllocator(alloc: TypeObjectAllocator): void;
|
|
19
|
+
export declare function formatTypeFlags(flags: TypeFlags | undefined): string;
|
|
20
|
+
export declare function formatObjectFlags(flags: ObjectFlags | undefined): string;
|
|
21
|
+
/**
|
|
22
|
+
* A informação de depuração dos tipos, que o `Debug.enableDebugInfo` da parse tree não alcança: as flags e o texto do
|
|
23
|
+
* tipo, como propriedades do protótipo, para o depurador.
|
|
24
|
+
*/
|
|
25
|
+
export declare function enableTypeDebugInfo(): void;
|
|
26
|
+
export declare function createCommentDirectivesMap(sourceFile: SourceFile, commentDirectives: CommentDirective[]): CommentDirectivesMap;
|
|
27
|
+
export declare function getNameFromIndexInfo(info: IndexInfo): string | undefined;
|
|
28
|
+
export declare function isIdentifierTypePredicate(predicate: TypePredicate): predicate is IdentifierTypePredicate;
|
|
29
|
+
export declare function createDiagnosticCollection(): DiagnosticCollection;
|
|
30
|
+
export declare function getCheckFlags(symbol: Symbol): CheckFlags;
|
|
31
|
+
export declare function skipAlias(symbol: Symbol, checker: TypeChecker): ts.Symbol;
|
|
32
|
+
export declare function getObjectFlags(type: Type): ObjectFlags;
|
|
33
|
+
export declare function typeHasCallOrConstructSignatures(type: Type, checker: TypeChecker): boolean;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
// Modificado de microsoft/TypeScript v3.9.10, src/compiler/utilities.ts e src/compiler/debug.ts: os utilitários que só o
|
|
2
|
+
// checker usa.
|
|
3
|
+
import * as ts from "./_namespaces/ts.js";
|
|
4
|
+
import { CommentDirectiveType, Debug, SymbolFlags, arrayFrom, binarySearch, compareDiagnostics, compareDiagnosticsSkipRelatedInformation, compareStringsCaseSensitive, createMap, createMapFromEntries, declarationNameToString, flatMapToMutable, forEach, getLineAndCharacterOfPosition, identity, insertSorted, } from "./_namespaces/ts.js";
|
|
5
|
+
function Type(checker, flags) {
|
|
6
|
+
this.flags = flags;
|
|
7
|
+
if (Debug.isDebugging) {
|
|
8
|
+
this.checker = checker;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
function Signature(checker, flags) {
|
|
12
|
+
this.flags = flags;
|
|
13
|
+
if (Debug.isDebugging) {
|
|
14
|
+
this.checker = checker;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export let typeObjectAllocator = {
|
|
18
|
+
getTypeConstructor: () => Type,
|
|
19
|
+
getSignatureConstructor: () => Signature,
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Troca os construtores de `Type` e de `Signature`: o par do `setObjectAllocator` da árvore, que na tag trocava os
|
|
23
|
+
* dois junto com os do nó, num alocador só (CK-64). O language service troca os dois pelos dele, com os métodos que os
|
|
24
|
+
* serviços chamam (`type.isUnion()`, `signature.getDocumentationComment()`), ao carregar. Vale para o checker criado
|
|
25
|
+
* depois da troca.
|
|
26
|
+
*/
|
|
27
|
+
export function setTypeObjectAllocator(alloc) {
|
|
28
|
+
typeObjectAllocator = alloc;
|
|
29
|
+
}
|
|
30
|
+
export function formatTypeFlags(flags) {
|
|
31
|
+
return Debug.formatEnum(flags, ts.TypeFlags, /*isFlags*/ true);
|
|
32
|
+
}
|
|
33
|
+
export function formatObjectFlags(flags) {
|
|
34
|
+
return Debug.formatEnum(flags, ts.ObjectFlags, /*isFlags*/ true);
|
|
35
|
+
}
|
|
36
|
+
let isTypeDebugInfoEnabled = false;
|
|
37
|
+
/**
|
|
38
|
+
* A informação de depuração dos tipos, que o `Debug.enableDebugInfo` da parse tree não alcança: as flags e o texto do
|
|
39
|
+
* tipo, como propriedades do protótipo, para o depurador.
|
|
40
|
+
*/
|
|
41
|
+
export function enableTypeDebugInfo() {
|
|
42
|
+
if (isTypeDebugInfoEnabled)
|
|
43
|
+
return;
|
|
44
|
+
Debug.enableDebugInfo();
|
|
45
|
+
Object.defineProperties(typeObjectAllocator.getTypeConstructor().prototype, {
|
|
46
|
+
__debugFlags: { get() { return formatTypeFlags(this.flags); } },
|
|
47
|
+
__debugObjectFlags: { get() { return this.flags & 524288 /* TypeFlags.Object */ ? formatObjectFlags(this.objectFlags) : ""; } },
|
|
48
|
+
__debugTypeToString: { value() { return this.checker.typeToString(this); } },
|
|
49
|
+
});
|
|
50
|
+
isTypeDebugInfoEnabled = true;
|
|
51
|
+
}
|
|
52
|
+
export function createCommentDirectivesMap(sourceFile, commentDirectives) {
|
|
53
|
+
const directivesByLine = createMapFromEntries(commentDirectives.map(commentDirective => ([
|
|
54
|
+
`${getLineAndCharacterOfPosition(sourceFile, commentDirective.range.end).line}`,
|
|
55
|
+
commentDirective,
|
|
56
|
+
])));
|
|
57
|
+
const usedLines = createMap();
|
|
58
|
+
return { getUnusedExpectations, markUsed };
|
|
59
|
+
function getUnusedExpectations() {
|
|
60
|
+
return arrayFrom(directivesByLine.entries())
|
|
61
|
+
.filter(([line, directive]) => directive.type === CommentDirectiveType.ExpectError && !usedLines.get(line))
|
|
62
|
+
.map(([_, directive]) => directive);
|
|
63
|
+
}
|
|
64
|
+
function markUsed(line) {
|
|
65
|
+
if (!directivesByLine.has(`${line}`)) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
usedLines.set(`${line}`, true);
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
export function getNameFromIndexInfo(info) {
|
|
73
|
+
return info.declaration ? declarationNameToString(info.declaration.parameters[0].name) : undefined;
|
|
74
|
+
}
|
|
75
|
+
export function isIdentifierTypePredicate(predicate) {
|
|
76
|
+
return predicate && predicate.kind === 0 /* TypePredicateKind.Identifier */;
|
|
77
|
+
}
|
|
78
|
+
export function createDiagnosticCollection() {
|
|
79
|
+
let nonFileDiagnostics = []; // See GH#19873
|
|
80
|
+
const filesWithDiagnostics = [];
|
|
81
|
+
const fileDiagnostics = createMap();
|
|
82
|
+
let hasReadNonFileDiagnostics = false;
|
|
83
|
+
return {
|
|
84
|
+
add,
|
|
85
|
+
lookup,
|
|
86
|
+
getGlobalDiagnostics,
|
|
87
|
+
getDiagnostics,
|
|
88
|
+
reattachFileDiagnostics
|
|
89
|
+
};
|
|
90
|
+
function reattachFileDiagnostics(newFile) {
|
|
91
|
+
forEach(fileDiagnostics.get(newFile.fileName), diagnostic => diagnostic.file = newFile);
|
|
92
|
+
}
|
|
93
|
+
function lookup(diagnostic) {
|
|
94
|
+
let diagnostics;
|
|
95
|
+
if (diagnostic.file) {
|
|
96
|
+
diagnostics = fileDiagnostics.get(diagnostic.file.fileName);
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
diagnostics = nonFileDiagnostics;
|
|
100
|
+
}
|
|
101
|
+
if (!diagnostics) {
|
|
102
|
+
return undefined;
|
|
103
|
+
}
|
|
104
|
+
const result = binarySearch(diagnostics, diagnostic, identity, compareDiagnosticsSkipRelatedInformation);
|
|
105
|
+
if (result >= 0) {
|
|
106
|
+
return diagnostics[result];
|
|
107
|
+
}
|
|
108
|
+
return undefined;
|
|
109
|
+
}
|
|
110
|
+
function add(diagnostic) {
|
|
111
|
+
let diagnostics;
|
|
112
|
+
if (diagnostic.file) {
|
|
113
|
+
diagnostics = fileDiagnostics.get(diagnostic.file.fileName);
|
|
114
|
+
if (!diagnostics) {
|
|
115
|
+
diagnostics = []; // See GH#19873
|
|
116
|
+
fileDiagnostics.set(diagnostic.file.fileName, diagnostics);
|
|
117
|
+
insertSorted(filesWithDiagnostics, diagnostic.file.fileName, compareStringsCaseSensitive);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
// If we've already read the non-file diagnostics, do not modify the existing array.
|
|
122
|
+
if (hasReadNonFileDiagnostics) {
|
|
123
|
+
hasReadNonFileDiagnostics = false;
|
|
124
|
+
nonFileDiagnostics = nonFileDiagnostics.slice();
|
|
125
|
+
}
|
|
126
|
+
diagnostics = nonFileDiagnostics;
|
|
127
|
+
}
|
|
128
|
+
insertSorted(diagnostics, diagnostic, compareDiagnostics);
|
|
129
|
+
}
|
|
130
|
+
function getGlobalDiagnostics() {
|
|
131
|
+
hasReadNonFileDiagnostics = true;
|
|
132
|
+
return nonFileDiagnostics;
|
|
133
|
+
}
|
|
134
|
+
function getDiagnostics(fileName) {
|
|
135
|
+
if (fileName) {
|
|
136
|
+
return fileDiagnostics.get(fileName) || [];
|
|
137
|
+
}
|
|
138
|
+
const fileDiags = flatMapToMutable(filesWithDiagnostics, f => fileDiagnostics.get(f));
|
|
139
|
+
if (!nonFileDiagnostics.length) {
|
|
140
|
+
return fileDiags;
|
|
141
|
+
}
|
|
142
|
+
fileDiags.unshift(...nonFileDiagnostics);
|
|
143
|
+
return fileDiags;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
export function getCheckFlags(symbol) {
|
|
147
|
+
return symbol.flags & SymbolFlags.Transient ? symbol.checkFlags : 0;
|
|
148
|
+
}
|
|
149
|
+
export function skipAlias(symbol, checker) {
|
|
150
|
+
return symbol.flags & SymbolFlags.Alias ? checker.getAliasedSymbol(symbol) : symbol;
|
|
151
|
+
}
|
|
152
|
+
export function getObjectFlags(type) {
|
|
153
|
+
return type.flags & 3899393 /* TypeFlags.ObjectFlagsType */ ? type.objectFlags : 0;
|
|
154
|
+
}
|
|
155
|
+
export function typeHasCallOrConstructSignatures(type, checker) {
|
|
156
|
+
return checker.getSignaturesOfType(type).length !== 0;
|
|
157
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/*! *****************************************************************************
|
|
2
|
+
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
4
|
+
this file except in compliance with the License. You may obtain a copy of the
|
|
5
|
+
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
8
|
+
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
9
|
+
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
10
|
+
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
11
|
+
|
|
12
|
+
See the Apache Version 2.0 License for specific language governing permissions
|
|
13
|
+
and limitations under the License.
|
|
14
|
+
***************************************************************************** */
|
|
15
|
+
|
|
16
|
+
// A lib da cópia (CK-48): os aliases da lib dos embutidos do oráculo (`packages/oracle/lib/lib.tslite.d.ts`, CK-42), com
|
|
17
|
+
// o texto da tag. Os embutidos nascem no checker: o `Array`, o `ReadonlyArray` e o `Promise` com o nome que o programa
|
|
18
|
+
// escreve; o `PromiseLike`, o protocolo de iteração, o `Function`, o `String`, o `Number` e o `Boolean`, sem nome que um
|
|
19
|
+
// programa alcance; e o `Object`, o `CallableFunction`, o `NewableFunction`, o `IArguments`, o `RegExp` e o `Symbol` o
|
|
20
|
+
// checker não procura mais. A lib do oráculo continua a declarar todos, porque a tag os procura.
|
|
21
|
+
|
|
22
|
+
/// <reference no-default-lib="true"/>
|
|
23
|
+
|
|
24
|
+
declare type PropertyKey = string | number;
|
|
25
|
+
|
|
26
|
+
type Partial<T> = {
|
|
27
|
+
[P in keyof T]?: T[P];
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
type Required<T> = {
|
|
31
|
+
[P in keyof T]-?: T[P];
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
type Readonly<T> = {
|
|
35
|
+
readonly [P in keyof T]: T[P];
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
type Pick<T, K extends keyof T> = {
|
|
39
|
+
[P in K]: T[P];
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
type Record<K extends keyof any, T> = {
|
|
43
|
+
[P in K]: T;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
type Exclude<T, U> = T extends U ? never : T;
|
|
47
|
+
|
|
48
|
+
type Extract<T, U> = T extends U ? T : never;
|
|
49
|
+
|
|
50
|
+
type Omit<T, K extends keyof any> = Pick<T, Exclude<keyof T, K>>;
|
|
51
|
+
|
|
52
|
+
type NonNullable<T> = T extends null | undefined ? never : T;
|
|
53
|
+
|
|
54
|
+
type Parameters<T extends (...args: any) => any> = T extends (...args: infer P) => any ? P : never;
|
|
55
|
+
|
|
56
|
+
type ReturnType<T extends (...args: any) => any> = T extends (...args: any) => infer R ? R : any;
|