Skip to content

Commit

Permalink
Merge branch 'master' of github.com:flow-typed/flow-typed into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Brianzchen committed Oct 26, 2023
2 parents 908dc38 + 119d3e4 commit 97b7b42
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
@@ -1,4 +1,4 @@
declare module 'body-scroll-lock' {
declare module 'body-scroll-lock-upgrade' {
declare type BodyScrollOptions = {|
reserveScrollBarGap?: boolean,
allowTouchMove?: (el: any) => boolean,
Expand Down
Expand Up @@ -4,7 +4,7 @@ import {
disableBodyScroll,
enableBodyScroll,
clearAllBodyScrollLocks,
} from 'body-scroll-lock';
} from 'body-scroll-lock-upgrade';

declare var element: HTMLElement;
declare var inputElement: HTMLInputElement;
Expand Down
Expand Up @@ -31,11 +31,15 @@ describe('use-debounce', () => {
1000
);

debounced('test');
// $FlowExpectedError[incompatible-call] it matches the type of the callback
debounced(123);

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

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

Expand All @@ -51,11 +55,15 @@ describe('use-debounce', () => {
1000
);

debounced('test');
// $FlowExpectedError[incompatible-call] it matches the type of the callback
debounced(123);

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

// $FlowExpectedError[prop-missing]
// $FlowExpectedError[incompatible-call]
debounced.foo();
});
});
Expand Up @@ -37,10 +37,7 @@ declare module 'use-debounce' {
* 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> = {|
...ControlFunctions,
(...args: Parameters<T>): R | void,
|};
declare type DebouncedState<R, T: (...args: any) => R> = ControlFunctions & ((...args: Parameters<T>) => R | void);

declare module.exports: {|
useDebounce: <T>(value: T, delay: number, options?: {|
Expand Down

0 comments on commit 97b7b42

Please sign in to comment.