A base TSConfig for working with Node 20
npx @tessl/cli install tessl/npm-tsconfig--node20@1.0.0@tsconfig/node20 provides a base TypeScript configuration optimized for Node.js 20 applications. It includes pre-configured compiler options with ES2023 library support, NodeNext module system, ES2022 target, strict type checking, and proper ES module interoperability.
npm install --save-dev @tsconfig/node20TypeScript configuration packages are used through the extends mechanism in tsconfig.json files:
{
"extends": "@tsconfig/node20/tsconfig.json"
}The package provides a single configuration file that can be extended in any TypeScript project. No direct code imports are required - the configuration is applied automatically by the TypeScript compiler.
Create or update your project's tsconfig.json:
{
"extends": "@tsconfig/node20/tsconfig.json",
"compilerOptions": {
// Your additional options here
"outDir": "./dist",
"rootDir": "./src"
},
"include": [
"src/**/*"
],
"exclude": [
"node_modules",
"dist"
]
}Alternative installation via Yarn:
yarn add --dev @tsconfig/node20@tsconfig/node20 follows the TypeScript configuration inheritance model:
extends field to inherit configurationsThe architecture enables:
Extends the provided Node.js 20 optimized TypeScript configuration through the TypeScript extends mechanism.
Usage in tsconfig.json:
{
"extends": "@tsconfig/node20/tsconfig.json"
}The base configuration provides the following compiler options:
{
"$schema": "https://json.schemastore.org/tsconfig",
"display": "Node 20",
"_version": "20.1.0",
"compilerOptions": {
"lib": ["es2023"],
"module": "nodenext",
"target": "es2022",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"moduleResolution": "node16"
}
}The package configures TypeScript for optimal Node.js 20 development:
{
"lib": ["es2023"]
}Includes ES2023 standard library features for modern JavaScript functionality.
{
"module": "nodenext",
"moduleResolution": "node16"
}Configures Node.js ESM support with modern module resolution.
{
"target": "es2022"
}Targets ES2022 features compatible with Node.js 20.
{
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true
}Enables strict type checking with ES module interoperability and optimized compilation.
{
"$schema": "https://json.schemastore.org/tsconfig",
"display": "Node 20",
"_version": "20.1.0"
}{
"compilerOptions": {
"lib": ["es2023"],
"module": "nodenext",
"target": "es2022",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"moduleResolution": "node16"
}
}Typical project structure when using @tsconfig/node20:
project/
├── src/
│ ├── index.ts
│ └── utils/
├── tsconfig.json
└── package.jsonExample tsconfig.json extending the base configuration:
{
"extends": "@tsconfig/node20/tsconfig.json",
"compilerOptions": {
"outDir": "./dist",
"rootDir": "./src",
"declaration": true,
"sourceMap": true
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist", "**/*.test.ts"]
}The extends field tells TypeScript to inherit all configuration options from @tsconfig/node20, then apply any additional or overriding options specified in the local configuration.
Compatible with standard TypeScript build tools:
# Direct TypeScript compilation
npx tsc
# With build scripts in package.json
npm run buildWorks seamlessly with:
The TypeScript compiler will validate the extended configuration and report errors for invalid options or conflicts.
If module resolution fails, ensure your Node.js version supports the configured module system:
.mjs extension or "type": "module" in package.json for .js filesskipLibCheck: true (already enabled)