Skip to content

Support for skipping type parameter constraints when merging interfaces is order dependent #23909

Closed
@mattmccutchen

Description

@mattmccutchen

TypeScript Version: master (618da24)

Search Terms: type parameter same merging constraint

Code

// Error: "All declarations of 'A' must have identical type parameters."
interface A<T> { }
interface A<T extends string> { }

// No error
interface B<T extends string> { }
interface B<T> { }

Expected behavior: Same for A and B.

Actual behavior: Different behavior for A and B as indicated.

Playground Link: link

Related Issues: #20018

I noticed this while trying to understand the code of areTypeParametersIdentical for another project. The problem is that getConstraintDeclaration always looks at the first declaration.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions