typescript 4.8.0-dev.20220712 → 4.8.0-dev.20220715
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/lib/lib.es2015.collection.d.ts +62 -1
- package/lib/tsc.js +36 -43
- package/lib/tsserver.js +76 -76
- package/lib/tsserverlibrary.js +76 -76
- package/lib/typescript.js +76 -76
- package/lib/typescriptServices.js +76 -76
- package/lib/typingsInstaller.js +58 -73
- package/package.json +1 -1
|
@@ -19,18 +19,38 @@ and limitations under the License.
|
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
interface Map<K, V> {
|
|
22
|
+
|
|
22
23
|
clear(): void;
|
|
24
|
+
/**
|
|
25
|
+
* @returns true if an element in the Map existed and has been removed, or false if the element does not exist.
|
|
26
|
+
*/
|
|
23
27
|
delete(key: K): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Executes a provided function once per each key/value pair in the Map, in insertion order.
|
|
30
|
+
*/
|
|
24
31
|
forEach(callbackfn: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void;
|
|
32
|
+
/**
|
|
33
|
+
* Returns a specified element from the Map object. If the value that is associated to the provided key is an object, then you will get a reference to that object and any change made to that object will effectively modify it inside the Map.
|
|
34
|
+
* @returns Returns the element associated with the specified key. If no element is associated with the specified key, undefined is returned.
|
|
35
|
+
*/
|
|
25
36
|
get(key: K): V | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* @returns boolean indicating whether an element with the specified key exists or not.
|
|
39
|
+
*/
|
|
26
40
|
has(key: K): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Adds a new element with a specified key and value to the Map. If an element with the same key already exists, the element will be updated.
|
|
43
|
+
*/
|
|
27
44
|
set(key: K, value: V): this;
|
|
45
|
+
/**
|
|
46
|
+
* @returns the number of elements in the Map.
|
|
47
|
+
*/
|
|
28
48
|
readonly size: number;
|
|
29
49
|
}
|
|
30
50
|
|
|
31
51
|
interface MapConstructor {
|
|
32
52
|
new(): Map<any, any>;
|
|
33
|
-
new<K, V>(entries?: readonly (readonly [K, V])[] | null): Map<K, V>;
|
|
53
|
+
new <K, V>(entries?: readonly (readonly [K, V])[] | null): Map<K, V>;
|
|
34
54
|
readonly prototype: Map<any, any>;
|
|
35
55
|
}
|
|
36
56
|
declare var Map: MapConstructor;
|
|
@@ -43,9 +63,23 @@ interface ReadonlyMap<K, V> {
|
|
|
43
63
|
}
|
|
44
64
|
|
|
45
65
|
interface WeakMap<K extends object, V> {
|
|
66
|
+
/**
|
|
67
|
+
* Removes the specified element from the WeakMap.
|
|
68
|
+
* @returns true if the element was successfully removed, or false if it was not present.
|
|
69
|
+
*/
|
|
46
70
|
delete(key: K): boolean;
|
|
71
|
+
/**
|
|
72
|
+
* @returns a specified element.
|
|
73
|
+
*/
|
|
47
74
|
get(key: K): V | undefined;
|
|
75
|
+
/**
|
|
76
|
+
* @returns a boolean indicating whether an element with the specified key exists or not.
|
|
77
|
+
*/
|
|
48
78
|
has(key: K): boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Adds a new element with a specified key and value.
|
|
81
|
+
* @param key Must be an object.
|
|
82
|
+
*/
|
|
49
83
|
set(key: K, value: V): this;
|
|
50
84
|
}
|
|
51
85
|
|
|
@@ -56,11 +90,28 @@ interface WeakMapConstructor {
|
|
|
56
90
|
declare var WeakMap: WeakMapConstructor;
|
|
57
91
|
|
|
58
92
|
interface Set<T> {
|
|
93
|
+
/**
|
|
94
|
+
* Appends a new element with a specified value to the end of the Set.
|
|
95
|
+
*/
|
|
59
96
|
add(value: T): this;
|
|
97
|
+
|
|
60
98
|
clear(): void;
|
|
99
|
+
/**
|
|
100
|
+
* Removes a specified value from the Set.
|
|
101
|
+
* @returns Returns true if an element in the Set existed and has been removed, or false if the element does not exist.
|
|
102
|
+
*/
|
|
61
103
|
delete(value: T): boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Executes a provided function once per each value in the Set object, in insertion order.
|
|
106
|
+
*/
|
|
62
107
|
forEach(callbackfn: (value: T, value2: T, set: Set<T>) => void, thisArg?: any): void;
|
|
108
|
+
/**
|
|
109
|
+
* @returns a boolean indicating whether an element with the specified value exists in the Set or not.
|
|
110
|
+
*/
|
|
63
111
|
has(value: T): boolean;
|
|
112
|
+
/**
|
|
113
|
+
* @returns the number of (unique) elements in Set.
|
|
114
|
+
*/
|
|
64
115
|
readonly size: number;
|
|
65
116
|
}
|
|
66
117
|
|
|
@@ -77,8 +128,18 @@ interface ReadonlySet<T> {
|
|
|
77
128
|
}
|
|
78
129
|
|
|
79
130
|
interface WeakSet<T extends object> {
|
|
131
|
+
/**
|
|
132
|
+
* Appends a new object to the end of the WeakSet.
|
|
133
|
+
*/
|
|
80
134
|
add(value: T): this;
|
|
135
|
+
/**
|
|
136
|
+
* Removes the specified element from the WeakSet.
|
|
137
|
+
* @returns Returns true if the element existed and has been removed, or false if the element does not exist.
|
|
138
|
+
*/
|
|
81
139
|
delete(value: T): boolean;
|
|
140
|
+
/**
|
|
141
|
+
* @returns a boolean indicating whether an object exists in the WeakSet or not.
|
|
142
|
+
*/
|
|
82
143
|
has(value: T): boolean;
|
|
83
144
|
}
|
|
84
145
|
|
package/lib/tsc.js
CHANGED
|
@@ -69,7 +69,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
69
69
|
var ts;
|
|
70
70
|
(function (ts) {
|
|
71
71
|
ts.versionMajorMinor = "4.8";
|
|
72
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
72
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220715";
|
|
73
73
|
var NativeCollections;
|
|
74
74
|
(function (NativeCollections) {
|
|
75
75
|
var globals = typeof globalThis !== "undefined" ? globalThis :
|
|
@@ -38457,24 +38457,6 @@ var ts;
|
|
|
38457
38457
|
typeLiteralSymbol.members.set(symbol.escapedName, symbol);
|
|
38458
38458
|
}
|
|
38459
38459
|
function bindObjectLiteralExpression(node) {
|
|
38460
|
-
if (inStrictMode && !ts.isAssignmentTarget(node)) {
|
|
38461
|
-
var seen = new ts.Map();
|
|
38462
|
-
for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
|
|
38463
|
-
var prop = _a[_i];
|
|
38464
|
-
if (prop.kind === 298 || prop.name.kind !== 79) {
|
|
38465
|
-
continue;
|
|
38466
|
-
}
|
|
38467
|
-
var identifier = prop.name;
|
|
38468
|
-
var currentKind = prop.kind === 296 || prop.kind === 297 || prop.kind === 169
|
|
38469
|
-
? 1
|
|
38470
|
-
: 2;
|
|
38471
|
-
var existingKind = seen.get(identifier.escapedText);
|
|
38472
|
-
if (!existingKind) {
|
|
38473
|
-
seen.set(identifier.escapedText, currentKind);
|
|
38474
|
-
continue;
|
|
38475
|
-
}
|
|
38476
|
-
}
|
|
38477
|
-
}
|
|
38478
38460
|
return bindAnonymousDeclaration(node, 4096, "__object");
|
|
38479
38461
|
}
|
|
38480
38462
|
function bindJsxAttributes(node) {
|
|
@@ -40278,11 +40260,10 @@ var ts;
|
|
|
40278
40260
|
var unresolvedSymbols = new ts.Map();
|
|
40279
40261
|
var errorTypes = new ts.Map();
|
|
40280
40262
|
var anyType = createIntrinsicType(1, "any");
|
|
40281
|
-
var autoType = createIntrinsicType(1, "any");
|
|
40263
|
+
var autoType = createIntrinsicType(1, "any", 262144);
|
|
40282
40264
|
var wildcardType = createIntrinsicType(1, "any");
|
|
40283
40265
|
var errorType = createIntrinsicType(1, "error");
|
|
40284
40266
|
var unresolvedType = createIntrinsicType(1, "unresolved");
|
|
40285
|
-
var nonInferrableAnyType = createIntrinsicType(1, "any", 65536);
|
|
40286
40267
|
var intrinsicMarkerType = createIntrinsicType(1, "intrinsic");
|
|
40287
40268
|
var unknownType = createIntrinsicType(2, "unknown");
|
|
40288
40269
|
var nonNullUnknownType = createIntrinsicType(2, "unknown");
|
|
@@ -40311,8 +40292,7 @@ var ts;
|
|
|
40311
40292
|
var esSymbolType = createIntrinsicType(4096, "symbol");
|
|
40312
40293
|
var voidType = createIntrinsicType(16384, "void");
|
|
40313
40294
|
var neverType = createIntrinsicType(131072, "never");
|
|
40314
|
-
var silentNeverType = createIntrinsicType(131072, "never");
|
|
40315
|
-
var nonInferrableType = createIntrinsicType(131072, "never", 262144);
|
|
40295
|
+
var silentNeverType = createIntrinsicType(131072, "never", 262144);
|
|
40316
40296
|
var implicitNeverType = createIntrinsicType(131072, "never");
|
|
40317
40297
|
var unreachableNeverType = createIntrinsicType(131072, "never");
|
|
40318
40298
|
var nonPrimitiveType = createIntrinsicType(67108864, "object");
|
|
@@ -47043,7 +47023,7 @@ var ts;
|
|
|
47043
47023
|
if (reportErrors && !declarationBelongsToPrivateAmbientMember(element)) {
|
|
47044
47024
|
reportImplicitAny(element, anyType);
|
|
47045
47025
|
}
|
|
47046
|
-
return
|
|
47026
|
+
return anyType;
|
|
47047
47027
|
}
|
|
47048
47028
|
function getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) {
|
|
47049
47029
|
var members = ts.createSymbolTable();
|
|
@@ -50345,7 +50325,7 @@ var ts;
|
|
|
50345
50325
|
var result = 0;
|
|
50346
50326
|
for (var _i = 0, types_8 = types; _i < types_8.length; _i++) {
|
|
50347
50327
|
var type = types_8[_i];
|
|
50348
|
-
if (!(type.flags & excludeKinds)) {
|
|
50328
|
+
if (excludeKinds === undefined || !(type.flags & excludeKinds)) {
|
|
50349
50329
|
result |= ts.getObjectFlags(type);
|
|
50350
50330
|
}
|
|
50351
50331
|
}
|
|
@@ -50357,7 +50337,7 @@ var ts;
|
|
|
50357
50337
|
if (!type) {
|
|
50358
50338
|
type = createObjectType(4, target.symbol);
|
|
50359
50339
|
target.instantiations.set(id, type);
|
|
50360
|
-
type.objectFlags |= typeArguments ? getPropagatingFlagsOfTypes(typeArguments
|
|
50340
|
+
type.objectFlags |= typeArguments ? getPropagatingFlagsOfTypes(typeArguments) : 0;
|
|
50361
50341
|
type.target = target;
|
|
50362
50342
|
type.resolvedTypeArguments = typeArguments;
|
|
50363
50343
|
}
|
|
@@ -53417,6 +53397,7 @@ var ts;
|
|
|
53417
53397
|
result.mapper = mapper;
|
|
53418
53398
|
result.aliasSymbol = aliasSymbol || type.aliasSymbol;
|
|
53419
53399
|
result.aliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(type.aliasTypeArguments, mapper);
|
|
53400
|
+
result.objectFlags |= result.aliasTypeArguments ? getPropagatingFlagsOfTypes(result.aliasTypeArguments) : 0;
|
|
53420
53401
|
return result;
|
|
53421
53402
|
}
|
|
53422
53403
|
function getConditionalTypeInstantiation(type, mapper, aliasSymbol, aliasTypeArguments) {
|
|
@@ -57685,8 +57666,10 @@ var ts;
|
|
|
57685
57666
|
propagationType = savePropagationType;
|
|
57686
57667
|
return;
|
|
57687
57668
|
}
|
|
57688
|
-
if (source.aliasSymbol && source.
|
|
57689
|
-
|
|
57669
|
+
if (source.aliasSymbol && source.aliasSymbol === target.aliasSymbol) {
|
|
57670
|
+
if (source.aliasTypeArguments) {
|
|
57671
|
+
inferFromTypeArguments(source.aliasTypeArguments, target.aliasTypeArguments, getAliasVariances(source.aliasSymbol));
|
|
57672
|
+
}
|
|
57690
57673
|
return;
|
|
57691
57674
|
}
|
|
57692
57675
|
if (source === target && source.flags & 3145728) {
|
|
@@ -57723,7 +57706,7 @@ var ts;
|
|
|
57723
57706
|
target = getActualTypeVariable(target);
|
|
57724
57707
|
}
|
|
57725
57708
|
if (target.flags & 8650752) {
|
|
57726
|
-
if (
|
|
57709
|
+
if (isFromInferenceBlockedSource(source)) {
|
|
57727
57710
|
return;
|
|
57728
57711
|
}
|
|
57729
57712
|
var inference = getInferenceInfoForType(target);
|
|
@@ -58192,19 +58175,16 @@ var ts;
|
|
|
58192
58175
|
var sourceLen = sourceSignatures.length;
|
|
58193
58176
|
var targetLen = targetSignatures.length;
|
|
58194
58177
|
var len = sourceLen < targetLen ? sourceLen : targetLen;
|
|
58195
|
-
var skipParameters = !!(ts.getObjectFlags(source) & 262144);
|
|
58196
58178
|
for (var i = 0; i < len; i++) {
|
|
58197
|
-
inferFromSignature(getBaseSignature(sourceSignatures[sourceLen - len + i]), getErasedSignature(targetSignatures[targetLen - len + i])
|
|
58179
|
+
inferFromSignature(getBaseSignature(sourceSignatures[sourceLen - len + i]), getErasedSignature(targetSignatures[targetLen - len + i]));
|
|
58198
58180
|
}
|
|
58199
58181
|
}
|
|
58200
|
-
function inferFromSignature(source, target
|
|
58201
|
-
|
|
58202
|
-
|
|
58203
|
-
|
|
58204
|
-
|
|
58205
|
-
|
|
58206
|
-
bivariant = saveBivariant;
|
|
58207
|
-
}
|
|
58182
|
+
function inferFromSignature(source, target) {
|
|
58183
|
+
var saveBivariant = bivariant;
|
|
58184
|
+
var kind = target.declaration ? target.declaration.kind : 0;
|
|
58185
|
+
bivariant = bivariant || kind === 169 || kind === 168 || kind === 171;
|
|
58186
|
+
applyToParameterTypes(source, target, inferFromContravariantTypes);
|
|
58187
|
+
bivariant = saveBivariant;
|
|
58208
58188
|
applyToReturnTypes(source, target, inferFromTypes);
|
|
58209
58189
|
}
|
|
58210
58190
|
function inferFromIndexTypes(source, target) {
|
|
@@ -61287,6 +61267,14 @@ var ts;
|
|
|
61287
61267
|
var lhsType = getTypeOfExpression(e.expression);
|
|
61288
61268
|
return ts.isPrivateIdentifier(e.name) ? tryGetPrivateIdentifierPropertyOfType(lhsType, e.name) : getPropertyOfType(lhsType, e.name.escapedText);
|
|
61289
61269
|
}
|
|
61270
|
+
if (ts.isElementAccessExpression(e)) {
|
|
61271
|
+
var propType = checkExpressionCached(e.argumentExpression);
|
|
61272
|
+
if (!isTypeUsableAsPropertyName(propType)) {
|
|
61273
|
+
return undefined;
|
|
61274
|
+
}
|
|
61275
|
+
var lhsType = getTypeOfExpression(e.expression);
|
|
61276
|
+
return getPropertyOfType(lhsType, getPropertyNameFromType(propType));
|
|
61277
|
+
}
|
|
61290
61278
|
return undefined;
|
|
61291
61279
|
function tryGetPrivateIdentifierPropertyOfType(type, id) {
|
|
61292
61280
|
var lexicallyScopedSymbol = lookupSymbolForPrivateIdentifierDeclaration(id.escapedText, id);
|
|
@@ -65063,7 +65051,7 @@ var ts;
|
|
|
65063
65051
|
checkGrammarTypeArguments(node, node.typeArguments);
|
|
65064
65052
|
var signature = getResolvedSignature(node, undefined, checkMode);
|
|
65065
65053
|
if (signature === resolvingSignature) {
|
|
65066
|
-
return
|
|
65054
|
+
return silentNeverType;
|
|
65067
65055
|
}
|
|
65068
65056
|
checkDeprecatedSignature(signature, node);
|
|
65069
65057
|
if (node.expression.kind === 106) {
|
|
@@ -70743,9 +70731,14 @@ var ts;
|
|
|
70743
70731
|
function unwrapReturnType(returnType, functionFlags) {
|
|
70744
70732
|
var isGenerator = !!(functionFlags & 1);
|
|
70745
70733
|
var isAsync = !!(functionFlags & 2);
|
|
70746
|
-
|
|
70747
|
-
|
|
70748
|
-
|
|
70734
|
+
if (isGenerator) {
|
|
70735
|
+
var returnIterationType = getIterationTypeOfGeneratorFunctionReturnType(1, returnType, isAsync);
|
|
70736
|
+
if (!returnIterationType) {
|
|
70737
|
+
return errorType;
|
|
70738
|
+
}
|
|
70739
|
+
return isAsync ? getAwaitedTypeNoAlias(unwrapAwaitedType(returnIterationType)) : returnIterationType;
|
|
70740
|
+
}
|
|
70741
|
+
return isAsync ? getAwaitedTypeNoAlias(returnType) || errorType : returnType;
|
|
70749
70742
|
}
|
|
70750
70743
|
function isUnwrappedReturnTypeVoidOrAny(func, returnType) {
|
|
70751
70744
|
var unwrappedReturnType = unwrapReturnType(returnType, ts.getFunctionFlags(func));
|
package/lib/tsserver.js
CHANGED
|
@@ -109,7 +109,7 @@ var ts;
|
|
|
109
109
|
// The following is baselined as a literal template type without intervention
|
|
110
110
|
/** The version of the TypeScript compiler release */
|
|
111
111
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
112
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
112
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220715";
|
|
113
113
|
/* @internal */
|
|
114
114
|
var Comparison;
|
|
115
115
|
(function (Comparison) {
|
|
@@ -46881,37 +46881,6 @@ var ts;
|
|
|
46881
46881
|
typeLiteralSymbol.members.set(symbol.escapedName, symbol);
|
|
46882
46882
|
}
|
|
46883
46883
|
function bindObjectLiteralExpression(node) {
|
|
46884
|
-
var ElementKind;
|
|
46885
|
-
(function (ElementKind) {
|
|
46886
|
-
ElementKind[ElementKind["Property"] = 1] = "Property";
|
|
46887
|
-
ElementKind[ElementKind["Accessor"] = 2] = "Accessor";
|
|
46888
|
-
})(ElementKind || (ElementKind = {}));
|
|
46889
|
-
if (inStrictMode && !ts.isAssignmentTarget(node)) {
|
|
46890
|
-
var seen = new ts.Map();
|
|
46891
|
-
for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
|
|
46892
|
-
var prop = _a[_i];
|
|
46893
|
-
if (prop.kind === 298 /* SpreadAssignment */ || prop.name.kind !== 79 /* Identifier */) {
|
|
46894
|
-
continue;
|
|
46895
|
-
}
|
|
46896
|
-
var identifier = prop.name;
|
|
46897
|
-
// ECMA-262 11.1.5 Object Initializer
|
|
46898
|
-
// If previous is not undefined then throw a SyntaxError exception if any of the following conditions are true
|
|
46899
|
-
// a.This production is contained in strict code and IsDataDescriptor(previous) is true and
|
|
46900
|
-
// IsDataDescriptor(propId.descriptor) is true.
|
|
46901
|
-
// b.IsDataDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true.
|
|
46902
|
-
// c.IsAccessorDescriptor(previous) is true and IsDataDescriptor(propId.descriptor) is true.
|
|
46903
|
-
// d.IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true
|
|
46904
|
-
// and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields
|
|
46905
|
-
var currentKind = prop.kind === 296 /* PropertyAssignment */ || prop.kind === 297 /* ShorthandPropertyAssignment */ || prop.kind === 169 /* MethodDeclaration */
|
|
46906
|
-
? 1 /* Property */
|
|
46907
|
-
: 2 /* Accessor */;
|
|
46908
|
-
var existingKind = seen.get(identifier.escapedText);
|
|
46909
|
-
if (!existingKind) {
|
|
46910
|
-
seen.set(identifier.escapedText, currentKind);
|
|
46911
|
-
continue;
|
|
46912
|
-
}
|
|
46913
|
-
}
|
|
46914
|
-
}
|
|
46915
46884
|
return bindAnonymousDeclaration(node, 4096 /* ObjectLiteral */, "__object" /* Object */);
|
|
46916
46885
|
}
|
|
46917
46886
|
function bindJsxAttributes(node) {
|
|
@@ -49150,11 +49119,10 @@ var ts;
|
|
|
49150
49119
|
var unresolvedSymbols = new ts.Map();
|
|
49151
49120
|
var errorTypes = new ts.Map();
|
|
49152
49121
|
var anyType = createIntrinsicType(1 /* Any */, "any");
|
|
49153
|
-
var autoType = createIntrinsicType(1 /* Any */, "any");
|
|
49122
|
+
var autoType = createIntrinsicType(1 /* Any */, "any", 262144 /* NonInferrableType */);
|
|
49154
49123
|
var wildcardType = createIntrinsicType(1 /* Any */, "any");
|
|
49155
49124
|
var errorType = createIntrinsicType(1 /* Any */, "error");
|
|
49156
49125
|
var unresolvedType = createIntrinsicType(1 /* Any */, "unresolved");
|
|
49157
|
-
var nonInferrableAnyType = createIntrinsicType(1 /* Any */, "any", 65536 /* ContainsWideningType */);
|
|
49158
49126
|
var intrinsicMarkerType = createIntrinsicType(1 /* Any */, "intrinsic");
|
|
49159
49127
|
var unknownType = createIntrinsicType(2 /* Unknown */, "unknown");
|
|
49160
49128
|
var nonNullUnknownType = createIntrinsicType(2 /* Unknown */, "unknown");
|
|
@@ -49183,8 +49151,7 @@ var ts;
|
|
|
49183
49151
|
var esSymbolType = createIntrinsicType(4096 /* ESSymbol */, "symbol");
|
|
49184
49152
|
var voidType = createIntrinsicType(16384 /* Void */, "void");
|
|
49185
49153
|
var neverType = createIntrinsicType(131072 /* Never */, "never");
|
|
49186
|
-
var silentNeverType = createIntrinsicType(131072 /* Never */, "never");
|
|
49187
|
-
var nonInferrableType = createIntrinsicType(131072 /* Never */, "never", 262144 /* NonInferrableType */);
|
|
49154
|
+
var silentNeverType = createIntrinsicType(131072 /* Never */, "never", 262144 /* NonInferrableType */);
|
|
49188
49155
|
var implicitNeverType = createIntrinsicType(131072 /* Never */, "never");
|
|
49189
49156
|
var unreachableNeverType = createIntrinsicType(131072 /* Never */, "never");
|
|
49190
49157
|
var nonPrimitiveType = createIntrinsicType(67108864 /* NonPrimitive */, "object");
|
|
@@ -56922,11 +56889,7 @@ var ts;
|
|
|
56922
56889
|
if (reportErrors && !declarationBelongsToPrivateAmbientMember(element)) {
|
|
56923
56890
|
reportImplicitAny(element, anyType);
|
|
56924
56891
|
}
|
|
56925
|
-
|
|
56926
|
-
// use the non-inferrable any type. Inference will never directly infer this type, but it is possible
|
|
56927
|
-
// to infer a type that contains it, e.g. for a binding pattern like [foo] or { foo }. In such cases,
|
|
56928
|
-
// widening of the binding pattern type substitutes a regular any for the non-inferrable any.
|
|
56929
|
-
return includePatternInType ? nonInferrableAnyType : anyType;
|
|
56892
|
+
return anyType;
|
|
56930
56893
|
}
|
|
56931
56894
|
// Return the type implied by an object binding pattern
|
|
56932
56895
|
function getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) {
|
|
@@ -60712,13 +60675,13 @@ var ts;
|
|
|
60712
60675
|
}
|
|
60713
60676
|
// This function is used to propagate certain flags when creating new object type references and union types.
|
|
60714
60677
|
// It is only necessary to do so if a constituent type might be the undefined type, the null type, the type
|
|
60715
|
-
// of an object literal or
|
|
60678
|
+
// of an object literal or a non-inferrable type. This is because there are operations in the type checker
|
|
60716
60679
|
// that care about the presence of such types at arbitrary depth in a containing type.
|
|
60717
60680
|
function getPropagatingFlagsOfTypes(types, excludeKinds) {
|
|
60718
60681
|
var result = 0;
|
|
60719
60682
|
for (var _i = 0, types_8 = types; _i < types_8.length; _i++) {
|
|
60720
60683
|
var type = types_8[_i];
|
|
60721
|
-
if (!(type.flags & excludeKinds)) {
|
|
60684
|
+
if (excludeKinds === undefined || !(type.flags & excludeKinds)) {
|
|
60722
60685
|
result |= ts.getObjectFlags(type);
|
|
60723
60686
|
}
|
|
60724
60687
|
}
|
|
@@ -60730,7 +60693,7 @@ var ts;
|
|
|
60730
60693
|
if (!type) {
|
|
60731
60694
|
type = createObjectType(4 /* Reference */, target.symbol);
|
|
60732
60695
|
target.instantiations.set(id, type);
|
|
60733
|
-
type.objectFlags |= typeArguments ? getPropagatingFlagsOfTypes(typeArguments
|
|
60696
|
+
type.objectFlags |= typeArguments ? getPropagatingFlagsOfTypes(typeArguments) : 0;
|
|
60734
60697
|
type.target = target;
|
|
60735
60698
|
type.resolvedTypeArguments = typeArguments;
|
|
60736
60699
|
}
|
|
@@ -64164,6 +64127,7 @@ var ts;
|
|
|
64164
64127
|
result.mapper = mapper;
|
|
64165
64128
|
result.aliasSymbol = aliasSymbol || type.aliasSymbol;
|
|
64166
64129
|
result.aliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(type.aliasTypeArguments, mapper);
|
|
64130
|
+
result.objectFlags |= result.aliasTypeArguments ? getPropagatingFlagsOfTypes(result.aliasTypeArguments) : 0;
|
|
64167
64131
|
return result;
|
|
64168
64132
|
}
|
|
64169
64133
|
function getConditionalTypeInstantiation(type, mapper, aliasSymbol, aliasTypeArguments) {
|
|
@@ -69116,10 +69080,13 @@ var ts;
|
|
|
69116
69080
|
propagationType = savePropagationType;
|
|
69117
69081
|
return;
|
|
69118
69082
|
}
|
|
69119
|
-
if (source.aliasSymbol && source.
|
|
69120
|
-
|
|
69121
|
-
|
|
69122
|
-
|
|
69083
|
+
if (source.aliasSymbol && source.aliasSymbol === target.aliasSymbol) {
|
|
69084
|
+
if (source.aliasTypeArguments) {
|
|
69085
|
+
// Source and target are types originating in the same generic type alias declaration.
|
|
69086
|
+
// Simply infer from source type arguments to target type arguments.
|
|
69087
|
+
inferFromTypeArguments(source.aliasTypeArguments, target.aliasTypeArguments, getAliasVariances(source.aliasSymbol));
|
|
69088
|
+
}
|
|
69089
|
+
// And if there weren't any type arguments, there's no reason to run inference as the types must be the same.
|
|
69123
69090
|
return;
|
|
69124
69091
|
}
|
|
69125
69092
|
if (source === target && source.flags & 3145728 /* UnionOrIntersection */) {
|
|
@@ -69175,18 +69142,26 @@ var ts;
|
|
|
69175
69142
|
target = getActualTypeVariable(target);
|
|
69176
69143
|
}
|
|
69177
69144
|
if (target.flags & 8650752 /* TypeVariable */) {
|
|
69178
|
-
//
|
|
69179
|
-
//
|
|
69180
|
-
|
|
69181
|
-
// it as an inference candidate. Hopefully, a better candidate will come along that does
|
|
69182
|
-
// not contain anyFunctionType when we come back to this argument for its second round
|
|
69183
|
-
// of inference. Also, we exclude inferences for silentNeverType (which is used as a wildcard
|
|
69184
|
-
// when constructing types from type parameters that had no inference candidates).
|
|
69185
|
-
if (source === nonInferrableAnyType || source === silentNeverType || (priority & 128 /* ReturnType */ && (source === autoType || source === autoArrayType)) || isFromInferenceBlockedSource(source)) {
|
|
69145
|
+
// Skip inference if the source is "blocked", which is used by the language service to
|
|
69146
|
+
// prevent inference on nodes currently being edited.
|
|
69147
|
+
if (isFromInferenceBlockedSource(source)) {
|
|
69186
69148
|
return;
|
|
69187
69149
|
}
|
|
69188
69150
|
var inference = getInferenceInfoForType(target);
|
|
69189
69151
|
if (inference) {
|
|
69152
|
+
// If target is a type parameter, make an inference, unless the source type contains
|
|
69153
|
+
// a "non-inferrable" type. Types with this flag set are markers used to prevent inference.
|
|
69154
|
+
//
|
|
69155
|
+
// For example:
|
|
69156
|
+
// - anyFunctionType is a wildcard type that's used to avoid contextually typing functions;
|
|
69157
|
+
// it's internal, so should not be exposed to the user by adding it as a candidate.
|
|
69158
|
+
// - autoType (and autoArrayType) is a special "any" used in control flow; like anyFunctionType,
|
|
69159
|
+
// it's internal and should not be observable.
|
|
69160
|
+
// - silentNeverType is returned by getInferredType when instantiating a generic function for
|
|
69161
|
+
// inference (and a type variable has no mapping).
|
|
69162
|
+
//
|
|
69163
|
+
// This flag is infectious; if we produce Box<never> (where never is silentNeverType), Box<never> is
|
|
69164
|
+
// also non-inferrable.
|
|
69190
69165
|
if (ts.getObjectFlags(source) & 262144 /* NonInferrableType */) {
|
|
69191
69166
|
return;
|
|
69192
69167
|
}
|
|
@@ -69729,20 +69704,17 @@ var ts;
|
|
|
69729
69704
|
var sourceLen = sourceSignatures.length;
|
|
69730
69705
|
var targetLen = targetSignatures.length;
|
|
69731
69706
|
var len = sourceLen < targetLen ? sourceLen : targetLen;
|
|
69732
|
-
var skipParameters = !!(ts.getObjectFlags(source) & 262144 /* NonInferrableType */);
|
|
69733
69707
|
for (var i = 0; i < len; i++) {
|
|
69734
|
-
inferFromSignature(getBaseSignature(sourceSignatures[sourceLen - len + i]), getErasedSignature(targetSignatures[targetLen - len + i])
|
|
69708
|
+
inferFromSignature(getBaseSignature(sourceSignatures[sourceLen - len + i]), getErasedSignature(targetSignatures[targetLen - len + i]));
|
|
69735
69709
|
}
|
|
69736
69710
|
}
|
|
69737
|
-
function inferFromSignature(source, target
|
|
69738
|
-
|
|
69739
|
-
|
|
69740
|
-
|
|
69741
|
-
|
|
69742
|
-
|
|
69743
|
-
|
|
69744
|
-
bivariant = saveBivariant;
|
|
69745
|
-
}
|
|
69711
|
+
function inferFromSignature(source, target) {
|
|
69712
|
+
var saveBivariant = bivariant;
|
|
69713
|
+
var kind = target.declaration ? target.declaration.kind : 0 /* Unknown */;
|
|
69714
|
+
// Once we descend into a bivariant signature we remain bivariant for all nested inferences
|
|
69715
|
+
bivariant = bivariant || kind === 169 /* MethodDeclaration */ || kind === 168 /* MethodSignature */ || kind === 171 /* Constructor */;
|
|
69716
|
+
applyToParameterTypes(source, target, inferFromContravariantTypes);
|
|
69717
|
+
bivariant = saveBivariant;
|
|
69746
69718
|
applyToReturnTypes(source, target, inferFromTypes);
|
|
69747
69719
|
}
|
|
69748
69720
|
function inferFromIndexTypes(source, target) {
|
|
@@ -73326,6 +73298,14 @@ var ts;
|
|
|
73326
73298
|
var lhsType = getTypeOfExpression(e.expression);
|
|
73327
73299
|
return ts.isPrivateIdentifier(e.name) ? tryGetPrivateIdentifierPropertyOfType(lhsType, e.name) : getPropertyOfType(lhsType, e.name.escapedText);
|
|
73328
73300
|
}
|
|
73301
|
+
if (ts.isElementAccessExpression(e)) {
|
|
73302
|
+
var propType = checkExpressionCached(e.argumentExpression);
|
|
73303
|
+
if (!isTypeUsableAsPropertyName(propType)) {
|
|
73304
|
+
return undefined;
|
|
73305
|
+
}
|
|
73306
|
+
var lhsType = getTypeOfExpression(e.expression);
|
|
73307
|
+
return getPropertyOfType(lhsType, getPropertyNameFromType(propType));
|
|
73308
|
+
}
|
|
73329
73309
|
return undefined;
|
|
73330
73310
|
function tryGetPrivateIdentifierPropertyOfType(type, id) {
|
|
73331
73311
|
var lexicallyScopedSymbol = lookupSymbolForPrivateIdentifierDeclaration(id.escapedText, id);
|
|
@@ -77240,7 +77220,7 @@ var ts;
|
|
|
77240
77220
|
// returns a function type, we choose to defer processing. This narrowly permits function composition
|
|
77241
77221
|
// operators to flow inferences through return types, but otherwise processes calls right away. We
|
|
77242
77222
|
// use the resolvingSignature singleton to indicate that we deferred processing. This result will be
|
|
77243
|
-
// propagated out and eventually turned into
|
|
77223
|
+
// propagated out and eventually turned into silentNeverType (a type that is assignable to anything and
|
|
77244
77224
|
// from which we never make inferences).
|
|
77245
77225
|
if (checkMode & 8 /* SkipGenericFunctions */ && !node.typeArguments && callSignatures.some(isGenericFunctionReturningFunction)) {
|
|
77246
77226
|
skippedGenericFunction(node, checkMode);
|
|
@@ -77793,8 +77773,8 @@ var ts;
|
|
|
77793
77773
|
var signature = getResolvedSignature(node, /*candidatesOutArray*/ undefined, checkMode);
|
|
77794
77774
|
if (signature === resolvingSignature) {
|
|
77795
77775
|
// CheckMode.SkipGenericFunctions is enabled and this is a call to a generic function that
|
|
77796
|
-
// returns a function type. We defer checking and return
|
|
77797
|
-
return
|
|
77776
|
+
// returns a function type. We defer checking and return silentNeverType.
|
|
77777
|
+
return silentNeverType;
|
|
77798
77778
|
}
|
|
77799
77779
|
checkDeprecatedSignature(signature, node);
|
|
77800
77780
|
if (node.expression.kind === 106 /* SuperKeyword */) {
|
|
@@ -84420,9 +84400,14 @@ var ts;
|
|
|
84420
84400
|
function unwrapReturnType(returnType, functionFlags) {
|
|
84421
84401
|
var isGenerator = !!(functionFlags & 1 /* Generator */);
|
|
84422
84402
|
var isAsync = !!(functionFlags & 2 /* Async */);
|
|
84423
|
-
|
|
84424
|
-
|
|
84425
|
-
|
|
84403
|
+
if (isGenerator) {
|
|
84404
|
+
var returnIterationType = getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, returnType, isAsync);
|
|
84405
|
+
if (!returnIterationType) {
|
|
84406
|
+
return errorType;
|
|
84407
|
+
}
|
|
84408
|
+
return isAsync ? getAwaitedTypeNoAlias(unwrapAwaitedType(returnIterationType)) : returnIterationType;
|
|
84409
|
+
}
|
|
84410
|
+
return isAsync ? getAwaitedTypeNoAlias(returnType) || errorType : returnType;
|
|
84426
84411
|
}
|
|
84427
84412
|
function isUnwrappedReturnTypeVoidOrAny(func, returnType) {
|
|
84428
84413
|
var unwrappedReturnType = unwrapReturnType(returnType, ts.getFunctionFlags(func));
|
|
@@ -144711,7 +144696,7 @@ var ts;
|
|
|
144711
144696
|
var SmartSelectionRange;
|
|
144712
144697
|
(function (SmartSelectionRange) {
|
|
144713
144698
|
function getSmartSelectionRange(pos, sourceFile) {
|
|
144714
|
-
var _a;
|
|
144699
|
+
var _a, _b;
|
|
144715
144700
|
var selectionRange = {
|
|
144716
144701
|
textSpan: ts.createTextSpanFromBounds(sourceFile.getFullStart(), sourceFile.getEnd())
|
|
144717
144702
|
};
|
|
@@ -144763,6 +144748,17 @@ var ts;
|
|
|
144763
144748
|
if (ts.hasJSDocNodes(node) && ((_a = node.jsDoc) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
144764
144749
|
pushSelectionRange(ts.first(node.jsDoc).getStart(), end);
|
|
144765
144750
|
}
|
|
144751
|
+
// (#39618 & #49807)
|
|
144752
|
+
// When the node is a SyntaxList and its first child has a JSDoc comment, then the node's
|
|
144753
|
+
// `start` (which usually is the result of calling `node.getStart()`) points to the first
|
|
144754
|
+
// token after the JSDoc comment. So, we have to make sure we'd pushed the selection
|
|
144755
|
+
// covering the JSDoc comment before diving further.
|
|
144756
|
+
if (ts.isSyntaxList(node)) {
|
|
144757
|
+
var firstChild = node.getChildren()[0];
|
|
144758
|
+
if (firstChild && ts.hasJSDocNodes(firstChild) && ((_b = firstChild.jsDoc) === null || _b === void 0 ? void 0 : _b.length) && firstChild.getStart() !== node.pos) {
|
|
144759
|
+
start = Math.min(start, ts.first(firstChild.jsDoc).getStart());
|
|
144760
|
+
}
|
|
144761
|
+
}
|
|
144766
144762
|
pushSelectionRange(start, end);
|
|
144767
144763
|
// String literals should have a stop both inside and outside their quotes.
|
|
144768
144764
|
if (ts.isStringLiteral(node) || ts.isTemplateLiteral(node)) {
|
|
@@ -144836,6 +144832,7 @@ var ts;
|
|
|
144836
144832
|
* other as well as of other top-level statements and declarations.
|
|
144837
144833
|
*/
|
|
144838
144834
|
function getSelectionChildren(node) {
|
|
144835
|
+
var _a;
|
|
144839
144836
|
// Group top-level imports
|
|
144840
144837
|
if (ts.isSourceFile(node)) {
|
|
144841
144838
|
return groupChildren(node.getChildAt(0).getChildren(), isImport);
|
|
@@ -144851,7 +144848,7 @@ var ts;
|
|
|
144851
144848
|
// because it allows the mapped type to become an object type with a
|
|
144852
144849
|
// few keystrokes.
|
|
144853
144850
|
if (ts.isMappedTypeNode(node)) {
|
|
144854
|
-
var
|
|
144851
|
+
var _b = node.getChildren(), openBraceToken = _b[0], children = _b.slice(1);
|
|
144855
144852
|
var closeBraceToken = ts.Debug.checkDefined(children.pop());
|
|
144856
144853
|
ts.Debug.assertEqual(openBraceToken.kind, 18 /* OpenBraceToken */);
|
|
144857
144854
|
ts.Debug.assertEqual(closeBraceToken.kind, 19 /* CloseBraceToken */);
|
|
@@ -144882,10 +144879,13 @@ var ts;
|
|
|
144882
144879
|
var children = groupChildren(node.getChildren(), function (child) {
|
|
144883
144880
|
return child === node.name || ts.contains(node.modifiers, child);
|
|
144884
144881
|
});
|
|
144885
|
-
|
|
144882
|
+
var firstJSDocChild = ((_a = children[0]) === null || _a === void 0 ? void 0 : _a.kind) === 320 /* JSDoc */ ? children[0] : undefined;
|
|
144883
|
+
var withJSDocSeparated = firstJSDocChild ? children.slice(1) : children;
|
|
144884
|
+
var splittedChildren = splitChildren(withJSDocSeparated, function (_a) {
|
|
144886
144885
|
var kind = _a.kind;
|
|
144887
144886
|
return kind === 58 /* ColonToken */;
|
|
144888
144887
|
});
|
|
144888
|
+
return firstJSDocChild ? [firstJSDocChild, createSyntaxList(splittedChildren)] : splittedChildren;
|
|
144889
144889
|
}
|
|
144890
144890
|
// Group the parameter name with its `...`, then that group with its `?`, then pivot on `=`.
|
|
144891
144891
|
if (ts.isParameter(node)) {
|