-
Notifications
You must be signed in to change notification settings - Fork 4.5k
TypeScript: Fix types for core entity meta #70788
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
Conversation
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.
Pull Request Overview
This PR fixes TypeScript type definitions for meta fields across core entity types to better reflect their actual nature. Meta fields in WordPress entities can contain various data types, not just strings.
- Changes meta field type from
Record<string, string>
toRecord<string, unknown>
across all core entity types - Improves type safety by accurately representing that meta field values can be of any type
- Addresses issue #70786 where the previous string-only typing was too restrictive
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
packages/core-data/src/entity-types/attachment.ts | Updates meta field type definition for attachment entities |
packages/core-data/src/entity-types/comment.ts | Updates meta field type definition for comment entities |
packages/core-data/src/entity-types/nav-menu-item.ts | Updates meta field type definition for navigation menu item entities |
packages/core-data/src/entity-types/nav-menu.ts | Updates meta field type definition for navigation menu entities |
packages/core-data/src/entity-types/page.ts | Updates meta field type definition for page entities |
packages/core-data/src/entity-types/post-revision.ts | Updates meta field type definition for post revision entities |
packages/core-data/src/entity-types/post.ts | Updates meta field type definition for post entities |
packages/core-data/src/entity-types/term.ts | Updates meta field type definition for term entities |
packages/core-data/src/entity-types/user.ts | Updates meta field type definition for user entities |
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. |
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.
Makes sense ✅
Flaky tests detected in a3411dd. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/16374022120
|
Co-authored-by: manzoorwanijk <manzoorwanijk@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
What?
Fixes #70786
Why?
The meta for the entity types like Post, User, Comment etc can be anything, not just a record of strings. Thus this PR reflects the same in the TS types.
How?
This PR changes the type of meta to be a record of
unknown
because that is what meta is - we don't know what type it is.Testing Instructions
some_key
isunknown
Testing Instructions for Keyboard
Screenshots or screencast