mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-18 17:27:54 -05:00
Check for instantiation on export default in ES6
This commit is contained in:
@@ -3924,26 +3924,28 @@ module ts {
|
||||
}
|
||||
|
||||
function emitExportAssignment(node: ExportAssignment) {
|
||||
if (languageVersion >= ScriptTarget.ES6) {
|
||||
writeLine();
|
||||
emitStart(node);
|
||||
write("export default ");
|
||||
var expression = node.expression;
|
||||
emit(expression);
|
||||
if (expression.kind !== SyntaxKind.FunctionDeclaration &&
|
||||
expression.kind !== SyntaxKind.ClassDeclaration) {
|
||||
write(";");
|
||||
if (!node.isExportEquals && resolver.isValueAliasDeclaration(node)) {
|
||||
if (languageVersion >= ScriptTarget.ES6) {
|
||||
writeLine();
|
||||
emitStart(node);
|
||||
write("export default ");
|
||||
var expression = node.expression;
|
||||
emit(expression);
|
||||
if (expression.kind !== SyntaxKind.FunctionDeclaration &&
|
||||
expression.kind !== SyntaxKind.ClassDeclaration) {
|
||||
write(";");
|
||||
}
|
||||
emitEnd(node);
|
||||
}
|
||||
else {
|
||||
writeLine();
|
||||
emitStart(node);
|
||||
emitContainingModuleName(node);
|
||||
write(".default = ");
|
||||
emit(node.expression);
|
||||
write(";");
|
||||
emitEnd(node);
|
||||
}
|
||||
emitEnd(node);
|
||||
}
|
||||
else if (!node.isExportEquals && resolver.isValueAliasDeclaration(node)) {
|
||||
writeLine();
|
||||
emitStart(node);
|
||||
emitContainingModuleName(node);
|
||||
write(".default = ");
|
||||
emit(node.expression);
|
||||
write(";");
|
||||
emitEnd(node);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user