8000 [no-unsafe-call] Expand checks to include parameters · Issue #1968 · typescript-eslint/typescript-eslint · GitHub
[go: up one dir, main page]

Skip to content
[no-unsafe-call] Expand checks to include parameters #1968
Closed
@Raynos

Description

@Raynos

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    package: eslint-pluginIssues related to @typescript-eslint/eslint-plugintriageWaiting for team members to take a look

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0