Hacker News new | ask | show | jobs
by tomhallett 958 days ago
The way I interpreted it:

* Person A [Marketer who knows html/handlebars] logs into Postmark and makes a new email template.

* Person A tells Person B [node js developer], "Please send the new 'welcome' email template from the app".

* Person B runs the cli script, so the json file now has a template with a key of 'welcome-template-2023-blue'.

* Person B can write/modify any code which calls "sendEmailTemplate" and know exactly what code is valid, wont compile, etc.

They are "generating" the "class/object/type definitions" programmatically - which seems fine to me for the code generation problem they lay out.

Which part is not "a valid case" to you?

Note: the fact that the article is "typescript + json" versus pure "typescript" doesn't seem like a important distinction with respect to it be valid code generation, not sure if others disagree.

Random note: A different way to solve this problem would be with the "cog" python module [1], but that would come with a different set of tradeoffs. :)

[1]: https://nedbatchelder.com/code/cog

1 comments

Thanks for making me discover cog ! It can be very useful.