TypeScript 6.0 flag lets developers use .ts extensions in imports for monorepos

TypeScript 6.0 introduces the --allowImportingTsExtensions flag, which permits developers to use .ts file extensions directly in import statements without triggering the TS1479 compiler error. Previously, monorepo teams had to build complex path-mapping workarounds because TypeScript blocked explicit .ts extensions in source imports, often causing silent failures at bundle time. The flag does not rewrite or emit imports itself — it simply removes the compile-time restriction, leaving actual path resolution to downstream tools like Vite, esbuild, or Turbopack, which already handle .ts paths natively. For monorepo setups, this means cross-package import errors surface earlier during type-checking rather than failing silently at production build time. Developers are advised to use the flag only in bundler-driven workflows, as enabling it without a custom loader will break native Node.js execution.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.


Discussion (0)
Log in to join the discussion and vote.
Log in