# typescript-config — Agent usage Configure a coding agent for @nexload-sdk/typescript-config. **Topic:** agents **Package:** `@nexload-sdk/typescript-config` v5.9.3 **Canonical page:** https://gecut.github.io/nexload-sdk/packages/typescript-config/agents/ ## Install matching skills These are shared engineering skills. ### nexload-way [Trigger](https://github.com/gecut/nexload-sdk/blob/main/skills/nexload/way/SKILL.md) ```text MUST load before writing or refactoring TypeScript or React in a project that follows the nexload way: creating, naming, moving or splitting a file, module, component or helper; extracting repeated code; exports; branching on a union or status. Picks the file role, module location and helper rung. Lint and enola enforce the mechanical rules. ``` ```bash npx skills add gecut/nexload-sdk --skill nexload-way ``` ### nexload-package [Trigger](https://github.com/gecut/nexload-sdk/blob/main/skills/nexload/package/SKILL.md) ```text Use when the primary task changes or evaluates the shipped contract of a publishable Nexload TypeScript package: ownership, public exports and subpaths, entrypoint runtime isolation, core/adapter direction where shared policy exists, metadata, dependencies or peers, packed artifacts, package-scoped compatibility, or README/API alignment. Do not use for internal-only code, React behavior, visual styling, repository-wide runtime standards, or release execution. ``` ```bash npx skills add gecut/nexload-sdk --skill nexload-package ``` ## Project AGENTS.md ```markdown For @nexload-sdk/typescript-config, load nexload-way when its trigger matches. Read the package bundle and check public exports against the installed version before editing. ``` ## Package context [Scoped Markdown bundle](/nexload-sdk/packages/typescript-config/llms.txt). ## Prompts ```text Choose a TypeScript compiler preset. Use @nexload-sdk/typescript-config and nexload-way. Inspect the installed version and show a minimal typed example for my project. ``` ```text Review my @nexload-sdk/typescript-config integration against the optimization page. Identify the relevant source for each finding and one test for the highest-risk behavior. ``` --- # typescript-config — Configuration reference Exported configuration entries for @nexload-sdk/typescript-config. **Topic:** api **Package:** `@nexload-sdk/typescript-config` v5.9.3 **Canonical page:** https://gecut.github.io/nexload-sdk/packages/typescript-config/api/ ## Public entries * `./base.json` * `./node.json` * `./react.json` * `./next.json` * `./vite.json` ## Usage Set extends to the package name followed by a preset subpath, for example @nexload-sdk/typescript-config/next.json. Set include and output paths in the consuming project. [Package manifest](https://github.com/gecut/nexload-sdk/blob/main/tools/typescript-config/package.json). --- # Configuration Guides & Recipes Monorepo project references, overriding compiler options safely, and library declaration builds. **Topic:** guides **Package:** `@nexload-sdk/typescript-config` v5.9.3 **Canonical page:** https://gecut.github.io/nexload-sdk/packages/typescript-config/guides/ ## 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` The root configuration acts as the solution orchestrator without compiling files directly: ```json title="tsconfig.json" { "files": [], "references": [ { "path": "packages/core" }, { "path": "packages/ui" }, { "path": "apps/web" } ] } ``` ### 2. Workspace Package `tsconfig.json` Inside individual packages, point `extends` to the preset matching that package's runtime archetype: ```json title="packages/core/tsconfig.json" { "extends": "@nexload-sdk/typescript-config/node.json", "compilerOptions": { "rootDir": "./src", "outDir": "./dist", "composite": true, "declaration": true, "declarationMap": true }, "include": ["src/**/*"] } ``` *** ## Overriding Compiler Options Safely Presets are designed to be composable. When overriding options in your local `tsconfig.json`, follow these guidelines: ### Safe to Customize * **`rootDir` and `outDir`**: Configure directory output paths according to your build tool (esbuild, tsup, tsc). * **`declaration` and `declarationMap`**: Enable when publishing dual packages with source-linked `.d.ts.map` files. * **`paths` / `baseUrl`**: Add path aliases (e.g., `~/*` or `@/*`) if required by your framework bundler. ### Never Weaken * **`strict`**: Do not disable `strict: 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` If upgrading an existing codebase with many loose types or legacy CommonJS options: 1. **Update Dependencies**: Install `typescript@^5.9.0` and `@nexload-sdk/typescript-config`. 2. **Replace `extends`**: Replace local compiler flags with `"extends": "@nexload-sdk/typescript-config/.json"`. 3. **Run Typecheck**: Run `pnpm tsc --noEmit` to surface type discrepancies. 4. **Fix Module Imports**: Ensure all relative imports use modern ESM file extensions (`.js` in import paths when targeting `NodeNext`). 5. **Resolve Strictness Issues**: Add explicit return types on recursive functions and eliminate switch statement fallthroughs. --- # Overview & Quick Start Strict, modern TypeScript configurations for Node.js, React, Next.js, and Vite applications. **Topic:** overview **Package:** `@nexload-sdk/typescript-config` v5.9.3 **Canonical page:** https://gecut.github.io/nexload-sdk/packages/typescript-config/ **Package:** `@nexload-sdk/typescript-config` **Workspace version:** `5.9.3` Shared TypeScript configurations for the Nexload SDK monorepo [npm](https://www.npmjs.com/package/@nexload-sdk/typescript-config) · [Source](https://github.com/gecut/nexload-sdk/tree/main/tools/typescript-config) `@nexload-sdk/typescript-config` provides battle-tested, strict TypeScript configurations tailored for modern TypeScript 5.9+ runtimes and frameworks. It eliminates boilerplate and enforces strict type boundaries across libraries, microservices, and web applications. *** ## 10-Second Code Snippet Extend the target preset directly in your project's `tsconfig.json`: ```json title="tsconfig.json" { "extends": "@nexload-sdk/typescript-config/node.json", "compilerOptions": { "outDir": "./dist", "rootDir": "./src" }, "include": ["src/**/*"] } ``` *** ## Available Presets Catalog The package ships explicit subpath exports for each runtime archetype: | Preset Subpath | Target Environment | Key Compiler Options | |---|---|---| | `@nexload-sdk/typescript-config/base.json` | Universal base for all TypeScript projects | `target: ES2022`, `moduleResolution: NodeNext`, `moduleDetection: force`, `strict: true` | | `@nexload-sdk/typescript-config/node.json` | Node.js backend services and CLI tools | Extends base, `lib: ["ES2023"]`, typed Node globals | | `@nexload-sdk/typescript-config/react.json` | Client React libraries and single-page apps | `jsx: react-jsx`, `lib: ["DOM", "DOM.Iterable", "ES2023"]` | | `@nexload-sdk/typescript-config/next.json` | Next.js App Router applications | `jsx: preserve`, `plugins: [{ name: "next" }]`, isolated module safety | | `@nexload-sdk/typescript-config/vite.json` | Vite frontend applications | `moduleResolution: Bundler`, `jsx: react-jsx`, client DOM types | *** ## Core Guarantees & Strictness Flags All presets inherit from `base.json` with maximum compiler safety enabled: * **`moduleDetection: "force"`**: Treats every TypeScript file as a module automatically, preventing ambient global scope pollution without needing empty `export {}` statements. * **`forceConsistentCasingInFileNames: true"`**: Prevents subtle filesystem case-sensitivity crashes between macOS/Windows and Linux CI containers. * **`noImplicitOverride: true`**: Guarantees that subclass method overrides are explicitly marked with the `override` keyword. * **`noImplicitReturns: true`**: Ensures all code paths within a function explicitly return a value. * **`noFallthroughCasesInSwitch: true`**: Catches accidental switch fallthrough bugs during compilation. * **`exactOptionalPropertyTypes: true`**: Distinguishes between omitted properties and properties explicitly assigned `undefined`. *** ## Installation & Requirements ```bash pnpm add -D @nexload-sdk/typescript-config typescript@^5.9.0 ``` Peer requirement: `typescript >= 5.0.0`. ## Next steps [Optimization](./optimization/) [Agent usage](./agents/) --- # typescript-config — Optimization Production choices for @nexload-sdk/typescript-config. **Topic:** optimization **Package:** `@nexload-sdk/typescript-config` v5.9.3 **Canonical page:** https://gecut.github.io/nexload-sdk/packages/typescript-config/optimization/ ## Extend the runtime preset Extend node.json for a backend package, react.json for a React library or next.json for a Next.js app. ## Retain checked indexed access Inherit strict and noUncheckedIndexedAccess from base.json when customizing project includes and output paths. ## Choose emit behavior The React preset emits declarations only. The Next.js and Vite presets set `noEmit`, so use the preset suited to the build pipeline. ## Include the intended sources Set `include` and output paths for the consuming project. The Node preset defaults to `src/**/*.ts` and excludes `dist` and `node_modules`. ## Sources [Package guidance](https://github.com/gecut/nexload-sdk/blob/main/tools/typescript-config/README.md) · [Implementation](https://github.com/gecut/nexload-sdk/blob/main/tools/typescript-config/base.json).