how can I make typescript recognize css or svg files that exist while still warning about files that don't exist (without allegedly creating .d.css.ts or whatever AI is trying to claim)?
SuggestionOut of Scope
### 🔍 Search Terms
the title
### ✅ Viability Checklist
- [x] This wouldn't be a breaking change in existing TypeScript/JavaScript code
- [x] This wouldn't change the runtime behavior of existing JavaScript code
- [x] This could be implemented without emitting different JS based on the types of the expressions
- [x] This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
- [x] This isn't a request to add a new utility type: https://github.com/microsoft/TypeScript/wiki/No-New-Utility-Types
- [x] This feature would agree with the rest of our Design Goals: https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals
### ⭐ Suggestion
I want the wildcard module to warn about files that don't exist. Build tools resolve this normally. And typescript would too if the file ended in `.ts`. Allow importing arbitrary extensions does not make this error go away.
### 📃 Motivating Example
```ts
import warningIcon from "@material-symbols/svg-400/outlined/warning-fill.svg";
declare module "*.svg" {
const css: string;
export default css;
}
```
### 💻 Use Cases
1. What do you want to use this for?
2. What shortcomings exist with current approaches?
3. What workarounds are you using in the meantime?
关闭于 2026-06-28 2 条评论