darklang / rescript-tea

The Elm Architecture for Rescript
Other
119 stars 9 forks source link

Use bs-json #3

Open pbiggar opened 2 years ago

pbiggar commented 2 years ago

As I understand it, bs-tea uses its own json decoder. bs-json has become standard, so use that instead.

pbiggar commented 2 years ago

bs-json is now https://github.com/glennsl/rescript-json-combinators

Json is used for both actual JSON, but also for "decoding" JS objects (that is, reading fields from them). That should be replaced by rescript-webapi - we should add proper types for events in event handlers, and then users can call rescript-webapi functions to access the nested fields. Then we'll have type safety most of the way through (we'll still need an Obj.magic to say that the event object is the type we associate with that event name, but that's a small price to pay, since those are defined in the spec and browsers are rigorous about such things).