Skip to content

Cannot find typings with typescript@beta and @types #243

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

Closed
SebastianStehle opened this issue Jul 12, 2016 · 11 comments
Closed

Cannot find typings with typescript@beta and @types #243

SebastianStehle opened this issue Jul 12, 2016 · 11 comments

Comments

@SebastianStehle
Copy link

Hi,

I am testing the new beta version of ts 2.0. In Visual Studio Code everything looks fine, but when I run my webpack build I get a lot of erros like

"Cannot find name Promise"
"Cannot find name Require"

I have added the same typings than before using the @types/... npm modules.

@blakeembrey
Copy link
Member

blakeembrey commented Jul 12, 2016

Have you tried debugging anything or running it with tsc? I know it's not looked up automatically, but there's a types property in tsconfig.json for that, so those errors make sense and probably are issues with tsc unless you've configured it. Please make sure this is a ts-loader issue and not a configuration issue by running tsc and providing a minimal reproduction.

@SebastianStehle
Copy link
Author

Yeah, sure. When I run tsc standalone it works well (I get one error in angular2, but this is another problem ;))

@blakeembrey
Copy link
Member

And is that a global version or a local version?

@SebastianStehle
Copy link
Author

tsc? it is a global version, but the same version

@blakeembrey
Copy link
Member

Can you provide a reproduction for someone to look over?

@SebastianStehle
Copy link
Author

Sorry to waste your time. I was just too lazy to read the documentation carefully. I just have to add the typings to the types folder.

@seanchas116
Copy link

Hi, I reproduced this problem.

https://github.com/seanchas116/ts-loader-global-types

In this project, tsc just works but webpack (with ts-loader) fails with
Cannot find module 'path'. and Cannot find name 'process'.

@SebastianStehle
Copy link
Author

I realized that I have to add the 3 typings packages to the types config: types: ['core-js', 'node', 'jasmine']

Dont know why it works with tsc, but it works fine now.

@seanchas116
Copy link

Specifying types: ['node'] in compilerOptions in tsconfig also fixed my project. (thanks @SebastianStehle !)

@gxsjtu
Copy link

gxsjtu commented Sep 5, 2016

i do not know why close the issue?
'can-use' and 'good-to-use' is different, it is redundant to declare types in tsconfig.json.

@blakeembrey
Copy link
Member

@gxsjtu make a PR. There's duplicate issues for this which you have already commented on.

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

No branches or pull requests

4 participants