mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-29 16:29:19 -05:00
Fix decorator metadata references to type-only-imported namespaces (#44915)
* Add test * Fix metadata references to type-only-imported namespaces * Use `!!` instead of `|| false`
This commit is contained in:
@@ -40480,9 +40480,14 @@ namespace ts {
|
||||
}
|
||||
|
||||
// Resolve the symbol as a value to ensure the type can be reached at runtime during emit.
|
||||
let isTypeOnly = false;
|
||||
if (isQualifiedName(typeName)) {
|
||||
const rootValueSymbol = resolveEntityName(getFirstIdentifier(typeName), SymbolFlags.Value, /*ignoreErrors*/ true, /*dontResolveAlias*/ true, location);
|
||||
isTypeOnly = !!rootValueSymbol?.declarations?.every(isTypeOnlyImportOrExportDeclaration);
|
||||
}
|
||||
const valueSymbol = resolveEntityName(typeName, SymbolFlags.Value, /*ignoreErrors*/ true, /*dontResolveAlias*/ true, location);
|
||||
const isTypeOnly = valueSymbol?.declarations?.every(isTypeOnlyImportOrExportDeclaration) || false;
|
||||
const resolvedSymbol = valueSymbol && valueSymbol.flags & SymbolFlags.Alias ? resolveAlias(valueSymbol) : valueSymbol;
|
||||
isTypeOnly ||= !!valueSymbol?.declarations?.every(isTypeOnlyImportOrExportDeclaration);
|
||||
|
||||
// Resolve the symbol as a type so that we can provide a more useful hint for the type serializer.
|
||||
const typeSymbol = resolveEntityName(typeName, SymbolFlags.Type, /*ignoreErrors*/ true, /*dontResolveAlias*/ false, location);
|
||||
|
||||
Reference in New Issue
Block a user