Always verify import path #40450
Labels
Awaiting More Feedback
This means we'd like to hear from more people who would be helped by this feature
Suggestion
An idea for TypeScript
In many projects is necessary work with files which isn't a TS/JS file. Some common ones are png, jpg, svg, but when importing this files we get
Cannot find module or its corresponding type declarations.
error.Searching how to fix that, we come across many discussions suggesting using the global module declaration, such as:
Links
This approach fix the lint error, but
disable
TS intellisense.Example
Folder structure
index.ts
No errors, but the correct path is
../img/top-view.svg
Here is the related issue #40333
Suggestion
Compiler could still returning missing type declarations for not TS/JS files. But always check if import path results in a file and return an error if not (even if file is not an TS/JS).
The text was updated successfully, but these errors were encountered: