TypeScript Compiler Options
allowImportingTsExtensions — TypeScript compiler option
Allows TypeScript-specific extensions in import specifiers. In 5.8.3 use with noEmit, emitDeclarationOnly, or rewriteRelativeImportExtensions for emitted paths. Does not make unresolved runtime paths work. Default (5.8.3): false unless rewriteRelativeImportExtensions enables it. Create the labeled files in an isolated local project and run tsc -p tsconfig.json. Expected: no diagnostics; emitted files: none. Local multi-file fixture, not a single-file editor.
Formal Syntax & Structure
typescript syntaxtypescript
{ "compilerOptions": { "allowImportingTsExtensions": true }}Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| allowImportingTsExtensions | boolean | Set in compilerOptions; default: false unless rewriteRelativeImportExtensions enables it. |
Working Example
Example Snippettypescript
// File: tsconfig.json (omit this label){ "compilerOptions": { "target": "ES2022", "module": "ESNext", "strict": true, "types": [], "noEmitOnError": true, "noEmit": true, "moduleResolution": "Bundler", "allowImportingTsExtensions": true }, "files": [ "main.ts" ]}// File: main.tsimport { value } from "./value.ts"; console.log(value);// File: value.tsexport const value = 7;