The Express type definitions for Typescript 2.0 result in unexpected errors when executing after running npm install @types/express and tsc -t ES6 for ES6. The code compiles fine without the ES6 flag. Can anyone explain? I also have issues with other type definitions such as ssh2.
Here are the steps to reproduce:
> mkdir humbug
> cd humbug
> touch blank.ts
> tsc blank.ts
> tsc -t ES6 .\blank.ts
Everything is fine so far.
> npm init .
...
> npm install @types/express
Things start going bad now
> tsc blank.ts
> tsc -t ES6 .\blank.ts
node_modules/@types/express/index.d.ts(16,30): error TS2307: Cannot find module 'serve-static'.
node_modules/@types/serve-static/index.d.ts(16,20): error TS2307: Cannot find module 'mime'.
Ok, well I better make sure that the types for serve-static and mime are installed.
> npm install @types/serve-static @types/mime
[email protected] C:\Users\me\Desktop\humbug
`-- (empty)
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
npm ERR! code 1
Weird I got an ERR! code but the types were downloaded, Lets try compiling again
> tsc blank.ts
> tsc -t ES6 .\blank.ts
node_modules/@types/express/index.d.ts(16,30): error TS2307: Cannot find module 'serve-static'.
node_modules/@types/serve-static/index.d.ts(16,20): error TS2307: Cannot find module 'mime'.
Same error as last time.
My Environment:
- Windows 10
- Node v6.6.0
- TSC 2.0.3
Other definitions with the same problem:
node_modules/@types/cors/index.d.ts(9,26): error TS2307: Cannot find module 'express'.
node_modules/@types/multer/index.d.ts(6,26): error TS2307: Cannot find module 'express'.
node_modules/@types/ssh2/index.d.ts(26,8): error TS2307: Cannot find module 'ssh2-streams'.