Could not find a declaration file for module 'sugar-high'
Closed this issue · 4 comments
alex289 commented
Im trying to import sugar-high like this
import { highlight } from 'sugar-high';
But I get the following error
Could not find a declaration file for module
. /Users/PlaceholderPath/node_modules/.pnpm/sugar-high@0.5.3/node_modules/sugar-high/lib/index.mjs implicitly has an
type.
There are types at /Users/PlaceholderPath/node_modules/sugar-high/index.d.ts', but this result could not be resolved when respecting package.json "exports". The sugar-high' library may need to update its package.json or typings.
Even though I can use @ts-expect-error
to fix this I think this is not the best way to go. Is there something wrong with my setup or is it a bug here?
Thanks for the great work :D
huozhi commented
Hey I published a patch 0.5.4 with the type declared in package.json, can you upgrade and try again to see if it works for you? Thanks
alex289 commented
@huozhi seems like this didn't fix the issue.
I tried restarting vscode but I still have this error:
Could not find a declaration file for module 'sugar-high'. '/Users/PlaceholderPath/node_modules/.pnpm/sugar-high@0.5.4/node_modules/sugar-high/lib/index.mjs' implicitly has an 'any' type.
There are types at '/Users/PlaceholderPath/node_modules/sugar-high/index.d.ts', but this result could not be resolved when respecting package.json "exports". The 'sugar-high' library may need to update its package.json or typings.ts(7016)
The build also fails when not using @ts-expect-error
alex289 commented
Now it works perfectly. Thanks a lot ❤️