typescript 4.8.0-dev.20220706 → 4.8.0-dev.20220707

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -303,7 +303,7 @@ var ts;
303
303
  // The following is baselined as a literal template type without intervention
304
304
  /** The version of the TypeScript compiler release */
305
305
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
306
- ts.version = ts.versionMajorMinor + ".0-dev.20220706";
306
+ ts.version = ts.versionMajorMinor + ".0-dev.20220707";
307
307
  /* @internal */
308
308
  var Comparison;
309
309
  (function (Comparison) {
@@ -2988,6 +2988,22 @@ var ts;
2988
2988
  return formatEnum(flags, ts.FlowFlags, /*isFlags*/ true);
2989
2989
  }
2990
2990
  Debug.formatFlowFlags = formatFlowFlags;
2991
+ function formatRelationComparisonResult(result) {
2992
+ return formatEnum(result, ts.RelationComparisonResult, /*isFlags*/ true);
2993
+ }
2994
+ Debug.formatRelationComparisonResult = formatRelationComparisonResult;
2995
+ function formatCheckMode(mode) {
2996
+ return formatEnum(mode, ts.CheckMode, /*isFlags*/ true);
2997
+ }
2998
+ Debug.formatCheckMode = formatCheckMode;
2999
+ function formatSignatureCheckMode(mode) {
3000
+ return formatEnum(mode, ts.SignatureCheckMode, /*isFlags*/ true);
3001
+ }
3002
+ Debug.formatSignatureCheckMode = formatSignatureCheckMode;
3003
+ function formatTypeFacts(facts) {
3004
+ return formatEnum(facts, ts.TypeFacts, /*isFlags*/ true);
3005
+ }
3006
+ Debug.formatTypeFacts = formatTypeFacts;
2991
3007
  var isDebugInfoEnabled = false;
2992
3008
  var extendedDebugModule;
2993
3009
  function extendedDebug() {
@@ -19725,7 +19741,8 @@ var ts;
19725
19741
  function getDeclarationModifierFlagsFromSymbol(s, isWrite) {
19726
19742
  if (isWrite === void 0) { isWrite = false; }
19727
19743
  if (s.valueDeclaration) {
19728
- var declaration = (isWrite && s.declarations && ts.find(s.declarations, function (d) { return d.kind === 173 /* SetAccessor */; })) || s.valueDeclaration;
19744
+ var declaration = (isWrite && s.declarations && ts.find(s.declarations, ts.isSetAccessorDeclaration))
19745
+ || (s.flags & 32768 /* GetAccessor */ && ts.find(s.declarations, ts.isGetAccessorDeclaration)) || s.valueDeclaration;
19729
19746
  var flags = ts.getCombinedModifierFlags(declaration);
19730
19747
  return s.parent && s.parent.flags & 32 /* Class */ ? flags : flags & ~28 /* AccessibilityModifier */;
19731
19748
  }
@@ -20400,7 +20417,7 @@ var ts;
20400
20417
  // Excludes declaration files - they still require an explicit `export {}` or the like
20401
20418
  // for back compat purposes. The only non-declaration files _not_ forced to be a module are `.js` files
20402
20419
  // that aren't esm-mode (meaning not in a `type: module` scope).
20403
- return (file.impliedNodeFormat === ts.ModuleKind.ESNext || (ts.fileExtensionIsOneOf(file.fileName, [".cjs" /* Cjs */, ".cts" /* Cts */]))) && !file.isDeclarationFile ? true : undefined;
20420
+ return (file.impliedNodeFormat === ts.ModuleKind.ESNext || (ts.fileExtensionIsOneOf(file.fileName, [".cjs" /* Cjs */, ".cts" /* Cts */, ".mjs" /* Mjs */, ".mts" /* Mts */]))) && !file.isDeclarationFile ? true : undefined;
20404
20421
  }
20405
20422
  function getSetExternalModuleIndicator(options) {
20406
20423
  // TODO: Should this callback be cached?
@@ -20423,10 +20440,7 @@ var ts;
20423
20440
  if (options.jsx === 4 /* ReactJSX */ || options.jsx === 5 /* ReactJSXDev */) {
20424
20441
  checks.push(isFileModuleFromUsingJSXTag);
20425
20442
  }
20426
- var moduleKind = getEmitModuleKind(options);
20427
- if (moduleKind === ts.ModuleKind.Node16 || moduleKind === ts.ModuleKind.NodeNext) {
20428
- checks.push(isFileForcedToBeModuleByFormat);
20429
- }
20443
+ checks.push(isFileForcedToBeModuleByFormat);
20430
20444
  var combined_1 = ts.or.apply(void 0, checks);
20431
20445
  var callback = function (file) { return void (file.externalModuleIndicator = combined_1(file)); };
20432
20446
  return callback;
@@ -34146,10 +34160,10 @@ var ts;
34146
34160
  var hasJSDoc = hasPrecedingJSDocComment();
34147
34161
  var modifiers = parseModifiers();
34148
34162
  if (parseContextualModifier(136 /* GetKeyword */)) {
34149
- return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 172 /* GetAccessor */);
34163
+ return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 172 /* GetAccessor */, 4 /* Type */);
34150
34164
  }
34151
34165
  if (parseContextualModifier(149 /* SetKeyword */)) {
34152
- return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 173 /* SetAccessor */);
34166
+ return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 173 /* SetAccessor */, 4 /* Type */);
34153
34167
  }
34154
34168
  if (isIndexSignature()) {
34155
34169
  return parseIndexSignatureDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers);
@@ -36195,10 +36209,10 @@ var ts;
36195
36209
  var decorators = parseDecorators();
36196
36210
  var modifiers = parseModifiers();
36197
36211
  if (parseContextualModifier(136 /* GetKeyword */)) {
36198
- return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172 /* GetAccessor */);
36212
+ return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172 /* GetAccessor */, 0 /* None */);
36199
36213
  }
36200
36214
  if (parseContextualModifier(149 /* SetKeyword */)) {
36201
- return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 173 /* SetAccessor */);
36215
+ return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 173 /* SetAccessor */, 0 /* None */);
36202
36216
  }
36203
36217
  var asteriskToken = parseOptionalToken(41 /* AsteriskToken */);
36204
36218
  var tokenIsIdentifier = isIdentifier();
@@ -36890,9 +36904,15 @@ var ts;
36890
36904
  return !scanner.hasPrecedingLineBreak() && (isIdentifier() || token() === 10 /* StringLiteral */);
36891
36905
  }
36892
36906
  function parseFunctionBlockOrSemicolon(flags, diagnosticMessage) {
36893
- if (token() !== 18 /* OpenBraceToken */ && canParseSemicolon()) {
36894
- parseSemicolon();
36895
- return;
36907
+ if (token() !== 18 /* OpenBraceToken */) {
36908
+ if (flags & 4 /* Type */) {
36909
+ parseTypeMemberSemicolon();
36910
+ return;
36911
+ }
36912
+ if (canParseSemicolon()) {
36913
+ parseSemicolon();
36914
+ return;
36915
+ }
36896
36916
  }
36897
36917
  return parseFunctionBlock(flags, diagnosticMessage);
36898
36918
  }
@@ -37096,12 +37116,12 @@ var ts;
37096
37116
  }
37097
37117
  return parsePropertyDeclaration(pos, hasJSDoc, decorators, modifiers, name, questionToken);
37098
37118
  }
37099
- function parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, kind) {
37119
+ function parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, kind, flags) {
37100
37120
  var name = parsePropertyName();
37101
37121
  var typeParameters = parseTypeParameters();
37102
37122
  var parameters = parseParameters(0 /* None */);
37103
37123
  var type = parseReturnType(58 /* ColonToken */, /*isType*/ false);
37104
- var body = parseFunctionBlockOrSemicolon(0 /* None */);
37124
+ var body = parseFunctionBlockOrSemicolon(flags);
37105
37125
  var node = kind === 172 /* GetAccessor */
37106
37126
  ? factory.createGetAccessorDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, parameters, type, body)
37107
37127
  : factory.createSetAccessorDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, parameters, body);
@@ -37288,10 +37308,10 @@ var ts;
37288
37308
  return parseClassStaticBlockDeclaration(pos, hasJSDoc, decorators, modifiers);
37289
37309
  }
37290
37310
  if (parseContextualModifier(136 /* GetKeyword */)) {
37291
- return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172 /* GetAccessor */);
37311
+ return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172 /* GetAccessor */, 0 /* None */);
37292
37312
  }
37293
37313
  if (parseContextualModifier(149 /* SetKeyword */)) {
37294
- return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 173 /* SetAccessor */);
37314
+ return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 173 /* SetAccessor */, 0 /* None */);
37295
37315
  }
37296
37316
  if (token() === 134 /* ConstructorKeyword */ || token() === 10 /* StringLiteral */) {
37297
37317
  var constructorDeclaration = tryParseConstructorDeclaration(pos, hasJSDoc, decorators, modifiers);
@@ -48695,7 +48715,7 @@ var ts;
48695
48715
  // Masks
48696
48716
  TypeFacts[TypeFacts["OrFactsMask"] = 8256] = "OrFactsMask";
48697
48717
  TypeFacts[TypeFacts["AndFactsMask"] = 134209471] = "AndFactsMask";
48698
- })(TypeFacts || (TypeFacts = {}));
48718
+ })(TypeFacts = ts.TypeFacts || (ts.TypeFacts = {}));
48699
48719
  var typeofNEFacts = new ts.Map(ts.getEntries({
48700
48720
  string: 256 /* TypeofNEString */,
48701
48721
  number: 512 /* TypeofNENumber */,
@@ -48730,7 +48750,7 @@ var ts;
48730
48750
  CheckMode[CheckMode["RestBindingElement"] = 64] = "RestBindingElement";
48731
48751
  // e.g. in `const { a, ...rest } = foo`, when checking the type of `foo` to determine the type of `rest`,
48732
48752
  // we need to preserve generic types instead of substituting them for constraints
48733
- })(CheckMode || (CheckMode = {}));
48753
+ })(CheckMode = ts.CheckMode || (ts.CheckMode = {}));
48734
48754
  var SignatureCheckMode;
48735
48755
  (function (SignatureCheckMode) {
48736
48756
  SignatureCheckMode[SignatureCheckMode["BivariantCallback"] = 1] = "BivariantCallback";
@@ -48738,7 +48758,7 @@ var ts;
48738
48758
  SignatureCheckMode[SignatureCheckMode["IgnoreReturnTypes"] = 4] = "IgnoreReturnTypes";
48739
48759
  SignatureCheckMode[SignatureCheckMode["StrictArity"] = 8] = "StrictArity";
48740
48760
  SignatureCheckMode[SignatureCheckMode["Callback"] = 3] = "Callback";
48741
- })(SignatureCheckMode || (SignatureCheckMode = {}));
48761
+ })(SignatureCheckMode = ts.SignatureCheckMode || (ts.SignatureCheckMode = {}));
48742
48762
  var IntersectionState;
48743
48763
  (function (IntersectionState) {
48744
48764
  IntersectionState[IntersectionState["None"] = 0] = "None";
@@ -49090,7 +49110,7 @@ var ts;
49090
49110
  },
49091
49111
  getContextualTypeForObjectLiteralElement: function (nodeIn) {
49092
49112
  var node = ts.getParseTreeNode(nodeIn, ts.isObjectLiteralElementLike);
49093
- return node ? getContextualTypeForObjectLiteralElement(node) : undefined;
49113
+ return node ? getContextualTypeForObjectLiteralElement(node, /*contextFlags*/ undefined) : undefined;
49094
49114
  },
49095
49115
  getContextualTypeForArgumentAtIndex: function (nodeIn, argIndex) {
49096
49116
  var node = ts.getParseTreeNode(nodeIn, ts.isCallLikeExpression);
@@ -49098,7 +49118,7 @@ var ts;
49098
49118
  },
49099
49119
  getContextualTypeForJsxAttribute: function (nodeIn) {
49100
49120
  var node = ts.getParseTreeNode(nodeIn, ts.isJsxAttributeLike);
49101
- return node && getContextualTypeForJsxAttribute(node);
49121
+ return node && getContextualTypeForJsxAttribute(node, /*contextFlags*/ undefined);
49102
49122
  },
49103
49123
  isContextSensitive: isContextSensitive,
49104
49124
  getTypeOfPropertyOfContextualType: getTypeOfPropertyOfContextualType,
@@ -52821,13 +52841,25 @@ var ts;
52821
52841
  && isDeclarationVisible(declaration.parent)) {
52822
52842
  return addVisibleAlias(declaration, declaration);
52823
52843
  }
52824
- 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
52825
- && ts.isVariableDeclaration(declaration.parent.parent)
52826
- && ((_b = declaration.parent.parent.parent) === null || _b === void 0 ? void 0 : _b.parent) && ts.isVariableStatement(declaration.parent.parent.parent.parent)
52827
- && !ts.hasSyntacticModifier(declaration.parent.parent.parent.parent, 1 /* Export */)
52828
- && declaration.parent.parent.parent.parent.parent // check if the thing containing the variable statement is visible (ie, the file)
52829
- && isDeclarationVisible(declaration.parent.parent.parent.parent.parent)) {
52830
- return addVisibleAlias(declaration, declaration.parent.parent.parent.parent);
52844
+ else if (ts.isBindingElement(declaration)) {
52845
+ 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
52846
+ && ts.isVariableDeclaration(declaration.parent.parent)
52847
+ && ((_b = declaration.parent.parent.parent) === null || _b === void 0 ? void 0 : _b.parent) && ts.isVariableStatement(declaration.parent.parent.parent.parent)
52848
+ && !ts.hasSyntacticModifier(declaration.parent.parent.parent.parent, 1 /* Export */)
52849
+ && declaration.parent.parent.parent.parent.parent // check if the thing containing the variable statement is visible (ie, the file)
52850
+ && isDeclarationVisible(declaration.parent.parent.parent.parent.parent)) {
52851
+ return addVisibleAlias(declaration, declaration.parent.parent.parent.parent);
52852
+ }
52853
+ else if (symbol.flags & 2 /* BlockScopedVariable */) {
52854
+ var variableStatement = ts.findAncestor(declaration, ts.isVariableStatement);
52855
+ if (ts.hasSyntacticModifier(variableStatement, 1 /* Export */)) {
52856
+ return true;
52857
+ }
52858
+ if (!isDeclarationVisible(variableStatement.parent)) {
52859
+ return false;
52860
+ }
52861
+ return addVisibleAlias(declaration, variableStatement);
52862
+ }
52831
52863
  }
52832
52864
  // Declaration is not visible
52833
52865
  return false;
@@ -53348,6 +53380,10 @@ var ts;
53348
53380
  }
53349
53381
  return typeToTypeNodeHelper(type, context);
53350
53382
  }
53383
+ function isHomomorphicMappedTypeWithNonHomomorphicInstantiation(type) {
53384
+ return isMappedTypeWithKeyofConstraintDeclaration(type)
53385
+ && !(getModifiersTypeFromMappedType(type).flags & 262144 /* TypeParameter */);
53386
+ }
53351
53387
  function createMappedTypeNodeFromType(type) {
53352
53388
  ts.Debug.assert(!!(type.flags & 524288 /* Object */));
53353
53389
  var readonlyToken = type.declaration.readonlyToken ? ts.factory.createToken(type.declaration.readonlyToken.kind) : undefined;
@@ -53357,7 +53393,7 @@ var ts;
53357
53393
  if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
53358
53394
  // We have a { [P in keyof T]: X }
53359
53395
  // We do this to ensure we retain the toplevel keyof-ness of the type which may be lost due to keyof distribution during `getConstraintTypeFromMappedType`
53360
- if (!(getModifiersTypeFromMappedType(type).flags & 262144 /* TypeParameter */) && context.flags & 4 /* GenerateNamesForShadowedTypeParams */) {
53396
+ if (isHomomorphicMappedTypeWithNonHomomorphicInstantiation(type) && context.flags & 4 /* GenerateNamesForShadowedTypeParams */) {
53361
53397
  var newParam = createTypeParameter(createSymbol(262144 /* TypeParameter */, "T"));
53362
53398
  var name = typeParameterToName(newParam, context);
53363
53399
  newTypeVariable = ts.factory.createTypeReferenceNode(name);
@@ -53373,11 +53409,12 @@ var ts;
53373
53409
  var mappedTypeNode = ts.factory.createMappedTypeNode(readonlyToken, typeParameterNode, nameTypeNode, questionToken, templateTypeNode, /*members*/ undefined);
53374
53410
  context.approximateLength += 10;
53375
53411
  var result = ts.setEmitFlags(mappedTypeNode, 1 /* SingleLine */);
53376
- if (isMappedTypeWithKeyofConstraintDeclaration(type) && !(getModifiersTypeFromMappedType(type).flags & 262144 /* TypeParameter */) && context.flags & 4 /* GenerateNamesForShadowedTypeParams */) {
53412
+ if (isHomomorphicMappedTypeWithNonHomomorphicInstantiation(type) && context.flags & 4 /* GenerateNamesForShadowedTypeParams */) {
53377
53413
  // homomorphic mapped type with a non-homomorphic naive inlining
53378
53414
  // wrap it with a conditional like `SomeModifiersType extends infer U ? {..the mapped type...} : never` to ensure the resulting
53379
53415
  // type stays homomorphic
53380
- 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 */));
53416
+ var originalConstraint = instantiateType(getConstraintOfTypeParameter(getTypeFromTypeNode(type.declaration.typeParameter.constraint.type)) || unknownType, type.mapper);
53417
+ 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 */));
53381
53418
  }
53382
53419
  return result;
53383
53420
  }
@@ -66327,13 +66364,20 @@ var ts;
66327
66364
  return result;
66328
66365
  }
66329
66366
  function structuredTypeRelatedTo(source, target, reportErrors, intersectionState) {
66367
+ var saveErrorInfo = captureErrorCalculationState();
66368
+ var result = structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState, saveErrorInfo);
66369
+ if (result) {
66370
+ resetErrorInfo(saveErrorInfo);
66371
+ }
66372
+ return result;
66373
+ }
66374
+ function structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState, saveErrorInfo) {
66330
66375
  if (intersectionState & 4 /* PropertyCheck */) {
66331
66376
  return propertiesRelatedTo(source, target, reportErrors, /*excludedProperties*/ undefined, 0 /* None */);
66332
66377
  }
66333
66378
  var result;
66334
66379
  var originalErrorInfo;
66335
66380
  var varianceCheckFailed = false;
66336
- var saveErrorInfo = captureErrorCalculationState();
66337
66381
  var sourceFlags = source.flags;
66338
66382
  var targetFlags = target.flags;
66339
66383
  if (relation === identityRelation) {
@@ -66397,7 +66441,6 @@ var ts;
66397
66441
  if (constraint && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself
66398
66442
  // TODO: Stack errors so we get a pyramid for the "normal" comparison above, _and_ a second for this
66399
66443
  if (result = isRelatedTo(constraint, target, 1 /* Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState)) {
66400
- resetErrorInfo(saveErrorInfo);
66401
66444
  return result;
66402
66445
  }
66403
66446
  }
@@ -66522,7 +66565,6 @@ var ts;
66522
66565
  result &= isRelatedTo(source.indexType, target.indexType, 3 /* Both */, reportErrors);
66523
66566
  }
66524
66567
  if (result) {
66525
- resetErrorInfo(saveErrorInfo);
66526
66568
  return result;
66527
66569
  }
66528
66570
  if (reportErrors) {
@@ -66625,7 +66667,6 @@ var ts;
66625
66667
  // If we reach 10 levels of nesting for the same conditional type, assume it is an infinitely expanding recursive
66626
66668
  // conditional type and bail out with a Ternary.Maybe result.
66627
66669
  if (isDeeplyNestedType(target, targetStack, targetDepth, 10)) {
66628
- resetErrorInfo(saveErrorInfo);
66629
66670
  return 3 /* Maybe */;
66630
66671
  }
66631
66672
  var c = target;
@@ -66640,7 +66681,6 @@ var ts;
66640
66681
  if (result = skipTrue ? -1 /* True */ : isRelatedTo(source, getTrueTypeFromConditionalType(c), 2 /* Target */, /*reportErrors*/ false)) {
66641
66682
  result &= skipFalse ? -1 /* True */ : isRelatedTo(source, getFalseTypeFromConditionalType(c), 2 /* Target */, /*reportErrors*/ false);
66642
66683
  if (result) {
66643
- resetErrorInfo(saveErrorInfo);
66644
66684
  return result;
66645
66685
  }
66646
66686
  }
@@ -66672,12 +66712,10 @@ var ts;
66672
66712
  var constraint = getConstraintOfType(source) || unknownType;
66673
66713
  // 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
66674
66714
  if (result = isRelatedTo(constraint, target, 1 /* Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState)) {
66675
- resetErrorInfo(saveErrorInfo);
66676
66715
  return result;
66677
66716
  }
66678
66717
  // slower, fuller, this-instantiated check (necessary when comparing raw `this` types from base classes), see `subclassWithPolymorphicThisIsAssignable.ts` test for example
66679
66718
  else if (result = isRelatedTo(getTypeWithThisArgument(constraint, source), target, 1 /* Source */, reportErrors && constraint !== unknownType && !(targetFlags & sourceFlags & 262144 /* TypeParameter */), /*headMessage*/ undefined, intersectionState)) {
66680
- resetErrorInfo(saveErrorInfo);
66681
66719
  return result;
66682
66720
  }
66683
66721
  if (isMappedTypeGenericIndexedAccess(source)) {
@@ -66686,7 +66724,6 @@ var ts;
66686
66724
  var indexConstraint = getConstraintOfType(source.indexType);
66687
66725
  if (indexConstraint) {
66688
66726
  if (result = isRelatedTo(getIndexedAccessType(source.objectType, indexConstraint), target, 1 /* Source */, reportErrors)) {
66689
- resetErrorInfo(saveErrorInfo);
66690
66727
  return result;
66691
66728
  }
66692
66729
  }
@@ -66695,7 +66732,6 @@ var ts;
66695
66732
  }
66696
66733
  else if (sourceFlags & 4194304 /* Index */) {
66697
66734
  if (result = isRelatedTo(keyofConstraintType, target, 1 /* Source */, reportErrors)) {
66698
- resetErrorInfo(saveErrorInfo);
66699
66735
  return result;
66700
66736
  }
66701
66737
  }
@@ -66703,7 +66739,6 @@ var ts;
66703
66739
  if (!(targetFlags & 134217728 /* TemplateLiteral */)) {
66704
66740
  var constraint = getBaseConstraintOfType(source);
66705
66741
  if (constraint && constraint !== source && (result = isRelatedTo(constraint, target, 1 /* Source */, reportErrors))) {
66706
- resetErrorInfo(saveErrorInfo);
66707
66742
  return result;
66708
66743
  }
66709
66744
  }
@@ -66714,14 +66749,12 @@ var ts;
66714
66749
  return 0 /* False */;
66715
66750
  }
66716
66751
  if (result = isRelatedTo(source.type, target.type, 3 /* Both */, reportErrors)) {
66717
- resetErrorInfo(saveErrorInfo);
66718
66752
  return result;
66719
66753
  }
66720
66754
  }
66721
66755
  else {
66722
66756
  var constraint = getBaseConstraintOfType(source);
66723
66757
  if (constraint && (result = isRelatedTo(constraint, target, 1 /* Source */, reportErrors))) {
66724
- resetErrorInfo(saveErrorInfo);
66725
66758
  return result;
66726
66759
  }
66727
66760
  }
@@ -66730,7 +66763,6 @@ var ts;
66730
66763
  // If we reach 10 levels of nesting for the same conditional type, assume it is an infinitely expanding recursive
66731
66764
  // conditional type and bail out with a Ternary.Maybe result.
66732
66765
  if (isDeeplyNestedType(source, sourceStack, sourceDepth, 10)) {
66733
- resetErrorInfo(saveErrorInfo);
66734
66766
  return 3 /* Maybe */;
66735
66767
  }
66736
66768
  if (targetFlags & 16777216 /* Conditional */) {
@@ -66753,7 +66785,6 @@ var ts;
66753
66785
  result &= isRelatedTo(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target), 3 /* Both */, reportErrors);
66754
66786
  }
66755
66787
  if (result) {
66756
- resetErrorInfo(saveErrorInfo);
66757
66788
  return result;
66758
66789
  }
66759
66790
  }
@@ -66764,7 +66795,6 @@ var ts;
66764
66795
  var distributiveConstraint = hasNonCircularBaseConstraint(source) ? getConstraintOfDistributiveConditionalType(source) : undefined;
66765
66796
  if (distributiveConstraint) {
66766
66797
  if (result = isRelatedTo(distributiveConstraint, target, 1 /* Source */, reportErrors)) {
66767
- resetErrorInfo(saveErrorInfo);
66768
66798
  return result;
66769
66799
  }
66770
66800
  }
@@ -66774,7 +66804,6 @@ var ts;
66774
66804
  var defaultConstraint = getDefaultConstraintOfConditionalType(source);
66775
66805
  if (defaultConstraint) {
66776
66806
  if (result = isRelatedTo(defaultConstraint, target, 1 /* Source */, reportErrors)) {
66777
- resetErrorInfo(saveErrorInfo);
66778
66807
  return result;
66779
66808
  }
66780
66809
  }
@@ -66787,7 +66816,6 @@ var ts;
66787
66816
  if (isGenericMappedType(target)) {
66788
66817
  if (isGenericMappedType(source)) {
66789
66818
  if (result = mappedTypeRelatedTo(source, target, reportErrors)) {
66790
- resetErrorInfo(saveErrorInfo);
66791
66819
  return result;
66792
66820
  }
66793
66821
  }
@@ -72308,7 +72336,7 @@ var ts;
72308
72336
  !((ts.isJsxOpeningElement(node.parent) || ts.isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) &&
72309
72337
  (checkMode && checkMode & 64 /* RestBindingElement */ ?
72310
72338
  getContextualType(node, 8 /* SkipBindingPatterns */)
72311
- : getContextualType(node));
72339
+ : getContextualType(node, /*contextFlags*/ undefined));
72312
72340
  return contextualType && !isGenericType(contextualType);
72313
72341
  }
72314
72342
  function getNarrowableTypeForReference(type, reference, checkMode) {
@@ -73172,7 +73200,7 @@ var ts;
73172
73200
  // We have an object literal method. Check if the containing object literal has a contextual type
73173
73201
  // that includes a ThisType<T>. If so, T is the contextual type for 'this'. We continue looking in
73174
73202
  // any directly enclosing object literals.
73175
- var contextualType = getApparentTypeOfContextualType(containingLiteral);
73203
+ var contextualType = getApparentTypeOfContextualType(containingLiteral, /*contextFlags*/ undefined);
73176
73204
  var literal = containingLiteral;
73177
73205
  var type = contextualType;
73178
73206
  while (type) {
@@ -73184,7 +73212,7 @@ var ts;
73184
73212
  break;
73185
73213
  }
73186
73214
  literal = literal.parent.parent;
73187
- type = getApparentTypeOfContextualType(literal);
73215
+ type = getApparentTypeOfContextualType(literal, /*contextFlags*/ undefined);
73188
73216
  }
73189
73217
  // There was no contextual ThisType<T> for the containing object literal, so the contextual type
73190
73218
  // for 'this' is the non-null form of the contextual type for the containing object literal or
@@ -73241,7 +73269,7 @@ var ts;
73241
73269
  tryGetTypeAtPosition(contextualSignature, index);
73242
73270
  }
73243
73271
  }
73244
- function getContextualTypeForVariableLikeDeclaration(declaration) {
73272
+ function getContextualTypeForVariableLikeDeclaration(declaration, contextFlags) {
73245
73273
  var typeNode = ts.getEffectiveTypeAnnotationNode(declaration);
73246
73274
  if (typeNode) {
73247
73275
  return getTypeFromTypeNode(typeNode);
@@ -73250,18 +73278,18 @@ var ts;
73250
73278
  case 164 /* Parameter */:
73251
73279
  return getContextuallyTypedParameterType(declaration);
73252
73280
  case 203 /* BindingElement */:
73253
- return getContextualTypeForBindingElement(declaration);
73281
+ return getContextualTypeForBindingElement(declaration, contextFlags);
73254
73282
  case 167 /* PropertyDeclaration */:
73255
73283
  if (ts.isStatic(declaration)) {
73256
- return getContextualTypeForStaticPropertyDeclaration(declaration);
73284
+ return getContextualTypeForStaticPropertyDeclaration(declaration, contextFlags);
73257
73285
  }
73258
73286
  // By default, do nothing and return undefined - only the above cases have context implied by a parent
73259
73287
  }
73260
73288
  }
73261
- function getContextualTypeForBindingElement(declaration) {
73289
+ function getContextualTypeForBindingElement(declaration, contextFlags) {
73262
73290
  var parent = declaration.parent.parent;
73263
73291
  var name = declaration.propertyName || declaration.name;
73264
- var parentType = getContextualTypeForVariableLikeDeclaration(parent) ||
73292
+ var parentType = getContextualTypeForVariableLikeDeclaration(parent, contextFlags) ||
73265
73293
  parent.kind !== 203 /* BindingElement */ && parent.initializer && checkDeclarationInitializer(parent, declaration.dotDotDotToken ? 64 /* RestBindingElement */ : 0 /* Normal */);
73266
73294
  if (!parentType || ts.isBindingPattern(name) || ts.isComputedNonLiteralName(name))
73267
73295
  return undefined;
@@ -73277,8 +73305,8 @@ var ts;
73277
73305
  return getTypeOfPropertyOfType(parentType, text);
73278
73306
  }
73279
73307
  }
73280
- function getContextualTypeForStaticPropertyDeclaration(declaration) {
73281
- var parentType = ts.isExpression(declaration.parent) && getContextualType(declaration.parent);
73308
+ function getContextualTypeForStaticPropertyDeclaration(declaration, contextFlags) {
73309
+ var parentType = ts.isExpression(declaration.parent) && getContextualType(declaration.parent, contextFlags);
73282
73310
  if (!parentType)
73283
73311
  return undefined;
73284
73312
  return getTypeOfPropertyOfContextualType(parentType, getSymbolOfNode(declaration).escapedName);
@@ -73294,7 +73322,7 @@ var ts;
73294
73322
  function getContextualTypeForInitializerExpression(node, contextFlags) {
73295
73323
  var declaration = node.parent;
73296
73324
  if (ts.hasInitializer(declaration) && node === declaration.initializer) {
73297
- var result = getContextualTypeForVariableLikeDeclaration(declaration);
73325
+ var result = getContextualTypeForVariableLikeDeclaration(declaration, contextFlags);
73298
73326
  if (result) {
73299
73327
  return result;
73300
73328
  }
@@ -73304,10 +73332,10 @@ var ts;
73304
73332
  }
73305
73333
  return undefined;
73306
73334
  }
73307
- function getContextualTypeForReturnExpression(node) {
73335
+ function getContextualTypeForReturnExpression(node, contextFlags) {
73308
73336
  var func = ts.getContainingFunction(node);
73309
73337
  if (func) {
73310
- var contextualReturnType = getContextualReturnType(func);
73338
+ var contextualReturnType = getContextualReturnType(func, contextFlags);
73311
73339
  if (contextualReturnType) {
73312
73340
  var functionFlags = ts.getFunctionFlags(func);
73313
73341
  if (functionFlags & 1 /* Generator */) { // Generator or AsyncGenerator function
@@ -73337,11 +73365,11 @@ var ts;
73337
73365
  }
73338
73366
  return undefined;
73339
73367
  }
73340
- function getContextualTypeForYieldOperand(node) {
73368
+ function getContextualTypeForYieldOperand(node, contextFlags) {
73341
73369
  var func = ts.getContainingFunction(node);
73342
73370
  if (func) {
73343
73371
  var functionFlags = ts.getFunctionFlags(func);
73344
- var contextualReturnType = getContextualReturnType(func);
73372
+ var contextualReturnType = getContextualReturnType(func, contextFlags);
73345
73373
  if (contextualReturnType) {
73346
73374
  return node.asteriskToken
73347
73375
  ? contextualReturnType
@@ -73365,14 +73393,14 @@ var ts;
73365
73393
  }
73366
73394
  function getContextualIterationType(kind, functionDecl) {
73367
73395
  var isAsync = !!(ts.getFunctionFlags(functionDecl) & 2 /* Async */);
73368
- var contextualReturnType = getContextualReturnType(functionDecl);
73396
+ var contextualReturnType = getContextualReturnType(functionDecl, /*contextFlags*/ undefined);
73369
73397
  if (contextualReturnType) {
73370
73398
  return getIterationTypeOfGeneratorFunctionReturnType(kind, contextualReturnType, isAsync)
73371
73399
  || undefined;
73372
73400
  }
73373
73401
  return undefined;
73374
73402
  }
73375
- function getContextualReturnType(functionDecl) {
73403
+ function getContextualReturnType(functionDecl, contextFlags) {
73376
73404
  // If the containing function has a return type annotation, is a constructor, or is a get accessor whose
73377
73405
  // corresponding set accessor has a type annotation, return statements in the function are contextually typed
73378
73406
  var returnType = getReturnTypeFromAnnotation(functionDecl);
@@ -73387,7 +73415,7 @@ var ts;
73387
73415
  }
73388
73416
  var iife = ts.getImmediatelyInvokedFunctionExpression(functionDecl);
73389
73417
  if (iife) {
73390
- return getContextualType(iife);
73418
+ return getContextualType(iife, contextFlags);
73391
73419
  }
73392
73420
  return undefined;
73393
73421
  }
@@ -73640,7 +73668,7 @@ var ts;
73640
73668
  }
73641
73669
  function getContextualTypeForObjectLiteralElement(element, contextFlags) {
73642
73670
  var objectLiteral = element.parent;
73643
- var propertyAssignmentType = ts.isPropertyAssignment(element) && getContextualTypeForVariableLikeDeclaration(element);
73671
+ var propertyAssignmentType = ts.isPropertyAssignment(element) && getContextualTypeForVariableLikeDeclaration(element, contextFlags);
73644
73672
  if (propertyAssignmentType) {
73645
73673
  return propertyAssignmentType;
73646
73674
  }
@@ -73835,9 +73863,9 @@ var ts;
73835
73863
  return getContextualTypeForInitializerExpression(node, contextFlags);
73836
73864
  case 214 /* ArrowFunction */:
73837
73865
  case 247 /* ReturnStatement */:
73838
- return getContextualTypeForReturnExpression(node);
73866
+ return getContextualTypeForReturnExpression(node, contextFlags);
73839
73867
  case 224 /* YieldExpression */:
73840
- return getContextualTypeForYieldOperand(parent);
73868
+ return getContextualTypeForYieldOperand(parent, contextFlags);
73841
73869
  case 218 /* AwaitExpression */:
73842
73870
  return getContextualTypeForAwaitOperand(parent, contextFlags);
73843
73871
  case 208 /* CallExpression */:
@@ -73885,7 +73913,7 @@ var ts;
73885
73913
  }
73886
73914
  return undefined;
73887
73915
  function tryFindWhenConstTypeReference(node) {
73888
- return getContextualType(node);
73916
+ return getContextualType(node, contextFlags);
73889
73917
  }
73890
73918
  }
73891
73919
  function getInferenceContext(node) {
@@ -74187,7 +74215,7 @@ var ts;
74187
74215
  var elementCount = elements.length;
74188
74216
  var elementTypes = [];
74189
74217
  var elementFlags = [];
74190
- var contextualType = getApparentTypeOfContextualType(node);
74218
+ var contextualType = getApparentTypeOfContextualType(node, /*contextFlags*/ undefined);
74191
74219
  var inDestructuringPattern = ts.isAssignmentTarget(node);
74192
74220
  var inConstContext = isConstContext(node);
74193
74221
  var hasOmittedExpression = false;
@@ -74358,7 +74386,7 @@ var ts;
74358
74386
  var propertiesTable = ts.createSymbolTable();
74359
74387
  var propertiesArray = [];
74360
74388
  var spread = emptyObjectType;
74361
- var contextualType = getApparentTypeOfContextualType(node);
74389
+ var contextualType = getApparentTypeOfContextualType(node, /*contextFlags*/ undefined);
74362
74390
  var contextualTypeHasPattern = contextualType && contextualType.pattern &&
74363
74391
  (contextualType.pattern.kind === 201 /* ObjectBindingPattern */ || contextualType.pattern.kind === 205 /* ObjectLiteralExpression */);
74364
74392
  var inConstContext = isConstContext(node);
@@ -74697,7 +74725,7 @@ var ts;
74697
74725
  if (explicitlySpecifyChildrenAttribute) {
74698
74726
  error(attributes, ts.Diagnostics._0_are_specified_twice_The_attribute_named_0_will_be_overwritten, ts.unescapeLeadingUnderscores(jsxChildrenPropertyName));
74699
74727
  }
74700
- var contextualType = getApparentTypeOfContextualType(openingLikeElement.attributes);
74728
+ var contextualType = getApparentTypeOfContextualType(openingLikeElement.attributes, /*contextFlags*/ undefined);
74701
74729
  var childrenContextualType = contextualType && getTypeOfPropertyOfContextualType(contextualType, jsxChildrenPropertyName);
74702
74730
  // 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
74703
74731
  var childrenPropSymbol = createSymbol(4 /* Property */, jsxChildrenPropertyName);
@@ -78537,17 +78565,6 @@ var ts;
78537
78565
  }
78538
78566
  }
78539
78567
  }
78540
- var restType = getEffectiveRestType(context);
78541
- if (restType && restType.flags & 262144 /* TypeParameter */) {
78542
- // The contextual signature has a generic rest parameter. We first instantiate the contextual
78543
- // signature (without fixing type parameters) and assign types to contextually typed parameters.
78544
- var instantiatedContext = instantiateSignature(context, inferenceContext.nonFixingMapper);
78545
- assignContextualParameterTypes(signature, instantiatedContext);
78546
- // We then infer from a tuple type representing the parameters that correspond to the contextual
78547
- // rest parameter.
78548
- var restPos = getParameterCount(context) - 1;
78549
- inferTypes(inferenceContext.inferences, getRestTypeAtPosition(signature, restPos), restType);
78550
- }
78551
78568
  }
78552
78569
  function assignContextualParameterTypes(signature, context) {
78553
78570
  if (context.typeParameters) {
@@ -78740,7 +78757,7 @@ var ts;
78740
78757
  var contextualSignature = getContextualSignatureForFunctionLikeDeclaration(func);
78741
78758
  var contextualType = !contextualSignature ? undefined :
78742
78759
  contextualSignature === getSignatureFromDeclaration(func) ? isGenerator ? undefined : returnType :
78743
- instantiateContextualType(getReturnTypeOfSignature(contextualSignature), func);
78760
+ instantiateContextualType(getReturnTypeOfSignature(contextualSignature), func, /*contextFlags*/ undefined);
78744
78761
  if (isGenerator) {
78745
78762
  yieldType = getWidenedLiteralLikeTypeForContextualIterationTypeIfNeeded(yieldType, contextualType, 0 /* Yield */, isAsync);
78746
78763
  returnType = getWidenedLiteralLikeTypeForContextualIterationTypeIfNeeded(returnType, contextualType, 1 /* Return */, isAsync);
@@ -78811,7 +78828,7 @@ var ts;
78811
78828
  nextType = iterationTypes && iterationTypes.nextType;
78812
78829
  }
78813
78830
  else {
78814
- nextType = getContextualType(yieldExpression);
78831
+ nextType = getContextualType(yieldExpression, /*contextFlags*/ undefined);
78815
78832
  }
78816
78833
  if (nextType)
78817
78834
  ts.pushIfUnique(nextTypes, nextType);
@@ -79020,11 +79037,16 @@ var ts;
79020
79037
  if (isContextSensitive(node)) {
79021
79038
  if (contextualSignature) {
79022
79039
  var inferenceContext = getInferenceContext(node);
79040
+ var instantiatedContextualSignature = void 0;
79023
79041
  if (checkMode && checkMode & 2 /* Inferential */) {
79024
79042
  inferFromAnnotatedParameters(signature, contextualSignature, inferenceContext);
79043
+ var restType = getEffectiveRestType(contextualSignature);
79044
+ if (restType && restType.flags & 262144 /* TypeParameter */) {
79045
+ instantiatedContextualSignature = instantiateSignature(contextualSignature, inferenceContext.nonFixingMapper);
79046
+ }
79025
79047
  }
79026
- var instantiatedContextualSignature = inferenceContext ?
79027
- instantiateSignature(contextualSignature, inferenceContext.mapper) : contextualSignature;
79048
+ instantiatedContextualSignature || (instantiatedContextualSignature = inferenceContext ?
79049
+ instantiateSignature(contextualSignature, inferenceContext.mapper) : contextualSignature);
79028
79050
  assignContextualParameterTypes(signature, instantiatedContextualSignature);
79029
79051
  }
79030
79052
  else {
@@ -80266,7 +80288,7 @@ var ts;
80266
80288
  type = anyType;
80267
80289
  addLazyDiagnostic(function () {
80268
80290
  if (noImplicitAny && !ts.expressionResultIsUnused(node)) {
80269
- var contextualType = getContextualType(node);
80291
+ var contextualType = getContextualType(node, /*contextFlags*/ undefined);
80270
80292
  if (!contextualType || isTypeAny(contextualType)) {
80271
80293
  error(node, ts.Diagnostics.yield_expression_implicitly_results_in_an_any_type_because_its_containing_generator_lacks_a_return_type_annotation);
80272
80294
  }
@@ -80307,7 +80329,7 @@ var ts;
80307
80329
  texts.push(span.literal.text);
80308
80330
  types.push(isTypeAssignableTo(type, templateConstraintType) ? type : stringType);
80309
80331
  }
80310
- return isConstContext(node) || isTemplateLiteralContext(node) || someType(getContextualType(node) || unknownType, isTemplateLiteralContextualType) ? getTemplateLiteralType(texts, types) : stringType;
80332
+ return isConstContext(node) || isTemplateLiteralContext(node) || someType(getContextualType(node, /*contextFlags*/ undefined) || unknownType, isTemplateLiteralContextualType) ? getTemplateLiteralType(texts, types) : stringType;
80311
80333
  }
80312
80334
  function isTemplateLiteralContextualType(type) {
80313
80335
  return !!(type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */) ||
@@ -80335,7 +80357,7 @@ var ts;
80335
80357
  // We strip literal freshness when an appropriate contextual type is present such that contextually typed
80336
80358
  // literals always preserve their literal types (otherwise they might widen during type inference). An alternative
80337
80359
  // here would be to not mark contextually typed literals as fresh in the first place.
80338
- var result = maybeTypeOfKind(type, 2944 /* Literal */) && isLiteralOfContextualType(type, instantiateContextualType(contextualType, node)) ?
80360
+ var result = maybeTypeOfKind(type, 2944 /* Literal */) && isLiteralOfContextualType(type, instantiateContextualType(contextualType, node, /*contextFlags*/ undefined)) ?
80339
80361
  getRegularTypeOfLiteralType(type) : type;
80340
80362
  return result;
80341
80363
  }
@@ -80450,7 +80472,7 @@ var ts;
80450
80472
  var type = checkExpression(node, checkMode, forceTuple);
80451
80473
  return isConstContext(node) || ts.isCommonJsExportedExpression(node) ? getRegularTypeOfLiteralType(type) :
80452
80474
  isTypeAssertion(node) ? type :
80453
- getWidenedLiteralLikeTypeForContextualType(type, instantiateContextualType(arguments.length === 2 ? getContextualType(node) : contextualType, node));
80475
+ getWidenedLiteralLikeTypeForContextualType(type, instantiateContextualType(arguments.length === 2 ? getContextualType(node, /*contextFlags*/ undefined) : contextualType, node, /*contextFlags*/ undefined));
80454
80476
  }
80455
80477
  function checkPropertyAssignment(node, checkMode) {
80456
80478
  // Do not use hasDynamicName here, because that returns false for well known symbols.
@@ -166127,20 +166149,25 @@ var ts;
166127
166149
  return this.documentationComment;
166128
166150
  };
166129
166151
  SymbolObject.prototype.getContextualDocumentationComment = function (context, checker) {
166130
- switch (context === null || context === void 0 ? void 0 : context.kind) {
166131
- case 172 /* GetAccessor */:
166152
+ if (context) {
166153
+ if (ts.isGetAccessor(context)) {
166132
166154
  if (!this.contextualGetAccessorDocumentationComment) {
166133
166155
  this.contextualGetAccessorDocumentationComment = getDocumentationComment(ts.filter(this.declarations, ts.isGetAccessor), checker);
166134
166156
  }
166135
- return this.contextualGetAccessorDocumentationComment;
166136
- case 173 /* SetAccessor */:
166157
+ if (ts.length(this.contextualGetAccessorDocumentationComment)) {
166158
+ return this.contextualGetAccessorDocumentationComment;
166159
+ }
166160
+ }
166161
+ if (ts.isSetAccessor(context)) {
166137
166162
  if (!this.contextualSetAccessorDocumentationComment) {
166138
166163
  this.contextualSetAccessorDocumentationComment = getDocumentationComment(ts.filter(this.declarations, ts.isSetAccessor), checker);
166139
166164
  }
166140
- return this.contextualSetAccessorDocumentationComment;
166141
- default:
166142
- return this.getDocumentationComment(checker);
166165
+ if (ts.length(this.contextualSetAccessorDocumentationComment)) {
166166
+ return this.contextualSetAccessorDocumentationComment;
166167
+ }
166168
+ }
166143
166169
  }
166170
+ return this.getDocumentationComment(checker);
166144
166171
  };
166145
166172
  SymbolObject.prototype.getJsDocTags = function (checker) {
166146
166173
  if (this.tags === undefined) {
@@ -166149,20 +166176,25 @@ var ts;
166149
166176
  return this.tags;
166150
166177
  };
166151
166178
  SymbolObject.prototype.getContextualJsDocTags = function (context, checker) {
166152
- switch (context === null || context === void 0 ? void 0 : context.kind) {
166153
- case 172 /* GetAccessor */:
166179
+ if (context) {
166180
+ if (ts.isGetAccessor(context)) {
166154
166181
  if (!this.contextualGetAccessorTags) {
166155
166182
  this.contextualGetAccessorTags = getJsDocTagsOfDeclarations(ts.filter(this.declarations, ts.isGetAccessor), checker);
166156
166183
  }
166157
- return this.contextualGetAccessorTags;
166158
- case 173 /* SetAccessor */:
166184
+ if (ts.length(this.contextualGetAccessorTags)) {
166185
+ return this.contextualGetAccessorTags;
166186
+ }
166187
+ }
166188
+ if (ts.isSetAccessor(context)) {
166159
166189
  if (!this.contextualSetAccessorTags) {
166160
166190
  this.contextualSetAccessorTags = getJsDocTagsOfDeclarations(ts.filter(this.declarations, ts.isSetAccessor), checker);
166161
166191
  }
166162
- return this.contextualSetAccessorTags;
166163
- default:
166164
- return this.getJsDocTags(checker);
166192
+ if (ts.length(this.contextualSetAccessorTags)) {
166193
+ return this.contextualSetAccessorTags;
166194
+ }
166195
+ }
166165
166196
  }
166197
+ return this.getJsDocTags(checker);
166166
166198
  };
166167
166199
  return SymbolObject;
166168
166200
  }());
@@ -166913,7 +166945,10 @@ var ts;
166913
166945
  program = undefined; // TODO: GH#18217
166914
166946
  lastTypesRootVersion = typeRootsVersion;
166915
166947
  }
166916
- var rootFileNames = host.getScriptFileNames();
166948
+ // This array is retained by the program and will be used to determine if the program is up to date,
166949
+ // so we need to make a copy in case the host mutates the underlying array - otherwise it would look
166950
+ // like every program always has the host's current list of root files.
166951
+ var rootFileNames = host.getScriptFileNames().slice();
166917
166952
  // Get a fresh cache of the host information
166918
166953
  var newSettings = host.getCompilationSettings() || getDefaultCompilerOptions();
166919
166954
  var hasInvalidatedResolution = host.hasInvalidatedResolution || ts.returnFalse;