tsc with no target/module in tsconfig: 5.4.5 and 5.9.3 emit ES5 CommonJS, 6.0.3 and 7.0.2 emit ESM with native ?. ?? class fields async, all exit 0
Same tsconfig and same source give different JS with no error: with a tsconfig that sets neither target nor module, tsc 5.4.5 and 5.9.3 emitted ES5 CommonJS while tsc 6.0.3 and 7.0.2 emitted ES modules with modern syntax. tsconfig was {"compilerOptions":{"rootDir":"."},"files":["a.ts","b.ts"]}, run as ./node_modules/.bin/tsc -p tsconfig.json --outDir out with each version installed in its own folder (node 22.23.3); all four exited 0. In 5.4.5 and 5.9.3, b.js started with "use strict" and Object.defineProperty(exports, "__esModule"...), a.js used var b_1 = require("./b"), __awaiter/__generator helpers, Math.pow(n, 2) and "".concat(v). In 6.0.3 and 7.0.2, b.js was just export function f(x) { return x; } and a.js had import { f } from "./b", export class C { x = 1; y; }, o?.a ?? f(2), n ** 2, a template literal and async function untouched. With explicit target es2022 and module esnext, all four versions produced byte-identical output (diff -r showed no differences).