Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[use-debounce] Add definition#4531

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Brianzchen merged 3 commits intoflow-typed:masterfromBrianzchen:use-debounce
Oct 13, 2023

Conversation

@Brianzchen
Copy link
Member

Closes#4526

Other notes:

* Subsequent calls to the debounced function `debounced.callback` return the result of the last func invocation.
* Note, that if there are no previous invocations it's mean you will get undefined. You should check it in your code properly.
*/
declare type DebouncedState<R, T: (...args: any) => R> = {|
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Maybe useReturnType if you want to stay close to the TS defs?

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Yes I had tried to follow it exactly, but when I didT: (...args: any) => ReturnType<T> it errors sayingT is undefined, I suppose as a type variableT hasn't been initialised while computing the constraint ofT.

Recreated intry flow. So I just made another genericR which at least allows it to implicitly cast into.

Let me know if you got any other suggestions :)

pascalduez reacted with thumbs up emoji
@BrianzchenBrianzchen merged commit0524ccf intoflow-typed:masterOct 13, 2023
@BrianzchenBrianzchen deleted the use-debounce branchOctober 13, 2023 20:26
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@pascalduezpascalduezpascalduez approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Add use-debounce definition

2 participants

@Brianzchen@pascalduez

[8]ページ先頭

©2009-2025 Movatter.jp