A base TSConfig for working with Node 12.
npx @tessl/cli install tessl/npm-tsconfig--node12@12.1.0@tsconfig/node12 provides a base TypeScript configuration optimized for Node.js 12 runtime environments. It defines compiler options that align with Node 12's JavaScript capabilities, ensuring strict type checking while maintaining compatibility with Node 12's module system and available ECMAScript features.
npm install --save-dev @tsconfig/node12This package is consumed through TypeScript configuration extension rather than code imports:
{
"extends": "@tsconfig/node12/tsconfig.json"
}# Install the package
npm install --save-dev @tsconfig/node12// tsconfig.json
{
"extends": "@tsconfig/node12/tsconfig.json",
"compilerOptions": {
// Your additional or overridden options
"outDir": "./dist",
"baseUrl": "./src"
}
}@tsconfig/node12 follows the TSConfig base pattern where:
extends property in user tsconfig.json filesThe main configuration object that provides Node.js 12-optimized TypeScript compiler settings.
{
"$schema": "https://json.schemastore.org/tsconfig",
"display": "Node 12",
"_version": "12.1.0",
"compilerOptions": {
"lib": ["es2019", "es2020.promise", "es2020.bigint", "es2020.string"],
"module": "node16",
"target": "es2019",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"moduleResolution": "node16"
}
}JSON schema reference for TypeScript configuration validation.
{
"$schema": "https://json.schemastore.org/tsconfig"
}Human-readable display name for this configuration.
{
"display": "Node 12"
}Internal version identifier for this configuration base.
{
"_version": "12.1.0"
}Core TypeScript compiler configuration optimized for Node.js 12.
{
"compilerOptions": {
"lib": string[],
"module": string,
"target": string,
"strict": boolean,
"esModuleInterop": boolean,
"skipLibCheck": boolean,
"moduleResolution": string
}
}JavaScript language features available in Node.js 12 environment.
{
"lib": ["es2019", "es2020.promise", "es2020.bigint", "es2020.string"]
}Features included:
es2019: Core ES2019 features (Array.flat, Object.fromEntries, etc.)es2020.promise: Promise.allSettled and related Promise featureses2020.bigint: BigInt support for large integer operationses2020.string: String.matchAll and related string methodsModule system and resolution settings for Node.js compatibility.
{
"module": "node16",
"moduleResolution": "node16"
}ECMAScript target version matching Node.js 12 capabilities.
{
"target": "es2019"
}Strict type checking and interoperability settings.
{
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true
}Settings explained:
strict: Enables all strict type checking options for maximum type safetyesModuleInterop: Enables interoperability between CommonJS and ES modulesskipLibCheck: Skips type checking of declaration files for faster compilationThe complete TypeScript configuration structure that can be extended.
interface TSConfig {
$schema?: string;
display?: string;
_version?: string;
compilerOptions: CompilerOptions;
extends?: string | string[];
// Additional tsconfig properties can be added by extending projects
}
interface CompilerOptions {
lib?: string[];
module?: string;
target?: string;
strict?: boolean;
esModuleInterop?: boolean;
skipLibCheck?: boolean;
moduleResolution?: string;
// Additional compiler options can be added by extending projects
}{
"extends": "@tsconfig/node12/tsconfig.json"
}{
"extends": "@tsconfig/node12/tsconfig.json",
"compilerOptions": {
"outDir": "./dist",
"baseUrl": "./src",
"paths": {
"@/*": ["./src/*"]
}
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist"]
}Since TypeScript 5.0+, you can extend from multiple configurations:
{
"extends": [
"@tsconfig/node12/tsconfig.json",
"@tsconfig/strictest/tsconfig.json"
]
}{
"extends": "@tsconfig/node12/tsconfig.json",
"compilerOptions": {
"outDir": "./build",
"baseUrl": ".",
"paths": {
"~/*": ["./src/*"]
},
"declaration": true,
"declarationMap": true
},
"include": [
"src/**/*.ts",
"types/**/*.ts"
],
"exclude": [
"node_modules",
"build",
"**/*.test.ts"
]
}