Skip to content

Bug: [no-deprecated] Maximum call stack size exceeded when class implements itself #10031

Closed
@fwdekker

Description

@fwdekker

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.

Issue Description

If you have a class in TypeScript that implements itself (i.e. class Foo implements Foo), inside which is a getter method (i.e. get bar(): number { return 42; }) that is used by another method (i.e. baz(): number { return this.bar; }), then upon running npx eslint Foo.ts I get the error "RangeError: Maximum call stack size exceeded" while running rule @typescript-eslint/no-deprecated, which occurs while linting the line containing return this.bar.

Now, why exactly you would want a class to implement itself is quite beyond me, but I accidentally had that in my code and it took me quite a while to figure out what was going on. TypeScript itself seems to have no problem with it at all. I have no problem at all if the resolution is to detect this and then give an error, but that error must be descriptive.

My reproduction repo is quite minimal, so I'm not sure why I was unable to reproduce it in the playground. I'm not too good with node-ish setups, I guess.

Reproduction Repository Link

https://github.com/FWDekker/typescript-eslint-no-deprecated-bug

Repro Steps

  1. clone the repo
  2. npm install
  3. npx eslint Foo.ts

Versions

package version
@typescript-eslint/eslint-plugin 8.6.0
@typescript-eslint/parser 8.6.0
@typescript-eslint/scope-manager 8.6.0
@typescript-eslint/typescript-estree 8.6.0
@typescript-eslint/type-utils 8.6.0
@typescript-eslint/utils 8.6.0
TypeScript 5.5.4
ESLint 9.11.0
node (Debian package) 20.17.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepting prsGo ahead, send a pull request that resolves this issuebugSomething isn't workinggood first issueGood for newcomerslocked due to agePlease open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions