diff --git a/angular-wizard/angular-wizard-tests.ts b/angular-wizard/angular-wizard-tests.ts index 48bc81f2cf..3fd77ae8a8 100644 --- a/angular-wizard/angular-wizard-tests.ts +++ b/angular-wizard/angular-wizard-tests.ts @@ -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 = $rootScope.$new(); scope.dynamicStepDisabled = 'Y'; var view = createGenericView(scope); diff --git a/angular/angular-tests.ts b/angular/angular-tests.ts index 6728124717..8e0711d6f7 100644 --- a/angular/angular-tests.ts +++ b/angular/angular-tests.ts @@ -650,12 +650,12 @@ angular.module('AnotherSampleDirective', []).directive('myDirective', ['$interpo resolve(); }); - promise = new $q((resolve: angular.IQResolveReject<{}>, reject: angular.IQResolveReject) => { + promise = new $q((resolve, reject) => { reject(); resolve(true); }); - promise = new $q((resolver: angular.IQResolveReject, reject: angular.IQResolveReject) => { + promise = new $q((resolver, reject) => { resolver(true); reject(false); }); diff --git a/angular/index.d.ts b/angular/index.d.ts index ede4733708..e130a7cc96 100644 --- a/angular/index.d.ts +++ b/angular/index.d.ts @@ -984,9 +984,7 @@ declare namespace angular { * See http://docs.angularjs.org/api/ng/service/$q */ interface IQService { - new (resolver: (resolve: IQResolveReject) => any): IPromise; new (resolver: (resolve: IQResolveReject, reject: IQResolveReject) => any): IPromise; - (resolver: (resolve: IQResolveReject) => any): IPromise; (resolver: (resolve: IQResolveReject, reject: IQResolveReject) => any): IPromise; /** @@ -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. diff --git a/bardjs/bardjs-tests.ts b/bardjs/bardjs-tests.ts index 319db54729..2d312634ca 100644 --- a/bardjs/bardjs-tests.ts +++ b/bardjs/bardjs-tests.ts @@ -12,7 +12,7 @@ namespace bardTests { constructor(private $q: angular.IQService) {} remoteCall(): angular.IPromise { - return new this.$q((resolve: angular.IQResolveReject<{}>, reject: angular.IQResolveReject) => { + return new this.$q((resolve, reject) => { resolve(['Hello', 'World']); }); } diff --git a/d3-array/d3-array-tests.ts b/d3-array/d3-array-tests.ts index c36c22d240..26ef2d3ef5 100644 --- a/d3-array/d3-array-tests.ts +++ b/d3-array/d3-array-tests.ts @@ -317,7 +317,7 @@ mixedObjectDateBisectorObject = d3Array.bisector(function (el }); // define using comparator -mixedObjectDateBisectorObject = d3Array.bisector(function (el: MixedObject, x: Date) { +mixedObjectDateBisectorObject = d3Array.bisector(function (el, x) { return el.date.valueOf() - x.valueOf(); }); diff --git a/d3-array/index.d.ts b/d3-array/index.d.ts index 998058dbf4..1d1aae3b67 100644 --- a/d3-array/index.d.ts +++ b/d3-array/index.d.ts @@ -195,10 +195,9 @@ export interface Bisector { right: (array: T[], x: U, lo?: number, hi?: number) => number; } +export function bisector(comparator: (a: T, b: U) => number): Bisector; export function bisector(accessor: (x: T) => U): Bisector; -export function bisector(comparator: (a: T, b: U) => number): Bisector - // 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). diff --git a/flickity/flickity-tests.ts b/flickity/flickity-tests.ts index 7cc3505a91..b98315285f 100644 --- a/flickity/flickity-tests.ts +++ b/flickity/flickity-tests.ts @@ -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 }); diff --git a/flickity/index.d.ts b/flickity/index.d.ts index febb09b525..16b5b7c96f 100644 --- a/flickity/index.d.ts +++ b/flickity/index.d.ts @@ -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 { diff --git a/fromjs/fromjs-tests.ts b/fromjs/fromjs-tests.ts index e89502b8f8..b0e4ada0bf 100644 --- a/fromjs/fromjs-tests.ts +++ b/fromjs/fromjs-tests.ts @@ -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); }); \ No newline at end of file diff --git a/fromjs/index.d.ts b/fromjs/index.d.ts index b023e24bea..937baa7cd2 100644 --- a/fromjs/index.d.ts +++ b/fromjs/index.d.ts @@ -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(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; concat(second: Array): IQueryable; sum(): T; diff --git a/jasmine-es6-promise-matchers/jasmine-es6-promise-matchers-tests.ts b/jasmine-es6-promise-matchers/jasmine-es6-promise-matchers-tests.ts index 4777baf63d..9d76049de8 100644 --- a/jasmine-es6-promise-matchers/jasmine-es6-promise-matchers-tests.ts +++ b/jasmine-es6-promise-matchers/jasmine-es6-promise-matchers-tests.ts @@ -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 = {}; diff --git a/jasmine/index.d.ts b/jasmine/index.d.ts index c4151995a7..180b3ef5ba 100644 --- a/jasmine/index.d.ts +++ b/jasmine/index.d.ts @@ -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; diff --git a/mongoose-promise/index.d.ts b/mongoose-promise/index.d.ts index fe60fe73c3..d730876e9f 100644 --- a/mongoose-promise/index.d.ts +++ b/mongoose-promise/index.d.ts @@ -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(onFulFill: (arg: T) => void | TRes | PromiseLike, - onReject?: (err: any) => void | TRes | PromiseLike): MongoosePromise; then(onFulfill: (...args: T[]) => void | TRes | PromiseLike, onReject?: (err: any) => void | TRes | PromiseLike): MongoosePromise; @@ -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(resolver: ( diff --git a/mongoose-promise/mongoose-promise-tests.ts b/mongoose-promise/mongoose-promise-tests.ts index 70fa9eaaf4..f6e4aa115b 100644 --- a/mongoose-promise/mongoose-promise-tests.ts +++ b/mongoose-promise/mongoose-promise-tests.ts @@ -6,14 +6,14 @@ var mongopromise: mongoose.Promise; 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(); }); diff --git a/mongoose/index.d.ts b/mongoose/index.d.ts index dc3c097dfc..150d94b2df 100644 --- a/mongoose/index.d.ts +++ b/mongoose/index.d.ts @@ -594,17 +594,17 @@ declare module "mongoose" { * @param method name of the method to hook * @param fn callback */ - post(method: string, fn: (doc: T) => void, ...args: any[]): this; post(method: string, fn: (doc: T, next: (err?: NativeError) => void, ...otherArgs: any[]) => void): this; + post(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. diff --git a/mongoose/mongoose-tests.ts b/mongoose/mongoose-tests.ts index 9ba84e0881..450076db3d 100644 --- a/mongoose/mongoose-tests.ts +++ b/mongoose/mongoose-tests.ts @@ -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', [[]]); diff --git a/multiplexjs/index.d.ts b/multiplexjs/index.d.ts index 61f846243d..d8cc9f96a4 100644 --- a/multiplexjs/index.d.ts +++ b/multiplexjs/index.d.ts @@ -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(selector: (item: T) => TResult): Enumerable - - - /** - * 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(selector: (item: T, index: number) => TResult): Enumerable - - - /** - * 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(selector: (item: T) => Iterable): Enumerable; - - - /** - * 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(selector: (item: T, index: number) => Iterable): Enumerable; - - - /** - * 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(collectionSelector: (item: T) => Iterable, resultSelector: (item: T, collection: TCollection) => TResult): Enumerable; + select(selector: (item: T, index: number) => TResult): Enumerable; /** @@ -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(collectionSelector: (item: T, index: number) => Iterable, resultSelector: (item: T, collection: TCollection) => TResult): Enumerable; + selectMany(collectionSelector: (item: T, index: number) => Iterable, resultSelector?: (item: T, collection: TCollection) => TResult): Enumerable; /** diff --git a/multiplexjs/multiplexjs-tests.ts b/multiplexjs/multiplexjs-tests.ts index 10a145399b..94f212b533 100644 --- a/multiplexjs/multiplexjs-tests.ts +++ b/multiplexjs/multiplexjs-tests.ts @@ -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!"); }); diff --git a/nightmare/index.d.ts b/nightmare/index.d.ts index 9abcbca272..87bf8027d1 100644 --- a/nightmare/index.d.ts +++ b/nightmare/index.d.ts @@ -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(fn: () => R, cb: (result: R) => void): Nightmare; - evaluate(fn: (arg: T) => void, cb: () => void, arg: T): Nightmare; - evaluate(fn: (arg: T) => R, cb: (result: R) => void, arg: T): Nightmare; - evaluate(fn: (arg1: T1, arg2: T2) => R, cb: (result: R) => void, arg1: T1, arg2: T2): Nightmare; evaluate(fn: (arg1: T1, arg2: T2, arg3: T3) => R, cb: (result: R) => void, arg1: T1, arg2: T2, arg3: T3): Nightmare; + evaluate(fn: (arg1: T1, arg2: T2) => R, cb: (result: R) => void, arg1: T1, arg2: T2): Nightmare; + evaluate(fn: (arg: T) => R, cb: (result: R) => void, arg: T): Nightmare; + evaluate(fn: (arg: T) => void, cb: () => void, arg: T): Nightmare; + evaluate(fn: () => R, cb: (result: R) => void): Nightmare; + evaluate(fn: () => void): Nightmare; wait(): Nightmare; wait(ms: number): Nightmare; wait(selector: string): Nightmare; diff --git a/nightmare/nightmare-tests.ts b/nightmare/nightmare-tests.ts index 9b6dfcc459..a9251192b3 100644 --- a/nightmare/nightmare-tests.ts +++ b/nightmare/nightmare-tests.ts @@ -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); diff --git a/phantom/index.d.ts b/phantom/index.d.ts index 1fd45260a2..f6a7cfe328 100644 --- a/phantom/index.d.ts +++ b/phantom/index.d.ts @@ -15,7 +15,6 @@ export interface WebPage { close(): Promise; evaluate(callback: () => R): Promise; - evaluate(callback: (arg: T) => void, arg: T): Promise; evaluate(callback: (arg: T) => R, arg: T): Promise; evaluate(callback: (arg1: T1, arg2: T2) => R, arg1: T1, arg2: T2): Promise; evaluate(callback: (arg1: T1, arg2: T2, arg3: T3) => R, arg1: T1, arg2: T2, arg3: T3): Promise; diff --git a/phantom/phantom-tests.ts b/phantom/phantom-tests.ts index f26cc7178c..ced5703927 100644 --- a/phantom/phantom-tests.ts +++ b/phantom/phantom-tests.ts @@ -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 = (document.querySelector(selector)).innerText return text - }) + }, "mySelector") }).then(function(result) { console.log("The element contains the following text: " + result) diff --git a/pinkyswear/index.d.ts b/pinkyswear/index.d.ts index 712d93846d..d74d17f10f 100644 --- a/pinkyswear/index.d.ts +++ b/pinkyswear/index.d.ts @@ -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 extends Promise { diff --git a/pinkyswear/pinkyswear-tests.ts b/pinkyswear/pinkyswear-tests.ts index 8bc2f7856c..88b52a0df4 100644 --- a/pinkyswear/pinkyswear-tests.ts +++ b/pinkyswear/pinkyswear-tests.ts @@ -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 + "!"); diff --git a/prelude-ls/index.d.ts b/prelude-ls/index.d.ts index bfa85c9bfa..1b84b4453f 100644 --- a/prelude-ls/index.d.ts +++ b/prelude-ls/index.d.ts @@ -281,14 +281,13 @@ declare namespace PreludeLS { export function flip(f: (x: A) => (y: B) => C, y: B): (x: A) => C; export function flip(f: (x: A) => (y: B) => C, y: B, x: A): C; export function fix(f: Function): Function; - export function over(f: (x: B) => (y: B) => C): (g: (x: A) => B) => (x: A) => (y: A) => C; - export function over(f: (x: B, y: B) => C): (g: (x: A) => B) => (x: A, y: A) => C; - export function over(f: (x: B) => (y: B) => C, g: (x: A) => B): (x: A) => (y: A) => C; + + export function over(f: (x: B) => (y: B) => C | ((x: B, y: B) => C), g: (x: A) => B, x: A, y: A): C; + export function over(f: (x: B, y: B) => C | ((x: B) => (y: B) => C), g: (x: A) => B, x: A): (y: A) => C; export function over(f: (x: B, y: B) => C, g: (x: A) => B): (x: A, y: A) => C; - export function over(f: (x: B) => (y: B) => C, g: (x: A) => B, x: A): (y: A) => C; - export function over(f: (x: B, y: B) => C, g: (x: A) => B, x: A): (y: A) => C; - export function over(f: (x: B) => (y: B) => C, g: (x: A) => B, x: A, y: A): C; - export function over(f: (x: B, y: B) => C, g: (x: A) => B, x: A, y: A): C; + export function over(f: (x: B) => (y: B) => C, g: (x: A) => B): (x: A) => (y: A) => C; + export function over(f: (x: B, y: B) => C): (g: (x: A) => B) => (x: A, y: A) => C; + export function over(f: (x: B) => (y: B) => C): (g: (x: A) => B) => (x: A) => (y: A) => C; // Num diff --git a/prelude-ls/prelude-ls-tests.ts b/prelude-ls/prelude-ls-tests.ts index 97b4d51c51..7074d6c70c 100644 --- a/prelude-ls/prelude-ls-tests.ts +++ b/prelude-ls/prelude-ls-tests.ts @@ -354,7 +354,7 @@ var fixRes: number = prelude.fix( )(9); //=> 55 var sameLength: (x: string, y: string) => boolean - = prelude.over((x: number, y: number) => x == y, x => x.length); + = prelude.over((x, y) => x == y, x => x.length); sameLength('hi', 'me'); //=> true sameLength('one', 'boom'); //=> false diff --git a/webtorrent/index.d.ts b/webtorrent/index.d.ts index 5182e629e5..6fd26b08f2 100644 --- a/webtorrent/index.d.ts +++ b/webtorrent/index.d.ts @@ -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 { diff --git a/webtorrent/webtorrent-tests.ts b/webtorrent/webtorrent-tests.ts index c466c07753..96314de12d 100644 --- a/webtorrent/webtorrent-tests.ts +++ b/webtorrent/webtorrent-tests.ts @@ -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() }) diff --git a/yargs/index.d.ts b/yargs/index.d.ts index 08c76b925e..c3f61b59ac 100644 --- a/yargs/index.d.ts +++ b/yargs/index.d.ts @@ -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; diff --git a/yargs/yargs-tests.ts b/yargs/yargs-tests.ts index 54a3b8c506..8a88b8720e 100644 --- a/yargs/yargs-tests.ts +++ b/yargs/yargs-tests.ts @@ -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',