Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

--allowImportingTsExtensions lets TypeScript imports include source extensions such as .ts, .mts, and .tsx. In a monorepo, it can support source-level imports when a bundler or TypeScript-capable runtime resolves those files. It does not link workspace packages or make emitted JavaScript able to load a .ts file. The option dates to TypeScript 5.0; it is useful in a TypeScript 6.0-era setup, but it was not introduced in 6.0.

What the option unlocks—and what it does not

Normally, TypeScript expects import specifiers to be meaningful to the eventual runtime or build output. The flag permits TypeScript source imports to name files with TypeScript-specific extensions, for example:

import { formatDate } from "./formatDate.ts";

This can be convenient when the tool consuming the code works directly with TypeScript source, such as a bundler that transpiles it or a runtime/loader that executes or transpiles TypeScript. TypeScript lists Node, Deno, and Bun as direct TypeScript runtime examples, and ts-node and tsx as transpiling loaders. The flag itself only changes what TypeScript permits; the host tool must still understand and resolve the import. See TypeScript’s option reference and its module theory guide.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • It does not create workspace links or configure package resolution.
  • It does not select the runtime’s resolver rules.
  • By itself, it does not turn a .ts import into a path that works in emitted JavaScript.

Why the emit constraint matters

TypeScript documents allowImportingTsExtensions for projects using noEmit or emitDeclarationOnly. In those modes, TypeScript is not producing JavaScript that would retain a source import such as ./formatDate.ts and then fail to find that file at runtime. A bundler or TypeScript runtime handles the source instead.

If your build emits JavaScript, enabling the flag alone is not enough. TypeScript 5.7 added rewriteRelativeImportExtensions, which rewrites relative .ts, .tsx, .mts, or .cts specifiers to their JavaScript equivalents in output. Check the exact supported combination and defaults for the compiler version you install; the TypeScript module theory documentation explains why output-compatible extensions matter.

Choose a setup based on who resolves the imports

Before enabling the option, identify whether your project checks TypeScript without emitting JavaScript, or emits JavaScript for a runtime to execute. Then match moduleResolution to the actual host. TypeScript documents bundler for bundlers and Bun; do not assume that a flag or resolution mode makes Node, a bundler, and other runtimes interchangeable.

Rank #2
TypeScript Programming Language - Software Engineer & Coder T-Shirt
  • TypeScript implements a superset of syntax for strictly typed development, facilitating deep static analysis and enhanced development environment integration. The compiler translates source into standard script formats, ensuring parity across any runtime.
  • TypeScript is ideal for front-end developers, full-stack engineers, and software architects who build large-scale web applications. It serves those looking to improve code excellence, reduce bugs through static checking, and maintain complex projects more.
  • Lightweight, Classic fit, Double-needle sleeve and bottom hem
Setup What handles the source import Configuration consideration
No-emit check with a bundler The bundler resolves and transpiles TypeScript source. Use a resolver mode that models the bundler; bundler is the documented choice for bundlers.
Direct TypeScript runtime or loader The runtime or loader resolves and executes or transpiles TypeScript. Confirm that the chosen host supports the import form and configure TypeScript resolution to match it.
JavaScript-emitting build The generated JavaScript is resolved by its eventual runtime. Use output-compatible specifiers or verify extension rewriting, including rewriteRelativeImportExtensions, for the installed compiler.

The table describes responsibilities, not a guarantee that every tool accepts every configuration. Verify the host’s behavior as well as TypeScript’s checks.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use workspaces for imports between monorepo packages

There are two different kinds of import to plan for: a relative import within one package, and an import from one package to another. The flag concerns TypeScript-extension specifiers; it does not replace package management for the second case.

For sibling packages, use npm, Yarn, or pnpm workspaces so the packages are linked into node_modules and resolved as packages. Import across the package boundary by its package name, with the package’s metadata participating in resolution. TypeScript’s ESM and Node.js guidance explains workspace-based package resolution.

A paths alias that points directly at another package’s source may be useful for some internal workflows, but it can bypass the package metadata and resolution path that consumers will use. If a package is intended for publication—or you want the monorepo to test its real package boundary—prefer workspace linking and package-name imports. Keep that choice separate from whether relative imports inside a package use .ts extensions.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Is this a TypeScript 6.0 feature?

No. The TSConfig reference identifies allowImportingTsExtensions as released in TypeScript 5.0. TypeScript 6.0 is relevant as the compiler context for 2026, not as the origin of this option. The TypeScript 6.0 release notes describe 6.0 as a transition release toward TypeScript 7.0 and cover other module changes.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.