typescript 4.8.0-dev.20220713 → 4.8.0-dev.20220716
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 +52 -52
- package/lib/tsserver.js +83 -89
- package/lib/tsserverlibrary.js +83 -89
- package/lib/typescript.js +83 -89
- package/lib/typescriptServices.js +83 -89
- package/lib/typingsInstaller.js +83 -89
- 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.20220716";
|
|
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) {
|
|
@@ -60178,16 +60158,23 @@ var ts;
|
|
|
60178
60158
|
if (!assumeTrue) {
|
|
60179
60159
|
return filterType(type, function (t) { return !isRelated(t, candidate); });
|
|
60180
60160
|
}
|
|
60181
|
-
if (type.flags &
|
|
60182
|
-
|
|
60183
|
-
if (!(assignableType.flags & 131072)) {
|
|
60184
|
-
return assignableType;
|
|
60185
|
-
}
|
|
60161
|
+
if (type.flags & 3) {
|
|
60162
|
+
return candidate;
|
|
60186
60163
|
}
|
|
60187
|
-
|
|
60188
|
-
|
|
60189
|
-
|
|
60190
|
-
|
|
60164
|
+
var keyPropertyName = type.flags & 1048576 ? getKeyPropertyName(type) : undefined;
|
|
60165
|
+
var narrowedType = mapType(candidate, function (c) {
|
|
60166
|
+
var discriminant = keyPropertyName && getTypeOfPropertyOfType(c, keyPropertyName);
|
|
60167
|
+
var matching = discriminant && getConstituentTypeForKeyType(type, discriminant);
|
|
60168
|
+
var directlyRelated = mapType(matching || type, function (t) { return isRelated(t, c) ? t : isRelated(c, t) ? c : neverType; });
|
|
60169
|
+
return directlyRelated.flags & 131072 ?
|
|
60170
|
+
mapType(type, function (t) { return maybeTypeOfKind(t, 465829888) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType; }) :
|
|
60171
|
+
directlyRelated;
|
|
60172
|
+
});
|
|
60173
|
+
return !(narrowedType.flags & 131072) ? narrowedType :
|
|
60174
|
+
isTypeSubtypeOf(candidate, type) ? candidate :
|
|
60175
|
+
isTypeAssignableTo(type, candidate) ? type :
|
|
60176
|
+
isTypeAssignableTo(candidate, type) ? candidate :
|
|
60177
|
+
getIntersectionType([type, candidate]);
|
|
60191
60178
|
}
|
|
60192
60179
|
function narrowTypeByCallExpression(type, callExpression, assumeTrue) {
|
|
60193
60180
|
if (hasMatchingArgument(callExpression, reference)) {
|
|
@@ -61287,6 +61274,14 @@ var ts;
|
|
|
61287
61274
|
var lhsType = getTypeOfExpression(e.expression);
|
|
61288
61275
|
return ts.isPrivateIdentifier(e.name) ? tryGetPrivateIdentifierPropertyOfType(lhsType, e.name) : getPropertyOfType(lhsType, e.name.escapedText);
|
|
61289
61276
|
}
|
|
61277
|
+
if (ts.isElementAccessExpression(e)) {
|
|
61278
|
+
var propType = checkExpressionCached(e.argumentExpression);
|
|
61279
|
+
if (!isTypeUsableAsPropertyName(propType)) {
|
|
61280
|
+
return undefined;
|
|
61281
|
+
}
|
|
61282
|
+
var lhsType = getTypeOfExpression(e.expression);
|
|
61283
|
+
return getPropertyOfType(lhsType, getPropertyNameFromType(propType));
|
|
61284
|
+
}
|
|
61290
61285
|
return undefined;
|
|
61291
61286
|
function tryGetPrivateIdentifierPropertyOfType(type, id) {
|
|
61292
61287
|
var lexicallyScopedSymbol = lookupSymbolForPrivateIdentifierDeclaration(id.escapedText, id);
|
|
@@ -65063,7 +65058,7 @@ var ts;
|
|
|
65063
65058
|
checkGrammarTypeArguments(node, node.typeArguments);
|
|
65064
65059
|
var signature = getResolvedSignature(node, undefined, checkMode);
|
|
65065
65060
|
if (signature === resolvingSignature) {
|
|
65066
|
-
return
|
|
65061
|
+
return silentNeverType;
|
|
65067
65062
|
}
|
|
65068
65063
|
checkDeprecatedSignature(signature, node);
|
|
65069
65064
|
if (node.expression.kind === 106) {
|
|
@@ -70743,9 +70738,14 @@ var ts;
|
|
|
70743
70738
|
function unwrapReturnType(returnType, functionFlags) {
|
|
70744
70739
|
var isGenerator = !!(functionFlags & 1);
|
|
70745
70740
|
var isAsync = !!(functionFlags & 2);
|
|
70746
|
-
|
|
70747
|
-
|
|
70748
|
-
|
|
70741
|
+
if (isGenerator) {
|
|
70742
|
+
var returnIterationType = getIterationTypeOfGeneratorFunctionReturnType(1, returnType, isAsync);
|
|
70743
|
+
if (!returnIterationType) {
|
|
70744
|
+
return errorType;
|
|
70745
|
+
}
|
|
70746
|
+
return isAsync ? getAwaitedTypeNoAlias(unwrapAwaitedType(returnIterationType)) : returnIterationType;
|
|
70747
|
+
}
|
|
70748
|
+
return isAsync ? getAwaitedTypeNoAlias(returnType) || errorType : returnType;
|
|
70749
70749
|
}
|
|
70750
70750
|
function isUnwrappedReturnTypeVoidOrAny(func, returnType) {
|
|
70751
70751
|
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.20220716";
|
|
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) {
|
|
@@ -71944,23 +71916,32 @@ var ts;
|
|
|
71944
71916
|
if (!assumeTrue) {
|
|
71945
71917
|
return filterType(type, function (t) { return !isRelated(t, candidate); });
|
|
71946
71918
|
}
|
|
71947
|
-
|
|
71948
|
-
|
|
71949
|
-
if (type.flags & 1048576 /* Union */) {
|
|
71950
|
-
var assignableType = filterType(type, function (t) { return isRelated(t, candidate); });
|
|
71951
|
-
if (!(assignableType.flags & 131072 /* Never */)) {
|
|
71952
|
-
return assignableType;
|
|
71953
|
-
}
|
|
71919
|
+
if (type.flags & 3 /* AnyOrUnknown */) {
|
|
71920
|
+
return candidate;
|
|
71954
71921
|
}
|
|
71955
|
-
//
|
|
71956
|
-
//
|
|
71957
|
-
|
|
71958
|
-
|
|
71959
|
-
|
|
71960
|
-
|
|
71961
|
-
|
|
71962
|
-
|
|
71963
|
-
|
|
71922
|
+
// We first attempt to filter the current type, narrowing constituents as appropriate and removing
|
|
71923
|
+
// constituents that are unrelated to the candidate.
|
|
71924
|
+
var keyPropertyName = type.flags & 1048576 /* Union */ ? getKeyPropertyName(type) : undefined;
|
|
71925
|
+
var narrowedType = mapType(candidate, function (c) {
|
|
71926
|
+
// If a discriminant property is available, use that to reduce the type.
|
|
71927
|
+
var discriminant = keyPropertyName && getTypeOfPropertyOfType(c, keyPropertyName);
|
|
71928
|
+
var matching = discriminant && getConstituentTypeForKeyType(type, discriminant);
|
|
71929
|
+
// For each constituent t in the current type, if t and and c are directly related, pick the most
|
|
71930
|
+
// specific of the two.
|
|
71931
|
+
var directlyRelated = mapType(matching || type, function (t) { return isRelated(t, c) ? t : isRelated(c, t) ? c : neverType; });
|
|
71932
|
+
// If no constituents are directly related, create intersections for any generic constituents that
|
|
71933
|
+
// are related by constraint.
|
|
71934
|
+
return directlyRelated.flags & 131072 /* Never */ ?
|
|
71935
|
+
mapType(type, function (t) { return maybeTypeOfKind(t, 465829888 /* Instantiable */) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType; }) :
|
|
71936
|
+
directlyRelated;
|
|
71937
|
+
});
|
|
71938
|
+
// If filtering produced a non-empty type, return that. Otherwise, pick the most specific of the two
|
|
71939
|
+
// based on assignability, or as a last resort produce an intersection.
|
|
71940
|
+
return !(narrowedType.flags & 131072 /* Never */) ? narrowedType :
|
|
71941
|
+
isTypeSubtypeOf(candidate, type) ? candidate :
|
|
71942
|
+
isTypeAssignableTo(type, candidate) ? type :
|
|
71943
|
+
isTypeAssignableTo(candidate, type) ? candidate :
|
|
71944
|
+
getIntersectionType([type, candidate]);
|
|
71964
71945
|
}
|
|
71965
71946
|
function narrowTypeByCallExpression(type, callExpression, assumeTrue) {
|
|
71966
71947
|
if (hasMatchingArgument(callExpression, reference)) {
|
|
@@ -73326,6 +73307,14 @@ var ts;
|
|
|
73326
73307
|
var lhsType = getTypeOfExpression(e.expression);
|
|
73327
73308
|
return ts.isPrivateIdentifier(e.name) ? tryGetPrivateIdentifierPropertyOfType(lhsType, e.name) : getPropertyOfType(lhsType, e.name.escapedText);
|
|
73328
73309
|
}
|
|
73310
|
+
if (ts.isElementAccessExpression(e)) {
|
|
73311
|
+
var propType = checkExpressionCached(e.argumentExpression);
|
|
73312
|
+
if (!isTypeUsableAsPropertyName(propType)) {
|
|
73313
|
+
return undefined;
|
|
73314
|
+
}
|
|
73315
|
+
var lhsType = getTypeOfExpression(e.expression);
|
|
73316
|
+
return getPropertyOfType(lhsType, getPropertyNameFromType(propType));
|
|
73317
|
+
}
|
|
73329
73318
|
return undefined;
|
|
73330
73319
|
function tryGetPrivateIdentifierPropertyOfType(type, id) {
|
|
73331
73320
|
var lexicallyScopedSymbol = lookupSymbolForPrivateIdentifierDeclaration(id.escapedText, id);
|
|
@@ -77240,7 +77229,7 @@ var ts;
|
|
|
77240
77229
|
// returns a function type, we choose to defer processing. This narrowly permits function composition
|
|
77241
77230
|
// operators to flow inferences through return types, but otherwise processes calls right away. We
|
|
77242
77231
|
// use the resolvingSignature singleton to indicate that we deferred processing. This result will be
|
|
77243
|
-
// propagated out and eventually turned into
|
|
77232
|
+
// propagated out and eventually turned into silentNeverType (a type that is assignable to anything and
|
|
77244
77233
|
// from which we never make inferences).
|
|
77245
77234
|
if (checkMode & 8 /* SkipGenericFunctions */ && !node.typeArguments && callSignatures.some(isGenericFunctionReturningFunction)) {
|
|
77246
77235
|
skippedGenericFunction(node, checkMode);
|
|
@@ -77793,8 +77782,8 @@ var ts;
|
|
|
77793
77782
|
var signature = getResolvedSignature(node, /*candidatesOutArray*/ undefined, checkMode);
|
|
77794
77783
|
if (signature === resolvingSignature) {
|
|
77795
77784
|
// 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
|
|
77785
|
+
// returns a function type. We defer checking and return silentNeverType.
|
|
77786
|
+
return silentNeverType;
|
|
77798
77787
|
}
|
|
77799
77788
|
checkDeprecatedSignature(signature, node);
|
|
77800
77789
|
if (node.expression.kind === 106 /* SuperKeyword */) {
|
|
@@ -84420,9 +84409,14 @@ var ts;
|
|
|
84420
84409
|
function unwrapReturnType(returnType, functionFlags) {
|
|
84421
84410
|
var isGenerator = !!(functionFlags & 1 /* Generator */);
|
|
84422
84411
|
var isAsync = !!(functionFlags & 2 /* Async */);
|
|
84423
|
-
|
|
84424
|
-
|
|
84425
|
-
|
|
84412
|
+
if (isGenerator) {
|
|
84413
|
+
var returnIterationType = getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, returnType, isAsync);
|
|
84414
|
+
if (!returnIterationType) {
|
|
84415
|
+
return errorType;
|
|
84416
|
+
}
|
|
84417
|
+
return isAsync ? getAwaitedTypeNoAlias(unwrapAwaitedType(returnIterationType)) : returnIterationType;
|
|
84418
|
+
}
|
|
84419
|
+
return isAsync ? getAwaitedTypeNoAlias(returnType) || errorType : returnType;
|
|
84426
84420
|
}
|
|
84427
84421
|
function isUnwrappedReturnTypeVoidOrAny(func, returnType) {
|
|
84428
84422
|
var unwrappedReturnType = unwrapReturnType(returnType, ts.getFunctionFlags(func));
|