or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

index.md
tile.json

tessl/npm-tsconfig--node14

A base TSConfig for working with Node 14.

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/@tsconfig/node14@14.1.x

To install, run

npx @tessl/cli install tessl/npm-tsconfig--node14@14.1.0

index.mddocs/

@tsconfig/node14

A base TypeScript configuration optimized for Node.js 14 runtime environment. This package provides sensible compiler defaults for projects targeting Node.js 14, including ES2020 language features, node16 module resolution, and strict type checking enabled.

Package Information

  • Package Name: @tsconfig/node14
  • Package Type: npm
  • Language: JSON (TypeScript configuration)
  • Installation: npm install --save-dev @tsconfig/node14 or yarn add --dev @tsconfig/node14

Core Imports

This package is not imported as a module but rather extended through TypeScript's configuration system:

{
  "extends": "@tsconfig/node14/tsconfig.json"
}

Basic Usage

Create or update your project's tsconfig.json file to extend this base configuration:

{
  "extends": "@tsconfig/node14/tsconfig.json",
  "compilerOptions": {
    // Your custom overrides here
    "outDir": "./dist",
    "rootDir": "./src"
  },
  "include": ["src/**/*"],
  "exclude": ["node_modules", "dist"]
}

The base configuration will provide all the Node.js 14 optimized compiler options, which you can then customize with additional options or overrides as needed.

Capabilities

Base TypeScript Configuration

Provides a complete TypeScript compiler configuration optimized for Node.js 14 runtime with modern JavaScript features and strict type checking.

{
  "$schema": "https://json.schemastore.org/tsconfig",
  "display": "Node 14",
  "_version": "14.1.0",
  "compilerOptions": {
    "lib": ["es2020"],
    "module": "node16",
    "target": "es2020",
    "strict": true,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "moduleResolution": "node16"
  }
}

Configuration Properties:

  • $schema: "https://json.schemastore.org/tsconfig" - JSON schema for IDE validation and autocomplete
  • display: "Node 14" - Human-readable name for this configuration
  • _version: "14.1.0" - Internal version tracking for the configuration
  • compilerOptions: Core TypeScript compiler settings
    • lib: ["es2020"] - Available ECMAScript library features (ES2020 APIs)
    • module: "node16" - Module system (Node.js 16+ style module resolution with package.json "type" support)
    • target: "es2020" - JavaScript output target (ES2020 syntax and features)
    • strict: true - Enables all strict type-checking options for better code quality
    • esModuleInterop: true - Enables seamless interoperability between CommonJS and ES modules
    • skipLibCheck: true - Skips type checking of declaration files for faster compilation
    • moduleResolution: "node16" - Uses Node.js 16+ module resolution algorithm

Configuration Extension

The configuration is designed to be extended by consumer projects through TypeScript's built-in configuration inheritance system.

{
  "extends": "@tsconfig/node14/tsconfig.json"
}

Extension Behavior:

  • Consumer configurations inherit all compiler options from this base
  • Consumer can override any inherited option by specifying it in their own compilerOptions
  • Consumer can add additional options not present in the base configuration
  • Arrays in compilerOptions (like lib) are replaced entirely, not merged

Override Examples:

{
  "extends": "@tsconfig/node14/tsconfig.json",
  "compilerOptions": {
    // Override target to older version if needed
    "target": "es2018",
    // Add additional libraries
    "lib": ["es2020", "dom"],
    // Add output directory
    "outDir": "./build",
    // Enable source maps for debugging
    "sourceMap": true
  }
}

Multiple Configuration Extension

Can be combined with other @tsconfig packages using TypeScript 5.0+ multiple extends feature:

{
  "extends": [
    "@tsconfig/node14/tsconfig.json",
    "@tsconfig/strictest/tsconfig.json"
  ]
}

Combination Rules:

  • Later configurations in the array override earlier ones
  • Each configuration's compilerOptions are merged in order
  • Final configuration is the result of all merged settings

Types

TypeScript Configuration Schema

The package provides a JSON configuration file that conforms to the TypeScript configuration schema:

interface TSConfig {
  /** JSON schema reference for validation */
  $schema?: string;
  /** Human-readable display name */
  display?: string;
  /** Internal version tracking */
  _version?: string;
  /** TypeScript compiler options */
  compilerOptions?: CompilerOptions;
  /** Base configurations to extend from */
  extends?: string | string[];
  /** Files to include in compilation */
  include?: string[];
  /** Files to exclude from compilation */
  exclude?: string[];
  /** Specific files to compile */
  files?: string[];
}

interface CompilerOptions {
  /** ECMAScript library features to include */
  lib?: string[];
  /** Module system to use */
  module?: string;
  /** JavaScript output target */
  target?: string;
  /** Enable all strict type-checking options */
  strict?: boolean;
  /** Enable ES module interoperability */
  esModuleInterop?: boolean;
  /** Skip type checking of declaration files */
  skipLibCheck?: boolean;
  /** Module resolution strategy */
  moduleResolution?: string;
  /** Output directory for compiled files */
  outDir?: string;
  /** Root directory of source files */
  rootDir?: string;
  /** Generate source maps */
  sourceMap?: boolean;
  /** Generate declaration files */
  declaration?: boolean;
  /** Other compiler options... */
  [key: string]: any;
}

Node.js 14 Compatibility

This configuration is specifically optimized for Node.js 14.x runtime environment:

Language Features:

  • ES2020: Full support for ES2020 JavaScript features including optional chaining, nullish coalescing, BigInt, and dynamic imports
  • Node.js 14 APIs: Access to Node.js 14 built-in modules and APIs through ES2020 lib definitions

Module Support:

  • node16 Module Resolution: Modern Node.js module resolution supporting both CommonJS and ES modules
  • Package.json "type" Field: Respects package.json "type" field for determining module format
  • Conditional Exports: Supports package.json "exports" field for conditional module exports

Performance Optimizations:

  • skipLibCheck: Faster compilation by skipping type checking of .d.ts files
  • Strict Mode: Better optimization opportunities through strict type checking

Installation and Setup

Installation

Install as a development dependency:

# npm
npm install --save-dev @tsconfig/node14

# yarn  
yarn add --dev @tsconfig/node14

# pnpm
pnpm add --save-dev @tsconfig/node14

Project Setup

  1. Create a tsconfig.json in your project root:
{
  "extends": "@tsconfig/node14/tsconfig.json",
  "compilerOptions": {
    "outDir": "./dist",
    "rootDir": "./src"
  },
  "include": ["src/**/*"],
  "exclude": ["node_modules", "dist"]
}
  1. Ensure your project targets Node.js 14 or higher in package.json:
{
  "engines": {
    "node": ">=14.0.0"
  }
}
  1. Your TypeScript code can now use ES2020 features and Node.js 14 APIs with full type support.

Error Handling

Common Configuration Issues

Module Resolution Errors:

  • Ensure your project structure aligns with the chosen module resolution strategy
  • Check that package.json "type" field matches your import/export syntax
  • Verify that dependencies support the selected module format

Compilation Errors:

  • If targeting older Node.js versions, consider overriding "target" and "lib" options
  • Some ES2020 features may require additional polyfills in runtime environments
  • Check that all imported modules are compatible with ES2020 and Node.js 14

Type Checking Issues:

  • The strict mode settings may reveal previously hidden type errors
  • Consider gradually enabling strict options if migrating from a looser configuration
  • Use type assertions or proper typing to resolve strict mode conflicts

Configuration Validation

TypeScript will validate the configuration and report errors for:

  • Invalid compiler option values
  • Conflicting option combinations
  • Missing required dependencies for specific features
  • Incompatible option combinations with the selected target/module settings