Skip to content
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

module.exports assignment in a JavaScript file cannot be imported with ES6 syntax #7076

Closed
billti opened this issue Feb 14, 2016 · 2 comments
Assignees
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@billti
Copy link
Member

billti commented Feb 14, 2016

See commented out failing test in this pull request.

I've spent a while in the debugger on this, and the root cause appears to be how the export= SymbolObject is constructed in the source file's symbol.exports property in a JavaScript module source file versus a TypeScript module source file. This causes resolveESModuleSymbol to return undefined.

Being it applies only to this specific construct (i.e. assignments to exports. work with es6 imports, or importing with var <id> = require(...) syntax works), its not a total blocker. But would be good to fix ASAP, especially as the error is rather unattractive.

screen shot 2016-02-13 at 5 32 44 pm

@billti billti added the Bug A bug in TypeScript label Feb 14, 2016
@billti billti self-assigned this Feb 14, 2016
@billti billti added this to the TypeScript 2.0 milestone Feb 14, 2016
@Arnavion
Copy link
Contributor

If you do do this, please consider stripping the () and new() members from the import binding to be compliant with ES6 (option 2 in #6809)

@billti
Copy link
Member Author

billti commented Jun 20, 2016

Verified this is working in the current bits in 'master'.

@billti billti closed this as completed Jun 20, 2016
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

3 participants