Skip to content

Instantly share code, notes, and snippets.

@jaycosaur
Last active August 9, 2020 13:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jaycosaur/9edef8ee755281c5bbdc6bf5fc5dfba1 to your computer and use it in GitHub Desktop.
Save jaycosaur/9edef8ee755281c5bbdc6bf5fc5dfba1 to your computer and use it in GitHub Desktop.
Hybrid [typescript] - Typescript to Python field guide
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