-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Adds @types/react as optional peer deps #1837
Conversation
🦋 Changeset is good to goLatest commit: 03e796b We got this. This PR includes changesets to release 3 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 |
Codecov Report
|
Isn't it the other way around? Old package managers will emit warnings for this as they don't know what optional peer dependencies are, right? Would you say that |
No, old package managers won't know what
Yes, unless they are regular dependencies (which I think is a decent choice from a UX perspective, even if it means more dependencies for those who don't use TypeScript). |
Right, but from what I understand this will cause warnings because old package managers understand |
My PR only adds |
Oh - have not noticed that. I suspect it's equivalent to using |
Yep, exactly! |
Is this affecting your personally or did you fix this after somebody's report? I'm not sure if emotion currently is PnP-compliant anyway. From what I recall PnP-compatibility got fixed on |
I've hit this in a project of mine. That said, I've been able to workaround it using
It is! I have no problem on the v10 line except for this. Since it's honestly a bit tricky to debug (the TS error is rather cryptic, just saying that a JSX element isn't compatible with JSX elements), I think it might be worth backporting, but your call. |
K, I'm gonna move with this in v10. The last thing though - I believe the same should be done for Also thanks for mentioning packageExtensions - I didn't know about this and will probably come handy in the future 👍 |
# Conflicts: # packages/styled-base/package.json
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 03e796b:
|
I've wanted to merge this into v10 branch but in the end, this PR has slipped my attention since April - at this point in time I don't think there is much need to fix this for v10 as we've not received any other reports about this problem. I'm happy to incorporate this change though - I've just merged this into v11 branch. Thanks for your help on this ❤️ |
* Adds @types/react as optional peer deps * Adds changeset * Add @types/react as optional peer dep to @emotion/react as well * Tweak changeset Co-authored-by: Mateusz Burzyński <[email protected]>
What:
Using Emotion w/ PnP & TypeScript yields an error saying that the result of
styled.div
isn't a callable JSX construct.Why:
This is because
styled
andstyled-base
are both missing optional peer dependencies on@types/react
, so they aren't allowed to access it.How:
I've added
@types/react
as optional peer dependencies. No warning will be emitted to consumers using old package managers, or simply not providing@types/react
as dependencies.Checklist:
packageExtensions