node
> TypeScript configuration for Node.js and CLI projects. Extends @jmlweb/tsconfig-base without DOM types.
โจ Features
Section titled โโจ Featuresโ- ๐ Strict Mode: inherits every strict flag from the base config
- ๐ข Node.js Focused:
lib: ["ES2022"], no DOM types - ๐ NodeNext Modules: Node.js ESM/CJS resolution, inherited from base
- ๐ฏ Flexible: no file patterns imposed
๐ฆ Installation
Section titled โ๐ฆ Installationโnpm install --save-dev @jmlweb/tsconfig-node @jmlweb/tsconfig-base typescript๐ Quick Start
Section titled โ๐ Quick Startโ{ "extends": "@jmlweb/tsconfig-node", "compilerOptions": { "outDir": "./dist", "rootDir": "./src" }, "include": ["src/**/*"], "exclude": ["node_modules", "dist"]}๐ก Examples
Section titled โ๐ก ExamplesโCLI tool
Section titled โCLI toolโ{ "extends": "@jmlweb/tsconfig-node", "compilerOptions": { "outDir": "./dist", "rootDir": "./src" }, "include": ["src/**/*"]}Typecheck only (with a bundler or tsx)
Section titled โTypecheck only (with a bundler or tsx)โ{ "extends": "@jmlweb/tsconfig-node", "compilerOptions": { "noEmit": true, "module": "ESNext", "moduleResolution": "bundler" }, "include": ["src/**/*"]}๐ Configuration Details
Section titled โ๐ Configuration DetailsโExtends @jmlweb/tsconfig-base and adds:
| Option | Value | Description |
|---|---|---|
lib |
["ES2022"] |
ES2022 APIs only, no DOM types |
All other options (strict, target: ES2022, module/moduleResolution: NodeNext, verbatimModuleSyntax, โฆ) come from the base config. With NodeNext, relative imports need .js extensions.
๐ฏ When to Use
Section titled โ๐ฏ When to Useโ- โ Node.js applications, APIs and services
- โ CLI tools and scripts
- โ Server-side libraries
Browser or React code: use @jmlweb/tsconfig-react. Need DOM types in Node.js (for example fetch typings): add "lib": ["ES2022", "DOM"].
๐ง Extending the Configuration
Section titled โ๐ง Extending the Configurationโ{ "extends": "@jmlweb/tsconfig-node", "compilerOptions": { "lib": ["ES2023"], "types": ["node"] }}๐ Usage with Scripts
Section titled โ๐ Usage with Scriptsโ{ "scripts": { "build": "tsc", "typecheck": "tsc --noEmit" }}npm run typecheck๐ Requirements
Section titled โ๐ Requirementsโ- Node.js >= 22.12.0
- TypeScript >= 5.0.0
๐ฆ Peer Dependencies
Section titled โ๐ฆ Peer Dependenciesโ@jmlweb/tsconfig-base(^2.0.0)typescript(>=5.0.0)
๐ Related Packages
Section titled โ๐ Related Packagesโ@jmlweb/tsconfig-base- base config extended by this package@jmlweb/oxlint-config-node- Oxlint configuration for Node.js (recommended)@jmlweb/oxfmt-config-base- Oxfmt configuration (recommended)
๐ Migration Guide
Section titled โ๐ Migration Guideโ1.x โ 2.0.0
Section titled โ1.x โ 2.0.0โBreaking: Node.js >=22.12.0 is now required (Node.js 18 and 20 are end-of-life).
- Upgrade Node.js to 22.12.0 or later.
- Update the package:
npm install --save-dev @jmlweb/tsconfig-node@^2.0.0.
The compilerOptions are unchanged. See the Changelog.
๐ License
Section titled โ๐ LicenseโMIT