Skip to content

Commit

Permalink
Merge pull request DefinitelyTyped#31575 from DefinitelyTyped/fix-pos…
Browse files Browse the repository at this point in the history
…t-3.3-errors

Fix post 3.3 errors
  • Loading branch information
sandersn authored Dec 21, 2018
2 parents 350cc99 + 19e2475 commit 6f13629
Show file tree
Hide file tree
Showing 12 changed files with 78 additions and 16 deletions.
4 changes: 0 additions & 4 deletions types/blissfuljs/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,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;
Expand Down Expand Up @@ -555,18 +554,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;
Expand Down
4 changes: 3 additions & 1 deletion types/debounce-promise/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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>>;
Expand Down
7 changes: 7 additions & 0 deletions types/debounce-promise/package.json
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/*"] }
}
}
25 changes: 25 additions & 0 deletions types/debounce-promise/ts3.1/debounce-promise-tests.ts
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);
18 changes: 18 additions & 0 deletions types/debounce-promise/ts3.1/index.d.ts
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;
16 changes: 16 additions & 0 deletions types/debounce-promise/ts3.1/tsconfig.json
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"]
}
1 change: 1 addition & 0 deletions types/debounce-promise/ts3.1/tslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
2 changes: 1 addition & 1 deletion types/pixi.js/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion types/quill/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
],
"types": [],
"noEmit": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"quill-tests.ts"
]
}
}
8 changes: 4 additions & 4 deletions types/styled-components/test/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -655,8 +655,8 @@ async function typedThemes() {
createGlobalStyle,
ThemeProvider,
ThemeConsumer
} = (await import("styled-components")) as ThemedStyledComponentsModule<
typeof theme
} = (await import("styled-components")) as any as ThemedStyledComponentsModule<
typeof theme
>;

const ThemedDiv = styled.div`
Expand Down Expand Up @@ -753,10 +753,10 @@ async function themeAugmentation() {
accent: string;
}

const base = (await import("styled-components")) as ThemedStyledComponentsModule<
const base = (await import("styled-components")) as any as ThemedStyledComponentsModule<
BaseTheme
>;
const extra = (await import("styled-components")) as ThemedStyledComponentsModule<
const extra = (await import("styled-components")) as any as ThemedStyledComponentsModule<
ExtraTheme,
BaseTheme
>;
Expand Down
5 changes: 1 addition & 4 deletions types/tingle.js/tingle.js-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ instance = new modal({
},
});

instance.addFooterBtn('text', undefined, function(e) {
e.x;
this.innerText;
});
instance.addFooterBtn('text', undefined, e => e.x);

instance.setStickyFooter(false);
1 change: 0 additions & 1 deletion types/workbox-sw/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"target": "es2017",
"lib": [
"es2015",
"dom",
"webworker"
],
"noImplicitAny": true,
Expand Down

0 comments on commit 6f13629

Please sign in to comment.