Skip to content

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

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.3.3&fileType=.ts&code=DYUwLgBAbghsCuIBcEB28C2AjEAnA3AFCGwIgQC8EAzgA4D29A1gJ75A&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQAIBcBPABxQGNoBLY-AWhXkoDt8B6Jge1tieQEMAZolp9kySgHMmAW0Qt0URNGgdokcGAC%2BITUA&tsconfig=&tokens=false

Repro Code

let value: number;

value = spooky;

ESLint Config

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

tsconfig

No response

Expected Result

Users should be told that the type is an "error" variant of any. It's confusing to have the same report show up for both a "real" any and an error in type checking.

Actual Result

The same error as if we'd added a declare const spooky: any;:

Unsafe assignment of an `any` value.

Additional Info

Although the type's typeToString() returns "any", its intrinsic name is "error". See the Types panel of the linked playground.

Error types in type checking are often a symptom of misconfiguration around TypeScript and/or typescript-eslint. Example StackOverflow question around an any in a lint rule.

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