Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Bug: Duplicate extends clause for interface should be reported #11077

Copy link
Copy link
Open
@leaysgur

Description

@leaysgur
Issue body actions

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-estree

Playground Link

https://typescript-eslint.io/play/#ts=5.4.3&fileType=.tsx&code=MYGwhgzhAECiCM0DeBfAUKSNYCZno3CmgA1EBTADwBdyA7AE20VTQHo3pNiS8rbGzaP3pM4eVtxgkAzNACWAWwAOIcovrUhrDlyLSALApVqNdLXERLV6zdgnoppAKzCaooddN3x%2BdpycSADZjGzMLBDcBMVw-NHlzcgAnADMwYHJoAE0Kd0FLPwTaVPTMrL48mNzo%2B3xoXUBeDcABHegAFQALeRgIdoB7AFcQBmgAI0yk8mVepNphkYBPaGUwJIhkgBpoEHkAa0ze6nbkiH8FRJKM7LkvW3NtdF0i5LTLrKMb8M8TW4iHU6eLmVXB8fJERPlYjpOACXmUQuCqqFvHdfKggA&eslintrc=N4KABGBEBOCuA2BTAzpAXGYBfEWg&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eAcgK6qoDCAFutAGsylBm3TgwAXxCSgA&tokens=false

Repro Code

class E1 {}
class E2 {}

// class X2 extends E1 extends E2 {} // This is reported
interface Y2 extends E1 extends E2 {} // This is NOT reported

ESLint Config

tsconfig

Expected Result

Parser should report internal error TS1172: 'extends' clause already seen. like TS does.

https://www.typescriptlang.org/play/?#code/MYGwhgzhAECiCM0DeBfAUKSNYCZno3CmgA1EBTADwBdyA7AE20VTQHo3pNiS8rbGzaP3pM4eVtxgkAzNACWAWwAOIcovrUhrDlyLSALApVqNdLXERLV6zdgnoppAKzCaooddN3x+dpycSADZjGzMLBDcBMVw-NHlzcgAnADMwYHJoAE0Kd0FLPwTaVPTMrL48mNzo+z9dIuS0jOy5L1tzbXR6xJLmrKM28M8TdoiHfwUeprLXQZ9IkXzYnU4G3rKQxarQ7w7fVCA

Actual Result

No errors are reported.

Additional Info

Since duplicate extends are reported correctly for class, they should be reported for interface too?

if (token === SyntaxKind.ExtendsKeyword) {
if (extendsClause) {
this.#throwUnlessAllowInvalidAST(
heritageClause,
"'extends' clause already seen.",
);
}

I can send a PR if this is acceptable change.

leaysgur@0a6d4db

Versions

package version
@typescript-eslint/typescript-estree 8.30.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    ASTPRs and Issues about the AST structurePRs and Issues about the AST structureaccepting prsGo ahead, send a pull request that resolves this issueGo ahead, send a pull request that resolves this issuebugSomething isn't workingSomething isn't workingpackage: typescript-estreeIssues related to @typescript-eslint/typescript-estreeIssues related to @typescript-eslint/typescript-estree

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.