Skip to content

Bug: [no-deprecated] doesn't report when deprecated API's are used in an object. #10643

Open
@ravichandra480

Description

@ravichandra480

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.7.2&fileType=.ts&code=PTAEGEEEGUFFQEwC5QDMD2AnUBLAdgC4CmmqAhgMZEDOAsAFD7GmVGgDimOAJgPIAOBHOjzVQAbwahQwAFSzQAAW5F%2BmIhTLFuoAK7U2eIgHdI-HLlHEyO2cCmgyAfhTUCXPAHMA3A4BGLqBuHj4MAL4MDCCgAHLoBKDGWADW%2BJ5BVHhkXOgMFCJuoAAeKJw8AkIFoAC8Eg5kKABEGOiNMmAA6pAASjFNZXyCwqIAdGS4YipqGlpE3Cj6bH6WbkQ24ZH00R0paRlEWTl5BQkAXjXFY95AA&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQAIBcBPABxQGNoBLY-AWhXkoDt8B6Jge1oBNFjpEZAIb5E3dFETRoHaJHBgAviEVA&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eAcgK6qoDCAFutAGsylBm3TgwAXxCSgA&tokens=false

Repro Code

// CASE 2: for interfaces
interface GridOptions {
  /** @deprecated use newApi instead */
  a?: string;
  b?: string;
}

// Not working scenario
const x: GridOptions = {
  a: "foo" // WARN: "GridOptions.a is deprecated: use b instead
}

// Working scenario
const z = x.a;

ESLint Config

{
  "rules": {
    "@typescript-eslint/no-deprecated": "error"
  }
}

tsconfig

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

Expected Result

Linter should report when a deprecated property is used inside an object

Actual Result

The linter is not reporting when a deprecated property is used inside an object.

Additional Info

Similar issue was reported [deprecation] Warns when deprecated APIs are used., and this issue was closed by refering to the eslint-plugin-deprecation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepting prsGo ahead, send a pull request that resolves this issuebugSomething isn't workingpackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions