I wrote a test:
printBeforeAndAfter(
`import {foo} from './another_place';
foo()`,
);
Here's the output:
# testImport
v--TS--v
import {foo} from './another_place';
foo()
---
// Compiled using ts2gas 4.2.0 (TypeScript 4.9.3)
var exports = exports || {};
var module = module || { exports: exports };
//import {foo} from './another_place';
(0, another_place_1.foo)();
^--GS--^
Expected output:
# testImport
v--TS--v
import {foo} from './another_place';
foo()
---
// Compiled using ts2gas 4.2.0 (TypeScript 4.9.3)
var exports = exports || {};
var module = module || { exports: exports };
//import {foo} from './another_place';
foo();
^--GS--^
Alternatively, if another_place.ts exports files, a different expectation would be for another_place.ts to define another_place_1 as its export variable:
var another_place_1 = another_place_1 || {};
var exports = exports || {};
// ...
exports.foo = another_place_1.foo = 'foo';
Or a namespace...
another_place.ts
namespace another_place_1 {
export function foo() {}
}
main.ts
// import {foo} from './another_place';
const {foo} = another_place_1;
I wrote a test:
Here's the output:
Expected output:
Alternatively, if
another_place.tsexports files, a different expectation would be foranother_place.tsto defineanother_place_1as its export variable:Or a namespace...
another_place.ts
main.ts