mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
Change order of overloads so that user code doesn't need parameter type declarations. (#12389)
This commit is contained in:
parent
403421e738
commit
e515b24a20
@ -245,7 +245,7 @@ describe('AngularWizard', function () {
|
||||
$rootScope.$digest();
|
||||
expect(scope.referenceCurrentStep).toEqual('Starting');
|
||||
});
|
||||
it("should go to the next step because the promise that CANENTER returns resolves to true", function (done: DoneFn) {
|
||||
it("should go to the next step because the promise that CANENTER returns resolves to true", function (done) {
|
||||
var scope = <IWizardScope>$rootScope.$new();
|
||||
scope.dynamicStepDisabled = 'Y';
|
||||
var view = createGenericView(scope);
|
||||
|
||||
@ -650,12 +650,12 @@ angular.module('AnotherSampleDirective', []).directive('myDirective', ['$interpo
|
||||
resolve();
|
||||
});
|
||||
|
||||
promise = new $q((resolve: angular.IQResolveReject<{}>, reject: angular.IQResolveReject<any>) => {
|
||||
promise = new $q((resolve, reject) => {
|
||||
reject();
|
||||
resolve(true);
|
||||
});
|
||||
|
||||
promise = new $q<boolean>((resolver: angular.IQResolveReject<boolean>, reject: angular.IQResolveReject<any>) => {
|
||||
promise = new $q<boolean>((resolver, reject) => {
|
||||
resolver(true);
|
||||
reject(false);
|
||||
});
|
||||
|
||||
8
angular/index.d.ts
vendored
8
angular/index.d.ts
vendored
@ -984,9 +984,7 @@ declare namespace angular {
|
||||
* See http://docs.angularjs.org/api/ng/service/$q
|
||||
*/
|
||||
interface IQService {
|
||||
new <T>(resolver: (resolve: IQResolveReject<T>) => any): IPromise<T>;
|
||||
new <T>(resolver: (resolve: IQResolveReject<T>, reject: IQResolveReject<any>) => any): IPromise<T>;
|
||||
<T>(resolver: (resolve: IQResolveReject<T>) => any): IPromise<T>;
|
||||
<T>(resolver: (resolve: IQResolveReject<T>, reject: IQResolveReject<any>) => any): IPromise<T>;
|
||||
|
||||
/**
|
||||
@ -1380,12 +1378,12 @@ declare namespace angular {
|
||||
*/
|
||||
url: string;
|
||||
/**
|
||||
* Event listeners to be bound to the XMLHttpRequest object.
|
||||
* Event listeners to be bound to the XMLHttpRequest object.
|
||||
* To bind events to the XMLHttpRequest upload object, use uploadEventHandlers. The handler will be called in the context of a $apply block.
|
||||
*/
|
||||
eventHandlers?: { [type: string]: EventListenerOrEventListenerObject };
|
||||
/**
|
||||
* Event listeners to be bound to the XMLHttpRequest upload object.
|
||||
* Event listeners to be bound to the XMLHttpRequest upload object.
|
||||
* To bind events to the XMLHttpRequest object, use eventHandlers. The handler will be called in the context of a $apply block.
|
||||
*/
|
||||
uploadEventHandlers?: { [type: string]: EventListenerOrEventListenerObject };
|
||||
@ -1709,7 +1707,7 @@ declare namespace angular {
|
||||
(new (...args: any[]) => IController) |
|
||||
// Instead of classes, plain functions are often used as controller constructors, especially in examples.
|
||||
((...args: any[]) => (void | IController));
|
||||
|
||||
|
||||
/**
|
||||
* Directive controllers have a well-defined lifecycle. Each controller can implement "lifecycle hooks". These are methods that
|
||||
* will be called by Angular at certain points in the life cycle of the directive.
|
||||
|
||||
@ -12,7 +12,7 @@ namespace bardTests {
|
||||
constructor(private $q: angular.IQService) {}
|
||||
|
||||
remoteCall(): angular.IPromise<string[]> {
|
||||
return new this.$q((resolve: angular.IQResolveReject<{}>, reject: angular.IQResolveReject<any>) => {
|
||||
return new this.$q((resolve, reject) => {
|
||||
resolve(['Hello', 'World']);
|
||||
});
|
||||
}
|
||||
|
||||
@ -317,7 +317,7 @@ mixedObjectDateBisectorObject = d3Array.bisector<MixedObject, Date>(function (el
|
||||
});
|
||||
|
||||
// define using comparator
|
||||
mixedObjectDateBisectorObject = d3Array.bisector<MixedObject, Date>(function (el: MixedObject, x: Date) {
|
||||
mixedObjectDateBisectorObject = d3Array.bisector<MixedObject, Date>(function (el, x) {
|
||||
return el.date.valueOf() - x.valueOf();
|
||||
});
|
||||
|
||||
|
||||
3
d3-array/index.d.ts
vendored
3
d3-array/index.d.ts
vendored
@ -195,10 +195,9 @@ export interface Bisector<T, U> {
|
||||
right: (array: T[], x: U, lo?: number, hi?: number) => number;
|
||||
}
|
||||
|
||||
export function bisector<T, U>(comparator: (a: T, b: U) => number): Bisector<T, U>;
|
||||
export function bisector<T, U>(accessor: (x: T) => U): Bisector<T, U>;
|
||||
|
||||
export function bisector<T, U>(comparator: (a: T, b: U) => number): Bisector<T, U>
|
||||
|
||||
// NB. this is limited to primitive values due to D3's use of the <, >, and >= operators. Results get weird for object instances.
|
||||
/**
|
||||
* Compares two primitive values for sorting (in ascending order).
|
||||
|
||||
@ -109,11 +109,11 @@ flikty2.on(FlickityEvents.cellSelect, (evt, ele) => {
|
||||
//do something
|
||||
});
|
||||
|
||||
flikty2.off(FlickityEvents.cellSelect, (evt: Event, ele: Element | Touch, pntr: Element, vctr: number) => {
|
||||
flikty2.off(FlickityEvents.cellSelect, (evt, ele, pntr, vctr) => {
|
||||
//do something
|
||||
});
|
||||
|
||||
flikty2.once(FlickityEvents.cellSelect, (evt: Event, ele: Element | Touch, pntr: Object) => {
|
||||
flikty2.once(FlickityEvents.cellSelect, (evt, ele, pntr) => {
|
||||
//do something
|
||||
});
|
||||
|
||||
|
||||
56
flickity/index.d.ts
vendored
56
flickity/index.d.ts
vendored
@ -161,13 +161,7 @@ declare class Flickity {
|
||||
* @param eventName name of event (@see FlickityEvents class for filckity supported events)
|
||||
* @param callback callback funtion to execute when event fires
|
||||
*/
|
||||
on(eventname: string, callback: (eventt?: Event, cellElement?: Element) => any) : void;
|
||||
/**
|
||||
* bind event listener
|
||||
* @param eventName name of event (@see FlickityEvents class for filckity supported events)
|
||||
* @param callback callback funtion to execute when event fires
|
||||
*/
|
||||
on(eventname: string, callback: (event?: Event, pointer?: Element | Touch) => any): void;
|
||||
on(eventname: string, callback: (event?: Event, pointer?: Element | Touch, cellElement?: Element, cellIndex?: number) => any): void;
|
||||
/**
|
||||
* bind event listener
|
||||
* @param eventName name of event (@see FlickityEvents class for filckity supported events)
|
||||
@ -179,7 +173,27 @@ declare class Flickity {
|
||||
* @param eventName name of event (@see FlickityEvents class for filckity supported events)
|
||||
* @param callback callback funtion to execute when event fires
|
||||
*/
|
||||
on(eventname: string, callback: (event?: Event, pointer?: Element | Touch, cellElement?: Element, cellIndex?: number) => any): void;
|
||||
on(eventname: string, callback: (eventt?: Event, cellElement?: Element) => any) : void;
|
||||
/**
|
||||
* bind event listener
|
||||
* @param eventName name of event (@see FlickityEvents class for filckity supported events)
|
||||
* @param callback callback funtion to execute when event fires
|
||||
*/
|
||||
on(eventname: string, callback: (event?: Event, pointer?: Element | Touch) => any): void;
|
||||
|
||||
/**
|
||||
* Remove event listener
|
||||
* @param eventName name of event (@see FlickityEvents class for filckity supported events)
|
||||
* @param callback callback funtion to execute when event fires
|
||||
*/
|
||||
off(eventname: string, callback: (event?: Event, pointer?: Element | Touch, cellElement?: Element, cellIndex?: number) => any): void;
|
||||
|
||||
/**
|
||||
* Remove event listener
|
||||
* @param eventName name of event (@see FlickityEvents class for filckity supported events)
|
||||
* @param callback callback funtion to execute when event fires
|
||||
*/
|
||||
off(eventname: string, callback: (event?: Event, pointer?: Element | Touch, moveVector?: Object) => any): void;
|
||||
|
||||
/**
|
||||
* Remove event listener
|
||||
@ -195,20 +209,20 @@ declare class Flickity {
|
||||
*/
|
||||
off(eventname: string, callback: (event?: Event, pointer?: Element | Touch) => any): void;
|
||||
|
||||
|
||||
/**
|
||||
* Remove event listener
|
||||
* one time event handler
|
||||
* @param eventName name of event (@see FlickityEvents class for filckity supported events)
|
||||
* @param callback callback funtion to execute when event fires
|
||||
*/
|
||||
off(eventname: string, callback: (event?: Event, pointer?: Element | Touch, moveVector?: Object) => any): void;
|
||||
once(eventname: string, callback: (event?: Event, pointer?: Element | Touch, cellElement?: Element, cellIndex?: number) => any): void;
|
||||
|
||||
/**
|
||||
* Remove event listener
|
||||
* one time event handler
|
||||
* @param eventName name of event (@see FlickityEvents class for filckity supported events)
|
||||
* @param callback callback funtion to execute when event fires
|
||||
*/
|
||||
off(eventname: string, callback: (event?: Event, pointer?: Element | Touch, cellElement?: Element, cellIndex?: number) => any): void;
|
||||
|
||||
once(eventname: string, callback: (event?: Event, pointer?: Element | Touch, moveVector?: Object) => any): void;
|
||||
|
||||
/**
|
||||
* one time event handler
|
||||
@ -223,22 +237,6 @@ declare class Flickity {
|
||||
* @param callback callback funtion to execute when event fires
|
||||
*/
|
||||
once(eventname: string, callback: (event?: Event, pointer?: Element | Touch) => any): void;
|
||||
|
||||
/**
|
||||
* one time event handler
|
||||
* @param eventName name of event (@see FlickityEvents class for filckity supported events)
|
||||
* @param callback callback funtion to execute when event fires
|
||||
*/
|
||||
once(eventname: string, callback: (event?: Event, pointer?: Element | Touch, moveVector?: Object) => any): void;
|
||||
|
||||
/**
|
||||
* one time event handler
|
||||
* @param eventName name of event (@see FlickityEvents class for filckity supported events)
|
||||
* @param callback callback funtion to execute when event fires
|
||||
*/
|
||||
once(eventname: string, callback: (event?: Event, pointer?: Element | Touch, cellElement?: Element, cellIndex?: number) => any): void;
|
||||
|
||||
|
||||
}
|
||||
|
||||
interface FlickityOptions {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
|
||||
var array = [1, 2, 3, 4];
|
||||
from(array).each(function (value: number, key: {}) {
|
||||
from(array).each(function (value, key) {
|
||||
console.log('Value ' + value + ' at index ' + key);
|
||||
});
|
||||
3
fromjs/index.d.ts
vendored
3
fromjs/index.d.ts
vendored
@ -32,9 +32,8 @@ declare namespace FromJS {
|
||||
contains(item: T): boolean;
|
||||
first(predicate: (item: T) => boolean): T;
|
||||
firstOrDefault(): T;
|
||||
each(action: (item: T) => void): void;
|
||||
each<TKey>(action: (value: T, key: TKey) => void): void;
|
||||
each(action: (item: T) => void, a: boolean): void;
|
||||
each(action: (item: T) => void, a?: boolean): void;
|
||||
toArray(): Array<T>;
|
||||
concat(second: Array<T>): IQueryable<T>;
|
||||
sum(): T;
|
||||
|
||||
@ -9,7 +9,7 @@ describe('specs', () => {
|
||||
JasminePromiseMatchers.uninstall
|
||||
});
|
||||
|
||||
it('should have correct syntax', (done: DoneFn) => {
|
||||
it('should have correct syntax', (done) => {
|
||||
var foo = {};
|
||||
var bar = {};
|
||||
|
||||
|
||||
7
jasmine/index.d.ts
vendored
7
jasmine/index.d.ts
vendored
@ -10,24 +10,17 @@ declare function describe(description: string, specDefinitions: () => void): voi
|
||||
declare function fdescribe(description: string, specDefinitions: () => void): void;
|
||||
declare function xdescribe(description: string, specDefinitions: () => void): void;
|
||||
|
||||
declare function it(expectation: string, assertion?: () => void, timeout?: number): void;
|
||||
declare function it(expectation: string, assertion?: (done: DoneFn) => void, timeout?: number): void;
|
||||
declare function fit(expectation: string, assertion?: () => void, timeout?: number): void;
|
||||
declare function fit(expectation: string, assertion?: (done: DoneFn) => void, timeout?: number): void;
|
||||
declare function xit(expectation: string, assertion?: () => void, timeout?: number): void;
|
||||
declare function xit(expectation: string, assertion?: (done: DoneFn) => void, timeout?: number): void;
|
||||
|
||||
/** If you call the function pending anywhere in the spec body, no matter the expectations, the spec will be marked pending. */
|
||||
declare function pending(reason?: string): void;
|
||||
|
||||
declare function beforeEach(action: () => void, timeout?: number): void;
|
||||
declare function beforeEach(action: (done: DoneFn) => void, timeout?: number): void;
|
||||
declare function afterEach(action: () => void, timeout?: number): void;
|
||||
declare function afterEach(action: (done: DoneFn) => void, timeout?: number): void;
|
||||
|
||||
declare function beforeAll(action: () => void, timeout?: number): void;
|
||||
declare function beforeAll(action: (done: DoneFn) => void, timeout?: number): void;
|
||||
declare function afterAll(action: () => void, timeout?: number): void;
|
||||
declare function afterAll(action: (done: DoneFn) => void, timeout?: number): void;
|
||||
|
||||
declare function expect(spy: Function): jasmine.Matchers;
|
||||
|
||||
7
mongoose-promise/index.d.ts
vendored
7
mongoose-promise/index.d.ts
vendored
@ -34,7 +34,6 @@ declare module 'mongoose' {
|
||||
* promises are not present) but still support plugging in your own ES6-compatible
|
||||
* promises library. Mongoose 5.0 will not support mpromise.
|
||||
*/
|
||||
constructor(fn?: (err: any, arg: T) => void);
|
||||
constructor(fn?: (err: any, ...args: T[]) => void);
|
||||
|
||||
/**
|
||||
@ -42,14 +41,12 @@ declare module 'mongoose' {
|
||||
* It will be executed with traditional node.js argument position when the promise is resolved.
|
||||
* @deprecated Use onResolve instead.
|
||||
*/
|
||||
addBack(listener: (err: any, arg: T) => void): this;
|
||||
addBack(listener: (err: any, ...args: T[]) => void): this;
|
||||
|
||||
/**
|
||||
* Adds a listener to the complete (success) event.
|
||||
* @deprecated Adds a listener to the complete (success) event.
|
||||
*/
|
||||
addCallback(listener: (arg: T) => void): this;
|
||||
addCallback(listener: (...args: T[]) => void): this;
|
||||
|
||||
/**
|
||||
@ -102,8 +99,6 @@ declare module 'mongoose' {
|
||||
* SUCCESS/ERROR callbacks to this promise after the nextTick.
|
||||
* Conforms to promises/A+ specification.
|
||||
*/
|
||||
then<TRes>(onFulFill: (arg: T) => void | TRes | PromiseLike<TRes>,
|
||||
onReject?: (err: any) => void | TRes | PromiseLike<TRes>): MongoosePromise<TRes>;
|
||||
then<TRes>(onFulfill: (...args: T[]) => void | TRes | PromiseLike<TRes>,
|
||||
onReject?: (err: any) => void | TRes | PromiseLike<TRes>): MongoosePromise<TRes>;
|
||||
|
||||
@ -111,12 +106,10 @@ declare module 'mongoose' {
|
||||
* Fulfills this promise with passed arguments. Alias of mpromise#fulfill.
|
||||
* @deprecated Use fulfill instead.
|
||||
*/
|
||||
complete(args: T): this;
|
||||
complete(...args: T[]): this;
|
||||
|
||||
/** Fulfills this promise with passed arguments. */
|
||||
fulfill(...args: T[]): this;
|
||||
fulfill(arg: T): this;
|
||||
|
||||
/** ES6-style promise constructor wrapper around mpromise. */
|
||||
static ES6<TRes>(resolver: (
|
||||
|
||||
@ -6,14 +6,14 @@ var mongopromise: mongoose.Promise<number>;
|
||||
mongopromise.addBack(function (err, arg) {
|
||||
err.stack;
|
||||
arg.toFixed();
|
||||
}).addBack(function (err: any, arg1: number, arg2: number) {
|
||||
}).addBack(function (err, arg1, arg2) {
|
||||
err.stack;
|
||||
arg1.toFixed();
|
||||
arg2.toFixed();
|
||||
});
|
||||
mongopromise.addCallback(function (arg) {
|
||||
arg.toFixed();
|
||||
}).addCallback(function (arg1: number, arg2: number) {
|
||||
}).addCallback(function (arg1, arg2) {
|
||||
arg1.toFixed();
|
||||
arg2.toFixed();
|
||||
});
|
||||
@ -34,7 +34,7 @@ mongopromise.then(function (arg) {
|
||||
}, function (err) {
|
||||
err.stack;
|
||||
return 9;
|
||||
}).then(function (arg1: number, arg2: number) {
|
||||
}).then(function (arg1, arg2) {
|
||||
arg1.toFixed();
|
||||
arg2.toFixed();
|
||||
});
|
||||
|
||||
6
mongoose/index.d.ts
vendored
6
mongoose/index.d.ts
vendored
@ -594,17 +594,17 @@ declare module "mongoose" {
|
||||
* @param method name of the method to hook
|
||||
* @param fn callback
|
||||
*/
|
||||
post<T extends Document>(method: string, fn: (doc: T) => void, ...args: any[]): this;
|
||||
post<T extends Document>(method: string, fn: (doc: T, next: (err?: NativeError) => void,
|
||||
...otherArgs: any[]) => void): this;
|
||||
post<T extends Document>(method: string, fn: (doc: T) => void, ...args: any[]): this;
|
||||
|
||||
/**
|
||||
* Defines a pre hook for the document.
|
||||
*/
|
||||
pre(method: string, fn: (next: (err?: NativeError) => void) => void,
|
||||
errorCb?: (err: Error) => void): this;
|
||||
pre(method: string, parallel: boolean, fn: (next: (err?: NativeError) => void, done: () => void) => void,
|
||||
errorCb?: (err: Error) => void): this;
|
||||
pre(method: string, fn: (next: (err?: NativeError) => void) => void,
|
||||
errorCb?: (err: Error) => void): this;
|
||||
|
||||
/**
|
||||
* Adds a method call to the queue.
|
||||
|
||||
@ -254,7 +254,7 @@ schema.plugin(function (schema, opts) {
|
||||
schema.get('path');
|
||||
opts.hasOwnProperty('');
|
||||
}).plugin(cb, {opts: true});
|
||||
schema.post('post', function (doc: mongoose.Document) {}).post('post', function (doc: mongoose.Document, next: (err: mongoose.NativeError) => void) {
|
||||
schema.post('post', function (doc) {}).post('post', function (doc, next) {
|
||||
next(new Error());
|
||||
});
|
||||
schema.queue('m1', [1, 2, 3]).queue('m2', [[]]);
|
||||
|
||||
35
multiplexjs/index.d.ts
vendored
35
multiplexjs/index.d.ts
vendored
@ -1989,39 +1989,10 @@ declare namespace multiplex {
|
||||
|
||||
|
||||
/**
|
||||
* Projects each element of a sequence into a new form.
|
||||
* @param selector A transform function to apply to each source element.
|
||||
*/
|
||||
select<TResult>(selector: (item: T) => TResult): Enumerable<TResult>
|
||||
|
||||
|
||||
/**
|
||||
* Projects each element of a sequence into a new form by incorporating the element's index.
|
||||
* Projects each element of a sequence into a new form. May incorporate the element's index.
|
||||
* @param selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element.
|
||||
*/
|
||||
select<TResult>(selector: (item: T, index: number) => TResult): Enumerable<TResult>
|
||||
|
||||
|
||||
/**
|
||||
* Projects each element of a sequence to an Enumerable and flattens the resulting sequences into one sequence.
|
||||
* @param collectionSelector A transform function to apply to each source element.
|
||||
*/
|
||||
selectMany<TResult>(selector: (item: T) => Iterable<TResult>): Enumerable<TResult>;
|
||||
|
||||
|
||||
/**
|
||||
* Projects each element of a sequence to an Enumerable and flattens the resulting sequences into one sequence. The index of each source element is used in the projected form of that element.
|
||||
* @param collectionSelector A transform function to apply to each source element; the second parameter of the function represents the index of the source element.
|
||||
*/
|
||||
selectMany<TResult>(selector: (item: T, index: number) => Iterable<TResult>): Enumerable<TResult>;
|
||||
|
||||
|
||||
/**
|
||||
* Projects each element of a sequence to an Enumerable and flattens the resulting sequences into one sequence.
|
||||
* @param collectionSelector A transform function to apply to each source element; the second parameter of the function represents the index of the source element.
|
||||
* @param resultSelector A transform function to apply to each element of the intermediate sequence.
|
||||
*/
|
||||
selectMany<TCollection, TResult>(collectionSelector: (item: T) => Iterable<TCollection>, resultSelector: (item: T, collection: TCollection) => TResult): Enumerable<TResult>;
|
||||
select<TResult>(selector: (item: T, index: number) => TResult): Enumerable<TResult>;
|
||||
|
||||
|
||||
/**
|
||||
@ -2029,7 +2000,7 @@ declare namespace multiplex {
|
||||
* @param collectionSelector A transform function to apply to each source element; the second parameter of the function represents the index of the source element.
|
||||
* @param resultSelector A transform function to apply to each element of the intermediate sequence.
|
||||
*/
|
||||
selectMany<TCollection, TResult>(collectionSelector: (item: T, index: number) => Iterable<TCollection>, resultSelector: (item: T, collection: TCollection) => TResult): Enumerable<TResult>;
|
||||
selectMany<TCollection, TResult>(collectionSelector: (item: T, index: number) => Iterable<TCollection>, resultSelector?: (item: T, collection: TCollection) => TResult): Enumerable<TResult>;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -657,7 +657,7 @@ namespace MxTests {
|
||||
var _arr = CreateNumberArray();
|
||||
|
||||
assert.ok(mx(_arr).select(t => t + 100).first() === 100, "select first 10 numbers plus 100!");
|
||||
assert.ok(mx(_arr).select((t: number, i: number) => i).last() === 9, "select index while enumerating 10 numbers!");
|
||||
assert.ok(mx(_arr).select((t, i) => i).last() === 9, "select index while enumerating 10 numbers!");
|
||||
});
|
||||
|
||||
|
||||
|
||||
10
nightmare/index.d.ts
vendored
10
nightmare/index.d.ts
vendored
@ -18,12 +18,12 @@ declare class Nightmare {
|
||||
upload(selector: string, path: string): Nightmare;
|
||||
scrollTo(top: number, left: number): Nightmare;
|
||||
inject(type: string, file: string): Nightmare;
|
||||
evaluate(fn: () => void): Nightmare;
|
||||
evaluate<R>(fn: () => R, cb: (result: R) => void): Nightmare;
|
||||
evaluate<T>(fn: (arg: T) => void, cb: () => void, arg: T): Nightmare;
|
||||
evaluate<T, R>(fn: (arg: T) => R, cb: (result: R) => void, arg: T): Nightmare;
|
||||
evaluate<T1, T2, R>(fn: (arg1: T1, arg2: T2) => R, cb: (result: R) => void, arg1: T1, arg2: T2): Nightmare;
|
||||
evaluate<T1, T2, T3, R>(fn: (arg1: T1, arg2: T2, arg3: T3) => R, cb: (result: R) => void, arg1: T1, arg2: T2, arg3: T3): Nightmare;
|
||||
evaluate<T1, T2, R>(fn: (arg1: T1, arg2: T2) => R, cb: (result: R) => void, arg1: T1, arg2: T2): Nightmare;
|
||||
evaluate<T, R>(fn: (arg: T) => R, cb: (result: R) => void, arg: T): Nightmare;
|
||||
evaluate<T>(fn: (arg: T) => void, cb: () => void, arg: T): Nightmare;
|
||||
evaluate<R>(fn: () => R, cb: (result: R) => void): Nightmare;
|
||||
evaluate(fn: () => void): Nightmare;
|
||||
wait(): Nightmare;
|
||||
wait(ms: number): Nightmare;
|
||||
wait(selector: string): Nightmare;
|
||||
|
||||
@ -75,7 +75,7 @@ new Nightmare()
|
||||
.goto('http://yahoo.com')
|
||||
.evaluate(function (parameter) {
|
||||
return document.title + ' -- ' + parameter;
|
||||
}, function (title: string) {
|
||||
}, function (title) {
|
||||
}, 'testparameter')
|
||||
.run(done);
|
||||
|
||||
|
||||
1
phantom/index.d.ts
vendored
1
phantom/index.d.ts
vendored
@ -15,7 +15,6 @@ export interface WebPage {
|
||||
close(): Promise<void>;
|
||||
|
||||
evaluate<R>(callback: () => R): Promise<R>;
|
||||
evaluate<T>(callback: (arg: T) => void, arg: T): Promise<void>;
|
||||
evaluate<T, R>(callback: (arg: T) => R, arg: T): Promise<R>;
|
||||
evaluate<T1, T2, R>(callback: (arg1: T1, arg2: T2) => R, arg1: T1, arg2: T2): Promise<R>;
|
||||
evaluate<T1, T2, T3, R>(callback: (arg1: T1, arg2: T2, arg3: T3) => R, arg1: T1, arg2: T2, arg3: T3): Promise<R>;
|
||||
|
||||
@ -34,10 +34,11 @@ phantom.create(["--web-security=no", "--ignore-ssl-errors=yes"]).then((ph) => {
|
||||
console.log(selector + " contains the following text: " + text);
|
||||
}, "title");
|
||||
}).then(() => {
|
||||
return page.evaluate(function(selector: any) {
|
||||
page.evaluate(f => f + 1, "zero");
|
||||
return page.evaluate(function(selector) {
|
||||
var text = (<HTMLElement>document.querySelector(selector)).innerText
|
||||
return text
|
||||
})
|
||||
}, "mySelector")
|
||||
}).then(function(result) {
|
||||
console.log("The element contains the following text: " + result)
|
||||
|
||||
|
||||
86
pinkyswear/index.d.ts
vendored
86
pinkyswear/index.d.ts
vendored
@ -29,40 +29,6 @@ declare namespace PinkySwear {
|
||||
*/
|
||||
(fulfilled: boolean, ...values: any[]): Promise;
|
||||
|
||||
/**
|
||||
* Called when or if the promise is either resolved or rejected.
|
||||
*
|
||||
* @returns PinkySwear.Promise
|
||||
*/
|
||||
then(): Promise;
|
||||
|
||||
/**
|
||||
* Called when or if the promise is either resolved or rejected.
|
||||
*
|
||||
* @param onFulfilled Called when or if the promise is resolved.
|
||||
* @param onRejected Called when or if the promise is rejected.
|
||||
* @returns PinkySwear.Promise
|
||||
*/
|
||||
then(onFulfilled?: () => Promise, onRejected?: () => void): Promise;
|
||||
|
||||
/**
|
||||
* Called when or if the promise is either resolved or rejected.
|
||||
*
|
||||
* @param onFulfilled Called when or if the promise is resolved.
|
||||
* @param onRejected Called when or if the promise is rejected.
|
||||
* @returns PinkySwear.Promise
|
||||
*/
|
||||
then(onFulfilled?: () => void, onRejected?: () => void): Promise;
|
||||
|
||||
/**
|
||||
* Called when or if the promise is either resolved or rejected.
|
||||
*
|
||||
* @param onFulfilled Called when or if the promise is resolved.
|
||||
* @param onRejected Called when or if the promise is rejected.
|
||||
* @returns PinkySwear.Promise
|
||||
*/
|
||||
then(onFulfilled?: () => any, onRejected?: () => void): Promise;
|
||||
|
||||
/**
|
||||
* onFulfilled is called when or if the promise is resolved.
|
||||
* onRejected is called when or if the promise is rejected.
|
||||
@ -71,57 +37,7 @@ declare namespace PinkySwear {
|
||||
* @param onRejected Called when or if the promise is rejected.
|
||||
* @returns PinkySwear.Promise
|
||||
*/
|
||||
then(onFulfilled?: (...values: any[]) => Promise, onRejected?: (...values: any[]) => void): Promise;
|
||||
|
||||
/**
|
||||
* onFulfilled is called when or if the promise is resolved.
|
||||
* onRejected is called when or if the promise is rejected.
|
||||
*
|
||||
* @param onFulfilled Called when or if the promise is resolved.
|
||||
* @param onRejected Called when or if the promise is rejected.
|
||||
* @returns PinkySwear.Promise
|
||||
*/
|
||||
then(onFulfilled?: (...values: any[]) => void, onRejected?: (...values: any[]) => void): Promise;
|
||||
|
||||
/**
|
||||
* onFulfilled is called when or if the promise is resolved.
|
||||
* onRejected is called when or if the promise is rejected.
|
||||
*
|
||||
* @param onFulfilled Called when or if the promise is resolved.
|
||||
* @param onRejected Called when or if the promise is rejected.
|
||||
* @returns PinkySwear.Promise
|
||||
*/
|
||||
then(onFulfilled?: (...values: any[]) => any, onRejected?: (...values: any[]) => void): Promise;
|
||||
|
||||
/**
|
||||
* onFulfilled is called when or if the promise is resolved.
|
||||
* onRejected is called when or if the promise is rejected.
|
||||
*
|
||||
* @param onFulfilled Called when or if the promise is resolved.
|
||||
* @param onRejected Called when or if the promise is rejected.
|
||||
* @returns PinkySwear.Promise
|
||||
*/
|
||||
then(onFulfilled?: (...values: any[]) => Promise, onRejected?: (error?: TypeError) => void): Promise;
|
||||
|
||||
/**
|
||||
* onFulfilled is called when or if the promise is resolved.
|
||||
* onRejected is called when or if the promise is rejected.
|
||||
*
|
||||
* @param onFulfilled Called when or if the promise is resolved.
|
||||
* @param onRejected Called when or if the promise is rejected.
|
||||
* @returns PinkySwear.Promise
|
||||
*/
|
||||
then(onFulfilled?: (...values: any[]) => void, onRejected?: (error: TypeError) => void): Promise;
|
||||
|
||||
/**
|
||||
* onFulfilled is called when or if the promise is resolved.
|
||||
* onRejected is called when or if the promise is rejected.
|
||||
*
|
||||
* @param onFulfilled Called when or if the promise is resolved.
|
||||
* @param onRejected Called when or if the promise is rejected.
|
||||
* @returns PinkySwear.Promise
|
||||
*/
|
||||
then(onFulfilled?: (...values: any[]) => any, onRejected?: (error: TypeError) => void): Promise;
|
||||
then(onFulfilled?: (...values: any[]) => Promise | void | any, onRejected?: (...values: any[]) => void): Promise;
|
||||
}
|
||||
|
||||
interface GenericPromise<T> extends Promise {
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
var promise: PinkySwear.Promise = pinkySwear();
|
||||
|
||||
promise.then(function(value: any) {
|
||||
promise.then(function(value) {
|
||||
console.log("Success with value " + value + "1");
|
||||
}, function(value) {
|
||||
console.log("Failure with value " + value + "!");
|
||||
|
||||
13
prelude-ls/index.d.ts
vendored
13
prelude-ls/index.d.ts
vendored
@ -281,14 +281,13 @@ declare namespace PreludeLS {
|
||||
export function flip<A, B, C>(f: (x: A) => (y: B) => C, y: B): (x: A) => C;
|
||||
export function flip<A, B, C>(f: (x: A) => (y: B) => C, y: B, x: A): C;
|
||||
export function fix(f: Function): Function;
|
||||
export function over<A, B, C>(f: (x: B) => (y: B) => C): (g: (x: A) => B) => (x: A) => (y: A) => C;
|
||||
export function over<A, B, C>(f: (x: B, y: B) => C): (g: (x: A) => B) => (x: A, y: A) => C;
|
||||
export function over<A, B, C>(f: (x: B) => (y: B) => C, g: (x: A) => B): (x: A) => (y: A) => C;
|
||||
|
||||
export function over<A, B, C>(f: (x: B) => (y: B) => C | ((x: B, y: B) => C), g: (x: A) => B, x: A, y: A): C;
|
||||
export function over<A, B, C>(f: (x: B, y: B) => C | ((x: B) => (y: B) => C), g: (x: A) => B, x: A): (y: A) => C;
|
||||
export function over<A, B, C>(f: (x: B, y: B) => C, g: (x: A) => B): (x: A, y: A) => C;
|
||||
export function over<A, B, C>(f: (x: B) => (y: B) => C, g: (x: A) => B, x: A): (y: A) => C;
|
||||
export function over<A, B, C>(f: (x: B, y: B) => C, g: (x: A) => B, x: A): (y: A) => C;
|
||||
export function over<A, B, C>(f: (x: B) => (y: B) => C, g: (x: A) => B, x: A, y: A): C;
|
||||
export function over<A, B, C>(f: (x: B, y: B) => C, g: (x: A) => B, x: A, y: A): C;
|
||||
export function over<A, B, C>(f: (x: B) => (y: B) => C, g: (x: A) => B): (x: A) => (y: A) => C;
|
||||
export function over<A, B, C>(f: (x: B, y: B) => C): (g: (x: A) => B) => (x: A, y: A) => C;
|
||||
export function over<A, B, C>(f: (x: B) => (y: B) => C): (g: (x: A) => B) => (x: A) => (y: A) => C;
|
||||
|
||||
|
||||
// Num
|
||||
|
||||
@ -354,7 +354,7 @@ var fixRes: number = prelude.fix(
|
||||
)(9); //=> 55
|
||||
|
||||
var sameLength: (x: string, y: string) => boolean
|
||||
= prelude.over<string, number, boolean>((x: number, y: number) => x == y, x => x.length);
|
||||
= prelude.over<string, number, boolean>((x, y) => x == y, x => x.length);
|
||||
sameLength('hi', 'me'); //=> true
|
||||
sameLength('one', 'boom'); //=> false
|
||||
|
||||
|
||||
2
webtorrent/index.d.ts
vendored
2
webtorrent/index.d.ts
vendored
@ -244,7 +244,7 @@ declare namespace WebTorrent {
|
||||
/**
|
||||
* Emitted whenever a new peer is connected for this torrent. wire is an instance of bittorrent-protocol, which is a node.js-style duplex stream to the remote peer. This event can be used to specify custom BitTorrent protocol extensions.
|
||||
*/
|
||||
on(event: 'wire', callback:(wire:any)=>void): this;
|
||||
on(event: 'wire', callback:(wire: any, addr: any) => void): this;
|
||||
}
|
||||
|
||||
export interface InTorrentFile extends NodeJS.EventEmitter {
|
||||
|
||||
@ -50,7 +50,7 @@ client.add(magnetURI, {}, function (torrent) {
|
||||
console.log('======');
|
||||
})
|
||||
|
||||
torrent.on('wire', function (wire: any, addr: any) {
|
||||
torrent.on('wire', function (wire, addr) {
|
||||
console.log('connected to peer with address ' + addr)
|
||||
wire.use()
|
||||
})
|
||||
|
||||
4
yargs/index.d.ts
vendored
4
yargs/index.d.ts
vendored
@ -78,10 +78,10 @@ declare namespace yargs {
|
||||
|
||||
commandDir(dir: string, opts?: RequireDirectoryOptions): Argv;
|
||||
|
||||
completion(cmd: string, fn?: SyncCompletionFunction): Argv;
|
||||
completion(cmd: string, description?: string, fn?: SyncCompletionFunction): Argv;
|
||||
completion(cmd: string, fn?: AsyncCompletionFunction): Argv;
|
||||
completion(cmd: string, fn?: SyncCompletionFunction): Argv;
|
||||
completion(cmd: string, description?: string, fn?: AsyncCompletionFunction): Argv;
|
||||
completion(cmd: string, description?: string, fn?: SyncCompletionFunction): Argv;
|
||||
|
||||
example(command: string, description: string): Argv;
|
||||
|
||||
|
||||
@ -224,7 +224,7 @@ function completion_sync() {
|
||||
|
||||
function completion_async() {
|
||||
var argv = yargs
|
||||
.completion('completion', (current: string, argv: any, done: (completion: string[]) => void) => {
|
||||
.completion('completion', (current, argv, done) => {
|
||||
setTimeout(function () {
|
||||
done([
|
||||
'apple',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user