forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request DefinitelyTyped#31575 from DefinitelyTyped/fix-pos…
…t-3.3-errors Fix post 3.3 errors
- Loading branch information
Showing
12 changed files
with
78 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"private": true, | ||
"types": "index", | ||
"typesVersions": { | ||
">=3.1.0-0": { "*": ["ts3.1/*"] } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import debounce = require("debounce-promise"); | ||
import { DebounceOptions } from "debounce-promise"; | ||
|
||
const options: DebounceOptions = {}; | ||
const optionsA: DebounceOptions = { leading: true }; | ||
const f = async () => 2; | ||
const f2 = (a: string) => 2; | ||
debounce(f, 100); | ||
debounce(f, 0, options); | ||
debounce(f, 100, optionsA); | ||
debounce(f, 10, { accumulate: true }); | ||
const foo = debounce(async () => f2, 10, { | ||
leading: true, | ||
accumulate: true | ||
}); | ||
foo().then(f => f("2")); | ||
const bar = debounce(async () => [1, 2, 3], 100); | ||
bar().then(ar => ar.concat()); | ||
|
||
// Converts the return value from the producer function to a promise | ||
const two = debounce((a: string, b: number, c: { d: boolean }) => [4], 10, { | ||
leading: true, | ||
accumulate: true | ||
}); | ||
two("1", 2, { d: false }).then(ar => ar.pop(), () => 2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
declare namespace debounce { | ||
interface DebounceOptions { | ||
leading?: boolean; | ||
accumulate?: boolean; | ||
} | ||
} | ||
|
||
declare function debounce<T extends (...args: any[]) => any>( | ||
func: T, | ||
wait?: number, | ||
options?: debounce.DebounceOptions | ||
): ( | ||
...args: Parameters<T> | ||
) => ReturnType<T> extends Promise<any> | ||
? ReturnType<T> | ||
: Promise<ReturnType<T>>; | ||
|
||
export = debounce; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"compilerOptions": { | ||
"module": "commonjs", | ||
"lib": ["es6"], | ||
"noImplicitAny": true, | ||
"noImplicitThis": true, | ||
"strictNullChecks": true, | ||
"strictFunctionTypes": true, | ||
"baseUrl": "../../", | ||
"typeRoots": ["../../"], | ||
"types": [], | ||
"noEmit": true, | ||
"forceConsistentCasingInFileNames": true | ||
}, | ||
"files": ["index.d.ts", "debounce-promise-tests.ts"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{ "extends": "dtslint/dt.json" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,6 @@ | |
"target": "es2017", | ||
"lib": [ | ||
"es2015", | ||
"dom", | ||
"webworker" | ||
], | ||
"noImplicitAny": true, | ||
|