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/tsserver.js
CHANGED
|
@@ -109,7 +109,7 @@ var ts;
|
|
|
109
109
|
// The following is baselined as a literal template type without intervention
|
|
110
110
|
/** The version of the TypeScript compiler release */
|
|
111
111
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
112
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
112
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220707";
|
|
113
113
|
/* @internal */
|
|
114
114
|
var Comparison;
|
|
115
115
|
(function (Comparison) {
|
|
@@ -2794,6 +2794,22 @@ var ts;
|
|
|
2794
2794
|
return formatEnum(flags, ts.FlowFlags, /*isFlags*/ true);
|
|
2795
2795
|
}
|
|
2796
2796
|
Debug.formatFlowFlags = formatFlowFlags;
|
|
2797
|
+
function formatRelationComparisonResult(result) {
|
|
2798
|
+
return formatEnum(result, ts.RelationComparisonResult, /*isFlags*/ true);
|
|
2799
|
+
}
|
|
2800
|
+
Debug.formatRelationComparisonResult = formatRelationComparisonResult;
|
|
2801
|
+
function formatCheckMode(mode) {
|
|
2802
|
+
return formatEnum(mode, ts.CheckMode, /*isFlags*/ true);
|
|
2803
|
+
}
|
|
2804
|
+
Debug.formatCheckMode = formatCheckMode;
|
|
2805
|
+
function formatSignatureCheckMode(mode) {
|
|
2806
|
+
return formatEnum(mode, ts.SignatureCheckMode, /*isFlags*/ true);
|
|
2807
|
+
}
|
|
2808
|
+
Debug.formatSignatureCheckMode = formatSignatureCheckMode;
|
|
2809
|
+
function formatTypeFacts(facts) {
|
|
2810
|
+
return formatEnum(facts, ts.TypeFacts, /*isFlags*/ true);
|
|
2811
|
+
}
|
|
2812
|
+
Debug.formatTypeFacts = formatTypeFacts;
|
|
2797
2813
|
var isDebugInfoEnabled = false;
|
|
2798
2814
|
var extendedDebugModule;
|
|
2799
2815
|
function extendedDebug() {
|
|
@@ -19531,7 +19547,8 @@ var ts;
|
|
|
19531
19547
|
function getDeclarationModifierFlagsFromSymbol(s, isWrite) {
|
|
19532
19548
|
if (isWrite === void 0) { isWrite = false; }
|
|
19533
19549
|
if (s.valueDeclaration) {
|
|
19534
|
-
var declaration = (isWrite && s.declarations && ts.find(s.declarations,
|
|
19550
|
+
var declaration = (isWrite && s.declarations && ts.find(s.declarations, ts.isSetAccessorDeclaration))
|
|
19551
|
+
|| (s.flags & 32768 /* GetAccessor */ && ts.find(s.declarations, ts.isGetAccessorDeclaration)) || s.valueDeclaration;
|
|
19535
19552
|
var flags = ts.getCombinedModifierFlags(declaration);
|
|
19536
19553
|
return s.parent && s.parent.flags & 32 /* Class */ ? flags : flags & ~28 /* AccessibilityModifier */;
|
|
19537
19554
|
}
|
|
@@ -20206,7 +20223,7 @@ var ts;
|
|
|
20206
20223
|
// Excludes declaration files - they still require an explicit `export {}` or the like
|
|
20207
20224
|
// for back compat purposes. The only non-declaration files _not_ forced to be a module are `.js` files
|
|
20208
20225
|
// that aren't esm-mode (meaning not in a `type: module` scope).
|
|
20209
|
-
return (file.impliedNodeFormat === ts.ModuleKind.ESNext || (ts.fileExtensionIsOneOf(file.fileName, [".cjs" /* Cjs */, ".cts" /* Cts */]))) && !file.isDeclarationFile ? true : undefined;
|
|
20226
|
+
return (file.impliedNodeFormat === ts.ModuleKind.ESNext || (ts.fileExtensionIsOneOf(file.fileName, [".cjs" /* Cjs */, ".cts" /* Cts */, ".mjs" /* Mjs */, ".mts" /* Mts */]))) && !file.isDeclarationFile ? true : undefined;
|
|
20210
20227
|
}
|
|
20211
20228
|
function getSetExternalModuleIndicator(options) {
|
|
20212
20229
|
// TODO: Should this callback be cached?
|
|
@@ -20229,10 +20246,7 @@ var ts;
|
|
|
20229
20246
|
if (options.jsx === 4 /* ReactJSX */ || options.jsx === 5 /* ReactJSXDev */) {
|
|
20230
20247
|
checks.push(isFileModuleFromUsingJSXTag);
|
|
20231
20248
|
}
|
|
20232
|
-
|
|
20233
|
-
if (moduleKind === ts.ModuleKind.Node16 || moduleKind === ts.ModuleKind.NodeNext) {
|
|
20234
|
-
checks.push(isFileForcedToBeModuleByFormat);
|
|
20235
|
-
}
|
|
20249
|
+
checks.push(isFileForcedToBeModuleByFormat);
|
|
20236
20250
|
var combined_1 = ts.or.apply(void 0, checks);
|
|
20237
20251
|
var callback = function (file) { return void (file.externalModuleIndicator = combined_1(file)); };
|
|
20238
20252
|
return callback;
|
|
@@ -33952,10 +33966,10 @@ var ts;
|
|
|
33952
33966
|
var hasJSDoc = hasPrecedingJSDocComment();
|
|
33953
33967
|
var modifiers = parseModifiers();
|
|
33954
33968
|
if (parseContextualModifier(136 /* GetKeyword */)) {
|
|
33955
|
-
return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 172 /* GetAccessor */);
|
|
33969
|
+
return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 172 /* GetAccessor */, 4 /* Type */);
|
|
33956
33970
|
}
|
|
33957
33971
|
if (parseContextualModifier(149 /* SetKeyword */)) {
|
|
33958
|
-
return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 173 /* SetAccessor */);
|
|
33972
|
+
return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 173 /* SetAccessor */, 4 /* Type */);
|
|
33959
33973
|
}
|
|
33960
33974
|
if (isIndexSignature()) {
|
|
33961
33975
|
return parseIndexSignatureDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers);
|
|
@@ -36001,10 +36015,10 @@ var ts;
|
|
|
36001
36015
|
var decorators = parseDecorators();
|
|
36002
36016
|
var modifiers = parseModifiers();
|
|
36003
36017
|
if (parseContextualModifier(136 /* GetKeyword */)) {
|
|
36004
|
-
return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172 /* GetAccessor */);
|
|
36018
|
+
return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172 /* GetAccessor */, 0 /* None */);
|
|
36005
36019
|
}
|
|
36006
36020
|
if (parseContextualModifier(149 /* SetKeyword */)) {
|
|
36007
|
-
return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 173 /* SetAccessor */);
|
|
36021
|
+
return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 173 /* SetAccessor */, 0 /* None */);
|
|
36008
36022
|
}
|
|
36009
36023
|
var asteriskToken = parseOptionalToken(41 /* AsteriskToken */);
|
|
36010
36024
|
var tokenIsIdentifier = isIdentifier();
|
|
@@ -36696,9 +36710,15 @@ var ts;
|
|
|
36696
36710
|
return !scanner.hasPrecedingLineBreak() && (isIdentifier() || token() === 10 /* StringLiteral */);
|
|
36697
36711
|
}
|
|
36698
36712
|
function parseFunctionBlockOrSemicolon(flags, diagnosticMessage) {
|
|
36699
|
-
if (token() !== 18 /* OpenBraceToken */
|
|
36700
|
-
|
|
36701
|
-
|
|
36713
|
+
if (token() !== 18 /* OpenBraceToken */) {
|
|
36714
|
+
if (flags & 4 /* Type */) {
|
|
36715
|
+
parseTypeMemberSemicolon();
|
|
36716
|
+
return;
|
|
36717
|
+
}
|
|
36718
|
+
if (canParseSemicolon()) {
|
|
36719
|
+
parseSemicolon();
|
|
36720
|
+
return;
|
|
36721
|
+
}
|
|
36702
36722
|
}
|
|
36703
36723
|
return parseFunctionBlock(flags, diagnosticMessage);
|
|
36704
36724
|
}
|
|
@@ -36902,12 +36922,12 @@ var ts;
|
|
|
36902
36922
|
}
|
|
36903
36923
|
return parsePropertyDeclaration(pos, hasJSDoc, decorators, modifiers, name, questionToken);
|
|
36904
36924
|
}
|
|
36905
|
-
function parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, kind) {
|
|
36925
|
+
function parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, kind, flags) {
|
|
36906
36926
|
var name = parsePropertyName();
|
|
36907
36927
|
var typeParameters = parseTypeParameters();
|
|
36908
36928
|
var parameters = parseParameters(0 /* None */);
|
|
36909
36929
|
var type = parseReturnType(58 /* ColonToken */, /*isType*/ false);
|
|
36910
|
-
var body = parseFunctionBlockOrSemicolon(
|
|
36930
|
+
var body = parseFunctionBlockOrSemicolon(flags);
|
|
36911
36931
|
var node = kind === 172 /* GetAccessor */
|
|
36912
36932
|
? factory.createGetAccessorDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, parameters, type, body)
|
|
36913
36933
|
: factory.createSetAccessorDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, parameters, body);
|
|
@@ -37094,10 +37114,10 @@ var ts;
|
|
|
37094
37114
|
return parseClassStaticBlockDeclaration(pos, hasJSDoc, decorators, modifiers);
|
|
37095
37115
|
}
|
|
37096
37116
|
if (parseContextualModifier(136 /* GetKeyword */)) {
|
|
37097
|
-
return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172 /* GetAccessor */);
|
|
37117
|
+
return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172 /* GetAccessor */, 0 /* None */);
|
|
37098
37118
|
}
|
|
37099
37119
|
if (parseContextualModifier(149 /* SetKeyword */)) {
|
|
37100
|
-
return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 173 /* SetAccessor */);
|
|
37120
|
+
return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 173 /* SetAccessor */, 0 /* None */);
|
|
37101
37121
|
}
|
|
37102
37122
|
if (token() === 134 /* ConstructorKeyword */ || token() === 10 /* StringLiteral */) {
|
|
37103
37123
|
var constructorDeclaration = tryParseConstructorDeclaration(pos, hasJSDoc, decorators, modifiers);
|
|
@@ -48501,7 +48521,7 @@ var ts;
|
|
|
48501
48521
|
// Masks
|
|
48502
48522
|
TypeFacts[TypeFacts["OrFactsMask"] = 8256] = "OrFactsMask";
|
|
48503
48523
|
TypeFacts[TypeFacts["AndFactsMask"] = 134209471] = "AndFactsMask";
|
|
48504
|
-
})(TypeFacts || (TypeFacts = {}));
|
|
48524
|
+
})(TypeFacts = ts.TypeFacts || (ts.TypeFacts = {}));
|
|
48505
48525
|
var typeofNEFacts = new ts.Map(ts.getEntries({
|
|
48506
48526
|
string: 256 /* TypeofNEString */,
|
|
48507
48527
|
number: 512 /* TypeofNENumber */,
|
|
@@ -48536,7 +48556,7 @@ var ts;
|
|
|
48536
48556
|
CheckMode[CheckMode["RestBindingElement"] = 64] = "RestBindingElement";
|
|
48537
48557
|
// e.g. in `const { a, ...rest } = foo`, when checking the type of `foo` to determine the type of `rest`,
|
|
48538
48558
|
// we need to preserve generic types instead of substituting them for constraints
|
|
48539
|
-
})(CheckMode || (CheckMode = {}));
|
|
48559
|
+
})(CheckMode = ts.CheckMode || (ts.CheckMode = {}));
|
|
48540
48560
|
var SignatureCheckMode;
|
|
48541
48561
|
(function (SignatureCheckMode) {
|
|
48542
48562
|
SignatureCheckMode[SignatureCheckMode["BivariantCallback"] = 1] = "BivariantCallback";
|
|
@@ -48544,7 +48564,7 @@ var ts;
|
|
|
48544
48564
|
SignatureCheckMode[SignatureCheckMode["IgnoreReturnTypes"] = 4] = "IgnoreReturnTypes";
|
|
48545
48565
|
SignatureCheckMode[SignatureCheckMode["StrictArity"] = 8] = "StrictArity";
|
|
48546
48566
|
SignatureCheckMode[SignatureCheckMode["Callback"] = 3] = "Callback";
|
|
48547
|
-
})(SignatureCheckMode || (SignatureCheckMode = {}));
|
|
48567
|
+
})(SignatureCheckMode = ts.SignatureCheckMode || (ts.SignatureCheckMode = {}));
|
|
48548
48568
|
var IntersectionState;
|
|
48549
48569
|
(function (IntersectionState) {
|
|
48550
48570
|
IntersectionState[IntersectionState["None"] = 0] = "None";
|
|
@@ -48896,7 +48916,7 @@ var ts;
|
|
|
48896
48916
|
},
|
|
48897
48917
|
getContextualTypeForObjectLiteralElement: function (nodeIn) {
|
|
48898
48918
|
var node = ts.getParseTreeNode(nodeIn, ts.isObjectLiteralElementLike);
|
|
48899
|
-
return node ? getContextualTypeForObjectLiteralElement(node) : undefined;
|
|
48919
|
+
return node ? getContextualTypeForObjectLiteralElement(node, /*contextFlags*/ undefined) : undefined;
|
|
48900
48920
|
},
|
|
48901
48921
|
getContextualTypeForArgumentAtIndex: function (nodeIn, argIndex) {
|
|
48902
48922
|
var node = ts.getParseTreeNode(nodeIn, ts.isCallLikeExpression);
|
|
@@ -48904,7 +48924,7 @@ var ts;
|
|
|
48904
48924
|
},
|
|
48905
48925
|
getContextualTypeForJsxAttribute: function (nodeIn) {
|
|
48906
48926
|
var node = ts.getParseTreeNode(nodeIn, ts.isJsxAttributeLike);
|
|
48907
|
-
return node && getContextualTypeForJsxAttribute(node);
|
|
48927
|
+
return node && getContextualTypeForJsxAttribute(node, /*contextFlags*/ undefined);
|
|
48908
48928
|
},
|
|
48909
48929
|
isContextSensitive: isContextSensitive,
|
|
48910
48930
|
getTypeOfPropertyOfContextualType: getTypeOfPropertyOfContextualType,
|
|
@@ -52627,13 +52647,25 @@ var ts;
|
|
|
52627
52647
|
&& isDeclarationVisible(declaration.parent)) {
|
|
52628
52648
|
return addVisibleAlias(declaration, declaration);
|
|
52629
52649
|
}
|
|
52630
|
-
else if (
|
|
52631
|
-
&& ts.
|
|
52632
|
-
|
|
52633
|
-
|
|
52634
|
-
|
|
52635
|
-
|
|
52636
|
-
|
|
52650
|
+
else if (ts.isBindingElement(declaration)) {
|
|
52651
|
+
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
|
|
52652
|
+
&& ts.isVariableDeclaration(declaration.parent.parent)
|
|
52653
|
+
&& ((_b = declaration.parent.parent.parent) === null || _b === void 0 ? void 0 : _b.parent) && ts.isVariableStatement(declaration.parent.parent.parent.parent)
|
|
52654
|
+
&& !ts.hasSyntacticModifier(declaration.parent.parent.parent.parent, 1 /* Export */)
|
|
52655
|
+
&& declaration.parent.parent.parent.parent.parent // check if the thing containing the variable statement is visible (ie, the file)
|
|
52656
|
+
&& isDeclarationVisible(declaration.parent.parent.parent.parent.parent)) {
|
|
52657
|
+
return addVisibleAlias(declaration, declaration.parent.parent.parent.parent);
|
|
52658
|
+
}
|
|
52659
|
+
else if (symbol.flags & 2 /* BlockScopedVariable */) {
|
|
52660
|
+
var variableStatement = ts.findAncestor(declaration, ts.isVariableStatement);
|
|
52661
|
+
if (ts.hasSyntacticModifier(variableStatement, 1 /* Export */)) {
|
|
52662
|
+
return true;
|
|
52663
|
+
}
|
|
52664
|
+
if (!isDeclarationVisible(variableStatement.parent)) {
|
|
52665
|
+
return false;
|
|
52666
|
+
}
|
|
52667
|
+
return addVisibleAlias(declaration, variableStatement);
|
|
52668
|
+
}
|
|
52637
52669
|
}
|
|
52638
52670
|
// Declaration is not visible
|
|
52639
52671
|
return false;
|
|
@@ -53154,6 +53186,10 @@ var ts;
|
|
|
53154
53186
|
}
|
|
53155
53187
|
return typeToTypeNodeHelper(type, context);
|
|
53156
53188
|
}
|
|
53189
|
+
function isHomomorphicMappedTypeWithNonHomomorphicInstantiation(type) {
|
|
53190
|
+
return isMappedTypeWithKeyofConstraintDeclaration(type)
|
|
53191
|
+
&& !(getModifiersTypeFromMappedType(type).flags & 262144 /* TypeParameter */);
|
|
53192
|
+
}
|
|
53157
53193
|
function createMappedTypeNodeFromType(type) {
|
|
53158
53194
|
ts.Debug.assert(!!(type.flags & 524288 /* Object */));
|
|
53159
53195
|
var readonlyToken = type.declaration.readonlyToken ? ts.factory.createToken(type.declaration.readonlyToken.kind) : undefined;
|
|
@@ -53163,7 +53199,7 @@ var ts;
|
|
|
53163
53199
|
if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
|
|
53164
53200
|
// We have a { [P in keyof T]: X }
|
|
53165
53201
|
// We do this to ensure we retain the toplevel keyof-ness of the type which may be lost due to keyof distribution during `getConstraintTypeFromMappedType`
|
|
53166
|
-
if (
|
|
53202
|
+
if (isHomomorphicMappedTypeWithNonHomomorphicInstantiation(type) && context.flags & 4 /* GenerateNamesForShadowedTypeParams */) {
|
|
53167
53203
|
var newParam = createTypeParameter(createSymbol(262144 /* TypeParameter */, "T"));
|
|
53168
53204
|
var name = typeParameterToName(newParam, context);
|
|
53169
53205
|
newTypeVariable = ts.factory.createTypeReferenceNode(name);
|
|
@@ -53179,11 +53215,12 @@ var ts;
|
|
|
53179
53215
|
var mappedTypeNode = ts.factory.createMappedTypeNode(readonlyToken, typeParameterNode, nameTypeNode, questionToken, templateTypeNode, /*members*/ undefined);
|
|
53180
53216
|
context.approximateLength += 10;
|
|
53181
53217
|
var result = ts.setEmitFlags(mappedTypeNode, 1 /* SingleLine */);
|
|
53182
|
-
if (
|
|
53218
|
+
if (isHomomorphicMappedTypeWithNonHomomorphicInstantiation(type) && context.flags & 4 /* GenerateNamesForShadowedTypeParams */) {
|
|
53183
53219
|
// homomorphic mapped type with a non-homomorphic naive inlining
|
|
53184
53220
|
// wrap it with a conditional like `SomeModifiersType extends infer U ? {..the mapped type...} : never` to ensure the resulting
|
|
53185
53221
|
// type stays homomorphic
|
|
53186
|
-
|
|
53222
|
+
var originalConstraint = instantiateType(getConstraintOfTypeParameter(getTypeFromTypeNode(type.declaration.typeParameter.constraint.type)) || unknownType, type.mapper);
|
|
53223
|
+
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 */));
|
|
53187
53224
|
}
|
|
53188
53225
|
return result;
|
|
53189
53226
|
}
|
|
@@ -66133,13 +66170,20 @@ var ts;
|
|
|
66133
66170
|
return result;
|
|
66134
66171
|
}
|
|
66135
66172
|
function structuredTypeRelatedTo(source, target, reportErrors, intersectionState) {
|
|
66173
|
+
var saveErrorInfo = captureErrorCalculationState();
|
|
66174
|
+
var result = structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState, saveErrorInfo);
|
|
66175
|
+
if (result) {
|
|
66176
|
+
resetErrorInfo(saveErrorInfo);
|
|
66177
|
+
}
|
|
66178
|
+
return result;
|
|
66179
|
+
}
|
|
66180
|
+
function structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState, saveErrorInfo) {
|
|
66136
66181
|
if (intersectionState & 4 /* PropertyCheck */) {
|
|
66137
66182
|
return propertiesRelatedTo(source, target, reportErrors, /*excludedProperties*/ undefined, 0 /* None */);
|
|
66138
66183
|
}
|
|
66139
66184
|
var result;
|
|
66140
66185
|
var originalErrorInfo;
|
|
66141
66186
|
var varianceCheckFailed = false;
|
|
66142
|
-
var saveErrorInfo = captureErrorCalculationState();
|
|
66143
66187
|
var sourceFlags = source.flags;
|
|
66144
66188
|
var targetFlags = target.flags;
|
|
66145
66189
|
if (relation === identityRelation) {
|
|
@@ -66203,7 +66247,6 @@ var ts;
|
|
|
66203
66247
|
if (constraint && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself
|
|
66204
66248
|
// TODO: Stack errors so we get a pyramid for the "normal" comparison above, _and_ a second for this
|
|
66205
66249
|
if (result = isRelatedTo(constraint, target, 1 /* Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState)) {
|
|
66206
|
-
resetErrorInfo(saveErrorInfo);
|
|
66207
66250
|
return result;
|
|
66208
66251
|
}
|
|
66209
66252
|
}
|
|
@@ -66328,7 +66371,6 @@ var ts;
|
|
|
66328
66371
|
result &= isRelatedTo(source.indexType, target.indexType, 3 /* Both */, reportErrors);
|
|
66329
66372
|
}
|
|
66330
66373
|
if (result) {
|
|
66331
|
-
resetErrorInfo(saveErrorInfo);
|
|
66332
66374
|
return result;
|
|
66333
66375
|
}
|
|
66334
66376
|
if (reportErrors) {
|
|
@@ -66431,7 +66473,6 @@ var ts;
|
|
|
66431
66473
|
// If we reach 10 levels of nesting for the same conditional type, assume it is an infinitely expanding recursive
|
|
66432
66474
|
// conditional type and bail out with a Ternary.Maybe result.
|
|
66433
66475
|
if (isDeeplyNestedType(target, targetStack, targetDepth, 10)) {
|
|
66434
|
-
resetErrorInfo(saveErrorInfo);
|
|
66435
66476
|
return 3 /* Maybe */;
|
|
66436
66477
|
}
|
|
66437
66478
|
var c = target;
|
|
@@ -66446,7 +66487,6 @@ var ts;
|
|
|
66446
66487
|
if (result = skipTrue ? -1 /* True */ : isRelatedTo(source, getTrueTypeFromConditionalType(c), 2 /* Target */, /*reportErrors*/ false)) {
|
|
66447
66488
|
result &= skipFalse ? -1 /* True */ : isRelatedTo(source, getFalseTypeFromConditionalType(c), 2 /* Target */, /*reportErrors*/ false);
|
|
66448
66489
|
if (result) {
|
|
66449
|
-
resetErrorInfo(saveErrorInfo);
|
|
66450
66490
|
return result;
|
|
66451
66491
|
}
|
|
66452
66492
|
}
|
|
@@ -66478,12 +66518,10 @@ var ts;
|
|
|
66478
66518
|
var constraint = getConstraintOfType(source) || unknownType;
|
|
66479
66519
|
// 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
|
|
66480
66520
|
if (result = isRelatedTo(constraint, target, 1 /* Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState)) {
|
|
66481
|
-
resetErrorInfo(saveErrorInfo);
|
|
66482
66521
|
return result;
|
|
66483
66522
|
}
|
|
66484
66523
|
// slower, fuller, this-instantiated check (necessary when comparing raw `this` types from base classes), see `subclassWithPolymorphicThisIsAssignable.ts` test for example
|
|
66485
66524
|
else if (result = isRelatedTo(getTypeWithThisArgument(constraint, source), target, 1 /* Source */, reportErrors && constraint !== unknownType && !(targetFlags & sourceFlags & 262144 /* TypeParameter */), /*headMessage*/ undefined, intersectionState)) {
|
|
66486
|
-
resetErrorInfo(saveErrorInfo);
|
|
66487
66525
|
return result;
|
|
66488
66526
|
}
|
|
66489
66527
|
if (isMappedTypeGenericIndexedAccess(source)) {
|
|
@@ -66492,7 +66530,6 @@ var ts;
|
|
|
66492
66530
|
var indexConstraint = getConstraintOfType(source.indexType);
|
|
66493
66531
|
if (indexConstraint) {
|
|
66494
66532
|
if (result = isRelatedTo(getIndexedAccessType(source.objectType, indexConstraint), target, 1 /* Source */, reportErrors)) {
|
|
66495
|
-
resetErrorInfo(saveErrorInfo);
|
|
66496
66533
|
return result;
|
|
66497
66534
|
}
|
|
66498
66535
|
}
|
|
@@ -66501,7 +66538,6 @@ var ts;
|
|
|
66501
66538
|
}
|
|
66502
66539
|
else if (sourceFlags & 4194304 /* Index */) {
|
|
66503
66540
|
if (result = isRelatedTo(keyofConstraintType, target, 1 /* Source */, reportErrors)) {
|
|
66504
|
-
resetErrorInfo(saveErrorInfo);
|
|
66505
66541
|
return result;
|
|
66506
66542
|
}
|
|
66507
66543
|
}
|
|
@@ -66509,7 +66545,6 @@ var ts;
|
|
|
66509
66545
|
if (!(targetFlags & 134217728 /* TemplateLiteral */)) {
|
|
66510
66546
|
var constraint = getBaseConstraintOfType(source);
|
|
66511
66547
|
if (constraint && constraint !== source && (result = isRelatedTo(constraint, target, 1 /* Source */, reportErrors))) {
|
|
66512
|
-
resetErrorInfo(saveErrorInfo);
|
|
66513
66548
|
return result;
|
|
66514
66549
|
}
|
|
66515
66550
|
}
|
|
@@ -66520,14 +66555,12 @@ var ts;
|
|
|
66520
66555
|
return 0 /* False */;
|
|
66521
66556
|
}
|
|
66522
66557
|
if (result = isRelatedTo(source.type, target.type, 3 /* Both */, reportErrors)) {
|
|
66523
|
-
resetErrorInfo(saveErrorInfo);
|
|
66524
66558
|
return result;
|
|
66525
66559
|
}
|
|
66526
66560
|
}
|
|
66527
66561
|
else {
|
|
66528
66562
|
var constraint = getBaseConstraintOfType(source);
|
|
66529
66563
|
if (constraint && (result = isRelatedTo(constraint, target, 1 /* Source */, reportErrors))) {
|
|
66530
|
-
resetErrorInfo(saveErrorInfo);
|
|
66531
66564
|
return result;
|
|
66532
66565
|
}
|
|
66533
66566
|
}
|
|
@@ -66536,7 +66569,6 @@ var ts;
|
|
|
66536
66569
|
// If we reach 10 levels of nesting for the same conditional type, assume it is an infinitely expanding recursive
|
|
66537
66570
|
// conditional type and bail out with a Ternary.Maybe result.
|
|
66538
66571
|
if (isDeeplyNestedType(source, sourceStack, sourceDepth, 10)) {
|
|
66539
|
-
resetErrorInfo(saveErrorInfo);
|
|
66540
66572
|
return 3 /* Maybe */;
|
|
66541
66573
|
}
|
|
66542
66574
|
if (targetFlags & 16777216 /* Conditional */) {
|
|
@@ -66559,7 +66591,6 @@ var ts;
|
|
|
66559
66591
|
result &= isRelatedTo(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target), 3 /* Both */, reportErrors);
|
|
66560
66592
|
}
|
|
66561
66593
|
if (result) {
|
|
66562
|
-
resetErrorInfo(saveErrorInfo);
|
|
66563
66594
|
return result;
|
|
66564
66595
|
}
|
|
66565
66596
|
}
|
|
@@ -66570,7 +66601,6 @@ var ts;
|
|
|
66570
66601
|
var distributiveConstraint = hasNonCircularBaseConstraint(source) ? getConstraintOfDistributiveConditionalType(source) : undefined;
|
|
66571
66602
|
if (distributiveConstraint) {
|
|
66572
66603
|
if (result = isRelatedTo(distributiveConstraint, target, 1 /* Source */, reportErrors)) {
|
|
66573
|
-
resetErrorInfo(saveErrorInfo);
|
|
66574
66604
|
return result;
|
|
66575
66605
|
}
|
|
66576
66606
|
}
|
|
@@ -66580,7 +66610,6 @@ var ts;
|
|
|
66580
66610
|
var defaultConstraint = getDefaultConstraintOfConditionalType(source);
|
|
66581
66611
|
if (defaultConstraint) {
|
|
66582
66612
|
if (result = isRelatedTo(defaultConstraint, target, 1 /* Source */, reportErrors)) {
|
|
66583
|
-
resetErrorInfo(saveErrorInfo);
|
|
66584
66613
|
return result;
|
|
66585
66614
|
}
|
|
66586
66615
|
}
|
|
@@ -66593,7 +66622,6 @@ var ts;
|
|
|
66593
66622
|
if (isGenericMappedType(target)) {
|
|
66594
66623
|
if (isGenericMappedType(source)) {
|
|
66595
66624
|
if (result = mappedTypeRelatedTo(source, target, reportErrors)) {
|
|
66596
|
-
resetErrorInfo(saveErrorInfo);
|
|
66597
66625
|
return result;
|
|
66598
66626
|
}
|
|
66599
66627
|
}
|
|
@@ -72114,7 +72142,7 @@ var ts;
|
|
|
72114
72142
|
!((ts.isJsxOpeningElement(node.parent) || ts.isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) &&
|
|
72115
72143
|
(checkMode && checkMode & 64 /* RestBindingElement */ ?
|
|
72116
72144
|
getContextualType(node, 8 /* SkipBindingPatterns */)
|
|
72117
|
-
: getContextualType(node));
|
|
72145
|
+
: getContextualType(node, /*contextFlags*/ undefined));
|
|
72118
72146
|
return contextualType && !isGenericType(contextualType);
|
|
72119
72147
|
}
|
|
72120
72148
|
function getNarrowableTypeForReference(type, reference, checkMode) {
|
|
@@ -72978,7 +73006,7 @@ var ts;
|
|
|
72978
73006
|
// We have an object literal method. Check if the containing object literal has a contextual type
|
|
72979
73007
|
// that includes a ThisType<T>. If so, T is the contextual type for 'this'. We continue looking in
|
|
72980
73008
|
// any directly enclosing object literals.
|
|
72981
|
-
var contextualType = getApparentTypeOfContextualType(containingLiteral);
|
|
73009
|
+
var contextualType = getApparentTypeOfContextualType(containingLiteral, /*contextFlags*/ undefined);
|
|
72982
73010
|
var literal = containingLiteral;
|
|
72983
73011
|
var type = contextualType;
|
|
72984
73012
|
while (type) {
|
|
@@ -72990,7 +73018,7 @@ var ts;
|
|
|
72990
73018
|
break;
|
|
72991
73019
|
}
|
|
72992
73020
|
literal = literal.parent.parent;
|
|
72993
|
-
type = getApparentTypeOfContextualType(literal);
|
|
73021
|
+
type = getApparentTypeOfContextualType(literal, /*contextFlags*/ undefined);
|
|
72994
73022
|
}
|
|
72995
73023
|
// There was no contextual ThisType<T> for the containing object literal, so the contextual type
|
|
72996
73024
|
// for 'this' is the non-null form of the contextual type for the containing object literal or
|
|
@@ -73047,7 +73075,7 @@ var ts;
|
|
|
73047
73075
|
tryGetTypeAtPosition(contextualSignature, index);
|
|
73048
73076
|
}
|
|
73049
73077
|
}
|
|
73050
|
-
function getContextualTypeForVariableLikeDeclaration(declaration) {
|
|
73078
|
+
function getContextualTypeForVariableLikeDeclaration(declaration, contextFlags) {
|
|
73051
73079
|
var typeNode = ts.getEffectiveTypeAnnotationNode(declaration);
|
|
73052
73080
|
if (typeNode) {
|
|
73053
73081
|
return getTypeFromTypeNode(typeNode);
|
|
@@ -73056,18 +73084,18 @@ var ts;
|
|
|
73056
73084
|
case 164 /* Parameter */:
|
|
73057
73085
|
return getContextuallyTypedParameterType(declaration);
|
|
73058
73086
|
case 203 /* BindingElement */:
|
|
73059
|
-
return getContextualTypeForBindingElement(declaration);
|
|
73087
|
+
return getContextualTypeForBindingElement(declaration, contextFlags);
|
|
73060
73088
|
case 167 /* PropertyDeclaration */:
|
|
73061
73089
|
if (ts.isStatic(declaration)) {
|
|
73062
|
-
return getContextualTypeForStaticPropertyDeclaration(declaration);
|
|
73090
|
+
return getContextualTypeForStaticPropertyDeclaration(declaration, contextFlags);
|
|
73063
73091
|
}
|
|
73064
73092
|
// By default, do nothing and return undefined - only the above cases have context implied by a parent
|
|
73065
73093
|
}
|
|
73066
73094
|
}
|
|
73067
|
-
function getContextualTypeForBindingElement(declaration) {
|
|
73095
|
+
function getContextualTypeForBindingElement(declaration, contextFlags) {
|
|
73068
73096
|
var parent = declaration.parent.parent;
|
|
73069
73097
|
var name = declaration.propertyName || declaration.name;
|
|
73070
|
-
var parentType = getContextualTypeForVariableLikeDeclaration(parent) ||
|
|
73098
|
+
var parentType = getContextualTypeForVariableLikeDeclaration(parent, contextFlags) ||
|
|
73071
73099
|
parent.kind !== 203 /* BindingElement */ && parent.initializer && checkDeclarationInitializer(parent, declaration.dotDotDotToken ? 64 /* RestBindingElement */ : 0 /* Normal */);
|
|
73072
73100
|
if (!parentType || ts.isBindingPattern(name) || ts.isComputedNonLiteralName(name))
|
|
73073
73101
|
return undefined;
|
|
@@ -73083,8 +73111,8 @@ var ts;
|
|
|
73083
73111
|
return getTypeOfPropertyOfType(parentType, text);
|
|
73084
73112
|
}
|
|
73085
73113
|
}
|
|
73086
|
-
function getContextualTypeForStaticPropertyDeclaration(declaration) {
|
|
73087
|
-
var parentType = ts.isExpression(declaration.parent) && getContextualType(declaration.parent);
|
|
73114
|
+
function getContextualTypeForStaticPropertyDeclaration(declaration, contextFlags) {
|
|
73115
|
+
var parentType = ts.isExpression(declaration.parent) && getContextualType(declaration.parent, contextFlags);
|
|
73088
73116
|
if (!parentType)
|
|
73089
73117
|
return undefined;
|
|
73090
73118
|
return getTypeOfPropertyOfContextualType(parentType, getSymbolOfNode(declaration).escapedName);
|
|
@@ -73100,7 +73128,7 @@ var ts;
|
|
|
73100
73128
|
function getContextualTypeForInitializerExpression(node, contextFlags) {
|
|
73101
73129
|
var declaration = node.parent;
|
|
73102
73130
|
if (ts.hasInitializer(declaration) && node === declaration.initializer) {
|
|
73103
|
-
var result = getContextualTypeForVariableLikeDeclaration(declaration);
|
|
73131
|
+
var result = getContextualTypeForVariableLikeDeclaration(declaration, contextFlags);
|
|
73104
73132
|
if (result) {
|
|
73105
73133
|
return result;
|
|
73106
73134
|
}
|
|
@@ -73110,10 +73138,10 @@ var ts;
|
|
|
73110
73138
|
}
|
|
73111
73139
|
return undefined;
|
|
73112
73140
|
}
|
|
73113
|
-
function getContextualTypeForReturnExpression(node) {
|
|
73141
|
+
function getContextualTypeForReturnExpression(node, contextFlags) {
|
|
73114
73142
|
var func = ts.getContainingFunction(node);
|
|
73115
73143
|
if (func) {
|
|
73116
|
-
var contextualReturnType = getContextualReturnType(func);
|
|
73144
|
+
var contextualReturnType = getContextualReturnType(func, contextFlags);
|
|
73117
73145
|
if (contextualReturnType) {
|
|
73118
73146
|
var functionFlags = ts.getFunctionFlags(func);
|
|
73119
73147
|
if (functionFlags & 1 /* Generator */) { // Generator or AsyncGenerator function
|
|
@@ -73143,11 +73171,11 @@ var ts;
|
|
|
73143
73171
|
}
|
|
73144
73172
|
return undefined;
|
|
73145
73173
|
}
|
|
73146
|
-
function getContextualTypeForYieldOperand(node) {
|
|
73174
|
+
function getContextualTypeForYieldOperand(node, contextFlags) {
|
|
73147
73175
|
var func = ts.getContainingFunction(node);
|
|
73148
73176
|
if (func) {
|
|
73149
73177
|
var functionFlags = ts.getFunctionFlags(func);
|
|
73150
|
-
var contextualReturnType = getContextualReturnType(func);
|
|
73178
|
+
var contextualReturnType = getContextualReturnType(func, contextFlags);
|
|
73151
73179
|
if (contextualReturnType) {
|
|
73152
73180
|
return node.asteriskToken
|
|
73153
73181
|
? contextualReturnType
|
|
@@ -73171,14 +73199,14 @@ var ts;
|
|
|
73171
73199
|
}
|
|
73172
73200
|
function getContextualIterationType(kind, functionDecl) {
|
|
73173
73201
|
var isAsync = !!(ts.getFunctionFlags(functionDecl) & 2 /* Async */);
|
|
73174
|
-
var contextualReturnType = getContextualReturnType(functionDecl);
|
|
73202
|
+
var contextualReturnType = getContextualReturnType(functionDecl, /*contextFlags*/ undefined);
|
|
73175
73203
|
if (contextualReturnType) {
|
|
73176
73204
|
return getIterationTypeOfGeneratorFunctionReturnType(kind, contextualReturnType, isAsync)
|
|
73177
73205
|
|| undefined;
|
|
73178
73206
|
}
|
|
73179
73207
|
return undefined;
|
|
73180
73208
|
}
|
|
73181
|
-
function getContextualReturnType(functionDecl) {
|
|
73209
|
+
function getContextualReturnType(functionDecl, contextFlags) {
|
|
73182
73210
|
// If the containing function has a return type annotation, is a constructor, or is a get accessor whose
|
|
73183
73211
|
// corresponding set accessor has a type annotation, return statements in the function are contextually typed
|
|
73184
73212
|
var returnType = getReturnTypeFromAnnotation(functionDecl);
|
|
@@ -73193,7 +73221,7 @@ var ts;
|
|
|
73193
73221
|
}
|
|
73194
73222
|
var iife = ts.getImmediatelyInvokedFunctionExpression(functionDecl);
|
|
73195
73223
|
if (iife) {
|
|
73196
|
-
return getContextualType(iife);
|
|
73224
|
+
return getContextualType(iife, contextFlags);
|
|
73197
73225
|
}
|
|
73198
73226
|
return undefined;
|
|
73199
73227
|
}
|
|
@@ -73446,7 +73474,7 @@ var ts;
|
|
|
73446
73474
|
}
|
|
73447
73475
|
function getContextualTypeForObjectLiteralElement(element, contextFlags) {
|
|
73448
73476
|
var objectLiteral = element.parent;
|
|
73449
|
-
var propertyAssignmentType = ts.isPropertyAssignment(element) && getContextualTypeForVariableLikeDeclaration(element);
|
|
73477
|
+
var propertyAssignmentType = ts.isPropertyAssignment(element) && getContextualTypeForVariableLikeDeclaration(element, contextFlags);
|
|
73450
73478
|
if (propertyAssignmentType) {
|
|
73451
73479
|
return propertyAssignmentType;
|
|
73452
73480
|
}
|
|
@@ -73641,9 +73669,9 @@ var ts;
|
|
|
73641
73669
|
return getContextualTypeForInitializerExpression(node, contextFlags);
|
|
73642
73670
|
case 214 /* ArrowFunction */:
|
|
73643
73671
|
case 247 /* ReturnStatement */:
|
|
73644
|
-
return getContextualTypeForReturnExpression(node);
|
|
73672
|
+
return getContextualTypeForReturnExpression(node, contextFlags);
|
|
73645
73673
|
case 224 /* YieldExpression */:
|
|
73646
|
-
return getContextualTypeForYieldOperand(parent);
|
|
73674
|
+
return getContextualTypeForYieldOperand(parent, contextFlags);
|
|
73647
73675
|
case 218 /* AwaitExpression */:
|
|
73648
73676
|
return getContextualTypeForAwaitOperand(parent, contextFlags);
|
|
73649
73677
|
case 208 /* CallExpression */:
|
|
@@ -73691,7 +73719,7 @@ var ts;
|
|
|
73691
73719
|
}
|
|
73692
73720
|
return undefined;
|
|
73693
73721
|
function tryFindWhenConstTypeReference(node) {
|
|
73694
|
-
return getContextualType(node);
|
|
73722
|
+
return getContextualType(node, contextFlags);
|
|
73695
73723
|
}
|
|
73696
73724
|
}
|
|
73697
73725
|
function getInferenceContext(node) {
|
|
@@ -73993,7 +74021,7 @@ var ts;
|
|
|
73993
74021
|
var elementCount = elements.length;
|
|
73994
74022
|
var elementTypes = [];
|
|
73995
74023
|
var elementFlags = [];
|
|
73996
|
-
var contextualType = getApparentTypeOfContextualType(node);
|
|
74024
|
+
var contextualType = getApparentTypeOfContextualType(node, /*contextFlags*/ undefined);
|
|
73997
74025
|
var inDestructuringPattern = ts.isAssignmentTarget(node);
|
|
73998
74026
|
var inConstContext = isConstContext(node);
|
|
73999
74027
|
var hasOmittedExpression = false;
|
|
@@ -74164,7 +74192,7 @@ var ts;
|
|
|
74164
74192
|
var propertiesTable = ts.createSymbolTable();
|
|
74165
74193
|
var propertiesArray = [];
|
|
74166
74194
|
var spread = emptyObjectType;
|
|
74167
|
-
var contextualType = getApparentTypeOfContextualType(node);
|
|
74195
|
+
var contextualType = getApparentTypeOfContextualType(node, /*contextFlags*/ undefined);
|
|
74168
74196
|
var contextualTypeHasPattern = contextualType && contextualType.pattern &&
|
|
74169
74197
|
(contextualType.pattern.kind === 201 /* ObjectBindingPattern */ || contextualType.pattern.kind === 205 /* ObjectLiteralExpression */);
|
|
74170
74198
|
var inConstContext = isConstContext(node);
|
|
@@ -74503,7 +74531,7 @@ var ts;
|
|
|
74503
74531
|
if (explicitlySpecifyChildrenAttribute) {
|
|
74504
74532
|
error(attributes, ts.Diagnostics._0_are_specified_twice_The_attribute_named_0_will_be_overwritten, ts.unescapeLeadingUnderscores(jsxChildrenPropertyName));
|
|
74505
74533
|
}
|
|
74506
|
-
var contextualType = getApparentTypeOfContextualType(openingLikeElement.attributes);
|
|
74534
|
+
var contextualType = getApparentTypeOfContextualType(openingLikeElement.attributes, /*contextFlags*/ undefined);
|
|
74507
74535
|
var childrenContextualType = contextualType && getTypeOfPropertyOfContextualType(contextualType, jsxChildrenPropertyName);
|
|
74508
74536
|
// 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
|
|
74509
74537
|
var childrenPropSymbol = createSymbol(4 /* Property */, jsxChildrenPropertyName);
|
|
@@ -78343,17 +78371,6 @@ var ts;
|
|
|
78343
78371
|
}
|
|
78344
78372
|
}
|
|
78345
78373
|
}
|
|
78346
|
-
var restType = getEffectiveRestType(context);
|
|
78347
|
-
if (restType && restType.flags & 262144 /* TypeParameter */) {
|
|
78348
|
-
// The contextual signature has a generic rest parameter. We first instantiate the contextual
|
|
78349
|
-
// signature (without fixing type parameters) and assign types to contextually typed parameters.
|
|
78350
|
-
var instantiatedContext = instantiateSignature(context, inferenceContext.nonFixingMapper);
|
|
78351
|
-
assignContextualParameterTypes(signature, instantiatedContext);
|
|
78352
|
-
// We then infer from a tuple type representing the parameters that correspond to the contextual
|
|
78353
|
-
// rest parameter.
|
|
78354
|
-
var restPos = getParameterCount(context) - 1;
|
|
78355
|
-
inferTypes(inferenceContext.inferences, getRestTypeAtPosition(signature, restPos), restType);
|
|
78356
|
-
}
|
|
78357
78374
|
}
|
|
78358
78375
|
function assignContextualParameterTypes(signature, context) {
|
|
78359
78376
|
if (context.typeParameters) {
|
|
@@ -78546,7 +78563,7 @@ var ts;
|
|
|
78546
78563
|
var contextualSignature = getContextualSignatureForFunctionLikeDeclaration(func);
|
|
78547
78564
|
var contextualType = !contextualSignature ? undefined :
|
|
78548
78565
|
contextualSignature === getSignatureFromDeclaration(func) ? isGenerator ? undefined : returnType :
|
|
78549
|
-
instantiateContextualType(getReturnTypeOfSignature(contextualSignature), func);
|
|
78566
|
+
instantiateContextualType(getReturnTypeOfSignature(contextualSignature), func, /*contextFlags*/ undefined);
|
|
78550
78567
|
if (isGenerator) {
|
|
78551
78568
|
yieldType = getWidenedLiteralLikeTypeForContextualIterationTypeIfNeeded(yieldType, contextualType, 0 /* Yield */, isAsync);
|
|
78552
78569
|
returnType = getWidenedLiteralLikeTypeForContextualIterationTypeIfNeeded(returnType, contextualType, 1 /* Return */, isAsync);
|
|
@@ -78617,7 +78634,7 @@ var ts;
|
|
|
78617
78634
|
nextType = iterationTypes && iterationTypes.nextType;
|
|
78618
78635
|
}
|
|
78619
78636
|
else {
|
|
78620
|
-
nextType = getContextualType(yieldExpression);
|
|
78637
|
+
nextType = getContextualType(yieldExpression, /*contextFlags*/ undefined);
|
|
78621
78638
|
}
|
|
78622
78639
|
if (nextType)
|
|
78623
78640
|
ts.pushIfUnique(nextTypes, nextType);
|
|
@@ -78826,11 +78843,16 @@ var ts;
|
|
|
78826
78843
|
if (isContextSensitive(node)) {
|
|
78827
78844
|
if (contextualSignature) {
|
|
78828
78845
|
var inferenceContext = getInferenceContext(node);
|
|
78846
|
+
var instantiatedContextualSignature = void 0;
|
|
78829
78847
|
if (checkMode && checkMode & 2 /* Inferential */) {
|
|
78830
78848
|
inferFromAnnotatedParameters(signature, contextualSignature, inferenceContext);
|
|
78849
|
+
var restType = getEffectiveRestType(contextualSignature);
|
|
78850
|
+
if (restType && restType.flags & 262144 /* TypeParameter */) {
|
|
78851
|
+
instantiatedContextualSignature = instantiateSignature(contextualSignature, inferenceContext.nonFixingMapper);
|
|
78852
|
+
}
|
|
78831
78853
|
}
|
|
78832
|
-
|
|
78833
|
-
instantiateSignature(contextualSignature, inferenceContext.mapper) : contextualSignature;
|
|
78854
|
+
instantiatedContextualSignature || (instantiatedContextualSignature = inferenceContext ?
|
|
78855
|
+
instantiateSignature(contextualSignature, inferenceContext.mapper) : contextualSignature);
|
|
78834
78856
|
assignContextualParameterTypes(signature, instantiatedContextualSignature);
|
|
78835
78857
|
}
|
|
78836
78858
|
else {
|
|
@@ -80072,7 +80094,7 @@ var ts;
|
|
|
80072
80094
|
type = anyType;
|
|
80073
80095
|
addLazyDiagnostic(function () {
|
|
80074
80096
|
if (noImplicitAny && !ts.expressionResultIsUnused(node)) {
|
|
80075
|
-
var contextualType = getContextualType(node);
|
|
80097
|
+
var contextualType = getContextualType(node, /*contextFlags*/ undefined);
|
|
80076
80098
|
if (!contextualType || isTypeAny(contextualType)) {
|
|
80077
80099
|
error(node, ts.Diagnostics.yield_expression_implicitly_results_in_an_any_type_because_its_containing_generator_lacks_a_return_type_annotation);
|
|
80078
80100
|
}
|
|
@@ -80113,7 +80135,7 @@ var ts;
|
|
|
80113
80135
|
texts.push(span.literal.text);
|
|
80114
80136
|
types.push(isTypeAssignableTo(type, templateConstraintType) ? type : stringType);
|
|
80115
80137
|
}
|
|
80116
|
-
return isConstContext(node) || isTemplateLiteralContext(node) || someType(getContextualType(node) || unknownType, isTemplateLiteralContextualType) ? getTemplateLiteralType(texts, types) : stringType;
|
|
80138
|
+
return isConstContext(node) || isTemplateLiteralContext(node) || someType(getContextualType(node, /*contextFlags*/ undefined) || unknownType, isTemplateLiteralContextualType) ? getTemplateLiteralType(texts, types) : stringType;
|
|
80117
80139
|
}
|
|
80118
80140
|
function isTemplateLiteralContextualType(type) {
|
|
80119
80141
|
return !!(type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */) ||
|
|
@@ -80141,7 +80163,7 @@ var ts;
|
|
|
80141
80163
|
// We strip literal freshness when an appropriate contextual type is present such that contextually typed
|
|
80142
80164
|
// literals always preserve their literal types (otherwise they might widen during type inference). An alternative
|
|
80143
80165
|
// here would be to not mark contextually typed literals as fresh in the first place.
|
|
80144
|
-
var result = maybeTypeOfKind(type, 2944 /* Literal */) && isLiteralOfContextualType(type, instantiateContextualType(contextualType, node)) ?
|
|
80166
|
+
var result = maybeTypeOfKind(type, 2944 /* Literal */) && isLiteralOfContextualType(type, instantiateContextualType(contextualType, node, /*contextFlags*/ undefined)) ?
|
|
80145
80167
|
getRegularTypeOfLiteralType(type) : type;
|
|
80146
80168
|
return result;
|
|
80147
80169
|
}
|
|
@@ -80256,7 +80278,7 @@ var ts;
|
|
|
80256
80278
|
var type = checkExpression(node, checkMode, forceTuple);
|
|
80257
80279
|
return isConstContext(node) || ts.isCommonJsExportedExpression(node) ? getRegularTypeOfLiteralType(type) :
|
|
80258
80280
|
isTypeAssertion(node) ? type :
|
|
80259
|
-
getWidenedLiteralLikeTypeForContextualType(type, instantiateContextualType(arguments.length === 2 ? getContextualType(node) : contextualType, node));
|
|
80281
|
+
getWidenedLiteralLikeTypeForContextualType(type, instantiateContextualType(arguments.length === 2 ? getContextualType(node, /*contextFlags*/ undefined) : contextualType, node, /*contextFlags*/ undefined));
|
|
80260
80282
|
}
|
|
80261
80283
|
function checkPropertyAssignment(node, checkMode) {
|
|
80262
80284
|
// Do not use hasDynamicName here, because that returns false for well known symbols.
|
|
@@ -165514,20 +165536,25 @@ var ts;
|
|
|
165514
165536
|
return this.documentationComment;
|
|
165515
165537
|
};
|
|
165516
165538
|
SymbolObject.prototype.getContextualDocumentationComment = function (context, checker) {
|
|
165517
|
-
|
|
165518
|
-
|
|
165539
|
+
if (context) {
|
|
165540
|
+
if (ts.isGetAccessor(context)) {
|
|
165519
165541
|
if (!this.contextualGetAccessorDocumentationComment) {
|
|
165520
165542
|
this.contextualGetAccessorDocumentationComment = getDocumentationComment(ts.filter(this.declarations, ts.isGetAccessor), checker);
|
|
165521
165543
|
}
|
|
165522
|
-
|
|
165523
|
-
|
|
165544
|
+
if (ts.length(this.contextualGetAccessorDocumentationComment)) {
|
|
165545
|
+
return this.contextualGetAccessorDocumentationComment;
|
|
165546
|
+
}
|
|
165547
|
+
}
|
|
165548
|
+
if (ts.isSetAccessor(context)) {
|
|
165524
165549
|
if (!this.contextualSetAccessorDocumentationComment) {
|
|
165525
165550
|
this.contextualSetAccessorDocumentationComment = getDocumentationComment(ts.filter(this.declarations, ts.isSetAccessor), checker);
|
|
165526
165551
|
}
|
|
165527
|
-
|
|
165528
|
-
|
|
165529
|
-
|
|
165552
|
+
if (ts.length(this.contextualSetAccessorDocumentationComment)) {
|
|
165553
|
+
return this.contextualSetAccessorDocumentationComment;
|
|
165554
|
+
}
|
|
165555
|
+
}
|
|
165530
165556
|
}
|
|
165557
|
+
return this.getDocumentationComment(checker);
|
|
165531
165558
|
};
|
|
165532
165559
|
SymbolObject.prototype.getJsDocTags = function (checker) {
|
|
165533
165560
|
if (this.tags === undefined) {
|
|
@@ -165536,20 +165563,25 @@ var ts;
|
|
|
165536
165563
|
return this.tags;
|
|
165537
165564
|
};
|
|
165538
165565
|
SymbolObject.prototype.getContextualJsDocTags = function (context, checker) {
|
|
165539
|
-
|
|
165540
|
-
|
|
165566
|
+
if (context) {
|
|
165567
|
+
if (ts.isGetAccessor(context)) {
|
|
165541
165568
|
if (!this.contextualGetAccessorTags) {
|
|
165542
165569
|
this.contextualGetAccessorTags = getJsDocTagsOfDeclarations(ts.filter(this.declarations, ts.isGetAccessor), checker);
|
|
165543
165570
|
}
|
|
165544
|
-
|
|
165545
|
-
|
|
165571
|
+
if (ts.length(this.contextualGetAccessorTags)) {
|
|
165572
|
+
return this.contextualGetAccessorTags;
|
|
165573
|
+
}
|
|
165574
|
+
}
|
|
165575
|
+
if (ts.isSetAccessor(context)) {
|
|
165546
165576
|
if (!this.contextualSetAccessorTags) {
|
|
165547
165577
|
this.contextualSetAccessorTags = getJsDocTagsOfDeclarations(ts.filter(this.declarations, ts.isSetAccessor), checker);
|
|
165548
165578
|
}
|
|
165549
|
-
|
|
165550
|
-
|
|
165551
|
-
|
|
165579
|
+
if (ts.length(this.contextualSetAccessorTags)) {
|
|
165580
|
+
return this.contextualSetAccessorTags;
|
|
165581
|
+
}
|
|
165582
|
+
}
|
|
165552
165583
|
}
|
|
165584
|
+
return this.getJsDocTags(checker);
|
|
165553
165585
|
};
|
|
165554
165586
|
return SymbolObject;
|
|
165555
165587
|
}());
|
|
@@ -166300,7 +166332,10 @@ var ts;
|
|
|
166300
166332
|
program = undefined; // TODO: GH#18217
|
|
166301
166333
|
lastTypesRootVersion = typeRootsVersion;
|
|
166302
166334
|
}
|
|
166303
|
-
|
|
166335
|
+
// This array is retained by the program and will be used to determine if the program is up to date,
|
|
166336
|
+
// so we need to make a copy in case the host mutates the underlying array - otherwise it would look
|
|
166337
|
+
// like every program always has the host's current list of root files.
|
|
166338
|
+
var rootFileNames = host.getScriptFileNames().slice();
|
|
166304
166339
|
// Get a fresh cache of the host information
|
|
166305
166340
|
var newSettings = host.getCompilationSettings() || getDefaultCompilerOptions();
|
|
166306
166341
|
var hasInvalidatedResolution = host.hasInvalidatedResolution || ts.returnFalse;
|