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
|
@@ -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.20220707";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -2979,6 +2979,22 @@ var ts;
|
|
|
2979
2979
|
return formatEnum(flags, ts.FlowFlags, /*isFlags*/ true);
|
|
2980
2980
|
}
|
|
2981
2981
|
Debug.formatFlowFlags = formatFlowFlags;
|
|
2982
|
+
function formatRelationComparisonResult(result) {
|
|
2983
|
+
return formatEnum(result, ts.RelationComparisonResult, /*isFlags*/ true);
|
|
2984
|
+
}
|
|
2985
|
+
Debug.formatRelationComparisonResult = formatRelationComparisonResult;
|
|
2986
|
+
function formatCheckMode(mode) {
|
|
2987
|
+
return formatEnum(mode, ts.CheckMode, /*isFlags*/ true);
|
|
2988
|
+
}
|
|
2989
|
+
Debug.formatCheckMode = formatCheckMode;
|
|
2990
|
+
function formatSignatureCheckMode(mode) {
|
|
2991
|
+
return formatEnum(mode, ts.SignatureCheckMode, /*isFlags*/ true);
|
|
2992
|
+
}
|
|
2993
|
+
Debug.formatSignatureCheckMode = formatSignatureCheckMode;
|
|
2994
|
+
function formatTypeFacts(facts) {
|
|
2995
|
+
return formatEnum(facts, ts.TypeFacts, /*isFlags*/ true);
|
|
2996
|
+
}
|
|
2997
|
+
Debug.formatTypeFacts = formatTypeFacts;
|
|
2982
2998
|
var isDebugInfoEnabled = false;
|
|
2983
2999
|
var extendedDebugModule;
|
|
2984
3000
|
function extendedDebug() {
|
|
@@ -19716,7 +19732,8 @@ var ts;
|
|
|
19716
19732
|
function getDeclarationModifierFlagsFromSymbol(s, isWrite) {
|
|
19717
19733
|
if (isWrite === void 0) { isWrite = false; }
|
|
19718
19734
|
if (s.valueDeclaration) {
|
|
19719
|
-
var declaration = (isWrite && s.declarations && ts.find(s.declarations,
|
|
19735
|
+
var declaration = (isWrite && s.declarations && ts.find(s.declarations, ts.isSetAccessorDeclaration))
|
|
19736
|
+
|| (s.flags & 32768 /* GetAccessor */ && ts.find(s.declarations, ts.isGetAccessorDeclaration)) || s.valueDeclaration;
|
|
19720
19737
|
var flags = ts.getCombinedModifierFlags(declaration);
|
|
19721
19738
|
return s.parent && s.parent.flags & 32 /* Class */ ? flags : flags & ~28 /* AccessibilityModifier */;
|
|
19722
19739
|
}
|
|
@@ -20391,7 +20408,7 @@ var ts;
|
|
|
20391
20408
|
// Excludes declaration files - they still require an explicit `export {}` or the like
|
|
20392
20409
|
// for back compat purposes. The only non-declaration files _not_ forced to be a module are `.js` files
|
|
20393
20410
|
// that aren't esm-mode (meaning not in a `type: module` scope).
|
|
20394
|
-
return (file.impliedNodeFormat === ts.ModuleKind.ESNext || (ts.fileExtensionIsOneOf(file.fileName, [".cjs" /* Cjs */, ".cts" /* Cts */]))) && !file.isDeclarationFile ? true : undefined;
|
|
20411
|
+
return (file.impliedNodeFormat === ts.ModuleKind.ESNext || (ts.fileExtensionIsOneOf(file.fileName, [".cjs" /* Cjs */, ".cts" /* Cts */, ".mjs" /* Mjs */, ".mts" /* Mts */]))) && !file.isDeclarationFile ? true : undefined;
|
|
20395
20412
|
}
|
|
20396
20413
|
function getSetExternalModuleIndicator(options) {
|
|
20397
20414
|
// TODO: Should this callback be cached?
|
|
@@ -20414,10 +20431,7 @@ var ts;
|
|
|
20414
20431
|
if (options.jsx === 4 /* ReactJSX */ || options.jsx === 5 /* ReactJSXDev */) {
|
|
20415
20432
|
checks.push(isFileModuleFromUsingJSXTag);
|
|
20416
20433
|
}
|
|
20417
|
-
|
|
20418
|
-
if (moduleKind === ts.ModuleKind.Node16 || moduleKind === ts.ModuleKind.NodeNext) {
|
|
20419
|
-
checks.push(isFileForcedToBeModuleByFormat);
|
|
20420
|
-
}
|
|
20434
|
+
checks.push(isFileForcedToBeModuleByFormat);
|
|
20421
20435
|
var combined_1 = ts.or.apply(void 0, checks);
|
|
20422
20436
|
var callback = function (file) { return void (file.externalModuleIndicator = combined_1(file)); };
|
|
20423
20437
|
return callback;
|
|
@@ -34137,10 +34151,10 @@ var ts;
|
|
|
34137
34151
|
var hasJSDoc = hasPrecedingJSDocComment();
|
|
34138
34152
|
var modifiers = parseModifiers();
|
|
34139
34153
|
if (parseContextualModifier(136 /* GetKeyword */)) {
|
|
34140
|
-
return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 172 /* GetAccessor */);
|
|
34154
|
+
return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 172 /* GetAccessor */, 4 /* Type */);
|
|
34141
34155
|
}
|
|
34142
34156
|
if (parseContextualModifier(149 /* SetKeyword */)) {
|
|
34143
|
-
return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 173 /* SetAccessor */);
|
|
34157
|
+
return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 173 /* SetAccessor */, 4 /* Type */);
|
|
34144
34158
|
}
|
|
34145
34159
|
if (isIndexSignature()) {
|
|
34146
34160
|
return parseIndexSignatureDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers);
|
|
@@ -36186,10 +36200,10 @@ var ts;
|
|
|
36186
36200
|
var decorators = parseDecorators();
|
|
36187
36201
|
var modifiers = parseModifiers();
|
|
36188
36202
|
if (parseContextualModifier(136 /* GetKeyword */)) {
|
|
36189
|
-
return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172 /* GetAccessor */);
|
|
36203
|
+
return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172 /* GetAccessor */, 0 /* None */);
|
|
36190
36204
|
}
|
|
36191
36205
|
if (parseContextualModifier(149 /* SetKeyword */)) {
|
|
36192
|
-
return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 173 /* SetAccessor */);
|
|
36206
|
+
return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 173 /* SetAccessor */, 0 /* None */);
|
|
36193
36207
|
}
|
|
36194
36208
|
var asteriskToken = parseOptionalToken(41 /* AsteriskToken */);
|
|
36195
36209
|
var tokenIsIdentifier = isIdentifier();
|
|
@@ -36881,9 +36895,15 @@ var ts;
|
|
|
36881
36895
|
return !scanner.hasPrecedingLineBreak() && (isIdentifier() || token() === 10 /* StringLiteral */);
|
|
36882
36896
|
}
|
|
36883
36897
|
function parseFunctionBlockOrSemicolon(flags, diagnosticMessage) {
|
|
36884
|
-
if (token() !== 18 /* OpenBraceToken */
|
|
36885
|
-
|
|
36886
|
-
|
|
36898
|
+
if (token() !== 18 /* OpenBraceToken */) {
|
|
36899
|
+
if (flags & 4 /* Type */) {
|
|
36900
|
+
parseTypeMemberSemicolon();
|
|
36901
|
+
return;
|
|
36902
|
+
}
|
|
36903
|
+
if (canParseSemicolon()) {
|
|
36904
|
+
parseSemicolon();
|
|
36905
|
+
return;
|
|
36906
|
+
}
|
|
36887
36907
|
}
|
|
36888
36908
|
return parseFunctionBlock(flags, diagnosticMessage);
|
|
36889
36909
|
}
|
|
@@ -37087,12 +37107,12 @@ var ts;
|
|
|
37087
37107
|
}
|
|
37088
37108
|
return parsePropertyDeclaration(pos, hasJSDoc, decorators, modifiers, name, questionToken);
|
|
37089
37109
|
}
|
|
37090
|
-
function parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, kind) {
|
|
37110
|
+
function parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, kind, flags) {
|
|
37091
37111
|
var name = parsePropertyName();
|
|
37092
37112
|
var typeParameters = parseTypeParameters();
|
|
37093
37113
|
var parameters = parseParameters(0 /* None */);
|
|
37094
37114
|
var type = parseReturnType(58 /* ColonToken */, /*isType*/ false);
|
|
37095
|
-
var body = parseFunctionBlockOrSemicolon(
|
|
37115
|
+
var body = parseFunctionBlockOrSemicolon(flags);
|
|
37096
37116
|
var node = kind === 172 /* GetAccessor */
|
|
37097
37117
|
? factory.createGetAccessorDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, parameters, type, body)
|
|
37098
37118
|
: factory.createSetAccessorDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, parameters, body);
|
|
@@ -37279,10 +37299,10 @@ var ts;
|
|
|
37279
37299
|
return parseClassStaticBlockDeclaration(pos, hasJSDoc, decorators, modifiers);
|
|
37280
37300
|
}
|
|
37281
37301
|
if (parseContextualModifier(136 /* GetKeyword */)) {
|
|
37282
|
-
return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172 /* GetAccessor */);
|
|
37302
|
+
return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172 /* GetAccessor */, 0 /* None */);
|
|
37283
37303
|
}
|
|
37284
37304
|
if (parseContextualModifier(149 /* SetKeyword */)) {
|
|
37285
|
-
return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 173 /* SetAccessor */);
|
|
37305
|
+
return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 173 /* SetAccessor */, 0 /* None */);
|
|
37286
37306
|
}
|
|
37287
37307
|
if (token() === 134 /* ConstructorKeyword */ || token() === 10 /* StringLiteral */) {
|
|
37288
37308
|
var constructorDeclaration = tryParseConstructorDeclaration(pos, hasJSDoc, decorators, modifiers);
|
|
@@ -48686,7 +48706,7 @@ var ts;
|
|
|
48686
48706
|
// Masks
|
|
48687
48707
|
TypeFacts[TypeFacts["OrFactsMask"] = 8256] = "OrFactsMask";
|
|
48688
48708
|
TypeFacts[TypeFacts["AndFactsMask"] = 134209471] = "AndFactsMask";
|
|
48689
|
-
})(TypeFacts || (TypeFacts = {}));
|
|
48709
|
+
})(TypeFacts = ts.TypeFacts || (ts.TypeFacts = {}));
|
|
48690
48710
|
var typeofNEFacts = new ts.Map(ts.getEntries({
|
|
48691
48711
|
string: 256 /* TypeofNEString */,
|
|
48692
48712
|
number: 512 /* TypeofNENumber */,
|
|
@@ -48721,7 +48741,7 @@ var ts;
|
|
|
48721
48741
|
CheckMode[CheckMode["RestBindingElement"] = 64] = "RestBindingElement";
|
|
48722
48742
|
// e.g. in `const { a, ...rest } = foo`, when checking the type of `foo` to determine the type of `rest`,
|
|
48723
48743
|
// we need to preserve generic types instead of substituting them for constraints
|
|
48724
|
-
})(CheckMode || (CheckMode = {}));
|
|
48744
|
+
})(CheckMode = ts.CheckMode || (ts.CheckMode = {}));
|
|
48725
48745
|
var SignatureCheckMode;
|
|
48726
48746
|
(function (SignatureCheckMode) {
|
|
48727
48747
|
SignatureCheckMode[SignatureCheckMode["BivariantCallback"] = 1] = "BivariantCallback";
|
|
@@ -48729,7 +48749,7 @@ var ts;
|
|
|
48729
48749
|
SignatureCheckMode[SignatureCheckMode["IgnoreReturnTypes"] = 4] = "IgnoreReturnTypes";
|
|
48730
48750
|
SignatureCheckMode[SignatureCheckMode["StrictArity"] = 8] = "StrictArity";
|
|
48731
48751
|
SignatureCheckMode[SignatureCheckMode["Callback"] = 3] = "Callback";
|
|
48732
|
-
})(SignatureCheckMode || (SignatureCheckMode = {}));
|
|
48752
|
+
})(SignatureCheckMode = ts.SignatureCheckMode || (ts.SignatureCheckMode = {}));
|
|
48733
48753
|
var IntersectionState;
|
|
48734
48754
|
(function (IntersectionState) {
|
|
48735
48755
|
IntersectionState[IntersectionState["None"] = 0] = "None";
|
|
@@ -49081,7 +49101,7 @@ var ts;
|
|
|
49081
49101
|
},
|
|
49082
49102
|
getContextualTypeForObjectLiteralElement: function (nodeIn) {
|
|
49083
49103
|
var node = ts.getParseTreeNode(nodeIn, ts.isObjectLiteralElementLike);
|
|
49084
|
-
return node ? getContextualTypeForObjectLiteralElement(node) : undefined;
|
|
49104
|
+
return node ? getContextualTypeForObjectLiteralElement(node, /*contextFlags*/ undefined) : undefined;
|
|
49085
49105
|
},
|
|
49086
49106
|
getContextualTypeForArgumentAtIndex: function (nodeIn, argIndex) {
|
|
49087
49107
|
var node = ts.getParseTreeNode(nodeIn, ts.isCallLikeExpression);
|
|
@@ -49089,7 +49109,7 @@ var ts;
|
|
|
49089
49109
|
},
|
|
49090
49110
|
getContextualTypeForJsxAttribute: function (nodeIn) {
|
|
49091
49111
|
var node = ts.getParseTreeNode(nodeIn, ts.isJsxAttributeLike);
|
|
49092
|
-
return node && getContextualTypeForJsxAttribute(node);
|
|
49112
|
+
return node && getContextualTypeForJsxAttribute(node, /*contextFlags*/ undefined);
|
|
49093
49113
|
},
|
|
49094
49114
|
isContextSensitive: isContextSensitive,
|
|
49095
49115
|
getTypeOfPropertyOfContextualType: getTypeOfPropertyOfContextualType,
|
|
@@ -52812,13 +52832,25 @@ var ts;
|
|
|
52812
52832
|
&& isDeclarationVisible(declaration.parent)) {
|
|
52813
52833
|
return addVisibleAlias(declaration, declaration);
|
|
52814
52834
|
}
|
|
52815
|
-
else if (
|
|
52816
|
-
&& ts.
|
|
52817
|
-
|
|
52818
|
-
|
|
52819
|
-
|
|
52820
|
-
|
|
52821
|
-
|
|
52835
|
+
else if (ts.isBindingElement(declaration)) {
|
|
52836
|
+
if (symbol.flags & 2097152 /* Alias */ && ts.isInJSFile(declaration) && ((_a = declaration.parent) === null || _a === void 0 ? void 0 : _a.parent) // exported import-like top-level JS require statement
|
|
52837
|
+
&& ts.isVariableDeclaration(declaration.parent.parent)
|
|
52838
|
+
&& ((_b = declaration.parent.parent.parent) === null || _b === void 0 ? void 0 : _b.parent) && ts.isVariableStatement(declaration.parent.parent.parent.parent)
|
|
52839
|
+
&& !ts.hasSyntacticModifier(declaration.parent.parent.parent.parent, 1 /* Export */)
|
|
52840
|
+
&& declaration.parent.parent.parent.parent.parent // check if the thing containing the variable statement is visible (ie, the file)
|
|
52841
|
+
&& isDeclarationVisible(declaration.parent.parent.parent.parent.parent)) {
|
|
52842
|
+
return addVisibleAlias(declaration, declaration.parent.parent.parent.parent);
|
|
52843
|
+
}
|
|
52844
|
+
else if (symbol.flags & 2 /* BlockScopedVariable */) {
|
|
52845
|
+
var variableStatement = ts.findAncestor(declaration, ts.isVariableStatement);
|
|
52846
|
+
if (ts.hasSyntacticModifier(variableStatement, 1 /* Export */)) {
|
|
52847
|
+
return true;
|
|
52848
|
+
}
|
|
52849
|
+
if (!isDeclarationVisible(variableStatement.parent)) {
|
|
52850
|
+
return false;
|
|
52851
|
+
}
|
|
52852
|
+
return addVisibleAlias(declaration, variableStatement);
|
|
52853
|
+
}
|
|
52822
52854
|
}
|
|
52823
52855
|
// Declaration is not visible
|
|
52824
52856
|
return false;
|
|
@@ -53339,6 +53371,10 @@ var ts;
|
|
|
53339
53371
|
}
|
|
53340
53372
|
return typeToTypeNodeHelper(type, context);
|
|
53341
53373
|
}
|
|
53374
|
+
function isHomomorphicMappedTypeWithNonHomomorphicInstantiation(type) {
|
|
53375
|
+
return isMappedTypeWithKeyofConstraintDeclaration(type)
|
|
53376
|
+
&& !(getModifiersTypeFromMappedType(type).flags & 262144 /* TypeParameter */);
|
|
53377
|
+
}
|
|
53342
53378
|
function createMappedTypeNodeFromType(type) {
|
|
53343
53379
|
ts.Debug.assert(!!(type.flags & 524288 /* Object */));
|
|
53344
53380
|
var readonlyToken = type.declaration.readonlyToken ? ts.factory.createToken(type.declaration.readonlyToken.kind) : undefined;
|
|
@@ -53348,7 +53384,7 @@ var ts;
|
|
|
53348
53384
|
if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
|
|
53349
53385
|
// We have a { [P in keyof T]: X }
|
|
53350
53386
|
// We do this to ensure we retain the toplevel keyof-ness of the type which may be lost due to keyof distribution during `getConstraintTypeFromMappedType`
|
|
53351
|
-
if (
|
|
53387
|
+
if (isHomomorphicMappedTypeWithNonHomomorphicInstantiation(type) && context.flags & 4 /* GenerateNamesForShadowedTypeParams */) {
|
|
53352
53388
|
var newParam = createTypeParameter(createSymbol(262144 /* TypeParameter */, "T"));
|
|
53353
53389
|
var name = typeParameterToName(newParam, context);
|
|
53354
53390
|
newTypeVariable = ts.factory.createTypeReferenceNode(name);
|
|
@@ -53364,11 +53400,12 @@ var ts;
|
|
|
53364
53400
|
var mappedTypeNode = ts.factory.createMappedTypeNode(readonlyToken, typeParameterNode, nameTypeNode, questionToken, templateTypeNode, /*members*/ undefined);
|
|
53365
53401
|
context.approximateLength += 10;
|
|
53366
53402
|
var result = ts.setEmitFlags(mappedTypeNode, 1 /* SingleLine */);
|
|
53367
|
-
if (
|
|
53403
|
+
if (isHomomorphicMappedTypeWithNonHomomorphicInstantiation(type) && context.flags & 4 /* GenerateNamesForShadowedTypeParams */) {
|
|
53368
53404
|
// homomorphic mapped type with a non-homomorphic naive inlining
|
|
53369
53405
|
// wrap it with a conditional like `SomeModifiersType extends infer U ? {..the mapped type...} : never` to ensure the resulting
|
|
53370
53406
|
// type stays homomorphic
|
|
53371
|
-
|
|
53407
|
+
var originalConstraint = instantiateType(getConstraintOfTypeParameter(getTypeFromTypeNode(type.declaration.typeParameter.constraint.type)) || unknownType, type.mapper);
|
|
53408
|
+
return ts.factory.createConditionalTypeNode(typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context), ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(/*modifiers*/ undefined, ts.factory.cloneNode(newTypeVariable.typeName), originalConstraint.flags & 2 /* Unknown */ ? undefined : typeToTypeNodeHelper(originalConstraint, context))), result, ts.factory.createKeywordTypeNode(143 /* NeverKeyword */));
|
|
53372
53409
|
}
|
|
53373
53410
|
return result;
|
|
53374
53411
|
}
|
|
@@ -66318,13 +66355,20 @@ var ts;
|
|
|
66318
66355
|
return result;
|
|
66319
66356
|
}
|
|
66320
66357
|
function structuredTypeRelatedTo(source, target, reportErrors, intersectionState) {
|
|
66358
|
+
var saveErrorInfo = captureErrorCalculationState();
|
|
66359
|
+
var result = structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState, saveErrorInfo);
|
|
66360
|
+
if (result) {
|
|
66361
|
+
resetErrorInfo(saveErrorInfo);
|
|
66362
|
+
}
|
|
66363
|
+
return result;
|
|
66364
|
+
}
|
|
66365
|
+
function structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState, saveErrorInfo) {
|
|
66321
66366
|
if (intersectionState & 4 /* PropertyCheck */) {
|
|
66322
66367
|
return propertiesRelatedTo(source, target, reportErrors, /*excludedProperties*/ undefined, 0 /* None */);
|
|
66323
66368
|
}
|
|
66324
66369
|
var result;
|
|
66325
66370
|
var originalErrorInfo;
|
|
66326
66371
|
var varianceCheckFailed = false;
|
|
66327
|
-
var saveErrorInfo = captureErrorCalculationState();
|
|
66328
66372
|
var sourceFlags = source.flags;
|
|
66329
66373
|
var targetFlags = target.flags;
|
|
66330
66374
|
if (relation === identityRelation) {
|
|
@@ -66388,7 +66432,6 @@ var ts;
|
|
|
66388
66432
|
if (constraint && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself
|
|
66389
66433
|
// TODO: Stack errors so we get a pyramid for the "normal" comparison above, _and_ a second for this
|
|
66390
66434
|
if (result = isRelatedTo(constraint, target, 1 /* Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState)) {
|
|
66391
|
-
resetErrorInfo(saveErrorInfo);
|
|
66392
66435
|
return result;
|
|
66393
66436
|
}
|
|
66394
66437
|
}
|
|
@@ -66513,7 +66556,6 @@ var ts;
|
|
|
66513
66556
|
result &= isRelatedTo(source.indexType, target.indexType, 3 /* Both */, reportErrors);
|
|
66514
66557
|
}
|
|
66515
66558
|
if (result) {
|
|
66516
|
-
resetErrorInfo(saveErrorInfo);
|
|
66517
66559
|
return result;
|
|
66518
66560
|
}
|
|
66519
66561
|
if (reportErrors) {
|
|
@@ -66616,7 +66658,6 @@ var ts;
|
|
|
66616
66658
|
// If we reach 10 levels of nesting for the same conditional type, assume it is an infinitely expanding recursive
|
|
66617
66659
|
// conditional type and bail out with a Ternary.Maybe result.
|
|
66618
66660
|
if (isDeeplyNestedType(target, targetStack, targetDepth, 10)) {
|
|
66619
|
-
resetErrorInfo(saveErrorInfo);
|
|
66620
66661
|
return 3 /* Maybe */;
|
|
66621
66662
|
}
|
|
66622
66663
|
var c = target;
|
|
@@ -66631,7 +66672,6 @@ var ts;
|
|
|
66631
66672
|
if (result = skipTrue ? -1 /* True */ : isRelatedTo(source, getTrueTypeFromConditionalType(c), 2 /* Target */, /*reportErrors*/ false)) {
|
|
66632
66673
|
result &= skipFalse ? -1 /* True */ : isRelatedTo(source, getFalseTypeFromConditionalType(c), 2 /* Target */, /*reportErrors*/ false);
|
|
66633
66674
|
if (result) {
|
|
66634
|
-
resetErrorInfo(saveErrorInfo);
|
|
66635
66675
|
return result;
|
|
66636
66676
|
}
|
|
66637
66677
|
}
|
|
@@ -66663,12 +66703,10 @@ var ts;
|
|
|
66663
66703
|
var constraint = getConstraintOfType(source) || unknownType;
|
|
66664
66704
|
// hi-speed no-this-instantiation check (less accurate, but avoids costly `this`-instantiation when the constraint will suffice), see #28231 for report on why this is needed
|
|
66665
66705
|
if (result = isRelatedTo(constraint, target, 1 /* Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState)) {
|
|
66666
|
-
resetErrorInfo(saveErrorInfo);
|
|
66667
66706
|
return result;
|
|
66668
66707
|
}
|
|
66669
66708
|
// slower, fuller, this-instantiated check (necessary when comparing raw `this` types from base classes), see `subclassWithPolymorphicThisIsAssignable.ts` test for example
|
|
66670
66709
|
else if (result = isRelatedTo(getTypeWithThisArgument(constraint, source), target, 1 /* Source */, reportErrors && constraint !== unknownType && !(targetFlags & sourceFlags & 262144 /* TypeParameter */), /*headMessage*/ undefined, intersectionState)) {
|
|
66671
|
-
resetErrorInfo(saveErrorInfo);
|
|
66672
66710
|
return result;
|
|
66673
66711
|
}
|
|
66674
66712
|
if (isMappedTypeGenericIndexedAccess(source)) {
|
|
@@ -66677,7 +66715,6 @@ var ts;
|
|
|
66677
66715
|
var indexConstraint = getConstraintOfType(source.indexType);
|
|
66678
66716
|
if (indexConstraint) {
|
|
66679
66717
|
if (result = isRelatedTo(getIndexedAccessType(source.objectType, indexConstraint), target, 1 /* Source */, reportErrors)) {
|
|
66680
|
-
resetErrorInfo(saveErrorInfo);
|
|
66681
66718
|
return result;
|
|
66682
66719
|
}
|
|
66683
66720
|
}
|
|
@@ -66686,7 +66723,6 @@ var ts;
|
|
|
66686
66723
|
}
|
|
66687
66724
|
else if (sourceFlags & 4194304 /* Index */) {
|
|
66688
66725
|
if (result = isRelatedTo(keyofConstraintType, target, 1 /* Source */, reportErrors)) {
|
|
66689
|
-
resetErrorInfo(saveErrorInfo);
|
|
66690
66726
|
return result;
|
|
66691
66727
|
}
|
|
66692
66728
|
}
|
|
@@ -66694,7 +66730,6 @@ var ts;
|
|
|
66694
66730
|
if (!(targetFlags & 134217728 /* TemplateLiteral */)) {
|
|
66695
66731
|
var constraint = getBaseConstraintOfType(source);
|
|
66696
66732
|
if (constraint && constraint !== source && (result = isRelatedTo(constraint, target, 1 /* Source */, reportErrors))) {
|
|
66697
|
-
resetErrorInfo(saveErrorInfo);
|
|
66698
66733
|
return result;
|
|
66699
66734
|
}
|
|
66700
66735
|
}
|
|
@@ -66705,14 +66740,12 @@ var ts;
|
|
|
66705
66740
|
return 0 /* False */;
|
|
66706
66741
|
}
|
|
66707
66742
|
if (result = isRelatedTo(source.type, target.type, 3 /* Both */, reportErrors)) {
|
|
66708
|
-
resetErrorInfo(saveErrorInfo);
|
|
66709
66743
|
return result;
|
|
66710
66744
|
}
|
|
66711
66745
|
}
|
|
66712
66746
|
else {
|
|
66713
66747
|
var constraint = getBaseConstraintOfType(source);
|
|
66714
66748
|
if (constraint && (result = isRelatedTo(constraint, target, 1 /* Source */, reportErrors))) {
|
|
66715
|
-
resetErrorInfo(saveErrorInfo);
|
|
66716
66749
|
return result;
|
|
66717
66750
|
}
|
|
66718
66751
|
}
|
|
@@ -66721,7 +66754,6 @@ var ts;
|
|
|
66721
66754
|
// If we reach 10 levels of nesting for the same conditional type, assume it is an infinitely expanding recursive
|
|
66722
66755
|
// conditional type and bail out with a Ternary.Maybe result.
|
|
66723
66756
|
if (isDeeplyNestedType(source, sourceStack, sourceDepth, 10)) {
|
|
66724
|
-
resetErrorInfo(saveErrorInfo);
|
|
66725
66757
|
return 3 /* Maybe */;
|
|
66726
66758
|
}
|
|
66727
66759
|
if (targetFlags & 16777216 /* Conditional */) {
|
|
@@ -66744,7 +66776,6 @@ var ts;
|
|
|
66744
66776
|
result &= isRelatedTo(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target), 3 /* Both */, reportErrors);
|
|
66745
66777
|
}
|
|
66746
66778
|
if (result) {
|
|
66747
|
-
resetErrorInfo(saveErrorInfo);
|
|
66748
66779
|
return result;
|
|
66749
66780
|
}
|
|
66750
66781
|
}
|
|
@@ -66755,7 +66786,6 @@ var ts;
|
|
|
66755
66786
|
var distributiveConstraint = hasNonCircularBaseConstraint(source) ? getConstraintOfDistributiveConditionalType(source) : undefined;
|
|
66756
66787
|
if (distributiveConstraint) {
|
|
66757
66788
|
if (result = isRelatedTo(distributiveConstraint, target, 1 /* Source */, reportErrors)) {
|
|
66758
|
-
resetErrorInfo(saveErrorInfo);
|
|
66759
66789
|
return result;
|
|
66760
66790
|
}
|
|
66761
66791
|
}
|
|
@@ -66765,7 +66795,6 @@ var ts;
|
|
|
66765
66795
|
var defaultConstraint = getDefaultConstraintOfConditionalType(source);
|
|
66766
66796
|
if (defaultConstraint) {
|
|
66767
66797
|
if (result = isRelatedTo(defaultConstraint, target, 1 /* Source */, reportErrors)) {
|
|
66768
|
-
resetErrorInfo(saveErrorInfo);
|
|
66769
66798
|
return result;
|
|
66770
66799
|
}
|
|
66771
66800
|
}
|
|
@@ -66778,7 +66807,6 @@ var ts;
|
|
|
66778
66807
|
if (isGenericMappedType(target)) {
|
|
66779
66808
|
if (isGenericMappedType(source)) {
|
|
66780
66809
|
if (result = mappedTypeRelatedTo(source, target, reportErrors)) {
|
|
66781
|
-
resetErrorInfo(saveErrorInfo);
|
|
66782
66810
|
return result;
|
|
66783
66811
|
}
|
|
66784
66812
|
}
|
|
@@ -72299,7 +72327,7 @@ var ts;
|
|
|
72299
72327
|
!((ts.isJsxOpeningElement(node.parent) || ts.isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) &&
|
|
72300
72328
|
(checkMode && checkMode & 64 /* RestBindingElement */ ?
|
|
72301
72329
|
getContextualType(node, 8 /* SkipBindingPatterns */)
|
|
72302
|
-
: getContextualType(node));
|
|
72330
|
+
: getContextualType(node, /*contextFlags*/ undefined));
|
|
72303
72331
|
return contextualType && !isGenericType(contextualType);
|
|
72304
72332
|
}
|
|
72305
72333
|
function getNarrowableTypeForReference(type, reference, checkMode) {
|
|
@@ -73163,7 +73191,7 @@ var ts;
|
|
|
73163
73191
|
// We have an object literal method. Check if the containing object literal has a contextual type
|
|
73164
73192
|
// that includes a ThisType<T>. If so, T is the contextual type for 'this'. We continue looking in
|
|
73165
73193
|
// any directly enclosing object literals.
|
|
73166
|
-
var contextualType = getApparentTypeOfContextualType(containingLiteral);
|
|
73194
|
+
var contextualType = getApparentTypeOfContextualType(containingLiteral, /*contextFlags*/ undefined);
|
|
73167
73195
|
var literal = containingLiteral;
|
|
73168
73196
|
var type = contextualType;
|
|
73169
73197
|
while (type) {
|
|
@@ -73175,7 +73203,7 @@ var ts;
|
|
|
73175
73203
|
break;
|
|
73176
73204
|
}
|
|
73177
73205
|
literal = literal.parent.parent;
|
|
73178
|
-
type = getApparentTypeOfContextualType(literal);
|
|
73206
|
+
type = getApparentTypeOfContextualType(literal, /*contextFlags*/ undefined);
|
|
73179
73207
|
}
|
|
73180
73208
|
// There was no contextual ThisType<T> for the containing object literal, so the contextual type
|
|
73181
73209
|
// for 'this' is the non-null form of the contextual type for the containing object literal or
|
|
@@ -73232,7 +73260,7 @@ var ts;
|
|
|
73232
73260
|
tryGetTypeAtPosition(contextualSignature, index);
|
|
73233
73261
|
}
|
|
73234
73262
|
}
|
|
73235
|
-
function getContextualTypeForVariableLikeDeclaration(declaration) {
|
|
73263
|
+
function getContextualTypeForVariableLikeDeclaration(declaration, contextFlags) {
|
|
73236
73264
|
var typeNode = ts.getEffectiveTypeAnnotationNode(declaration);
|
|
73237
73265
|
if (typeNode) {
|
|
73238
73266
|
return getTypeFromTypeNode(typeNode);
|
|
@@ -73241,18 +73269,18 @@ var ts;
|
|
|
73241
73269
|
case 164 /* Parameter */:
|
|
73242
73270
|
return getContextuallyTypedParameterType(declaration);
|
|
73243
73271
|
case 203 /* BindingElement */:
|
|
73244
|
-
return getContextualTypeForBindingElement(declaration);
|
|
73272
|
+
return getContextualTypeForBindingElement(declaration, contextFlags);
|
|
73245
73273
|
case 167 /* PropertyDeclaration */:
|
|
73246
73274
|
if (ts.isStatic(declaration)) {
|
|
73247
|
-
return getContextualTypeForStaticPropertyDeclaration(declaration);
|
|
73275
|
+
return getContextualTypeForStaticPropertyDeclaration(declaration, contextFlags);
|
|
73248
73276
|
}
|
|
73249
73277
|
// By default, do nothing and return undefined - only the above cases have context implied by a parent
|
|
73250
73278
|
}
|
|
73251
73279
|
}
|
|
73252
|
-
function getContextualTypeForBindingElement(declaration) {
|
|
73280
|
+
function getContextualTypeForBindingElement(declaration, contextFlags) {
|
|
73253
73281
|
var parent = declaration.parent.parent;
|
|
73254
73282
|
var name = declaration.propertyName || declaration.name;
|
|
73255
|
-
var parentType = getContextualTypeForVariableLikeDeclaration(parent) ||
|
|
73283
|
+
var parentType = getContextualTypeForVariableLikeDeclaration(parent, contextFlags) ||
|
|
73256
73284
|
parent.kind !== 203 /* BindingElement */ && parent.initializer && checkDeclarationInitializer(parent, declaration.dotDotDotToken ? 64 /* RestBindingElement */ : 0 /* Normal */);
|
|
73257
73285
|
if (!parentType || ts.isBindingPattern(name) || ts.isComputedNonLiteralName(name))
|
|
73258
73286
|
return undefined;
|
|
@@ -73268,8 +73296,8 @@ var ts;
|
|
|
73268
73296
|
return getTypeOfPropertyOfType(parentType, text);
|
|
73269
73297
|
}
|
|
73270
73298
|
}
|
|
73271
|
-
function getContextualTypeForStaticPropertyDeclaration(declaration) {
|
|
73272
|
-
var parentType = ts.isExpression(declaration.parent) && getContextualType(declaration.parent);
|
|
73299
|
+
function getContextualTypeForStaticPropertyDeclaration(declaration, contextFlags) {
|
|
73300
|
+
var parentType = ts.isExpression(declaration.parent) && getContextualType(declaration.parent, contextFlags);
|
|
73273
73301
|
if (!parentType)
|
|
73274
73302
|
return undefined;
|
|
73275
73303
|
return getTypeOfPropertyOfContextualType(parentType, getSymbolOfNode(declaration).escapedName);
|
|
@@ -73285,7 +73313,7 @@ var ts;
|
|
|
73285
73313
|
function getContextualTypeForInitializerExpression(node, contextFlags) {
|
|
73286
73314
|
var declaration = node.parent;
|
|
73287
73315
|
if (ts.hasInitializer(declaration) && node === declaration.initializer) {
|
|
73288
|
-
var result = getContextualTypeForVariableLikeDeclaration(declaration);
|
|
73316
|
+
var result = getContextualTypeForVariableLikeDeclaration(declaration, contextFlags);
|
|
73289
73317
|
if (result) {
|
|
73290
73318
|
return result;
|
|
73291
73319
|
}
|
|
@@ -73295,10 +73323,10 @@ var ts;
|
|
|
73295
73323
|
}
|
|
73296
73324
|
return undefined;
|
|
73297
73325
|
}
|
|
73298
|
-
function getContextualTypeForReturnExpression(node) {
|
|
73326
|
+
function getContextualTypeForReturnExpression(node, contextFlags) {
|
|
73299
73327
|
var func = ts.getContainingFunction(node);
|
|
73300
73328
|
if (func) {
|
|
73301
|
-
var contextualReturnType = getContextualReturnType(func);
|
|
73329
|
+
var contextualReturnType = getContextualReturnType(func, contextFlags);
|
|
73302
73330
|
if (contextualReturnType) {
|
|
73303
73331
|
var functionFlags = ts.getFunctionFlags(func);
|
|
73304
73332
|
if (functionFlags & 1 /* Generator */) { // Generator or AsyncGenerator function
|
|
@@ -73328,11 +73356,11 @@ var ts;
|
|
|
73328
73356
|
}
|
|
73329
73357
|
return undefined;
|
|
73330
73358
|
}
|
|
73331
|
-
function getContextualTypeForYieldOperand(node) {
|
|
73359
|
+
function getContextualTypeForYieldOperand(node, contextFlags) {
|
|
73332
73360
|
var func = ts.getContainingFunction(node);
|
|
73333
73361
|
if (func) {
|
|
73334
73362
|
var functionFlags = ts.getFunctionFlags(func);
|
|
73335
|
-
var contextualReturnType = getContextualReturnType(func);
|
|
73363
|
+
var contextualReturnType = getContextualReturnType(func, contextFlags);
|
|
73336
73364
|
if (contextualReturnType) {
|
|
73337
73365
|
return node.asteriskToken
|
|
73338
73366
|
? contextualReturnType
|
|
@@ -73356,14 +73384,14 @@ var ts;
|
|
|
73356
73384
|
}
|
|
73357
73385
|
function getContextualIterationType(kind, functionDecl) {
|
|
73358
73386
|
var isAsync = !!(ts.getFunctionFlags(functionDecl) & 2 /* Async */);
|
|
73359
|
-
var contextualReturnType = getContextualReturnType(functionDecl);
|
|
73387
|
+
var contextualReturnType = getContextualReturnType(functionDecl, /*contextFlags*/ undefined);
|
|
73360
73388
|
if (contextualReturnType) {
|
|
73361
73389
|
return getIterationTypeOfGeneratorFunctionReturnType(kind, contextualReturnType, isAsync)
|
|
73362
73390
|
|| undefined;
|
|
73363
73391
|
}
|
|
73364
73392
|
return undefined;
|
|
73365
73393
|
}
|
|
73366
|
-
function getContextualReturnType(functionDecl) {
|
|
73394
|
+
function getContextualReturnType(functionDecl, contextFlags) {
|
|
73367
73395
|
// If the containing function has a return type annotation, is a constructor, or is a get accessor whose
|
|
73368
73396
|
// corresponding set accessor has a type annotation, return statements in the function are contextually typed
|
|
73369
73397
|
var returnType = getReturnTypeFromAnnotation(functionDecl);
|
|
@@ -73378,7 +73406,7 @@ var ts;
|
|
|
73378
73406
|
}
|
|
73379
73407
|
var iife = ts.getImmediatelyInvokedFunctionExpression(functionDecl);
|
|
73380
73408
|
if (iife) {
|
|
73381
|
-
return getContextualType(iife);
|
|
73409
|
+
return getContextualType(iife, contextFlags);
|
|
73382
73410
|
}
|
|
73383
73411
|
return undefined;
|
|
73384
73412
|
}
|
|
@@ -73631,7 +73659,7 @@ var ts;
|
|
|
73631
73659
|
}
|
|
73632
73660
|
function getContextualTypeForObjectLiteralElement(element, contextFlags) {
|
|
73633
73661
|
var objectLiteral = element.parent;
|
|
73634
|
-
var propertyAssignmentType = ts.isPropertyAssignment(element) && getContextualTypeForVariableLikeDeclaration(element);
|
|
73662
|
+
var propertyAssignmentType = ts.isPropertyAssignment(element) && getContextualTypeForVariableLikeDeclaration(element, contextFlags);
|
|
73635
73663
|
if (propertyAssignmentType) {
|
|
73636
73664
|
return propertyAssignmentType;
|
|
73637
73665
|
}
|
|
@@ -73826,9 +73854,9 @@ var ts;
|
|
|
73826
73854
|
return getContextualTypeForInitializerExpression(node, contextFlags);
|
|
73827
73855
|
case 214 /* ArrowFunction */:
|
|
73828
73856
|
case 247 /* ReturnStatement */:
|
|
73829
|
-
return getContextualTypeForReturnExpression(node);
|
|
73857
|
+
return getContextualTypeForReturnExpression(node, contextFlags);
|
|
73830
73858
|
case 224 /* YieldExpression */:
|
|
73831
|
-
return getContextualTypeForYieldOperand(parent);
|
|
73859
|
+
return getContextualTypeForYieldOperand(parent, contextFlags);
|
|
73832
73860
|
case 218 /* AwaitExpression */:
|
|
73833
73861
|
return getContextualTypeForAwaitOperand(parent, contextFlags);
|
|
73834
73862
|
case 208 /* CallExpression */:
|
|
@@ -73876,7 +73904,7 @@ var ts;
|
|
|
73876
73904
|
}
|
|
73877
73905
|
return undefined;
|
|
73878
73906
|
function tryFindWhenConstTypeReference(node) {
|
|
73879
|
-
return getContextualType(node);
|
|
73907
|
+
return getContextualType(node, contextFlags);
|
|
73880
73908
|
}
|
|
73881
73909
|
}
|
|
73882
73910
|
function getInferenceContext(node) {
|
|
@@ -74178,7 +74206,7 @@ var ts;
|
|
|
74178
74206
|
var elementCount = elements.length;
|
|
74179
74207
|
var elementTypes = [];
|
|
74180
74208
|
var elementFlags = [];
|
|
74181
|
-
var contextualType = getApparentTypeOfContextualType(node);
|
|
74209
|
+
var contextualType = getApparentTypeOfContextualType(node, /*contextFlags*/ undefined);
|
|
74182
74210
|
var inDestructuringPattern = ts.isAssignmentTarget(node);
|
|
74183
74211
|
var inConstContext = isConstContext(node);
|
|
74184
74212
|
var hasOmittedExpression = false;
|
|
@@ -74349,7 +74377,7 @@ var ts;
|
|
|
74349
74377
|
var propertiesTable = ts.createSymbolTable();
|
|
74350
74378
|
var propertiesArray = [];
|
|
74351
74379
|
var spread = emptyObjectType;
|
|
74352
|
-
var contextualType = getApparentTypeOfContextualType(node);
|
|
74380
|
+
var contextualType = getApparentTypeOfContextualType(node, /*contextFlags*/ undefined);
|
|
74353
74381
|
var contextualTypeHasPattern = contextualType && contextualType.pattern &&
|
|
74354
74382
|
(contextualType.pattern.kind === 201 /* ObjectBindingPattern */ || contextualType.pattern.kind === 205 /* ObjectLiteralExpression */);
|
|
74355
74383
|
var inConstContext = isConstContext(node);
|
|
@@ -74688,7 +74716,7 @@ var ts;
|
|
|
74688
74716
|
if (explicitlySpecifyChildrenAttribute) {
|
|
74689
74717
|
error(attributes, ts.Diagnostics._0_are_specified_twice_The_attribute_named_0_will_be_overwritten, ts.unescapeLeadingUnderscores(jsxChildrenPropertyName));
|
|
74690
74718
|
}
|
|
74691
|
-
var contextualType = getApparentTypeOfContextualType(openingLikeElement.attributes);
|
|
74719
|
+
var contextualType = getApparentTypeOfContextualType(openingLikeElement.attributes, /*contextFlags*/ undefined);
|
|
74692
74720
|
var childrenContextualType = contextualType && getTypeOfPropertyOfContextualType(contextualType, jsxChildrenPropertyName);
|
|
74693
74721
|
// If there are children in the body of JSX element, create dummy attribute "children" with the union of children types so that it will pass the attribute checking process
|
|
74694
74722
|
var childrenPropSymbol = createSymbol(4 /* Property */, jsxChildrenPropertyName);
|
|
@@ -78528,17 +78556,6 @@ var ts;
|
|
|
78528
78556
|
}
|
|
78529
78557
|
}
|
|
78530
78558
|
}
|
|
78531
|
-
var restType = getEffectiveRestType(context);
|
|
78532
|
-
if (restType && restType.flags & 262144 /* TypeParameter */) {
|
|
78533
|
-
// The contextual signature has a generic rest parameter. We first instantiate the contextual
|
|
78534
|
-
// signature (without fixing type parameters) and assign types to contextually typed parameters.
|
|
78535
|
-
var instantiatedContext = instantiateSignature(context, inferenceContext.nonFixingMapper);
|
|
78536
|
-
assignContextualParameterTypes(signature, instantiatedContext);
|
|
78537
|
-
// We then infer from a tuple type representing the parameters that correspond to the contextual
|
|
78538
|
-
// rest parameter.
|
|
78539
|
-
var restPos = getParameterCount(context) - 1;
|
|
78540
|
-
inferTypes(inferenceContext.inferences, getRestTypeAtPosition(signature, restPos), restType);
|
|
78541
|
-
}
|
|
78542
78559
|
}
|
|
78543
78560
|
function assignContextualParameterTypes(signature, context) {
|
|
78544
78561
|
if (context.typeParameters) {
|
|
@@ -78731,7 +78748,7 @@ var ts;
|
|
|
78731
78748
|
var contextualSignature = getContextualSignatureForFunctionLikeDeclaration(func);
|
|
78732
78749
|
var contextualType = !contextualSignature ? undefined :
|
|
78733
78750
|
contextualSignature === getSignatureFromDeclaration(func) ? isGenerator ? undefined : returnType :
|
|
78734
|
-
instantiateContextualType(getReturnTypeOfSignature(contextualSignature), func);
|
|
78751
|
+
instantiateContextualType(getReturnTypeOfSignature(contextualSignature), func, /*contextFlags*/ undefined);
|
|
78735
78752
|
if (isGenerator) {
|
|
78736
78753
|
yieldType = getWidenedLiteralLikeTypeForContextualIterationTypeIfNeeded(yieldType, contextualType, 0 /* Yield */, isAsync);
|
|
78737
78754
|
returnType = getWidenedLiteralLikeTypeForContextualIterationTypeIfNeeded(returnType, contextualType, 1 /* Return */, isAsync);
|
|
@@ -78802,7 +78819,7 @@ var ts;
|
|
|
78802
78819
|
nextType = iterationTypes && iterationTypes.nextType;
|
|
78803
78820
|
}
|
|
78804
78821
|
else {
|
|
78805
|
-
nextType = getContextualType(yieldExpression);
|
|
78822
|
+
nextType = getContextualType(yieldExpression, /*contextFlags*/ undefined);
|
|
78806
78823
|
}
|
|
78807
78824
|
if (nextType)
|
|
78808
78825
|
ts.pushIfUnique(nextTypes, nextType);
|
|
@@ -79011,11 +79028,16 @@ var ts;
|
|
|
79011
79028
|
if (isContextSensitive(node)) {
|
|
79012
79029
|
if (contextualSignature) {
|
|
79013
79030
|
var inferenceContext = getInferenceContext(node);
|
|
79031
|
+
var instantiatedContextualSignature = void 0;
|
|
79014
79032
|
if (checkMode && checkMode & 2 /* Inferential */) {
|
|
79015
79033
|
inferFromAnnotatedParameters(signature, contextualSignature, inferenceContext);
|
|
79034
|
+
var restType = getEffectiveRestType(contextualSignature);
|
|
79035
|
+
if (restType && restType.flags & 262144 /* TypeParameter */) {
|
|
79036
|
+
instantiatedContextualSignature = instantiateSignature(contextualSignature, inferenceContext.nonFixingMapper);
|
|
79037
|
+
}
|
|
79016
79038
|
}
|
|
79017
|
-
|
|
79018
|
-
instantiateSignature(contextualSignature, inferenceContext.mapper) : contextualSignature;
|
|
79039
|
+
instantiatedContextualSignature || (instantiatedContextualSignature = inferenceContext ?
|
|
79040
|
+
instantiateSignature(contextualSignature, inferenceContext.mapper) : contextualSignature);
|
|
79019
79041
|
assignContextualParameterTypes(signature, instantiatedContextualSignature);
|
|
79020
79042
|
}
|
|
79021
79043
|
else {
|
|
@@ -80257,7 +80279,7 @@ var ts;
|
|
|
80257
80279
|
type = anyType;
|
|
80258
80280
|
addLazyDiagnostic(function () {
|
|
80259
80281
|
if (noImplicitAny && !ts.expressionResultIsUnused(node)) {
|
|
80260
|
-
var contextualType = getContextualType(node);
|
|
80282
|
+
var contextualType = getContextualType(node, /*contextFlags*/ undefined);
|
|
80261
80283
|
if (!contextualType || isTypeAny(contextualType)) {
|
|
80262
80284
|
error(node, ts.Diagnostics.yield_expression_implicitly_results_in_an_any_type_because_its_containing_generator_lacks_a_return_type_annotation);
|
|
80263
80285
|
}
|
|
@@ -80298,7 +80320,7 @@ var ts;
|
|
|
80298
80320
|
texts.push(span.literal.text);
|
|
80299
80321
|
types.push(isTypeAssignableTo(type, templateConstraintType) ? type : stringType);
|
|
80300
80322
|
}
|
|
80301
|
-
return isConstContext(node) || isTemplateLiteralContext(node) || someType(getContextualType(node) || unknownType, isTemplateLiteralContextualType) ? getTemplateLiteralType(texts, types) : stringType;
|
|
80323
|
+
return isConstContext(node) || isTemplateLiteralContext(node) || someType(getContextualType(node, /*contextFlags*/ undefined) || unknownType, isTemplateLiteralContextualType) ? getTemplateLiteralType(texts, types) : stringType;
|
|
80302
80324
|
}
|
|
80303
80325
|
function isTemplateLiteralContextualType(type) {
|
|
80304
80326
|
return !!(type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */) ||
|
|
@@ -80326,7 +80348,7 @@ var ts;
|
|
|
80326
80348
|
// We strip literal freshness when an appropriate contextual type is present such that contextually typed
|
|
80327
80349
|
// literals always preserve their literal types (otherwise they might widen during type inference). An alternative
|
|
80328
80350
|
// here would be to not mark contextually typed literals as fresh in the first place.
|
|
80329
|
-
var result = maybeTypeOfKind(type, 2944 /* Literal */) && isLiteralOfContextualType(type, instantiateContextualType(contextualType, node)) ?
|
|
80351
|
+
var result = maybeTypeOfKind(type, 2944 /* Literal */) && isLiteralOfContextualType(type, instantiateContextualType(contextualType, node, /*contextFlags*/ undefined)) ?
|
|
80330
80352
|
getRegularTypeOfLiteralType(type) : type;
|
|
80331
80353
|
return result;
|
|
80332
80354
|
}
|
|
@@ -80441,7 +80463,7 @@ var ts;
|
|
|
80441
80463
|
var type = checkExpression(node, checkMode, forceTuple);
|
|
80442
80464
|
return isConstContext(node) || ts.isCommonJsExportedExpression(node) ? getRegularTypeOfLiteralType(type) :
|
|
80443
80465
|
isTypeAssertion(node) ? type :
|
|
80444
|
-
getWidenedLiteralLikeTypeForContextualType(type, instantiateContextualType(arguments.length === 2 ? getContextualType(node) : contextualType, node));
|
|
80466
|
+
getWidenedLiteralLikeTypeForContextualType(type, instantiateContextualType(arguments.length === 2 ? getContextualType(node, /*contextFlags*/ undefined) : contextualType, node, /*contextFlags*/ undefined));
|
|
80445
80467
|
}
|
|
80446
80468
|
function checkPropertyAssignment(node, checkMode) {
|
|
80447
80469
|
// Do not use hasDynamicName here, because that returns false for well known symbols.
|
|
@@ -166118,20 +166140,25 @@ var ts;
|
|
|
166118
166140
|
return this.documentationComment;
|
|
166119
166141
|
};
|
|
166120
166142
|
SymbolObject.prototype.getContextualDocumentationComment = function (context, checker) {
|
|
166121
|
-
|
|
166122
|
-
|
|
166143
|
+
if (context) {
|
|
166144
|
+
if (ts.isGetAccessor(context)) {
|
|
166123
166145
|
if (!this.contextualGetAccessorDocumentationComment) {
|
|
166124
166146
|
this.contextualGetAccessorDocumentationComment = getDocumentationComment(ts.filter(this.declarations, ts.isGetAccessor), checker);
|
|
166125
166147
|
}
|
|
166126
|
-
|
|
166127
|
-
|
|
166148
|
+
if (ts.length(this.contextualGetAccessorDocumentationComment)) {
|
|
166149
|
+
return this.contextualGetAccessorDocumentationComment;
|
|
166150
|
+
}
|
|
166151
|
+
}
|
|
166152
|
+
if (ts.isSetAccessor(context)) {
|
|
166128
166153
|
if (!this.contextualSetAccessorDocumentationComment) {
|
|
166129
166154
|
this.contextualSetAccessorDocumentationComment = getDocumentationComment(ts.filter(this.declarations, ts.isSetAccessor), checker);
|
|
166130
166155
|
}
|
|
166131
|
-
|
|
166132
|
-
|
|
166133
|
-
|
|
166156
|
+
if (ts.length(this.contextualSetAccessorDocumentationComment)) {
|
|
166157
|
+
return this.contextualSetAccessorDocumentationComment;
|
|
166158
|
+
}
|
|
166159
|
+
}
|
|
166134
166160
|
}
|
|
166161
|
+
return this.getDocumentationComment(checker);
|
|
166135
166162
|
};
|
|
166136
166163
|
SymbolObject.prototype.getJsDocTags = function (checker) {
|
|
166137
166164
|
if (this.tags === undefined) {
|
|
@@ -166140,20 +166167,25 @@ var ts;
|
|
|
166140
166167
|
return this.tags;
|
|
166141
166168
|
};
|
|
166142
166169
|
SymbolObject.prototype.getContextualJsDocTags = function (context, checker) {
|
|
166143
|
-
|
|
166144
|
-
|
|
166170
|
+
if (context) {
|
|
166171
|
+
if (ts.isGetAccessor(context)) {
|
|
166145
166172
|
if (!this.contextualGetAccessorTags) {
|
|
166146
166173
|
this.contextualGetAccessorTags = getJsDocTagsOfDeclarations(ts.filter(this.declarations, ts.isGetAccessor), checker);
|
|
166147
166174
|
}
|
|
166148
|
-
|
|
166149
|
-
|
|
166175
|
+
if (ts.length(this.contextualGetAccessorTags)) {
|
|
166176
|
+
return this.contextualGetAccessorTags;
|
|
166177
|
+
}
|
|
166178
|
+
}
|
|
166179
|
+
if (ts.isSetAccessor(context)) {
|
|
166150
166180
|
if (!this.contextualSetAccessorTags) {
|
|
166151
166181
|
this.contextualSetAccessorTags = getJsDocTagsOfDeclarations(ts.filter(this.declarations, ts.isSetAccessor), checker);
|
|
166152
166182
|
}
|
|
166153
|
-
|
|
166154
|
-
|
|
166155
|
-
|
|
166183
|
+
if (ts.length(this.contextualSetAccessorTags)) {
|
|
166184
|
+
return this.contextualSetAccessorTags;
|
|
166185
|
+
}
|
|
166186
|
+
}
|
|
166156
166187
|
}
|
|
166188
|
+
return this.getJsDocTags(checker);
|
|
166157
166189
|
};
|
|
166158
166190
|
return SymbolObject;
|
|
166159
166191
|
}());
|
|
@@ -166904,7 +166936,10 @@ var ts;
|
|
|
166904
166936
|
program = undefined; // TODO: GH#18217
|
|
166905
166937
|
lastTypesRootVersion = typeRootsVersion;
|
|
166906
166938
|
}
|
|
166907
|
-
|
|
166939
|
+
// This array is retained by the program and will be used to determine if the program is up to date,
|
|
166940
|
+
// so we need to make a copy in case the host mutates the underlying array - otherwise it would look
|
|
166941
|
+
// like every program always has the host's current list of root files.
|
|
166942
|
+
var rootFileNames = host.getScriptFileNames().slice();
|
|
166908
166943
|
// Get a fresh cache of the host information
|
|
166909
166944
|
var newSettings = host.getCompilationSettings() || getDefaultCompilerOptions();
|
|
166910
166945
|
var hasInvalidatedResolution = host.hasInvalidatedResolution || ts.returnFalse;
|