typescript 5.5.0-dev.20240411 → 5.5.0-dev.20240412
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/tsc.js +530 -532
- package/lib/typescript.d.ts +2 -0
- package/lib/typescript.js +544 -532
- package/package.json +2 -2
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.
|
|
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,
|
|
@@ -43646,6 +44026,31 @@ function createTypeChecker(host) {
|
|
|
43646
44026
|
var lastGetCombinedNodeFlagsResult = 0 /* None */;
|
|
43647
44027
|
var lastGetCombinedModifierFlagsNode;
|
|
43648
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
|
+
});
|
|
43649
44054
|
const checker = {
|
|
43650
44055
|
getNodeCount: () => reduceLeft(host.getSourceFiles(), (n, s) => n + s.nodeCount, 0),
|
|
43651
44056
|
getIdentifierCount: () => reduceLeft(host.getSourceFiles(), (n, s) => n + s.identifierCount, 0),
|
|
@@ -43951,8 +44356,6 @@ function createTypeChecker(host) {
|
|
|
43951
44356
|
meaning,
|
|
43952
44357
|
/*nameNotFoundMessage*/
|
|
43953
44358
|
void 0,
|
|
43954
|
-
/*nameArg*/
|
|
43955
|
-
void 0,
|
|
43956
44359
|
/*isUse*/
|
|
43957
44360
|
false,
|
|
43958
44361
|
excludeGlobals
|
|
@@ -44982,9 +45385,6 @@ function createTypeChecker(host) {
|
|
|
44982
45385
|
const nodeId = getNodeId(node);
|
|
44983
45386
|
return nodeLinks[nodeId] || (nodeLinks[nodeId] = new NodeLinks());
|
|
44984
45387
|
}
|
|
44985
|
-
function isGlobalSourceFile(node) {
|
|
44986
|
-
return node.kind === 307 /* SourceFile */ && !isExternalOrCommonJsModule(node);
|
|
44987
|
-
}
|
|
44988
45388
|
function getSymbol(symbols, name, meaning) {
|
|
44989
45389
|
if (meaning) {
|
|
44990
45390
|
const symbol = getMergedSymbol(symbols.get(name));
|
|
@@ -45160,417 +45560,120 @@ function createTypeChecker(host) {
|
|
|
45160
45560
|
return ancestorChangingReferenceScope === void 0;
|
|
45161
45561
|
}
|
|
45162
45562
|
}
|
|
45163
|
-
function
|
|
45164
|
-
|
|
45165
|
-
|
|
45166
|
-
|
|
45167
|
-
|
|
45168
|
-
|
|
45169
|
-
|
|
45170
|
-
|
|
45171
|
-
|
|
45172
|
-
return
|
|
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;
|
|
45173
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;
|
|
45174
45581
|
}
|
|
45175
45582
|
return false;
|
|
45176
|
-
function requiresScopeChange(node) {
|
|
45177
|
-
return requiresScopeChangeWorker(node.name) || !!node.initializer && requiresScopeChangeWorker(node.initializer);
|
|
45178
|
-
}
|
|
45179
|
-
function requiresScopeChangeWorker(node) {
|
|
45180
|
-
switch (node.kind) {
|
|
45181
|
-
case 219 /* ArrowFunction */:
|
|
45182
|
-
case 218 /* FunctionExpression */:
|
|
45183
|
-
case 262 /* FunctionDeclaration */:
|
|
45184
|
-
case 176 /* Constructor */:
|
|
45185
|
-
return false;
|
|
45186
|
-
case 174 /* MethodDeclaration */:
|
|
45187
|
-
case 177 /* GetAccessor */:
|
|
45188
|
-
case 178 /* SetAccessor */:
|
|
45189
|
-
case 303 /* PropertyAssignment */:
|
|
45190
|
-
return requiresScopeChangeWorker(node.name);
|
|
45191
|
-
case 172 /* PropertyDeclaration */:
|
|
45192
|
-
if (hasStaticModifier(node)) {
|
|
45193
|
-
return !emitStandardClassFields;
|
|
45194
|
-
}
|
|
45195
|
-
return requiresScopeChangeWorker(node.name);
|
|
45196
|
-
default:
|
|
45197
|
-
if (isNullishCoalesce(node) || isOptionalChain(node)) {
|
|
45198
|
-
return target < 7 /* ES2020 */;
|
|
45199
|
-
}
|
|
45200
|
-
if (isBindingElement(node) && node.dotDotDotToken && isObjectBindingPattern(node.parent)) {
|
|
45201
|
-
return target < 4 /* ES2017 */;
|
|
45202
|
-
}
|
|
45203
|
-
if (isTypeNode(node))
|
|
45204
|
-
return false;
|
|
45205
|
-
return forEachChild(node, requiresScopeChangeWorker) || false;
|
|
45206
|
-
}
|
|
45207
|
-
}
|
|
45208
|
-
}
|
|
45209
|
-
function isConstAssertion(location) {
|
|
45210
|
-
return isAssertionExpression(location) && isConstTypeReference(location.type) || isJSDocTypeTag(location) && isConstTypeReference(location.typeExpression);
|
|
45211
45583
|
}
|
|
45212
|
-
function
|
|
45213
|
-
|
|
45214
|
-
|
|
45215
|
-
|
|
45216
|
-
|
|
45217
|
-
|
|
45218
|
-
|
|
45219
|
-
|
|
45220
|
-
|
|
45221
|
-
|
|
45222
|
-
|
|
45223
|
-
|
|
45224
|
-
|
|
45225
|
-
|
|
45226
|
-
|
|
45227
|
-
|
|
45228
|
-
|
|
45229
|
-
|
|
45230
|
-
|
|
45231
|
-
|
|
45232
|
-
|
|
45233
|
-
|
|
45234
|
-
|
|
45235
|
-
|
|
45236
|
-
|
|
45237
|
-
|
|
45238
|
-
|
|
45239
|
-
|
|
45240
|
-
|
|
45241
|
-
|
|
45242
|
-
|
|
45243
|
-
|
|
45244
|
-
|
|
45245
|
-
|
|
45246
|
-
} else if (result.flags & 1 /* FunctionScopedVariable */) {
|
|
45247
|
-
useResult = lastLocation.kind === 169 /* Parameter */ || lastLocation === location.type && !!findAncestor(result.valueDeclaration, isParameter);
|
|
45248
|
-
}
|
|
45249
|
-
}
|
|
45250
|
-
} else if (location.kind === 194 /* ConditionalType */) {
|
|
45251
|
-
useResult = lastLocation === location.trueType;
|
|
45252
|
-
}
|
|
45253
|
-
if (useResult) {
|
|
45254
|
-
break loop;
|
|
45255
|
-
} else {
|
|
45256
|
-
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
|
+
);
|
|
45257
45618
|
}
|
|
45258
45619
|
}
|
|
45259
45620
|
}
|
|
45260
|
-
|
|
45261
|
-
|
|
45262
|
-
case 307 /* SourceFile */:
|
|
45263
|
-
if (!isExternalOrCommonJsModule(location))
|
|
45264
|
-
break;
|
|
45265
|
-
isInExternalModule = true;
|
|
45266
|
-
case 267 /* ModuleDeclaration */:
|
|
45267
|
-
const moduleExports = ((_a = getSymbolOfDeclaration(location)) == null ? void 0 : _a.exports) || emptySymbols;
|
|
45268
|
-
if (location.kind === 307 /* SourceFile */ || isModuleDeclaration(location) && location.flags & 33554432 /* Ambient */ && !isGlobalScopeAugmentation(location)) {
|
|
45269
|
-
if (result = moduleExports.get("default" /* Default */)) {
|
|
45270
|
-
const localSymbol = getLocalSymbolForExportDefault(result);
|
|
45271
|
-
if (localSymbol && result.flags & meaning && localSymbol.escapedName === name) {
|
|
45272
|
-
break loop;
|
|
45273
|
-
}
|
|
45274
|
-
result = void 0;
|
|
45275
|
-
}
|
|
45276
|
-
const moduleExport = moduleExports.get(name);
|
|
45277
|
-
if (moduleExport && moduleExport.flags === 2097152 /* Alias */ && (getDeclarationOfKind(moduleExport, 281 /* ExportSpecifier */) || getDeclarationOfKind(moduleExport, 280 /* NamespaceExport */))) {
|
|
45278
|
-
break;
|
|
45279
|
-
}
|
|
45280
|
-
}
|
|
45281
|
-
if (name !== "default" /* Default */ && (result = lookup(moduleExports, name, meaning & 2623475 /* ModuleMember */))) {
|
|
45282
|
-
if (isSourceFile(location) && location.commonJsModuleIndicator && !((_b = result.declarations) == null ? void 0 : _b.some(isJSDocTypeAlias))) {
|
|
45283
|
-
result = void 0;
|
|
45284
|
-
} else {
|
|
45285
|
-
break loop;
|
|
45286
|
-
}
|
|
45287
|
-
}
|
|
45288
|
-
break;
|
|
45289
|
-
case 266 /* EnumDeclaration */:
|
|
45290
|
-
if (result = lookup(((_c = getSymbolOfDeclaration(location)) == null ? void 0 : _c.exports) || emptySymbols, name, meaning & 8 /* EnumMember */)) {
|
|
45291
|
-
if (nameNotFoundMessage && getIsolatedModules(compilerOptions) && !(location.flags & 33554432 /* Ambient */) && getSourceFileOfNode(location) !== getSourceFileOfNode(result.valueDeclaration)) {
|
|
45292
|
-
error(
|
|
45293
|
-
errorLocation,
|
|
45294
|
-
Diagnostics.Cannot_access_0_from_another_file_without_qualification_when_1_is_enabled_Use_2_instead,
|
|
45295
|
-
unescapeLeadingUnderscores(name),
|
|
45296
|
-
isolatedModulesLikeFlagName,
|
|
45297
|
-
`${unescapeLeadingUnderscores(getSymbolOfNode(location).escapedName)}.${unescapeLeadingUnderscores(name)}`
|
|
45298
|
-
);
|
|
45299
|
-
}
|
|
45300
|
-
break loop;
|
|
45301
|
-
}
|
|
45302
|
-
break;
|
|
45303
|
-
case 172 /* PropertyDeclaration */:
|
|
45304
|
-
if (!isStatic(location)) {
|
|
45305
|
-
const ctor = findConstructorDeclaration(location.parent);
|
|
45306
|
-
if (ctor && ctor.locals) {
|
|
45307
|
-
if (lookup(ctor.locals, name, meaning & 111551 /* Value */)) {
|
|
45308
|
-
Debug.assertNode(location, isPropertyDeclaration);
|
|
45309
|
-
propertyWithInvalidInitializer = location;
|
|
45310
|
-
}
|
|
45311
|
-
}
|
|
45312
|
-
}
|
|
45313
|
-
break;
|
|
45314
|
-
case 263 /* ClassDeclaration */:
|
|
45315
|
-
case 231 /* ClassExpression */:
|
|
45316
|
-
case 264 /* InterfaceDeclaration */:
|
|
45317
|
-
if (result = lookup(getSymbolOfDeclaration(location).members || emptySymbols, name, meaning & 788968 /* Type */)) {
|
|
45318
|
-
if (!isTypeParameterSymbolDeclaredInContainer(result, location)) {
|
|
45319
|
-
result = void 0;
|
|
45320
|
-
break;
|
|
45321
|
-
}
|
|
45322
|
-
if (lastLocation && isStatic(lastLocation)) {
|
|
45323
|
-
if (nameNotFoundMessage) {
|
|
45324
|
-
error(errorLocation, Diagnostics.Static_members_cannot_reference_class_type_parameters);
|
|
45325
|
-
}
|
|
45326
|
-
return void 0;
|
|
45327
|
-
}
|
|
45328
|
-
break loop;
|
|
45329
|
-
}
|
|
45330
|
-
if (isClassExpression(location) && meaning & 32 /* Class */) {
|
|
45331
|
-
const className = location.name;
|
|
45332
|
-
if (className && name === className.escapedText) {
|
|
45333
|
-
result = location.symbol;
|
|
45334
|
-
break loop;
|
|
45335
|
-
}
|
|
45336
|
-
}
|
|
45337
|
-
break;
|
|
45338
|
-
case 233 /* ExpressionWithTypeArguments */:
|
|
45339
|
-
if (lastLocation === location.expression && location.parent.token === 96 /* ExtendsKeyword */) {
|
|
45340
|
-
const container = location.parent.parent;
|
|
45341
|
-
if (isClassLike(container) && (result = lookup(getSymbolOfDeclaration(container).members, name, meaning & 788968 /* Type */))) {
|
|
45342
|
-
if (nameNotFoundMessage) {
|
|
45343
|
-
error(errorLocation, Diagnostics.Base_class_expressions_cannot_reference_class_type_parameters);
|
|
45344
|
-
}
|
|
45345
|
-
return void 0;
|
|
45346
|
-
}
|
|
45347
|
-
}
|
|
45348
|
-
break;
|
|
45349
|
-
case 167 /* ComputedPropertyName */:
|
|
45350
|
-
grandparent = location.parent.parent;
|
|
45351
|
-
if (isClassLike(grandparent) || grandparent.kind === 264 /* InterfaceDeclaration */) {
|
|
45352
|
-
if (result = lookup(getSymbolOfDeclaration(grandparent).members, name, meaning & 788968 /* Type */)) {
|
|
45353
|
-
if (nameNotFoundMessage) {
|
|
45354
|
-
error(errorLocation, Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type);
|
|
45355
|
-
}
|
|
45356
|
-
return void 0;
|
|
45357
|
-
}
|
|
45358
|
-
}
|
|
45359
|
-
break;
|
|
45360
|
-
case 219 /* ArrowFunction */:
|
|
45361
|
-
if (getEmitScriptTarget(compilerOptions) >= 2 /* ES2015 */) {
|
|
45362
|
-
break;
|
|
45363
|
-
}
|
|
45364
|
-
case 174 /* MethodDeclaration */:
|
|
45365
|
-
case 176 /* Constructor */:
|
|
45366
|
-
case 177 /* GetAccessor */:
|
|
45367
|
-
case 178 /* SetAccessor */:
|
|
45368
|
-
case 262 /* FunctionDeclaration */:
|
|
45369
|
-
if (meaning & 3 /* Variable */ && name === "arguments") {
|
|
45370
|
-
result = argumentsSymbol;
|
|
45371
|
-
break loop;
|
|
45372
|
-
}
|
|
45373
|
-
break;
|
|
45374
|
-
case 218 /* FunctionExpression */:
|
|
45375
|
-
if (meaning & 3 /* Variable */ && name === "arguments") {
|
|
45376
|
-
result = argumentsSymbol;
|
|
45377
|
-
break loop;
|
|
45378
|
-
}
|
|
45379
|
-
if (meaning & 16 /* Function */) {
|
|
45380
|
-
const functionName = location.name;
|
|
45381
|
-
if (functionName && name === functionName.escapedText) {
|
|
45382
|
-
result = location.symbol;
|
|
45383
|
-
break loop;
|
|
45384
|
-
}
|
|
45385
|
-
}
|
|
45386
|
-
break;
|
|
45387
|
-
case 170 /* Decorator */:
|
|
45388
|
-
if (location.parent && location.parent.kind === 169 /* Parameter */) {
|
|
45389
|
-
location = location.parent;
|
|
45390
|
-
}
|
|
45391
|
-
if (location.parent && (isClassElement(location.parent) || location.parent.kind === 263 /* ClassDeclaration */)) {
|
|
45392
|
-
location = location.parent;
|
|
45393
|
-
}
|
|
45394
|
-
break;
|
|
45395
|
-
case 346 /* JSDocTypedefTag */:
|
|
45396
|
-
case 338 /* JSDocCallbackTag */:
|
|
45397
|
-
case 340 /* JSDocEnumTag */:
|
|
45398
|
-
case 351 /* JSDocImportTag */:
|
|
45399
|
-
const root = getJSDocRoot(location);
|
|
45400
|
-
if (root) {
|
|
45401
|
-
location = root.parent;
|
|
45402
|
-
}
|
|
45403
|
-
break;
|
|
45404
|
-
case 169 /* Parameter */:
|
|
45405
|
-
if (lastLocation && (lastLocation === location.initializer || lastLocation === location.name && isBindingPattern(lastLocation))) {
|
|
45406
|
-
if (!associatedDeclarationForContainingInitializerOrBindingName) {
|
|
45407
|
-
associatedDeclarationForContainingInitializerOrBindingName = location;
|
|
45408
|
-
}
|
|
45409
|
-
}
|
|
45410
|
-
break;
|
|
45411
|
-
case 208 /* BindingElement */:
|
|
45412
|
-
if (lastLocation && (lastLocation === location.initializer || lastLocation === location.name && isBindingPattern(lastLocation))) {
|
|
45413
|
-
if (isParameterDeclaration(location) && !associatedDeclarationForContainingInitializerOrBindingName) {
|
|
45414
|
-
associatedDeclarationForContainingInitializerOrBindingName = location;
|
|
45415
|
-
}
|
|
45416
|
-
}
|
|
45417
|
-
break;
|
|
45418
|
-
case 195 /* InferType */:
|
|
45419
|
-
if (meaning & 262144 /* TypeParameter */) {
|
|
45420
|
-
const parameterName = location.typeParameter.name;
|
|
45421
|
-
if (parameterName && name === parameterName.escapedText) {
|
|
45422
|
-
result = location.typeParameter.symbol;
|
|
45423
|
-
break loop;
|
|
45424
|
-
}
|
|
45425
|
-
}
|
|
45426
|
-
break;
|
|
45427
|
-
case 281 /* ExportSpecifier */:
|
|
45428
|
-
if (lastLocation && lastLocation === location.propertyName && location.parent.parent.moduleSpecifier) {
|
|
45429
|
-
location = location.parent.parent.parent;
|
|
45430
|
-
}
|
|
45431
|
-
break;
|
|
45432
|
-
}
|
|
45433
|
-
if (isSelfReferenceLocation(location)) {
|
|
45434
|
-
lastSelfReferenceLocation = location;
|
|
45435
|
-
}
|
|
45436
|
-
lastLocation = location;
|
|
45437
|
-
location = isJSDocTemplateTag(location) ? getEffectiveContainerForJSDocTemplateTag(location) || location.parent : isJSDocParameterTag(location) || isJSDocReturnTag(location) ? getHostSignatureFromJSDoc(location) || location.parent : location.parent;
|
|
45438
|
-
}
|
|
45439
|
-
if (isUse && result && (!lastSelfReferenceLocation || result !== lastSelfReferenceLocation.symbol)) {
|
|
45440
|
-
result.isReferenced |= meaning;
|
|
45441
|
-
}
|
|
45442
|
-
if (!result) {
|
|
45443
|
-
if (lastLocation) {
|
|
45444
|
-
Debug.assertNode(lastLocation, isSourceFile);
|
|
45445
|
-
if (lastLocation.commonJsModuleIndicator && name === "exports" && meaning & lastLocation.symbol.flags) {
|
|
45446
|
-
return lastLocation.symbol;
|
|
45621
|
+
if (!suggestion && !suggestedLib && nameArg) {
|
|
45622
|
+
error(errorLocation, nameNotFoundMessage, diagnosticName(nameArg));
|
|
45447
45623
|
}
|
|
45624
|
+
suggestionCount++;
|
|
45448
45625
|
}
|
|
45449
|
-
|
|
45450
|
-
|
|
45451
|
-
|
|
45452
|
-
|
|
45453
|
-
|
|
45454
|
-
|
|
45455
|
-
|
|
45456
|
-
|
|
45457
|
-
|
|
45458
|
-
|
|
45459
|
-
|
|
45460
|
-
|
|
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
|
+
);
|
|
45461
45664
|
}
|
|
45462
45665
|
}
|
|
45463
|
-
|
|
45464
|
-
|
|
45465
|
-
|
|
45466
|
-
|
|
45467
|
-
|
|
45468
|
-
|
|
45469
|
-
|
|
45470
|
-
diagnosticName(nameArg)
|
|
45471
|
-
);
|
|
45472
|
-
return true;
|
|
45473
|
-
}
|
|
45474
|
-
return false;
|
|
45475
|
-
}
|
|
45476
|
-
if (!result) {
|
|
45477
|
-
if (nameNotFoundMessage) {
|
|
45478
|
-
addLazyDiagnostic(() => {
|
|
45479
|
-
if (!errorLocation || errorLocation.parent.kind !== 324 /* JSDocLink */ && !checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) && // TODO: GH#18217
|
|
45480
|
-
!checkAndReportErrorForInvalidInitializer() && !checkAndReportErrorForExtendingInterface(errorLocation) && !checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) && !checkAndReportErrorForExportingPrimitiveType(errorLocation, name) && !checkAndReportErrorForUsingNamespaceAsTypeOrValue(errorLocation, name, meaning) && !checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) && !checkAndReportErrorForUsingValueAsType(errorLocation, name, meaning)) {
|
|
45481
|
-
let suggestion;
|
|
45482
|
-
let suggestedLib;
|
|
45483
|
-
if (nameArg) {
|
|
45484
|
-
suggestedLib = getSuggestedLibForNonExistentName(nameArg);
|
|
45485
|
-
if (suggestedLib) {
|
|
45486
|
-
error(errorLocation, nameNotFoundMessage, diagnosticName(nameArg), suggestedLib);
|
|
45487
|
-
}
|
|
45488
|
-
}
|
|
45489
|
-
if (!suggestedLib && getSpellingSuggestions && suggestionCount < maximumSuggestionCount) {
|
|
45490
|
-
suggestion = getSuggestedSymbolForNonexistentSymbol(originalLocation, name, meaning);
|
|
45491
|
-
const isGlobalScopeAugmentationDeclaration = (suggestion == null ? void 0 : suggestion.valueDeclaration) && isAmbientModule(suggestion.valueDeclaration) && isGlobalScopeAugmentation(suggestion.valueDeclaration);
|
|
45492
|
-
if (isGlobalScopeAugmentationDeclaration) {
|
|
45493
|
-
suggestion = void 0;
|
|
45494
|
-
}
|
|
45495
|
-
if (suggestion) {
|
|
45496
|
-
const suggestionName = symbolToString(suggestion);
|
|
45497
|
-
const isUncheckedJS = isUncheckedJSSuggestion(
|
|
45498
|
-
originalLocation,
|
|
45499
|
-
suggestion,
|
|
45500
|
-
/*excludeClasses*/
|
|
45501
|
-
false
|
|
45502
|
-
);
|
|
45503
|
-
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;
|
|
45504
|
-
const diagnostic = createError(errorLocation, message, diagnosticName(nameArg), suggestionName);
|
|
45505
|
-
addErrorOrSuggestion(!isUncheckedJS, diagnostic);
|
|
45506
|
-
if (suggestion.valueDeclaration) {
|
|
45507
|
-
addRelatedInfo(
|
|
45508
|
-
diagnostic,
|
|
45509
|
-
createDiagnosticForNode(suggestion.valueDeclaration, Diagnostics._0_is_declared_here, suggestionName)
|
|
45510
|
-
);
|
|
45511
|
-
}
|
|
45512
|
-
}
|
|
45513
|
-
}
|
|
45514
|
-
if (!suggestion && !suggestedLib && nameArg) {
|
|
45515
|
-
error(errorLocation, nameNotFoundMessage, diagnosticName(nameArg));
|
|
45516
|
-
}
|
|
45517
|
-
suggestionCount++;
|
|
45518
|
-
}
|
|
45519
|
-
});
|
|
45520
|
-
}
|
|
45521
|
-
return void 0;
|
|
45522
|
-
} else if (nameNotFoundMessage && checkAndReportErrorForInvalidInitializer()) {
|
|
45523
|
-
return void 0;
|
|
45524
|
-
}
|
|
45525
|
-
if (nameNotFoundMessage) {
|
|
45526
|
-
addLazyDiagnostic(() => {
|
|
45527
|
-
var _a2;
|
|
45528
|
-
if (errorLocation && (meaning & 2 /* BlockScopedVariable */ || (meaning & 32 /* Class */ || meaning & 384 /* Enum */) && (meaning & 111551 /* Value */) === 111551 /* Value */)) {
|
|
45529
|
-
const exportOrLocalSymbol = getExportSymbolOfValueSymbolIfExported(result);
|
|
45530
|
-
if (exportOrLocalSymbol.flags & 2 /* BlockScopedVariable */ || exportOrLocalSymbol.flags & 32 /* Class */ || exportOrLocalSymbol.flags & 384 /* Enum */) {
|
|
45531
|
-
checkResolvedBlockScopedVariable(exportOrLocalSymbol, errorLocation);
|
|
45532
|
-
}
|
|
45533
|
-
}
|
|
45534
|
-
if (result && isInExternalModule && (meaning & 111551 /* Value */) === 111551 /* Value */ && !(originalLocation.flags & 16777216 /* JSDoc */)) {
|
|
45535
|
-
const merged = getMergedSymbol(result);
|
|
45536
|
-
if (length(merged.declarations) && every(merged.declarations, (d) => isNamespaceExportDeclaration(d) || isSourceFile(d) && !!d.symbol.globalExports)) {
|
|
45537
|
-
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));
|
|
45538
|
-
}
|
|
45539
|
-
}
|
|
45540
|
-
if (result && associatedDeclarationForContainingInitializerOrBindingName && !withinDeferredContext && (meaning & 111551 /* Value */) === 111551 /* Value */) {
|
|
45541
|
-
const candidate = getMergedSymbol(getLateBoundSymbol(result));
|
|
45542
|
-
const root = getRootDeclaration(associatedDeclarationForContainingInitializerOrBindingName);
|
|
45543
|
-
if (candidate === getSymbolOfDeclaration(associatedDeclarationForContainingInitializerOrBindingName)) {
|
|
45544
|
-
error(errorLocation, Diagnostics.Parameter_0_cannot_reference_itself, declarationNameToString(associatedDeclarationForContainingInitializerOrBindingName.name));
|
|
45545
|
-
} else if (candidate.valueDeclaration && candidate.valueDeclaration.pos > associatedDeclarationForContainingInitializerOrBindingName.pos && root.parent.locals && lookup(root.parent.locals, candidate.escapedName, meaning) === candidate) {
|
|
45546
|
-
error(errorLocation, Diagnostics.Parameter_0_cannot_reference_identifier_1_declared_after_it, declarationNameToString(associatedDeclarationForContainingInitializerOrBindingName.name), declarationNameToString(errorLocation));
|
|
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));
|
|
45547
45673
|
}
|
|
45548
45674
|
}
|
|
45549
|
-
|
|
45550
|
-
|
|
45551
|
-
if (typeOnlyDeclaration) {
|
|
45552
|
-
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;
|
|
45553
|
-
const unescapedName = unescapeLeadingUnderscores(name);
|
|
45554
|
-
addTypeOnlyDeclarationRelatedInfo(
|
|
45555
|
-
error(errorLocation, message, unescapedName),
|
|
45556
|
-
typeOnlyDeclaration,
|
|
45557
|
-
unescapedName
|
|
45558
|
-
);
|
|
45559
|
-
}
|
|
45560
|
-
}
|
|
45561
|
-
if (compilerOptions.isolatedModules && result && isInExternalModule && (meaning & 111551 /* Value */) === 111551 /* Value */) {
|
|
45562
|
-
const isGlobal = lookup(globals, name, meaning) === result;
|
|
45563
|
-
const nonValueSymbol = isGlobal && isSourceFile(lastLocation) && lastLocation.locals && lookup(lastLocation.locals, name, ~111551 /* Value */);
|
|
45564
|
-
if (nonValueSymbol) {
|
|
45565
|
-
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 */);
|
|
45566
|
-
if (importDecl && !isTypeOnlyImportDeclaration(importDecl)) {
|
|
45567
|
-
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));
|
|
45568
|
-
}
|
|
45569
|
-
}
|
|
45570
|
-
}
|
|
45571
|
-
});
|
|
45572
|
-
}
|
|
45573
|
-
return result;
|
|
45675
|
+
}
|
|
45676
|
+
});
|
|
45574
45677
|
}
|
|
45575
45678
|
function addTypeOnlyDeclarationRelatedInfo(diagnostic, typeOnlyDeclaration, unescapedName) {
|
|
45576
45679
|
if (!typeOnlyDeclaration)
|
|
@@ -45584,47 +45687,9 @@ function createTypeChecker(host) {
|
|
|
45584
45687
|
)
|
|
45585
45688
|
);
|
|
45586
45689
|
}
|
|
45587
|
-
function getIsDeferredContext(location, lastLocation) {
|
|
45588
|
-
if (location.kind !== 219 /* ArrowFunction */ && location.kind !== 218 /* FunctionExpression */) {
|
|
45589
|
-
return isTypeQueryNode(location) || (isFunctionLikeDeclaration(location) || location.kind === 172 /* PropertyDeclaration */ && !isStatic(location)) && (!lastLocation || lastLocation !== location.name);
|
|
45590
|
-
}
|
|
45591
|
-
if (lastLocation && lastLocation === location.name) {
|
|
45592
|
-
return false;
|
|
45593
|
-
}
|
|
45594
|
-
if (location.asteriskToken || hasSyntacticModifier(location, 1024 /* Async */)) {
|
|
45595
|
-
return true;
|
|
45596
|
-
}
|
|
45597
|
-
return !getImmediatelyInvokedFunctionExpression(location);
|
|
45598
|
-
}
|
|
45599
|
-
function isSelfReferenceLocation(node) {
|
|
45600
|
-
switch (node.kind) {
|
|
45601
|
-
case 262 /* FunctionDeclaration */:
|
|
45602
|
-
case 263 /* ClassDeclaration */:
|
|
45603
|
-
case 264 /* InterfaceDeclaration */:
|
|
45604
|
-
case 266 /* EnumDeclaration */:
|
|
45605
|
-
case 265 /* TypeAliasDeclaration */:
|
|
45606
|
-
case 267 /* ModuleDeclaration */:
|
|
45607
|
-
return true;
|
|
45608
|
-
default:
|
|
45609
|
-
return false;
|
|
45610
|
-
}
|
|
45611
|
-
}
|
|
45612
45690
|
function diagnosticName(nameArg) {
|
|
45613
45691
|
return isString(nameArg) ? unescapeLeadingUnderscores(nameArg) : declarationNameToString(nameArg);
|
|
45614
45692
|
}
|
|
45615
|
-
function isTypeParameterSymbolDeclaredInContainer(symbol, container) {
|
|
45616
|
-
if (symbol.declarations) {
|
|
45617
|
-
for (const decl of symbol.declarations) {
|
|
45618
|
-
if (decl.kind === 168 /* TypeParameter */) {
|
|
45619
|
-
const parent = isJSDocTemplateTag(decl.parent) ? getJSDocHost(decl.parent) : decl.parent;
|
|
45620
|
-
if (parent === container) {
|
|
45621
|
-
return !(isJSDocTemplateTag(decl.parent) && find(decl.parent.parent.tags, isJSDocTypeAlias));
|
|
45622
|
-
}
|
|
45623
|
-
}
|
|
45624
|
-
}
|
|
45625
|
-
}
|
|
45626
|
-
return false;
|
|
45627
|
-
}
|
|
45628
45693
|
function checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) {
|
|
45629
45694
|
if (!isIdentifier(errorLocation) || errorLocation.escapedText !== name || isTypeReferenceIdentifier(errorLocation) || isInTypeQuery(errorLocation)) {
|
|
45630
45695
|
return false;
|
|
@@ -45695,8 +45760,6 @@ function createTypeChecker(host) {
|
|
|
45695
45760
|
788968 /* Type */ & ~namespaceMeaning,
|
|
45696
45761
|
/*nameNotFoundMessage*/
|
|
45697
45762
|
void 0,
|
|
45698
|
-
/*nameArg*/
|
|
45699
|
-
void 0,
|
|
45700
45763
|
/*isUse*/
|
|
45701
45764
|
false
|
|
45702
45765
|
));
|
|
@@ -45730,8 +45793,6 @@ function createTypeChecker(host) {
|
|
|
45730
45793
|
~788968 /* Type */ & 111551 /* Value */,
|
|
45731
45794
|
/*nameNotFoundMessage*/
|
|
45732
45795
|
void 0,
|
|
45733
|
-
/*nameArg*/
|
|
45734
|
-
void 0,
|
|
45735
45796
|
/*isUse*/
|
|
45736
45797
|
false
|
|
45737
45798
|
));
|
|
@@ -45777,8 +45838,6 @@ function createTypeChecker(host) {
|
|
|
45777
45838
|
788968 /* Type */ & ~111551 /* Value */,
|
|
45778
45839
|
/*nameNotFoundMessage*/
|
|
45779
45840
|
void 0,
|
|
45780
|
-
/*nameArg*/
|
|
45781
|
-
void 0,
|
|
45782
45841
|
/*isUse*/
|
|
45783
45842
|
false
|
|
45784
45843
|
));
|
|
@@ -45830,8 +45889,6 @@ function createTypeChecker(host) {
|
|
|
45830
45889
|
1024 /* NamespaceModule */,
|
|
45831
45890
|
/*nameNotFoundMessage*/
|
|
45832
45891
|
void 0,
|
|
45833
|
-
/*nameArg*/
|
|
45834
|
-
void 0,
|
|
45835
45892
|
/*isUse*/
|
|
45836
45893
|
false
|
|
45837
45894
|
));
|
|
@@ -45850,8 +45907,6 @@ function createTypeChecker(host) {
|
|
|
45850
45907
|
1536 /* Module */,
|
|
45851
45908
|
/*nameNotFoundMessage*/
|
|
45852
45909
|
void 0,
|
|
45853
|
-
/*nameArg*/
|
|
45854
|
-
void 0,
|
|
45855
45910
|
/*isUse*/
|
|
45856
45911
|
false
|
|
45857
45912
|
));
|
|
@@ -46667,11 +46722,10 @@ function createTypeChecker(host) {
|
|
|
46667
46722
|
let left = getFirstIdentifier(node);
|
|
46668
46723
|
let symbol = resolveName(
|
|
46669
46724
|
left,
|
|
46670
|
-
left
|
|
46725
|
+
left,
|
|
46671
46726
|
111551 /* Value */,
|
|
46672
46727
|
/*nameNotFoundMessage*/
|
|
46673
46728
|
void 0,
|
|
46674
|
-
left,
|
|
46675
46729
|
/*isUse*/
|
|
46676
46730
|
true
|
|
46677
46731
|
);
|
|
@@ -46699,10 +46753,9 @@ function createTypeChecker(host) {
|
|
|
46699
46753
|
const symbolFromJSPrototype = isInJSFile(name) && !nodeIsSynthesized(name) ? resolveEntityNameFromAssignmentDeclaration(name, meaning) : void 0;
|
|
46700
46754
|
symbol = getMergedSymbol(resolveName(
|
|
46701
46755
|
location || name,
|
|
46702
|
-
name
|
|
46756
|
+
name,
|
|
46703
46757
|
meaning,
|
|
46704
46758
|
ignoreErrors || symbolFromJSPrototype ? void 0 : message,
|
|
46705
|
-
name,
|
|
46706
46759
|
/*isUse*/
|
|
46707
46760
|
true,
|
|
46708
46761
|
/*excludeGlobals*/
|
|
@@ -46798,11 +46851,10 @@ function createTypeChecker(host) {
|
|
|
46798
46851
|
if (secondaryLocation) {
|
|
46799
46852
|
return resolveName(
|
|
46800
46853
|
secondaryLocation,
|
|
46801
|
-
name
|
|
46854
|
+
name,
|
|
46802
46855
|
meaning,
|
|
46803
46856
|
/*nameNotFoundMessage*/
|
|
46804
46857
|
void 0,
|
|
46805
|
-
name,
|
|
46806
46858
|
/*isUse*/
|
|
46807
46859
|
true
|
|
46808
46860
|
);
|
|
@@ -47500,14 +47552,6 @@ function createTypeChecker(host) {
|
|
|
47500
47552
|
function symbolIsValue(symbol, includeTypeOnlyMembers) {
|
|
47501
47553
|
return !!(symbol.flags & 111551 /* Value */ || symbol.flags & 2097152 /* Alias */ && getSymbolFlags(symbol, !includeTypeOnlyMembers) & 111551 /* Value */);
|
|
47502
47554
|
}
|
|
47503
|
-
function findConstructorDeclaration(node) {
|
|
47504
|
-
const members = node.members;
|
|
47505
|
-
for (const member of members) {
|
|
47506
|
-
if (member.kind === 176 /* Constructor */ && nodeIsPresent(member.body)) {
|
|
47507
|
-
return member;
|
|
47508
|
-
}
|
|
47509
|
-
}
|
|
47510
|
-
}
|
|
47511
47555
|
function createType(flags) {
|
|
47512
47556
|
var _a;
|
|
47513
47557
|
const result = new Type7(checker, flags);
|
|
@@ -47989,8 +48033,6 @@ function createTypeChecker(host) {
|
|
|
47989
48033
|
meaning,
|
|
47990
48034
|
/*nameNotFoundMessage*/
|
|
47991
48035
|
void 0,
|
|
47992
|
-
/*nameArg*/
|
|
47993
|
-
void 0,
|
|
47994
48036
|
/*isUse*/
|
|
47995
48037
|
false
|
|
47996
48038
|
);
|
|
@@ -49561,8 +49603,6 @@ function createTypeChecker(host) {
|
|
|
49561
49603
|
111551 /* Value */ | 1048576 /* ExportValue */,
|
|
49562
49604
|
/*nameNotFoundMessage*/
|
|
49563
49605
|
void 0,
|
|
49564
|
-
/*nameArg*/
|
|
49565
|
-
void 0,
|
|
49566
49606
|
/*isUse*/
|
|
49567
49607
|
true
|
|
49568
49608
|
);
|
|
@@ -49886,7 +49926,6 @@ function createTypeChecker(host) {
|
|
|
49886
49926
|
788968 /* Type */,
|
|
49887
49927
|
/*nameNotFoundMessage*/
|
|
49888
49928
|
void 0,
|
|
49889
|
-
escapedName,
|
|
49890
49929
|
/*isUse*/
|
|
49891
49930
|
false
|
|
49892
49931
|
);
|
|
@@ -52218,11 +52257,10 @@ function createTypeChecker(host) {
|
|
|
52218
52257
|
if (node.parent && node.parent.kind === 277 /* ExportAssignment */) {
|
|
52219
52258
|
exportSymbol = resolveName(
|
|
52220
52259
|
node,
|
|
52221
|
-
node
|
|
52260
|
+
node,
|
|
52222
52261
|
111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */,
|
|
52223
52262
|
/*nameNotFoundMessage*/
|
|
52224
52263
|
void 0,
|
|
52225
|
-
node,
|
|
52226
52264
|
/*isUse*/
|
|
52227
52265
|
false
|
|
52228
52266
|
);
|
|
@@ -52255,8 +52293,6 @@ function createTypeChecker(host) {
|
|
|
52255
52293
|
111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */,
|
|
52256
52294
|
/*nameNotFoundMessage*/
|
|
52257
52295
|
void 0,
|
|
52258
|
-
/*nameArg*/
|
|
52259
|
-
void 0,
|
|
52260
52296
|
/*isUse*/
|
|
52261
52297
|
false
|
|
52262
52298
|
);
|
|
@@ -56076,8 +56112,6 @@ function createTypeChecker(host) {
|
|
|
56076
56112
|
111551 /* Value */,
|
|
56077
56113
|
/*nameNotFoundMessage*/
|
|
56078
56114
|
void 0,
|
|
56079
|
-
/*nameArg*/
|
|
56080
|
-
void 0,
|
|
56081
56115
|
/*isUse*/
|
|
56082
56116
|
false
|
|
56083
56117
|
);
|
|
@@ -57111,12 +57145,9 @@ function createTypeChecker(host) {
|
|
|
57111
57145
|
name,
|
|
57112
57146
|
meaning,
|
|
57113
57147
|
diagnostic,
|
|
57114
|
-
name,
|
|
57115
57148
|
/*isUse*/
|
|
57116
57149
|
false,
|
|
57117
57150
|
/*excludeGlobals*/
|
|
57118
|
-
false,
|
|
57119
|
-
/*getSpellingSuggestions*/
|
|
57120
57151
|
false
|
|
57121
57152
|
);
|
|
57122
57153
|
}
|
|
@@ -64501,7 +64532,6 @@ function createTypeChecker(host) {
|
|
|
64501
64532
|
788968 /* Type */,
|
|
64502
64533
|
/*nameNotFoundMessage*/
|
|
64503
64534
|
void 0,
|
|
64504
|
-
param.name.escapedText,
|
|
64505
64535
|
/*isUse*/
|
|
64506
64536
|
true
|
|
64507
64537
|
) || originalKeywordKind && isTypeNodeKind(originalKeywordKind))) {
|
|
@@ -65723,10 +65753,9 @@ function createTypeChecker(host) {
|
|
|
65723
65753
|
if (!links.resolvedSymbol) {
|
|
65724
65754
|
links.resolvedSymbol = !nodeIsMissing(node) && resolveName(
|
|
65725
65755
|
node,
|
|
65726
|
-
node
|
|
65756
|
+
node,
|
|
65727
65757
|
111551 /* Value */ | 1048576 /* ExportValue */,
|
|
65728
65758
|
getCannotFindNameDiagnosticForName(node),
|
|
65729
|
-
node,
|
|
65730
65759
|
!isWriteOnlyAccess(node),
|
|
65731
65760
|
/*excludeGlobals*/
|
|
65732
65761
|
false
|
|
@@ -68962,7 +68991,6 @@ function createTypeChecker(host) {
|
|
|
68962
68991
|
111551 /* Value */,
|
|
68963
68992
|
/*nameNotFoundMessage*/
|
|
68964
68993
|
void 0,
|
|
68965
|
-
id.escapedText,
|
|
68966
68994
|
/*isUse*/
|
|
68967
68995
|
true
|
|
68968
68996
|
);
|
|
@@ -69012,8 +69040,6 @@ function createTypeChecker(host) {
|
|
|
69012
69040
|
111551 /* Value */,
|
|
69013
69041
|
/*nameNotFoundMessage*/
|
|
69014
69042
|
void 0,
|
|
69015
|
-
/*nameArg*/
|
|
69016
|
-
void 0,
|
|
69017
69043
|
/*isUse*/
|
|
69018
69044
|
true,
|
|
69019
69045
|
/*excludeGlobals*/
|
|
@@ -70390,7 +70416,6 @@ function createTypeChecker(host) {
|
|
|
70390
70416
|
1920 /* Namespace */,
|
|
70391
70417
|
/*nameNotFoundMessage*/
|
|
70392
70418
|
void 0,
|
|
70393
|
-
namespaceName,
|
|
70394
70419
|
/*isUse*/
|
|
70395
70420
|
false
|
|
70396
70421
|
);
|
|
@@ -70605,7 +70630,6 @@ function createTypeChecker(host) {
|
|
|
70605
70630
|
jsxFactoryNamespace,
|
|
70606
70631
|
111551 /* Value */,
|
|
70607
70632
|
jsxFactoryRefErr,
|
|
70608
|
-
jsxFactoryNamespace,
|
|
70609
70633
|
/*isUse*/
|
|
70610
70634
|
true
|
|
70611
70635
|
);
|
|
@@ -70625,7 +70649,6 @@ function createTypeChecker(host) {
|
|
|
70625
70649
|
localJsxNamespace,
|
|
70626
70650
|
111551 /* Value */,
|
|
70627
70651
|
jsxFactoryRefErr,
|
|
70628
|
-
localJsxNamespace,
|
|
70629
70652
|
/*isUse*/
|
|
70630
70653
|
true
|
|
70631
70654
|
);
|
|
@@ -71346,38 +71369,34 @@ function createTypeChecker(host) {
|
|
|
71346
71369
|
const suggestion = getSuggestedSymbolForNonexistentProperty(name, containingType);
|
|
71347
71370
|
return suggestion && symbolName(suggestion);
|
|
71348
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
|
+
}
|
|
71349
71388
|
function getSuggestedSymbolForNonexistentSymbol(location, outerName, meaning) {
|
|
71350
71389
|
Debug.assert(outerName !== void 0, "outername should always be defined");
|
|
71351
|
-
const result =
|
|
71390
|
+
const result = resolveNameForSymbolSuggestion(
|
|
71352
71391
|
location,
|
|
71353
71392
|
outerName,
|
|
71354
71393
|
meaning,
|
|
71355
71394
|
/*nameNotFoundMessage*/
|
|
71356
71395
|
void 0,
|
|
71357
|
-
outerName,
|
|
71358
71396
|
/*isUse*/
|
|
71359
71397
|
false,
|
|
71360
71398
|
/*excludeGlobals*/
|
|
71361
|
-
false
|
|
71362
|
-
/*getSpellingSuggestions*/
|
|
71363
|
-
true,
|
|
71364
|
-
(symbols, name, meaning2) => {
|
|
71365
|
-
Debug.assertEqual(outerName, name, "name should equal outerName");
|
|
71366
|
-
const symbol = getSymbol(symbols, name, meaning2);
|
|
71367
|
-
if (symbol)
|
|
71368
|
-
return symbol;
|
|
71369
|
-
let candidates;
|
|
71370
|
-
if (symbols === globals) {
|
|
71371
|
-
const primitives = mapDefined(
|
|
71372
|
-
["string", "number", "boolean", "object", "bigint", "symbol"],
|
|
71373
|
-
(s) => symbols.has(s.charAt(0).toUpperCase() + s.slice(1)) ? createSymbol(524288 /* TypeAlias */, s) : void 0
|
|
71374
|
-
);
|
|
71375
|
-
candidates = primitives.concat(arrayFrom(symbols.values()));
|
|
71376
|
-
} else {
|
|
71377
|
-
candidates = arrayFrom(symbols.values());
|
|
71378
|
-
}
|
|
71379
|
-
return getSpellingSuggestionForName(unescapeLeadingUnderscores(name), candidates, meaning2);
|
|
71380
|
-
}
|
|
71399
|
+
false
|
|
71381
71400
|
);
|
|
71382
71401
|
return result;
|
|
71383
71402
|
}
|
|
@@ -72234,8 +72253,6 @@ function createTypeChecker(host) {
|
|
|
72234
72253
|
111551 /* Value */,
|
|
72235
72254
|
/*nameNotFoundMessage*/
|
|
72236
72255
|
void 0,
|
|
72237
|
-
/*nameArg*/
|
|
72238
|
-
void 0,
|
|
72239
72256
|
/*isUse*/
|
|
72240
72257
|
false
|
|
72241
72258
|
);
|
|
@@ -73499,8 +73516,6 @@ function createTypeChecker(host) {
|
|
|
73499
73516
|
111551 /* Value */,
|
|
73500
73517
|
/*nameNotFoundMessage*/
|
|
73501
73518
|
void 0,
|
|
73502
|
-
/*nameArg*/
|
|
73503
|
-
void 0,
|
|
73504
73519
|
/*isUse*/
|
|
73505
73520
|
false
|
|
73506
73521
|
);
|
|
@@ -73618,8 +73633,6 @@ function createTypeChecker(host) {
|
|
|
73618
73633
|
111551 /* Value */,
|
|
73619
73634
|
/*nameNotFoundMessage*/
|
|
73620
73635
|
void 0,
|
|
73621
|
-
/*nameArg*/
|
|
73622
|
-
void 0,
|
|
73623
73636
|
/*isUse*/
|
|
73624
73637
|
true
|
|
73625
73638
|
);
|
|
@@ -75955,7 +75968,6 @@ function createTypeChecker(host) {
|
|
|
75955
75968
|
788968 /* Type */,
|
|
75956
75969
|
/*nameNotFoundMessage*/
|
|
75957
75970
|
void 0,
|
|
75958
|
-
name,
|
|
75959
75971
|
/*isUse*/
|
|
75960
75972
|
false
|
|
75961
75973
|
);
|
|
@@ -78243,8 +78255,6 @@ function createTypeChecker(host) {
|
|
|
78243
78255
|
meaning,
|
|
78244
78256
|
/*nameNotFoundMessage*/
|
|
78245
78257
|
void 0,
|
|
78246
|
-
/*nameArg*/
|
|
78247
|
-
void 0,
|
|
78248
78258
|
/*isUse*/
|
|
78249
78259
|
true
|
|
78250
78260
|
);
|
|
@@ -78996,8 +79006,6 @@ function createTypeChecker(host) {
|
|
|
78996
79006
|
3 /* Variable */,
|
|
78997
79007
|
/*nameNotFoundMessage*/
|
|
78998
79008
|
void 0,
|
|
78999
|
-
/*nameArg*/
|
|
79000
|
-
void 0,
|
|
79001
79009
|
/*isUse*/
|
|
79002
79010
|
false
|
|
79003
79011
|
);
|
|
@@ -81822,8 +81830,6 @@ function createTypeChecker(host) {
|
|
|
81822
81830
|
111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */,
|
|
81823
81831
|
/*nameNotFoundMessage*/
|
|
81824
81832
|
void 0,
|
|
81825
|
-
/*nameArg*/
|
|
81826
|
-
void 0,
|
|
81827
81833
|
/*isUse*/
|
|
81828
81834
|
true
|
|
81829
81835
|
);
|
|
@@ -83240,8 +83246,6 @@ function createTypeChecker(host) {
|
|
|
83240
83246
|
111551 /* Value */,
|
|
83241
83247
|
/*nameNotFoundMessage*/
|
|
83242
83248
|
void 0,
|
|
83243
|
-
/*nameArg*/
|
|
83244
|
-
void 0,
|
|
83245
83249
|
/*isUse*/
|
|
83246
83250
|
false
|
|
83247
83251
|
)) {
|
|
@@ -83633,8 +83637,6 @@ function createTypeChecker(host) {
|
|
|
83633
83637
|
111551 /* Value */ | 1048576 /* ExportValue */ | 2097152 /* Alias */,
|
|
83634
83638
|
/*nameNotFoundMessage*/
|
|
83635
83639
|
void 0,
|
|
83636
|
-
/*nameArg*/
|
|
83637
|
-
void 0,
|
|
83638
83640
|
/*isUse*/
|
|
83639
83641
|
true
|
|
83640
83642
|
);
|
|
@@ -83650,13 +83652,9 @@ function createTypeChecker(host) {
|
|
|
83650
83652
|
111551 /* Value */ | 1048576 /* ExportValue */ | 2097152 /* Alias */,
|
|
83651
83653
|
/*nameNotFoundMessage*/
|
|
83652
83654
|
void 0,
|
|
83653
|
-
/*nameArg*/
|
|
83654
|
-
void 0,
|
|
83655
83655
|
/*isUse*/
|
|
83656
83656
|
true,
|
|
83657
83657
|
/*excludeGlobals*/
|
|
83658
|
-
void 0,
|
|
83659
|
-
/*getSpellingSuggestions*/
|
|
83660
83658
|
void 0
|
|
83661
83659
|
);
|
|
83662
83660
|
}
|