mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-11-18 20:11:14 +00:00
Handle when import alias has to parent (therefore is synthetic module symbol) (#33813)
This commit is contained in:
1 parent
3c123b61d7
commit
114329ade8
7 files changed
+191
-5
No files matched your search
@@ -5350,7 +5350,7 @@ namespace ts {
|
||||
// so we don't even have placeholders to fill in.
|
||||
if (length(realMembers)) {
|
||||
const localName = getInternalSymbolName(symbol, symbolName);
|
||||
serializeAsNamespaceDeclaration(realMembers, localName, modifierFlags, /*suppressNewPrivateContext*/ false);
|
||||
serializeAsNamespaceDeclaration(realMembers, localName, modifierFlags, !!(symbol.flags & SymbolFlags.Function));
|
||||
}
|
||||
if (length(mergedMembers)) {
|
||||
const localName = getInternalSymbolName(symbol, symbolName);
|
||||
@@ -5593,7 +5593,10 @@ namespace ts {
|
||||
/*decorators*/ undefined,
|
||||
/*modifiers*/ undefined,
|
||||
createImportClause(createIdentifier(localName), /*namedBindings*/ undefined),
|
||||
createLiteral(getSpecifierForModuleSymbol(target.parent!, context))
|
||||
// We use `target.parent || target` below as `target.parent` is unset when the target is a module which has been export assigned
|
||||
// And then made into a default by the `esModuleInterop` or `allowSyntheticDefaultImports` flag
|
||||
// In such cases, the `target` refers to the module itself already
|
||||
createLiteral(getSpecifierForModuleSymbol(target.parent || target, context))
|
||||
), ModifierFlags.None);
|
||||
break;
|
||||
case SyntaxKind.NamespaceImport:
|
||||
@@ -5614,7 +5617,7 @@ namespace ts {
|
||||
createIdentifier(localName)
|
||||
)
|
||||
])),
|
||||
createLiteral(getSpecifierForModuleSymbol(target.parent!, context))
|
||||
createLiteral(getSpecifierForModuleSymbol(target.parent || target, context))
|
||||
), ModifierFlags.None);
|
||||
break;
|
||||
case SyntaxKind.ExportSpecifier:
|
||||
|
||||
@@ -285,6 +285,7 @@ namespace ts {
|
||||
let combinedStatements: NodeArray<Statement>;
|
||||
if (isSourceFileJS(currentSourceFile)) {
|
||||
combinedStatements = createNodeArray(transformDeclarationsForJS(node));
|
||||
refs.forEach(referenceVisitor);
|
||||
emittedImports = filter(combinedStatements, isAnyImportSyntax);
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in new issue
Block a user