New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add explicit type declaration to ChakraProvider.defaultProps
#6464
Add explicit type declaration to ChakraProvider.defaultProps
#6464
Conversation
🦋 Changeset detectedLatest commit: ff3f328 The changes in this PR will be included in the next version bump. This PR includes changesets to release 6 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit ff3f328:
|
We really want to move away from default props for the most part and just add the default from within the component. If you can refactor the code to do that, that'll be great. |
Thanks for the review. I've revised the PR - does this match what you were suggesting? |
Closes #6463
📝 Description
This PR adds an explicit declaration to
chakra-provider.tsx
that will forcefully change the declaration output from this:to this:
I was
⛳️ Current behavior (updates)
The current implementation leaves TypeScript to infer the type that must be emitted for
ChakraProvider.defaultProps
, which it fails to do. This causes TypeScript builds to fail in strict mode for consumers of@chakra-ui/react
.🚀 New behavior
The new implementation explicitly declares the type that needs to be emitted.
💣 Is this a breaking change (Yes/No):
I don't believe this is a real breaking change, though I guess it could potentially break builds in some edge cases.
📝 Additional Information
I did find alternative ways to do this without the
declare namespace
, but they require depending on the@chakra-ui/theme-tools
package and inline the gigantic theme type into the emitted declaration file.