timc1 / kbar

fast, portable, and extensible cmd+k interface for your site
https://kbar.vercel.app
MIT License
4.84k stars 185 forks source link

Add React 18 Support #202

Closed AnishDe12020 closed 2 years ago

AnishDe12020 commented 2 years ago

Closes #199

As stated in this comment on the issue, with React 18, to accept the children prop, the props interface must be wrapped with PropsWithChildren.

I have done the same for KBarProvider, KBarAnimator, and KbarPositioner. All typescript errors should be gone.

I have tested this by synlinking the package and using it in one of my projects. There were no errors when building (it is a Next.js app using typescript)

vercel[bot] commented 2 years ago

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/timc/kbar/FQSTwh8qEzRJLHUqH4HhsqsjsWkh
✅ Preview: https://kbar-git-fork-anishde12020-fix-add-react-18-support-timc.vercel.app

AnishDe12020 commented 2 years ago

Hey @timc1, thanks a lot for merging this!

It would be cool if you could also push these changes as a release to the registry as the current release is still old (25 days old as of writing) and the problem still persists if we try to use it.

timc1 commented 2 years ago

This is available in the latest release 👍

kirillrogovoy commented 2 years ago

Should we also add React 18 to package.json -> peerDependencies?

Right now, an npm install fails with the following error if one's using React 18 along with kbar.

image

One can shut it up with npm i --legacy-peer-deps, but that's not a good practice.