Skip to content

Interface 'MyInterface<T>' incorrectly extends interface - for named tuple type that has '...rest' param #51751

Description

@pmunin

Bug Report

Error happens only when:

  • MyInterface extends type alias which represents named array tuple
  • MyInterface is generic
  • MyType is NAMED tuple
  • MyType has ...rest

🔎 Search Terms

type alias, named tuple, interface

🕗 Version & Regression Information

Typescript v4.9.3

⏯ Playground Link

Playground link with relevant code

💻 Code

The following code throws that error:

typeMyType=[name1:string,name2: number,
...rest:any[]]interfaceMyInterface<T>extendsMyType{}// "Interface 'MyInterface<T>' incorrectly extends interface '[name1: string, name2: number, ...rest: any[]]'.

All of the following below works fine:

typeMyType=[name1:string,name2: number,
...rest:any[]]interfaceMyInterfaceextendsMyType{//MyInterface is not generic => works}// ----------- OR -------------typeMyType=[// MyType does not have ...rest => works finename1:string,name2: number]interfaceMyInterface<T>extendsMyType{}// ------------ OR ------------typeMyType=[// MyType typle elements are not named => works finestring,number,
...any[]]interfaceMyInterface<T>extendsMyType{}

🙁 Actual behavior

TSC throws error:

Interface 'MyInterface<T>' incorrectly extends interface '[name1: string, name2: number, ...rest: any[]]'.

🙂 Expected behavior

Successfull compilation

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: Something ElseFallback label when we just can't figure anything else outHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions