mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 12:51:30 -05:00
Elide export assignment when it does not resolve to a value (#41904)
* Only mark aliases that resolve to values referenced * Update other affected baselines * Remove redundant check
This commit is contained in:
@@ -22868,11 +22868,14 @@ namespace ts {
|
||||
|
||||
function markAliasReferenced(symbol: Symbol, location: Node) {
|
||||
if (isNonLocalAlias(symbol, /*excludes*/ SymbolFlags.Value) && !isInTypeQuery(location) && !getTypeOnlyAliasDeclaration(symbol)) {
|
||||
if (compilerOptions.preserveConstEnums && isExportOrExportExpression(location) || !isConstEnumOrConstEnumOnlyModule(resolveAlias(symbol))) {
|
||||
markAliasSymbolAsReferenced(symbol);
|
||||
}
|
||||
else {
|
||||
markConstEnumAliasAsReferenced(symbol);
|
||||
const target = resolveAlias(symbol);
|
||||
if (target.flags & SymbolFlags.Value) {
|
||||
if (compilerOptions.preserveConstEnums && isExportOrExportExpression(location) || !isConstEnumOrConstEnumOnlyModule(target)) {
|
||||
markAliasSymbolAsReferenced(symbol);
|
||||
}
|
||||
else {
|
||||
markConstEnumAliasAsReferenced(symbol);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user