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
Merged
Changes from1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
add some failures
  • Loading branch information
@Brianzchen
Brianzchen committedOct 10, 2023
commit9daa96243c4775ef5ee1512999f2f9964f657a11
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,7 +5,7 @@ import { useDebounce, useDebouncedCallback, useThrottledCallback } from 'use-deb

describe('use-debounce', () => {
test('useDebounce', () => {
const [value] = useDebounce('test', 1000, {
const [value, debouncedState] = useDebounce('test', 1000, {
maxWait: 1,
leading: true,
trailing: true,
Expand All@@ -14,6 +14,9 @@ describe('use-debounce', () => {
},
});
(value: string);

// $FlowExpectedError[incompatible-cast] infers as a string
(value: number);
});

test('useDebouncedCallback', () => {
Expand All@@ -27,6 +30,13 @@ describe('use-debounce', () => {
// delay in ms
1000
);

debounced.cancel();
debounced.flush();
debounced.isPending();

// $FlowExpectedError[prop-missing]
debounced.foo();
});

test('useThrottledCallback', () => {
Expand All@@ -40,5 +50,12 @@ describe('use-debounce', () => {
// delay in ms
1000
);
})

debounced.cancel();
debounced.flush();
debounced.isPending();

// $FlowExpectedError[prop-missing]
debounced.foo();
});
});

[8]ページ先頭

©2009-2025 Movatter.jp