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.

Error with @chakra-ui/image 1.1.1 (chakra-ui 1.7.1) when running tsc

See original GitHub issue

Description

When I started development of new app with vite and chakra-ui, I noticed that there is TS error in @chakra-ui/image on compile

Link to Reproduction

It’s error with typescript

Steps to reproduce

  1. Create new app using with importing chakra 1.7.1
  2. Run tsc
  3. See error

Chakra UI Version

1.7.1

Browser

No response

Operating System

  • macOS
  • Windows
  • Linux

Additional Information

TS error log:

node_modules/@chakra-ui/image/dist/declarations/src/use-image.d.ts:1:23 - error TS2688: Cannot find type definition file for 'next'.

1 /// <reference types="next" />

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:3
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

13reactions
thomaseizingercommented, Nov 18, 2021

@cschroeter Can you reopen this issue please? It is still a problem!

12reactions
tkesgarcommented, Nov 25, 2021

It seems that there is a line /// <reference types="next" /> in the compiled TypeScript definition file for use-image module. It will cause issue on projects that do not use Next.js, since the package does not exist.

https://unpkg.com/browse/@chakra-ui/image@1.1.1/dist/declarations/src/use-image.d.ts

I do not have a clue why this line would exist. It only occurs in one file. The change seems to be from v1.0.22 to v1.1.0, which has a different folder layout (probably due to build tool changes):

Some workarounds:

  • Add "skipLibCheck": true to your tsconfig.json. This will skip package definitions to be checked deeply: https://www.typescriptlang.org/tsconfig#skipLibCheck
  • If you are using Yarn, you can try resolution. I don’t use Yarn so I have not tried this.
  • You can manually remove the line in the file. Search the node_modules folder for /// <reference types="next" /> and remove any lines from the file use-image.d.ts. This will not work on automated environments such as CI, but if you are still working in local environment, this is a temporary workaround until a proper fix is created.
Read more comments on GitHub >

github_iconTop Results From Across the Web

@chakra-ui/image - npm
React component for progressive image loading. ... Start using @chakra-ui/image in your project by running `npm i @chakra-ui/image`.
Read more >
Version 2.4.0 - Chakra UI
Fixed issue where dynamically changing a tooltip's isDisabled when it is open didn't have any effect. Now, changing the isDisabled prop will close...
Read more >
list of all node.js modules created on June 24, 2013
=cookieu 2013-04-07 07:43 0.0.1 abc-web ui for abc =abc-team 2013-06-24 01:59 ... Easy creation of Airbrake (or errbit) error notifications from Node.js or ......
Read more >
How to Use Chakra UI with Next.js and React - freeCodeCamp
Chakra UI is a component library for React that makes it easy to build the UI of an app or website. Their goal...
Read more >
Next-Chakra-UI - CodeSandbox
Create Sandbox Sign in. Template Info. Next-Chakra-UI. A starter for Jamstack application using Next.js, Chakra-UI, Auth0, Cloudinary. chakra-ui. jamstack.
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