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

@types not working with 3.0.2 #657

Closed
ldrick opened this issue Oct 17, 2017 · 14 comments
Closed

@types not working with 3.0.2 #657

ldrick opened this issue Oct 17, 2017 · 14 comments

Comments

@ldrick
Copy link

ldrick commented Oct 17, 2017

I encountered a couple of Errors saying things like:
ERROR in ./[...]/SimpleDateFormat.ts [tsl] ERROR in /home/[...]/SimpleDateFormat.ts(1,52) TS7016: Could not find a declaration file for module 'date-fns'. '/home/[...]/node_modules/date-fns/esm/index.js' implicitly has an 'any' type. Try npm install @types/date-fnsif it exists or add a new declaration (.d.ts) file containingdeclare module 'date-fns';
These @types are all installed and tsc is working smooth with them. Until today I used ts-loader@2.3.7 and it worked. If you need further information, please come back to me, thanks.

@johnnyreilly
Copy link
Member

@ldrick I'm guessing this is going to be the same as #655. Essentially I think you can fix this by either supplying ts-loader with the option entryFileCannotBeJs: true OR setting allowJs: false in your tsconfig.json.

I believe there is a bug in ts-loader around the allowJs functionality which is worked around with this flag. Can I ask a favour? Assuming that my suggestion does resolve your issue would you be able to supply me with a minimal repro repo that illustrates this issue? I'd love to fix this properly in ts-loader so the workaround isn't necessary. To do that I need a way to reliably reproduce the issue. You can help!

@ldrick
Copy link
Author

ldrick commented Oct 17, 2017

@johnnyreilly Thanks, allowJs is truthy needed in my project. But entryFileCannotBeJs: true works.
I will come back within next 2 hours having a reproducable repo. (I think of running JQuery with its types)

@johnnyreilly
Copy link
Member

Thanks @ldrick - I appreciate it!

@ldrick
Copy link
Author

ldrick commented Oct 17, 2017

@johnnyreilly I got through some strange things, but could reproduce exact my error like this:
ts-loader-test

I know types are not installed for date-fns, but they are not required.
It comes down to tsconfig --> moduleResolution: "node" I believe. Because activating this one in this new project, tsl failed.

@johnnyreilly
Copy link
Member

Thanks @ldrick - I'll take a look!

@johnnyreilly
Copy link
Member

Hopefully this will be fixed with #658 (testing now)

@johnnyreilly
Copy link
Member

Fix released with 3.0.3

@dawidzq
Copy link

dawidzq commented Oct 18, 2017

Hey,

I'm trying to download 3.0.3 via npm and I'm getting "No matching version found for ts-loader@3.0.3". Has it officially been published yet?

Thank you!

@johnnyreilly
Copy link
Member

Yup - shipped. Other people have reported it working so downloading must be happening...

@johnnyreilly
Copy link
Member

@dawidzq
Copy link

dawidzq commented Oct 18, 2017

It appears to be a caching issue on my end.

@johnnyreilly
Copy link
Member

Well cache invalidation is famously hard 😉

@ldrick
Copy link
Author

ldrick commented Oct 19, 2017

Just want to confirm, that everything works smooth on my side since 3.0.3 and I removed the entryFileCannotBeJs: true again.
Thanks @johnnyreilly

@johnnyreilly
Copy link
Member

Brilliant!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants