Created
November 7, 2019 04:47
-
-
Save IntegerMan/7770119b6543bd753f629e66bcd57e62 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
class AwesomePerson extends Person { | |
public onlyDoesBoringThings(): boolean { | |
return false; | |
} | |
public doAwesomeStuff(): void {} | |
public doBoringStuff(): void {} | |
} | |
function handlePersonTask(person: AwesomePerson) { | |
if (person.onlyDoesBoringThings) { // oops - no () so we're just checking for non-null | |
person.doBoringStuff(); | |
} else { | |
person.doAwesomeStuff(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment