TS1371
error TS1371: This import is never used as a value and must use ‘import type’ because ‘importsNotUsedAsValues’ is set to ‘error’.
Broken Code ❌
1 |
|
1 |
|
Fixed Code ✔️
Solution 1:
When “importsNotUsedAsValues” is set to “error” in your “tsconfig.json”, then you have to use the “import type” syntax when you just want to refer to a type instead of using it as a value:
1 |
|
Solution 2:
Use the class also as a value and not just a type:
1 |
|
Solution 3:
You can also set “importsNotUsedAsValues” to “preserve” which is not recommended.