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.01k stars 87 forks source link

Export SuperJSONResult type #271

Closed tmcw closed 10 months ago

tmcw commented 11 months 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 10 months ago

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

tmcw commented 10 months ago

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