typescript 5.5.0-dev.20240508 → 5.5.0-dev.20240510
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 +338 -167
- package/lib/typescript.d.ts +53 -0
- package/lib/typescript.js +636 -338
- 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.20240510`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -11908,6 +11908,10 @@ function isPropertyAccessOrQualifiedNameOrImportTypeNode(node) {
|
|
|
11908
11908
|
const kind = node.kind;
|
|
11909
11909
|
return kind === 211 /* PropertyAccessExpression */ || kind === 166 /* QualifiedName */ || kind === 205 /* ImportType */;
|
|
11910
11910
|
}
|
|
11911
|
+
function isPropertyAccessOrQualifiedName(node) {
|
|
11912
|
+
const kind = node.kind;
|
|
11913
|
+
return kind === 211 /* PropertyAccessExpression */ || kind === 166 /* QualifiedName */;
|
|
11914
|
+
}
|
|
11911
11915
|
function isCallLikeOrFunctionLikeExpression(node) {
|
|
11912
11916
|
return isCallLikeExpression(node) || isFunctionExpressionOrArrowFunction(node);
|
|
11913
11917
|
}
|
|
@@ -45467,7 +45471,8 @@ function createTypeChecker(host) {
|
|
|
45467
45471
|
getTypeOnlyAliasDeclaration,
|
|
45468
45472
|
getMemberOverrideModifierStatus,
|
|
45469
45473
|
isTypeParameterPossiblyReferenced,
|
|
45470
|
-
typeHasCallOrConstructSignatures
|
|
45474
|
+
typeHasCallOrConstructSignatures,
|
|
45475
|
+
getSymbolFlags
|
|
45471
45476
|
};
|
|
45472
45477
|
function getCandidateSignaturesForStringLiteralCompletions(call, editingArgument) {
|
|
45473
45478
|
const candidatesSet = /* @__PURE__ */ new Set();
|
|
@@ -47657,37 +47662,6 @@ function createTypeChecker(host) {
|
|
|
47657
47662
|
}
|
|
47658
47663
|
return void 0;
|
|
47659
47664
|
}
|
|
47660
|
-
function markExportAsReferenced(node) {
|
|
47661
|
-
if (!canCollectSymbolAliasAccessabilityData) {
|
|
47662
|
-
return;
|
|
47663
|
-
}
|
|
47664
|
-
const symbol = getSymbolOfDeclaration(node);
|
|
47665
|
-
const target = resolveAlias(symbol);
|
|
47666
|
-
if (target) {
|
|
47667
|
-
const markAlias = target === unknownSymbol || getSymbolFlags(
|
|
47668
|
-
symbol,
|
|
47669
|
-
/*excludeTypeOnlyMeanings*/
|
|
47670
|
-
true
|
|
47671
|
-
) & 111551 /* Value */ && !isConstEnumOrConstEnumOnlyModule(target);
|
|
47672
|
-
if (markAlias) {
|
|
47673
|
-
markAliasSymbolAsReferenced(symbol);
|
|
47674
|
-
}
|
|
47675
|
-
}
|
|
47676
|
-
}
|
|
47677
|
-
function markAliasSymbolAsReferenced(symbol) {
|
|
47678
|
-
Debug.assert(canCollectSymbolAliasAccessabilityData);
|
|
47679
|
-
const links = getSymbolLinks(symbol);
|
|
47680
|
-
if (!links.referenced) {
|
|
47681
|
-
links.referenced = true;
|
|
47682
|
-
const node = getDeclarationOfAliasSymbol(symbol);
|
|
47683
|
-
if (!node) return Debug.fail();
|
|
47684
|
-
if (isInternalModuleImportEqualsDeclaration(node)) {
|
|
47685
|
-
if (getSymbolFlags(resolveSymbol(symbol)) & 111551 /* Value */) {
|
|
47686
|
-
checkExpressionCached(node.moduleReference);
|
|
47687
|
-
}
|
|
47688
|
-
}
|
|
47689
|
-
}
|
|
47690
|
-
}
|
|
47691
47665
|
function getSymbolOfPartOfRightHandSideOfImportEquals(entityName, dontResolveAlias) {
|
|
47692
47666
|
if (entityName.kind === 80 /* Identifier */ && isRightSideOfQualifiedNameOrPropertyAccess(entityName)) {
|
|
47693
47667
|
entityName = entityName.parent;
|
|
@@ -51119,7 +51093,7 @@ function createTypeChecker(host) {
|
|
|
51119
51093
|
var _a;
|
|
51120
51094
|
const addUndefined = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration);
|
|
51121
51095
|
const enclosingDeclaration = context.enclosingDeclaration;
|
|
51122
|
-
if (!isErrorType(type)
|
|
51096
|
+
if (enclosingDeclaration && (!isErrorType(type) || context.flags & 1 /* AllowUnresolvedNames */)) {
|
|
51123
51097
|
const declWithExistingAnnotation = declaration && getNonlocalEffectiveTypeAnnotationNode(declaration) ? declaration : getDeclarationWithTypeAnnotation(symbol, getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration));
|
|
51124
51098
|
if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
|
|
51125
51099
|
const existing = getNonlocalEffectiveTypeAnnotationNode(declWithExistingAnnotation);
|
|
@@ -51408,7 +51382,7 @@ function createTypeChecker(host) {
|
|
|
51408
51382
|
);
|
|
51409
51383
|
}
|
|
51410
51384
|
if (isNamedDeclaration(node) && node.name.kind === 167 /* ComputedPropertyName */ && !isLateBindableName(node.name)) {
|
|
51411
|
-
if (!(context.flags & 1 /*
|
|
51385
|
+
if (!(context.flags & 1 /* AllowUnresolvedNames */ && hasDynamicName(node) && isEntityNameExpression(node.name.expression) && checkComputedPropertyName(node.name).flags & 1 /* Any */)) {
|
|
51412
51386
|
return void 0;
|
|
51413
51387
|
}
|
|
51414
51388
|
}
|
|
@@ -68912,6 +68886,248 @@ function createTypeChecker(host) {
|
|
|
68912
68886
|
return false;
|
|
68913
68887
|
});
|
|
68914
68888
|
}
|
|
68889
|
+
function markLinkedReferences(location, hint, propSymbol, parentType) {
|
|
68890
|
+
if (!canCollectSymbolAliasAccessabilityData) {
|
|
68891
|
+
return;
|
|
68892
|
+
}
|
|
68893
|
+
if (location.flags & 33554432 /* Ambient */) {
|
|
68894
|
+
return;
|
|
68895
|
+
}
|
|
68896
|
+
switch (hint) {
|
|
68897
|
+
case 1 /* Identifier */:
|
|
68898
|
+
return markIdentifierAliasReferenced(location);
|
|
68899
|
+
case 2 /* Property */:
|
|
68900
|
+
return markPropertyAliasReferenced(location, propSymbol, parentType);
|
|
68901
|
+
case 3 /* ExportAssignment */:
|
|
68902
|
+
return markExportAssignmentAliasReferenced(location);
|
|
68903
|
+
case 4 /* Jsx */:
|
|
68904
|
+
return markJsxAliasReferenced(location);
|
|
68905
|
+
case 5 /* AsyncFunction */:
|
|
68906
|
+
return markAsyncFunctionAliasReferenced(location);
|
|
68907
|
+
case 6 /* ExportImportEquals */:
|
|
68908
|
+
return markImportEqualsAliasReferenced(location);
|
|
68909
|
+
case 7 /* ExportSpecifier */:
|
|
68910
|
+
return markExportSpecifierAliasReferenced(location);
|
|
68911
|
+
case 8 /* Decorator */:
|
|
68912
|
+
return markDecoratorAliasReferenced(location);
|
|
68913
|
+
case 0 /* Unspecified */: {
|
|
68914
|
+
if (isIdentifier(location) && (isExpressionNode(location) || isShorthandPropertyAssignment(location.parent) || isImportEqualsDeclaration(location.parent) && location.parent.moduleReference === location) && shouldMarkIdentifierAliasReferenced(location)) {
|
|
68915
|
+
if (isPropertyAccessOrQualifiedName(location.parent)) {
|
|
68916
|
+
const left = isPropertyAccessExpression(location.parent) ? location.parent.expression : location.parent.left;
|
|
68917
|
+
if (left !== location) return;
|
|
68918
|
+
}
|
|
68919
|
+
markIdentifierAliasReferenced(location);
|
|
68920
|
+
return;
|
|
68921
|
+
}
|
|
68922
|
+
if (isPropertyAccessOrQualifiedName(location)) {
|
|
68923
|
+
let topProp = location;
|
|
68924
|
+
while (isPropertyAccessOrQualifiedName(topProp)) {
|
|
68925
|
+
if (isPartOfTypeNode(topProp)) return;
|
|
68926
|
+
topProp = topProp.parent;
|
|
68927
|
+
}
|
|
68928
|
+
return markPropertyAliasReferenced(location);
|
|
68929
|
+
}
|
|
68930
|
+
if (isExportAssignment(location)) {
|
|
68931
|
+
return markExportAssignmentAliasReferenced(location);
|
|
68932
|
+
}
|
|
68933
|
+
if (isJsxOpeningLikeElement(location) || isJsxOpeningFragment(location)) {
|
|
68934
|
+
return markJsxAliasReferenced(location);
|
|
68935
|
+
}
|
|
68936
|
+
if (isFunctionLikeDeclaration(location) || isMethodSignature(location)) {
|
|
68937
|
+
return markAsyncFunctionAliasReferenced(location);
|
|
68938
|
+
}
|
|
68939
|
+
if (isImportEqualsDeclaration(location)) {
|
|
68940
|
+
if (isInternalModuleImportEqualsDeclaration(location) || checkExternalImportOrExportDeclaration(location)) {
|
|
68941
|
+
return markImportEqualsAliasReferenced(location);
|
|
68942
|
+
}
|
|
68943
|
+
return;
|
|
68944
|
+
}
|
|
68945
|
+
if (isExportSpecifier(location)) {
|
|
68946
|
+
return markExportSpecifierAliasReferenced(location);
|
|
68947
|
+
}
|
|
68948
|
+
if (!compilerOptions.emitDecoratorMetadata) {
|
|
68949
|
+
return;
|
|
68950
|
+
}
|
|
68951
|
+
if (!canHaveDecorators(location) || !hasDecorators(location) || !location.modifiers || !nodeCanBeDecorated(legacyDecorators, location, location.parent, location.parent.parent)) {
|
|
68952
|
+
return;
|
|
68953
|
+
}
|
|
68954
|
+
return markDecoratorAliasReferenced(location);
|
|
68955
|
+
}
|
|
68956
|
+
default:
|
|
68957
|
+
Debug.assertNever(hint, `Unhandled reference hint: ${hint}`);
|
|
68958
|
+
}
|
|
68959
|
+
}
|
|
68960
|
+
function markIdentifierAliasReferenced(location) {
|
|
68961
|
+
const symbol = getResolvedSymbol(location);
|
|
68962
|
+
if (symbol && symbol !== argumentsSymbol && symbol !== unknownSymbol && !isThisInTypeQuery(location)) {
|
|
68963
|
+
markAliasReferenced(symbol, location);
|
|
68964
|
+
}
|
|
68965
|
+
}
|
|
68966
|
+
function markPropertyAliasReferenced(location, propSymbol, parentType) {
|
|
68967
|
+
const left = isPropertyAccessExpression(location) ? location.expression : location.left;
|
|
68968
|
+
if (isThisIdentifier(left) || !isIdentifier(left)) {
|
|
68969
|
+
return;
|
|
68970
|
+
}
|
|
68971
|
+
const parentSymbol = getResolvedSymbol(left);
|
|
68972
|
+
if (!parentSymbol || parentSymbol === unknownSymbol) {
|
|
68973
|
+
return;
|
|
68974
|
+
}
|
|
68975
|
+
if (getIsolatedModules(compilerOptions) || shouldPreserveConstEnums(compilerOptions) && isExportOrExportExpression(location)) {
|
|
68976
|
+
markAliasReferenced(parentSymbol, location);
|
|
68977
|
+
return;
|
|
68978
|
+
}
|
|
68979
|
+
const leftType = parentType || checkExpressionCached(left);
|
|
68980
|
+
if (isTypeAny(leftType) || leftType === silentNeverType) {
|
|
68981
|
+
markAliasReferenced(parentSymbol, location);
|
|
68982
|
+
return;
|
|
68983
|
+
}
|
|
68984
|
+
let prop = propSymbol;
|
|
68985
|
+
if (!prop && !parentType) {
|
|
68986
|
+
const right = isPropertyAccessExpression(location) ? location.name : location.right;
|
|
68987
|
+
const lexicallyScopedSymbol = isPrivateIdentifier(right) && lookupSymbolForPrivateIdentifierDeclaration(right.escapedText, right);
|
|
68988
|
+
const assignmentKind = getAssignmentTargetKind(location);
|
|
68989
|
+
const apparentType = getApparentType(assignmentKind !== 0 /* None */ || isMethodAccessForCall(location) ? getWidenedType(leftType) : leftType);
|
|
68990
|
+
prop = isPrivateIdentifier(right) ? lexicallyScopedSymbol && getPrivateIdentifierPropertyOfType(apparentType, lexicallyScopedSymbol) || void 0 : getPropertyOfType(apparentType, right.escapedText);
|
|
68991
|
+
}
|
|
68992
|
+
if (!(prop && (isConstEnumOrConstEnumOnlyModule(prop) || prop.flags & 8 /* EnumMember */ && location.parent.kind === 306 /* EnumMember */))) {
|
|
68993
|
+
markAliasReferenced(parentSymbol, location);
|
|
68994
|
+
}
|
|
68995
|
+
return;
|
|
68996
|
+
}
|
|
68997
|
+
function markExportAssignmentAliasReferenced(location) {
|
|
68998
|
+
if (isIdentifier(location.expression)) {
|
|
68999
|
+
const id = location.expression;
|
|
69000
|
+
const sym = getExportSymbolOfValueSymbolIfExported(resolveEntityName(
|
|
69001
|
+
id,
|
|
69002
|
+
-1 /* All */,
|
|
69003
|
+
/*ignoreErrors*/
|
|
69004
|
+
true,
|
|
69005
|
+
/*dontResolveAlias*/
|
|
69006
|
+
true,
|
|
69007
|
+
location
|
|
69008
|
+
));
|
|
69009
|
+
if (sym) {
|
|
69010
|
+
markAliasReferenced(sym, id);
|
|
69011
|
+
}
|
|
69012
|
+
}
|
|
69013
|
+
}
|
|
69014
|
+
function markJsxAliasReferenced(node) {
|
|
69015
|
+
if (!getJsxNamespaceContainerForImplicitImport(node)) {
|
|
69016
|
+
const jsxFactoryRefErr = diagnostics && compilerOptions.jsx === 2 /* React */ ? Diagnostics.Cannot_find_name_0 : void 0;
|
|
69017
|
+
const jsxFactoryNamespace = getJsxNamespace(node);
|
|
69018
|
+
const jsxFactoryLocation = isJsxOpeningLikeElement(node) ? node.tagName : node;
|
|
69019
|
+
let jsxFactorySym;
|
|
69020
|
+
if (!(isJsxOpeningFragment(node) && jsxFactoryNamespace === "null")) {
|
|
69021
|
+
jsxFactorySym = resolveName(
|
|
69022
|
+
jsxFactoryLocation,
|
|
69023
|
+
jsxFactoryNamespace,
|
|
69024
|
+
111551 /* Value */,
|
|
69025
|
+
jsxFactoryRefErr,
|
|
69026
|
+
/*isUse*/
|
|
69027
|
+
true
|
|
69028
|
+
);
|
|
69029
|
+
}
|
|
69030
|
+
if (jsxFactorySym) {
|
|
69031
|
+
jsxFactorySym.isReferenced = -1 /* All */;
|
|
69032
|
+
if (canCollectSymbolAliasAccessabilityData && jsxFactorySym.flags & 2097152 /* Alias */ && !getTypeOnlyAliasDeclaration(jsxFactorySym)) {
|
|
69033
|
+
markAliasSymbolAsReferenced(jsxFactorySym);
|
|
69034
|
+
}
|
|
69035
|
+
}
|
|
69036
|
+
if (isJsxOpeningFragment(node)) {
|
|
69037
|
+
const file = getSourceFileOfNode(node);
|
|
69038
|
+
const localJsxNamespace = getLocalJsxNamespace(file);
|
|
69039
|
+
if (localJsxNamespace) {
|
|
69040
|
+
resolveName(
|
|
69041
|
+
jsxFactoryLocation,
|
|
69042
|
+
localJsxNamespace,
|
|
69043
|
+
111551 /* Value */,
|
|
69044
|
+
jsxFactoryRefErr,
|
|
69045
|
+
/*isUse*/
|
|
69046
|
+
true
|
|
69047
|
+
);
|
|
69048
|
+
}
|
|
69049
|
+
}
|
|
69050
|
+
}
|
|
69051
|
+
return;
|
|
69052
|
+
}
|
|
69053
|
+
function markAsyncFunctionAliasReferenced(location) {
|
|
69054
|
+
if (languageVersion < 2 /* ES2015 */) {
|
|
69055
|
+
if (getFunctionFlags(location) & 2 /* Async */) {
|
|
69056
|
+
const returnTypeNode = getEffectiveReturnTypeNode(location);
|
|
69057
|
+
markTypeNodeAsReferenced(returnTypeNode);
|
|
69058
|
+
}
|
|
69059
|
+
}
|
|
69060
|
+
}
|
|
69061
|
+
function markImportEqualsAliasReferenced(location) {
|
|
69062
|
+
if (hasSyntacticModifier(location, 32 /* Export */)) {
|
|
69063
|
+
markExportAsReferenced(location);
|
|
69064
|
+
}
|
|
69065
|
+
}
|
|
69066
|
+
function markExportSpecifierAliasReferenced(location) {
|
|
69067
|
+
if (!location.parent.parent.moduleSpecifier && !location.isTypeOnly && !location.parent.parent.isTypeOnly) {
|
|
69068
|
+
const exportedName = location.propertyName || location.name;
|
|
69069
|
+
const symbol = resolveName(
|
|
69070
|
+
exportedName,
|
|
69071
|
+
exportedName.escapedText,
|
|
69072
|
+
111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */,
|
|
69073
|
+
/*nameNotFoundMessage*/
|
|
69074
|
+
void 0,
|
|
69075
|
+
/*isUse*/
|
|
69076
|
+
true
|
|
69077
|
+
);
|
|
69078
|
+
if (symbol && (symbol === undefinedSymbol || symbol === globalThisSymbol || symbol.declarations && isGlobalSourceFile(getDeclarationContainer(symbol.declarations[0])))) {
|
|
69079
|
+
} else {
|
|
69080
|
+
const target = symbol && (symbol.flags & 2097152 /* Alias */ ? resolveAlias(symbol) : symbol);
|
|
69081
|
+
if (!target || getSymbolFlags(target) & 111551 /* Value */) {
|
|
69082
|
+
markExportAsReferenced(location);
|
|
69083
|
+
markIdentifierAliasReferenced(location.propertyName || location.name);
|
|
69084
|
+
}
|
|
69085
|
+
}
|
|
69086
|
+
return;
|
|
69087
|
+
}
|
|
69088
|
+
}
|
|
69089
|
+
function markDecoratorAliasReferenced(node) {
|
|
69090
|
+
if (compilerOptions.emitDecoratorMetadata) {
|
|
69091
|
+
const firstDecorator = find(node.modifiers, isDecorator);
|
|
69092
|
+
if (!firstDecorator) {
|
|
69093
|
+
return;
|
|
69094
|
+
}
|
|
69095
|
+
checkExternalEmitHelpers(firstDecorator, 16 /* Metadata */);
|
|
69096
|
+
switch (node.kind) {
|
|
69097
|
+
case 263 /* ClassDeclaration */:
|
|
69098
|
+
const constructor = getFirstConstructorWithBody(node);
|
|
69099
|
+
if (constructor) {
|
|
69100
|
+
for (const parameter of constructor.parameters) {
|
|
69101
|
+
markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter));
|
|
69102
|
+
}
|
|
69103
|
+
}
|
|
69104
|
+
break;
|
|
69105
|
+
case 177 /* GetAccessor */:
|
|
69106
|
+
case 178 /* SetAccessor */:
|
|
69107
|
+
const otherKind = node.kind === 177 /* GetAccessor */ ? 178 /* SetAccessor */ : 177 /* GetAccessor */;
|
|
69108
|
+
const otherAccessor = getDeclarationOfKind(getSymbolOfDeclaration(node), otherKind);
|
|
69109
|
+
markDecoratorMedataDataTypeNodeAsReferenced(getAnnotatedAccessorTypeNode(node) || otherAccessor && getAnnotatedAccessorTypeNode(otherAccessor));
|
|
69110
|
+
break;
|
|
69111
|
+
case 174 /* MethodDeclaration */:
|
|
69112
|
+
for (const parameter of node.parameters) {
|
|
69113
|
+
markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter));
|
|
69114
|
+
}
|
|
69115
|
+
markDecoratorMedataDataTypeNodeAsReferenced(getEffectiveReturnTypeNode(node));
|
|
69116
|
+
break;
|
|
69117
|
+
case 172 /* PropertyDeclaration */:
|
|
69118
|
+
markDecoratorMedataDataTypeNodeAsReferenced(getEffectiveTypeAnnotationNode(node));
|
|
69119
|
+
break;
|
|
69120
|
+
case 169 /* Parameter */:
|
|
69121
|
+
markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(node));
|
|
69122
|
+
const containingSignature = node.parent;
|
|
69123
|
+
for (const parameter of containingSignature.parameters) {
|
|
69124
|
+
markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter));
|
|
69125
|
+
}
|
|
69126
|
+
markDecoratorMedataDataTypeNodeAsReferenced(getEffectiveReturnTypeNode(containingSignature));
|
|
69127
|
+
break;
|
|
69128
|
+
}
|
|
69129
|
+
}
|
|
69130
|
+
}
|
|
68915
69131
|
function markAliasReferenced(symbol, location) {
|
|
68916
69132
|
if (!canCollectSymbolAliasAccessabilityData) {
|
|
68917
69133
|
return;
|
|
@@ -68933,6 +69149,77 @@ function createTypeChecker(host) {
|
|
|
68933
69149
|
}
|
|
68934
69150
|
}
|
|
68935
69151
|
}
|
|
69152
|
+
function markAliasSymbolAsReferenced(symbol) {
|
|
69153
|
+
Debug.assert(canCollectSymbolAliasAccessabilityData);
|
|
69154
|
+
const links = getSymbolLinks(symbol);
|
|
69155
|
+
if (!links.referenced) {
|
|
69156
|
+
links.referenced = true;
|
|
69157
|
+
const node = getDeclarationOfAliasSymbol(symbol);
|
|
69158
|
+
if (!node) return Debug.fail();
|
|
69159
|
+
if (isInternalModuleImportEqualsDeclaration(node)) {
|
|
69160
|
+
if (getSymbolFlags(resolveSymbol(symbol)) & 111551 /* Value */) {
|
|
69161
|
+
const left = getFirstIdentifier(node.moduleReference);
|
|
69162
|
+
markIdentifierAliasReferenced(left);
|
|
69163
|
+
}
|
|
69164
|
+
}
|
|
69165
|
+
}
|
|
69166
|
+
}
|
|
69167
|
+
function markExportAsReferenced(node) {
|
|
69168
|
+
const symbol = getSymbolOfDeclaration(node);
|
|
69169
|
+
const target = resolveAlias(symbol);
|
|
69170
|
+
if (target) {
|
|
69171
|
+
const markAlias = target === unknownSymbol || getSymbolFlags(
|
|
69172
|
+
symbol,
|
|
69173
|
+
/*excludeTypeOnlyMeanings*/
|
|
69174
|
+
true
|
|
69175
|
+
) & 111551 /* Value */ && !isConstEnumOrConstEnumOnlyModule(target);
|
|
69176
|
+
if (markAlias) {
|
|
69177
|
+
markAliasSymbolAsReferenced(symbol);
|
|
69178
|
+
}
|
|
69179
|
+
}
|
|
69180
|
+
}
|
|
69181
|
+
function markEntityNameOrEntityExpressionAsReference(typeName, forDecoratorMetadata) {
|
|
69182
|
+
if (!typeName) return;
|
|
69183
|
+
const rootName = getFirstIdentifier(typeName);
|
|
69184
|
+
const meaning = (typeName.kind === 80 /* Identifier */ ? 788968 /* Type */ : 1920 /* Namespace */) | 2097152 /* Alias */;
|
|
69185
|
+
const rootSymbol = resolveName(
|
|
69186
|
+
rootName,
|
|
69187
|
+
rootName.escapedText,
|
|
69188
|
+
meaning,
|
|
69189
|
+
/*nameNotFoundMessage*/
|
|
69190
|
+
void 0,
|
|
69191
|
+
/*isUse*/
|
|
69192
|
+
true
|
|
69193
|
+
);
|
|
69194
|
+
if (rootSymbol && rootSymbol.flags & 2097152 /* Alias */) {
|
|
69195
|
+
if (canCollectSymbolAliasAccessabilityData && symbolIsValue(rootSymbol) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol)) && !getTypeOnlyAliasDeclaration(rootSymbol)) {
|
|
69196
|
+
markAliasSymbolAsReferenced(rootSymbol);
|
|
69197
|
+
} else if (forDecoratorMetadata && getIsolatedModules(compilerOptions) && getEmitModuleKind(compilerOptions) >= 5 /* ES2015 */ && !symbolIsValue(rootSymbol) && !some(rootSymbol.declarations, isTypeOnlyImportOrExportDeclaration)) {
|
|
69198
|
+
const diag2 = error(typeName, Diagnostics.A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_when_isolatedModules_and_emitDecoratorMetadata_are_enabled);
|
|
69199
|
+
const aliasDeclaration = find(rootSymbol.declarations || emptyArray, isAliasSymbolDeclaration);
|
|
69200
|
+
if (aliasDeclaration) {
|
|
69201
|
+
addRelatedInfo(diag2, createDiagnosticForNode(aliasDeclaration, Diagnostics._0_was_imported_here, idText(rootName)));
|
|
69202
|
+
}
|
|
69203
|
+
}
|
|
69204
|
+
}
|
|
69205
|
+
}
|
|
69206
|
+
function markTypeNodeAsReferenced(node) {
|
|
69207
|
+
markEntityNameOrEntityExpressionAsReference(
|
|
69208
|
+
node && getEntityNameFromTypeNode(node),
|
|
69209
|
+
/*forDecoratorMetadata*/
|
|
69210
|
+
false
|
|
69211
|
+
);
|
|
69212
|
+
}
|
|
69213
|
+
function markDecoratorMedataDataTypeNodeAsReferenced(node) {
|
|
69214
|
+
const entityName = getEntityNameForDecoratorMetadata(node);
|
|
69215
|
+
if (entityName && isEntityName(entityName)) {
|
|
69216
|
+
markEntityNameOrEntityExpressionAsReference(
|
|
69217
|
+
entityName,
|
|
69218
|
+
/*forDecoratorMetadata*/
|
|
69219
|
+
true
|
|
69220
|
+
);
|
|
69221
|
+
}
|
|
69222
|
+
}
|
|
68936
69223
|
function getNarrowedTypeOfSymbol(symbol, location, checkMode) {
|
|
68937
69224
|
var _a;
|
|
68938
69225
|
const type = getTypeOfSymbol(symbol, checkMode);
|
|
@@ -69028,7 +69315,7 @@ function createTypeChecker(host) {
|
|
|
69028
69315
|
return getTypeOfSymbol(symbol);
|
|
69029
69316
|
}
|
|
69030
69317
|
if (shouldMarkIdentifierAliasReferenced(node)) {
|
|
69031
|
-
|
|
69318
|
+
markLinkedReferences(node, 1 /* Identifier */);
|
|
69032
69319
|
}
|
|
69033
69320
|
const localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol);
|
|
69034
69321
|
const targetSymbol = resolveAliasWithDeprecationCheck(localOrExportSymbol, node);
|
|
@@ -71571,42 +71858,7 @@ function createTypeChecker(host) {
|
|
|
71571
71858
|
checkGrammarJsxElement(node);
|
|
71572
71859
|
}
|
|
71573
71860
|
checkJsxPreconditions(node);
|
|
71574
|
-
|
|
71575
|
-
const jsxFactoryRefErr = diagnostics && compilerOptions.jsx === 2 /* React */ ? Diagnostics.Cannot_find_name_0 : void 0;
|
|
71576
|
-
const jsxFactoryNamespace = getJsxNamespace(node);
|
|
71577
|
-
const jsxFactoryLocation = isNodeOpeningLikeElement ? node.tagName : node;
|
|
71578
|
-
let jsxFactorySym;
|
|
71579
|
-
if (!(isJsxOpeningFragment(node) && jsxFactoryNamespace === "null")) {
|
|
71580
|
-
jsxFactorySym = resolveName(
|
|
71581
|
-
jsxFactoryLocation,
|
|
71582
|
-
jsxFactoryNamespace,
|
|
71583
|
-
111551 /* Value */,
|
|
71584
|
-
jsxFactoryRefErr,
|
|
71585
|
-
/*isUse*/
|
|
71586
|
-
true
|
|
71587
|
-
);
|
|
71588
|
-
}
|
|
71589
|
-
if (jsxFactorySym) {
|
|
71590
|
-
jsxFactorySym.isReferenced = -1 /* All */;
|
|
71591
|
-
if (canCollectSymbolAliasAccessabilityData && jsxFactorySym.flags & 2097152 /* Alias */ && !getTypeOnlyAliasDeclaration(jsxFactorySym)) {
|
|
71592
|
-
markAliasSymbolAsReferenced(jsxFactorySym);
|
|
71593
|
-
}
|
|
71594
|
-
}
|
|
71595
|
-
if (isJsxOpeningFragment(node)) {
|
|
71596
|
-
const file = getSourceFileOfNode(node);
|
|
71597
|
-
const localJsxNamespace = getLocalJsxNamespace(file);
|
|
71598
|
-
if (localJsxNamespace) {
|
|
71599
|
-
resolveName(
|
|
71600
|
-
jsxFactoryLocation,
|
|
71601
|
-
localJsxNamespace,
|
|
71602
|
-
111551 /* Value */,
|
|
71603
|
-
jsxFactoryRefErr,
|
|
71604
|
-
/*isUse*/
|
|
71605
|
-
true
|
|
71606
|
-
);
|
|
71607
|
-
}
|
|
71608
|
-
}
|
|
71609
|
-
}
|
|
71861
|
+
markLinkedReferences(node, 4 /* Jsx */);
|
|
71610
71862
|
if (isNodeOpeningLikeElement) {
|
|
71611
71863
|
const jsxOpeningLikeNode = node;
|
|
71612
71864
|
const sig = getResolvedSignature(jsxOpeningLikeNode);
|
|
@@ -72037,7 +72289,13 @@ function createTypeChecker(host) {
|
|
|
72037
72289
|
} else {
|
|
72038
72290
|
if (isAnyLike) {
|
|
72039
72291
|
if (isIdentifier(left) && parentSymbol) {
|
|
72040
|
-
|
|
72292
|
+
markLinkedReferences(
|
|
72293
|
+
node,
|
|
72294
|
+
2 /* Property */,
|
|
72295
|
+
/*propSymbol*/
|
|
72296
|
+
void 0,
|
|
72297
|
+
leftType
|
|
72298
|
+
);
|
|
72041
72299
|
}
|
|
72042
72300
|
return isErrorType(apparentType) ? errorType : apparentType;
|
|
72043
72301
|
}
|
|
@@ -72050,9 +72308,7 @@ function createTypeChecker(host) {
|
|
|
72050
72308
|
node.kind === 166 /* QualifiedName */
|
|
72051
72309
|
);
|
|
72052
72310
|
}
|
|
72053
|
-
|
|
72054
|
-
markAliasReferenced(parentSymbol, node);
|
|
72055
|
-
}
|
|
72311
|
+
markLinkedReferences(node, 2 /* Property */, prop, leftType);
|
|
72056
72312
|
let propType;
|
|
72057
72313
|
if (!prop) {
|
|
72058
72314
|
const indexInfo = !isPrivateIdentifier(right) && (assignmentKind === 0 /* None */ || !isGenericObjectType(leftType) || isThisTypeParameter(leftType)) ? getApplicableIndexInfoForName(apparentType, right.escapedText) : void 0;
|
|
@@ -78985,7 +79241,7 @@ function createTypeChecker(host) {
|
|
|
78985
79241
|
return;
|
|
78986
79242
|
}
|
|
78987
79243
|
} else {
|
|
78988
|
-
|
|
79244
|
+
markLinkedReferences(node, 5 /* AsyncFunction */);
|
|
78989
79245
|
if (isErrorType(returnType)) {
|
|
78990
79246
|
return;
|
|
78991
79247
|
}
|
|
@@ -79169,48 +79425,6 @@ function createTypeChecker(host) {
|
|
|
79169
79425
|
voidType
|
|
79170
79426
|
);
|
|
79171
79427
|
}
|
|
79172
|
-
function markTypeNodeAsReferenced(node) {
|
|
79173
|
-
markEntityNameOrEntityExpressionAsReference(
|
|
79174
|
-
node && getEntityNameFromTypeNode(node),
|
|
79175
|
-
/*forDecoratorMetadata*/
|
|
79176
|
-
false
|
|
79177
|
-
);
|
|
79178
|
-
}
|
|
79179
|
-
function markEntityNameOrEntityExpressionAsReference(typeName, forDecoratorMetadata) {
|
|
79180
|
-
if (!typeName) return;
|
|
79181
|
-
const rootName = getFirstIdentifier(typeName);
|
|
79182
|
-
const meaning = (typeName.kind === 80 /* Identifier */ ? 788968 /* Type */ : 1920 /* Namespace */) | 2097152 /* Alias */;
|
|
79183
|
-
const rootSymbol = resolveName(
|
|
79184
|
-
rootName,
|
|
79185
|
-
rootName.escapedText,
|
|
79186
|
-
meaning,
|
|
79187
|
-
/*nameNotFoundMessage*/
|
|
79188
|
-
void 0,
|
|
79189
|
-
/*isUse*/
|
|
79190
|
-
true
|
|
79191
|
-
);
|
|
79192
|
-
if (rootSymbol && rootSymbol.flags & 2097152 /* Alias */) {
|
|
79193
|
-
if (canCollectSymbolAliasAccessabilityData && symbolIsValue(rootSymbol) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol)) && !getTypeOnlyAliasDeclaration(rootSymbol)) {
|
|
79194
|
-
markAliasSymbolAsReferenced(rootSymbol);
|
|
79195
|
-
} else if (forDecoratorMetadata && getIsolatedModules(compilerOptions) && getEmitModuleKind(compilerOptions) >= 5 /* ES2015 */ && !symbolIsValue(rootSymbol) && !some(rootSymbol.declarations, isTypeOnlyImportOrExportDeclaration)) {
|
|
79196
|
-
const diag2 = error(typeName, Diagnostics.A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_when_isolatedModules_and_emitDecoratorMetadata_are_enabled);
|
|
79197
|
-
const aliasDeclaration = find(rootSymbol.declarations || emptyArray, isAliasSymbolDeclaration);
|
|
79198
|
-
if (aliasDeclaration) {
|
|
79199
|
-
addRelatedInfo(diag2, createDiagnosticForNode(aliasDeclaration, Diagnostics._0_was_imported_here, idText(rootName)));
|
|
79200
|
-
}
|
|
79201
|
-
}
|
|
79202
|
-
}
|
|
79203
|
-
}
|
|
79204
|
-
function markDecoratorMedataDataTypeNodeAsReferenced(node) {
|
|
79205
|
-
const entityName = getEntityNameForDecoratorMetadata(node);
|
|
79206
|
-
if (entityName && isEntityName(entityName)) {
|
|
79207
|
-
markEntityNameOrEntityExpressionAsReference(
|
|
79208
|
-
entityName,
|
|
79209
|
-
/*forDecoratorMetadata*/
|
|
79210
|
-
true
|
|
79211
|
-
);
|
|
79212
|
-
}
|
|
79213
|
-
}
|
|
79214
79428
|
function getEntityNameForDecoratorMetadata(node) {
|
|
79215
79429
|
if (node) {
|
|
79216
79430
|
switch (node.kind) {
|
|
@@ -79290,42 +79504,7 @@ function createTypeChecker(host) {
|
|
|
79290
79504
|
}
|
|
79291
79505
|
}
|
|
79292
79506
|
}
|
|
79293
|
-
|
|
79294
|
-
checkExternalEmitHelpers(firstDecorator, 16 /* Metadata */);
|
|
79295
|
-
switch (node.kind) {
|
|
79296
|
-
case 263 /* ClassDeclaration */:
|
|
79297
|
-
const constructor = getFirstConstructorWithBody(node);
|
|
79298
|
-
if (constructor) {
|
|
79299
|
-
for (const parameter of constructor.parameters) {
|
|
79300
|
-
markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter));
|
|
79301
|
-
}
|
|
79302
|
-
}
|
|
79303
|
-
break;
|
|
79304
|
-
case 177 /* GetAccessor */:
|
|
79305
|
-
case 178 /* SetAccessor */:
|
|
79306
|
-
const otherKind = node.kind === 177 /* GetAccessor */ ? 178 /* SetAccessor */ : 177 /* GetAccessor */;
|
|
79307
|
-
const otherAccessor = getDeclarationOfKind(getSymbolOfDeclaration(node), otherKind);
|
|
79308
|
-
markDecoratorMedataDataTypeNodeAsReferenced(getAnnotatedAccessorTypeNode(node) || otherAccessor && getAnnotatedAccessorTypeNode(otherAccessor));
|
|
79309
|
-
break;
|
|
79310
|
-
case 174 /* MethodDeclaration */:
|
|
79311
|
-
for (const parameter of node.parameters) {
|
|
79312
|
-
markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter));
|
|
79313
|
-
}
|
|
79314
|
-
markDecoratorMedataDataTypeNodeAsReferenced(getEffectiveReturnTypeNode(node));
|
|
79315
|
-
break;
|
|
79316
|
-
case 172 /* PropertyDeclaration */:
|
|
79317
|
-
markDecoratorMedataDataTypeNodeAsReferenced(getEffectiveTypeAnnotationNode(node));
|
|
79318
|
-
break;
|
|
79319
|
-
case 169 /* Parameter */:
|
|
79320
|
-
markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(node));
|
|
79321
|
-
const containingSignature = node.parent;
|
|
79322
|
-
for (const parameter of containingSignature.parameters) {
|
|
79323
|
-
markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter));
|
|
79324
|
-
}
|
|
79325
|
-
markDecoratorMedataDataTypeNodeAsReferenced(getEffectiveReturnTypeNode(containingSignature));
|
|
79326
|
-
break;
|
|
79327
|
-
}
|
|
79328
|
-
}
|
|
79507
|
+
markLinkedReferences(node, 8 /* Decorator */);
|
|
79329
79508
|
for (const modifier of node.modifiers) {
|
|
79330
79509
|
if (isDecorator(modifier)) {
|
|
79331
79510
|
checkDecorator(modifier);
|
|
@@ -82666,9 +82845,7 @@ function createTypeChecker(host) {
|
|
|
82666
82845
|
checkGrammarModifiers(node);
|
|
82667
82846
|
if (isInternalModuleImportEqualsDeclaration(node) || checkExternalImportOrExportDeclaration(node)) {
|
|
82668
82847
|
checkImportBinding(node);
|
|
82669
|
-
|
|
82670
|
-
markExportAsReferenced(node);
|
|
82671
|
-
}
|
|
82848
|
+
markLinkedReferences(node, 6 /* ExportImportEquals */);
|
|
82672
82849
|
if (node.moduleReference.kind !== 283 /* ExternalModuleReference */) {
|
|
82673
82850
|
const target = resolveAlias(getSymbolOfDeclaration(node));
|
|
82674
82851
|
if (target !== unknownSymbol) {
|
|
@@ -82766,13 +82943,7 @@ function createTypeChecker(host) {
|
|
|
82766
82943
|
if (symbol && (symbol === undefinedSymbol || symbol === globalThisSymbol || symbol.declarations && isGlobalSourceFile(getDeclarationContainer(symbol.declarations[0])))) {
|
|
82767
82944
|
error(exportedName, Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, idText(exportedName));
|
|
82768
82945
|
} else {
|
|
82769
|
-
|
|
82770
|
-
markExportAsReferenced(node);
|
|
82771
|
-
}
|
|
82772
|
-
const target = symbol && (symbol.flags & 2097152 /* Alias */ ? resolveAlias(symbol) : symbol);
|
|
82773
|
-
if (!target || getSymbolFlags(target) & 111551 /* Value */) {
|
|
82774
|
-
checkExpressionCached(node.propertyName || node.name);
|
|
82775
|
-
}
|
|
82946
|
+
markLinkedReferences(node, 7 /* ExportSpecifier */);
|
|
82776
82947
|
}
|
|
82777
82948
|
} else {
|
|
82778
82949
|
if (getESModuleInterop(compilerOptions) && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */ && idText(node.propertyName || node.name) === "default") {
|
|
@@ -82814,8 +82985,8 @@ function createTypeChecker(host) {
|
|
|
82814
82985
|
node
|
|
82815
82986
|
));
|
|
82816
82987
|
if (sym) {
|
|
82988
|
+
markLinkedReferences(node, 3 /* ExportAssignment */);
|
|
82817
82989
|
const typeOnlyDeclaration = getTypeOnlyAliasDeclaration(sym, 111551 /* Value */);
|
|
82818
|
-
markAliasReferenced(sym, id);
|
|
82819
82990
|
if (getSymbolFlags(sym) & 111551 /* Value */) {
|
|
82820
82991
|
checkExpressionCached(id);
|
|
82821
82992
|
if (!isIllegalExportDefaultInCJS && !(node.flags & 33554432 /* Ambient */) && compilerOptions.verbatimModuleSyntax && typeOnlyDeclaration) {
|
|
@@ -109875,7 +110046,7 @@ function getDeclarationDiagnostics(host, resolver, file) {
|
|
|
109875
110046
|
);
|
|
109876
110047
|
return result.diagnostics;
|
|
109877
110048
|
}
|
|
109878
|
-
var declarationEmitNodeBuilderFlags = 1024 /* MultilineObjectLiterals */ | 2048 /* WriteClassExpressionAsTypeLiteral */ | 4096 /* UseTypeOfFunction */ | 8 /* UseStructuralFallback */ | 524288 /* AllowEmptyTuple */ | 1 /*
|
|
110049
|
+
var declarationEmitNodeBuilderFlags = 1024 /* MultilineObjectLiterals */ | 2048 /* WriteClassExpressionAsTypeLiteral */ | 4096 /* UseTypeOfFunction */ | 8 /* UseStructuralFallback */ | 524288 /* AllowEmptyTuple */ | 1 /* AllowUnresolvedNames */ | 4 /* GenerateNamesForShadowedTypeParams */ | 1 /* NoTruncation */;
|
|
109879
110050
|
function transformDeclarations(context) {
|
|
109880
110051
|
const throwDiagnostic = () => Debug.fail("Diagnostic emitted without context");
|
|
109881
110052
|
let getSymbolAccessibilityDiagnostic = throwDiagnostic;
|