Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[no-misused-promises] checksVoidReturn=true doesn't catch the error when variadic arguments are used (like...handlers: Array<() => void>) #4015

Closed
Labels
accepting prsGo ahead, send a pull request that resolves this issuebugSomething isn't workingpackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin
@dko-slapdash

Description

@dko-slapdash

This issue affects e.g. express used with new route handlers which are required to be non-async in their TS typings. I think in case of variadic arguments, the plugin verifies just the 1st argument and, if it's okay, doesn't even check the rest of the arguments.

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I haveread the FAQ and my problem is not listed.

Repro

{"rules": {"@typescript-eslint/no-misused-promises":"error",  }}
functionget2(_h1:()=>void,_h2:()=>void){}functionget(..._handlers:Array<()=>void>){}get2(()=>{},async()=>{}// <-- fails, which is what we want);get(()=>{},async()=>{}// <-- this must fail too, but it does not);

Expected Result

Both get() and get2() calls must raise an eslint error.

Actual Result

Only get2() is treated as incorrect, and get() is fine - although it should fail too:

image

Additional Info

Versions

packageversion
@typescript-eslint/eslint-plugin5.0.0
@typescript-eslint/parser5.0.0
TypeScript4.4.4
ESLint8.0.1
node16.11.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepting prsGo ahead, send a pull request that resolves this issuebugSomething isn't workingpackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp