Advertisement
Guest User

Untitled

a guest
Jun 25th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. abstract class Original {
  2.     constructor() {}
  3.     get info() {return 'X';}
  4.     getData(key: this['info']) {}
  5.     setData(key: this['info'], value ) {}
  6. }
  7.  
  8. class MyClass extends Original {
  9.     get info() {return 'A' as 'A';}
  10. }
  11. class MyOtherClass extends Original {
  12.     get info() {return 'B' as 'B';}
  13. }
  14. const myInstance = new MyClass();
  15. console.log(myInstance.getData('A'));
  16.  
  17. const myOtherInstance = new MyOtherClass();
  18. console.log(myOtherInstance.getData('B'));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement