I am trying to get my first TypeScript and DefinitelyTyped Node.js application up and running, and running into some errors.
I am getting the error \"TS2304: Cannot
This answer relates to modern setups (TypeScript 2.x, Webpack > 2.x)
You don't need to install @types/node (which is all of Node.js types and is irrelevant for front-end code, actually complicating things such as setTimout different return values, etc..
You do need to install @types/webpack-env
npm i -D @types/webpack-env
which gives the runtime signatures that Webpack has (including require, require.ensure, etc.)
Also make sure that your tsconfig.json file has no set 'types' array -> which will make it pickup all type definitions in your node_modules/@types folder.
If you want to restrict search of types you can set the typeRoot property to node_modules/@types.