Configuration Guides & Recipes
Monorepo Setup with Project References
Section titled “Monorepo Setup with Project References”In high-performance monorepos (Turborepo or pnpm workspaces), use a root orchestrator configuration and extend specific presets in each workspace package.
1. Root tsconfig.json
Section titled “1. Root tsconfig.json”The root configuration acts as the solution orchestrator without compiling files directly:
{ "files": [], "references": [ { "path": "packages/core" }, { "path": "packages/ui" }, { "path": "apps/web" } ]}2. Workspace Package tsconfig.json
Section titled “2. Workspace Package tsconfig.json”Inside individual packages, point extends to the preset matching that package’s runtime archetype:
{ "extends": "@nexload-sdk/typescript-config/node.json", "compilerOptions": { "rootDir": "./src", "outDir": "./dist", "composite": true, "declaration": true, "declarationMap": true }, "include": ["src/**/*"]}Overriding Compiler Options Safely
Section titled “Overriding Compiler Options Safely”Presets are designed to be composable. When overriding options in your local tsconfig.json, follow these guidelines:
Safe to Customize
Section titled “Safe to Customize”rootDirandoutDir: Configure directory output paths according to your build tool (esbuild, tsup, tsc).declarationanddeclarationMap: Enable when publishing dual packages with source-linked.d.ts.mapfiles.paths/baseUrl: Add path aliases (e.g.,~/*or@/*) if required by your framework bundler.
Never Weaken
Section titled “Never Weaken”strict: Do not disablestrict: false. Narrow types explicitly at trust boundaries instead.moduleDetection: Keep"force"to guarantee proper module scoping in all environments.forceConsistentCasingInFileNames: Never disable; required to prevent cross-OS deployment failures.
Migrating from Legacy tsconfig.json
Section titled “Migrating from Legacy tsconfig.json”If upgrading an existing codebase with many loose types or legacy CommonJS options:
- Update Dependencies: Install
typescript@^5.9.0and@nexload-sdk/typescript-config. - Replace
extends: Replace local compiler flags with"extends": "@nexload-sdk/typescript-config/<target>.json". - Run Typecheck: Run
pnpm tsc --noEmitto surface type discrepancies. - Fix Module Imports: Ensure all relative imports use modern ESM file extensions (
.jsin import paths when targetingNodeNext). - Resolve Strictness Issues: Add explicit return types on recursive functions and eliminate switch statement fallthroughs.