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-3/

Modern TypeScript Module Configuration

Build a TypeScript configuration validation tool that helps developers migrate to modern TypeScript compiler features. The tool should check project configurations and validate they use appropriate cutting-edge TypeScript settings.

Requirements

Create a TypeScript module that validates TypeScript configuration objects against modern compiler features. The validator should:

  1. Configuration Validation: Accept a TypeScript configuration object and validate it contains specific modern compiler options
  2. Feature Detection: Identify which cutting-edge TypeScript features are enabled in a given configuration
  3. Compatibility Checking: Verify that configurations meet minimum TypeScript version requirements for specific features
  4. Recommendations: Suggest missing modern features that could improve type safety and build performance

Specific Validation Rules

The tool should validate these modern TypeScript compiler options:

  • rewriteRelativeImportExtensions: Ensures imports are automatically rewritten from .ts to .js
  • verbatimModuleSyntax: Enforces explicit type-only imports
  • noUncheckedSideEffectImports: Validates all imports have proper side effects
  • allowImportingTsExtensions: Allows direct .ts file imports (for bundler environments)
  • erasableSyntaxOnly: Ensures only type-erasable syntax is used

Version Requirements

  • rewriteRelativeImportExtensions: Requires TypeScript 5.7+
  • erasableSyntaxOnly: Requires TypeScript 5.8+
  • noUncheckedSideEffectImports: Requires TypeScript 5.9+

Capabilities

Validates configuration structure

  • Given an empty object {}, the validator returns an error indicating no configuration options found @test
  • Given a config with only strict: true, the validator accepts it but reports zero modern features enabled @test

Detects cutting-edge TypeScript features

  • Given a config with rewriteRelativeImportExtensions: true, the validator identifies it as a TypeScript 5.7+ feature @test
  • Given a config with erasableSyntaxOnly: true, the validator identifies it as a TypeScript 5.8+ feature @test
  • Given a config with both verbatimModuleSyntax: true and noUncheckedSideEffectImports: true, the validator identifies both modern features @test

Checks version compatibility

  • Given a config with rewriteRelativeImportExtensions: true and TypeScript version "5.6.0", the validator reports a version compatibility error @test
  • Given a config with erasableSyntaxOnly: true and TypeScript version "5.8.0", the validator accepts the configuration @test

Provides recommendations

  • Given a minimal config without modern features, the validator suggests enabling verbatimModuleSyntax for better tree-shaking @test
  • Given a config with allowImportingTsExtensions: true but missing noEmit: true, the validator warns that bundler mode requires noEmit @test

Implementation

@generates

API

/**
 * TypeScript configuration object to validate
 */
export interface TSConfig {
  compilerOptions?: {
    rewriteRelativeImportExtensions?: boolean;
    verbatimModuleSyntax?: boolean;
    noUncheckedSideEffectImports?: boolean;
    allowImportingTsExtensions?: boolean;
    erasableSyntaxOnly?: boolean;
    noEmit?: boolean;
    strict?: boolean;
    [key: string]: any;
  };
  [key: string]: any;
}

/**
 * Result of configuration validation
 */
export interface ValidationResult {
  valid: boolean;
  errors: string[];
  warnings: string[];
  modernFeaturesDetected: {
    feature: string;
    minVersion: string;
  }[];
  recommendations: string[];
}

/**
 * Validates a TypeScript configuration and checks for modern compiler features
 *
 * @param config - The TypeScript configuration object to validate
 * @param tsVersion - The TypeScript version being used (e.g., "5.8.0")
 * @returns Validation result with errors, warnings, detected features, and recommendations
 */
export function validateConfig(
  config: TSConfig,
  tsVersion: string
): ValidationResult;

Dependencies { .dependencies }

@tsconfig/bases { .dependency }

Provides reference TypeScript configurations with cutting-edge compiler features.

@satisfied-by

Install with Tessl CLI

npx tessl i tessl/npm-tsconfig--node14

tile.json