typescript 4.8.0-dev.20220704 → 4.8.0-dev.20220707

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/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.20220704";
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() {
@@ -4746,6 +4762,7 @@ var ts;
4746
4762
  NodeBuilderFlags[NodeBuilderFlags["UseAliasDefinedOutsideCurrentScope"] = 16384] = "UseAliasDefinedOutsideCurrentScope";
4747
4763
  NodeBuilderFlags[NodeBuilderFlags["UseSingleQuotesForStringLiteralType"] = 268435456] = "UseSingleQuotesForStringLiteralType";
4748
4764
  NodeBuilderFlags[NodeBuilderFlags["NoTypeReduction"] = 536870912] = "NoTypeReduction";
4765
+ NodeBuilderFlags[NodeBuilderFlags["OmitThisParameter"] = 33554432] = "OmitThisParameter";
4749
4766
  // Error handling
4750
4767
  NodeBuilderFlags[NodeBuilderFlags["AllowThisInObjectLiteral"] = 32768] = "AllowThisInObjectLiteral";
4751
4768
  NodeBuilderFlags[NodeBuilderFlags["AllowQualifiedNameInPlaceOfIdentifier"] = 65536] = "AllowQualifiedNameInPlaceOfIdentifier";
@@ -4786,6 +4803,7 @@ var ts;
4786
4803
  TypeFormatFlags[TypeFormatFlags["UseAliasDefinedOutsideCurrentScope"] = 16384] = "UseAliasDefinedOutsideCurrentScope";
4787
4804
  TypeFormatFlags[TypeFormatFlags["UseSingleQuotesForStringLiteralType"] = 268435456] = "UseSingleQuotesForStringLiteralType";
4788
4805
  TypeFormatFlags[TypeFormatFlags["NoTypeReduction"] = 536870912] = "NoTypeReduction";
4806
+ TypeFormatFlags[TypeFormatFlags["OmitThisParameter"] = 33554432] = "OmitThisParameter";
4789
4807
  // Error Handling
4790
4808
  TypeFormatFlags[TypeFormatFlags["AllowUniqueESSymbolType"] = 1048576] = "AllowUniqueESSymbolType";
4791
4809
  // TypeFormatFlags exclusive
@@ -4797,7 +4815,7 @@ var ts;
4797
4815
  TypeFormatFlags[TypeFormatFlags["InFirstTypeArgument"] = 4194304] = "InFirstTypeArgument";
4798
4816
  TypeFormatFlags[TypeFormatFlags["InTypeAlias"] = 8388608] = "InTypeAlias";
4799
4817
  /** @deprecated */ TypeFormatFlags[TypeFormatFlags["WriteOwnNameForAnyLike"] = 0] = "WriteOwnNameForAnyLike";
4800
- TypeFormatFlags[TypeFormatFlags["NodeBuilderFlagsMask"] = 814775659] = "NodeBuilderFlagsMask";
4818
+ TypeFormatFlags[TypeFormatFlags["NodeBuilderFlagsMask"] = 848330091] = "NodeBuilderFlagsMask";
4801
4819
  })(TypeFormatFlags = ts.TypeFormatFlags || (ts.TypeFormatFlags = {}));
4802
4820
  var SymbolFormatFlags;
4803
4821
  (function (SymbolFormatFlags) {
@@ -19529,7 +19547,8 @@ var ts;
19529
19547
  function getDeclarationModifierFlagsFromSymbol(s, isWrite) {
19530
19548
  if (isWrite === void 0) { isWrite = false; }
19531
19549
  if (s.valueDeclaration) {
19532
- var declaration = (isWrite && s.declarations && ts.find(s.declarations, function (d) { return d.kind === 173 /* SetAccessor */; })) || s.valueDeclaration;
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;
19533
19552
  var flags = ts.getCombinedModifierFlags(declaration);
19534
19553
  return s.parent && s.parent.flags & 32 /* Class */ ? flags : flags & ~28 /* AccessibilityModifier */;
19535
19554
  }
@@ -20204,7 +20223,7 @@ var ts;
20204
20223
  // Excludes declaration files - they still require an explicit `export {}` or the like
20205
20224
  // for back compat purposes. The only non-declaration files _not_ forced to be a module are `.js` files
20206
20225
  // that aren't esm-mode (meaning not in a `type: module` scope).
20207
- 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;
20208
20227
  }
20209
20228
  function getSetExternalModuleIndicator(options) {
20210
20229
  // TODO: Should this callback be cached?
@@ -20227,10 +20246,7 @@ var ts;
20227
20246
  if (options.jsx === 4 /* ReactJSX */ || options.jsx === 5 /* ReactJSXDev */) {
20228
20247
  checks.push(isFileModuleFromUsingJSXTag);
20229
20248
  }
20230
- var moduleKind = getEmitModuleKind(options);
20231
- if (moduleKind === ts.ModuleKind.Node16 || moduleKind === ts.ModuleKind.NodeNext) {
20232
- checks.push(isFileForcedToBeModuleByFormat);
20233
- }
20249
+ checks.push(isFileForcedToBeModuleByFormat);
20234
20250
  var combined_1 = ts.or.apply(void 0, checks);
20235
20251
  var callback = function (file) { return void (file.externalModuleIndicator = combined_1(file)); };
20236
20252
  return callback;
@@ -33950,10 +33966,10 @@ var ts;
33950
33966
  var hasJSDoc = hasPrecedingJSDocComment();
33951
33967
  var modifiers = parseModifiers();
33952
33968
  if (parseContextualModifier(136 /* GetKeyword */)) {
33953
- return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 172 /* GetAccessor */);
33969
+ return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 172 /* GetAccessor */, 4 /* Type */);
33954
33970
  }
33955
33971
  if (parseContextualModifier(149 /* SetKeyword */)) {
33956
- return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 173 /* SetAccessor */);
33972
+ return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 173 /* SetAccessor */, 4 /* Type */);
33957
33973
  }
33958
33974
  if (isIndexSignature()) {
33959
33975
  return parseIndexSignatureDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers);
@@ -35999,10 +36015,10 @@ var ts;
35999
36015
  var decorators = parseDecorators();
36000
36016
  var modifiers = parseModifiers();
36001
36017
  if (parseContextualModifier(136 /* GetKeyword */)) {
36002
- return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172 /* GetAccessor */);
36018
+ return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172 /* GetAccessor */, 0 /* None */);
36003
36019
  }
36004
36020
  if (parseContextualModifier(149 /* SetKeyword */)) {
36005
- return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 173 /* SetAccessor */);
36021
+ return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 173 /* SetAccessor */, 0 /* None */);
36006
36022
  }
36007
36023
  var asteriskToken = parseOptionalToken(41 /* AsteriskToken */);
36008
36024
  var tokenIsIdentifier = isIdentifier();
@@ -36694,9 +36710,15 @@ var ts;
36694
36710
  return !scanner.hasPrecedingLineBreak() && (isIdentifier() || token() === 10 /* StringLiteral */);
36695
36711
  }
36696
36712
  function parseFunctionBlockOrSemicolon(flags, diagnosticMessage) {
36697
- if (token() !== 18 /* OpenBraceToken */ && canParseSemicolon()) {
36698
- parseSemicolon();
36699
- return;
36713
+ if (token() !== 18 /* OpenBraceToken */) {
36714
+ if (flags & 4 /* Type */) {
36715
+ parseTypeMemberSemicolon();
36716
+ return;
36717
+ }
36718
+ if (canParseSemicolon()) {
36719
+ parseSemicolon();
36720
+ return;
36721
+ }
36700
36722
  }
36701
36723
  return parseFunctionBlock(flags, diagnosticMessage);
36702
36724
  }
@@ -36900,12 +36922,12 @@ var ts;
36900
36922
  }
36901
36923
  return parsePropertyDeclaration(pos, hasJSDoc, decorators, modifiers, name, questionToken);
36902
36924
  }
36903
- function parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, kind) {
36925
+ function parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, kind, flags) {
36904
36926
  var name = parsePropertyName();
36905
36927
  var typeParameters = parseTypeParameters();
36906
36928
  var parameters = parseParameters(0 /* None */);
36907
36929
  var type = parseReturnType(58 /* ColonToken */, /*isType*/ false);
36908
- var body = parseFunctionBlockOrSemicolon(0 /* None */);
36930
+ var body = parseFunctionBlockOrSemicolon(flags);
36909
36931
  var node = kind === 172 /* GetAccessor */
36910
36932
  ? factory.createGetAccessorDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, parameters, type, body)
36911
36933
  : factory.createSetAccessorDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, parameters, body);
@@ -37092,10 +37114,10 @@ var ts;
37092
37114
  return parseClassStaticBlockDeclaration(pos, hasJSDoc, decorators, modifiers);
37093
37115
  }
37094
37116
  if (parseContextualModifier(136 /* GetKeyword */)) {
37095
- return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172 /* GetAccessor */);
37117
+ return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172 /* GetAccessor */, 0 /* None */);
37096
37118
  }
37097
37119
  if (parseContextualModifier(149 /* SetKeyword */)) {
37098
- return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 173 /* SetAccessor */);
37120
+ return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 173 /* SetAccessor */, 0 /* None */);
37099
37121
  }
37100
37122
  if (token() === 134 /* ConstructorKeyword */ || token() === 10 /* StringLiteral */) {
37101
37123
  var constructorDeclaration = tryParseConstructorDeclaration(pos, hasJSDoc, decorators, modifiers);
@@ -48499,7 +48521,7 @@ var ts;
48499
48521
  // Masks
48500
48522
  TypeFacts[TypeFacts["OrFactsMask"] = 8256] = "OrFactsMask";
48501
48523
  TypeFacts[TypeFacts["AndFactsMask"] = 134209471] = "AndFactsMask";
48502
- })(TypeFacts || (TypeFacts = {}));
48524
+ })(TypeFacts = ts.TypeFacts || (ts.TypeFacts = {}));
48503
48525
  var typeofNEFacts = new ts.Map(ts.getEntries({
48504
48526
  string: 256 /* TypeofNEString */,
48505
48527
  number: 512 /* TypeofNENumber */,
@@ -48534,7 +48556,7 @@ var ts;
48534
48556
  CheckMode[CheckMode["RestBindingElement"] = 64] = "RestBindingElement";
48535
48557
  // e.g. in `const { a, ...rest } = foo`, when checking the type of `foo` to determine the type of `rest`,
48536
48558
  // we need to preserve generic types instead of substituting them for constraints
48537
- })(CheckMode || (CheckMode = {}));
48559
+ })(CheckMode = ts.CheckMode || (ts.CheckMode = {}));
48538
48560
  var SignatureCheckMode;
48539
48561
  (function (SignatureCheckMode) {
48540
48562
  SignatureCheckMode[SignatureCheckMode["BivariantCallback"] = 1] = "BivariantCallback";
@@ -48542,7 +48564,7 @@ var ts;
48542
48564
  SignatureCheckMode[SignatureCheckMode["IgnoreReturnTypes"] = 4] = "IgnoreReturnTypes";
48543
48565
  SignatureCheckMode[SignatureCheckMode["StrictArity"] = 8] = "StrictArity";
48544
48566
  SignatureCheckMode[SignatureCheckMode["Callback"] = 3] = "Callback";
48545
- })(SignatureCheckMode || (SignatureCheckMode = {}));
48567
+ })(SignatureCheckMode = ts.SignatureCheckMode || (ts.SignatureCheckMode = {}));
48546
48568
  var IntersectionState;
48547
48569
  (function (IntersectionState) {
48548
48570
  IntersectionState[IntersectionState["None"] = 0] = "None";
@@ -48894,7 +48916,7 @@ var ts;
48894
48916
  },
48895
48917
  getContextualTypeForObjectLiteralElement: function (nodeIn) {
48896
48918
  var node = ts.getParseTreeNode(nodeIn, ts.isObjectLiteralElementLike);
48897
- return node ? getContextualTypeForObjectLiteralElement(node) : undefined;
48919
+ return node ? getContextualTypeForObjectLiteralElement(node, /*contextFlags*/ undefined) : undefined;
48898
48920
  },
48899
48921
  getContextualTypeForArgumentAtIndex: function (nodeIn, argIndex) {
48900
48922
  var node = ts.getParseTreeNode(nodeIn, ts.isCallLikeExpression);
@@ -48902,7 +48924,7 @@ var ts;
48902
48924
  },
48903
48925
  getContextualTypeForJsxAttribute: function (nodeIn) {
48904
48926
  var node = ts.getParseTreeNode(nodeIn, ts.isJsxAttributeLike);
48905
- return node && getContextualTypeForJsxAttribute(node);
48927
+ return node && getContextualTypeForJsxAttribute(node, /*contextFlags*/ undefined);
48906
48928
  },
48907
48929
  isContextSensitive: isContextSensitive,
48908
48930
  getTypeOfPropertyOfContextualType: getTypeOfPropertyOfContextualType,
@@ -49108,6 +49130,7 @@ var ts;
49108
49130
  var stringMappingTypes = new ts.Map();
49109
49131
  var substitutionTypes = new ts.Map();
49110
49132
  var subtypeReductionCache = new ts.Map();
49133
+ var cachedTypes = new ts.Map();
49111
49134
  var evolvingArrayTypes = [];
49112
49135
  var undefinedProperties = new ts.Map();
49113
49136
  var markerTypes = new ts.Set();
@@ -49361,6 +49384,14 @@ var ts;
49361
49384
  ];
49362
49385
  initializeTypeChecker();
49363
49386
  return checker;
49387
+ function getCachedType(key) {
49388
+ return key ? cachedTypes.get(key) : undefined;
49389
+ }
49390
+ function setCachedType(key, type) {
49391
+ if (key)
49392
+ cachedTypes.set(key, type);
49393
+ return type;
49394
+ }
49364
49395
  function getJsxNamespace(location) {
49365
49396
  if (location) {
49366
49397
  var file = ts.getSourceFileOfNode(location);
@@ -52616,13 +52647,25 @@ var ts;
52616
52647
  && isDeclarationVisible(declaration.parent)) {
52617
52648
  return addVisibleAlias(declaration, declaration);
52618
52649
  }
52619
- else if (symbol.flags & 2097152 /* Alias */ && ts.isBindingElement(declaration) && ts.isInJSFile(declaration) && ((_a = declaration.parent) === null || _a === void 0 ? void 0 : _a.parent) // exported import-like top-level JS require statement
52620
- && ts.isVariableDeclaration(declaration.parent.parent)
52621
- && ((_b = declaration.parent.parent.parent) === null || _b === void 0 ? void 0 : _b.parent) && ts.isVariableStatement(declaration.parent.parent.parent.parent)
52622
- && !ts.hasSyntacticModifier(declaration.parent.parent.parent.parent, 1 /* Export */)
52623
- && declaration.parent.parent.parent.parent.parent // check if the thing containing the variable statement is visible (ie, the file)
52624
- && isDeclarationVisible(declaration.parent.parent.parent.parent.parent)) {
52625
- return addVisibleAlias(declaration, declaration.parent.parent.parent.parent);
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
+ }
52626
52669
  }
52627
52670
  // Declaration is not visible
52628
52671
  return false;
@@ -52755,7 +52798,7 @@ var ts;
52755
52798
  }
52756
52799
  function toNodeBuilderFlags(flags) {
52757
52800
  if (flags === void 0) { flags = 0 /* None */; }
52758
- return flags & 814775659 /* NodeBuilderFlagsMask */;
52801
+ return flags & 848330091 /* NodeBuilderFlagsMask */;
52759
52802
  }
52760
52803
  function isClassInstanceSide(type) {
52761
52804
  return !!type.symbol && !!(type.symbol.flags & 32 /* Class */) && (type === getDeclaredTypeOfClassOrInterface(type.symbol) || (!!(type.flags & 524288 /* Object */) && !!(ts.getObjectFlags(type) & 16777216 /* IsClassInstanceClone */)));
@@ -53143,6 +53186,10 @@ var ts;
53143
53186
  }
53144
53187
  return typeToTypeNodeHelper(type, context);
53145
53188
  }
53189
+ function isHomomorphicMappedTypeWithNonHomomorphicInstantiation(type) {
53190
+ return isMappedTypeWithKeyofConstraintDeclaration(type)
53191
+ && !(getModifiersTypeFromMappedType(type).flags & 262144 /* TypeParameter */);
53192
+ }
53146
53193
  function createMappedTypeNodeFromType(type) {
53147
53194
  ts.Debug.assert(!!(type.flags & 524288 /* Object */));
53148
53195
  var readonlyToken = type.declaration.readonlyToken ? ts.factory.createToken(type.declaration.readonlyToken.kind) : undefined;
@@ -53152,7 +53199,7 @@ var ts;
53152
53199
  if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
53153
53200
  // We have a { [P in keyof T]: X }
53154
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`
53155
- if (!(getModifiersTypeFromMappedType(type).flags & 262144 /* TypeParameter */) && context.flags & 4 /* GenerateNamesForShadowedTypeParams */) {
53202
+ if (isHomomorphicMappedTypeWithNonHomomorphicInstantiation(type) && context.flags & 4 /* GenerateNamesForShadowedTypeParams */) {
53156
53203
  var newParam = createTypeParameter(createSymbol(262144 /* TypeParameter */, "T"));
53157
53204
  var name = typeParameterToName(newParam, context);
53158
53205
  newTypeVariable = ts.factory.createTypeReferenceNode(name);
@@ -53168,11 +53215,12 @@ var ts;
53168
53215
  var mappedTypeNode = ts.factory.createMappedTypeNode(readonlyToken, typeParameterNode, nameTypeNode, questionToken, templateTypeNode, /*members*/ undefined);
53169
53216
  context.approximateLength += 10;
53170
53217
  var result = ts.setEmitFlags(mappedTypeNode, 1 /* SingleLine */);
53171
- if (isMappedTypeWithKeyofConstraintDeclaration(type) && !(getModifiersTypeFromMappedType(type).flags & 262144 /* TypeParameter */) && context.flags & 4 /* GenerateNamesForShadowedTypeParams */) {
53218
+ if (isHomomorphicMappedTypeWithNonHomomorphicInstantiation(type) && context.flags & 4 /* GenerateNamesForShadowedTypeParams */) {
53172
53219
  // homomorphic mapped type with a non-homomorphic naive inlining
53173
53220
  // wrap it with a conditional like `SomeModifiersType extends infer U ? {..the mapped type...} : never` to ensure the resulting
53174
53221
  // type stays homomorphic
53175
- return ts.factory.createConditionalTypeNode(typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context), ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(/*modifiers*/ undefined, ts.factory.cloneNode(newTypeVariable.typeName))), result, ts.factory.createKeywordTypeNode(143 /* NeverKeyword */));
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 */));
53176
53224
  }
53177
53225
  return result;
53178
53226
  }
@@ -53734,7 +53782,7 @@ var ts;
53734
53782
  var expandedParams = getExpandedParameters(signature, /*skipUnionExpanding*/ true)[0];
53735
53783
  // If the expanded parameter list had a variadic in a non-trailing position, don't expand it
53736
53784
  var parameters = (ts.some(expandedParams, function (p) { return p !== expandedParams[expandedParams.length - 1] && !!(ts.getCheckFlags(p) & 32768 /* RestParameter */); }) ? signature.parameters : expandedParams).map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 171 /* Constructor */, options === null || options === void 0 ? void 0 : options.privateSymbolVisitor, options === null || options === void 0 ? void 0 : options.bundledImports); });
53737
- var thisParameter = tryGetThisParameterDeclaration(signature, context);
53785
+ var thisParameter = context.flags & 33554432 /* OmitThisParameter */ ? undefined : tryGetThisParameterDeclaration(signature, context);
53738
53786
  if (thisParameter) {
53739
53787
  parameters.unshift(thisParameter);
53740
53788
  }
@@ -54793,12 +54841,11 @@ var ts;
54793
54841
  if (skipMembershipCheck || (!!ts.length(symbol.declarations) && ts.some(symbol.declarations, function (d) { return !!ts.findAncestor(d, function (n) { return n === enclosingDeclaration; }); }))) {
54794
54842
  var oldContext = context;
54795
54843
  context = cloneNodeBuilderContext(context);
54796
- var result = serializeSymbolWorker(symbol, isPrivate, propertyAsAlias);
54844
+ serializeSymbolWorker(symbol, isPrivate, propertyAsAlias);
54797
54845
  if (context.reportedDiagnostic) {
54798
54846
  oldcontext.reportedDiagnostic = context.reportedDiagnostic; // hoist diagnostic result into outer context
54799
54847
  }
54800
54848
  context = oldContext;
54801
- return result;
54802
54849
  }
54803
54850
  }
54804
54851
  // Synthesize declarations for a symbol - might be an Interface, a Class, a Namespace, a Type, a Variable (const, let, or var), an Alias
@@ -57855,7 +57902,7 @@ var ts;
57855
57902
  error(declaration.typeExpression.type, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
57856
57903
  }
57857
57904
  else {
57858
- error(ts.isNamedDeclaration(declaration) ? declaration.name : declaration || declaration, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
57905
+ error(ts.isNamedDeclaration(declaration) ? declaration.name || declaration : declaration, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
57859
57906
  }
57860
57907
  }
57861
57908
  links.declaredType = type;
@@ -66123,13 +66170,20 @@ var ts;
66123
66170
  return result;
66124
66171
  }
66125
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) {
66126
66181
  if (intersectionState & 4 /* PropertyCheck */) {
66127
66182
  return propertiesRelatedTo(source, target, reportErrors, /*excludedProperties*/ undefined, 0 /* None */);
66128
66183
  }
66129
66184
  var result;
66130
66185
  var originalErrorInfo;
66131
66186
  var varianceCheckFailed = false;
66132
- var saveErrorInfo = captureErrorCalculationState();
66133
66187
  var sourceFlags = source.flags;
66134
66188
  var targetFlags = target.flags;
66135
66189
  if (relation === identityRelation) {
@@ -66193,7 +66247,6 @@ var ts;
66193
66247
  if (constraint && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself
66194
66248
  // TODO: Stack errors so we get a pyramid for the "normal" comparison above, _and_ a second for this
66195
66249
  if (result = isRelatedTo(constraint, target, 1 /* Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState)) {
66196
- resetErrorInfo(saveErrorInfo);
66197
66250
  return result;
66198
66251
  }
66199
66252
  }
@@ -66318,7 +66371,6 @@ var ts;
66318
66371
  result &= isRelatedTo(source.indexType, target.indexType, 3 /* Both */, reportErrors);
66319
66372
  }
66320
66373
  if (result) {
66321
- resetErrorInfo(saveErrorInfo);
66322
66374
  return result;
66323
66375
  }
66324
66376
  if (reportErrors) {
@@ -66421,7 +66473,6 @@ var ts;
66421
66473
  // If we reach 10 levels of nesting for the same conditional type, assume it is an infinitely expanding recursive
66422
66474
  // conditional type and bail out with a Ternary.Maybe result.
66423
66475
  if (isDeeplyNestedType(target, targetStack, targetDepth, 10)) {
66424
- resetErrorInfo(saveErrorInfo);
66425
66476
  return 3 /* Maybe */;
66426
66477
  }
66427
66478
  var c = target;
@@ -66436,7 +66487,6 @@ var ts;
66436
66487
  if (result = skipTrue ? -1 /* True */ : isRelatedTo(source, getTrueTypeFromConditionalType(c), 2 /* Target */, /*reportErrors*/ false)) {
66437
66488
  result &= skipFalse ? -1 /* True */ : isRelatedTo(source, getFalseTypeFromConditionalType(c), 2 /* Target */, /*reportErrors*/ false);
66438
66489
  if (result) {
66439
- resetErrorInfo(saveErrorInfo);
66440
66490
  return result;
66441
66491
  }
66442
66492
  }
@@ -66468,12 +66518,10 @@ var ts;
66468
66518
  var constraint = getConstraintOfType(source) || unknownType;
66469
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
66470
66520
  if (result = isRelatedTo(constraint, target, 1 /* Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState)) {
66471
- resetErrorInfo(saveErrorInfo);
66472
66521
  return result;
66473
66522
  }
66474
66523
  // slower, fuller, this-instantiated check (necessary when comparing raw `this` types from base classes), see `subclassWithPolymorphicThisIsAssignable.ts` test for example
66475
66524
  else if (result = isRelatedTo(getTypeWithThisArgument(constraint, source), target, 1 /* Source */, reportErrors && constraint !== unknownType && !(targetFlags & sourceFlags & 262144 /* TypeParameter */), /*headMessage*/ undefined, intersectionState)) {
66476
- resetErrorInfo(saveErrorInfo);
66477
66525
  return result;
66478
66526
  }
66479
66527
  if (isMappedTypeGenericIndexedAccess(source)) {
@@ -66482,7 +66530,6 @@ var ts;
66482
66530
  var indexConstraint = getConstraintOfType(source.indexType);
66483
66531
  if (indexConstraint) {
66484
66532
  if (result = isRelatedTo(getIndexedAccessType(source.objectType, indexConstraint), target, 1 /* Source */, reportErrors)) {
66485
- resetErrorInfo(saveErrorInfo);
66486
66533
  return result;
66487
66534
  }
66488
66535
  }
@@ -66491,7 +66538,6 @@ var ts;
66491
66538
  }
66492
66539
  else if (sourceFlags & 4194304 /* Index */) {
66493
66540
  if (result = isRelatedTo(keyofConstraintType, target, 1 /* Source */, reportErrors)) {
66494
- resetErrorInfo(saveErrorInfo);
66495
66541
  return result;
66496
66542
  }
66497
66543
  }
@@ -66499,7 +66545,6 @@ var ts;
66499
66545
  if (!(targetFlags & 134217728 /* TemplateLiteral */)) {
66500
66546
  var constraint = getBaseConstraintOfType(source);
66501
66547
  if (constraint && constraint !== source && (result = isRelatedTo(constraint, target, 1 /* Source */, reportErrors))) {
66502
- resetErrorInfo(saveErrorInfo);
66503
66548
  return result;
66504
66549
  }
66505
66550
  }
@@ -66510,14 +66555,12 @@ var ts;
66510
66555
  return 0 /* False */;
66511
66556
  }
66512
66557
  if (result = isRelatedTo(source.type, target.type, 3 /* Both */, reportErrors)) {
66513
- resetErrorInfo(saveErrorInfo);
66514
66558
  return result;
66515
66559
  }
66516
66560
  }
66517
66561
  else {
66518
66562
  var constraint = getBaseConstraintOfType(source);
66519
66563
  if (constraint && (result = isRelatedTo(constraint, target, 1 /* Source */, reportErrors))) {
66520
- resetErrorInfo(saveErrorInfo);
66521
66564
  return result;
66522
66565
  }
66523
66566
  }
@@ -66526,7 +66569,6 @@ var ts;
66526
66569
  // If we reach 10 levels of nesting for the same conditional type, assume it is an infinitely expanding recursive
66527
66570
  // conditional type and bail out with a Ternary.Maybe result.
66528
66571
  if (isDeeplyNestedType(source, sourceStack, sourceDepth, 10)) {
66529
- resetErrorInfo(saveErrorInfo);
66530
66572
  return 3 /* Maybe */;
66531
66573
  }
66532
66574
  if (targetFlags & 16777216 /* Conditional */) {
@@ -66549,7 +66591,6 @@ var ts;
66549
66591
  result &= isRelatedTo(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target), 3 /* Both */, reportErrors);
66550
66592
  }
66551
66593
  if (result) {
66552
- resetErrorInfo(saveErrorInfo);
66553
66594
  return result;
66554
66595
  }
66555
66596
  }
@@ -66560,7 +66601,6 @@ var ts;
66560
66601
  var distributiveConstraint = hasNonCircularBaseConstraint(source) ? getConstraintOfDistributiveConditionalType(source) : undefined;
66561
66602
  if (distributiveConstraint) {
66562
66603
  if (result = isRelatedTo(distributiveConstraint, target, 1 /* Source */, reportErrors)) {
66563
- resetErrorInfo(saveErrorInfo);
66564
66604
  return result;
66565
66605
  }
66566
66606
  }
@@ -66570,7 +66610,6 @@ var ts;
66570
66610
  var defaultConstraint = getDefaultConstraintOfConditionalType(source);
66571
66611
  if (defaultConstraint) {
66572
66612
  if (result = isRelatedTo(defaultConstraint, target, 1 /* Source */, reportErrors)) {
66573
- resetErrorInfo(saveErrorInfo);
66574
66613
  return result;
66575
66614
  }
66576
66615
  }
@@ -66583,7 +66622,6 @@ var ts;
66583
66622
  if (isGenericMappedType(target)) {
66584
66623
  if (isGenericMappedType(source)) {
66585
66624
  if (result = mappedTypeRelatedTo(source, target, reportErrors)) {
66586
- resetErrorInfo(saveErrorInfo);
66587
66625
  return result;
66588
66626
  }
66589
66627
  }
@@ -68038,9 +68076,14 @@ var ts;
68038
68076
  type.flags & 256 /* NumberLiteral */ ? numberType :
68039
68077
  type.flags & 2048 /* BigIntLiteral */ ? bigintType :
68040
68078
  type.flags & 512 /* BooleanLiteral */ ? booleanType :
68041
- type.flags & 1048576 /* Union */ ? mapType(type, getBaseTypeOfLiteralType) :
68079
+ type.flags & 1048576 /* Union */ ? getBaseTypeOfLiteralTypeUnion(type) :
68042
68080
  type;
68043
68081
  }
68082
+ function getBaseTypeOfLiteralTypeUnion(type) {
68083
+ var _a;
68084
+ var key = "B" + getTypeId(type);
68085
+ return (_a = getCachedType(key)) !== null && _a !== void 0 ? _a : setCachedType(key, mapType(type, getBaseTypeOfLiteralType));
68086
+ }
68044
68087
  function getWidenedLiteralType(type) {
68045
68088
  return type.flags & 1024 /* EnumLiteral */ && isFreshLiteralType(type) ? getBaseTypeOfEnumLiteralType(type) :
68046
68089
  type.flags & 128 /* StringLiteral */ && isFreshLiteralType(type) ? stringType :
@@ -70183,23 +70226,25 @@ var ts;
70183
70226
  // For example, when a variable of type number | string | boolean is assigned a value of type number | boolean,
70184
70227
  // we remove type string.
70185
70228
  function getAssignmentReducedType(declaredType, assignedType) {
70186
- if (declaredType !== assignedType) {
70187
- if (assignedType.flags & 131072 /* Never */) {
70188
- return assignedType;
70189
- }
70190
- var reducedType = filterType(declaredType, function (t) { return typeMaybeAssignableTo(assignedType, t); });
70191
- if (assignedType.flags & 512 /* BooleanLiteral */ && isFreshLiteralType(assignedType)) {
70192
- reducedType = mapType(reducedType, getFreshTypeOfLiteralType); // Ensure that if the assignment is a fresh type, that we narrow to fresh types
70193
- }
70194
- // Our crude heuristic produces an invalid result in some cases: see GH#26130.
70195
- // For now, when that happens, we give up and don't narrow at all. (This also
70196
- // means we'll never narrow for erroneous assignments where the assigned type
70197
- // is not assignable to the declared type.)
70198
- if (isTypeAssignableTo(assignedType, reducedType)) {
70199
- return reducedType;
70200
- }
70229
+ var _a;
70230
+ if (declaredType === assignedType) {
70231
+ return declaredType;
70201
70232
  }
70202
- return declaredType;
70233
+ if (assignedType.flags & 131072 /* Never */) {
70234
+ return assignedType;
70235
+ }
70236
+ var key = "A" + getTypeId(declaredType) + "," + getTypeId(assignedType);
70237
+ return (_a = getCachedType(key)) !== null && _a !== void 0 ? _a : setCachedType(key, getAssignmentReducedTypeWorker(declaredType, assignedType));
70238
+ }
70239
+ function getAssignmentReducedTypeWorker(declaredType, assignedType) {
70240
+ var filteredType = filterType(declaredType, function (t) { return typeMaybeAssignableTo(assignedType, t); });
70241
+ // Ensure that we narrow to fresh types if the assignment is a fresh boolean literal type.
70242
+ var reducedType = assignedType.flags & 512 /* BooleanLiteral */ && isFreshLiteralType(assignedType) ? mapType(filteredType, getFreshTypeOfLiteralType) : filteredType;
70243
+ // Our crude heuristic produces an invalid result in some cases: see GH#26130.
70244
+ // For now, when that happens, we give up and don't narrow at all. (This also
70245
+ // means we'll never narrow for erroneous assignments where the assigned type
70246
+ // is not assignable to the declared type.)
70247
+ return isTypeAssignableTo(assignedType, reducedType) ? reducedType : declaredType;
70203
70248
  }
70204
70249
  function isFunctionObjectType(type) {
70205
70250
  // We do a quick check for a "bind" property before performing the more expensive subtype
@@ -71605,7 +71650,7 @@ var ts;
71605
71650
  var targetType = ts.hasStaticModifier(ts.Debug.checkDefined(symbol.valueDeclaration, "should always have a declaration"))
71606
71651
  ? getTypeOfSymbol(classSymbol)
71607
71652
  : getDeclaredTypeOfSymbol(classSymbol);
71608
- return getNarrowedType(type, targetType, assumeTrue, isTypeDerivedFrom);
71653
+ return getNarrowedType(type, targetType, assumeTrue, /*checkDerived*/ true);
71609
71654
  }
71610
71655
  function narrowTypeByOptionalChainContainment(type, operator, value, assumeTrue) {
71611
71656
  // We are in a branch of obj?.foo === value (or any one of the other equality operators). We narrow obj as follows:
@@ -71856,9 +71901,15 @@ var ts;
71856
71901
  if (!nonConstructorTypeInUnion)
71857
71902
  return type;
71858
71903
  }
71859
- return getNarrowedType(type, targetType, assumeTrue, isTypeDerivedFrom);
71904
+ return getNarrowedType(type, targetType, assumeTrue, /*checkDerived*/ true);
71905
+ }
71906
+ function getNarrowedType(type, candidate, assumeTrue, checkDerived) {
71907
+ var _a;
71908
+ var key = type.flags & 1048576 /* Union */ ? "N" + getTypeId(type) + "," + getTypeId(candidate) + "," + ((assumeTrue ? 1 : 0) | (checkDerived ? 2 : 0)) : undefined;
71909
+ return (_a = getCachedType(key)) !== null && _a !== void 0 ? _a : setCachedType(key, getNarrowedTypeWorker(type, candidate, assumeTrue, checkDerived));
71860
71910
  }
71861
- function getNarrowedType(type, candidate, assumeTrue, isRelated) {
71911
+ function getNarrowedTypeWorker(type, candidate, assumeTrue, checkDerived) {
71912
+ var isRelated = checkDerived ? isTypeDerivedFrom : isTypeSubtypeOf;
71862
71913
  if (!assumeTrue) {
71863
71914
  return filterType(type, function (t) { return !isRelated(t, candidate); });
71864
71915
  }
@@ -71906,7 +71957,7 @@ var ts;
71906
71957
  var predicateArgument = getTypePredicateArgument(predicate, callExpression);
71907
71958
  if (predicateArgument) {
71908
71959
  if (isMatchingReference(reference, predicateArgument)) {
71909
- return getNarrowedType(type, predicate.type, assumeTrue, isTypeSubtypeOf);
71960
+ return getNarrowedType(type, predicate.type, assumeTrue, /*checkDerived*/ false);
71910
71961
  }
71911
71962
  if (strictNullChecks && assumeTrue && optionalChainContainsReference(predicateArgument, reference) &&
71912
71963
  !(getTypeFacts(predicate.type) & 65536 /* EQUndefined */)) {
@@ -71914,7 +71965,7 @@ var ts;
71914
71965
  }
71915
71966
  var access = getDiscriminantPropertyAccess(predicateArgument, type);
71916
71967
  if (access) {
71917
- return narrowTypeByDiscriminant(type, access, function (t) { return getNarrowedType(t, predicate.type, assumeTrue, isTypeSubtypeOf); });
71968
+ return narrowTypeByDiscriminant(type, access, function (t) { return getNarrowedType(t, predicate.type, assumeTrue, /*checkDerived*/ false); });
71918
71969
  }
71919
71970
  }
71920
71971
  }
@@ -72091,7 +72142,7 @@ var ts;
72091
72142
  !((ts.isJsxOpeningElement(node.parent) || ts.isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) &&
72092
72143
  (checkMode && checkMode & 64 /* RestBindingElement */ ?
72093
72144
  getContextualType(node, 8 /* SkipBindingPatterns */)
72094
- : getContextualType(node));
72145
+ : getContextualType(node, /*contextFlags*/ undefined));
72095
72146
  return contextualType && !isGenericType(contextualType);
72096
72147
  }
72097
72148
  function getNarrowableTypeForReference(type, reference, checkMode) {
@@ -72253,9 +72304,7 @@ var ts;
72253
72304
  getNodeLinks(container).flags |= 8192 /* CaptureArguments */;
72254
72305
  return getTypeOfSymbol(symbol);
72255
72306
  }
72256
- // We should only mark aliases as referenced if there isn't a local value declaration
72257
- // for the symbol. Also, don't mark any property access expression LHS - checkPropertyAccessExpression will handle that
72258
- if (!(node.parent && ts.isPropertyAccessExpression(node.parent) && node.parent.expression === node)) {
72307
+ if (shouldMarkIdentifierAliasReferenced(node)) {
72259
72308
  markAliasReferenced(symbol, node);
72260
72309
  }
72261
72310
  var localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol);
@@ -72389,6 +72438,25 @@ var ts;
72389
72438
  }
72390
72439
  return assignmentKind ? getBaseTypeOfLiteralType(flowType) : flowType;
72391
72440
  }
72441
+ function shouldMarkIdentifierAliasReferenced(node) {
72442
+ var _a;
72443
+ var parent = node.parent;
72444
+ if (parent) {
72445
+ // A property access expression LHS? checkPropertyAccessExpression will handle that.
72446
+ if (ts.isPropertyAccessExpression(parent) && parent.expression === node) {
72447
+ return false;
72448
+ }
72449
+ // Next two check for an identifier inside a type only export.
72450
+ if (ts.isExportSpecifier(parent) && parent.isTypeOnly) {
72451
+ return false;
72452
+ }
72453
+ var greatGrandparent = (_a = parent.parent) === null || _a === void 0 ? void 0 : _a.parent;
72454
+ if (greatGrandparent && ts.isExportDeclaration(greatGrandparent) && greatGrandparent.isTypeOnly) {
72455
+ return false;
72456
+ }
72457
+ }
72458
+ return true;
72459
+ }
72392
72460
  function isInsideFunctionOrInstancePropertyInitializer(node, threshold) {
72393
72461
  return !!ts.findAncestor(node, function (n) { return n === threshold ? "quit" : ts.isFunctionLike(n) || (n.parent && ts.isPropertyDeclaration(n.parent) && !ts.hasStaticModifier(n.parent) && n.parent.initializer === n); });
72394
72462
  }
@@ -72938,7 +73006,7 @@ var ts;
72938
73006
  // We have an object literal method. Check if the containing object literal has a contextual type
72939
73007
  // that includes a ThisType<T>. If so, T is the contextual type for 'this'. We continue looking in
72940
73008
  // any directly enclosing object literals.
72941
- var contextualType = getApparentTypeOfContextualType(containingLiteral);
73009
+ var contextualType = getApparentTypeOfContextualType(containingLiteral, /*contextFlags*/ undefined);
72942
73010
  var literal = containingLiteral;
72943
73011
  var type = contextualType;
72944
73012
  while (type) {
@@ -72950,7 +73018,7 @@ var ts;
72950
73018
  break;
72951
73019
  }
72952
73020
  literal = literal.parent.parent;
72953
- type = getApparentTypeOfContextualType(literal);
73021
+ type = getApparentTypeOfContextualType(literal, /*contextFlags*/ undefined);
72954
73022
  }
72955
73023
  // There was no contextual ThisType<T> for the containing object literal, so the contextual type
72956
73024
  // for 'this' is the non-null form of the contextual type for the containing object literal or
@@ -73007,7 +73075,7 @@ var ts;
73007
73075
  tryGetTypeAtPosition(contextualSignature, index);
73008
73076
  }
73009
73077
  }
73010
- function getContextualTypeForVariableLikeDeclaration(declaration) {
73078
+ function getContextualTypeForVariableLikeDeclaration(declaration, contextFlags) {
73011
73079
  var typeNode = ts.getEffectiveTypeAnnotationNode(declaration);
73012
73080
  if (typeNode) {
73013
73081
  return getTypeFromTypeNode(typeNode);
@@ -73016,18 +73084,18 @@ var ts;
73016
73084
  case 164 /* Parameter */:
73017
73085
  return getContextuallyTypedParameterType(declaration);
73018
73086
  case 203 /* BindingElement */:
73019
- return getContextualTypeForBindingElement(declaration);
73087
+ return getContextualTypeForBindingElement(declaration, contextFlags);
73020
73088
  case 167 /* PropertyDeclaration */:
73021
73089
  if (ts.isStatic(declaration)) {
73022
- return getContextualTypeForStaticPropertyDeclaration(declaration);
73090
+ return getContextualTypeForStaticPropertyDeclaration(declaration, contextFlags);
73023
73091
  }
73024
73092
  // By default, do nothing and return undefined - only the above cases have context implied by a parent
73025
73093
  }
73026
73094
  }
73027
- function getContextualTypeForBindingElement(declaration) {
73095
+ function getContextualTypeForBindingElement(declaration, contextFlags) {
73028
73096
  var parent = declaration.parent.parent;
73029
73097
  var name = declaration.propertyName || declaration.name;
73030
- var parentType = getContextualTypeForVariableLikeDeclaration(parent) ||
73098
+ var parentType = getContextualTypeForVariableLikeDeclaration(parent, contextFlags) ||
73031
73099
  parent.kind !== 203 /* BindingElement */ && parent.initializer && checkDeclarationInitializer(parent, declaration.dotDotDotToken ? 64 /* RestBindingElement */ : 0 /* Normal */);
73032
73100
  if (!parentType || ts.isBindingPattern(name) || ts.isComputedNonLiteralName(name))
73033
73101
  return undefined;
@@ -73043,8 +73111,8 @@ var ts;
73043
73111
  return getTypeOfPropertyOfType(parentType, text);
73044
73112
  }
73045
73113
  }
73046
- function getContextualTypeForStaticPropertyDeclaration(declaration) {
73047
- 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);
73048
73116
  if (!parentType)
73049
73117
  return undefined;
73050
73118
  return getTypeOfPropertyOfContextualType(parentType, getSymbolOfNode(declaration).escapedName);
@@ -73060,7 +73128,7 @@ var ts;
73060
73128
  function getContextualTypeForInitializerExpression(node, contextFlags) {
73061
73129
  var declaration = node.parent;
73062
73130
  if (ts.hasInitializer(declaration) && node === declaration.initializer) {
73063
- var result = getContextualTypeForVariableLikeDeclaration(declaration);
73131
+ var result = getContextualTypeForVariableLikeDeclaration(declaration, contextFlags);
73064
73132
  if (result) {
73065
73133
  return result;
73066
73134
  }
@@ -73070,10 +73138,10 @@ var ts;
73070
73138
  }
73071
73139
  return undefined;
73072
73140
  }
73073
- function getContextualTypeForReturnExpression(node) {
73141
+ function getContextualTypeForReturnExpression(node, contextFlags) {
73074
73142
  var func = ts.getContainingFunction(node);
73075
73143
  if (func) {
73076
- var contextualReturnType = getContextualReturnType(func);
73144
+ var contextualReturnType = getContextualReturnType(func, contextFlags);
73077
73145
  if (contextualReturnType) {
73078
73146
  var functionFlags = ts.getFunctionFlags(func);
73079
73147
  if (functionFlags & 1 /* Generator */) { // Generator or AsyncGenerator function
@@ -73103,11 +73171,11 @@ var ts;
73103
73171
  }
73104
73172
  return undefined;
73105
73173
  }
73106
- function getContextualTypeForYieldOperand(node) {
73174
+ function getContextualTypeForYieldOperand(node, contextFlags) {
73107
73175
  var func = ts.getContainingFunction(node);
73108
73176
  if (func) {
73109
73177
  var functionFlags = ts.getFunctionFlags(func);
73110
- var contextualReturnType = getContextualReturnType(func);
73178
+ var contextualReturnType = getContextualReturnType(func, contextFlags);
73111
73179
  if (contextualReturnType) {
73112
73180
  return node.asteriskToken
73113
73181
  ? contextualReturnType
@@ -73131,14 +73199,14 @@ var ts;
73131
73199
  }
73132
73200
  function getContextualIterationType(kind, functionDecl) {
73133
73201
  var isAsync = !!(ts.getFunctionFlags(functionDecl) & 2 /* Async */);
73134
- var contextualReturnType = getContextualReturnType(functionDecl);
73202
+ var contextualReturnType = getContextualReturnType(functionDecl, /*contextFlags*/ undefined);
73135
73203
  if (contextualReturnType) {
73136
73204
  return getIterationTypeOfGeneratorFunctionReturnType(kind, contextualReturnType, isAsync)
73137
73205
  || undefined;
73138
73206
  }
73139
73207
  return undefined;
73140
73208
  }
73141
- function getContextualReturnType(functionDecl) {
73209
+ function getContextualReturnType(functionDecl, contextFlags) {
73142
73210
  // If the containing function has a return type annotation, is a constructor, or is a get accessor whose
73143
73211
  // corresponding set accessor has a type annotation, return statements in the function are contextually typed
73144
73212
  var returnType = getReturnTypeFromAnnotation(functionDecl);
@@ -73153,7 +73221,7 @@ var ts;
73153
73221
  }
73154
73222
  var iife = ts.getImmediatelyInvokedFunctionExpression(functionDecl);
73155
73223
  if (iife) {
73156
- return getContextualType(iife);
73224
+ return getContextualType(iife, contextFlags);
73157
73225
  }
73158
73226
  return undefined;
73159
73227
  }
@@ -73406,7 +73474,7 @@ var ts;
73406
73474
  }
73407
73475
  function getContextualTypeForObjectLiteralElement(element, contextFlags) {
73408
73476
  var objectLiteral = element.parent;
73409
- var propertyAssignmentType = ts.isPropertyAssignment(element) && getContextualTypeForVariableLikeDeclaration(element);
73477
+ var propertyAssignmentType = ts.isPropertyAssignment(element) && getContextualTypeForVariableLikeDeclaration(element, contextFlags);
73410
73478
  if (propertyAssignmentType) {
73411
73479
  return propertyAssignmentType;
73412
73480
  }
@@ -73601,9 +73669,9 @@ var ts;
73601
73669
  return getContextualTypeForInitializerExpression(node, contextFlags);
73602
73670
  case 214 /* ArrowFunction */:
73603
73671
  case 247 /* ReturnStatement */:
73604
- return getContextualTypeForReturnExpression(node);
73672
+ return getContextualTypeForReturnExpression(node, contextFlags);
73605
73673
  case 224 /* YieldExpression */:
73606
- return getContextualTypeForYieldOperand(parent);
73674
+ return getContextualTypeForYieldOperand(parent, contextFlags);
73607
73675
  case 218 /* AwaitExpression */:
73608
73676
  return getContextualTypeForAwaitOperand(parent, contextFlags);
73609
73677
  case 208 /* CallExpression */:
@@ -73651,7 +73719,7 @@ var ts;
73651
73719
  }
73652
73720
  return undefined;
73653
73721
  function tryFindWhenConstTypeReference(node) {
73654
- return getContextualType(node);
73722
+ return getContextualType(node, contextFlags);
73655
73723
  }
73656
73724
  }
73657
73725
  function getInferenceContext(node) {
@@ -73953,7 +74021,7 @@ var ts;
73953
74021
  var elementCount = elements.length;
73954
74022
  var elementTypes = [];
73955
74023
  var elementFlags = [];
73956
- var contextualType = getApparentTypeOfContextualType(node);
74024
+ var contextualType = getApparentTypeOfContextualType(node, /*contextFlags*/ undefined);
73957
74025
  var inDestructuringPattern = ts.isAssignmentTarget(node);
73958
74026
  var inConstContext = isConstContext(node);
73959
74027
  var hasOmittedExpression = false;
@@ -74124,7 +74192,7 @@ var ts;
74124
74192
  var propertiesTable = ts.createSymbolTable();
74125
74193
  var propertiesArray = [];
74126
74194
  var spread = emptyObjectType;
74127
- var contextualType = getApparentTypeOfContextualType(node);
74195
+ var contextualType = getApparentTypeOfContextualType(node, /*contextFlags*/ undefined);
74128
74196
  var contextualTypeHasPattern = contextualType && contextualType.pattern &&
74129
74197
  (contextualType.pattern.kind === 201 /* ObjectBindingPattern */ || contextualType.pattern.kind === 205 /* ObjectLiteralExpression */);
74130
74198
  var inConstContext = isConstContext(node);
@@ -74463,7 +74531,7 @@ var ts;
74463
74531
  if (explicitlySpecifyChildrenAttribute) {
74464
74532
  error(attributes, ts.Diagnostics._0_are_specified_twice_The_attribute_named_0_will_be_overwritten, ts.unescapeLeadingUnderscores(jsxChildrenPropertyName));
74465
74533
  }
74466
- var contextualType = getApparentTypeOfContextualType(openingLikeElement.attributes);
74534
+ var contextualType = getApparentTypeOfContextualType(openingLikeElement.attributes, /*contextFlags*/ undefined);
74467
74535
  var childrenContextualType = contextualType && getTypeOfPropertyOfContextualType(contextualType, jsxChildrenPropertyName);
74468
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
74469
74537
  var childrenPropSymbol = createSymbol(4 /* Property */, jsxChildrenPropertyName);
@@ -76926,7 +76994,7 @@ var ts;
76926
76994
  argCheckMode = checkMode & 32 /* IsForStringLiteralArgumentCompletions */;
76927
76995
  if (inferenceContext) {
76928
76996
  var typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
76929
- checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, ts.isInJSFile(candidate.declaration), inferenceContext && inferenceContext.inferredTypeParameters);
76997
+ checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, ts.isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters);
76930
76998
  // If the original signature has a generic rest type, instantiation may produce a
76931
76999
  // signature with different arity and we need to perform another arity check.
76932
77000
  if (getNonArrayRestType(candidate) && !hasCorrectArity(node, args, checkCandidate, signatureHelpTrailingComma)) {
@@ -78303,17 +78371,6 @@ var ts;
78303
78371
  }
78304
78372
  }
78305
78373
  }
78306
- var restType = getEffectiveRestType(context);
78307
- if (restType && restType.flags & 262144 /* TypeParameter */) {
78308
- // The contextual signature has a generic rest parameter. We first instantiate the contextual
78309
- // signature (without fixing type parameters) and assign types to contextually typed parameters.
78310
- var instantiatedContext = instantiateSignature(context, inferenceContext.nonFixingMapper);
78311
- assignContextualParameterTypes(signature, instantiatedContext);
78312
- // We then infer from a tuple type representing the parameters that correspond to the contextual
78313
- // rest parameter.
78314
- var restPos = getParameterCount(context) - 1;
78315
- inferTypes(inferenceContext.inferences, getRestTypeAtPosition(signature, restPos), restType);
78316
- }
78317
78374
  }
78318
78375
  function assignContextualParameterTypes(signature, context) {
78319
78376
  if (context.typeParameters) {
@@ -78506,7 +78563,7 @@ var ts;
78506
78563
  var contextualSignature = getContextualSignatureForFunctionLikeDeclaration(func);
78507
78564
  var contextualType = !contextualSignature ? undefined :
78508
78565
  contextualSignature === getSignatureFromDeclaration(func) ? isGenerator ? undefined : returnType :
78509
- instantiateContextualType(getReturnTypeOfSignature(contextualSignature), func);
78566
+ instantiateContextualType(getReturnTypeOfSignature(contextualSignature), func, /*contextFlags*/ undefined);
78510
78567
  if (isGenerator) {
78511
78568
  yieldType = getWidenedLiteralLikeTypeForContextualIterationTypeIfNeeded(yieldType, contextualType, 0 /* Yield */, isAsync);
78512
78569
  returnType = getWidenedLiteralLikeTypeForContextualIterationTypeIfNeeded(returnType, contextualType, 1 /* Return */, isAsync);
@@ -78577,7 +78634,7 @@ var ts;
78577
78634
  nextType = iterationTypes && iterationTypes.nextType;
78578
78635
  }
78579
78636
  else {
78580
- nextType = getContextualType(yieldExpression);
78637
+ nextType = getContextualType(yieldExpression, /*contextFlags*/ undefined);
78581
78638
  }
78582
78639
  if (nextType)
78583
78640
  ts.pushIfUnique(nextTypes, nextType);
@@ -78786,11 +78843,16 @@ var ts;
78786
78843
  if (isContextSensitive(node)) {
78787
78844
  if (contextualSignature) {
78788
78845
  var inferenceContext = getInferenceContext(node);
78846
+ var instantiatedContextualSignature = void 0;
78789
78847
  if (checkMode && checkMode & 2 /* Inferential */) {
78790
78848
  inferFromAnnotatedParameters(signature, contextualSignature, inferenceContext);
78849
+ var restType = getEffectiveRestType(contextualSignature);
78850
+ if (restType && restType.flags & 262144 /* TypeParameter */) {
78851
+ instantiatedContextualSignature = instantiateSignature(contextualSignature, inferenceContext.nonFixingMapper);
78852
+ }
78791
78853
  }
78792
- var instantiatedContextualSignature = inferenceContext ?
78793
- instantiateSignature(contextualSignature, inferenceContext.mapper) : contextualSignature;
78854
+ instantiatedContextualSignature || (instantiatedContextualSignature = inferenceContext ?
78855
+ instantiateSignature(contextualSignature, inferenceContext.mapper) : contextualSignature);
78794
78856
  assignContextualParameterTypes(signature, instantiatedContextualSignature);
78795
78857
  }
78796
78858
  else {
@@ -80032,7 +80094,7 @@ var ts;
80032
80094
  type = anyType;
80033
80095
  addLazyDiagnostic(function () {
80034
80096
  if (noImplicitAny && !ts.expressionResultIsUnused(node)) {
80035
- var contextualType = getContextualType(node);
80097
+ var contextualType = getContextualType(node, /*contextFlags*/ undefined);
80036
80098
  if (!contextualType || isTypeAny(contextualType)) {
80037
80099
  error(node, ts.Diagnostics.yield_expression_implicitly_results_in_an_any_type_because_its_containing_generator_lacks_a_return_type_annotation);
80038
80100
  }
@@ -80073,7 +80135,7 @@ var ts;
80073
80135
  texts.push(span.literal.text);
80074
80136
  types.push(isTypeAssignableTo(type, templateConstraintType) ? type : stringType);
80075
80137
  }
80076
- 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;
80077
80139
  }
80078
80140
  function isTemplateLiteralContextualType(type) {
80079
80141
  return !!(type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */) ||
@@ -80101,7 +80163,7 @@ var ts;
80101
80163
  // We strip literal freshness when an appropriate contextual type is present such that contextually typed
80102
80164
  // literals always preserve their literal types (otherwise they might widen during type inference). An alternative
80103
80165
  // here would be to not mark contextually typed literals as fresh in the first place.
80104
- 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)) ?
80105
80167
  getRegularTypeOfLiteralType(type) : type;
80106
80168
  return result;
80107
80169
  }
@@ -80216,7 +80278,7 @@ var ts;
80216
80278
  var type = checkExpression(node, checkMode, forceTuple);
80217
80279
  return isConstContext(node) || ts.isCommonJsExportedExpression(node) ? getRegularTypeOfLiteralType(type) :
80218
80280
  isTypeAssertion(node) ? type :
80219
- 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));
80220
80282
  }
80221
80283
  function checkPropertyAssignment(node, checkMode) {
80222
80284
  // Do not use hasDynamicName here, because that returns false for well known symbols.
@@ -86198,7 +86260,9 @@ var ts;
86198
86260
  error(exportedName, ts.Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, ts.idText(exportedName));
86199
86261
  }
86200
86262
  else {
86201
- markExportAsReferenced(node);
86263
+ if (!node.isTypeOnly && !node.parent.parent.isTypeOnly) {
86264
+ markExportAsReferenced(node);
86265
+ }
86202
86266
  var target = symbol && (symbol.flags & 2097152 /* Alias */ ? resolveAlias(symbol) : symbol);
86203
86267
  if (!target || target === unknownSymbol || target.flags & 111551 /* Value */) {
86204
86268
  checkExpressionCached(node.propertyName || node.name);
@@ -89559,9 +89623,6 @@ var ts;
89559
89623
  else {
89560
89624
  return grammarErrorOnNode(initializer, ts.Diagnostics.Initializers_are_not_allowed_in_ambient_contexts);
89561
89625
  }
89562
- if (!isConstOrReadonly || isInvalidInitializer) {
89563
- return grammarErrorOnNode(initializer, ts.Diagnostics.Initializers_are_not_allowed_in_ambient_contexts);
89564
- }
89565
89626
  }
89566
89627
  }
89567
89628
  function checkGrammarVariableDeclaration(node) {
@@ -111346,7 +111407,7 @@ var ts;
111346
111407
  return;
111347
111408
  }
111348
111409
  // Make sure not to write js file and source map file if any of them cannot be written
111349
- if ((jsFilePath && host.isEmitBlocked(jsFilePath)) || compilerOptions.noEmit) {
111410
+ if (host.isEmitBlocked(jsFilePath) || compilerOptions.noEmit) {
111350
111411
  emitSkipped = true;
111351
111412
  return;
111352
111413
  }
@@ -124608,7 +124669,6 @@ var ts;
124608
124669
  var parsedConfigs; // Parsed commandline and watching cached for referenced projects
124609
124670
  var sharedExtendedConfigFileWatchers; // Map of file watchers for extended files, shared between different referenced projects
124610
124671
  var extendedConfigCache = host.extendedConfigCache; // Cache for extended config evaluation
124611
- var changesAffectResolution = false; // Flag for indicating non-config changes affect module resolution
124612
124672
  var reportFileChangeDetectedOnCreateProgram = false; // True if synchronizeProgram should report "File change detected..." when a new program is created
124613
124673
  var sourceFilesCache = new ts.Map(); // Cache that stores the source file and version info
124614
124674
  var missingFilePathsRequestedForRelease; // These paths are held temporarily so that we can remove the entry from source file cache if the file is not tracked by missing files
@@ -124761,12 +124821,12 @@ var ts;
124761
124821
  var program = getCurrentBuilderProgram();
124762
124822
  if (hasChangedCompilerOptions) {
124763
124823
  newLine = updateNewLine();
124764
- if (program && (changesAffectResolution || ts.changesAffectModuleResolution(program.getCompilerOptions(), compilerOptions))) {
124824
+ if (program && ts.changesAffectModuleResolution(program.getCompilerOptions(), compilerOptions)) {
124765
124825
  resolutionCache.clear();
124766
124826
  }
124767
124827
  }
124768
124828
  // All resolutions are invalid if user provided resolutions
124769
- var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution || changesAffectResolution);
124829
+ var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution);
124770
124830
  if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, fileExists, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
124771
124831
  if (hasChangedConfigFileParsingErrors) {
124772
124832
  if (reportFileChangeDetectedOnCreateProgram) {
@@ -124782,7 +124842,6 @@ var ts;
124782
124842
  }
124783
124843
  createNewProgram(hasInvalidatedResolution);
124784
124844
  }
124785
- changesAffectResolution = false; // reset for next sync
124786
124845
  reportFileChangeDetectedOnCreateProgram = false;
124787
124846
  if (host.afterProgramCreate && program !== builderProgram) {
124788
124847
  host.afterProgramCreate(builderProgram);
@@ -126163,7 +126222,7 @@ var ts;
126163
126222
  }
126164
126223
  function afterProgramDone(state, program, config) {
126165
126224
  if (program) {
126166
- if (program && state.write)
126225
+ if (state.write)
126167
126226
  ts.listFiles(program, state.write);
126168
126227
  if (state.host.afterProgramEmitAndDiagnostics) {
126169
126228
  state.host.afterProgramEmitAndDiagnostics(program);
@@ -133932,7 +133991,7 @@ var ts;
133932
133991
  var name = ts.getSynthesizedDeepClone(ts.getNameOfDeclaration(declaration), /*includeTrivia*/ false);
133933
133992
  var type = checker.getWidenedType(checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration));
133934
133993
  var quotePreference = ts.getQuotePreference(sourceFile, preferences);
133935
- var builderFlags = quotePreference === 0 /* Single */ ? 268435456 /* UseSingleQuotesForStringLiteralType */ : undefined;
133994
+ var builderFlags = 33554432 /* OmitThisParameter */ | (quotePreference === 0 /* Single */ ? 268435456 /* UseSingleQuotesForStringLiteralType */ : 0 /* None */);
133936
133995
  switch (declaration.kind) {
133937
133996
  case 166 /* PropertySignature */:
133938
133997
  case 167 /* PropertyDeclaration */:
@@ -165477,20 +165536,25 @@ var ts;
165477
165536
  return this.documentationComment;
165478
165537
  };
165479
165538
  SymbolObject.prototype.getContextualDocumentationComment = function (context, checker) {
165480
- switch (context === null || context === void 0 ? void 0 : context.kind) {
165481
- case 172 /* GetAccessor */:
165539
+ if (context) {
165540
+ if (ts.isGetAccessor(context)) {
165482
165541
  if (!this.contextualGetAccessorDocumentationComment) {
165483
165542
  this.contextualGetAccessorDocumentationComment = getDocumentationComment(ts.filter(this.declarations, ts.isGetAccessor), checker);
165484
165543
  }
165485
- return this.contextualGetAccessorDocumentationComment;
165486
- case 173 /* SetAccessor */:
165544
+ if (ts.length(this.contextualGetAccessorDocumentationComment)) {
165545
+ return this.contextualGetAccessorDocumentationComment;
165546
+ }
165547
+ }
165548
+ if (ts.isSetAccessor(context)) {
165487
165549
  if (!this.contextualSetAccessorDocumentationComment) {
165488
165550
  this.contextualSetAccessorDocumentationComment = getDocumentationComment(ts.filter(this.declarations, ts.isSetAccessor), checker);
165489
165551
  }
165490
- return this.contextualSetAccessorDocumentationComment;
165491
- default:
165492
- return this.getDocumentationComment(checker);
165552
+ if (ts.length(this.contextualSetAccessorDocumentationComment)) {
165553
+ return this.contextualSetAccessorDocumentationComment;
165554
+ }
165555
+ }
165493
165556
  }
165557
+ return this.getDocumentationComment(checker);
165494
165558
  };
165495
165559
  SymbolObject.prototype.getJsDocTags = function (checker) {
165496
165560
  if (this.tags === undefined) {
@@ -165499,20 +165563,25 @@ var ts;
165499
165563
  return this.tags;
165500
165564
  };
165501
165565
  SymbolObject.prototype.getContextualJsDocTags = function (context, checker) {
165502
- switch (context === null || context === void 0 ? void 0 : context.kind) {
165503
- case 172 /* GetAccessor */:
165566
+ if (context) {
165567
+ if (ts.isGetAccessor(context)) {
165504
165568
  if (!this.contextualGetAccessorTags) {
165505
165569
  this.contextualGetAccessorTags = getJsDocTagsOfDeclarations(ts.filter(this.declarations, ts.isGetAccessor), checker);
165506
165570
  }
165507
- return this.contextualGetAccessorTags;
165508
- case 173 /* SetAccessor */:
165571
+ if (ts.length(this.contextualGetAccessorTags)) {
165572
+ return this.contextualGetAccessorTags;
165573
+ }
165574
+ }
165575
+ if (ts.isSetAccessor(context)) {
165509
165576
  if (!this.contextualSetAccessorTags) {
165510
165577
  this.contextualSetAccessorTags = getJsDocTagsOfDeclarations(ts.filter(this.declarations, ts.isSetAccessor), checker);
165511
165578
  }
165512
- return this.contextualSetAccessorTags;
165513
- default:
165514
- return this.getJsDocTags(checker);
165579
+ if (ts.length(this.contextualSetAccessorTags)) {
165580
+ return this.contextualSetAccessorTags;
165581
+ }
165582
+ }
165515
165583
  }
165584
+ return this.getJsDocTags(checker);
165516
165585
  };
165517
165586
  return SymbolObject;
165518
165587
  }());
@@ -166263,7 +166332,10 @@ var ts;
166263
166332
  program = undefined; // TODO: GH#18217
166264
166333
  lastTypesRootVersion = typeRootsVersion;
166265
166334
  }
166266
- var rootFileNames = host.getScriptFileNames();
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();
166267
166339
  // Get a fresh cache of the host information
166268
166340
  var newSettings = host.getCompilationSettings() || getDefaultCompilerOptions();
166269
166341
  var hasInvalidatedResolution = host.hasInvalidatedResolution || ts.returnFalse;