TypeScript Compiler Options

allowArbitraryExtensions — TypeScript compiler option

Permits unfamiliar import extensions with a corresponding declaration such as app.d.css.ts. An asset loader is still needed at runtime. Default (5.8.3): false. Create the labeled files in an isolated project and run tsc -p tsconfig.json. No diagnostics; output: none. Local project fixture, not a single-file editor.

Formal Syntax & Structure

typescript syntaxtypescript
{  "compilerOptions": {    "allowArbitraryExtensions": true  }}

Parameters & Attributes

NameTypeDescription
allowArbitraryExtensionsbooleanSet in compilerOptions; default: false.

Working Example

Example Snippettypescript
// File: tsconfig.json (omit this label){  "compilerOptions": {    "target": "ES2022",    "module": "NodeNext",    "strict": true,    "types": [],    "noEmitOnError": true,    "noEmit": true,    "allowArbitraryExtensions": true  },  "files": [    "main.mts",    "app.d.css.ts"  ]}// File: main.mtsimport { style } from "./app.css";const name: string = style.name;// File: app.d.css.tsexport declare const style: { name: string };
TypeScript Reference