mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-16 07:13:45 -05:00
addressed PR feedback
This commit is contained in:
@@ -4221,15 +4221,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||
const isExported = getCombinedNodeFlags(node) & NodeFlags.Export;
|
||||
if (languageVersion >= ScriptTarget.ES6 && (!isExported || modulekind === ModuleKind.ES6)) {
|
||||
// emit ES6 destructuring only if target module is ES6 or variable is not exported
|
||||
// exported variables in CJS\AMD are prefixed with 'exports.' so result javascript { exports.toString } = 1; is illegal
|
||||
// exported variables in CJS/AMD are prefixed with 'exports.' so result javascript { exports.toString } = 1; is illegal
|
||||
|
||||
const isTopLevelDeclarationInSystemModule =
|
||||
modulekind === ModuleKind.System &&
|
||||
shouldHoistVariable(node, /*checkIfSourceFileLevelDecl*/true);
|
||||
|
||||
if (isTopLevelDeclarationInSystemModule) {
|
||||
// in System modules top level variables are hoisted
|
||||
// so variable declarations with destructuring are turned into destructuring assignments
|
||||
// In System modules top level variables are hoisted
|
||||
// so variable declarations with destructuring are turned into destructuring assignments.
|
||||
// As a result, they will need parentheses to disambiguate object binding assignments from blocks.
|
||||
write("(");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user