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

Unclear on how to use allowJS with untyped modules installed with npm #7542

Closed
raybooysen opened this issue Mar 16, 2016 · 3 comments
Closed
Assignees
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@raybooysen
Copy link

TypeScript Version:

1.8.7

Code

import classnames from 'classnames';

If I write the following code with a tsconfig that has allowJs = true, I receive the error below.

ERROR in ./src/ts-loader-example/headerBar.tsx
(3,24): error TS2307: Cannot find module 'classnames'.

I expect this to work as per the documentation for 1.8. I have found the following stackoverflow question which shows that there is some other that are unsure on how to accomplish this.

As a developer moving from JS to TS, how do I consume untyped modules with the allowJs flag?

@billti
Copy link
Member

billti commented Mar 16, 2016

We don't load JavaScript modules from node_modules in response to imports in TypeScript files currently. There is a pull request out to get this done (#7075) but it is not in yet.

@billti billti added the Salsa label Mar 16, 2016
@billti billti added this to the TypeScript 2.0 milestone Mar 16, 2016
@billti billti self-assigned this Mar 16, 2016
@raybooysen
Copy link
Author

@billti thank you

@mhegazy mhegazy added the Bug A bug in TypeScript label Mar 17, 2016
@tamird
Copy link

tamird commented Jun 28, 2016

#7075 is merged, so I guess this is good to close.

@mhegazy mhegazy closed this as completed Jun 28, 2016
@mhegazy mhegazy added the Fixed A PR has been merged for this issue label Jun 28, 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

4 participants