dillonkearns / elm-typescript-interop

Generate TypeScript declaration files for your elm ports!
BSD 3-Clause "New" or "Revised" License
165 stars 13 forks source link

Handling port subscriptions with a union type #30

Open pnaylor opened 4 years ago

pnaylor commented 4 years ago

Am excited to try this library out but also find myself wishing for this feature which was alluded to in this old Reddit announcement post.

The next set of features I'm thinking about experimenting with are around handling port subscriptions with a union type in a single subscribe function, similar to how the Elm update function works (so it won't compile if you forget to handle a case).

This sounds like exactly the setup I was hoping to have with just a pair of an incoming and outgoing port that pass generic messages, rather than a port for each message type.

Wondering if there was ever any progress on this front or maybe there was some technical limitation that prevented it?

Awesome tool, much appreciated.