Skip to content

allowArbitraryExtensions does not work as expectedΒ #55507

Closed
@indooorsman

Description

@indooorsman

πŸ”Ž Search Terms

allowArbitraryExtensions

πŸ•— Version & Regression Information

  • This is unexpected error from Typescript@5.0

⏯ Playground Link

https://codesandbox.io/p/sandbox/typescript-playground-export-forked-mfz7rg?file=/index.ts:10,28

πŸ’» Code

import {} from "./app.css";

export {};

my tsconfig.json

{
  "compileOnSave": false,
  "compilerOptions": {
    "module": "ESNext",
    "target": "ESNext",
    "lib": [
      "ESNext",
      "DOM",
      "DOM.Iterable"
    ],
    "moduleResolution": "bundler",
    "customConditions": [
      "dev"
    ],
    "jsx": "react-jsx",
    "declaration": true,
    "emitDeclarationOnly": true,
    "isolatedModules": true,
    "strict": true,
    "allowJs": true,
    "skipDefaultLibCheck": true,
    "skipLibCheck": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "allowArbitraryExtensions": true,
    "allowImportingTsExtensions": true,
    "resolveJsonModule": true,
    "sourceMap": false,
    "rootDirs": [
      "./src",
      "./esm"
    ],
    "outDir": "./esm"
  },
  "include": [
    "./src/**/*"
  ]
}

πŸ™ Actual behavior

I have set allowArbitraryExtensions to true, but it still throw error when import a .css file.
As mentioned in document:

you can suppress the error with the new --allowArbitraryExtensions compiler option.

πŸ™‚ Expected behavior

should not throw error

Additional information about the issue

issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions