Last active
August 9, 2020 13:40
-
-
Save jaycosaur/9edef8ee755281c5bbdc6bf5fc5dfba1 to your computer and use it in GitHub Desktop.
Hybrid [typescript] - Typescript to Python field guide
This file contains hidden or 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
interface Dog { | |
(food: string): void; | |
type: string; | |
} | |
const dogFactory = (breed: string): Dog => { | |
const eat = (food: string) => console.log(`Eating ${food}.`); | |
eat.type = breed; | |
return eat; | |
}; | |
const poodle: Dog = dogFactory("Poodle"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment