mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Fix crash on missing parent pointer in binder when transpiling export as ns (#36387)
This commit is contained in:
@@ -2608,6 +2608,9 @@ namespace ts {
|
||||
declareSymbol(container.symbol.exports, container.symbol, node, SymbolFlags.ExportStar, SymbolFlags.None);
|
||||
}
|
||||
else if (isNamespaceExport(node.exportClause)) {
|
||||
// declareSymbol walks up parents to find name text, parent _must_ be set
|
||||
// but won't be set by the normal binder walk until `bindChildren` later on.
|
||||
node.exportClause.parent = node;
|
||||
declareSymbol(container.symbol.exports, container.symbol, node.exportClause, SymbolFlags.Alias, SymbolFlags.AliasExcludes);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -474,5 +474,12 @@ var x = 0;`, {
|
||||
transpilesCorrectly("Infer correct file extension", `const fn = <T>(a: T) => a`, {
|
||||
noSetFileName: true
|
||||
});
|
||||
|
||||
transpilesCorrectly("Export star as ns conflict does not crash", `
|
||||
var a;
|
||||
export { a as alias };
|
||||
export * as alias from './file';`, {
|
||||
noSetFileName: true
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
var a;
|
||||
exports.alias = a;
|
||||
exports.alias = require("./file");
|
||||
//# sourceMappingURL=module.js.map
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
var a;
|
||||
exports.alias = a;
|
||||
exports.alias = require("./file");
|
||||
//# sourceMappingURL=module.js.map
|
||||
Reference in New Issue
Block a user