TypeScript Config Package
Shared TypeScript configurations used across all workspaces.
A dedicated configuration package (@workspace/typescript-config) keeps TypeScript settings consistent across the monorepo. Every workspace extends one of its presets.
Directory Structure
Which Config Goes Where
| Workspace | TypeScript Config |
|---|---|
apps/native | nextjs.json |
apps/web | nextjs.json |
packages/ui | react-library.json |
packages/core | react-library.json |
packages/i18n | base.json |
packages/cli | base.json |
Base and Presets
Three configs that extend each other:
{
"$schema": "https://json.schemastore.org/tsconfig",
"display": "Default",
"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"
}
}strict: true + noUncheckedIndexedAccess enforces strict type checking. incremental: false is set because Turborepo handles caching.
{
"$schema": "https://json.schemastore.org/tsconfig",
"display": "Next.js",
"extends": "./base.json",
"compilerOptions": {
"plugins": [{ "name": "next" }],
"module": "ESNext",
"moduleResolution": "Bundler",
"allowJs": true,
"jsx": "preserve",
"noEmit": true
}
}Overrides module resolution to Bundler (Next.js uses its own bundler), enables the Next.js TypeScript plugin for route type checking, and sets noEmit since Next.js handles compilation.
{
"$schema": "https://json.schemastore.org/tsconfig",
"display": "React Library",
"extends": "./base.json",
"compilerOptions": {
"jsx": "react-jsx"
}
}react-jsx transform means no import React needed in component files.
Usage
{
"extends": "@workspace/typescript-config/nextjs.json"
}Adding a new package? Extend react-library.json for React packages, or base.json for plain TypeScript utilities.