New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: [no-misused-promises] Cannot read properties of undefined (reading 'flags') #5807
Comments
Shorter repro: function getInnerValue(...args: []): void;
export function getValue(): undefined {
return getInnerValue('a');
} I didn't know that |
This is affecting me in various projects and almost always occurs with |
…sused-promises Fixes typescript-eslint#5807 When linting a function with a 'rest' tuple argument, we might have different numbers of arguments between signatures: ``` function foo(...args: []); function foo(...args: [string]); ``` This PR makes no-misused-promises handle this code correctly, by ensuring that we only check an argument when we have a corresponding type parameter in the tuple type arguments.
…sused-promises (#5809) Fixes #5807 When linting a function with a 'rest' tuple argument, we might have different numbers of arguments between signatures: ``` function foo(...args: []); function foo(...args: [string]); ``` This PR makes no-misused-promises handle this code correctly, by ensuring that we only check an argument when we have a corresponding type parameter in the tuple type arguments.
Just also got hurt by this. @JoshuaKGoldberg I guess you'll be preparing a release soon? |
We have a standard release schedule: |
Before You File a Bug Report Please Confirm You Have Done The Following...
Playground Link
https://typescript-eslint.io/play/#ts=4.8.4&sourceType=module&code=GYVwdgxgLglg9mABAcwKZQJJjKgTgNQEMAbEVACgDprDdkBnALkV1UIBMFiBPRAbQC6ASmbh2qYDBzsA3AChQkWAhTosOAiTJUadJizacwPfvSi4pyYaLDjJ0+YujwkaTNjxFSFapQD6tAzMrBxcvGYWYMiCIohiElKo7IgA3nKIBlAguEjx9knyAL5ycqgAHgAOcLhQiE7Kruhe2rF5iclpGaxZOaruGs0UAOSEQ0JFQA&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQAIBcBPABxQGNoBLY-AWhXkoDt8B6Jge1oFtLlZkiACa1i0Dr0GoMAbXDYciaOOiQANPIVYF2SGQAWiMgGtkANQ6UhAJUT5Y0JukyadOAIb58VAEax8KM4AZu7wgq4KAL4RYNEKALry0ZFAA&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eAcgK6qoDCAFutAGsylBm3TgwAXxCSgA
Repro Code
ESLint Config
tsconfig
Expected Result
eslint runs without error
Actual Result
Additional Info
The issue seems to be coming from the function being defined in a polymorphism manner with rest args.
For instance, this produces the error:
But this does not:
And neither does this:
Versions
@typescript-eslint/eslint-plugin
5.40.0
@typescript-eslint/parser
5.40.0
TypeScript
4.8.4
ESLint
8.15.0
node
18.9.1
The text was updated successfully, but these errors were encountered: