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.
package/lib/tsserver.js CHANGED
@@ -2662,7 +2662,7 @@ __export(ts_server_exports3, {
2662
2662
 
2663
2663
  // src/compiler/corePublic.ts
2664
2664
  var versionMajorMinor = "5.0";
2665
- var version = `${versionMajorMinor}.0-dev.20230111`;
2665
+ var version = `${versionMajorMinor}.0-dev.20230112`;
2666
2666
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2667
2667
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2668
2668
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -12230,7 +12230,8 @@ function isIdentifierStart(ch, languageVersion) {
12230
12230
  return ch >= 65 /* A */ && ch <= 90 /* Z */ || ch >= 97 /* a */ && ch <= 122 /* z */ || ch === 36 /* $ */ || ch === 95 /* _ */ || ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierStart(ch, languageVersion);
12231
12231
  }
12232
12232
  function isIdentifierPart(ch, languageVersion, identifierVariant) {
12233
- 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);
12233
+ 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
12234
+ (identifierVariant === 1 /* JSX */ ? ch === 45 /* minus */ || ch === 58 /* colon */ : false) || ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierPart(ch, languageVersion);
12234
12235
  }
12235
12236
  function isIdentifierText(name, languageVersion, identifierVariant) {
12236
12237
  let ch = codePointAt(name, 0);
@@ -38963,7 +38964,8 @@ function convertToObjectWorker(sourceFile, rootExpression, errors, returnValue,
38963
38964
  if (returnValue) {
38964
38965
  result[keyText] = value;
38965
38966
  }
38966
- if (jsonConversionNotifier && (parentOption || isRootOptionMap(knownOptions))) {
38967
+ if (jsonConversionNotifier && // Current callbacks are only on known parent option or if we are setting values in the root
38968
+ (parentOption || isRootOptionMap(knownOptions))) {
38967
38969
  const isValidOptionValue = isCompilerOptionsValue(option, value);
38968
38970
  if (parentOption) {
38969
38971
  if (isValidOptionValue) {
@@ -45434,8 +45436,12 @@ function createBinder() {
45434
45436
  return false;
45435
45437
  }
45436
45438
  if (currentFlow === unreachableFlow) {
45437
- const reportError = isStatementButNotDeclaration(node) && node.kind !== 239 /* EmptyStatement */ || // report error on class declarations
45438
- node.kind === 260 /* ClassDeclaration */ || node.kind === 264 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node);
45439
+ const reportError = (
45440
+ // report error on all statements except empty ones
45441
+ isStatementButNotDeclaration(node) && node.kind !== 239 /* EmptyStatement */ || // report error on class declarations
45442
+ node.kind === 260 /* ClassDeclaration */ || // report error on instantiated modules or const-enums only modules if preserveConstEnums is set
45443
+ node.kind === 264 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)
45444
+ );
45439
45445
  if (reportError) {
45440
45446
  currentFlow = reportedUnreachableFlow;
45441
45447
  if (!options.allowUnreachableCode) {
@@ -51289,7 +51295,8 @@ function createTypeChecker(host) {
51289
51295
  const isNonLocalFunctionSymbol = !!(symbol.flags & 16 /* Function */) && (symbol.parent || // is exported function symbol
51290
51296
  forEach(symbol.declarations, (declaration) => declaration.parent.kind === 308 /* SourceFile */ || declaration.parent.kind === 265 /* ModuleBlock */));
51291
51297
  if (isStaticMethodSymbol || isNonLocalFunctionSymbol) {
51292
- return (!!(context.flags & 4096 /* UseTypeOfFunction */) || ((_a4 = context.visitedTypes) == null ? void 0 : _a4.has(typeId))) && (!(context.flags & 8 /* UseStructuralFallback */) || isValueSymbolAccessible(symbol, context.enclosingDeclaration));
51298
+ return (!!(context.flags & 4096 /* UseTypeOfFunction */) || ((_a4 = context.visitedTypes) == null ? void 0 : _a4.has(typeId))) && // it is type of the symbol uses itself recursively
51299
+ (!(context.flags & 8 /* UseStructuralFallback */) || isValueSymbolAccessible(symbol, context.enclosingDeclaration));
51293
51300
  }
51294
51301
  }
51295
51302
  }
@@ -51381,7 +51388,9 @@ function createTypeChecker(host) {
51381
51388
  const abstractSignatures = filter(resolved.constructSignatures, (signature) => !!(signature.flags & 4 /* Abstract */));
51382
51389
  if (some(abstractSignatures)) {
51383
51390
  const types = map(abstractSignatures, getOrCreateTypeFromSignature);
51384
- 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));
51391
+ 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
51392
+ // the logic in `createTypeNodesFromResolvedType`.
51393
+ (context.flags & 2048 /* WriteClassExpressionAsTypeLiteral */ ? countWhere(resolved.properties, (p) => !(p.flags & 4194304 /* Prototype */)) : length(resolved.properties));
51385
51394
  if (typeElementCount) {
51386
51395
  types.push(getResolvedTypeWithoutAbstractConstructSignatures(resolved));
51387
51396
  }
@@ -52043,9 +52052,11 @@ function createTypeChecker(host) {
52043
52052
  if (accessibleSymbolChain) {
52044
52053
  return accessibleSymbolChain;
52045
52054
  }
52046
- if (// If this is the last part of outputting the symbol, always output. The cases apply only to parent symbols.
52047
- endOfChain || // If a parent symbol is an anonymous type, don't write it.
52048
- !(symbol2.flags & (2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */))) {
52055
+ if (
52056
+ // If this is the last part of outputting the symbol, always output. The cases apply only to parent symbols.
52057
+ endOfChain || // If a parent symbol is an anonymous type, don't write it.
52058
+ !(symbol2.flags & (2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */))
52059
+ ) {
52049
52060
  if (!endOfChain && !yieldModuleSymbol && !!forEach(symbol2.declarations, hasNonGlobalAugmentationExternalModuleSymbol)) {
52050
52061
  return;
52051
52062
  }
@@ -52667,7 +52678,8 @@ function createTypeChecker(host) {
52667
52678
  }
52668
52679
  if (isLiteralImportTypeNode(node)) {
52669
52680
  const nodeSymbol = getNodeLinks(node).resolvedSymbol;
52670
- if (isInJSDoc(node) && nodeSymbol && (!node.isTypeOf && !(nodeSymbol.flags & 788968 /* Type */) || // The import type had type arguments autofilled by js fallback logic
52681
+ if (isInJSDoc(node) && nodeSymbol && // The import type resolved using jsdoc fallback logic
52682
+ (!node.isTypeOf && !(nodeSymbol.flags & 788968 /* Type */) || // The import type had type arguments autofilled by js fallback logic
52671
52683
  !(length(node.typeArguments) >= getMinTypeArgumentCount(getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(nodeSymbol))))) {
52672
52684
  return setOriginalNode(typeToTypeNodeHelper(getTypeFromTypeNode(node), context), node);
52673
52685
  }
@@ -54184,8 +54196,10 @@ function createTypeChecker(host) {
54184
54196
  }
54185
54197
  }
54186
54198
  function getNameOfSymbolAsWritten(symbol, context) {
54187
- 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`
54188
- !symbol.declarations || context.enclosingDeclaration && findAncestor(symbol.declarations[0], isDefaultBindingContext) !== findAncestor(context.enclosingDeclaration, isDefaultBindingContext))) {
54199
+ 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`
54200
+ (!(context.flags & 16777216 /* InInitialEntityName */) || // if the symbol is synthesized, it will only be referenced externally it must print as `default`
54201
+ !symbol.declarations || // if not in the same binding context (source file, module declaration), it must print as `default`
54202
+ context.enclosingDeclaration && findAncestor(symbol.declarations[0], isDefaultBindingContext) !== findAncestor(context.enclosingDeclaration, isDefaultBindingContext))) {
54189
54203
  return "default";
54190
54204
  }
54191
54205
  if (symbol.declarations && symbol.declarations.length) {
@@ -55512,7 +55526,10 @@ function createTypeChecker(host) {
55512
55526
  function getWriteTypeOfSymbol(symbol) {
55513
55527
  const checkFlags = getCheckFlags(symbol);
55514
55528
  if (symbol.flags & 4 /* Property */) {
55515
- return checkFlags & 2 /* SyntheticProperty */ ? checkFlags & 65536 /* DeferredType */ ? getWriteTypeOfSymbolWithDeferredType(symbol) || getTypeOfSymbolWithDeferredType(symbol) : symbol.links.writeType || symbol.links.type : getTypeOfSymbol(symbol);
55529
+ return checkFlags & 2 /* SyntheticProperty */ ? checkFlags & 65536 /* DeferredType */ ? getWriteTypeOfSymbolWithDeferredType(symbol) || getTypeOfSymbolWithDeferredType(symbol) : (
55530
+ // NOTE: cast to TransientSymbol should be safe because only TransientSymbols can have CheckFlags.SyntheticProperty
55531
+ symbol.links.writeType || symbol.links.type
55532
+ ) : getTypeOfSymbol(symbol);
55516
55533
  }
55517
55534
  if (symbol.flags & 98304 /* Accessor */) {
55518
55535
  return checkFlags & 1 /* Instantiated */ ? getWriteTypeOfInstantiatedSymbol(symbol) : getWriteTypeOfAccessors(symbol);
@@ -63929,7 +63946,11 @@ function createTypeChecker(host) {
63929
63946
  if (variances === emptyArray) {
63930
63947
  return 1 /* Unknown */;
63931
63948
  }
63932
- const varianceResult = relateVariances(source2.aliasTypeArguments, target2.aliasTypeArguments, variances, intersectionState);
63949
+ const params = getSymbolLinks(source2.aliasSymbol).typeParameters;
63950
+ const minParams = getMinTypeArgumentCount(params);
63951
+ const sourceTypes = fillMissingTypeArguments(source2.aliasTypeArguments, params, minParams, isInJSFile(source2.aliasSymbol.valueDeclaration));
63952
+ const targetTypes = fillMissingTypeArguments(target2.aliasTypeArguments, params, minParams, isInJSFile(source2.aliasSymbol.valueDeclaration));
63953
+ const varianceResult = relateVariances(sourceTypes, targetTypes, variances, intersectionState);
63933
63954
  if (varianceResult !== void 0) {
63934
63955
  return varianceResult;
63935
63956
  }
@@ -66386,7 +66407,11 @@ function createTypeChecker(host) {
66386
66407
  }
66387
66408
  if (source.aliasSymbol && source.aliasSymbol === target.aliasSymbol) {
66388
66409
  if (source.aliasTypeArguments) {
66389
- inferFromTypeArguments(source.aliasTypeArguments, target.aliasTypeArguments, getAliasVariances(source.aliasSymbol));
66410
+ const params = getSymbolLinks(source.aliasSymbol).typeParameters;
66411
+ const minParams = getMinTypeArgumentCount(params);
66412
+ const sourceTypes = fillMissingTypeArguments(source.aliasTypeArguments, params, minParams, isInJSFile(source.aliasSymbol.valueDeclaration));
66413
+ const targetTypes = fillMissingTypeArguments(target.aliasTypeArguments, params, minParams, isInJSFile(source.aliasSymbol.valueDeclaration));
66414
+ inferFromTypeArguments(sourceTypes, targetTypes, getAliasVariances(source.aliasSymbol));
66390
66415
  }
66391
66416
  return;
66392
66417
  }
@@ -68793,18 +68818,20 @@ function createTypeChecker(host) {
68793
68818
  return narrowTypeByTypeFacts(type, nonPrimitiveType, 128 /* TypeofEQHostObject */);
68794
68819
  }
68795
68820
  function narrowTypeByTypeFacts(type, impliedType, facts) {
68796
- return mapType(type, (t) => // We first check if a constituent is a subtype of the implied type. If so, we either keep or eliminate
68797
- // the constituent based on its type facts. We use the strict subtype relation because it treats `object`
68798
- // as a subtype of `{}`, and we need the type facts check because function types are subtypes of `object`,
68799
- // but are classified as "function" according to `typeof`.
68800
- isTypeRelatedTo(t, impliedType, strictSubtypeRelation) ? getTypeFacts(t) & facts ? t : neverType : (
68801
- // We next check if the consituent is a supertype of the implied type. If so, we substitute the implied
68802
- // type. This handles top types like `unknown` and `{}`, and supertypes like `{ toString(): string }`.
68803
- isTypeSubtypeOf(impliedType, t) ? impliedType : (
68804
- // Neither the constituent nor the implied type is a subtype of the other, however their domains may still
68805
- // overlap. For example, an unconstrained type parameter and type `string`. If the type facts indicate
68806
- // possible overlap, we form an intersection. Otherwise, we eliminate the constituent.
68807
- getTypeFacts(t) & facts ? getIntersectionType([t, impliedType]) : neverType
68821
+ return mapType(type, (t) => (
68822
+ // We first check if a constituent is a subtype of the implied type. If so, we either keep or eliminate
68823
+ // the constituent based on its type facts. We use the strict subtype relation because it treats `object`
68824
+ // as a subtype of `{}`, and we need the type facts check because function types are subtypes of `object`,
68825
+ // but are classified as "function" according to `typeof`.
68826
+ isTypeRelatedTo(t, impliedType, strictSubtypeRelation) ? getTypeFacts(t) & facts ? t : neverType : (
68827
+ // We next check if the consituent is a supertype of the implied type. If so, we substitute the implied
68828
+ // type. This handles top types like `unknown` and `{}`, and supertypes like `{ toString(): string }`.
68829
+ isTypeSubtypeOf(impliedType, t) ? impliedType : (
68830
+ // Neither the constituent nor the implied type is a subtype of the other, however their domains may still
68831
+ // overlap. For example, an unconstrained type parameter and type `string`. If the type facts indicate
68832
+ // possible overlap, we form an intersection. Otherwise, we eliminate the constituent.
68833
+ getTypeFacts(t) & facts ? getIntersectionType([t, impliedType]) : neverType
68834
+ )
68808
68835
  )
68809
68836
  ));
68810
68837
  }
@@ -76375,7 +76402,8 @@ function createTypeChecker(host) {
76375
76402
  }
76376
76403
  }
76377
76404
  function isIndirectCall(node) {
76378
- 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");
76405
+ 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.
76406
+ (isAccessExpression(node.right) || isIdentifier(node.right) && node.right.escapedText === "eval");
76379
76407
  }
76380
76408
  function checkForDisallowedESSymbolOperand(operator2) {
76381
76409
  const offendingSymbolOperand = maybeTypeOfKindConsideringBaseConstraint(leftType, 12288 /* ESSymbolLike */) ? left : maybeTypeOfKindConsideringBaseConstraint(rightType, 12288 /* ESSymbolLike */) ? right : void 0;
@@ -83460,7 +83488,12 @@ function createTypeChecker(host) {
83460
83488
  return false;
83461
83489
  const symbol = getSymbolOfDeclaration(node);
83462
83490
  const signaturesOfSymbol = getSignaturesOfSymbol(symbol);
83463
- return signaturesOfSymbol.length > 1 || signaturesOfSymbol.length === 1 && signaturesOfSymbol[0].declaration !== node;
83491
+ return signaturesOfSymbol.length > 1 || // If there is single signature for the symbol, it is overload if that signature isn't coming from the node
83492
+ // e.g.: function foo(a: string): string;
83493
+ // function foo(a: any) { // This is implementation of the overloads
83494
+ // return a;
83495
+ // }
83496
+ signaturesOfSymbol.length === 1 && signaturesOfSymbol[0].declaration !== node;
83464
83497
  }
83465
83498
  return false;
83466
83499
  }
@@ -114115,7 +114148,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
114115
114148
  const oldSourceFiles = oldProgram.getSourceFiles();
114116
114149
  for (const oldSourceFile of oldSourceFiles) {
114117
114150
  const newFile = getSourceFileByPath(oldSourceFile.resolvedPath);
114118
- if (shouldCreateNewSourceFile || !newFile || newFile.impliedNodeFormat !== oldSourceFile.impliedNodeFormat || oldSourceFile.resolvedPath === oldSourceFile.path && newFile.resolvedPath !== oldSourceFile.path) {
114151
+ if (shouldCreateNewSourceFile || !newFile || newFile.impliedNodeFormat !== oldSourceFile.impliedNodeFormat || // old file wasn't redirect but new file is
114152
+ oldSourceFile.resolvedPath === oldSourceFile.path && newFile.resolvedPath !== oldSourceFile.path) {
114119
114153
  host.onReleaseOldSourceFile(oldSourceFile, oldProgram.getCompilerOptions(), !!getSourceFileByPath(oldSourceFile.path));
114120
114154
  }
114121
114155
  }
@@ -118843,7 +118877,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
118843
118877
  const name = loader.nameAndMode.getName(entry);
118844
118878
  const mode = loader.nameAndMode.getMode(entry, containingSourceFile);
118845
118879
  let resolution = resolutionsInFile.get(name, mode);
118846
- if (!seenNamesInFile.has(name, mode) && unmatchedRedirects || !resolution || resolution.isInvalidated || hasInvalidatedNonRelativeUnresolvedImport && !isExternalModuleNameRelative(name) && shouldRetryResolution(resolution)) {
118880
+ if (!seenNamesInFile.has(name, mode) && unmatchedRedirects || !resolution || resolution.isInvalidated || // If the name is unresolved import that was invalidated, recalculate
118881
+ hasInvalidatedNonRelativeUnresolvedImport && !isExternalModuleNameRelative(name) && shouldRetryResolution(resolution)) {
118847
118882
  const existingResolution = resolution;
118848
118883
  resolution = loader.resolve(name, mode);
118849
118884
  if (resolutionHost.onDiscoveredSymlink && resolutionIsSymlink(resolution)) {
@@ -126976,7 +127011,11 @@ function findNextToken(previousToken, parent2, sourceFile) {
126976
127011
  return n;
126977
127012
  }
126978
127013
  return firstDefined(n.getChildren(sourceFile), (child) => {
126979
- const shouldDiveInChildNode = child.pos <= previousToken.pos && child.end > previousToken.end || child.pos === previousToken.end;
127014
+ const shouldDiveInChildNode = (
127015
+ // previous token is enclosed somewhere in the child
127016
+ child.pos <= previousToken.pos && child.end > previousToken.end || // previous token ends exactly at the beginning of child
127017
+ child.pos === previousToken.end
127018
+ );
126980
127019
  return shouldDiveInChildNode && nodeHasTokens(child, sourceFile) ? find2(child) : void 0;
126981
127020
  });
126982
127021
  }
@@ -140435,15 +140474,17 @@ function getBestFix(fixes, sourceFile, program, packageJsonImportFilter, host) {
140435
140474
  return fixes[0];
140436
140475
  }
140437
140476
  return fixes.reduce(
140438
- (best, fix) => // Takes true branch of conditional if `fix` is better than `best`
140439
- compareModuleSpecifiers(
140440
- fix,
140441
- best,
140442
- sourceFile,
140443
- program,
140444
- packageJsonImportFilter.allowsImportingSpecifier,
140445
- (fileName) => toPath(fileName, host.getCurrentDirectory(), hostGetCanonicalFileName(host))
140446
- ) === -1 /* LessThan */ ? fix : best
140477
+ (best, fix) => (
140478
+ // Takes true branch of conditional if `fix` is better than `best`
140479
+ compareModuleSpecifiers(
140480
+ fix,
140481
+ best,
140482
+ sourceFile,
140483
+ program,
140484
+ packageJsonImportFilter.allowsImportingSpecifier,
140485
+ (fileName) => toPath(fileName, host.getCurrentDirectory(), hostGetCanonicalFileName(host))
140486
+ ) === -1 /* LessThan */ ? fix : best
140487
+ )
140447
140488
  );
140448
140489
  }
140449
140490
  function compareModuleSpecifiers(a, b, importingFile, program, allowsImportingSpecifier, toPath3) {
@@ -149431,7 +149472,10 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
149431
149472
  return containingNodeKind === 257 /* VariableDeclaration */ || isVariableDeclarationListButNotTypeArgument(contextToken2) || containingNodeKind === 240 /* VariableStatement */ || containingNodeKind === 263 /* EnumDeclaration */ || // enum a { foo, |
149432
149473
  isFunctionLikeButNotConstructor(containingNodeKind) || containingNodeKind === 261 /* InterfaceDeclaration */ || // interface A<T, |
149433
149474
  containingNodeKind === 204 /* ArrayBindingPattern */ || // var [x, y|
149434
- containingNodeKind === 262 /* TypeAliasDeclaration */ || isClassLike(parent2) && !!parent2.typeParameters && parent2.typeParameters.end >= contextToken2.pos;
149475
+ containingNodeKind === 262 /* TypeAliasDeclaration */ || // type Map, K, |
149476
+ // class A<T, |
149477
+ // var C = class D<T, |
149478
+ isClassLike(parent2) && !!parent2.typeParameters && parent2.typeParameters.end >= contextToken2.pos;
149435
149479
  case 24 /* DotToken */:
149436
149480
  return containingNodeKind === 204 /* ArrayBindingPattern */;
149437
149481
  case 58 /* ColonToken */:
@@ -151376,8 +151420,10 @@ function getDirectImportsMap(sourceFiles, checker, cancellationToken) {
151376
151420
  return map2;
151377
151421
  }
151378
151422
  function forEachPossibleImportOrExportStatement(sourceFileLike, action) {
151379
- return forEach(sourceFileLike.kind === 308 /* SourceFile */ ? sourceFileLike.statements : sourceFileLike.body.statements, (statement) => // TODO: GH#18217
151380
- action(statement) || isAmbientModuleDeclaration(statement) && forEach(statement.body && statement.body.statements, action));
151423
+ return forEach(sourceFileLike.kind === 308 /* SourceFile */ ? sourceFileLike.statements : sourceFileLike.body.statements, (statement) => (
151424
+ // TODO: GH#18217
151425
+ action(statement) || isAmbientModuleDeclaration(statement) && forEach(statement.body && statement.body.statements, action)
151426
+ ));
151381
151427
  }
151382
151428
  function forEachImport(sourceFile, action) {
151383
151429
  if (sourceFile.externalModuleIndicator || sourceFile.imports !== void 0) {
@@ -151645,7 +151691,9 @@ function getContextNodeForNodeEntry(node) {
151645
151691
  return propertyName ? getContextNode(propertyName.parent) : void 0;
151646
151692
  }
151647
151693
  if (node.parent.name === node || // node is name of declaration, use parent
151648
- 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 */)) {
151694
+ isConstructorDeclaration(node.parent) || isExportAssignment(node.parent) || // Property name of the import export specifier or binding pattern, use parent
151695
+ (isImportOrExportSpecifier(node.parent) || isBindingElement(node.parent)) && node.parent.propertyName === node || // Is default export
151696
+ node.kind === 88 /* DefaultKeyword */ && hasSyntacticModifier(node.parent, 1025 /* ExportDefault */)) {
151649
151697
  return getContextNode(node.parent);
151650
151698
  }
151651
151699
  return void 0;
@@ -151705,11 +151753,13 @@ function findReferencedSymbols(program, cancellationToken, sourceFiles, sourceFi
151705
151753
  const checker = program.getTypeChecker();
151706
151754
  const adjustedNode = Core.getAdjustedNode(node, options);
151707
151755
  const symbol = isDefinitionForReference(adjustedNode) ? checker.getSymbolAtLocation(adjustedNode) : void 0;
151708
- return !referencedSymbols || !referencedSymbols.length ? void 0 : mapDefined(referencedSymbols, ({ definition, references }) => // Only include referenced symbols that have a valid definition.
151709
- definition && {
151710
- definition: checker.runWithCancellationToken(cancellationToken, (checker2) => definitionToReferencedSymbolDefinitionInfo(definition, checker2, node)),
151711
- references: references.map((r) => toReferencedSymbolEntry(r, symbol))
151712
- });
151756
+ return !referencedSymbols || !referencedSymbols.length ? void 0 : mapDefined(referencedSymbols, ({ definition, references }) => (
151757
+ // Only include referenced symbols that have a valid definition.
151758
+ definition && {
151759
+ definition: checker.runWithCancellationToken(cancellationToken, (checker2) => definitionToReferencedSymbolDefinitionInfo(definition, checker2, node)),
151760
+ references: references.map((r) => toReferencedSymbolEntry(r, symbol))
151761
+ }
151762
+ ));
151713
151763
  }
151714
151764
  function isDefinitionForReference(node) {
151715
151765
  return node.kind === 88 /* DefaultKeyword */ || !!getDeclarationFromName(node) || isLiteralComputedPropertyDeclarationName(node) || node.kind === 135 /* ConstructorKeyword */ && isConstructorDeclaration(node.parent);
@@ -152719,8 +152769,10 @@ var Core;
152719
152769
  function getLabelReferencesInNode(container, targetLabel) {
152720
152770
  const sourceFile = container.getSourceFile();
152721
152771
  const labelName = targetLabel.text;
152722
- 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
152723
- node === targetLabel || isJumpStatementTarget(node) && getTargetLabel(node, labelName) === targetLabel ? nodeEntry(node) : void 0);
152772
+ const references = mapDefined(getPossibleSymbolReferenceNodes(sourceFile, labelName, container), (node) => (
152773
+ // Only pick labels that are either the target label, or have a target that is the target label
152774
+ node === targetLabel || isJumpStatementTarget(node) && getTargetLabel(node, labelName) === targetLabel ? nodeEntry(node) : void 0
152775
+ ));
152724
152776
  return [{ definition: { type: 1 /* Label */, node: targetLabel }, references }];
152725
152777
  }
152726
152778
  function isValidReferencePosition(node, searchSymbolName) {
@@ -161548,7 +161600,8 @@ function getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, so
161548
161600
  hasAddedSymbolInfo = true;
161549
161601
  hasMultipleSignatures = allSignatures.length > 1;
161550
161602
  }
161551
- } else if (isNameOfFunctionDeclaration(location) && !(symbolFlags & 98304 /* Accessor */) || location.kind === 135 /* ConstructorKeyword */ && location.parent.kind === 173 /* Constructor */) {
161603
+ } else if (isNameOfFunctionDeclaration(location) && !(symbolFlags & 98304 /* Accessor */) || // name of function declaration
161604
+ location.kind === 135 /* ConstructorKeyword */ && location.parent.kind === 173 /* Constructor */) {
161552
161605
  const functionDeclaration = location.parent;
161553
161606
  const locationIsSymbolDeclaration = symbol.declarations && find(symbol.declarations, (declaration) => declaration === (location.kind === 135 /* ConstructorKeyword */ ? functionDeclaration.parent : functionDeclaration));
161554
161607
  if (locationIsSymbolDeclaration) {
@@ -163855,18 +163908,12 @@ function getAllRules() {
163855
163908
  rule("NoSpaceBetweenCloseParenAndAngularBracket", 21 /* CloseParenToken */, 29 /* LessThanToken */, [isNonJsxSameLineTokenContext, isTypeArgumentOrParameterOrAssertionContext], 16 /* DeleteSpace */),
163856
163909
  rule("NoSpaceAfterOpenAngularBracket", 29 /* LessThanToken */, anyToken, [isNonJsxSameLineTokenContext, isTypeArgumentOrParameterOrAssertionContext], 16 /* DeleteSpace */),
163857
163910
  rule("NoSpaceBeforeCloseAngularBracket", anyToken, 31 /* GreaterThanToken */, [isNonJsxSameLineTokenContext, isTypeArgumentOrParameterOrAssertionContext], 16 /* DeleteSpace */),
163858
- rule(
163859
- "NoSpaceAfterCloseAngularBracket",
163860
- 31 /* GreaterThanToken */,
163861
- [20 /* OpenParenToken */, 22 /* OpenBracketToken */, 31 /* GreaterThanToken */, 27 /* CommaToken */],
163862
- [
163863
- isNonJsxSameLineTokenContext,
163864
- isTypeArgumentOrParameterOrAssertionContext,
163865
- isNotFunctionDeclContext
163866
- /*To prevent an interference with the SpaceBeforeOpenParenInFuncDecl rule*/
163867
- ],
163868
- 16 /* DeleteSpace */
163869
- ),
163911
+ rule("NoSpaceAfterCloseAngularBracket", 31 /* GreaterThanToken */, [20 /* OpenParenToken */, 22 /* OpenBracketToken */, 31 /* GreaterThanToken */, 27 /* CommaToken */], [
163912
+ isNonJsxSameLineTokenContext,
163913
+ isTypeArgumentOrParameterOrAssertionContext,
163914
+ isNotFunctionDeclContext,
163915
+ isNonTypeAssertionContext
163916
+ ], 16 /* DeleteSpace */),
163870
163917
  // decorators
163871
163918
  rule("SpaceBeforeAt", [21 /* CloseParenToken */, 79 /* Identifier */], 59 /* AtToken */, [isNonJsxSameLineTokenContext], 4 /* InsertSpace */),
163872
163919
  rule("NoSpaceAfterAt", 59 /* AtToken */, anyToken, [isNonJsxSameLineTokenContext], 16 /* DeleteSpace */),
@@ -164299,6 +164346,9 @@ function isTypeArgumentOrParameterOrAssertionContext(context) {
164299
164346
  function isTypeAssertionContext(context) {
164300
164347
  return context.contextNode.kind === 213 /* TypeAssertionExpression */;
164301
164348
  }
164349
+ function isNonTypeAssertionContext(context) {
164350
+ return !isTypeAssertionContext(context);
164351
+ }
164302
164352
  function isVoidOpContext(context) {
164303
164353
  return context.currentTokenSpan.kind === 114 /* VoidKeyword */ && context.currentTokenParent.kind === 219 /* VoidExpression */;
164304
164354
  }
@@ -172377,7 +172427,8 @@ var _ProjectService = class {
172377
172427
  });
172378
172428
  }
172379
172429
  getOrCreateInferredProjectForProjectRootPathIfEnabled(info, projectRootPath) {
172380
- if (!this.useInferredProjectPerProjectRoot || info.isDynamic && projectRootPath === void 0) {
172430
+ if (!this.useInferredProjectPerProjectRoot || // Its a dynamic info opened without project root
172431
+ info.isDynamic && projectRootPath === void 0) {
172381
172432
  return void 0;
172382
172433
  }
172383
172434
  if (projectRootPath) {