cat > tsconfig-debian.json <<'EOF'
{
  "compilerOptions": {
    "target": "es5",
    "downlevelIteration": true,
    "module": "commonjs",
    "declaration": true,
    "sourceMap": true,
    "outDir": "build-out",
    "strict": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "noImplicitReturns": true,
    "noFallthroughCasesInSwitch": true,
    "lib": ["es2016", "dom"],
    "types": [],
    "skipLibCheck": true
  },
  "include": ["src/**/*.ts"]
}
EOF
tsc -p tsconfig-debian.json
# Mirror the build output flat into the package root, like the original `tsc --outDir .` did
cp -r build-out/* . 2>/dev/null || true
rm -rf build-out tsconfig-debian.json
