typescript 4.8.0-dev.20220714 → 4.8.0-dev.20220717
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 +44 -52
- package/lib/tsserver.js +75 -89
- package/lib/tsserverlibrary.js +75 -89
- package/lib/typescript.js +75 -89
- package/lib/typescriptServices.js +75 -89
- package/lib/typingsInstaller.js +75 -89
- package/package.json +1 -1
|
@@ -294,7 +294,7 @@ var ts;
|
|
|
294
294
|
// The following is baselined as a literal template type without intervention
|
|
295
295
|
/** The version of the TypeScript compiler release */
|
|
296
296
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
297
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
297
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220717";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -47066,37 +47066,6 @@ var ts;
|
|
|
47066
47066
|
typeLiteralSymbol.members.set(symbol.escapedName, symbol);
|
|
47067
47067
|
}
|
|
47068
47068
|
function bindObjectLiteralExpression(node) {
|
|
47069
|
-
var ElementKind;
|
|
47070
|
-
(function (ElementKind) {
|
|
47071
|
-
ElementKind[ElementKind["Property"] = 1] = "Property";
|
|
47072
|
-
ElementKind[ElementKind["Accessor"] = 2] = "Accessor";
|
|
47073
|
-
})(ElementKind || (ElementKind = {}));
|
|
47074
|
-
if (inStrictMode && !ts.isAssignmentTarget(node)) {
|
|
47075
|
-
var seen = new ts.Map();
|
|
47076
|
-
for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
|
|
47077
|
-
var prop = _a[_i];
|
|
47078
|
-
if (prop.kind === 298 /* SpreadAssignment */ || prop.name.kind !== 79 /* Identifier */) {
|
|
47079
|
-
continue;
|
|
47080
|
-
}
|
|
47081
|
-
var identifier = prop.name;
|
|
47082
|
-
// ECMA-262 11.1.5 Object Initializer
|
|
47083
|
-
// If previous is not undefined then throw a SyntaxError exception if any of the following conditions are true
|
|
47084
|
-
// a.This production is contained in strict code and IsDataDescriptor(previous) is true and
|
|
47085
|
-
// IsDataDescriptor(propId.descriptor) is true.
|
|
47086
|
-
// b.IsDataDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true.
|
|
47087
|
-
// c.IsAccessorDescriptor(previous) is true and IsDataDescriptor(propId.descriptor) is true.
|
|
47088
|
-
// d.IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true
|
|
47089
|
-
// and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields
|
|
47090
|
-
var currentKind = prop.kind === 296 /* PropertyAssignment */ || prop.kind === 297 /* ShorthandPropertyAssignment */ || prop.kind === 169 /* MethodDeclaration */
|
|
47091
|
-
? 1 /* Property */
|
|
47092
|
-
: 2 /* Accessor */;
|
|
47093
|
-
var existingKind = seen.get(identifier.escapedText);
|
|
47094
|
-
if (!existingKind) {
|
|
47095
|
-
seen.set(identifier.escapedText, currentKind);
|
|
47096
|
-
continue;
|
|
47097
|
-
}
|
|
47098
|
-
}
|
|
47099
|
-
}
|
|
47100
47069
|
return bindAnonymousDeclaration(node, 4096 /* ObjectLiteral */, "__object" /* Object */);
|
|
47101
47070
|
}
|
|
47102
47071
|
function bindJsxAttributes(node) {
|
|
@@ -49335,11 +49304,10 @@ var ts;
|
|
|
49335
49304
|
var unresolvedSymbols = new ts.Map();
|
|
49336
49305
|
var errorTypes = new ts.Map();
|
|
49337
49306
|
var anyType = createIntrinsicType(1 /* Any */, "any");
|
|
49338
|
-
var autoType = createIntrinsicType(1 /* Any */, "any");
|
|
49307
|
+
var autoType = createIntrinsicType(1 /* Any */, "any", 262144 /* NonInferrableType */);
|
|
49339
49308
|
var wildcardType = createIntrinsicType(1 /* Any */, "any");
|
|
49340
49309
|
var errorType = createIntrinsicType(1 /* Any */, "error");
|
|
49341
49310
|
var unresolvedType = createIntrinsicType(1 /* Any */, "unresolved");
|
|
49342
|
-
var nonInferrableAnyType = createIntrinsicType(1 /* Any */, "any", 65536 /* ContainsWideningType */);
|
|
49343
49311
|
var intrinsicMarkerType = createIntrinsicType(1 /* Any */, "intrinsic");
|
|
49344
49312
|
var unknownType = createIntrinsicType(2 /* Unknown */, "unknown");
|
|
49345
49313
|
var nonNullUnknownType = createIntrinsicType(2 /* Unknown */, "unknown");
|
|
@@ -49368,8 +49336,7 @@ var ts;
|
|
|
49368
49336
|
var esSymbolType = createIntrinsicType(4096 /* ESSymbol */, "symbol");
|
|
49369
49337
|
var voidType = createIntrinsicType(16384 /* Void */, "void");
|
|
49370
49338
|
var neverType = createIntrinsicType(131072 /* Never */, "never");
|
|
49371
|
-
var silentNeverType = createIntrinsicType(131072 /* Never */, "never");
|
|
49372
|
-
var nonInferrableType = createIntrinsicType(131072 /* Never */, "never", 262144 /* NonInferrableType */);
|
|
49339
|
+
var silentNeverType = createIntrinsicType(131072 /* Never */, "never", 262144 /* NonInferrableType */);
|
|
49373
49340
|
var implicitNeverType = createIntrinsicType(131072 /* Never */, "never");
|
|
49374
49341
|
var unreachableNeverType = createIntrinsicType(131072 /* Never */, "never");
|
|
49375
49342
|
var nonPrimitiveType = createIntrinsicType(67108864 /* NonPrimitive */, "object");
|
|
@@ -57107,11 +57074,7 @@ var ts;
|
|
|
57107
57074
|
if (reportErrors && !declarationBelongsToPrivateAmbientMember(element)) {
|
|
57108
57075
|
reportImplicitAny(element, anyType);
|
|
57109
57076
|
}
|
|
57110
|
-
|
|
57111
|
-
// use the non-inferrable any type. Inference will never directly infer this type, but it is possible
|
|
57112
|
-
// to infer a type that contains it, e.g. for a binding pattern like [foo] or { foo }. In such cases,
|
|
57113
|
-
// widening of the binding pattern type substitutes a regular any for the non-inferrable any.
|
|
57114
|
-
return includePatternInType ? nonInferrableAnyType : anyType;
|
|
57077
|
+
return anyType;
|
|
57115
57078
|
}
|
|
57116
57079
|
// Return the type implied by an object binding pattern
|
|
57117
57080
|
function getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) {
|
|
@@ -60897,13 +60860,13 @@ var ts;
|
|
|
60897
60860
|
}
|
|
60898
60861
|
// This function is used to propagate certain flags when creating new object type references and union types.
|
|
60899
60862
|
// It is only necessary to do so if a constituent type might be the undefined type, the null type, the type
|
|
60900
|
-
// of an object literal or
|
|
60863
|
+
// of an object literal or a non-inferrable type. This is because there are operations in the type checker
|
|
60901
60864
|
// that care about the presence of such types at arbitrary depth in a containing type.
|
|
60902
60865
|
function getPropagatingFlagsOfTypes(types, excludeKinds) {
|
|
60903
60866
|
var result = 0;
|
|
60904
60867
|
for (var _i = 0, types_8 = types; _i < types_8.length; _i++) {
|
|
60905
60868
|
var type = types_8[_i];
|
|
60906
|
-
if (!(type.flags & excludeKinds)) {
|
|
60869
|
+
if (excludeKinds === undefined || !(type.flags & excludeKinds)) {
|
|
60907
60870
|
result |= ts.getObjectFlags(type);
|
|
60908
60871
|
}
|
|
60909
60872
|
}
|
|
@@ -60915,7 +60878,7 @@ var ts;
|
|
|
60915
60878
|
if (!type) {
|
|
60916
60879
|
type = createObjectType(4 /* Reference */, target.symbol);
|
|
60917
60880
|
target.instantiations.set(id, type);
|
|
60918
|
-
type.objectFlags |= typeArguments ? getPropagatingFlagsOfTypes(typeArguments
|
|
60881
|
+
type.objectFlags |= typeArguments ? getPropagatingFlagsOfTypes(typeArguments) : 0;
|
|
60919
60882
|
type.target = target;
|
|
60920
60883
|
type.resolvedTypeArguments = typeArguments;
|
|
60921
60884
|
}
|
|
@@ -64349,6 +64312,7 @@ var ts;
|
|
|
64349
64312
|
result.mapper = mapper;
|
|
64350
64313
|
result.aliasSymbol = aliasSymbol || type.aliasSymbol;
|
|
64351
64314
|
result.aliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(type.aliasTypeArguments, mapper);
|
|
64315
|
+
result.objectFlags |= result.aliasTypeArguments ? getPropagatingFlagsOfTypes(result.aliasTypeArguments) : 0;
|
|
64352
64316
|
return result;
|
|
64353
64317
|
}
|
|
64354
64318
|
function getConditionalTypeInstantiation(type, mapper, aliasSymbol, aliasTypeArguments) {
|
|
@@ -69301,10 +69265,13 @@ var ts;
|
|
|
69301
69265
|
propagationType = savePropagationType;
|
|
69302
69266
|
return;
|
|
69303
69267
|
}
|
|
69304
|
-
if (source.aliasSymbol && source.
|
|
69305
|
-
|
|
69306
|
-
|
|
69307
|
-
|
|
69268
|
+
if (source.aliasSymbol && source.aliasSymbol === target.aliasSymbol) {
|
|
69269
|
+
if (source.aliasTypeArguments) {
|
|
69270
|
+
// Source and target are types originating in the same generic type alias declaration.
|
|
69271
|
+
// Simply infer from source type arguments to target type arguments.
|
|
69272
|
+
inferFromTypeArguments(source.aliasTypeArguments, target.aliasTypeArguments, getAliasVariances(source.aliasSymbol));
|
|
69273
|
+
}
|
|
69274
|
+
// And if there weren't any type arguments, there's no reason to run inference as the types must be the same.
|
|
69308
69275
|
return;
|
|
69309
69276
|
}
|
|
69310
69277
|
if (source === target && source.flags & 3145728 /* UnionOrIntersection */) {
|
|
@@ -69360,18 +69327,26 @@ var ts;
|
|
|
69360
69327
|
target = getActualTypeVariable(target);
|
|
69361
69328
|
}
|
|
69362
69329
|
if (target.flags & 8650752 /* TypeVariable */) {
|
|
69363
|
-
//
|
|
69364
|
-
//
|
|
69365
|
-
|
|
69366
|
-
// it as an inference candidate. Hopefully, a better candidate will come along that does
|
|
69367
|
-
// not contain anyFunctionType when we come back to this argument for its second round
|
|
69368
|
-
// of inference. Also, we exclude inferences for silentNeverType (which is used as a wildcard
|
|
69369
|
-
// when constructing types from type parameters that had no inference candidates).
|
|
69370
|
-
if (source === nonInferrableAnyType || source === silentNeverType || (priority & 128 /* ReturnType */ && (source === autoType || source === autoArrayType)) || isFromInferenceBlockedSource(source)) {
|
|
69330
|
+
// Skip inference if the source is "blocked", which is used by the language service to
|
|
69331
|
+
// prevent inference on nodes currently being edited.
|
|
69332
|
+
if (isFromInferenceBlockedSource(source)) {
|
|
69371
69333
|
return;
|
|
69372
69334
|
}
|
|
69373
69335
|
var inference = getInferenceInfoForType(target);
|
|
69374
69336
|
if (inference) {
|
|
69337
|
+
// If target is a type parameter, make an inference, unless the source type contains
|
|
69338
|
+
// a "non-inferrable" type. Types with this flag set are markers used to prevent inference.
|
|
69339
|
+
//
|
|
69340
|
+
// For example:
|
|
69341
|
+
// - anyFunctionType is a wildcard type that's used to avoid contextually typing functions;
|
|
69342
|
+
// it's internal, so should not be exposed to the user by adding it as a candidate.
|
|
69343
|
+
// - autoType (and autoArrayType) is a special "any" used in control flow; like anyFunctionType,
|
|
69344
|
+
// it's internal and should not be observable.
|
|
69345
|
+
// - silentNeverType is returned by getInferredType when instantiating a generic function for
|
|
69346
|
+
// inference (and a type variable has no mapping).
|
|
69347
|
+
//
|
|
69348
|
+
// This flag is infectious; if we produce Box<never> (where never is silentNeverType), Box<never> is
|
|
69349
|
+
// also non-inferrable.
|
|
69375
69350
|
if (ts.getObjectFlags(source) & 262144 /* NonInferrableType */) {
|
|
69376
69351
|
return;
|
|
69377
69352
|
}
|
|
@@ -69914,20 +69889,17 @@ var ts;
|
|
|
69914
69889
|
var sourceLen = sourceSignatures.length;
|
|
69915
69890
|
var targetLen = targetSignatures.length;
|
|
69916
69891
|
var len = sourceLen < targetLen ? sourceLen : targetLen;
|
|
69917
|
-
var skipParameters = !!(ts.getObjectFlags(source) & 262144 /* NonInferrableType */);
|
|
69918
69892
|
for (var i = 0; i < len; i++) {
|
|
69919
|
-
inferFromSignature(getBaseSignature(sourceSignatures[sourceLen - len + i]), getErasedSignature(targetSignatures[targetLen - len + i])
|
|
69893
|
+
inferFromSignature(getBaseSignature(sourceSignatures[sourceLen - len + i]), getErasedSignature(targetSignatures[targetLen - len + i]));
|
|
69920
69894
|
}
|
|
69921
69895
|
}
|
|
69922
|
-
function inferFromSignature(source, target
|
|
69923
|
-
|
|
69924
|
-
|
|
69925
|
-
|
|
69926
|
-
|
|
69927
|
-
|
|
69928
|
-
|
|
69929
|
-
bivariant = saveBivariant;
|
|
69930
|
-
}
|
|
69896
|
+
function inferFromSignature(source, target) {
|
|
69897
|
+
var saveBivariant = bivariant;
|
|
69898
|
+
var kind = target.declaration ? target.declaration.kind : 0 /* Unknown */;
|
|
69899
|
+
// Once we descend into a bivariant signature we remain bivariant for all nested inferences
|
|
69900
|
+
bivariant = bivariant || kind === 169 /* MethodDeclaration */ || kind === 168 /* MethodSignature */ || kind === 171 /* Constructor */;
|
|
69901
|
+
applyToParameterTypes(source, target, inferFromContravariantTypes);
|
|
69902
|
+
bivariant = saveBivariant;
|
|
69931
69903
|
applyToReturnTypes(source, target, inferFromTypes);
|
|
69932
69904
|
}
|
|
69933
69905
|
function inferFromIndexTypes(source, target) {
|
|
@@ -72129,23 +72101,32 @@ var ts;
|
|
|
72129
72101
|
if (!assumeTrue) {
|
|
72130
72102
|
return filterType(type, function (t) { return !isRelated(t, candidate); });
|
|
72131
72103
|
}
|
|
72132
|
-
|
|
72133
|
-
|
|
72134
|
-
if (type.flags & 1048576 /* Union */) {
|
|
72135
|
-
var assignableType = filterType(type, function (t) { return isRelated(t, candidate); });
|
|
72136
|
-
if (!(assignableType.flags & 131072 /* Never */)) {
|
|
72137
|
-
return assignableType;
|
|
72138
|
-
}
|
|
72104
|
+
if (type.flags & 3 /* AnyOrUnknown */) {
|
|
72105
|
+
return candidate;
|
|
72139
72106
|
}
|
|
72140
|
-
//
|
|
72141
|
-
//
|
|
72142
|
-
|
|
72143
|
-
|
|
72144
|
-
|
|
72145
|
-
|
|
72146
|
-
|
|
72147
|
-
|
|
72148
|
-
|
|
72107
|
+
// We first attempt to filter the current type, narrowing constituents as appropriate and removing
|
|
72108
|
+
// constituents that are unrelated to the candidate.
|
|
72109
|
+
var keyPropertyName = type.flags & 1048576 /* Union */ ? getKeyPropertyName(type) : undefined;
|
|
72110
|
+
var narrowedType = mapType(candidate, function (c) {
|
|
72111
|
+
// If a discriminant property is available, use that to reduce the type.
|
|
72112
|
+
var discriminant = keyPropertyName && getTypeOfPropertyOfType(c, keyPropertyName);
|
|
72113
|
+
var matching = discriminant && getConstituentTypeForKeyType(type, discriminant);
|
|
72114
|
+
// For each constituent t in the current type, if t and and c are directly related, pick the most
|
|
72115
|
+
// specific of the two.
|
|
72116
|
+
var directlyRelated = mapType(matching || type, function (t) { return isRelated(t, c) ? t : isRelated(c, t) ? c : neverType; });
|
|
72117
|
+
// If no constituents are directly related, create intersections for any generic constituents that
|
|
72118
|
+
// are related by constraint.
|
|
72119
|
+
return directlyRelated.flags & 131072 /* Never */ ?
|
|
72120
|
+
mapType(type, function (t) { return maybeTypeOfKind(t, 465829888 /* Instantiable */) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType; }) :
|
|
72121
|
+
directlyRelated;
|
|
72122
|
+
});
|
|
72123
|
+
// If filtering produced a non-empty type, return that. Otherwise, pick the most specific of the two
|
|
72124
|
+
// based on assignability, or as a last resort produce an intersection.
|
|
72125
|
+
return !(narrowedType.flags & 131072 /* Never */) ? narrowedType :
|
|
72126
|
+
isTypeSubtypeOf(candidate, type) ? candidate :
|
|
72127
|
+
isTypeAssignableTo(type, candidate) ? type :
|
|
72128
|
+
isTypeAssignableTo(candidate, type) ? candidate :
|
|
72129
|
+
getIntersectionType([type, candidate]);
|
|
72149
72130
|
}
|
|
72150
72131
|
function narrowTypeByCallExpression(type, callExpression, assumeTrue) {
|
|
72151
72132
|
if (hasMatchingArgument(callExpression, reference)) {
|
|
@@ -77433,7 +77414,7 @@ var ts;
|
|
|
77433
77414
|
// returns a function type, we choose to defer processing. This narrowly permits function composition
|
|
77434
77415
|
// operators to flow inferences through return types, but otherwise processes calls right away. We
|
|
77435
77416
|
// use the resolvingSignature singleton to indicate that we deferred processing. This result will be
|
|
77436
|
-
// propagated out and eventually turned into
|
|
77417
|
+
// propagated out and eventually turned into silentNeverType (a type that is assignable to anything and
|
|
77437
77418
|
// from which we never make inferences).
|
|
77438
77419
|
if (checkMode & 8 /* SkipGenericFunctions */ && !node.typeArguments && callSignatures.some(isGenericFunctionReturningFunction)) {
|
|
77439
77420
|
skippedGenericFunction(node, checkMode);
|
|
@@ -77986,8 +77967,8 @@ var ts;
|
|
|
77986
77967
|
var signature = getResolvedSignature(node, /*candidatesOutArray*/ undefined, checkMode);
|
|
77987
77968
|
if (signature === resolvingSignature) {
|
|
77988
77969
|
// CheckMode.SkipGenericFunctions is enabled and this is a call to a generic function that
|
|
77989
|
-
// returns a function type. We defer checking and return
|
|
77990
|
-
return
|
|
77970
|
+
// returns a function type. We defer checking and return silentNeverType.
|
|
77971
|
+
return silentNeverType;
|
|
77991
77972
|
}
|
|
77992
77973
|
checkDeprecatedSignature(signature, node);
|
|
77993
77974
|
if (node.expression.kind === 106 /* SuperKeyword */) {
|
|
@@ -84613,9 +84594,14 @@ var ts;
|
|
|
84613
84594
|
function unwrapReturnType(returnType, functionFlags) {
|
|
84614
84595
|
var isGenerator = !!(functionFlags & 1 /* Generator */);
|
|
84615
84596
|
var isAsync = !!(functionFlags & 2 /* Async */);
|
|
84616
|
-
|
|
84617
|
-
|
|
84618
|
-
|
|
84597
|
+
if (isGenerator) {
|
|
84598
|
+
var returnIterationType = getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, returnType, isAsync);
|
|
84599
|
+
if (!returnIterationType) {
|
|
84600
|
+
return errorType;
|
|
84601
|
+
}
|
|
84602
|
+
return isAsync ? getAwaitedTypeNoAlias(unwrapAwaitedType(returnIterationType)) : returnIterationType;
|
|
84603
|
+
}
|
|
84604
|
+
return isAsync ? getAwaitedTypeNoAlias(returnType) || errorType : returnType;
|
|
84619
84605
|
}
|
|
84620
84606
|
function isUnwrappedReturnTypeVoidOrAny(func, returnType) {
|
|
84621
84607
|
var unwrappedReturnType = unwrapReturnType(returnType, ts.getFunctionFlags(func));
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -89,7 +89,7 @@ var ts;
|
|
|
89
89
|
// The following is baselined as a literal template type without intervention
|
|
90
90
|
/** The version of the TypeScript compiler release */
|
|
91
91
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
92
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
92
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220717";
|
|
93
93
|
/* @internal */
|
|
94
94
|
var Comparison;
|
|
95
95
|
(function (Comparison) {
|
|
@@ -46861,37 +46861,6 @@ var ts;
|
|
|
46861
46861
|
typeLiteralSymbol.members.set(symbol.escapedName, symbol);
|
|
46862
46862
|
}
|
|
46863
46863
|
function bindObjectLiteralExpression(node) {
|
|
46864
|
-
var ElementKind;
|
|
46865
|
-
(function (ElementKind) {
|
|
46866
|
-
ElementKind[ElementKind["Property"] = 1] = "Property";
|
|
46867
|
-
ElementKind[ElementKind["Accessor"] = 2] = "Accessor";
|
|
46868
|
-
})(ElementKind || (ElementKind = {}));
|
|
46869
|
-
if (inStrictMode && !ts.isAssignmentTarget(node)) {
|
|
46870
|
-
var seen = new ts.Map();
|
|
46871
|
-
for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
|
|
46872
|
-
var prop = _a[_i];
|
|
46873
|
-
if (prop.kind === 298 /* SpreadAssignment */ || prop.name.kind !== 79 /* Identifier */) {
|
|
46874
|
-
continue;
|
|
46875
|
-
}
|
|
46876
|
-
var identifier = prop.name;
|
|
46877
|
-
// ECMA-262 11.1.5 Object Initializer
|
|
46878
|
-
// If previous is not undefined then throw a SyntaxError exception if any of the following conditions are true
|
|
46879
|
-
// a.This production is contained in strict code and IsDataDescriptor(previous) is true and
|
|
46880
|
-
// IsDataDescriptor(propId.descriptor) is true.
|
|
46881
|
-
// b.IsDataDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true.
|
|
46882
|
-
// c.IsAccessorDescriptor(previous) is true and IsDataDescriptor(propId.descriptor) is true.
|
|
46883
|
-
// d.IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true
|
|
46884
|
-
// and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields
|
|
46885
|
-
var currentKind = prop.kind === 296 /* PropertyAssignment */ || prop.kind === 297 /* ShorthandPropertyAssignment */ || prop.kind === 169 /* MethodDeclaration */
|
|
46886
|
-
? 1 /* Property */
|
|
46887
|
-
: 2 /* Accessor */;
|
|
46888
|
-
var existingKind = seen.get(identifier.escapedText);
|
|
46889
|
-
if (!existingKind) {
|
|
46890
|
-
seen.set(identifier.escapedText, currentKind);
|
|
46891
|
-
continue;
|
|
46892
|
-
}
|
|
46893
|
-
}
|
|
46894
|
-
}
|
|
46895
46864
|
return bindAnonymousDeclaration(node, 4096 /* ObjectLiteral */, "__object" /* Object */);
|
|
46896
46865
|
}
|
|
46897
46866
|
function bindJsxAttributes(node) {
|
|
@@ -49130,11 +49099,10 @@ var ts;
|
|
|
49130
49099
|
var unresolvedSymbols = new ts.Map();
|
|
49131
49100
|
var errorTypes = new ts.Map();
|
|
49132
49101
|
var anyType = createIntrinsicType(1 /* Any */, "any");
|
|
49133
|
-
var autoType = createIntrinsicType(1 /* Any */, "any");
|
|
49102
|
+
var autoType = createIntrinsicType(1 /* Any */, "any", 262144 /* NonInferrableType */);
|
|
49134
49103
|
var wildcardType = createIntrinsicType(1 /* Any */, "any");
|
|
49135
49104
|
var errorType = createIntrinsicType(1 /* Any */, "error");
|
|
49136
49105
|
var unresolvedType = createIntrinsicType(1 /* Any */, "unresolved");
|
|
49137
|
-
var nonInferrableAnyType = createIntrinsicType(1 /* Any */, "any", 65536 /* ContainsWideningType */);
|
|
49138
49106
|
var intrinsicMarkerType = createIntrinsicType(1 /* Any */, "intrinsic");
|
|
49139
49107
|
var unknownType = createIntrinsicType(2 /* Unknown */, "unknown");
|
|
49140
49108
|
var nonNullUnknownType = createIntrinsicType(2 /* Unknown */, "unknown");
|
|
@@ -49163,8 +49131,7 @@ var ts;
|
|
|
49163
49131
|
var esSymbolType = createIntrinsicType(4096 /* ESSymbol */, "symbol");
|
|
49164
49132
|
var voidType = createIntrinsicType(16384 /* Void */, "void");
|
|
49165
49133
|
var neverType = createIntrinsicType(131072 /* Never */, "never");
|
|
49166
|
-
var silentNeverType = createIntrinsicType(131072 /* Never */, "never");
|
|
49167
|
-
var nonInferrableType = createIntrinsicType(131072 /* Never */, "never", 262144 /* NonInferrableType */);
|
|
49134
|
+
var silentNeverType = createIntrinsicType(131072 /* Never */, "never", 262144 /* NonInferrableType */);
|
|
49168
49135
|
var implicitNeverType = createIntrinsicType(131072 /* Never */, "never");
|
|
49169
49136
|
var unreachableNeverType = createIntrinsicType(131072 /* Never */, "never");
|
|
49170
49137
|
var nonPrimitiveType = createIntrinsicType(67108864 /* NonPrimitive */, "object");
|
|
@@ -56902,11 +56869,7 @@ var ts;
|
|
|
56902
56869
|
if (reportErrors && !declarationBelongsToPrivateAmbientMember(element)) {
|
|
56903
56870
|
reportImplicitAny(element, anyType);
|
|
56904
56871
|
}
|
|
56905
|
-
|
|
56906
|
-
// use the non-inferrable any type. Inference will never directly infer this type, but it is possible
|
|
56907
|
-
// to infer a type that contains it, e.g. for a binding pattern like [foo] or { foo }. In such cases,
|
|
56908
|
-
// widening of the binding pattern type substitutes a regular any for the non-inferrable any.
|
|
56909
|
-
return includePatternInType ? nonInferrableAnyType : anyType;
|
|
56872
|
+
return anyType;
|
|
56910
56873
|
}
|
|
56911
56874
|
// Return the type implied by an object binding pattern
|
|
56912
56875
|
function getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) {
|
|
@@ -60692,13 +60655,13 @@ var ts;
|
|
|
60692
60655
|
}
|
|
60693
60656
|
// This function is used to propagate certain flags when creating new object type references and union types.
|
|
60694
60657
|
// It is only necessary to do so if a constituent type might be the undefined type, the null type, the type
|
|
60695
|
-
// of an object literal or
|
|
60658
|
+
// of an object literal or a non-inferrable type. This is because there are operations in the type checker
|
|
60696
60659
|
// that care about the presence of such types at arbitrary depth in a containing type.
|
|
60697
60660
|
function getPropagatingFlagsOfTypes(types, excludeKinds) {
|
|
60698
60661
|
var result = 0;
|
|
60699
60662
|
for (var _i = 0, types_8 = types; _i < types_8.length; _i++) {
|
|
60700
60663
|
var type = types_8[_i];
|
|
60701
|
-
if (!(type.flags & excludeKinds)) {
|
|
60664
|
+
if (excludeKinds === undefined || !(type.flags & excludeKinds)) {
|
|
60702
60665
|
result |= ts.getObjectFlags(type);
|
|
60703
60666
|
}
|
|
60704
60667
|
}
|
|
@@ -60710,7 +60673,7 @@ var ts;
|
|
|
60710
60673
|
if (!type) {
|
|
60711
60674
|
type = createObjectType(4 /* Reference */, target.symbol);
|
|
60712
60675
|
target.instantiations.set(id, type);
|
|
60713
|
-
type.objectFlags |= typeArguments ? getPropagatingFlagsOfTypes(typeArguments
|
|
60676
|
+
type.objectFlags |= typeArguments ? getPropagatingFlagsOfTypes(typeArguments) : 0;
|
|
60714
60677
|
type.target = target;
|
|
60715
60678
|
type.resolvedTypeArguments = typeArguments;
|
|
60716
60679
|
}
|
|
@@ -64144,6 +64107,7 @@ var ts;
|
|
|
64144
64107
|
result.mapper = mapper;
|
|
64145
64108
|
result.aliasSymbol = aliasSymbol || type.aliasSymbol;
|
|
64146
64109
|
result.aliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(type.aliasTypeArguments, mapper);
|
|
64110
|
+
result.objectFlags |= result.aliasTypeArguments ? getPropagatingFlagsOfTypes(result.aliasTypeArguments) : 0;
|
|
64147
64111
|
return result;
|
|
64148
64112
|
}
|
|
64149
64113
|
function getConditionalTypeInstantiation(type, mapper, aliasSymbol, aliasTypeArguments) {
|
|
@@ -69096,10 +69060,13 @@ var ts;
|
|
|
69096
69060
|
propagationType = savePropagationType;
|
|
69097
69061
|
return;
|
|
69098
69062
|
}
|
|
69099
|
-
if (source.aliasSymbol && source.
|
|
69100
|
-
|
|
69101
|
-
|
|
69102
|
-
|
|
69063
|
+
if (source.aliasSymbol && source.aliasSymbol === target.aliasSymbol) {
|
|
69064
|
+
if (source.aliasTypeArguments) {
|
|
69065
|
+
// Source and target are types originating in the same generic type alias declaration.
|
|
69066
|
+
// Simply infer from source type arguments to target type arguments.
|
|
69067
|
+
inferFromTypeArguments(source.aliasTypeArguments, target.aliasTypeArguments, getAliasVariances(source.aliasSymbol));
|
|
69068
|
+
}
|
|
69069
|
+
// And if there weren't any type arguments, there's no reason to run inference as the types must be the same.
|
|
69103
69070
|
return;
|
|
69104
69071
|
}
|
|
69105
69072
|
if (source === target && source.flags & 3145728 /* UnionOrIntersection */) {
|
|
@@ -69155,18 +69122,26 @@ var ts;
|
|
|
69155
69122
|
target = getActualTypeVariable(target);
|
|
69156
69123
|
}
|
|
69157
69124
|
if (target.flags & 8650752 /* TypeVariable */) {
|
|
69158
|
-
//
|
|
69159
|
-
//
|
|
69160
|
-
|
|
69161
|
-
// it as an inference candidate. Hopefully, a better candidate will come along that does
|
|
69162
|
-
// not contain anyFunctionType when we come back to this argument for its second round
|
|
69163
|
-
// of inference. Also, we exclude inferences for silentNeverType (which is used as a wildcard
|
|
69164
|
-
// when constructing types from type parameters that had no inference candidates).
|
|
69165
|
-
if (source === nonInferrableAnyType || source === silentNeverType || (priority & 128 /* ReturnType */ && (source === autoType || source === autoArrayType)) || isFromInferenceBlockedSource(source)) {
|
|
69125
|
+
// Skip inference if the source is "blocked", which is used by the language service to
|
|
69126
|
+
// prevent inference on nodes currently being edited.
|
|
69127
|
+
if (isFromInferenceBlockedSource(source)) {
|
|
69166
69128
|
return;
|
|
69167
69129
|
}
|
|
69168
69130
|
var inference = getInferenceInfoForType(target);
|
|
69169
69131
|
if (inference) {
|
|
69132
|
+
// If target is a type parameter, make an inference, unless the source type contains
|
|
69133
|
+
// a "non-inferrable" type. Types with this flag set are markers used to prevent inference.
|
|
69134
|
+
//
|
|
69135
|
+
// For example:
|
|
69136
|
+
// - anyFunctionType is a wildcard type that's used to avoid contextually typing functions;
|
|
69137
|
+
// it's internal, so should not be exposed to the user by adding it as a candidate.
|
|
69138
|
+
// - autoType (and autoArrayType) is a special "any" used in control flow; like anyFunctionType,
|
|
69139
|
+
// it's internal and should not be observable.
|
|
69140
|
+
// - silentNeverType is returned by getInferredType when instantiating a generic function for
|
|
69141
|
+
// inference (and a type variable has no mapping).
|
|
69142
|
+
//
|
|
69143
|
+
// This flag is infectious; if we produce Box<never> (where never is silentNeverType), Box<never> is
|
|
69144
|
+
// also non-inferrable.
|
|
69170
69145
|
if (ts.getObjectFlags(source) & 262144 /* NonInferrableType */) {
|
|
69171
69146
|
return;
|
|
69172
69147
|
}
|
|
@@ -69709,20 +69684,17 @@ var ts;
|
|
|
69709
69684
|
var sourceLen = sourceSignatures.length;
|
|
69710
69685
|
var targetLen = targetSignatures.length;
|
|
69711
69686
|
var len = sourceLen < targetLen ? sourceLen : targetLen;
|
|
69712
|
-
var skipParameters = !!(ts.getObjectFlags(source) & 262144 /* NonInferrableType */);
|
|
69713
69687
|
for (var i = 0; i < len; i++) {
|
|
69714
|
-
inferFromSignature(getBaseSignature(sourceSignatures[sourceLen - len + i]), getErasedSignature(targetSignatures[targetLen - len + i])
|
|
69688
|
+
inferFromSignature(getBaseSignature(sourceSignatures[sourceLen - len + i]), getErasedSignature(targetSignatures[targetLen - len + i]));
|
|
69715
69689
|
}
|
|
69716
69690
|
}
|
|
69717
|
-
function inferFromSignature(source, target
|
|
69718
|
-
|
|
69719
|
-
|
|
69720
|
-
|
|
69721
|
-
|
|
69722
|
-
|
|
69723
|
-
|
|
69724
|
-
bivariant = saveBivariant;
|
|
69725
|
-
}
|
|
69691
|
+
function inferFromSignature(source, target) {
|
|
69692
|
+
var saveBivariant = bivariant;
|
|
69693
|
+
var kind = target.declaration ? target.declaration.kind : 0 /* Unknown */;
|
|
69694
|
+
// Once we descend into a bivariant signature we remain bivariant for all nested inferences
|
|
69695
|
+
bivariant = bivariant || kind === 169 /* MethodDeclaration */ || kind === 168 /* MethodSignature */ || kind === 171 /* Constructor */;
|
|
69696
|
+
applyToParameterTypes(source, target, inferFromContravariantTypes);
|
|
69697
|
+
bivariant = saveBivariant;
|
|
69726
69698
|
applyToReturnTypes(source, target, inferFromTypes);
|
|
69727
69699
|
}
|
|
69728
69700
|
function inferFromIndexTypes(source, target) {
|
|
@@ -71924,23 +71896,32 @@ var ts;
|
|
|
71924
71896
|
if (!assumeTrue) {
|
|
71925
71897
|
return filterType(type, function (t) { return !isRelated(t, candidate); });
|
|
71926
71898
|
}
|
|
71927
|
-
|
|
71928
|
-
|
|
71929
|
-
if (type.flags & 1048576 /* Union */) {
|
|
71930
|
-
var assignableType = filterType(type, function (t) { return isRelated(t, candidate); });
|
|
71931
|
-
if (!(assignableType.flags & 131072 /* Never */)) {
|
|
71932
|
-
return assignableType;
|
|
71933
|
-
}
|
|
71899
|
+
if (type.flags & 3 /* AnyOrUnknown */) {
|
|
71900
|
+
return candidate;
|
|
71934
71901
|
}
|
|
71935
|
-
//
|
|
71936
|
-
//
|
|
71937
|
-
|
|
71938
|
-
|
|
71939
|
-
|
|
71940
|
-
|
|
71941
|
-
|
|
71942
|
-
|
|
71943
|
-
|
|
71902
|
+
// We first attempt to filter the current type, narrowing constituents as appropriate and removing
|
|
71903
|
+
// constituents that are unrelated to the candidate.
|
|
71904
|
+
var keyPropertyName = type.flags & 1048576 /* Union */ ? getKeyPropertyName(type) : undefined;
|
|
71905
|
+
var narrowedType = mapType(candidate, function (c) {
|
|
71906
|
+
// If a discriminant property is available, use that to reduce the type.
|
|
71907
|
+
var discriminant = keyPropertyName && getTypeOfPropertyOfType(c, keyPropertyName);
|
|
71908
|
+
var matching = discriminant && getConstituentTypeForKeyType(type, discriminant);
|
|
71909
|
+
// For each constituent t in the current type, if t and and c are directly related, pick the most
|
|
71910
|
+
// specific of the two.
|
|
71911
|
+
var directlyRelated = mapType(matching || type, function (t) { return isRelated(t, c) ? t : isRelated(c, t) ? c : neverType; });
|
|
71912
|
+
// If no constituents are directly related, create intersections for any generic constituents that
|
|
71913
|
+
// are related by constraint.
|
|
71914
|
+
return directlyRelated.flags & 131072 /* Never */ ?
|
|
71915
|
+
mapType(type, function (t) { return maybeTypeOfKind(t, 465829888 /* Instantiable */) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType; }) :
|
|
71916
|
+
directlyRelated;
|
|
71917
|
+
});
|
|
71918
|
+
// If filtering produced a non-empty type, return that. Otherwise, pick the most specific of the two
|
|
71919
|
+
// based on assignability, or as a last resort produce an intersection.
|
|
71920
|
+
return !(narrowedType.flags & 131072 /* Never */) ? narrowedType :
|
|
71921
|
+
isTypeSubtypeOf(candidate, type) ? candidate :
|
|
71922
|
+
isTypeAssignableTo(type, candidate) ? type :
|
|
71923
|
+
isTypeAssignableTo(candidate, type) ? candidate :
|
|
71924
|
+
getIntersectionType([type, candidate]);
|
|
71944
71925
|
}
|
|
71945
71926
|
function narrowTypeByCallExpression(type, callExpression, assumeTrue) {
|
|
71946
71927
|
if (hasMatchingArgument(callExpression, reference)) {
|
|
@@ -77228,7 +77209,7 @@ var ts;
|
|
|
77228
77209
|
// returns a function type, we choose to defer processing. This narrowly permits function composition
|
|
77229
77210
|
// operators to flow inferences through return types, but otherwise processes calls right away. We
|
|
77230
77211
|
// use the resolvingSignature singleton to indicate that we deferred processing. This result will be
|
|
77231
|
-
// propagated out and eventually turned into
|
|
77212
|
+
// propagated out and eventually turned into silentNeverType (a type that is assignable to anything and
|
|
77232
77213
|
// from which we never make inferences).
|
|
77233
77214
|
if (checkMode & 8 /* SkipGenericFunctions */ && !node.typeArguments && callSignatures.some(isGenericFunctionReturningFunction)) {
|
|
77234
77215
|
skippedGenericFunction(node, checkMode);
|
|
@@ -77781,8 +77762,8 @@ var ts;
|
|
|
77781
77762
|
var signature = getResolvedSignature(node, /*candidatesOutArray*/ undefined, checkMode);
|
|
77782
77763
|
if (signature === resolvingSignature) {
|
|
77783
77764
|
// CheckMode.SkipGenericFunctions is enabled and this is a call to a generic function that
|
|
77784
|
-
// returns a function type. We defer checking and return
|
|
77785
|
-
return
|
|
77765
|
+
// returns a function type. We defer checking and return silentNeverType.
|
|
77766
|
+
return silentNeverType;
|
|
77786
77767
|
}
|
|
77787
77768
|
checkDeprecatedSignature(signature, node);
|
|
77788
77769
|
if (node.expression.kind === 106 /* SuperKeyword */) {
|
|
@@ -84408,9 +84389,14 @@ var ts;
|
|
|
84408
84389
|
function unwrapReturnType(returnType, functionFlags) {
|
|
84409
84390
|
var isGenerator = !!(functionFlags & 1 /* Generator */);
|
|
84410
84391
|
var isAsync = !!(functionFlags & 2 /* Async */);
|
|
84411
|
-
|
|
84412
|
-
|
|
84413
|
-
|
|
84392
|
+
if (isGenerator) {
|
|
84393
|
+
var returnIterationType = getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, returnType, isAsync);
|
|
84394
|
+
if (!returnIterationType) {
|
|
84395
|
+
return errorType;
|
|
84396
|
+
}
|
|
84397
|
+
return isAsync ? getAwaitedTypeNoAlias(unwrapAwaitedType(returnIterationType)) : returnIterationType;
|
|
84398
|
+
}
|
|
84399
|
+
return isAsync ? getAwaitedTypeNoAlias(returnType) || errorType : returnType;
|
|
84414
84400
|
}
|
|
84415
84401
|
function isUnwrappedReturnTypeVoidOrAny(func, returnType) {
|
|
84416
84402
|
var unwrappedReturnType = unwrapReturnType(returnType, ts.getFunctionFlags(func));
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "typescript",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "4.8.0-dev.
|
|
5
|
+
"version": "4.8.0-dev.20220717",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|