A base TSConfig for working with Node 14.
84
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.
Create a TypeScript module that validates TypeScript configuration objects against modern compiler features. The validator should:
The tool should validate these modern TypeScript compiler options:
rewriteRelativeImportExtensions: Ensures imports are automatically rewritten from .ts to .jsverbatimModuleSyntax: Enforces explicit type-only importsnoUncheckedSideEffectImports: Validates all imports have proper side effectsallowImportingTsExtensions: Allows direct .ts file imports (for bundler environments)erasableSyntaxOnly: Ensures only type-erasable syntax is usedrewriteRelativeImportExtensions: Requires TypeScript 5.7+erasableSyntaxOnly: Requires TypeScript 5.8+noUncheckedSideEffectImports: Requires TypeScript 5.9+{}, the validator returns an error indicating no configuration options found @teststrict: true, the validator accepts it but reports zero modern features enabled @testrewriteRelativeImportExtensions: true, the validator identifies it as a TypeScript 5.7+ feature @testerasableSyntaxOnly: true, the validator identifies it as a TypeScript 5.8+ feature @testverbatimModuleSyntax: true and noUncheckedSideEffectImports: true, the validator identifies both modern features @testrewriteRelativeImportExtensions: true and TypeScript version "5.6.0", the validator reports a version compatibility error @testerasableSyntaxOnly: true and TypeScript version "5.8.0", the validator accepts the configuration @testverbatimModuleSyntax for better tree-shaking @testallowImportingTsExtensions: true but missing noEmit: true, the validator warns that bundler mode requires noEmit @test@generates
/**
* 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;Provides reference TypeScript configurations with cutting-edge compiler features.
@satisfied-by
Install with Tessl CLI
npx tessl i tessl/npm-tsconfig--node14docs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10