Skip to content

Bug: Forbid invalid extend in interface #11088

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
fisker opened this issue Apr 18, 2025 · 2 comments · Fixed by #11271
Closed
4 tasks done

Bug: Forbid invalid extend in interface #11088

fisker opened this issue Apr 18, 2025 · 2 comments · Fixed by #11271
Labels
accepting prs Go ahead, send a pull request that resolves this issue AST PRs and Issues about the AST structure bug Something isn't working package: typescript-estree Issues related to @typescript-eslint/typescript-estree

Comments

@fisker
Copy link
Contributor

fisker commented Apr 18, 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.

Relevant Package

typescript-eslint

Playground Link

https://typescript-eslint.io/play#ts=5.8.2&fileType=.tsx&code=KYDwDg9gTgLgBASwHY2FAZgQwMbDgMQGcBZCbAazlFSQBNC4AKGATzGAnTnUIEo4A3gFgAUAF8gA&eslintrc=N4KABGBEBOCuA2BTAzpAXGYBfEWg&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eAcgK6qoDCAFutAGsylBm3TgwAXxCSgA&tokens=false

Repro Code

export interface FsMock extends (typeof fs) {
}

ESLint Config

tsconfig

Expected Result

An error with message

An interface can only extend an identifier/qualified-name with optional type arguments.

Actual Result

Successfuly parsered.

Additional Info

All cases mentioned in microsoft/TypeScript#31843 should be rejected.

Versions

package version
@typescript-eslint/typescript-estree 8.30.1
@fisker fisker added bug Something isn't working triage Waiting for team members to take a look labels Apr 18, 2025
@bradzacher
Copy link
Member

Very similar to #11077

Might be worth adding validation to interface extends?

@JoshuaKGoldberg
Copy link
Member

Agreed, this and #11077 wouldn't be much work to support. And 👍 from me on adding slightly more sanitization to the AST.

@JoshuaKGoldberg JoshuaKGoldberg added accepting prs Go ahead, send a pull request that resolves this issue package: typescript-estree Issues related to @typescript-eslint/typescript-estree and removed triage Waiting for team members to take a look labels May 19, 2025
@JoshuaKGoldberg JoshuaKGoldberg added the AST PRs and Issues about the AST structure label May 19, 2025
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 AST PRs and Issues about the AST structure bug Something isn't working package: typescript-estree Issues related to @typescript-eslint/typescript-estree
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants