-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
withFilters: Convert to TypeScript #48721
Conversation
constructor( props: { [ key: string ]: any } ) { | ||
super( props ); |
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.
This change addresses the prefer-rest-params
lint error. Runtime behavior should be the same.
FilteredComponent = applyFilters( | ||
hookName, | ||
OriginalComponent | ||
) as WPComponent; |
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.
We need to cast here because applyFilters
returns unknown
.
Size Change: +2.42 kB (0%) Total Size: 1.34 MB
ℹ️ View Unchanged
|
Flaky tests detected in d08710e. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/4323076108
|
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.
🚀
(although there seems to be an issue with importing the WPComponent
type — maybe we could just swap to React.ComponentType
?)
Part of #35744
What?
Convert the
withFilters
HOC to TypeScript.Why?
It isn't really necessary that these HOCs are typed at this point, but just converting them because they are pretty simple. We can
ts-nocheck
any of the ones that are not worthwhile.Testing Instructions
✅ Static checks pass.