typescript 5.5.0-dev.20240410 → 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.20240410`;
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,
@@ -43525,7 +43910,7 @@ function loadModuleFromImportsOrExports(extensions, state, cache, redirectedRefe
43525
43910
  moduleName
43526
43911
  );
43527
43912
  }
43528
- const expandingKeys = sort(filter(getOwnKeys(lookupTable), (k) => k.includes("*") || endsWith(k, "/")), comparePatternKeys);
43913
+ const expandingKeys = sort(filter(getOwnKeys(lookupTable), (k) => hasOneAsterisk(k) || endsWith(k, "/")), comparePatternKeys);
43529
43914
  for (const potentialTarget of expandingKeys) {
43530
43915
  if (state.features & 16 /* ExportsPatternTrailers */ && matchesPatternWithTrailer(potentialTarget, moduleName)) {
43531
43916
  const target = lookupTable[potentialTarget];
@@ -43569,6 +43954,10 @@ function loadModuleFromImportsOrExports(extensions, state, cache, redirectedRefe
43569
43954
  return startsWith(name, target.substring(0, starPos)) && endsWith(name, target.substring(starPos + 1));
43570
43955
  }
43571
43956
  }
43957
+ function hasOneAsterisk(patternKey) {
43958
+ const firstStar = patternKey.indexOf("*");
43959
+ return firstStar !== -1 && firstStar === patternKey.lastIndexOf("*");
43960
+ }
43572
43961
  function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports) {
43573
43962
  return loadModuleFromTargetImportOrExport;
43574
43963
  function loadModuleFromTargetImportOrExport(target, subpath, pattern, key) {
@@ -48430,6 +48819,31 @@ function createTypeChecker(host) {
48430
48819
  var lastGetCombinedNodeFlagsResult = 0 /* None */;
48431
48820
  var lastGetCombinedModifierFlagsNode;
48432
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
+ });
48433
48847
  const checker = {
48434
48848
  getNodeCount: () => reduceLeft(host.getSourceFiles(), (n, s) => n + s.nodeCount, 0),
48435
48849
  getIdentifierCount: () => reduceLeft(host.getSourceFiles(), (n, s) => n + s.identifierCount, 0),
@@ -48735,8 +49149,6 @@ function createTypeChecker(host) {
48735
49149
  meaning,
48736
49150
  /*nameNotFoundMessage*/
48737
49151
  void 0,
48738
- /*nameArg*/
48739
- void 0,
48740
49152
  /*isUse*/
48741
49153
  false,
48742
49154
  excludeGlobals
@@ -49766,9 +50178,6 @@ function createTypeChecker(host) {
49766
50178
  const nodeId = getNodeId(node);
49767
50179
  return nodeLinks[nodeId] || (nodeLinks[nodeId] = new NodeLinks());
49768
50180
  }
49769
- function isGlobalSourceFile(node) {
49770
- return node.kind === 307 /* SourceFile */ && !isExternalOrCommonJsModule(node);
49771
- }
49772
50181
  function getSymbol2(symbols, name, meaning) {
49773
50182
  if (meaning) {
49774
50183
  const symbol = getMergedSymbol(symbols.get(name));
@@ -49944,417 +50353,120 @@ function createTypeChecker(host) {
49944
50353
  return ancestorChangingReferenceScope === void 0;
49945
50354
  }
49946
50355
  }
49947
- function useOuterVariableScopeInParameter(result, location, lastLocation) {
49948
- const target = getEmitScriptTarget(compilerOptions);
49949
- const functionLocation = location;
49950
- if (isParameter(lastLocation) && functionLocation.body && result.valueDeclaration && result.valueDeclaration.pos >= functionLocation.body.pos && result.valueDeclaration.end <= functionLocation.body.end) {
49951
- if (target >= 2 /* ES2015 */) {
49952
- const links = getNodeLinks(functionLocation);
49953
- if (links.declarationRequiresScopeChange === void 0) {
49954
- links.declarationRequiresScopeChange = forEach(functionLocation.parameters, requiresScopeChange) || false;
49955
- }
49956
- 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;
49957
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;
49958
50374
  }
49959
50375
  return false;
49960
- function requiresScopeChange(node) {
49961
- return requiresScopeChangeWorker(node.name) || !!node.initializer && requiresScopeChangeWorker(node.initializer);
49962
- }
49963
- function requiresScopeChangeWorker(node) {
49964
- switch (node.kind) {
49965
- case 219 /* ArrowFunction */:
49966
- case 218 /* FunctionExpression */:
49967
- case 262 /* FunctionDeclaration */:
49968
- case 176 /* Constructor */:
49969
- return false;
49970
- case 174 /* MethodDeclaration */:
49971
- case 177 /* GetAccessor */:
49972
- case 178 /* SetAccessor */:
49973
- case 303 /* PropertyAssignment */:
49974
- return requiresScopeChangeWorker(node.name);
49975
- case 172 /* PropertyDeclaration */:
49976
- if (hasStaticModifier(node)) {
49977
- return !emitStandardClassFields;
49978
- }
49979
- return requiresScopeChangeWorker(node.name);
49980
- default:
49981
- if (isNullishCoalesce(node) || isOptionalChain(node)) {
49982
- return target < 7 /* ES2020 */;
49983
- }
49984
- if (isBindingElement(node) && node.dotDotDotToken && isObjectBindingPattern(node.parent)) {
49985
- return target < 4 /* ES2017 */;
49986
- }
49987
- if (isTypeNode(node))
49988
- return false;
49989
- return forEachChild(node, requiresScopeChangeWorker) || false;
49990
- }
49991
- }
49992
- }
49993
- function isConstAssertion(location) {
49994
- return isAssertionExpression(location) && isConstTypeReference(location.type) || isJSDocTypeTag(location) && isConstTypeReference(location.typeExpression);
49995
50376
  }
49996
- function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals = false, getSpellingSuggestions = true) {
49997
- return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, getSymbol2);
49998
- }
49999
- function resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, lookup) {
50000
- var _a, _b, _c;
50001
- const originalLocation = location;
50002
- let result;
50003
- let lastLocation;
50004
- let lastSelfReferenceLocation;
50005
- let propertyWithInvalidInitializer;
50006
- let associatedDeclarationForContainingInitializerOrBindingName;
50007
- let withinDeferredContext = false;
50008
- const errorLocation = location;
50009
- let grandparent;
50010
- let isInExternalModule = false;
50011
- loop:
50012
- while (location) {
50013
- if (name === "const" && isConstAssertion(location)) {
50014
- return void 0;
50015
- }
50016
- if (isModuleOrEnumDeclaration(location) && lastLocation && location.name === lastLocation) {
50017
- lastLocation = location;
50018
- location = location.parent;
50019
- }
50020
- if (canHaveLocals(location) && location.locals && !isGlobalSourceFile(location)) {
50021
- if (result = lookup(location.locals, name, meaning)) {
50022
- let useResult = true;
50023
- if (isFunctionLike(location) && lastLocation && lastLocation !== location.body) {
50024
- if (meaning & result.flags & 788968 /* Type */ && lastLocation.kind !== 320 /* JSDoc */) {
50025
- 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;
50026
- }
50027
- if (meaning & result.flags & 3 /* Variable */) {
50028
- if (useOuterVariableScopeInParameter(result, location, lastLocation)) {
50029
- useResult = false;
50030
- } else if (result.flags & 1 /* FunctionScopedVariable */) {
50031
- useResult = lastLocation.kind === 169 /* Parameter */ || lastLocation === location.type && !!findAncestor(result.valueDeclaration, isParameter);
50032
- }
50033
- }
50034
- } else if (location.kind === 194 /* ConditionalType */) {
50035
- useResult = lastLocation === location.trueType;
50036
- }
50037
- if (useResult) {
50038
- break loop;
50039
- } else {
50040
- 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
+ );
50041
50411
  }
50042
50412
  }
50043
50413
  }
50044
- withinDeferredContext = withinDeferredContext || getIsDeferredContext(location, lastLocation);
50045
- switch (location.kind) {
50046
- case 307 /* SourceFile */:
50047
- if (!isExternalOrCommonJsModule(location))
50048
- break;
50049
- isInExternalModule = true;
50050
- case 267 /* ModuleDeclaration */:
50051
- const moduleExports = ((_a = getSymbolOfDeclaration(location)) == null ? void 0 : _a.exports) || emptySymbols;
50052
- if (location.kind === 307 /* SourceFile */ || isModuleDeclaration(location) && location.flags & 33554432 /* Ambient */ && !isGlobalScopeAugmentation(location)) {
50053
- if (result = moduleExports.get("default" /* Default */)) {
50054
- const localSymbol = getLocalSymbolForExportDefault(result);
50055
- if (localSymbol && result.flags & meaning && localSymbol.escapedName === name) {
50056
- break loop;
50057
- }
50058
- result = void 0;
50059
- }
50060
- const moduleExport = moduleExports.get(name);
50061
- if (moduleExport && moduleExport.flags === 2097152 /* Alias */ && (getDeclarationOfKind(moduleExport, 281 /* ExportSpecifier */) || getDeclarationOfKind(moduleExport, 280 /* NamespaceExport */))) {
50062
- break;
50063
- }
50064
- }
50065
- if (name !== "default" /* Default */ && (result = lookup(moduleExports, name, meaning & 2623475 /* ModuleMember */))) {
50066
- if (isSourceFile(location) && location.commonJsModuleIndicator && !((_b = result.declarations) == null ? void 0 : _b.some(isJSDocTypeAlias))) {
50067
- result = void 0;
50068
- } else {
50069
- break loop;
50070
- }
50071
- }
50072
- break;
50073
- case 266 /* EnumDeclaration */:
50074
- if (result = lookup(((_c = getSymbolOfDeclaration(location)) == null ? void 0 : _c.exports) || emptySymbols, name, meaning & 8 /* EnumMember */)) {
50075
- if (nameNotFoundMessage && getIsolatedModules(compilerOptions) && !(location.flags & 33554432 /* Ambient */) && getSourceFileOfNode(location) !== getSourceFileOfNode(result.valueDeclaration)) {
50076
- error2(
50077
- errorLocation,
50078
- Diagnostics.Cannot_access_0_from_another_file_without_qualification_when_1_is_enabled_Use_2_instead,
50079
- unescapeLeadingUnderscores(name),
50080
- isolatedModulesLikeFlagName,
50081
- `${unescapeLeadingUnderscores(getSymbolOfNode(location).escapedName)}.${unescapeLeadingUnderscores(name)}`
50082
- );
50083
- }
50084
- break loop;
50085
- }
50086
- break;
50087
- case 172 /* PropertyDeclaration */:
50088
- if (!isStatic(location)) {
50089
- const ctor = findConstructorDeclaration(location.parent);
50090
- if (ctor && ctor.locals) {
50091
- if (lookup(ctor.locals, name, meaning & 111551 /* Value */)) {
50092
- Debug.assertNode(location, isPropertyDeclaration);
50093
- propertyWithInvalidInitializer = location;
50094
- }
50095
- }
50096
- }
50097
- break;
50098
- case 263 /* ClassDeclaration */:
50099
- case 231 /* ClassExpression */:
50100
- case 264 /* InterfaceDeclaration */:
50101
- if (result = lookup(getSymbolOfDeclaration(location).members || emptySymbols, name, meaning & 788968 /* Type */)) {
50102
- if (!isTypeParameterSymbolDeclaredInContainer(result, location)) {
50103
- result = void 0;
50104
- break;
50105
- }
50106
- if (lastLocation && isStatic(lastLocation)) {
50107
- if (nameNotFoundMessage) {
50108
- error2(errorLocation, Diagnostics.Static_members_cannot_reference_class_type_parameters);
50109
- }
50110
- return void 0;
50111
- }
50112
- break loop;
50113
- }
50114
- if (isClassExpression(location) && meaning & 32 /* Class */) {
50115
- const className = location.name;
50116
- if (className && name === className.escapedText) {
50117
- result = location.symbol;
50118
- break loop;
50119
- }
50120
- }
50121
- break;
50122
- case 233 /* ExpressionWithTypeArguments */:
50123
- if (lastLocation === location.expression && location.parent.token === 96 /* ExtendsKeyword */) {
50124
- const container = location.parent.parent;
50125
- if (isClassLike(container) && (result = lookup(getSymbolOfDeclaration(container).members, name, meaning & 788968 /* Type */))) {
50126
- if (nameNotFoundMessage) {
50127
- error2(errorLocation, Diagnostics.Base_class_expressions_cannot_reference_class_type_parameters);
50128
- }
50129
- return void 0;
50130
- }
50131
- }
50132
- break;
50133
- case 167 /* ComputedPropertyName */:
50134
- grandparent = location.parent.parent;
50135
- if (isClassLike(grandparent) || grandparent.kind === 264 /* InterfaceDeclaration */) {
50136
- if (result = lookup(getSymbolOfDeclaration(grandparent).members, name, meaning & 788968 /* Type */)) {
50137
- if (nameNotFoundMessage) {
50138
- error2(errorLocation, Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type);
50139
- }
50140
- return void 0;
50141
- }
50142
- }
50143
- break;
50144
- case 219 /* ArrowFunction */:
50145
- if (getEmitScriptTarget(compilerOptions) >= 2 /* ES2015 */) {
50146
- break;
50147
- }
50148
- case 174 /* MethodDeclaration */:
50149
- case 176 /* Constructor */:
50150
- case 177 /* GetAccessor */:
50151
- case 178 /* SetAccessor */:
50152
- case 262 /* FunctionDeclaration */:
50153
- if (meaning & 3 /* Variable */ && name === "arguments") {
50154
- result = argumentsSymbol;
50155
- break loop;
50156
- }
50157
- break;
50158
- case 218 /* FunctionExpression */:
50159
- if (meaning & 3 /* Variable */ && name === "arguments") {
50160
- result = argumentsSymbol;
50161
- break loop;
50162
- }
50163
- if (meaning & 16 /* Function */) {
50164
- const functionName = location.name;
50165
- if (functionName && name === functionName.escapedText) {
50166
- result = location.symbol;
50167
- break loop;
50168
- }
50169
- }
50170
- break;
50171
- case 170 /* Decorator */:
50172
- if (location.parent && location.parent.kind === 169 /* Parameter */) {
50173
- location = location.parent;
50174
- }
50175
- if (location.parent && (isClassElement(location.parent) || location.parent.kind === 263 /* ClassDeclaration */)) {
50176
- location = location.parent;
50177
- }
50178
- break;
50179
- case 346 /* JSDocTypedefTag */:
50180
- case 338 /* JSDocCallbackTag */:
50181
- case 340 /* JSDocEnumTag */:
50182
- case 351 /* JSDocImportTag */:
50183
- const root = getJSDocRoot(location);
50184
- if (root) {
50185
- location = root.parent;
50186
- }
50187
- break;
50188
- case 169 /* Parameter */:
50189
- if (lastLocation && (lastLocation === location.initializer || lastLocation === location.name && isBindingPattern(lastLocation))) {
50190
- if (!associatedDeclarationForContainingInitializerOrBindingName) {
50191
- associatedDeclarationForContainingInitializerOrBindingName = location;
50192
- }
50193
- }
50194
- break;
50195
- case 208 /* BindingElement */:
50196
- if (lastLocation && (lastLocation === location.initializer || lastLocation === location.name && isBindingPattern(lastLocation))) {
50197
- if (isParameterDeclaration(location) && !associatedDeclarationForContainingInitializerOrBindingName) {
50198
- associatedDeclarationForContainingInitializerOrBindingName = location;
50199
- }
50200
- }
50201
- break;
50202
- case 195 /* InferType */:
50203
- if (meaning & 262144 /* TypeParameter */) {
50204
- const parameterName = location.typeParameter.name;
50205
- if (parameterName && name === parameterName.escapedText) {
50206
- result = location.typeParameter.symbol;
50207
- break loop;
50208
- }
50209
- }
50210
- break;
50211
- case 281 /* ExportSpecifier */:
50212
- if (lastLocation && lastLocation === location.propertyName && location.parent.parent.moduleSpecifier) {
50213
- location = location.parent.parent.parent;
50214
- }
50215
- break;
50216
- }
50217
- if (isSelfReferenceLocation(location)) {
50218
- lastSelfReferenceLocation = location;
50414
+ if (!suggestion && !suggestedLib && nameArg) {
50415
+ error2(errorLocation, nameNotFoundMessage, diagnosticName(nameArg));
50219
50416
  }
50220
- lastLocation = location;
50221
- location = isJSDocTemplateTag(location) ? getEffectiveContainerForJSDocTemplateTag(location) || location.parent : isJSDocParameterTag(location) || isJSDocReturnTag(location) ? getHostSignatureFromJSDoc(location) || location.parent : location.parent;
50417
+ suggestionCount++;
50222
50418
  }
50223
- if (isUse && result && (!lastSelfReferenceLocation || result !== lastSelfReferenceLocation.symbol)) {
50224
- result.isReferenced |= meaning;
50225
- }
50226
- if (!result) {
50227
- if (lastLocation) {
50228
- Debug.assertNode(lastLocation, isSourceFile);
50229
- if (lastLocation.commonJsModuleIndicator && name === "exports" && meaning & lastLocation.symbol.flags) {
50230
- return lastLocation.symbol;
50231
- }
50232
- }
50233
- if (!excludeGlobals) {
50234
- result = lookup(globals, name, meaning);
50235
- }
50236
- }
50237
- if (!result) {
50238
- if (originalLocation && isInJSFile(originalLocation) && originalLocation.parent) {
50239
- if (isRequireCall(
50240
- originalLocation.parent,
50241
- /*requireStringLiteralLikeArgument*/
50242
- false
50243
- )) {
50244
- 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
+ );
50245
50457
  }
50246
50458
  }
50247
- }
50248
- function checkAndReportErrorForInvalidInitializer() {
50249
- if (propertyWithInvalidInitializer && !emitStandardClassFields) {
50250
- error2(
50251
- errorLocation,
50252
- 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,
50253
- declarationNameToString(propertyWithInvalidInitializer.name),
50254
- diagnosticName(nameArg)
50255
- );
50256
- return true;
50257
- }
50258
- return false;
50259
- }
50260
- if (!result) {
50261
- if (nameNotFoundMessage) {
50262
- addLazyDiagnostic(() => {
50263
- if (!errorLocation || errorLocation.parent.kind !== 324 /* JSDocLink */ && !checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) && // TODO: GH#18217
50264
- !checkAndReportErrorForInvalidInitializer() && !checkAndReportErrorForExtendingInterface(errorLocation) && !checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) && !checkAndReportErrorForExportingPrimitiveType(errorLocation, name) && !checkAndReportErrorForUsingNamespaceAsTypeOrValue(errorLocation, name, meaning) && !checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) && !checkAndReportErrorForUsingValueAsType(errorLocation, name, meaning)) {
50265
- let suggestion;
50266
- let suggestedLib;
50267
- if (nameArg) {
50268
- suggestedLib = getSuggestedLibForNonExistentName(nameArg);
50269
- if (suggestedLib) {
50270
- error2(errorLocation, nameNotFoundMessage, diagnosticName(nameArg), suggestedLib);
50271
- }
50272
- }
50273
- if (!suggestedLib && getSpellingSuggestions && suggestionCount < maximumSuggestionCount) {
50274
- suggestion = getSuggestedSymbolForNonexistentSymbol(originalLocation, name, meaning);
50275
- const isGlobalScopeAugmentationDeclaration = (suggestion == null ? void 0 : suggestion.valueDeclaration) && isAmbientModule(suggestion.valueDeclaration) && isGlobalScopeAugmentation(suggestion.valueDeclaration);
50276
- if (isGlobalScopeAugmentationDeclaration) {
50277
- suggestion = void 0;
50278
- }
50279
- if (suggestion) {
50280
- const suggestionName = symbolToString(suggestion);
50281
- const isUncheckedJS = isUncheckedJSSuggestion(
50282
- originalLocation,
50283
- suggestion,
50284
- /*excludeClasses*/
50285
- false
50286
- );
50287
- 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;
50288
- const diagnostic = createError(errorLocation, message, diagnosticName(nameArg), suggestionName);
50289
- addErrorOrSuggestion(!isUncheckedJS, diagnostic);
50290
- if (suggestion.valueDeclaration) {
50291
- addRelatedInfo(
50292
- diagnostic,
50293
- createDiagnosticForNode(suggestion.valueDeclaration, Diagnostics._0_is_declared_here, suggestionName)
50294
- );
50295
- }
50296
- }
50297
- }
50298
- if (!suggestion && !suggestedLib && nameArg) {
50299
- error2(errorLocation, nameNotFoundMessage, diagnosticName(nameArg));
50300
- }
50301
- suggestionCount++;
50302
- }
50303
- });
50304
- }
50305
- return void 0;
50306
- } else if (nameNotFoundMessage && checkAndReportErrorForInvalidInitializer()) {
50307
- return void 0;
50308
- }
50309
- if (nameNotFoundMessage) {
50310
- addLazyDiagnostic(() => {
50311
- var _a2;
50312
- if (errorLocation && (meaning & 2 /* BlockScopedVariable */ || (meaning & 32 /* Class */ || meaning & 384 /* Enum */) && (meaning & 111551 /* Value */) === 111551 /* Value */)) {
50313
- const exportOrLocalSymbol = getExportSymbolOfValueSymbolIfExported(result);
50314
- if (exportOrLocalSymbol.flags & 2 /* BlockScopedVariable */ || exportOrLocalSymbol.flags & 32 /* Class */ || exportOrLocalSymbol.flags & 384 /* Enum */) {
50315
- checkResolvedBlockScopedVariable(exportOrLocalSymbol, errorLocation);
50316
- }
50317
- }
50318
- if (result && isInExternalModule && (meaning & 111551 /* Value */) === 111551 /* Value */ && !(originalLocation.flags & 16777216 /* JSDoc */)) {
50319
- const merged = getMergedSymbol(result);
50320
- if (length(merged.declarations) && every(merged.declarations, (d) => isNamespaceExportDeclaration(d) || isSourceFile(d) && !!d.symbol.globalExports)) {
50321
- 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));
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));
50322
50466
  }
50323
50467
  }
50324
- if (result && associatedDeclarationForContainingInitializerOrBindingName && !withinDeferredContext && (meaning & 111551 /* Value */) === 111551 /* Value */) {
50325
- const candidate = getMergedSymbol(getLateBoundSymbol(result));
50326
- const root = getRootDeclaration(associatedDeclarationForContainingInitializerOrBindingName);
50327
- if (candidate === getSymbolOfDeclaration(associatedDeclarationForContainingInitializerOrBindingName)) {
50328
- error2(errorLocation, Diagnostics.Parameter_0_cannot_reference_itself, declarationNameToString(associatedDeclarationForContainingInitializerOrBindingName.name));
50329
- } else if (candidate.valueDeclaration && candidate.valueDeclaration.pos > associatedDeclarationForContainingInitializerOrBindingName.pos && root.parent.locals && lookup(root.parent.locals, candidate.escapedName, meaning) === candidate) {
50330
- error2(errorLocation, Diagnostics.Parameter_0_cannot_reference_identifier_1_declared_after_it, declarationNameToString(associatedDeclarationForContainingInitializerOrBindingName.name), declarationNameToString(errorLocation));
50331
- }
50332
- }
50333
- if (result && errorLocation && meaning & 111551 /* Value */ && result.flags & 2097152 /* Alias */ && !(result.flags & 111551 /* Value */) && !isValidTypeOnlyAliasUseSite(errorLocation)) {
50334
- const typeOnlyDeclaration = getTypeOnlyAliasDeclaration(result, 111551 /* Value */);
50335
- if (typeOnlyDeclaration) {
50336
- 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;
50337
- const unescapedName = unescapeLeadingUnderscores(name);
50338
- addTypeOnlyDeclarationRelatedInfo(
50339
- error2(errorLocation, message, unescapedName),
50340
- typeOnlyDeclaration,
50341
- unescapedName
50342
- );
50343
- }
50344
- }
50345
- if (compilerOptions.isolatedModules && result && isInExternalModule && (meaning & 111551 /* Value */) === 111551 /* Value */) {
50346
- const isGlobal = lookup(globals, name, meaning) === result;
50347
- const nonValueSymbol = isGlobal && isSourceFile(lastLocation) && lastLocation.locals && lookup(lastLocation.locals, name, ~111551 /* Value */);
50348
- if (nonValueSymbol) {
50349
- 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 */);
50350
- if (importDecl && !isTypeOnlyImportDeclaration(importDecl)) {
50351
- 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));
50352
- }
50353
- }
50354
- }
50355
- });
50356
- }
50357
- return result;
50468
+ }
50469
+ });
50358
50470
  }
50359
50471
  function addTypeOnlyDeclarationRelatedInfo(diagnostic, typeOnlyDeclaration, unescapedName) {
50360
50472
  if (!typeOnlyDeclaration)
@@ -50368,47 +50480,9 @@ function createTypeChecker(host) {
50368
50480
  )
50369
50481
  );
50370
50482
  }
50371
- function getIsDeferredContext(location, lastLocation) {
50372
- if (location.kind !== 219 /* ArrowFunction */ && location.kind !== 218 /* FunctionExpression */) {
50373
- return isTypeQueryNode(location) || (isFunctionLikeDeclaration(location) || location.kind === 172 /* PropertyDeclaration */ && !isStatic(location)) && (!lastLocation || lastLocation !== location.name);
50374
- }
50375
- if (lastLocation && lastLocation === location.name) {
50376
- return false;
50377
- }
50378
- if (location.asteriskToken || hasSyntacticModifier(location, 1024 /* Async */)) {
50379
- return true;
50380
- }
50381
- return !getImmediatelyInvokedFunctionExpression(location);
50382
- }
50383
- function isSelfReferenceLocation(node) {
50384
- switch (node.kind) {
50385
- case 262 /* FunctionDeclaration */:
50386
- case 263 /* ClassDeclaration */:
50387
- case 264 /* InterfaceDeclaration */:
50388
- case 266 /* EnumDeclaration */:
50389
- case 265 /* TypeAliasDeclaration */:
50390
- case 267 /* ModuleDeclaration */:
50391
- return true;
50392
- default:
50393
- return false;
50394
- }
50395
- }
50396
50483
  function diagnosticName(nameArg) {
50397
50484
  return isString(nameArg) ? unescapeLeadingUnderscores(nameArg) : declarationNameToString(nameArg);
50398
50485
  }
50399
- function isTypeParameterSymbolDeclaredInContainer(symbol, container) {
50400
- if (symbol.declarations) {
50401
- for (const decl of symbol.declarations) {
50402
- if (decl.kind === 168 /* TypeParameter */) {
50403
- const parent2 = isJSDocTemplateTag(decl.parent) ? getJSDocHost(decl.parent) : decl.parent;
50404
- if (parent2 === container) {
50405
- return !(isJSDocTemplateTag(decl.parent) && find(decl.parent.parent.tags, isJSDocTypeAlias));
50406
- }
50407
- }
50408
- }
50409
- }
50410
- return false;
50411
- }
50412
50486
  function checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) {
50413
50487
  if (!isIdentifier(errorLocation) || errorLocation.escapedText !== name || isTypeReferenceIdentifier(errorLocation) || isInTypeQuery(errorLocation)) {
50414
50488
  return false;
@@ -50479,8 +50553,6 @@ function createTypeChecker(host) {
50479
50553
  788968 /* Type */ & ~namespaceMeaning,
50480
50554
  /*nameNotFoundMessage*/
50481
50555
  void 0,
50482
- /*nameArg*/
50483
- void 0,
50484
50556
  /*isUse*/
50485
50557
  false
50486
50558
  ));
@@ -50514,8 +50586,6 @@ function createTypeChecker(host) {
50514
50586
  ~788968 /* Type */ & 111551 /* Value */,
50515
50587
  /*nameNotFoundMessage*/
50516
50588
  void 0,
50517
- /*nameArg*/
50518
- void 0,
50519
50589
  /*isUse*/
50520
50590
  false
50521
50591
  ));
@@ -50561,8 +50631,6 @@ function createTypeChecker(host) {
50561
50631
  788968 /* Type */ & ~111551 /* Value */,
50562
50632
  /*nameNotFoundMessage*/
50563
50633
  void 0,
50564
- /*nameArg*/
50565
- void 0,
50566
50634
  /*isUse*/
50567
50635
  false
50568
50636
  ));
@@ -50614,8 +50682,6 @@ function createTypeChecker(host) {
50614
50682
  1024 /* NamespaceModule */,
50615
50683
  /*nameNotFoundMessage*/
50616
50684
  void 0,
50617
- /*nameArg*/
50618
- void 0,
50619
50685
  /*isUse*/
50620
50686
  false
50621
50687
  ));
@@ -50634,8 +50700,6 @@ function createTypeChecker(host) {
50634
50700
  1536 /* Module */,
50635
50701
  /*nameNotFoundMessage*/
50636
50702
  void 0,
50637
- /*nameArg*/
50638
- void 0,
50639
50703
  /*isUse*/
50640
50704
  false
50641
50705
  ));
@@ -51451,11 +51515,10 @@ function createTypeChecker(host) {
51451
51515
  let left = getFirstIdentifier(node);
51452
51516
  let symbol = resolveName(
51453
51517
  left,
51454
- left.escapedText,
51518
+ left,
51455
51519
  111551 /* Value */,
51456
51520
  /*nameNotFoundMessage*/
51457
51521
  void 0,
51458
- left,
51459
51522
  /*isUse*/
51460
51523
  true
51461
51524
  );
@@ -51483,10 +51546,9 @@ function createTypeChecker(host) {
51483
51546
  const symbolFromJSPrototype = isInJSFile(name) && !nodeIsSynthesized(name) ? resolveEntityNameFromAssignmentDeclaration(name, meaning) : void 0;
51484
51547
  symbol = getMergedSymbol(resolveName(
51485
51548
  location || name,
51486
- name.escapedText,
51549
+ name,
51487
51550
  meaning,
51488
51551
  ignoreErrors || symbolFromJSPrototype ? void 0 : message,
51489
- name,
51490
51552
  /*isUse*/
51491
51553
  true,
51492
51554
  /*excludeGlobals*/
@@ -51582,11 +51644,10 @@ function createTypeChecker(host) {
51582
51644
  if (secondaryLocation) {
51583
51645
  return resolveName(
51584
51646
  secondaryLocation,
51585
- name.escapedText,
51647
+ name,
51586
51648
  meaning,
51587
51649
  /*nameNotFoundMessage*/
51588
51650
  void 0,
51589
- name,
51590
51651
  /*isUse*/
51591
51652
  true
51592
51653
  );
@@ -52284,14 +52345,6 @@ function createTypeChecker(host) {
52284
52345
  function symbolIsValue(symbol, includeTypeOnlyMembers) {
52285
52346
  return !!(symbol.flags & 111551 /* Value */ || symbol.flags & 2097152 /* Alias */ && getSymbolFlags(symbol, !includeTypeOnlyMembers) & 111551 /* Value */);
52286
52347
  }
52287
- function findConstructorDeclaration(node) {
52288
- const members = node.members;
52289
- for (const member of members) {
52290
- if (member.kind === 176 /* Constructor */ && nodeIsPresent(member.body)) {
52291
- return member;
52292
- }
52293
- }
52294
- }
52295
52348
  function createType(flags) {
52296
52349
  var _a;
52297
52350
  const result = new Type28(checker, flags);
@@ -52773,8 +52826,6 @@ function createTypeChecker(host) {
52773
52826
  meaning,
52774
52827
  /*nameNotFoundMessage*/
52775
52828
  void 0,
52776
- /*nameArg*/
52777
- void 0,
52778
52829
  /*isUse*/
52779
52830
  false
52780
52831
  );
@@ -54345,8 +54396,6 @@ function createTypeChecker(host) {
54345
54396
  111551 /* Value */ | 1048576 /* ExportValue */,
54346
54397
  /*nameNotFoundMessage*/
54347
54398
  void 0,
54348
- /*nameArg*/
54349
- void 0,
54350
54399
  /*isUse*/
54351
54400
  true
54352
54401
  );
@@ -54670,7 +54719,6 @@ function createTypeChecker(host) {
54670
54719
  788968 /* Type */,
54671
54720
  /*nameNotFoundMessage*/
54672
54721
  void 0,
54673
- escapedName,
54674
54722
  /*isUse*/
54675
54723
  false
54676
54724
  );
@@ -57002,11 +57050,10 @@ function createTypeChecker(host) {
57002
57050
  if (node.parent && node.parent.kind === 277 /* ExportAssignment */) {
57003
57051
  exportSymbol = resolveName(
57004
57052
  node,
57005
- node.escapedText,
57053
+ node,
57006
57054
  111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */,
57007
57055
  /*nameNotFoundMessage*/
57008
57056
  void 0,
57009
- node,
57010
57057
  /*isUse*/
57011
57058
  false
57012
57059
  );
@@ -57039,8 +57086,6 @@ function createTypeChecker(host) {
57039
57086
  111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */,
57040
57087
  /*nameNotFoundMessage*/
57041
57088
  void 0,
57042
- /*nameArg*/
57043
- void 0,
57044
57089
  /*isUse*/
57045
57090
  false
57046
57091
  );
@@ -60860,8 +60905,6 @@ function createTypeChecker(host) {
60860
60905
  111551 /* Value */,
60861
60906
  /*nameNotFoundMessage*/
60862
60907
  void 0,
60863
- /*nameArg*/
60864
- void 0,
60865
60908
  /*isUse*/
60866
60909
  false
60867
60910
  );
@@ -61895,12 +61938,9 @@ function createTypeChecker(host) {
61895
61938
  name,
61896
61939
  meaning,
61897
61940
  diagnostic,
61898
- name,
61899
61941
  /*isUse*/
61900
61942
  false,
61901
61943
  /*excludeGlobals*/
61902
- false,
61903
- /*getSpellingSuggestions*/
61904
61944
  false
61905
61945
  );
61906
61946
  }
@@ -69285,7 +69325,6 @@ function createTypeChecker(host) {
69285
69325
  788968 /* Type */,
69286
69326
  /*nameNotFoundMessage*/
69287
69327
  void 0,
69288
- param.name.escapedText,
69289
69328
  /*isUse*/
69290
69329
  true
69291
69330
  ) || originalKeywordKind && isTypeNodeKind(originalKeywordKind))) {
@@ -70507,10 +70546,9 @@ function createTypeChecker(host) {
70507
70546
  if (!links.resolvedSymbol) {
70508
70547
  links.resolvedSymbol = !nodeIsMissing(node) && resolveName(
70509
70548
  node,
70510
- node.escapedText,
70549
+ node,
70511
70550
  111551 /* Value */ | 1048576 /* ExportValue */,
70512
70551
  getCannotFindNameDiagnosticForName(node),
70513
- node,
70514
70552
  !isWriteOnlyAccess(node),
70515
70553
  /*excludeGlobals*/
70516
70554
  false
@@ -71497,7 +71535,7 @@ function createTypeChecker(host) {
71497
71535
  case 80 /* Identifier */:
71498
71536
  if (!isThisInTypeQuery(node)) {
71499
71537
  const symbol = getResolvedSymbol(node);
71500
- return isConstantVariable(symbol) || isParameterOrMutableLocalVariable(symbol) && !isSymbolAssigned(symbol);
71538
+ return isConstantVariable(symbol) || isParameterOrMutableLocalVariable(symbol) && !isSymbolAssigned(symbol) || !!symbol.valueDeclaration && isFunctionExpression(symbol.valueDeclaration);
71501
71539
  }
71502
71540
  break;
71503
71541
  case 211 /* PropertyAccessExpression */:
@@ -73746,7 +73784,6 @@ function createTypeChecker(host) {
73746
73784
  111551 /* Value */,
73747
73785
  /*nameNotFoundMessage*/
73748
73786
  void 0,
73749
- id.escapedText,
73750
73787
  /*isUse*/
73751
73788
  true
73752
73789
  );
@@ -73796,8 +73833,6 @@ function createTypeChecker(host) {
73796
73833
  111551 /* Value */,
73797
73834
  /*nameNotFoundMessage*/
73798
73835
  void 0,
73799
- /*nameArg*/
73800
- void 0,
73801
73836
  /*isUse*/
73802
73837
  true,
73803
73838
  /*excludeGlobals*/
@@ -75174,7 +75209,6 @@ function createTypeChecker(host) {
75174
75209
  1920 /* Namespace */,
75175
75210
  /*nameNotFoundMessage*/
75176
75211
  void 0,
75177
- namespaceName,
75178
75212
  /*isUse*/
75179
75213
  false
75180
75214
  );
@@ -75389,7 +75423,6 @@ function createTypeChecker(host) {
75389
75423
  jsxFactoryNamespace,
75390
75424
  111551 /* Value */,
75391
75425
  jsxFactoryRefErr,
75392
- jsxFactoryNamespace,
75393
75426
  /*isUse*/
75394
75427
  true
75395
75428
  );
@@ -75409,7 +75442,6 @@ function createTypeChecker(host) {
75409
75442
  localJsxNamespace,
75410
75443
  111551 /* Value */,
75411
75444
  jsxFactoryRefErr,
75412
- localJsxNamespace,
75413
75445
  /*isUse*/
75414
75446
  true
75415
75447
  );
@@ -76130,38 +76162,34 @@ function createTypeChecker(host) {
76130
76162
  const suggestion = getSuggestedSymbolForNonexistentProperty(name, containingType);
76131
76163
  return suggestion && symbolName(suggestion);
76132
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
+ }
76133
76181
  function getSuggestedSymbolForNonexistentSymbol(location, outerName, meaning) {
76134
76182
  Debug.assert(outerName !== void 0, "outername should always be defined");
76135
- const result = resolveNameHelper(
76183
+ const result = resolveNameForSymbolSuggestion(
76136
76184
  location,
76137
76185
  outerName,
76138
76186
  meaning,
76139
76187
  /*nameNotFoundMessage*/
76140
76188
  void 0,
76141
- outerName,
76142
76189
  /*isUse*/
76143
76190
  false,
76144
76191
  /*excludeGlobals*/
76145
- false,
76146
- /*getSpellingSuggestions*/
76147
- true,
76148
- (symbols, name, meaning2) => {
76149
- Debug.assertEqual(outerName, name, "name should equal outerName");
76150
- const symbol = getSymbol2(symbols, name, meaning2);
76151
- if (symbol)
76152
- return symbol;
76153
- let candidates;
76154
- if (symbols === globals) {
76155
- const primitives = mapDefined(
76156
- ["string", "number", "boolean", "object", "bigint", "symbol"],
76157
- (s) => symbols.has(s.charAt(0).toUpperCase() + s.slice(1)) ? createSymbol(524288 /* TypeAlias */, s) : void 0
76158
- );
76159
- candidates = primitives.concat(arrayFrom(symbols.values()));
76160
- } else {
76161
- candidates = arrayFrom(symbols.values());
76162
- }
76163
- return getSpellingSuggestionForName(unescapeLeadingUnderscores(name), candidates, meaning2);
76164
- }
76192
+ false
76165
76193
  );
76166
76194
  return result;
76167
76195
  }
@@ -77018,8 +77046,6 @@ function createTypeChecker(host) {
77018
77046
  111551 /* Value */,
77019
77047
  /*nameNotFoundMessage*/
77020
77048
  void 0,
77021
- /*nameArg*/
77022
- void 0,
77023
77049
  /*isUse*/
77024
77050
  false
77025
77051
  );
@@ -78283,8 +78309,6 @@ function createTypeChecker(host) {
78283
78309
  111551 /* Value */,
78284
78310
  /*nameNotFoundMessage*/
78285
78311
  void 0,
78286
- /*nameArg*/
78287
- void 0,
78288
78312
  /*isUse*/
78289
78313
  false
78290
78314
  );
@@ -78402,8 +78426,6 @@ function createTypeChecker(host) {
78402
78426
  111551 /* Value */,
78403
78427
  /*nameNotFoundMessage*/
78404
78428
  void 0,
78405
- /*nameArg*/
78406
- void 0,
78407
78429
  /*isUse*/
78408
78430
  true
78409
78431
  );
@@ -79509,7 +79531,7 @@ function createTypeChecker(host) {
79509
79531
  true
79510
79532
  );
79511
79533
  }
79512
- if (expr.kind === 213 /* CallExpression */ && expr.expression.kind === 80 /* Identifier */ && checkExpressionCached(expr.expression).symbol === func.symbol) {
79534
+ if (expr.kind === 213 /* CallExpression */ && expr.expression.kind === 80 /* Identifier */ && checkExpressionCached(expr.expression).symbol === getMergedSymbol(func.symbol) && (!isFunctionExpressionOrArrowFunction(func.symbol.valueDeclaration) || isConstantReference(expr.expression))) {
79513
79535
  hasReturnOfTypeNever = true;
79514
79536
  return;
79515
79537
  }
@@ -80739,7 +80761,6 @@ function createTypeChecker(host) {
80739
80761
  788968 /* Type */,
80740
80762
  /*nameNotFoundMessage*/
80741
80763
  void 0,
80742
- name,
80743
80764
  /*isUse*/
80744
80765
  false
80745
80766
  );
@@ -83027,8 +83048,6 @@ function createTypeChecker(host) {
83027
83048
  meaning,
83028
83049
  /*nameNotFoundMessage*/
83029
83050
  void 0,
83030
- /*nameArg*/
83031
- void 0,
83032
83051
  /*isUse*/
83033
83052
  true
83034
83053
  );
@@ -83780,8 +83799,6 @@ function createTypeChecker(host) {
83780
83799
  3 /* Variable */,
83781
83800
  /*nameNotFoundMessage*/
83782
83801
  void 0,
83783
- /*nameArg*/
83784
- void 0,
83785
83802
  /*isUse*/
83786
83803
  false
83787
83804
  );
@@ -86606,8 +86623,6 @@ function createTypeChecker(host) {
86606
86623
  111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */,
86607
86624
  /*nameNotFoundMessage*/
86608
86625
  void 0,
86609
- /*nameArg*/
86610
- void 0,
86611
86626
  /*isUse*/
86612
86627
  true
86613
86628
  );
@@ -88024,8 +88039,6 @@ function createTypeChecker(host) {
88024
88039
  111551 /* Value */,
88025
88040
  /*nameNotFoundMessage*/
88026
88041
  void 0,
88027
- /*nameArg*/
88028
- void 0,
88029
88042
  /*isUse*/
88030
88043
  false
88031
88044
  )) {
@@ -88417,8 +88430,6 @@ function createTypeChecker(host) {
88417
88430
  111551 /* Value */ | 1048576 /* ExportValue */ | 2097152 /* Alias */,
88418
88431
  /*nameNotFoundMessage*/
88419
88432
  void 0,
88420
- /*nameArg*/
88421
- void 0,
88422
88433
  /*isUse*/
88423
88434
  true
88424
88435
  );
@@ -88434,13 +88445,9 @@ function createTypeChecker(host) {
88434
88445
  111551 /* Value */ | 1048576 /* ExportValue */ | 2097152 /* Alias */,
88435
88446
  /*nameNotFoundMessage*/
88436
88447
  void 0,
88437
- /*nameArg*/
88438
- void 0,
88439
88448
  /*isUse*/
88440
88449
  true,
88441
88450
  /*excludeGlobals*/
88442
- void 0,
88443
- /*getSpellingSuggestions*/
88444
88451
  void 0
88445
88452
  );
88446
88453
  }
@@ -175807,6 +175814,7 @@ __export(ts_exports2, {
175807
175814
  createModuleResolutionLoaderUsingGlobalCache: () => createModuleResolutionLoaderUsingGlobalCache,
175808
175815
  createModuleSpecifierResolutionHost: () => createModuleSpecifierResolutionHost,
175809
175816
  createMultiMap: () => createMultiMap,
175817
+ createNameResolver: () => createNameResolver,
175810
175818
  createNodeConverters: () => createNodeConverters,
175811
175819
  createNodeFactory: () => createNodeFactory,
175812
175820
  createOptionNameMap: () => createOptionNameMap,
@@ -175947,6 +175955,7 @@ __export(ts_exports2, {
175947
175955
  findChildOfKind: () => findChildOfKind,
175948
175956
  findComputedPropertyNameCacheAssignment: () => findComputedPropertyNameCacheAssignment,
175949
175957
  findConfigFile: () => findConfigFile,
175958
+ findConstructorDeclaration: () => findConstructorDeclaration,
175950
175959
  findContainingList: () => findContainingList,
175951
175960
  findDiagnosticForNode: () => findDiagnosticForNode,
175952
175961
  findFirstNonJsxWhitespaceToken: () => findFirstNonJsxWhitespaceToken,
@@ -176658,6 +176667,7 @@ __export(ts_exports2, {
176658
176667
  isConciseBody: () => isConciseBody,
176659
176668
  isConditionalExpression: () => isConditionalExpression,
176660
176669
  isConditionalTypeNode: () => isConditionalTypeNode,
176670
+ isConstAssertion: () => isConstAssertion,
176661
176671
  isConstTypeReference: () => isConstTypeReference,
176662
176672
  isConstructSignatureDeclaration: () => isConstructSignatureDeclaration,
176663
176673
  isConstructorDeclaration: () => isConstructorDeclaration,
@@ -176772,6 +176782,7 @@ __export(ts_exports2, {
176772
176782
  isGetOrSetAccessorDeclaration: () => isGetOrSetAccessorDeclaration,
176773
176783
  isGlobalDeclaration: () => isGlobalDeclaration,
176774
176784
  isGlobalScopeAugmentation: () => isGlobalScopeAugmentation,
176785
+ isGlobalSourceFile: () => isGlobalSourceFile,
176775
176786
  isGrammarError: () => isGrammarError,
176776
176787
  isHeritageClause: () => isHeritageClause,
176777
176788
  isHoistedFunction: () => isHoistedFunction,
@@ -178753,6 +178764,7 @@ var ScriptTarget10 = /* @__PURE__ */ ((ScriptTarget11) => {
178753
178764
  ScriptTarget11["ES2020"] = "es2020";
178754
178765
  ScriptTarget11["ES2021"] = "es2021";
178755
178766
  ScriptTarget11["ES2022"] = "es2022";
178767
+ ScriptTarget11["ES2023"] = "es2023";
178756
178768
  ScriptTarget11["ESNext"] = "esnext";
178757
178769
  ScriptTarget11["JSON"] = "json";
178758
178770
  ScriptTarget11["Latest"] = "esnext" /* ESNext */;
@@ -190051,6 +190063,7 @@ if (typeof console !== "undefined") {
190051
190063
  createModuleResolutionLoaderUsingGlobalCache,
190052
190064
  createModuleSpecifierResolutionHost,
190053
190065
  createMultiMap,
190066
+ createNameResolver,
190054
190067
  createNodeConverters,
190055
190068
  createNodeFactory,
190056
190069
  createOptionNameMap,
@@ -190191,6 +190204,7 @@ if (typeof console !== "undefined") {
190191
190204
  findChildOfKind,
190192
190205
  findComputedPropertyNameCacheAssignment,
190193
190206
  findConfigFile,
190207
+ findConstructorDeclaration,
190194
190208
  findContainingList,
190195
190209
  findDiagnosticForNode,
190196
190210
  findFirstNonJsxWhitespaceToken,
@@ -190902,6 +190916,7 @@ if (typeof console !== "undefined") {
190902
190916
  isConciseBody,
190903
190917
  isConditionalExpression,
190904
190918
  isConditionalTypeNode,
190919
+ isConstAssertion,
190905
190920
  isConstTypeReference,
190906
190921
  isConstructSignatureDeclaration,
190907
190922
  isConstructorDeclaration,
@@ -191016,6 +191031,7 @@ if (typeof console !== "undefined") {
191016
191031
  isGetOrSetAccessorDeclaration,
191017
191032
  isGlobalDeclaration,
191018
191033
  isGlobalScopeAugmentation,
191034
+ isGlobalSourceFile,
191019
191035
  isGrammarError,
191020
191036
  isHeritageClause,
191021
191037
  isHoistedFunction,