T
tRPC

Sharing Enum

Sharing Enum

MMugetsu3/21/2023
On the backend: I have colocated files with types and procedures (index.ts - procedures, schemas.ts - zod/ts types). If I define an Enum on the backend in the schemas.ts and would like to use it on the client(frontend) does it meat that importing that enum would boundle this file in my client? With type I can just do import type { SomeType } from '../backend/schemas' and that would be stripped If I understand correctly. But what about enum?
Nnlucas3/21/2023
TS types will get stripped, but if you want the Zod type it might be worth breaking that into a library for peace of mind Treeshaking should do a lot in theory but it’s still better to separate it
MMugetsu3/21/2023
Got it. Thanks for the heads up

Looking for more? Join the community!

T
tRPC

Sharing Enum

Join Server