frenic / csstype

Strict TypeScript and Flow types for style based on MDN data

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

eslint import/no-unresolved error for csstype

nishantnaagnihotri opened this issue · comments

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 😞

Maybe the answer to your issue can be found here import-js/eslint-plugin-import#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.