mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-24 11:43:18 -05:00
Fix getTypeFromJSDocValueReference
When using `{import('./b').FOO}` which is defined as a string literal,
`valueType` doesn't have a `symbol`. Leave it for the fallback value
for now.
This was exposed in 8223c0752.
Fixes #34869.
This commit is contained in:
@@ -10840,7 +10840,8 @@ namespace ts {
|
||||
isRequireAlias = isCallExpression(expr) && isRequireCall(expr, /*requireStringLiteralLikeArgument*/ true) && !!valueType.symbol;
|
||||
}
|
||||
const isImportTypeWithQualifier = node.kind === SyntaxKind.ImportType && (node as ImportTypeNode).qualifier;
|
||||
if (isRequireAlias || isImportTypeWithQualifier) {
|
||||
// valueType might not have a symbol, eg, {import('./b').STRING_LITERAL}
|
||||
if (valueType.symbol && (isRequireAlias || isImportTypeWithQualifier)) {
|
||||
typeType = getTypeReferenceType(node, valueType.symbol);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user