Skip to content

[no-unsafe-assignment] any => unknown assignment triggers error for object shorthand notation #3575

@michens

Description

@michens
  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have read the FAQ and my problem is not listed.

Repro

Playground

{
  "rules": {
    "@typescript-eslint/no-unsafe-assignment": "error"
  }
}
type Foo = { bar: unknown; };
const bar: any = 1;

const foo: Foo = { bar };
const foo2: Foo = { bar: bar };

I expect that foo will be treated the same as foo2

foo triggers the unsafe-assignment error, while foo2 does not

Additional Info

Versions

package version
@typescript-eslint/eslint-plugin 4.26.0
@typescript-eslint/parser 4.26.0
TypeScript 4.1.2
ESLint 7.12.1
node 14.14.0

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

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy