mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-15 11:35:42 -06:00
[Transforms] fix8038 and 8047 (#8071)
* Fix 8047: stop "require" is paranthesized * Fix 8038: quote "default" in es3 output
This commit is contained in:
parent
2c95ea966c
commit
c21ff6421c
@ -755,11 +755,20 @@ namespace ts {
|
||||
else if (declaration.kind === SyntaxKind.ImportSpecifier) {
|
||||
const name = (<ImportSpecifier>declaration).propertyName
|
||||
|| (<ImportSpecifier>declaration).name;
|
||||
return createPropertyAccess(
|
||||
getGeneratedNameForNode(declaration.parent.parent.parent),
|
||||
getSynthesizedClone(name),
|
||||
/*location*/ node
|
||||
);
|
||||
if (name.originalKeywordKind === SyntaxKind.DefaultKeyword && languageVersion <= ScriptTarget.ES3) {
|
||||
return createElementAccess(
|
||||
getGeneratedNameForNode(declaration.parent.parent.parent),
|
||||
createLiteral(name.text),
|
||||
/*location*/ node
|
||||
);
|
||||
}
|
||||
else {
|
||||
return createPropertyAccess(
|
||||
getGeneratedNameForNode(declaration.parent.parent.parent),
|
||||
getSynthesizedClone(name),
|
||||
/*location*/ node
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -791,7 +800,7 @@ namespace ts {
|
||||
|
||||
function createExportAssignment(name: Identifier, value: Expression) {
|
||||
return createAssignment(
|
||||
name.originalKeywordKind && languageVersion === ScriptTarget.ES3
|
||||
name.originalKeywordKind === SyntaxKind.DefaultKeyword && languageVersion === ScriptTarget.ES3
|
||||
? createElementAccess(
|
||||
createIdentifier("exports"),
|
||||
createLiteral(name.text)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user