flightcontrolhq / superjson

Safely serialize JavaScript expressions to a superset of JSON, which includes Dates, BigInts, and more.
https://www.flightcontrol.dev?ref=superjson
MIT License
4.17k stars 90 forks source link

Export SuperJSONResult type #271

Closed tmcw closed 1 year ago

tmcw commented 1 year ago

We were previously using SuperJSON v1, and importing from dist/types to get the SuperJSONResult type. Now that it's at v2 and there's an explicit exports entry in superjson, we can't do that, and it'd be nicer if index.ts re-exported SuperJSONResult to make that access possible.

This is for things like making sure that a zod parser that tests whether a value is "like" a SuperJSONResult is accurate, or just for typing the output of functions that return SuperJSON-serialized data.

Skn0tt commented 1 year ago

That's a good idea! Do you wanna open another PR for this?

tmcw commented 1 year ago

Sure! PR: https://github.com/blitz-js/superjson/pull/272