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/tsc.js CHANGED
@@ -18,7 +18,7 @@ and limitations under the License.
18
18
 
19
19
  // src/compiler/corePublic.ts
20
20
  var versionMajorMinor = "5.5";
21
- var version = `${versionMajorMinor}.0-dev.20240410`;
21
+ var version = `${versionMajorMinor}.0-dev.20240412`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -10060,6 +10060,8 @@ function getDefaultLibFileName(options) {
10060
10060
  switch (getEmitScriptTarget(options)) {
10061
10061
  case 99 /* ESNext */:
10062
10062
  return "lib.esnext.full.d.ts";
10063
+ case 10 /* ES2023 */:
10064
+ return "lib.es2023.full.d.ts";
10063
10065
  case 9 /* ES2022 */:
10064
10066
  return "lib.es2022.full.d.ts";
10065
10067
  case 8 /* ES2021 */:
@@ -12644,6 +12646,9 @@ function getErrorSpanForNode(sourceFile, node) {
12644
12646
  }
12645
12647
  return createTextSpanFromBounds(pos, errorNode.end);
12646
12648
  }
12649
+ function isGlobalSourceFile(node) {
12650
+ return node.kind === 307 /* SourceFile */ && !isExternalOrCommonJsModule(node);
12651
+ }
12647
12652
  function isExternalOrCommonJsModule(file) {
12648
12653
  return (file.externalModuleIndicator || file.commonJsModuleIndicator) !== void 0;
12649
12654
  }
@@ -17820,6 +17825,380 @@ function createEvaluator({ evaluateElementAccessExpression, evaluateEntityNameEx
17820
17825
  }
17821
17826
  return evaluate;
17822
17827
  }
17828
+ function isConstAssertion(location) {
17829
+ return isAssertionExpression(location) && isConstTypeReference(location.type) || isJSDocTypeTag(location) && isConstTypeReference(location.typeExpression);
17830
+ }
17831
+ function findConstructorDeclaration(node) {
17832
+ const members = node.members;
17833
+ for (const member of members) {
17834
+ if (member.kind === 176 /* Constructor */ && nodeIsPresent(member.body)) {
17835
+ return member;
17836
+ }
17837
+ }
17838
+ }
17839
+ function createNameResolver({
17840
+ compilerOptions,
17841
+ requireSymbol,
17842
+ argumentsSymbol,
17843
+ error,
17844
+ getSymbolOfDeclaration,
17845
+ globals,
17846
+ lookup,
17847
+ setRequiresScopeChangeCache = returnUndefined,
17848
+ getRequiresScopeChangeCache = returnUndefined,
17849
+ onPropertyWithInvalidInitializer = returnFalse,
17850
+ onFailedToResolveSymbol = returnUndefined,
17851
+ onSuccessfullyResolvedSymbol = returnUndefined
17852
+ }) {
17853
+ var isolatedModulesLikeFlagName = compilerOptions.verbatimModuleSyntax ? "verbatimModuleSyntax" : "isolatedModules";
17854
+ var emitStandardClassFields = getEmitStandardClassFields(compilerOptions);
17855
+ var emptySymbols = createSymbolTable();
17856
+ return resolveNameHelper;
17857
+ function resolveNameHelper(location, nameArg, meaning, nameNotFoundMessage, isUse, excludeGlobals) {
17858
+ var _a, _b, _c;
17859
+ const originalLocation = location;
17860
+ let result;
17861
+ let lastLocation;
17862
+ let lastSelfReferenceLocation;
17863
+ let propertyWithInvalidInitializer;
17864
+ let associatedDeclarationForContainingInitializerOrBindingName;
17865
+ let withinDeferredContext = false;
17866
+ let grandparent;
17867
+ const name = isString(nameArg) ? nameArg : nameArg.escapedText;
17868
+ loop:
17869
+ while (location) {
17870
+ if (name === "const" && isConstAssertion(location)) {
17871
+ return void 0;
17872
+ }
17873
+ if (isModuleOrEnumDeclaration(location) && lastLocation && location.name === lastLocation) {
17874
+ lastLocation = location;
17875
+ location = location.parent;
17876
+ }
17877
+ if (canHaveLocals(location) && location.locals && !isGlobalSourceFile(location)) {
17878
+ if (result = lookup(location.locals, name, meaning)) {
17879
+ let useResult = true;
17880
+ if (isFunctionLike(location) && lastLocation && lastLocation !== location.body) {
17881
+ if (meaning & result.flags & 788968 /* Type */ && lastLocation.kind !== 320 /* JSDoc */) {
17882
+ 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;
17883
+ }
17884
+ if (meaning & result.flags & 3 /* Variable */) {
17885
+ if (useOuterVariableScopeInParameter(result, location, lastLocation)) {
17886
+ useResult = false;
17887
+ } else if (result.flags & 1 /* FunctionScopedVariable */) {
17888
+ useResult = lastLocation.kind === 169 /* Parameter */ || lastLocation === location.type && !!findAncestor(result.valueDeclaration, isParameter);
17889
+ }
17890
+ }
17891
+ } else if (location.kind === 194 /* ConditionalType */) {
17892
+ useResult = lastLocation === location.trueType;
17893
+ }
17894
+ if (useResult) {
17895
+ break loop;
17896
+ } else {
17897
+ result = void 0;
17898
+ }
17899
+ }
17900
+ }
17901
+ withinDeferredContext = withinDeferredContext || getIsDeferredContext(location, lastLocation);
17902
+ switch (location.kind) {
17903
+ case 307 /* SourceFile */:
17904
+ if (!isExternalOrCommonJsModule(location))
17905
+ break;
17906
+ case 267 /* ModuleDeclaration */:
17907
+ const moduleExports = ((_a = getSymbolOfDeclaration(location)) == null ? void 0 : _a.exports) || emptySymbols;
17908
+ if (location.kind === 307 /* SourceFile */ || isModuleDeclaration(location) && location.flags & 33554432 /* Ambient */ && !isGlobalScopeAugmentation(location)) {
17909
+ if (result = moduleExports.get("default" /* Default */)) {
17910
+ const localSymbol = getLocalSymbolForExportDefault(result);
17911
+ if (localSymbol && result.flags & meaning && localSymbol.escapedName === name) {
17912
+ break loop;
17913
+ }
17914
+ result = void 0;
17915
+ }
17916
+ const moduleExport = moduleExports.get(name);
17917
+ if (moduleExport && moduleExport.flags === 2097152 /* Alias */ && (getDeclarationOfKind(moduleExport, 281 /* ExportSpecifier */) || getDeclarationOfKind(moduleExport, 280 /* NamespaceExport */))) {
17918
+ break;
17919
+ }
17920
+ }
17921
+ if (name !== "default" /* Default */ && (result = lookup(moduleExports, name, meaning & 2623475 /* ModuleMember */))) {
17922
+ if (isSourceFile(location) && location.commonJsModuleIndicator && !((_b = result.declarations) == null ? void 0 : _b.some(isJSDocTypeAlias))) {
17923
+ result = void 0;
17924
+ } else {
17925
+ break loop;
17926
+ }
17927
+ }
17928
+ break;
17929
+ case 266 /* EnumDeclaration */:
17930
+ if (result = lookup(((_c = getSymbolOfDeclaration(location)) == null ? void 0 : _c.exports) || emptySymbols, name, meaning & 8 /* EnumMember */)) {
17931
+ if (nameNotFoundMessage && getIsolatedModules(compilerOptions) && !(location.flags & 33554432 /* Ambient */) && getSourceFileOfNode(location) !== getSourceFileOfNode(result.valueDeclaration)) {
17932
+ error(
17933
+ originalLocation,
17934
+ Diagnostics.Cannot_access_0_from_another_file_without_qualification_when_1_is_enabled_Use_2_instead,
17935
+ unescapeLeadingUnderscores(name),
17936
+ isolatedModulesLikeFlagName,
17937
+ `${unescapeLeadingUnderscores(getSymbolOfDeclaration(location).escapedName)}.${unescapeLeadingUnderscores(name)}`
17938
+ );
17939
+ }
17940
+ break loop;
17941
+ }
17942
+ break;
17943
+ case 172 /* PropertyDeclaration */:
17944
+ if (!isStatic(location)) {
17945
+ const ctor = findConstructorDeclaration(location.parent);
17946
+ if (ctor && ctor.locals) {
17947
+ if (lookup(ctor.locals, name, meaning & 111551 /* Value */)) {
17948
+ Debug.assertNode(location, isPropertyDeclaration);
17949
+ propertyWithInvalidInitializer = location;
17950
+ }
17951
+ }
17952
+ }
17953
+ break;
17954
+ case 263 /* ClassDeclaration */:
17955
+ case 231 /* ClassExpression */:
17956
+ case 264 /* InterfaceDeclaration */:
17957
+ if (result = lookup(getSymbolOfDeclaration(location).members || emptySymbols, name, meaning & 788968 /* Type */)) {
17958
+ if (!isTypeParameterSymbolDeclaredInContainer(result, location)) {
17959
+ result = void 0;
17960
+ break;
17961
+ }
17962
+ if (lastLocation && isStatic(lastLocation)) {
17963
+ if (nameNotFoundMessage) {
17964
+ error(originalLocation, Diagnostics.Static_members_cannot_reference_class_type_parameters);
17965
+ }
17966
+ return void 0;
17967
+ }
17968
+ break loop;
17969
+ }
17970
+ if (isClassExpression(location) && meaning & 32 /* Class */) {
17971
+ const className = location.name;
17972
+ if (className && name === className.escapedText) {
17973
+ result = location.symbol;
17974
+ break loop;
17975
+ }
17976
+ }
17977
+ break;
17978
+ case 233 /* ExpressionWithTypeArguments */:
17979
+ if (lastLocation === location.expression && location.parent.token === 96 /* ExtendsKeyword */) {
17980
+ const container = location.parent.parent;
17981
+ if (isClassLike(container) && (result = lookup(getSymbolOfDeclaration(container).members, name, meaning & 788968 /* Type */))) {
17982
+ if (nameNotFoundMessage) {
17983
+ error(originalLocation, Diagnostics.Base_class_expressions_cannot_reference_class_type_parameters);
17984
+ }
17985
+ return void 0;
17986
+ }
17987
+ }
17988
+ break;
17989
+ case 167 /* ComputedPropertyName */:
17990
+ grandparent = location.parent.parent;
17991
+ if (isClassLike(grandparent) || grandparent.kind === 264 /* InterfaceDeclaration */) {
17992
+ if (result = lookup(getSymbolOfDeclaration(grandparent).members, name, meaning & 788968 /* Type */)) {
17993
+ if (nameNotFoundMessage) {
17994
+ error(originalLocation, Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type);
17995
+ }
17996
+ return void 0;
17997
+ }
17998
+ }
17999
+ break;
18000
+ case 219 /* ArrowFunction */:
18001
+ if (getEmitScriptTarget(compilerOptions) >= 2 /* ES2015 */) {
18002
+ break;
18003
+ }
18004
+ case 174 /* MethodDeclaration */:
18005
+ case 176 /* Constructor */:
18006
+ case 177 /* GetAccessor */:
18007
+ case 178 /* SetAccessor */:
18008
+ case 262 /* FunctionDeclaration */:
18009
+ if (meaning & 3 /* Variable */ && name === "arguments") {
18010
+ result = argumentsSymbol;
18011
+ break loop;
18012
+ }
18013
+ break;
18014
+ case 218 /* FunctionExpression */:
18015
+ if (meaning & 3 /* Variable */ && name === "arguments") {
18016
+ result = argumentsSymbol;
18017
+ break loop;
18018
+ }
18019
+ if (meaning & 16 /* Function */) {
18020
+ const functionName = location.name;
18021
+ if (functionName && name === functionName.escapedText) {
18022
+ result = location.symbol;
18023
+ break loop;
18024
+ }
18025
+ }
18026
+ break;
18027
+ case 170 /* Decorator */:
18028
+ if (location.parent && location.parent.kind === 169 /* Parameter */) {
18029
+ location = location.parent;
18030
+ }
18031
+ if (location.parent && (isClassElement(location.parent) || location.parent.kind === 263 /* ClassDeclaration */)) {
18032
+ location = location.parent;
18033
+ }
18034
+ break;
18035
+ case 346 /* JSDocTypedefTag */:
18036
+ case 338 /* JSDocCallbackTag */:
18037
+ case 340 /* JSDocEnumTag */:
18038
+ case 351 /* JSDocImportTag */:
18039
+ const root = getJSDocRoot(location);
18040
+ if (root) {
18041
+ location = root.parent;
18042
+ }
18043
+ break;
18044
+ case 169 /* Parameter */:
18045
+ if (lastLocation && (lastLocation === location.initializer || lastLocation === location.name && isBindingPattern(lastLocation))) {
18046
+ if (!associatedDeclarationForContainingInitializerOrBindingName) {
18047
+ associatedDeclarationForContainingInitializerOrBindingName = location;
18048
+ }
18049
+ }
18050
+ break;
18051
+ case 208 /* BindingElement */:
18052
+ if (lastLocation && (lastLocation === location.initializer || lastLocation === location.name && isBindingPattern(lastLocation))) {
18053
+ if (isParameterDeclaration(location) && !associatedDeclarationForContainingInitializerOrBindingName) {
18054
+ associatedDeclarationForContainingInitializerOrBindingName = location;
18055
+ }
18056
+ }
18057
+ break;
18058
+ case 195 /* InferType */:
18059
+ if (meaning & 262144 /* TypeParameter */) {
18060
+ const parameterName = location.typeParameter.name;
18061
+ if (parameterName && name === parameterName.escapedText) {
18062
+ result = location.typeParameter.symbol;
18063
+ break loop;
18064
+ }
18065
+ }
18066
+ break;
18067
+ case 281 /* ExportSpecifier */:
18068
+ if (lastLocation && lastLocation === location.propertyName && location.parent.parent.moduleSpecifier) {
18069
+ location = location.parent.parent.parent;
18070
+ }
18071
+ break;
18072
+ }
18073
+ if (isSelfReferenceLocation(location)) {
18074
+ lastSelfReferenceLocation = location;
18075
+ }
18076
+ lastLocation = location;
18077
+ location = isJSDocTemplateTag(location) ? getEffectiveContainerForJSDocTemplateTag(location) || location.parent : isJSDocParameterTag(location) || isJSDocReturnTag(location) ? getHostSignatureFromJSDoc(location) || location.parent : location.parent;
18078
+ }
18079
+ if (isUse && result && (!lastSelfReferenceLocation || result !== lastSelfReferenceLocation.symbol)) {
18080
+ result.isReferenced |= meaning;
18081
+ }
18082
+ if (!result) {
18083
+ if (lastLocation) {
18084
+ Debug.assertNode(lastLocation, isSourceFile);
18085
+ if (lastLocation.commonJsModuleIndicator && name === "exports" && meaning & lastLocation.symbol.flags) {
18086
+ return lastLocation.symbol;
18087
+ }
18088
+ }
18089
+ if (!excludeGlobals) {
18090
+ result = lookup(globals, name, meaning);
18091
+ }
18092
+ }
18093
+ if (!result) {
18094
+ if (originalLocation && isInJSFile(originalLocation) && originalLocation.parent) {
18095
+ if (isRequireCall(
18096
+ originalLocation.parent,
18097
+ /*requireStringLiteralLikeArgument*/
18098
+ false
18099
+ )) {
18100
+ return requireSymbol;
18101
+ }
18102
+ }
18103
+ }
18104
+ if (nameNotFoundMessage) {
18105
+ if (propertyWithInvalidInitializer && onPropertyWithInvalidInitializer(originalLocation, name, propertyWithInvalidInitializer, result)) {
18106
+ return void 0;
18107
+ }
18108
+ if (!result) {
18109
+ onFailedToResolveSymbol(originalLocation, nameArg, meaning, nameNotFoundMessage);
18110
+ } else {
18111
+ onSuccessfullyResolvedSymbol(originalLocation, result, meaning, lastLocation, associatedDeclarationForContainingInitializerOrBindingName, withinDeferredContext);
18112
+ }
18113
+ }
18114
+ return result;
18115
+ }
18116
+ function useOuterVariableScopeInParameter(result, location, lastLocation) {
18117
+ const target = getEmitScriptTarget(compilerOptions);
18118
+ const functionLocation = location;
18119
+ if (isParameter(lastLocation) && functionLocation.body && result.valueDeclaration && result.valueDeclaration.pos >= functionLocation.body.pos && result.valueDeclaration.end <= functionLocation.body.end) {
18120
+ if (target >= 2 /* ES2015 */) {
18121
+ let declarationRequiresScopeChange = getRequiresScopeChangeCache(functionLocation);
18122
+ if (declarationRequiresScopeChange === void 0) {
18123
+ declarationRequiresScopeChange = forEach(functionLocation.parameters, requiresScopeChange) || false;
18124
+ setRequiresScopeChangeCache(functionLocation, declarationRequiresScopeChange);
18125
+ }
18126
+ return !declarationRequiresScopeChange;
18127
+ }
18128
+ }
18129
+ return false;
18130
+ function requiresScopeChange(node) {
18131
+ return requiresScopeChangeWorker(node.name) || !!node.initializer && requiresScopeChangeWorker(node.initializer);
18132
+ }
18133
+ function requiresScopeChangeWorker(node) {
18134
+ switch (node.kind) {
18135
+ case 219 /* ArrowFunction */:
18136
+ case 218 /* FunctionExpression */:
18137
+ case 262 /* FunctionDeclaration */:
18138
+ case 176 /* Constructor */:
18139
+ return false;
18140
+ case 174 /* MethodDeclaration */:
18141
+ case 177 /* GetAccessor */:
18142
+ case 178 /* SetAccessor */:
18143
+ case 303 /* PropertyAssignment */:
18144
+ return requiresScopeChangeWorker(node.name);
18145
+ case 172 /* PropertyDeclaration */:
18146
+ if (hasStaticModifier(node)) {
18147
+ return !emitStandardClassFields;
18148
+ }
18149
+ return requiresScopeChangeWorker(node.name);
18150
+ default:
18151
+ if (isNullishCoalesce(node) || isOptionalChain(node)) {
18152
+ return target < 7 /* ES2020 */;
18153
+ }
18154
+ if (isBindingElement(node) && node.dotDotDotToken && isObjectBindingPattern(node.parent)) {
18155
+ return target < 4 /* ES2017 */;
18156
+ }
18157
+ if (isTypeNode(node))
18158
+ return false;
18159
+ return forEachChild(node, requiresScopeChangeWorker) || false;
18160
+ }
18161
+ }
18162
+ }
18163
+ function getIsDeferredContext(location, lastLocation) {
18164
+ if (location.kind !== 219 /* ArrowFunction */ && location.kind !== 218 /* FunctionExpression */) {
18165
+ return isTypeQueryNode(location) || (isFunctionLikeDeclaration(location) || location.kind === 172 /* PropertyDeclaration */ && !isStatic(location)) && (!lastLocation || lastLocation !== location.name);
18166
+ }
18167
+ if (lastLocation && lastLocation === location.name) {
18168
+ return false;
18169
+ }
18170
+ if (location.asteriskToken || hasSyntacticModifier(location, 1024 /* Async */)) {
18171
+ return true;
18172
+ }
18173
+ return !getImmediatelyInvokedFunctionExpression(location);
18174
+ }
18175
+ function isSelfReferenceLocation(node) {
18176
+ switch (node.kind) {
18177
+ case 262 /* FunctionDeclaration */:
18178
+ case 263 /* ClassDeclaration */:
18179
+ case 264 /* InterfaceDeclaration */:
18180
+ case 266 /* EnumDeclaration */:
18181
+ case 265 /* TypeAliasDeclaration */:
18182
+ case 267 /* ModuleDeclaration */:
18183
+ return true;
18184
+ default:
18185
+ return false;
18186
+ }
18187
+ }
18188
+ function isTypeParameterSymbolDeclaredInContainer(symbol, container) {
18189
+ if (symbol.declarations) {
18190
+ for (const decl of symbol.declarations) {
18191
+ if (decl.kind === 168 /* TypeParameter */) {
18192
+ const parent = isJSDocTemplateTag(decl.parent) ? getJSDocHost(decl.parent) : decl.parent;
18193
+ if (parent === container) {
18194
+ return !(isJSDocTemplateTag(decl.parent) && find(decl.parent.parent.tags, isJSDocTypeAlias));
18195
+ }
18196
+ }
18197
+ }
18198
+ }
18199
+ return false;
18200
+ }
18201
+ }
17823
18202
 
17824
18203
  // src/compiler/factory/baseNodeFactory.ts
17825
18204
  function createBaseNodeFactory() {
@@ -34253,6 +34632,7 @@ var targetOptionDeclaration = {
34253
34632
  es2020: 7 /* ES2020 */,
34254
34633
  es2021: 8 /* ES2021 */,
34255
34634
  es2022: 9 /* ES2022 */,
34635
+ es2023: 10 /* ES2023 */,
34256
34636
  esnext: 99 /* ESNext */
34257
34637
  })),
34258
34638
  affectsSourceFile: true,
@@ -38856,7 +39236,7 @@ function loadModuleFromImportsOrExports(extensions, state, cache, redirectedRefe
38856
39236
  moduleName
38857
39237
  );
38858
39238
  }
38859
- const expandingKeys = sort(filter(getOwnKeys(lookupTable), (k) => k.includes("*") || endsWith(k, "/")), comparePatternKeys);
39239
+ const expandingKeys = sort(filter(getOwnKeys(lookupTable), (k) => hasOneAsterisk(k) || endsWith(k, "/")), comparePatternKeys);
38860
39240
  for (const potentialTarget of expandingKeys) {
38861
39241
  if (state.features & 16 /* ExportsPatternTrailers */ && matchesPatternWithTrailer(potentialTarget, moduleName)) {
38862
39242
  const target = lookupTable[potentialTarget];
@@ -38900,6 +39280,10 @@ function loadModuleFromImportsOrExports(extensions, state, cache, redirectedRefe
38900
39280
  return startsWith(name, target.substring(0, starPos)) && endsWith(name, target.substring(starPos + 1));
38901
39281
  }
38902
39282
  }
39283
+ function hasOneAsterisk(patternKey) {
39284
+ const firstStar = patternKey.indexOf("*");
39285
+ return firstStar !== -1 && firstStar === patternKey.lastIndexOf("*");
39286
+ }
38903
39287
  function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports) {
38904
39288
  return loadModuleFromTargetImportOrExport;
38905
39289
  function loadModuleFromTargetImportOrExport(target, subpath, pattern, key) {
@@ -43642,6 +44026,31 @@ function createTypeChecker(host) {
43642
44026
  var lastGetCombinedNodeFlagsResult = 0 /* None */;
43643
44027
  var lastGetCombinedModifierFlagsNode;
43644
44028
  var lastGetCombinedModifierFlagsResult = 0 /* None */;
44029
+ var resolveName = createNameResolver({
44030
+ compilerOptions,
44031
+ requireSymbol,
44032
+ argumentsSymbol,
44033
+ globals,
44034
+ getSymbolOfDeclaration,
44035
+ error,
44036
+ getRequiresScopeChangeCache,
44037
+ setRequiresScopeChangeCache,
44038
+ lookup: getSymbol,
44039
+ onPropertyWithInvalidInitializer: checkAndReportErrorForInvalidInitializer,
44040
+ onFailedToResolveSymbol,
44041
+ onSuccessfullyResolvedSymbol
44042
+ });
44043
+ var resolveNameForSymbolSuggestion = createNameResolver({
44044
+ compilerOptions,
44045
+ requireSymbol,
44046
+ argumentsSymbol,
44047
+ globals,
44048
+ getSymbolOfDeclaration,
44049
+ error,
44050
+ getRequiresScopeChangeCache,
44051
+ setRequiresScopeChangeCache,
44052
+ lookup: getSuggestionForSymbolNameLookup
44053
+ });
43645
44054
  const checker = {
43646
44055
  getNodeCount: () => reduceLeft(host.getSourceFiles(), (n, s) => n + s.nodeCount, 0),
43647
44056
  getIdentifierCount: () => reduceLeft(host.getSourceFiles(), (n, s) => n + s.identifierCount, 0),
@@ -43947,8 +44356,6 @@ function createTypeChecker(host) {
43947
44356
  meaning,
43948
44357
  /*nameNotFoundMessage*/
43949
44358
  void 0,
43950
- /*nameArg*/
43951
- void 0,
43952
44359
  /*isUse*/
43953
44360
  false,
43954
44361
  excludeGlobals
@@ -44978,9 +45385,6 @@ function createTypeChecker(host) {
44978
45385
  const nodeId = getNodeId(node);
44979
45386
  return nodeLinks[nodeId] || (nodeLinks[nodeId] = new NodeLinks());
44980
45387
  }
44981
- function isGlobalSourceFile(node) {
44982
- return node.kind === 307 /* SourceFile */ && !isExternalOrCommonJsModule(node);
44983
- }
44984
45388
  function getSymbol(symbols, name, meaning) {
44985
45389
  if (meaning) {
44986
45390
  const symbol = getMergedSymbol(symbols.get(name));
@@ -45156,417 +45560,120 @@ function createTypeChecker(host) {
45156
45560
  return ancestorChangingReferenceScope === void 0;
45157
45561
  }
45158
45562
  }
45159
- function useOuterVariableScopeInParameter(result, location, lastLocation) {
45160
- const target = getEmitScriptTarget(compilerOptions);
45161
- const functionLocation = location;
45162
- if (isParameter(lastLocation) && functionLocation.body && result.valueDeclaration && result.valueDeclaration.pos >= functionLocation.body.pos && result.valueDeclaration.end <= functionLocation.body.end) {
45163
- if (target >= 2 /* ES2015 */) {
45164
- const links = getNodeLinks(functionLocation);
45165
- if (links.declarationRequiresScopeChange === void 0) {
45166
- links.declarationRequiresScopeChange = forEach(functionLocation.parameters, requiresScopeChange) || false;
45167
- }
45168
- return !links.declarationRequiresScopeChange;
45563
+ function getRequiresScopeChangeCache(node) {
45564
+ return getNodeLinks(node).declarationRequiresScopeChange;
45565
+ }
45566
+ function setRequiresScopeChangeCache(node, value) {
45567
+ getNodeLinks(node).declarationRequiresScopeChange = value;
45568
+ }
45569
+ function checkAndReportErrorForInvalidInitializer(errorLocation, name, propertyWithInvalidInitializer, result) {
45570
+ if (!emitStandardClassFields) {
45571
+ if (errorLocation && !result && checkAndReportErrorForMissingPrefix(errorLocation, name, name)) {
45572
+ return true;
45169
45573
  }
45574
+ error(
45575
+ errorLocation,
45576
+ 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,
45577
+ declarationNameToString(propertyWithInvalidInitializer.name),
45578
+ diagnosticName(name)
45579
+ );
45580
+ return true;
45170
45581
  }
45171
45582
  return false;
45172
- function requiresScopeChange(node) {
45173
- return requiresScopeChangeWorker(node.name) || !!node.initializer && requiresScopeChangeWorker(node.initializer);
45174
- }
45175
- function requiresScopeChangeWorker(node) {
45176
- switch (node.kind) {
45177
- case 219 /* ArrowFunction */:
45178
- case 218 /* FunctionExpression */:
45179
- case 262 /* FunctionDeclaration */:
45180
- case 176 /* Constructor */:
45181
- return false;
45182
- case 174 /* MethodDeclaration */:
45183
- case 177 /* GetAccessor */:
45184
- case 178 /* SetAccessor */:
45185
- case 303 /* PropertyAssignment */:
45186
- return requiresScopeChangeWorker(node.name);
45187
- case 172 /* PropertyDeclaration */:
45188
- if (hasStaticModifier(node)) {
45189
- return !emitStandardClassFields;
45190
- }
45191
- return requiresScopeChangeWorker(node.name);
45192
- default:
45193
- if (isNullishCoalesce(node) || isOptionalChain(node)) {
45194
- return target < 7 /* ES2020 */;
45195
- }
45196
- if (isBindingElement(node) && node.dotDotDotToken && isObjectBindingPattern(node.parent)) {
45197
- return target < 4 /* ES2017 */;
45198
- }
45199
- if (isTypeNode(node))
45200
- return false;
45201
- return forEachChild(node, requiresScopeChangeWorker) || false;
45202
- }
45203
- }
45204
45583
  }
45205
- function isConstAssertion(location) {
45206
- return isAssertionExpression(location) && isConstTypeReference(location.type) || isJSDocTypeTag(location) && isConstTypeReference(location.typeExpression);
45207
- }
45208
- function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals = false, getSpellingSuggestions = true) {
45209
- return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, getSymbol);
45210
- }
45211
- function resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, lookup) {
45212
- var _a, _b, _c;
45213
- const originalLocation = location;
45214
- let result;
45215
- let lastLocation;
45216
- let lastSelfReferenceLocation;
45217
- let propertyWithInvalidInitializer;
45218
- let associatedDeclarationForContainingInitializerOrBindingName;
45219
- let withinDeferredContext = false;
45220
- const errorLocation = location;
45221
- let grandparent;
45222
- let isInExternalModule = false;
45223
- loop:
45224
- while (location) {
45225
- if (name === "const" && isConstAssertion(location)) {
45226
- return void 0;
45227
- }
45228
- if (isModuleOrEnumDeclaration(location) && lastLocation && location.name === lastLocation) {
45229
- lastLocation = location;
45230
- location = location.parent;
45231
- }
45232
- if (canHaveLocals(location) && location.locals && !isGlobalSourceFile(location)) {
45233
- if (result = lookup(location.locals, name, meaning)) {
45234
- let useResult = true;
45235
- if (isFunctionLike(location) && lastLocation && lastLocation !== location.body) {
45236
- if (meaning & result.flags & 788968 /* Type */ && lastLocation.kind !== 320 /* JSDoc */) {
45237
- 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;
45238
- }
45239
- if (meaning & result.flags & 3 /* Variable */) {
45240
- if (useOuterVariableScopeInParameter(result, location, lastLocation)) {
45241
- useResult = false;
45242
- } else if (result.flags & 1 /* FunctionScopedVariable */) {
45243
- useResult = lastLocation.kind === 169 /* Parameter */ || lastLocation === location.type && !!findAncestor(result.valueDeclaration, isParameter);
45244
- }
45245
- }
45246
- } else if (location.kind === 194 /* ConditionalType */) {
45247
- useResult = lastLocation === location.trueType;
45248
- }
45249
- if (useResult) {
45250
- break loop;
45251
- } else {
45252
- result = void 0;
45584
+ function onFailedToResolveSymbol(errorLocation, nameArg, meaning, nameNotFoundMessage) {
45585
+ const name = isString(nameArg) ? nameArg : nameArg.escapedText;
45586
+ addLazyDiagnostic(() => {
45587
+ 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)) {
45588
+ let suggestion;
45589
+ let suggestedLib;
45590
+ if (nameArg) {
45591
+ suggestedLib = getSuggestedLibForNonExistentName(nameArg);
45592
+ if (suggestedLib) {
45593
+ error(errorLocation, nameNotFoundMessage, diagnosticName(nameArg), suggestedLib);
45594
+ }
45595
+ }
45596
+ if (!suggestedLib && suggestionCount < maximumSuggestionCount) {
45597
+ suggestion = getSuggestedSymbolForNonexistentSymbol(errorLocation, name, meaning);
45598
+ const isGlobalScopeAugmentationDeclaration = (suggestion == null ? void 0 : suggestion.valueDeclaration) && isAmbientModule(suggestion.valueDeclaration) && isGlobalScopeAugmentation(suggestion.valueDeclaration);
45599
+ if (isGlobalScopeAugmentationDeclaration) {
45600
+ suggestion = void 0;
45601
+ }
45602
+ if (suggestion) {
45603
+ const suggestionName = symbolToString(suggestion);
45604
+ const isUncheckedJS = isUncheckedJSSuggestion(
45605
+ errorLocation,
45606
+ suggestion,
45607
+ /*excludeClasses*/
45608
+ false
45609
+ );
45610
+ 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;
45611
+ const diagnostic = createError(errorLocation, message, diagnosticName(nameArg), suggestionName);
45612
+ addErrorOrSuggestion(!isUncheckedJS, diagnostic);
45613
+ if (suggestion.valueDeclaration) {
45614
+ addRelatedInfo(
45615
+ diagnostic,
45616
+ createDiagnosticForNode(suggestion.valueDeclaration, Diagnostics._0_is_declared_here, suggestionName)
45617
+ );
45253
45618
  }
45254
45619
  }
45255
45620
  }
45256
- withinDeferredContext = withinDeferredContext || getIsDeferredContext(location, lastLocation);
45257
- switch (location.kind) {
45258
- case 307 /* SourceFile */:
45259
- if (!isExternalOrCommonJsModule(location))
45260
- break;
45261
- isInExternalModule = true;
45262
- case 267 /* ModuleDeclaration */:
45263
- const moduleExports = ((_a = getSymbolOfDeclaration(location)) == null ? void 0 : _a.exports) || emptySymbols;
45264
- if (location.kind === 307 /* SourceFile */ || isModuleDeclaration(location) && location.flags & 33554432 /* Ambient */ && !isGlobalScopeAugmentation(location)) {
45265
- if (result = moduleExports.get("default" /* Default */)) {
45266
- const localSymbol = getLocalSymbolForExportDefault(result);
45267
- if (localSymbol && result.flags & meaning && localSymbol.escapedName === name) {
45268
- break loop;
45269
- }
45270
- result = void 0;
45271
- }
45272
- const moduleExport = moduleExports.get(name);
45273
- if (moduleExport && moduleExport.flags === 2097152 /* Alias */ && (getDeclarationOfKind(moduleExport, 281 /* ExportSpecifier */) || getDeclarationOfKind(moduleExport, 280 /* NamespaceExport */))) {
45274
- break;
45275
- }
45276
- }
45277
- if (name !== "default" /* Default */ && (result = lookup(moduleExports, name, meaning & 2623475 /* ModuleMember */))) {
45278
- if (isSourceFile(location) && location.commonJsModuleIndicator && !((_b = result.declarations) == null ? void 0 : _b.some(isJSDocTypeAlias))) {
45279
- result = void 0;
45280
- } else {
45281
- break loop;
45282
- }
45283
- }
45284
- break;
45285
- case 266 /* EnumDeclaration */:
45286
- if (result = lookup(((_c = getSymbolOfDeclaration(location)) == null ? void 0 : _c.exports) || emptySymbols, name, meaning & 8 /* EnumMember */)) {
45287
- if (nameNotFoundMessage && getIsolatedModules(compilerOptions) && !(location.flags & 33554432 /* Ambient */) && getSourceFileOfNode(location) !== getSourceFileOfNode(result.valueDeclaration)) {
45288
- error(
45289
- errorLocation,
45290
- Diagnostics.Cannot_access_0_from_another_file_without_qualification_when_1_is_enabled_Use_2_instead,
45291
- unescapeLeadingUnderscores(name),
45292
- isolatedModulesLikeFlagName,
45293
- `${unescapeLeadingUnderscores(getSymbolOfNode(location).escapedName)}.${unescapeLeadingUnderscores(name)}`
45294
- );
45295
- }
45296
- break loop;
45297
- }
45298
- break;
45299
- case 172 /* PropertyDeclaration */:
45300
- if (!isStatic(location)) {
45301
- const ctor = findConstructorDeclaration(location.parent);
45302
- if (ctor && ctor.locals) {
45303
- if (lookup(ctor.locals, name, meaning & 111551 /* Value */)) {
45304
- Debug.assertNode(location, isPropertyDeclaration);
45305
- propertyWithInvalidInitializer = location;
45306
- }
45307
- }
45308
- }
45309
- break;
45310
- case 263 /* ClassDeclaration */:
45311
- case 231 /* ClassExpression */:
45312
- case 264 /* InterfaceDeclaration */:
45313
- if (result = lookup(getSymbolOfDeclaration(location).members || emptySymbols, name, meaning & 788968 /* Type */)) {
45314
- if (!isTypeParameterSymbolDeclaredInContainer(result, location)) {
45315
- result = void 0;
45316
- break;
45317
- }
45318
- if (lastLocation && isStatic(lastLocation)) {
45319
- if (nameNotFoundMessage) {
45320
- error(errorLocation, Diagnostics.Static_members_cannot_reference_class_type_parameters);
45321
- }
45322
- return void 0;
45323
- }
45324
- break loop;
45325
- }
45326
- if (isClassExpression(location) && meaning & 32 /* Class */) {
45327
- const className = location.name;
45328
- if (className && name === className.escapedText) {
45329
- result = location.symbol;
45330
- break loop;
45331
- }
45332
- }
45333
- break;
45334
- case 233 /* ExpressionWithTypeArguments */:
45335
- if (lastLocation === location.expression && location.parent.token === 96 /* ExtendsKeyword */) {
45336
- const container = location.parent.parent;
45337
- if (isClassLike(container) && (result = lookup(getSymbolOfDeclaration(container).members, name, meaning & 788968 /* Type */))) {
45338
- if (nameNotFoundMessage) {
45339
- error(errorLocation, Diagnostics.Base_class_expressions_cannot_reference_class_type_parameters);
45340
- }
45341
- return void 0;
45342
- }
45343
- }
45344
- break;
45345
- case 167 /* ComputedPropertyName */:
45346
- grandparent = location.parent.parent;
45347
- if (isClassLike(grandparent) || grandparent.kind === 264 /* InterfaceDeclaration */) {
45348
- if (result = lookup(getSymbolOfDeclaration(grandparent).members, name, meaning & 788968 /* Type */)) {
45349
- if (nameNotFoundMessage) {
45350
- error(errorLocation, Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type);
45351
- }
45352
- return void 0;
45353
- }
45354
- }
45355
- break;
45356
- case 219 /* ArrowFunction */:
45357
- if (getEmitScriptTarget(compilerOptions) >= 2 /* ES2015 */) {
45358
- break;
45359
- }
45360
- case 174 /* MethodDeclaration */:
45361
- case 176 /* Constructor */:
45362
- case 177 /* GetAccessor */:
45363
- case 178 /* SetAccessor */:
45364
- case 262 /* FunctionDeclaration */:
45365
- if (meaning & 3 /* Variable */ && name === "arguments") {
45366
- result = argumentsSymbol;
45367
- break loop;
45368
- }
45369
- break;
45370
- case 218 /* FunctionExpression */:
45371
- if (meaning & 3 /* Variable */ && name === "arguments") {
45372
- result = argumentsSymbol;
45373
- break loop;
45374
- }
45375
- if (meaning & 16 /* Function */) {
45376
- const functionName = location.name;
45377
- if (functionName && name === functionName.escapedText) {
45378
- result = location.symbol;
45379
- break loop;
45380
- }
45381
- }
45382
- break;
45383
- case 170 /* Decorator */:
45384
- if (location.parent && location.parent.kind === 169 /* Parameter */) {
45385
- location = location.parent;
45386
- }
45387
- if (location.parent && (isClassElement(location.parent) || location.parent.kind === 263 /* ClassDeclaration */)) {
45388
- location = location.parent;
45389
- }
45390
- break;
45391
- case 346 /* JSDocTypedefTag */:
45392
- case 338 /* JSDocCallbackTag */:
45393
- case 340 /* JSDocEnumTag */:
45394
- case 351 /* JSDocImportTag */:
45395
- const root = getJSDocRoot(location);
45396
- if (root) {
45397
- location = root.parent;
45398
- }
45399
- break;
45400
- case 169 /* Parameter */:
45401
- if (lastLocation && (lastLocation === location.initializer || lastLocation === location.name && isBindingPattern(lastLocation))) {
45402
- if (!associatedDeclarationForContainingInitializerOrBindingName) {
45403
- associatedDeclarationForContainingInitializerOrBindingName = location;
45404
- }
45405
- }
45406
- break;
45407
- case 208 /* BindingElement */:
45408
- if (lastLocation && (lastLocation === location.initializer || lastLocation === location.name && isBindingPattern(lastLocation))) {
45409
- if (isParameterDeclaration(location) && !associatedDeclarationForContainingInitializerOrBindingName) {
45410
- associatedDeclarationForContainingInitializerOrBindingName = location;
45411
- }
45412
- }
45413
- break;
45414
- case 195 /* InferType */:
45415
- if (meaning & 262144 /* TypeParameter */) {
45416
- const parameterName = location.typeParameter.name;
45417
- if (parameterName && name === parameterName.escapedText) {
45418
- result = location.typeParameter.symbol;
45419
- break loop;
45420
- }
45421
- }
45422
- break;
45423
- case 281 /* ExportSpecifier */:
45424
- if (lastLocation && lastLocation === location.propertyName && location.parent.parent.moduleSpecifier) {
45425
- location = location.parent.parent.parent;
45426
- }
45427
- break;
45428
- }
45429
- if (isSelfReferenceLocation(location)) {
45430
- lastSelfReferenceLocation = location;
45431
- }
45432
- lastLocation = location;
45433
- location = isJSDocTemplateTag(location) ? getEffectiveContainerForJSDocTemplateTag(location) || location.parent : isJSDocParameterTag(location) || isJSDocReturnTag(location) ? getHostSignatureFromJSDoc(location) || location.parent : location.parent;
45434
- }
45435
- if (isUse && result && (!lastSelfReferenceLocation || result !== lastSelfReferenceLocation.symbol)) {
45436
- result.isReferenced |= meaning;
45437
- }
45438
- if (!result) {
45439
- if (lastLocation) {
45440
- Debug.assertNode(lastLocation, isSourceFile);
45441
- if (lastLocation.commonJsModuleIndicator && name === "exports" && meaning & lastLocation.symbol.flags) {
45442
- return lastLocation.symbol;
45621
+ if (!suggestion && !suggestedLib && nameArg) {
45622
+ error(errorLocation, nameNotFoundMessage, diagnosticName(nameArg));
45443
45623
  }
45624
+ suggestionCount++;
45444
45625
  }
45445
- if (!excludeGlobals) {
45446
- result = lookup(globals, name, meaning);
45447
- }
45448
- }
45449
- if (!result) {
45450
- if (originalLocation && isInJSFile(originalLocation) && originalLocation.parent) {
45451
- if (isRequireCall(
45452
- originalLocation.parent,
45453
- /*requireStringLiteralLikeArgument*/
45454
- false
45455
- )) {
45456
- return requireSymbol;
45626
+ });
45627
+ }
45628
+ function onSuccessfullyResolvedSymbol(errorLocation, result, meaning, lastLocation, associatedDeclarationForContainingInitializerOrBindingName, withinDeferredContext) {
45629
+ addLazyDiagnostic(() => {
45630
+ var _a;
45631
+ const name = result.escapedName;
45632
+ const isInExternalModule = lastLocation && isSourceFile(lastLocation) && isExternalOrCommonJsModule(lastLocation);
45633
+ if (errorLocation && (meaning & 2 /* BlockScopedVariable */ || (meaning & 32 /* Class */ || meaning & 384 /* Enum */) && (meaning & 111551 /* Value */) === 111551 /* Value */)) {
45634
+ const exportOrLocalSymbol = getExportSymbolOfValueSymbolIfExported(result);
45635
+ if (exportOrLocalSymbol.flags & 2 /* BlockScopedVariable */ || exportOrLocalSymbol.flags & 32 /* Class */ || exportOrLocalSymbol.flags & 384 /* Enum */) {
45636
+ checkResolvedBlockScopedVariable(exportOrLocalSymbol, errorLocation);
45637
+ }
45638
+ }
45639
+ if (isInExternalModule && (meaning & 111551 /* Value */) === 111551 /* Value */ && !(errorLocation.flags & 16777216 /* JSDoc */)) {
45640
+ const merged = getMergedSymbol(result);
45641
+ if (length(merged.declarations) && every(merged.declarations, (d) => isNamespaceExportDeclaration(d) || isSourceFile(d) && !!d.symbol.globalExports)) {
45642
+ 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));
45643
+ }
45644
+ }
45645
+ if (associatedDeclarationForContainingInitializerOrBindingName && !withinDeferredContext && (meaning & 111551 /* Value */) === 111551 /* Value */) {
45646
+ const candidate = getMergedSymbol(getLateBoundSymbol(result));
45647
+ const root = getRootDeclaration(associatedDeclarationForContainingInitializerOrBindingName);
45648
+ if (candidate === getSymbolOfDeclaration(associatedDeclarationForContainingInitializerOrBindingName)) {
45649
+ error(errorLocation, Diagnostics.Parameter_0_cannot_reference_itself, declarationNameToString(associatedDeclarationForContainingInitializerOrBindingName.name));
45650
+ } else if (candidate.valueDeclaration && candidate.valueDeclaration.pos > associatedDeclarationForContainingInitializerOrBindingName.pos && root.parent.locals && getSymbol(root.parent.locals, candidate.escapedName, meaning) === candidate) {
45651
+ error(errorLocation, Diagnostics.Parameter_0_cannot_reference_identifier_1_declared_after_it, declarationNameToString(associatedDeclarationForContainingInitializerOrBindingName.name), declarationNameToString(errorLocation));
45652
+ }
45653
+ }
45654
+ if (errorLocation && meaning & 111551 /* Value */ && result.flags & 2097152 /* Alias */ && !(result.flags & 111551 /* Value */) && !isValidTypeOnlyAliasUseSite(errorLocation)) {
45655
+ const typeOnlyDeclaration = getTypeOnlyAliasDeclaration(result, 111551 /* Value */);
45656
+ if (typeOnlyDeclaration) {
45657
+ 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;
45658
+ const unescapedName = unescapeLeadingUnderscores(name);
45659
+ addTypeOnlyDeclarationRelatedInfo(
45660
+ error(errorLocation, message, unescapedName),
45661
+ typeOnlyDeclaration,
45662
+ unescapedName
45663
+ );
45457
45664
  }
45458
45665
  }
45459
- }
45460
- function checkAndReportErrorForInvalidInitializer() {
45461
- if (propertyWithInvalidInitializer && !emitStandardClassFields) {
45462
- error(
45463
- errorLocation,
45464
- 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,
45465
- declarationNameToString(propertyWithInvalidInitializer.name),
45466
- diagnosticName(nameArg)
45467
- );
45468
- return true;
45469
- }
45470
- return false;
45471
- }
45472
- if (!result) {
45473
- if (nameNotFoundMessage) {
45474
- addLazyDiagnostic(() => {
45475
- if (!errorLocation || errorLocation.parent.kind !== 324 /* JSDocLink */ && !checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) && // TODO: GH#18217
45476
- !checkAndReportErrorForInvalidInitializer() && !checkAndReportErrorForExtendingInterface(errorLocation) && !checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) && !checkAndReportErrorForExportingPrimitiveType(errorLocation, name) && !checkAndReportErrorForUsingNamespaceAsTypeOrValue(errorLocation, name, meaning) && !checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) && !checkAndReportErrorForUsingValueAsType(errorLocation, name, meaning)) {
45477
- let suggestion;
45478
- let suggestedLib;
45479
- if (nameArg) {
45480
- suggestedLib = getSuggestedLibForNonExistentName(nameArg);
45481
- if (suggestedLib) {
45482
- error(errorLocation, nameNotFoundMessage, diagnosticName(nameArg), suggestedLib);
45483
- }
45484
- }
45485
- if (!suggestedLib && getSpellingSuggestions && suggestionCount < maximumSuggestionCount) {
45486
- suggestion = getSuggestedSymbolForNonexistentSymbol(originalLocation, name, meaning);
45487
- const isGlobalScopeAugmentationDeclaration = (suggestion == null ? void 0 : suggestion.valueDeclaration) && isAmbientModule(suggestion.valueDeclaration) && isGlobalScopeAugmentation(suggestion.valueDeclaration);
45488
- if (isGlobalScopeAugmentationDeclaration) {
45489
- suggestion = void 0;
45490
- }
45491
- if (suggestion) {
45492
- const suggestionName = symbolToString(suggestion);
45493
- const isUncheckedJS = isUncheckedJSSuggestion(
45494
- originalLocation,
45495
- suggestion,
45496
- /*excludeClasses*/
45497
- false
45498
- );
45499
- 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;
45500
- const diagnostic = createError(errorLocation, message, diagnosticName(nameArg), suggestionName);
45501
- addErrorOrSuggestion(!isUncheckedJS, diagnostic);
45502
- if (suggestion.valueDeclaration) {
45503
- addRelatedInfo(
45504
- diagnostic,
45505
- createDiagnosticForNode(suggestion.valueDeclaration, Diagnostics._0_is_declared_here, suggestionName)
45506
- );
45507
- }
45508
- }
45509
- }
45510
- if (!suggestion && !suggestedLib && nameArg) {
45511
- error(errorLocation, nameNotFoundMessage, diagnosticName(nameArg));
45512
- }
45513
- suggestionCount++;
45514
- }
45515
- });
45516
- }
45517
- return void 0;
45518
- } else if (nameNotFoundMessage && checkAndReportErrorForInvalidInitializer()) {
45519
- return void 0;
45520
- }
45521
- if (nameNotFoundMessage) {
45522
- addLazyDiagnostic(() => {
45523
- var _a2;
45524
- if (errorLocation && (meaning & 2 /* BlockScopedVariable */ || (meaning & 32 /* Class */ || meaning & 384 /* Enum */) && (meaning & 111551 /* Value */) === 111551 /* Value */)) {
45525
- const exportOrLocalSymbol = getExportSymbolOfValueSymbolIfExported(result);
45526
- if (exportOrLocalSymbol.flags & 2 /* BlockScopedVariable */ || exportOrLocalSymbol.flags & 32 /* Class */ || exportOrLocalSymbol.flags & 384 /* Enum */) {
45527
- checkResolvedBlockScopedVariable(exportOrLocalSymbol, errorLocation);
45528
- }
45529
- }
45530
- if (result && isInExternalModule && (meaning & 111551 /* Value */) === 111551 /* Value */ && !(originalLocation.flags & 16777216 /* JSDoc */)) {
45531
- const merged = getMergedSymbol(result);
45532
- if (length(merged.declarations) && every(merged.declarations, (d) => isNamespaceExportDeclaration(d) || isSourceFile(d) && !!d.symbol.globalExports)) {
45533
- 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));
45534
- }
45535
- }
45536
- if (result && associatedDeclarationForContainingInitializerOrBindingName && !withinDeferredContext && (meaning & 111551 /* Value */) === 111551 /* Value */) {
45537
- const candidate = getMergedSymbol(getLateBoundSymbol(result));
45538
- const root = getRootDeclaration(associatedDeclarationForContainingInitializerOrBindingName);
45539
- if (candidate === getSymbolOfDeclaration(associatedDeclarationForContainingInitializerOrBindingName)) {
45540
- error(errorLocation, Diagnostics.Parameter_0_cannot_reference_itself, declarationNameToString(associatedDeclarationForContainingInitializerOrBindingName.name));
45541
- } else if (candidate.valueDeclaration && candidate.valueDeclaration.pos > associatedDeclarationForContainingInitializerOrBindingName.pos && root.parent.locals && lookup(root.parent.locals, candidate.escapedName, meaning) === candidate) {
45542
- error(errorLocation, Diagnostics.Parameter_0_cannot_reference_identifier_1_declared_after_it, declarationNameToString(associatedDeclarationForContainingInitializerOrBindingName.name), declarationNameToString(errorLocation));
45543
- }
45544
- }
45545
- if (result && errorLocation && meaning & 111551 /* Value */ && result.flags & 2097152 /* Alias */ && !(result.flags & 111551 /* Value */) && !isValidTypeOnlyAliasUseSite(errorLocation)) {
45546
- const typeOnlyDeclaration = getTypeOnlyAliasDeclaration(result, 111551 /* Value */);
45547
- if (typeOnlyDeclaration) {
45548
- 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;
45549
- const unescapedName = unescapeLeadingUnderscores(name);
45550
- addTypeOnlyDeclarationRelatedInfo(
45551
- error(errorLocation, message, unescapedName),
45552
- typeOnlyDeclaration,
45553
- unescapedName
45554
- );
45555
- }
45556
- }
45557
- if (compilerOptions.isolatedModules && result && isInExternalModule && (meaning & 111551 /* Value */) === 111551 /* Value */) {
45558
- const isGlobal = lookup(globals, name, meaning) === result;
45559
- const nonValueSymbol = isGlobal && isSourceFile(lastLocation) && lastLocation.locals && lookup(lastLocation.locals, name, ~111551 /* Value */);
45560
- if (nonValueSymbol) {
45561
- 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 */);
45562
- if (importDecl && !isTypeOnlyImportDeclaration(importDecl)) {
45563
- error(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));
45564
- }
45666
+ if (compilerOptions.isolatedModules && result && isInExternalModule && (meaning & 111551 /* Value */) === 111551 /* Value */) {
45667
+ const isGlobal = getSymbol(globals, name, meaning) === result;
45668
+ const nonValueSymbol = isGlobal && isSourceFile(lastLocation) && lastLocation.locals && getSymbol(lastLocation.locals, name, ~111551 /* Value */);
45669
+ if (nonValueSymbol) {
45670
+ 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 */);
45671
+ if (importDecl && !isTypeOnlyImportDeclaration(importDecl)) {
45672
+ error(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));
45565
45673
  }
45566
45674
  }
45567
- });
45568
- }
45569
- return result;
45675
+ }
45676
+ });
45570
45677
  }
45571
45678
  function addTypeOnlyDeclarationRelatedInfo(diagnostic, typeOnlyDeclaration, unescapedName) {
45572
45679
  if (!typeOnlyDeclaration)
@@ -45580,47 +45687,9 @@ function createTypeChecker(host) {
45580
45687
  )
45581
45688
  );
45582
45689
  }
45583
- function getIsDeferredContext(location, lastLocation) {
45584
- if (location.kind !== 219 /* ArrowFunction */ && location.kind !== 218 /* FunctionExpression */) {
45585
- return isTypeQueryNode(location) || (isFunctionLikeDeclaration(location) || location.kind === 172 /* PropertyDeclaration */ && !isStatic(location)) && (!lastLocation || lastLocation !== location.name);
45586
- }
45587
- if (lastLocation && lastLocation === location.name) {
45588
- return false;
45589
- }
45590
- if (location.asteriskToken || hasSyntacticModifier(location, 1024 /* Async */)) {
45591
- return true;
45592
- }
45593
- return !getImmediatelyInvokedFunctionExpression(location);
45594
- }
45595
- function isSelfReferenceLocation(node) {
45596
- switch (node.kind) {
45597
- case 262 /* FunctionDeclaration */:
45598
- case 263 /* ClassDeclaration */:
45599
- case 264 /* InterfaceDeclaration */:
45600
- case 266 /* EnumDeclaration */:
45601
- case 265 /* TypeAliasDeclaration */:
45602
- case 267 /* ModuleDeclaration */:
45603
- return true;
45604
- default:
45605
- return false;
45606
- }
45607
- }
45608
45690
  function diagnosticName(nameArg) {
45609
45691
  return isString(nameArg) ? unescapeLeadingUnderscores(nameArg) : declarationNameToString(nameArg);
45610
45692
  }
45611
- function isTypeParameterSymbolDeclaredInContainer(symbol, container) {
45612
- if (symbol.declarations) {
45613
- for (const decl of symbol.declarations) {
45614
- if (decl.kind === 168 /* TypeParameter */) {
45615
- const parent = isJSDocTemplateTag(decl.parent) ? getJSDocHost(decl.parent) : decl.parent;
45616
- if (parent === container) {
45617
- return !(isJSDocTemplateTag(decl.parent) && find(decl.parent.parent.tags, isJSDocTypeAlias));
45618
- }
45619
- }
45620
- }
45621
- }
45622
- return false;
45623
- }
45624
45693
  function checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) {
45625
45694
  if (!isIdentifier(errorLocation) || errorLocation.escapedText !== name || isTypeReferenceIdentifier(errorLocation) || isInTypeQuery(errorLocation)) {
45626
45695
  return false;
@@ -45691,8 +45760,6 @@ function createTypeChecker(host) {
45691
45760
  788968 /* Type */ & ~namespaceMeaning,
45692
45761
  /*nameNotFoundMessage*/
45693
45762
  void 0,
45694
- /*nameArg*/
45695
- void 0,
45696
45763
  /*isUse*/
45697
45764
  false
45698
45765
  ));
@@ -45726,8 +45793,6 @@ function createTypeChecker(host) {
45726
45793
  ~788968 /* Type */ & 111551 /* Value */,
45727
45794
  /*nameNotFoundMessage*/
45728
45795
  void 0,
45729
- /*nameArg*/
45730
- void 0,
45731
45796
  /*isUse*/
45732
45797
  false
45733
45798
  ));
@@ -45773,8 +45838,6 @@ function createTypeChecker(host) {
45773
45838
  788968 /* Type */ & ~111551 /* Value */,
45774
45839
  /*nameNotFoundMessage*/
45775
45840
  void 0,
45776
- /*nameArg*/
45777
- void 0,
45778
45841
  /*isUse*/
45779
45842
  false
45780
45843
  ));
@@ -45826,8 +45889,6 @@ function createTypeChecker(host) {
45826
45889
  1024 /* NamespaceModule */,
45827
45890
  /*nameNotFoundMessage*/
45828
45891
  void 0,
45829
- /*nameArg*/
45830
- void 0,
45831
45892
  /*isUse*/
45832
45893
  false
45833
45894
  ));
@@ -45846,8 +45907,6 @@ function createTypeChecker(host) {
45846
45907
  1536 /* Module */,
45847
45908
  /*nameNotFoundMessage*/
45848
45909
  void 0,
45849
- /*nameArg*/
45850
- void 0,
45851
45910
  /*isUse*/
45852
45911
  false
45853
45912
  ));
@@ -46663,11 +46722,10 @@ function createTypeChecker(host) {
46663
46722
  let left = getFirstIdentifier(node);
46664
46723
  let symbol = resolveName(
46665
46724
  left,
46666
- left.escapedText,
46725
+ left,
46667
46726
  111551 /* Value */,
46668
46727
  /*nameNotFoundMessage*/
46669
46728
  void 0,
46670
- left,
46671
46729
  /*isUse*/
46672
46730
  true
46673
46731
  );
@@ -46695,10 +46753,9 @@ function createTypeChecker(host) {
46695
46753
  const symbolFromJSPrototype = isInJSFile(name) && !nodeIsSynthesized(name) ? resolveEntityNameFromAssignmentDeclaration(name, meaning) : void 0;
46696
46754
  symbol = getMergedSymbol(resolveName(
46697
46755
  location || name,
46698
- name.escapedText,
46756
+ name,
46699
46757
  meaning,
46700
46758
  ignoreErrors || symbolFromJSPrototype ? void 0 : message,
46701
- name,
46702
46759
  /*isUse*/
46703
46760
  true,
46704
46761
  /*excludeGlobals*/
@@ -46794,11 +46851,10 @@ function createTypeChecker(host) {
46794
46851
  if (secondaryLocation) {
46795
46852
  return resolveName(
46796
46853
  secondaryLocation,
46797
- name.escapedText,
46854
+ name,
46798
46855
  meaning,
46799
46856
  /*nameNotFoundMessage*/
46800
46857
  void 0,
46801
- name,
46802
46858
  /*isUse*/
46803
46859
  true
46804
46860
  );
@@ -47496,14 +47552,6 @@ function createTypeChecker(host) {
47496
47552
  function symbolIsValue(symbol, includeTypeOnlyMembers) {
47497
47553
  return !!(symbol.flags & 111551 /* Value */ || symbol.flags & 2097152 /* Alias */ && getSymbolFlags(symbol, !includeTypeOnlyMembers) & 111551 /* Value */);
47498
47554
  }
47499
- function findConstructorDeclaration(node) {
47500
- const members = node.members;
47501
- for (const member of members) {
47502
- if (member.kind === 176 /* Constructor */ && nodeIsPresent(member.body)) {
47503
- return member;
47504
- }
47505
- }
47506
- }
47507
47555
  function createType(flags) {
47508
47556
  var _a;
47509
47557
  const result = new Type7(checker, flags);
@@ -47985,8 +48033,6 @@ function createTypeChecker(host) {
47985
48033
  meaning,
47986
48034
  /*nameNotFoundMessage*/
47987
48035
  void 0,
47988
- /*nameArg*/
47989
- void 0,
47990
48036
  /*isUse*/
47991
48037
  false
47992
48038
  );
@@ -49557,8 +49603,6 @@ function createTypeChecker(host) {
49557
49603
  111551 /* Value */ | 1048576 /* ExportValue */,
49558
49604
  /*nameNotFoundMessage*/
49559
49605
  void 0,
49560
- /*nameArg*/
49561
- void 0,
49562
49606
  /*isUse*/
49563
49607
  true
49564
49608
  );
@@ -49882,7 +49926,6 @@ function createTypeChecker(host) {
49882
49926
  788968 /* Type */,
49883
49927
  /*nameNotFoundMessage*/
49884
49928
  void 0,
49885
- escapedName,
49886
49929
  /*isUse*/
49887
49930
  false
49888
49931
  );
@@ -52214,11 +52257,10 @@ function createTypeChecker(host) {
52214
52257
  if (node.parent && node.parent.kind === 277 /* ExportAssignment */) {
52215
52258
  exportSymbol = resolveName(
52216
52259
  node,
52217
- node.escapedText,
52260
+ node,
52218
52261
  111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */,
52219
52262
  /*nameNotFoundMessage*/
52220
52263
  void 0,
52221
- node,
52222
52264
  /*isUse*/
52223
52265
  false
52224
52266
  );
@@ -52251,8 +52293,6 @@ function createTypeChecker(host) {
52251
52293
  111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */,
52252
52294
  /*nameNotFoundMessage*/
52253
52295
  void 0,
52254
- /*nameArg*/
52255
- void 0,
52256
52296
  /*isUse*/
52257
52297
  false
52258
52298
  );
@@ -56072,8 +56112,6 @@ function createTypeChecker(host) {
56072
56112
  111551 /* Value */,
56073
56113
  /*nameNotFoundMessage*/
56074
56114
  void 0,
56075
- /*nameArg*/
56076
- void 0,
56077
56115
  /*isUse*/
56078
56116
  false
56079
56117
  );
@@ -57107,12 +57145,9 @@ function createTypeChecker(host) {
57107
57145
  name,
57108
57146
  meaning,
57109
57147
  diagnostic,
57110
- name,
57111
57148
  /*isUse*/
57112
57149
  false,
57113
57150
  /*excludeGlobals*/
57114
- false,
57115
- /*getSpellingSuggestions*/
57116
57151
  false
57117
57152
  );
57118
57153
  }
@@ -64497,7 +64532,6 @@ function createTypeChecker(host) {
64497
64532
  788968 /* Type */,
64498
64533
  /*nameNotFoundMessage*/
64499
64534
  void 0,
64500
- param.name.escapedText,
64501
64535
  /*isUse*/
64502
64536
  true
64503
64537
  ) || originalKeywordKind && isTypeNodeKind(originalKeywordKind))) {
@@ -65719,10 +65753,9 @@ function createTypeChecker(host) {
65719
65753
  if (!links.resolvedSymbol) {
65720
65754
  links.resolvedSymbol = !nodeIsMissing(node) && resolveName(
65721
65755
  node,
65722
- node.escapedText,
65756
+ node,
65723
65757
  111551 /* Value */ | 1048576 /* ExportValue */,
65724
65758
  getCannotFindNameDiagnosticForName(node),
65725
- node,
65726
65759
  !isWriteOnlyAccess(node),
65727
65760
  /*excludeGlobals*/
65728
65761
  false
@@ -66709,7 +66742,7 @@ function createTypeChecker(host) {
66709
66742
  case 80 /* Identifier */:
66710
66743
  if (!isThisInTypeQuery(node)) {
66711
66744
  const symbol = getResolvedSymbol(node);
66712
- return isConstantVariable(symbol) || isParameterOrMutableLocalVariable(symbol) && !isSymbolAssigned(symbol);
66745
+ return isConstantVariable(symbol) || isParameterOrMutableLocalVariable(symbol) && !isSymbolAssigned(symbol) || !!symbol.valueDeclaration && isFunctionExpression(symbol.valueDeclaration);
66713
66746
  }
66714
66747
  break;
66715
66748
  case 211 /* PropertyAccessExpression */:
@@ -68958,7 +68991,6 @@ function createTypeChecker(host) {
68958
68991
  111551 /* Value */,
68959
68992
  /*nameNotFoundMessage*/
68960
68993
  void 0,
68961
- id.escapedText,
68962
68994
  /*isUse*/
68963
68995
  true
68964
68996
  );
@@ -69008,8 +69040,6 @@ function createTypeChecker(host) {
69008
69040
  111551 /* Value */,
69009
69041
  /*nameNotFoundMessage*/
69010
69042
  void 0,
69011
- /*nameArg*/
69012
- void 0,
69013
69043
  /*isUse*/
69014
69044
  true,
69015
69045
  /*excludeGlobals*/
@@ -70386,7 +70416,6 @@ function createTypeChecker(host) {
70386
70416
  1920 /* Namespace */,
70387
70417
  /*nameNotFoundMessage*/
70388
70418
  void 0,
70389
- namespaceName,
70390
70419
  /*isUse*/
70391
70420
  false
70392
70421
  );
@@ -70601,7 +70630,6 @@ function createTypeChecker(host) {
70601
70630
  jsxFactoryNamespace,
70602
70631
  111551 /* Value */,
70603
70632
  jsxFactoryRefErr,
70604
- jsxFactoryNamespace,
70605
70633
  /*isUse*/
70606
70634
  true
70607
70635
  );
@@ -70621,7 +70649,6 @@ function createTypeChecker(host) {
70621
70649
  localJsxNamespace,
70622
70650
  111551 /* Value */,
70623
70651
  jsxFactoryRefErr,
70624
- localJsxNamespace,
70625
70652
  /*isUse*/
70626
70653
  true
70627
70654
  );
@@ -71342,38 +71369,34 @@ function createTypeChecker(host) {
71342
71369
  const suggestion = getSuggestedSymbolForNonexistentProperty(name, containingType);
71343
71370
  return suggestion && symbolName(suggestion);
71344
71371
  }
71372
+ function getSuggestionForSymbolNameLookup(symbols, name, meaning) {
71373
+ const symbol = getSymbol(symbols, name, meaning);
71374
+ if (symbol)
71375
+ return symbol;
71376
+ let candidates;
71377
+ if (symbols === globals) {
71378
+ const primitives = mapDefined(
71379
+ ["string", "number", "boolean", "object", "bigint", "symbol"],
71380
+ (s) => symbols.has(s.charAt(0).toUpperCase() + s.slice(1)) ? createSymbol(524288 /* TypeAlias */, s) : void 0
71381
+ );
71382
+ candidates = primitives.concat(arrayFrom(symbols.values()));
71383
+ } else {
71384
+ candidates = arrayFrom(symbols.values());
71385
+ }
71386
+ return getSpellingSuggestionForName(unescapeLeadingUnderscores(name), candidates, meaning);
71387
+ }
71345
71388
  function getSuggestedSymbolForNonexistentSymbol(location, outerName, meaning) {
71346
71389
  Debug.assert(outerName !== void 0, "outername should always be defined");
71347
- const result = resolveNameHelper(
71390
+ const result = resolveNameForSymbolSuggestion(
71348
71391
  location,
71349
71392
  outerName,
71350
71393
  meaning,
71351
71394
  /*nameNotFoundMessage*/
71352
71395
  void 0,
71353
- outerName,
71354
71396
  /*isUse*/
71355
71397
  false,
71356
71398
  /*excludeGlobals*/
71357
- false,
71358
- /*getSpellingSuggestions*/
71359
- true,
71360
- (symbols, name, meaning2) => {
71361
- Debug.assertEqual(outerName, name, "name should equal outerName");
71362
- const symbol = getSymbol(symbols, name, meaning2);
71363
- if (symbol)
71364
- return symbol;
71365
- let candidates;
71366
- if (symbols === globals) {
71367
- const primitives = mapDefined(
71368
- ["string", "number", "boolean", "object", "bigint", "symbol"],
71369
- (s) => symbols.has(s.charAt(0).toUpperCase() + s.slice(1)) ? createSymbol(524288 /* TypeAlias */, s) : void 0
71370
- );
71371
- candidates = primitives.concat(arrayFrom(symbols.values()));
71372
- } else {
71373
- candidates = arrayFrom(symbols.values());
71374
- }
71375
- return getSpellingSuggestionForName(unescapeLeadingUnderscores(name), candidates, meaning2);
71376
- }
71399
+ false
71377
71400
  );
71378
71401
  return result;
71379
71402
  }
@@ -72230,8 +72253,6 @@ function createTypeChecker(host) {
72230
72253
  111551 /* Value */,
72231
72254
  /*nameNotFoundMessage*/
72232
72255
  void 0,
72233
- /*nameArg*/
72234
- void 0,
72235
72256
  /*isUse*/
72236
72257
  false
72237
72258
  );
@@ -73495,8 +73516,6 @@ function createTypeChecker(host) {
73495
73516
  111551 /* Value */,
73496
73517
  /*nameNotFoundMessage*/
73497
73518
  void 0,
73498
- /*nameArg*/
73499
- void 0,
73500
73519
  /*isUse*/
73501
73520
  false
73502
73521
  );
@@ -73614,8 +73633,6 @@ function createTypeChecker(host) {
73614
73633
  111551 /* Value */,
73615
73634
  /*nameNotFoundMessage*/
73616
73635
  void 0,
73617
- /*nameArg*/
73618
- void 0,
73619
73636
  /*isUse*/
73620
73637
  true
73621
73638
  );
@@ -74721,7 +74738,7 @@ function createTypeChecker(host) {
74721
74738
  true
74722
74739
  );
74723
74740
  }
74724
- if (expr.kind === 213 /* CallExpression */ && expr.expression.kind === 80 /* Identifier */ && checkExpressionCached(expr.expression).symbol === func.symbol) {
74741
+ if (expr.kind === 213 /* CallExpression */ && expr.expression.kind === 80 /* Identifier */ && checkExpressionCached(expr.expression).symbol === getMergedSymbol(func.symbol) && (!isFunctionExpressionOrArrowFunction(func.symbol.valueDeclaration) || isConstantReference(expr.expression))) {
74725
74742
  hasReturnOfTypeNever = true;
74726
74743
  return;
74727
74744
  }
@@ -75951,7 +75968,6 @@ function createTypeChecker(host) {
75951
75968
  788968 /* Type */,
75952
75969
  /*nameNotFoundMessage*/
75953
75970
  void 0,
75954
- name,
75955
75971
  /*isUse*/
75956
75972
  false
75957
75973
  );
@@ -78239,8 +78255,6 @@ function createTypeChecker(host) {
78239
78255
  meaning,
78240
78256
  /*nameNotFoundMessage*/
78241
78257
  void 0,
78242
- /*nameArg*/
78243
- void 0,
78244
78258
  /*isUse*/
78245
78259
  true
78246
78260
  );
@@ -78992,8 +79006,6 @@ function createTypeChecker(host) {
78992
79006
  3 /* Variable */,
78993
79007
  /*nameNotFoundMessage*/
78994
79008
  void 0,
78995
- /*nameArg*/
78996
- void 0,
78997
79009
  /*isUse*/
78998
79010
  false
78999
79011
  );
@@ -81818,8 +81830,6 @@ function createTypeChecker(host) {
81818
81830
  111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */,
81819
81831
  /*nameNotFoundMessage*/
81820
81832
  void 0,
81821
- /*nameArg*/
81822
- void 0,
81823
81833
  /*isUse*/
81824
81834
  true
81825
81835
  );
@@ -83236,8 +83246,6 @@ function createTypeChecker(host) {
83236
83246
  111551 /* Value */,
83237
83247
  /*nameNotFoundMessage*/
83238
83248
  void 0,
83239
- /*nameArg*/
83240
- void 0,
83241
83249
  /*isUse*/
83242
83250
  false
83243
83251
  )) {
@@ -83629,8 +83637,6 @@ function createTypeChecker(host) {
83629
83637
  111551 /* Value */ | 1048576 /* ExportValue */ | 2097152 /* Alias */,
83630
83638
  /*nameNotFoundMessage*/
83631
83639
  void 0,
83632
- /*nameArg*/
83633
- void 0,
83634
83640
  /*isUse*/
83635
83641
  true
83636
83642
  );
@@ -83646,13 +83652,9 @@ function createTypeChecker(host) {
83646
83652
  111551 /* Value */ | 1048576 /* ExportValue */ | 2097152 /* Alias */,
83647
83653
  /*nameNotFoundMessage*/
83648
83654
  void 0,
83649
- /*nameArg*/
83650
- void 0,
83651
83655
  /*isUse*/
83652
83656
  true,
83653
83657
  /*excludeGlobals*/
83654
- void 0,
83655
- /*getSpellingSuggestions*/
83656
83658
  void 0
83657
83659
  );
83658
83660
  }