Round 1 of fixes

This commit is contained in:
Nathan Shively-Sanders
2018-12-19 14:09:24 -08:00
parent 996c4a2f1f
commit 42fdf759bb
10 changed files with 81 additions and 7 deletions
+1 -4
View File
@@ -2,6 +2,7 @@
// Project: http://blissfuljs.com/
// Definitions by: François Skorzec <https://github.com/fskorzec>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.0
interface Element {
_: BlissNS.BlissBindedElement<Element>;
@@ -285,7 +286,6 @@ declare namespace BlissNS {
addEventListener(type: "MSGotPointerCapture", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): T;
addEventListener(type: "MSInertiaStart", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): T;
addEventListener(type: "MSLostPointerCapture", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): T;
addEventListener(type: "MSManipulationStateChanged", listener: (ev: MSManipulationEvent) => any, useCapture?: boolean): T;
addEventListener(type: "MSPointerCancel", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): T;
addEventListener(type: "MSPointerDown", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): T;
addEventListener(type: "MSPointerEnter", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): T;
@@ -555,18 +555,15 @@ declare namespace BlissNS {
getElementsByTagName(name: "video"): NodeListOf<HTMLVideoElement>;
getElementsByTagName(name: "view"): NodeListOf<SVGViewElement>;
getElementsByTagName(name: "wbr"): NodeListOf<HTMLElement>;
getElementsByTagName(name: "x-ms-webview"): NodeListOf<MSHTMLWebViewElement>;
getElementsByTagName(name: "xmp"): NodeListOf<HTMLElement>;
getElementsByTagName(name: string): NodeListOf<Element>;
getElementsByTagNameNS(namespaceURI: string, localName: string): NodeListOf<Element>;
hasAttribute(name: string): boolean;
hasAttributeNS(namespaceURI: string, localName: string): boolean;
msGetRegionContent(): MSRangeCollection;
msGetUntransformedBounds(): ClientRect;
msMatchesSelector(selectors: string): boolean;
msReleasePointerCapture(pointerId: number): T;
msSetPointerCapture(pointerId: number): T;
msZoomTo(args: MsZoomToOptions): T;
releasePointerCapture(pointerId: number): T;
removeAttribute(name?: string): T;
removeAttributeNS(namespaceURI: string, localName: string): T;
+3 -1
View File
@@ -11,12 +11,14 @@ declare namespace debounce {
}
}
type ArgumentsType<T> = T extends (...args: infer A) => any ? A : never;
declare function debounce<T extends (...args: any[]) => any>(
func: T,
wait?: number,
options?: debounce.DebounceOptions
): (
...args: Parameters<T>
...args: ArgumentsType<T>
) => ReturnType<T> extends Promise<any>
? ReturnType<T>
: Promise<ReturnType<T>>;
+7
View File
@@ -0,0 +1,7 @@
{
"private": true,
"types": "index",
"typesVersions": {
">=3.1.0-0": { "*": ["ts3.1/*"] }
}
}
@@ -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);
+18
View File
@@ -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;
@@ -0,0 +1,7 @@
{
"private": true,
"types": "index",
"typesVersions": {
">=3.2.0-0": { "*": ["ts3.2/*"] }
}
}
@@ -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"]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+1 -1
View File
@@ -2,7 +2,7 @@
// Project: https://github.com/pixijs/pixi.js/tree/dev
// Definitions by: clark-stevenson <https://github.com/clark-stevenson>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
// TypeScript Version: 2.3
declare namespace PIXI {
// from CONST
+2 -1
View File
@@ -15,10 +15,11 @@
],
"types": [],
"noEmit": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"quill-tests.ts"
]
}
}