-
Notifications
You must be signed in to change notification settings - Fork 50k
Fix Flow types of useEffectEvent #26468
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
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -218,24 +218,26 @@ export function useSyncExternalStore<T>( | |||||||
|
|
||||||||
| export function useCacheRefresh(): <T>(?() => T, ?T) => void { | ||||||||
| const dispatcher = resolveDispatcher(); | ||||||||
| // $FlowFixMe This is unstable, thus optional | ||||||||
| // $FlowFixMe[not-a-function] This is unstable, thus optional | ||||||||
| return dispatcher.useCacheRefresh(); | ||||||||
| } | ||||||||
|
|
||||||||
| export function use<T>(usable: Usable<T>): T { | ||||||||
| const dispatcher = resolveDispatcher(); | ||||||||
| // $FlowFixMe This is unstable, thus optional | ||||||||
| // $FlowFixMe[not-a-function] This is unstable, thus optional | ||||||||
| return dispatcher.use(usable); | ||||||||
| } | ||||||||
|
|
||||||||
| export function useMemoCache(size: number): Array<any> { | ||||||||
| const dispatcher = resolveDispatcher(); | ||||||||
| // $FlowFixMe This is unstable, thus optional | ||||||||
| // $FlowFixMe[not-a-function] This is unstable, thus optional | ||||||||
| return dispatcher.useMemoCache(size); | ||||||||
| } | ||||||||
|
|
||||||||
| export function useEffectEvent<T>(callback: T): void { | ||||||||
| export function useEffectEvent<Args, Return, F: (...Array<Args>) => Return>( | ||||||||
|
||||||||
| export function useEffectEvent<Args, Return, F: (...Array<Args>) => Return>( | |
| export function useEffectEvent<Args, Return, F: (...Array<Args>) => Return>( | |
| export function useEffectEvent<Args, F: (...Args) => mixed>( |
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.
Applied in facebook/react@9cf21fb (#26468) to make it consistent with the internal types.
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.
@kassens Do we actually need the
ArgsandReturntype parameter here? In TS we can just douseEffectEvent<T extends Function>. Does something similar exist in Flow?