Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- interface Runner {
- run: Function
- }
- interface Swimmer {
- swim: Function
- }
- type RunnerAndSwimmer = Runner & Swimmer; // Could be Runner & Swimmer & Dancer ....
- const person: RunnerAndSwimmer = {
- run: function() {
- console.log('I can run!')
- },
- swim: function () {
- console.log('I can swim!')
- }
- };
- person.run(); // prints I can run
- person.swim(); // prints I can swim
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement