typescript 5.5.0-dev.20240411 → 5.5.0-dev.20240412

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/typescript.js CHANGED
@@ -434,6 +434,7 @@ __export(typescript_exports, {
434
434
  createModuleResolutionLoaderUsingGlobalCache: () => createModuleResolutionLoaderUsingGlobalCache,
435
435
  createModuleSpecifierResolutionHost: () => createModuleSpecifierResolutionHost,
436
436
  createMultiMap: () => createMultiMap,
437
+ createNameResolver: () => createNameResolver,
437
438
  createNodeConverters: () => createNodeConverters,
438
439
  createNodeFactory: () => createNodeFactory,
439
440
  createOptionNameMap: () => createOptionNameMap,
@@ -574,6 +575,7 @@ __export(typescript_exports, {
574
575
  findChildOfKind: () => findChildOfKind,
575
576
  findComputedPropertyNameCacheAssignment: () => findComputedPropertyNameCacheAssignment,
576
577
  findConfigFile: () => findConfigFile,
578
+ findConstructorDeclaration: () => findConstructorDeclaration,
577
579
  findContainingList: () => findContainingList,
578
580
  findDiagnosticForNode: () => findDiagnosticForNode,
579
581
  findFirstNonJsxWhitespaceToken: () => findFirstNonJsxWhitespaceToken,
@@ -1285,6 +1287,7 @@ __export(typescript_exports, {
1285
1287
  isConciseBody: () => isConciseBody,
1286
1288
  isConditionalExpression: () => isConditionalExpression,
1287
1289
  isConditionalTypeNode: () => isConditionalTypeNode,
1290
+ isConstAssertion: () => isConstAssertion,
1288
1291
  isConstTypeReference: () => isConstTypeReference,
1289
1292
  isConstructSignatureDeclaration: () => isConstructSignatureDeclaration,
1290
1293
  isConstructorDeclaration: () => isConstructorDeclaration,
@@ -1399,6 +1402,7 @@ __export(typescript_exports, {
1399
1402
  isGetOrSetAccessorDeclaration: () => isGetOrSetAccessorDeclaration,
1400
1403
  isGlobalDeclaration: () => isGlobalDeclaration,
1401
1404
  isGlobalScopeAugmentation: () => isGlobalScopeAugmentation,
1405
+ isGlobalSourceFile: () => isGlobalSourceFile,
1402
1406
  isGrammarError: () => isGrammarError,
1403
1407
  isHeritageClause: () => isHeritageClause,
1404
1408
  isHoistedFunction: () => isHoistedFunction,
@@ -2338,7 +2342,7 @@ module.exports = __toCommonJS(typescript_exports);
2338
2342
 
2339
2343
  // src/compiler/corePublic.ts
2340
2344
  var versionMajorMinor = "5.5";
2341
- var version = `${versionMajorMinor}.0-dev.20240411`;
2345
+ var version = `${versionMajorMinor}.0-dev.20240412`;
2342
2346
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2343
2347
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2344
2348
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -6958,6 +6962,7 @@ var ScriptTarget = /* @__PURE__ */ ((ScriptTarget11) => {
6958
6962
  ScriptTarget11[ScriptTarget11["ES2020"] = 7] = "ES2020";
6959
6963
  ScriptTarget11[ScriptTarget11["ES2021"] = 8] = "ES2021";
6960
6964
  ScriptTarget11[ScriptTarget11["ES2022"] = 9] = "ES2022";
6965
+ ScriptTarget11[ScriptTarget11["ES2023"] = 10] = "ES2023";
6961
6966
  ScriptTarget11[ScriptTarget11["ESNext"] = 99] = "ESNext";
6962
6967
  ScriptTarget11[ScriptTarget11["JSON"] = 100] = "JSON";
6963
6968
  ScriptTarget11[ScriptTarget11["Latest"] = 99 /* ESNext */] = "Latest";
@@ -13648,6 +13653,8 @@ function getDefaultLibFileName(options) {
13648
13653
  switch (getEmitScriptTarget(options)) {
13649
13654
  case 99 /* ESNext */:
13650
13655
  return "lib.esnext.full.d.ts";
13656
+ case 10 /* ES2023 */:
13657
+ return "lib.es2023.full.d.ts";
13651
13658
  case 9 /* ES2022 */:
13652
13659
  return "lib.es2022.full.d.ts";
13653
13660
  case 8 /* ES2021 */:
@@ -16520,6 +16527,9 @@ function getErrorSpanForNode(sourceFile, node) {
16520
16527
  }
16521
16528
  return createTextSpanFromBounds(pos, errorNode.end);
16522
16529
  }
16530
+ function isGlobalSourceFile(node) {
16531
+ return node.kind === 307 /* SourceFile */ && !isExternalOrCommonJsModule(node);
16532
+ }
16523
16533
  function isExternalOrCommonJsModule(file) {
16524
16534
  return (file.externalModuleIndicator || file.commonJsModuleIndicator) !== void 0;
16525
16535
  }
@@ -22069,6 +22079,380 @@ function createEvaluator({ evaluateElementAccessExpression, evaluateEntityNameEx
22069
22079
  }
22070
22080
  return evaluate;
22071
22081
  }
22082
+ function isConstAssertion(location) {
22083
+ return isAssertionExpression(location) && isConstTypeReference(location.type) || isJSDocTypeTag(location) && isConstTypeReference(location.typeExpression);
22084
+ }
22085
+ function findConstructorDeclaration(node) {
22086
+ const members = node.members;
22087
+ for (const member of members) {
22088
+ if (member.kind === 176 /* Constructor */ && nodeIsPresent(member.body)) {
22089
+ return member;
22090
+ }
22091
+ }
22092
+ }
22093
+ function createNameResolver({
22094
+ compilerOptions,
22095
+ requireSymbol,
22096
+ argumentsSymbol,
22097
+ error: error2,
22098
+ getSymbolOfDeclaration,
22099
+ globals,
22100
+ lookup,
22101
+ setRequiresScopeChangeCache = returnUndefined,
22102
+ getRequiresScopeChangeCache = returnUndefined,
22103
+ onPropertyWithInvalidInitializer = returnFalse,
22104
+ onFailedToResolveSymbol = returnUndefined,
22105
+ onSuccessfullyResolvedSymbol = returnUndefined
22106
+ }) {
22107
+ var isolatedModulesLikeFlagName = compilerOptions.verbatimModuleSyntax ? "verbatimModuleSyntax" : "isolatedModules";
22108
+ var emitStandardClassFields = getEmitStandardClassFields(compilerOptions);
22109
+ var emptySymbols = createSymbolTable();
22110
+ return resolveNameHelper;
22111
+ function resolveNameHelper(location, nameArg, meaning, nameNotFoundMessage, isUse, excludeGlobals) {
22112
+ var _a, _b, _c;
22113
+ const originalLocation = location;
22114
+ let result;
22115
+ let lastLocation;
22116
+ let lastSelfReferenceLocation;
22117
+ let propertyWithInvalidInitializer;
22118
+ let associatedDeclarationForContainingInitializerOrBindingName;
22119
+ let withinDeferredContext = false;
22120
+ let grandparent;
22121
+ const name = isString(nameArg) ? nameArg : nameArg.escapedText;
22122
+ loop:
22123
+ while (location) {
22124
+ if (name === "const" && isConstAssertion(location)) {
22125
+ return void 0;
22126
+ }
22127
+ if (isModuleOrEnumDeclaration(location) && lastLocation && location.name === lastLocation) {
22128
+ lastLocation = location;
22129
+ location = location.parent;
22130
+ }
22131
+ if (canHaveLocals(location) && location.locals && !isGlobalSourceFile(location)) {
22132
+ if (result = lookup(location.locals, name, meaning)) {
22133
+ let useResult = true;
22134
+ if (isFunctionLike(location) && lastLocation && lastLocation !== location.body) {
22135
+ if (meaning & result.flags & 788968 /* Type */ && lastLocation.kind !== 320 /* JSDoc */) {
22136
+ useResult = result.flags & 262144 /* TypeParameter */ ? lastLocation === location.type || lastLocation.kind === 169 /* Parameter */ || lastLocation.kind === 341 /* JSDocParameterTag */ || lastLocation.kind === 342 /* JSDocReturnTag */ || lastLocation.kind === 168 /* TypeParameter */ : false;
22137
+ }
22138
+ if (meaning & result.flags & 3 /* Variable */) {
22139
+ if (useOuterVariableScopeInParameter(result, location, lastLocation)) {
22140
+ useResult = false;
22141
+ } else if (result.flags & 1 /* FunctionScopedVariable */) {
22142
+ useResult = lastLocation.kind === 169 /* Parameter */ || lastLocation === location.type && !!findAncestor(result.valueDeclaration, isParameter);
22143
+ }
22144
+ }
22145
+ } else if (location.kind === 194 /* ConditionalType */) {
22146
+ useResult = lastLocation === location.trueType;
22147
+ }
22148
+ if (useResult) {
22149
+ break loop;
22150
+ } else {
22151
+ result = void 0;
22152
+ }
22153
+ }
22154
+ }
22155
+ withinDeferredContext = withinDeferredContext || getIsDeferredContext(location, lastLocation);
22156
+ switch (location.kind) {
22157
+ case 307 /* SourceFile */:
22158
+ if (!isExternalOrCommonJsModule(location))
22159
+ break;
22160
+ case 267 /* ModuleDeclaration */:
22161
+ const moduleExports = ((_a = getSymbolOfDeclaration(location)) == null ? void 0 : _a.exports) || emptySymbols;
22162
+ if (location.kind === 307 /* SourceFile */ || isModuleDeclaration(location) && location.flags & 33554432 /* Ambient */ && !isGlobalScopeAugmentation(location)) {
22163
+ if (result = moduleExports.get("default" /* Default */)) {
22164
+ const localSymbol = getLocalSymbolForExportDefault(result);
22165
+ if (localSymbol && result.flags & meaning && localSymbol.escapedName === name) {
22166
+ break loop;
22167
+ }
22168
+ result = void 0;
22169
+ }
22170
+ const moduleExport = moduleExports.get(name);
22171
+ if (moduleExport && moduleExport.flags === 2097152 /* Alias */ && (getDeclarationOfKind(moduleExport, 281 /* ExportSpecifier */) || getDeclarationOfKind(moduleExport, 280 /* NamespaceExport */))) {
22172
+ break;
22173
+ }
22174
+ }
22175
+ if (name !== "default" /* Default */ && (result = lookup(moduleExports, name, meaning & 2623475 /* ModuleMember */))) {
22176
+ if (isSourceFile(location) && location.commonJsModuleIndicator && !((_b = result.declarations) == null ? void 0 : _b.some(isJSDocTypeAlias))) {
22177
+ result = void 0;
22178
+ } else {
22179
+ break loop;
22180
+ }
22181
+ }
22182
+ break;
22183
+ case 266 /* EnumDeclaration */:
22184
+ if (result = lookup(((_c = getSymbolOfDeclaration(location)) == null ? void 0 : _c.exports) || emptySymbols, name, meaning & 8 /* EnumMember */)) {
22185
+ if (nameNotFoundMessage && getIsolatedModules(compilerOptions) && !(location.flags & 33554432 /* Ambient */) && getSourceFileOfNode(location) !== getSourceFileOfNode(result.valueDeclaration)) {
22186
+ error2(
22187
+ originalLocation,
22188
+ Diagnostics.Cannot_access_0_from_another_file_without_qualification_when_1_is_enabled_Use_2_instead,
22189
+ unescapeLeadingUnderscores(name),
22190
+ isolatedModulesLikeFlagName,
22191
+ `${unescapeLeadingUnderscores(getSymbolOfDeclaration(location).escapedName)}.${unescapeLeadingUnderscores(name)}`
22192
+ );
22193
+ }
22194
+ break loop;
22195
+ }
22196
+ break;
22197
+ case 172 /* PropertyDeclaration */:
22198
+ if (!isStatic(location)) {
22199
+ const ctor = findConstructorDeclaration(location.parent);
22200
+ if (ctor && ctor.locals) {
22201
+ if (lookup(ctor.locals, name, meaning & 111551 /* Value */)) {
22202
+ Debug.assertNode(location, isPropertyDeclaration);
22203
+ propertyWithInvalidInitializer = location;
22204
+ }
22205
+ }
22206
+ }
22207
+ break;
22208
+ case 263 /* ClassDeclaration */:
22209
+ case 231 /* ClassExpression */:
22210
+ case 264 /* InterfaceDeclaration */:
22211
+ if (result = lookup(getSymbolOfDeclaration(location).members || emptySymbols, name, meaning & 788968 /* Type */)) {
22212
+ if (!isTypeParameterSymbolDeclaredInContainer(result, location)) {
22213
+ result = void 0;
22214
+ break;
22215
+ }
22216
+ if (lastLocation && isStatic(lastLocation)) {
22217
+ if (nameNotFoundMessage) {
22218
+ error2(originalLocation, Diagnostics.Static_members_cannot_reference_class_type_parameters);
22219
+ }
22220
+ return void 0;
22221
+ }
22222
+ break loop;
22223
+ }
22224
+ if (isClassExpression(location) && meaning & 32 /* Class */) {
22225
+ const className = location.name;
22226
+ if (className && name === className.escapedText) {
22227
+ result = location.symbol;
22228
+ break loop;
22229
+ }
22230
+ }
22231
+ break;
22232
+ case 233 /* ExpressionWithTypeArguments */:
22233
+ if (lastLocation === location.expression && location.parent.token === 96 /* ExtendsKeyword */) {
22234
+ const container = location.parent.parent;
22235
+ if (isClassLike(container) && (result = lookup(getSymbolOfDeclaration(container).members, name, meaning & 788968 /* Type */))) {
22236
+ if (nameNotFoundMessage) {
22237
+ error2(originalLocation, Diagnostics.Base_class_expressions_cannot_reference_class_type_parameters);
22238
+ }
22239
+ return void 0;
22240
+ }
22241
+ }
22242
+ break;
22243
+ case 167 /* ComputedPropertyName */:
22244
+ grandparent = location.parent.parent;
22245
+ if (isClassLike(grandparent) || grandparent.kind === 264 /* InterfaceDeclaration */) {
22246
+ if (result = lookup(getSymbolOfDeclaration(grandparent).members, name, meaning & 788968 /* Type */)) {
22247
+ if (nameNotFoundMessage) {
22248
+ error2(originalLocation, Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type);
22249
+ }
22250
+ return void 0;
22251
+ }
22252
+ }
22253
+ break;
22254
+ case 219 /* ArrowFunction */:
22255
+ if (getEmitScriptTarget(compilerOptions) >= 2 /* ES2015 */) {
22256
+ break;
22257
+ }
22258
+ case 174 /* MethodDeclaration */:
22259
+ case 176 /* Constructor */:
22260
+ case 177 /* GetAccessor */:
22261
+ case 178 /* SetAccessor */:
22262
+ case 262 /* FunctionDeclaration */:
22263
+ if (meaning & 3 /* Variable */ && name === "arguments") {
22264
+ result = argumentsSymbol;
22265
+ break loop;
22266
+ }
22267
+ break;
22268
+ case 218 /* FunctionExpression */:
22269
+ if (meaning & 3 /* Variable */ && name === "arguments") {
22270
+ result = argumentsSymbol;
22271
+ break loop;
22272
+ }
22273
+ if (meaning & 16 /* Function */) {
22274
+ const functionName = location.name;
22275
+ if (functionName && name === functionName.escapedText) {
22276
+ result = location.symbol;
22277
+ break loop;
22278
+ }
22279
+ }
22280
+ break;
22281
+ case 170 /* Decorator */:
22282
+ if (location.parent && location.parent.kind === 169 /* Parameter */) {
22283
+ location = location.parent;
22284
+ }
22285
+ if (location.parent && (isClassElement(location.parent) || location.parent.kind === 263 /* ClassDeclaration */)) {
22286
+ location = location.parent;
22287
+ }
22288
+ break;
22289
+ case 346 /* JSDocTypedefTag */:
22290
+ case 338 /* JSDocCallbackTag */:
22291
+ case 340 /* JSDocEnumTag */:
22292
+ case 351 /* JSDocImportTag */:
22293
+ const root = getJSDocRoot(location);
22294
+ if (root) {
22295
+ location = root.parent;
22296
+ }
22297
+ break;
22298
+ case 169 /* Parameter */:
22299
+ if (lastLocation && (lastLocation === location.initializer || lastLocation === location.name && isBindingPattern(lastLocation))) {
22300
+ if (!associatedDeclarationForContainingInitializerOrBindingName) {
22301
+ associatedDeclarationForContainingInitializerOrBindingName = location;
22302
+ }
22303
+ }
22304
+ break;
22305
+ case 208 /* BindingElement */:
22306
+ if (lastLocation && (lastLocation === location.initializer || lastLocation === location.name && isBindingPattern(lastLocation))) {
22307
+ if (isParameterDeclaration(location) && !associatedDeclarationForContainingInitializerOrBindingName) {
22308
+ associatedDeclarationForContainingInitializerOrBindingName = location;
22309
+ }
22310
+ }
22311
+ break;
22312
+ case 195 /* InferType */:
22313
+ if (meaning & 262144 /* TypeParameter */) {
22314
+ const parameterName = location.typeParameter.name;
22315
+ if (parameterName && name === parameterName.escapedText) {
22316
+ result = location.typeParameter.symbol;
22317
+ break loop;
22318
+ }
22319
+ }
22320
+ break;
22321
+ case 281 /* ExportSpecifier */:
22322
+ if (lastLocation && lastLocation === location.propertyName && location.parent.parent.moduleSpecifier) {
22323
+ location = location.parent.parent.parent;
22324
+ }
22325
+ break;
22326
+ }
22327
+ if (isSelfReferenceLocation(location)) {
22328
+ lastSelfReferenceLocation = location;
22329
+ }
22330
+ lastLocation = location;
22331
+ location = isJSDocTemplateTag(location) ? getEffectiveContainerForJSDocTemplateTag(location) || location.parent : isJSDocParameterTag(location) || isJSDocReturnTag(location) ? getHostSignatureFromJSDoc(location) || location.parent : location.parent;
22332
+ }
22333
+ if (isUse && result && (!lastSelfReferenceLocation || result !== lastSelfReferenceLocation.symbol)) {
22334
+ result.isReferenced |= meaning;
22335
+ }
22336
+ if (!result) {
22337
+ if (lastLocation) {
22338
+ Debug.assertNode(lastLocation, isSourceFile);
22339
+ if (lastLocation.commonJsModuleIndicator && name === "exports" && meaning & lastLocation.symbol.flags) {
22340
+ return lastLocation.symbol;
22341
+ }
22342
+ }
22343
+ if (!excludeGlobals) {
22344
+ result = lookup(globals, name, meaning);
22345
+ }
22346
+ }
22347
+ if (!result) {
22348
+ if (originalLocation && isInJSFile(originalLocation) && originalLocation.parent) {
22349
+ if (isRequireCall(
22350
+ originalLocation.parent,
22351
+ /*requireStringLiteralLikeArgument*/
22352
+ false
22353
+ )) {
22354
+ return requireSymbol;
22355
+ }
22356
+ }
22357
+ }
22358
+ if (nameNotFoundMessage) {
22359
+ if (propertyWithInvalidInitializer && onPropertyWithInvalidInitializer(originalLocation, name, propertyWithInvalidInitializer, result)) {
22360
+ return void 0;
22361
+ }
22362
+ if (!result) {
22363
+ onFailedToResolveSymbol(originalLocation, nameArg, meaning, nameNotFoundMessage);
22364
+ } else {
22365
+ onSuccessfullyResolvedSymbol(originalLocation, result, meaning, lastLocation, associatedDeclarationForContainingInitializerOrBindingName, withinDeferredContext);
22366
+ }
22367
+ }
22368
+ return result;
22369
+ }
22370
+ function useOuterVariableScopeInParameter(result, location, lastLocation) {
22371
+ const target = getEmitScriptTarget(compilerOptions);
22372
+ const functionLocation = location;
22373
+ if (isParameter(lastLocation) && functionLocation.body && result.valueDeclaration && result.valueDeclaration.pos >= functionLocation.body.pos && result.valueDeclaration.end <= functionLocation.body.end) {
22374
+ if (target >= 2 /* ES2015 */) {
22375
+ let declarationRequiresScopeChange = getRequiresScopeChangeCache(functionLocation);
22376
+ if (declarationRequiresScopeChange === void 0) {
22377
+ declarationRequiresScopeChange = forEach(functionLocation.parameters, requiresScopeChange) || false;
22378
+ setRequiresScopeChangeCache(functionLocation, declarationRequiresScopeChange);
22379
+ }
22380
+ return !declarationRequiresScopeChange;
22381
+ }
22382
+ }
22383
+ return false;
22384
+ function requiresScopeChange(node) {
22385
+ return requiresScopeChangeWorker(node.name) || !!node.initializer && requiresScopeChangeWorker(node.initializer);
22386
+ }
22387
+ function requiresScopeChangeWorker(node) {
22388
+ switch (node.kind) {
22389
+ case 219 /* ArrowFunction */:
22390
+ case 218 /* FunctionExpression */:
22391
+ case 262 /* FunctionDeclaration */:
22392
+ case 176 /* Constructor */:
22393
+ return false;
22394
+ case 174 /* MethodDeclaration */:
22395
+ case 177 /* GetAccessor */:
22396
+ case 178 /* SetAccessor */:
22397
+ case 303 /* PropertyAssignment */:
22398
+ return requiresScopeChangeWorker(node.name);
22399
+ case 172 /* PropertyDeclaration */:
22400
+ if (hasStaticModifier(node)) {
22401
+ return !emitStandardClassFields;
22402
+ }
22403
+ return requiresScopeChangeWorker(node.name);
22404
+ default:
22405
+ if (isNullishCoalesce(node) || isOptionalChain(node)) {
22406
+ return target < 7 /* ES2020 */;
22407
+ }
22408
+ if (isBindingElement(node) && node.dotDotDotToken && isObjectBindingPattern(node.parent)) {
22409
+ return target < 4 /* ES2017 */;
22410
+ }
22411
+ if (isTypeNode(node))
22412
+ return false;
22413
+ return forEachChild(node, requiresScopeChangeWorker) || false;
22414
+ }
22415
+ }
22416
+ }
22417
+ function getIsDeferredContext(location, lastLocation) {
22418
+ if (location.kind !== 219 /* ArrowFunction */ && location.kind !== 218 /* FunctionExpression */) {
22419
+ return isTypeQueryNode(location) || (isFunctionLikeDeclaration(location) || location.kind === 172 /* PropertyDeclaration */ && !isStatic(location)) && (!lastLocation || lastLocation !== location.name);
22420
+ }
22421
+ if (lastLocation && lastLocation === location.name) {
22422
+ return false;
22423
+ }
22424
+ if (location.asteriskToken || hasSyntacticModifier(location, 1024 /* Async */)) {
22425
+ return true;
22426
+ }
22427
+ return !getImmediatelyInvokedFunctionExpression(location);
22428
+ }
22429
+ function isSelfReferenceLocation(node) {
22430
+ switch (node.kind) {
22431
+ case 262 /* FunctionDeclaration */:
22432
+ case 263 /* ClassDeclaration */:
22433
+ case 264 /* InterfaceDeclaration */:
22434
+ case 266 /* EnumDeclaration */:
22435
+ case 265 /* TypeAliasDeclaration */:
22436
+ case 267 /* ModuleDeclaration */:
22437
+ return true;
22438
+ default:
22439
+ return false;
22440
+ }
22441
+ }
22442
+ function isTypeParameterSymbolDeclaredInContainer(symbol, container) {
22443
+ if (symbol.declarations) {
22444
+ for (const decl of symbol.declarations) {
22445
+ if (decl.kind === 168 /* TypeParameter */) {
22446
+ const parent2 = isJSDocTemplateTag(decl.parent) ? getJSDocHost(decl.parent) : decl.parent;
22447
+ if (parent2 === container) {
22448
+ return !(isJSDocTemplateTag(decl.parent) && find(decl.parent.parent.tags, isJSDocTypeAlias));
22449
+ }
22450
+ }
22451
+ }
22452
+ }
22453
+ return false;
22454
+ }
22455
+ }
22072
22456
 
22073
22457
  // src/compiler/factory/baseNodeFactory.ts
22074
22458
  function createBaseNodeFactory() {
@@ -38685,6 +39069,7 @@ var targetOptionDeclaration = {
38685
39069
  es2020: 7 /* ES2020 */,
38686
39070
  es2021: 8 /* ES2021 */,
38687
39071
  es2022: 9 /* ES2022 */,
39072
+ es2023: 10 /* ES2023 */,
38688
39073
  esnext: 99 /* ESNext */
38689
39074
  })),
38690
39075
  affectsSourceFile: true,
@@ -48434,6 +48819,31 @@ function createTypeChecker(host) {
48434
48819
  var lastGetCombinedNodeFlagsResult = 0 /* None */;
48435
48820
  var lastGetCombinedModifierFlagsNode;
48436
48821
  var lastGetCombinedModifierFlagsResult = 0 /* None */;
48822
+ var resolveName = createNameResolver({
48823
+ compilerOptions,
48824
+ requireSymbol,
48825
+ argumentsSymbol,
48826
+ globals,
48827
+ getSymbolOfDeclaration,
48828
+ error: error2,
48829
+ getRequiresScopeChangeCache,
48830
+ setRequiresScopeChangeCache,
48831
+ lookup: getSymbol2,
48832
+ onPropertyWithInvalidInitializer: checkAndReportErrorForInvalidInitializer,
48833
+ onFailedToResolveSymbol,
48834
+ onSuccessfullyResolvedSymbol
48835
+ });
48836
+ var resolveNameForSymbolSuggestion = createNameResolver({
48837
+ compilerOptions,
48838
+ requireSymbol,
48839
+ argumentsSymbol,
48840
+ globals,
48841
+ getSymbolOfDeclaration,
48842
+ error: error2,
48843
+ getRequiresScopeChangeCache,
48844
+ setRequiresScopeChangeCache,
48845
+ lookup: getSuggestionForSymbolNameLookup
48846
+ });
48437
48847
  const checker = {
48438
48848
  getNodeCount: () => reduceLeft(host.getSourceFiles(), (n, s) => n + s.nodeCount, 0),
48439
48849
  getIdentifierCount: () => reduceLeft(host.getSourceFiles(), (n, s) => n + s.identifierCount, 0),
@@ -48739,8 +49149,6 @@ function createTypeChecker(host) {
48739
49149
  meaning,
48740
49150
  /*nameNotFoundMessage*/
48741
49151
  void 0,
48742
- /*nameArg*/
48743
- void 0,
48744
49152
  /*isUse*/
48745
49153
  false,
48746
49154
  excludeGlobals
@@ -49770,9 +50178,6 @@ function createTypeChecker(host) {
49770
50178
  const nodeId = getNodeId(node);
49771
50179
  return nodeLinks[nodeId] || (nodeLinks[nodeId] = new NodeLinks());
49772
50180
  }
49773
- function isGlobalSourceFile(node) {
49774
- return node.kind === 307 /* SourceFile */ && !isExternalOrCommonJsModule(node);
49775
- }
49776
50181
  function getSymbol2(symbols, name, meaning) {
49777
50182
  if (meaning) {
49778
50183
  const symbol = getMergedSymbol(symbols.get(name));
@@ -49948,417 +50353,120 @@ function createTypeChecker(host) {
49948
50353
  return ancestorChangingReferenceScope === void 0;
49949
50354
  }
49950
50355
  }
49951
- function useOuterVariableScopeInParameter(result, location, lastLocation) {
49952
- const target = getEmitScriptTarget(compilerOptions);
49953
- const functionLocation = location;
49954
- if (isParameter(lastLocation) && functionLocation.body && result.valueDeclaration && result.valueDeclaration.pos >= functionLocation.body.pos && result.valueDeclaration.end <= functionLocation.body.end) {
49955
- if (target >= 2 /* ES2015 */) {
49956
- const links = getNodeLinks(functionLocation);
49957
- if (links.declarationRequiresScopeChange === void 0) {
49958
- links.declarationRequiresScopeChange = forEach(functionLocation.parameters, requiresScopeChange) || false;
49959
- }
49960
- return !links.declarationRequiresScopeChange;
50356
+ function getRequiresScopeChangeCache(node) {
50357
+ return getNodeLinks(node).declarationRequiresScopeChange;
50358
+ }
50359
+ function setRequiresScopeChangeCache(node, value) {
50360
+ getNodeLinks(node).declarationRequiresScopeChange = value;
50361
+ }
50362
+ function checkAndReportErrorForInvalidInitializer(errorLocation, name, propertyWithInvalidInitializer, result) {
50363
+ if (!emitStandardClassFields) {
50364
+ if (errorLocation && !result && checkAndReportErrorForMissingPrefix(errorLocation, name, name)) {
50365
+ return true;
49961
50366
  }
50367
+ error2(
50368
+ errorLocation,
50369
+ errorLocation && propertyWithInvalidInitializer.type && textRangeContainsPositionInclusive(propertyWithInvalidInitializer.type, errorLocation.pos) ? Diagnostics.Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor : Diagnostics.Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor,
50370
+ declarationNameToString(propertyWithInvalidInitializer.name),
50371
+ diagnosticName(name)
50372
+ );
50373
+ return true;
49962
50374
  }
49963
50375
  return false;
49964
- function requiresScopeChange(node) {
49965
- return requiresScopeChangeWorker(node.name) || !!node.initializer && requiresScopeChangeWorker(node.initializer);
49966
- }
49967
- function requiresScopeChangeWorker(node) {
49968
- switch (node.kind) {
49969
- case 219 /* ArrowFunction */:
49970
- case 218 /* FunctionExpression */:
49971
- case 262 /* FunctionDeclaration */:
49972
- case 176 /* Constructor */:
49973
- return false;
49974
- case 174 /* MethodDeclaration */:
49975
- case 177 /* GetAccessor */:
49976
- case 178 /* SetAccessor */:
49977
- case 303 /* PropertyAssignment */:
49978
- return requiresScopeChangeWorker(node.name);
49979
- case 172 /* PropertyDeclaration */:
49980
- if (hasStaticModifier(node)) {
49981
- return !emitStandardClassFields;
49982
- }
49983
- return requiresScopeChangeWorker(node.name);
49984
- default:
49985
- if (isNullishCoalesce(node) || isOptionalChain(node)) {
49986
- return target < 7 /* ES2020 */;
49987
- }
49988
- if (isBindingElement(node) && node.dotDotDotToken && isObjectBindingPattern(node.parent)) {
49989
- return target < 4 /* ES2017 */;
49990
- }
49991
- if (isTypeNode(node))
49992
- return false;
49993
- return forEachChild(node, requiresScopeChangeWorker) || false;
49994
- }
49995
- }
49996
- }
49997
- function isConstAssertion(location) {
49998
- return isAssertionExpression(location) && isConstTypeReference(location.type) || isJSDocTypeTag(location) && isConstTypeReference(location.typeExpression);
49999
- }
50000
- function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals = false, getSpellingSuggestions = true) {
50001
- return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, getSymbol2);
50002
50376
  }
50003
- function resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, lookup) {
50004
- var _a, _b, _c;
50005
- const originalLocation = location;
50006
- let result;
50007
- let lastLocation;
50008
- let lastSelfReferenceLocation;
50009
- let propertyWithInvalidInitializer;
50010
- let associatedDeclarationForContainingInitializerOrBindingName;
50011
- let withinDeferredContext = false;
50012
- const errorLocation = location;
50013
- let grandparent;
50014
- let isInExternalModule = false;
50015
- loop:
50016
- while (location) {
50017
- if (name === "const" && isConstAssertion(location)) {
50018
- return void 0;
50019
- }
50020
- if (isModuleOrEnumDeclaration(location) && lastLocation && location.name === lastLocation) {
50021
- lastLocation = location;
50022
- location = location.parent;
50023
- }
50024
- if (canHaveLocals(location) && location.locals && !isGlobalSourceFile(location)) {
50025
- if (result = lookup(location.locals, name, meaning)) {
50026
- let useResult = true;
50027
- if (isFunctionLike(location) && lastLocation && lastLocation !== location.body) {
50028
- if (meaning & result.flags & 788968 /* Type */ && lastLocation.kind !== 320 /* JSDoc */) {
50029
- useResult = result.flags & 262144 /* TypeParameter */ ? lastLocation === location.type || lastLocation.kind === 169 /* Parameter */ || lastLocation.kind === 341 /* JSDocParameterTag */ || lastLocation.kind === 342 /* JSDocReturnTag */ || lastLocation.kind === 168 /* TypeParameter */ : false;
50030
- }
50031
- if (meaning & result.flags & 3 /* Variable */) {
50032
- if (useOuterVariableScopeInParameter(result, location, lastLocation)) {
50033
- useResult = false;
50034
- } else if (result.flags & 1 /* FunctionScopedVariable */) {
50035
- useResult = lastLocation.kind === 169 /* Parameter */ || lastLocation === location.type && !!findAncestor(result.valueDeclaration, isParameter);
50036
- }
50037
- }
50038
- } else if (location.kind === 194 /* ConditionalType */) {
50039
- useResult = lastLocation === location.trueType;
50040
- }
50041
- if (useResult) {
50042
- break loop;
50043
- } else {
50044
- result = void 0;
50377
+ function onFailedToResolveSymbol(errorLocation, nameArg, meaning, nameNotFoundMessage) {
50378
+ const name = isString(nameArg) ? nameArg : nameArg.escapedText;
50379
+ addLazyDiagnostic(() => {
50380
+ if (!errorLocation || errorLocation.parent.kind !== 324 /* JSDocLink */ && !checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) && !checkAndReportErrorForExtendingInterface(errorLocation) && !checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) && !checkAndReportErrorForExportingPrimitiveType(errorLocation, name) && !checkAndReportErrorForUsingNamespaceAsTypeOrValue(errorLocation, name, meaning) && !checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) && !checkAndReportErrorForUsingValueAsType(errorLocation, name, meaning)) {
50381
+ let suggestion;
50382
+ let suggestedLib;
50383
+ if (nameArg) {
50384
+ suggestedLib = getSuggestedLibForNonExistentName(nameArg);
50385
+ if (suggestedLib) {
50386
+ error2(errorLocation, nameNotFoundMessage, diagnosticName(nameArg), suggestedLib);
50387
+ }
50388
+ }
50389
+ if (!suggestedLib && suggestionCount < maximumSuggestionCount) {
50390
+ suggestion = getSuggestedSymbolForNonexistentSymbol(errorLocation, name, meaning);
50391
+ const isGlobalScopeAugmentationDeclaration = (suggestion == null ? void 0 : suggestion.valueDeclaration) && isAmbientModule(suggestion.valueDeclaration) && isGlobalScopeAugmentation(suggestion.valueDeclaration);
50392
+ if (isGlobalScopeAugmentationDeclaration) {
50393
+ suggestion = void 0;
50394
+ }
50395
+ if (suggestion) {
50396
+ const suggestionName = symbolToString(suggestion);
50397
+ const isUncheckedJS = isUncheckedJSSuggestion(
50398
+ errorLocation,
50399
+ suggestion,
50400
+ /*excludeClasses*/
50401
+ false
50402
+ );
50403
+ const message = meaning === 1920 /* Namespace */ || nameArg && typeof nameArg !== "string" && nodeIsSynthesized(nameArg) ? Diagnostics.Cannot_find_namespace_0_Did_you_mean_1 : isUncheckedJS ? Diagnostics.Could_not_find_name_0_Did_you_mean_1 : Diagnostics.Cannot_find_name_0_Did_you_mean_1;
50404
+ const diagnostic = createError(errorLocation, message, diagnosticName(nameArg), suggestionName);
50405
+ addErrorOrSuggestion(!isUncheckedJS, diagnostic);
50406
+ if (suggestion.valueDeclaration) {
50407
+ addRelatedInfo(
50408
+ diagnostic,
50409
+ createDiagnosticForNode(suggestion.valueDeclaration, Diagnostics._0_is_declared_here, suggestionName)
50410
+ );
50045
50411
  }
50046
50412
  }
50047
50413
  }
50048
- withinDeferredContext = withinDeferredContext || getIsDeferredContext(location, lastLocation);
50049
- switch (location.kind) {
50050
- case 307 /* SourceFile */:
50051
- if (!isExternalOrCommonJsModule(location))
50052
- break;
50053
- isInExternalModule = true;
50054
- case 267 /* ModuleDeclaration */:
50055
- const moduleExports = ((_a = getSymbolOfDeclaration(location)) == null ? void 0 : _a.exports) || emptySymbols;
50056
- if (location.kind === 307 /* SourceFile */ || isModuleDeclaration(location) && location.flags & 33554432 /* Ambient */ && !isGlobalScopeAugmentation(location)) {
50057
- if (result = moduleExports.get("default" /* Default */)) {
50058
- const localSymbol = getLocalSymbolForExportDefault(result);
50059
- if (localSymbol && result.flags & meaning && localSymbol.escapedName === name) {
50060
- break loop;
50061
- }
50062
- result = void 0;
50063
- }
50064
- const moduleExport = moduleExports.get(name);
50065
- if (moduleExport && moduleExport.flags === 2097152 /* Alias */ && (getDeclarationOfKind(moduleExport, 281 /* ExportSpecifier */) || getDeclarationOfKind(moduleExport, 280 /* NamespaceExport */))) {
50066
- break;
50067
- }
50068
- }
50069
- if (name !== "default" /* Default */ && (result = lookup(moduleExports, name, meaning & 2623475 /* ModuleMember */))) {
50070
- if (isSourceFile(location) && location.commonJsModuleIndicator && !((_b = result.declarations) == null ? void 0 : _b.some(isJSDocTypeAlias))) {
50071
- result = void 0;
50072
- } else {
50073
- break loop;
50074
- }
50075
- }
50076
- break;
50077
- case 266 /* EnumDeclaration */:
50078
- if (result = lookup(((_c = getSymbolOfDeclaration(location)) == null ? void 0 : _c.exports) || emptySymbols, name, meaning & 8 /* EnumMember */)) {
50079
- if (nameNotFoundMessage && getIsolatedModules(compilerOptions) && !(location.flags & 33554432 /* Ambient */) && getSourceFileOfNode(location) !== getSourceFileOfNode(result.valueDeclaration)) {
50080
- error2(
50081
- errorLocation,
50082
- Diagnostics.Cannot_access_0_from_another_file_without_qualification_when_1_is_enabled_Use_2_instead,
50083
- unescapeLeadingUnderscores(name),
50084
- isolatedModulesLikeFlagName,
50085
- `${unescapeLeadingUnderscores(getSymbolOfNode(location).escapedName)}.${unescapeLeadingUnderscores(name)}`
50086
- );
50087
- }
50088
- break loop;
50089
- }
50090
- break;
50091
- case 172 /* PropertyDeclaration */:
50092
- if (!isStatic(location)) {
50093
- const ctor = findConstructorDeclaration(location.parent);
50094
- if (ctor && ctor.locals) {
50095
- if (lookup(ctor.locals, name, meaning & 111551 /* Value */)) {
50096
- Debug.assertNode(location, isPropertyDeclaration);
50097
- propertyWithInvalidInitializer = location;
50098
- }
50099
- }
50100
- }
50101
- break;
50102
- case 263 /* ClassDeclaration */:
50103
- case 231 /* ClassExpression */:
50104
- case 264 /* InterfaceDeclaration */:
50105
- if (result = lookup(getSymbolOfDeclaration(location).members || emptySymbols, name, meaning & 788968 /* Type */)) {
50106
- if (!isTypeParameterSymbolDeclaredInContainer(result, location)) {
50107
- result = void 0;
50108
- break;
50109
- }
50110
- if (lastLocation && isStatic(lastLocation)) {
50111
- if (nameNotFoundMessage) {
50112
- error2(errorLocation, Diagnostics.Static_members_cannot_reference_class_type_parameters);
50113
- }
50114
- return void 0;
50115
- }
50116
- break loop;
50117
- }
50118
- if (isClassExpression(location) && meaning & 32 /* Class */) {
50119
- const className = location.name;
50120
- if (className && name === className.escapedText) {
50121
- result = location.symbol;
50122
- break loop;
50123
- }
50124
- }
50125
- break;
50126
- case 233 /* ExpressionWithTypeArguments */:
50127
- if (lastLocation === location.expression && location.parent.token === 96 /* ExtendsKeyword */) {
50128
- const container = location.parent.parent;
50129
- if (isClassLike(container) && (result = lookup(getSymbolOfDeclaration(container).members, name, meaning & 788968 /* Type */))) {
50130
- if (nameNotFoundMessage) {
50131
- error2(errorLocation, Diagnostics.Base_class_expressions_cannot_reference_class_type_parameters);
50132
- }
50133
- return void 0;
50134
- }
50135
- }
50136
- break;
50137
- case 167 /* ComputedPropertyName */:
50138
- grandparent = location.parent.parent;
50139
- if (isClassLike(grandparent) || grandparent.kind === 264 /* InterfaceDeclaration */) {
50140
- if (result = lookup(getSymbolOfDeclaration(grandparent).members, name, meaning & 788968 /* Type */)) {
50141
- if (nameNotFoundMessage) {
50142
- error2(errorLocation, Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type);
50143
- }
50144
- return void 0;
50145
- }
50146
- }
50147
- break;
50148
- case 219 /* ArrowFunction */:
50149
- if (getEmitScriptTarget(compilerOptions) >= 2 /* ES2015 */) {
50150
- break;
50151
- }
50152
- case 174 /* MethodDeclaration */:
50153
- case 176 /* Constructor */:
50154
- case 177 /* GetAccessor */:
50155
- case 178 /* SetAccessor */:
50156
- case 262 /* FunctionDeclaration */:
50157
- if (meaning & 3 /* Variable */ && name === "arguments") {
50158
- result = argumentsSymbol;
50159
- break loop;
50160
- }
50161
- break;
50162
- case 218 /* FunctionExpression */:
50163
- if (meaning & 3 /* Variable */ && name === "arguments") {
50164
- result = argumentsSymbol;
50165
- break loop;
50166
- }
50167
- if (meaning & 16 /* Function */) {
50168
- const functionName = location.name;
50169
- if (functionName && name === functionName.escapedText) {
50170
- result = location.symbol;
50171
- break loop;
50172
- }
50173
- }
50174
- break;
50175
- case 170 /* Decorator */:
50176
- if (location.parent && location.parent.kind === 169 /* Parameter */) {
50177
- location = location.parent;
50178
- }
50179
- if (location.parent && (isClassElement(location.parent) || location.parent.kind === 263 /* ClassDeclaration */)) {
50180
- location = location.parent;
50181
- }
50182
- break;
50183
- case 346 /* JSDocTypedefTag */:
50184
- case 338 /* JSDocCallbackTag */:
50185
- case 340 /* JSDocEnumTag */:
50186
- case 351 /* JSDocImportTag */:
50187
- const root = getJSDocRoot(location);
50188
- if (root) {
50189
- location = root.parent;
50190
- }
50191
- break;
50192
- case 169 /* Parameter */:
50193
- if (lastLocation && (lastLocation === location.initializer || lastLocation === location.name && isBindingPattern(lastLocation))) {
50194
- if (!associatedDeclarationForContainingInitializerOrBindingName) {
50195
- associatedDeclarationForContainingInitializerOrBindingName = location;
50196
- }
50197
- }
50198
- break;
50199
- case 208 /* BindingElement */:
50200
- if (lastLocation && (lastLocation === location.initializer || lastLocation === location.name && isBindingPattern(lastLocation))) {
50201
- if (isParameterDeclaration(location) && !associatedDeclarationForContainingInitializerOrBindingName) {
50202
- associatedDeclarationForContainingInitializerOrBindingName = location;
50203
- }
50204
- }
50205
- break;
50206
- case 195 /* InferType */:
50207
- if (meaning & 262144 /* TypeParameter */) {
50208
- const parameterName = location.typeParameter.name;
50209
- if (parameterName && name === parameterName.escapedText) {
50210
- result = location.typeParameter.symbol;
50211
- break loop;
50212
- }
50213
- }
50214
- break;
50215
- case 281 /* ExportSpecifier */:
50216
- if (lastLocation && lastLocation === location.propertyName && location.parent.parent.moduleSpecifier) {
50217
- location = location.parent.parent.parent;
50218
- }
50219
- break;
50220
- }
50221
- if (isSelfReferenceLocation(location)) {
50222
- lastSelfReferenceLocation = location;
50223
- }
50224
- lastLocation = location;
50225
- location = isJSDocTemplateTag(location) ? getEffectiveContainerForJSDocTemplateTag(location) || location.parent : isJSDocParameterTag(location) || isJSDocReturnTag(location) ? getHostSignatureFromJSDoc(location) || location.parent : location.parent;
50226
- }
50227
- if (isUse && result && (!lastSelfReferenceLocation || result !== lastSelfReferenceLocation.symbol)) {
50228
- result.isReferenced |= meaning;
50229
- }
50230
- if (!result) {
50231
- if (lastLocation) {
50232
- Debug.assertNode(lastLocation, isSourceFile);
50233
- if (lastLocation.commonJsModuleIndicator && name === "exports" && meaning & lastLocation.symbol.flags) {
50234
- return lastLocation.symbol;
50414
+ if (!suggestion && !suggestedLib && nameArg) {
50415
+ error2(errorLocation, nameNotFoundMessage, diagnosticName(nameArg));
50235
50416
  }
50417
+ suggestionCount++;
50236
50418
  }
50237
- if (!excludeGlobals) {
50238
- result = lookup(globals, name, meaning);
50239
- }
50240
- }
50241
- if (!result) {
50242
- if (originalLocation && isInJSFile(originalLocation) && originalLocation.parent) {
50243
- if (isRequireCall(
50244
- originalLocation.parent,
50245
- /*requireStringLiteralLikeArgument*/
50246
- false
50247
- )) {
50248
- return requireSymbol;
50419
+ });
50420
+ }
50421
+ function onSuccessfullyResolvedSymbol(errorLocation, result, meaning, lastLocation, associatedDeclarationForContainingInitializerOrBindingName, withinDeferredContext) {
50422
+ addLazyDiagnostic(() => {
50423
+ var _a;
50424
+ const name = result.escapedName;
50425
+ const isInExternalModule = lastLocation && isSourceFile(lastLocation) && isExternalOrCommonJsModule(lastLocation);
50426
+ if (errorLocation && (meaning & 2 /* BlockScopedVariable */ || (meaning & 32 /* Class */ || meaning & 384 /* Enum */) && (meaning & 111551 /* Value */) === 111551 /* Value */)) {
50427
+ const exportOrLocalSymbol = getExportSymbolOfValueSymbolIfExported(result);
50428
+ if (exportOrLocalSymbol.flags & 2 /* BlockScopedVariable */ || exportOrLocalSymbol.flags & 32 /* Class */ || exportOrLocalSymbol.flags & 384 /* Enum */) {
50429
+ checkResolvedBlockScopedVariable(exportOrLocalSymbol, errorLocation);
50430
+ }
50431
+ }
50432
+ if (isInExternalModule && (meaning & 111551 /* Value */) === 111551 /* Value */ && !(errorLocation.flags & 16777216 /* JSDoc */)) {
50433
+ const merged = getMergedSymbol(result);
50434
+ if (length(merged.declarations) && every(merged.declarations, (d) => isNamespaceExportDeclaration(d) || isSourceFile(d) && !!d.symbol.globalExports)) {
50435
+ errorOrSuggestion(!compilerOptions.allowUmdGlobalAccess, errorLocation, Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, unescapeLeadingUnderscores(name));
50436
+ }
50437
+ }
50438
+ if (associatedDeclarationForContainingInitializerOrBindingName && !withinDeferredContext && (meaning & 111551 /* Value */) === 111551 /* Value */) {
50439
+ const candidate = getMergedSymbol(getLateBoundSymbol(result));
50440
+ const root = getRootDeclaration(associatedDeclarationForContainingInitializerOrBindingName);
50441
+ if (candidate === getSymbolOfDeclaration(associatedDeclarationForContainingInitializerOrBindingName)) {
50442
+ error2(errorLocation, Diagnostics.Parameter_0_cannot_reference_itself, declarationNameToString(associatedDeclarationForContainingInitializerOrBindingName.name));
50443
+ } else if (candidate.valueDeclaration && candidate.valueDeclaration.pos > associatedDeclarationForContainingInitializerOrBindingName.pos && root.parent.locals && getSymbol2(root.parent.locals, candidate.escapedName, meaning) === candidate) {
50444
+ error2(errorLocation, Diagnostics.Parameter_0_cannot_reference_identifier_1_declared_after_it, declarationNameToString(associatedDeclarationForContainingInitializerOrBindingName.name), declarationNameToString(errorLocation));
50445
+ }
50446
+ }
50447
+ if (errorLocation && meaning & 111551 /* Value */ && result.flags & 2097152 /* Alias */ && !(result.flags & 111551 /* Value */) && !isValidTypeOnlyAliasUseSite(errorLocation)) {
50448
+ const typeOnlyDeclaration = getTypeOnlyAliasDeclaration(result, 111551 /* Value */);
50449
+ if (typeOnlyDeclaration) {
50450
+ const message = typeOnlyDeclaration.kind === 281 /* ExportSpecifier */ || typeOnlyDeclaration.kind === 278 /* ExportDeclaration */ || typeOnlyDeclaration.kind === 280 /* NamespaceExport */ ? Diagnostics._0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type : Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type;
50451
+ const unescapedName = unescapeLeadingUnderscores(name);
50452
+ addTypeOnlyDeclarationRelatedInfo(
50453
+ error2(errorLocation, message, unescapedName),
50454
+ typeOnlyDeclaration,
50455
+ unescapedName
50456
+ );
50249
50457
  }
50250
50458
  }
50251
- }
50252
- function checkAndReportErrorForInvalidInitializer() {
50253
- if (propertyWithInvalidInitializer && !emitStandardClassFields) {
50254
- error2(
50255
- errorLocation,
50256
- errorLocation && propertyWithInvalidInitializer.type && textRangeContainsPositionInclusive(propertyWithInvalidInitializer.type, errorLocation.pos) ? Diagnostics.Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor : Diagnostics.Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor,
50257
- declarationNameToString(propertyWithInvalidInitializer.name),
50258
- diagnosticName(nameArg)
50259
- );
50260
- return true;
50261
- }
50262
- return false;
50263
- }
50264
- if (!result) {
50265
- if (nameNotFoundMessage) {
50266
- addLazyDiagnostic(() => {
50267
- if (!errorLocation || errorLocation.parent.kind !== 324 /* JSDocLink */ && !checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) && // TODO: GH#18217
50268
- !checkAndReportErrorForInvalidInitializer() && !checkAndReportErrorForExtendingInterface(errorLocation) && !checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) && !checkAndReportErrorForExportingPrimitiveType(errorLocation, name) && !checkAndReportErrorForUsingNamespaceAsTypeOrValue(errorLocation, name, meaning) && !checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) && !checkAndReportErrorForUsingValueAsType(errorLocation, name, meaning)) {
50269
- let suggestion;
50270
- let suggestedLib;
50271
- if (nameArg) {
50272
- suggestedLib = getSuggestedLibForNonExistentName(nameArg);
50273
- if (suggestedLib) {
50274
- error2(errorLocation, nameNotFoundMessage, diagnosticName(nameArg), suggestedLib);
50275
- }
50276
- }
50277
- if (!suggestedLib && getSpellingSuggestions && suggestionCount < maximumSuggestionCount) {
50278
- suggestion = getSuggestedSymbolForNonexistentSymbol(originalLocation, name, meaning);
50279
- const isGlobalScopeAugmentationDeclaration = (suggestion == null ? void 0 : suggestion.valueDeclaration) && isAmbientModule(suggestion.valueDeclaration) && isGlobalScopeAugmentation(suggestion.valueDeclaration);
50280
- if (isGlobalScopeAugmentationDeclaration) {
50281
- suggestion = void 0;
50282
- }
50283
- if (suggestion) {
50284
- const suggestionName = symbolToString(suggestion);
50285
- const isUncheckedJS = isUncheckedJSSuggestion(
50286
- originalLocation,
50287
- suggestion,
50288
- /*excludeClasses*/
50289
- false
50290
- );
50291
- const message = meaning === 1920 /* Namespace */ || nameArg && typeof nameArg !== "string" && nodeIsSynthesized(nameArg) ? Diagnostics.Cannot_find_namespace_0_Did_you_mean_1 : isUncheckedJS ? Diagnostics.Could_not_find_name_0_Did_you_mean_1 : Diagnostics.Cannot_find_name_0_Did_you_mean_1;
50292
- const diagnostic = createError(errorLocation, message, diagnosticName(nameArg), suggestionName);
50293
- addErrorOrSuggestion(!isUncheckedJS, diagnostic);
50294
- if (suggestion.valueDeclaration) {
50295
- addRelatedInfo(
50296
- diagnostic,
50297
- createDiagnosticForNode(suggestion.valueDeclaration, Diagnostics._0_is_declared_here, suggestionName)
50298
- );
50299
- }
50300
- }
50301
- }
50302
- if (!suggestion && !suggestedLib && nameArg) {
50303
- error2(errorLocation, nameNotFoundMessage, diagnosticName(nameArg));
50304
- }
50305
- suggestionCount++;
50306
- }
50307
- });
50308
- }
50309
- return void 0;
50310
- } else if (nameNotFoundMessage && checkAndReportErrorForInvalidInitializer()) {
50311
- return void 0;
50312
- }
50313
- if (nameNotFoundMessage) {
50314
- addLazyDiagnostic(() => {
50315
- var _a2;
50316
- if (errorLocation && (meaning & 2 /* BlockScopedVariable */ || (meaning & 32 /* Class */ || meaning & 384 /* Enum */) && (meaning & 111551 /* Value */) === 111551 /* Value */)) {
50317
- const exportOrLocalSymbol = getExportSymbolOfValueSymbolIfExported(result);
50318
- if (exportOrLocalSymbol.flags & 2 /* BlockScopedVariable */ || exportOrLocalSymbol.flags & 32 /* Class */ || exportOrLocalSymbol.flags & 384 /* Enum */) {
50319
- checkResolvedBlockScopedVariable(exportOrLocalSymbol, errorLocation);
50320
- }
50321
- }
50322
- if (result && isInExternalModule && (meaning & 111551 /* Value */) === 111551 /* Value */ && !(originalLocation.flags & 16777216 /* JSDoc */)) {
50323
- const merged = getMergedSymbol(result);
50324
- if (length(merged.declarations) && every(merged.declarations, (d) => isNamespaceExportDeclaration(d) || isSourceFile(d) && !!d.symbol.globalExports)) {
50325
- errorOrSuggestion(!compilerOptions.allowUmdGlobalAccess, errorLocation, Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, unescapeLeadingUnderscores(name));
50326
- }
50327
- }
50328
- if (result && associatedDeclarationForContainingInitializerOrBindingName && !withinDeferredContext && (meaning & 111551 /* Value */) === 111551 /* Value */) {
50329
- const candidate = getMergedSymbol(getLateBoundSymbol(result));
50330
- const root = getRootDeclaration(associatedDeclarationForContainingInitializerOrBindingName);
50331
- if (candidate === getSymbolOfDeclaration(associatedDeclarationForContainingInitializerOrBindingName)) {
50332
- error2(errorLocation, Diagnostics.Parameter_0_cannot_reference_itself, declarationNameToString(associatedDeclarationForContainingInitializerOrBindingName.name));
50333
- } else if (candidate.valueDeclaration && candidate.valueDeclaration.pos > associatedDeclarationForContainingInitializerOrBindingName.pos && root.parent.locals && lookup(root.parent.locals, candidate.escapedName, meaning) === candidate) {
50334
- error2(errorLocation, Diagnostics.Parameter_0_cannot_reference_identifier_1_declared_after_it, declarationNameToString(associatedDeclarationForContainingInitializerOrBindingName.name), declarationNameToString(errorLocation));
50335
- }
50336
- }
50337
- if (result && errorLocation && meaning & 111551 /* Value */ && result.flags & 2097152 /* Alias */ && !(result.flags & 111551 /* Value */) && !isValidTypeOnlyAliasUseSite(errorLocation)) {
50338
- const typeOnlyDeclaration = getTypeOnlyAliasDeclaration(result, 111551 /* Value */);
50339
- if (typeOnlyDeclaration) {
50340
- const message = typeOnlyDeclaration.kind === 281 /* ExportSpecifier */ || typeOnlyDeclaration.kind === 278 /* ExportDeclaration */ || typeOnlyDeclaration.kind === 280 /* NamespaceExport */ ? Diagnostics._0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type : Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type;
50341
- const unescapedName = unescapeLeadingUnderscores(name);
50342
- addTypeOnlyDeclarationRelatedInfo(
50343
- error2(errorLocation, message, unescapedName),
50344
- typeOnlyDeclaration,
50345
- unescapedName
50346
- );
50347
- }
50348
- }
50349
- if (compilerOptions.isolatedModules && result && isInExternalModule && (meaning & 111551 /* Value */) === 111551 /* Value */) {
50350
- const isGlobal = lookup(globals, name, meaning) === result;
50351
- const nonValueSymbol = isGlobal && isSourceFile(lastLocation) && lastLocation.locals && lookup(lastLocation.locals, name, ~111551 /* Value */);
50352
- if (nonValueSymbol) {
50353
- const importDecl = (_a2 = nonValueSymbol.declarations) == null ? void 0 : _a2.find((d) => d.kind === 276 /* ImportSpecifier */ || d.kind === 273 /* ImportClause */ || d.kind === 274 /* NamespaceImport */ || d.kind === 271 /* ImportEqualsDeclaration */);
50354
- if (importDecl && !isTypeOnlyImportDeclaration(importDecl)) {
50355
- error2(importDecl, Diagnostics.Import_0_conflicts_with_global_value_used_in_this_file_so_must_be_declared_with_a_type_only_import_when_isolatedModules_is_enabled, unescapeLeadingUnderscores(name));
50356
- }
50459
+ if (compilerOptions.isolatedModules && result && isInExternalModule && (meaning & 111551 /* Value */) === 111551 /* Value */) {
50460
+ const isGlobal = getSymbol2(globals, name, meaning) === result;
50461
+ const nonValueSymbol = isGlobal && isSourceFile(lastLocation) && lastLocation.locals && getSymbol2(lastLocation.locals, name, ~111551 /* Value */);
50462
+ if (nonValueSymbol) {
50463
+ const importDecl = (_a = nonValueSymbol.declarations) == null ? void 0 : _a.find((d) => d.kind === 276 /* ImportSpecifier */ || d.kind === 273 /* ImportClause */ || d.kind === 274 /* NamespaceImport */ || d.kind === 271 /* ImportEqualsDeclaration */);
50464
+ if (importDecl && !isTypeOnlyImportDeclaration(importDecl)) {
50465
+ error2(importDecl, Diagnostics.Import_0_conflicts_with_global_value_used_in_this_file_so_must_be_declared_with_a_type_only_import_when_isolatedModules_is_enabled, unescapeLeadingUnderscores(name));
50357
50466
  }
50358
50467
  }
50359
- });
50360
- }
50361
- return result;
50468
+ }
50469
+ });
50362
50470
  }
50363
50471
  function addTypeOnlyDeclarationRelatedInfo(diagnostic, typeOnlyDeclaration, unescapedName) {
50364
50472
  if (!typeOnlyDeclaration)
@@ -50372,47 +50480,9 @@ function createTypeChecker(host) {
50372
50480
  )
50373
50481
  );
50374
50482
  }
50375
- function getIsDeferredContext(location, lastLocation) {
50376
- if (location.kind !== 219 /* ArrowFunction */ && location.kind !== 218 /* FunctionExpression */) {
50377
- return isTypeQueryNode(location) || (isFunctionLikeDeclaration(location) || location.kind === 172 /* PropertyDeclaration */ && !isStatic(location)) && (!lastLocation || lastLocation !== location.name);
50378
- }
50379
- if (lastLocation && lastLocation === location.name) {
50380
- return false;
50381
- }
50382
- if (location.asteriskToken || hasSyntacticModifier(location, 1024 /* Async */)) {
50383
- return true;
50384
- }
50385
- return !getImmediatelyInvokedFunctionExpression(location);
50386
- }
50387
- function isSelfReferenceLocation(node) {
50388
- switch (node.kind) {
50389
- case 262 /* FunctionDeclaration */:
50390
- case 263 /* ClassDeclaration */:
50391
- case 264 /* InterfaceDeclaration */:
50392
- case 266 /* EnumDeclaration */:
50393
- case 265 /* TypeAliasDeclaration */:
50394
- case 267 /* ModuleDeclaration */:
50395
- return true;
50396
- default:
50397
- return false;
50398
- }
50399
- }
50400
50483
  function diagnosticName(nameArg) {
50401
50484
  return isString(nameArg) ? unescapeLeadingUnderscores(nameArg) : declarationNameToString(nameArg);
50402
50485
  }
50403
- function isTypeParameterSymbolDeclaredInContainer(symbol, container) {
50404
- if (symbol.declarations) {
50405
- for (const decl of symbol.declarations) {
50406
- if (decl.kind === 168 /* TypeParameter */) {
50407
- const parent2 = isJSDocTemplateTag(decl.parent) ? getJSDocHost(decl.parent) : decl.parent;
50408
- if (parent2 === container) {
50409
- return !(isJSDocTemplateTag(decl.parent) && find(decl.parent.parent.tags, isJSDocTypeAlias));
50410
- }
50411
- }
50412
- }
50413
- }
50414
- return false;
50415
- }
50416
50486
  function checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) {
50417
50487
  if (!isIdentifier(errorLocation) || errorLocation.escapedText !== name || isTypeReferenceIdentifier(errorLocation) || isInTypeQuery(errorLocation)) {
50418
50488
  return false;
@@ -50483,8 +50553,6 @@ function createTypeChecker(host) {
50483
50553
  788968 /* Type */ & ~namespaceMeaning,
50484
50554
  /*nameNotFoundMessage*/
50485
50555
  void 0,
50486
- /*nameArg*/
50487
- void 0,
50488
50556
  /*isUse*/
50489
50557
  false
50490
50558
  ));
@@ -50518,8 +50586,6 @@ function createTypeChecker(host) {
50518
50586
  ~788968 /* Type */ & 111551 /* Value */,
50519
50587
  /*nameNotFoundMessage*/
50520
50588
  void 0,
50521
- /*nameArg*/
50522
- void 0,
50523
50589
  /*isUse*/
50524
50590
  false
50525
50591
  ));
@@ -50565,8 +50631,6 @@ function createTypeChecker(host) {
50565
50631
  788968 /* Type */ & ~111551 /* Value */,
50566
50632
  /*nameNotFoundMessage*/
50567
50633
  void 0,
50568
- /*nameArg*/
50569
- void 0,
50570
50634
  /*isUse*/
50571
50635
  false
50572
50636
  ));
@@ -50618,8 +50682,6 @@ function createTypeChecker(host) {
50618
50682
  1024 /* NamespaceModule */,
50619
50683
  /*nameNotFoundMessage*/
50620
50684
  void 0,
50621
- /*nameArg*/
50622
- void 0,
50623
50685
  /*isUse*/
50624
50686
  false
50625
50687
  ));
@@ -50638,8 +50700,6 @@ function createTypeChecker(host) {
50638
50700
  1536 /* Module */,
50639
50701
  /*nameNotFoundMessage*/
50640
50702
  void 0,
50641
- /*nameArg*/
50642
- void 0,
50643
50703
  /*isUse*/
50644
50704
  false
50645
50705
  ));
@@ -51455,11 +51515,10 @@ function createTypeChecker(host) {
51455
51515
  let left = getFirstIdentifier(node);
51456
51516
  let symbol = resolveName(
51457
51517
  left,
51458
- left.escapedText,
51518
+ left,
51459
51519
  111551 /* Value */,
51460
51520
  /*nameNotFoundMessage*/
51461
51521
  void 0,
51462
- left,
51463
51522
  /*isUse*/
51464
51523
  true
51465
51524
  );
@@ -51487,10 +51546,9 @@ function createTypeChecker(host) {
51487
51546
  const symbolFromJSPrototype = isInJSFile(name) && !nodeIsSynthesized(name) ? resolveEntityNameFromAssignmentDeclaration(name, meaning) : void 0;
51488
51547
  symbol = getMergedSymbol(resolveName(
51489
51548
  location || name,
51490
- name.escapedText,
51549
+ name,
51491
51550
  meaning,
51492
51551
  ignoreErrors || symbolFromJSPrototype ? void 0 : message,
51493
- name,
51494
51552
  /*isUse*/
51495
51553
  true,
51496
51554
  /*excludeGlobals*/
@@ -51586,11 +51644,10 @@ function createTypeChecker(host) {
51586
51644
  if (secondaryLocation) {
51587
51645
  return resolveName(
51588
51646
  secondaryLocation,
51589
- name.escapedText,
51647
+ name,
51590
51648
  meaning,
51591
51649
  /*nameNotFoundMessage*/
51592
51650
  void 0,
51593
- name,
51594
51651
  /*isUse*/
51595
51652
  true
51596
51653
  );
@@ -52288,14 +52345,6 @@ function createTypeChecker(host) {
52288
52345
  function symbolIsValue(symbol, includeTypeOnlyMembers) {
52289
52346
  return !!(symbol.flags & 111551 /* Value */ || symbol.flags & 2097152 /* Alias */ && getSymbolFlags(symbol, !includeTypeOnlyMembers) & 111551 /* Value */);
52290
52347
  }
52291
- function findConstructorDeclaration(node) {
52292
- const members = node.members;
52293
- for (const member of members) {
52294
- if (member.kind === 176 /* Constructor */ && nodeIsPresent(member.body)) {
52295
- return member;
52296
- }
52297
- }
52298
- }
52299
52348
  function createType(flags) {
52300
52349
  var _a;
52301
52350
  const result = new Type28(checker, flags);
@@ -52777,8 +52826,6 @@ function createTypeChecker(host) {
52777
52826
  meaning,
52778
52827
  /*nameNotFoundMessage*/
52779
52828
  void 0,
52780
- /*nameArg*/
52781
- void 0,
52782
52829
  /*isUse*/
52783
52830
  false
52784
52831
  );
@@ -54349,8 +54396,6 @@ function createTypeChecker(host) {
54349
54396
  111551 /* Value */ | 1048576 /* ExportValue */,
54350
54397
  /*nameNotFoundMessage*/
54351
54398
  void 0,
54352
- /*nameArg*/
54353
- void 0,
54354
54399
  /*isUse*/
54355
54400
  true
54356
54401
  );
@@ -54674,7 +54719,6 @@ function createTypeChecker(host) {
54674
54719
  788968 /* Type */,
54675
54720
  /*nameNotFoundMessage*/
54676
54721
  void 0,
54677
- escapedName,
54678
54722
  /*isUse*/
54679
54723
  false
54680
54724
  );
@@ -57006,11 +57050,10 @@ function createTypeChecker(host) {
57006
57050
  if (node.parent && node.parent.kind === 277 /* ExportAssignment */) {
57007
57051
  exportSymbol = resolveName(
57008
57052
  node,
57009
- node.escapedText,
57053
+ node,
57010
57054
  111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */,
57011
57055
  /*nameNotFoundMessage*/
57012
57056
  void 0,
57013
- node,
57014
57057
  /*isUse*/
57015
57058
  false
57016
57059
  );
@@ -57043,8 +57086,6 @@ function createTypeChecker(host) {
57043
57086
  111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */,
57044
57087
  /*nameNotFoundMessage*/
57045
57088
  void 0,
57046
- /*nameArg*/
57047
- void 0,
57048
57089
  /*isUse*/
57049
57090
  false
57050
57091
  );
@@ -60864,8 +60905,6 @@ function createTypeChecker(host) {
60864
60905
  111551 /* Value */,
60865
60906
  /*nameNotFoundMessage*/
60866
60907
  void 0,
60867
- /*nameArg*/
60868
- void 0,
60869
60908
  /*isUse*/
60870
60909
  false
60871
60910
  );
@@ -61899,12 +61938,9 @@ function createTypeChecker(host) {
61899
61938
  name,
61900
61939
  meaning,
61901
61940
  diagnostic,
61902
- name,
61903
61941
  /*isUse*/
61904
61942
  false,
61905
61943
  /*excludeGlobals*/
61906
- false,
61907
- /*getSpellingSuggestions*/
61908
61944
  false
61909
61945
  );
61910
61946
  }
@@ -69289,7 +69325,6 @@ function createTypeChecker(host) {
69289
69325
  788968 /* Type */,
69290
69326
  /*nameNotFoundMessage*/
69291
69327
  void 0,
69292
- param.name.escapedText,
69293
69328
  /*isUse*/
69294
69329
  true
69295
69330
  ) || originalKeywordKind && isTypeNodeKind(originalKeywordKind))) {
@@ -70511,10 +70546,9 @@ function createTypeChecker(host) {
70511
70546
  if (!links.resolvedSymbol) {
70512
70547
  links.resolvedSymbol = !nodeIsMissing(node) && resolveName(
70513
70548
  node,
70514
- node.escapedText,
70549
+ node,
70515
70550
  111551 /* Value */ | 1048576 /* ExportValue */,
70516
70551
  getCannotFindNameDiagnosticForName(node),
70517
- node,
70518
70552
  !isWriteOnlyAccess(node),
70519
70553
  /*excludeGlobals*/
70520
70554
  false
@@ -73750,7 +73784,6 @@ function createTypeChecker(host) {
73750
73784
  111551 /* Value */,
73751
73785
  /*nameNotFoundMessage*/
73752
73786
  void 0,
73753
- id.escapedText,
73754
73787
  /*isUse*/
73755
73788
  true
73756
73789
  );
@@ -73800,8 +73833,6 @@ function createTypeChecker(host) {
73800
73833
  111551 /* Value */,
73801
73834
  /*nameNotFoundMessage*/
73802
73835
  void 0,
73803
- /*nameArg*/
73804
- void 0,
73805
73836
  /*isUse*/
73806
73837
  true,
73807
73838
  /*excludeGlobals*/
@@ -75178,7 +75209,6 @@ function createTypeChecker(host) {
75178
75209
  1920 /* Namespace */,
75179
75210
  /*nameNotFoundMessage*/
75180
75211
  void 0,
75181
- namespaceName,
75182
75212
  /*isUse*/
75183
75213
  false
75184
75214
  );
@@ -75393,7 +75423,6 @@ function createTypeChecker(host) {
75393
75423
  jsxFactoryNamespace,
75394
75424
  111551 /* Value */,
75395
75425
  jsxFactoryRefErr,
75396
- jsxFactoryNamespace,
75397
75426
  /*isUse*/
75398
75427
  true
75399
75428
  );
@@ -75413,7 +75442,6 @@ function createTypeChecker(host) {
75413
75442
  localJsxNamespace,
75414
75443
  111551 /* Value */,
75415
75444
  jsxFactoryRefErr,
75416
- localJsxNamespace,
75417
75445
  /*isUse*/
75418
75446
  true
75419
75447
  );
@@ -76134,38 +76162,34 @@ function createTypeChecker(host) {
76134
76162
  const suggestion = getSuggestedSymbolForNonexistentProperty(name, containingType);
76135
76163
  return suggestion && symbolName(suggestion);
76136
76164
  }
76165
+ function getSuggestionForSymbolNameLookup(symbols, name, meaning) {
76166
+ const symbol = getSymbol2(symbols, name, meaning);
76167
+ if (symbol)
76168
+ return symbol;
76169
+ let candidates;
76170
+ if (symbols === globals) {
76171
+ const primitives = mapDefined(
76172
+ ["string", "number", "boolean", "object", "bigint", "symbol"],
76173
+ (s) => symbols.has(s.charAt(0).toUpperCase() + s.slice(1)) ? createSymbol(524288 /* TypeAlias */, s) : void 0
76174
+ );
76175
+ candidates = primitives.concat(arrayFrom(symbols.values()));
76176
+ } else {
76177
+ candidates = arrayFrom(symbols.values());
76178
+ }
76179
+ return getSpellingSuggestionForName(unescapeLeadingUnderscores(name), candidates, meaning);
76180
+ }
76137
76181
  function getSuggestedSymbolForNonexistentSymbol(location, outerName, meaning) {
76138
76182
  Debug.assert(outerName !== void 0, "outername should always be defined");
76139
- const result = resolveNameHelper(
76183
+ const result = resolveNameForSymbolSuggestion(
76140
76184
  location,
76141
76185
  outerName,
76142
76186
  meaning,
76143
76187
  /*nameNotFoundMessage*/
76144
76188
  void 0,
76145
- outerName,
76146
76189
  /*isUse*/
76147
76190
  false,
76148
76191
  /*excludeGlobals*/
76149
- false,
76150
- /*getSpellingSuggestions*/
76151
- true,
76152
- (symbols, name, meaning2) => {
76153
- Debug.assertEqual(outerName, name, "name should equal outerName");
76154
- const symbol = getSymbol2(symbols, name, meaning2);
76155
- if (symbol)
76156
- return symbol;
76157
- let candidates;
76158
- if (symbols === globals) {
76159
- const primitives = mapDefined(
76160
- ["string", "number", "boolean", "object", "bigint", "symbol"],
76161
- (s) => symbols.has(s.charAt(0).toUpperCase() + s.slice(1)) ? createSymbol(524288 /* TypeAlias */, s) : void 0
76162
- );
76163
- candidates = primitives.concat(arrayFrom(symbols.values()));
76164
- } else {
76165
- candidates = arrayFrom(symbols.values());
76166
- }
76167
- return getSpellingSuggestionForName(unescapeLeadingUnderscores(name), candidates, meaning2);
76168
- }
76192
+ false
76169
76193
  );
76170
76194
  return result;
76171
76195
  }
@@ -77022,8 +77046,6 @@ function createTypeChecker(host) {
77022
77046
  111551 /* Value */,
77023
77047
  /*nameNotFoundMessage*/
77024
77048
  void 0,
77025
- /*nameArg*/
77026
- void 0,
77027
77049
  /*isUse*/
77028
77050
  false
77029
77051
  );
@@ -78287,8 +78309,6 @@ function createTypeChecker(host) {
78287
78309
  111551 /* Value */,
78288
78310
  /*nameNotFoundMessage*/
78289
78311
  void 0,
78290
- /*nameArg*/
78291
- void 0,
78292
78312
  /*isUse*/
78293
78313
  false
78294
78314
  );
@@ -78406,8 +78426,6 @@ function createTypeChecker(host) {
78406
78426
  111551 /* Value */,
78407
78427
  /*nameNotFoundMessage*/
78408
78428
  void 0,
78409
- /*nameArg*/
78410
- void 0,
78411
78429
  /*isUse*/
78412
78430
  true
78413
78431
  );
@@ -80743,7 +80761,6 @@ function createTypeChecker(host) {
80743
80761
  788968 /* Type */,
80744
80762
  /*nameNotFoundMessage*/
80745
80763
  void 0,
80746
- name,
80747
80764
  /*isUse*/
80748
80765
  false
80749
80766
  );
@@ -83031,8 +83048,6 @@ function createTypeChecker(host) {
83031
83048
  meaning,
83032
83049
  /*nameNotFoundMessage*/
83033
83050
  void 0,
83034
- /*nameArg*/
83035
- void 0,
83036
83051
  /*isUse*/
83037
83052
  true
83038
83053
  );
@@ -83784,8 +83799,6 @@ function createTypeChecker(host) {
83784
83799
  3 /* Variable */,
83785
83800
  /*nameNotFoundMessage*/
83786
83801
  void 0,
83787
- /*nameArg*/
83788
- void 0,
83789
83802
  /*isUse*/
83790
83803
  false
83791
83804
  );
@@ -86610,8 +86623,6 @@ function createTypeChecker(host) {
86610
86623
  111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */,
86611
86624
  /*nameNotFoundMessage*/
86612
86625
  void 0,
86613
- /*nameArg*/
86614
- void 0,
86615
86626
  /*isUse*/
86616
86627
  true
86617
86628
  );
@@ -88028,8 +88039,6 @@ function createTypeChecker(host) {
88028
88039
  111551 /* Value */,
88029
88040
  /*nameNotFoundMessage*/
88030
88041
  void 0,
88031
- /*nameArg*/
88032
- void 0,
88033
88042
  /*isUse*/
88034
88043
  false
88035
88044
  )) {
@@ -88421,8 +88430,6 @@ function createTypeChecker(host) {
88421
88430
  111551 /* Value */ | 1048576 /* ExportValue */ | 2097152 /* Alias */,
88422
88431
  /*nameNotFoundMessage*/
88423
88432
  void 0,
88424
- /*nameArg*/
88425
- void 0,
88426
88433
  /*isUse*/
88427
88434
  true
88428
88435
  );
@@ -88438,13 +88445,9 @@ function createTypeChecker(host) {
88438
88445
  111551 /* Value */ | 1048576 /* ExportValue */ | 2097152 /* Alias */,
88439
88446
  /*nameNotFoundMessage*/
88440
88447
  void 0,
88441
- /*nameArg*/
88442
- void 0,
88443
88448
  /*isUse*/
88444
88449
  true,
88445
88450
  /*excludeGlobals*/
88446
- void 0,
88447
- /*getSpellingSuggestions*/
88448
88451
  void 0
88449
88452
  );
88450
88453
  }
@@ -175811,6 +175814,7 @@ __export(ts_exports2, {
175811
175814
  createModuleResolutionLoaderUsingGlobalCache: () => createModuleResolutionLoaderUsingGlobalCache,
175812
175815
  createModuleSpecifierResolutionHost: () => createModuleSpecifierResolutionHost,
175813
175816
  createMultiMap: () => createMultiMap,
175817
+ createNameResolver: () => createNameResolver,
175814
175818
  createNodeConverters: () => createNodeConverters,
175815
175819
  createNodeFactory: () => createNodeFactory,
175816
175820
  createOptionNameMap: () => createOptionNameMap,
@@ -175951,6 +175955,7 @@ __export(ts_exports2, {
175951
175955
  findChildOfKind: () => findChildOfKind,
175952
175956
  findComputedPropertyNameCacheAssignment: () => findComputedPropertyNameCacheAssignment,
175953
175957
  findConfigFile: () => findConfigFile,
175958
+ findConstructorDeclaration: () => findConstructorDeclaration,
175954
175959
  findContainingList: () => findContainingList,
175955
175960
  findDiagnosticForNode: () => findDiagnosticForNode,
175956
175961
  findFirstNonJsxWhitespaceToken: () => findFirstNonJsxWhitespaceToken,
@@ -176662,6 +176667,7 @@ __export(ts_exports2, {
176662
176667
  isConciseBody: () => isConciseBody,
176663
176668
  isConditionalExpression: () => isConditionalExpression,
176664
176669
  isConditionalTypeNode: () => isConditionalTypeNode,
176670
+ isConstAssertion: () => isConstAssertion,
176665
176671
  isConstTypeReference: () => isConstTypeReference,
176666
176672
  isConstructSignatureDeclaration: () => isConstructSignatureDeclaration,
176667
176673
  isConstructorDeclaration: () => isConstructorDeclaration,
@@ -176776,6 +176782,7 @@ __export(ts_exports2, {
176776
176782
  isGetOrSetAccessorDeclaration: () => isGetOrSetAccessorDeclaration,
176777
176783
  isGlobalDeclaration: () => isGlobalDeclaration,
176778
176784
  isGlobalScopeAugmentation: () => isGlobalScopeAugmentation,
176785
+ isGlobalSourceFile: () => isGlobalSourceFile,
176779
176786
  isGrammarError: () => isGrammarError,
176780
176787
  isHeritageClause: () => isHeritageClause,
176781
176788
  isHoistedFunction: () => isHoistedFunction,
@@ -178757,6 +178764,7 @@ var ScriptTarget10 = /* @__PURE__ */ ((ScriptTarget11) => {
178757
178764
  ScriptTarget11["ES2020"] = "es2020";
178758
178765
  ScriptTarget11["ES2021"] = "es2021";
178759
178766
  ScriptTarget11["ES2022"] = "es2022";
178767
+ ScriptTarget11["ES2023"] = "es2023";
178760
178768
  ScriptTarget11["ESNext"] = "esnext";
178761
178769
  ScriptTarget11["JSON"] = "json";
178762
178770
  ScriptTarget11["Latest"] = "esnext" /* ESNext */;
@@ -190055,6 +190063,7 @@ if (typeof console !== "undefined") {
190055
190063
  createModuleResolutionLoaderUsingGlobalCache,
190056
190064
  createModuleSpecifierResolutionHost,
190057
190065
  createMultiMap,
190066
+ createNameResolver,
190058
190067
  createNodeConverters,
190059
190068
  createNodeFactory,
190060
190069
  createOptionNameMap,
@@ -190195,6 +190204,7 @@ if (typeof console !== "undefined") {
190195
190204
  findChildOfKind,
190196
190205
  findComputedPropertyNameCacheAssignment,
190197
190206
  findConfigFile,
190207
+ findConstructorDeclaration,
190198
190208
  findContainingList,
190199
190209
  findDiagnosticForNode,
190200
190210
  findFirstNonJsxWhitespaceToken,
@@ -190906,6 +190916,7 @@ if (typeof console !== "undefined") {
190906
190916
  isConciseBody,
190907
190917
  isConditionalExpression,
190908
190918
  isConditionalTypeNode,
190919
+ isConstAssertion,
190909
190920
  isConstTypeReference,
190910
190921
  isConstructSignatureDeclaration,
190911
190922
  isConstructorDeclaration,
@@ -191020,6 +191031,7 @@ if (typeof console !== "undefined") {
191020
191031
  isGetOrSetAccessorDeclaration,
191021
191032
  isGlobalDeclaration,
191022
191033
  isGlobalScopeAugmentation,
191034
+ isGlobalSourceFile,
191023
191035
  isGrammarError,
191024
191036
  isHeritageClause,
191025
191037
  isHoistedFunction,