@repo/typescript-config
Reusable TypeScript compiler configurations.
@repo/typescript-config provides shared tsconfig base files used across the monorepo. It ensures consistent TypeScript compiler options for all packages and apps.
Available Configs
base.json
The foundational TypeScript configuration all other configs extend:
{
"compilerOptions": {
"declaration": true,
"declarationMap": true,
"esModuleInterop": true,
"incremental": false,
"isolatedModules": true,
"lib": ["es2022", "DOM", "DOM.Iterable"],
"module": "NodeNext",
"moduleDetection": "force",
"moduleResolution": "NodeNext",
"noUncheckedIndexedAccess": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"strict": true,
"target": "ES2022"
}
}Key features:
- Strict mode enabled — catches more type errors at compile time
noUncheckedIndexedAccess— Addsundefinedto index signatures, preventing common runtime errorsisolatedModules— Required for Vite/esbuild compatibility- ES2022 target — Modern JavaScript output
- NodeNext module resolution — Full ESM support with
.jsextensions
preact-library.json
Extends base.json with Preact-specific JSX settings:
{
"extends": "./base.json",
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "preact",
"types": ["node"],
"skipLibCheck": true
}
}This configures TypeScript to use Preact's JSX factory instead of React's.
Usage
Reference the shared config in your app's tsconfig.json:
{
"extends": "@repo/typescript-config/preact-library.json",
"compilerOptions": {
"paths": {
"react": ["./node_modules/preact/compat/"],
"react-dom": ["./node_modules/preact/compat/"]
}
},
"include": ["src"]
}The paths mapping ensures that any imports of react or react-dom (commonly used by third-party libraries) are redirected to preact/compat.