The following code...
app.get('/basic', (req, res) => {
res.send({message: 'hello'})
})
generates a message Argument types do not match parameters
in WebStorm 2016.2.4
The relevant dependencies section in my package.json
is:
"dependencies": {
"@types/body-parser": "0.0.32",
"@types/express": "^4.0.33",
"@types/lodash": "^4.14.34",
"@types/node": "^6.0.38",
"body-parser": "1.15.1",
"dotenv": "2.0.0",
"express": "4.13.4",
"lodash": "^4.13.1",
"typescript": "^2.0.3"
},
When I remove the @types/express
package, WebStorm no longer gives the error message, but the TypeScript compiler gives a error TS2307: Cannot find module 'express'
message.
Is there a way to configure this differently or is WebStorm just playing catch-up with TypeScript 2?
Had the same issue. Problem is I installed the typings from dt/express via typings install dt~express
and when I looked at the type definition of .get() at the express/index.ts file, there was a mismatch:
get: {(name: string): any;} & IRouterMatcher<this>;
This was not what I wanted, and I instead did a typings install express
to get the type definitions from npm/express.
My typings.json
file looks like this:
{
"dependencies": {
"express": "registry:npm/express#4.14.0+20160925001530"
},
...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With