8000 Bug: [no-deprecated] doesn't report deprecated type index access · Issue #10837 · typescript-eslint/typescript-eslint · GitHub
[go: up one dir, main page]

Skip to content

Bug: [no-deprecated] doesn't report deprecated type index access #10837

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
ronami opened this issue Feb 15, 2025 · 1 comment · Fixed by #10867
Closed
4 tasks done

Bug: [no-deprecated] doesn't report deprecated type index access #10837

ronami opened this issue Feb 15, 2025 · 1 comment · Fixed by #10867
Labels
accepting prs Go ahead, send a pull request that resolves this issue bug Something isn't working package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin

Comments

@ronami
Copy link
Member
ronami commented Feb 15, 2025

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=C4TwDgpgBAKhDOwoF4oG8BQUoHoBUeUAAgCYRgBOEAxgIbAQlR45ZS0BcUA5LdwDRsARl25CBGAL4BuDBhw4o8ABYB7AK4AbJhAoVVFKEPVISqhADtuwDKEhQASgi1JUcRAG1e3ALqygA&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQAIBcBPABxQGNoBLY-AWhXkoDt8B6Jge1oBNFjpEZAIb5E3dGADakRNGgdokALrgwAXxBqgA&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eAcgK6qoDCAFutAGsylBm3TgwAXxCSgA&tokens=false

Repro Code

type Test = {
  /** @deprecated */
  a: 'a',
  b: 'b',
};

// should error but doesn't
type Result = Test['a'];

ESLint Config

module.exports = {
  parser: "@typescript-eslint/parser",
  rules: {
    "@typescript-eslint/no-deprecated": ["error"],
  },
};

tsconfig

{
  "compilerOptions": {
    "strictNullChecks": true
  }
}

Expected Result

I expected the deprecated type index access to be reported since it's also reported by TypeScript as deprecated.

Actual Result

The deprecated type index access hasn't been reported.

Additional Info

No response

@ronami ronami 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 Feb 15, 2025
@JoshuaKGoldberg JoshuaKGoldberg 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 Feb 17, 2025
@ronami
Copy link
Member Author
r 97FE onami commented Feb 17, 2025

Interestingly, this seems to also affect non-type (computed) index access (playground link):

const test1 = {
  /** @deprecated */
  'foo-bar': 'a',
};

// should report but doesn't
const result1 = test1['foo-bar'];

const test2 = {
  /** @deprecated */
  [Symbol.iterator]: 1,
};

// should report but doesn't
const result2 = test2[Symbol.iterator];

I think this would have a similar issue to the one mentioned in #10310 (comment) (which I completely forgot to follow up, I'll try to get back to it soon).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepting prs Go ahead, send a pull request that resolves this issue bug Something isn't working package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants
0