You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Import path not checked when not importing any symbols #20534
I can't find the issue because "import" + "error" = all the issues, but this is the intended behavior as per many requests from users to support scenarios such as importing CSS modules for their side effects without having to write empty declaration files for them
So in order to support using import statements to resolve non-Typescript/non-Javascript files, any import statement that doesn't resolve an export from a module is essentially not checked at all?
This seems very counterintuitive. It's perfectly valid ES6 syntax to import JavaScript modules without importing any symbols in order to ensure (say) global dependencies or other bootstrapping is resolved; I would think allowing importing things that aren't actually code should be the exception rather than the rule and have some special handling if needed.
This should at the very least be a user-configurable compilation option. And even if we decide we aren't going to typecheck the static dependency (e.g. since it's CSS), we should still at least ensure it exists! But ideally, we'd ensure ALL import targets exist, and ones that are actually typescript (or javascript if using allowJs) would also by compiled normally as would be any other static code dependency. Right now, as far as I can tell, such imports are completely ignored.
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.
Activity
RyanCavanaugh commentedon Dec 11, 2017
I can't find the issue because "import" + "error" = all the issues, but this is the intended behavior as per many requests from users to support scenarios such as importing CSS modules for their side effects without having to write empty declaration files for them
jamietre commentedon Dec 13, 2017
So in order to support using
importstatements to resolve non-Typescript/non-Javascript files, anyimportstatement that doesn't resolve an export from a module is essentially not checked at all?This seems very counterintuitive. It's perfectly valid ES6 syntax to import JavaScript modules without importing any symbols in order to ensure (say) global dependencies or other bootstrapping is resolved; I would think allowing importing things that aren't actually code should be the exception rather than the rule and have some special handling if needed.
This should at the very least be a user-configurable compilation option. And even if we decide we aren't going to typecheck the static dependency (e.g. since it's CSS), we should still at least ensure it exists! But ideally, we'd ensure ALL import targets exist, and ones that are actually typescript (or javascript if using
allowJs) would also by compiled normally as would be any other static code dependency. Right now, as far as I can tell, such imports are completely ignored.typescript-bot commentedon Jan 2, 2018
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.