-
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
Core data: Fix some typing issues #39214
Conversation
Size Change: +4 B (0%) Total Size: 1.15 MB
ℹ️ View Unchanged
|
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.
Looks good and makes sense, I like how .add and .delete now uses a single argument.
Thanks for the review @adamziel (also c/c @sarayourfriend) I was actually less of a fan of converting these, especially when hitting the |
In this commit we're cleaning up type issues in the core-data package that prevent us from telling TypeScript to run on the package and all of its existing code, even the JS files. After these changes we should be able to do so and start converting more modules to TypeScript with less friction. This patch follows a series of other smaller updates: - #39212 - #39214 - #39225 - #39476 - #39477 - #39479 - #39480 - #39525 - #39526 - #39655 - #39656 - #39659 It was built in order to support ongoing work to add types to the `getEntityRecord` family of functions in #39025.
In this commit we're cleaning up type issues in the core-data package that prevent us from telling TypeScript to run on the package and all of its existing code, even the JS files. After these changes we should be able to do so and start converting more modules to TypeScript with less friction. This patch follows a series of other smaller updates: - #39212 - #39214 - #39225 - #39476 - #39477 - #39479 - #39480 - #39525 - #39526 - #39655 - #39656 - #39659 It was built in order to support ongoing work to add types to the `getEntityRecord` family of functions in #39025.
Part of #39211
Description
Fixes a few small issues with the JSDoc types in @wordpress/core-data.
batch
was untyped, added type holding vague structure of typeawait
'edPromise
calledresolve()
but wasn't typed asPromise<void>
. this may not be possible in JSDoc whereas it is in.ts
with the type parameter. I've made itresolve(undefined)
to get around this.ObservedSet
used spread arguments forSet
's 1-arity functions. I've replaced...args
withvalue
to match the API ofSet
Testing Instructions
Audit the types. As a type-only change this won't impact the built files
Types of changes
This is a type-only change and won't impact the build.
Checklist:
*.native.js
files for terms that need renaming or removal).