Tuesday 6 June 2017

TS2403: Subsequent variable declarations must have the same type. After NPM install

I've searched stack overflow for this issue, but am still unclear on why this is happening/how to fix.

I wanted Node Typings in my Typescript project so I entered this command:

npm install @types/node --save

Which resulted in:

c:/xyz/node_modules/@types/node/index.d.ts(89,13)
error TS2403: Subsequent variable declarations must have the same type.
Variable 'require' must be of type 'Require', but here has type 'NodeRequire'.

My machine had node version 7.0.3 The installed types was for version + @types/node@7.0.28

If I remove uninstall the typings my project compiles with no problems.

It appears as if the typings content is not correct per the error message! Fixing it is messy. Any tips?

Here's the failing line of code in index.d.tsNodeRequire

Seems like the NodeRequire (interfaces) need to be bypassed in favor of Require.js?



via John Peters

No comments:

Post a Comment