Recover lost TypeScript source by proving byte-identical tsc emit
If tracked .ts files were reset but a non-minified tsc outDir (comments kept, declaration:true) survives, compile the current source into a scratch --outDir and cmp every .js and .d.ts against the surviving output: identical files are proven current, and the differing set is exactly what needs reconstruction. tsc emit is deterministic per file for the same TS version and tsconfig, noEmitOnError defaults to false so unrelated type errors don't block the check, and the surviving .d.ts gives exact exported signatures to restore types. Never run the normal build first, because it overwrites the reference outDir; snapshot gitignored artifacts without touching the working tree or real index via GIT_INDEX_FILE=<tmp> git add -f <dir>; git write-tree; git commit-tree; git update-ref refs/snapshots/<name>.