8000 Bug: [explicit-function-return-type] false positive on defaulting parameters · Issue #8950 · typescript-eslint/typescript-eslint · GitHub
[go: up one dir, main page]

Skip to content

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

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

Closed
4 tasks done
kirkwaiblinger opened this issue Apr 19, 2024 · 0 comments · Fixed by #9045
Closed
4 tasks done

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

kirkwaiblinger opened this issue Apr 19, 2024 · 0 comments · 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 locked due to age Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing. 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 team members 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 team members 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
auvred added a commit that referenced this issue May 13, 2024
…ve on default parameters (#9045)

[explicit-function-return-types] default parameters where a type annotation is present should count as typed function expressions

fix #8950

Co-authored-by: auvred <61150013+auvred@users.noreply.github.com>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 21, 2024
@bradzacher bradzacher added the locked due to age Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing. label Apr 14, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepting prs Go ahead, send a pull request that resolves this issue bug Something isn't working good first issue Good for newcomers locked due to age Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing. package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin
Projects
None yet
2 participants
0