Closed
Description
openedon May 25, 2018
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