question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

15.1.0 fails to build in TypeScript project (15.0.0 works)

See original GitHub issue

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:

  • tsc reports 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. Try npm 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.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:7
  • Comments:14 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
kamsarcommented, Aug 23, 2021

Also hit this. The cause is that the typings in package.json point to dist/types/index.d.ts, however this file does not exist in the package: only dist/types/rich-text-html-renderer/src/index.d.ts (and strangely dist/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:

import { documentToHtmlString } from '@contentful/rich-text-html-renderer/dist/types/rich-text-html-renderer/src/index';
1reaction
somehancommented, Sep 10, 2021

Just for reference: the new version also works in our production app. Thanks for the fix, @kamsar and @djagya !

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I resolve peer dependency error: The package react ...
it worked when i updated npm "npm install npm -g" and then downgraded react to; "react": "15.3.0" , cleared cache: npm cache clear...
Read more >
[Node.js 12.11+ and Windows 10] Error: Cannot find module ...
My use case: I have TypeScript projects that are coded as ES modules (for example: cedx/coveralls.js or cedx/which.js).
Read more >
Prevent npm install for not supported Node.js versions
When I run npm install in a project with a not supported Node.js version, the following warning ( EBADENGINE ) is displayed. $...
Read more >
Deprecations by version - GitLab Docs
In GitLab 16.0, any personal, project, or group access token that does not have an expiration date will automatically have an expiration date...
Read more >
How to set up TypeScript
Add TypeScript to your project, or install TypeScript globally. ... many different versions of TypeScript, this keeps each project working consistently.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found