typescript 4.8.0-dev.20220705 → 4.8.0-dev.20220706

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.
@@ -19,11 +19,11 @@ and limitations under the License.
19
19
 
20
20
 
21
21
  interface ErrorOptions {
22
- cause?: Error;
22
+ cause?: unknown;
23
23
  }
24
24
 
25
25
  interface Error {
26
- cause?: Error;
26
+ cause?: unknown;
27
27
  }
28
28
 
29
29
  interface ErrorConstructor {
package/lib/tsc.js CHANGED
@@ -69,7 +69,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
69
69
  var ts;
70
70
  (function (ts) {
71
71
  ts.versionMajorMinor = "4.8";
72
- ts.version = ts.versionMajorMinor + ".0-dev.20220705";
72
+ ts.version = ts.versionMajorMinor + ".0-dev.20220706";
73
73
  var NativeCollections;
74
74
  (function (NativeCollections) {
75
75
  var globals = typeof globalThis !== "undefined" ? globalThis :
@@ -40239,6 +40239,7 @@ var ts;
40239
40239
  var stringMappingTypes = new ts.Map();
40240
40240
  var substitutionTypes = new ts.Map();
40241
40241
  var subtypeReductionCache = new ts.Map();
40242
+ var cachedTypes = new ts.Map();
40242
40243
  var evolvingArrayTypes = [];
40243
40244
  var undefinedProperties = new ts.Map();
40244
40245
  var markerTypes = new ts.Set();
@@ -40477,6 +40478,14 @@ var ts;
40477
40478
  ];
40478
40479
  initializeTypeChecker();
40479
40480
  return checker;
40481
+ function getCachedType(key) {
40482
+ return key ? cachedTypes.get(key) : undefined;
40483
+ }
40484
+ function setCachedType(key, type) {
40485
+ if (key)
40486
+ cachedTypes.set(key, type);
40487
+ return type;
40488
+ }
40480
40489
  function getJsxNamespace(location) {
40481
40490
  if (location) {
40482
40491
  var file = ts.getSourceFileOfNode(location);
@@ -43411,7 +43420,7 @@ var ts;
43411
43420
  }
43412
43421
  function toNodeBuilderFlags(flags) {
43413
43422
  if (flags === void 0) { flags = 0; }
43414
- return flags & 814775659;
43423
+ return flags & 848330091;
43415
43424
  }
43416
43425
  function isClassInstanceSide(type) {
43417
43426
  return !!type.symbol && !!(type.symbol.flags & 32) && (type === getDeclaredTypeOfClassOrInterface(type.symbol) || (!!(type.flags & 524288) && !!(ts.getObjectFlags(type) & 16777216)));
@@ -44324,7 +44333,7 @@ var ts;
44324
44333
  }
44325
44334
  var expandedParams = getExpandedParameters(signature, true)[0];
44326
44335
  var parameters = (ts.some(expandedParams, function (p) { return p !== expandedParams[expandedParams.length - 1] && !!(ts.getCheckFlags(p) & 32768); }) ? signature.parameters : expandedParams).map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 171, options === null || options === void 0 ? void 0 : options.privateSymbolVisitor, options === null || options === void 0 ? void 0 : options.bundledImports); });
44327
- var thisParameter = tryGetThisParameterDeclaration(signature, context);
44336
+ var thisParameter = context.flags & 33554432 ? undefined : tryGetThisParameterDeclaration(signature, context);
44328
44337
  if (thisParameter) {
44329
44338
  parameters.unshift(thisParameter);
44330
44339
  }
@@ -45277,12 +45286,11 @@ var ts;
45277
45286
  if (skipMembershipCheck || (!!ts.length(symbol.declarations) && ts.some(symbol.declarations, function (d) { return !!ts.findAncestor(d, function (n) { return n === enclosingDeclaration; }); }))) {
45278
45287
  var oldContext = context;
45279
45288
  context = cloneNodeBuilderContext(context);
45280
- var result = serializeSymbolWorker(symbol, isPrivate, propertyAsAlias);
45289
+ serializeSymbolWorker(symbol, isPrivate, propertyAsAlias);
45281
45290
  if (context.reportedDiagnostic) {
45282
45291
  oldcontext.reportedDiagnostic = context.reportedDiagnostic;
45283
45292
  }
45284
45293
  context = oldContext;
45285
- return result;
45286
45294
  }
45287
45295
  }
45288
45296
  function serializeSymbolWorker(symbol, isPrivate, propertyAsAlias) {
@@ -47867,7 +47875,7 @@ var ts;
47867
47875
  error(declaration.typeExpression.type, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
47868
47876
  }
47869
47877
  else {
47870
- error(ts.isNamedDeclaration(declaration) ? declaration.name : declaration || declaration, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
47878
+ error(ts.isNamedDeclaration(declaration) ? declaration.name || declaration : declaration, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
47871
47879
  }
47872
47880
  }
47873
47881
  links.declaredType = type;
@@ -56759,9 +56767,14 @@ var ts;
56759
56767
  type.flags & 256 ? numberType :
56760
56768
  type.flags & 2048 ? bigintType :
56761
56769
  type.flags & 512 ? booleanType :
56762
- type.flags & 1048576 ? mapType(type, getBaseTypeOfLiteralType) :
56770
+ type.flags & 1048576 ? getBaseTypeOfLiteralTypeUnion(type) :
56763
56771
  type;
56764
56772
  }
56773
+ function getBaseTypeOfLiteralTypeUnion(type) {
56774
+ var _a;
56775
+ var key = "B" + getTypeId(type);
56776
+ return (_a = getCachedType(key)) !== null && _a !== void 0 ? _a : setCachedType(key, mapType(type, getBaseTypeOfLiteralType));
56777
+ }
56765
56778
  function getWidenedLiteralType(type) {
56766
56779
  return type.flags & 1024 && isFreshLiteralType(type) ? getBaseTypeOfEnumLiteralType(type) :
56767
56780
  type.flags & 128 && isFreshLiteralType(type) ? stringType :
@@ -58611,19 +58624,20 @@ var ts;
58611
58624
  return false;
58612
58625
  }
58613
58626
  function getAssignmentReducedType(declaredType, assignedType) {
58614
- if (declaredType !== assignedType) {
58615
- if (assignedType.flags & 131072) {
58616
- return assignedType;
58617
- }
58618
- var reducedType = filterType(declaredType, function (t) { return typeMaybeAssignableTo(assignedType, t); });
58619
- if (assignedType.flags & 512 && isFreshLiteralType(assignedType)) {
58620
- reducedType = mapType(reducedType, getFreshTypeOfLiteralType);
58621
- }
58622
- if (isTypeAssignableTo(assignedType, reducedType)) {
58623
- return reducedType;
58624
- }
58627
+ var _a;
58628
+ if (declaredType === assignedType) {
58629
+ return declaredType;
58625
58630
  }
58626
- return declaredType;
58631
+ if (assignedType.flags & 131072) {
58632
+ return assignedType;
58633
+ }
58634
+ var key = "A" + getTypeId(declaredType) + "," + getTypeId(assignedType);
58635
+ return (_a = getCachedType(key)) !== null && _a !== void 0 ? _a : setCachedType(key, getAssignmentReducedTypeWorker(declaredType, assignedType));
58636
+ }
58637
+ function getAssignmentReducedTypeWorker(declaredType, assignedType) {
58638
+ var filteredType = filterType(declaredType, function (t) { return typeMaybeAssignableTo(assignedType, t); });
58639
+ var reducedType = assignedType.flags & 512 && isFreshLiteralType(assignedType) ? mapType(filteredType, getFreshTypeOfLiteralType) : filteredType;
58640
+ return isTypeAssignableTo(assignedType, reducedType) ? reducedType : declaredType;
58627
58641
  }
58628
58642
  function isFunctionObjectType(type) {
58629
58643
  var resolved = resolveStructuredTypeMembers(type);
@@ -59892,7 +59906,7 @@ var ts;
59892
59906
  var targetType = ts.hasStaticModifier(ts.Debug.checkDefined(symbol.valueDeclaration, "should always have a declaration"))
59893
59907
  ? getTypeOfSymbol(classSymbol)
59894
59908
  : getDeclaredTypeOfSymbol(classSymbol);
59895
- return getNarrowedType(type, targetType, assumeTrue, isTypeDerivedFrom);
59909
+ return getNarrowedType(type, targetType, assumeTrue, true);
59896
59910
  }
59897
59911
  function narrowTypeByOptionalChainContainment(type, operator, value, assumeTrue) {
59898
59912
  var equalsOperator = operator === 34 || operator === 36;
@@ -60101,9 +60115,15 @@ var ts;
60101
60115
  if (!nonConstructorTypeInUnion)
60102
60116
  return type;
60103
60117
  }
60104
- return getNarrowedType(type, targetType, assumeTrue, isTypeDerivedFrom);
60118
+ return getNarrowedType(type, targetType, assumeTrue, true);
60119
+ }
60120
+ function getNarrowedType(type, candidate, assumeTrue, checkDerived) {
60121
+ var _a;
60122
+ var key = type.flags & 1048576 ? "N" + getTypeId(type) + "," + getTypeId(candidate) + "," + ((assumeTrue ? 1 : 0) | (checkDerived ? 2 : 0)) : undefined;
60123
+ return (_a = getCachedType(key)) !== null && _a !== void 0 ? _a : setCachedType(key, getNarrowedTypeWorker(type, candidate, assumeTrue, checkDerived));
60105
60124
  }
60106
- function getNarrowedType(type, candidate, assumeTrue, isRelated) {
60125
+ function getNarrowedTypeWorker(type, candidate, assumeTrue, checkDerived) {
60126
+ var isRelated = checkDerived ? isTypeDerivedFrom : isTypeSubtypeOf;
60107
60127
  if (!assumeTrue) {
60108
60128
  return filterType(type, function (t) { return !isRelated(t, candidate); });
60109
60129
  }
@@ -60143,7 +60163,7 @@ var ts;
60143
60163
  var predicateArgument = getTypePredicateArgument(predicate, callExpression);
60144
60164
  if (predicateArgument) {
60145
60165
  if (isMatchingReference(reference, predicateArgument)) {
60146
- return getNarrowedType(type, predicate.type, assumeTrue, isTypeSubtypeOf);
60166
+ return getNarrowedType(type, predicate.type, assumeTrue, false);
60147
60167
  }
60148
60168
  if (strictNullChecks && assumeTrue && optionalChainContainsReference(predicateArgument, reference) &&
60149
60169
  !(getTypeFacts(predicate.type) & 65536)) {
@@ -60151,7 +60171,7 @@ var ts;
60151
60171
  }
60152
60172
  var access = getDiscriminantPropertyAccess(predicateArgument, type);
60153
60173
  if (access) {
60154
- return narrowTypeByDiscriminant(type, access, function (t) { return getNarrowedType(t, predicate.type, assumeTrue, isTypeSubtypeOf); });
60174
+ return narrowTypeByDiscriminant(type, access, function (t) { return getNarrowedType(t, predicate.type, assumeTrue, false); });
60155
60175
  }
60156
60176
  }
60157
60177
  }
@@ -60407,7 +60427,7 @@ var ts;
60407
60427
  getNodeLinks(container).flags |= 8192;
60408
60428
  return getTypeOfSymbol(symbol);
60409
60429
  }
60410
- if (!(node.parent && ts.isPropertyAccessExpression(node.parent) && node.parent.expression === node)) {
60430
+ if (shouldMarkIdentifierAliasReferenced(node)) {
60411
60431
  markAliasReferenced(symbol, node);
60412
60432
  }
60413
60433
  var localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol);
@@ -60520,6 +60540,23 @@ var ts;
60520
60540
  }
60521
60541
  return assignmentKind ? getBaseTypeOfLiteralType(flowType) : flowType;
60522
60542
  }
60543
+ function shouldMarkIdentifierAliasReferenced(node) {
60544
+ var _a;
60545
+ var parent = node.parent;
60546
+ if (parent) {
60547
+ if (ts.isPropertyAccessExpression(parent) && parent.expression === node) {
60548
+ return false;
60549
+ }
60550
+ if (ts.isExportSpecifier(parent) && parent.isTypeOnly) {
60551
+ return false;
60552
+ }
60553
+ var greatGrandparent = (_a = parent.parent) === null || _a === void 0 ? void 0 : _a.parent;
60554
+ if (greatGrandparent && ts.isExportDeclaration(greatGrandparent) && greatGrandparent.isTypeOnly) {
60555
+ return false;
60556
+ }
60557
+ }
60558
+ return true;
60559
+ }
60523
60560
  function isInsideFunctionOrInstancePropertyInitializer(node, threshold) {
60524
60561
  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); });
60525
60562
  }
@@ -64336,7 +64373,7 @@ var ts;
64336
64373
  argCheckMode = checkMode & 32;
64337
64374
  if (inferenceContext) {
64338
64375
  var typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
64339
- checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, ts.isInJSFile(candidate.declaration), inferenceContext && inferenceContext.inferredTypeParameters);
64376
+ checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, ts.isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters);
64340
64377
  if (getNonArrayRestType(candidate) && !hasCorrectArity(node, args, checkCandidate, signatureHelpTrailingComma)) {
64341
64378
  candidateForArgumentArityError = checkCandidate;
64342
64379
  continue;
@@ -72352,7 +72389,9 @@ var ts;
72352
72389
  error(exportedName, ts.Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, ts.idText(exportedName));
72353
72390
  }
72354
72391
  else {
72355
- markExportAsReferenced(node);
72392
+ if (!node.isTypeOnly && !node.parent.parent.isTypeOnly) {
72393
+ markExportAsReferenced(node);
72394
+ }
72356
72395
  var target = symbol && (symbol.flags & 2097152 ? resolveAlias(symbol) : symbol);
72357
72396
  if (!target || target === unknownSymbol || target.flags & 111551) {
72358
72397
  checkExpressionCached(node.propertyName || node.name);
@@ -75409,9 +75448,6 @@ var ts;
75409
75448
  else {
75410
75449
  return grammarErrorOnNode(initializer, ts.Diagnostics.Initializers_are_not_allowed_in_ambient_contexts);
75411
75450
  }
75412
- if (!isConstOrReadonly || isInvalidInitializer) {
75413
- return grammarErrorOnNode(initializer, ts.Diagnostics.Initializers_are_not_allowed_in_ambient_contexts);
75414
- }
75415
75451
  }
75416
75452
  }
75417
75453
  function checkGrammarVariableDeclaration(node) {
@@ -91571,7 +91607,7 @@ var ts;
91571
91607
  if (!sourceFileOrBundle || emitOnlyDtsFiles || !jsFilePath) {
91572
91608
  return;
91573
91609
  }
91574
- if ((jsFilePath && host.isEmitBlocked(jsFilePath)) || compilerOptions.noEmit) {
91610
+ if (host.isEmitBlocked(jsFilePath) || compilerOptions.noEmit) {
91575
91611
  emitSkipped = true;
91576
91612
  return;
91577
91613
  }
@@ -103337,7 +103373,6 @@ var ts;
103337
103373
  var parsedConfigs;
103338
103374
  var sharedExtendedConfigFileWatchers;
103339
103375
  var extendedConfigCache = host.extendedConfigCache;
103340
- var changesAffectResolution = false;
103341
103376
  var reportFileChangeDetectedOnCreateProgram = false;
103342
103377
  var sourceFilesCache = new ts.Map();
103343
103378
  var missingFilePathsRequestedForRelease;
@@ -103482,11 +103517,11 @@ var ts;
103482
103517
  var program = getCurrentBuilderProgram();
103483
103518
  if (hasChangedCompilerOptions) {
103484
103519
  newLine = updateNewLine();
103485
- if (program && (changesAffectResolution || ts.changesAffectModuleResolution(program.getCompilerOptions(), compilerOptions))) {
103520
+ if (program && ts.changesAffectModuleResolution(program.getCompilerOptions(), compilerOptions)) {
103486
103521
  resolutionCache.clear();
103487
103522
  }
103488
103523
  }
103489
- var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution || changesAffectResolution);
103524
+ var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution);
103490
103525
  if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, fileExists, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
103491
103526
  if (hasChangedConfigFileParsingErrors) {
103492
103527
  if (reportFileChangeDetectedOnCreateProgram) {
@@ -103502,7 +103537,6 @@ var ts;
103502
103537
  }
103503
103538
  createNewProgram(hasInvalidatedResolution);
103504
103539
  }
103505
- changesAffectResolution = false;
103506
103540
  reportFileChangeDetectedOnCreateProgram = false;
103507
103541
  if (host.afterProgramCreate && program !== builderProgram) {
103508
103542
  host.afterProgramCreate(builderProgram);
@@ -104780,7 +104814,7 @@ var ts;
104780
104814
  }
104781
104815
  function afterProgramDone(state, program, config) {
104782
104816
  if (program) {
104783
- if (program && state.write)
104817
+ if (state.write)
104784
104818
  ts.listFiles(program, state.write);
104785
104819
  if (state.host.afterProgramEmitAndDiagnostics) {
104786
104820
  state.host.afterProgramEmitAndDiagnostics(program);
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.20220705";
112
+ ts.version = ts.versionMajorMinor + ".0-dev.20220706";
113
113
  /* @internal */
114
114
  var Comparison;
115
115
  (function (Comparison) {
@@ -4746,6 +4746,7 @@ var ts;
4746
4746
  NodeBuilderFlags[NodeBuilderFlags["UseAliasDefinedOutsideCurrentScope"] = 16384] = "UseAliasDefinedOutsideCurrentScope";
4747
4747
  NodeBuilderFlags[NodeBuilderFlags["UseSingleQuotesForStringLiteralType"] = 268435456] = "UseSingleQuotesForStringLiteralType";
4748
4748
  NodeBuilderFlags[NodeBuilderFlags["NoTypeReduction"] = 536870912] = "NoTypeReduction";
4749
+ NodeBuilderFlags[NodeBuilderFlags["OmitThisParameter"] = 33554432] = "OmitThisParameter";
4749
4750
  // Error handling
4750
4751
  NodeBuilderFlags[NodeBuilderFlags["AllowThisInObjectLiteral"] = 32768] = "AllowThisInObjectLiteral";
4751
4752
  NodeBuilderFlags[NodeBuilderFlags["AllowQualifiedNameInPlaceOfIdentifier"] = 65536] = "AllowQualifiedNameInPlaceOfIdentifier";
@@ -4786,6 +4787,7 @@ var ts;
4786
4787
  TypeFormatFlags[TypeFormatFlags["UseAliasDefinedOutsideCurrentScope"] = 16384] = "UseAliasDefinedOutsideCurrentScope";
4787
4788
  TypeFormatFlags[TypeFormatFlags["UseSingleQuotesForStringLiteralType"] = 268435456] = "UseSingleQuotesForStringLiteralType";
4788
4789
  TypeFormatFlags[TypeFormatFlags["NoTypeReduction"] = 536870912] = "NoTypeReduction";
4790
+ TypeFormatFlags[TypeFormatFlags["OmitThisParameter"] = 33554432] = "OmitThisParameter";
4789
4791
  // Error Handling
4790
4792
  TypeFormatFlags[TypeFormatFlags["AllowUniqueESSymbolType"] = 1048576] = "AllowUniqueESSymbolType";
4791
4793
  // TypeFormatFlags exclusive
@@ -4797,7 +4799,7 @@ var ts;
4797
4799
  TypeFormatFlags[TypeFormatFlags["InFirstTypeArgument"] = 4194304] = "InFirstTypeArgument";
4798
4800
  TypeFormatFlags[TypeFormatFlags["InTypeAlias"] = 8388608] = "InTypeAlias";
4799
4801
  /** @deprecated */ TypeFormatFlags[TypeFormatFlags["WriteOwnNameForAnyLike"] = 0] = "WriteOwnNameForAnyLike";
4800
- TypeFormatFlags[TypeFormatFlags["NodeBuilderFlagsMask"] = 814775659] = "NodeBuilderFlagsMask";
4802
+ TypeFormatFlags[TypeFormatFlags["NodeBuilderFlagsMask"] = 848330091] = "NodeBuilderFlagsMask";
4801
4803
  })(TypeFormatFlags = ts.TypeFormatFlags || (ts.TypeFormatFlags = {}));
4802
4804
  var SymbolFormatFlags;
4803
4805
  (function (SymbolFormatFlags) {
@@ -49108,6 +49110,7 @@ var ts;
49108
49110
  var stringMappingTypes = new ts.Map();
49109
49111
  var substitutionTypes = new ts.Map();
49110
49112
  var subtypeReductionCache = new ts.Map();
49113
+ var cachedTypes = new ts.Map();
49111
49114
  var evolvingArrayTypes = [];
49112
49115
  var undefinedProperties = new ts.Map();
49113
49116
  var markerTypes = new ts.Set();
@@ -49361,6 +49364,14 @@ var ts;
49361
49364
  ];
49362
49365
  initializeTypeChecker();
49363
49366
  return checker;
49367
+ function getCachedType(key) {
49368
+ return key ? cachedTypes.get(key) : undefined;
49369
+ }
49370
+ function setCachedType(key, type) {
49371
+ if (key)
49372
+ cachedTypes.set(key, type);
49373
+ return type;
49374
+ }
49364
49375
  function getJsxNamespace(location) {
49365
49376
  if (location) {
49366
49377
  var file = ts.getSourceFileOfNode(location);
@@ -52755,7 +52766,7 @@ var ts;
52755
52766
  }
52756
52767
  function toNodeBuilderFlags(flags) {
52757
52768
  if (flags === void 0) { flags = 0 /* None */; }
52758
- return flags & 814775659 /* NodeBuilderFlagsMask */;
52769
+ return flags & 848330091 /* NodeBuilderFlagsMask */;
52759
52770
  }
52760
52771
  function isClassInstanceSide(type) {
52761
52772
  return !!type.symbol && !!(type.symbol.flags & 32 /* Class */) && (type === getDeclaredTypeOfClassOrInterface(type.symbol) || (!!(type.flags & 524288 /* Object */) && !!(ts.getObjectFlags(type) & 16777216 /* IsClassInstanceClone */)));
@@ -53734,7 +53745,7 @@ var ts;
53734
53745
  var expandedParams = getExpandedParameters(signature, /*skipUnionExpanding*/ true)[0];
53735
53746
  // If the expanded parameter list had a variadic in a non-trailing position, don't expand it
53736
53747
  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);
53748
+ var thisParameter = context.flags & 33554432 /* OmitThisParameter */ ? undefined : tryGetThisParameterDeclaration(signature, context);
53738
53749
  if (thisParameter) {
53739
53750
  parameters.unshift(thisParameter);
53740
53751
  }
@@ -54793,12 +54804,11 @@ var ts;
54793
54804
  if (skipMembershipCheck || (!!ts.length(symbol.declarations) && ts.some(symbol.declarations, function (d) { return !!ts.findAncestor(d, function (n) { return n === enclosingDeclaration; }); }))) {
54794
54805
  var oldContext = context;
54795
54806
  context = cloneNodeBuilderContext(context);
54796
- var result = serializeSymbolWorker(symbol, isPrivate, propertyAsAlias);
54807
+ serializeSymbolWorker(symbol, isPrivate, propertyAsAlias);
54797
54808
  if (context.reportedDiagnostic) {
54798
54809
  oldcontext.reportedDiagnostic = context.reportedDiagnostic; // hoist diagnostic result into outer context
54799
54810
  }
54800
54811
  context = oldContext;
54801
- return result;
54802
54812
  }
54803
54813
  }
54804
54814
  // 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 +57865,7 @@ var ts;
57855
57865
  error(declaration.typeExpression.type, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
57856
57866
  }
57857
57867
  else {
57858
- error(ts.isNamedDeclaration(declaration) ? declaration.name : declaration || declaration, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
57868
+ error(ts.isNamedDeclaration(declaration) ? declaration.name || declaration : declaration, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
57859
57869
  }
57860
57870
  }
57861
57871
  links.declaredType = type;
@@ -68038,9 +68048,14 @@ var ts;
68038
68048
  type.flags & 256 /* NumberLiteral */ ? numberType :
68039
68049
  type.flags & 2048 /* BigIntLiteral */ ? bigintType :
68040
68050
  type.flags & 512 /* BooleanLiteral */ ? booleanType :
68041
- type.flags & 1048576 /* Union */ ? mapType(type, getBaseTypeOfLiteralType) :
68051
+ type.flags & 1048576 /* Union */ ? getBaseTypeOfLiteralTypeUnion(type) :
68042
68052
  type;
68043
68053
  }
68054
+ function getBaseTypeOfLiteralTypeUnion(type) {
68055
+ var _a;
68056
+ var key = "B" + getTypeId(type);
68057
+ return (_a = getCachedType(key)) !== null && _a !== void 0 ? _a : setCachedType(key, mapType(type, getBaseTypeOfLiteralType));
68058
+ }
68044
68059
  function getWidenedLiteralType(type) {
68045
68060
  return type.flags & 1024 /* EnumLiteral */ && isFreshLiteralType(type) ? getBaseTypeOfEnumLiteralType(type) :
68046
68061
  type.flags & 128 /* StringLiteral */ && isFreshLiteralType(type) ? stringType :
@@ -70183,23 +70198,25 @@ var ts;
70183
70198
  // For example, when a variable of type number | string | boolean is assigned a value of type number | boolean,
70184
70199
  // we remove type string.
70185
70200
  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
- }
70201
+ var _a;
70202
+ if (declaredType === assignedType) {
70203
+ return declaredType;
70201
70204
  }
70202
- return declaredType;
70205
+ if (assignedType.flags & 131072 /* Never */) {
70206
+ return assignedType;
70207
+ }
70208
+ var key = "A" + getTypeId(declaredType) + "," + getTypeId(assignedType);
70209
+ return (_a = getCachedType(key)) !== null && _a !== void 0 ? _a : setCachedType(key, getAssignmentReducedTypeWorker(declaredType, assignedType));
70210
+ }
70211
+ function getAssignmentReducedTypeWorker(declaredType, assignedType) {
70212
+ var filteredType = filterType(declaredType, function (t) { return typeMaybeAssignableTo(assignedType, t); });
70213
+ // Ensure that we narrow to fresh types if the assignment is a fresh boolean literal type.
70214
+ var reducedType = assignedType.flags & 512 /* BooleanLiteral */ && isFreshLiteralType(assignedType) ? mapType(filteredType, getFreshTypeOfLiteralType) : filteredType;
70215
+ // Our crude heuristic produces an invalid result in some cases: see GH#26130.
70216
+ // For now, when that happens, we give up and don't narrow at all. (This also
70217
+ // means we'll never narrow for erroneous assignments where the assigned type
70218
+ // is not assignable to the declared type.)
70219
+ return isTypeAssignableTo(assignedType, reducedType) ? reducedType : declaredType;
70203
70220
  }
70204
70221
  function isFunctionObjectType(type) {
70205
70222
  // We do a quick check for a "bind" property before performing the more expensive subtype
@@ -71605,7 +71622,7 @@ var ts;
71605
71622
  var targetType = ts.hasStaticModifier(ts.Debug.checkDefined(symbol.valueDeclaration, "should always have a declaration"))
71606
71623
  ? getTypeOfSymbol(classSymbol)
71607
71624
  : getDeclaredTypeOfSymbol(classSymbol);
71608
- return getNarrowedType(type, targetType, assumeTrue, isTypeDerivedFrom);
71625
+ return getNarrowedType(type, targetType, assumeTrue, /*checkDerived*/ true);
71609
71626
  }
71610
71627
  function narrowTypeByOptionalChainContainment(type, operator, value, assumeTrue) {
71611
71628
  // We are in a branch of obj?.foo === value (or any one of the other equality operators). We narrow obj as follows:
@@ -71856,9 +71873,15 @@ var ts;
71856
71873
  if (!nonConstructorTypeInUnion)
71857
71874
  return type;
71858
71875
  }
71859
- return getNarrowedType(type, targetType, assumeTrue, isTypeDerivedFrom);
71876
+ return getNarrowedType(type, targetType, assumeTrue, /*checkDerived*/ true);
71877
+ }
71878
+ function getNarrowedType(type, candidate, assumeTrue, checkDerived) {
71879
+ var _a;
71880
+ var key = type.flags & 1048576 /* Union */ ? "N" + getTypeId(type) + "," + getTypeId(candidate) + "," + ((assumeTrue ? 1 : 0) | (checkDerived ? 2 : 0)) : undefined;
71881
+ return (_a = getCachedType(key)) !== null && _a !== void 0 ? _a : setCachedType(key, getNarrowedTypeWorker(type, candidate, assumeTrue, checkDerived));
71860
71882
  }
71861
- function getNarrowedType(type, candidate, assumeTrue, isRelated) {
71883
+ function getNarrowedTypeWorker(type, candidate, assumeTrue, checkDerived) {
71884
+ var isRelated = checkDerived ? isTypeDerivedFrom : isTypeSubtypeOf;
71862
71885
  if (!assumeTrue) {
71863
71886
  return filterType(type, function (t) { return !isRelated(t, candidate); });
71864
71887
  }
@@ -71906,7 +71929,7 @@ var ts;
71906
71929
  var predicateArgument = getTypePredicateArgument(predicate, callExpression);
71907
71930
  if (predicateArgument) {
71908
71931
  if (isMatchingReference(reference, predicateArgument)) {
71909
- return getNarrowedType(type, predicate.type, assumeTrue, isTypeSubtypeOf);
71932
+ return getNarrowedType(type, predicate.type, assumeTrue, /*checkDerived*/ false);
71910
71933
  }
71911
71934
  if (strictNullChecks && assumeTrue && optionalChainContainsReference(predicateArgument, reference) &&
71912
71935
  !(getTypeFacts(predicate.type) & 65536 /* EQUndefined */)) {
@@ -71914,7 +71937,7 @@ var ts;
71914
71937
  }
71915
71938
  var access = getDiscriminantPropertyAccess(predicateArgument, type);
71916
71939
  if (access) {
71917
- return narrowTypeByDiscriminant(type, access, function (t) { return getNarrowedType(t, predicate.type, assumeTrue, isTypeSubtypeOf); });
71940
+ return narrowTypeByDiscriminant(type, access, function (t) { return getNarrowedType(t, predicate.type, assumeTrue, /*checkDerived*/ false); });
71918
71941
  }
71919
71942
  }
71920
71943
  }
@@ -72253,9 +72276,7 @@ var ts;
72253
72276
  getNodeLinks(container).flags |= 8192 /* CaptureArguments */;
72254
72277
  return getTypeOfSymbol(symbol);
72255
72278
  }
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)) {
72279
+ if (shouldMarkIdentifierAliasReferenced(node)) {
72259
72280
  markAliasReferenced(symbol, node);
72260
72281
  }
72261
72282
  var localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol);
@@ -72389,6 +72410,25 @@ var ts;
72389
72410
  }
72390
72411
  return assignmentKind ? getBaseTypeOfLiteralType(flowType) : flowType;
72391
72412
  }
72413
+ function shouldMarkIdentifierAliasReferenced(node) {
72414
+ var _a;
72415
+ var parent = node.parent;
72416
+ if (parent) {
72417
+ // A property access expression LHS? checkPropertyAccessExpression will handle that.
72418
+ if (ts.isPropertyAccessExpression(parent) && parent.expression === node) {
72419
+ return false;
72420
+ }
72421
+ // Next two check for an identifier inside a type only export.
72422
+ if (ts.isExportSpecifier(parent) && parent.isTypeOnly) {
72423
+ return false;
72424
+ }
72425
+ var greatGrandparent = (_a = parent.parent) === null || _a === void 0 ? void 0 : _a.parent;
72426
+ if (greatGrandparent && ts.isExportDeclaration(greatGrandparent) && greatGrandparent.isTypeOnly) {
72427
+ return false;
72428
+ }
72429
+ }
72430
+ return true;
72431
+ }
72392
72432
  function isInsideFunctionOrInstancePropertyInitializer(node, threshold) {
72393
72433
  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
72434
  }
@@ -76926,7 +76966,7 @@ var ts;
76926
76966
  argCheckMode = checkMode & 32 /* IsForStringLiteralArgumentCompletions */;
76927
76967
  if (inferenceContext) {
76928
76968
  var typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
76929
- checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, ts.isInJSFile(candidate.declaration), inferenceContext && inferenceContext.inferredTypeParameters);
76969
+ checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, ts.isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters);
76930
76970
  // If the original signature has a generic rest type, instantiation may produce a
76931
76971
  // signature with different arity and we need to perform another arity check.
76932
76972
  if (getNonArrayRestType(candidate) && !hasCorrectArity(node, args, checkCandidate, signatureHelpTrailingComma)) {
@@ -86198,7 +86238,9 @@ var ts;
86198
86238
  error(exportedName, ts.Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, ts.idText(exportedName));
86199
86239
  }
86200
86240
  else {
86201
- markExportAsReferenced(node);
86241
+ if (!node.isTypeOnly && !node.parent.parent.isTypeOnly) {
86242
+ markExportAsReferenced(node);
86243
+ }
86202
86244
  var target = symbol && (symbol.flags & 2097152 /* Alias */ ? resolveAlias(symbol) : symbol);
86203
86245
  if (!target || target === unknownSymbol || target.flags & 111551 /* Value */) {
86204
86246
  checkExpressionCached(node.propertyName || node.name);
@@ -89559,9 +89601,6 @@ var ts;
89559
89601
  else {
89560
89602
  return grammarErrorOnNode(initializer, ts.Diagnostics.Initializers_are_not_allowed_in_ambient_contexts);
89561
89603
  }
89562
- if (!isConstOrReadonly || isInvalidInitializer) {
89563
- return grammarErrorOnNode(initializer, ts.Diagnostics.Initializers_are_not_allowed_in_ambient_contexts);
89564
- }
89565
89604
  }
89566
89605
  }
89567
89606
  function checkGrammarVariableDeclaration(node) {
@@ -111346,7 +111385,7 @@ var ts;
111346
111385
  return;
111347
111386
  }
111348
111387
  // 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) {
111388
+ if (host.isEmitBlocked(jsFilePath) || compilerOptions.noEmit) {
111350
111389
  emitSkipped = true;
111351
111390
  return;
111352
111391
  }
@@ -124608,7 +124647,6 @@ var ts;
124608
124647
  var parsedConfigs; // Parsed commandline and watching cached for referenced projects
124609
124648
  var sharedExtendedConfigFileWatchers; // Map of file watchers for extended files, shared between different referenced projects
124610
124649
  var extendedConfigCache = host.extendedConfigCache; // Cache for extended config evaluation
124611
- var changesAffectResolution = false; // Flag for indicating non-config changes affect module resolution
124612
124650
  var reportFileChangeDetectedOnCreateProgram = false; // True if synchronizeProgram should report "File change detected..." when a new program is created
124613
124651
  var sourceFilesCache = new ts.Map(); // Cache that stores the source file and version info
124614
124652
  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 +124799,12 @@ var ts;
124761
124799
  var program = getCurrentBuilderProgram();
124762
124800
  if (hasChangedCompilerOptions) {
124763
124801
  newLine = updateNewLine();
124764
- if (program && (changesAffectResolution || ts.changesAffectModuleResolution(program.getCompilerOptions(), compilerOptions))) {
124802
+ if (program && ts.changesAffectModuleResolution(program.getCompilerOptions(), compilerOptions)) {
124765
124803
  resolutionCache.clear();
124766
124804
  }
124767
124805
  }
124768
124806
  // All resolutions are invalid if user provided resolutions
124769
- var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution || changesAffectResolution);
124807
+ var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution);
124770
124808
  if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, fileExists, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
124771
124809
  if (hasChangedConfigFileParsingErrors) {
124772
124810
  if (reportFileChangeDetectedOnCreateProgram) {
@@ -124782,7 +124820,6 @@ var ts;
124782
124820
  }
124783
124821
  createNewProgram(hasInvalidatedResolution);
124784
124822
  }
124785
- changesAffectResolution = false; // reset for next sync
124786
124823
  reportFileChangeDetectedOnCreateProgram = false;
124787
124824
  if (host.afterProgramCreate && program !== builderProgram) {
124788
124825
  host.afterProgramCreate(builderProgram);
@@ -126163,7 +126200,7 @@ var ts;
126163
126200
  }
126164
126201
  function afterProgramDone(state, program, config) {
126165
126202
  if (program) {
126166
- if (program && state.write)
126203
+ if (state.write)
126167
126204
  ts.listFiles(program, state.write);
126168
126205
  if (state.host.afterProgramEmitAndDiagnostics) {
126169
126206
  state.host.afterProgramEmitAndDiagnostics(program);
@@ -133932,7 +133969,7 @@ var ts;
133932
133969
  var name = ts.getSynthesizedDeepClone(ts.getNameOfDeclaration(declaration), /*includeTrivia*/ false);
133933
133970
  var type = checker.getWidenedType(checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration));
133934
133971
  var quotePreference = ts.getQuotePreference(sourceFile, preferences);
133935
- var builderFlags = quotePreference === 0 /* Single */ ? 268435456 /* UseSingleQuotesForStringLiteralType */ : undefined;
133972
+ var builderFlags = 33554432 /* OmitThisParameter */ | (quotePreference === 0 /* Single */ ? 268435456 /* UseSingleQuotesForStringLiteralType */ : 0 /* None */);
133936
133973
  switch (declaration.kind) {
133937
133974
  case 166 /* PropertySignature */:
133938
133975
  case 167 /* PropertyDeclaration */:
@@ -2420,6 +2420,7 @@ declare namespace ts {
2420
2420
  UseAliasDefinedOutsideCurrentScope = 16384,
2421
2421
  UseSingleQuotesForStringLiteralType = 268435456,
2422
2422
  NoTypeReduction = 536870912,
2423
+ OmitThisParameter = 33554432,
2423
2424
  AllowThisInObjectLiteral = 32768,
2424
2425
  AllowQualifiedNameInPlaceOfIdentifier = 65536,
2425
2426
  /** @deprecated AllowQualifedNameInPlaceOfIdentifier. Use AllowQualifiedNameInPlaceOfIdentifier instead. */
@@ -2450,6 +2451,7 @@ declare namespace ts {
2450
2451
  UseAliasDefinedOutsideCurrentScope = 16384,
2451
2452
  UseSingleQuotesForStringLiteralType = 268435456,
2452
2453
  NoTypeReduction = 536870912,
2454
+ OmitThisParameter = 33554432,
2453
2455
  AllowUniqueESSymbolType = 1048576,
2454
2456
  AddUndefined = 131072,
2455
2457
  WriteArrowStyleSignature = 262144,
@@ -2458,7 +2460,7 @@ declare namespace ts {
2458
2460
  InFirstTypeArgument = 4194304,
2459
2461
  InTypeAlias = 8388608,
2460
2462
  /** @deprecated */ WriteOwnNameForAnyLike = 0,
2461
- NodeBuilderFlagsMask = 814775659
2463
+ NodeBuilderFlagsMask = 848330091
2462
2464
  }
2463
2465
  export enum SymbolFormatFlags {
2464
2466
  None = 0,