TypeScript: Convert data controls to TS#70838
Conversation
|
Size Change: 0 B Total Size: 3.09 MB ℹ️ View Unchanged
|
|
Flaky tests detected in 463a478. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/19095424640
|
51084bd to
004a1c5
Compare
|
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. |
004a1c5 to
093b206
Compare
| * @property {Function} dispatch Given a namespace key, returns an | ||
| * object of the store's registered | ||
| * action dispatchers. | ||
| * @property {any} stores An object of registered stores. |
There was a problem hiding this comment.
Looking through packages/data/src/types.ts I would say that better than any I would rather choose some combination extending StoreInstance or maybe something a little more generic?
But I feel that any is too loose for this case.
There was a problem hiding this comment.
The registry is still too far from better typing. I wanted to actually use unknown here, but that opens a can of worms. So, I used any here to keep things moving. Once, registry is properly typed this will automatically be updated.
|
Completed via #76149 |
What?
Converts several JavaScript files in the
@wordpress/datapackage to TypeScript.Why?
This is part of the ongoing effort (via #67691) to improve type safety and developer experience in the Gutenberg codebase by migrating JavaScript files to TypeScript.
How?
Converted the following files from JavaScript to TypeScript:
controls.js→controls.ts: Added types for theselect,resolveSelect, anddispatchcontrol functions, including proper typing forStoreDescriptorparameters and control arguments (SelectorControlArgs,ActionControlArgs).promise-middleware.js→promise-middleware.ts: Added the ReduxMiddlewaretype annotation.resolvers-cache-middleware.js→resolvers-cache-middleware.ts: Added types for the registry parameter (WPDataRegistry), store name, and the resolver entries map.Testing Instructions
npm run clean:package-types && npm run buildto verify the build succeeds.Testing Instructions for Keyboard
N/A - No UI changes.
Screenshots or screencast
N/A - Internal code changes only.