mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-29 16:29:19 -05:00
Retain undefined initializations (#36806)
* Emit an export assignment even when the initializer is elided * User a void 0; and elide assignments for enum/namespace-sourced exported variables * HAHA, SIMPLIFY GREATLY
This commit is contained in:
@@ -1180,7 +1180,6 @@ namespace ts {
|
||||
let modifiers: NodeArray<Modifier> | undefined;
|
||||
|
||||
// If we're exporting these variables, then these just become assignments to 'exports.x'.
|
||||
// We only want to emit assignments for variables with initializers.
|
||||
for (const variable of node.declarationList.declarations) {
|
||||
if (isIdentifier(variable.name) && isLocalName(variable.name)) {
|
||||
if (!modifiers) {
|
||||
@@ -1189,7 +1188,7 @@ namespace ts {
|
||||
|
||||
variables = append(variables, variable);
|
||||
}
|
||||
else if (variable.initializer) {
|
||||
else {
|
||||
expressions = append(expressions, transformInitializedVariable(variable));
|
||||
}
|
||||
}
|
||||
@@ -1259,7 +1258,7 @@ namespace ts {
|
||||
),
|
||||
/*location*/ node.name
|
||||
),
|
||||
visitNode(node.initializer, moduleExpressionElementVisitor)
|
||||
node.initializer ? visitNode(node.initializer, moduleExpressionElementVisitor) : createVoidZero()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user