-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Export syntax for ES6 modules #1215
Comments
Note that syntax of for export {a } from StringLiteral is dynamic so we would need to emit import statement at the reference location and the bindings at that point |
The export binding here has the same issue as the import binding in #1203. As the original export is mutable, export bindings re-exported from an external module would lose this trait. a.js
b.js
c.js
The only way to guarantee the bindings match with the ES6 implementation is to implement them as getters, which wouldn't be supported in ES3: b.ts
|
The |
@rbuckton I am trying to re-export a variable binding like in your example above and am looking for some clarification on how this works. As I understand it, this should is support according to the ES6 standard. However typescript does not support this as it copies the re-exports rather than forwards them. Is this correct? If so is there a work-around for re-exporting live bindings or is this just not possible when using typescript? (Want to know if I should keep digging and try to make it work or just give up). Btw, for me is is OK to use ES5 only, so if there is some way to enable your example using getters to forward the bindings that would be useful. UPDATE: Also asked on stackoverflow. Since I have target=es5 I think the suggestion to generate getters should be OK. Is there an open issue to implement that or should I open one? |
For Module documentation please see: https://github.com/Microsoft/TypeScript-Handbook/blob/master/pages/Modules.md |
As per ES6 grammar:
Meanings of export syntax that we currently do not support (doesn't list generators since we do not support them as yet)
Few things to consider:
The text was updated successfully, but these errors were encountered: