Error with @chakra-ui/image 1.1.1 (chakra-ui 1.7.1) when running tsc
See original GitHub issueDescription
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
- Create new app using with importing chakra 1.7.1
- Run
tsc
- 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:
- Created 2 years ago
- Reactions:3
- Comments:10 (1 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@cschroeter Can you reopen this issue please? It is still a problem!
It seems that there is a line
/// <reference types="next" />
in the compiled TypeScript definition file foruse-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
tov1.1.0
, which has a different folder layout (probably due to build tool changes):Some workarounds:
"skipLibCheck": true
to yourtsconfig.json
. This will skip package definitions to be checked deeply: https://www.typescriptlang.org/tsconfig#skipLibChecknode_modules
folder for/// <reference types="next" />
and remove any lines from the fileuse-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.