mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-23 07:07:09 -05:00
exports.default in ES5 vs exports["default"] in ES3
This commit is contained in:
@@ -11412,7 +11412,14 @@ module ts {
|
||||
let node = getDeclarationOfAliasSymbol(symbol);
|
||||
if (node) {
|
||||
if (node.kind === SyntaxKind.ImportClause) {
|
||||
return getGeneratedNameForNode(<ImportDeclaration>node.parent) + ".default";
|
||||
let defaultKeyword: string;
|
||||
|
||||
if (languageVersion === ScriptTarget.ES3) {
|
||||
defaultKeyword = "[\"default\"]";
|
||||
} else {
|
||||
defaultKeyword = ".default";
|
||||
}
|
||||
return getGeneratedNameForNode(<ImportDeclaration>node.parent) + defaultKeyword;
|
||||
}
|
||||
if (node.kind === SyntaxKind.ImportSpecifier) {
|
||||
let moduleName = getGeneratedNameForNode(<ImportDeclaration>node.parent.parent.parent);
|
||||
|
||||
@@ -2452,7 +2452,11 @@ var __param = this.__param || function(index, decorator) { return function (targ
|
||||
writeLine();
|
||||
emitStart(node);
|
||||
if (node.flags & NodeFlags.Default) {
|
||||
write("exports.default");
|
||||
if (languageVersion === ScriptTarget.ES3) {
|
||||
write("exports[\"default\"]");
|
||||
} else {
|
||||
write("exports.default");
|
||||
}
|
||||
}
|
||||
else {
|
||||
emitModuleMemberName(node);
|
||||
@@ -4548,7 +4552,11 @@ var __param = this.__param || function(index, decorator) { return function (targ
|
||||
writeLine();
|
||||
emitStart(node);
|
||||
emitContainingModuleName(node);
|
||||
write(".default = ");
|
||||
if (languageVersion === ScriptTarget.ES3) {
|
||||
write("[\"default\"] = ");
|
||||
} else {
|
||||
write(".default = ");
|
||||
}
|
||||
emit(node.expression);
|
||||
write(";");
|
||||
emitEnd(node);
|
||||
|
||||
Reference in New Issue
Block a user