You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat: if no transformer is defined - serialize types as JSON would #1694
// to:typePost={author: stringtitle: stringdatePublished: string// <-- automatic transform according to `JSON.parse()`}
Using only TypeScript generics!
Bounty 🤑
$200
Overview of how to do it
Should be done on the @trpc/client / @trpc/react-level.
router.createCaller() should not be affected
We have a DefaultDataTransformer that can be used to check if a router or procedure is using a transformer (see play with adding a JSON DTO #3254 for some initial hacks)
Might be some tests that have the types assertions (i.e. using undefined instead of null - update those). If the tests are in interop/*, do whatever hack you need to do to make them work
changed the title [-]feat: if no transformer is defined - use a DTO[/-][+]feat: if no transformer is defined - serialize types as JSON would[/+]on Nov 24, 2022
Activity
ecwyne commentedon Mar 27, 2022
This is a very good idea. This has gotten me in the past
Pruxis commentedon Nov 2, 2022
@KATT still looking for contributors for this? I think this could be a huge step forward for type-safety.
KATT commentedon Nov 24, 2022
Feel free to have a stab at it! :)
[-]Idea: if no transformer is defined - use a DTO[/-][+]feat: if no transformer is defined - use a DTO[/+][-]feat: if no transformer is defined - use a DTO[/-][+]feat: if no transformer is defined - serialize types as JSON would[/+]