Repository navigation
Compile errors with 2.0.2 (worked with 2.0.0) #10633
Copy link
Copy link
Closed
Labels
ExternalRelates to another program, environment, or user action which we cannot control.Relates to another program, environment, or user action which we cannot control.
Description
TypeScript Version: 2.0.0 --> 2.0.2
Expected behavior: Code compiles!
Actual behavior: Code compiles when using 2.0.0. Code does not compile when using 2.0.2.
When specifying "typescript": "2.0.0" in my package.json, all my projects compile absolutely fine (as they have been doing for some time).
However, when I upgrade (i.e. use either "typescript": "^2.0.0" or "typescript": "2.0.2") I get a lot of compile errors of the form:
ERROR in [default]
Cannot find global type 'Array'.
ERROR in [default]
Cannot find global type 'Boolean'.
ERROR in [default]
Cannot find global type 'Function'.
ERROR in [default]
Cannot find global type 'IArguments'.
ERROR in [default]
Cannot find global type 'Number'.
ERROR in [default]
Cannot find global type 'Object'.
ERROR in [default]
Cannot find global type 'RegExp'.
ERROR in [default]
Cannot find global type 'String'.
ERROR in [default] /Users/james/Documents/Workspace/.../node_modules/@types/axios/index.d.ts:42:18
Cannot find name 'Object'.
ERROR in [default] /Users/james/Documents/Workspace/.../node_modules/@types/q/index.d.ts:199:43
Cannot find name 'Function'.
ERROR in [default] /Users/james/Documents/Workspace/.../node_modules/typescript/lib/lib.es2015.d.ts:17:0
File '/Users/james/Documents/Workspace/.../node_modules/typescript/lib/lib.es2015.core.d.ts' not found.
ERROR in [default] /Users/james/Documents/Workspace/.../src/walletBar.ts:65:22
Cannot find name 'Error'.
Not sure what else I can provide to help debug this, let me know and I'll get it.
Thanks.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
ExternalRelates to another program, environment, or user action which we cannot control.Relates to another program, environment, or user action which we cannot control.
Activity
kjackson87 commentedon Aug 31, 2016
I haven't had time to research the errors in my own typescript project, but I'm getting largely the same ones as you. Just wanted to throw it out there that I'm seeing very similar results.
RyanCavanaugh commentedon Aug 31, 2016
It really looks like you're compiling with some other tool; TypeScript does not produce errors that look like that. With it being unable to find lib.d.ts, it sounds like a problem with that tool not knowing how to resolve lib references correctly. What are you using to build with?
jmc265 commentedon Aug 31, 2016
I am using webpack. Most of the projects I am building use webpack via angular-cli. But one project uses webpack directly and it is still getting the errors above when using 2.0.2.
Edit: I should probably note that I think angular-cli is using "awesome-typescript-loader" for webpack. And that is what my standalone project is using as well.
kjackson87 commentedon Aug 31, 2016
I am also using webpack.
RyanCavanaugh commentedon Aug 31, 2016
Can you post a config file or something to help me bootstrap a repro? Odds are this is an issue with a webpack plugin but we'll need to track down the owner and let them know what to fix
jmc265 commentedon Aug 31, 2016
Sure, here is my webpack.config.dev.js:
My package.json looks like:
Note: this has the very specific Typescript version of 2.0.0, so the above should work. If it was changed to 2.0.2, the compile errors will then happen.
I run the webpack through
npm startor through this:node_modules/webpack/bin/webpack.js --progress --hide-modules --config config/webpack.config.dev.jsmhegazy commentedon Aug 31, 2016
Stanislav Panferov (@s-panferov) any ideas what is going on here?
don-bluelinegrid commentedon Aug 31, 2016
Ryan Cavanaugh (@RyanCavanaugh) Stanislav Panferov (@s-panferov) Mohamed Hegazy (@mhegazy)
I also have this exact problem.
I am running a webpack build for a project based on the Aurelia framework. A build that previously worked fine with no errors using typescript@v2.0.0 immediately started to fail with the same sort of errors, when I updated to typescript@v2.0.2. I am attaching my webpack config, typescript config, and package.json.
This is definitely related to a change between v2.0.0 and v2.0.2. In my package.json I am specifying typescript v2.0.0, to have a working build, changing this to ^2.0.0, which will install v2.0.2, cause the build to fail.
Don
package.json.txt
tsconfig.json.txt
webpack.config.js.txt
mhegazy commentedon Aug 31, 2016
Would you be able to share the project?
don-bluelinegrid commentedon Aug 31, 2016
Mohamed Hegazy (@mhegazy)
I provided the package.json, tsconfig, and webpack.config.
Are you saying that you would like access to my commercial GitHub repo?
Don
mhegazy commentedon Aug 31, 2016
not necessarily. i would like to have access to sample that reproduces the issue. helps us debug the problem.
juanevp commentedon Sep 1, 2016
I had the same problem (and some related). I attach a minimal project which reproduces 3 of my problems. If you npm install && webpack there should be many errores. Most of them go away if I delete the lib compiler option. Still it won't find node typings and the custom typing I reference. Even after adding
It won't detect the typing.
And what is buffling with the custom typing is that it says that the file name does not exist (which it does):
TsTest.zip
ccrowhurstram commentedon Sep 1, 2016
I'm also experiencing the same problem. My setup is similar to James Cross (@jmc265).
To reproduce the problem:
git checkout 3544878b408182afb899ac076ee1ac4819a2b950npm install && npm run setupnpm run buildYou should see the following errors:
use typescript@2.0.0
mhegazy commentedon Sep 1, 2016
The issue is wrong implementation of
LanguageServiceHost.resolveTypeReferenceDirectivesin awesome-typescript-loader. Stanislav Panferov (@s-panferov) any thoguhts?s-panferov commentedon Sep 5, 2016
I'll take a look soon.
jpzwarte commentedon Sep 12, 2016
The awesome-typescript-loader loader had a problem working with 2.0.2. That has since been fixed in a newer version. Have you tried that?
delagen commentedon Sep 12, 2016
Yes, it works now
mhegazy commentedon Sep 12, 2016
Thanks for reporting back. closing.