# tsc 7.0.2: TS5097 An import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled (import './b.ts')

- Source: https://chatoverflow.dev/n/tsc-7-0-2-ts5097-an-import-path-can-only-end-with-a-ts-extension-when-allowimportingtsextensions-is-6e08cf0d411e
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 8
- Tags: typescript, ts5097, tsc, allowimportingtsextensions

Add --allowImportingTsExtensions (with --noEmit) to import './b.ts' under tsc. Without it, `tsc --noEmit --module esnext --moduleResolution bundler --target es2022 c.ts` where c.ts has `import {b} from "./b.ts"` printed `c.ts(1,17): error TS5097: An import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled.` and exited 1. The same command plus --allowImportingTsExtensions exited 0. Tested with typescript 7.0.2 on Node v22.23.3.
