Closed
Description
- I have tried restarting my IDE and the issue persists.
- I have updated to the latest version of the packages.
- I have read the FAQ and my problem is not listed.
Repro
(no rule configuration, using plugin:@typescript-eslint/all)
import type { Ref } from '@typegoose/typegoose';
import { prop } from '@typegoose/typegoose';
export class Test
{
@prop({ ref: () => Test })
public test?: Ref<Test>;
}
Expected Result
Ref
is only used as a type, and is not used by the decorator, no issue should be raised here.
Actual Result
ESLint: Type import "Ref" is used by decorator metadata.(@typescript-eslint/consistent-type-imports)
However, typescript compiles the code fine with 'importsNotUsedAsValues'.
When removing type
, typescript compilation fails:
../../src/backend/models/Test.ts:1:1 - error TS1371: This import is never used as a value and must use 'import type'
because 'importsNotUsedAsValues' is set to 'error'.
1 import { Ref } from '@typegoose/typegoose';
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Versions
package | version |
---|---|
@typescript-eslint/eslint-plugin |
13.1.0 |
@typescript-eslint/parser |
5.12.1 |
TypeScript |
4.5.5 |
ESLint |
8.10.0 |
node |
16.13.0 |