Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. interface Runner {
  2. run: Function
  3. }
  4. interface Swimmer {
  5. swim: Function
  6. }
  7. type RunnerAndSwimmer = Runner & Swimmer; // Could be Runner & Swimmer & Dancer ....
  8. const person: RunnerAndSwimmer = {
  9. run: function() {
  10. console.log('I can run!')
  11. },
  12. swim: function () {
  13. console.log('I can swim!')
  14. }
  15. };
  16. person.run(); // prints I can run
  17. person.swim(); // prints I can swim
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement