Closed
Description
Currently no-unsafe-call
checks for calling a function whose type is any
and lets you know it's unsafe.
Repro
// this.httpServer is http.Server
// The on('request') defn is req: any, res: any
this.httpServer.on('request', (req, res) => {
// This method exists and its type are ServerRequest & ServerResponse
// here I am calling a method that i've implemented with any, any
this.handleServerRequest(req, res)
})
Smaller reproduction
/**
* @returns {void}
*/
function foo () {
y(JSON.parse('y'))
/**
* @param {string} s
* @returns {string}
*/
function y (s) {
return s
}
}
Basically if i have a function with type definition for arguments and i call it with an any
that i received from somewhere else then it should fail.
I expect the rule no-unsafe-call
to catch this because it's about making all CallExpression
in the AST safe ( no unsafe )
Expected Result
Warning from typescript-eslint
Actual Result
no warning
Additional Info
Versions
package | version |
---|---|
@typescript-eslint/eslint-plugin |
X.Y.Z |
@typescript-eslint/parser |
X.Y.Z |
TypeScript |
X.Y.Z |
ESLint |
X.Y.Z |
node |
X.Y.Z |
npm |
X.Y.Z |