Skip to content

Bug: [no-unsafe-return] Differentiate a types-error any from a "true" any #9218

Closed
@JoshuaKGoldberg

Description

@JoshuaKGoldberg

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.5&fileType=.ts&code=DYUwLgBAbghsCuIBcEByB7MBpAdug7jgNwBQJAZvDgMZgCW6OEIAHjALYAOoAFAJQQA3iQgQATuHhimsBCFIBfIA&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQAIBcBPABxQGNoBLY-AWhXkoDt8B6Jge1tieQEMAZolrRE%2BWNCbooiaNA7RI4MAF8QKoA&tsconfig=&tokens=false

Repro Code

let value: NotKnown;

function example() {
  return value;
}

ESLint Config

module.exports = {
  "rules": {
    "@typescript-eslint/no-unsafe-return": "error"
  }
}

tsconfig

{
  "compilerOptions": {
    // ...
  }
}

Expected Result

When the value being returned is of an "error" type, there should be some indication that it's not the same as an any. It's confusing for developers to see both "error" anys and "true" anys described with the same messaging.

Actual Result

Unsafe return of an `any` typed value. 4:3 - 4:16

Additional Info

Split out of #8304 <- #8231.

💖

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepting prsGo ahead, send a pull request that resolves this issuebugSomething isn't workinglocked due to agePlease open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.package: 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