-
Notifications
You must be signed in to change notification settings - Fork 233
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
fix: avoid relying on implicit children prop #848
base: main
Are you sure you want to change the base?
Conversation
❌ Deploy Preview for react-hooks-testing-library failed.
|
52dcc43
to
c11cefd
Compare
c11cefd
to
37f1328
Compare
Sigh Getting some type-checking errors.
|
Minor bump for review—anyone? |
Sorry, just so i'm clear, you're using react18 types on your project and this is causing your error? |
Yes. We're using |
Maybe i'm misunderstanding so apologies, but this lib doesn't support react18, so wouldn't it be fair to say that this issue is a mismatch of dependencies? i.e. all our types incl. exported ones are based on react17 types and there were some major changes to |
Codecov Report
@@ Coverage Diff @@
## main #848 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 15 15
Lines 245 245
Branches 34 34
=========================================
Hits 245 245 Continue to review full report at Codecov.
|
Indeed, that's why I said we are probably doing something weird here, but so far everything is working as expected. React 18 doesn't introduce breaking runtime API changes (and I doubt they will in any future major version), so upgrading the types package is a net gain, because of stricter types like no implicit any when using The library would likely need to do it anyway if we every plan to be compatible with React 18. (I don't know if that's a goal; I did see the README notice but I can't fully appreciate its implications.) Reliance on implicit |
We're not upgrading to The tests seem to pass which is a good start. Think the docs fail due to something else. I don't necessarily have an issue with this PR although i'd have to let @mpeyper have final say. |
The docs fail because the Netlify deployment is using an outdated version of Node. This is caused by pierrec/node-eval#28. (Yes, I know it because I implemented that as well 😄) The lack of a lockfile (which I can emphasize with) combined with that PR shipped in a patch version causes this. (It was rightfully a patch because Node 10 was long EOL'ed at that time)
The implicit |
What:
This PR adds
children: ReactNode
to the props ofWrapperComponent
.Why:
Docusaurus is doing something a bit weird: we are using React 17, but at the same time, we use
@types/react@18
to enjoy its stricter types. The only thing hindering it from working properly is thatWrapperComponent
does not declare that it will always pass thechildren
prop. This leads to type errors in test files:How:
Just added an explicit
children
prop.Checklist: