typescript 4.8.0-dev.20220704 → 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/lib.es2022.error.d.ts +2 -2
- package/lib/tsc.js +182 -122
- package/lib/tsserver.js +224 -152
- package/lib/tsserverlibrary.d.ts +9 -1
- package/lib/tsserverlibrary.js +224 -152
- package/lib/typescript.d.ts +9 -1
- package/lib/typescript.js +224 -152
- package/lib/typescriptServices.d.ts +9 -1
- package/lib/typescriptServices.js +224 -152
- package/lib/typingsInstaller.js +195 -136
- 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,
|
|
@@ -40239,6 +40259,7 @@ var ts;
|
|
|
40239
40259
|
var stringMappingTypes = new ts.Map();
|
|
40240
40260
|
var substitutionTypes = new ts.Map();
|
|
40241
40261
|
var subtypeReductionCache = new ts.Map();
|
|
40262
|
+
var cachedTypes = new ts.Map();
|
|
40242
40263
|
var evolvingArrayTypes = [];
|
|
40243
40264
|
var undefinedProperties = new ts.Map();
|
|
40244
40265
|
var markerTypes = new ts.Set();
|
|
@@ -40477,6 +40498,14 @@ var ts;
|
|
|
40477
40498
|
];
|
|
40478
40499
|
initializeTypeChecker();
|
|
40479
40500
|
return checker;
|
|
40501
|
+
function getCachedType(key) {
|
|
40502
|
+
return key ? cachedTypes.get(key) : undefined;
|
|
40503
|
+
}
|
|
40504
|
+
function setCachedType(key, type) {
|
|
40505
|
+
if (key)
|
|
40506
|
+
cachedTypes.set(key, type);
|
|
40507
|
+
return type;
|
|
40508
|
+
}
|
|
40480
40509
|
function getJsxNamespace(location) {
|
|
40481
40510
|
if (location) {
|
|
40482
40511
|
var file = ts.getSourceFileOfNode(location);
|
|
@@ -43285,13 +43314,25 @@ var ts;
|
|
|
43285
43314
|
&& isDeclarationVisible(declaration.parent)) {
|
|
43286
43315
|
return addVisibleAlias(declaration, declaration);
|
|
43287
43316
|
}
|
|
43288
|
-
else if (
|
|
43289
|
-
&& ts.
|
|
43290
|
-
|
|
43291
|
-
|
|
43292
|
-
|
|
43293
|
-
|
|
43294
|
-
|
|
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
|
+
}
|
|
43295
43336
|
}
|
|
43296
43337
|
return false;
|
|
43297
43338
|
}
|
|
@@ -43411,7 +43452,7 @@ var ts;
|
|
|
43411
43452
|
}
|
|
43412
43453
|
function toNodeBuilderFlags(flags) {
|
|
43413
43454
|
if (flags === void 0) { flags = 0; }
|
|
43414
|
-
return flags &
|
|
43455
|
+
return flags & 848330091;
|
|
43415
43456
|
}
|
|
43416
43457
|
function isClassInstanceSide(type) {
|
|
43417
43458
|
return !!type.symbol && !!(type.symbol.flags & 32) && (type === getDeclaredTypeOfClassOrInterface(type.symbol) || (!!(type.flags & 524288) && !!(ts.getObjectFlags(type) & 16777216)));
|
|
@@ -43782,6 +43823,10 @@ var ts;
|
|
|
43782
43823
|
}
|
|
43783
43824
|
return typeToTypeNodeHelper(type, context);
|
|
43784
43825
|
}
|
|
43826
|
+
function isHomomorphicMappedTypeWithNonHomomorphicInstantiation(type) {
|
|
43827
|
+
return isMappedTypeWithKeyofConstraintDeclaration(type)
|
|
43828
|
+
&& !(getModifiersTypeFromMappedType(type).flags & 262144);
|
|
43829
|
+
}
|
|
43785
43830
|
function createMappedTypeNodeFromType(type) {
|
|
43786
43831
|
ts.Debug.assert(!!(type.flags & 524288));
|
|
43787
43832
|
var readonlyToken = type.declaration.readonlyToken ? ts.factory.createToken(type.declaration.readonlyToken.kind) : undefined;
|
|
@@ -43789,7 +43834,7 @@ var ts;
|
|
|
43789
43834
|
var appropriateConstraintTypeNode;
|
|
43790
43835
|
var newTypeVariable;
|
|
43791
43836
|
if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
|
|
43792
|
-
if (
|
|
43837
|
+
if (isHomomorphicMappedTypeWithNonHomomorphicInstantiation(type) && context.flags & 4) {
|
|
43793
43838
|
var newParam = createTypeParameter(createSymbol(262144, "T"));
|
|
43794
43839
|
var name = typeParameterToName(newParam, context);
|
|
43795
43840
|
newTypeVariable = ts.factory.createTypeReferenceNode(name);
|
|
@@ -43805,8 +43850,9 @@ var ts;
|
|
|
43805
43850
|
var mappedTypeNode = ts.factory.createMappedTypeNode(readonlyToken, typeParameterNode, nameTypeNode, questionToken, templateTypeNode, undefined);
|
|
43806
43851
|
context.approximateLength += 10;
|
|
43807
43852
|
var result = ts.setEmitFlags(mappedTypeNode, 1);
|
|
43808
|
-
if (
|
|
43809
|
-
|
|
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));
|
|
43810
43856
|
}
|
|
43811
43857
|
return result;
|
|
43812
43858
|
}
|
|
@@ -44324,7 +44370,7 @@ var ts;
|
|
|
44324
44370
|
}
|
|
44325
44371
|
var expandedParams = getExpandedParameters(signature, true)[0];
|
|
44326
44372
|
var parameters = (ts.some(expandedParams, function (p) { return p !== expandedParams[expandedParams.length - 1] && !!(ts.getCheckFlags(p) & 32768); }) ? signature.parameters : expandedParams).map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 171, options === null || options === void 0 ? void 0 : options.privateSymbolVisitor, options === null || options === void 0 ? void 0 : options.bundledImports); });
|
|
44327
|
-
var thisParameter = tryGetThisParameterDeclaration(signature, context);
|
|
44373
|
+
var thisParameter = context.flags & 33554432 ? undefined : tryGetThisParameterDeclaration(signature, context);
|
|
44328
44374
|
if (thisParameter) {
|
|
44329
44375
|
parameters.unshift(thisParameter);
|
|
44330
44376
|
}
|
|
@@ -45277,12 +45323,11 @@ var ts;
|
|
|
45277
45323
|
if (skipMembershipCheck || (!!ts.length(symbol.declarations) && ts.some(symbol.declarations, function (d) { return !!ts.findAncestor(d, function (n) { return n === enclosingDeclaration; }); }))) {
|
|
45278
45324
|
var oldContext = context;
|
|
45279
45325
|
context = cloneNodeBuilderContext(context);
|
|
45280
|
-
|
|
45326
|
+
serializeSymbolWorker(symbol, isPrivate, propertyAsAlias);
|
|
45281
45327
|
if (context.reportedDiagnostic) {
|
|
45282
45328
|
oldcontext.reportedDiagnostic = context.reportedDiagnostic;
|
|
45283
45329
|
}
|
|
45284
45330
|
context = oldContext;
|
|
45285
|
-
return result;
|
|
45286
45331
|
}
|
|
45287
45332
|
}
|
|
45288
45333
|
function serializeSymbolWorker(symbol, isPrivate, propertyAsAlias) {
|
|
@@ -47867,7 +47912,7 @@ var ts;
|
|
|
47867
47912
|
error(declaration.typeExpression.type, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
|
|
47868
47913
|
}
|
|
47869
47914
|
else {
|
|
47870
|
-
error(ts.isNamedDeclaration(declaration) ? declaration.name
|
|
47915
|
+
error(ts.isNamedDeclaration(declaration) ? declaration.name || declaration : declaration, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
|
|
47871
47916
|
}
|
|
47872
47917
|
}
|
|
47873
47918
|
links.declaredType = type;
|
|
@@ -55149,13 +55194,20 @@ var ts;
|
|
|
55149
55194
|
return result;
|
|
55150
55195
|
}
|
|
55151
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) {
|
|
55152
55205
|
if (intersectionState & 4) {
|
|
55153
55206
|
return propertiesRelatedTo(source, target, reportErrors, undefined, 0);
|
|
55154
55207
|
}
|
|
55155
55208
|
var result;
|
|
55156
55209
|
var originalErrorInfo;
|
|
55157
55210
|
var varianceCheckFailed = false;
|
|
55158
|
-
var saveErrorInfo = captureErrorCalculationState();
|
|
55159
55211
|
var sourceFlags = source.flags;
|
|
55160
55212
|
var targetFlags = target.flags;
|
|
55161
55213
|
if (relation === identityRelation) {
|
|
@@ -55204,7 +55256,6 @@ var ts;
|
|
|
55204
55256
|
var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 ? source.types : [source], !!(target.flags & 1048576));
|
|
55205
55257
|
if (constraint && everyType(constraint, function (c) { return c !== source; })) {
|
|
55206
55258
|
if (result = isRelatedTo(constraint, target, 1, false, undefined, intersectionState)) {
|
|
55207
|
-
resetErrorInfo(saveErrorInfo);
|
|
55208
55259
|
return result;
|
|
55209
55260
|
}
|
|
55210
55261
|
}
|
|
@@ -55297,7 +55348,6 @@ var ts;
|
|
|
55297
55348
|
result &= isRelatedTo(source.indexType, target.indexType, 3, reportErrors);
|
|
55298
55349
|
}
|
|
55299
55350
|
if (result) {
|
|
55300
|
-
resetErrorInfo(saveErrorInfo);
|
|
55301
55351
|
return result;
|
|
55302
55352
|
}
|
|
55303
55353
|
if (reportErrors) {
|
|
@@ -55373,7 +55423,6 @@ var ts;
|
|
|
55373
55423
|
}
|
|
55374
55424
|
else if (targetFlags & 16777216) {
|
|
55375
55425
|
if (isDeeplyNestedType(target, targetStack, targetDepth, 10)) {
|
|
55376
|
-
resetErrorInfo(saveErrorInfo);
|
|
55377
55426
|
return 3;
|
|
55378
55427
|
}
|
|
55379
55428
|
var c = target;
|
|
@@ -55383,7 +55432,6 @@ var ts;
|
|
|
55383
55432
|
if (result = skipTrue ? -1 : isRelatedTo(source, getTrueTypeFromConditionalType(c), 2, false)) {
|
|
55384
55433
|
result &= skipFalse ? -1 : isRelatedTo(source, getFalseTypeFromConditionalType(c), 2, false);
|
|
55385
55434
|
if (result) {
|
|
55386
|
-
resetErrorInfo(saveErrorInfo);
|
|
55387
55435
|
return result;
|
|
55388
55436
|
}
|
|
55389
55437
|
}
|
|
@@ -55411,18 +55459,15 @@ var ts;
|
|
|
55411
55459
|
if (!(sourceFlags & 8388608 && targetFlags & 8388608)) {
|
|
55412
55460
|
var constraint = getConstraintOfType(source) || unknownType;
|
|
55413
55461
|
if (result = isRelatedTo(constraint, target, 1, false, undefined, intersectionState)) {
|
|
55414
|
-
resetErrorInfo(saveErrorInfo);
|
|
55415
55462
|
return result;
|
|
55416
55463
|
}
|
|
55417
55464
|
else if (result = isRelatedTo(getTypeWithThisArgument(constraint, source), target, 1, reportErrors && constraint !== unknownType && !(targetFlags & sourceFlags & 262144), undefined, intersectionState)) {
|
|
55418
|
-
resetErrorInfo(saveErrorInfo);
|
|
55419
55465
|
return result;
|
|
55420
55466
|
}
|
|
55421
55467
|
if (isMappedTypeGenericIndexedAccess(source)) {
|
|
55422
55468
|
var indexConstraint = getConstraintOfType(source.indexType);
|
|
55423
55469
|
if (indexConstraint) {
|
|
55424
55470
|
if (result = isRelatedTo(getIndexedAccessType(source.objectType, indexConstraint), target, 1, reportErrors)) {
|
|
55425
|
-
resetErrorInfo(saveErrorInfo);
|
|
55426
55471
|
return result;
|
|
55427
55472
|
}
|
|
55428
55473
|
}
|
|
@@ -55431,7 +55476,6 @@ var ts;
|
|
|
55431
55476
|
}
|
|
55432
55477
|
else if (sourceFlags & 4194304) {
|
|
55433
55478
|
if (result = isRelatedTo(keyofConstraintType, target, 1, reportErrors)) {
|
|
55434
|
-
resetErrorInfo(saveErrorInfo);
|
|
55435
55479
|
return result;
|
|
55436
55480
|
}
|
|
55437
55481
|
}
|
|
@@ -55439,7 +55483,6 @@ var ts;
|
|
|
55439
55483
|
if (!(targetFlags & 134217728)) {
|
|
55440
55484
|
var constraint = getBaseConstraintOfType(source);
|
|
55441
55485
|
if (constraint && constraint !== source && (result = isRelatedTo(constraint, target, 1, reportErrors))) {
|
|
55442
|
-
resetErrorInfo(saveErrorInfo);
|
|
55443
55486
|
return result;
|
|
55444
55487
|
}
|
|
55445
55488
|
}
|
|
@@ -55450,21 +55493,18 @@ var ts;
|
|
|
55450
55493
|
return 0;
|
|
55451
55494
|
}
|
|
55452
55495
|
if (result = isRelatedTo(source.type, target.type, 3, reportErrors)) {
|
|
55453
|
-
resetErrorInfo(saveErrorInfo);
|
|
55454
55496
|
return result;
|
|
55455
55497
|
}
|
|
55456
55498
|
}
|
|
55457
55499
|
else {
|
|
55458
55500
|
var constraint = getBaseConstraintOfType(source);
|
|
55459
55501
|
if (constraint && (result = isRelatedTo(constraint, target, 1, reportErrors))) {
|
|
55460
|
-
resetErrorInfo(saveErrorInfo);
|
|
55461
55502
|
return result;
|
|
55462
55503
|
}
|
|
55463
55504
|
}
|
|
55464
55505
|
}
|
|
55465
55506
|
else if (sourceFlags & 16777216) {
|
|
55466
55507
|
if (isDeeplyNestedType(source, sourceStack, sourceDepth, 10)) {
|
|
55467
|
-
resetErrorInfo(saveErrorInfo);
|
|
55468
55508
|
return 3;
|
|
55469
55509
|
}
|
|
55470
55510
|
if (targetFlags & 16777216) {
|
|
@@ -55483,7 +55523,6 @@ var ts;
|
|
|
55483
55523
|
result &= isRelatedTo(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target), 3, reportErrors);
|
|
55484
55524
|
}
|
|
55485
55525
|
if (result) {
|
|
55486
|
-
resetErrorInfo(saveErrorInfo);
|
|
55487
55526
|
return result;
|
|
55488
55527
|
}
|
|
55489
55528
|
}
|
|
@@ -55492,7 +55531,6 @@ var ts;
|
|
|
55492
55531
|
var distributiveConstraint = hasNonCircularBaseConstraint(source) ? getConstraintOfDistributiveConditionalType(source) : undefined;
|
|
55493
55532
|
if (distributiveConstraint) {
|
|
55494
55533
|
if (result = isRelatedTo(distributiveConstraint, target, 1, reportErrors)) {
|
|
55495
|
-
resetErrorInfo(saveErrorInfo);
|
|
55496
55534
|
return result;
|
|
55497
55535
|
}
|
|
55498
55536
|
}
|
|
@@ -55500,7 +55538,6 @@ var ts;
|
|
|
55500
55538
|
var defaultConstraint = getDefaultConstraintOfConditionalType(source);
|
|
55501
55539
|
if (defaultConstraint) {
|
|
55502
55540
|
if (result = isRelatedTo(defaultConstraint, target, 1, reportErrors)) {
|
|
55503
|
-
resetErrorInfo(saveErrorInfo);
|
|
55504
55541
|
return result;
|
|
55505
55542
|
}
|
|
55506
55543
|
}
|
|
@@ -55512,7 +55549,6 @@ var ts;
|
|
|
55512
55549
|
if (isGenericMappedType(target)) {
|
|
55513
55550
|
if (isGenericMappedType(source)) {
|
|
55514
55551
|
if (result = mappedTypeRelatedTo(source, target, reportErrors)) {
|
|
55515
|
-
resetErrorInfo(saveErrorInfo);
|
|
55516
55552
|
return result;
|
|
55517
55553
|
}
|
|
55518
55554
|
}
|
|
@@ -56759,9 +56795,14 @@ var ts;
|
|
|
56759
56795
|
type.flags & 256 ? numberType :
|
|
56760
56796
|
type.flags & 2048 ? bigintType :
|
|
56761
56797
|
type.flags & 512 ? booleanType :
|
|
56762
|
-
type.flags & 1048576 ?
|
|
56798
|
+
type.flags & 1048576 ? getBaseTypeOfLiteralTypeUnion(type) :
|
|
56763
56799
|
type;
|
|
56764
56800
|
}
|
|
56801
|
+
function getBaseTypeOfLiteralTypeUnion(type) {
|
|
56802
|
+
var _a;
|
|
56803
|
+
var key = "B" + getTypeId(type);
|
|
56804
|
+
return (_a = getCachedType(key)) !== null && _a !== void 0 ? _a : setCachedType(key, mapType(type, getBaseTypeOfLiteralType));
|
|
56805
|
+
}
|
|
56765
56806
|
function getWidenedLiteralType(type) {
|
|
56766
56807
|
return type.flags & 1024 && isFreshLiteralType(type) ? getBaseTypeOfEnumLiteralType(type) :
|
|
56767
56808
|
type.flags & 128 && isFreshLiteralType(type) ? stringType :
|
|
@@ -58611,19 +58652,20 @@ var ts;
|
|
|
58611
58652
|
return false;
|
|
58612
58653
|
}
|
|
58613
58654
|
function getAssignmentReducedType(declaredType, assignedType) {
|
|
58614
|
-
|
|
58615
|
-
|
|
58616
|
-
|
|
58617
|
-
}
|
|
58618
|
-
var reducedType = filterType(declaredType, function (t) { return typeMaybeAssignableTo(assignedType, t); });
|
|
58619
|
-
if (assignedType.flags & 512 && isFreshLiteralType(assignedType)) {
|
|
58620
|
-
reducedType = mapType(reducedType, getFreshTypeOfLiteralType);
|
|
58621
|
-
}
|
|
58622
|
-
if (isTypeAssignableTo(assignedType, reducedType)) {
|
|
58623
|
-
return reducedType;
|
|
58624
|
-
}
|
|
58655
|
+
var _a;
|
|
58656
|
+
if (declaredType === assignedType) {
|
|
58657
|
+
return declaredType;
|
|
58625
58658
|
}
|
|
58626
|
-
|
|
58659
|
+
if (assignedType.flags & 131072) {
|
|
58660
|
+
return assignedType;
|
|
58661
|
+
}
|
|
58662
|
+
var key = "A" + getTypeId(declaredType) + "," + getTypeId(assignedType);
|
|
58663
|
+
return (_a = getCachedType(key)) !== null && _a !== void 0 ? _a : setCachedType(key, getAssignmentReducedTypeWorker(declaredType, assignedType));
|
|
58664
|
+
}
|
|
58665
|
+
function getAssignmentReducedTypeWorker(declaredType, assignedType) {
|
|
58666
|
+
var filteredType = filterType(declaredType, function (t) { return typeMaybeAssignableTo(assignedType, t); });
|
|
58667
|
+
var reducedType = assignedType.flags & 512 && isFreshLiteralType(assignedType) ? mapType(filteredType, getFreshTypeOfLiteralType) : filteredType;
|
|
58668
|
+
return isTypeAssignableTo(assignedType, reducedType) ? reducedType : declaredType;
|
|
58627
58669
|
}
|
|
58628
58670
|
function isFunctionObjectType(type) {
|
|
58629
58671
|
var resolved = resolveStructuredTypeMembers(type);
|
|
@@ -59892,7 +59934,7 @@ var ts;
|
|
|
59892
59934
|
var targetType = ts.hasStaticModifier(ts.Debug.checkDefined(symbol.valueDeclaration, "should always have a declaration"))
|
|
59893
59935
|
? getTypeOfSymbol(classSymbol)
|
|
59894
59936
|
: getDeclaredTypeOfSymbol(classSymbol);
|
|
59895
|
-
return getNarrowedType(type, targetType, assumeTrue,
|
|
59937
|
+
return getNarrowedType(type, targetType, assumeTrue, true);
|
|
59896
59938
|
}
|
|
59897
59939
|
function narrowTypeByOptionalChainContainment(type, operator, value, assumeTrue) {
|
|
59898
59940
|
var equalsOperator = operator === 34 || operator === 36;
|
|
@@ -60101,9 +60143,15 @@ var ts;
|
|
|
60101
60143
|
if (!nonConstructorTypeInUnion)
|
|
60102
60144
|
return type;
|
|
60103
60145
|
}
|
|
60104
|
-
return getNarrowedType(type, targetType, assumeTrue,
|
|
60146
|
+
return getNarrowedType(type, targetType, assumeTrue, true);
|
|
60147
|
+
}
|
|
60148
|
+
function getNarrowedType(type, candidate, assumeTrue, checkDerived) {
|
|
60149
|
+
var _a;
|
|
60150
|
+
var key = type.flags & 1048576 ? "N" + getTypeId(type) + "," + getTypeId(candidate) + "," + ((assumeTrue ? 1 : 0) | (checkDerived ? 2 : 0)) : undefined;
|
|
60151
|
+
return (_a = getCachedType(key)) !== null && _a !== void 0 ? _a : setCachedType(key, getNarrowedTypeWorker(type, candidate, assumeTrue, checkDerived));
|
|
60105
60152
|
}
|
|
60106
|
-
function
|
|
60153
|
+
function getNarrowedTypeWorker(type, candidate, assumeTrue, checkDerived) {
|
|
60154
|
+
var isRelated = checkDerived ? isTypeDerivedFrom : isTypeSubtypeOf;
|
|
60107
60155
|
if (!assumeTrue) {
|
|
60108
60156
|
return filterType(type, function (t) { return !isRelated(t, candidate); });
|
|
60109
60157
|
}
|
|
@@ -60143,7 +60191,7 @@ var ts;
|
|
|
60143
60191
|
var predicateArgument = getTypePredicateArgument(predicate, callExpression);
|
|
60144
60192
|
if (predicateArgument) {
|
|
60145
60193
|
if (isMatchingReference(reference, predicateArgument)) {
|
|
60146
|
-
return getNarrowedType(type, predicate.type, assumeTrue,
|
|
60194
|
+
return getNarrowedType(type, predicate.type, assumeTrue, false);
|
|
60147
60195
|
}
|
|
60148
60196
|
if (strictNullChecks && assumeTrue && optionalChainContainsReference(predicateArgument, reference) &&
|
|
60149
60197
|
!(getTypeFacts(predicate.type) & 65536)) {
|
|
@@ -60151,7 +60199,7 @@ var ts;
|
|
|
60151
60199
|
}
|
|
60152
60200
|
var access = getDiscriminantPropertyAccess(predicateArgument, type);
|
|
60153
60201
|
if (access) {
|
|
60154
|
-
return narrowTypeByDiscriminant(type, access, function (t) { return getNarrowedType(t, predicate.type, assumeTrue,
|
|
60202
|
+
return narrowTypeByDiscriminant(type, access, function (t) { return getNarrowedType(t, predicate.type, assumeTrue, false); });
|
|
60155
60203
|
}
|
|
60156
60204
|
}
|
|
60157
60205
|
}
|
|
@@ -60304,7 +60352,7 @@ var ts;
|
|
|
60304
60352
|
!((ts.isJsxOpeningElement(node.parent) || ts.isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) &&
|
|
60305
60353
|
(checkMode && checkMode & 64 ?
|
|
60306
60354
|
getContextualType(node, 8)
|
|
60307
|
-
: getContextualType(node));
|
|
60355
|
+
: getContextualType(node, undefined));
|
|
60308
60356
|
return contextualType && !isGenericType(contextualType);
|
|
60309
60357
|
}
|
|
60310
60358
|
function getNarrowableTypeForReference(type, reference, checkMode) {
|
|
@@ -60407,7 +60455,7 @@ var ts;
|
|
|
60407
60455
|
getNodeLinks(container).flags |= 8192;
|
|
60408
60456
|
return getTypeOfSymbol(symbol);
|
|
60409
60457
|
}
|
|
60410
|
-
if (
|
|
60458
|
+
if (shouldMarkIdentifierAliasReferenced(node)) {
|
|
60411
60459
|
markAliasReferenced(symbol, node);
|
|
60412
60460
|
}
|
|
60413
60461
|
var localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol);
|
|
@@ -60520,6 +60568,23 @@ var ts;
|
|
|
60520
60568
|
}
|
|
60521
60569
|
return assignmentKind ? getBaseTypeOfLiteralType(flowType) : flowType;
|
|
60522
60570
|
}
|
|
60571
|
+
function shouldMarkIdentifierAliasReferenced(node) {
|
|
60572
|
+
var _a;
|
|
60573
|
+
var parent = node.parent;
|
|
60574
|
+
if (parent) {
|
|
60575
|
+
if (ts.isPropertyAccessExpression(parent) && parent.expression === node) {
|
|
60576
|
+
return false;
|
|
60577
|
+
}
|
|
60578
|
+
if (ts.isExportSpecifier(parent) && parent.isTypeOnly) {
|
|
60579
|
+
return false;
|
|
60580
|
+
}
|
|
60581
|
+
var greatGrandparent = (_a = parent.parent) === null || _a === void 0 ? void 0 : _a.parent;
|
|
60582
|
+
if (greatGrandparent && ts.isExportDeclaration(greatGrandparent) && greatGrandparent.isTypeOnly) {
|
|
60583
|
+
return false;
|
|
60584
|
+
}
|
|
60585
|
+
}
|
|
60586
|
+
return true;
|
|
60587
|
+
}
|
|
60523
60588
|
function isInsideFunctionOrInstancePropertyInitializer(node, threshold) {
|
|
60524
60589
|
return !!ts.findAncestor(node, function (n) { return n === threshold ? "quit" : ts.isFunctionLike(n) || (n.parent && ts.isPropertyDeclaration(n.parent) && !ts.hasStaticModifier(n.parent) && n.parent.initializer === n); });
|
|
60525
60590
|
}
|
|
@@ -60944,7 +61009,7 @@ var ts;
|
|
|
60944
61009
|
if (noImplicitThis || inJs) {
|
|
60945
61010
|
var containingLiteral = getContainingObjectLiteral(func);
|
|
60946
61011
|
if (containingLiteral) {
|
|
60947
|
-
var contextualType = getApparentTypeOfContextualType(containingLiteral);
|
|
61012
|
+
var contextualType = getApparentTypeOfContextualType(containingLiteral, undefined);
|
|
60948
61013
|
var literal = containingLiteral;
|
|
60949
61014
|
var type = contextualType;
|
|
60950
61015
|
while (type) {
|
|
@@ -60956,7 +61021,7 @@ var ts;
|
|
|
60956
61021
|
break;
|
|
60957
61022
|
}
|
|
60958
61023
|
literal = literal.parent.parent;
|
|
60959
|
-
type = getApparentTypeOfContextualType(literal);
|
|
61024
|
+
type = getApparentTypeOfContextualType(literal, undefined);
|
|
60960
61025
|
}
|
|
60961
61026
|
return getWidenedType(contextualType ? getNonNullableType(contextualType) : checkExpressionCached(containingLiteral));
|
|
60962
61027
|
}
|
|
@@ -61006,7 +61071,7 @@ var ts;
|
|
|
61006
61071
|
tryGetTypeAtPosition(contextualSignature, index);
|
|
61007
61072
|
}
|
|
61008
61073
|
}
|
|
61009
|
-
function getContextualTypeForVariableLikeDeclaration(declaration) {
|
|
61074
|
+
function getContextualTypeForVariableLikeDeclaration(declaration, contextFlags) {
|
|
61010
61075
|
var typeNode = ts.getEffectiveTypeAnnotationNode(declaration);
|
|
61011
61076
|
if (typeNode) {
|
|
61012
61077
|
return getTypeFromTypeNode(typeNode);
|
|
@@ -61015,17 +61080,17 @@ var ts;
|
|
|
61015
61080
|
case 164:
|
|
61016
61081
|
return getContextuallyTypedParameterType(declaration);
|
|
61017
61082
|
case 203:
|
|
61018
|
-
return getContextualTypeForBindingElement(declaration);
|
|
61083
|
+
return getContextualTypeForBindingElement(declaration, contextFlags);
|
|
61019
61084
|
case 167:
|
|
61020
61085
|
if (ts.isStatic(declaration)) {
|
|
61021
|
-
return getContextualTypeForStaticPropertyDeclaration(declaration);
|
|
61086
|
+
return getContextualTypeForStaticPropertyDeclaration(declaration, contextFlags);
|
|
61022
61087
|
}
|
|
61023
61088
|
}
|
|
61024
61089
|
}
|
|
61025
|
-
function getContextualTypeForBindingElement(declaration) {
|
|
61090
|
+
function getContextualTypeForBindingElement(declaration, contextFlags) {
|
|
61026
61091
|
var parent = declaration.parent.parent;
|
|
61027
61092
|
var name = declaration.propertyName || declaration.name;
|
|
61028
|
-
var parentType = getContextualTypeForVariableLikeDeclaration(parent) ||
|
|
61093
|
+
var parentType = getContextualTypeForVariableLikeDeclaration(parent, contextFlags) ||
|
|
61029
61094
|
parent.kind !== 203 && parent.initializer && checkDeclarationInitializer(parent, declaration.dotDotDotToken ? 64 : 0);
|
|
61030
61095
|
if (!parentType || ts.isBindingPattern(name) || ts.isComputedNonLiteralName(name))
|
|
61031
61096
|
return undefined;
|
|
@@ -61041,8 +61106,8 @@ var ts;
|
|
|
61041
61106
|
return getTypeOfPropertyOfType(parentType, text);
|
|
61042
61107
|
}
|
|
61043
61108
|
}
|
|
61044
|
-
function getContextualTypeForStaticPropertyDeclaration(declaration) {
|
|
61045
|
-
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);
|
|
61046
61111
|
if (!parentType)
|
|
61047
61112
|
return undefined;
|
|
61048
61113
|
return getTypeOfPropertyOfContextualType(parentType, getSymbolOfNode(declaration).escapedName);
|
|
@@ -61050,7 +61115,7 @@ var ts;
|
|
|
61050
61115
|
function getContextualTypeForInitializerExpression(node, contextFlags) {
|
|
61051
61116
|
var declaration = node.parent;
|
|
61052
61117
|
if (ts.hasInitializer(declaration) && node === declaration.initializer) {
|
|
61053
|
-
var result = getContextualTypeForVariableLikeDeclaration(declaration);
|
|
61118
|
+
var result = getContextualTypeForVariableLikeDeclaration(declaration, contextFlags);
|
|
61054
61119
|
if (result) {
|
|
61055
61120
|
return result;
|
|
61056
61121
|
}
|
|
@@ -61060,10 +61125,10 @@ var ts;
|
|
|
61060
61125
|
}
|
|
61061
61126
|
return undefined;
|
|
61062
61127
|
}
|
|
61063
|
-
function getContextualTypeForReturnExpression(node) {
|
|
61128
|
+
function getContextualTypeForReturnExpression(node, contextFlags) {
|
|
61064
61129
|
var func = ts.getContainingFunction(node);
|
|
61065
61130
|
if (func) {
|
|
61066
|
-
var contextualReturnType = getContextualReturnType(func);
|
|
61131
|
+
var contextualReturnType = getContextualReturnType(func, contextFlags);
|
|
61067
61132
|
if (contextualReturnType) {
|
|
61068
61133
|
var functionFlags = ts.getFunctionFlags(func);
|
|
61069
61134
|
if (functionFlags & 1) {
|
|
@@ -61091,11 +61156,11 @@ var ts;
|
|
|
61091
61156
|
}
|
|
61092
61157
|
return undefined;
|
|
61093
61158
|
}
|
|
61094
|
-
function getContextualTypeForYieldOperand(node) {
|
|
61159
|
+
function getContextualTypeForYieldOperand(node, contextFlags) {
|
|
61095
61160
|
var func = ts.getContainingFunction(node);
|
|
61096
61161
|
if (func) {
|
|
61097
61162
|
var functionFlags = ts.getFunctionFlags(func);
|
|
61098
|
-
var contextualReturnType = getContextualReturnType(func);
|
|
61163
|
+
var contextualReturnType = getContextualReturnType(func, contextFlags);
|
|
61099
61164
|
if (contextualReturnType) {
|
|
61100
61165
|
return node.asteriskToken
|
|
61101
61166
|
? contextualReturnType
|
|
@@ -61119,14 +61184,14 @@ var ts;
|
|
|
61119
61184
|
}
|
|
61120
61185
|
function getContextualIterationType(kind, functionDecl) {
|
|
61121
61186
|
var isAsync = !!(ts.getFunctionFlags(functionDecl) & 2);
|
|
61122
|
-
var contextualReturnType = getContextualReturnType(functionDecl);
|
|
61187
|
+
var contextualReturnType = getContextualReturnType(functionDecl, undefined);
|
|
61123
61188
|
if (contextualReturnType) {
|
|
61124
61189
|
return getIterationTypeOfGeneratorFunctionReturnType(kind, contextualReturnType, isAsync)
|
|
61125
61190
|
|| undefined;
|
|
61126
61191
|
}
|
|
61127
61192
|
return undefined;
|
|
61128
61193
|
}
|
|
61129
|
-
function getContextualReturnType(functionDecl) {
|
|
61194
|
+
function getContextualReturnType(functionDecl, contextFlags) {
|
|
61130
61195
|
var returnType = getReturnTypeFromAnnotation(functionDecl);
|
|
61131
61196
|
if (returnType) {
|
|
61132
61197
|
return returnType;
|
|
@@ -61137,7 +61202,7 @@ var ts;
|
|
|
61137
61202
|
}
|
|
61138
61203
|
var iife = ts.getImmediatelyInvokedFunctionExpression(functionDecl);
|
|
61139
61204
|
if (iife) {
|
|
61140
|
-
return getContextualType(iife);
|
|
61205
|
+
return getContextualType(iife, contextFlags);
|
|
61141
61206
|
}
|
|
61142
61207
|
return undefined;
|
|
61143
61208
|
}
|
|
@@ -61367,7 +61432,7 @@ var ts;
|
|
|
61367
61432
|
}
|
|
61368
61433
|
function getContextualTypeForObjectLiteralElement(element, contextFlags) {
|
|
61369
61434
|
var objectLiteral = element.parent;
|
|
61370
|
-
var propertyAssignmentType = ts.isPropertyAssignment(element) && getContextualTypeForVariableLikeDeclaration(element);
|
|
61435
|
+
var propertyAssignmentType = ts.isPropertyAssignment(element) && getContextualTypeForVariableLikeDeclaration(element, contextFlags);
|
|
61371
61436
|
if (propertyAssignmentType) {
|
|
61372
61437
|
return propertyAssignmentType;
|
|
61373
61438
|
}
|
|
@@ -61512,9 +61577,9 @@ var ts;
|
|
|
61512
61577
|
return getContextualTypeForInitializerExpression(node, contextFlags);
|
|
61513
61578
|
case 214:
|
|
61514
61579
|
case 247:
|
|
61515
|
-
return getContextualTypeForReturnExpression(node);
|
|
61580
|
+
return getContextualTypeForReturnExpression(node, contextFlags);
|
|
61516
61581
|
case 224:
|
|
61517
|
-
return getContextualTypeForYieldOperand(parent);
|
|
61582
|
+
return getContextualTypeForYieldOperand(parent, contextFlags);
|
|
61518
61583
|
case 218:
|
|
61519
61584
|
return getContextualTypeForAwaitOperand(parent, contextFlags);
|
|
61520
61585
|
case 208:
|
|
@@ -61561,7 +61626,7 @@ var ts;
|
|
|
61561
61626
|
}
|
|
61562
61627
|
return undefined;
|
|
61563
61628
|
function tryFindWhenConstTypeReference(node) {
|
|
61564
|
-
return getContextualType(node);
|
|
61629
|
+
return getContextualType(node, contextFlags);
|
|
61565
61630
|
}
|
|
61566
61631
|
}
|
|
61567
61632
|
function getInferenceContext(node) {
|
|
@@ -61830,7 +61895,7 @@ var ts;
|
|
|
61830
61895
|
var elementCount = elements.length;
|
|
61831
61896
|
var elementTypes = [];
|
|
61832
61897
|
var elementFlags = [];
|
|
61833
|
-
var contextualType = getApparentTypeOfContextualType(node);
|
|
61898
|
+
var contextualType = getApparentTypeOfContextualType(node, undefined);
|
|
61834
61899
|
var inDestructuringPattern = ts.isAssignmentTarget(node);
|
|
61835
61900
|
var inConstContext = isConstContext(node);
|
|
61836
61901
|
var hasOmittedExpression = false;
|
|
@@ -61979,7 +62044,7 @@ var ts;
|
|
|
61979
62044
|
var propertiesTable = ts.createSymbolTable();
|
|
61980
62045
|
var propertiesArray = [];
|
|
61981
62046
|
var spread = emptyObjectType;
|
|
61982
|
-
var contextualType = getApparentTypeOfContextualType(node);
|
|
62047
|
+
var contextualType = getApparentTypeOfContextualType(node, undefined);
|
|
61983
62048
|
var contextualTypeHasPattern = contextualType && contextualType.pattern &&
|
|
61984
62049
|
(contextualType.pattern.kind === 201 || contextualType.pattern.kind === 205);
|
|
61985
62050
|
var inConstContext = isConstContext(node);
|
|
@@ -62277,7 +62342,7 @@ var ts;
|
|
|
62277
62342
|
if (explicitlySpecifyChildrenAttribute) {
|
|
62278
62343
|
error(attributes, ts.Diagnostics._0_are_specified_twice_The_attribute_named_0_will_be_overwritten, ts.unescapeLeadingUnderscores(jsxChildrenPropertyName));
|
|
62279
62344
|
}
|
|
62280
|
-
var contextualType = getApparentTypeOfContextualType(openingLikeElement.attributes);
|
|
62345
|
+
var contextualType = getApparentTypeOfContextualType(openingLikeElement.attributes, undefined);
|
|
62281
62346
|
var childrenContextualType = contextualType && getTypeOfPropertyOfContextualType(contextualType, jsxChildrenPropertyName);
|
|
62282
62347
|
var childrenPropSymbol = createSymbol(4, jsxChildrenPropertyName);
|
|
62283
62348
|
childrenPropSymbol.type = childrenTypes.length === 1 ? childrenTypes[0] :
|
|
@@ -64336,7 +64401,7 @@ var ts;
|
|
|
64336
64401
|
argCheckMode = checkMode & 32;
|
|
64337
64402
|
if (inferenceContext) {
|
|
64338
64403
|
var typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
|
|
64339
|
-
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, ts.isInJSFile(candidate.declaration), inferenceContext
|
|
64404
|
+
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, ts.isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters);
|
|
64340
64405
|
if (getNonArrayRestType(candidate) && !hasCorrectArity(node, args, checkCandidate, signatureHelpTrailingComma)) {
|
|
64341
64406
|
candidateForArgumentArityError = checkCandidate;
|
|
64342
64407
|
continue;
|
|
@@ -65565,13 +65630,6 @@ var ts;
|
|
|
65565
65630
|
}
|
|
65566
65631
|
}
|
|
65567
65632
|
}
|
|
65568
|
-
var restType = getEffectiveRestType(context);
|
|
65569
|
-
if (restType && restType.flags & 262144) {
|
|
65570
|
-
var instantiatedContext = instantiateSignature(context, inferenceContext.nonFixingMapper);
|
|
65571
|
-
assignContextualParameterTypes(signature, instantiatedContext);
|
|
65572
|
-
var restPos = getParameterCount(context) - 1;
|
|
65573
|
-
inferTypes(inferenceContext.inferences, getRestTypeAtPosition(signature, restPos), restType);
|
|
65574
|
-
}
|
|
65575
65633
|
}
|
|
65576
65634
|
function assignContextualParameterTypes(signature, context) {
|
|
65577
65635
|
if (context.typeParameters) {
|
|
@@ -65744,7 +65802,7 @@ var ts;
|
|
|
65744
65802
|
var contextualSignature = getContextualSignatureForFunctionLikeDeclaration(func);
|
|
65745
65803
|
var contextualType = !contextualSignature ? undefined :
|
|
65746
65804
|
contextualSignature === getSignatureFromDeclaration(func) ? isGenerator ? undefined : returnType :
|
|
65747
|
-
instantiateContextualType(getReturnTypeOfSignature(contextualSignature), func);
|
|
65805
|
+
instantiateContextualType(getReturnTypeOfSignature(contextualSignature), func, undefined);
|
|
65748
65806
|
if (isGenerator) {
|
|
65749
65807
|
yieldType = getWidenedLiteralLikeTypeForContextualIterationTypeIfNeeded(yieldType, contextualType, 0, isAsync);
|
|
65750
65808
|
returnType = getWidenedLiteralLikeTypeForContextualIterationTypeIfNeeded(returnType, contextualType, 1, isAsync);
|
|
@@ -65807,7 +65865,7 @@ var ts;
|
|
|
65807
65865
|
nextType = iterationTypes && iterationTypes.nextType;
|
|
65808
65866
|
}
|
|
65809
65867
|
else {
|
|
65810
|
-
nextType = getContextualType(yieldExpression);
|
|
65868
|
+
nextType = getContextualType(yieldExpression, undefined);
|
|
65811
65869
|
}
|
|
65812
65870
|
if (nextType)
|
|
65813
65871
|
ts.pushIfUnique(nextTypes, nextType);
|
|
@@ -65980,11 +66038,16 @@ var ts;
|
|
|
65980
66038
|
if (isContextSensitive(node)) {
|
|
65981
66039
|
if (contextualSignature) {
|
|
65982
66040
|
var inferenceContext = getInferenceContext(node);
|
|
66041
|
+
var instantiatedContextualSignature = void 0;
|
|
65983
66042
|
if (checkMode && checkMode & 2) {
|
|
65984
66043
|
inferFromAnnotatedParameters(signature, contextualSignature, inferenceContext);
|
|
66044
|
+
var restType = getEffectiveRestType(contextualSignature);
|
|
66045
|
+
if (restType && restType.flags & 262144) {
|
|
66046
|
+
instantiatedContextualSignature = instantiateSignature(contextualSignature, inferenceContext.nonFixingMapper);
|
|
66047
|
+
}
|
|
65985
66048
|
}
|
|
65986
|
-
|
|
65987
|
-
instantiateSignature(contextualSignature, inferenceContext.mapper) : contextualSignature;
|
|
66049
|
+
instantiatedContextualSignature || (instantiatedContextualSignature = inferenceContext ?
|
|
66050
|
+
instantiateSignature(contextualSignature, inferenceContext.mapper) : contextualSignature);
|
|
65988
66051
|
assignContextualParameterTypes(signature, instantiatedContextualSignature);
|
|
65989
66052
|
}
|
|
65990
66053
|
else {
|
|
@@ -67099,7 +67162,7 @@ var ts;
|
|
|
67099
67162
|
type = anyType;
|
|
67100
67163
|
addLazyDiagnostic(function () {
|
|
67101
67164
|
if (noImplicitAny && !ts.expressionResultIsUnused(node)) {
|
|
67102
|
-
var contextualType = getContextualType(node);
|
|
67165
|
+
var contextualType = getContextualType(node, undefined);
|
|
67103
67166
|
if (!contextualType || isTypeAny(contextualType)) {
|
|
67104
67167
|
error(node, ts.Diagnostics.yield_expression_implicitly_results_in_an_any_type_because_its_containing_generator_lacks_a_return_type_annotation);
|
|
67105
67168
|
}
|
|
@@ -67140,7 +67203,7 @@ var ts;
|
|
|
67140
67203
|
texts.push(span.literal.text);
|
|
67141
67204
|
types.push(isTypeAssignableTo(type, templateConstraintType) ? type : stringType);
|
|
67142
67205
|
}
|
|
67143
|
-
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;
|
|
67144
67207
|
}
|
|
67145
67208
|
function isTemplateLiteralContextualType(type) {
|
|
67146
67209
|
return !!(type.flags & (128 | 134217728) ||
|
|
@@ -67163,7 +67226,7 @@ var ts;
|
|
|
67163
67226
|
if (inferenceContext && inferenceContext.intraExpressionInferenceSites) {
|
|
67164
67227
|
inferenceContext.intraExpressionInferenceSites = undefined;
|
|
67165
67228
|
}
|
|
67166
|
-
var result = maybeTypeOfKind(type, 2944) && isLiteralOfContextualType(type, instantiateContextualType(contextualType, node)) ?
|
|
67229
|
+
var result = maybeTypeOfKind(type, 2944) && isLiteralOfContextualType(type, instantiateContextualType(contextualType, node, undefined)) ?
|
|
67167
67230
|
getRegularTypeOfLiteralType(type) : type;
|
|
67168
67231
|
return result;
|
|
67169
67232
|
}
|
|
@@ -67267,7 +67330,7 @@ var ts;
|
|
|
67267
67330
|
var type = checkExpression(node, checkMode, forceTuple);
|
|
67268
67331
|
return isConstContext(node) || ts.isCommonJsExportedExpression(node) ? getRegularTypeOfLiteralType(type) :
|
|
67269
67332
|
isTypeAssertion(node) ? type :
|
|
67270
|
-
getWidenedLiteralLikeTypeForContextualType(type, instantiateContextualType(arguments.length === 2 ? getContextualType(node) : contextualType, node));
|
|
67333
|
+
getWidenedLiteralLikeTypeForContextualType(type, instantiateContextualType(arguments.length === 2 ? getContextualType(node, undefined) : contextualType, node, undefined));
|
|
67271
67334
|
}
|
|
67272
67335
|
function checkPropertyAssignment(node, checkMode) {
|
|
67273
67336
|
if (node.name.kind === 162) {
|
|
@@ -72352,7 +72415,9 @@ var ts;
|
|
|
72352
72415
|
error(exportedName, ts.Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, ts.idText(exportedName));
|
|
72353
72416
|
}
|
|
72354
72417
|
else {
|
|
72355
|
-
|
|
72418
|
+
if (!node.isTypeOnly && !node.parent.parent.isTypeOnly) {
|
|
72419
|
+
markExportAsReferenced(node);
|
|
72420
|
+
}
|
|
72356
72421
|
var target = symbol && (symbol.flags & 2097152 ? resolveAlias(symbol) : symbol);
|
|
72357
72422
|
if (!target || target === unknownSymbol || target.flags & 111551) {
|
|
72358
72423
|
checkExpressionCached(node.propertyName || node.name);
|
|
@@ -75409,9 +75474,6 @@ var ts;
|
|
|
75409
75474
|
else {
|
|
75410
75475
|
return grammarErrorOnNode(initializer, ts.Diagnostics.Initializers_are_not_allowed_in_ambient_contexts);
|
|
75411
75476
|
}
|
|
75412
|
-
if (!isConstOrReadonly || isInvalidInitializer) {
|
|
75413
|
-
return grammarErrorOnNode(initializer, ts.Diagnostics.Initializers_are_not_allowed_in_ambient_contexts);
|
|
75414
|
-
}
|
|
75415
75477
|
}
|
|
75416
75478
|
}
|
|
75417
75479
|
function checkGrammarVariableDeclaration(node) {
|
|
@@ -91571,7 +91633,7 @@ var ts;
|
|
|
91571
91633
|
if (!sourceFileOrBundle || emitOnlyDtsFiles || !jsFilePath) {
|
|
91572
91634
|
return;
|
|
91573
91635
|
}
|
|
91574
|
-
if (
|
|
91636
|
+
if (host.isEmitBlocked(jsFilePath) || compilerOptions.noEmit) {
|
|
91575
91637
|
emitSkipped = true;
|
|
91576
91638
|
return;
|
|
91577
91639
|
}
|
|
@@ -103337,7 +103399,6 @@ var ts;
|
|
|
103337
103399
|
var parsedConfigs;
|
|
103338
103400
|
var sharedExtendedConfigFileWatchers;
|
|
103339
103401
|
var extendedConfigCache = host.extendedConfigCache;
|
|
103340
|
-
var changesAffectResolution = false;
|
|
103341
103402
|
var reportFileChangeDetectedOnCreateProgram = false;
|
|
103342
103403
|
var sourceFilesCache = new ts.Map();
|
|
103343
103404
|
var missingFilePathsRequestedForRelease;
|
|
@@ -103482,11 +103543,11 @@ var ts;
|
|
|
103482
103543
|
var program = getCurrentBuilderProgram();
|
|
103483
103544
|
if (hasChangedCompilerOptions) {
|
|
103484
103545
|
newLine = updateNewLine();
|
|
103485
|
-
if (program &&
|
|
103546
|
+
if (program && ts.changesAffectModuleResolution(program.getCompilerOptions(), compilerOptions)) {
|
|
103486
103547
|
resolutionCache.clear();
|
|
103487
103548
|
}
|
|
103488
103549
|
}
|
|
103489
|
-
var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution
|
|
103550
|
+
var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution);
|
|
103490
103551
|
if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, fileExists, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
|
|
103491
103552
|
if (hasChangedConfigFileParsingErrors) {
|
|
103492
103553
|
if (reportFileChangeDetectedOnCreateProgram) {
|
|
@@ -103502,7 +103563,6 @@ var ts;
|
|
|
103502
103563
|
}
|
|
103503
103564
|
createNewProgram(hasInvalidatedResolution);
|
|
103504
103565
|
}
|
|
103505
|
-
changesAffectResolution = false;
|
|
103506
103566
|
reportFileChangeDetectedOnCreateProgram = false;
|
|
103507
103567
|
if (host.afterProgramCreate && program !== builderProgram) {
|
|
103508
103568
|
host.afterProgramCreate(builderProgram);
|
|
@@ -104780,7 +104840,7 @@ var ts;
|
|
|
104780
104840
|
}
|
|
104781
104841
|
function afterProgramDone(state, program, config) {
|
|
104782
104842
|
if (program) {
|
|
104783
|
-
if (
|
|
104843
|
+
if (state.write)
|
|
104784
104844
|
ts.listFiles(program, state.write);
|
|
104785
104845
|
if (state.host.afterProgramEmitAndDiagnostics) {
|
|
104786
104846
|
state.host.afterProgramEmitAndDiagnostics(program);
|