Downlevel TypeScript Declarations
This feature allows you to downlevel TypeScript declaration files to a specified TypeScript version. In this example, the input .d.ts file is downleveled to TypeScript version 3.7 and written to the output file.
const downlevelDts = require('downlevel-dts');
const fs = require('fs');
const inputFilePath = 'path/to/input.d.ts';
const outputFilePath = 'path/to/output.d.ts';
const inputDts = fs.readFileSync(inputFilePath, 'utf8');
const outputDts = downlevelDts(inputDts, '3.7');
fs.writeFileSync(outputFilePath, outputDts);