typescript 4.8.0-dev.20220706 → 4.8.0-dev.20220707
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/tsc.js +113 -87
- package/lib/tsserver.js +144 -109
- package/lib/tsserverlibrary.d.ts +6 -0
- package/lib/tsserverlibrary.js +144 -109
- package/lib/typescript.d.ts +6 -0
- package/lib/typescript.js +144 -109
- package/lib/typescriptServices.d.ts +6 -0
- package/lib/typescriptServices.js +144 -109
- package/lib/typingsInstaller.js +116 -94
- package/package.json +1 -1
package/lib/typingsInstaller.js
CHANGED
|
@@ -89,7 +89,7 @@ var ts;
|
|
|
89
89
|
// The following is baselined as a literal template type without intervention
|
|
90
90
|
/** The version of the TypeScript compiler release */
|
|
91
91
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
92
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
92
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220707";
|
|
93
93
|
/* @internal */
|
|
94
94
|
var Comparison;
|
|
95
95
|
(function (Comparison) {
|
|
@@ -2774,6 +2774,22 @@ var ts;
|
|
|
2774
2774
|
return formatEnum(flags, ts.FlowFlags, /*isFlags*/ true);
|
|
2775
2775
|
}
|
|
2776
2776
|
Debug.formatFlowFlags = formatFlowFlags;
|
|
2777
|
+
function formatRelationComparisonResult(result) {
|
|
2778
|
+
return formatEnum(result, ts.RelationComparisonResult, /*isFlags*/ true);
|
|
2779
|
+
}
|
|
2780
|
+
Debug.formatRelationComparisonResult = formatRelationComparisonResult;
|
|
2781
|
+
function formatCheckMode(mode) {
|
|
2782
|
+
return formatEnum(mode, ts.CheckMode, /*isFlags*/ true);
|
|
2783
|
+
}
|
|
2784
|
+
Debug.formatCheckMode = formatCheckMode;
|
|
2785
|
+
function formatSignatureCheckMode(mode) {
|
|
2786
|
+
return formatEnum(mode, ts.SignatureCheckMode, /*isFlags*/ true);
|
|
2787
|
+
}
|
|
2788
|
+
Debug.formatSignatureCheckMode = formatSignatureCheckMode;
|
|
2789
|
+
function formatTypeFacts(facts) {
|
|
2790
|
+
return formatEnum(facts, ts.TypeFacts, /*isFlags*/ true);
|
|
2791
|
+
}
|
|
2792
|
+
Debug.formatTypeFacts = formatTypeFacts;
|
|
2777
2793
|
var isDebugInfoEnabled = false;
|
|
2778
2794
|
var extendedDebugModule;
|
|
2779
2795
|
function extendedDebug() {
|
|
@@ -19511,7 +19527,8 @@ var ts;
|
|
|
19511
19527
|
function getDeclarationModifierFlagsFromSymbol(s, isWrite) {
|
|
19512
19528
|
if (isWrite === void 0) { isWrite = false; }
|
|
19513
19529
|
if (s.valueDeclaration) {
|
|
19514
|
-
var declaration = (isWrite && s.declarations && ts.find(s.declarations,
|
|
19530
|
+
var declaration = (isWrite && s.declarations && ts.find(s.declarations, ts.isSetAccessorDeclaration))
|
|
19531
|
+
|| (s.flags & 32768 /* GetAccessor */ && ts.find(s.declarations, ts.isGetAccessorDeclaration)) || s.valueDeclaration;
|
|
19515
19532
|
var flags = ts.getCombinedModifierFlags(declaration);
|
|
19516
19533
|
return s.parent && s.parent.flags & 32 /* Class */ ? flags : flags & ~28 /* AccessibilityModifier */;
|
|
19517
19534
|
}
|
|
@@ -20186,7 +20203,7 @@ var ts;
|
|
|
20186
20203
|
// Excludes declaration files - they still require an explicit `export {}` or the like
|
|
20187
20204
|
// for back compat purposes. The only non-declaration files _not_ forced to be a module are `.js` files
|
|
20188
20205
|
// that aren't esm-mode (meaning not in a `type: module` scope).
|
|
20189
|
-
return (file.impliedNodeFormat === ts.ModuleKind.ESNext || (ts.fileExtensionIsOneOf(file.fileName, [".cjs" /* Cjs */, ".cts" /* Cts */]))) && !file.isDeclarationFile ? true : undefined;
|
|
20206
|
+
return (file.impliedNodeFormat === ts.ModuleKind.ESNext || (ts.fileExtensionIsOneOf(file.fileName, [".cjs" /* Cjs */, ".cts" /* Cts */, ".mjs" /* Mjs */, ".mts" /* Mts */]))) && !file.isDeclarationFile ? true : undefined;
|
|
20190
20207
|
}
|
|
20191
20208
|
function getSetExternalModuleIndicator(options) {
|
|
20192
20209
|
// TODO: Should this callback be cached?
|
|
@@ -20209,10 +20226,7 @@ var ts;
|
|
|
20209
20226
|
if (options.jsx === 4 /* ReactJSX */ || options.jsx === 5 /* ReactJSXDev */) {
|
|
20210
20227
|
checks.push(isFileModuleFromUsingJSXTag);
|
|
20211
20228
|
}
|
|
20212
|
-
|
|
20213
|
-
if (moduleKind === ts.ModuleKind.Node16 || moduleKind === ts.ModuleKind.NodeNext) {
|
|
20214
|
-
checks.push(isFileForcedToBeModuleByFormat);
|
|
20215
|
-
}
|
|
20229
|
+
checks.push(isFileForcedToBeModuleByFormat);
|
|
20216
20230
|
var combined_1 = ts.or.apply(void 0, checks);
|
|
20217
20231
|
var callback = function (file) { return void (file.externalModuleIndicator = combined_1(file)); };
|
|
20218
20232
|
return callback;
|
|
@@ -33932,10 +33946,10 @@ var ts;
|
|
|
33932
33946
|
var hasJSDoc = hasPrecedingJSDocComment();
|
|
33933
33947
|
var modifiers = parseModifiers();
|
|
33934
33948
|
if (parseContextualModifier(136 /* GetKeyword */)) {
|
|
33935
|
-
return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 172 /* GetAccessor */);
|
|
33949
|
+
return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 172 /* GetAccessor */, 4 /* Type */);
|
|
33936
33950
|
}
|
|
33937
33951
|
if (parseContextualModifier(149 /* SetKeyword */)) {
|
|
33938
|
-
return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 173 /* SetAccessor */);
|
|
33952
|
+
return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 173 /* SetAccessor */, 4 /* Type */);
|
|
33939
33953
|
}
|
|
33940
33954
|
if (isIndexSignature()) {
|
|
33941
33955
|
return parseIndexSignatureDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers);
|
|
@@ -35981,10 +35995,10 @@ var ts;
|
|
|
35981
35995
|
var decorators = parseDecorators();
|
|
35982
35996
|
var modifiers = parseModifiers();
|
|
35983
35997
|
if (parseContextualModifier(136 /* GetKeyword */)) {
|
|
35984
|
-
return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172 /* GetAccessor */);
|
|
35998
|
+
return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172 /* GetAccessor */, 0 /* None */);
|
|
35985
35999
|
}
|
|
35986
36000
|
if (parseContextualModifier(149 /* SetKeyword */)) {
|
|
35987
|
-
return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 173 /* SetAccessor */);
|
|
36001
|
+
return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 173 /* SetAccessor */, 0 /* None */);
|
|
35988
36002
|
}
|
|
35989
36003
|
var asteriskToken = parseOptionalToken(41 /* AsteriskToken */);
|
|
35990
36004
|
var tokenIsIdentifier = isIdentifier();
|
|
@@ -36676,9 +36690,15 @@ var ts;
|
|
|
36676
36690
|
return !scanner.hasPrecedingLineBreak() && (isIdentifier() || token() === 10 /* StringLiteral */);
|
|
36677
36691
|
}
|
|
36678
36692
|
function parseFunctionBlockOrSemicolon(flags, diagnosticMessage) {
|
|
36679
|
-
if (token() !== 18 /* OpenBraceToken */
|
|
36680
|
-
|
|
36681
|
-
|
|
36693
|
+
if (token() !== 18 /* OpenBraceToken */) {
|
|
36694
|
+
if (flags & 4 /* Type */) {
|
|
36695
|
+
parseTypeMemberSemicolon();
|
|
36696
|
+
return;
|
|
36697
|
+
}
|
|
36698
|
+
if (canParseSemicolon()) {
|
|
36699
|
+
parseSemicolon();
|
|
36700
|
+
return;
|
|
36701
|
+
}
|
|
36682
36702
|
}
|
|
36683
36703
|
return parseFunctionBlock(flags, diagnosticMessage);
|
|
36684
36704
|
}
|
|
@@ -36882,12 +36902,12 @@ var ts;
|
|
|
36882
36902
|
}
|
|
36883
36903
|
return parsePropertyDeclaration(pos, hasJSDoc, decorators, modifiers, name, questionToken);
|
|
36884
36904
|
}
|
|
36885
|
-
function parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, kind) {
|
|
36905
|
+
function parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, kind, flags) {
|
|
36886
36906
|
var name = parsePropertyName();
|
|
36887
36907
|
var typeParameters = parseTypeParameters();
|
|
36888
36908
|
var parameters = parseParameters(0 /* None */);
|
|
36889
36909
|
var type = parseReturnType(58 /* ColonToken */, /*isType*/ false);
|
|
36890
|
-
var body = parseFunctionBlockOrSemicolon(
|
|
36910
|
+
var body = parseFunctionBlockOrSemicolon(flags);
|
|
36891
36911
|
var node = kind === 172 /* GetAccessor */
|
|
36892
36912
|
? factory.createGetAccessorDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, parameters, type, body)
|
|
36893
36913
|
: factory.createSetAccessorDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, parameters, body);
|
|
@@ -37074,10 +37094,10 @@ var ts;
|
|
|
37074
37094
|
return parseClassStaticBlockDeclaration(pos, hasJSDoc, decorators, modifiers);
|
|
37075
37095
|
}
|
|
37076
37096
|
if (parseContextualModifier(136 /* GetKeyword */)) {
|
|
37077
|
-
return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172 /* GetAccessor */);
|
|
37097
|
+
return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172 /* GetAccessor */, 0 /* None */);
|
|
37078
37098
|
}
|
|
37079
37099
|
if (parseContextualModifier(149 /* SetKeyword */)) {
|
|
37080
|
-
return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 173 /* SetAccessor */);
|
|
37100
|
+
return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 173 /* SetAccessor */, 0 /* None */);
|
|
37081
37101
|
}
|
|
37082
37102
|
if (token() === 134 /* ConstructorKeyword */ || token() === 10 /* StringLiteral */) {
|
|
37083
37103
|
var constructorDeclaration = tryParseConstructorDeclaration(pos, hasJSDoc, decorators, modifiers);
|
|
@@ -48481,7 +48501,7 @@ var ts;
|
|
|
48481
48501
|
// Masks
|
|
48482
48502
|
TypeFacts[TypeFacts["OrFactsMask"] = 8256] = "OrFactsMask";
|
|
48483
48503
|
TypeFacts[TypeFacts["AndFactsMask"] = 134209471] = "AndFactsMask";
|
|
48484
|
-
})(TypeFacts || (TypeFacts = {}));
|
|
48504
|
+
})(TypeFacts = ts.TypeFacts || (ts.TypeFacts = {}));
|
|
48485
48505
|
var typeofNEFacts = new ts.Map(ts.getEntries({
|
|
48486
48506
|
string: 256 /* TypeofNEString */,
|
|
48487
48507
|
number: 512 /* TypeofNENumber */,
|
|
@@ -48516,7 +48536,7 @@ var ts;
|
|
|
48516
48536
|
CheckMode[CheckMode["RestBindingElement"] = 64] = "RestBindingElement";
|
|
48517
48537
|
// e.g. in `const { a, ...rest } = foo`, when checking the type of `foo` to determine the type of `rest`,
|
|
48518
48538
|
// we need to preserve generic types instead of substituting them for constraints
|
|
48519
|
-
})(CheckMode || (CheckMode = {}));
|
|
48539
|
+
})(CheckMode = ts.CheckMode || (ts.CheckMode = {}));
|
|
48520
48540
|
var SignatureCheckMode;
|
|
48521
48541
|
(function (SignatureCheckMode) {
|
|
48522
48542
|
SignatureCheckMode[SignatureCheckMode["BivariantCallback"] = 1] = "BivariantCallback";
|
|
@@ -48524,7 +48544,7 @@ var ts;
|
|
|
48524
48544
|
SignatureCheckMode[SignatureCheckMode["IgnoreReturnTypes"] = 4] = "IgnoreReturnTypes";
|
|
48525
48545
|
SignatureCheckMode[SignatureCheckMode["StrictArity"] = 8] = "StrictArity";
|
|
48526
48546
|
SignatureCheckMode[SignatureCheckMode["Callback"] = 3] = "Callback";
|
|
48527
|
-
})(SignatureCheckMode || (SignatureCheckMode = {}));
|
|
48547
|
+
})(SignatureCheckMode = ts.SignatureCheckMode || (ts.SignatureCheckMode = {}));
|
|
48528
48548
|
var IntersectionState;
|
|
48529
48549
|
(function (IntersectionState) {
|
|
48530
48550
|
IntersectionState[IntersectionState["None"] = 0] = "None";
|
|
@@ -48876,7 +48896,7 @@ var ts;
|
|
|
48876
48896
|
},
|
|
48877
48897
|
getContextualTypeForObjectLiteralElement: function (nodeIn) {
|
|
48878
48898
|
var node = ts.getParseTreeNode(nodeIn, ts.isObjectLiteralElementLike);
|
|
48879
|
-
return node ? getContextualTypeForObjectLiteralElement(node) : undefined;
|
|
48899
|
+
return node ? getContextualTypeForObjectLiteralElement(node, /*contextFlags*/ undefined) : undefined;
|
|
48880
48900
|
},
|
|
48881
48901
|
getContextualTypeForArgumentAtIndex: function (nodeIn, argIndex) {
|
|
48882
48902
|
var node = ts.getParseTreeNode(nodeIn, ts.isCallLikeExpression);
|
|
@@ -48884,7 +48904,7 @@ var ts;
|
|
|
48884
48904
|
},
|
|
48885
48905
|
getContextualTypeForJsxAttribute: function (nodeIn) {
|
|
48886
48906
|
var node = ts.getParseTreeNode(nodeIn, ts.isJsxAttributeLike);
|
|
48887
|
-
return node && getContextualTypeForJsxAttribute(node);
|
|
48907
|
+
return node && getContextualTypeForJsxAttribute(node, /*contextFlags*/ undefined);
|
|
48888
48908
|
},
|
|
48889
48909
|
isContextSensitive: isContextSensitive,
|
|
48890
48910
|
getTypeOfPropertyOfContextualType: getTypeOfPropertyOfContextualType,
|
|
@@ -52607,13 +52627,25 @@ var ts;
|
|
|
52607
52627
|
&& isDeclarationVisible(declaration.parent)) {
|
|
52608
52628
|
return addVisibleAlias(declaration, declaration);
|
|
52609
52629
|
}
|
|
52610
|
-
else if (
|
|
52611
|
-
&& ts.
|
|
52612
|
-
|
|
52613
|
-
|
|
52614
|
-
|
|
52615
|
-
|
|
52616
|
-
|
|
52630
|
+
else if (ts.isBindingElement(declaration)) {
|
|
52631
|
+
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
|
|
52632
|
+
&& ts.isVariableDeclaration(declaration.parent.parent)
|
|
52633
|
+
&& ((_b = declaration.parent.parent.parent) === null || _b === void 0 ? void 0 : _b.parent) && ts.isVariableStatement(declaration.parent.parent.parent.parent)
|
|
52634
|
+
&& !ts.hasSyntacticModifier(declaration.parent.parent.parent.parent, 1 /* Export */)
|
|
52635
|
+
&& declaration.parent.parent.parent.parent.parent // check if the thing containing the variable statement is visible (ie, the file)
|
|
52636
|
+
&& isDeclarationVisible(declaration.parent.parent.parent.parent.parent)) {
|
|
52637
|
+
return addVisibleAlias(declaration, declaration.parent.parent.parent.parent);
|
|
52638
|
+
}
|
|
52639
|
+
else if (symbol.flags & 2 /* BlockScopedVariable */) {
|
|
52640
|
+
var variableStatement = ts.findAncestor(declaration, ts.isVariableStatement);
|
|
52641
|
+
if (ts.hasSyntacticModifier(variableStatement, 1 /* Export */)) {
|
|
52642
|
+
return true;
|
|
52643
|
+
}
|
|
52644
|
+
if (!isDeclarationVisible(variableStatement.parent)) {
|
|
52645
|
+
return false;
|
|
52646
|
+
}
|
|
52647
|
+
return addVisibleAlias(declaration, variableStatement);
|
|
52648
|
+
}
|
|
52617
52649
|
}
|
|
52618
52650
|
// Declaration is not visible
|
|
52619
52651
|
return false;
|
|
@@ -53134,6 +53166,10 @@ var ts;
|
|
|
53134
53166
|
}
|
|
53135
53167
|
return typeToTypeNodeHelper(type, context);
|
|
53136
53168
|
}
|
|
53169
|
+
function isHomomorphicMappedTypeWithNonHomomorphicInstantiation(type) {
|
|
53170
|
+
return isMappedTypeWithKeyofConstraintDeclaration(type)
|
|
53171
|
+
&& !(getModifiersTypeFromMappedType(type).flags & 262144 /* TypeParameter */);
|
|
53172
|
+
}
|
|
53137
53173
|
function createMappedTypeNodeFromType(type) {
|
|
53138
53174
|
ts.Debug.assert(!!(type.flags & 524288 /* Object */));
|
|
53139
53175
|
var readonlyToken = type.declaration.readonlyToken ? ts.factory.createToken(type.declaration.readonlyToken.kind) : undefined;
|
|
@@ -53143,7 +53179,7 @@ var ts;
|
|
|
53143
53179
|
if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
|
|
53144
53180
|
// We have a { [P in keyof T]: X }
|
|
53145
53181
|
// We do this to ensure we retain the toplevel keyof-ness of the type which may be lost due to keyof distribution during `getConstraintTypeFromMappedType`
|
|
53146
|
-
if (
|
|
53182
|
+
if (isHomomorphicMappedTypeWithNonHomomorphicInstantiation(type) && context.flags & 4 /* GenerateNamesForShadowedTypeParams */) {
|
|
53147
53183
|
var newParam = createTypeParameter(createSymbol(262144 /* TypeParameter */, "T"));
|
|
53148
53184
|
var name = typeParameterToName(newParam, context);
|
|
53149
53185
|
newTypeVariable = ts.factory.createTypeReferenceNode(name);
|
|
@@ -53159,11 +53195,12 @@ var ts;
|
|
|
53159
53195
|
var mappedTypeNode = ts.factory.createMappedTypeNode(readonlyToken, typeParameterNode, nameTypeNode, questionToken, templateTypeNode, /*members*/ undefined);
|
|
53160
53196
|
context.approximateLength += 10;
|
|
53161
53197
|
var result = ts.setEmitFlags(mappedTypeNode, 1 /* SingleLine */);
|
|
53162
|
-
if (
|
|
53198
|
+
if (isHomomorphicMappedTypeWithNonHomomorphicInstantiation(type) && context.flags & 4 /* GenerateNamesForShadowedTypeParams */) {
|
|
53163
53199
|
// homomorphic mapped type with a non-homomorphic naive inlining
|
|
53164
53200
|
// wrap it with a conditional like `SomeModifiersType extends infer U ? {..the mapped type...} : never` to ensure the resulting
|
|
53165
53201
|
// type stays homomorphic
|
|
53166
|
-
|
|
53202
|
+
var originalConstraint = instantiateType(getConstraintOfTypeParameter(getTypeFromTypeNode(type.declaration.typeParameter.constraint.type)) || unknownType, type.mapper);
|
|
53203
|
+
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 */));
|
|
53167
53204
|
}
|
|
53168
53205
|
return result;
|
|
53169
53206
|
}
|
|
@@ -66113,13 +66150,20 @@ var ts;
|
|
|
66113
66150
|
return result;
|
|
66114
66151
|
}
|
|
66115
66152
|
function structuredTypeRelatedTo(source, target, reportErrors, intersectionState) {
|
|
66153
|
+
var saveErrorInfo = captureErrorCalculationState();
|
|
66154
|
+
var result = structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState, saveErrorInfo);
|
|
66155
|
+
if (result) {
|
|
66156
|
+
resetErrorInfo(saveErrorInfo);
|
|
66157
|
+
}
|
|
66158
|
+
return result;
|
|
66159
|
+
}
|
|
66160
|
+
function structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState, saveErrorInfo) {
|
|
66116
66161
|
if (intersectionState & 4 /* PropertyCheck */) {
|
|
66117
66162
|
return propertiesRelatedTo(source, target, reportErrors, /*excludedProperties*/ undefined, 0 /* None */);
|
|
66118
66163
|
}
|
|
66119
66164
|
var result;
|
|
66120
66165
|
var originalErrorInfo;
|
|
66121
66166
|
var varianceCheckFailed = false;
|
|
66122
|
-
var saveErrorInfo = captureErrorCalculationState();
|
|
66123
66167
|
var sourceFlags = source.flags;
|
|
66124
66168
|
var targetFlags = target.flags;
|
|
66125
66169
|
if (relation === identityRelation) {
|
|
@@ -66183,7 +66227,6 @@ var ts;
|
|
|
66183
66227
|
if (constraint && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself
|
|
66184
66228
|
// TODO: Stack errors so we get a pyramid for the "normal" comparison above, _and_ a second for this
|
|
66185
66229
|
if (result = isRelatedTo(constraint, target, 1 /* Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState)) {
|
|
66186
|
-
resetErrorInfo(saveErrorInfo);
|
|
66187
66230
|
return result;
|
|
66188
66231
|
}
|
|
66189
66232
|
}
|
|
@@ -66308,7 +66351,6 @@ var ts;
|
|
|
66308
66351
|
result &= isRelatedTo(source.indexType, target.indexType, 3 /* Both */, reportErrors);
|
|
66309
66352
|
}
|
|
66310
66353
|
if (result) {
|
|
66311
|
-
resetErrorInfo(saveErrorInfo);
|
|
66312
66354
|
return result;
|
|
66313
66355
|
}
|
|
66314
66356
|
if (reportErrors) {
|
|
@@ -66411,7 +66453,6 @@ var ts;
|
|
|
66411
66453
|
// If we reach 10 levels of nesting for the same conditional type, assume it is an infinitely expanding recursive
|
|
66412
66454
|
// conditional type and bail out with a Ternary.Maybe result.
|
|
66413
66455
|
if (isDeeplyNestedType(target, targetStack, targetDepth, 10)) {
|
|
66414
|
-
resetErrorInfo(saveErrorInfo);
|
|
66415
66456
|
return 3 /* Maybe */;
|
|
66416
66457
|
}
|
|
66417
66458
|
var c = target;
|
|
@@ -66426,7 +66467,6 @@ var ts;
|
|
|
66426
66467
|
if (result = skipTrue ? -1 /* True */ : isRelatedTo(source, getTrueTypeFromConditionalType(c), 2 /* Target */, /*reportErrors*/ false)) {
|
|
66427
66468
|
result &= skipFalse ? -1 /* True */ : isRelatedTo(source, getFalseTypeFromConditionalType(c), 2 /* Target */, /*reportErrors*/ false);
|
|
66428
66469
|
if (result) {
|
|
66429
|
-
resetErrorInfo(saveErrorInfo);
|
|
66430
66470
|
return result;
|
|
66431
66471
|
}
|
|
66432
66472
|
}
|
|
@@ -66458,12 +66498,10 @@ var ts;
|
|
|
66458
66498
|
var constraint = getConstraintOfType(source) || unknownType;
|
|
66459
66499
|
// 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
|
|
66460
66500
|
if (result = isRelatedTo(constraint, target, 1 /* Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState)) {
|
|
66461
|
-
resetErrorInfo(saveErrorInfo);
|
|
66462
66501
|
return result;
|
|
66463
66502
|
}
|
|
66464
66503
|
// slower, fuller, this-instantiated check (necessary when comparing raw `this` types from base classes), see `subclassWithPolymorphicThisIsAssignable.ts` test for example
|
|
66465
66504
|
else if (result = isRelatedTo(getTypeWithThisArgument(constraint, source), target, 1 /* Source */, reportErrors && constraint !== unknownType && !(targetFlags & sourceFlags & 262144 /* TypeParameter */), /*headMessage*/ undefined, intersectionState)) {
|
|
66466
|
-
resetErrorInfo(saveErrorInfo);
|
|
66467
66505
|
return result;
|
|
66468
66506
|
}
|
|
66469
66507
|
if (isMappedTypeGenericIndexedAccess(source)) {
|
|
@@ -66472,7 +66510,6 @@ var ts;
|
|
|
66472
66510
|
var indexConstraint = getConstraintOfType(source.indexType);
|
|
66473
66511
|
if (indexConstraint) {
|
|
66474
66512
|
if (result = isRelatedTo(getIndexedAccessType(source.objectType, indexConstraint), target, 1 /* Source */, reportErrors)) {
|
|
66475
|
-
resetErrorInfo(saveErrorInfo);
|
|
66476
66513
|
return result;
|
|
66477
66514
|
}
|
|
66478
66515
|
}
|
|
@@ -66481,7 +66518,6 @@ var ts;
|
|
|
66481
66518
|
}
|
|
66482
66519
|
else if (sourceFlags & 4194304 /* Index */) {
|
|
66483
66520
|
if (result = isRelatedTo(keyofConstraintType, target, 1 /* Source */, reportErrors)) {
|
|
66484
|
-
resetErrorInfo(saveErrorInfo);
|
|
66485
66521
|
return result;
|
|
66486
66522
|
}
|
|
66487
66523
|
}
|
|
@@ -66489,7 +66525,6 @@ var ts;
|
|
|
66489
66525
|
if (!(targetFlags & 134217728 /* TemplateLiteral */)) {
|
|
66490
66526
|
var constraint = getBaseConstraintOfType(source);
|
|
66491
66527
|
if (constraint && constraint !== source && (result = isRelatedTo(constraint, target, 1 /* Source */, reportErrors))) {
|
|
66492
|
-
resetErrorInfo(saveErrorInfo);
|
|
66493
66528
|
return result;
|
|
66494
66529
|
}
|
|
66495
66530
|
}
|
|
@@ -66500,14 +66535,12 @@ var ts;
|
|
|
66500
66535
|
return 0 /* False */;
|
|
66501
66536
|
}
|
|
66502
66537
|
if (result = isRelatedTo(source.type, target.type, 3 /* Both */, reportErrors)) {
|
|
66503
|
-
resetErrorInfo(saveErrorInfo);
|
|
66504
66538
|
return result;
|
|
66505
66539
|
}
|
|
66506
66540
|
}
|
|
66507
66541
|
else {
|
|
66508
66542
|
var constraint = getBaseConstraintOfType(source);
|
|
66509
66543
|
if (constraint && (result = isRelatedTo(constraint, target, 1 /* Source */, reportErrors))) {
|
|
66510
|
-
resetErrorInfo(saveErrorInfo);
|
|
66511
66544
|
return result;
|
|
66512
66545
|
}
|
|
66513
66546
|
}
|
|
@@ -66516,7 +66549,6 @@ var ts;
|
|
|
66516
66549
|
// If we reach 10 levels of nesting for the same conditional type, assume it is an infinitely expanding recursive
|
|
66517
66550
|
// conditional type and bail out with a Ternary.Maybe result.
|
|
66518
66551
|
if (isDeeplyNestedType(source, sourceStack, sourceDepth, 10)) {
|
|
66519
|
-
resetErrorInfo(saveErrorInfo);
|
|
66520
66552
|
return 3 /* Maybe */;
|
|
66521
66553
|
}
|
|
66522
66554
|
if (targetFlags & 16777216 /* Conditional */) {
|
|
@@ -66539,7 +66571,6 @@ var ts;
|
|
|
66539
66571
|
result &= isRelatedTo(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target), 3 /* Both */, reportErrors);
|
|
66540
66572
|
}
|
|
66541
66573
|
if (result) {
|
|
66542
|
-
resetErrorInfo(saveErrorInfo);
|
|
66543
66574
|
return result;
|
|
66544
66575
|
}
|
|
66545
66576
|
}
|
|
@@ -66550,7 +66581,6 @@ var ts;
|
|
|
66550
66581
|
var distributiveConstraint = hasNonCircularBaseConstraint(source) ? getConstraintOfDistributiveConditionalType(source) : undefined;
|
|
66551
66582
|
if (distributiveConstraint) {
|
|
66552
66583
|
if (result = isRelatedTo(distributiveConstraint, target, 1 /* Source */, reportErrors)) {
|
|
66553
|
-
resetErrorInfo(saveErrorInfo);
|
|
66554
66584
|
return result;
|
|
66555
66585
|
}
|
|
66556
66586
|
}
|
|
@@ -66560,7 +66590,6 @@ var ts;
|
|
|
66560
66590
|
var defaultConstraint = getDefaultConstraintOfConditionalType(source);
|
|
66561
66591
|
if (defaultConstraint) {
|
|
66562
66592
|
if (result = isRelatedTo(defaultConstraint, target, 1 /* Source */, reportErrors)) {
|
|
66563
|
-
resetErrorInfo(saveErrorInfo);
|
|
66564
66593
|
return result;
|
|
66565
66594
|
}
|
|
66566
66595
|
}
|
|
@@ -66573,7 +66602,6 @@ var ts;
|
|
|
66573
66602
|
if (isGenericMappedType(target)) {
|
|
66574
66603
|
if (isGenericMappedType(source)) {
|
|
66575
66604
|
if (result = mappedTypeRelatedTo(source, target, reportErrors)) {
|
|
66576
|
-
resetErrorInfo(saveErrorInfo);
|
|
66577
66605
|
return result;
|
|
66578
66606
|
}
|
|
66579
66607
|
}
|
|
@@ -72094,7 +72122,7 @@ var ts;
|
|
|
72094
72122
|
!((ts.isJsxOpeningElement(node.parent) || ts.isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) &&
|
|
72095
72123
|
(checkMode && checkMode & 64 /* RestBindingElement */ ?
|
|
72096
72124
|
getContextualType(node, 8 /* SkipBindingPatterns */)
|
|
72097
|
-
: getContextualType(node));
|
|
72125
|
+
: getContextualType(node, /*contextFlags*/ undefined));
|
|
72098
72126
|
return contextualType && !isGenericType(contextualType);
|
|
72099
72127
|
}
|
|
72100
72128
|
function getNarrowableTypeForReference(type, reference, checkMode) {
|
|
@@ -72958,7 +72986,7 @@ var ts;
|
|
|
72958
72986
|
// We have an object literal method. Check if the containing object literal has a contextual type
|
|
72959
72987
|
// that includes a ThisType<T>. If so, T is the contextual type for 'this'. We continue looking in
|
|
72960
72988
|
// any directly enclosing object literals.
|
|
72961
|
-
var contextualType = getApparentTypeOfContextualType(containingLiteral);
|
|
72989
|
+
var contextualType = getApparentTypeOfContextualType(containingLiteral, /*contextFlags*/ undefined);
|
|
72962
72990
|
var literal = containingLiteral;
|
|
72963
72991
|
var type = contextualType;
|
|
72964
72992
|
while (type) {
|
|
@@ -72970,7 +72998,7 @@ var ts;
|
|
|
72970
72998
|
break;
|
|
72971
72999
|
}
|
|
72972
73000
|
literal = literal.parent.parent;
|
|
72973
|
-
type = getApparentTypeOfContextualType(literal);
|
|
73001
|
+
type = getApparentTypeOfContextualType(literal, /*contextFlags*/ undefined);
|
|
72974
73002
|
}
|
|
72975
73003
|
// There was no contextual ThisType<T> for the containing object literal, so the contextual type
|
|
72976
73004
|
// for 'this' is the non-null form of the contextual type for the containing object literal or
|
|
@@ -73027,7 +73055,7 @@ var ts;
|
|
|
73027
73055
|
tryGetTypeAtPosition(contextualSignature, index);
|
|
73028
73056
|
}
|
|
73029
73057
|
}
|
|
73030
|
-
function getContextualTypeForVariableLikeDeclaration(declaration) {
|
|
73058
|
+
function getContextualTypeForVariableLikeDeclaration(declaration, contextFlags) {
|
|
73031
73059
|
var typeNode = ts.getEffectiveTypeAnnotationNode(declaration);
|
|
73032
73060
|
if (typeNode) {
|
|
73033
73061
|
return getTypeFromTypeNode(typeNode);
|
|
@@ -73036,18 +73064,18 @@ var ts;
|
|
|
73036
73064
|
case 164 /* Parameter */:
|
|
73037
73065
|
return getContextuallyTypedParameterType(declaration);
|
|
73038
73066
|
case 203 /* BindingElement */:
|
|
73039
|
-
return getContextualTypeForBindingElement(declaration);
|
|
73067
|
+
return getContextualTypeForBindingElement(declaration, contextFlags);
|
|
73040
73068
|
case 167 /* PropertyDeclaration */:
|
|
73041
73069
|
if (ts.isStatic(declaration)) {
|
|
73042
|
-
return getContextualTypeForStaticPropertyDeclaration(declaration);
|
|
73070
|
+
return getContextualTypeForStaticPropertyDeclaration(declaration, contextFlags);
|
|
73043
73071
|
}
|
|
73044
73072
|
// By default, do nothing and return undefined - only the above cases have context implied by a parent
|
|
73045
73073
|
}
|
|
73046
73074
|
}
|
|
73047
|
-
function getContextualTypeForBindingElement(declaration) {
|
|
73075
|
+
function getContextualTypeForBindingElement(declaration, contextFlags) {
|
|
73048
73076
|
var parent = declaration.parent.parent;
|
|
73049
73077
|
var name = declaration.propertyName || declaration.name;
|
|
73050
|
-
var parentType = getContextualTypeForVariableLikeDeclaration(parent) ||
|
|
73078
|
+
var parentType = getContextualTypeForVariableLikeDeclaration(parent, contextFlags) ||
|
|
73051
73079
|
parent.kind !== 203 /* BindingElement */ && parent.initializer && checkDeclarationInitializer(parent, declaration.dotDotDotToken ? 64 /* RestBindingElement */ : 0 /* Normal */);
|
|
73052
73080
|
if (!parentType || ts.isBindingPattern(name) || ts.isComputedNonLiteralName(name))
|
|
73053
73081
|
return undefined;
|
|
@@ -73063,8 +73091,8 @@ var ts;
|
|
|
73063
73091
|
return getTypeOfPropertyOfType(parentType, text);
|
|
73064
73092
|
}
|
|
73065
73093
|
}
|
|
73066
|
-
function getContextualTypeForStaticPropertyDeclaration(declaration) {
|
|
73067
|
-
var parentType = ts.isExpression(declaration.parent) && getContextualType(declaration.parent);
|
|
73094
|
+
function getContextualTypeForStaticPropertyDeclaration(declaration, contextFlags) {
|
|
73095
|
+
var parentType = ts.isExpression(declaration.parent) && getContextualType(declaration.parent, contextFlags);
|
|
73068
73096
|
if (!parentType)
|
|
73069
73097
|
return undefined;
|
|
73070
73098
|
return getTypeOfPropertyOfContextualType(parentType, getSymbolOfNode(declaration).escapedName);
|
|
@@ -73080,7 +73108,7 @@ var ts;
|
|
|
73080
73108
|
function getContextualTypeForInitializerExpression(node, contextFlags) {
|
|
73081
73109
|
var declaration = node.parent;
|
|
73082
73110
|
if (ts.hasInitializer(declaration) && node === declaration.initializer) {
|
|
73083
|
-
var result = getContextualTypeForVariableLikeDeclaration(declaration);
|
|
73111
|
+
var result = getContextualTypeForVariableLikeDeclaration(declaration, contextFlags);
|
|
73084
73112
|
if (result) {
|
|
73085
73113
|
return result;
|
|
73086
73114
|
}
|
|
@@ -73090,10 +73118,10 @@ var ts;
|
|
|
73090
73118
|
}
|
|
73091
73119
|
return undefined;
|
|
73092
73120
|
}
|
|
73093
|
-
function getContextualTypeForReturnExpression(node) {
|
|
73121
|
+
function getContextualTypeForReturnExpression(node, contextFlags) {
|
|
73094
73122
|
var func = ts.getContainingFunction(node);
|
|
73095
73123
|
if (func) {
|
|
73096
|
-
var contextualReturnType = getContextualReturnType(func);
|
|
73124
|
+
var contextualReturnType = getContextualReturnType(func, contextFlags);
|
|
73097
73125
|
if (contextualReturnType) {
|
|
73098
73126
|
var functionFlags = ts.getFunctionFlags(func);
|
|
73099
73127
|
if (functionFlags & 1 /* Generator */) { // Generator or AsyncGenerator function
|
|
@@ -73123,11 +73151,11 @@ var ts;
|
|
|
73123
73151
|
}
|
|
73124
73152
|
return undefined;
|
|
73125
73153
|
}
|
|
73126
|
-
function getContextualTypeForYieldOperand(node) {
|
|
73154
|
+
function getContextualTypeForYieldOperand(node, contextFlags) {
|
|
73127
73155
|
var func = ts.getContainingFunction(node);
|
|
73128
73156
|
if (func) {
|
|
73129
73157
|
var functionFlags = ts.getFunctionFlags(func);
|
|
73130
|
-
var contextualReturnType = getContextualReturnType(func);
|
|
73158
|
+
var contextualReturnType = getContextualReturnType(func, contextFlags);
|
|
73131
73159
|
if (contextualReturnType) {
|
|
73132
73160
|
return node.asteriskToken
|
|
73133
73161
|
? contextualReturnType
|
|
@@ -73151,14 +73179,14 @@ var ts;
|
|
|
73151
73179
|
}
|
|
73152
73180
|
function getContextualIterationType(kind, functionDecl) {
|
|
73153
73181
|
var isAsync = !!(ts.getFunctionFlags(functionDecl) & 2 /* Async */);
|
|
73154
|
-
var contextualReturnType = getContextualReturnType(functionDecl);
|
|
73182
|
+
var contextualReturnType = getContextualReturnType(functionDecl, /*contextFlags*/ undefined);
|
|
73155
73183
|
if (contextualReturnType) {
|
|
73156
73184
|
return getIterationTypeOfGeneratorFunctionReturnType(kind, contextualReturnType, isAsync)
|
|
73157
73185
|
|| undefined;
|
|
73158
73186
|
}
|
|
73159
73187
|
return undefined;
|
|
73160
73188
|
}
|
|
73161
|
-
function getContextualReturnType(functionDecl) {
|
|
73189
|
+
function getContextualReturnType(functionDecl, contextFlags) {
|
|
73162
73190
|
// If the containing function has a return type annotation, is a constructor, or is a get accessor whose
|
|
73163
73191
|
// corresponding set accessor has a type annotation, return statements in the function are contextually typed
|
|
73164
73192
|
var returnType = getReturnTypeFromAnnotation(functionDecl);
|
|
@@ -73173,7 +73201,7 @@ var ts;
|
|
|
73173
73201
|
}
|
|
73174
73202
|
var iife = ts.getImmediatelyInvokedFunctionExpression(functionDecl);
|
|
73175
73203
|
if (iife) {
|
|
73176
|
-
return getContextualType(iife);
|
|
73204
|
+
return getContextualType(iife, contextFlags);
|
|
73177
73205
|
}
|
|
73178
73206
|
return undefined;
|
|
73179
73207
|
}
|
|
@@ -73426,7 +73454,7 @@ var ts;
|
|
|
73426
73454
|
}
|
|
73427
73455
|
function getContextualTypeForObjectLiteralElement(element, contextFlags) {
|
|
73428
73456
|
var objectLiteral = element.parent;
|
|
73429
|
-
var propertyAssignmentType = ts.isPropertyAssignment(element) && getContextualTypeForVariableLikeDeclaration(element);
|
|
73457
|
+
var propertyAssignmentType = ts.isPropertyAssignment(element) && getContextualTypeForVariableLikeDeclaration(element, contextFlags);
|
|
73430
73458
|
if (propertyAssignmentType) {
|
|
73431
73459
|
return propertyAssignmentType;
|
|
73432
73460
|
}
|
|
@@ -73621,9 +73649,9 @@ var ts;
|
|
|
73621
73649
|
return getContextualTypeForInitializerExpression(node, contextFlags);
|
|
73622
73650
|
case 214 /* ArrowFunction */:
|
|
73623
73651
|
case 247 /* ReturnStatement */:
|
|
73624
|
-
return getContextualTypeForReturnExpression(node);
|
|
73652
|
+
return getContextualTypeForReturnExpression(node, contextFlags);
|
|
73625
73653
|
case 224 /* YieldExpression */:
|
|
73626
|
-
return getContextualTypeForYieldOperand(parent);
|
|
73654
|
+
return getContextualTypeForYieldOperand(parent, contextFlags);
|
|
73627
73655
|
case 218 /* AwaitExpression */:
|
|
73628
73656
|
return getContextualTypeForAwaitOperand(parent, contextFlags);
|
|
73629
73657
|
case 208 /* CallExpression */:
|
|
@@ -73671,7 +73699,7 @@ var ts;
|
|
|
73671
73699
|
}
|
|
73672
73700
|
return undefined;
|
|
73673
73701
|
function tryFindWhenConstTypeReference(node) {
|
|
73674
|
-
return getContextualType(node);
|
|
73702
|
+
return getContextualType(node, contextFlags);
|
|
73675
73703
|
}
|
|
73676
73704
|
}
|
|
73677
73705
|
function getInferenceContext(node) {
|
|
@@ -73973,7 +74001,7 @@ var ts;
|
|
|
73973
74001
|
var elementCount = elements.length;
|
|
73974
74002
|
var elementTypes = [];
|
|
73975
74003
|
var elementFlags = [];
|
|
73976
|
-
var contextualType = getApparentTypeOfContextualType(node);
|
|
74004
|
+
var contextualType = getApparentTypeOfContextualType(node, /*contextFlags*/ undefined);
|
|
73977
74005
|
var inDestructuringPattern = ts.isAssignmentTarget(node);
|
|
73978
74006
|
var inConstContext = isConstContext(node);
|
|
73979
74007
|
var hasOmittedExpression = false;
|
|
@@ -74144,7 +74172,7 @@ var ts;
|
|
|
74144
74172
|
var propertiesTable = ts.createSymbolTable();
|
|
74145
74173
|
var propertiesArray = [];
|
|
74146
74174
|
var spread = emptyObjectType;
|
|
74147
|
-
var contextualType = getApparentTypeOfContextualType(node);
|
|
74175
|
+
var contextualType = getApparentTypeOfContextualType(node, /*contextFlags*/ undefined);
|
|
74148
74176
|
var contextualTypeHasPattern = contextualType && contextualType.pattern &&
|
|
74149
74177
|
(contextualType.pattern.kind === 201 /* ObjectBindingPattern */ || contextualType.pattern.kind === 205 /* ObjectLiteralExpression */);
|
|
74150
74178
|
var inConstContext = isConstContext(node);
|
|
@@ -74483,7 +74511,7 @@ var ts;
|
|
|
74483
74511
|
if (explicitlySpecifyChildrenAttribute) {
|
|
74484
74512
|
error(attributes, ts.Diagnostics._0_are_specified_twice_The_attribute_named_0_will_be_overwritten, ts.unescapeLeadingUnderscores(jsxChildrenPropertyName));
|
|
74485
74513
|
}
|
|
74486
|
-
var contextualType = getApparentTypeOfContextualType(openingLikeElement.attributes);
|
|
74514
|
+
var contextualType = getApparentTypeOfContextualType(openingLikeElement.attributes, /*contextFlags*/ undefined);
|
|
74487
74515
|
var childrenContextualType = contextualType && getTypeOfPropertyOfContextualType(contextualType, jsxChildrenPropertyName);
|
|
74488
74516
|
// 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
|
|
74489
74517
|
var childrenPropSymbol = createSymbol(4 /* Property */, jsxChildrenPropertyName);
|
|
@@ -78323,17 +78351,6 @@ var ts;
|
|
|
78323
78351
|
}
|
|
78324
78352
|
}
|
|
78325
78353
|
}
|
|
78326
|
-
var restType = getEffectiveRestType(context);
|
|
78327
|
-
if (restType && restType.flags & 262144 /* TypeParameter */) {
|
|
78328
|
-
// The contextual signature has a generic rest parameter. We first instantiate the contextual
|
|
78329
|
-
// signature (without fixing type parameters) and assign types to contextually typed parameters.
|
|
78330
|
-
var instantiatedContext = instantiateSignature(context, inferenceContext.nonFixingMapper);
|
|
78331
|
-
assignContextualParameterTypes(signature, instantiatedContext);
|
|
78332
|
-
// We then infer from a tuple type representing the parameters that correspond to the contextual
|
|
78333
|
-
// rest parameter.
|
|
78334
|
-
var restPos = getParameterCount(context) - 1;
|
|
78335
|
-
inferTypes(inferenceContext.inferences, getRestTypeAtPosition(signature, restPos), restType);
|
|
78336
|
-
}
|
|
78337
78354
|
}
|
|
78338
78355
|
function assignContextualParameterTypes(signature, context) {
|
|
78339
78356
|
if (context.typeParameters) {
|
|
@@ -78526,7 +78543,7 @@ var ts;
|
|
|
78526
78543
|
var contextualSignature = getContextualSignatureForFunctionLikeDeclaration(func);
|
|
78527
78544
|
var contextualType = !contextualSignature ? undefined :
|
|
78528
78545
|
contextualSignature === getSignatureFromDeclaration(func) ? isGenerator ? undefined : returnType :
|
|
78529
|
-
instantiateContextualType(getReturnTypeOfSignature(contextualSignature), func);
|
|
78546
|
+
instantiateContextualType(getReturnTypeOfSignature(contextualSignature), func, /*contextFlags*/ undefined);
|
|
78530
78547
|
if (isGenerator) {
|
|
78531
78548
|
yieldType = getWidenedLiteralLikeTypeForContextualIterationTypeIfNeeded(yieldType, contextualType, 0 /* Yield */, isAsync);
|
|
78532
78549
|
returnType = getWidenedLiteralLikeTypeForContextualIterationTypeIfNeeded(returnType, contextualType, 1 /* Return */, isAsync);
|
|
@@ -78597,7 +78614,7 @@ var ts;
|
|
|
78597
78614
|
nextType = iterationTypes && iterationTypes.nextType;
|
|
78598
78615
|
}
|
|
78599
78616
|
else {
|
|
78600
|
-
nextType = getContextualType(yieldExpression);
|
|
78617
|
+
nextType = getContextualType(yieldExpression, /*contextFlags*/ undefined);
|
|
78601
78618
|
}
|
|
78602
78619
|
if (nextType)
|
|
78603
78620
|
ts.pushIfUnique(nextTypes, nextType);
|
|
@@ -78806,11 +78823,16 @@ var ts;
|
|
|
78806
78823
|
if (isContextSensitive(node)) {
|
|
78807
78824
|
if (contextualSignature) {
|
|
78808
78825
|
var inferenceContext = getInferenceContext(node);
|
|
78826
|
+
var instantiatedContextualSignature = void 0;
|
|
78809
78827
|
if (checkMode && checkMode & 2 /* Inferential */) {
|
|
78810
78828
|
inferFromAnnotatedParameters(signature, contextualSignature, inferenceContext);
|
|
78829
|
+
var restType = getEffectiveRestType(contextualSignature);
|
|
78830
|
+
if (restType && restType.flags & 262144 /* TypeParameter */) {
|
|
78831
|
+
instantiatedContextualSignature = instantiateSignature(contextualSignature, inferenceContext.nonFixingMapper);
|
|
78832
|
+
}
|
|
78811
78833
|
}
|
|
78812
|
-
|
|
78813
|
-
instantiateSignature(contextualSignature, inferenceContext.mapper) : contextualSignature;
|
|
78834
|
+
instantiatedContextualSignature || (instantiatedContextualSignature = inferenceContext ?
|
|
78835
|
+
instantiateSignature(contextualSignature, inferenceContext.mapper) : contextualSignature);
|
|
78814
78836
|
assignContextualParameterTypes(signature, instantiatedContextualSignature);
|
|
78815
78837
|
}
|
|
78816
78838
|
else {
|
|
@@ -80052,7 +80074,7 @@ var ts;
|
|
|
80052
80074
|
type = anyType;
|
|
80053
80075
|
addLazyDiagnostic(function () {
|
|
80054
80076
|
if (noImplicitAny && !ts.expressionResultIsUnused(node)) {
|
|
80055
|
-
var contextualType = getContextualType(node);
|
|
80077
|
+
var contextualType = getContextualType(node, /*contextFlags*/ undefined);
|
|
80056
80078
|
if (!contextualType || isTypeAny(contextualType)) {
|
|
80057
80079
|
error(node, ts.Diagnostics.yield_expression_implicitly_results_in_an_any_type_because_its_containing_generator_lacks_a_return_type_annotation);
|
|
80058
80080
|
}
|
|
@@ -80093,7 +80115,7 @@ var ts;
|
|
|
80093
80115
|
texts.push(span.literal.text);
|
|
80094
80116
|
types.push(isTypeAssignableTo(type, templateConstraintType) ? type : stringType);
|
|
80095
80117
|
}
|
|
80096
|
-
return isConstContext(node) || isTemplateLiteralContext(node) || someType(getContextualType(node) || unknownType, isTemplateLiteralContextualType) ? getTemplateLiteralType(texts, types) : stringType;
|
|
80118
|
+
return isConstContext(node) || isTemplateLiteralContext(node) || someType(getContextualType(node, /*contextFlags*/ undefined) || unknownType, isTemplateLiteralContextualType) ? getTemplateLiteralType(texts, types) : stringType;
|
|
80097
80119
|
}
|
|
80098
80120
|
function isTemplateLiteralContextualType(type) {
|
|
80099
80121
|
return !!(type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */) ||
|
|
@@ -80121,7 +80143,7 @@ var ts;
|
|
|
80121
80143
|
// We strip literal freshness when an appropriate contextual type is present such that contextually typed
|
|
80122
80144
|
// literals always preserve their literal types (otherwise they might widen during type inference). An alternative
|
|
80123
80145
|
// here would be to not mark contextually typed literals as fresh in the first place.
|
|
80124
|
-
var result = maybeTypeOfKind(type, 2944 /* Literal */) && isLiteralOfContextualType(type, instantiateContextualType(contextualType, node)) ?
|
|
80146
|
+
var result = maybeTypeOfKind(type, 2944 /* Literal */) && isLiteralOfContextualType(type, instantiateContextualType(contextualType, node, /*contextFlags*/ undefined)) ?
|
|
80125
80147
|
getRegularTypeOfLiteralType(type) : type;
|
|
80126
80148
|
return result;
|
|
80127
80149
|
}
|
|
@@ -80236,7 +80258,7 @@ var ts;
|
|
|
80236
80258
|
var type = checkExpression(node, checkMode, forceTuple);
|
|
80237
80259
|
return isConstContext(node) || ts.isCommonJsExportedExpression(node) ? getRegularTypeOfLiteralType(type) :
|
|
80238
80260
|
isTypeAssertion(node) ? type :
|
|
80239
|
-
getWidenedLiteralLikeTypeForContextualType(type, instantiateContextualType(arguments.length === 2 ? getContextualType(node) : contextualType, node));
|
|
80261
|
+
getWidenedLiteralLikeTypeForContextualType(type, instantiateContextualType(arguments.length === 2 ? getContextualType(node, /*contextFlags*/ undefined) : contextualType, node, /*contextFlags*/ undefined));
|
|
80240
80262
|
}
|
|
80241
80263
|
function checkPropertyAssignment(node, checkMode) {
|
|
80242
80264
|
// Do not use hasDynamicName here, because that returns false for well known symbols.
|