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
|
@@ -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.20220715";
|
|
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) {
|
|
@@ -73511,6 +73483,14 @@ var ts;
|
|
|
73511
73483
|
var lhsType = getTypeOfExpression(e.expression);
|
|
73512
73484
|
return ts.isPrivateIdentifier(e.name) ? tryGetPrivateIdentifierPropertyOfType(lhsType, e.name) : getPropertyOfType(lhsType, e.name.escapedText);
|
|
73513
73485
|
}
|
|
73486
|
+
if (ts.isElementAccessExpression(e)) {
|
|
73487
|
+
var propType = checkExpressionCached(e.argumentExpression);
|
|
73488
|
+
if (!isTypeUsableAsPropertyName(propType)) {
|
|
73489
|
+
return undefined;
|
|
73490
|
+
}
|
|
73491
|
+
var lhsType = getTypeOfExpression(e.expression);
|
|
73492
|
+
return getPropertyOfType(lhsType, getPropertyNameFromType(propType));
|
|
73493
|
+
}
|
|
73514
73494
|
return undefined;
|
|
73515
73495
|
function tryGetPrivateIdentifierPropertyOfType(type, id) {
|
|
73516
73496
|
var lexicallyScopedSymbol = lookupSymbolForPrivateIdentifierDeclaration(id.escapedText, id);
|
|
@@ -77425,7 +77405,7 @@ var ts;
|
|
|
77425
77405
|
// returns a function type, we choose to defer processing. This narrowly permits function composition
|
|
77426
77406
|
// operators to flow inferences through return types, but otherwise processes calls right away. We
|
|
77427
77407
|
// use the resolvingSignature singleton to indicate that we deferred processing. This result will be
|
|
77428
|
-
// propagated out and eventually turned into
|
|
77408
|
+
// propagated out and eventually turned into silentNeverType (a type that is assignable to anything and
|
|
77429
77409
|
// from which we never make inferences).
|
|
77430
77410
|
if (checkMode & 8 /* SkipGenericFunctions */ && !node.typeArguments && callSignatures.some(isGenericFunctionReturningFunction)) {
|
|
77431
77411
|
skippedGenericFunction(node, checkMode);
|
|
@@ -77978,8 +77958,8 @@ var ts;
|
|
|
77978
77958
|
var signature = getResolvedSignature(node, /*candidatesOutArray*/ undefined, checkMode);
|
|
77979
77959
|
if (signature === resolvingSignature) {
|
|
77980
77960
|
// CheckMode.SkipGenericFunctions is enabled and this is a call to a generic function that
|
|
77981
|
-
// returns a function type. We defer checking and return
|
|
77982
|
-
return
|
|
77961
|
+
// returns a function type. We defer checking and return silentNeverType.
|
|
77962
|
+
return silentNeverType;
|
|
77983
77963
|
}
|
|
77984
77964
|
checkDeprecatedSignature(signature, node);
|
|
77985
77965
|
if (node.expression.kind === 106 /* SuperKeyword */) {
|
|
@@ -84605,9 +84585,14 @@ var ts;
|
|
|
84605
84585
|
function unwrapReturnType(returnType, functionFlags) {
|
|
84606
84586
|
var isGenerator = !!(functionFlags & 1 /* Generator */);
|
|
84607
84587
|
var isAsync = !!(functionFlags & 2 /* Async */);
|
|
84608
|
-
|
|
84609
|
-
|
|
84610
|
-
|
|
84588
|
+
if (isGenerator) {
|
|
84589
|
+
var returnIterationType = getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, returnType, isAsync);
|
|
84590
|
+
if (!returnIterationType) {
|
|
84591
|
+
return errorType;
|
|
84592
|
+
}
|
|
84593
|
+
return isAsync ? getAwaitedTypeNoAlias(unwrapAwaitedType(returnIterationType)) : returnIterationType;
|
|
84594
|
+
}
|
|
84595
|
+
return isAsync ? getAwaitedTypeNoAlias(returnType) || errorType : returnType;
|
|
84611
84596
|
}
|
|
84612
84597
|
function isUnwrappedReturnTypeVoidOrAny(func, returnType) {
|
|
84613
84598
|
var unwrappedReturnType = unwrapReturnType(returnType, ts.getFunctionFlags(func));
|
|
@@ -145315,7 +145300,7 @@ var ts;
|
|
|
145315
145300
|
var SmartSelectionRange;
|
|
145316
145301
|
(function (SmartSelectionRange) {
|
|
145317
145302
|
function getSmartSelectionRange(pos, sourceFile) {
|
|
145318
|
-
var _a;
|
|
145303
|
+
var _a, _b;
|
|
145319
145304
|
var selectionRange = {
|
|
145320
145305
|
textSpan: ts.createTextSpanFromBounds(sourceFile.getFullStart(), sourceFile.getEnd())
|
|
145321
145306
|
};
|
|
@@ -145367,6 +145352,17 @@ var ts;
|
|
|
145367
145352
|
if (ts.hasJSDocNodes(node) && ((_a = node.jsDoc) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
145368
145353
|
pushSelectionRange(ts.first(node.jsDoc).getStart(), end);
|
|
145369
145354
|
}
|
|
145355
|
+
// (#39618 & #49807)
|
|
145356
|
+
// When the node is a SyntaxList and its first child has a JSDoc comment, then the node's
|
|
145357
|
+
// `start` (which usually is the result of calling `node.getStart()`) points to the first
|
|
145358
|
+
// token after the JSDoc comment. So, we have to make sure we'd pushed the selection
|
|
145359
|
+
// covering the JSDoc comment before diving further.
|
|
145360
|
+
if (ts.isSyntaxList(node)) {
|
|
145361
|
+
var firstChild = node.getChildren()[0];
|
|
145362
|
+
if (firstChild && ts.hasJSDocNodes(firstChild) && ((_b = firstChild.jsDoc) === null || _b === void 0 ? void 0 : _b.length) && firstChild.getStart() !== node.pos) {
|
|
145363
|
+
start = Math.min(start, ts.first(firstChild.jsDoc).getStart());
|
|
145364
|
+
}
|
|
145365
|
+
}
|
|
145370
145366
|
pushSelectionRange(start, end);
|
|
145371
145367
|
// String literals should have a stop both inside and outside their quotes.
|
|
145372
145368
|
if (ts.isStringLiteral(node) || ts.isTemplateLiteral(node)) {
|
|
@@ -145440,6 +145436,7 @@ var ts;
|
|
|
145440
145436
|
* other as well as of other top-level statements and declarations.
|
|
145441
145437
|
*/
|
|
145442
145438
|
function getSelectionChildren(node) {
|
|
145439
|
+
var _a;
|
|
145443
145440
|
// Group top-level imports
|
|
145444
145441
|
if (ts.isSourceFile(node)) {
|
|
145445
145442
|
return groupChildren(node.getChildAt(0).getChildren(), isImport);
|
|
@@ -145455,7 +145452,7 @@ var ts;
|
|
|
145455
145452
|
// because it allows the mapped type to become an object type with a
|
|
145456
145453
|
// few keystrokes.
|
|
145457
145454
|
if (ts.isMappedTypeNode(node)) {
|
|
145458
|
-
var
|
|
145455
|
+
var _b = node.getChildren(), openBraceToken = _b[0], children = _b.slice(1);
|
|
145459
145456
|
var closeBraceToken = ts.Debug.checkDefined(children.pop());
|
|
145460
145457
|
ts.Debug.assertEqual(openBraceToken.kind, 18 /* OpenBraceToken */);
|
|
145461
145458
|
ts.Debug.assertEqual(closeBraceToken.kind, 19 /* CloseBraceToken */);
|
|
@@ -145486,10 +145483,13 @@ var ts;
|
|
|
145486
145483
|
var children = groupChildren(node.getChildren(), function (child) {
|
|
145487
145484
|
return child === node.name || ts.contains(node.modifiers, child);
|
|
145488
145485
|
});
|
|
145489
|
-
|
|
145486
|
+
var firstJSDocChild = ((_a = children[0]) === null || _a === void 0 ? void 0 : _a.kind) === 320 /* JSDoc */ ? children[0] : undefined;
|
|
145487
|
+
var withJSDocSeparated = firstJSDocChild ? children.slice(1) : children;
|
|
145488
|
+
var splittedChildren = splitChildren(withJSDocSeparated, function (_a) {
|
|
145490
145489
|
var kind = _a.kind;
|
|
145491
145490
|
return kind === 58 /* ColonToken */;
|
|
145492
145491
|
});
|
|
145492
|
+
return firstJSDocChild ? [firstJSDocChild, createSyntaxList(splittedChildren)] : splittedChildren;
|
|
145493
145493
|
}
|
|
145494
145494
|
// Group the parameter name with its `...`, then that group with its `?`, then pivot on `=`.
|
|
145495
145495
|
if (ts.isParameter(node)) {
|
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.20220715";
|
|
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) {
|
|
@@ -73306,6 +73278,14 @@ var ts;
|
|
|
73306
73278
|
var lhsType = getTypeOfExpression(e.expression);
|
|
73307
73279
|
return ts.isPrivateIdentifier(e.name) ? tryGetPrivateIdentifierPropertyOfType(lhsType, e.name) : getPropertyOfType(lhsType, e.name.escapedText);
|
|
73308
73280
|
}
|
|
73281
|
+
if (ts.isElementAccessExpression(e)) {
|
|
73282
|
+
var propType = checkExpressionCached(e.argumentExpression);
|
|
73283
|
+
if (!isTypeUsableAsPropertyName(propType)) {
|
|
73284
|
+
return undefined;
|
|
73285
|
+
}
|
|
73286
|
+
var lhsType = getTypeOfExpression(e.expression);
|
|
73287
|
+
return getPropertyOfType(lhsType, getPropertyNameFromType(propType));
|
|
73288
|
+
}
|
|
73309
73289
|
return undefined;
|
|
73310
73290
|
function tryGetPrivateIdentifierPropertyOfType(type, id) {
|
|
73311
73291
|
var lexicallyScopedSymbol = lookupSymbolForPrivateIdentifierDeclaration(id.escapedText, id);
|
|
@@ -77220,7 +77200,7 @@ var ts;
|
|
|
77220
77200
|
// returns a function type, we choose to defer processing. This narrowly permits function composition
|
|
77221
77201
|
// operators to flow inferences through return types, but otherwise processes calls right away. We
|
|
77222
77202
|
// use the resolvingSignature singleton to indicate that we deferred processing. This result will be
|
|
77223
|
-
// propagated out and eventually turned into
|
|
77203
|
+
// propagated out and eventually turned into silentNeverType (a type that is assignable to anything and
|
|
77224
77204
|
// from which we never make inferences).
|
|
77225
77205
|
if (checkMode & 8 /* SkipGenericFunctions */ && !node.typeArguments && callSignatures.some(isGenericFunctionReturningFunction)) {
|
|
77226
77206
|
skippedGenericFunction(node, checkMode);
|
|
@@ -77773,8 +77753,8 @@ var ts;
|
|
|
77773
77753
|
var signature = getResolvedSignature(node, /*candidatesOutArray*/ undefined, checkMode);
|
|
77774
77754
|
if (signature === resolvingSignature) {
|
|
77775
77755
|
// CheckMode.SkipGenericFunctions is enabled and this is a call to a generic function that
|
|
77776
|
-
// returns a function type. We defer checking and return
|
|
77777
|
-
return
|
|
77756
|
+
// returns a function type. We defer checking and return silentNeverType.
|
|
77757
|
+
return silentNeverType;
|
|
77778
77758
|
}
|
|
77779
77759
|
checkDeprecatedSignature(signature, node);
|
|
77780
77760
|
if (node.expression.kind === 106 /* SuperKeyword */) {
|
|
@@ -84400,9 +84380,14 @@ var ts;
|
|
|
84400
84380
|
function unwrapReturnType(returnType, functionFlags) {
|
|
84401
84381
|
var isGenerator = !!(functionFlags & 1 /* Generator */);
|
|
84402
84382
|
var isAsync = !!(functionFlags & 2 /* Async */);
|
|
84403
|
-
|
|
84404
|
-
|
|
84405
|
-
|
|
84383
|
+
if (isGenerator) {
|
|
84384
|
+
var returnIterationType = getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, returnType, isAsync);
|
|
84385
|
+
if (!returnIterationType) {
|
|
84386
|
+
return errorType;
|
|
84387
|
+
}
|
|
84388
|
+
return isAsync ? getAwaitedTypeNoAlias(unwrapAwaitedType(returnIterationType)) : returnIterationType;
|
|
84389
|
+
}
|
|
84390
|
+
return isAsync ? getAwaitedTypeNoAlias(returnType) || errorType : returnType;
|
|
84406
84391
|
}
|
|
84407
84392
|
function isUnwrappedReturnTypeVoidOrAny(func, returnType) {
|
|
84408
84393
|
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.20220715",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|