Skip to content

Instantly share code, notes, and snippets.

@S2
Created October 5, 2018 07:18
Show Gist options
  • Save S2/ea5865999ec658c9b313731168c0a542 to your computer and use it in GitHub Desktop.
Save S2/ea5865999ec658c9b313731168c0a542 to your computer and use it in GitHub Desktop.
class AAA{
constructor(){
console.log("aaa")
}
}
class XXX{
}
class BBB extends XXX{
constructor(){
super()
console.log("bbb")
}
}
class CCC extends XXX{
constructor(){
super()
console.log("ccc")
}
}
class Hoge<A , B extends BBB|CCC>{
constructor(public a : A , public b : B){
console.log("XXXXX")
}
}
class Fuga<B> extends Hoge<AAA , B>{}
class Fuga1<B> extends Fuga<B>{}
class Fuga2<B> extends Fuga<B>{}
class Fuga3<B> extends Fuga<B>{}
class Fuga4 extends Fuga<BBB>{}
interface Piyo{
a : {new<B extends XXX>(p : AAA , q : B) :Fuga<B>}
}
class Bar implements Piyo{
a = Fuga1
constructor(){
new this.a(new AAA() , new AAA()) // error?
new this.a(new AAA() , new BBB())
new this.a(new AAA() , new CCC())
}
}
new Bar()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment