csstype
csstype copied to clipboard
eslint import/no-unresolved error for csstype
Eslint raises compilation error of the rule import/no-unresolved, for the csstype import statement.
This is because the package.json of csstype has a blank value for "main" field. It should have the value as "index.d.ts".
I did the change locally and eslint stopped complaining.
The main
field is the same as @types
packages which is just ""
. There could be other issues when adding a .d.ts
file to main
so I'd say it's better to keep it like this even though @types
are used differently. But maybe this will do the trick for you?
import type * as CSS from 'csstype';
Thanks for the prompt response!!
I tried it out, the error does not go away :disappointed:
Maybe the answer to your issue can be found here https://github.com/import-js/eslint-plugin-import/issues/1341?
They suggest to use eslint-import-resolver-typescript and yes, I can confirm that (at least for me) it does the trick. Thanks for pointing this out.