Prebuilt types solve type inference issues that occur when bundling soda-gql with tools like tsdown, rollup-plugin-dts, or other bundlers that merge declaration files.
When bundlers merge .d.ts files, complex type inference (like InferFields) can be lost at module boundaries. This means your fragments and operations may lose their precise input/output types in the bundled output.
Generate a prebuilt types module that pre-calculates all types at build time:
This creates additional files:
For fragments to be included in the prebuilt registry, they must have a key property:
Fragments without a key property are silently skipped during prebuilt type generation. They will not appear in prebuilt/types.ts.
Operations use their name property as the key automatically - no additional configuration needed:
Configure your bundler to use the prebuilt module via path aliases:
Replace <outdir> with your actual codegen output directory (e.g., ./src/graphql-system).
The same source code works in both modes:
| Mode | Type Resolution |
|---|---|
| Development | Full type inference at IDE/compile time |
| Bundled/Production | Prebuilt types from registry |
No code changes needed between environments.