-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
In DiscussionNot yet reached consensusNot yet reached consensusSuggestionAn idea for TypeScriptAn idea for TypeScript
Description
Search Terms
empy import cannot find module symbols side deffect
Suggestion
Current behaviour: given an empty import (an import that has side effects and/or does not import any symbols):
import './abc';
If the module does not exist, there will be no error.
This is unlike other (non-empty) imports, which will error for non-existent modules:
import 'foo' from ./abc';
I understand this is intended behaviour as per #20534 (comment).
I would like to suggest a compiler option for people to opt-in to the stricter behaviour. This could also be added to the strict
compiler option.
Checklist
My suggestion meets these guidelines:
- This wouldn't be a breaking change in existing TypeScript / JavaScript code
- This wouldn't change the runtime behavior of existing JavaScript code
- This could be implemented without emitting different JS based on the types of the expressions
- This isn't a runtime feature (e.g. new expression-level syntax)
IllusionMH, matthias-ccri, DetachHead, KotlinIsland, ofhouse and 5 more
Metadata
Metadata
Assignees
Labels
In DiscussionNot yet reached consensusNot yet reached consensusSuggestionAn idea for TypeScriptAn idea for TypeScript