mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-11-03 05:20:31 +00:00
Strict function variance fixes round 1, stage 1
This commit is contained in:
Vendored
+1
-1
@@ -219,7 +219,7 @@ declare namespace Backbone {
|
||||
/**
|
||||
* Specify a model attribute name (string) or function that will be used to sort the collection.
|
||||
*/
|
||||
comparator: string | ((element: TModel) => number | string) | ((compare: TModel, to?: TModel) => number);
|
||||
comparator: string | { bivarianceHack(element: TModel): number | string }["bivarianceHack"] | { bivarianceHack(compare: TModel, to?: TModel): number }["bivarianceHack"];
|
||||
|
||||
add(model: {}|TModel, options?: AddOptions): TModel;
|
||||
add(models: ({}|TModel)[], options?: AddOptions): TModel[];
|
||||
|
||||
Vendored
+7
-7
@@ -7,9 +7,9 @@
|
||||
/// <reference types="jquery" />
|
||||
|
||||
/** Bootbox options shared by all modal types */
|
||||
interface BootboxBaseOptions {
|
||||
interface BootboxBaseOptions<T = any> {
|
||||
title?: string | Element;
|
||||
callback?: (result: boolean | string) => any;
|
||||
callback?: (result: T) => any;
|
||||
onEscape?: (() => any) | boolean;
|
||||
show?: boolean;
|
||||
backdrop?: boolean;
|
||||
@@ -22,24 +22,24 @@ interface BootboxBaseOptions {
|
||||
}
|
||||
|
||||
/** Bootbox options available for custom modals */
|
||||
interface BootboxDialogOptions extends BootboxBaseOptions {
|
||||
interface BootboxDialogOptions<T = any> extends BootboxBaseOptions<T> {
|
||||
message: string | Element;
|
||||
}
|
||||
|
||||
/** Bootbox options available for alert modals */
|
||||
interface BootboxAlertOptions extends BootboxDialogOptions {
|
||||
interface BootboxAlertOptions extends BootboxDialogOptions<void> {
|
||||
callback?: () => any;
|
||||
buttons?: BootboxAlertButtonMap;
|
||||
}
|
||||
|
||||
/** Bootbox options available for confirm modals */
|
||||
interface BootboxConfirmOptions extends BootboxDialogOptions {
|
||||
interface BootboxConfirmOptions extends BootboxDialogOptions<boolean> {
|
||||
callback: (result: boolean) => any;
|
||||
buttons?: BootboxConfirmPromptButtonMap;
|
||||
}
|
||||
|
||||
/** Bootbox options available for prompt modals */
|
||||
interface BootboxPromptOptions extends BootboxBaseOptions {
|
||||
interface BootboxPromptOptions extends BootboxBaseOptions<string> {
|
||||
title: string;
|
||||
value?: string;
|
||||
inputType?: "text" | "textarea" | "email" | "select" | "checkbox" | "date" | "time" | "number" | "password";
|
||||
@@ -93,7 +93,7 @@ interface BootboxStatic {
|
||||
prompt(message: string, callback: (result: string) => void): JQuery;
|
||||
prompt(options: BootboxPromptOptions): JQuery;
|
||||
dialog(message: string, callback?: (result: string) => void): JQuery;
|
||||
dialog(options: BootboxDialogOptions): JQuery;
|
||||
dialog(options: BootboxDialogOptions<string>): JQuery;
|
||||
setDefaults(options: BootboxDefaultOptions): void;
|
||||
hideAll(): void;
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
@@ -20,4 +21,4 @@
|
||||
"index.d.ts",
|
||||
"bootbox-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ interface Window {
|
||||
* NOTE: The InAppBrowser window behaves like a standard web browser, and can't access Cordova APIs.
|
||||
*/
|
||||
interface InAppBrowser extends Window {
|
||||
onloadstart(type: InAppBrowserEvent): void;
|
||||
onloadstart(type: Event): void;
|
||||
onloadstop(type: InAppBrowserEvent): void;
|
||||
onloaderror(type: InAppBrowserEvent): void;
|
||||
onexit(type: InAppBrowserEvent): void;
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
"noImplicitAny": false,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
@@ -20,4 +21,4 @@
|
||||
"index.d.ts",
|
||||
"cordova-plugin-inappbrowser-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -61,8 +61,8 @@ declare namespace WL {
|
||||
getHeader(name: any): string;
|
||||
}
|
||||
interface Options {
|
||||
onSuccess?: (response: IResponse) => void;
|
||||
onFailure?: (response: IResponse) => void;
|
||||
onSuccess?(response: IResponse): void;
|
||||
onFailure?(response: IResponse): void;
|
||||
invocationContext?: any;
|
||||
}
|
||||
interface ResponseHandler<T> {
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
@@ -20,4 +21,4 @@
|
||||
"index.d.ts",
|
||||
"ibm-mobilefirst-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -144,13 +144,13 @@ const nodeStyle = (input: string, cb: (error: any, success: any) => void) => {
|
||||
cb(null, input);
|
||||
};
|
||||
|
||||
Q.nfapply(nodeStyle, ["foo"]).done((result: string) => {
|
||||
Q.nfapply<string>(nodeStyle, ["foo"]).done((result: string) => {
|
||||
});
|
||||
Q.nfcall(nodeStyle, "foo").done((result: string) => {
|
||||
Q.nfcall<string>(nodeStyle, "foo").done((result: string) => {
|
||||
});
|
||||
Q.denodeify(nodeStyle)('foo').done((result: string) => {
|
||||
Q.denodeify<string>(nodeStyle)('foo').done((result: string) => {
|
||||
});
|
||||
Q.nfbind(nodeStyle)('foo').done((result: string) => {
|
||||
Q.nfbind<string>(nodeStyle)('foo').done((result: string) => {
|
||||
});
|
||||
|
||||
class Repo {
|
||||
@@ -171,7 +171,7 @@ class Repo {
|
||||
}
|
||||
|
||||
const kitty = new Repo();
|
||||
Q.nbind(kitty.find, kitty)({cute: true}).done((kitties: any[]) => {
|
||||
Q.nbind<any[]>(kitty.find, kitty)({cute: true}).done((kitties: any[]) => {
|
||||
});
|
||||
|
||||
/**
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
|
||||
Vendored
+3
-3
@@ -72,7 +72,7 @@ declare namespace React {
|
||||
type ComponentType<P = {}> = ComponentClass<P> | StatelessComponent<P>;
|
||||
|
||||
type Key = string | number;
|
||||
type Ref<T> = string | ((instance: T | null) => any);
|
||||
type Ref<T> = string | { bivarianceHack(instance: T | null): any }["bivarianceHack"];
|
||||
|
||||
// tslint:disable-next-line:interface-over-type-literal
|
||||
type ComponentState = {};
|
||||
@@ -555,7 +555,7 @@ declare namespace React {
|
||||
// Event Handler Types
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
type EventHandler<E extends SyntheticEvent<any>> = (event: E) => void;
|
||||
type EventHandler<E extends SyntheticEvent<any>> = { bivarianceHack(event: E): void }["bivarianceHack"];
|
||||
|
||||
type ReactEventHandler<T> = EventHandler<SyntheticEvent<T>>;
|
||||
|
||||
@@ -3369,7 +3369,7 @@ declare namespace React {
|
||||
// React.PropTypes
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
type Validator<T> = (object: T, key: string, componentName: string, ...rest: any[]) => Error | null;
|
||||
type Validator<T> = { bivarianceHack(object: T, key: string, componentName: string, ...rest: any[]): Error | null }["bivarianceHack"];
|
||||
|
||||
interface Requireable<T> extends Validator<T> {
|
||||
isRequired: Validator<T>;
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": false,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
|
||||
Reference in New Issue
Block a user