export imported aliases
This commit is contained in:
parent
0c84acd8ef
commit
5d2897d67f
|
@ -5026,6 +5026,30 @@ var __param = this.__param || function(index, decorator) { return function (targ
|
|||
writeLocalNameForExternalImport(importNode);
|
||||
write(` = ${setterParameterName}`);
|
||||
writeLine();
|
||||
|
||||
let defaultName =
|
||||
importNode.kind === SyntaxKind.ImportDeclaration
|
||||
? (<ImportDeclaration>importNode).importClause.name
|
||||
: (<ImportEqualsDeclaration>importNode).name;
|
||||
if (defaultName) {
|
||||
emitExportMemberAssignments(defaultName);
|
||||
writeLine();
|
||||
}
|
||||
|
||||
if (importNode.kind === SyntaxKind.ImportDeclaration && (<ImportDeclaration>importNode).importClause.namedBindings) {
|
||||
if ((<ImportDeclaration>importNode).importClause.namedBindings.kind === SyntaxKind.NamespaceImport) {
|
||||
emitExportMemberAssignments((<NamespaceImport>(<ImportDeclaration>importNode).importClause.namedBindings).name);
|
||||
writeLine();
|
||||
}
|
||||
else {
|
||||
for (let element of (<NamedImports>(<ImportDeclaration>importNode).importClause.namedBindings).elements) {
|
||||
emitExportMemberAssignments(element.name || element.propertyName);
|
||||
writeLine()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
decreaseIndent();
|
||||
break;
|
||||
case SyntaxKind.ExportDeclaration:
|
||||
|
|
18
tests/baselines/reference/systemModule10.errors.txt
Normal file
18
tests/baselines/reference/systemModule10.errors.txt
Normal file
|
@ -0,0 +1,18 @@
|
|||
tests/cases/compiler/systemModule10.ts(2,20): error TS2307: Cannot find external module 'file1'.
|
||||
tests/cases/compiler/systemModule10.ts(3,21): error TS2307: Cannot find external module 'file2'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/systemModule10.ts (2 errors) ====
|
||||
|
||||
import n, {x} from 'file1'
|
||||
~~~~~~~
|
||||
!!! error TS2307: Cannot find external module 'file1'.
|
||||
import n2 = require('file2');
|
||||
~~~~~~~
|
||||
!!! error TS2307: Cannot find external module 'file2'.
|
||||
export {x}
|
||||
export {x as y}
|
||||
export {n}
|
||||
export {n as n1}
|
||||
export {n2}
|
||||
export {n2 as n3}
|
32
tests/baselines/reference/systemModule10.js
Normal file
32
tests/baselines/reference/systemModule10.js
Normal file
|
@ -0,0 +1,32 @@
|
|||
//// [systemModule10.ts]
|
||||
|
||||
import n, {x} from 'file1'
|
||||
import n2 = require('file2');
|
||||
export {x}
|
||||
export {x as y}
|
||||
export {n}
|
||||
export {n as n1}
|
||||
export {n2}
|
||||
export {n2 as n3}
|
||||
|
||||
//// [systemModule10.js]
|
||||
System.register(['file1', 'file2'], function(exports_1) {
|
||||
var file1_1, n2;
|
||||
return {
|
||||
setters:[
|
||||
function (v_1) {
|
||||
file1_1 = v_1
|
||||
exports_1("n", file1_1.default);
|
||||
exports_1("n1", file1_1.default);
|
||||
exports_1("x", file1_1.x);
|
||||
exports_1("y", file1_1.x);
|
||||
},
|
||||
function (v_1) {
|
||||
n2 = v_1
|
||||
exports_1("n2", n2);
|
||||
exports_1("n3", n2);
|
||||
}],
|
||||
execute: function() {
|
||||
}
|
||||
}
|
||||
});
|
11
tests/cases/compiler/systemModule10.ts
Normal file
11
tests/cases/compiler/systemModule10.ts
Normal file
|
@ -0,0 +1,11 @@
|
|||
// @module: system
|
||||
// @separateCompilation: true
|
||||
|
||||
import n, {x} from 'file1'
|
||||
import n2 = require('file2');
|
||||
export {x}
|
||||
export {x as y}
|
||||
export {n}
|
||||
export {n as n1}
|
||||
export {n2}
|
||||
export {n2 as n3}
|
Loading…
Reference in a new issue