-
Notifications
You must be signed in to change notification settings - Fork 4.5k
TypeScript: Convert redux-store types in data package to TS #67666
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. |
Size Change: +3 B (0%) Total Size: 1.91 MB
ℹ️ View Unchanged
|
Flaky tests detected in 4c471dc. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/12515974894
|
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
Convert JavaScript Redux store utilities in the data
package to TypeScript to enable stronger typing across the store.
- Added typed versions of thunk middleware, action creators, reducer, and
combineReducers
. - Removed the corresponding JavaScript files.
- Enhanced the reducer with a
default
case and streamlined action unions.
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
packages/data/src/redux-store/thunk-middleware.ts | Added TS version of thunk middleware |
packages/data/src/redux-store/thunk-middleware.js | Removed JS version of thunk middleware |
packages/data/src/redux-store/metadata/actions.ts | Added TS action creators with as const types |
packages/data/src/redux-store/metadata/actions.js | Removed JS action creators |
packages/data/src/redux-store/metadata/reducer.ts | Converted reducer to TS, added default case |
packages/data/src/redux-store/combine-reducers.ts | Added TS-typed combineReducers implementation |
packages/data/src/redux-store/combine-reducers.js | Removed JS combineReducers |
Comments suppressed due to low confidence (2)
packages/data/src/redux-store/metadata/reducer.ts:38
- The
StateKey
type is declared but not used anywhere. Removing it will reduce dead code and improve clarity.
type StateKey = unknown[] | unknown;
packages/data/src/redux-store/combine-reducers.ts:11
- [nitpick] Consider adding a JSDoc comment explaining this generic overload and its parameters, so future maintainers understand the intended usage and type behavior.
export function combineReducers< M >(
Supercedes #66683, which got closed after I deleted my fork 🤦
What?
Convert JS files inside
packages/data/src/redux-store
to TSWhy?
To pave the way for fixing types for
data
andcore-data
packagesHow?
Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast