-
-
Notifications
You must be signed in to change notification settings - Fork 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
Adds missing Context and Dispatch types to compat #4028
Conversation
compat/src/index.d.ts
Outdated
@@ -30,6 +30,7 @@ declare namespace React { | |||
export import useReducer = _hooks.useReducer; | |||
export import useRef = _hooks.useRef; | |||
export import useState = _hooks.useState; | |||
export type Dispatch<A> = (value: A) => void; |
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.
export type Dispatch<A> = (value: A) => void; | |
export type Dispatch<A> = (action: A) => void; |
Might be worth extracting to core hook's types for reuse in submodules, not sure. We do use it in a few different places.
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.
@rschristian Do you mean define the type in ./src/index.d.ts
as part of preact's namespace and re-export in the compat types via ./compat/src/index.d.ts
?
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.
Whoops, sorry. Not to core, but to /hooks/src/index.d.ts
, as it can be used in useReducer
's types quite nicely and re-exported through compat.
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.
Okay sounds good. I'm making this change now then will mark this as ready for review.
Co-authored-by: Ryan Christian <33403762+rschristian@users.noreply.github.com>
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.
Thanks, looks great!
Adds two missing types to the exported React namespace in compat.
Closes #4027