Skip to content
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: [explicit-function-return-type] false positive on defaulting parameters #8950

Open
4 tasks done
kirkwaiblinger opened this issue Apr 19, 2024 · 0 comments · May be fixed by #9045
Open
4 tasks done

Bug: [explicit-function-return-type] false positive on defaulting parameters #8950

kirkwaiblinger opened this issue Apr 19, 2024 · 0 comments · May be fixed by #9045
Labels
accepting prs Go ahead, send a pull request that resolves this issue bug Something isn't working good first issue Good for newcomers package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin

Comments

@kirkwaiblinger
Copy link
Member

Before You File a Bug Report Please Confirm You Have Done The Following...

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have searched for related issues and found none that matched my issue.
  • I have read the FAQ and my problem is not listed.

Playground Link

https://typescript-eslint.io/play/#ts=5.4.3&fileType=.ts&code=C4TwDgpgBAwghgGwQITgYwNZQLxQBQCUOAfFAG4D2AlgCYDcAUAwGYCuAdmsFRe1M3gDmFYGgAWcAFyxEKdFlyESUAN5QAvgWmVaqpuqA&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQAIBcBPABxQGNoBLY-AWhXkoDt8B6RAD2MbMroDNYTMvkoB7JrWiJ8saJKKl0URNGhjokcGAC%2BIHUA&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eFYDAruuGAL4g9A&tokens=false

Repro Code

type CallBack = () => void;

function f(gotcha: CallBack = () => { }): void {

}

ESLint Config

module.exports = {
  "rules": {
    "@typescript-eslint/explicit-function-return-type": "error"
  }
}

tsconfig

{
  "compilerOptions": {
    "strict": true
  }
}

Expected Result

I expect no error since CallBack makes it a typed function expression

Actual Result

"Missing return type on function":

function f(gotcha: CallBack = () => { }): void {
                                 ^^

Additional Info

No response

@kirkwaiblinger kirkwaiblinger added bug Something isn't working package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for maintainers to take a look labels Apr 19, 2024
@bradzacher bradzacher added accepting prs Go ahead, send a pull request that resolves this issue and removed triage Waiting for maintainers to take a look labels Apr 19, 2024
@kirkwaiblinger kirkwaiblinger added the good first issue Good for newcomers label May 4, 2024
kirkwaiblinger added a commit to kirkwaiblinger/typescript-eslint that referenced this issue May 4, 2024
…tation is present should count as typed function expressions

fix typescript-eslint#8950
kirkwaiblinger added a commit to kirkwaiblinger/typescript-eslint that referenced this issue May 4, 2024
…tation is present should count as typed function expressions

fix typescript-eslint#8950
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepting prs Go ahead, send a pull request that resolves this issue bug Something isn't working good first issue Good for newcomers package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin
Projects
None yet
2 participants