CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-tsconfig--node14

A base TSConfig for working with Node 14.

84

1.05x
Overview
Eval results
Files

task.mdevals/scenario-8/

Node.js TypeScript Configuration Manager

Build a command-line tool that generates appropriate TypeScript configuration files for different Node.js runtime versions.

Requirements

Your tool should accept a Node.js version number as input and generate a tsconfig.json file with compiler options appropriate for that Node.js version. The tool should support Node.js versions from 10 through 24, as well as a special "lts" mode that targets the current LTS version.

Version-Specific Configuration Rules

Different Node.js versions support different ECMAScript features and module systems. Your tool should apply the following rules:

Target ECMAScript Version:

  • Node 10-11: Use ES2018
  • Node 12-13: Use ES2019
  • Node 14-15: Use ES2020
  • Node 16: Use ES2021
  • Node 17-21: Use ES2022
  • Node 22+: Use ES2023

Module System:

  • Node 10-15: Use CommonJS module format
  • Node 16-21: Use Node16 module format
  • Node 22+: Use NodeNext module format

Module Resolution:

  • Node 10-15: Use "node" resolution strategy
  • Node 16+: Use "node16" resolution strategy

Library Definitions:

  • All versions should include appropriate ES library definitions matching the target version
  • Node 22+ should also include cutting-edge library features: "ESNext.Array", "ESNext.Collection", "ESNext.Iterator", "ESNext.Promise"

Core Configuration

All generated configurations must include these foundational options:

  • Strict type checking enabled
  • Skip library checking for build performance
  • ES module interoperability enabled

Input and Output

The tool should:

  • Accept a Node.js version as a command-line argument (e.g., "14", "20", "lts")
  • Generate a properly formatted tsconfig.json file in the current directory
  • Handle invalid version inputs gracefully with clear error messages

Test Cases

  • When run with Node version 14, it generates a config with ES2020 target and CommonJS modules @test
  • When run with Node version 20, it generates a config with ES2022 target and Node16 modules @test
  • When run with Node version 22, it generates a config with ES2023 target, NodeNext modules, and ESNext library features @test
  • When run with an invalid version like "99", it displays an error message @test

@generates

API

/**
 * Generates a TypeScript configuration for a specific Node.js version
 */
export function generateConfig(nodeVersion: string): object;

/**
 * Main entry point for the CLI tool
 */
export function main(args: string[]): void;

Dependencies { .dependencies }

@tsconfig/node14 { .dependency }

Provides TypeScript configuration for Node.js 14.

@tsconfig/node20 { .dependency }

Provides TypeScript configuration for Node.js 20.

@tsconfig/node22 { .dependency }

Provides TypeScript configuration for Node.js 22.

Install with Tessl CLI

npx tessl i tessl/npm-tsconfig--node14

tile.json