typescript 5.0.0-dev.20230111 → 5.0.0-dev.20230112

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.
@@ -42,7 +42,7 @@ var ts = (() => {
42
42
  "src/compiler/corePublic.ts"() {
43
43
  "use strict";
44
44
  versionMajorMinor = "5.0";
45
- version = `${versionMajorMinor}.0-dev.20230111`;
45
+ version = `${versionMajorMinor}.0-dev.20230112`;
46
46
  Comparison = /* @__PURE__ */ ((Comparison3) => {
47
47
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
48
48
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -9527,7 +9527,8 @@ ${lanes.join("\n")}
9527
9527
  return ch >= 65 /* A */ && ch <= 90 /* Z */ || ch >= 97 /* a */ && ch <= 122 /* z */ || ch === 36 /* $ */ || ch === 95 /* _ */ || ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierStart(ch, languageVersion);
9528
9528
  }
9529
9529
  function isIdentifierPart(ch, languageVersion, identifierVariant) {
9530
- return ch >= 65 /* A */ && ch <= 90 /* Z */ || ch >= 97 /* a */ && ch <= 122 /* z */ || ch >= 48 /* _0 */ && ch <= 57 /* _9 */ || ch === 36 /* $ */ || ch === 95 /* _ */ || (identifierVariant === 1 /* JSX */ ? ch === 45 /* minus */ || ch === 58 /* colon */ : false) || ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierPart(ch, languageVersion);
9530
+ return ch >= 65 /* A */ && ch <= 90 /* Z */ || ch >= 97 /* a */ && ch <= 122 /* z */ || ch >= 48 /* _0 */ && ch <= 57 /* _9 */ || ch === 36 /* $ */ || ch === 95 /* _ */ || // "-" and ":" are valid in JSX Identifiers
9531
+ (identifierVariant === 1 /* JSX */ ? ch === 45 /* minus */ || ch === 58 /* colon */ : false) || ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierPart(ch, languageVersion);
9531
9532
  }
9532
9533
  function isIdentifierText(name, languageVersion, identifierVariant) {
9533
9534
  let ch = codePointAt(name, 0);
@@ -34991,7 +34992,8 @@ ${lanes.join("\n")}
34991
34992
  if (returnValue) {
34992
34993
  result[keyText] = value;
34993
34994
  }
34994
- if (jsonConversionNotifier && (parentOption || isRootOptionMap(knownOptions))) {
34995
+ if (jsonConversionNotifier && // Current callbacks are only on known parent option or if we are setting values in the root
34996
+ (parentOption || isRootOptionMap(knownOptions))) {
34995
34997
  const isValidOptionValue = isCompilerOptionsValue(option, value);
34996
34998
  if (parentOption) {
34997
34999
  if (isValidOptionValue) {
@@ -42967,8 +42969,12 @@ ${lanes.join("\n")}
42967
42969
  return false;
42968
42970
  }
42969
42971
  if (currentFlow === unreachableFlow) {
42970
- const reportError = isStatementButNotDeclaration(node) && node.kind !== 239 /* EmptyStatement */ || // report error on class declarations
42971
- node.kind === 260 /* ClassDeclaration */ || node.kind === 264 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node);
42972
+ const reportError = (
42973
+ // report error on all statements except empty ones
42974
+ isStatementButNotDeclaration(node) && node.kind !== 239 /* EmptyStatement */ || // report error on class declarations
42975
+ node.kind === 260 /* ClassDeclaration */ || // report error on instantiated modules or const-enums only modules if preserveConstEnums is set
42976
+ node.kind === 264 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)
42977
+ );
42972
42978
  if (reportError) {
42973
42979
  currentFlow = reportedUnreachableFlow;
42974
42980
  if (!options.allowUnreachableCode) {
@@ -48731,7 +48737,8 @@ ${lanes.join("\n")}
48731
48737
  const isNonLocalFunctionSymbol = !!(symbol.flags & 16 /* Function */) && (symbol.parent || // is exported function symbol
48732
48738
  forEach(symbol.declarations, (declaration) => declaration.parent.kind === 308 /* SourceFile */ || declaration.parent.kind === 265 /* ModuleBlock */));
48733
48739
  if (isStaticMethodSymbol || isNonLocalFunctionSymbol) {
48734
- return (!!(context.flags & 4096 /* UseTypeOfFunction */) || ((_a4 = context.visitedTypes) == null ? void 0 : _a4.has(typeId))) && (!(context.flags & 8 /* UseStructuralFallback */) || isValueSymbolAccessible(symbol, context.enclosingDeclaration));
48740
+ return (!!(context.flags & 4096 /* UseTypeOfFunction */) || ((_a4 = context.visitedTypes) == null ? void 0 : _a4.has(typeId))) && // it is type of the symbol uses itself recursively
48741
+ (!(context.flags & 8 /* UseStructuralFallback */) || isValueSymbolAccessible(symbol, context.enclosingDeclaration));
48735
48742
  }
48736
48743
  }
48737
48744
  }
@@ -48823,7 +48830,9 @@ ${lanes.join("\n")}
48823
48830
  const abstractSignatures = filter(resolved.constructSignatures, (signature) => !!(signature.flags & 4 /* Abstract */));
48824
48831
  if (some(abstractSignatures)) {
48825
48832
  const types = map(abstractSignatures, getOrCreateTypeFromSignature);
48826
- const typeElementCount = resolved.callSignatures.length + (resolved.constructSignatures.length - abstractSignatures.length) + resolved.indexInfos.length + (context.flags & 2048 /* WriteClassExpressionAsTypeLiteral */ ? countWhere(resolved.properties, (p) => !(p.flags & 4194304 /* Prototype */)) : length(resolved.properties));
48833
+ const typeElementCount = resolved.callSignatures.length + (resolved.constructSignatures.length - abstractSignatures.length) + resolved.indexInfos.length + // exclude `prototype` when writing a class expression as a type literal, as per
48834
+ // the logic in `createTypeNodesFromResolvedType`.
48835
+ (context.flags & 2048 /* WriteClassExpressionAsTypeLiteral */ ? countWhere(resolved.properties, (p) => !(p.flags & 4194304 /* Prototype */)) : length(resolved.properties));
48827
48836
  if (typeElementCount) {
48828
48837
  types.push(getResolvedTypeWithoutAbstractConstructSignatures(resolved));
48829
48838
  }
@@ -49485,9 +49494,11 @@ ${lanes.join("\n")}
49485
49494
  if (accessibleSymbolChain) {
49486
49495
  return accessibleSymbolChain;
49487
49496
  }
49488
- if (// If this is the last part of outputting the symbol, always output. The cases apply only to parent symbols.
49489
- endOfChain || // If a parent symbol is an anonymous type, don't write it.
49490
- !(symbol2.flags & (2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */))) {
49497
+ if (
49498
+ // If this is the last part of outputting the symbol, always output. The cases apply only to parent symbols.
49499
+ endOfChain || // If a parent symbol is an anonymous type, don't write it.
49500
+ !(symbol2.flags & (2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */))
49501
+ ) {
49491
49502
  if (!endOfChain && !yieldModuleSymbol && !!forEach(symbol2.declarations, hasNonGlobalAugmentationExternalModuleSymbol)) {
49492
49503
  return;
49493
49504
  }
@@ -50109,7 +50120,8 @@ ${lanes.join("\n")}
50109
50120
  }
50110
50121
  if (isLiteralImportTypeNode(node)) {
50111
50122
  const nodeSymbol = getNodeLinks(node).resolvedSymbol;
50112
- if (isInJSDoc(node) && nodeSymbol && (!node.isTypeOf && !(nodeSymbol.flags & 788968 /* Type */) || // The import type had type arguments autofilled by js fallback logic
50123
+ if (isInJSDoc(node) && nodeSymbol && // The import type resolved using jsdoc fallback logic
50124
+ (!node.isTypeOf && !(nodeSymbol.flags & 788968 /* Type */) || // The import type had type arguments autofilled by js fallback logic
50113
50125
  !(length(node.typeArguments) >= getMinTypeArgumentCount(getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(nodeSymbol))))) {
50114
50126
  return setOriginalNode(typeToTypeNodeHelper(getTypeFromTypeNode(node), context), node);
50115
50127
  }
@@ -51626,8 +51638,10 @@ ${lanes.join("\n")}
51626
51638
  }
51627
51639
  }
51628
51640
  function getNameOfSymbolAsWritten(symbol, context) {
51629
- if (context && symbol.escapedName === "default" /* Default */ && !(context.flags & 16384 /* UseAliasDefinedOutsideCurrentScope */) && (!(context.flags & 16777216 /* InInitialEntityName */) || // if the symbol is synthesized, it will only be referenced externally it must print as `default`
51630
- !symbol.declarations || context.enclosingDeclaration && findAncestor(symbol.declarations[0], isDefaultBindingContext) !== findAncestor(context.enclosingDeclaration, isDefaultBindingContext))) {
51641
+ if (context && symbol.escapedName === "default" /* Default */ && !(context.flags & 16384 /* UseAliasDefinedOutsideCurrentScope */) && // If it's not the first part of an entity name, it must print as `default`
51642
+ (!(context.flags & 16777216 /* InInitialEntityName */) || // if the symbol is synthesized, it will only be referenced externally it must print as `default`
51643
+ !symbol.declarations || // if not in the same binding context (source file, module declaration), it must print as `default`
51644
+ context.enclosingDeclaration && findAncestor(symbol.declarations[0], isDefaultBindingContext) !== findAncestor(context.enclosingDeclaration, isDefaultBindingContext))) {
51631
51645
  return "default";
51632
51646
  }
51633
51647
  if (symbol.declarations && symbol.declarations.length) {
@@ -52954,7 +52968,10 @@ ${lanes.join("\n")}
52954
52968
  function getWriteTypeOfSymbol(symbol) {
52955
52969
  const checkFlags = getCheckFlags(symbol);
52956
52970
  if (symbol.flags & 4 /* Property */) {
52957
- return checkFlags & 2 /* SyntheticProperty */ ? checkFlags & 65536 /* DeferredType */ ? getWriteTypeOfSymbolWithDeferredType(symbol) || getTypeOfSymbolWithDeferredType(symbol) : symbol.links.writeType || symbol.links.type : getTypeOfSymbol(symbol);
52971
+ return checkFlags & 2 /* SyntheticProperty */ ? checkFlags & 65536 /* DeferredType */ ? getWriteTypeOfSymbolWithDeferredType(symbol) || getTypeOfSymbolWithDeferredType(symbol) : (
52972
+ // NOTE: cast to TransientSymbol should be safe because only TransientSymbols can have CheckFlags.SyntheticProperty
52973
+ symbol.links.writeType || symbol.links.type
52974
+ ) : getTypeOfSymbol(symbol);
52958
52975
  }
52959
52976
  if (symbol.flags & 98304 /* Accessor */) {
52960
52977
  return checkFlags & 1 /* Instantiated */ ? getWriteTypeOfInstantiatedSymbol(symbol) : getWriteTypeOfAccessors(symbol);
@@ -61371,7 +61388,11 @@ ${lanes.join("\n")}
61371
61388
  if (variances === emptyArray) {
61372
61389
  return 1 /* Unknown */;
61373
61390
  }
61374
- const varianceResult = relateVariances(source2.aliasTypeArguments, target2.aliasTypeArguments, variances, intersectionState);
61391
+ const params = getSymbolLinks(source2.aliasSymbol).typeParameters;
61392
+ const minParams = getMinTypeArgumentCount(params);
61393
+ const sourceTypes = fillMissingTypeArguments(source2.aliasTypeArguments, params, minParams, isInJSFile(source2.aliasSymbol.valueDeclaration));
61394
+ const targetTypes = fillMissingTypeArguments(target2.aliasTypeArguments, params, minParams, isInJSFile(source2.aliasSymbol.valueDeclaration));
61395
+ const varianceResult = relateVariances(sourceTypes, targetTypes, variances, intersectionState);
61375
61396
  if (varianceResult !== void 0) {
61376
61397
  return varianceResult;
61377
61398
  }
@@ -63828,7 +63849,11 @@ ${lanes.join("\n")}
63828
63849
  }
63829
63850
  if (source.aliasSymbol && source.aliasSymbol === target.aliasSymbol) {
63830
63851
  if (source.aliasTypeArguments) {
63831
- inferFromTypeArguments(source.aliasTypeArguments, target.aliasTypeArguments, getAliasVariances(source.aliasSymbol));
63852
+ const params = getSymbolLinks(source.aliasSymbol).typeParameters;
63853
+ const minParams = getMinTypeArgumentCount(params);
63854
+ const sourceTypes = fillMissingTypeArguments(source.aliasTypeArguments, params, minParams, isInJSFile(source.aliasSymbol.valueDeclaration));
63855
+ const targetTypes = fillMissingTypeArguments(target.aliasTypeArguments, params, minParams, isInJSFile(source.aliasSymbol.valueDeclaration));
63856
+ inferFromTypeArguments(sourceTypes, targetTypes, getAliasVariances(source.aliasSymbol));
63832
63857
  }
63833
63858
  return;
63834
63859
  }
@@ -66235,18 +66260,20 @@ ${lanes.join("\n")}
66235
66260
  return narrowTypeByTypeFacts(type, nonPrimitiveType, 128 /* TypeofEQHostObject */);
66236
66261
  }
66237
66262
  function narrowTypeByTypeFacts(type, impliedType, facts) {
66238
- return mapType(type, (t) => // We first check if a constituent is a subtype of the implied type. If so, we either keep or eliminate
66239
- // the constituent based on its type facts. We use the strict subtype relation because it treats `object`
66240
- // as a subtype of `{}`, and we need the type facts check because function types are subtypes of `object`,
66241
- // but are classified as "function" according to `typeof`.
66242
- isTypeRelatedTo(t, impliedType, strictSubtypeRelation) ? getTypeFacts(t) & facts ? t : neverType : (
66243
- // We next check if the consituent is a supertype of the implied type. If so, we substitute the implied
66244
- // type. This handles top types like `unknown` and `{}`, and supertypes like `{ toString(): string }`.
66245
- isTypeSubtypeOf(impliedType, t) ? impliedType : (
66246
- // Neither the constituent nor the implied type is a subtype of the other, however their domains may still
66247
- // overlap. For example, an unconstrained type parameter and type `string`. If the type facts indicate
66248
- // possible overlap, we form an intersection. Otherwise, we eliminate the constituent.
66249
- getTypeFacts(t) & facts ? getIntersectionType([t, impliedType]) : neverType
66263
+ return mapType(type, (t) => (
66264
+ // We first check if a constituent is a subtype of the implied type. If so, we either keep or eliminate
66265
+ // the constituent based on its type facts. We use the strict subtype relation because it treats `object`
66266
+ // as a subtype of `{}`, and we need the type facts check because function types are subtypes of `object`,
66267
+ // but are classified as "function" according to `typeof`.
66268
+ isTypeRelatedTo(t, impliedType, strictSubtypeRelation) ? getTypeFacts(t) & facts ? t : neverType : (
66269
+ // We next check if the consituent is a supertype of the implied type. If so, we substitute the implied
66270
+ // type. This handles top types like `unknown` and `{}`, and supertypes like `{ toString(): string }`.
66271
+ isTypeSubtypeOf(impliedType, t) ? impliedType : (
66272
+ // Neither the constituent nor the implied type is a subtype of the other, however their domains may still
66273
+ // overlap. For example, an unconstrained type parameter and type `string`. If the type facts indicate
66274
+ // possible overlap, we form an intersection. Otherwise, we eliminate the constituent.
66275
+ getTypeFacts(t) & facts ? getIntersectionType([t, impliedType]) : neverType
66276
+ )
66250
66277
  )
66251
66278
  ));
66252
66279
  }
@@ -73817,7 +73844,8 @@ ${lanes.join("\n")}
73817
73844
  }
73818
73845
  }
73819
73846
  function isIndirectCall(node) {
73820
- return node.parent.kind === 214 /* ParenthesizedExpression */ && isNumericLiteral(node.left) && node.left.text === "0" && (isCallExpression(node.parent.parent) && node.parent.parent.expression === node.parent || node.parent.parent.kind === 212 /* TaggedTemplateExpression */) && (isAccessExpression(node.right) || isIdentifier(node.right) && node.right.escapedText === "eval");
73847
+ return node.parent.kind === 214 /* ParenthesizedExpression */ && isNumericLiteral(node.left) && node.left.text === "0" && (isCallExpression(node.parent.parent) && node.parent.parent.expression === node.parent || node.parent.parent.kind === 212 /* TaggedTemplateExpression */) && // special-case for "eval" because it's the only non-access case where an indirect call actually affects behavior.
73848
+ (isAccessExpression(node.right) || isIdentifier(node.right) && node.right.escapedText === "eval");
73821
73849
  }
73822
73850
  function checkForDisallowedESSymbolOperand(operator2) {
73823
73851
  const offendingSymbolOperand = maybeTypeOfKindConsideringBaseConstraint(leftType, 12288 /* ESSymbolLike */) ? left : maybeTypeOfKindConsideringBaseConstraint(rightType, 12288 /* ESSymbolLike */) ? right : void 0;
@@ -80902,7 +80930,12 @@ ${lanes.join("\n")}
80902
80930
  return false;
80903
80931
  const symbol = getSymbolOfDeclaration(node);
80904
80932
  const signaturesOfSymbol = getSignaturesOfSymbol(symbol);
80905
- return signaturesOfSymbol.length > 1 || signaturesOfSymbol.length === 1 && signaturesOfSymbol[0].declaration !== node;
80933
+ return signaturesOfSymbol.length > 1 || // If there is single signature for the symbol, it is overload if that signature isn't coming from the node
80934
+ // e.g.: function foo(a: string): string;
80935
+ // function foo(a: any) { // This is implementation of the overloads
80936
+ // return a;
80937
+ // }
80938
+ signaturesOfSymbol.length === 1 && signaturesOfSymbol[0].declaration !== node;
80906
80939
  }
80907
80940
  return false;
80908
80941
  }
@@ -111760,7 +111793,8 @@ ${lanes.join("\n")}
111760
111793
  const oldSourceFiles = oldProgram.getSourceFiles();
111761
111794
  for (const oldSourceFile of oldSourceFiles) {
111762
111795
  const newFile = getSourceFileByPath(oldSourceFile.resolvedPath);
111763
- if (shouldCreateNewSourceFile || !newFile || newFile.impliedNodeFormat !== oldSourceFile.impliedNodeFormat || oldSourceFile.resolvedPath === oldSourceFile.path && newFile.resolvedPath !== oldSourceFile.path) {
111796
+ if (shouldCreateNewSourceFile || !newFile || newFile.impliedNodeFormat !== oldSourceFile.impliedNodeFormat || // old file wasn't redirect but new file is
111797
+ oldSourceFile.resolvedPath === oldSourceFile.path && newFile.resolvedPath !== oldSourceFile.path) {
111764
111798
  host.onReleaseOldSourceFile(oldSourceFile, oldProgram.getCompilerOptions(), !!getSourceFileByPath(oldSourceFile.path));
111765
111799
  }
111766
111800
  }
@@ -116646,7 +116680,8 @@ ${lanes.join("\n")}
116646
116680
  const name = loader.nameAndMode.getName(entry);
116647
116681
  const mode = loader.nameAndMode.getMode(entry, containingSourceFile);
116648
116682
  let resolution = resolutionsInFile.get(name, mode);
116649
- if (!seenNamesInFile.has(name, mode) && unmatchedRedirects || !resolution || resolution.isInvalidated || hasInvalidatedNonRelativeUnresolvedImport && !isExternalModuleNameRelative(name) && shouldRetryResolution(resolution)) {
116683
+ if (!seenNamesInFile.has(name, mode) && unmatchedRedirects || !resolution || resolution.isInvalidated || // If the name is unresolved import that was invalidated, recalculate
116684
+ hasInvalidatedNonRelativeUnresolvedImport && !isExternalModuleNameRelative(name) && shouldRetryResolution(resolution)) {
116650
116685
  const existingResolution = resolution;
116651
116686
  resolution = loader.resolve(name, mode);
116652
116687
  if (resolutionHost.onDiscoveredSymlink && resolutionIsSymlink(resolution)) {
@@ -122305,7 +122340,11 @@ ${lanes.join("\n")}
122305
122340
  return n;
122306
122341
  }
122307
122342
  return firstDefined(n.getChildren(sourceFile), (child) => {
122308
- const shouldDiveInChildNode = child.pos <= previousToken.pos && child.end > previousToken.end || child.pos === previousToken.end;
122343
+ const shouldDiveInChildNode = (
122344
+ // previous token is enclosed somewhere in the child
122345
+ child.pos <= previousToken.pos && child.end > previousToken.end || // previous token ends exactly at the beginning of child
122346
+ child.pos === previousToken.end
122347
+ );
122309
122348
  return shouldDiveInChildNode && nodeHasTokens(child, sourceFile) ? find2(child) : void 0;
122310
122349
  });
122311
122350
  }
@@ -135976,15 +136015,17 @@ ${lanes.join("\n")}
135976
136015
  return fixes[0];
135977
136016
  }
135978
136017
  return fixes.reduce(
135979
- (best, fix) => // Takes true branch of conditional if `fix` is better than `best`
135980
- compareModuleSpecifiers(
135981
- fix,
135982
- best,
135983
- sourceFile,
135984
- program,
135985
- packageJsonImportFilter.allowsImportingSpecifier,
135986
- (fileName) => toPath(fileName, host.getCurrentDirectory(), hostGetCanonicalFileName(host))
135987
- ) === -1 /* LessThan */ ? fix : best
136018
+ (best, fix) => (
136019
+ // Takes true branch of conditional if `fix` is better than `best`
136020
+ compareModuleSpecifiers(
136021
+ fix,
136022
+ best,
136023
+ sourceFile,
136024
+ program,
136025
+ packageJsonImportFilter.allowsImportingSpecifier,
136026
+ (fileName) => toPath(fileName, host.getCurrentDirectory(), hostGetCanonicalFileName(host))
136027
+ ) === -1 /* LessThan */ ? fix : best
136028
+ )
135988
136029
  );
135989
136030
  }
135990
136031
  function compareModuleSpecifiers(a, b, importingFile, program, allowsImportingSpecifier, toPath3) {
@@ -145480,7 +145521,10 @@ ${lanes.join("\n")}
145480
145521
  return containingNodeKind === 257 /* VariableDeclaration */ || isVariableDeclarationListButNotTypeArgument(contextToken2) || containingNodeKind === 240 /* VariableStatement */ || containingNodeKind === 263 /* EnumDeclaration */ || // enum a { foo, |
145481
145522
  isFunctionLikeButNotConstructor(containingNodeKind) || containingNodeKind === 261 /* InterfaceDeclaration */ || // interface A<T, |
145482
145523
  containingNodeKind === 204 /* ArrayBindingPattern */ || // var [x, y|
145483
- containingNodeKind === 262 /* TypeAliasDeclaration */ || isClassLike(parent2) && !!parent2.typeParameters && parent2.typeParameters.end >= contextToken2.pos;
145524
+ containingNodeKind === 262 /* TypeAliasDeclaration */ || // type Map, K, |
145525
+ // class A<T, |
145526
+ // var C = class D<T, |
145527
+ isClassLike(parent2) && !!parent2.typeParameters && parent2.typeParameters.end >= contextToken2.pos;
145484
145528
  case 24 /* DotToken */:
145485
145529
  return containingNodeKind === 204 /* ArrayBindingPattern */;
145486
145530
  case 58 /* ColonToken */:
@@ -147497,8 +147541,10 @@ ${lanes.join("\n")}
147497
147541
  return map2;
147498
147542
  }
147499
147543
  function forEachPossibleImportOrExportStatement(sourceFileLike, action) {
147500
- return forEach(sourceFileLike.kind === 308 /* SourceFile */ ? sourceFileLike.statements : sourceFileLike.body.statements, (statement) => // TODO: GH#18217
147501
- action(statement) || isAmbientModuleDeclaration(statement) && forEach(statement.body && statement.body.statements, action));
147544
+ return forEach(sourceFileLike.kind === 308 /* SourceFile */ ? sourceFileLike.statements : sourceFileLike.body.statements, (statement) => (
147545
+ // TODO: GH#18217
147546
+ action(statement) || isAmbientModuleDeclaration(statement) && forEach(statement.body && statement.body.statements, action)
147547
+ ));
147502
147548
  }
147503
147549
  function forEachImport(sourceFile, action) {
147504
147550
  if (sourceFile.externalModuleIndicator || sourceFile.imports !== void 0) {
@@ -147767,7 +147813,9 @@ ${lanes.join("\n")}
147767
147813
  return propertyName ? getContextNode(propertyName.parent) : void 0;
147768
147814
  }
147769
147815
  if (node.parent.name === node || // node is name of declaration, use parent
147770
- isConstructorDeclaration(node.parent) || isExportAssignment(node.parent) || (isImportOrExportSpecifier(node.parent) || isBindingElement(node.parent)) && node.parent.propertyName === node || node.kind === 88 /* DefaultKeyword */ && hasSyntacticModifier(node.parent, 1025 /* ExportDefault */)) {
147816
+ isConstructorDeclaration(node.parent) || isExportAssignment(node.parent) || // Property name of the import export specifier or binding pattern, use parent
147817
+ (isImportOrExportSpecifier(node.parent) || isBindingElement(node.parent)) && node.parent.propertyName === node || // Is default export
147818
+ node.kind === 88 /* DefaultKeyword */ && hasSyntacticModifier(node.parent, 1025 /* ExportDefault */)) {
147771
147819
  return getContextNode(node.parent);
147772
147820
  }
147773
147821
  return void 0;
@@ -147821,11 +147869,13 @@ ${lanes.join("\n")}
147821
147869
  const checker = program.getTypeChecker();
147822
147870
  const adjustedNode = Core.getAdjustedNode(node, options);
147823
147871
  const symbol = isDefinitionForReference(adjustedNode) ? checker.getSymbolAtLocation(adjustedNode) : void 0;
147824
- return !referencedSymbols || !referencedSymbols.length ? void 0 : mapDefined(referencedSymbols, ({ definition, references }) => // Only include referenced symbols that have a valid definition.
147825
- definition && {
147826
- definition: checker.runWithCancellationToken(cancellationToken, (checker2) => definitionToReferencedSymbolDefinitionInfo(definition, checker2, node)),
147827
- references: references.map((r) => toReferencedSymbolEntry(r, symbol))
147828
- });
147872
+ return !referencedSymbols || !referencedSymbols.length ? void 0 : mapDefined(referencedSymbols, ({ definition, references }) => (
147873
+ // Only include referenced symbols that have a valid definition.
147874
+ definition && {
147875
+ definition: checker.runWithCancellationToken(cancellationToken, (checker2) => definitionToReferencedSymbolDefinitionInfo(definition, checker2, node)),
147876
+ references: references.map((r) => toReferencedSymbolEntry(r, symbol))
147877
+ }
147878
+ ));
147829
147879
  }
147830
147880
  function isDefinitionForReference(node) {
147831
147881
  return node.kind === 88 /* DefaultKeyword */ || !!getDeclarationFromName(node) || isLiteralComputedPropertyDeclarationName(node) || node.kind === 135 /* ConstructorKeyword */ && isConstructorDeclaration(node.parent);
@@ -148863,8 +148913,10 @@ ${lanes.join("\n")}
148863
148913
  function getLabelReferencesInNode(container, targetLabel) {
148864
148914
  const sourceFile = container.getSourceFile();
148865
148915
  const labelName = targetLabel.text;
148866
- const references = mapDefined(getPossibleSymbolReferenceNodes(sourceFile, labelName, container), (node) => // Only pick labels that are either the target label, or have a target that is the target label
148867
- node === targetLabel || isJumpStatementTarget(node) && getTargetLabel(node, labelName) === targetLabel ? nodeEntry(node) : void 0);
148916
+ const references = mapDefined(getPossibleSymbolReferenceNodes(sourceFile, labelName, container), (node) => (
148917
+ // Only pick labels that are either the target label, or have a target that is the target label
148918
+ node === targetLabel || isJumpStatementTarget(node) && getTargetLabel(node, labelName) === targetLabel ? nodeEntry(node) : void 0
148919
+ ));
148868
148920
  return [{ definition: { type: 1 /* Label */, node: targetLabel }, references }];
148869
148921
  }
148870
148922
  function isValidReferencePosition(node, searchSymbolName) {
@@ -158005,7 +158057,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
158005
158057
  hasAddedSymbolInfo = true;
158006
158058
  hasMultipleSignatures = allSignatures.length > 1;
158007
158059
  }
158008
- } else if (isNameOfFunctionDeclaration(location) && !(symbolFlags & 98304 /* Accessor */) || location.kind === 135 /* ConstructorKeyword */ && location.parent.kind === 173 /* Constructor */) {
158060
+ } else if (isNameOfFunctionDeclaration(location) && !(symbolFlags & 98304 /* Accessor */) || // name of function declaration
158061
+ location.kind === 135 /* ConstructorKeyword */ && location.parent.kind === 173 /* Constructor */) {
158009
158062
  const functionDeclaration = location.parent;
158010
158063
  const locationIsSymbolDeclaration = symbol.declarations && find(symbol.declarations, (declaration) => declaration === (location.kind === 135 /* ConstructorKeyword */ ? functionDeclaration.parent : functionDeclaration));
158011
158064
  if (locationIsSymbolDeclaration) {
@@ -160343,18 +160396,12 @@ ${options.prefix}` : "\n" : options.prefix
160343
160396
  rule("NoSpaceBetweenCloseParenAndAngularBracket", 21 /* CloseParenToken */, 29 /* LessThanToken */, [isNonJsxSameLineTokenContext, isTypeArgumentOrParameterOrAssertionContext], 16 /* DeleteSpace */),
160344
160397
  rule("NoSpaceAfterOpenAngularBracket", 29 /* LessThanToken */, anyToken, [isNonJsxSameLineTokenContext, isTypeArgumentOrParameterOrAssertionContext], 16 /* DeleteSpace */),
160345
160398
  rule("NoSpaceBeforeCloseAngularBracket", anyToken, 31 /* GreaterThanToken */, [isNonJsxSameLineTokenContext, isTypeArgumentOrParameterOrAssertionContext], 16 /* DeleteSpace */),
160346
- rule(
160347
- "NoSpaceAfterCloseAngularBracket",
160348
- 31 /* GreaterThanToken */,
160349
- [20 /* OpenParenToken */, 22 /* OpenBracketToken */, 31 /* GreaterThanToken */, 27 /* CommaToken */],
160350
- [
160351
- isNonJsxSameLineTokenContext,
160352
- isTypeArgumentOrParameterOrAssertionContext,
160353
- isNotFunctionDeclContext
160354
- /*To prevent an interference with the SpaceBeforeOpenParenInFuncDecl rule*/
160355
- ],
160356
- 16 /* DeleteSpace */
160357
- ),
160399
+ rule("NoSpaceAfterCloseAngularBracket", 31 /* GreaterThanToken */, [20 /* OpenParenToken */, 22 /* OpenBracketToken */, 31 /* GreaterThanToken */, 27 /* CommaToken */], [
160400
+ isNonJsxSameLineTokenContext,
160401
+ isTypeArgumentOrParameterOrAssertionContext,
160402
+ isNotFunctionDeclContext,
160403
+ isNonTypeAssertionContext
160404
+ ], 16 /* DeleteSpace */),
160358
160405
  // decorators
160359
160406
  rule("SpaceBeforeAt", [21 /* CloseParenToken */, 79 /* Identifier */], 59 /* AtToken */, [isNonJsxSameLineTokenContext], 4 /* InsertSpace */),
160360
160407
  rule("NoSpaceAfterAt", 59 /* AtToken */, anyToken, [isNonJsxSameLineTokenContext], 16 /* DeleteSpace */),
@@ -160787,6 +160834,9 @@ ${options.prefix}` : "\n" : options.prefix
160787
160834
  function isTypeAssertionContext(context) {
160788
160835
  return context.contextNode.kind === 213 /* TypeAssertionExpression */;
160789
160836
  }
160837
+ function isNonTypeAssertionContext(context) {
160838
+ return !isTypeAssertionContext(context);
160839
+ }
160790
160840
  function isVoidOpContext(context) {
160791
160841
  return context.currentTokenSpan.kind === 114 /* VoidKeyword */ && context.currentTokenParent.kind === 219 /* VoidExpression */;
160792
160842
  }
@@ -169136,7 +169186,8 @@ ${options.prefix}` : "\n" : options.prefix
169136
169186
  });
169137
169187
  }
169138
169188
  getOrCreateInferredProjectForProjectRootPathIfEnabled(info, projectRootPath) {
169139
- if (!this.useInferredProjectPerProjectRoot || info.isDynamic && projectRootPath === void 0) {
169189
+ if (!this.useInferredProjectPerProjectRoot || // Its a dynamic info opened without project root
169190
+ info.isDynamic && projectRootPath === void 0) {
169140
169191
  return void 0;
169141
169192
  }
169142
169193
  if (projectRootPath) {