The current package.json results in an error in TypeScript 5.2.2 (perhaps also for versions back to 4.7). Here's the error:
error TS7016: Could not find a declaration file for module 'react-d3-speedometer'. '<path-to-project>/node_modules/react-d3-speedometer/dist/react-d3-speedometer.es.js' implicitly has an 'any' type.
There are types at '<path-to-project>/node_modules/react-d3-speedometer/dist/index.d.ts', but this result could not be resolved when respecting package.json "exports". The 'react-d3-speedometer' library may need to update its package.json or typing.
According to this StackOverflow post, when "exports" is defined "types" needs to be defined in the "exports".
Adding "types": "./dist/index.d.ts" to "exports" fixes things, at least it does for my project.
The current
package.json
results in an error in TypeScript 5.2.2 (perhaps also for versions back to 4.7). Here's the error:According to this StackOverflow post, when
"exports"
is defined"types"
needs to be defined in the"exports"
.Adding
"types": "./dist/index.d.ts"
to"exports"
fixes things, at least it does for my project.