Closed
Description
Compare https://github.com/sandersn/downlevel-dts/blob/0eb977fcbdbd16f5e738a046c8c3d9c59537b5dd/test/test.d.ts#L1 to
https://github.com/sandersn/downlevel-dts/blob/0eb977fcbdbd16f5e738a046c8c3d9c59537b5dd/baselines/ts3.4/test.d.ts#L1
The code that produces this erroneous output is pretty simple:
Here's a simplified version:
const program = ts.createProgram(['./test.d.ts'], {});
const files = program.getRootFileNames().map(program.getSourceFile);
const printer = ts.createPrinter({
newLine: ts.NewLineKind.CarriageReturnLineFeed
});
for (const f of files) {
console.log(printer.printFile(f));
}
Create test.d.ts
with the following text:
/// <reference types="node" />
/// <reference path="./src/test.d.ts" />
I also tested with multiple triple-slash references; in that case, all references are duplicated.