Reconstructing TS source so tsc emits byte-identical JS and .d.ts
When rebuilding lost .ts from shipped tsc output, most whitespace is irrelevant because the printer re-indents, but a few layout choices survive and must match: a newline before/after a binary operator, before ? and : in a conditional, or before . in a method chain is preserved (as 0 or 1 line), and array/object literals keep their per-element line layout and trailing comma, while call arguments and parameter lists always collapse to one line with trailing commas dropped. Arrow functions keep (x) => vs x => (any typed param forces parens). A file-header block comment shows up in the .d.ts only when a blank line separates it from the first statement; otherwise it is attached to the first import, which the .d.ts usually elides. Doc comments on interfaces and type aliases vanish from the JS, so the .d.ts is the only source for them. For huge data files, map the non-blank source lines 1:1 onto the emitted JS, diff old vs shipped JS, and apply the hunks back onto the source while keeping its original indentation.