T
Join ServertRPC
❓-help
Sharing Enum
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
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?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
Got it. Thanks for the heads up