-
-
Notifications
You must be signed in to change notification settings - Fork 511
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
π noUnusedImports does not detect used types #557
Comments
This is intentional. |
@Conaclos typeof can be applied to a variable imported as a type |
I have the same issue on my side import type * as Config from './objects/config'; // -> Config is reported as unused
type ConfigCheck<T extends CheckObject<Omit<typeof Config, never>> = Omit<typeof Config, never>> =
T; |
In my view, import * as Config from './objects/config'; // -> Config is reported as unused
type ConfigCheck<T extends CheckObject<Omit<typeof Config, never>> = Omit<typeof Config, never>> =
T; Taking some time to investigate, it seems that TypeScript allows the use of a type in |
Maybe we need a rule for detecting when you're unnecessarily using Although, TypeScript yells at me if I try to remove it: import type NextAuth from 'next-auth/next';
// 'NextAuth' refers to a value, but is being used as a type here. Did you mean 'typeof NextAuth'?
const a: NextAuth = {} This works though: import NextAuth from 'next-auth/next';
const a: typeof NextAuth = {} |
Yes this conflicts with |
Environment information
What happened?
When the
nursery/noUnusedImports
rule is used in a file where a type is imported, it will detect that import as unused (even though it's actually used).Expected result
Because the import is actually used, it should not be flagged for removal.
Code of Conduct
The text was updated successfully, but these errors were encountered: