-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Upgrade @types/react package and @types/react-dom #60796
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @mrmurphy. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @mrmurphy! In case you missed it, we'd love to have you join us in our Slack community. If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've look into this, and both of the problems that are addressed here (BorderControl
and View
) are surfacing typing errors that should be fixed in a more complete way. And it looks like those are each important enough to warrant their own PRs and reviews.
Could you hold off a bit on this so I can fix the type errors separately first? I think I can do it next week.
Also, heads up that a TS update was merged recently (#60793), though it may not be specifically relevant to this problem.
Great, thank you @mirka! Do you want to close this PR and open a new one? Or just keep it open until next week? |
Let's keep this one. I only wanted to separate out the type fixes. I proposed a fix for diff --git a/packages/components/src/border-control/types.ts b/packages/components/src/border-control/types.ts
index b1ff87aaf5..5e028050d8 100644
--- a/packages/components/src/border-control/types.ts
+++ b/packages/components/src/border-control/types.ts
@@ -61,6 +61,10 @@ export type BorderControlProps = ColorProps &
* interaction that selects or clears, border color, style, or width.
*/
onChange: ( value?: Border ) => void;
+ /**
+ * Placeholder text for the number input.
+ */
+ placeholder?: HTMLInputElement[ 'placeholder' ];
/**
* An internal prop used to control the visibility of the dropdown.
*/ We should be good to go once the View fix is merged. |
@mrmurphy The fix for |
Is anything blocking this? @mirka are you planning to land it or do you need help? I think (hope) this will fix some intermittent type issues with react and ariakit like this:
|
Since this is becoming a blocker for me in another PR. I went ahead and applied the review suggestion. This should be ready to go. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are newer versions of these types now:
"@types/react": "18.3.1"
"@types/react-dom": "18.3.0"
It would be nice to get on the latest version.
I've tried updating that, but I'm having problems building locally.
I did notice that we have multiple versions of react types which is not ideal. There's a single version of react used and there should be a single set of types. react-native-safe-area
seems to depend on v16 react types. That can (and should!) be solved with overrides, but there still seemed to be other incompatibilities between types when I tried to build locally.
No blockers on my end, please feel free to commandeer and merge since I will be unavailable for the next few days. |
I'm going to need some help here :) I'm having trouble reproducing the failures reported in CI locally. |
Oh I think the remaining issue is just because the compressed size check switches branches and because of the different versions of the package between the branches, it results in errors but the errors are not really there if you actually clean everything properly. Based on that, I'm going to force merge this one. There's probably something to be done to "fix" that job but since it's an external action, it's hard to change. Maybe we can do something in our cleanup function (types linger) |
Congratulations on your first merged pull request, @mrmurphy! We'd like to credit you for your contribution in the post announcing the next WordPress release, but we can't find a WordPress.org profile associated with your GitHub account. When you have a moment, visit the following URL and click "link your GitHub account" under "GitHub Username" to link your accounts: https://profiles.wordpress.org/me/profile/edit/ And if you don't have a WordPress.org account, you can create one on this page: https://login.wordpress.org/register Kudos! |
I'm worried this will still cause problems, try checking out npm ci
./node_modules/.bin/tsc --build --force @youknowriad are you able to reproduce build issues like that? I'll try to help fix this. |
I have no build issues in trunk (using the instructions above) and the CI jobs in trunk are passing. |
@oandregal can you try after cleaning everything?
|
It works after doing that. 👍 |
Following the merge of #60796, developers may face build issues that require package types to be rebuilt. The problem is that `tsc --build` fails somewhat silently -- or rather, there is some output, but it's not clear in the console which stage of the `build:package-types` command failed, and hence what the workaround should be. This commit alleviates the issue by logging a helpful message in the console if `tsc --build` fails: tsc failed. Try cleaning up first: `npm run clean:package-types`
Following the merge of #60796, developers may face build issues that require package types to be rebuilt. The problem is that `tsc --build` fails somewhat silently -- or rather, there is some output, but it's not clear in the console which stage of the `build:package-types` command failed, and hence what the workaround should be. This commit alleviates the issue by logging a helpful message in the console if `tsc --build` fails: tsc failed. Try cleaning up first: `npm run clean:package-types`
Squashed commit of the following: commit 40c0fd7 Author: Jon Surrell <sirreal@users.noreply.github.com> Date: Wed May 8 18:55:56 2024 +0200 Patch react-autosize-textarea for updated types commit 69cf754 Author: Jon Surrell <sirreal@users.noreply.github.com> Date: Wed May 8 18:48:37 2024 +0200 upgrade framer-motion commit b383044 Author: Jon Surrell <sirreal@users.noreply.github.com> Date: Wed May 8 18:34:44 2024 +0200 Upgrade @use-gesture/react commit fdf93ae Author: Jon Surrell <sirreal@users.noreply.github.com> Date: Wed May 8 18:32:11 2024 +0200 Go bonkers on the global vars commit cc43b8c Author: Jon Surrell <sirreal@users.noreply.github.com> Date: Wed May 8 16:46:39 2024 +0200 Fix the process problem commit 548145e Author: Jon Surrell <sirreal@users.noreply.github.com> Date: Wed May 8 13:33:23 2024 +0200 No more skipLibCheck commit 1eb7644 Author: Miguel Fonseca <150562+mcsf@users.noreply.github.com> Date: Wed May 8 16:33:10 2024 +0100 build: Suggest workaround if `tsc --build` fails (#61501) Following the merge of #60796, developers may face build issues that require package types to be rebuilt. The problem is that `tsc --build` fails somewhat silently -- or rather, there is some output, but it's not clear in the console which stage of the `build:package-types` command failed, and hence what the workaround should be. This commit alleviates the issue by logging a helpful message in the console if `tsc --build` fails: tsc failed. Try cleaning up first: `npm run clean:package-types` commit 14ecb1d Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed May 8 09:49:20 2024 -0400 Bump actions/checkout from 4.1.4 to 4.1.5 in the github-actions group (#61449) Bumps the github-actions group with 1 update: [actions/checkout](https://github.com/actions/checkout). Updates `actions/checkout` from 4.1.4 to 4.1.5 - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](actions/checkout@0ad4b8f...44c2b7a) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-patch dependency-group: github-actions ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: desrosj <desrosj@git.wordpress.org> commit e899475 Author: Marin Atanasov <8436925+tyxla@users.noreply.github.com> Date: Wed May 8 16:48:50 2024 +0300 RadioControl: Fix shrinking radio controls (#61476) Co-authored-by: tyxla <tyxla@git.wordpress.org> Co-authored-by: jameskoster <jameskoster@git.wordpress.org> commit 839c17d Author: Riad Benguella <benguella@gmail.com> Date: Wed May 8 14:39:34 2024 +0100 Editor: Unify Header component. (#61273) Co-authored-by: youknowriad <youknowriad@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: jeryj <jeryj@git.wordpress.org> Co-authored-by: jasmussen <joen@git.wordpress.org> commit 2c2f899 Author: Ella <4710635+ellatrix@users.noreply.github.com> Date: Wed May 8 20:30:44 2024 +0900 Revert "useBlockSync: remove isControlled effect" (#61480) Co-authored-by: ellatrix <ellatrix@git.wordpress.org> Co-authored-by: youknowriad <youknowriad@git.wordpress.org>
Ahh thank you so much to all of you for wrapping this up. I moved on to other projects and hadn't circled back around. I really appreciate it! |
What?
Upgrades the @types/react and @types/react-dom packages
Why?
We have a project depending on @wordpress/components that upgraded @types/react to the latest version. When that happened we ran into the build error mentioned here:
DefinitelyTyped/DefinitelyTyped#69006
How?
I've just updated the versions in the dependencies and addressed the two compiler errors that the upgrade produced.
View
to a specific type. This one I'm less sure about. The compiler wasn't happy when trying to assign the result of styled.div`` to the specified type. Here was the error:I addressed this by casting the result of
styled.div
to the specific desired type. I'm not sure how safe this is, but I think TS would warn me if that cast weren't compatible, like it does if I try to cast a string literal to a number.