Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion angular-wizard/angular-wizard-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions angular/angular-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Expand Down
8 changes: 3 additions & 5 deletions angular/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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>;

/**
Expand Down Expand Up @@ -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 };
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion bardjs/bardjs-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
});
}
Expand Down
2 changes: 1 addition & 1 deletion d3-array/d3-array-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});

Expand Down
3 changes: 1 addition & 2 deletions d3-array/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
4 changes: 2 additions & 2 deletions flickity/flickity-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
});

Expand Down
26 changes: 12 additions & 14 deletions flickity/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,84 +161,82 @@ 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;
on(eventname: string, callback: (event?: Event, pointer?: Element | Touch, cellElement?: Element, cellIndex?: number) => any): void;

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've just changed the order of these, but these overloads don't really make sense -- they all take a string and a function, so how does the library know what kind of values to pass to the function? Can we use string literal types here? @clmcgrath

/**
* 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, moveVector?: Object) => 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, moveVector?: Object) => 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, cellElement?: Element, cellIndex?: number) => any): void;
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, cellElement?: Element) => any): void;
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) => any): void;
off(eventname: string, callback: (event?: Event, pointer?: Element | Touch, moveVector?: Object) => 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;
off(eventname: string, callback: (event?: Event, cellElement?: Element) => 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;
off(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, cellElement?: Element) => any): void;
once(eventname: string, callback: (event?: Event, pointer?: Element | Touch, cellElement?: Element, cellIndex?: number) => 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) => any): void;
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, moveVector?: Object) => any): void;
once(eventname: string, callback: (event?: Event, cellElement?: Element) => 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;


once(eventname: string, callback: (event?: Event, pointer?: Element | Touch) => any): void;
}

interface FlickityOptions {
Expand Down
2 changes: 1 addition & 1 deletion fromjs/fromjs-tests.ts
Original file line number Diff line number Diff line change
@@ -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 changes: 1 addition & 2 deletions fromjs/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {};

Expand Down
7 changes: 0 additions & 7 deletions jasmine/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 0 additions & 7 deletions mongoose-promise/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,19 @@ 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);

/**
* Adds a single function as a listener to both err and complete.
* 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;

/**

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just (...args: T[]) where the length happens to be 1.

Expand Down Expand Up @@ -102,21 +99,17 @@ 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>;

/**
* 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: (
Expand Down
6 changes: 3 additions & 3 deletions mongoose-promise/mongoose-promise-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
Expand All @@ -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();
});
Expand Down
6 changes: 3 additions & 3 deletions mongoose/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion mongoose/mongoose-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', [[]]);
Expand Down
Loading