From 1916f716dc67551c639b323a14064c7b9f74562e Mon Sep 17 00:00:00 2001 From: Wayne Carson Date: Fri, 30 Nov 2018 15:41:13 -0800 Subject: [PATCH 1/2] Added flush() method to debounce (see https://git.io/fpoYM) --- types/debounce/debounce-tests.ts | 3 +++ types/debounce/index.d.ts | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/types/debounce/debounce-tests.ts b/types/debounce/debounce-tests.ts index 4acff7c446..5f0463a4c1 100644 --- a/types/debounce/debounce-tests.ts +++ b/types/debounce/debounce-tests.ts @@ -14,6 +14,9 @@ const imm1: number = (debounce((x: number) => x * 2, 100, true))(2); const clearable = debounce(doThings); clearable.clear(); +const flushable = debounce(doThings); +flushable.flush(); + // Intentionally asserts that the member variable has all the same benefits as the direct export. // Eventually, if debounce stop supporting the CommonJS-only module calling (`require("debounce")(...)`), // we can remove this and change the top import&require to `import { debounce } from "debounce";`. diff --git a/types/debounce/index.d.ts b/types/debounce/index.d.ts index fa244351d6..bef99f2c86 100644 --- a/types/debounce/index.d.ts +++ b/types/debounce/index.d.ts @@ -1,13 +1,15 @@ -// Type definitions for debounce 3.0 +// Type definitions for debounce 1.2.0 // Project: https://github.com/component/debounce // Definitions by: Denis Sokolov // Josh Goldberg +// Wayne Carson // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace _debounce { const debounce: typeof _debounce; } -declare function _debounce(f: A, interval?: number, immediate?: boolean): A & { clear(): void; }; +declare function _debounce(f: A, interval?: number, immediate?: boolean): A & { clear(): void; } + & { flush(): void }; export = _debounce; From 6645ba33d52edd3303ae58bf81ce6b29042bd924 Mon Sep 17 00:00:00 2001 From: Wayne Carson Date: Fri, 30 Nov 2018 16:12:54 -0800 Subject: [PATCH 2/2] Fixed DT header version convention issue. --- types/debounce/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/debounce/index.d.ts b/types/debounce/index.d.ts index bef99f2c86..e561cb51fe 100644 --- a/types/debounce/index.d.ts +++ b/types/debounce/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for debounce 1.2.0 +// Type definitions for debounce 1.2 // Project: https://github.com/component/debounce // Definitions by: Denis Sokolov // Josh Goldberg