TypeScript
Turbopack supports TypeScript out of the box. This means you can import .ts
files with Turbopack. We support all of TypeScript's feature set.
Thanks to our JSX support, you can also import .tsx
files too.
Resolving paths
and baseUrl
In TypeScript, you can use the paths
property of tsconfig.json
to let you import files from custom paths.
This would let you import directly from app/*
without needing to do a relative import:
Turbopack reads the paths
and baseUrl
in tsconfig.json
in order to resolve these paths, just like Next.js
does.
This means you only need to configure your absolute paths in one place.
Type Checking
Turbopack does not perform type checks on your application. We use SWC to compile TypeScript code, which also does not perform type checks.
This means that in order to run your type checks, you'll need a sidecar process running tsc --watch
. Or, you can rely on your IDE's TypeScript integration.