🤖 Pick PR #59160 (Fixed crash on authored import type...) into release-5.5 (#59226)

Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
This commit is contained in:
TypeScript Bot
2024-07-18 08:41:58 +09:00
committed by GitHub
co-authored by Mateusz Burzyński
parent f35206d202
commit a44e2d925c
5 changed files with 142 additions and 0 deletions
+6
View File
@@ -902,6 +902,12 @@ export function tryGetAutoImportableReferenceFromTypeNode(importTypeNode: TypeNo
if (isLiteralImportTypeNode(node) && node.qualifier) {
// Symbol for the left-most thing after the dot
const firstIdentifier = getFirstIdentifier(node.qualifier);
if (!firstIdentifier.symbol) {
// if symbol is missing then this doesn't come from a synthesized import type node
// it has to be an import type node authored by the user and thus it has to be valid
// it can't refer to reserved internal symbol names and such
return visitEachChild(node, visit, /*context*/ undefined);
}
const name = getNameForExportedSymbol(firstIdentifier.symbol, scriptTarget);
const qualifier = name !== firstIdentifier.text
? replaceFirstIdentifierOfEntityName(node.qualifier, factory.createIdentifier(name))