Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
Open
Description
Before You File a Bug Report Please Confirm You Have Done The Following...
- I have tried restarting my IDE and the issue persists.
- I have updated to the latest version of the packages.
- I havesearched for related issues and found none that matched my issue.
- I haveread the FAQ and my problem is not listed.
Playground Link
Repro Code
//@ts-expect-error - The module doesn't exist, but this is not relevant.import{Placeholder}from'placeholder';exporttypeConfig={// Using it only as a typeplaceholder:Placeholder;}// A symbol with the same name as the typefunctionPlaceholder(){returnnull;}// Using the local symbol as a valueexportfunctionMain(){return<Placeholder/>;}
ESLint Config
{"rules":{"@typescript-eslint/consistent-type-imports":"error"}}
tsconfig
No response
Expected Result
It should report an error because the actual import is only used as a type. Instead no error is reported.
TSC accepts types with the same name as local values. Babel with the TypeScript preset throws an error due to having a duplicate identifier as it is unable to determine that the import will be dropped during compile-time.
There's also changes coming toTypeScript 5.4 that introduces errors when type-only imports conflict with local values.
Actual Result
No errors shown.
Additional Info
No response