Skip to content

interface partial specializations #24400

Closed

Description

Is there any way to specialize an generic interface.

Examples

interface Gen<T> {
   method1 (): void
}
// not use '='? it is a break change
interface Gen<T = number> {
   method2 (): void
}

let v1 = {} as Gen<string>
v1.method1() // correct ,  Gen<string> has method1
v1.method2() // error,  Gen<string> does not has method2

let v2 = {} as Gen<number>
v1.method2() // correct ,  Gen<string> has method2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions