Created
October 6, 2017 05:56
-
-
Save another-guy/e459cea9430d66519b08769e6a2e639d to your computer and use it in GitHub Desktop.
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
export class Mammal { | |
mammalName: string; | |
} | |
export class Dog extends Mammal { | |
dogName: string; | |
} | |
export class Cat extends Mammal { | |
catName: string; | |
} | |
const cat: Cat = { catName: 'kitty' }; | |
const dog: Dog = { dogName: 'doggo' }; | |
export function compare<T>(a: T, b: T): number { | |
// ... implementation | |
} | |
// Guess what is the inferred type of `T` here | |
const comparationResult = comparator(cat, dog); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment