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 have searched for related issues and found none that matched my issue.
- I have read 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';
export type Config = {
// Using it only as a type
placeholder: Placeholder;
}
// A symbol with the same name as the type
function Placeholder() {
return null;
}
// Using the local symbol as a value
export function Main() {
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 to TypeScript 5.4 that introduces errors when type-only imports conflict with local values.
Actual Result
No errors shown.
Additional Info
No response