TS2691: An import path cannot end with a .ts extension - in CI
You wrote an import specifier ending in .ts, which TypeScript rejects unless allowImportingTsExtensions is set.
What this error means
Type-checking fails with TS2691 suggesting you drop the extension.
tsc
src/app.ts(2,21): error TS2691: An import path cannot end with a '.ts' extension. Consider importing './utils' instead.Common causes
How to fix it
Drop the .ts extension
- Import without the extension (or use .js for nodenext ESM resolution)
ts
import { x } from './utils'Opt in to .ts imports (noEmit setups)
- Set allowImportingTsExtensions with noEmit when a bundler handles emit
tsconfig.json
{
"compilerOptions": {
"allowImportingTsExtensions": true,
"noEmit": true
}
}How to prevent it
- Import without source extensions unless your toolchain explicitly enables .ts specifiers.
Frequently asked questions
What causes "TS2691 import path .ts"?
Type-checking fails with TS2691 suggesting you drop the extension.
How do I fix TS2691 import path .ts?
Drop the .ts extension
Related guides
TS2307: Cannot find module - in CIFix "error TS2307: Cannot find module 'x' or its corresponding type declarations" when tsc runs in CI - a mis…
TS2792: Cannot find module - try moduleResolution node - in CIFix "error TS2792: Cannot find module 'x'. Did you mean to set the 'moduleResolution' option to 'nodenext', o…
TS2688: Cannot find type definition file for - in CIFix "error TS2688: Cannot find type definition file for 'x'" when tsc runs in CI - a types entry that is not…