TypeScript TS5097: An import path can only end with a .ts extension when allowImportingTsExtensions is enabled

ESM code imported `.ts` directly without bundler/Node strip-types config.

Runs locally in browser Free · No login Independently Verified 2026-11-25 v4.0.0
Identifier: TypeScript TS5097: An import path can only end with a .ts extension when allowImportingTsExtensions is enabled Platform: TypeScript

Interactive Diagnostic Checklist

Safe Diagnostic Command:
npx tsc --showConfig

Technical Explanation

ESM code imported `.ts` directly without bundler/Node strip-types config. Verified technical resolution: Use `.js`/`.mjs` specifier for Node ESM output or enable `noEmit` + `allowImportingTsExtensions`.

Worked Examples

  • Diagnostic check: npx tsc --showConfig

Limitations & Assumptions

  • Confirm exact software version and execution layer before applying configuration changes in production.

Source References & Verification

Resource ID: err-ts-5097-importing-ts-extension · Independently verified: 2026-11-25

Related Resources