Last active
October 16, 2017 10:08
-
-
Save nabeix/7a0fdce6c560be0e7ab1408a7f7fb94c to your computer and use it in GitHub Desktop.
TypeScript Generics ignore extend types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class A<T1, T2> { | |
} | |
class B extends A<string, number> { | |
} | |
interface AClassStatic<T1, T2, T3 extends A<T1, T2>> { | |
new (): T3 | |
} | |
function getFromAClass<T1, T2, T3 extends A<T1, T2>>(aClass: AClassStatic<T1, T2, T3>): { t1: T1, t2: T2 } { | |
return <any>{}; // dummy | |
} | |
const param = getFromAClass(B); // expect: {t1: string, t2: number}, actual: {t1: {}, t2: {}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment