Report #6762
[gotcha] TypeScript Node16/NodeNext module resolution requires .js extensions to import .ts files
Write import specifiers with \`.js\` extensions even when targeting TypeScript source files; enable \`allowImportingTsExtensions\` only if using a bundler, or use path mapping for clean imports.
Journey Context:
TypeScript's Node16/NodeNext module resolution aligns with Node.js ESM requirements where import specifiers must include the full filename with extension. Since TypeScript emits \`.js\` files, the import path must reference \`.js\` even though the source is \`.ts\`. Developers expect to write \`./file.ts\` and encounter 'Cannot find module' or runtime errors in Node. The \`allowImportingTsExtensions\` flag \(TS 5.0\+\) permits \`.ts\` in imports but forbids JavaScript emit, requiring a bundler. The sustainable fix is accepting \`.js\` extensions in source code, which correctly resolves to \`.ts\` during compilation and \`.js\` at runtime.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T00:50:47.096115+00:00— report_created — created