typescript 4.8.0-dev.20220706 → 4.8.0-dev.20220707
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/tsc.js +113 -87
- package/lib/tsserver.js +144 -109
- package/lib/tsserverlibrary.d.ts +6 -0
- package/lib/tsserverlibrary.js +144 -109
- package/lib/typescript.d.ts +6 -0
- package/lib/typescript.js +144 -109
- package/lib/typescriptServices.d.ts +6 -0
- package/lib/typescriptServices.js +144 -109
- package/lib/typingsInstaller.js +116 -94
- package/package.json +1 -1
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.20220707";
|
|
73
73
|
var NativeCollections;
|
|
74
74
|
(function (NativeCollections) {
|
|
75
75
|
var globals = typeof globalThis !== "undefined" ? globalThis :
|
|
@@ -2362,6 +2362,22 @@ var ts;
|
|
|
2362
2362
|
return formatEnum(flags, ts.FlowFlags, true);
|
|
2363
2363
|
}
|
|
2364
2364
|
Debug.formatFlowFlags = formatFlowFlags;
|
|
2365
|
+
function formatRelationComparisonResult(result) {
|
|
2366
|
+
return formatEnum(result, ts.RelationComparisonResult, true);
|
|
2367
|
+
}
|
|
2368
|
+
Debug.formatRelationComparisonResult = formatRelationComparisonResult;
|
|
2369
|
+
function formatCheckMode(mode) {
|
|
2370
|
+
return formatEnum(mode, ts.CheckMode, true);
|
|
2371
|
+
}
|
|
2372
|
+
Debug.formatCheckMode = formatCheckMode;
|
|
2373
|
+
function formatSignatureCheckMode(mode) {
|
|
2374
|
+
return formatEnum(mode, ts.SignatureCheckMode, true);
|
|
2375
|
+
}
|
|
2376
|
+
Debug.formatSignatureCheckMode = formatSignatureCheckMode;
|
|
2377
|
+
function formatTypeFacts(facts) {
|
|
2378
|
+
return formatEnum(facts, ts.TypeFacts, true);
|
|
2379
|
+
}
|
|
2380
|
+
Debug.formatTypeFacts = formatTypeFacts;
|
|
2365
2381
|
var isDebugInfoEnabled = false;
|
|
2366
2382
|
var extendedDebugModule;
|
|
2367
2383
|
function extendedDebug() {
|
|
@@ -15381,7 +15397,8 @@ var ts;
|
|
|
15381
15397
|
function getDeclarationModifierFlagsFromSymbol(s, isWrite) {
|
|
15382
15398
|
if (isWrite === void 0) { isWrite = false; }
|
|
15383
15399
|
if (s.valueDeclaration) {
|
|
15384
|
-
var declaration = (isWrite && s.declarations && ts.find(s.declarations,
|
|
15400
|
+
var declaration = (isWrite && s.declarations && ts.find(s.declarations, ts.isSetAccessorDeclaration))
|
|
15401
|
+
|| (s.flags & 32768 && ts.find(s.declarations, ts.isGetAccessorDeclaration)) || s.valueDeclaration;
|
|
15385
15402
|
var flags = ts.getCombinedModifierFlags(declaration);
|
|
15386
15403
|
return s.parent && s.parent.flags & 32 ? flags : flags & ~28;
|
|
15387
15404
|
}
|
|
@@ -16003,7 +16020,7 @@ var ts;
|
|
|
16003
16020
|
return !file.isDeclarationFile ? walkTreeForJSXTags(file) : undefined;
|
|
16004
16021
|
}
|
|
16005
16022
|
function isFileForcedToBeModuleByFormat(file) {
|
|
16006
|
-
return (file.impliedNodeFormat === ts.ModuleKind.ESNext || (ts.fileExtensionIsOneOf(file.fileName, [".cjs", ".cts"]))) && !file.isDeclarationFile ? true : undefined;
|
|
16023
|
+
return (file.impliedNodeFormat === ts.ModuleKind.ESNext || (ts.fileExtensionIsOneOf(file.fileName, [".cjs", ".cts", ".mjs", ".mts"]))) && !file.isDeclarationFile ? true : undefined;
|
|
16007
16024
|
}
|
|
16008
16025
|
function getSetExternalModuleIndicator(options) {
|
|
16009
16026
|
switch (getEmitModuleDetectionKind(options)) {
|
|
@@ -16020,10 +16037,7 @@ var ts;
|
|
|
16020
16037
|
if (options.jsx === 4 || options.jsx === 5) {
|
|
16021
16038
|
checks.push(isFileModuleFromUsingJSXTag);
|
|
16022
16039
|
}
|
|
16023
|
-
|
|
16024
|
-
if (moduleKind === ts.ModuleKind.Node16 || moduleKind === ts.ModuleKind.NodeNext) {
|
|
16025
|
-
checks.push(isFileForcedToBeModuleByFormat);
|
|
16026
|
-
}
|
|
16040
|
+
checks.push(isFileForcedToBeModuleByFormat);
|
|
16027
16041
|
var combined_1 = ts.or.apply(void 0, checks);
|
|
16028
16042
|
var callback = function (file) { return void (file.externalModuleIndicator = combined_1(file)); };
|
|
16029
16043
|
return callback;
|
|
@@ -27359,10 +27373,10 @@ var ts;
|
|
|
27359
27373
|
var hasJSDoc = hasPrecedingJSDocComment();
|
|
27360
27374
|
var modifiers = parseModifiers();
|
|
27361
27375
|
if (parseContextualModifier(136)) {
|
|
27362
|
-
return parseAccessorDeclaration(pos, hasJSDoc, undefined, modifiers, 172);
|
|
27376
|
+
return parseAccessorDeclaration(pos, hasJSDoc, undefined, modifiers, 172, 4);
|
|
27363
27377
|
}
|
|
27364
27378
|
if (parseContextualModifier(149)) {
|
|
27365
|
-
return parseAccessorDeclaration(pos, hasJSDoc, undefined, modifiers, 173);
|
|
27379
|
+
return parseAccessorDeclaration(pos, hasJSDoc, undefined, modifiers, 173, 4);
|
|
27366
27380
|
}
|
|
27367
27381
|
if (isIndexSignature()) {
|
|
27368
27382
|
return parseIndexSignatureDeclaration(pos, hasJSDoc, undefined, modifiers);
|
|
@@ -28953,10 +28967,10 @@ var ts;
|
|
|
28953
28967
|
var decorators = parseDecorators();
|
|
28954
28968
|
var modifiers = parseModifiers();
|
|
28955
28969
|
if (parseContextualModifier(136)) {
|
|
28956
|
-
return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172);
|
|
28970
|
+
return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172, 0);
|
|
28957
28971
|
}
|
|
28958
28972
|
if (parseContextualModifier(149)) {
|
|
28959
|
-
return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 173);
|
|
28973
|
+
return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 173, 0);
|
|
28960
28974
|
}
|
|
28961
28975
|
var asteriskToken = parseOptionalToken(41);
|
|
28962
28976
|
var tokenIsIdentifier = isIdentifier();
|
|
@@ -29574,9 +29588,15 @@ var ts;
|
|
|
29574
29588
|
return !scanner.hasPrecedingLineBreak() && (isIdentifier() || token() === 10);
|
|
29575
29589
|
}
|
|
29576
29590
|
function parseFunctionBlockOrSemicolon(flags, diagnosticMessage) {
|
|
29577
|
-
if (token() !== 18
|
|
29578
|
-
|
|
29579
|
-
|
|
29591
|
+
if (token() !== 18) {
|
|
29592
|
+
if (flags & 4) {
|
|
29593
|
+
parseTypeMemberSemicolon();
|
|
29594
|
+
return;
|
|
29595
|
+
}
|
|
29596
|
+
if (canParseSemicolon()) {
|
|
29597
|
+
parseSemicolon();
|
|
29598
|
+
return;
|
|
29599
|
+
}
|
|
29580
29600
|
}
|
|
29581
29601
|
return parseFunctionBlock(flags, diagnosticMessage);
|
|
29582
29602
|
}
|
|
@@ -29764,12 +29784,12 @@ var ts;
|
|
|
29764
29784
|
}
|
|
29765
29785
|
return parsePropertyDeclaration(pos, hasJSDoc, decorators, modifiers, name, questionToken);
|
|
29766
29786
|
}
|
|
29767
|
-
function parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, kind) {
|
|
29787
|
+
function parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, kind, flags) {
|
|
29768
29788
|
var name = parsePropertyName();
|
|
29769
29789
|
var typeParameters = parseTypeParameters();
|
|
29770
29790
|
var parameters = parseParameters(0);
|
|
29771
29791
|
var type = parseReturnType(58, false);
|
|
29772
|
-
var body = parseFunctionBlockOrSemicolon(
|
|
29792
|
+
var body = parseFunctionBlockOrSemicolon(flags);
|
|
29773
29793
|
var node = kind === 172
|
|
29774
29794
|
? factory.createGetAccessorDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, parameters, type, body)
|
|
29775
29795
|
: factory.createSetAccessorDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, parameters, body);
|
|
@@ -29925,10 +29945,10 @@ var ts;
|
|
|
29925
29945
|
return parseClassStaticBlockDeclaration(pos, hasJSDoc, decorators, modifiers);
|
|
29926
29946
|
}
|
|
29927
29947
|
if (parseContextualModifier(136)) {
|
|
29928
|
-
return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172);
|
|
29948
|
+
return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172, 0);
|
|
29929
29949
|
}
|
|
29930
29950
|
if (parseContextualModifier(149)) {
|
|
29931
|
-
return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 173);
|
|
29951
|
+
return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 173, 0);
|
|
29932
29952
|
}
|
|
29933
29953
|
if (token() === 134 || token() === 10) {
|
|
29934
29954
|
var constructorDeclaration = tryParseConstructorDeclaration(pos, hasJSDoc, decorators, modifiers);
|
|
@@ -40031,7 +40051,7 @@ var ts;
|
|
|
40031
40051
|
},
|
|
40032
40052
|
getContextualTypeForObjectLiteralElement: function (nodeIn) {
|
|
40033
40053
|
var node = ts.getParseTreeNode(nodeIn, ts.isObjectLiteralElementLike);
|
|
40034
|
-
return node ? getContextualTypeForObjectLiteralElement(node) : undefined;
|
|
40054
|
+
return node ? getContextualTypeForObjectLiteralElement(node, undefined) : undefined;
|
|
40035
40055
|
},
|
|
40036
40056
|
getContextualTypeForArgumentAtIndex: function (nodeIn, argIndex) {
|
|
40037
40057
|
var node = ts.getParseTreeNode(nodeIn, ts.isCallLikeExpression);
|
|
@@ -40039,7 +40059,7 @@ var ts;
|
|
|
40039
40059
|
},
|
|
40040
40060
|
getContextualTypeForJsxAttribute: function (nodeIn) {
|
|
40041
40061
|
var node = ts.getParseTreeNode(nodeIn, ts.isJsxAttributeLike);
|
|
40042
|
-
return node && getContextualTypeForJsxAttribute(node);
|
|
40062
|
+
return node && getContextualTypeForJsxAttribute(node, undefined);
|
|
40043
40063
|
},
|
|
40044
40064
|
isContextSensitive: isContextSensitive,
|
|
40045
40065
|
getTypeOfPropertyOfContextualType: getTypeOfPropertyOfContextualType,
|
|
@@ -43294,13 +43314,25 @@ var ts;
|
|
|
43294
43314
|
&& isDeclarationVisible(declaration.parent)) {
|
|
43295
43315
|
return addVisibleAlias(declaration, declaration);
|
|
43296
43316
|
}
|
|
43297
|
-
else if (
|
|
43298
|
-
&& ts.
|
|
43299
|
-
|
|
43300
|
-
|
|
43301
|
-
|
|
43302
|
-
|
|
43303
|
-
|
|
43317
|
+
else if (ts.isBindingElement(declaration)) {
|
|
43318
|
+
if (symbol.flags & 2097152 && ts.isInJSFile(declaration) && ((_a = declaration.parent) === null || _a === void 0 ? void 0 : _a.parent)
|
|
43319
|
+
&& ts.isVariableDeclaration(declaration.parent.parent)
|
|
43320
|
+
&& ((_b = declaration.parent.parent.parent) === null || _b === void 0 ? void 0 : _b.parent) && ts.isVariableStatement(declaration.parent.parent.parent.parent)
|
|
43321
|
+
&& !ts.hasSyntacticModifier(declaration.parent.parent.parent.parent, 1)
|
|
43322
|
+
&& declaration.parent.parent.parent.parent.parent
|
|
43323
|
+
&& isDeclarationVisible(declaration.parent.parent.parent.parent.parent)) {
|
|
43324
|
+
return addVisibleAlias(declaration, declaration.parent.parent.parent.parent);
|
|
43325
|
+
}
|
|
43326
|
+
else if (symbol.flags & 2) {
|
|
43327
|
+
var variableStatement = ts.findAncestor(declaration, ts.isVariableStatement);
|
|
43328
|
+
if (ts.hasSyntacticModifier(variableStatement, 1)) {
|
|
43329
|
+
return true;
|
|
43330
|
+
}
|
|
43331
|
+
if (!isDeclarationVisible(variableStatement.parent)) {
|
|
43332
|
+
return false;
|
|
43333
|
+
}
|
|
43334
|
+
return addVisibleAlias(declaration, variableStatement);
|
|
43335
|
+
}
|
|
43304
43336
|
}
|
|
43305
43337
|
return false;
|
|
43306
43338
|
}
|
|
@@ -43791,6 +43823,10 @@ var ts;
|
|
|
43791
43823
|
}
|
|
43792
43824
|
return typeToTypeNodeHelper(type, context);
|
|
43793
43825
|
}
|
|
43826
|
+
function isHomomorphicMappedTypeWithNonHomomorphicInstantiation(type) {
|
|
43827
|
+
return isMappedTypeWithKeyofConstraintDeclaration(type)
|
|
43828
|
+
&& !(getModifiersTypeFromMappedType(type).flags & 262144);
|
|
43829
|
+
}
|
|
43794
43830
|
function createMappedTypeNodeFromType(type) {
|
|
43795
43831
|
ts.Debug.assert(!!(type.flags & 524288));
|
|
43796
43832
|
var readonlyToken = type.declaration.readonlyToken ? ts.factory.createToken(type.declaration.readonlyToken.kind) : undefined;
|
|
@@ -43798,7 +43834,7 @@ var ts;
|
|
|
43798
43834
|
var appropriateConstraintTypeNode;
|
|
43799
43835
|
var newTypeVariable;
|
|
43800
43836
|
if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
|
|
43801
|
-
if (
|
|
43837
|
+
if (isHomomorphicMappedTypeWithNonHomomorphicInstantiation(type) && context.flags & 4) {
|
|
43802
43838
|
var newParam = createTypeParameter(createSymbol(262144, "T"));
|
|
43803
43839
|
var name = typeParameterToName(newParam, context);
|
|
43804
43840
|
newTypeVariable = ts.factory.createTypeReferenceNode(name);
|
|
@@ -43814,8 +43850,9 @@ var ts;
|
|
|
43814
43850
|
var mappedTypeNode = ts.factory.createMappedTypeNode(readonlyToken, typeParameterNode, nameTypeNode, questionToken, templateTypeNode, undefined);
|
|
43815
43851
|
context.approximateLength += 10;
|
|
43816
43852
|
var result = ts.setEmitFlags(mappedTypeNode, 1);
|
|
43817
|
-
if (
|
|
43818
|
-
|
|
43853
|
+
if (isHomomorphicMappedTypeWithNonHomomorphicInstantiation(type) && context.flags & 4) {
|
|
43854
|
+
var originalConstraint = instantiateType(getConstraintOfTypeParameter(getTypeFromTypeNode(type.declaration.typeParameter.constraint.type)) || unknownType, type.mapper);
|
|
43855
|
+
return ts.factory.createConditionalTypeNode(typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context), ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(undefined, ts.factory.cloneNode(newTypeVariable.typeName), originalConstraint.flags & 2 ? undefined : typeToTypeNodeHelper(originalConstraint, context))), result, ts.factory.createKeywordTypeNode(143));
|
|
43819
43856
|
}
|
|
43820
43857
|
return result;
|
|
43821
43858
|
}
|
|
@@ -55157,13 +55194,20 @@ var ts;
|
|
|
55157
55194
|
return result;
|
|
55158
55195
|
}
|
|
55159
55196
|
function structuredTypeRelatedTo(source, target, reportErrors, intersectionState) {
|
|
55197
|
+
var saveErrorInfo = captureErrorCalculationState();
|
|
55198
|
+
var result = structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState, saveErrorInfo);
|
|
55199
|
+
if (result) {
|
|
55200
|
+
resetErrorInfo(saveErrorInfo);
|
|
55201
|
+
}
|
|
55202
|
+
return result;
|
|
55203
|
+
}
|
|
55204
|
+
function structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState, saveErrorInfo) {
|
|
55160
55205
|
if (intersectionState & 4) {
|
|
55161
55206
|
return propertiesRelatedTo(source, target, reportErrors, undefined, 0);
|
|
55162
55207
|
}
|
|
55163
55208
|
var result;
|
|
55164
55209
|
var originalErrorInfo;
|
|
55165
55210
|
var varianceCheckFailed = false;
|
|
55166
|
-
var saveErrorInfo = captureErrorCalculationState();
|
|
55167
55211
|
var sourceFlags = source.flags;
|
|
55168
55212
|
var targetFlags = target.flags;
|
|
55169
55213
|
if (relation === identityRelation) {
|
|
@@ -55212,7 +55256,6 @@ var ts;
|
|
|
55212
55256
|
var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 ? source.types : [source], !!(target.flags & 1048576));
|
|
55213
55257
|
if (constraint && everyType(constraint, function (c) { return c !== source; })) {
|
|
55214
55258
|
if (result = isRelatedTo(constraint, target, 1, false, undefined, intersectionState)) {
|
|
55215
|
-
resetErrorInfo(saveErrorInfo);
|
|
55216
55259
|
return result;
|
|
55217
55260
|
}
|
|
55218
55261
|
}
|
|
@@ -55305,7 +55348,6 @@ var ts;
|
|
|
55305
55348
|
result &= isRelatedTo(source.indexType, target.indexType, 3, reportErrors);
|
|
55306
55349
|
}
|
|
55307
55350
|
if (result) {
|
|
55308
|
-
resetErrorInfo(saveErrorInfo);
|
|
55309
55351
|
return result;
|
|
55310
55352
|
}
|
|
55311
55353
|
if (reportErrors) {
|
|
@@ -55381,7 +55423,6 @@ var ts;
|
|
|
55381
55423
|
}
|
|
55382
55424
|
else if (targetFlags & 16777216) {
|
|
55383
55425
|
if (isDeeplyNestedType(target, targetStack, targetDepth, 10)) {
|
|
55384
|
-
resetErrorInfo(saveErrorInfo);
|
|
55385
55426
|
return 3;
|
|
55386
55427
|
}
|
|
55387
55428
|
var c = target;
|
|
@@ -55391,7 +55432,6 @@ var ts;
|
|
|
55391
55432
|
if (result = skipTrue ? -1 : isRelatedTo(source, getTrueTypeFromConditionalType(c), 2, false)) {
|
|
55392
55433
|
result &= skipFalse ? -1 : isRelatedTo(source, getFalseTypeFromConditionalType(c), 2, false);
|
|
55393
55434
|
if (result) {
|
|
55394
|
-
resetErrorInfo(saveErrorInfo);
|
|
55395
55435
|
return result;
|
|
55396
55436
|
}
|
|
55397
55437
|
}
|
|
@@ -55419,18 +55459,15 @@ var ts;
|
|
|
55419
55459
|
if (!(sourceFlags & 8388608 && targetFlags & 8388608)) {
|
|
55420
55460
|
var constraint = getConstraintOfType(source) || unknownType;
|
|
55421
55461
|
if (result = isRelatedTo(constraint, target, 1, false, undefined, intersectionState)) {
|
|
55422
|
-
resetErrorInfo(saveErrorInfo);
|
|
55423
55462
|
return result;
|
|
55424
55463
|
}
|
|
55425
55464
|
else if (result = isRelatedTo(getTypeWithThisArgument(constraint, source), target, 1, reportErrors && constraint !== unknownType && !(targetFlags & sourceFlags & 262144), undefined, intersectionState)) {
|
|
55426
|
-
resetErrorInfo(saveErrorInfo);
|
|
55427
55465
|
return result;
|
|
55428
55466
|
}
|
|
55429
55467
|
if (isMappedTypeGenericIndexedAccess(source)) {
|
|
55430
55468
|
var indexConstraint = getConstraintOfType(source.indexType);
|
|
55431
55469
|
if (indexConstraint) {
|
|
55432
55470
|
if (result = isRelatedTo(getIndexedAccessType(source.objectType, indexConstraint), target, 1, reportErrors)) {
|
|
55433
|
-
resetErrorInfo(saveErrorInfo);
|
|
55434
55471
|
return result;
|
|
55435
55472
|
}
|
|
55436
55473
|
}
|
|
@@ -55439,7 +55476,6 @@ var ts;
|
|
|
55439
55476
|
}
|
|
55440
55477
|
else if (sourceFlags & 4194304) {
|
|
55441
55478
|
if (result = isRelatedTo(keyofConstraintType, target, 1, reportErrors)) {
|
|
55442
|
-
resetErrorInfo(saveErrorInfo);
|
|
55443
55479
|
return result;
|
|
55444
55480
|
}
|
|
55445
55481
|
}
|
|
@@ -55447,7 +55483,6 @@ var ts;
|
|
|
55447
55483
|
if (!(targetFlags & 134217728)) {
|
|
55448
55484
|
var constraint = getBaseConstraintOfType(source);
|
|
55449
55485
|
if (constraint && constraint !== source && (result = isRelatedTo(constraint, target, 1, reportErrors))) {
|
|
55450
|
-
resetErrorInfo(saveErrorInfo);
|
|
55451
55486
|
return result;
|
|
55452
55487
|
}
|
|
55453
55488
|
}
|
|
@@ -55458,21 +55493,18 @@ var ts;
|
|
|
55458
55493
|
return 0;
|
|
55459
55494
|
}
|
|
55460
55495
|
if (result = isRelatedTo(source.type, target.type, 3, reportErrors)) {
|
|
55461
|
-
resetErrorInfo(saveErrorInfo);
|
|
55462
55496
|
return result;
|
|
55463
55497
|
}
|
|
55464
55498
|
}
|
|
55465
55499
|
else {
|
|
55466
55500
|
var constraint = getBaseConstraintOfType(source);
|
|
55467
55501
|
if (constraint && (result = isRelatedTo(constraint, target, 1, reportErrors))) {
|
|
55468
|
-
resetErrorInfo(saveErrorInfo);
|
|
55469
55502
|
return result;
|
|
55470
55503
|
}
|
|
55471
55504
|
}
|
|
55472
55505
|
}
|
|
55473
55506
|
else if (sourceFlags & 16777216) {
|
|
55474
55507
|
if (isDeeplyNestedType(source, sourceStack, sourceDepth, 10)) {
|
|
55475
|
-
resetErrorInfo(saveErrorInfo);
|
|
55476
55508
|
return 3;
|
|
55477
55509
|
}
|
|
55478
55510
|
if (targetFlags & 16777216) {
|
|
@@ -55491,7 +55523,6 @@ var ts;
|
|
|
55491
55523
|
result &= isRelatedTo(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target), 3, reportErrors);
|
|
55492
55524
|
}
|
|
55493
55525
|
if (result) {
|
|
55494
|
-
resetErrorInfo(saveErrorInfo);
|
|
55495
55526
|
return result;
|
|
55496
55527
|
}
|
|
55497
55528
|
}
|
|
@@ -55500,7 +55531,6 @@ var ts;
|
|
|
55500
55531
|
var distributiveConstraint = hasNonCircularBaseConstraint(source) ? getConstraintOfDistributiveConditionalType(source) : undefined;
|
|
55501
55532
|
if (distributiveConstraint) {
|
|
55502
55533
|
if (result = isRelatedTo(distributiveConstraint, target, 1, reportErrors)) {
|
|
55503
|
-
resetErrorInfo(saveErrorInfo);
|
|
55504
55534
|
return result;
|
|
55505
55535
|
}
|
|
55506
55536
|
}
|
|
@@ -55508,7 +55538,6 @@ var ts;
|
|
|
55508
55538
|
var defaultConstraint = getDefaultConstraintOfConditionalType(source);
|
|
55509
55539
|
if (defaultConstraint) {
|
|
55510
55540
|
if (result = isRelatedTo(defaultConstraint, target, 1, reportErrors)) {
|
|
55511
|
-
resetErrorInfo(saveErrorInfo);
|
|
55512
55541
|
return result;
|
|
55513
55542
|
}
|
|
55514
55543
|
}
|
|
@@ -55520,7 +55549,6 @@ var ts;
|
|
|
55520
55549
|
if (isGenericMappedType(target)) {
|
|
55521
55550
|
if (isGenericMappedType(source)) {
|
|
55522
55551
|
if (result = mappedTypeRelatedTo(source, target, reportErrors)) {
|
|
55523
|
-
resetErrorInfo(saveErrorInfo);
|
|
55524
55552
|
return result;
|
|
55525
55553
|
}
|
|
55526
55554
|
}
|
|
@@ -60324,7 +60352,7 @@ var ts;
|
|
|
60324
60352
|
!((ts.isJsxOpeningElement(node.parent) || ts.isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) &&
|
|
60325
60353
|
(checkMode && checkMode & 64 ?
|
|
60326
60354
|
getContextualType(node, 8)
|
|
60327
|
-
: getContextualType(node));
|
|
60355
|
+
: getContextualType(node, undefined));
|
|
60328
60356
|
return contextualType && !isGenericType(contextualType);
|
|
60329
60357
|
}
|
|
60330
60358
|
function getNarrowableTypeForReference(type, reference, checkMode) {
|
|
@@ -60981,7 +61009,7 @@ var ts;
|
|
|
60981
61009
|
if (noImplicitThis || inJs) {
|
|
60982
61010
|
var containingLiteral = getContainingObjectLiteral(func);
|
|
60983
61011
|
if (containingLiteral) {
|
|
60984
|
-
var contextualType = getApparentTypeOfContextualType(containingLiteral);
|
|
61012
|
+
var contextualType = getApparentTypeOfContextualType(containingLiteral, undefined);
|
|
60985
61013
|
var literal = containingLiteral;
|
|
60986
61014
|
var type = contextualType;
|
|
60987
61015
|
while (type) {
|
|
@@ -60993,7 +61021,7 @@ var ts;
|
|
|
60993
61021
|
break;
|
|
60994
61022
|
}
|
|
60995
61023
|
literal = literal.parent.parent;
|
|
60996
|
-
type = getApparentTypeOfContextualType(literal);
|
|
61024
|
+
type = getApparentTypeOfContextualType(literal, undefined);
|
|
60997
61025
|
}
|
|
60998
61026
|
return getWidenedType(contextualType ? getNonNullableType(contextualType) : checkExpressionCached(containingLiteral));
|
|
60999
61027
|
}
|
|
@@ -61043,7 +61071,7 @@ var ts;
|
|
|
61043
61071
|
tryGetTypeAtPosition(contextualSignature, index);
|
|
61044
61072
|
}
|
|
61045
61073
|
}
|
|
61046
|
-
function getContextualTypeForVariableLikeDeclaration(declaration) {
|
|
61074
|
+
function getContextualTypeForVariableLikeDeclaration(declaration, contextFlags) {
|
|
61047
61075
|
var typeNode = ts.getEffectiveTypeAnnotationNode(declaration);
|
|
61048
61076
|
if (typeNode) {
|
|
61049
61077
|
return getTypeFromTypeNode(typeNode);
|
|
@@ -61052,17 +61080,17 @@ var ts;
|
|
|
61052
61080
|
case 164:
|
|
61053
61081
|
return getContextuallyTypedParameterType(declaration);
|
|
61054
61082
|
case 203:
|
|
61055
|
-
return getContextualTypeForBindingElement(declaration);
|
|
61083
|
+
return getContextualTypeForBindingElement(declaration, contextFlags);
|
|
61056
61084
|
case 167:
|
|
61057
61085
|
if (ts.isStatic(declaration)) {
|
|
61058
|
-
return getContextualTypeForStaticPropertyDeclaration(declaration);
|
|
61086
|
+
return getContextualTypeForStaticPropertyDeclaration(declaration, contextFlags);
|
|
61059
61087
|
}
|
|
61060
61088
|
}
|
|
61061
61089
|
}
|
|
61062
|
-
function getContextualTypeForBindingElement(declaration) {
|
|
61090
|
+
function getContextualTypeForBindingElement(declaration, contextFlags) {
|
|
61063
61091
|
var parent = declaration.parent.parent;
|
|
61064
61092
|
var name = declaration.propertyName || declaration.name;
|
|
61065
|
-
var parentType = getContextualTypeForVariableLikeDeclaration(parent) ||
|
|
61093
|
+
var parentType = getContextualTypeForVariableLikeDeclaration(parent, contextFlags) ||
|
|
61066
61094
|
parent.kind !== 203 && parent.initializer && checkDeclarationInitializer(parent, declaration.dotDotDotToken ? 64 : 0);
|
|
61067
61095
|
if (!parentType || ts.isBindingPattern(name) || ts.isComputedNonLiteralName(name))
|
|
61068
61096
|
return undefined;
|
|
@@ -61078,8 +61106,8 @@ var ts;
|
|
|
61078
61106
|
return getTypeOfPropertyOfType(parentType, text);
|
|
61079
61107
|
}
|
|
61080
61108
|
}
|
|
61081
|
-
function getContextualTypeForStaticPropertyDeclaration(declaration) {
|
|
61082
|
-
var parentType = ts.isExpression(declaration.parent) && getContextualType(declaration.parent);
|
|
61109
|
+
function getContextualTypeForStaticPropertyDeclaration(declaration, contextFlags) {
|
|
61110
|
+
var parentType = ts.isExpression(declaration.parent) && getContextualType(declaration.parent, contextFlags);
|
|
61083
61111
|
if (!parentType)
|
|
61084
61112
|
return undefined;
|
|
61085
61113
|
return getTypeOfPropertyOfContextualType(parentType, getSymbolOfNode(declaration).escapedName);
|
|
@@ -61087,7 +61115,7 @@ var ts;
|
|
|
61087
61115
|
function getContextualTypeForInitializerExpression(node, contextFlags) {
|
|
61088
61116
|
var declaration = node.parent;
|
|
61089
61117
|
if (ts.hasInitializer(declaration) && node === declaration.initializer) {
|
|
61090
|
-
var result = getContextualTypeForVariableLikeDeclaration(declaration);
|
|
61118
|
+
var result = getContextualTypeForVariableLikeDeclaration(declaration, contextFlags);
|
|
61091
61119
|
if (result) {
|
|
61092
61120
|
return result;
|
|
61093
61121
|
}
|
|
@@ -61097,10 +61125,10 @@ var ts;
|
|
|
61097
61125
|
}
|
|
61098
61126
|
return undefined;
|
|
61099
61127
|
}
|
|
61100
|
-
function getContextualTypeForReturnExpression(node) {
|
|
61128
|
+
function getContextualTypeForReturnExpression(node, contextFlags) {
|
|
61101
61129
|
var func = ts.getContainingFunction(node);
|
|
61102
61130
|
if (func) {
|
|
61103
|
-
var contextualReturnType = getContextualReturnType(func);
|
|
61131
|
+
var contextualReturnType = getContextualReturnType(func, contextFlags);
|
|
61104
61132
|
if (contextualReturnType) {
|
|
61105
61133
|
var functionFlags = ts.getFunctionFlags(func);
|
|
61106
61134
|
if (functionFlags & 1) {
|
|
@@ -61128,11 +61156,11 @@ var ts;
|
|
|
61128
61156
|
}
|
|
61129
61157
|
return undefined;
|
|
61130
61158
|
}
|
|
61131
|
-
function getContextualTypeForYieldOperand(node) {
|
|
61159
|
+
function getContextualTypeForYieldOperand(node, contextFlags) {
|
|
61132
61160
|
var func = ts.getContainingFunction(node);
|
|
61133
61161
|
if (func) {
|
|
61134
61162
|
var functionFlags = ts.getFunctionFlags(func);
|
|
61135
|
-
var contextualReturnType = getContextualReturnType(func);
|
|
61163
|
+
var contextualReturnType = getContextualReturnType(func, contextFlags);
|
|
61136
61164
|
if (contextualReturnType) {
|
|
61137
61165
|
return node.asteriskToken
|
|
61138
61166
|
? contextualReturnType
|
|
@@ -61156,14 +61184,14 @@ var ts;
|
|
|
61156
61184
|
}
|
|
61157
61185
|
function getContextualIterationType(kind, functionDecl) {
|
|
61158
61186
|
var isAsync = !!(ts.getFunctionFlags(functionDecl) & 2);
|
|
61159
|
-
var contextualReturnType = getContextualReturnType(functionDecl);
|
|
61187
|
+
var contextualReturnType = getContextualReturnType(functionDecl, undefined);
|
|
61160
61188
|
if (contextualReturnType) {
|
|
61161
61189
|
return getIterationTypeOfGeneratorFunctionReturnType(kind, contextualReturnType, isAsync)
|
|
61162
61190
|
|| undefined;
|
|
61163
61191
|
}
|
|
61164
61192
|
return undefined;
|
|
61165
61193
|
}
|
|
61166
|
-
function getContextualReturnType(functionDecl) {
|
|
61194
|
+
function getContextualReturnType(functionDecl, contextFlags) {
|
|
61167
61195
|
var returnType = getReturnTypeFromAnnotation(functionDecl);
|
|
61168
61196
|
if (returnType) {
|
|
61169
61197
|
return returnType;
|
|
@@ -61174,7 +61202,7 @@ var ts;
|
|
|
61174
61202
|
}
|
|
61175
61203
|
var iife = ts.getImmediatelyInvokedFunctionExpression(functionDecl);
|
|
61176
61204
|
if (iife) {
|
|
61177
|
-
return getContextualType(iife);
|
|
61205
|
+
return getContextualType(iife, contextFlags);
|
|
61178
61206
|
}
|
|
61179
61207
|
return undefined;
|
|
61180
61208
|
}
|
|
@@ -61404,7 +61432,7 @@ var ts;
|
|
|
61404
61432
|
}
|
|
61405
61433
|
function getContextualTypeForObjectLiteralElement(element, contextFlags) {
|
|
61406
61434
|
var objectLiteral = element.parent;
|
|
61407
|
-
var propertyAssignmentType = ts.isPropertyAssignment(element) && getContextualTypeForVariableLikeDeclaration(element);
|
|
61435
|
+
var propertyAssignmentType = ts.isPropertyAssignment(element) && getContextualTypeForVariableLikeDeclaration(element, contextFlags);
|
|
61408
61436
|
if (propertyAssignmentType) {
|
|
61409
61437
|
return propertyAssignmentType;
|
|
61410
61438
|
}
|
|
@@ -61549,9 +61577,9 @@ var ts;
|
|
|
61549
61577
|
return getContextualTypeForInitializerExpression(node, contextFlags);
|
|
61550
61578
|
case 214:
|
|
61551
61579
|
case 247:
|
|
61552
|
-
return getContextualTypeForReturnExpression(node);
|
|
61580
|
+
return getContextualTypeForReturnExpression(node, contextFlags);
|
|
61553
61581
|
case 224:
|
|
61554
|
-
return getContextualTypeForYieldOperand(parent);
|
|
61582
|
+
return getContextualTypeForYieldOperand(parent, contextFlags);
|
|
61555
61583
|
case 218:
|
|
61556
61584
|
return getContextualTypeForAwaitOperand(parent, contextFlags);
|
|
61557
61585
|
case 208:
|
|
@@ -61598,7 +61626,7 @@ var ts;
|
|
|
61598
61626
|
}
|
|
61599
61627
|
return undefined;
|
|
61600
61628
|
function tryFindWhenConstTypeReference(node) {
|
|
61601
|
-
return getContextualType(node);
|
|
61629
|
+
return getContextualType(node, contextFlags);
|
|
61602
61630
|
}
|
|
61603
61631
|
}
|
|
61604
61632
|
function getInferenceContext(node) {
|
|
@@ -61867,7 +61895,7 @@ var ts;
|
|
|
61867
61895
|
var elementCount = elements.length;
|
|
61868
61896
|
var elementTypes = [];
|
|
61869
61897
|
var elementFlags = [];
|
|
61870
|
-
var contextualType = getApparentTypeOfContextualType(node);
|
|
61898
|
+
var contextualType = getApparentTypeOfContextualType(node, undefined);
|
|
61871
61899
|
var inDestructuringPattern = ts.isAssignmentTarget(node);
|
|
61872
61900
|
var inConstContext = isConstContext(node);
|
|
61873
61901
|
var hasOmittedExpression = false;
|
|
@@ -62016,7 +62044,7 @@ var ts;
|
|
|
62016
62044
|
var propertiesTable = ts.createSymbolTable();
|
|
62017
62045
|
var propertiesArray = [];
|
|
62018
62046
|
var spread = emptyObjectType;
|
|
62019
|
-
var contextualType = getApparentTypeOfContextualType(node);
|
|
62047
|
+
var contextualType = getApparentTypeOfContextualType(node, undefined);
|
|
62020
62048
|
var contextualTypeHasPattern = contextualType && contextualType.pattern &&
|
|
62021
62049
|
(contextualType.pattern.kind === 201 || contextualType.pattern.kind === 205);
|
|
62022
62050
|
var inConstContext = isConstContext(node);
|
|
@@ -62314,7 +62342,7 @@ var ts;
|
|
|
62314
62342
|
if (explicitlySpecifyChildrenAttribute) {
|
|
62315
62343
|
error(attributes, ts.Diagnostics._0_are_specified_twice_The_attribute_named_0_will_be_overwritten, ts.unescapeLeadingUnderscores(jsxChildrenPropertyName));
|
|
62316
62344
|
}
|
|
62317
|
-
var contextualType = getApparentTypeOfContextualType(openingLikeElement.attributes);
|
|
62345
|
+
var contextualType = getApparentTypeOfContextualType(openingLikeElement.attributes, undefined);
|
|
62318
62346
|
var childrenContextualType = contextualType && getTypeOfPropertyOfContextualType(contextualType, jsxChildrenPropertyName);
|
|
62319
62347
|
var childrenPropSymbol = createSymbol(4, jsxChildrenPropertyName);
|
|
62320
62348
|
childrenPropSymbol.type = childrenTypes.length === 1 ? childrenTypes[0] :
|
|
@@ -65602,13 +65630,6 @@ var ts;
|
|
|
65602
65630
|
}
|
|
65603
65631
|
}
|
|
65604
65632
|
}
|
|
65605
|
-
var restType = getEffectiveRestType(context);
|
|
65606
|
-
if (restType && restType.flags & 262144) {
|
|
65607
|
-
var instantiatedContext = instantiateSignature(context, inferenceContext.nonFixingMapper);
|
|
65608
|
-
assignContextualParameterTypes(signature, instantiatedContext);
|
|
65609
|
-
var restPos = getParameterCount(context) - 1;
|
|
65610
|
-
inferTypes(inferenceContext.inferences, getRestTypeAtPosition(signature, restPos), restType);
|
|
65611
|
-
}
|
|
65612
65633
|
}
|
|
65613
65634
|
function assignContextualParameterTypes(signature, context) {
|
|
65614
65635
|
if (context.typeParameters) {
|
|
@@ -65781,7 +65802,7 @@ var ts;
|
|
|
65781
65802
|
var contextualSignature = getContextualSignatureForFunctionLikeDeclaration(func);
|
|
65782
65803
|
var contextualType = !contextualSignature ? undefined :
|
|
65783
65804
|
contextualSignature === getSignatureFromDeclaration(func) ? isGenerator ? undefined : returnType :
|
|
65784
|
-
instantiateContextualType(getReturnTypeOfSignature(contextualSignature), func);
|
|
65805
|
+
instantiateContextualType(getReturnTypeOfSignature(contextualSignature), func, undefined);
|
|
65785
65806
|
if (isGenerator) {
|
|
65786
65807
|
yieldType = getWidenedLiteralLikeTypeForContextualIterationTypeIfNeeded(yieldType, contextualType, 0, isAsync);
|
|
65787
65808
|
returnType = getWidenedLiteralLikeTypeForContextualIterationTypeIfNeeded(returnType, contextualType, 1, isAsync);
|
|
@@ -65844,7 +65865,7 @@ var ts;
|
|
|
65844
65865
|
nextType = iterationTypes && iterationTypes.nextType;
|
|
65845
65866
|
}
|
|
65846
65867
|
else {
|
|
65847
|
-
nextType = getContextualType(yieldExpression);
|
|
65868
|
+
nextType = getContextualType(yieldExpression, undefined);
|
|
65848
65869
|
}
|
|
65849
65870
|
if (nextType)
|
|
65850
65871
|
ts.pushIfUnique(nextTypes, nextType);
|
|
@@ -66017,11 +66038,16 @@ var ts;
|
|
|
66017
66038
|
if (isContextSensitive(node)) {
|
|
66018
66039
|
if (contextualSignature) {
|
|
66019
66040
|
var inferenceContext = getInferenceContext(node);
|
|
66041
|
+
var instantiatedContextualSignature = void 0;
|
|
66020
66042
|
if (checkMode && checkMode & 2) {
|
|
66021
66043
|
inferFromAnnotatedParameters(signature, contextualSignature, inferenceContext);
|
|
66044
|
+
var restType = getEffectiveRestType(contextualSignature);
|
|
66045
|
+
if (restType && restType.flags & 262144) {
|
|
66046
|
+
instantiatedContextualSignature = instantiateSignature(contextualSignature, inferenceContext.nonFixingMapper);
|
|
66047
|
+
}
|
|
66022
66048
|
}
|
|
66023
|
-
|
|
66024
|
-
instantiateSignature(contextualSignature, inferenceContext.mapper) : contextualSignature;
|
|
66049
|
+
instantiatedContextualSignature || (instantiatedContextualSignature = inferenceContext ?
|
|
66050
|
+
instantiateSignature(contextualSignature, inferenceContext.mapper) : contextualSignature);
|
|
66025
66051
|
assignContextualParameterTypes(signature, instantiatedContextualSignature);
|
|
66026
66052
|
}
|
|
66027
66053
|
else {
|
|
@@ -67136,7 +67162,7 @@ var ts;
|
|
|
67136
67162
|
type = anyType;
|
|
67137
67163
|
addLazyDiagnostic(function () {
|
|
67138
67164
|
if (noImplicitAny && !ts.expressionResultIsUnused(node)) {
|
|
67139
|
-
var contextualType = getContextualType(node);
|
|
67165
|
+
var contextualType = getContextualType(node, undefined);
|
|
67140
67166
|
if (!contextualType || isTypeAny(contextualType)) {
|
|
67141
67167
|
error(node, ts.Diagnostics.yield_expression_implicitly_results_in_an_any_type_because_its_containing_generator_lacks_a_return_type_annotation);
|
|
67142
67168
|
}
|
|
@@ -67177,7 +67203,7 @@ var ts;
|
|
|
67177
67203
|
texts.push(span.literal.text);
|
|
67178
67204
|
types.push(isTypeAssignableTo(type, templateConstraintType) ? type : stringType);
|
|
67179
67205
|
}
|
|
67180
|
-
return isConstContext(node) || isTemplateLiteralContext(node) || someType(getContextualType(node) || unknownType, isTemplateLiteralContextualType) ? getTemplateLiteralType(texts, types) : stringType;
|
|
67206
|
+
return isConstContext(node) || isTemplateLiteralContext(node) || someType(getContextualType(node, undefined) || unknownType, isTemplateLiteralContextualType) ? getTemplateLiteralType(texts, types) : stringType;
|
|
67181
67207
|
}
|
|
67182
67208
|
function isTemplateLiteralContextualType(type) {
|
|
67183
67209
|
return !!(type.flags & (128 | 134217728) ||
|
|
@@ -67200,7 +67226,7 @@ var ts;
|
|
|
67200
67226
|
if (inferenceContext && inferenceContext.intraExpressionInferenceSites) {
|
|
67201
67227
|
inferenceContext.intraExpressionInferenceSites = undefined;
|
|
67202
67228
|
}
|
|
67203
|
-
var result = maybeTypeOfKind(type, 2944) && isLiteralOfContextualType(type, instantiateContextualType(contextualType, node)) ?
|
|
67229
|
+
var result = maybeTypeOfKind(type, 2944) && isLiteralOfContextualType(type, instantiateContextualType(contextualType, node, undefined)) ?
|
|
67204
67230
|
getRegularTypeOfLiteralType(type) : type;
|
|
67205
67231
|
return result;
|
|
67206
67232
|
}
|
|
@@ -67304,7 +67330,7 @@ var ts;
|
|
|
67304
67330
|
var type = checkExpression(node, checkMode, forceTuple);
|
|
67305
67331
|
return isConstContext(node) || ts.isCommonJsExportedExpression(node) ? getRegularTypeOfLiteralType(type) :
|
|
67306
67332
|
isTypeAssertion(node) ? type :
|
|
67307
|
-
getWidenedLiteralLikeTypeForContextualType(type, instantiateContextualType(arguments.length === 2 ? getContextualType(node) : contextualType, node));
|
|
67333
|
+
getWidenedLiteralLikeTypeForContextualType(type, instantiateContextualType(arguments.length === 2 ? getContextualType(node, undefined) : contextualType, node, undefined));
|
|
67308
67334
|
}
|
|
67309
67335
|
function checkPropertyAssignment(node, checkMode) {
|
|
67310
67336
|
if (node.name.kind === 162) {
|