Haskell already has world-class support for converting data to and from JSON using the Aeson library. But what if you want to ensure that your TypeScript frontend is using your data types correctly?

If you already use Aeson’s autogenerated Template Haskell instances, then this library will let you generate TypeScript definitions that match up with them perfectly.

See the Github readme or the Hackage docs for more details, including some suggestions on how you can generate type files automatically as part of your frontend build process.

The library is on Stackage as of LTS-10.8.

Notes

This was my first significant Template Haskell project. Here are some notes on the implementation: