-
Notifications
You must be signed in to change notification settings - Fork 4.5k
[core-data]: Fix TS types for user object #68045
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
base: trunk
Are you sure you want to change the base?
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 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. |
Flaky tests detected in 6e61661. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/16372596563
|
This PR solves two issues
getCurrentUser
selector's return type is set toET.User< 'edit' >
, which sets the incorrect return type with properties that don't exist on the current user object, for example,user.capabilities
. The return type should rather beET.User< 'view' >
because that is whatstate.currentUser
is, as mentioned in Convert core-data selectors from jsDoc annotations into TypeScript type signatures #40025 (comment)Here, you can see the difference between a current user (
users/me
) and a normal user (users/<id>
) object.user.capabilities
is set toRecord< string, string >
, which is incorrect. It should rather beRecord< string, boolean >
, because those capabilities come from here as pointed out in Core Data: TypeScript definitions for entity records. #38666 (comment)What?
getCurrentUser
selector.user.capabilities
to be a record of booleans instead of a record of strings.Why?
To fix the incorrect types
How?
By fixing the types
Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast