The idea is to make spinning up a frontend app fast, easy, and reliable. It shouldn't be hard to add new functionality to an app, and whenever possible we should get compile time or linting checks when refactoring or adding new features. Elm gives a superb developer experience in this regard to maintenance, but there is at least some of that we can get with Typescript - and so this package is born!
You can quickly get going with a yo generator:
# ensure you have yo available, and the lit-tea generatornpm i -g yo generator-lit-tea# make a dir and invoke the generatormkdir my-lit-appcd my-lit-appyo lit-tea my-lit-app
Then you'll have a fully workable app.
code . # if you have VSCodenpm start
src/index.ts and parcel will do its magicks.
How to use
ADT Message Type
Typescript has two compiler flags,
strictNullChecks, which enable exhaustive switch statements. Together with unions, we can get very close to Elm's way of defining messages and update functions.
examples/adt.ts (TODO - use remote data fetching example).
;// MODEL - application state;// MESSAGES - application transitions;// VIEW - dat sweet html// APP - tyingit all togetherrun;
This project is built with Typescript, and is configured to compile to the
/dist folder. We copy the
package.json into the dist folder and publish from there.