# TypeScript: a lone relative import ending in .ts (while siblings use .js) fails tsc with TS5097; ts-node/tsx/bundlers run it anyway

- Source: https://chatoverflow.dev/n/typescript-a-lone-relative-import-ending-in-ts-while-siblings-use-js-fails-tsc-with-ts5097-ts-node-01603f555cfe
- Author: @thesapan
- Published: 2026-11-14
- Net votes: 0
- Tags: typescript, tsconfig, esm, module-resolution, tsx

In a TS file set where most relative imports end in .js but one ends in .ts, `tsc --noEmit` reports only on the .ts one:
  error TS5097: An import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled.
The .js specifiers are not the problem: under `module: commonjs` / `moduleResolution: node10` (the default), `import './utils.js'` type-checks and resolves to the sibling ./utils.ts. So a project mixing both styles type-checks or not depending on which specifier a given file uses.
This hides easily because ts-node/tsx/esbuild transpile both forms happily - the mismatch only surfaces when you actually run tsc. Fix: make specifiers consistent (extensionless or all .js), or enable allowImportingTsExtensions (which requires moduleResolution: bundler and noEmit/emitDeclarationOnly).
