typescript 4.8.0-dev.20220706 → 4.8.0-dev.20220709

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 CHANGED
@@ -69,7 +69,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
69
69
  var ts;
70
70
  (function (ts) {
71
71
  ts.versionMajorMinor = "4.8";
72
- ts.version = ts.versionMajorMinor + ".0-dev.20220706";
72
+ ts.version = ts.versionMajorMinor + ".0-dev.20220709";
73
73
  var NativeCollections;
74
74
  (function (NativeCollections) {
75
75
  var globals = typeof globalThis !== "undefined" ? globalThis :
@@ -1707,7 +1707,7 @@ var ts;
1707
1707
  }
1708
1708
  ts.compareBooleans = compareBooleans;
1709
1709
  function getSpellingSuggestion(name, candidates, getName) {
1710
- var maximumLengthDifference = Math.min(2, Math.floor(name.length * 0.34));
1710
+ var maximumLengthDifference = Math.max(2, Math.floor(name.length * 0.34));
1711
1711
  var bestDistance = Math.floor(name.length * 0.4) + 1;
1712
1712
  var bestCandidate;
1713
1713
  for (var _i = 0, candidates_2 = candidates; _i < candidates_2.length; _i++) {
@@ -2362,6 +2362,22 @@ var ts;
2362
2362
  return formatEnum(flags, ts.FlowFlags, true);
2363
2363
  }
2364
2364
  Debug.formatFlowFlags = formatFlowFlags;
2365
+ function formatRelationComparisonResult(result) {
2366
+ return formatEnum(result, ts.RelationComparisonResult, true);
2367
+ }
2368
+ Debug.formatRelationComparisonResult = formatRelationComparisonResult;
2369
+ function formatCheckMode(mode) {
2370
+ return formatEnum(mode, ts.CheckMode, true);
2371
+ }
2372
+ Debug.formatCheckMode = formatCheckMode;
2373
+ function formatSignatureCheckMode(mode) {
2374
+ return formatEnum(mode, ts.SignatureCheckMode, true);
2375
+ }
2376
+ Debug.formatSignatureCheckMode = formatSignatureCheckMode;
2377
+ function formatTypeFacts(facts) {
2378
+ return formatEnum(facts, ts.TypeFacts, true);
2379
+ }
2380
+ Debug.formatTypeFacts = formatTypeFacts;
2365
2381
  var isDebugInfoEnabled = false;
2366
2382
  var extendedDebugModule;
2367
2383
  function extendedDebug() {
@@ -6187,6 +6203,7 @@ var ts;
6187
6203
  The_type_of_this_expression_cannot_be_named_without_a_resolution_mode_assertion_which_is_an_unstable_feature_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next: diag(2841, ts.DiagnosticCategory.Error, "The_type_of_this_expression_cannot_be_named_without_a_resolution_mode_assertion_which_is_an_unstable_2841", "The type of this expression cannot be named without a 'resolution-mode' assertion, which is an unstable feature. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'."),
6188
6204
  _0_is_an_unused_renaming_of_1_Did_you_intend_to_use_it_as_a_type_annotation: diag(2842, ts.DiagnosticCategory.Error, "_0_is_an_unused_renaming_of_1_Did_you_intend_to_use_it_as_a_type_annotation_2842", "'{0}' is an unused renaming of '{1}'. Did you intend to use it as a type annotation?"),
6189
6205
  We_can_only_write_a_type_for_0_by_adding_a_type_for_the_entire_parameter_here: diag(2843, ts.DiagnosticCategory.Error, "We_can_only_write_a_type_for_0_by_adding_a_type_for_the_entire_parameter_here_2843", "We can only write a type for '{0}' by adding a type for the entire parameter here."),
6206
+ Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2844, ts.DiagnosticCategory.Error, "Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2844", "Type of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."),
6190
6207
  Import_declaration_0_is_using_private_name_1: diag(4000, ts.DiagnosticCategory.Error, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
6191
6208
  Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
6192
6209
  Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
@@ -15381,7 +15398,8 @@ var ts;
15381
15398
  function getDeclarationModifierFlagsFromSymbol(s, isWrite) {
15382
15399
  if (isWrite === void 0) { isWrite = false; }
15383
15400
  if (s.valueDeclaration) {
15384
- var declaration = (isWrite && s.declarations && ts.find(s.declarations, function (d) { return d.kind === 173; })) || s.valueDeclaration;
15401
+ var declaration = (isWrite && s.declarations && ts.find(s.declarations, ts.isSetAccessorDeclaration))
15402
+ || (s.flags & 32768 && ts.find(s.declarations, ts.isGetAccessorDeclaration)) || s.valueDeclaration;
15385
15403
  var flags = ts.getCombinedModifierFlags(declaration);
15386
15404
  return s.parent && s.parent.flags & 32 ? flags : flags & ~28;
15387
15405
  }
@@ -16003,7 +16021,7 @@ var ts;
16003
16021
  return !file.isDeclarationFile ? walkTreeForJSXTags(file) : undefined;
16004
16022
  }
16005
16023
  function isFileForcedToBeModuleByFormat(file) {
16006
- return (file.impliedNodeFormat === ts.ModuleKind.ESNext || (ts.fileExtensionIsOneOf(file.fileName, [".cjs", ".cts"]))) && !file.isDeclarationFile ? true : undefined;
16024
+ return (file.impliedNodeFormat === ts.ModuleKind.ESNext || (ts.fileExtensionIsOneOf(file.fileName, [".cjs", ".cts", ".mjs", ".mts"]))) && !file.isDeclarationFile ? true : undefined;
16007
16025
  }
16008
16026
  function getSetExternalModuleIndicator(options) {
16009
16027
  switch (getEmitModuleDetectionKind(options)) {
@@ -16020,10 +16038,7 @@ var ts;
16020
16038
  if (options.jsx === 4 || options.jsx === 5) {
16021
16039
  checks.push(isFileModuleFromUsingJSXTag);
16022
16040
  }
16023
- var moduleKind = getEmitModuleKind(options);
16024
- if (moduleKind === ts.ModuleKind.Node16 || moduleKind === ts.ModuleKind.NodeNext) {
16025
- checks.push(isFileForcedToBeModuleByFormat);
16026
- }
16041
+ checks.push(isFileForcedToBeModuleByFormat);
16027
16042
  var combined_1 = ts.or.apply(void 0, checks);
16028
16043
  var callback = function (file) { return void (file.externalModuleIndicator = combined_1(file)); };
16029
16044
  return callback;
@@ -27359,10 +27374,10 @@ var ts;
27359
27374
  var hasJSDoc = hasPrecedingJSDocComment();
27360
27375
  var modifiers = parseModifiers();
27361
27376
  if (parseContextualModifier(136)) {
27362
- return parseAccessorDeclaration(pos, hasJSDoc, undefined, modifiers, 172);
27377
+ return parseAccessorDeclaration(pos, hasJSDoc, undefined, modifiers, 172, 4);
27363
27378
  }
27364
27379
  if (parseContextualModifier(149)) {
27365
- return parseAccessorDeclaration(pos, hasJSDoc, undefined, modifiers, 173);
27380
+ return parseAccessorDeclaration(pos, hasJSDoc, undefined, modifiers, 173, 4);
27366
27381
  }
27367
27382
  if (isIndexSignature()) {
27368
27383
  return parseIndexSignatureDeclaration(pos, hasJSDoc, undefined, modifiers);
@@ -28953,10 +28968,10 @@ var ts;
28953
28968
  var decorators = parseDecorators();
28954
28969
  var modifiers = parseModifiers();
28955
28970
  if (parseContextualModifier(136)) {
28956
- return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172);
28971
+ return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172, 0);
28957
28972
  }
28958
28973
  if (parseContextualModifier(149)) {
28959
- return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 173);
28974
+ return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 173, 0);
28960
28975
  }
28961
28976
  var asteriskToken = parseOptionalToken(41);
28962
28977
  var tokenIsIdentifier = isIdentifier();
@@ -29574,9 +29589,15 @@ var ts;
29574
29589
  return !scanner.hasPrecedingLineBreak() && (isIdentifier() || token() === 10);
29575
29590
  }
29576
29591
  function parseFunctionBlockOrSemicolon(flags, diagnosticMessage) {
29577
- if (token() !== 18 && canParseSemicolon()) {
29578
- parseSemicolon();
29579
- return;
29592
+ if (token() !== 18) {
29593
+ if (flags & 4) {
29594
+ parseTypeMemberSemicolon();
29595
+ return;
29596
+ }
29597
+ if (canParseSemicolon()) {
29598
+ parseSemicolon();
29599
+ return;
29600
+ }
29580
29601
  }
29581
29602
  return parseFunctionBlock(flags, diagnosticMessage);
29582
29603
  }
@@ -29764,12 +29785,12 @@ var ts;
29764
29785
  }
29765
29786
  return parsePropertyDeclaration(pos, hasJSDoc, decorators, modifiers, name, questionToken);
29766
29787
  }
29767
- function parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, kind) {
29788
+ function parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, kind, flags) {
29768
29789
  var name = parsePropertyName();
29769
29790
  var typeParameters = parseTypeParameters();
29770
29791
  var parameters = parseParameters(0);
29771
29792
  var type = parseReturnType(58, false);
29772
- var body = parseFunctionBlockOrSemicolon(0);
29793
+ var body = parseFunctionBlockOrSemicolon(flags);
29773
29794
  var node = kind === 172
29774
29795
  ? factory.createGetAccessorDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, parameters, type, body)
29775
29796
  : factory.createSetAccessorDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, parameters, body);
@@ -29925,10 +29946,10 @@ var ts;
29925
29946
  return parseClassStaticBlockDeclaration(pos, hasJSDoc, decorators, modifiers);
29926
29947
  }
29927
29948
  if (parseContextualModifier(136)) {
29928
- return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172);
29949
+ return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172, 0);
29929
29950
  }
29930
29951
  if (parseContextualModifier(149)) {
29931
- return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 173);
29952
+ return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 173, 0);
29932
29953
  }
29933
29954
  if (token() === 134 || token() === 10) {
29934
29955
  var constructorDeclaration = tryParseConstructorDeclaration(pos, hasJSDoc, decorators, modifiers);
@@ -36352,6 +36373,7 @@ var ts;
36352
36373
  return 1;
36353
36374
  return 0;
36354
36375
  }
36376
+ ts.comparePatternKeys = comparePatternKeys;
36355
36377
  function loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, moduleName, lookupTable, scope, isImports) {
36356
36378
  var loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports);
36357
36379
  if (!ts.endsWith(moduleName, ts.directorySeparator) && moduleName.indexOf("*") === -1 && ts.hasProperty(lookupTable, moduleName)) {
@@ -40031,7 +40053,7 @@ var ts;
40031
40053
  },
40032
40054
  getContextualTypeForObjectLiteralElement: function (nodeIn) {
40033
40055
  var node = ts.getParseTreeNode(nodeIn, ts.isObjectLiteralElementLike);
40034
- return node ? getContextualTypeForObjectLiteralElement(node) : undefined;
40056
+ return node ? getContextualTypeForObjectLiteralElement(node, undefined) : undefined;
40035
40057
  },
40036
40058
  getContextualTypeForArgumentAtIndex: function (nodeIn, argIndex) {
40037
40059
  var node = ts.getParseTreeNode(nodeIn, ts.isCallLikeExpression);
@@ -40039,7 +40061,7 @@ var ts;
40039
40061
  },
40040
40062
  getContextualTypeForJsxAttribute: function (nodeIn) {
40041
40063
  var node = ts.getParseTreeNode(nodeIn, ts.isJsxAttributeLike);
40042
- return node && getContextualTypeForJsxAttribute(node);
40064
+ return node && getContextualTypeForJsxAttribute(node, undefined);
40043
40065
  },
40044
40066
  isContextSensitive: isContextSensitive,
40045
40067
  getTypeOfPropertyOfContextualType: getTypeOfPropertyOfContextualType,
@@ -41225,6 +41247,7 @@ var ts;
41225
41247
  var ctor = findConstructorDeclaration(location.parent);
41226
41248
  if (ctor && ctor.locals) {
41227
41249
  if (lookup(ctor.locals, name, meaning & 111551)) {
41250
+ ts.Debug.assertNode(location, ts.isPropertyDeclaration);
41228
41251
  propertyWithInvalidInitializer = location;
41229
41252
  }
41230
41253
  }
@@ -41370,11 +41393,21 @@ var ts;
41370
41393
  }
41371
41394
  }
41372
41395
  }
41396
+ function checkAndReportErrorForInvalidInitializer() {
41397
+ if (propertyWithInvalidInitializer && !(ts.getEmitScriptTarget(compilerOptions) === 99 && useDefineForClassFields)) {
41398
+ error(errorLocation, errorLocation && propertyWithInvalidInitializer.type && ts.textRangeContainsPositionInclusive(propertyWithInvalidInitializer.type, errorLocation.pos)
41399
+ ? ts.Diagnostics.Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor
41400
+ : ts.Diagnostics.Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor, ts.declarationNameToString(propertyWithInvalidInitializer.name), diagnosticName(nameArg));
41401
+ return true;
41402
+ }
41403
+ return false;
41404
+ }
41373
41405
  if (!result) {
41374
41406
  if (nameNotFoundMessage) {
41375
41407
  addLazyDiagnostic(function () {
41376
41408
  if (!errorLocation ||
41377
41409
  !checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) &&
41410
+ !checkAndReportErrorForInvalidInitializer() &&
41378
41411
  !checkAndReportErrorForExtendingInterface(errorLocation) &&
41379
41412
  !checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) &&
41380
41413
  !checkAndReportErrorForExportingPrimitiveType(errorLocation, name) &&
@@ -41382,7 +41415,14 @@ var ts;
41382
41415
  !checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation, name, meaning) &&
41383
41416
  !checkAndReportErrorForUsingValueAsType(errorLocation, name, meaning)) {
41384
41417
  var suggestion = void 0;
41385
- if (getSpellingSuggestions && suggestionCount < maximumSuggestionCount) {
41418
+ var suggestedLib = void 0;
41419
+ if (nameArg) {
41420
+ suggestedLib = getSuggestedLibForNonExistentName(nameArg);
41421
+ if (suggestedLib) {
41422
+ error(errorLocation, nameNotFoundMessage, diagnosticName(nameArg), suggestedLib);
41423
+ }
41424
+ }
41425
+ if (!suggestedLib && getSpellingSuggestions && suggestionCount < maximumSuggestionCount) {
41386
41426
  suggestion = getSuggestedSymbolForNonexistentSymbol(originalLocation, name, meaning);
41387
41427
  var isGlobalScopeAugmentationDeclaration = (suggestion === null || suggestion === void 0 ? void 0 : suggestion.valueDeclaration) && ts.isAmbientModule(suggestion.valueDeclaration) && ts.isGlobalScopeAugmentation(suggestion.valueDeclaration);
41388
41428
  if (isGlobalScopeAugmentationDeclaration) {
@@ -41401,16 +41441,8 @@ var ts;
41401
41441
  }
41402
41442
  }
41403
41443
  }
41404
- if (!suggestion) {
41405
- if (nameArg) {
41406
- var lib = getSuggestedLibForNonExistentName(nameArg);
41407
- if (lib) {
41408
- error(errorLocation, nameNotFoundMessage, diagnosticName(nameArg), lib);
41409
- }
41410
- else {
41411
- error(errorLocation, nameNotFoundMessage, diagnosticName(nameArg));
41412
- }
41413
- }
41444
+ if (!suggestion && !suggestedLib && nameArg) {
41445
+ error(errorLocation, nameNotFoundMessage, diagnosticName(nameArg));
41414
41446
  }
41415
41447
  suggestionCount++;
41416
41448
  }
@@ -41418,9 +41450,7 @@ var ts;
41418
41450
  }
41419
41451
  return undefined;
41420
41452
  }
41421
- if (propertyWithInvalidInitializer && !(ts.getEmitScriptTarget(compilerOptions) === 99 && useDefineForClassFields)) {
41422
- var propertyName = propertyWithInvalidInitializer.name;
41423
- error(errorLocation, ts.Diagnostics.Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor, ts.declarationNameToString(propertyName), diagnosticName(nameArg));
41453
+ else if (checkAndReportErrorForInvalidInitializer()) {
41424
41454
  return undefined;
41425
41455
  }
41426
41456
  if (nameNotFoundMessage) {
@@ -43294,13 +43324,25 @@ var ts;
43294
43324
  && isDeclarationVisible(declaration.parent)) {
43295
43325
  return addVisibleAlias(declaration, declaration);
43296
43326
  }
43297
- else if (symbol.flags & 2097152 && ts.isBindingElement(declaration) && ts.isInJSFile(declaration) && ((_a = declaration.parent) === null || _a === void 0 ? void 0 : _a.parent)
43298
- && ts.isVariableDeclaration(declaration.parent.parent)
43299
- && ((_b = declaration.parent.parent.parent) === null || _b === void 0 ? void 0 : _b.parent) && ts.isVariableStatement(declaration.parent.parent.parent.parent)
43300
- && !ts.hasSyntacticModifier(declaration.parent.parent.parent.parent, 1)
43301
- && declaration.parent.parent.parent.parent.parent
43302
- && isDeclarationVisible(declaration.parent.parent.parent.parent.parent)) {
43303
- return addVisibleAlias(declaration, declaration.parent.parent.parent.parent);
43327
+ else if (ts.isBindingElement(declaration)) {
43328
+ if (symbol.flags & 2097152 && ts.isInJSFile(declaration) && ((_a = declaration.parent) === null || _a === void 0 ? void 0 : _a.parent)
43329
+ && ts.isVariableDeclaration(declaration.parent.parent)
43330
+ && ((_b = declaration.parent.parent.parent) === null || _b === void 0 ? void 0 : _b.parent) && ts.isVariableStatement(declaration.parent.parent.parent.parent)
43331
+ && !ts.hasSyntacticModifier(declaration.parent.parent.parent.parent, 1)
43332
+ && declaration.parent.parent.parent.parent.parent
43333
+ && isDeclarationVisible(declaration.parent.parent.parent.parent.parent)) {
43334
+ return addVisibleAlias(declaration, declaration.parent.parent.parent.parent);
43335
+ }
43336
+ else if (symbol.flags & 2) {
43337
+ var variableStatement = ts.findAncestor(declaration, ts.isVariableStatement);
43338
+ if (ts.hasSyntacticModifier(variableStatement, 1)) {
43339
+ return true;
43340
+ }
43341
+ if (!isDeclarationVisible(variableStatement.parent)) {
43342
+ return false;
43343
+ }
43344
+ return addVisibleAlias(declaration, variableStatement);
43345
+ }
43304
43346
  }
43305
43347
  return false;
43306
43348
  }
@@ -43791,6 +43833,10 @@ var ts;
43791
43833
  }
43792
43834
  return typeToTypeNodeHelper(type, context);
43793
43835
  }
43836
+ function isHomomorphicMappedTypeWithNonHomomorphicInstantiation(type) {
43837
+ return isMappedTypeWithKeyofConstraintDeclaration(type)
43838
+ && !(getModifiersTypeFromMappedType(type).flags & 262144);
43839
+ }
43794
43840
  function createMappedTypeNodeFromType(type) {
43795
43841
  ts.Debug.assert(!!(type.flags & 524288));
43796
43842
  var readonlyToken = type.declaration.readonlyToken ? ts.factory.createToken(type.declaration.readonlyToken.kind) : undefined;
@@ -43798,7 +43844,7 @@ var ts;
43798
43844
  var appropriateConstraintTypeNode;
43799
43845
  var newTypeVariable;
43800
43846
  if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
43801
- if (!(getModifiersTypeFromMappedType(type).flags & 262144) && context.flags & 4) {
43847
+ if (isHomomorphicMappedTypeWithNonHomomorphicInstantiation(type) && context.flags & 4) {
43802
43848
  var newParam = createTypeParameter(createSymbol(262144, "T"));
43803
43849
  var name = typeParameterToName(newParam, context);
43804
43850
  newTypeVariable = ts.factory.createTypeReferenceNode(name);
@@ -43814,8 +43860,9 @@ var ts;
43814
43860
  var mappedTypeNode = ts.factory.createMappedTypeNode(readonlyToken, typeParameterNode, nameTypeNode, questionToken, templateTypeNode, undefined);
43815
43861
  context.approximateLength += 10;
43816
43862
  var result = ts.setEmitFlags(mappedTypeNode, 1);
43817
- if (isMappedTypeWithKeyofConstraintDeclaration(type) && !(getModifiersTypeFromMappedType(type).flags & 262144) && context.flags & 4) {
43818
- return ts.factory.createConditionalTypeNode(typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context), ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(undefined, ts.factory.cloneNode(newTypeVariable.typeName))), result, ts.factory.createKeywordTypeNode(143));
43863
+ if (isHomomorphicMappedTypeWithNonHomomorphicInstantiation(type) && context.flags & 4) {
43864
+ var originalConstraint = instantiateType(getConstraintOfTypeParameter(getTypeFromTypeNode(type.declaration.typeParameter.constraint.type)) || unknownType, type.mapper);
43865
+ return ts.factory.createConditionalTypeNode(typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context), ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(undefined, ts.factory.cloneNode(newTypeVariable.typeName), originalConstraint.flags & 2 ? undefined : typeToTypeNodeHelper(originalConstraint, context))), result, ts.factory.createKeywordTypeNode(143));
43819
43866
  }
43820
43867
  return result;
43821
43868
  }
@@ -51774,19 +51821,22 @@ var ts;
51774
51821
  return getUnionType(ts.concatenate(propertyTypes, indexKeyTypes), 1, undefined, undefined, origin);
51775
51822
  }
51776
51823
  function isPossiblyReducibleByInstantiation(type) {
51777
- return ts.some(type.types, function (t) {
51778
- var uniqueFilled = getUniqueLiteralFilledInstantiation(t);
51779
- return getReducedType(uniqueFilled) !== uniqueFilled;
51780
- });
51824
+ var uniqueFilled = getUniqueLiteralFilledInstantiation(type);
51825
+ return getReducedType(uniqueFilled) !== uniqueFilled;
51826
+ }
51827
+ function shouldDeferIndexType(type) {
51828
+ return !!(type.flags & 58982400 ||
51829
+ isGenericTupleType(type) ||
51830
+ isGenericMappedType(type) && !hasDistributiveNameType(type) ||
51831
+ type.flags & 1048576 && ts.some(type.types, isPossiblyReducibleByInstantiation) ||
51832
+ type.flags & 2097152 && maybeTypeOfKind(type, 465829888) && ts.some(type.types, isEmptyAnonymousObjectType));
51781
51833
  }
51782
51834
  function getIndexType(type, stringsOnly, noIndexSignatures) {
51783
51835
  if (stringsOnly === void 0) { stringsOnly = keyofStringsOnly; }
51784
51836
  type = getReducedType(type);
51785
- return type.flags & 1048576 ? isPossiblyReducibleByInstantiation(type)
51786
- ? getIndexTypeForGenericType(type, stringsOnly)
51787
- : getIntersectionType(ts.map(type.types, function (t) { return getIndexType(t, stringsOnly, noIndexSignatures); })) :
51788
- type.flags & 2097152 ? getUnionType(ts.map(type.types, function (t) { return getIndexType(t, stringsOnly, noIndexSignatures); })) :
51789
- type.flags & 58982400 || isGenericTupleType(type) || isGenericMappedType(type) && !hasDistributiveNameType(type) ? getIndexTypeForGenericType(type, stringsOnly) :
51837
+ return shouldDeferIndexType(type) ? getIndexTypeForGenericType(type, stringsOnly) :
51838
+ type.flags & 1048576 ? getIntersectionType(ts.map(type.types, function (t) { return getIndexType(t, stringsOnly, noIndexSignatures); })) :
51839
+ type.flags & 2097152 ? getUnionType(ts.map(type.types, function (t) { return getIndexType(t, stringsOnly, noIndexSignatures); })) :
51790
51840
  ts.getObjectFlags(type) & 32 ? getIndexTypeForMappedType(type, stringsOnly, noIndexSignatures) :
51791
51841
  type === wildcardType ? wildcardType :
51792
51842
  type.flags & 2 ? neverType :
@@ -55157,13 +55207,20 @@ var ts;
55157
55207
  return result;
55158
55208
  }
55159
55209
  function structuredTypeRelatedTo(source, target, reportErrors, intersectionState) {
55210
+ var saveErrorInfo = captureErrorCalculationState();
55211
+ var result = structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState, saveErrorInfo);
55212
+ if (result) {
55213
+ resetErrorInfo(saveErrorInfo);
55214
+ }
55215
+ return result;
55216
+ }
55217
+ function structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState, saveErrorInfo) {
55160
55218
  if (intersectionState & 4) {
55161
55219
  return propertiesRelatedTo(source, target, reportErrors, undefined, 0);
55162
55220
  }
55163
55221
  var result;
55164
55222
  var originalErrorInfo;
55165
55223
  var varianceCheckFailed = false;
55166
- var saveErrorInfo = captureErrorCalculationState();
55167
55224
  var sourceFlags = source.flags;
55168
55225
  var targetFlags = target.flags;
55169
55226
  if (relation === identityRelation) {
@@ -55212,7 +55269,6 @@ var ts;
55212
55269
  var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 ? source.types : [source], !!(target.flags & 1048576));
55213
55270
  if (constraint && everyType(constraint, function (c) { return c !== source; })) {
55214
55271
  if (result = isRelatedTo(constraint, target, 1, false, undefined, intersectionState)) {
55215
- resetErrorInfo(saveErrorInfo);
55216
55272
  return result;
55217
55273
  }
55218
55274
  }
@@ -55305,7 +55361,6 @@ var ts;
55305
55361
  result &= isRelatedTo(source.indexType, target.indexType, 3, reportErrors);
55306
55362
  }
55307
55363
  if (result) {
55308
- resetErrorInfo(saveErrorInfo);
55309
55364
  return result;
55310
55365
  }
55311
55366
  if (reportErrors) {
@@ -55381,7 +55436,6 @@ var ts;
55381
55436
  }
55382
55437
  else if (targetFlags & 16777216) {
55383
55438
  if (isDeeplyNestedType(target, targetStack, targetDepth, 10)) {
55384
- resetErrorInfo(saveErrorInfo);
55385
55439
  return 3;
55386
55440
  }
55387
55441
  var c = target;
@@ -55391,7 +55445,6 @@ var ts;
55391
55445
  if (result = skipTrue ? -1 : isRelatedTo(source, getTrueTypeFromConditionalType(c), 2, false)) {
55392
55446
  result &= skipFalse ? -1 : isRelatedTo(source, getFalseTypeFromConditionalType(c), 2, false);
55393
55447
  if (result) {
55394
- resetErrorInfo(saveErrorInfo);
55395
55448
  return result;
55396
55449
  }
55397
55450
  }
@@ -55419,18 +55472,15 @@ var ts;
55419
55472
  if (!(sourceFlags & 8388608 && targetFlags & 8388608)) {
55420
55473
  var constraint = getConstraintOfType(source) || unknownType;
55421
55474
  if (result = isRelatedTo(constraint, target, 1, false, undefined, intersectionState)) {
55422
- resetErrorInfo(saveErrorInfo);
55423
55475
  return result;
55424
55476
  }
55425
55477
  else if (result = isRelatedTo(getTypeWithThisArgument(constraint, source), target, 1, reportErrors && constraint !== unknownType && !(targetFlags & sourceFlags & 262144), undefined, intersectionState)) {
55426
- resetErrorInfo(saveErrorInfo);
55427
55478
  return result;
55428
55479
  }
55429
55480
  if (isMappedTypeGenericIndexedAccess(source)) {
55430
55481
  var indexConstraint = getConstraintOfType(source.indexType);
55431
55482
  if (indexConstraint) {
55432
55483
  if (result = isRelatedTo(getIndexedAccessType(source.objectType, indexConstraint), target, 1, reportErrors)) {
55433
- resetErrorInfo(saveErrorInfo);
55434
55484
  return result;
55435
55485
  }
55436
55486
  }
@@ -55439,7 +55489,6 @@ var ts;
55439
55489
  }
55440
55490
  else if (sourceFlags & 4194304) {
55441
55491
  if (result = isRelatedTo(keyofConstraintType, target, 1, reportErrors)) {
55442
- resetErrorInfo(saveErrorInfo);
55443
55492
  return result;
55444
55493
  }
55445
55494
  }
@@ -55447,7 +55496,6 @@ var ts;
55447
55496
  if (!(targetFlags & 134217728)) {
55448
55497
  var constraint = getBaseConstraintOfType(source);
55449
55498
  if (constraint && constraint !== source && (result = isRelatedTo(constraint, target, 1, reportErrors))) {
55450
- resetErrorInfo(saveErrorInfo);
55451
55499
  return result;
55452
55500
  }
55453
55501
  }
@@ -55458,21 +55506,18 @@ var ts;
55458
55506
  return 0;
55459
55507
  }
55460
55508
  if (result = isRelatedTo(source.type, target.type, 3, reportErrors)) {
55461
- resetErrorInfo(saveErrorInfo);
55462
55509
  return result;
55463
55510
  }
55464
55511
  }
55465
55512
  else {
55466
55513
  var constraint = getBaseConstraintOfType(source);
55467
55514
  if (constraint && (result = isRelatedTo(constraint, target, 1, reportErrors))) {
55468
- resetErrorInfo(saveErrorInfo);
55469
55515
  return result;
55470
55516
  }
55471
55517
  }
55472
55518
  }
55473
55519
  else if (sourceFlags & 16777216) {
55474
55520
  if (isDeeplyNestedType(source, sourceStack, sourceDepth, 10)) {
55475
- resetErrorInfo(saveErrorInfo);
55476
55521
  return 3;
55477
55522
  }
55478
55523
  if (targetFlags & 16777216) {
@@ -55491,7 +55536,6 @@ var ts;
55491
55536
  result &= isRelatedTo(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target), 3, reportErrors);
55492
55537
  }
55493
55538
  if (result) {
55494
- resetErrorInfo(saveErrorInfo);
55495
55539
  return result;
55496
55540
  }
55497
55541
  }
@@ -55500,7 +55544,6 @@ var ts;
55500
55544
  var distributiveConstraint = hasNonCircularBaseConstraint(source) ? getConstraintOfDistributiveConditionalType(source) : undefined;
55501
55545
  if (distributiveConstraint) {
55502
55546
  if (result = isRelatedTo(distributiveConstraint, target, 1, reportErrors)) {
55503
- resetErrorInfo(saveErrorInfo);
55504
55547
  return result;
55505
55548
  }
55506
55549
  }
@@ -55508,7 +55551,6 @@ var ts;
55508
55551
  var defaultConstraint = getDefaultConstraintOfConditionalType(source);
55509
55552
  if (defaultConstraint) {
55510
55553
  if (result = isRelatedTo(defaultConstraint, target, 1, reportErrors)) {
55511
- resetErrorInfo(saveErrorInfo);
55512
55554
  return result;
55513
55555
  }
55514
55556
  }
@@ -55520,7 +55562,6 @@ var ts;
55520
55562
  if (isGenericMappedType(target)) {
55521
55563
  if (isGenericMappedType(source)) {
55522
55564
  if (result = mappedTypeRelatedTo(source, target, reportErrors)) {
55523
- resetErrorInfo(saveErrorInfo);
55524
55565
  return result;
55525
55566
  }
55526
55567
  }
@@ -58379,6 +58420,14 @@ var ts;
58379
58420
  var key = getFlowCacheKey(node.expression, declaredType, initialType, flowContainer);
58380
58421
  return key && key + "." + propName;
58381
58422
  }
58423
+ break;
58424
+ case 201:
58425
+ case 202:
58426
+ case 256:
58427
+ case 213:
58428
+ case 214:
58429
+ case 169:
58430
+ return getNodeId(node) + "#" + getTypeId(declaredType);
58382
58431
  }
58383
58432
  return undefined;
58384
58433
  }
@@ -60324,7 +60373,7 @@ var ts;
60324
60373
  !((ts.isJsxOpeningElement(node.parent) || ts.isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) &&
60325
60374
  (checkMode && checkMode & 64 ?
60326
60375
  getContextualType(node, 8)
60327
- : getContextualType(node));
60376
+ : getContextualType(node, undefined));
60328
60377
  return contextualType && !isGenericType(contextualType);
60329
60378
  }
60330
60379
  function getNarrowableTypeForReference(type, reference, checkMode) {
@@ -60981,7 +61030,7 @@ var ts;
60981
61030
  if (noImplicitThis || inJs) {
60982
61031
  var containingLiteral = getContainingObjectLiteral(func);
60983
61032
  if (containingLiteral) {
60984
- var contextualType = getApparentTypeOfContextualType(containingLiteral);
61033
+ var contextualType = getApparentTypeOfContextualType(containingLiteral, undefined);
60985
61034
  var literal = containingLiteral;
60986
61035
  var type = contextualType;
60987
61036
  while (type) {
@@ -60993,7 +61042,7 @@ var ts;
60993
61042
  break;
60994
61043
  }
60995
61044
  literal = literal.parent.parent;
60996
- type = getApparentTypeOfContextualType(literal);
61045
+ type = getApparentTypeOfContextualType(literal, undefined);
60997
61046
  }
60998
61047
  return getWidenedType(contextualType ? getNonNullableType(contextualType) : checkExpressionCached(containingLiteral));
60999
61048
  }
@@ -61043,7 +61092,7 @@ var ts;
61043
61092
  tryGetTypeAtPosition(contextualSignature, index);
61044
61093
  }
61045
61094
  }
61046
- function getContextualTypeForVariableLikeDeclaration(declaration) {
61095
+ function getContextualTypeForVariableLikeDeclaration(declaration, contextFlags) {
61047
61096
  var typeNode = ts.getEffectiveTypeAnnotationNode(declaration);
61048
61097
  if (typeNode) {
61049
61098
  return getTypeFromTypeNode(typeNode);
@@ -61052,17 +61101,17 @@ var ts;
61052
61101
  case 164:
61053
61102
  return getContextuallyTypedParameterType(declaration);
61054
61103
  case 203:
61055
- return getContextualTypeForBindingElement(declaration);
61104
+ return getContextualTypeForBindingElement(declaration, contextFlags);
61056
61105
  case 167:
61057
61106
  if (ts.isStatic(declaration)) {
61058
- return getContextualTypeForStaticPropertyDeclaration(declaration);
61107
+ return getContextualTypeForStaticPropertyDeclaration(declaration, contextFlags);
61059
61108
  }
61060
61109
  }
61061
61110
  }
61062
- function getContextualTypeForBindingElement(declaration) {
61111
+ function getContextualTypeForBindingElement(declaration, contextFlags) {
61063
61112
  var parent = declaration.parent.parent;
61064
61113
  var name = declaration.propertyName || declaration.name;
61065
- var parentType = getContextualTypeForVariableLikeDeclaration(parent) ||
61114
+ var parentType = getContextualTypeForVariableLikeDeclaration(parent, contextFlags) ||
61066
61115
  parent.kind !== 203 && parent.initializer && checkDeclarationInitializer(parent, declaration.dotDotDotToken ? 64 : 0);
61067
61116
  if (!parentType || ts.isBindingPattern(name) || ts.isComputedNonLiteralName(name))
61068
61117
  return undefined;
@@ -61078,8 +61127,8 @@ var ts;
61078
61127
  return getTypeOfPropertyOfType(parentType, text);
61079
61128
  }
61080
61129
  }
61081
- function getContextualTypeForStaticPropertyDeclaration(declaration) {
61082
- var parentType = ts.isExpression(declaration.parent) && getContextualType(declaration.parent);
61130
+ function getContextualTypeForStaticPropertyDeclaration(declaration, contextFlags) {
61131
+ var parentType = ts.isExpression(declaration.parent) && getContextualType(declaration.parent, contextFlags);
61083
61132
  if (!parentType)
61084
61133
  return undefined;
61085
61134
  return getTypeOfPropertyOfContextualType(parentType, getSymbolOfNode(declaration).escapedName);
@@ -61087,7 +61136,7 @@ var ts;
61087
61136
  function getContextualTypeForInitializerExpression(node, contextFlags) {
61088
61137
  var declaration = node.parent;
61089
61138
  if (ts.hasInitializer(declaration) && node === declaration.initializer) {
61090
- var result = getContextualTypeForVariableLikeDeclaration(declaration);
61139
+ var result = getContextualTypeForVariableLikeDeclaration(declaration, contextFlags);
61091
61140
  if (result) {
61092
61141
  return result;
61093
61142
  }
@@ -61097,10 +61146,10 @@ var ts;
61097
61146
  }
61098
61147
  return undefined;
61099
61148
  }
61100
- function getContextualTypeForReturnExpression(node) {
61149
+ function getContextualTypeForReturnExpression(node, contextFlags) {
61101
61150
  var func = ts.getContainingFunction(node);
61102
61151
  if (func) {
61103
- var contextualReturnType = getContextualReturnType(func);
61152
+ var contextualReturnType = getContextualReturnType(func, contextFlags);
61104
61153
  if (contextualReturnType) {
61105
61154
  var functionFlags = ts.getFunctionFlags(func);
61106
61155
  if (functionFlags & 1) {
@@ -61128,11 +61177,11 @@ var ts;
61128
61177
  }
61129
61178
  return undefined;
61130
61179
  }
61131
- function getContextualTypeForYieldOperand(node) {
61180
+ function getContextualTypeForYieldOperand(node, contextFlags) {
61132
61181
  var func = ts.getContainingFunction(node);
61133
61182
  if (func) {
61134
61183
  var functionFlags = ts.getFunctionFlags(func);
61135
- var contextualReturnType = getContextualReturnType(func);
61184
+ var contextualReturnType = getContextualReturnType(func, contextFlags);
61136
61185
  if (contextualReturnType) {
61137
61186
  return node.asteriskToken
61138
61187
  ? contextualReturnType
@@ -61156,14 +61205,14 @@ var ts;
61156
61205
  }
61157
61206
  function getContextualIterationType(kind, functionDecl) {
61158
61207
  var isAsync = !!(ts.getFunctionFlags(functionDecl) & 2);
61159
- var contextualReturnType = getContextualReturnType(functionDecl);
61208
+ var contextualReturnType = getContextualReturnType(functionDecl, undefined);
61160
61209
  if (contextualReturnType) {
61161
61210
  return getIterationTypeOfGeneratorFunctionReturnType(kind, contextualReturnType, isAsync)
61162
61211
  || undefined;
61163
61212
  }
61164
61213
  return undefined;
61165
61214
  }
61166
- function getContextualReturnType(functionDecl) {
61215
+ function getContextualReturnType(functionDecl, contextFlags) {
61167
61216
  var returnType = getReturnTypeFromAnnotation(functionDecl);
61168
61217
  if (returnType) {
61169
61218
  return returnType;
@@ -61174,7 +61223,7 @@ var ts;
61174
61223
  }
61175
61224
  var iife = ts.getImmediatelyInvokedFunctionExpression(functionDecl);
61176
61225
  if (iife) {
61177
- return getContextualType(iife);
61226
+ return getContextualType(iife, contextFlags);
61178
61227
  }
61179
61228
  return undefined;
61180
61229
  }
@@ -61404,7 +61453,7 @@ var ts;
61404
61453
  }
61405
61454
  function getContextualTypeForObjectLiteralElement(element, contextFlags) {
61406
61455
  var objectLiteral = element.parent;
61407
- var propertyAssignmentType = ts.isPropertyAssignment(element) && getContextualTypeForVariableLikeDeclaration(element);
61456
+ var propertyAssignmentType = ts.isPropertyAssignment(element) && getContextualTypeForVariableLikeDeclaration(element, contextFlags);
61408
61457
  if (propertyAssignmentType) {
61409
61458
  return propertyAssignmentType;
61410
61459
  }
@@ -61549,9 +61598,9 @@ var ts;
61549
61598
  return getContextualTypeForInitializerExpression(node, contextFlags);
61550
61599
  case 214:
61551
61600
  case 247:
61552
- return getContextualTypeForReturnExpression(node);
61601
+ return getContextualTypeForReturnExpression(node, contextFlags);
61553
61602
  case 224:
61554
- return getContextualTypeForYieldOperand(parent);
61603
+ return getContextualTypeForYieldOperand(parent, contextFlags);
61555
61604
  case 218:
61556
61605
  return getContextualTypeForAwaitOperand(parent, contextFlags);
61557
61606
  case 208:
@@ -61598,7 +61647,7 @@ var ts;
61598
61647
  }
61599
61648
  return undefined;
61600
61649
  function tryFindWhenConstTypeReference(node) {
61601
- return getContextualType(node);
61650
+ return getContextualType(node, contextFlags);
61602
61651
  }
61603
61652
  }
61604
61653
  function getInferenceContext(node) {
@@ -61867,7 +61916,7 @@ var ts;
61867
61916
  var elementCount = elements.length;
61868
61917
  var elementTypes = [];
61869
61918
  var elementFlags = [];
61870
- var contextualType = getApparentTypeOfContextualType(node);
61919
+ var contextualType = getApparentTypeOfContextualType(node, undefined);
61871
61920
  var inDestructuringPattern = ts.isAssignmentTarget(node);
61872
61921
  var inConstContext = isConstContext(node);
61873
61922
  var hasOmittedExpression = false;
@@ -62016,7 +62065,7 @@ var ts;
62016
62065
  var propertiesTable = ts.createSymbolTable();
62017
62066
  var propertiesArray = [];
62018
62067
  var spread = emptyObjectType;
62019
- var contextualType = getApparentTypeOfContextualType(node);
62068
+ var contextualType = getApparentTypeOfContextualType(node, undefined);
62020
62069
  var contextualTypeHasPattern = contextualType && contextualType.pattern &&
62021
62070
  (contextualType.pattern.kind === 201 || contextualType.pattern.kind === 205);
62022
62071
  var inConstContext = isConstContext(node);
@@ -62314,7 +62363,7 @@ var ts;
62314
62363
  if (explicitlySpecifyChildrenAttribute) {
62315
62364
  error(attributes, ts.Diagnostics._0_are_specified_twice_The_attribute_named_0_will_be_overwritten, ts.unescapeLeadingUnderscores(jsxChildrenPropertyName));
62316
62365
  }
62317
- var contextualType = getApparentTypeOfContextualType(openingLikeElement.attributes);
62366
+ var contextualType = getApparentTypeOfContextualType(openingLikeElement.attributes, undefined);
62318
62367
  var childrenContextualType = contextualType && getTypeOfPropertyOfContextualType(contextualType, jsxChildrenPropertyName);
62319
62368
  var childrenPropSymbol = createSymbol(4, jsxChildrenPropertyName);
62320
62369
  childrenPropSymbol.type = childrenTypes.length === 1 ? childrenTypes[0] :
@@ -65602,13 +65651,6 @@ var ts;
65602
65651
  }
65603
65652
  }
65604
65653
  }
65605
- var restType = getEffectiveRestType(context);
65606
- if (restType && restType.flags & 262144) {
65607
- var instantiatedContext = instantiateSignature(context, inferenceContext.nonFixingMapper);
65608
- assignContextualParameterTypes(signature, instantiatedContext);
65609
- var restPos = getParameterCount(context) - 1;
65610
- inferTypes(inferenceContext.inferences, getRestTypeAtPosition(signature, restPos), restType);
65611
- }
65612
65654
  }
65613
65655
  function assignContextualParameterTypes(signature, context) {
65614
65656
  if (context.typeParameters) {
@@ -65781,7 +65823,7 @@ var ts;
65781
65823
  var contextualSignature = getContextualSignatureForFunctionLikeDeclaration(func);
65782
65824
  var contextualType = !contextualSignature ? undefined :
65783
65825
  contextualSignature === getSignatureFromDeclaration(func) ? isGenerator ? undefined : returnType :
65784
- instantiateContextualType(getReturnTypeOfSignature(contextualSignature), func);
65826
+ instantiateContextualType(getReturnTypeOfSignature(contextualSignature), func, undefined);
65785
65827
  if (isGenerator) {
65786
65828
  yieldType = getWidenedLiteralLikeTypeForContextualIterationTypeIfNeeded(yieldType, contextualType, 0, isAsync);
65787
65829
  returnType = getWidenedLiteralLikeTypeForContextualIterationTypeIfNeeded(returnType, contextualType, 1, isAsync);
@@ -65844,7 +65886,7 @@ var ts;
65844
65886
  nextType = iterationTypes && iterationTypes.nextType;
65845
65887
  }
65846
65888
  else {
65847
- nextType = getContextualType(yieldExpression);
65889
+ nextType = getContextualType(yieldExpression, undefined);
65848
65890
  }
65849
65891
  if (nextType)
65850
65892
  ts.pushIfUnique(nextTypes, nextType);
@@ -66017,11 +66059,16 @@ var ts;
66017
66059
  if (isContextSensitive(node)) {
66018
66060
  if (contextualSignature) {
66019
66061
  var inferenceContext = getInferenceContext(node);
66062
+ var instantiatedContextualSignature = void 0;
66020
66063
  if (checkMode && checkMode & 2) {
66021
66064
  inferFromAnnotatedParameters(signature, contextualSignature, inferenceContext);
66065
+ var restType = getEffectiveRestType(contextualSignature);
66066
+ if (restType && restType.flags & 262144) {
66067
+ instantiatedContextualSignature = instantiateSignature(contextualSignature, inferenceContext.nonFixingMapper);
66068
+ }
66022
66069
  }
66023
- var instantiatedContextualSignature = inferenceContext ?
66024
- instantiateSignature(contextualSignature, inferenceContext.mapper) : contextualSignature;
66070
+ instantiatedContextualSignature || (instantiatedContextualSignature = inferenceContext ?
66071
+ instantiateSignature(contextualSignature, inferenceContext.mapper) : contextualSignature);
66025
66072
  assignContextualParameterTypes(signature, instantiatedContextualSignature);
66026
66073
  }
66027
66074
  else {
@@ -67136,7 +67183,7 @@ var ts;
67136
67183
  type = anyType;
67137
67184
  addLazyDiagnostic(function () {
67138
67185
  if (noImplicitAny && !ts.expressionResultIsUnused(node)) {
67139
- var contextualType = getContextualType(node);
67186
+ var contextualType = getContextualType(node, undefined);
67140
67187
  if (!contextualType || isTypeAny(contextualType)) {
67141
67188
  error(node, ts.Diagnostics.yield_expression_implicitly_results_in_an_any_type_because_its_containing_generator_lacks_a_return_type_annotation);
67142
67189
  }
@@ -67177,7 +67224,7 @@ var ts;
67177
67224
  texts.push(span.literal.text);
67178
67225
  types.push(isTypeAssignableTo(type, templateConstraintType) ? type : stringType);
67179
67226
  }
67180
- return isConstContext(node) || isTemplateLiteralContext(node) || someType(getContextualType(node) || unknownType, isTemplateLiteralContextualType) ? getTemplateLiteralType(texts, types) : stringType;
67227
+ return isConstContext(node) || isTemplateLiteralContext(node) || someType(getContextualType(node, undefined) || unknownType, isTemplateLiteralContextualType) ? getTemplateLiteralType(texts, types) : stringType;
67181
67228
  }
67182
67229
  function isTemplateLiteralContextualType(type) {
67183
67230
  return !!(type.flags & (128 | 134217728) ||
@@ -67200,7 +67247,7 @@ var ts;
67200
67247
  if (inferenceContext && inferenceContext.intraExpressionInferenceSites) {
67201
67248
  inferenceContext.intraExpressionInferenceSites = undefined;
67202
67249
  }
67203
- var result = maybeTypeOfKind(type, 2944) && isLiteralOfContextualType(type, instantiateContextualType(contextualType, node)) ?
67250
+ var result = maybeTypeOfKind(type, 2944) && isLiteralOfContextualType(type, instantiateContextualType(contextualType, node, undefined)) ?
67204
67251
  getRegularTypeOfLiteralType(type) : type;
67205
67252
  return result;
67206
67253
  }
@@ -67304,7 +67351,7 @@ var ts;
67304
67351
  var type = checkExpression(node, checkMode, forceTuple);
67305
67352
  return isConstContext(node) || ts.isCommonJsExportedExpression(node) ? getRegularTypeOfLiteralType(type) :
67306
67353
  isTypeAssertion(node) ? type :
67307
- getWidenedLiteralLikeTypeForContextualType(type, instantiateContextualType(arguments.length === 2 ? getContextualType(node) : contextualType, node));
67354
+ getWidenedLiteralLikeTypeForContextualType(type, instantiateContextualType(arguments.length === 2 ? getContextualType(node, undefined) : contextualType, node, undefined));
67308
67355
  }
67309
67356
  function checkPropertyAssignment(node, checkMode) {
67310
67357
  if (node.name.kind === 162) {