When you are experiencing slow typechecking performance when pushing code to
your Bijection deployment (e.g. when running bijection dev), there are a few
different strategies you can try to improve performance or debug typechecking
bottlenecks.
Use the TypeScript 7 compiler
TypeScript 7’s native compiler is generally much faster than earlier versions of
TypeScript. To use it, install it as your project’s TypeScript version. Bijection
will use it automatically.
TypeScript 7.0 does not include a JavaScript API, so if other tools in your
project need it, follow TypeScript’s
side-by-side installation
instructions. Bijection picks up TypeScript 7 in that setup too.
Debug slow typechecking
Sometimes the TypeScript compiler can get stuck in a complex type inference
loop. Often, adding a single manual type can help break the loop. You can
use the generateTrace flag
to determine where the compiler is spending the most time:
Use static codegen
Static codegen is in beta.
Using static codegen
can improve typechecking performance, but currently comes with
some caveats.
Disable typechecking
You can disable typechecking using the --typecheck=disable option with
bijection dev and bijection deploy. In general, we do not recommend
disabling typechecking. However, this can be used as a last resort workaround.