rich-text: 15.1.0 fails to build in TypeScript project (15.0.0 works)
Hi,
when upgrading contentful/rich-text-html-renderer and contentful/rich-text-types from 15.0.0 to 15.1.0, we get the following error:
error TS7016: Could not find a declaration file for module '@contentful/rich-text-html-renderer'. '/[path redacted]/node_modules/@contentful/rich-text-html-renderer/dist/rich-text-html-renderer.es5.js' implicitly has an 'any' type.
A minimum sample can be found at https://github.com/somehan/2021-08-cf-lib-issue
Steps to reproduce using the sample project:
- Run
npm i - Run `npm run build
Expected behavior:
- No output from
tsc - Code gets built without errors
Acctual behavior:
tscreports one error:error TS7016: Could not find a declaration file for module '@contentful/rich-text-html-renderer'. '/home/[path redacted]/cf-lib-issue/node_modules/@contentful/rich-text-html-renderer/dist/rich-text-html-renderer.es5.js' implicitly has an 'any' type. Trynpm i --save-dev @types/contentful__rich-text-html-rendererif it exists or add a new declaration (.d.ts) file containingdeclare module ‘@contentful/rich-text-html-renderer’;``
When downgrading the libraries to 15.0.0, compilation works as expected.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 7
- Comments: 15 (3 by maintainers)
Also hit this. The cause is that the
typingsinpackage.jsonpoint todist/types/index.d.ts, however this file does not exist in the package: onlydist/types/rich-text-html-renderer/src/index.d.ts(and strangelydist/types/rich-text-react-renderer/src/index.d.ts- not sure why React typings are being published in the non-React package).As a hacktacular workaround liable to break once this gets fixed, you can do this instead:
Just for reference: the new version also works in our production app. Thanks for the fix, @kamsar and @djagya !
@kamsar would it be possible for you to put this into a PR? Maybe that may help getting the issue fixed more easily.