Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.