Monteluna pfp
Monteluna
@monteluna
@darrylyeo GADTs in Typescript in action. Not really the best example because I'm not using recursive, but a good example. It slightly increases the codebase, but it moves business logic into the type system. By using them with the case statements below, it forces the developer to be explicit about the state of the code, and handle each possible state. https://github.com/enviodev/velodrome-indexer/pull/287/files#diff-b5265cb45df3c9b118cf42de25e3f34b3b838c88120cd40d41c36ca2c9293d29R177-R214
1 reply
1 recast
3 reactions

Darryl Yeo đŸ› ïž pfp
Darryl Yeo đŸ› ïž
@darrylyeo
Love it! GADTs are absolutely the way to go and will only get easier to use now that TypeScript 5.8 can narrow them directly off of JavaScript control flow. https://warpcast.com/darrylyeo/0xde3a8327
1 reply
0 recast
0 reaction