From 9a99bb62415a8707f6229b484478cba564bdd364 Mon Sep 17 00:00:00 2001 From: "Piotr \"Hitori\" Bosak" Date: Wed, 2 Aug 2017 12:39:18 +0200 Subject: [PATCH 001/156] Updates for Kefir.js --- types/kefir/index.d.ts | 54 +++++++++++++++++++++++++++++------------- 1 file changed, 38 insertions(+), 16 deletions(-) diff --git a/types/kefir/index.d.ts b/types/kefir/index.d.ts index 09917d7846..7d524b3dda 100644 --- a/types/kefir/index.d.ts +++ b/types/kefir/index.d.ts @@ -1,10 +1,13 @@ -// Type definitions for Kefir 3.3.0 +// Type definitions for Kefir 3.7.3 // Project: http://rpominov.github.io/kefir/ // Definitions by: Aya Morisawa +// Piotr Hitori Bosak // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// +export type ValueOfAnObservable> = T[''] + export interface Subscription { unsubscribe(): void; closed: boolean; // Actually, `readonly` but it's avaiable in tsc starting with 2.0.0 @@ -28,6 +31,9 @@ export interface Observer { } export interface Observable { + '': T // TypeScript hack to enable value unwrapping for combine/flatMap + + toProperty(getCurrent?: () => T): Property; // Subscribe / add side effects onValue(callback: (value: T) => void): void; offValue(callback: (value: T) => void): void; @@ -37,10 +43,13 @@ export interface Observable { offEnd(callback: () => void): void; onAny(callback: (event: Event) => void): void; offAny(callback: (event: Event) => void): void; - log(name?: string): void; - offLog(name?: string): void; + log(name?: string): this; + spy(name?: string): this; + offLog(name?: string): this; + offSpy(name?: string): this; flatten(transformer?: (value: T) => U[]): Stream; - toPromise(PromiseConstructor?: any): any; + toPromise(): Promise; + toPromise>(PromiseConstructor: () => W): W; toESObservable(): any; // This method is designed to replace all other methods for subscribing observe(params: Observer): Subscription; @@ -49,11 +58,11 @@ export interface Observable { onError?: (error: S) => void, onEnd?: () => void ): Subscription; + setName(source: Observable, selfName: string): this; + setName(selfName: string): this; } export interface Stream extends Observable { - toProperty(getCurrent?: () => T): Property; - // Modify an stream map(fn: (value: T) => U): Stream; filter(predicate?: (value: T) => boolean): Stream; @@ -64,7 +73,8 @@ export interface Stream extends Observable { skipWhile(predicate?: (value: T) => boolean): Stream; skipDuplicates(comparator?: (a: T, b: T) => boolean): Stream; diff(fn?: (prev: T, next: T) => T, seed?: T): Stream; - scan(fn: (prev: T, next: T) => T, seed?: T): Stream; + scan(fn: (prev: T | W, next: T) => W): Stream; + scan(fn: (prev: W, next: T) => W, seed: W): Stream; delay(wait: number): Stream; throttle(wait: number, options?: { leading?: boolean, trailing?: boolean }): Stream; debounce(wait: number, options?: { immediate: boolean }): Stream; @@ -85,19 +95,21 @@ export interface Stream extends Observable { bufferWithTimeOrCount(interval: number, count: number, options?: { flushOnEnd: boolean }): Stream; transduce(transducer: any): Stream; withHandler(handler: (emitter: Emitter, event: Event) => void): Stream; - // Combine streams combine(otherObs: Stream, combinator?: (value: T, ...values: U[]) => W): Stream; zip(otherObs: Stream, combinator?: (value: T, ...values: U[]) => W): Stream; merge(otherObs: Stream): Stream; concat(otherObs: Stream): Stream; flatMap(transform: (value: T) => Stream): Stream; + flatMap>(): Stream, any>; flatMapLatest(fn: (value: T) => Stream): Stream; + flatMapLatest>(): Stream, any>; flatMapFirst(fn: (value: T) => Stream): Stream; + flatMapFirst>(): Stream, any>; flatMapConcat(fn: (value: T) => Stream): Stream; + flatMapConcat>(): Stream, any>; flatMapConcurLimit(fn: (value: T) => Stream, limit: number): Stream; flatMapErrors(transform: (error: S) => Stream): Stream; - // Combine two streams filterBy(otherObs: Observable): Stream; sampledBy(otherObs: Observable, combinator?: (a: T, b: U) => W): Stream; @@ -110,7 +122,6 @@ export interface Stream extends Observable { export interface Property extends Observable { changes(): Stream; - // Modify an property map(fn: (value: T) => U): Property; filter(predicate?: (value: T) => boolean): Property; @@ -141,19 +152,20 @@ export interface Property extends Observable { bufferWithTimeOrCount(interval: number, count: number, options?: { flushOnEnd: boolean }): Property; transduce(transducer: any): Property; withHandler(handler: (emitter: Emitter, event: Event) => void): Property; - // Combine properties combine(otherObs: Property, combinator?: (value: T, ...values: U[]) => W): Property; zip(otherObs: Property, combinator?: (value: T, ...values: U[]) => W): Property; merge(otherObs: Property): Property; concat(otherObs: Property): Property; flatMap(transform: (value: T) => Property): Property; + flatMap>(): Property, any>; flatMapLatest(fn: (value: T) => Property): Property; + flatMapLatest>(): Property, any>; flatMapFirst(fn: (value: T) => Property): Property; + flatMapFirst>(): Property, any>; flatMapConcat(fn: (value: T) => Property): Property; flatMapConcurLimit(fn: (value: T) => Property, limit: number): Property; flatMapErrors(transform: (error: S) => Property): Property; - // Combine two properties filterBy(otherObs: Observable): Property; sampledBy(otherObs: Observable, combinator?: (a: T, b: U) => W): Property; @@ -197,11 +209,21 @@ export declare function fromESObservable(observable: any): Stream // Create a property export declare function constant(value: T): Property; export declare function constantError(error: T): Property; -export declare function fromPromise(promise: any): Property; - +export declare function fromPromise(promise: Promise): Property; // Combine observables -export declare function combine(obss: Observable[], passiveObss: Observable[], combinator?: (...values: T[]) => U): Observable; -export declare function combine(obss: Observable[], combinator?: (...values: T[]) => U): Observable; +export declare function combine(obss: Observable[], passiveObss: Observable[], combinator?: (...values: T[]) => U): Stream; +export declare function combine(obss: Observable[], combinator: (...values: T[]) => U): Stream; +export declare function combine }>(obss: T): Stream<{ [P in keyof T]: ValueOfAnObservable }, any>; +export declare function combine], P extends keyof T>(obss: T): Stream<[ValueOfAnObservable, ValueOfAnObservable], any>; +export declare function combine, Observable, Observable, Observable, Observable, Observable, Observable, Observable]>(obss: T): Stream<[ValueOfAnObservable, ValueOfAnObservable, ValueOfAnObservable, ValueOfAnObservable, ValueOfAnObservable, ValueOfAnObservable, ValueOfAnObservable, ValueOfAnObservable], any>; +export declare function combine, Observable, Observable, Observable, Observable, Observable, Observable]>(obss: T): Stream<[ValueOfAnObservable, ValueOfAnObservable, ValueOfAnObservable, ValueOfAnObservable, ValueOfAnObservable, ValueOfAnObservable, ValueOfAnObservable], any>; +export declare function combine, Observable, Observable, Observable, Observable, Observable]>(obss: T): Stream<[ValueOfAnObservable, ValueOfAnObservable, ValueOfAnObservable, ValueOfAnObservable, ValueOfAnObservable, ValueOfAnObservable], any>; +export declare function combine, Observable, Observable, Observable, Observable]>(obss: T): Stream<[ValueOfAnObservable, ValueOfAnObservable, ValueOfAnObservable, ValueOfAnObservable, ValueOfAnObservable], any>; +export declare function combine, Observable, Observable, Observable]>(obss: T): Stream<[ValueOfAnObservable, ValueOfAnObservable, ValueOfAnObservable, ValueOfAnObservable], any>; +export declare function combine, Observable, Observable]>(obss: T): Stream<[ValueOfAnObservable, ValueOfAnObservable, ValueOfAnObservable], any>; +export declare function combine, Observable]>(obss: T): Stream<[ValueOfAnObservable, ValueOfAnObservable], any>; +export declare function combine]>(obss: T): Stream<[ValueOfAnObservable], any>; +export declare function combine(obss: T): Stream; export declare function zip(obss: Observable[], passiveObss?: Observable[], combinator?: (...values: T[]) => U): Observable; export declare function merge(obss: Observable[]): Observable; export declare function concat(obss: Observable[]): Observable; From 9e257d00c79b28bd3c0a03f2fb69c6a60d6c896a Mon Sep 17 00:00:00 2001 From: "Piotr \"Hitori\" Bosak" Date: Wed, 2 Aug 2017 13:28:28 +0200 Subject: [PATCH 002/156] Fixed missing semicolon --- types/kefir/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/kefir/index.d.ts b/types/kefir/index.d.ts index 7d524b3dda..ea823f73ff 100644 --- a/types/kefir/index.d.ts +++ b/types/kefir/index.d.ts @@ -6,7 +6,7 @@ /// -export type ValueOfAnObservable> = T[''] +export type ValueOfAnObservable> = T['']; export interface Subscription { unsubscribe(): void; From ce3c41a0a87c6d9b8e3a2dc74ad2c3f6c83a4677 Mon Sep 17 00:00:00 2001 From: "Piotr \"Hitori\" Bosak" Date: Wed, 2 Aug 2017 13:32:55 +0200 Subject: [PATCH 003/156] Added version header --- types/kefir/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/kefir/index.d.ts b/types/kefir/index.d.ts index ea823f73ff..86885f1776 100644 --- a/types/kefir/index.d.ts +++ b/types/kefir/index.d.ts @@ -3,6 +3,7 @@ // Definitions by: Aya Morisawa // Piotr Hitori Bosak // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.4 /// @@ -31,7 +32,7 @@ export interface Observer { } export interface Observable { - '': T // TypeScript hack to enable value unwrapping for combine/flatMap + '': T; // TypeScript hack to enable value unwrapping for combine/flatMap toProperty(getCurrent?: () => T): Property; // Subscribe / add side effects From 0402f45814e9b6230e47fe69e02e8ce5fc076cdf Mon Sep 17 00:00:00 2001 From: "Piotr \"Hitori\" Bosak" Date: Mon, 7 Aug 2017 13:28:14 +0200 Subject: [PATCH 004/156] kefir.js: onValue/onError/onAny allows chaining --- types/kefir/index.d.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/types/kefir/index.d.ts b/types/kefir/index.d.ts index 86885f1776..e892e1b291 100644 --- a/types/kefir/index.d.ts +++ b/types/kefir/index.d.ts @@ -36,14 +36,14 @@ export interface Observable { toProperty(getCurrent?: () => T): Property; // Subscribe / add side effects - onValue(callback: (value: T) => void): void; - offValue(callback: (value: T) => void): void; - onError(callback: (error: S) => void): void; - offError(callback: (error: S) => void): void; - onEnd(callback: () => void): void; - offEnd(callback: () => void): void; - onAny(callback: (event: Event) => void): void; - offAny(callback: (event: Event) => void): void; + onValue(callback: (value: T) => void): this; + offValue(callback: (value: T) => void): this; + onError(callback: (error: S) => void): this; + offError(callback: (error: S) => void): this; + onEnd(callback: () => void): this; + offEnd(callback: () => void): this; + onAny(callback: (event: Event) => void): this; + offAny(callback: (event: Event) => void): this; log(name?: string): this; spy(name?: string): this; offLog(name?: string): this; @@ -178,8 +178,8 @@ export interface Property extends Observable { } export interface ObservablePool extends Observable { - plug(obs: Observable): void; - unPlug(obs: Observable): void; + plug(obs: Observable): this; + unPlug(obs: Observable): this; } export interface Event { From fece0e0e6b46241e066062deb23771a23b19319e Mon Sep 17 00:00:00 2001 From: Chris Krycho Date: Fri, 11 Aug 2017 09:08:47 -0400 Subject: [PATCH 005/156] RSVP: switch to `export =` with `allowSyntheticDefaultExports`. --- types/rsvp/index.d.ts | 299 ++++++++++++++++++++------------------- types/rsvp/tsconfig.json | 5 +- 2 files changed, 153 insertions(+), 151 deletions(-) diff --git a/types/rsvp/index.d.ts b/types/rsvp/index.d.ts index c0a7dc8b07..5372bdd7d5 100644 --- a/types/rsvp/index.d.ts +++ b/types/rsvp/index.d.ts @@ -14,98 +14,98 @@ // Credit for that file goes to: Barrie Nemetchek , Andrew Gaspar , John Reilly declare namespace RSVP { - type Resolution = (value: T) => U | Thenable; - type Rejection = (error: C) => D | Thenable; + type Resolution = (value: T) => U | Thenable; + type Rejection = (error: C) => D | Thenable; - interface Thenable { - then(label?: string): Thenable; - then(onFulfillment: Resolution, label?: string): Thenable; - then( - onFulfillment: Resolution, - onRejected: Rejection, - label?: string - ): Thenable; - } + interface Thenable { + then(label?: string): Thenable; + then(onFulfillment: Resolution, label?: string): Thenable; + then( + onFulfillment: Resolution, + onRejected: Rejection, + label?: string + ): Thenable; + } - interface Catchable { - catch(label?: string): Catchable; - catch(onRejection: (error: C) => D, label?: string): Catchable; - } + interface Catchable { + catch(label?: string): Catchable; + catch(onRejection: (error: C) => D, label?: string): Catchable; + } - interface Deferred { - promise: Promise; - resolve(value: T): void; - reject(reason: C): void; - } + interface Deferred { + promise: Promise; + resolve(value: T): void; + reject(reason: C): void; + } - type PromiseStates = 'fulfilled' | 'rejected' | 'pending'; - interface IPromiseState { - state: PromiseStates; - value: T; - reason: C; - } + type PromiseStates = 'fulfilled' | 'rejected' | 'pending'; + interface IPromiseState { + state: PromiseStates; + value: T; + reason: C; + } - class Resolved implements IPromiseState { - state: 'fulfilled'; - value: T; - reason: never; - } + class Resolved implements IPromiseState { + state: 'fulfilled'; + value: T; + reason: never; + } - class Rejected implements IPromiseState { - state: 'rejected'; - value: never; - reason: C; - } + class Rejected implements IPromiseState { + state: 'rejected'; + value: never; + reason: C; + } - class Pending implements IPromiseState { - state: 'pending'; - value: never; - reason: never; - } + class Pending implements IPromiseState { + state: 'pending'; + value: never; + reason: never; + } - type PromiseState = Resolved | Rejected | Pending; + type PromiseState = Resolved | Rejected | Pending; - type PromiseHash = { [P in keyof T]: Thenable | T[P] }; + type PromiseHash = { [P in keyof T]: Thenable | T[P] }; - type SettledHash = { [P in keyof T]: PromiseState }; + type SettledHash = { [P in keyof T]: PromiseState }; - interface InstrumentEvent { - guid: string; // guid of promise. Must be globally unique, not just within the implementation - childGuid: string; // child of child promise (for chained via `then`) - eventName: string; // one of ['created', 'chained', 'fulfilled', 'rejected'] - detail: any; // fulfillment value or rejection reason, if applicable - label: string; // label passed to promise's constructor - timeStamp: number; // milliseconds elapsed since 1 January 1970 00:00:00 UTC up until now - } + interface InstrumentEvent { + guid: string; // guid of promise. Must be globally unique, not just within the implementation + childGuid: string; // child of child promise (for chained via `then`) + eventName: string; // one of ['created', 'chained', 'fulfilled', 'rejected'] + detail: any; // fulfillment value or rejection reason, if applicable + label: string; // label passed to promise's constructor + timeStamp: number; // milliseconds elapsed since 1 January 1970 00:00:00 UTC up until now + } - interface ObjectWithEventMixins { - on( - eventName: 'created' | 'chained' | 'fulfilled' | 'rejected', - listener: (event: InstrumentEvent) => void - ): void; - on(eventName: 'error', errorHandler: (reason: any) => void): void; - on(eventName: string, callback: (value: any) => void): void; - off(eventName: string, callback?: (value: any) => void): void; - trigger(eventName: string, options?: any, label?: string): void; - } + interface ObjectWithEventMixins { + on( + eventName: 'created' | 'chained' | 'fulfilled' | 'rejected', + listener: (event: InstrumentEvent) => void + ): void; + on(eventName: 'error', errorHandler: (reason: any) => void): void; + on(eventName: string, callback: (value: any) => void): void; + off(eventName: string, callback?: (value: any) => void): void; + trigger(eventName: string, options?: any, label?: string): void; + } - class Promise implements Thenable, Catchable { - /** + class Promise implements Thenable, Catchable { + /** * If you call resolve in the body of the callback passed to the constructor, * your promise is fulfilled with result object passed to resolve. * If you call reject your promise is rejected with the object passed to reject. * For consistency and debugging (eg stack traces), obj should be an instanceof Error. * Any errors thrown in the constructor callback will be implicitly passed to reject(). */ - constructor( - callback: ( - resolve: (result?: T | Thenable) => void, - reject: (error: C | Thenable) => void - ) => void, - label?: string - ); + constructor( + callback: ( + resolve: (result?: T | Thenable) => void, + reject: (error: C | Thenable) => void + ) => void, + label?: string + ); - /** + /** * onFulfillment is called when/if "promise" resolves. onRejected is called when/if "promise" rejects. * Both are optional, if either/both are omitted the next onFulfillment/onRejected in the chain is called. * Both callbacks have a single parameter , the fulfillment value or rejection reason. @@ -116,31 +116,31 @@ declare namespace RSVP { * @param onRejected called when/if "promise" rejects * @param label useful for tooling */ - then( - onFulfillment: Resolution, - onRejected: Rejection, - label?: string - ): Promise; - then(onFulfillment: Resolution, label?: string): Promise; - then(label?: string): Promise; + then( + onFulfillment: Resolution, + onRejected: Rejection, + label?: string + ): Promise; + then(onFulfillment: Resolution, label?: string): Promise; + then(label?: string): Promise; - /** + /** * Sugar for promise.then(undefined, onRejected) */ - catch(label?: string): Promise; - catch(onRejection: Rejection, label?: string): Promise; + catch(label?: string): Promise; + catch(onRejection: Rejection, label?: string): Promise; - finally(finallyCallback: Function): Promise; + finally(finallyCallback: Function): Promise; - /** + /** * `RSVP.Promise.all` accepts an array of promises, and returns a new promise which * is fulfilled with an array of fulfillment values for the passed promises, or * rejected with the reason of the first passed promise to be rejected. It casts all * elements of the passed iterable to promises as it runs this algorithm. */ - static all(promises: Thenable[], label?: string): Promise; + static all(promises: Thenable[], label?: string): Promise; - /** + /** * `RSVP.Promise.race` returns a new promise which is settled in the same way as the * first passed promise to settle. * @@ -150,67 +150,67 @@ declare namespace RSVP { * become rejected before the other promises became fulfilled, the returned * promise will become rejected. */ - static race(promises: Promise[]): Promise; + static race(promises: Promise[]): Promise; - /** + /** * Returns a promise that will become resolved with the passed `value` */ - static resolve(value: T, label?: string): Promise; + static resolve(value: T, label?: string): Promise; - /** + /** * Deprecated in favor of resolve */ - static cast(value: T, label?: string): Promise; + static cast(value: T, label?: string): Promise; - /** + /** * Returns a promise rejected with the passed `reason`. */ - static reject(reason: C): Promise; - } + static reject(reason: C): Promise; + } - export namespace EventTarget { - /** `RSVP.EventTarget.mixin` extends an object with EventTarget methods. */ - function mixin(object: object): ObjectWithEventMixins; + export namespace EventTarget { + /** `RSVP.EventTarget.mixin` extends an object with EventTarget methods. */ + function mixin(object: object): ObjectWithEventMixins; - /** Registers a callback to be executed when `eventName` is triggered */ - function on( - eventName: 'created' | 'chained' | 'fulfilled' | 'rejected', - listener: (event: InstrumentEvent) => void - ): void; - function on(eventName: 'error', errorHandler: (reason: any) => void): void; - function on(eventName: string, callback: (value: any) => void): void; + /** Registers a callback to be executed when `eventName` is triggered */ + function on( + eventName: 'created' | 'chained' | 'fulfilled' | 'rejected', + listener: (event: InstrumentEvent) => void + ): void; + function on(eventName: 'error', errorHandler: (reason: any) => void): void; + function on(eventName: string, callback: (value: any) => void): void; - /** + /** * You can use `off` to stop firing a particular callback for an event. * * If you don't pass a `callback` argument to `off`, ALL callbacks for the * event will not be executed when the event fires. */ - function off(eventName: string, callback?: (value: any) => void): void; + function off(eventName: string, callback?: (value: any) => void): void; - /** + /** * Use `trigger` to fire custom events. * * You can also pass a value as a second argument to `trigger` that will be * passed as an argument to all event listeners for the event */ - function trigger(eventName: string, options?: any, label?: string): void; - } + function trigger(eventName: string, options?: any, label?: string): void; + } - export function configure( - configName: 'instrument' | 'instrument-with-stack', - shouldInstrument: boolean - ): void; - export function configure(configName: string, value: any): void; + export function configure( + configName: 'instrument' | 'instrument-with-stack', + shouldInstrument: boolean + ): void; + export function configure(configName: string, value: any): void; - /** + /** * Make a promise that fulfills when every item in the array fulfills, and rejects if (and when) any item rejects. * the array passed to all can be a mixture of promise-like objects and other objects. * The fulfillment value is an array (in order) of fulfillment values. The rejection value is the first rejection value. */ - export function all(promises: Thenable[]): Promise; + export function all(promises: Thenable[]): Promise; - /** + /** * `RSVP.hash` is similar to `RSVP.all`, but takes an object instead of an array * for its `promises` argument. * @@ -223,9 +223,9 @@ declare namespace RSVP { * If any of the `promises` given to `RSVP.hash` are rejected, the first promise * that is rejected will be given as the reason to the rejection handler. */ - export function hash(promises: PromiseHash): Promise; + export function hash(promises: PromiseHash): Promise; - /** + /** * `RSVP.map` is similar to JavaScript's native `map` method. `mapFn` is eagerly called * meaning that as soon as any promise resolves its value will be passed to `mapFn`. * `RSVP.map` returns a promise that will become fulfilled with the result of running @@ -235,21 +235,21 @@ declare namespace RSVP { * that is rejected will be given as an argument to the returned promise's * rejection handler. */ - export function map( - promises: Thenable[], - mapFn: (item: T) => U, - label?: string - ): Promise; + export function map( + promises: Thenable[], + mapFn: (item: T) => U, + label?: string + ): Promise; - /** + /** * `RSVP.allSettled` is similar to `RSVP.all`, but instead of implementing * a fail-fast method, it waits until all the promises have returned and * shows you all the results. This is useful if you want to handle multiple * promises' failure states together as a set. */ - export function allSettled(promises: Thenable[]): Promise[], C>; + export function allSettled(promises: Thenable[]): Promise[], C>; - /** + /** * `RSVP.hashSettled` is similar to `RSVP.allSettled`, but takes an object * instead of an array for its `promises` argument. * @@ -259,14 +259,14 @@ declare namespace RSVP { * with their states and values/reasons. This is useful if you want to * handle multiple promises' failure states together as a set. */ - export function hashSettled(promises: PromiseHash): Promise, C>; + export function hashSettled(promises: PromiseHash): Promise, C>; - /** + /** * Make a Promise that fulfills when any item fulfills, and rejects if any item rejects. */ - function race(promises: Promise[]): Promise; + function race(promises: Promise[]): Promise; - /** + /** * `RSVP.denodeify` takes a "node-style" function and returns a function that * will return an `RSVP.Promise`. You can use `denodeify` in Node.js or the * browser when you'd prefer to use promises over using callbacks. For example, @@ -324,12 +324,12 @@ declare namespace RSVP { * }); * ``` */ - export function denodeify( - nodeFunction: Function, - options: boolean | string[] - ): (...args: A[]) => Promise; + export function denodeify( + nodeFunction: Function, + options: boolean | string[] + ): (...args: A[]) => Promise; - /** + /** * `RSVP.defer` returns an object similar to jQuery's `$.Deferred`. * `RSVP.defer` should be used when porting over code reliant on `$.Deferred`'s * interface. New code should use the `RSVP.Promise` constructor instead. @@ -339,32 +339,32 @@ declare namespace RSVP { * * reject - a function that causes the `promise` property on this object to become rejected * * resolve - a function that causes the `promise` property on this object to become fulfilled. */ - export function defer(label?: string): Deferred; + export function defer(label?: string): Deferred; - /** + /** * `RSVP.Promise.reject` returns a promise rejected with the passed `reason`. */ - export function reject(reason: C): Promise; + export function reject(reason: C): Promise; - /** + /** * `RSVP.Promise.resolve` returns a promise that will become resolved with the * passed `value`. */ - export function resolve(value: T): Promise; + export function resolve(value: T): Promise; - /** + /** * `RSVP.filter` is similar to JavaScript's native `filter` method, except that it * waits for all promises to become fulfilled before running the `filterFn` on * each item in given to `promises`. `RSVP.filter` returns a promise that will * become fulfilled with the result of running `filterFn` on the values the * promises become fulfilled with. */ - export function filter( - promises: Thenable[], - filterFn: (value: T) => boolean | Promise - ): Promise; + export function filter( + promises: Thenable[], + filterFn: (value: T) => boolean | Promise + ): Promise; - /** + /** * `RSVP.rethrow` will rethrow an error on the next turn of the JavaScript event * loop in order to aid debugging. * @@ -376,7 +376,8 @@ declare namespace RSVP { * or domain/cause uncaught exception in Node. `rethrow` will also throw the * error again so the error can be handled by the promise per the spec. */ - export function rethrow(reason: C): void; + export function rethrow(reason: C): void; } -export default RSVP; +// export default RSVP; +export = RSVP; diff --git a/types/rsvp/tsconfig.json b/types/rsvp/tsconfig.json index 58c8e605be..fee17b279a 100644 --- a/types/rsvp/tsconfig.json +++ b/types/rsvp/tsconfig.json @@ -13,10 +13,11 @@ ], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": true + "forceConsistentCasingInFileNames": true, + "allowSyntheticDefaultImports": true }, "files": [ "index.d.ts", "rsvp-tests.ts" ] -} \ No newline at end of file +} From 0196f2468ea3f38b96afe01e77fd7980710c8ac2 Mon Sep 17 00:00:00 2001 From: Chris Krycho Date: Fri, 11 Aug 2017 09:18:16 -0400 Subject: [PATCH 006/156] Update RSVP dependencies to allow synthetic imports. --- types/ember-testing-helpers/tsconfig.json | 3 ++- types/ember/tsconfig.json | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/types/ember-testing-helpers/tsconfig.json b/types/ember-testing-helpers/tsconfig.json index aaf474ecba..cd7634bd25 100644 --- a/types/ember-testing-helpers/tsconfig.json +++ b/types/ember-testing-helpers/tsconfig.json @@ -14,7 +14,8 @@ ], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": true + "forceConsistentCasingInFileNames": true, + "allowSyntheticDefaultImports": true }, "files": [ "index.d.ts", diff --git a/types/ember/tsconfig.json b/types/ember/tsconfig.json index d2f27dfec9..fbc4052a08 100644 --- a/types/ember/tsconfig.json +++ b/types/ember/tsconfig.json @@ -14,10 +14,11 @@ ], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": true + "forceConsistentCasingInFileNames": true, + "allowSyntheticDefaultImports": true }, "files": [ "index.d.ts", "ember-tests.ts" ] -} \ No newline at end of file +} From 6ecbed72420aa10dac76a64db6ced41e217f645b Mon Sep 17 00:00:00 2001 From: Chris Krycho Date: Fri, 11 Aug 2017 09:19:55 -0400 Subject: [PATCH 007/156] Fix spacing in RSVP (thanks, Prettier). --- types/rsvp/index.d.ts | 296 +++++++++++++++++++++--------------------- 1 file changed, 148 insertions(+), 148 deletions(-) diff --git a/types/rsvp/index.d.ts b/types/rsvp/index.d.ts index 5372bdd7d5..1aa764d785 100644 --- a/types/rsvp/index.d.ts +++ b/types/rsvp/index.d.ts @@ -14,98 +14,98 @@ // Credit for that file goes to: Barrie Nemetchek , Andrew Gaspar , John Reilly declare namespace RSVP { - type Resolution = (value: T) => U | Thenable; - type Rejection = (error: C) => D | Thenable; + type Resolution = (value: T) => U | Thenable; + type Rejection = (error: C) => D | Thenable; - interface Thenable { - then(label?: string): Thenable; - then(onFulfillment: Resolution, label?: string): Thenable; - then( - onFulfillment: Resolution, - onRejected: Rejection, - label?: string - ): Thenable; - } + interface Thenable { + then(label?: string): Thenable; + then(onFulfillment: Resolution, label?: string): Thenable; + then( + onFulfillment: Resolution, + onRejected: Rejection, + label?: string + ): Thenable; + } - interface Catchable { - catch(label?: string): Catchable; - catch(onRejection: (error: C) => D, label?: string): Catchable; - } + interface Catchable { + catch(label?: string): Catchable; + catch(onRejection: (error: C) => D, label?: string): Catchable; + } - interface Deferred { - promise: Promise; - resolve(value: T): void; - reject(reason: C): void; - } + interface Deferred { + promise: Promise; + resolve(value: T): void; + reject(reason: C): void; + } - type PromiseStates = 'fulfilled' | 'rejected' | 'pending'; - interface IPromiseState { - state: PromiseStates; - value: T; - reason: C; - } + type PromiseStates = 'fulfilled' | 'rejected' | 'pending'; + interface IPromiseState { + state: PromiseStates; + value: T; + reason: C; + } - class Resolved implements IPromiseState { - state: 'fulfilled'; - value: T; - reason: never; - } + class Resolved implements IPromiseState { + state: 'fulfilled'; + value: T; + reason: never; + } - class Rejected implements IPromiseState { - state: 'rejected'; - value: never; - reason: C; - } + class Rejected implements IPromiseState { + state: 'rejected'; + value: never; + reason: C; + } - class Pending implements IPromiseState { - state: 'pending'; - value: never; - reason: never; - } + class Pending implements IPromiseState { + state: 'pending'; + value: never; + reason: never; + } - type PromiseState = Resolved | Rejected | Pending; + type PromiseState = Resolved | Rejected | Pending; - type PromiseHash = { [P in keyof T]: Thenable | T[P] }; + type PromiseHash = { [P in keyof T]: Thenable | T[P] }; - type SettledHash = { [P in keyof T]: PromiseState }; + type SettledHash = { [P in keyof T]: PromiseState }; - interface InstrumentEvent { - guid: string; // guid of promise. Must be globally unique, not just within the implementation - childGuid: string; // child of child promise (for chained via `then`) - eventName: string; // one of ['created', 'chained', 'fulfilled', 'rejected'] - detail: any; // fulfillment value or rejection reason, if applicable - label: string; // label passed to promise's constructor - timeStamp: number; // milliseconds elapsed since 1 January 1970 00:00:00 UTC up until now - } + interface InstrumentEvent { + guid: string; // guid of promise. Must be globally unique, not just within the implementation + childGuid: string; // child of child promise (for chained via `then`) + eventName: string; // one of ['created', 'chained', 'fulfilled', 'rejected'] + detail: any; // fulfillment value or rejection reason, if applicable + label: string; // label passed to promise's constructor + timeStamp: number; // milliseconds elapsed since 1 January 1970 00:00:00 UTC up until now + } - interface ObjectWithEventMixins { - on( - eventName: 'created' | 'chained' | 'fulfilled' | 'rejected', - listener: (event: InstrumentEvent) => void - ): void; - on(eventName: 'error', errorHandler: (reason: any) => void): void; - on(eventName: string, callback: (value: any) => void): void; - off(eventName: string, callback?: (value: any) => void): void; - trigger(eventName: string, options?: any, label?: string): void; - } + interface ObjectWithEventMixins { + on( + eventName: 'created' | 'chained' | 'fulfilled' | 'rejected', + listener: (event: InstrumentEvent) => void + ): void; + on(eventName: 'error', errorHandler: (reason: any) => void): void; + on(eventName: string, callback: (value: any) => void): void; + off(eventName: string, callback?: (value: any) => void): void; + trigger(eventName: string, options?: any, label?: string): void; + } - class Promise implements Thenable, Catchable { - /** + class Promise implements Thenable, Catchable { + /** * If you call resolve in the body of the callback passed to the constructor, * your promise is fulfilled with result object passed to resolve. * If you call reject your promise is rejected with the object passed to reject. * For consistency and debugging (eg stack traces), obj should be an instanceof Error. * Any errors thrown in the constructor callback will be implicitly passed to reject(). */ - constructor( - callback: ( - resolve: (result?: T | Thenable) => void, - reject: (error: C | Thenable) => void - ) => void, - label?: string - ); + constructor( + callback: ( + resolve: (result?: T | Thenable) => void, + reject: (error: C | Thenable) => void + ) => void, + label?: string + ); - /** + /** * onFulfillment is called when/if "promise" resolves. onRejected is called when/if "promise" rejects. * Both are optional, if either/both are omitted the next onFulfillment/onRejected in the chain is called. * Both callbacks have a single parameter , the fulfillment value or rejection reason. @@ -116,31 +116,31 @@ declare namespace RSVP { * @param onRejected called when/if "promise" rejects * @param label useful for tooling */ - then( - onFulfillment: Resolution, - onRejected: Rejection, - label?: string - ): Promise; - then(onFulfillment: Resolution, label?: string): Promise; - then(label?: string): Promise; + then( + onFulfillment: Resolution, + onRejected: Rejection, + label?: string + ): Promise; + then(onFulfillment: Resolution, label?: string): Promise; + then(label?: string): Promise; - /** + /** * Sugar for promise.then(undefined, onRejected) */ - catch(label?: string): Promise; - catch(onRejection: Rejection, label?: string): Promise; + catch(label?: string): Promise; + catch(onRejection: Rejection, label?: string): Promise; - finally(finallyCallback: Function): Promise; + finally(finallyCallback: Function): Promise; - /** + /** * `RSVP.Promise.all` accepts an array of promises, and returns a new promise which * is fulfilled with an array of fulfillment values for the passed promises, or * rejected with the reason of the first passed promise to be rejected. It casts all * elements of the passed iterable to promises as it runs this algorithm. */ - static all(promises: Thenable[], label?: string): Promise; + static all(promises: Thenable[], label?: string): Promise; - /** + /** * `RSVP.Promise.race` returns a new promise which is settled in the same way as the * first passed promise to settle. * @@ -150,67 +150,67 @@ declare namespace RSVP { * become rejected before the other promises became fulfilled, the returned * promise will become rejected. */ - static race(promises: Promise[]): Promise; + static race(promises: Promise[]): Promise; - /** + /** * Returns a promise that will become resolved with the passed `value` */ - static resolve(value: T, label?: string): Promise; + static resolve(value: T, label?: string): Promise; - /** + /** * Deprecated in favor of resolve */ - static cast(value: T, label?: string): Promise; + static cast(value: T, label?: string): Promise; - /** + /** * Returns a promise rejected with the passed `reason`. */ - static reject(reason: C): Promise; - } + static reject(reason: C): Promise; + } - export namespace EventTarget { - /** `RSVP.EventTarget.mixin` extends an object with EventTarget methods. */ - function mixin(object: object): ObjectWithEventMixins; + export namespace EventTarget { + /** `RSVP.EventTarget.mixin` extends an object with EventTarget methods. */ + function mixin(object: object): ObjectWithEventMixins; - /** Registers a callback to be executed when `eventName` is triggered */ - function on( - eventName: 'created' | 'chained' | 'fulfilled' | 'rejected', - listener: (event: InstrumentEvent) => void - ): void; - function on(eventName: 'error', errorHandler: (reason: any) => void): void; - function on(eventName: string, callback: (value: any) => void): void; + /** Registers a callback to be executed when `eventName` is triggered */ + function on( + eventName: 'created' | 'chained' | 'fulfilled' | 'rejected', + listener: (event: InstrumentEvent) => void + ): void; + function on(eventName: 'error', errorHandler: (reason: any) => void): void; + function on(eventName: string, callback: (value: any) => void): void; - /** + /** * You can use `off` to stop firing a particular callback for an event. * * If you don't pass a `callback` argument to `off`, ALL callbacks for the * event will not be executed when the event fires. */ - function off(eventName: string, callback?: (value: any) => void): void; + function off(eventName: string, callback?: (value: any) => void): void; - /** + /** * Use `trigger` to fire custom events. * * You can also pass a value as a second argument to `trigger` that will be * passed as an argument to all event listeners for the event */ - function trigger(eventName: string, options?: any, label?: string): void; - } + function trigger(eventName: string, options?: any, label?: string): void; + } - export function configure( - configName: 'instrument' | 'instrument-with-stack', - shouldInstrument: boolean - ): void; - export function configure(configName: string, value: any): void; + export function configure( + configName: 'instrument' | 'instrument-with-stack', + shouldInstrument: boolean + ): void; + export function configure(configName: string, value: any): void; - /** + /** * Make a promise that fulfills when every item in the array fulfills, and rejects if (and when) any item rejects. * the array passed to all can be a mixture of promise-like objects and other objects. * The fulfillment value is an array (in order) of fulfillment values. The rejection value is the first rejection value. */ - export function all(promises: Thenable[]): Promise; + export function all(promises: Thenable[]): Promise; - /** + /** * `RSVP.hash` is similar to `RSVP.all`, but takes an object instead of an array * for its `promises` argument. * @@ -223,9 +223,9 @@ declare namespace RSVP { * If any of the `promises` given to `RSVP.hash` are rejected, the first promise * that is rejected will be given as the reason to the rejection handler. */ - export function hash(promises: PromiseHash): Promise; + export function hash(promises: PromiseHash): Promise; - /** + /** * `RSVP.map` is similar to JavaScript's native `map` method. `mapFn` is eagerly called * meaning that as soon as any promise resolves its value will be passed to `mapFn`. * `RSVP.map` returns a promise that will become fulfilled with the result of running @@ -235,21 +235,21 @@ declare namespace RSVP { * that is rejected will be given as an argument to the returned promise's * rejection handler. */ - export function map( - promises: Thenable[], - mapFn: (item: T) => U, - label?: string - ): Promise; + export function map( + promises: Thenable[], + mapFn: (item: T) => U, + label?: string + ): Promise; - /** + /** * `RSVP.allSettled` is similar to `RSVP.all`, but instead of implementing * a fail-fast method, it waits until all the promises have returned and * shows you all the results. This is useful if you want to handle multiple * promises' failure states together as a set. */ - export function allSettled(promises: Thenable[]): Promise[], C>; + export function allSettled(promises: Thenable[]): Promise[], C>; - /** + /** * `RSVP.hashSettled` is similar to `RSVP.allSettled`, but takes an object * instead of an array for its `promises` argument. * @@ -259,14 +259,14 @@ declare namespace RSVP { * with their states and values/reasons. This is useful if you want to * handle multiple promises' failure states together as a set. */ - export function hashSettled(promises: PromiseHash): Promise, C>; + export function hashSettled(promises: PromiseHash): Promise, C>; - /** + /** * Make a Promise that fulfills when any item fulfills, and rejects if any item rejects. */ - function race(promises: Promise[]): Promise; + function race(promises: Promise[]): Promise; - /** + /** * `RSVP.denodeify` takes a "node-style" function and returns a function that * will return an `RSVP.Promise`. You can use `denodeify` in Node.js or the * browser when you'd prefer to use promises over using callbacks. For example, @@ -324,12 +324,12 @@ declare namespace RSVP { * }); * ``` */ - export function denodeify( - nodeFunction: Function, - options: boolean | string[] - ): (...args: A[]) => Promise; + export function denodeify( + nodeFunction: Function, + options: boolean | string[] + ): (...args: A[]) => Promise; - /** + /** * `RSVP.defer` returns an object similar to jQuery's `$.Deferred`. * `RSVP.defer` should be used when porting over code reliant on `$.Deferred`'s * interface. New code should use the `RSVP.Promise` constructor instead. @@ -339,32 +339,32 @@ declare namespace RSVP { * * reject - a function that causes the `promise` property on this object to become rejected * * resolve - a function that causes the `promise` property on this object to become fulfilled. */ - export function defer(label?: string): Deferred; + export function defer(label?: string): Deferred; - /** + /** * `RSVP.Promise.reject` returns a promise rejected with the passed `reason`. */ - export function reject(reason: C): Promise; + export function reject(reason: C): Promise; - /** + /** * `RSVP.Promise.resolve` returns a promise that will become resolved with the * passed `value`. */ - export function resolve(value: T): Promise; + export function resolve(value: T): Promise; - /** + /** * `RSVP.filter` is similar to JavaScript's native `filter` method, except that it * waits for all promises to become fulfilled before running the `filterFn` on * each item in given to `promises`. `RSVP.filter` returns a promise that will * become fulfilled with the result of running `filterFn` on the values the * promises become fulfilled with. */ - export function filter( - promises: Thenable[], - filterFn: (value: T) => boolean | Promise - ): Promise; + export function filter( + promises: Thenable[], + filterFn: (value: T) => boolean | Promise + ): Promise; - /** + /** * `RSVP.rethrow` will rethrow an error on the next turn of the JavaScript event * loop in order to aid debugging. * @@ -376,7 +376,7 @@ declare namespace RSVP { * or domain/cause uncaught exception in Node. `rethrow` will also throw the * error again so the error can be handled by the promise per the spec. */ - export function rethrow(reason: C): void; + export function rethrow(reason: C): void; } // export default RSVP; From c1bbbe3c691c07c6017c11ecf7bf6c12a357fb0a Mon Sep 17 00:00:00 2001 From: Chris Krycho Date: Fri, 11 Aug 2017 18:08:42 -0400 Subject: [PATCH 008/156] Use `import =` for RSVP tests; drop corresponding tsconfig setting. --- types/rsvp/index.d.ts | 1 - types/rsvp/rsvp-tests.ts | 2 +- types/rsvp/tsconfig.json | 3 +-- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/types/rsvp/index.d.ts b/types/rsvp/index.d.ts index 1aa764d785..8f2fdfee04 100644 --- a/types/rsvp/index.d.ts +++ b/types/rsvp/index.d.ts @@ -379,5 +379,4 @@ declare namespace RSVP { export function rethrow(reason: C): void; } -// export default RSVP; export = RSVP; diff --git a/types/rsvp/rsvp-tests.ts b/types/rsvp/rsvp-tests.ts index 519947dcc7..aec0acfede 100644 --- a/types/rsvp/rsvp-tests.ts +++ b/types/rsvp/rsvp-tests.ts @@ -1,4 +1,4 @@ -import RSVP from 'rsvp'; +import RSVP = require('rsvp'); let promise1: RSVP.Promise = RSVP.Promise.resolve(1); let promise1a: RSVP.Promise = RSVP.resolve(1); diff --git a/types/rsvp/tsconfig.json b/types/rsvp/tsconfig.json index fee17b279a..4eb44a2f7d 100644 --- a/types/rsvp/tsconfig.json +++ b/types/rsvp/tsconfig.json @@ -13,8 +13,7 @@ ], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": true, - "allowSyntheticDefaultImports": true + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", From 2ff76c2755156481894f7db78a7fa539b2aa3112 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Mon, 14 Aug 2017 14:06:21 -0700 Subject: [PATCH 009/156] Remove `--allowSyntheticDefaultImports` --- types/ember-testing-helpers/tsconfig.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/types/ember-testing-helpers/tsconfig.json b/types/ember-testing-helpers/tsconfig.json index cd7634bd25..aaf474ecba 100644 --- a/types/ember-testing-helpers/tsconfig.json +++ b/types/ember-testing-helpers/tsconfig.json @@ -14,8 +14,7 @@ ], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": true, - "allowSyntheticDefaultImports": true + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", From 43a1348b9146b0c6130a37f28d019eb2924ad9a3 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Mon, 14 Aug 2017 14:06:48 -0700 Subject: [PATCH 010/156] Remove `--allowSyntheticDefaultImports` --- types/ember/tsconfig.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/types/ember/tsconfig.json b/types/ember/tsconfig.json index fbc4052a08..b73838d20e 100644 --- a/types/ember/tsconfig.json +++ b/types/ember/tsconfig.json @@ -14,8 +14,7 @@ ], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": true, - "allowSyntheticDefaultImports": true + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", From 3a6dc3305f9c435984d9789dde8ee910f6729b2e Mon Sep 17 00:00:00 2001 From: Dave Baumann Date: Tue, 15 Aug 2017 23:47:05 -0500 Subject: [PATCH 011/156] adding stockChart method to Highstock.Static --- types/highcharts/highstock.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/highcharts/highstock.d.ts b/types/highcharts/highstock.d.ts index 3ec90ec6a1..4c246478ee 100644 --- a/types/highcharts/highstock.d.ts +++ b/types/highcharts/highstock.d.ts @@ -1,6 +1,7 @@ // Type definitions for Highstock 2.1.5 // Project: http://www.highcharts.com/ // Definitions by: David Deutsch +// Definitions by: Dave Baumann // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped import * as Highcharts from "highcharts"; @@ -100,6 +101,7 @@ declare namespace Highstock { interface Static extends Highcharts.Static { StockChart: Chart; + stockChart(renderTo: string | HTMLElement, options: Options, callback?: (chart: ChartObject) => void): ChartObject; } } From c1417d1f64e1359b89c0d9e701ac3772075f36e5 Mon Sep 17 00:00:00 2001 From: Andrew Town Date: Thu, 17 Aug 2017 10:14:11 -0500 Subject: [PATCH 012/156] Add support for more button column types and support the filename option --- .../datatables.net-buttons-tests.ts | 10 ++++++++++ types/datatables.net-buttons/index.d.ts | 7 ++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/types/datatables.net-buttons/datatables.net-buttons-tests.ts b/types/datatables.net-buttons/datatables.net-buttons-tests.ts index 015917c456..3323f6fdb9 100644 --- a/types/datatables.net-buttons/datatables.net-buttons-tests.ts +++ b/types/datatables.net-buttons/datatables.net-buttons-tests.ts @@ -8,10 +8,20 @@ $(document).ready(function () { extend: 'excel', text: 'Excel', className: 'class', + filename: "exported_file.csv", exportOptions: { columns: ':visible' } }, + { + extend: 'excel', + text: 'Excel', + className: 'class', + filename: "exported_file.csv", + exportOptions: { + columns: [1, 6, 2, 3, 4] + } + }, { action: function (e, dt, node, config) { }, available: function (dt, config) { return true; }, diff --git a/types/datatables.net-buttons/index.d.ts b/types/datatables.net-buttons/index.d.ts index a5b32c1bf6..1bdf212b03 100644 --- a/types/datatables.net-buttons/index.d.ts +++ b/types/datatables.net-buttons/index.d.ts @@ -86,6 +86,11 @@ declare namespace DataTables { */ title?: string; + /** + * Define what the exported filename should be + */ + filename?: string; + exportOptions?: ButtonExportOptions; autoPrint?: boolean; customize?: FunctionButtonCustomize; @@ -95,7 +100,7 @@ declare namespace DataTables { (dt: DataTables.Api, config: any): boolean } export interface ButtonExportOptions { - columns?: string; + columns?: string | number | string[] | number[]; } export interface ButtonKey { From 73dd4e148f4561c649b62482bdadaef6757e8948 Mon Sep 17 00:00:00 2001 From: Andrew Lessels Date: Fri, 18 Aug 2017 08:42:17 +1000 Subject: [PATCH 013/156] Add typeInterval constructor option and screenshot overload for clipping path --- types/nightmare/index.d.ts | 2 ++ types/nightmare/nightmare-tests.ts | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/types/nightmare/index.d.ts b/types/nightmare/index.d.ts index d99947ab27..5e4160fd41 100644 --- a/types/nightmare/index.d.ts +++ b/types/nightmare/index.d.ts @@ -96,6 +96,7 @@ declare class Nightmare { removeListener(event: 'error', cb: (msg: string, trace?: Nightmare.IStackTrace[]) => void): Nightmare; removeListener(event: 'timeout', cb: (msg: string) => void): Nightmare; screenshot(path: string): Nightmare; + screenshot(path: string, clip: Object): Nightmare; html(path: string, saveType: string): Nightmare; html(path: string, saveType: 'HTMLOnly'): Nightmare; html(path: string, saveType: 'HTMLComplete'): Nightmare; @@ -134,6 +135,7 @@ declare namespace Nightmare { cookiesFile?: string; phantomPath?: string; show?: boolean; + typeInterval?: number; } export interface IRequest { diff --git a/types/nightmare/nightmare-tests.ts b/types/nightmare/nightmare-tests.ts index 921e961538..37ac342d5f 100644 --- a/types/nightmare/nightmare-tests.ts +++ b/types/nightmare/nightmare-tests.ts @@ -167,6 +167,11 @@ new Nightmare() .screenshot('test/test.png') .run(done); +new Nightmare() + .goto('http://yahoo.com') + .screenshot('test/test.png', { x: 10, y: 5, width: 10, height: 10}) + .run(done); + new Nightmare() .goto('http://yahoo.com') .pdf('test/test.pdf') From 288dd9b3099ee9b8f92dd41e7eaf29d943122dd9 Mon Sep 17 00:00:00 2001 From: Ivan Goncharov Date: Tue, 22 Aug 2017 16:59:17 +0300 Subject: [PATCH 014/156] Add validation rules --- types/graphql/index.d.ts | 31 +++++ types/graphql/validation/index.d.ts | 130 ++++++++++++++++++ .../rules/ArgumentsOfCorrectType.d.ts | 9 ++ .../rules/DefaultValuesOfCorrectType.d.ts | 9 ++ .../validation/rules/FieldsOnCorrectType.d.ts | 9 ++ .../rules/FragmentsOnCompositeTypes.d.ts | 10 ++ .../validation/rules/KnownArgumentNames.d.ts | 9 ++ .../validation/rules/KnownDirectives.d.ts | 9 ++ .../validation/rules/KnownFragmentNames.d.ts | 9 ++ .../validation/rules/KnownTypeNames.d.ts | 9 ++ .../rules/LoneAnonymousOperation.d.ts | 9 ++ .../validation/rules/NoFragmentCycles.d.ts | 3 + .../rules/NoUndefinedVariables.d.ts | 9 ++ .../validation/rules/NoUnusedFragments.d.ts | 9 ++ .../validation/rules/NoUnusedVariables.d.ts | 9 ++ .../rules/OverlappingFieldsCanBeMerged.d.ts | 10 ++ .../rules/PossibleFragmentSpreads.d.ts | 10 ++ .../rules/ProvidedNonNullArguments.d.ts | 9 ++ .../graphql/validation/rules/ScalarLeafs.d.ts | 9 ++ .../rules/SingleFieldSubscriptions.d.ts | 8 ++ .../validation/rules/UniqueArgumentNames.d.ts | 9 ++ .../rules/UniqueDirectivesPerLocation.d.ts | 9 ++ .../validation/rules/UniqueFragmentNames.d.ts | 8 ++ .../rules/UniqueInputFieldNames.d.ts | 9 ++ .../rules/UniqueOperationNames.d.ts | 8 ++ .../validation/rules/UniqueVariableNames.d.ts | 8 ++ .../rules/VariablesAreInputTypes.d.ts | 9 ++ .../rules/VariablesInAllowedPosition.d.ts | 6 + 28 files changed, 385 insertions(+) create mode 100644 types/graphql/validation/rules/ArgumentsOfCorrectType.d.ts create mode 100644 types/graphql/validation/rules/DefaultValuesOfCorrectType.d.ts create mode 100644 types/graphql/validation/rules/FieldsOnCorrectType.d.ts create mode 100644 types/graphql/validation/rules/FragmentsOnCompositeTypes.d.ts create mode 100644 types/graphql/validation/rules/KnownArgumentNames.d.ts create mode 100644 types/graphql/validation/rules/KnownDirectives.d.ts create mode 100644 types/graphql/validation/rules/KnownFragmentNames.d.ts create mode 100644 types/graphql/validation/rules/KnownTypeNames.d.ts create mode 100644 types/graphql/validation/rules/LoneAnonymousOperation.d.ts create mode 100644 types/graphql/validation/rules/NoFragmentCycles.d.ts create mode 100644 types/graphql/validation/rules/NoUndefinedVariables.d.ts create mode 100644 types/graphql/validation/rules/NoUnusedFragments.d.ts create mode 100644 types/graphql/validation/rules/NoUnusedVariables.d.ts create mode 100644 types/graphql/validation/rules/OverlappingFieldsCanBeMerged.d.ts create mode 100644 types/graphql/validation/rules/PossibleFragmentSpreads.d.ts create mode 100644 types/graphql/validation/rules/ProvidedNonNullArguments.d.ts create mode 100644 types/graphql/validation/rules/ScalarLeafs.d.ts create mode 100644 types/graphql/validation/rules/SingleFieldSubscriptions.d.ts create mode 100644 types/graphql/validation/rules/UniqueArgumentNames.d.ts create mode 100644 types/graphql/validation/rules/UniqueDirectivesPerLocation.d.ts create mode 100644 types/graphql/validation/rules/UniqueFragmentNames.d.ts create mode 100644 types/graphql/validation/rules/UniqueInputFieldNames.d.ts create mode 100644 types/graphql/validation/rules/UniqueOperationNames.d.ts create mode 100644 types/graphql/validation/rules/UniqueVariableNames.d.ts create mode 100644 types/graphql/validation/rules/VariablesAreInputTypes.d.ts create mode 100644 types/graphql/validation/rules/VariablesInAllowedPosition.d.ts diff --git a/types/graphql/index.d.ts b/types/graphql/index.d.ts index 971ae5945b..ee1a95c059 100644 --- a/types/graphql/index.d.ts +++ b/types/graphql/index.d.ts @@ -6,6 +6,7 @@ // Firede // Kepennar // Mikhail Novikov +// Ivan Goncharov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -34,7 +35,37 @@ export { export { validate, ValidationContext, + + // All validation rules in the GraphQL Specification. specifiedRules, + + // Individual validation rules. + ArgumentsOfCorrectTypeRule, + DefaultValuesOfCorrectTypeRule, + FieldsOnCorrectTypeRule, + FragmentsOnCompositeTypesRule, + KnownArgumentNamesRule, + KnownDirectivesRule, + KnownFragmentNamesRule, + KnownTypeNamesRule, + LoneAnonymousOperationRule, + NoFragmentCyclesRule, + NoUndefinedVariablesRule, + NoUnusedFragmentsRule, + NoUnusedVariablesRule, + OverlappingFieldsCanBeMergedRule, + PossibleFragmentSpreadsRule, + ProvidedNonNullArgumentsRule, + ScalarLeafsRule, + SingleFieldSubscriptionsRule, + UniqueArgumentNamesRule, + UniqueDirectivesPerLocationRule, + UniqueFragmentNamesRule, + UniqueInputFieldNamesRule, + UniqueOperationNamesRule, + UniqueVariableNamesRule, + VariablesAreInputTypesRule, + VariablesInAllowedPositionRule, } from './validation'; // Create and format GraphQL errors. diff --git a/types/graphql/validation/index.d.ts b/types/graphql/validation/index.d.ts index a3ebc6a208..7f897fe78d 100644 --- a/types/graphql/validation/index.d.ts +++ b/types/graphql/validation/index.d.ts @@ -1,2 +1,132 @@ export { validate, ValidationContext } from './validate'; export { specifiedRules } from './specifiedRules'; + +// Spec Section: "Argument Values Type Correctness" +export { + ArgumentsOfCorrectType as ArgumentsOfCorrectTypeRule +} from './rules/ArgumentsOfCorrectType'; + +// Spec Section: "Variable Default Values Are Correctly Typed" +export { + DefaultValuesOfCorrectType as DefaultValuesOfCorrectTypeRule +} from './rules/DefaultValuesOfCorrectType'; + +// Spec Section: "Field Selections on Objects, Interfaces, and Unions Types" +export { + FieldsOnCorrectType as FieldsOnCorrectTypeRule +} from './rules/FieldsOnCorrectType'; + +// Spec Section: "Fragments on Composite Types" +export { + FragmentsOnCompositeTypes as FragmentsOnCompositeTypesRule +} from './rules/FragmentsOnCompositeTypes'; + +// Spec Section: "Argument Names" +export { + KnownArgumentNames as KnownArgumentNamesRule +} from './rules/KnownArgumentNames'; + +// Spec Section: "Directives Are Defined" +export { + KnownDirectives as KnownDirectivesRule +} from './rules/KnownDirectives'; + +// Spec Section: "Fragment spread target defined" +export { + KnownFragmentNames as KnownFragmentNamesRule +} from './rules/KnownFragmentNames'; + +// Spec Section: "Fragment Spread Type Existence" +export { + KnownTypeNames as KnownTypeNamesRule +} from './rules/KnownTypeNames'; + +// Spec Section: "Lone Anonymous Operation" +export { + LoneAnonymousOperation as LoneAnonymousOperationRule +} from './rules/LoneAnonymousOperation'; + +// Spec Section: "Fragments must not form cycles" +export { + NoFragmentCycles as NoFragmentCyclesRule +} from './rules/NoFragmentCycles'; + +// Spec Section: "All Variable Used Defined" +export { + NoUndefinedVariables as NoUndefinedVariablesRule +} from './rules/NoUndefinedVariables'; + +// Spec Section: "Fragments must be used" +export { + NoUnusedFragments as NoUnusedFragmentsRule +} from './rules/NoUnusedFragments'; + +// Spec Section: "All Variables Used" +export { + NoUnusedVariables as NoUnusedVariablesRule +} from './rules/NoUnusedVariables'; + +// Spec Section: "Field Selection Merging" +export { + OverlappingFieldsCanBeMerged as OverlappingFieldsCanBeMergedRule +} from './rules/OverlappingFieldsCanBeMerged'; + +// Spec Section: "Fragment spread is possible" +export { + PossibleFragmentSpreads as PossibleFragmentSpreadsRule +} from './rules/PossibleFragmentSpreads'; + +// Spec Section: "Argument Optionality" +export { + ProvidedNonNullArguments as ProvidedNonNullArgumentsRule +} from './rules/ProvidedNonNullArguments'; + +// Spec Section: "Leaf Field Selections" +export { + ScalarLeafs as ScalarLeafsRule +} from './rules/ScalarLeafs'; + +// Spec Section: "Subscriptions with Single Root Field" +export { + SingleFieldSubscriptions as SingleFieldSubscriptionsRule +} from './rules/SingleFieldSubscriptions'; + +// Spec Section: "Argument Uniqueness" +export { + UniqueArgumentNames as UniqueArgumentNamesRule +} from './rules/UniqueArgumentNames'; + +// Spec Section: "Directives Are Unique Per Location" +export { + UniqueDirectivesPerLocation as UniqueDirectivesPerLocationRule +} from './rules/UniqueDirectivesPerLocation'; + +// Spec Section: "Fragment Name Uniqueness" +export { + UniqueFragmentNames as UniqueFragmentNamesRule +} from './rules/UniqueFragmentNames'; + +// Spec Section: "Input Object Field Uniqueness" +export { + UniqueInputFieldNames as UniqueInputFieldNamesRule +} from './rules/UniqueInputFieldNames'; + +// Spec Section: "Operation Name Uniqueness" +export { + UniqueOperationNames as UniqueOperationNamesRule +} from './rules/UniqueOperationNames'; + +// Spec Section: "Variable Uniqueness" +export { + UniqueVariableNames as UniqueVariableNamesRule +} from './rules/UniqueVariableNames'; + +// Spec Section: "Variables are Input Types" +export { + VariablesAreInputTypes as VariablesAreInputTypesRule +} from './rules/VariablesAreInputTypes'; + +// Spec Section: "All Variable Usages Are Allowed" +export { + VariablesInAllowedPosition as VariablesInAllowedPositionRule +} from './rules/VariablesInAllowedPosition'; diff --git a/types/graphql/validation/rules/ArgumentsOfCorrectType.d.ts b/types/graphql/validation/rules/ArgumentsOfCorrectType.d.ts new file mode 100644 index 0000000000..f7247d0a9c --- /dev/null +++ b/types/graphql/validation/rules/ArgumentsOfCorrectType.d.ts @@ -0,0 +1,9 @@ +import { ValidationContext } from '../index'; + +/** + * Argument values of correct type + * + * A GraphQL document is only valid if all field argument literal values are + * of the type expected by their position. + */ +export function ArgumentsOfCorrectType(context: ValidationContext): any; diff --git a/types/graphql/validation/rules/DefaultValuesOfCorrectType.d.ts b/types/graphql/validation/rules/DefaultValuesOfCorrectType.d.ts new file mode 100644 index 0000000000..88b3a824f2 --- /dev/null +++ b/types/graphql/validation/rules/DefaultValuesOfCorrectType.d.ts @@ -0,0 +1,9 @@ +import { ValidationContext } from '../index'; + +/** + * Variable default values of correct type + * + * A GraphQL document is only valid if all variable default values are of the + * type expected by their definition. + */ +export function DefaultValuesOfCorrectType(context: ValidationContext): any; diff --git a/types/graphql/validation/rules/FieldsOnCorrectType.d.ts b/types/graphql/validation/rules/FieldsOnCorrectType.d.ts new file mode 100644 index 0000000000..19609b2b65 --- /dev/null +++ b/types/graphql/validation/rules/FieldsOnCorrectType.d.ts @@ -0,0 +1,9 @@ +import { ValidationContext } from '../index'; + +/** + * Fields on correct type + * + * A GraphQL document is only valid if all fields selected are defined by the + * parent type, or are an allowed meta field such as __typename. + */ +export function FieldsOnCorrectType(context: ValidationContext): any; diff --git a/types/graphql/validation/rules/FragmentsOnCompositeTypes.d.ts b/types/graphql/validation/rules/FragmentsOnCompositeTypes.d.ts new file mode 100644 index 0000000000..d6fffd4337 --- /dev/null +++ b/types/graphql/validation/rules/FragmentsOnCompositeTypes.d.ts @@ -0,0 +1,10 @@ +import { ValidationContext } from '../index'; + +/** + * Fragments on composite type + * + * Fragments use a type condition to determine if they apply, since fragments + * can only be spread into a composite type (object, interface, or union), the + * type condition must also be a composite type. + */ +export function FragmentsOnCompositeTypes(context: ValidationContext): any; diff --git a/types/graphql/validation/rules/KnownArgumentNames.d.ts b/types/graphql/validation/rules/KnownArgumentNames.d.ts new file mode 100644 index 0000000000..4477b62a75 --- /dev/null +++ b/types/graphql/validation/rules/KnownArgumentNames.d.ts @@ -0,0 +1,9 @@ +import { ValidationContext } from '../index'; + +/** + * Known argument names + * + * A GraphQL field is only valid if all supplied arguments are defined by + * that field. + */ +export function KnownArgumentNames(context: ValidationContext): any; diff --git a/types/graphql/validation/rules/KnownDirectives.d.ts b/types/graphql/validation/rules/KnownDirectives.d.ts new file mode 100644 index 0000000000..68c6acf549 --- /dev/null +++ b/types/graphql/validation/rules/KnownDirectives.d.ts @@ -0,0 +1,9 @@ +import { ValidationContext } from '../index'; + +/** + * Known directives + * + * A GraphQL document is only valid if all `@directives` are known by the + * schema and legally positioned. + */ +export function KnownDirectives(context: ValidationContext): any; diff --git a/types/graphql/validation/rules/KnownFragmentNames.d.ts b/types/graphql/validation/rules/KnownFragmentNames.d.ts new file mode 100644 index 0000000000..b904f22d89 --- /dev/null +++ b/types/graphql/validation/rules/KnownFragmentNames.d.ts @@ -0,0 +1,9 @@ +import { ValidationContext } from '../index'; + +/** + * Known fragment names + * + * A GraphQL document is only valid if all `...Fragment` fragment spreads refer + * to fragments defined in the same document. + */ +export function KnownFragmentNames(context: ValidationContext): any; diff --git a/types/graphql/validation/rules/KnownTypeNames.d.ts b/types/graphql/validation/rules/KnownTypeNames.d.ts new file mode 100644 index 0000000000..48b15318da --- /dev/null +++ b/types/graphql/validation/rules/KnownTypeNames.d.ts @@ -0,0 +1,9 @@ +import { ValidationContext } from '../index'; + +/** + * Known type names + * + * A GraphQL document is only valid if referenced types (specifically + * variable definitions and fragment conditions) are defined by the type schema. + */ +export function KnownTypeNames(context: ValidationContext): any; diff --git a/types/graphql/validation/rules/LoneAnonymousOperation.d.ts b/types/graphql/validation/rules/LoneAnonymousOperation.d.ts new file mode 100644 index 0000000000..4ce6abcba9 --- /dev/null +++ b/types/graphql/validation/rules/LoneAnonymousOperation.d.ts @@ -0,0 +1,9 @@ +import { ValidationContext } from '../index'; + +/** + * Lone anonymous operation + * + * A GraphQL document is only valid if when it contains an anonymous operation + * (the query short-hand) that it contains only that one operation definition. + */ +export function LoneAnonymousOperation(context: ValidationContext): any; diff --git a/types/graphql/validation/rules/NoFragmentCycles.d.ts b/types/graphql/validation/rules/NoFragmentCycles.d.ts new file mode 100644 index 0000000000..fed5982fc8 --- /dev/null +++ b/types/graphql/validation/rules/NoFragmentCycles.d.ts @@ -0,0 +1,3 @@ +import { ValidationContext } from '../index'; + +export function NoFragmentCycles(context: ValidationContext): any; diff --git a/types/graphql/validation/rules/NoUndefinedVariables.d.ts b/types/graphql/validation/rules/NoUndefinedVariables.d.ts new file mode 100644 index 0000000000..51d30b8fd1 --- /dev/null +++ b/types/graphql/validation/rules/NoUndefinedVariables.d.ts @@ -0,0 +1,9 @@ +import { ValidationContext } from '../index'; + +/** + * No undefined variables + * + * A GraphQL operation is only valid if all variables encountered, both directly + * and via fragment spreads, are defined by that operation. + */ +export function NoUndefinedVariables(context: ValidationContext): any; diff --git a/types/graphql/validation/rules/NoUnusedFragments.d.ts b/types/graphql/validation/rules/NoUnusedFragments.d.ts new file mode 100644 index 0000000000..7f4d431299 --- /dev/null +++ b/types/graphql/validation/rules/NoUnusedFragments.d.ts @@ -0,0 +1,9 @@ +import { ValidationContext } from '../index'; + +/** + * No unused fragments + * + * A GraphQL document is only valid if all fragment definitions are spread + * within operations, or spread within other fragments spread within operations. + */ +export function NoUnusedFragments(context: ValidationContext): any; diff --git a/types/graphql/validation/rules/NoUnusedVariables.d.ts b/types/graphql/validation/rules/NoUnusedVariables.d.ts new file mode 100644 index 0000000000..6eb2d984aa --- /dev/null +++ b/types/graphql/validation/rules/NoUnusedVariables.d.ts @@ -0,0 +1,9 @@ +import { ValidationContext } from '../index'; + +/** + * No unused variables + * + * A GraphQL operation is only valid if all variables defined by an operation + * are used, either directly or within a spread fragment. + */ +export function NoUnusedVariables(context: ValidationContext): any; diff --git a/types/graphql/validation/rules/OverlappingFieldsCanBeMerged.d.ts b/types/graphql/validation/rules/OverlappingFieldsCanBeMerged.d.ts new file mode 100644 index 0000000000..f21edbd2cb --- /dev/null +++ b/types/graphql/validation/rules/OverlappingFieldsCanBeMerged.d.ts @@ -0,0 +1,10 @@ +import { ValidationContext } from '../index'; + +/** + * Overlapping fields can be merged + * + * A selection set is only valid if all fields (including spreading any + * fragments) either correspond to distinct response names or can be merged + * without ambiguity. + */ +export function OverlappingFieldsCanBeMerged(context: ValidationContext): any; diff --git a/types/graphql/validation/rules/PossibleFragmentSpreads.d.ts b/types/graphql/validation/rules/PossibleFragmentSpreads.d.ts new file mode 100644 index 0000000000..8defb47721 --- /dev/null +++ b/types/graphql/validation/rules/PossibleFragmentSpreads.d.ts @@ -0,0 +1,10 @@ +import { ValidationContext } from '../index'; + +/** + * Possible fragment spread + * + * A fragment spread is only valid if the type condition could ever possibly + * be true: if there is a non-empty intersection of the possible parent types, + * and possible types which pass the type condition. + */ +export function PossibleFragmentSpreads(context: ValidationContext): any; diff --git a/types/graphql/validation/rules/ProvidedNonNullArguments.d.ts b/types/graphql/validation/rules/ProvidedNonNullArguments.d.ts new file mode 100644 index 0000000000..4d5334b9fb --- /dev/null +++ b/types/graphql/validation/rules/ProvidedNonNullArguments.d.ts @@ -0,0 +1,9 @@ +import { ValidationContext } from '../index'; + +/** + * Provided required arguments + * + * A field or directive is only valid if all required (non-null) field arguments + * have been provided. + */ +export function ProvidedNonNullArguments(context: ValidationContext): any; diff --git a/types/graphql/validation/rules/ScalarLeafs.d.ts b/types/graphql/validation/rules/ScalarLeafs.d.ts new file mode 100644 index 0000000000..afdc575671 --- /dev/null +++ b/types/graphql/validation/rules/ScalarLeafs.d.ts @@ -0,0 +1,9 @@ +import { ValidationContext } from '../index'; + +/** + * Scalar leafs + * + * A GraphQL document is valid only if all leaf fields (fields without + * sub selections) are of scalar or enum types. + */ +export function ScalarLeafs(context: ValidationContext): any; diff --git a/types/graphql/validation/rules/SingleFieldSubscriptions.d.ts b/types/graphql/validation/rules/SingleFieldSubscriptions.d.ts new file mode 100644 index 0000000000..01a2654a16 --- /dev/null +++ b/types/graphql/validation/rules/SingleFieldSubscriptions.d.ts @@ -0,0 +1,8 @@ +import { ValidationContext } from '../index'; + +/** + * Subscriptions must only include one field. + * + * A GraphQL subscription is valid only if it contains a single root field. + */ +export function SingleFieldSubscriptions(context: ValidationContext): any; diff --git a/types/graphql/validation/rules/UniqueArgumentNames.d.ts b/types/graphql/validation/rules/UniqueArgumentNames.d.ts new file mode 100644 index 0000000000..8cc166d07a --- /dev/null +++ b/types/graphql/validation/rules/UniqueArgumentNames.d.ts @@ -0,0 +1,9 @@ +import { ValidationContext } from '../index'; + +/** + * Unique argument names + * + * A GraphQL field or directive is only valid if all supplied arguments are + * uniquely named. + */ +export function UniqueArgumentNames(context: ValidationContext): any; diff --git a/types/graphql/validation/rules/UniqueDirectivesPerLocation.d.ts b/types/graphql/validation/rules/UniqueDirectivesPerLocation.d.ts new file mode 100644 index 0000000000..70ea02cd9c --- /dev/null +++ b/types/graphql/validation/rules/UniqueDirectivesPerLocation.d.ts @@ -0,0 +1,9 @@ +import { ValidationContext } from '../index'; + +/** + * Unique directive names per location + * + * A GraphQL document is only valid if all directives at a given location + * are uniquely named. + */ +export function UniqueDirectivesPerLocation(context: ValidationContext): any; diff --git a/types/graphql/validation/rules/UniqueFragmentNames.d.ts b/types/graphql/validation/rules/UniqueFragmentNames.d.ts new file mode 100644 index 0000000000..c505968f6a --- /dev/null +++ b/types/graphql/validation/rules/UniqueFragmentNames.d.ts @@ -0,0 +1,8 @@ +import { ValidationContext } from '../index'; + +/** + * Unique fragment names + * + * A GraphQL document is only valid if all defined fragments have unique names. + */ +export function UniqueFragmentNames(context: ValidationContext): any; diff --git a/types/graphql/validation/rules/UniqueInputFieldNames.d.ts b/types/graphql/validation/rules/UniqueInputFieldNames.d.ts new file mode 100644 index 0000000000..cebd71b79b --- /dev/null +++ b/types/graphql/validation/rules/UniqueInputFieldNames.d.ts @@ -0,0 +1,9 @@ +import { ValidationContext } from '../index'; + +/** + * Unique input field names + * + * A GraphQL input object value is only valid if all supplied fields are + * uniquely named. + */ +export function UniqueInputFieldNames(context: ValidationContext): any; diff --git a/types/graphql/validation/rules/UniqueOperationNames.d.ts b/types/graphql/validation/rules/UniqueOperationNames.d.ts new file mode 100644 index 0000000000..5b12cc0eed --- /dev/null +++ b/types/graphql/validation/rules/UniqueOperationNames.d.ts @@ -0,0 +1,8 @@ +import { ValidationContext } from '../index'; + +/** + * Unique operation names + * + * A GraphQL document is only valid if all defined operations have unique names. + */ +export function UniqueOperationNames(context: ValidationContext): any; diff --git a/types/graphql/validation/rules/UniqueVariableNames.d.ts b/types/graphql/validation/rules/UniqueVariableNames.d.ts new file mode 100644 index 0000000000..ef8712fbc1 --- /dev/null +++ b/types/graphql/validation/rules/UniqueVariableNames.d.ts @@ -0,0 +1,8 @@ +import { ValidationContext } from '../index'; + +/** + * Unique variable names + * + * A GraphQL operation is only valid if all its variables are uniquely named. + */ +export function UniqueVariableNames(context: ValidationContext): any; diff --git a/types/graphql/validation/rules/VariablesAreInputTypes.d.ts b/types/graphql/validation/rules/VariablesAreInputTypes.d.ts new file mode 100644 index 0000000000..df079e52f9 --- /dev/null +++ b/types/graphql/validation/rules/VariablesAreInputTypes.d.ts @@ -0,0 +1,9 @@ +import { ValidationContext } from '../index'; + +/** + * Variables are input types + * + * A GraphQL operation is only valid if all the variables it defines are of + * input types (scalar, enum, or input object). + */ +export function VariablesAreInputTypes(context: ValidationContext): any; diff --git a/types/graphql/validation/rules/VariablesInAllowedPosition.d.ts b/types/graphql/validation/rules/VariablesInAllowedPosition.d.ts new file mode 100644 index 0000000000..6d3e513876 --- /dev/null +++ b/types/graphql/validation/rules/VariablesInAllowedPosition.d.ts @@ -0,0 +1,6 @@ +import { ValidationContext } from '../index'; + +/** + * Variables passed to field arguments conform to type + */ +export function VariablesInAllowedPosition(context: ValidationContext): any; From 18dff7db038d2cc7150aa330f1b9de07177647b2 Mon Sep 17 00:00:00 2001 From: Andrew Lessels Date: Wed, 23 Aug 2017 08:47:48 +1000 Subject: [PATCH 015/156] Added type literal for clip shape Added optional done params --- types/nightmare/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/nightmare/index.d.ts b/types/nightmare/index.d.ts index 5e4160fd41..be51b05374 100644 --- a/types/nightmare/index.d.ts +++ b/types/nightmare/index.d.ts @@ -95,8 +95,8 @@ declare class Nightmare { removeListener(event: 'prompt', cb: (msg: string, defaultValue?: string) => void): Nightmare; removeListener(event: 'error', cb: (msg: string, trace?: Nightmare.IStackTrace[]) => void): Nightmare; removeListener(event: 'timeout', cb: (msg: string) => void): Nightmare; - screenshot(path: string): Nightmare; - screenshot(path: string, clip: Object): Nightmare; + screenshot(path: string, done?: (err: any) => void): Nightmare; + screenshot(path: string, clip?: { x: number, y: number, width: number, height: number }, done?: (err: any) => void): Nightmare; html(path: string, saveType: string): Nightmare; html(path: string, saveType: 'HTMLOnly'): Nightmare; html(path: string, saveType: 'HTMLComplete'): Nightmare; From a4421c2566674b7856fd2899ee3d5034f7784cd1 Mon Sep 17 00:00:00 2001 From: Andrew Lessels Date: Wed, 23 Aug 2017 09:39:17 +1000 Subject: [PATCH 016/156] Added more overloads for screenshot to handle buffer --- types/nightmare/index.d.ts | 6 ++++-- types/nightmare/nightmare-tests.ts | 15 ++++++++++++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/types/nightmare/index.d.ts b/types/nightmare/index.d.ts index be51b05374..d487df20f1 100644 --- a/types/nightmare/index.d.ts +++ b/types/nightmare/index.d.ts @@ -1,3 +1,5 @@ +/// + // Type definitions for Nightmare 1.6.6 // Project: https://github.com/segmentio/nightmare // Definitions by: horiuchi @@ -5,8 +7,6 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 - - declare class Nightmare { constructor(options?: Nightmare.IConstructorOptions); @@ -95,7 +95,9 @@ declare class Nightmare { removeListener(event: 'prompt', cb: (msg: string, defaultValue?: string) => void): Nightmare; removeListener(event: 'error', cb: (msg: string, trace?: Nightmare.IStackTrace[]) => void): Nightmare; removeListener(event: 'timeout', cb: (msg: string) => void): Nightmare; + screenshot(done?: (err: any, buffer: Buffer) => void): Nightmare; screenshot(path: string, done?: (err: any) => void): Nightmare; + screenshot(clip: { x: number, y: number, width: number, height: number }, done?: (err: any, buffer: Buffer) => void): Nightmare; screenshot(path: string, clip?: { x: number, y: number, width: number, height: number }, done?: (err: any) => void): Nightmare; html(path: string, saveType: string): Nightmare; html(path: string, saveType: 'HTMLOnly'): Nightmare; diff --git a/types/nightmare/nightmare-tests.ts b/types/nightmare/nightmare-tests.ts index 37ac342d5f..443f239a4d 100644 --- a/types/nightmare/nightmare-tests.ts +++ b/types/nightmare/nightmare-tests.ts @@ -3,7 +3,6 @@ import Nightmare = require("nightmare"); - new Nightmare() .goto('http://yahoo.com') .type('input[title="Search"]', 'github nightmare') @@ -168,10 +167,24 @@ new Nightmare() .run(done); new Nightmare() + .goto('http://yahoo.com') + .screenshot((err, buffer) => { + console.log(Buffer.isBuffer(buffer)); + }) + .run(done); + + new Nightmare() .goto('http://yahoo.com') .screenshot('test/test.png', { x: 10, y: 5, width: 10, height: 10}) .run(done); + new Nightmare() + .goto('http://yahoo.com') + .screenshot({ x: 10, y: 5, width: 10, height: 10}, (err, buffer) => { + console.log(Buffer.isBuffer(buffer)); + }) + .run(done); + new Nightmare() .goto('http://yahoo.com') .pdf('test/test.pdf') From 99aa44bb736e9439fa9d0dfd9ca343f6210db371 Mon Sep 17 00:00:00 2001 From: Andrew Lessels Date: Wed, 23 Aug 2017 09:44:49 +1000 Subject: [PATCH 017/156] Added node reference to test page --- types/nightmare/nightmare-tests.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/nightmare/nightmare-tests.ts b/types/nightmare/nightmare-tests.ts index 443f239a4d..9275e04ff2 100644 --- a/types/nightmare/nightmare-tests.ts +++ b/types/nightmare/nightmare-tests.ts @@ -1,5 +1,7 @@ /// +/// + import Nightmare = require("nightmare"); From 4518ee787ea7d3adaaa11292e396861c5641875b Mon Sep 17 00:00:00 2001 From: Andrew Lessels Date: Wed, 23 Aug 2017 09:51:10 +1000 Subject: [PATCH 018/156] Reorder reference / definition --- types/nightmare/index.d.ts | 4 ++-- types/nightmare/nightmare-tests.ts | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/types/nightmare/index.d.ts b/types/nightmare/index.d.ts index d487df20f1..0b717b4555 100644 --- a/types/nightmare/index.d.ts +++ b/types/nightmare/index.d.ts @@ -1,5 +1,3 @@ -/// - // Type definitions for Nightmare 1.6.6 // Project: https://github.com/segmentio/nightmare // Definitions by: horiuchi @@ -7,6 +5,8 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 +/// + declare class Nightmare { constructor(options?: Nightmare.IConstructorOptions); diff --git a/types/nightmare/nightmare-tests.ts b/types/nightmare/nightmare-tests.ts index 9275e04ff2..ded854ce06 100644 --- a/types/nightmare/nightmare-tests.ts +++ b/types/nightmare/nightmare-tests.ts @@ -1,8 +1,6 @@ - /// /// - import Nightmare = require("nightmare"); new Nightmare() From cfd677d7dcfcdad03265bd019817de65eaa2499a Mon Sep 17 00:00:00 2001 From: Andrew Lessels Date: Wed, 23 Aug 2017 09:54:13 +1000 Subject: [PATCH 019/156] Remove redundant node reference --- types/nightmare/nightmare-tests.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/types/nightmare/nightmare-tests.ts b/types/nightmare/nightmare-tests.ts index ded854ce06..dec08730f7 100644 --- a/types/nightmare/nightmare-tests.ts +++ b/types/nightmare/nightmare-tests.ts @@ -1,5 +1,4 @@ /// -/// import Nightmare = require("nightmare"); From 23047318b39967460da6c119f74badf4be3b8e9a Mon Sep 17 00:00:00 2001 From: Andrew Lessels Date: Wed, 23 Aug 2017 15:45:46 +1000 Subject: [PATCH 020/156] Added x and y constructor arguments for browser position --- types/nightmare/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/nightmare/index.d.ts b/types/nightmare/index.d.ts index 0b717b4555..77c433ae80 100644 --- a/types/nightmare/index.d.ts +++ b/types/nightmare/index.d.ts @@ -138,6 +138,8 @@ declare namespace Nightmare { phantomPath?: string; show?: boolean; typeInterval?: number; + x?: number; + y?: number; } export interface IRequest { From 16caa8fc42719ecda67d71002c4f3022a285d7ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jozef=20B=C3=ADro=C5=A1?= Date: Wed, 23 Aug 2017 07:55:33 +0200 Subject: [PATCH 021/156] Added SubmissionError into export for immutabable Added SubmissionError into export in redux-from/immutable/index.d.ts in order to be able to use SubmissionError with immutable store state. In redux-form/lib/SubmissionError.d.ts changed default generic from void to any, in order to be able to use it as is state redux-form docs. http://redux-form.com/7.0.3/examples/submitValidation/ Because there is no way to pass anoter type into generic constructor from real project. --- types/redux-form/immutable/index.d.ts | 1 + types/redux-form/lib/SubmissionError.d.ts | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/types/redux-form/immutable/index.d.ts b/types/redux-form/immutable/index.d.ts index 3eacb2338c..fe5cc6904d 100644 --- a/types/redux-form/immutable/index.d.ts +++ b/types/redux-form/immutable/index.d.ts @@ -20,4 +20,5 @@ export { isPristine, isSubmitting, isValid, + SubmissionError } from "redux-form"; diff --git a/types/redux-form/lib/SubmissionError.d.ts b/types/redux-form/lib/SubmissionError.d.ts index ffe7a0064a..790cb8e697 100644 --- a/types/redux-form/lib/SubmissionError.d.ts +++ b/types/redux-form/lib/SubmissionError.d.ts @@ -1,7 +1,7 @@ import { FormErrors } from "redux-form"; -export interface SubmissionErrorConstructor { +export interface SubmissionErrorConstructor { new (errors?: FormErrors): Error; } -declare const SubmissionError: SubmissionErrorConstructor; +declare const SubmissionError: SubmissionErrorConstructor; From 6800cd1a0aa752cf6f2e05cb7d5317fd5d3856c1 Mon Sep 17 00:00:00 2001 From: Joscha Feth Date: Thu, 24 Aug 2017 17:54:13 +1000 Subject: [PATCH 022/156] add: xhr-mock --- types/xhr-mock/index.d.ts | 57 ++++++++++++++++++++++++++++++++ types/xhr-mock/tsconfig.json | 23 +++++++++++++ types/xhr-mock/tslint.json | 1 + types/xhr-mock/xhr-mock-tests.ts | 25 ++++++++++++++ 4 files changed, 106 insertions(+) create mode 100644 types/xhr-mock/index.d.ts create mode 100644 types/xhr-mock/tsconfig.json create mode 100644 types/xhr-mock/tslint.json create mode 100644 types/xhr-mock/xhr-mock-tests.ts diff --git a/types/xhr-mock/index.d.ts b/types/xhr-mock/index.d.ts new file mode 100644 index 0000000000..eacec1c5fc --- /dev/null +++ b/types/xhr-mock/index.d.ts @@ -0,0 +1,57 @@ +// Type definitions for xhr-mock 1.9 +// Project: https://github.com/jameslnewell/xhr-mock#readme +// Definitions by: Joscha Feth +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare namespace mock { + interface Headers { + [k: string]: string; + } + + interface MockResponse { + status(code: number): this; + status(): number; + statusText(statusText: string): this; + statusText(): string; + header(name: string, value: string): this; + header(name: string): string | null; + headers(obj: Headers): this; + headers(): Headers; + body(body: string): this; + body(): string; + timeout(timeout: boolean | number): this; + timeout(): boolean | number; + } + + interface MockRequest { + method(): string; + url(): string; + query(): string; + header(name: string, value: string): this; + header(name: string): string | null; + headers(obj: Headers): this; + headers(): Headers; + body(body: string): this; + body(): string; + progress(loaded: number, total: number, lengthComputable?: boolean): void; + } + + type MockFunction = (req: MockRequest, res: MockResponse) => MockResponse | null; + + interface XhrMock { + XMLHttpRequest: XMLHttpRequest; + setup(): this; + teardown(): this; + reset(): this; + mock(method: string, url: string, fn: mock.MockFunction): this; + get(url: string, fn: mock.MockFunction): this; + post(url: string, fn: mock.MockFunction): this; + put(url: string, fn: mock.MockFunction): this; + patch(url: string, fn: mock.MockFunction): this; + delete(url: string, fn: mock.MockFunction): this; + } +} + +declare var mock: mock.XhrMock; +export = mock; +export as namespace mock; diff --git a/types/xhr-mock/tsconfig.json b/types/xhr-mock/tsconfig.json new file mode 100644 index 0000000000..6a5c03268f --- /dev/null +++ b/types/xhr-mock/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "xhr-mock-tests.ts" + ] +} diff --git a/types/xhr-mock/tslint.json b/types/xhr-mock/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/xhr-mock/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/xhr-mock/xhr-mock-tests.ts b/types/xhr-mock/xhr-mock-tests.ts new file mode 100644 index 0000000000..fd26b3a43f --- /dev/null +++ b/types/xhr-mock/xhr-mock-tests.ts @@ -0,0 +1,25 @@ +// replace the real XHR object with the mock XHR object +mock.setup(); + +// create a mock response for all POST requests with the URL http://localhost/api/user +mock.post('http://localhost/api/user', (req: mock.MockRequest, res: mock.MockResponse) => { + // return null; //simulate an error + // return res.timeout(true); //simulate a timeout + + return res + .status(201) + .header('Content-Type', 'application/json') + .body(JSON.stringify({data: { + first_name: 'John', last_name: 'Smith' + }})); +}); + +// create an instance of the (mock) XHR object and use as per normal +const xhr = new XMLHttpRequest(); + +xhr.onreadystatechange = () => { + if (xhr.readyState === 4) { + // when you're finished put the real XHR object back + mock.teardown(); + } +}; From 149dde5da4afd0172f82a1bdd66b23581e4a56c2 Mon Sep 17 00:00:00 2001 From: Chris Krycho Date: Thu, 24 Aug 2017 09:02:31 -0400 Subject: [PATCH 023/156] Revert "Remove `--allowSyntheticDefaultImports`" (from ember-testing-helpers) This reverts commit 2ff76c2755156481894f7db78a7fa539b2aa3112. --- types/ember-testing-helpers/tsconfig.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/ember-testing-helpers/tsconfig.json b/types/ember-testing-helpers/tsconfig.json index aaf474ecba..cd7634bd25 100644 --- a/types/ember-testing-helpers/tsconfig.json +++ b/types/ember-testing-helpers/tsconfig.json @@ -14,7 +14,8 @@ ], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": true + "forceConsistentCasingInFileNames": true, + "allowSyntheticDefaultImports": true }, "files": [ "index.d.ts", From 4ad5e86ffe81753f4fd3b53171ab33d9f313947e Mon Sep 17 00:00:00 2001 From: Chris Krycho Date: Thu, 24 Aug 2017 09:02:49 -0400 Subject: [PATCH 024/156] Revert "Remove `--allowSyntheticDefaultImports`" (from ember) This reverts commit 43a1348b9146b0c6130a37f28d019eb2924ad9a3. --- types/ember/tsconfig.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/ember/tsconfig.json b/types/ember/tsconfig.json index b73838d20e..fbc4052a08 100644 --- a/types/ember/tsconfig.json +++ b/types/ember/tsconfig.json @@ -14,7 +14,8 @@ ], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": true + "forceConsistentCasingInFileNames": true, + "allowSyntheticDefaultImports": true }, "files": [ "index.d.ts", From 22cb8115d805384f334e1bfc563ce2e0e36abcfa Mon Sep 17 00:00:00 2001 From: Andrew Lessels Date: Fri, 25 Aug 2017 08:28:51 +1000 Subject: [PATCH 025/156] Fix indentation --- types/nightmare/nightmare-tests.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/nightmare/nightmare-tests.ts b/types/nightmare/nightmare-tests.ts index dec08730f7..434964bb20 100644 --- a/types/nightmare/nightmare-tests.ts +++ b/types/nightmare/nightmare-tests.ts @@ -172,12 +172,12 @@ new Nightmare() }) .run(done); - new Nightmare() +new Nightmare() .goto('http://yahoo.com') .screenshot('test/test.png', { x: 10, y: 5, width: 10, height: 10}) .run(done); - new Nightmare() +new Nightmare() .goto('http://yahoo.com') .screenshot({ x: 10, y: 5, width: 10, height: 10}, (err, buffer) => { console.log(Buffer.isBuffer(buffer)); From 3cbb7290b1d4392625d8dc5944ae61b5c5b2ecc1 Mon Sep 17 00:00:00 2001 From: Matt Bishop Date: Fri, 25 Aug 2017 12:56:01 -0700 Subject: [PATCH 026/156] Add definitions for chai-as-promised v7.1 which supports Chai v4 --- types/chai-as-promised/index.d.ts | 138 ++++++++++++++++++++++++++++-- 1 file changed, 129 insertions(+), 9 deletions(-) diff --git a/types/chai-as-promised/index.d.ts b/types/chai-as-promised/index.d.ts index 0dde8837dd..bd67bf90cd 100644 --- a/types/chai-as-promised/index.d.ts +++ b/types/chai-as-promised/index.d.ts @@ -1,6 +1,9 @@ -// Type definitions for chai-as-promised +// Type definitions for chai-as-promised 7.1.0 // Project: https://github.com/domenic/chai-as-promised/ -// Definitions by: jt000 , Yuki Kokubun , Leonard Thieu +// Definitions by: jt000 , +// Yuki Kokubun , +// Leonard Thieu , +// Matt Bishop // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -35,12 +38,15 @@ declare namespace Chai { become(expected: PromiseLike): PromisedAssertion; fulfilled: PromisedAssertion; rejected: PromisedAssertion; - rejectedWith(expected: any, message?: string | RegExp): PromisedAssertion; + rejectedWith: PromisedThrow; notify(fn: Function): PromisedAssertion; // From chai not: PromisedAssertion; deep: PromisedDeep; + ordered: PromisedOrdered; + nested: PromisedNested; + any: PromisedKeyFilter; all: PromisedKeyFilter; a: PromisedTypeComparison; an: PromisedTypeComparison; @@ -51,6 +57,7 @@ declare namespace Chai { false: PromisedAssertion; null: PromisedAssertion; undefined: PromisedAssertion; + NaN: PromisedAssertion; exist: PromisedAssertion; empty: PromisedAssertion; arguments: PromisedAssertion; @@ -63,20 +70,36 @@ declare namespace Chai { property: PromisedProperty; ownProperty: PromisedOwnProperty; haveOwnProperty: PromisedOwnProperty; + ownPropertyDescriptor: PromisedOwnPropertyDescriptor; + haveOwnPropertyDescriptor: PromisedOwnPropertyDescriptor; length: PromisedLength; lengthOf: PromisedLength; - match(regexp: RegExp | string, message?: string): PromisedAssertion; + match: PromisedMatch; + matches: PromisedMatch; string(string: string, message?: string): PromisedAssertion; keys: PromisedKeys; key(string: string): PromisedAssertion; throw: PromisedThrow; throws: PromisedThrow; Throw: PromisedThrow; - respondTo(method: string, message?: string): PromisedAssertion; + respondTo: PromisedRespondTo; + respondsTo: PromisedRespondTo; itself: PromisedAssertion; - satisfy(matcher: Function, message?: string): PromisedAssertion; - closeTo(expected: number, delta: number, message?: string): PromisedAssertion; + satisfy: PromisedSatisfy; + satisfies: PromisedSatisfy; + closeTo: PromisedCloseTo; + approximately: PromisedCloseTo; members: PromisedMembers; + increase: PromisedPropertyChange; + increases: PromisedPropertyChange; + decrease: PromisedPropertyChange; + decreases: PromisedPropertyChange; + change: PromisedPropertyChange; + changes: PromisedPropertyChange; + extensible: PromisedAssertion; + sealed: PromisedAssertion; + frozen: PromisedAssertion; + oneOf(list: any[], message?: string): PromisedAssertion; } interface PromisedAssertion extends Eventually, PromiseLike { @@ -99,6 +122,8 @@ declare namespace Chai { at: PromisedAssertion; of: PromisedAssertion; same: PromisedAssertion; + but: PromisedAssertion; + does: PromisedAssertion; } interface PromisedNumericComparison { @@ -129,10 +154,28 @@ declare namespace Chai { (constructor: Object, message?: string): PromisedAssertion; } - interface PromisedDeep { - equal: PromisedEqual; + interface PromisedCloseTo { + (expected: number, delta: number, message?: string): PromisedAssertion; + } + + interface PromisedNested { include: PromisedInclude; property: PromisedProperty; + members: PromisedMembers; + } + + interface PromisedDeep { + equal: PromisedEqual; + equals: PromisedEqual; + eq: PromisedEqual; + include: PromisedInclude; + property: PromisedProperty; + members: PromisedMembers; + ordered: PromisedOrdered + } + + interface PromisedOrdered { + members: PromisedMembers; } interface PromisedKeyFilter { @@ -151,6 +194,11 @@ declare namespace Chai { (name: string, message?: string): PromisedAssertion; } + interface PromisedOwnPropertyDescriptor { + (name: string, descriptor: PropertyDescriptor, message?: string): PromisedAssertion; + (name: string, message?: string): PromisedAssertion; + } + interface PromisedLength extends PromisedLanguageChains, PromisedNumericComparison { (length: number, message?: string): PromisedAssertion; } @@ -160,13 +208,21 @@ declare namespace Chai { (value: string, message?: string): PromisedAssertion; (value: number, message?: string): PromisedAssertion; keys: PromisedKeys; + deep: PromisedDeep; + ordered: PromisedOrdered; members: PromisedMembers; + any: PromisedKeyFilter; all: PromisedKeyFilter; } + interface PromisedMatch { + (regexp: RegExp | string, message?: string): PromisedAssertion; + } + interface PromisedKeys { (...keys: string[]): PromisedAssertion; (keys: any[]): PromisedAssertion; + (keys: Object): PromisedAssertion; } interface PromisedThrow { @@ -179,10 +235,22 @@ declare namespace Chai { (constructor: Function, expected?: RegExp, message?: string): PromisedAssertion; } + interface PromisedRespondTo { + (method: string, message?: string): PromisedAssertion; + } + + interface PromisedSatisfy { + (matcher: Function, message?: string): PromisedAssertion; + } + interface PromisedMembers { (set: any[], message?: string): PromisedAssertion; } + interface PromisedPropertyChange { + (object: Object, property: string, message?: string): PromisedAssertion; + } + // For Assert API interface Assert { eventually: PromisedAssert; @@ -198,7 +266,9 @@ declare namespace Chai { export interface PromisedAssert { fail(actual?: any, expected?: any, msg?: string, operator?: string): PromiseLike; + isOk(val: any, msg?: string): PromiseLike; ok(val: any, msg?: string): PromiseLike; + isNotOk(val: any, msg?: string): PromiseLike; notOk(val: any, msg?: string): PromiseLike; equal(act: any, exp: any, msg?: string): PromiseLike; @@ -210,12 +280,26 @@ declare namespace Chai { deepEqual(act: any, exp: any, msg?: string): PromiseLike; notDeepEqual(act: any, exp: any, msg?: string): PromiseLike; + isAbove(val: number, above: number, msg?: string): PromiseLike; + isAtLeast(val: number, atLeast: number, msg?: string): PromiseLike; + isAtBelow(val: number, below: number, msg?: string): PromiseLike; + isAtMost(val: number, atMost: number, msg?: string): PromiseLike; + isTrue(val: any, msg?: string): PromiseLike; isFalse(val: any, msg?: string): PromiseLike; + isNotTrue(val: any, msg?: string): PromiseLike; + isNotFalse(val: any, msg?: string): PromiseLike; + isNull(val: any, msg?: string): PromiseLike; isNotNull(val: any, msg?: string): PromiseLike; + isNaN(val: any, msg?: string): PromiseLike; + isNotNaN(val: any, msg?: string): PromiseLike; + + exists(val: any, msg?: string): PromiseLike; + notExists(val: any, msg?: string): PromiseLike; + isUndefined(val: any, msg?: string): PromiseLike; isDefined(val: any, msg?: string): PromiseLike; @@ -287,10 +371,46 @@ declare namespace Chai { operator(val: any, operator: string, val2: any, msg?: string): PromiseLike; closeTo(act: number, exp: number, delta: number, msg?: string): PromiseLike; + approximately(act: number, exp: number, delta: number, msg?: string): PromiseLike; sameMembers(set1: any[], set2: any[], msg?: string): PromiseLike; + sameDeepMembers(set1: any[], set2: any[], msg?: string): PromiseLike; + sameOrderedMembers(set1: any[], set2: any[], msg?: string): PromiseLike; + notSameOrderedMembers(set1: any[], set2: any[], msg?: string): PromiseLike; + sameDeepOrderedMembers(set1: any[], set2: any[], msg?: string): PromiseLike; + notSameDeepOrderedMembers(set1: any[], set2: any[], msg?: string): PromiseLike; + includeOrderedMembers(set1: any[], set2: any[], msg?: string): PromiseLike; + notIncludeOrderedMembers(set1: any[], set2: any[], msg?: string): PromiseLike; + includeDeepOrderedMembers(set1: any[], set2: any[], msg?: string): PromiseLike; + notIncludeDeepOrderedMembers(set1: any[], set2: any[], msg?: string): PromiseLike; includeMembers(set1: any[], set2: any[], msg?: string): PromiseLike; + includeDeepMembers(set1: any[], set2: any[], msg?: string): PromiseLike; + + oneOf(val: any, list: any[], msg?: string): PromiseLike; + + changes(modifier: Function, obj: Object, property: string, msg?: string): PromiseLike; + doesNotChange(modifier: Function, obj: Object, property: string, msg?: string): PromiseLike; + increases(modifier: Function, obj: Object, property: string, msg?: string): PromiseLike; + doesNotIncrease(modifier: Function, obj: Object, property: string, msg?: string): PromiseLike; + decreases(modifier: Function, obj: Object, property: string, msg?: string): PromiseLike; + doesNotDecrease(modifier: Function, obj: Object, property: string, msg?: string): PromiseLike; ifError(val: any, msg?: string): PromiseLike; + + isExtensible(obj: Object, msg?: string): PromiseLike; + isNotExtensible(obj: Object, msg?: string): PromiseLike; + + isSealed(obj: Object, msg?: string): PromiseLike; + sealed(obj: Object, msg?: string): PromiseLike; + isNotSealed(obj: Object, msg?: string): PromiseLike; + notSealed(obj: Object, msg?: string): PromiseLike; + + isFrozen(obj: Object, msg?: string): PromiseLike; + frozen(obj: Object, msg?: string): PromiseLike; + isNotFrozen(obj: Object, msg?: string): PromiseLike; + notFrozen(obj: Object, msg?: string): PromiseLike; + + isEmpty(val: any, msg?: string): PromiseLike; + isNotEmpty(val: any, msg?: string): PromiseLike; } } From 3904dd3c99abcde7bc9f8324586926781fad2fdc Mon Sep 17 00:00:00 2001 From: Conrad Wahlen Date: Sat, 26 Aug 2017 01:58:11 +0200 Subject: [PATCH 027/156] Update Material class closer to three.js docs --- types/three/three-core.d.ts | 275 +++++++++++++++++++++++++----------- 1 file changed, 191 insertions(+), 84 deletions(-) diff --git a/types/three/three-core.d.ts b/types/three/three-core.d.ts index 71dc6f4386..70529c99ca 100644 --- a/types/three/three-core.d.ts +++ b/types/three/three-core.d.ts @@ -2317,36 +2317,39 @@ export namespace Cache { export let MaterialIdCount: number; export interface MaterialParameters { - name?: string; - side?: Side; - opacity?: number; - transparent?: boolean; + alphaTest?: number; + blendDst?: BlendingDstFactor; + blendDstAlpha?: number; + blendEquation?: BlendingEquation; + blendEquationAlpha?: number; blending?: Blending; blendSrc?: BlendingSrcFactor | BlendingDstFactor; - blendDst?: BlendingDstFactor; - blendEquation?: BlendingEquation; blendSrcAlpha?: number; - blendDstAlpha?: number; - blendEquationAlpha?: number; + clipIntersection?: boolean; + clippingPlanes?: Plane[]; + clipShadows?: boolean; + colorWrite?: boolean; depthFunc?: DepthModes; depthTest?: boolean; depthWrite?: boolean; - colorWrite?: boolean; - precision?: number; + fog?: boolean; + lights?: boolean; + name?: string; + opacity?: number; + overdraw?: number; polygonOffset?: boolean; polygonOffsetFactor?: number; polygonOffsetUnits?: number; - alphaTest?: number; + precision?: 'highp' | 'mediump' | 'lowp' | null; premultipliedAlpha?: boolean; - overdraw?: number; - visible?: boolean; - fog?: boolean; - lights?: boolean; - shading?: Shading; + dithering?: boolean; + flatShading?: boolean; + side?: Side; + transparent?: boolean; vertexColors?: Colors; - clippingPlanes?: Plane[]; - clipIntersection?: boolean; - clipShadows?: boolean; + visible?: boolean; + + shading?: Shading; } /** @@ -2356,62 +2359,70 @@ export class Material extends EventDispatcher { constructor(); /** - * Unique number of this material instance. + * Sets the alpha value to be used when running an alpha test. Default is 0. */ - id: number; - - uuid: string; - - /** - * Material name. Default is an empty string. - */ - name: string; - - type: string; - - /** - * Defines which of the face sides will be rendered - front, back or both. - * Default is THREE.FrontSide. Other options are THREE.BackSide and THREE.DoubleSide. - */ - side: Side; - - /** - * Opacity. Default is 1. - */ - opacity: number; - - /** - * Defines whether this material is transparent. This has an effect on rendering, as transparent objects need an special treatment, and are rendered after the opaque (i.e. non transparent) objects. For a working example of this behaviour, check the {@link WebGLRenderer} code. - * Default is false. - */ - transparent: boolean; - - /** - * Which blending to use when displaying objects with this material. Default is {@link NormalBlending}. - */ - blending: Blending; - - /** - * Blending source. It's one of the blending mode constants defined in Three.js. Default is {@link SrcAlphaFactor}. - */ - blendSrc: BlendingSrcFactor | BlendingDstFactor; + alphaTest: number; /** * Blending destination. It's one of the blending mode constants defined in Three.js. Default is {@link OneMinusSrcAlphaFactor}. */ blendDst: BlendingDstFactor; - + /** - * Blending equation to use when applying blending. It's one of the constants defined in Three.js. Default is AddEquation. + * The tranparency of the .blendDst. Default is null. + */ + blendDstAlpha: number; + + /** + * Blending equation to use when applying blending. It's one of the constants defined in Three.js. Default is {@link AddEquation}. */ blendEquation: BlendingEquation; - blendSrcAlpha: number; - blendDstAlpha: number; + /** + * The tranparency of the .blendEquation. Default is null. + */ blendEquationAlpha: number; + + /** + * Which blending to use when displaying objects with this material. Default is {@link NormalBlending}. + */ + blending: Blending; + + /** + * Blending source. It's one of the blending mode constants defined in Three.js. Default is {@link SrcAlphaFactor}. + */ + blendSrc: BlendingSrcFactor | BlendingDstFactor; + + /** + * The tranparency of the .blendSrc. Default is null. + */ + blendSrcAlpha: number; + /** + * Changes the behavior of clipping planes so that only their intersection is clipped, rather than their union. Default is false. + */ + clipIntersection: boolean; + + /** + * User-defined clipping planes specified as THREE.Plane objects in world space. These planes apply to the objects this material is attached to. Points in space whose signed distance to the plane is negative are clipped (not rendered). See the WebGL / clipping /intersection example. Default is null. + */ + clippingPlanes: any; + + /** + * Defines whether to clip shadows according to the clipping planes specified on this material. Default is false. + */ + clipShadows: boolean; + + /** + * Whether to render the material's color. This can be used in conjunction with a mesh's .renderOrder property to create invisible objects that occlude other objects. Default is true. + */ + colorWrite: boolean; + + /** + * Which depth function to use. Default is {@link LessEqualDepth}. See the depth mode constants for all possible values. + */ depthFunc: DepthModes; - + /** * Whether to have depth test enabled when rendering this material. Default is true. */ @@ -2423,18 +2434,53 @@ export class Material extends EventDispatcher { */ depthWrite: boolean; - clippingPlanes: any; - clipShadows: boolean; + /** + * Whether the material is affected by fog. Default is true. + */ + fog: boolean; - colorWrite: boolean; + /** + * Unique number of this material instance. + */ + id: number; - precision: any; + /** + * Used to check whether this or derived classes are materials. Default is true. + * You should not change this, as it used internally for optimisation. + */ + isMaterial: boolean; + + /** + * Whether the material is affected by lights. Default is true. + */ + lights: boolean; + + /** + * Material name. Default is an empty string. + */ + name: string; + + /** + * Specifies that the material needs to be updated, WebGL wise. Set it to true if you made changes that need to be reflected in WebGL. + * This property is automatically set to true when instancing a new material. + */ + needsUpdate: boolean; + + /** + * Opacity. Default is 1. + */ + opacity: number; + + /** + * Enables/disables overdraw. If greater than zero, polygons are drawn slightly bigger in order to fix antialiasing gaps when using the CanvasRenderer. Default is 0. + */ + overdraw: number; /** * Whether to use polygon offset. Default is false. This corresponds to the POLYGON_OFFSET_FILL WebGL feature. */ polygonOffset: boolean; - + /** * Sets the polygon offset factor. Default is 0. */ @@ -2446,16 +2492,52 @@ export class Material extends EventDispatcher { polygonOffsetUnits: number; /** - * Sets the alpha value to be used when running an alpha test. Default is 0. + * Override the renderer's default precision for this material. Can be "highp", "mediump" or "lowp". Defaults is null. */ - alphaTest: number; + precision: 'highp' | 'mediump' | 'lowp' | null; + /** + * Whether to premultiply the alpha (transparency) value. See WebGL / Materials / Transparency for an example of the difference. Default is false. + */ premultipliedAlpha: boolean; /** - * Enables/disables overdraw. If greater than zero, polygons are drawn slightly bigger in order to fix antialiasing gaps when using the CanvasRenderer. Default is 0. + * Whether to apply dithering to the color to remove the appearance of banding. Default is false. */ - overdraw: number; + dithering: boolean; + + /** + * Define whether the material is rendered with flat shading. Default is false. + */ + flatShading: boolean; + + /** + * Defines which of the face sides will be rendered - front, back or both. + * Default is THREE.FrontSide. Other options are THREE.BackSide and THREE.DoubleSide. + */ + side: Side; + + /** + * Defines whether this material is transparent. This has an effect on rendering as transparent objects need special treatment and are rendered after non-transparent objects. + * When set to true, the extent to which the material is transparent is controlled by setting it's .opacity property. + * Default is false. + */ + transparent: boolean; + + /** + * Value is the string 'Material'. This shouldn't be changed, and can be used to find all objects of this type in a scene. + */ + type: string; + + /** + * UUID of this material instance. This gets automatically assigned, so this shouldn't be edited. + */ + uuid: string; + + /** + * Defines whether vertex coloring is used. Default is THREE.NoColors. Other options are THREE.VertexColors and THREE.FaceColors. + */ + vertexColors: Colors; /** * Defines whether this material is visible. Default is true. @@ -2463,27 +2545,52 @@ export class Material extends EventDispatcher { visible: boolean; /** - * Specifies that the material needs to be updated, WebGL wise. Set it to true if you made changes that need to be reflected in WebGL. - * This property is automatically set to true when instancing a new material. + * An object that can be used to store custom data about the Material. It should not hold references to functions as these will not be cloned. + */ + userData: any; + + /** + * Return a new material with the same parameters as this material. */ - needsUpdate: boolean; - - fog: boolean; - lights: boolean; - shading: Shading; - vertexColors: Colors; - - setValues(parameters: MaterialParameters): void; - toJSON(meta?: any): any; clone(): this; - copy(source: this): this; - update(): void; + + /** + * Copy the parameters from the passed material into this material. + * @param material + */ + copy(material: this): this; + + /** + * This disposes the material. Textures of a material don't get disposed. These needs to be disposed by {@link Texture}. + */ dispose(): void; + /** + * Sets the properties based on the values. + * @param values A container with parameters. + */ + setValues(values: MaterialParameters): void; + + /** + * Convert the material to three.js JSON format. + * @param meta Object containing metadata such as textures or images for the material. + */ + toJSON(meta?: any): any; + + /** + * Call .dispatchEvent ( { type: 'update' }) on the material. + */ + update(): void; + /** * @deprecated */ warpRGB: Color; + + /** + * @deprecated Removed, use .flatShading instead. + */ + shading: Shading; } export interface LineBasicMaterialParameters extends MaterialParameters { From fbc01f889d2cf65cf724b3e4d8e6d6635eaa6b20 Mon Sep 17 00:00:00 2001 From: loopArray <525029662@qq.com> Date: Sun, 27 Aug 2017 00:13:06 +0800 Subject: [PATCH 028/156] fixed some ts error My environment is typescript 2.4.2, which reminds me of the wrong type. `[ts] JSX element type 'Icon' does not have any construct or call signatures.` When you add `typeof` changes like this, there is no error --- types/react-native-vector-icons/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/react-native-vector-icons/index.d.ts b/types/react-native-vector-icons/index.d.ts index 3e9af9e042..b9dfc622c3 100644 --- a/types/react-native-vector-icons/index.d.ts +++ b/types/react-native-vector-icons/index.d.ts @@ -24,7 +24,7 @@ export function createIconSet( glyphMap: {}, fontFamily: string, fontFile?: string -): Icon; +): typeof Icon; /** * Convenience method to create a custom font based on a fontello config file. @@ -41,7 +41,7 @@ export function createIconSet( * @param {{}} config * @returns {Icon} */ -export function createIconSetFromFontello(config: {}): Icon; +export function createIconSetFromFontello(config: {}): typeof Icon; /** * Convenience method to create a custom font from IcoMoon @@ -59,4 +59,4 @@ export function createIconSetFromFontello(config: {}): Icon; * @param {{}} config * @returns {Icon} */ -export function createIconSetFromIcoMoon(config: {}): Icon; +export function createIconSetFromIcoMoon(config: {}): typeof Icon; From 0d4f8a72c5fbe648821b195c2b96438434c6aca5 Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Sun, 27 Aug 2017 10:51:24 +0200 Subject: [PATCH 029/156] feat(fs-extra): callbacks can return `null` as value when there is no error --- types/fs-extra/fs-extra-tests.ts | 2 +- types/fs-extra/index.d.ts | 146 ++++++++++++++++--------------- 2 files changed, 75 insertions(+), 73 deletions(-) diff --git a/types/fs-extra/fs-extra-tests.ts b/types/fs-extra/fs-extra-tests.ts index 22232bc297..a807428548 100644 --- a/types/fs-extra/fs-extra-tests.ts +++ b/types/fs-extra/fs-extra-tests.ts @@ -14,7 +14,7 @@ const fd = 0; const modeNum = 0; const modeStr = ""; const object = {}; -const errorCallback = (err: Error) => { }; +const errorCallback = (err: Error | null) => { }; const readOptions: fs.ReadOptions = { reviver: {} }; diff --git a/types/fs-extra/index.d.ts b/types/fs-extra/index.d.ts index 0231cac2d2..90e26418ba 100644 --- a/types/fs-extra/index.d.ts +++ b/types/fs-extra/index.d.ts @@ -14,140 +14,141 @@ import { Stats } from "fs"; export * from "fs"; export function copy(src: string, dest: string, options?: CopyOptions): Promise; -export function copy(src: string, dest: string, callback: (err: Error) => void): void; -export function copy(src: string, dest: string, options: CopyOptions, callback: (err: Error) => void): void; +export function copy(src: string, dest: string, callback: (err: Error | null) => void): void; +export function copy(src: string, dest: string, options: CopyOptions, callback: (err: Error | null) => void): void; export function copySync(src: string, dest: string, options?: CopyOptions): void; export function move(src: string, dest: string, options?: MoveOptions): Promise; -export function move(src: string, dest: string, callback: (err: Error) => void): void; -export function move(src: string, dest: string, options: MoveOptions, callback: (err: Error) => void): void; +export function move(src: string, dest: string, callback: (err: Error | null) => void): void; +export function move(src: string, dest: string, options: MoveOptions, callback: (err: Error | null) => void): void; export function moveSync(src: string, dest: string, options?: MoveOptions): void; export function createFile(file: string): Promise; -export function createFile(file: string, callback: (err: Error) => void): void; +export function createFile(file: string, callback: (err: Error | null) => void): void; export function createFileSync(file: string): void; export function ensureDir(path: string): Promise; -export function ensureDir(path: string, callback: (err: Error) => void): void; +export function ensureDir(path: string, callback: (err: Error | null) => void): void; export function ensureDirSync(path: string): void; export function mkdirs(dir: string): Promise; -export function mkdirs(dir: string, callback: (err: Error) => void): void; +export function mkdirs(dir: string, callback: (err: Error | null) => void): void; export function mkdirp(dir: string): Promise; -export function mkdirp(dir: string, callback: (err: Error) => void): void; +export function mkdirp(dir: string, callback: (err: Error | null) => void): void; export function mkdirsSync(dir: string): void; export function mkdirpSync(dir: string): void; export function outputFile(file: string, data: any): Promise; -export function outputFile(file: string, data: any, callback: (err: Error) => void): void; +export function outputFile(file: string, data: any, callback: (err: Error | null) => void): void; export function outputFileSync(file: string, data: any): void; export function readJson(file: string, options?: ReadOptions): Promise; -export function readJson(file: string, callback: (err: Error, jsonObject: any) => void): void; -export function readJson(file: string, options: ReadOptions, callback: (err: Error, jsonObject: any) => void): void; +export function readJson(file: string, callback: (err: Error | null, jsonObject: any) => void): void; +export function readJson(file: string, options: ReadOptions, callback: (err: Error | null, jsonObject: any) => void): void; export function readJSON(file: string, options?: ReadOptions): Promise; -export function readJSON(file: string, callback: (err: Error, jsonObject: any) => void): void; -export function readJSON(file: string, options: ReadOptions, callback: (err: Error, jsonObject: any) => void): void; +export function readJSON(file: string, callback: (err: Error | null, jsonObject: any) => void): void; +export function readJSON(file: string, options: ReadOptions, callback: (err: Error | null, jsonObject: any) => void): void; export function readJsonSync(file: string, options?: ReadOptions): any; export function readJSONSync(file: string, options?: ReadOptions): any; export function remove(dir: string): Promise; -export function remove(dir: string, callback: (err: Error) => void): void; +export function remove(dir: string, callback: (err: Error | null) => void): void; export function removeSync(dir: string): void; export function outputJSON(file: string, data: any, options?: WriteOptions): Promise; -export function outputJSON(file: string, data: any, options: WriteOptions, callback: (err: Error) => void): void; -export function outputJSON(file: string, data: any, callback: (err: Error) => void): void; +export function outputJSON(file: string, data: any, options: WriteOptions, callback: (err: Error | null) => void): void; +export function outputJSON(file: string, data: any, callback: (err: Error | null) => void): void; export function outputJson(file: string, data: any, options?: WriteOptions): Promise; -export function outputJson(file: string, data: any, options: WriteOptions, callback: (err: Error) => void): void; -export function outputJson(file: string, data: any, callback: (err: Error) => void): void; +export function outputJson(file: string, data: any, options: WriteOptions, callback: (err: Error | null) => void): void; +export function outputJson(file: string, data: any, callback: (err: Error | null) => void): void; export function outputJsonSync(file: string, data: any, options?: WriteOptions): void; export function outputJSONSync(file: string, data: any, options?: WriteOptions): void; export function writeJSON(file: string, object: any, options?: WriteOptions): Promise; -export function writeJSON(file: string, object: any, callback: (err: Error) => void): void; -export function writeJSON(file: string, object: any, options: WriteOptions, callback: (err: Error) => void): void; +export function writeJSON(file: string, object: any, callback: (err: Error | null) => void): void; +export function writeJSON(file: string, object: any, options: WriteOptions, callback: (err: Error | null) => void): void; export function writeJson(file: string, object: any, options?: WriteOptions): Promise; -export function writeJson(file: string, object: any, callback: (err: Error) => void): void; -export function writeJson(file: string, object: any, options: WriteOptions, callback: (err: Error) => void): void; +export function writeJson(file: string, object: any, callback: (err: Error | null) => void): void; +export function writeJson(file: string, object: any, options: WriteOptions, callback: (err: Error | null) => void): void; export function writeJsonSync(file: string, object: any, options?: WriteOptions): void; export function writeJSONSync(file: string, object: any, options?: WriteOptions): void; export function ensureFile(path: string): Promise; -export function ensureFile(path: string, callback: (err: Error) => void): void; +export function ensureFile(path: string, callback: (err: Error | null) => void): void; export function ensureFileSync(path: string): void; export function ensureLink(src: string, dest: string): Promise; -export function ensureLink(src: string, dest: string, callback: (err: Error) => void): void; +export function ensureLink(src: string, dest: string, callback: (err: Error | null) => void): void; export function ensureLinkSync(src: string, dest: string): void; export function ensureSymlink(src: string, dest: string, type?: SymlinkType): Promise; -export function ensureSymlink(src: string, dest: string, type: SymlinkType, callback: (err: Error) => void): void; -export function ensureSymlink(src: string, dest: string, callback: (err: Error) => void): void; +export function ensureSymlink(src: string, dest: string, type: SymlinkType, callback: (err: Error | null) => void): void; +export function ensureSymlink(src: string, dest: string, callback: (err: Error | null) => void): void; export function ensureSymlinkSync(src: string, dest: string, type?: SymlinkType): void; export function emptyDir(path: string): Promise; -export function emptyDir(path: string, callback: (err: Error) => void): void; +export function emptyDir(path: string, callback: (err: Error | null) => void): void; export function emptyDirSync(path: string): void; export function pathExists(path: string): Promise; -export function pathExists(path: string, callback: (err: Error, exists: boolean) => void): void; +export function pathExists(path: string, callback: (err: Error | null, exists: boolean) => void): void; export function pathExistsSync(path: string): boolean; // fs async methods // copied from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/node/v6/index.d.ts /** Tests a user's permissions for the file specified by path. */ -export function access(path: string | Buffer, callback: (err: NodeJS.ErrnoException) => void): void; -export function access(path: string | Buffer, mode: number, callback: (err: NodeJS.ErrnoException) => void): void; +export function access(path: string | Buffer, callback: (err: NodeJS.ErrnoException | null) => void): void; +export function access(path: string | Buffer, mode: number, callback: (err: NodeJS.ErrnoException | null) => void): void; export function access(path: string | Buffer, mode?: number): Promise; -export function appendFile(file: string | Buffer | number, data: any, options: { encoding?: string; mode?: number | string; flag?: string; }, callback: (err: NodeJS.ErrnoException) => void): void; -export function appendFile(file: string | Buffer | number, data: any, callback: (err: NodeJS.ErrnoException) => void): void; +export function appendFile(file: string | Buffer | number, data: any, options: { encoding?: string; mode?: number | string; flag?: string; }, + callback: (err: NodeJS.ErrnoException | null) => void): void; +export function appendFile(file: string | Buffer | number, data: any, callback: (err: NodeJS.ErrnoException | null) => void): void; export function appendFile(file: string | Buffer | number, data: any, options?: { encoding?: string; mode?: number | string; flag?: string; }): Promise; -export function chmod(path: string | Buffer, mode: string | number, callback: (err?: NodeJS.ErrnoException) => void): void; +export function chmod(path: string | Buffer, mode: string | number, callback: (err?: NodeJS.ErrnoException | null) => void): void; export function chmod(path: string | Buffer, mode: string | number): Promise; export function chown(path: string | Buffer, uid: number, gid: number): Promise; -export function chown(path: string | Buffer, uid: number, gid: number, callback: (err?: NodeJS.ErrnoException) => void): void; +export function chown(path: string | Buffer, uid: number, gid: number, callback: (err?: NodeJS.ErrnoException | null) => void): void; -export function close(fd: number, callback: (err?: NodeJS.ErrnoException) => void): void; +export function close(fd: number, callback: (err?: NodeJS.ErrnoException | null) => void): void; export function close(fd: number): Promise; -export function fchmod(fd: number, mode: string | number, callback: (err?: NodeJS.ErrnoException) => void): void; +export function fchmod(fd: number, mode: string | number, callback: (err?: NodeJS.ErrnoException | null) => void): void; export function fchmod(fd: number, mode: string | number): Promise; -export function fchown(fd: number, uid: number, gid: number, callback: (err?: NodeJS.ErrnoException) => void): void; +export function fchown(fd: number, uid: number, gid: number, callback: (err?: NodeJS.ErrnoException | null) => void): void; export function fchown(fd: number, uid: number, gid: number): Promise; export function fdatasync(fd: number, callback: () => void): void; export function fdatasync(fd: number): Promise; -export function fstat(fd: number, callback: (err: NodeJS.ErrnoException, stats: Stats) => any): void; +export function fstat(fd: number, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => any): void; export function fstat(fd: number): Promise; -export function fsync(fd: number, callback: (err?: NodeJS.ErrnoException) => void): void; +export function fsync(fd: number, callback: (err?: NodeJS.ErrnoException | null) => void): void; export function fsync(fd: number): Promise; -export function ftruncate(fd: number, callback: (err?: NodeJS.ErrnoException) => void): void; -export function ftruncate(fd: number, len: number, callback: (err?: NodeJS.ErrnoException) => void): void; +export function ftruncate(fd: number, callback: (err?: NodeJS.ErrnoException | null) => void): void; +export function ftruncate(fd: number, len: number, callback: (err?: NodeJS.ErrnoException | null) => void): void; export function ftruncate(fd: number, len?: number): Promise; -export function futimes(fd: number, atime: number, mtime: number, callback: (err?: NodeJS.ErrnoException) => void): void; -export function futimes(fd: number, atime: Date, mtime: Date, callback: (err?: NodeJS.ErrnoException) => void): void; +export function futimes(fd: number, atime: number, mtime: number, callback: (err?: NodeJS.ErrnoException | null) => void): void; +export function futimes(fd: number, atime: Date, mtime: Date, callback: (err?: NodeJS.ErrnoException | null) => void): void; export function futimes(fd: number, atime: number, mtime: number): Promise; export function futimes(fd: number, atime: Date, mtime: Date): Promise; -export function lchown(path: string | Buffer, uid: number, gid: number, callback: (err?: NodeJS.ErrnoException) => void): void; +export function lchown(path: string | Buffer, uid: number, gid: number, callback: (err?: NodeJS.ErrnoException | null) => void): void; export function lchown(path: string | Buffer, uid: number, gid: number): Promise; -export function link(srcpath: string | Buffer, dstpath: string | Buffer, callback: (err?: NodeJS.ErrnoException) => void): void; +export function link(srcpath: string | Buffer, dstpath: string | Buffer, callback: (err?: NodeJS.ErrnoException | null) => void): void; export function link(srcpath: string | Buffer, dstpath: string | Buffer): Promise; -export function lstat(path: string | Buffer, callback: (err: NodeJS.ErrnoException, stats: Stats) => any): void; +export function lstat(path: string | Buffer, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => any): void; export function lstat(path: string | Buffer): Promise; /** @@ -156,7 +157,7 @@ export function lstat(path: string | Buffer): Promise; * @param path * @param callback No arguments other than a possible exception are given to the completion callback. */ -export function mkdir(path: string | Buffer, callback: (err?: NodeJS.ErrnoException) => void): void; +export function mkdir(path: string | Buffer, callback: (err?: NodeJS.ErrnoException | null) => void): void; /** * Asynchronous mkdir - creates the directory specified in {path}. Parameter {mode} defaults to 0777. * @@ -164,35 +165,36 @@ export function mkdir(path: string | Buffer, callback: (err?: NodeJS.ErrnoExcept * @param mode * @param callback No arguments other than a possible exception are given to the completion callback. */ -export function mkdir(path: string | Buffer, mode: number | string, callback: (err?: NodeJS.ErrnoException) => void): void; +export function mkdir(path: string | Buffer, mode: number | string, callback: (err?: NodeJS.ErrnoException | null) => void): void; export function mkdir(path: string | Buffer): Promise; -export function open(path: string | Buffer, flags: string | number, callback: (err: NodeJS.ErrnoException, fd: number) => void): void; -export function open(path: string | Buffer, flags: string | number, mode: number, callback: (err: NodeJS.ErrnoException, fd: number) => void): void; +export function open(path: string | Buffer, flags: string | number, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void; +export function open(path: string | Buffer, flags: string | number, mode: number, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void; export function open(path: string | Buffer, flags: string | number, mode?: number): Promise; -export function read(fd: number, buffer: Buffer, offset: number, length: number, position: number | null, callback: (err: NodeJS.ErrnoException, bytesRead: number, buffer: Buffer) => void): void; +export function read(fd: number, buffer: Buffer, offset: number, length: number, position: number | null, + callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: Buffer) => void): void; export function read(fd: number, buffer: Buffer, offset: number, length: number, position: number | null): Promise; -export function readFile(file: string | Buffer | number, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void; -export function readFile(file: string | Buffer | number, encoding: string, callback: (err: NodeJS.ErrnoException, data: string) => void): void; +export function readFile(file: string | Buffer | number, callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void): void; +export function readFile(file: string | Buffer | number, encoding: string, callback: (err: NodeJS.ErrnoException | null, data: string) => void): void; export function readFile(file: string | Buffer | number, options: { flag?: string; } | { encoding: string; flag?: string; }, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void; export function readFile(file: string | Buffer | number, options: { flag?: string; } | { encoding: string; flag?: string; }): Promise; // tslint:disable-next-line:unified-signatures export function readFile(file: string | Buffer | number, encoding: string): Promise; export function readFile(file: string | Buffer | number): Promise; -export function readdir(path: string | Buffer, callback: (err: NodeJS.ErrnoException, files: string[]) => void): void; +export function readdir(path: string | Buffer, callback: (err: NodeJS.ErrnoException | null, files: string[]) => void): void; export function readdir(path: string | Buffer): Promise; -export function readlink(path: string | Buffer, callback: (err: NodeJS.ErrnoException, linkString: string) => any): void; +export function readlink(path: string | Buffer, callback: (err: NodeJS.ErrnoException | null, linkString: string) => any): void; export function readlink(path: string | Buffer): Promise; -export function realpath(path: string | Buffer, callback: (err: NodeJS.ErrnoException, resolvedPath: string) => any): void; -export function realpath(path: string | Buffer, cache: { [path: string]: string }, callback: (err: NodeJS.ErrnoException, resolvedPath: string) => any): void; +export function realpath(path: string | Buffer, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => any): void; +export function realpath(path: string | Buffer, cache: { [path: string]: string }, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => any): void; export function realpath(path: string | Buffer, cache?: { [path: string]: string }): Promise; -export function rename(oldPath: string, newPath: string, callback: (err?: NodeJS.ErrnoException) => void): void; +export function rename(oldPath: string, newPath: string, callback: (err?: NodeJS.ErrnoException | null) => void): void; export function rename(oldPath: string, newPath: string): Promise; /** @@ -201,17 +203,17 @@ export function rename(oldPath: string, newPath: string): Promise; * @param path * @param callback No arguments other than a possible exception are given to the completion callback. */ -export function rmdir(path: string | Buffer, callback: (err?: NodeJS.ErrnoException) => void): void; +export function rmdir(path: string | Buffer, callback: (err?: NodeJS.ErrnoException | null) => void): void; export function rmdir(path: string | Buffer): Promise; -export function stat(path: string | Buffer, callback: (err: NodeJS.ErrnoException, stats: Stats) => any): void; +export function stat(path: string | Buffer, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => any): void; export function stat(path: string | Buffer): Promise; -export function symlink(srcpath: string | Buffer, dstpath: string | Buffer, type: string, callback: (err?: NodeJS.ErrnoException) => void): void; +export function symlink(srcpath: string | Buffer, dstpath: string | Buffer, type: string, callback: (err?: NodeJS.ErrnoException | null) => void): void; export function symlink(srcpath: string | Buffer, dstpath: string | Buffer, type?: string): Promise; -export function truncate(path: string | Buffer, callback: (err?: NodeJS.ErrnoException) => void): void; -export function truncate(path: string | Buffer, len: number, callback: (err?: NodeJS.ErrnoException) => void): void; +export function truncate(path: string | Buffer, callback: (err?: NodeJS.ErrnoException | null) => void): void; +export function truncate(path: string | Buffer, len: number, callback: (err?: NodeJS.ErrnoException | null) => void): void; export function truncate(path: string | Buffer, len?: number): Promise; /** @@ -220,25 +222,25 @@ export function truncate(path: string | Buffer, len?: number): Promise; * @param path * @param callback No arguments other than a possible exception are given to the completion callback. */ -export function unlink(path: string | Buffer, callback: (err?: NodeJS.ErrnoException) => void): void; +export function unlink(path: string | Buffer, callback: (err?: NodeJS.ErrnoException | null) => void): void; export function unlink(path: string | Buffer): Promise; export function utimes(path: string | Buffer, atime: number, mtime: number, callback: (err?: NodeJS.ErrnoException) => void): void; -export function utimes(path: string | Buffer, atime: Date, mtime: Date, callback: (err?: NodeJS.ErrnoException) => void): void; +export function utimes(path: string | Buffer, atime: Date, mtime: Date, callback: (err?: NodeJS.ErrnoException | null) => void): void; export function utimes(path: string | Buffer, atime: number, mtime: number): Promise; export function utimes(path: string | Buffer, atime: Date, mtime: Date): Promise; export function write(fd: number, buffer: Buffer, offset: number, length: number, position: number | null, callback: (err: NodeJS.ErrnoException, written: number, buffer: Buffer) => void): void; -export function write(fd: number, buffer: Buffer, offset: number, length: number, callback: (err: NodeJS.ErrnoException, written: number, buffer: Buffer) => void): void; -export function write(fd: number, data: any, callback: (err: NodeJS.ErrnoException, written: number, str: string) => void): void; -export function write(fd: number, data: any, offset: number, callback: (err: NodeJS.ErrnoException, written: number, str: string) => void): void; -export function write(fd: number, data: any, offset: number, encoding: string, callback: (err: NodeJS.ErrnoException, written: number, str: string) => void): void; +export function write(fd: number, buffer: Buffer, offset: number, length: number, callback: (err: NodeJS.ErrnoException | null, written: number, buffer: Buffer) => void): void; +export function write(fd: number, data: any, callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void): void; +export function write(fd: number, data: any, offset: number, callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void): void; +export function write(fd: number, data: any, offset: number, encoding: string, callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void): void; export function write(fd: number, buffer: Buffer, offset: number, length: number, position?: number | null): Promise; export function write(fd: number, data: any, offset: number, encoding?: string): Promise; -export function writeFile(file: string | Buffer | number, data: any, callback: (err: NodeJS.ErrnoException) => void): void; +export function writeFile(file: string | Buffer | number, data: any, callback: (err: NodeJS.ErrnoException | null) => void): void; export function writeFile(file: string | Buffer | number, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): Promise; -export function writeFile(file: string | Buffer | number, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback: (err: NodeJS.ErrnoException) => void): void; +export function writeFile(file: string | Buffer | number, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback: (err: NodeJS.ErrnoException | null) => void): void; /** * Asynchronous mkdtemp - Creates a unique temporary directory. Generates six random characters to be appended behind a required prefix to create a unique temporary directory. @@ -247,7 +249,7 @@ export function writeFile(file: string | Buffer | number, data: any, options: { * @param callback The created folder path is passed as a string to the callback's second parameter. */ export function mkdtemp(prefix: string): Promise; -export function mkdtemp(prefix: string, callback: (err: NodeJS.ErrnoException, folder: string) => void): void; +export function mkdtemp(prefix: string, callback: (err: NodeJS.ErrnoException | null, folder: string) => void): void; export interface PathEntry { path: string; From 87539a0231576a6a0c97b703df3c4d53d9724219 Mon Sep 17 00:00:00 2001 From: ashwinr Date: Sun, 27 Aug 2017 11:38:39 -0400 Subject: [PATCH 030/156] Make comparator optional in sort method Comparator should be optional, just like the official docs and JSDoc indicate. --- types/underscore/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/underscore/index.d.ts b/types/underscore/index.d.ts index 031da982ab..2803c89b96 100644 --- a/types/underscore/index.d.ts +++ b/types/underscore/index.d.ts @@ -6042,7 +6042,7 @@ declare module _ { * @param compareFn Optional. Specifies a function that defines the sort order. If omitted, the array is sorted according to each character's Unicode code point value, according to the string conversion of each element. * @return The sorted array. **/ - sort(compareFn: (a: T, b: T) => boolean): _Chain; + sort(compareFn?: (a: T, b: T) => boolean): _Chain; /** * Changes the content of an array by removing existing elements and/or adding new elements. From 15e604f2f37524a9bc39e35a61bc6d26696fd31e Mon Sep 17 00:00:00 2001 From: Frank Tan Date: Sun, 27 Aug 2017 16:11:16 -0400 Subject: [PATCH 031/156] [react-redux] Make `connect` input types optional For convenience. --- types/react-redux/index.d.ts | 22 +++++++++++----------- types/react-redux/react-redux-tests.tsx | 10 +++++----- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/types/react-redux/index.d.ts b/types/react-redux/index.d.ts index b83252a745..44c18a91a5 100644 --- a/types/react-redux/index.d.ts +++ b/types/react-redux/index.d.ts @@ -67,66 +67,66 @@ export type InferableComponentEnhancer = */ export declare function connect(): InferableComponentEnhancer>; -export declare function connect( +export declare function connect( mapStateToProps: MapStateToPropsParam ): InferableComponentEnhancerWithProps, TOwnProps>; -export declare function connect( +export declare function connect( mapStateToProps: null | undefined, mapDispatchToProps: MapDispatchToPropsParam ): InferableComponentEnhancerWithProps; -export declare function connect( +export declare function connect( mapStateToProps: MapStateToPropsParam, mapDispatchToProps: MapDispatchToPropsParam ): InferableComponentEnhancerWithProps; -export declare function connect( +export declare function connect( mapStateToProps: MapStateToPropsParam, mapDispatchToProps: null | undefined, mergeProps: MergeProps, ): InferableComponentEnhancerWithProps; -export declare function connect( +export declare function connect( mapStateToProps: null | undefined, mapDispatchToProps: MapDispatchToPropsParam, mergeProps: MergeProps, ): InferableComponentEnhancerWithProps; -export declare function connect( +export declare function connect( mapStateToProps: null | undefined, mapDispatchToProps: null | undefined, mergeProps: MergeProps, ): InferableComponentEnhancerWithProps; -export declare function connect( +export declare function connect( mapStateToProps: MapStateToPropsParam, mapDispatchToProps: MapDispatchToPropsParam, mergeProps: MergeProps, ): InferableComponentEnhancerWithProps; -export declare function connect( +export declare function connect( mapStateToProps: MapStateToPropsParam, mapDispatchToProps: null | undefined, mergeProps: null | undefined, options: Options ): InferableComponentEnhancerWithProps & TStateProps, TOwnProps>; -export declare function connect( +export declare function connect( mapStateToProps: null | undefined, mapDispatchToProps: MapDispatchToPropsParam, mergeProps: null | undefined, options: Options ): InferableComponentEnhancerWithProps; -export declare function connect( +export declare function connect( mapStateToProps: MapStateToPropsParam, mapDispatchToProps: MapDispatchToPropsParam, mergeProps: null | undefined, options: Options ): InferableComponentEnhancerWithProps; -export declare function connect( +export declare function connect( mapStateToProps: MapStateToPropsParam, mapDispatchToProps: MapDispatchToPropsParam, mergeProps: MergeProps, diff --git a/types/react-redux/react-redux-tests.tsx b/types/react-redux/react-redux-tests.tsx index 5a9b038dc5..619a25a7df 100644 --- a/types/react-redux/react-redux-tests.tsx +++ b/types/react-redux/react-redux-tests.tsx @@ -57,26 +57,26 @@ interface ICounterDispatchProps { onIncrement: () => void } // with higher order functions -connect( +connect( () => mapStateToProps, () => mapDispatchToProps )(Counter); // with higher order functions using parameters -connect( +connect( (initialState: CounterState, ownProps) => mapStateToProps, (dispatch: Dispatch, ownProps) => mapDispatchToProps )(Counter); // only first argument -connect( +connect( () => mapStateToProps )(Counter); // wrap only one argument -connect( +connect( mapStateToProps, () => mapDispatchToProps )(Counter); // with extra arguments -connect( +connect( () => mapStateToProps, () => mapDispatchToProps, (s: ICounterStateProps, d: ICounterDispatchProps) => From 582bba204d4918c447cd6cc68aca775c5123b481 Mon Sep 17 00:00:00 2001 From: Leo Liang Date: Wed, 2 Aug 2017 11:52:55 +0800 Subject: [PATCH 032/156] Update typing for pg --- types/pg/index.d.ts | 31 +++++++++++---------- types/pg/pg-tests.ts | 63 +++++++++++++++++++++++++----------------- types/pg/tsconfig.json | 4 +-- types/pg/tslint.json | 5 ++++ 4 files changed, 61 insertions(+), 42 deletions(-) create mode 100644 types/pg/tslint.json diff --git a/types/pg/index.d.ts b/types/pg/index.d.ts index da6f4db575..fc20d5fd85 100644 --- a/types/pg/index.d.ts +++ b/types/pg/index.d.ts @@ -9,9 +9,11 @@ import events = require("events"); import stream = require("stream"); import pgTypes = require("pg-types"); -export declare function connect(connection: string, callback: (err: Error, client: Client, done: (err?: any) => void) => void): void; -export declare function connect(config: ClientConfig, callback: (err: Error, client: Client, done: (err?: any) => void) => void): void; -export declare function end(): void; +// tslint:disable-next-line unified-signatures +export function connect(connection: string, callback: (err: Error, client: Client, done: (err?: any) => void) => void): void; +// tslint:disable-next-line unified-signatures +export function connect(config: ClientConfig, callback: (err: Error, client: Client, done: (err?: any) => void) => void): void; +export function end(): void; export interface ConnectionConfig { user?: string; @@ -64,7 +66,7 @@ export interface ResultBuilder extends QueryResult { addRow(row: any): void; } -export declare class Pool extends events.EventEmitter { +export class Pool extends events.EventEmitter { // `new Pool('pg://user@localhost/mydb')` is not allowed. // But it passes type check because of issue: // https://github.com/Microsoft/TypeScript/issues/7485 @@ -76,9 +78,8 @@ export declare class Pool extends events.EventEmitter { end(callback?: () => void): Promise; query(queryStream: QueryConfig & stream.Readable): stream.Readable; - query(queryTextOrConfig: string | QueryConfig): Promise; - query(queryText: string, values: any[]): Promise; - + query(queryConfig: QueryConfig): Promise; + query(queryText: string, values?: any[]): Promise; query(queryTextOrConfig: string | QueryConfig, callback: (err: Error, result: QueryResult) => void): Query; query(queryText: string, values: any[], callback: (err: Error, result: QueryResult) => void): Query; @@ -86,18 +87,17 @@ export declare class Pool extends events.EventEmitter { on(event: "connect" | "acquire", listener: (client: Client) => void): this; } -export declare class Client extends events.EventEmitter { - constructor(connection: string); - constructor(config: ClientConfig); +export class Client extends events.EventEmitter { + constructor(connection: string); // tslint:disable-line unified-signatures + constructor(config: ClientConfig); // tslint:disable-line unified-signatures connect(callback?: (err: Error) => void): void; end(callback?: (err: Error) => void): void; release(err?: Error): void; query(queryStream: QueryConfig & stream.Readable): stream.Readable; - query(queryTextOrConfig: string | QueryConfig): Promise; - query(queryText: string, values: any[]): Promise; - + query(queryConfig: QueryConfig): Promise; + query(queryText: string, values?: any[]): Promise; query(queryTextOrConfig: string | QueryConfig, callback: (err: Error, result: QueryResult) => void): Query; query(queryText: string, values: any[], callback: (err: Error, result: QueryResult) => void): Query; @@ -110,16 +110,17 @@ export declare class Client extends events.EventEmitter { on(event: "drain", listener: () => void): this; on(event: "error", listener: (err: Error) => void): this; on(event: "notification" | "notice", listener: (message: any) => void): this; + // tslint:disable-next-line unified-signatures on(event: "end", listener: () => void): this; } -export declare class Query extends events.EventEmitter { +export class Query extends events.EventEmitter { on(event: "row", listener: (row: any, result?: ResultBuilder) => void): this; on(event: "error", listener: (err: Error) => void): this; on(event: "end", listener: (result: ResultBuilder) => void): this; } -export declare class Events extends events.EventEmitter { +export class Events extends events.EventEmitter { on(event: "error", listener: (err: Error, client: Client) => void): this; } diff --git a/types/pg/pg-tests.ts b/types/pg/pg-tests.ts index 4b4cfba7ec..6bdf408bee 100644 --- a/types/pg/pg-tests.ts +++ b/types/pg/pg-tests.ts @@ -1,8 +1,9 @@ import * as pg from "pg"; -var conString = "postgres://username:password@localhost/database"; +const conString = "postgres://username:password@localhost/database"; // https://github.com/brianc/node-pg-types +// tslint:disable-next-line no-unnecessary-callback-wrapper pg.types.setTypeParser(20, val => Number(val)); // Client pooling @@ -15,8 +16,7 @@ pg.connect(conString, (err, client, done) => { if (err) { done(err); return console.error("Error running query", err); - } - else { + } else { done(); } console.log(result.rows[0]["number"]); @@ -26,7 +26,7 @@ pg.connect(conString, (err, client, done) => { }); // Simple -var client = new pg.Client(conString); +const client = new pg.Client(conString); client.connect(err => { if (err) { return console.error("Could not connect to postgres", err); @@ -46,36 +46,49 @@ client.on('end', () => console.log("Client was disconnected.")); // client pooling -var config = { - user: 'foo', //env var: PGUSER - database: 'my_db', //env var: PGDATABASE - password: 'secret', //env var: PGPASSWORD - port: 5432, //env var: PGPORT - max: 10, // max number of clients in the pool - idleTimeoutMillis: 30000, // how long a client is allowed to remain idle before being closed - Promise, +const config = { + user: 'foo', + database: 'my_db', + password: 'secret', + port: 5432, + max: 10, + idleTimeoutMillis: 30000, + Promise, }; -var pool = new pg.Pool(config); +const pool = new pg.Pool(config); pool.connect((err, client, done) => { - if(err) { - return console.error('error fetching client from pool', err); - } - client.query('SELECT $1::int AS number', ['1'], (err, result) => { - done(); - - if(err) { - return console.error('error running query', err); + if (err) { + return console.error('error fetching client from pool', err); } - console.log(result.rows[0].number); - }); + client.query('SELECT $1::int AS number', ['1'], (err, result) => { + done(); + + if (err) { + return console.error('error running query', err); + } + console.log(result.rows[0].number); + }); }); pool.on('error', (err, client) => { - console.error('idle client error', err.message, err.stack) -}) + console.error('idle client error', err.message, err.stack); +}); pool.end(); pool.end(() => { console.log("pool is closed"); }); + +// Promise + +function query(sql: string, binds?: any[]): void { + // binds: any[] | undefined + pool.query(sql, binds) + .then((result: pg.QueryResult) => { + console.log(result.rows[0].number); + }) + .catch((err: any) => { + console.error('error running query', err); + }); +} diff --git a/types/pg/tsconfig.json b/types/pg/tsconfig.json index 3535f4d43f..6905c7197c 100644 --- a/types/pg/tsconfig.json +++ b/types/pg/tsconfig.json @@ -6,7 +6,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" @@ -19,4 +19,4 @@ "index.d.ts", "pg-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/pg/tslint.json b/types/pg/tslint.json new file mode 100644 index 0000000000..495d29983d --- /dev/null +++ b/types/pg/tslint.json @@ -0,0 +1,5 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + } +} From 59035dd08eb992d11440874d99785707e36677af Mon Sep 17 00:00:00 2001 From: Leo Liang Date: Thu, 3 Aug 2017 11:32:19 +0800 Subject: [PATCH 033/156] Fix review comment --- types/pg/index.d.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/types/pg/index.d.ts b/types/pg/index.d.ts index fc20d5fd85..b2c3634f5c 100644 --- a/types/pg/index.d.ts +++ b/types/pg/index.d.ts @@ -9,10 +9,9 @@ import events = require("events"); import stream = require("stream"); import pgTypes = require("pg-types"); -// tslint:disable-next-line unified-signatures -export function connect(connection: string, callback: (err: Error, client: Client, done: (err?: any) => void) => void): void; -// tslint:disable-next-line unified-signatures -export function connect(config: ClientConfig, callback: (err: Error, client: Client, done: (err?: any) => void) => void): void; +export function connect( + connectionOrConfig: string | ClientConfig, + callback: (err: Error, client: Client, done: (err?: any) => void) => void): void; export function end(): void; export interface ConnectionConfig { @@ -88,8 +87,7 @@ export class Pool extends events.EventEmitter { } export class Client extends events.EventEmitter { - constructor(connection: string); // tslint:disable-line unified-signatures - constructor(config: ClientConfig); // tslint:disable-line unified-signatures + constructor(connectionOrConfig: string | ClientConfig); connect(callback?: (err: Error) => void): void; end(callback?: (err: Error) => void): void; From 3653eef83fb63e92c9751ea67670f0c43b9ef150 Mon Sep 17 00:00:00 2001 From: Leo Liang Date: Fri, 11 Aug 2017 14:37:31 +0800 Subject: [PATCH 034/156] Update to pg 7.1 API --- types/pg/index.d.ts | 21 +++--- types/pg/pg-tests.ts | 144 +++++++++++++++++++++++++---------------- types/pg/tsconfig.json | 1 + 3 files changed, 100 insertions(+), 66 deletions(-) diff --git a/types/pg/index.d.ts b/types/pg/index.d.ts index b2c3634f5c..92aeb91c86 100644 --- a/types/pg/index.d.ts +++ b/types/pg/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for pg 6.1 +// Type definitions for pg 7.1 // Project: https://github.com/brianc/node-postgres // Definitions by: Phips Peter // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -9,11 +9,6 @@ import events = require("events"); import stream = require("stream"); import pgTypes = require("pg-types"); -export function connect( - connectionOrConfig: string | ClientConfig, - callback: (err: Error, client: Client, done: (err?: any) => void) => void): void; -export function end(): void; - export interface ConnectionConfig { user?: string; database?: string; @@ -41,6 +36,7 @@ export interface PoolConfig extends ClientConfig { max?: number; min?: number; refreshIdle?: boolean; + connectionTimeoutMillis?: number; idleTimeoutMillis?: number; reapIntervalMillis?: number; returnToHead?: boolean; @@ -74,7 +70,8 @@ export class Pool extends events.EventEmitter { connect(): Promise; connect(callback: (err: Error, client: Client, done: () => void) => void): void; - end(callback?: () => void): Promise; + end(): Promise; + end(callback: () => void): void; query(queryStream: QueryConfig & stream.Readable): stream.Readable; query(queryConfig: QueryConfig): Promise; @@ -87,10 +84,14 @@ export class Pool extends events.EventEmitter { } export class Client extends events.EventEmitter { - constructor(connectionOrConfig: string | ClientConfig); + constructor(config: ClientConfig); + + connect(): Promise; + connect(callback: (err: Error) => void): void; + + end(): Promise; + end(callback: (err: Error) => void): void; - connect(callback?: (err: Error) => void): void; - end(callback?: (err: Error) => void): void; release(err?: Error): void; query(queryStream: QueryConfig & stream.Readable): stream.Readable; diff --git a/types/pg/pg-tests.ts b/types/pg/pg-tests.ts index 6bdf408bee..d3359d930a 100644 --- a/types/pg/pg-tests.ts +++ b/types/pg/pg-tests.ts @@ -1,32 +1,15 @@ import * as pg from "pg"; -const conString = "postgres://username:password@localhost/database"; - // https://github.com/brianc/node-pg-types // tslint:disable-next-line no-unnecessary-callback-wrapper pg.types.setTypeParser(20, val => Number(val)); -// Client pooling -pg.defaults.ssl = true; -pg.connect(conString, (err, client, done) => { - if (err) { - return console.error("Error fetching client from pool", err); - } - client.query("SELECT $1::int AS number", ["1"], (err, result) => { - if (err) { - done(err); - return console.error("Error running query", err); - } else { - done(); - } - console.log(result.rows[0]["number"]); - return null; - }); - return null; +const client = new pg.Client({ + host: 'my.database-server.com', + port: 5334, + user: 'database-user', + password: 'secretpassword!!', }); - -// Simple -const client = new pg.Client(conString); client.connect(err => { if (err) { return console.error("Could not connect to postgres", err); @@ -44,51 +27,100 @@ client.connect(err => { }); client.on('end', () => console.log("Client was disconnected.")); -// client pooling +client.connect() + .then(() => console.log('connected')) + .catch(e => console.error('connection error', e.stack)); -const config = { - user: 'foo', - database: 'my_db', - password: 'secret', - port: 5432, - max: 10, - idleTimeoutMillis: 30000, - Promise, +client.query('SELECT NOW()', (err, res) => { + if (err) throw err; + console.log(res); + client.end(); +}); + +client.query('SELECT $1::text as name', ['brianc'], (err, res) => { + if (err) throw err; + console.log(res); + client.end(); +}); + +const query = { + name: 'get-name', + text: 'SELECT $1::text', + values: ['brianc'], + rowMode: 'array' }; -const pool = new pg.Pool(config); +client.query(query, (err, res) => { + if (err) { + console.error(err.stack); + } else { + console.log(res.rows); + } +}); +client.query(query) + .then(res => { + console.log(res.rows); + }) + .catch(e => { + console.error(e.stack); + }); +client.end((err) => { + console.log('client has disconnected'); + if (err) { + console.log('error during disconnection', err.stack); + } +}); + +client.end() + .then(() => console.log('client has disconnected')) + .catch(err => console.error('error during disconnection', err.stack)); + +const pool = new pg.Pool({ + host: 'localhost', + port: 5432, + user: 'database-user', + database: 'my_db', + max: 20, + idleTimeoutMillis: 30000, + connectionTimeoutMillis: 2000, +}); pool.connect((err, client, done) => { - if (err) { - return console.error('error fetching client from pool', err); - } - client.query('SELECT $1::int AS number', ['1'], (err, result) => { - done(); + if (err) { + return console.error('error fetching client from pool', err); + } + client.query('SELECT $1::int AS number', ['1'], (err, result) => { + done(); - if (err) { - return console.error('error running query', err); - } - console.log(result.rows[0].number); - }); + if (err) { + return console.error('error running query', err); + } + console.log(result.rows[0].number); + }); }); pool.on('error', (err, client) => { - console.error('idle client error', err.message, err.stack); + console.error('idle client error', err.message, err.stack); }); -pool.end(); +pool.query('SELECT $1::text as name', ['brianc'], (err, result) => { + if (err) { + return console.error('Error executing query', err.stack); + } + console.log(result.rows[0].name); +}); + +pool.query('SELECT $1::text as name', ['brianc']) + .then((res) => console.log(res.rows[0].name)) + .catch(err => console.error('Error executing query', err.stack)); + pool.end(() => { - console.log("pool is closed"); + console.log('pool has ended'); }); -// Promise +pool.end().then(() => console.log('pool has ended')); -function query(sql: string, binds?: any[]): void { - // binds: any[] | undefined - pool.query(sql, binds) - .then((result: pg.QueryResult) => { - console.log(result.rows[0].number); - }) - .catch((err: any) => { - console.error('error running query', err); - }); -} +(async () => { + const client = await pool.connect(); + await client.query('SELECT NOW()'); + client.release(); +})(); diff --git a/types/pg/tsconfig.json b/types/pg/tsconfig.json index 6905c7197c..caa997a916 100644 --- a/types/pg/tsconfig.json +++ b/types/pg/tsconfig.json @@ -4,6 +4,7 @@ "lib": [ "es6" ], + "target": "es6", "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, From c03e601a5079f67aae15d2780e8c01d2136da18e Mon Sep 17 00:00:00 2001 From: Leo Liang Date: Fri, 11 Aug 2017 16:23:04 +0800 Subject: [PATCH 035/156] Update pg-query-stream test to use pg@7.1 API. --- types/pg-query-stream/pg-query-stream-tests.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/types/pg-query-stream/pg-query-stream-tests.ts b/types/pg-query-stream/pg-query-stream-tests.ts index 6c4c034102..1df78ea648 100644 --- a/types/pg-query-stream/pg-query-stream-tests.ts +++ b/types/pg-query-stream/pg-query-stream-tests.ts @@ -8,7 +8,8 @@ const options: QueryStream.Options = { const query = new QueryStream('SELECT * FROM generate_series(0, $1) num', [1000000], options); -pg.connect('', (err, client, done) => { +const pool = new pg.Pool(); +pool.connect((err, client, done) => { const stream = client.query(query); stream.on('end', () => { client.end(); @@ -17,3 +18,4 @@ pg.connect('', (err, client, done) => { console.log(data); }); }); +pool.end(); From 854a2af8e5ff411490b48cc14f960ead8f4c1874 Mon Sep 17 00:00:00 2001 From: Leo Liang Date: Tue, 22 Aug 2017 18:26:00 +0800 Subject: [PATCH 036/156] Add properties totalCount, idleCount, waitingCount --- types/pg/index.d.ts | 4 ++++ types/pg/pg-tests.ts | 1 + 2 files changed, 5 insertions(+) diff --git a/types/pg/index.d.ts b/types/pg/index.d.ts index 92aeb91c86..ebba2d0f7d 100644 --- a/types/pg/index.d.ts +++ b/types/pg/index.d.ts @@ -67,6 +67,10 @@ export class Pool extends events.EventEmitter { // https://github.com/Microsoft/TypeScript/issues/7485 constructor(config?: PoolConfig); + readonly totalCount: number; + readonly idleCount: number; + readonly waitingCount: number; + connect(): Promise; connect(callback: (err: Error, client: Client, done: () => void) => void): void; diff --git a/types/pg/pg-tests.ts b/types/pg/pg-tests.ts index d3359d930a..81eadd0b13 100644 --- a/types/pg/pg-tests.ts +++ b/types/pg/pg-tests.ts @@ -84,6 +84,7 @@ const pool = new pg.Pool({ idleTimeoutMillis: 30000, connectionTimeoutMillis: 2000, }); +console.log(pool.totalCount); pool.connect((err, client, done) => { if (err) { return console.error('error fetching client from pool', err); From a26b2c6e97871596a94e4c2d5529bb229861080a Mon Sep 17 00:00:00 2001 From: Leo Liang Date: Fri, 25 Aug 2017 17:33:35 +0800 Subject: [PATCH 037/156] Remove properties which are no more available in pg 7.1 --- types/pg/index.d.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/types/pg/index.d.ts b/types/pg/index.d.ts index ebba2d0f7d..04a84f1dfd 100644 --- a/types/pg/index.d.ts +++ b/types/pg/index.d.ts @@ -35,11 +35,9 @@ export interface PoolConfig extends ClientConfig { // properties from module 'node-pool' max?: number; min?: number; - refreshIdle?: boolean; connectionTimeoutMillis?: number; idleTimeoutMillis?: number; - reapIntervalMillis?: number; - returnToHead?: boolean; + application_name?: string; Promise?: PromiseConstructorLike; } From 84a47dcbebb349bd3f72810b7ec2f63b85629c4a Mon Sep 17 00:00:00 2001 From: Leo Liang Date: Fri, 25 Aug 2017 17:59:24 +0800 Subject: [PATCH 038/156] New test rule expects a github URL. --- types/pg/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/pg/index.d.ts b/types/pg/index.d.ts index 04a84f1dfd..1383dc2a22 100644 --- a/types/pg/index.d.ts +++ b/types/pg/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for pg 7.1 // Project: https://github.com/brianc/node-postgres -// Definitions by: Phips Peter +// Definitions by: Phips Peter // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// From 3bc2634b096e54d3c6c5a5af7ef58051bc1847dd Mon Sep 17 00:00:00 2001 From: Leo Liang Date: Mon, 28 Aug 2017 10:56:04 +0800 Subject: [PATCH 039/156] Fix lint rule no-void-expression --- types/pg/pg-tests.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/types/pg/pg-tests.ts b/types/pg/pg-tests.ts index 81eadd0b13..bc1bfd30e0 100644 --- a/types/pg/pg-tests.ts +++ b/types/pg/pg-tests.ts @@ -12,11 +12,13 @@ const client = new pg.Client({ }); client.connect(err => { if (err) { - return console.error("Could not connect to postgres", err); + console.error("Could not connect to postgres", err); + return; } client.query("SELECT NOW() AS 'theTime'", (err, result) => { if (err) { - return console.error("Error running query", err); + console.error("Error running query", err); + return; } console.log(result.rowCount); console.log(result.rows[0]["theTime"]); @@ -87,13 +89,15 @@ const pool = new pg.Pool({ console.log(pool.totalCount); pool.connect((err, client, done) => { if (err) { - return console.error('error fetching client from pool', err); + console.error('error fetching client from pool', err); + return; } client.query('SELECT $1::int AS number', ['1'], (err, result) => { done(); if (err) { - return console.error('error running query', err); + console.error('error running query', err); + return; } console.log(result.rows[0].number); }); @@ -105,7 +109,8 @@ pool.on('error', (err, client) => { pool.query('SELECT $1::text as name', ['brianc'], (err, result) => { if (err) { - return console.error('Error executing query', err.stack); + console.error('Error executing query', err.stack); + return; } console.log(result.rows[0].name); }); From 87a16df2ae5c837ce588e67ed3618dc08b8fb4c2 Mon Sep 17 00:00:00 2001 From: Dimitri Benin Date: Mon, 28 Aug 2017 09:26:56 +0200 Subject: [PATCH 040/156] [sprintf-js] improve typings, enable strict null checks and linting --- types/sprintf-js/index.d.ts | 234 ++++++++++++++++++--------- types/sprintf-js/sprintf-js-tests.ts | 10 +- types/sprintf-js/tsconfig.json | 4 +- types/sprintf-js/tslint.json | 1 + 4 files changed, 169 insertions(+), 80 deletions(-) create mode 100644 types/sprintf-js/tslint.json diff --git a/types/sprintf-js/index.d.ts b/types/sprintf-js/index.d.ts index b7c54d40fb..67d6bba4a8 100644 --- a/types/sprintf-js/index.d.ts +++ b/types/sprintf-js/index.d.ts @@ -1,78 +1,168 @@ -// Type definitions for sprintf-js +// Type definitions for sprintf-js 1.1 // Project: https://www.npmjs.com/package/sprintf-js -// Definitions by: Jason Swearingen +// Definitions by: Jason Swearingen +// BendingBender // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +/** + * Returns a formatted string: + * + * string sprintf(string format, mixed arg1?, mixed arg2?, ...) + * + * ### Argument swapping + * + * You can also swap the arguments. That is, the order of the placeholders doesn't have to match the order of the arguments. + * You can do that by simply indicating in the format string which arguments the placeholders refer to: + * + * sprintf('%2$s %3$s a %1$s', 'cracker', 'Polly', 'wants') + * + * And, of course, you can repeat the placeholders without having to increase the number of arguments. + * + * ### Named arguments + * + * Format strings may contain replacement fields rather than positional placeholders. Instead of referring to a certain argument, + * you can now refer to a certain key within an object. Replacement fields are surrounded by rounded parentheses - `(` and `)` - + * and begin with a keyword that refers to a key: + * + * var user = { + * name: 'Dolly', + * } + * sprintf('Hello %(name)s', user) // Hello Dolly + * + * Keywords in replacement fields can be optionally followed by any number of keywords or indexes: + * + * var users = [ + * {name: 'Dolly'}, + * {name: 'Molly'}, + * {name: 'Polly'}, + * ] + * sprintf('Hello %(users[0].name)s, %(users[1].name)s and %(users[2].name)s', {users: users}) // Hello Dolly, Molly and Polly + * + * Note: mixing positional and named placeholders is not (yet) supported + * + * ### Computed values + * + * You can pass in a function as a dynamic value and it will be invoked (with no arguments) in order to compute the value on the fly. + * + * sprintf('Current date and time: %s', function() { return new Date().toString() }) + * + * @param format: format string + * The placeholders in the format string are marked by `%` and are followed by one or more of these elements, in this order: + * * An optional number followed by a `$` sign that selects which argument index to use for the value. If not specified, + * arguments will be placed in the same order as the placeholders in the input string. + * * An optional `+` sign that forces to preceed the result with a plus or minus sign on numeric values. By default, + * only the `-` sign is used on negative numbers. + * * An optional padding specifier that says what character to use for padding (if specified). Possible values are + * `0` or any other character precedeed by a `'` (single quote). The default is to pad with *spaces*. + * * An optional `-` sign, that causes `sprintf` to left-align the result of this placeholder. The default is to right-align the result. + * * An optional number, that says how many characters the result should have. If the value to be returned is shorter + * than this number, the result will be padded. When used with the `j` (JSON) type specifier, the padding length + * specifies the tab size used for indentation. + * * An optional precision modifier, consisting of a `.` (dot) followed by a number, that says how many digits should be + * displayed for floating point numbers. When used with the `g` type specifier, it specifies the number of significant + * digits. When used on a string, it causes the result to be truncated. + * * A type specifier that can be any of: + * * `%` — yields a literal `%` character + * * `b` — yields an integer as a binary number + * * `c` — yields an integer as the character with that ASCII value + * * `d` or `i` — yields an integer as a signed decimal number + * * `e` — yields a float using scientific notation + * * `u` — yields an integer as an unsigned decimal number + * * `f` — yields a float as is; see notes on precision above + * * `g` — yields a float as is; see notes on precision above + * * `o` — yields an integer as an octal number + * * `s` — yields a string as is + * * `t` — yields `true` or `false` + * * `T` — yields the type of the argument1 + * * `v` — yields the primitive value of the specified argument + * * `x` — yields an integer as a hexadecimal number (lower-case) + * * `X` — yields an integer as a hexadecimal number (upper-case) + * * `j` — yields a JavaScript object or array as a JSON encoded string + * @param args: the arguments for the format string + */ +export function sprintf(format: string, ...args: any[]): string; -/** sprintf.js is a complete open source JavaScript sprintf implementation for the browser and node.js. +/** + * Same as `sprintf` except it takes an array of arguments, rather than a variable number of arguments: + * + * string vsprintf(string format, array arguments?) + * + * ### Argument swapping + * + * You can also swap the arguments. That is, the order of the placeholders doesn't have to match the order of the arguments. + * You can do that by simply indicating in the format string which arguments the placeholders refer to: + * + * sprintf('%2$s %3$s a %1$s', 'cracker', 'Polly', 'wants') + * + * And, of course, you can repeat the placeholders without having to increase the number of arguments. + * + * ### Named arguments + * + * Format strings may contain replacement fields rather than positional placeholders. Instead of referring to a certain argument, + * you can now refer to a certain key within an object. Replacement fields are surrounded by rounded parentheses - `(` and `)` - + * and begin with a keyword that refers to a key: + * + * var user = { + * name: 'Dolly', + * } + * sprintf('Hello %(name)s', user) // Hello Dolly + * + * Keywords in replacement fields can be optionally followed by any number of keywords or indexes: + * + * var users = [ + * {name: 'Dolly'}, + * {name: 'Molly'}, + * {name: 'Polly'}, + * ] + * sprintf('Hello %(users[0].name)s, %(users[1].name)s and %(users[2].name)s', {users: users}) // Hello Dolly, Molly and Polly + * + * Note: mixing positional and named placeholders is not (yet) supported + * + * ### Computed values + * + * You can pass in a function as a dynamic value and it will be invoked (with no arguments) in order to compute the value on the fly. + * + * sprintf('Current date and time: %s', function() { return new Date().toString() }) + * + * @param format: format string + * + * The placeholders in the format string are marked by `%` and are followed by one or more of these elements, in this order: + * + * * An optional number followed by a `$` sign that selects which argument index to use for the value. If not specified, + * arguments will be placed in the same order as the placeholders in the input string. + * * An optional `+` sign that forces to preceed the result with a plus or minus sign on numeric values. By default, + * only the `-` sign is used on negative numbers. + * * An optional padding specifier that says what character to use for padding (if specified). Possible values are + * `0` or any other character precedeed by a `'` (single quote). The default is to pad with *spaces*. + * * An optional `-` sign, that causes `sprintf` to left-align the result of this placeholder. The default is to right-align the result. + * * An optional number, that says how many characters the result should have. If the value to be returned is shorter + * than this number, the result will be padded. When used with the `j` (JSON) type specifier, the padding length + * specifies the tab size used for indentation. + * * An optional precision modifier, consisting of a `.` (dot) followed by a number, that says how many digits should be + * displayed for floating point numbers. When used with the `g` type specifier, it specifies the number of significant + * digits. When used on a string, it causes the result to be truncated. + * * A type specifier that can be any of: + * * `%` — yields a literal `%` character + * * `b` — yields an integer as a binary number + * * `c` — yields an integer as the character with that ASCII value + * * `d` or `i` — yields an integer as a signed decimal number + * * `e` — yields a float using scientific notation + * * `u` — yields an integer as an unsigned decimal number + * * `f` — yields a float as is; see notes on precision above + * * `g` — yields a float as is; see notes on precision above + * * `o` — yields an integer as an octal number + * * `s` — yields a string as is + * * `t` — yields `true` or `false` + * * `T` — yields the type of the argument1 + * * `v` — yields the primitive value of the specified argument + * * `x` — yields an integer as a hexadecimal number (lower-case) + * * `X` — yields an integer as a hexadecimal number (upper-case) + * * `j` — yields a JavaScript object or array as a JSON encoded string + * @param args: the arguments for the format string + */ +export function vsprintf(format: string, args: any[]): string; -Its prototype is simple: - -string sprintf(string format , [mixed arg1 [, mixed arg2 [ ,...]]]) -*/ -declare namespace sprintf_js { - /** sprintf.js is a complete open source JavaScript sprintf implementation for the browser and node.js. -Its prototype is simple: - string sprintf(string format , [mixed arg1 [, mixed arg2 [ ,...]]]) - -==Placeholders== - The placeholders in the format string are marked by % and are followed by one or more of these elements. see "fmt" arg for more docs on placeholders. - -==Argument swapping== -You can also swap the arguments. That is, the order of the placeholders doesn't have to match the order of the arguments. You can do that by simply indicating in the format string which arguments the placeholders refer to: - sprintf("%2$s %3$s a %1$s", "cracker", "Polly", "wants") - And, of course, you can repeat the placeholders without having to increase the number of arguments. - -==Named arguments== -Format strings may contain replacement fields rather than positional placeholders. Instead of referring to a certain argument, you can now refer to a certain key within an object. Replacement fields are surrounded by rounded parentheses - ( and ) - and begin with a keyword that refers to a key: - var user = {name: "Dolly"} - sprintf("Hello %(name)s", user) // Hello Dolly -Keywords in replacement fields can be optionally followed by any number of keywords or indexes: - var users = [{name: "Dolly"},{name: "Molly"},{name: "Polly"}] - sprintf("Hello %(users[0].name)s, %(users[1].name)s and %(users[2].name)s", {users: users}) // Hello Dolly, Molly and Polly -Note: mixing positional and named placeholders is not (yet) supported - -==Computed values== -You can pass in a function as a dynamic value and it will be invoked (with no arguments) in order to compute the value on-the-fly. - sprintf("Current timestamp: %d", Date.now) // Current timestamp: 1398005382890 - sprintf("Current date and time: %s", function() { return new Date().toString() }) - */ - export function sprintf( - /** The placeholders in the format string are marked by % and are followed by one or more of these elements, in this order: - -An optional number followed by a $ sign that selects which argument index to use for the value. If not specified, arguments will be placed in the same order as the placeholders in the input string. -An optional + sign that forces to preceed the result with a plus or minus sign on numeric values. By default, only the - sign is used on negative numbers. -An optional padding specifier that says what character to use for padding (if specified). Possible values are 0 or any other character precedeed by a ' (single quote). The default is to pad with spaces. -An optional - sign, that causes sprintf to left-align the result of this placeholder. The default is to right-align the result. -An optional number, that says how many characters the result should have. If the value to be returned is shorter than this number, the result will be padded. -An optional precision modifier, consisting of a . (dot) followed by a number, that says how many digits should be displayed for floating point numbers. When used on a string, it causes the result to be truncated. -A type specifier that can be any of: -% - yields a literal % character -b - yields an integer as a binary number -c - yields an integer as the character with that ASCII value -d or i - yields an integer as a signed decimal number -e - yields a float using scientific notation -u - yields an integer as an unsigned decimal number -f - yields a float as is -o - yields an integer as an octal number -s - yields a string as is -x - yields an integer as a hexadecimal number (lower-case) -X - yields an integer as a hexadecimal number (upper-case) - */ - fmt: string, - /** */ - ...args: any[] - ): string; - /** vsprintf is the same as sprintf except that it accepts an array of arguments, rather than a variable number of arguments: - - vsprintf("The first 4 letters of the english alphabet are: %s, %s, %s and %s", ["a", "b", "c", "d"]) -*/ - export function vsprintf(fmt: string, args: any[]): string; +declare global { + function sprintf(format: string, ...args: any[]): string; + function vsprintf(format: string, args: any[]): string; } - -declare module "sprintf-js" { - export =sprintf_js; -} - -declare var sprintf: typeof sprintf_js.sprintf; -declare var vsprintf: typeof sprintf_js.vsprintf; diff --git a/types/sprintf-js/sprintf-js-tests.ts b/types/sprintf-js/sprintf-js-tests.ts index 8119f6d45a..03bc5a40e4 100644 --- a/types/sprintf-js/sprintf-js-tests.ts +++ b/types/sprintf-js/sprintf-js-tests.ts @@ -1,14 +1,12 @@ - - import sprintf = require('sprintf-js'); -var str: string; -var num: number; +declare const str: string; +declare const num: number; -sprintf.sprintf(str, str); +sprintf.sprintf(str, str); // $ExpectType string sprintf.sprintf(str, str, num); sprintf.sprintf(str, num, str); -sprintf.vsprintf(str, [str]); +sprintf.vsprintf(str, [str]); // $ExpectType string sprintf.vsprintf(str, [str, num]); sprintf.vsprintf(str, [num, str]); diff --git a/types/sprintf-js/tsconfig.json b/types/sprintf-js/tsconfig.json index a53c1db3cc..eda7030ead 100644 --- a/types/sprintf-js/tsconfig.json +++ b/types/sprintf-js/tsconfig.json @@ -6,7 +6,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" @@ -19,4 +19,4 @@ "index.d.ts", "sprintf-js-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/sprintf-js/tslint.json b/types/sprintf-js/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/sprintf-js/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 2c963b4c5f8dfe7274037e1cb533210e30013ca1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josue=CC=81=20Us?= Date: Mon, 28 Aug 2017 11:56:50 -0600 Subject: [PATCH 041/156] Add missed function type for filterValue on TableHeaderColumn --- types/react-bootstrap-table/index.d.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/types/react-bootstrap-table/index.d.ts b/types/react-bootstrap-table/index.d.ts index 1b80e670fa..e670fa2464 100644 --- a/types/react-bootstrap-table/index.d.ts +++ b/types/react-bootstrap-table/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for react-bootstrap-table v2.6.0 // Project: https://github.com/AllenFang/react-bootstrap-table -// Definitions by: Frank Laub , Aleksander Lode +// Definitions by: Frank Laub , Aleksander Lode , Josué Us // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -581,6 +581,12 @@ export interface TableHeaderColumnProps extends Props { * Default: 1 */ colSpan?: number; + + /** + * Return the value you want to be filtered on that column. + * It's useful if your column data is an object. + */ + filterValue?: Function; } export interface Editable { type?: string;//edit type, avaiable value is textarea, select, checkbox From fda3af0b02fa78cddd809e77bfeb6fed536a2f48 Mon Sep 17 00:00:00 2001 From: rhysd Date: Tue, 29 Aug 2017 19:25:56 +0900 Subject: [PATCH 042/156] fix #19372 --- types/rc-tooltip/index.d.ts | 12 +++++------- types/rc-tooltip/rc-tooltip-tests.tsx | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/types/rc-tooltip/index.d.ts b/types/rc-tooltip/index.d.ts index c24f0018fd..20f65e3059 100644 --- a/types/rc-tooltip/index.d.ts +++ b/types/rc-tooltip/index.d.ts @@ -5,9 +5,11 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 -/// +import * as React from 'react'; -declare namespace Tooltip { +export as namespace RCTooltip; + +declare namespace RCTooltip { export type Trigger = "hover" | "click" | "focus"; export type Placement = "left" | "right" | "top" | "bottom" | @@ -34,8 +36,4 @@ declare namespace Tooltip { } } -declare class Tooltip extends React.Component {} - -declare module "rc-tooltip" { - export = Tooltip -} +export default class Tooltip extends React.Component {} diff --git a/types/rc-tooltip/rc-tooltip-tests.tsx b/types/rc-tooltip/rc-tooltip-tests.tsx index 832a292e97..25eedad8eb 100644 --- a/types/rc-tooltip/rc-tooltip-tests.tsx +++ b/types/rc-tooltip/rc-tooltip-tests.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; import * as ReactDOM from 'react-dom'; -import * as Tooltip from 'rc-tooltip'; +import Tooltip from 'rc-tooltip'; ReactDOM.render( tooltip}> From 891ea85b105bbbc2fe428d36caed8e6e62becd75 Mon Sep 17 00:00:00 2001 From: rhysd Date: Tue, 29 Aug 2017 19:31:54 +0900 Subject: [PATCH 043/156] add tests for RCTooltip namespace --- types/rc-tooltip/rc-tooltip-tests.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/types/rc-tooltip/rc-tooltip-tests.tsx b/types/rc-tooltip/rc-tooltip-tests.tsx index 25eedad8eb..06b230a55b 100644 --- a/types/rc-tooltip/rc-tooltip-tests.tsx +++ b/types/rc-tooltip/rc-tooltip-tests.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; import * as ReactDOM from 'react-dom'; -import Tooltip from 'rc-tooltip'; +import Tooltip, {RCTooltip} from 'rc-tooltip'; ReactDOM.render( tooltip}> @@ -50,3 +50,9 @@ ReactDOM.render( , document.querySelector('.another-app') ); + +const props: RCTooltip.Props = { + placement: "bottomRight", + trigger: ['click', 'focus'], + overlay: () => tooltip, +}; From 74f2afea077e135db74b9b1f8d65e4ff49e30fe6 Mon Sep 17 00:00:00 2001 From: Benjamin Svobodny Date: Tue, 29 Aug 2017 08:27:20 -0400 Subject: [PATCH 044/156] Add steppedLine property in ChartDataSets Add steppedLine property in ChartDataSets definition as per the documentation : http://www.chartjs.org/docs/latest/charts/line.html#stepped-line --- types/chart.js/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/chart.js/index.d.ts b/types/chart.js/index.d.ts index ec8a7c0c03..42f907b846 100644 --- a/types/chart.js/index.d.ts +++ b/types/chart.js/index.d.ts @@ -371,6 +371,7 @@ declare namespace Chart { fill?: boolean; label?: string; lineTension?: number; + steppedLine?: 'before' | 'after' | boolean; pointBorderColor?: ChartColor | ChartColor[]; pointBackgroundColor?: ChartColor | ChartColor[]; pointBorderWidth?: number | number[]; From 5677208b599570119ab8712bee1e2a9765a6b64d Mon Sep 17 00:00:00 2001 From: Frank Tan Date: Tue, 29 Aug 2017 11:28:29 -0400 Subject: [PATCH 045/156] [react-redux] Fix incorrect change in connect. Accidentally removed {} in 3rd generic position and turned this into a 3-arity version vs the original 4-arity. --- types/react-redux/react-redux-tests.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-redux/react-redux-tests.tsx b/types/react-redux/react-redux-tests.tsx index 619a25a7df..e369003434 100644 --- a/types/react-redux/react-redux-tests.tsx +++ b/types/react-redux/react-redux-tests.tsx @@ -76,7 +76,7 @@ connect( () => mapDispatchToProps )(Counter); // with extra arguments -connect( +connect( () => mapStateToProps, () => mapDispatchToProps, (s: ICounterStateProps, d: ICounterDispatchProps) => From 61409c12dfa324f923972297037d54cf54f55c9f Mon Sep 17 00:00:00 2001 From: Drew Pirrone-Brusse Date: Tue, 29 Aug 2017 12:39:23 -0400 Subject: [PATCH 046/156] Add missing Joi.string().uuid() As per the [Joi API docs](https://github.com/hapijs/joi/blob/v10.5.0/API.md#stringguid---aliases-uuid) `uuid()` is an alias for `guid()`, so this is essentially a one-liner. --- types/joi/index.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/types/joi/index.d.ts b/types/joi/index.d.ts index 0772c82fbe..4ae81db885 100644 --- a/types/joi/index.d.ts +++ b/types/joi/index.d.ts @@ -519,6 +519,11 @@ export interface StringSchema extends AnySchema { * Requires the string value to be a valid GUID. */ guid(options?: GuidOptions): StringSchema; + + /** + * Alias for `guid` -- Requires the string value to be a valid GUID + */ + uuid(options?: GuidOptions): StringSchema; /** * Requires the string value to be a valid hexadecimal string. From 4220dd986878a2b450fa15a8196f40b11482b90e Mon Sep 17 00:00:00 2001 From: Simon Fridlund Date: Tue, 29 Aug 2017 18:20:22 +0200 Subject: [PATCH 047/156] flux-standard-action: Update AnyMeta and TypedMeta `meta` is optional according to the specification. --- types/flux-standard-action/index.d.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/types/flux-standard-action/index.d.ts b/types/flux-standard-action/index.d.ts index 388132bea6..ce328e9be8 100644 --- a/types/flux-standard-action/index.d.ts +++ b/types/flux-standard-action/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for flux-standard-action 0.5.0 // Project: https://github.com/acdlite/flux-standard-action // Definitions by: Qubo +// Simon Fridlund // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -16,12 +17,12 @@ export interface Action { /** Usage: `var action: Action & AnyMeta;` */ export interface AnyMeta { - meta: any + meta?: any; } /** Usage: `var action: Action & TypedMeta;` */ export interface TypedMeta { - meta: T + meta?: T; } export declare function isFSA(action: any): action is Action; From f43d588a4a194b9325cad4ae99228f4e71006f7a Mon Sep 17 00:00:00 2001 From: Juan Carlos Paucar Date: Tue, 29 Aug 2017 13:19:31 -0500 Subject: [PATCH 048/156] Include subQuery for sequelize version 3 as well --- types/sequelize/v3/index.d.ts | 5 +++++ types/sequelize/v3/sequelize-tests.ts | 1 + 2 files changed, 6 insertions(+) diff --git a/types/sequelize/v3/index.d.ts b/types/sequelize/v3/index.d.ts index bb9511c5ed..c0372c6b66 100644 --- a/types/sequelize/v3/index.d.ts +++ b/types/sequelize/v3/index.d.ts @@ -3221,6 +3221,11 @@ declare namespace sequelize { * Apply DISTINCT(col) for FindAndCount(all) */ distinct?: boolean; + + /** + * Prevents a subquery on the main table when using include + */ + subQuery?: boolean; } /** diff --git a/types/sequelize/v3/sequelize-tests.ts b/types/sequelize/v3/sequelize-tests.ts index 3f1ef022bb..4a3ba51753 100644 --- a/types/sequelize/v3/sequelize-tests.ts +++ b/types/sequelize/v3/sequelize-tests.ts @@ -896,6 +896,7 @@ User.findAll( { attributes: [[s.fn('count', Sequelize.col('*')), 'count']] }); User.findAll( { attributes: [[s.fn('count', Sequelize.col('*')), 'count']], group: ['sex'] }); User.findAll( { attributes: [s.cast(s.fn('count', Sequelize.col('*')), 'INTEGER')] }); User.findAll( { attributes: [[s.cast(s.fn('count', Sequelize.col('*')), 'INTEGER'), 'count']] }); +User.findAll( { subQuery: false, include : [User], order : [['id', 'ASC NULLS LAST']] } ); User.findById( 'a string' ); From 0ced620e8a08607e91696aba961ada9445d11e58 Mon Sep 17 00:00:00 2001 From: Austin Martin Date: Tue, 29 Aug 2017 13:24:38 -0500 Subject: [PATCH 049/156] Add mat4.getScaling function declaration. --- types/gl-matrix/gl-matrix-tests.ts | 10 ++++++---- types/gl-matrix/index.d.ts | 12 ++++++++++++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/types/gl-matrix/gl-matrix-tests.ts b/types/gl-matrix/gl-matrix-tests.ts index 3642cca521..3a9c3175c8 100644 --- a/types/gl-matrix/gl-matrix-tests.ts +++ b/types/gl-matrix/gl-matrix-tests.ts @@ -294,8 +294,9 @@ outMat4 = mat4.fromXRotation(outMat4, Math.PI); outMat4 = mat4.fromYRotation(outMat4, Math.PI); outMat4 = mat4.fromZRotation(outMat4, Math.PI); outMat4 = mat4.fromRotationTranslation(outMat4, quatA, vec3A); -outVec3 = mat4.getTranslation(outVec3, mat4A) -outQuat = mat4.getRotation(outQuat, mat4A) +outVec3 = mat4.getTranslation(outVec3, mat4A); +outVec3 = mat4.getScaling(outVec3, mat4A); +outQuat = mat4.getRotation(outQuat, mat4A); outMat4 = mat4.fromRotationTranslationScale(outMat4, quatA, vec3A, vec3B); outMat4 = mat4.fromRotationTranslationScaleOrigin(outMat4, quatA, vec3A, vec3B, vec3A); outMat4 = mat4.fromQuat(outMat4, quatB); @@ -643,8 +644,9 @@ outMat4 = _mat4.fromXRotation(outMat4, Math.PI); outMat4 = _mat4.fromYRotation(outMat4, Math.PI); outMat4 = _mat4.fromZRotation(outMat4, Math.PI); outMat4 = _mat4.fromRotationTranslation(outMat4, quatA, vec3A); -outVec3 = _mat4.getTranslation(outVec3, mat4A) -outQuat = _mat4.getRotation(outQuat, mat4A) +outVec3 = _mat4.getTranslation(outVec3, mat4A); +outVec3 = _mat4.getScaling(outVec3, mat4A); +outQuat = _mat4.getRotation(outQuat, mat4A); outMat4 = _mat4.fromRotationTranslationScale(outMat4, quatA, vec3A, vec3B); outMat4 = _mat4.fromRotationTranslationScaleOrigin(outMat4, quatA, vec3A, vec3B, vec3A); outMat4 = _mat4.fromQuat(outMat4, quatB); diff --git a/types/gl-matrix/index.d.ts b/types/gl-matrix/index.d.ts index 89f28934b8..1e6d310ed6 100644 --- a/types/gl-matrix/index.d.ts +++ b/types/gl-matrix/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for gl-matrix 2.2.2 // Project: https://github.com/toji/gl-matrix // Definitions by: Mattijs Kneppers , based on definitions by Tat +// Austin Martin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare module 'gl-matrix' { @@ -2450,6 +2451,17 @@ declare module 'gl-matrix' { */ public static getTranslation(out: vec3, mat: mat4): vec3; + /** + * Returns the scaling factor component of a transformation matrix. + * If a matrix is built with fromRotationTranslationScale with a + * normalized Quaternion parameter, the returned vector will be + * the same as the scaling vector originally supplied. + * @param {vec3} out Vector to receive scaling factor component + * @param {mat4} mat Matrix to be decomposed (input) + * @return {vec3} out + */ + public static getScaling(out: vec3, mat: mat4): vec3; + /** * Returns a quaternion representing the rotational component * of a transformation matrix. If a matrix is built with From 0509463266acfcf4fee13349fb9eb97179c5ef53 Mon Sep 17 00:00:00 2001 From: Ivan Goncharov Date: Tue, 22 Aug 2017 16:59:46 +0300 Subject: [PATCH 050/156] Add "getDirectiveValues" --- types/graphql/UNUSED_FILES.txt | 1 - types/graphql/execution/index.d.ts | 2 ++ types/graphql/execution/values.d.ts | 13 +++++++++++++ types/graphql/index.d.ts | 3 ++- 4 files changed, 17 insertions(+), 2 deletions(-) delete mode 100644 types/graphql/UNUSED_FILES.txt diff --git a/types/graphql/UNUSED_FILES.txt b/types/graphql/UNUSED_FILES.txt deleted file mode 100644 index df0fadfe79..0000000000 --- a/types/graphql/UNUSED_FILES.txt +++ /dev/null @@ -1 +0,0 @@ -execution/values.d.ts \ No newline at end of file diff --git a/types/graphql/execution/index.d.ts b/types/graphql/execution/index.d.ts index be3038be95..82d6bce853 100644 --- a/types/graphql/execution/index.d.ts +++ b/types/graphql/execution/index.d.ts @@ -4,3 +4,5 @@ export { responsePathAsArray, ExecutionResult } from './execute'; + +export { getDirectiveValues } from './values'; diff --git a/types/graphql/execution/values.d.ts b/types/graphql/execution/values.d.ts index 3f6e909ed7..79a0176f8d 100644 --- a/types/graphql/execution/values.d.ts +++ b/types/graphql/execution/values.d.ts @@ -23,3 +23,16 @@ export function getArgumentValues( node: FieldNode | DirectiveNode, variableValues?: { [key: string]: any } ): { [key: string]: any }; + +/** + * Prepares an object map of argument values given a directive definition + * and a AST node which may contain directives. Optionally also accepts a map + * of variable values. + * + * If the directive does not exist on the node, returns undefined. + */ +export function getDirectiveValues( + directiveDef: GraphQLDirective, + node: { directives?: Array }, + variableValues?: { [key: string]: any } +): void | { [key: string]: any }; diff --git a/types/graphql/index.d.ts b/types/graphql/index.d.ts index ee1a95c059..e85060bab5 100644 --- a/types/graphql/index.d.ts +++ b/types/graphql/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for graphql 0.10 +// Type definitions for graphql 0.11 // Project: https://www.npmjs.com/package/graphql // Definitions by: TonyYang // Caleb Meredith @@ -28,6 +28,7 @@ export { execute, defaultFieldResolver, responsePathAsArray, + getDirectiveValues, ExecutionResult, } from './execution'; From c7fbc7fe1456f01d5ec8cb34eb81e4e0a3ada235 Mon Sep 17 00:00:00 2001 From: Chet Husk Date: Tue, 29 Aug 2017 16:58:15 -0500 Subject: [PATCH 051/156] querying and update enhancements --- types/jsforce/connection.d.ts | 20 +++++++++++++------- types/jsforce/query.d.ts | 10 ++++++++-- types/jsforce/record-result.d.ts | 14 ++++++++++---- types/jsforce/salesforce-object.d.ts | 3 ++- 4 files changed, 33 insertions(+), 14 deletions(-) diff --git a/types/jsforce/connection.d.ts b/types/jsforce/connection.d.ts index 612bf6fc84..859b6dbdb2 100644 --- a/types/jsforce/connection.d.ts +++ b/types/jsforce/connection.d.ts @@ -1,21 +1,26 @@ import { SObjectCreateOptions } from './create-options'; import { DescribeSObjectResult } from './describe-result'; -import { Query } from './query'; +import { Query, QueryResult } from './query'; import { RecordResult } from './record-result'; import { SObject } from './salesforce-object'; -export interface ConnectionOptions { +// These are pulled out because according to http://jsforce.github.io/jsforce/doc/connection.js.html#line49 +//the oauth options can either be in the `oauth2` proeprty OR spread across the main connection +interface OAuth2Options { + clientId: string; + clientSecret: string; + loginUrl: string; + redirectUri?: string; +} + +export interface ConnectionOptions extends Partial { accessToken?: string; callOptions?: Object; instanceUrl?: string; loginUrl?: string; logLevel?: string; maxRequest?: number; - oauth2?: { - clientId: string, - clientSecret: string, - redirectUri?: string, - }; + oauth2?: OAuth2Options; proxyUrl?: string; redirectUri?: string; refreshToken?: string; @@ -37,6 +42,7 @@ export class Connection { constructor(params: ConnectionOptions) accessToken: string; + query(soql: string, callback?: (err: Error, result: QueryResult) => void): QueryResult; sobject(resource: string): SObject; login(user: string, password: string, callback?: (err: Error, res: UserInfo) => void): Promise; loginByOAuth2(user: string, password: string, callback?: (err: Error, res: UserInfo) => void): Promise; diff --git a/types/jsforce/query.d.ts b/types/jsforce/query.d.ts index 42d258a48d..00b90a9464 100644 --- a/types/jsforce/query.d.ts +++ b/types/jsforce/query.d.ts @@ -7,7 +7,14 @@ export interface ExecuteOptions { scanAll?: number; } -export class Query { +export interface QueryResult { + done: boolean; + nextRecordsUrl?: string; + totalSize: number; + records: T[]; +} + +export class Query extends Promise { end(): Query; filter(filter: Object): Query; include(include: string): Query; @@ -27,7 +34,6 @@ export class Query { map(callback: (currentValue: Object) => void): Promise; scanAll(value: boolean): Query; select(fields: Object | string[] | string): Query; - then(onSuccess?: Function, onRejected?: Function): Promise; thenCall(callback?: (err: Error, records: T) => void): Query; toSOQL(callback: (err: Error, soql: string) => void): Promise; update(mapping: any, type: string, callback: (err: Error, records: RecordResult[]) => void): Promise; diff --git a/types/jsforce/record-result.d.ts b/types/jsforce/record-result.d.ts index bf53a5bf98..df77ef26d3 100644 --- a/types/jsforce/record-result.d.ts +++ b/types/jsforce/record-result.d.ts @@ -1,7 +1,13 @@ import { SalesforceId } from './salesforce-id'; -export interface RecordResult { - id: SalesforceId; - success: boolean; - anys: Object[]; +interface ErrorResult { + errors: string[]; + success: false; } + +interface SuccessResult { + id: SalesforceId; + success: true; +} + +export type RecordResult = SuccessResult | ErrorResult; diff --git a/types/jsforce/salesforce-object.d.ts b/types/jsforce/salesforce-object.d.ts index 31da3a2c92..2fd097b709 100644 --- a/types/jsforce/salesforce-object.d.ts +++ b/types/jsforce/salesforce-object.d.ts @@ -10,7 +10,8 @@ import { SalesforceId } from './salesforce-id'; export class SObject { record(options: any, callback?: (err: Error, ret: any) => void): void; - update(options: SObjectCreateOptions, callback?: (err: Error, ret: any) => void): void; + update(record: Partial, options?: Object, callback?: (err: Error, ret: RecordResult) => void): Promise; + update(records: Partial[], options?: Object, callback?: (err: Error, ret: RecordResult[]) => void): Promise; retrieve(ids: string | string[], callback?: (err: Error, ret: Record | Record[]) => void): Promise; retrieve(ids: string | string[], options?: Object, callback?: (err: Error, ret: Record | Record[]) => void): Promise; upsert(records: Record | Record[], extIdField: SalesforceId, options?: Object, callback?: (err: Error, ret: RecordResult) => void): Promise; From ce91cdc545bc27fdf17269eb56f217543d44c8a5 Mon Sep 17 00:00:00 2001 From: Jack Sun Date: Tue, 29 Aug 2017 16:45:21 -0700 Subject: [PATCH 052/156] [deepmerge] Allow partial types in deepmerge Sometimes deepmerge is used for overwriting only a few properties in a larger object. Allowing partial types lets users deepmerge without having to typecast in those cases. In addition, also updated the typings for arrayMerge to indicate that it will be operating on two arrays. --- types/deepmerge/deepmerge-tests.ts | 12 +++++++++++- types/deepmerge/index.d.ts | 10 ++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/types/deepmerge/deepmerge-tests.ts b/types/deepmerge/deepmerge-tests.ts index 5467cb83f0..8e1ab07828 100644 --- a/types/deepmerge/deepmerge-tests.ts +++ b/types/deepmerge/deepmerge-tests.ts @@ -16,4 +16,14 @@ const expected = { quux: 5 }; -const result = deepmerge(x, y); +const result = deepmerge(x, y); +const anyResult = deepmerge(x, y); + +function reverseConcat(dest: number[], src: number[]) { + return src.concat(dest); +} + +const withOptions = deepmerge(x, y, { + clone: false, + arrayMerge: reverseConcat +}); diff --git a/types/deepmerge/index.d.ts b/types/deepmerge/index.d.ts index 96d0412aa6..5b5e3806bd 100644 --- a/types/deepmerge/index.d.ts +++ b/types/deepmerge/index.d.ts @@ -1,17 +1,19 @@ // Type definitions for deepmerge 1.3 // Project: https://github.com/KyleAMathews/deepmerge // Definitions by: marvinscharle +// syy1125 // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export = deepmerge; -declare function deepmerge(x: T, y: T, options?: deepmerge.Options): T; +declare function deepmerge(x: Partial, y: Partial, options?: deepmerge.Options): T; +declare function deepmerge(x: T1, y: T2, options?: deepmerge.Options): T1 & T2; declare namespace deepmerge { - interface Options { + interface Options { clone?: boolean; - arrayMerge?(destination: T, source: T, options?: Options): T; + arrayMerge?(destination: any[], source: any[], options?: Options): any[]; } - function all(objects: T[], options?: Options): T; + function all(objects: Array>, options?: Options): T; } From 771016d704db347f2df23d79ea3dbe65128f8633 Mon Sep 17 00:00:00 2001 From: Jack Sun Date: Tue, 29 Aug 2017 16:45:21 -0700 Subject: [PATCH 053/156] [deepmerge] Allow partial types in deepmerge Sometimes deepmerge is used for overwriting only a few properties in a larger object. Allowing partial types lets users deepmerge without having to typecast in those cases. In addition, also updated the typings for arrayMerge to indicate that it will be operating on two arrays. --- types/deepmerge/deepmerge-tests.ts | 28 +++++++++++++++++++--------- types/deepmerge/index.d.ts | 10 ++++++---- 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/types/deepmerge/deepmerge-tests.ts b/types/deepmerge/deepmerge-tests.ts index 5467cb83f0..dcd21ff3c3 100644 --- a/types/deepmerge/deepmerge-tests.ts +++ b/types/deepmerge/deepmerge-tests.ts @@ -1,19 +1,29 @@ import * as deepmerge from "deepmerge"; const x = { - foo: { bar: 3 }, - array: [{ does: 'work', too: [1, 2, 3] }] + foo: { bar: 3 }, + array: [{ does: 'work', too: [1, 2, 3] }] }; const y = { - foo: { baz: 4 }, - quux: 5, - array: [{ does: 'work', too: [4, 5, 6] }, { really: 'yes' }] + foo: { baz: 4 }, + quux: 5, + array: [{ does: 'work', too: [4, 5, 6] }, { really: 'yes' }] }; const expected = { - foo: { bar: 3, baz: 4 }, - array: [{ does: 'work', too: [1, 2, 3, 4, 5, 6] }, { really: 'yes' }], - quux: 5 + foo: { bar: 3, baz: 4 }, + array: [{ does: 'work', too: [1, 2, 3, 4, 5, 6] }, { really: 'yes' }], + quux: 5 }; -const result = deepmerge(x, y); +const result = deepmerge(x, y); +const anyResult = deepmerge(x, y); + +function reverseConcat(dest: number[], src: number[]) { + return src.concat(dest); +} + +const withOptions = deepmerge(x, y, { + clone: false, + arrayMerge: reverseConcat +}); diff --git a/types/deepmerge/index.d.ts b/types/deepmerge/index.d.ts index 96d0412aa6..5b5e3806bd 100644 --- a/types/deepmerge/index.d.ts +++ b/types/deepmerge/index.d.ts @@ -1,17 +1,19 @@ // Type definitions for deepmerge 1.3 // Project: https://github.com/KyleAMathews/deepmerge // Definitions by: marvinscharle +// syy1125 // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export = deepmerge; -declare function deepmerge(x: T, y: T, options?: deepmerge.Options): T; +declare function deepmerge(x: Partial, y: Partial, options?: deepmerge.Options): T; +declare function deepmerge(x: T1, y: T2, options?: deepmerge.Options): T1 & T2; declare namespace deepmerge { - interface Options { + interface Options { clone?: boolean; - arrayMerge?(destination: T, source: T, options?: Options): T; + arrayMerge?(destination: any[], source: any[], options?: Options): any[]; } - function all(objects: T[], options?: Options): T; + function all(objects: Array>, options?: Options): T; } From b04d8872dcc988e128b9c1b804a3237c26bf4e9e Mon Sep 17 00:00:00 2001 From: Jack Sun Date: Tue, 29 Aug 2017 16:57:22 -0700 Subject: [PATCH 054/156] Using TypeScript 2.1 The Partial type was only added in TS v2.1 --- types/deepmerge/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/deepmerge/index.d.ts b/types/deepmerge/index.d.ts index 5b5e3806bd..797e52c8a5 100644 --- a/types/deepmerge/index.d.ts +++ b/types/deepmerge/index.d.ts @@ -3,6 +3,7 @@ // Definitions by: marvinscharle // syy1125 // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 export = deepmerge; From 680fc0b398a87fa7d19cb377a0decd9665a55982 Mon Sep 17 00:00:00 2001 From: Matt Bishop Date: Tue, 29 Aug 2017 18:23:16 -0700 Subject: [PATCH 055/156] Added fix from https://github.com/DefinitelyTyped/DefinitelyTyped/pull/19382 --- types/chai-as-promised/chai-as-promised-tests.ts | 1 + types/chai-as-promised/index.d.ts | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/types/chai-as-promised/chai-as-promised-tests.ts b/types/chai-as-promised/chai-as-promised-tests.ts index 7e422521aa..2157f0cc3c 100644 --- a/types/chai-as-promised/chai-as-promised-tests.ts +++ b/types/chai-as-promised/chai-as-promised-tests.ts @@ -26,6 +26,7 @@ thenableNum = chai.expect(thenableNum).to.notify(() => console.log('done')); // BDD API (should) thenableNum = thenableNum.should.be.fulfilled; thenableNum = thenableNum.should.eventually.deep.equal(3); +thenableNum = thenableNum.should.eventually.become(3); thenableNum = thenableNum.should.become(3); thenableNum = thenableNum.should.be.rejected; thenableNum = thenableNum.should.be.rejectedWith(Error); diff --git a/types/chai-as-promised/index.d.ts b/types/chai-as-promised/index.d.ts index bd67bf90cd..459758aa55 100644 --- a/types/chai-as-promised/index.d.ts +++ b/types/chai-as-promised/index.d.ts @@ -3,6 +3,7 @@ // Definitions by: jt000 , // Yuki Kokubun , // Leonard Thieu , +// Mike Lazer-Walker , // Matt Bishop // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -28,14 +29,14 @@ declare namespace Chai { become(expected: any): PromisedAssertion; fulfilled: PromisedAssertion; rejected: PromisedAssertion; - rejectedWith(expected: any, message?: string | RegExp): PromisedAssertion; + rejectedWith: PromisedThrow; notify(fn: Function): PromisedAssertion; } // Eventually does not have .then(), but PromisedAssertion have. interface Eventually extends PromisedLanguageChains, PromisedNumericComparison, PromisedTypeComparison { // From chai-as-promised - become(expected: PromiseLike): PromisedAssertion; + become(expected: any): PromisedAssertion; fulfilled: PromisedAssertion; rejected: PromisedAssertion; rejectedWith: PromisedThrow; From adcf24f32d70efed4ab820adadd454575d09de20 Mon Sep 17 00:00:00 2001 From: Leo Liang Date: Wed, 30 Aug 2017 10:55:55 +0800 Subject: [PATCH 056/156] Add connectionString property to the config object --- types/pg/index.d.ts | 1 + types/pg/pg-tests.ts | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/types/pg/index.d.ts b/types/pg/index.d.ts index 1383dc2a22..ec5b929aa4 100644 --- a/types/pg/index.d.ts +++ b/types/pg/index.d.ts @@ -15,6 +15,7 @@ export interface ConnectionConfig { password?: string; port?: number; host?: string; + connectionString?: string; } export interface Defaults extends ConnectionConfig { diff --git a/types/pg/pg-tests.ts b/types/pg/pg-tests.ts index bc1bfd30e0..1f1e312544 100644 --- a/types/pg/pg-tests.ts +++ b/types/pg/pg-tests.ts @@ -77,6 +77,10 @@ client.end() .then(() => console.log('client has disconnected')) .catch(err => console.error('error during disconnection', err.stack)); +const poolOne = new pg.Pool({ + connectionString: 'postgresql://dbuser:secretpassword@database.server.com:3211/mydb' +}); + const pool = new pg.Pool({ host: 'localhost', port: 5432, From 8fb230373fb43e1991fb42eaca80a88120ca0a77 Mon Sep 17 00:00:00 2001 From: Daniel Fader Date: Wed, 30 Aug 2017 10:33:58 +0200 Subject: [PATCH 057/156] Extended definitions for asynchronous resolution of 'OptionsObj' in graphqlHTTP --- .../express-graphql/express-graphql-tests.ts | 26 +++++++++++++------ types/express-graphql/index.d.ts | 6 +++-- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/types/express-graphql/express-graphql-tests.ts b/types/express-graphql/express-graphql-tests.ts index 6b9c0b9169..d476682104 100644 --- a/types/express-graphql/express-graphql-tests.ts +++ b/types/express-graphql/express-graphql-tests.ts @@ -1,6 +1,6 @@ -import * as express from "express"; +import * as express from 'express'; import 'express-session'; -import * as graphqlHTTP from "express-graphql"; +import * as graphqlHTTP from 'express-graphql'; const app = express(); const schema = {}; @@ -8,19 +8,29 @@ const schema = {}; const graphqlOption: graphqlHTTP.OptionsObj = { graphiql: true, schema: schema, - formatError: (error:Error) => ({ - message: error.message, + formatError: (error: Error) => ({ + message: error.message }) }; const graphqlOptionRequest = (request: express.Request): graphqlHTTP.OptionsObj => ({ graphiql: true, schema: schema, - context: request.session, + context: request.session }); -app.use("/graphql1", graphqlHTTP(graphqlOption)); +const graphqlOptionRequestAsync = async (request: express.Request): Promise => { + return { + graphiql: true, + schema: await Promise.resolve(schema), + context: request.session + }; +}; -app.use("/graphql2", graphqlHTTP(graphqlOptionRequest)); +app.use('/graphql1', graphqlHTTP(graphqlOption)); -app.listen(8080); +app.use('/graphql2', graphqlHTTP(graphqlOptionRequest)); + +app.use('/graphqlasync', graphqlHTTP(graphqlOptionRequestAsync)); + +app.listen(8080, () => console.log('GraphQL Server running on localhost:8080')); diff --git a/types/express-graphql/index.d.ts b/types/express-graphql/index.d.ts index 680e83668b..077e3ab736 100644 --- a/types/express-graphql/index.d.ts +++ b/types/express-graphql/index.d.ts @@ -1,6 +1,8 @@ // Type definitions for express-graphql // Project: https://www.npmjs.org/package/express-graphql -// Definitions by: Isman Usoh , Nitin Tutlani +// Definitions by: Isman Usoh +// Nitin Tutlani +// Daniel Fader // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped import { Request, Response } from "express"; @@ -12,7 +14,7 @@ declare namespace graphqlHTTP { * Used to configure the graphQLHTTP middleware by providing a schema * and other configuration options. */ - export type Options = ((req: Request) => OptionsObj) | OptionsObj + export type Options = ((req: Request) => OptionsObj) | ((req: Request) => Promise) | OptionsObj export type OptionsObj = { /** * A GraphQL schema from graphql-js. From 5c5298d813703f245069ab988de78c23a43f37de Mon Sep 17 00:00:00 2001 From: Daniel Fader Date: Wed, 30 Aug 2017 10:50:51 +0200 Subject: [PATCH 058/156] Updated 'target' to 'es2015' to enable async notation --- types/express-graphql/tsconfig.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/express-graphql/tsconfig.json b/types/express-graphql/tsconfig.json index 3394d7c54a..8cec14e03c 100644 --- a/types/express-graphql/tsconfig.json +++ b/types/express-graphql/tsconfig.json @@ -1,6 +1,7 @@ { "compilerOptions": { "module": "commonjs", + "target": "es2015", "lib": [ "es6" ], @@ -19,4 +20,4 @@ "index.d.ts", "express-graphql-tests.ts" ] -} \ No newline at end of file +} From 1c389ce93d7812925dba0a05d1981c05b3ce4f1d Mon Sep 17 00:00:00 2001 From: maxpaj Date: Wed, 30 Aug 2017 15:08:07 +0200 Subject: [PATCH 059/156] fluent-ffmpeg filter functions Added alternative parameter types for the filter functions. Resources: https://github.com/fluent-ffmpeg/node-fluent-ffmpeg/search?utf8=%E2%9C%93&q=withAudioFilters&type= https://github.com/fluent-ffmpeg/node-fluent-ffmpeg/search?utf8=%E2%9C%93&q=withVideoFilters&type= --- types/fluent-ffmpeg/index.d.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/types/fluent-ffmpeg/index.d.ts b/types/fluent-ffmpeg/index.d.ts index e1380dc78e..a27277e14a 100644 --- a/types/fluent-ffmpeg/index.d.ts +++ b/types/fluent-ffmpeg/index.d.ts @@ -144,10 +144,10 @@ declare namespace Ffmpeg { audioFrequency(freq: number): FfmpegCommand; withAudioQuality(quality: number): FfmpegCommand; audioQuality(quality: number): FfmpegCommand; - withAudioFilter(filters: { filter: string, options: any }): FfmpegCommand; - withAudioFilters(filters: { filter: string, options: any }): FfmpegCommand; - audioFilter(filters: { filter: string, options: any }): FfmpegCommand; - audioFilters(filters: { filter: string, options: any }): FfmpegCommand; + withAudioFilter(filters: { filter: string, options: any } | String | String[]): FfmpegCommand; + withAudioFilters(filters: { filter: string, options: any } | String | String[]): FfmpegCommand; + audioFilter(filters: { filter: string, options: any } | String | String[]): FfmpegCommand; + audioFilters(filters: { filter: string, options: any } | String | String[]): FfmpegCommand; // options/video; withNoVideo(): FfmpegCommand; @@ -156,10 +156,10 @@ declare namespace Ffmpeg { videoCodec(codec: string): FfmpegCommand; withVideoBitrate(bitrate: string | number): FfmpegCommand; videoBitrate(bitrate: string | number): FfmpegCommand; - withVideoFilter(filters: { filter: string, options: any }): FfmpegCommand; - withVideoFilters(filters: { filter: string, options: any }): FfmpegCommand; - videoFilter(filters: { filter: string, options: any }): FfmpegCommand; - videoFilters(filters: { filter: string, options: any }): FfmpegCommand; + withVideoFilter(filters: { filter: string, options: any } | String | String[]): FfmpegCommand; + withVideoFilters(filters: { filter: string, options: any } | String | String[]): FfmpegCommand; + videoFilter(filters: { filter: string, options: any } | String | String[]): FfmpegCommand; + videoFilters(filters: { filter: string, options: any } | String | String[]): FfmpegCommand; withOutputFps(fps: number): FfmpegCommand; withOutputFPS(fps: number): FfmpegCommand; withFpsOutput(fps: number): FfmpegCommand; From e31c1ee9197a888eb58d1265a60adb5f4afae029 Mon Sep 17 00:00:00 2001 From: maxpaj Date: Wed, 30 Aug 2017 15:12:14 +0200 Subject: [PATCH 060/156] Change signature type from Object to Object[] --- types/fluent-ffmpeg/index.d.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/types/fluent-ffmpeg/index.d.ts b/types/fluent-ffmpeg/index.d.ts index a27277e14a..5d45a3d465 100644 --- a/types/fluent-ffmpeg/index.d.ts +++ b/types/fluent-ffmpeg/index.d.ts @@ -144,10 +144,10 @@ declare namespace Ffmpeg { audioFrequency(freq: number): FfmpegCommand; withAudioQuality(quality: number): FfmpegCommand; audioQuality(quality: number): FfmpegCommand; - withAudioFilter(filters: { filter: string, options: any } | String | String[]): FfmpegCommand; - withAudioFilters(filters: { filter: string, options: any } | String | String[]): FfmpegCommand; - audioFilter(filters: { filter: string, options: any } | String | String[]): FfmpegCommand; - audioFilters(filters: { filter: string, options: any } | String | String[]): FfmpegCommand; + withAudioFilter(filters: { filter: string, options: any }[] | String | String[]): FfmpegCommand; + withAudioFilters(filters: { filter: string, options: any }[] | String | String[]): FfmpegCommand; + audioFilter(filters: { filter: string, options: any }[] | String | String[]): FfmpegCommand; + audioFilters(filters: { filter: string, options: any }[] | String | String[]): FfmpegCommand; // options/video; withNoVideo(): FfmpegCommand; @@ -156,10 +156,10 @@ declare namespace Ffmpeg { videoCodec(codec: string): FfmpegCommand; withVideoBitrate(bitrate: string | number): FfmpegCommand; videoBitrate(bitrate: string | number): FfmpegCommand; - withVideoFilter(filters: { filter: string, options: any } | String | String[]): FfmpegCommand; - withVideoFilters(filters: { filter: string, options: any } | String | String[]): FfmpegCommand; - videoFilter(filters: { filter: string, options: any } | String | String[]): FfmpegCommand; - videoFilters(filters: { filter: string, options: any } | String | String[]): FfmpegCommand; + withVideoFilter(filters: { filter: string, options: any }[] | String | String[]): FfmpegCommand; + withVideoFilters(filters: { filter: string, options: any }[] | String | String[]): FfmpegCommand; + videoFilter(filters: { filter: string, options: any }[] | String | String[]): FfmpegCommand; + videoFilters(filters: { filter: string, options: any }[] | String | String[]): FfmpegCommand; withOutputFps(fps: number): FfmpegCommand; withOutputFPS(fps: number): FfmpegCommand; withFpsOutput(fps: number): FfmpegCommand; From e7e82f42fb8908216c6f5c84be5645a6cd5e881d Mon Sep 17 00:00:00 2001 From: Niklas Wulf Date: Wed, 30 Aug 2017 16:00:21 +0200 Subject: [PATCH 061/156] [nes] Fix Socket.disconnect typo --- types/nes/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/nes/index.d.ts b/types/nes/index.d.ts index aab6827ed7..c5526049de 100644 --- a/types/nes/index.d.ts +++ b/types/nes/index.d.ts @@ -91,7 +91,7 @@ declare module nes { id: string; app: Object; auth: nes.SocketAuthObject; - disconect(callback?: () => void): void; + disconnect(callback?: () => void): void; send(message: any, callback?: (err?: any) => void): void; publish(path: string, message: any, callback?: (err?: any) => void): void; revoke(path: string, message: any, callback?: (err?: any) => void): void; From bdd079afbeae2fd8b7c4e539536352b72d7d4009 Mon Sep 17 00:00:00 2001 From: Niklas Wulf Date: Wed, 30 Aug 2017 16:10:00 +0200 Subject: [PATCH 062/156] [nes] Add test/socket.ts --- types/nes/test/socket.ts | 16 ++++++++++++++++ types/nes/tsconfig.json | 3 ++- 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 types/nes/test/socket.ts diff --git a/types/nes/test/socket.ts b/types/nes/test/socket.ts new file mode 100644 index 0000000000..7f7617d462 --- /dev/null +++ b/types/nes/test/socket.ts @@ -0,0 +1,16 @@ +// from https://github.com/hapijs/nes/blob/v6.4.3/lib/socket.js + +import Nes = require('nes'); + +const socket: Nes.Socket = undefined; + +const cb = () => { }; +socket.disconnect(cb); +const s: string = socket.id; +const o: Object = socket.app; +const auth: Nes.SocketAuthObject = socket.auth; + +const cb2 = (err?: any) => { }; +socket.send('message', (err?: any) => { }); +socket.publish('path', 'message', cb2); +socket.revoke('path', 'message', cb2); diff --git a/types/nes/tsconfig.json b/types/nes/tsconfig.json index cb28129b71..c03d7c22ee 100644 --- a/types/nes/tsconfig.json +++ b/types/nes/tsconfig.json @@ -26,9 +26,10 @@ "test/route-authentication-server.ts", "test/route-invocation-client.ts", "test/route-invocation-server.ts", + "test/socket.ts", "test/subscription-filter-client.ts", "test/subscription-filter-server.ts", "test/subscriptions-client.ts", "test/subscriptions-server.ts" ] -} \ No newline at end of file +} From c2bc7792e69366f2183026aa902bcf1406189e0a Mon Sep 17 00:00:00 2001 From: Chet Husk Date: Wed, 30 Aug 2017 09:26:11 -0500 Subject: [PATCH 063/156] more cleanups and stronger typing --- types/jsforce/connection.d.ts | 33 +++++++++++++--- types/jsforce/jsforce-tests.ts | 15 +++++++- types/jsforce/record.d.ts | 16 ++++++-- types/jsforce/salesforce-object.d.ts | 56 +++++++++++++++++----------- 4 files changed, 87 insertions(+), 33 deletions(-) diff --git a/types/jsforce/connection.d.ts b/types/jsforce/connection.d.ts index 859b6dbdb2..189ce234e8 100644 --- a/types/jsforce/connection.d.ts +++ b/types/jsforce/connection.d.ts @@ -20,7 +20,7 @@ export interface ConnectionOptions extends Partial { loginUrl?: string; logLevel?: string; maxRequest?: number; - oauth2?: OAuth2Options; + oauth2?: Partial; proxyUrl?: string; redirectUri?: string; refreshToken?: string; @@ -38,12 +38,33 @@ export interface UserInfo { export type ConnectionEvent = "refresh"; -export class Connection { - constructor(params: ConnectionOptions) - - accessToken: string; +/** + * the methods exposed here are done so that a client can use 'declaration augmentation' to get intellisense on their own projects. + * for example, given a type + * + * interface Foo { + * thing: string; + * yes: boolean; + * } + * + * you can write + * + * declare module "jsforce" { + * interface Connection { + * sobject(type: 'Foo'): SObject + * } + * } + * + * to ensure that you have the correct data types for the various collection names. + */ +export interface Connection { query(soql: string, callback?: (err: Error, result: QueryResult) => void): QueryResult; - sobject(resource: string): SObject; + sobject(resource: string): SObject; +} + +export class Connection implements Connection { + constructor(params: ConnectionOptions) + accessToken: string; login(user: string, password: string, callback?: (err: Error, res: UserInfo) => void): Promise; loginByOAuth2(user: string, password: string, callback?: (err: Error, res: UserInfo) => void): Promise; loginBySoap(user: string, password: string, callback?: (err: Error, res: UserInfo) => void): Promise; diff --git a/types/jsforce/jsforce-tests.ts b/types/jsforce/jsforce-tests.ts index 3c1657711d..208dba8bc8 100644 --- a/types/jsforce/jsforce-tests.ts +++ b/types/jsforce/jsforce-tests.ts @@ -1,5 +1,11 @@ import * as sf from 'jsforce'; +export interface DummyRecord { + thing: boolean; + other: number; + person: string; +} + const salesforceConnection: sf.Connection = new sf.Connection({ instanceUrl: '', refreshToken: '', @@ -9,6 +15,11 @@ const salesforceConnection: sf.Connection = new sf.Connection({ }, }); +salesforceConnection.sobject("Dummy").select(["thing", "other"]); + +// note the following should never compile: +// salesforceConnection.sobject("Dummy").select(["lol"]); + salesforceConnection.sobject("Account").create({ Name: "Test Acc 2", BillingStreet: "Maplestory street", @@ -30,9 +41,9 @@ salesforceConnection.sobject("ContentVersion").create({ } }); -salesforceConnection.sobject("ContentVersion").retrieve("world", { +salesforceConnection.sobject("ContentVersion").retrieve("world", { test: "test" -}, (err: Error, ret: sf.Record) => { +}, (err: Error, ret) => { if (err) { return; } diff --git a/types/jsforce/record.d.ts b/types/jsforce/record.d.ts index 3bfec4c65b..3dd0bca1da 100644 --- a/types/jsforce/record.d.ts +++ b/types/jsforce/record.d.ts @@ -1,6 +1,16 @@ +import { RecordResult } from './record-result'; +import { Connection } from './connection'; import { SalesforceId } from './salesforce-id'; +import { Stream } from 'stream'; -export interface Record { - Id: SalesforceId; - attributes: Object[]; +export class RecordReference { + constructor(conn: Connection, type: string, id: SalesforceId); + blob(fieldName: string): Stream; + del(options?: Object, callback?: (err: Error, result: RecordResult) => void): Promise; + delete(options?: Object, callback?: (err: Error, result: RecordResult) => void): Promise; + destroy(options?: Object, callback?: (err: Error, result: RecordResult) => void): Promise; + retrieve(options?: Object, callback?: (err: Error, record: Record) => void): Promise>; + update(record: Partial, options?: Object, callback?: (err: Error, result: RecordResult) => void): Promise; } + +export type Record = {Id: SalesforceId } & T; diff --git a/types/jsforce/salesforce-object.d.ts b/types/jsforce/salesforce-object.d.ts index 2fd097b709..c1f8f61207 100644 --- a/types/jsforce/salesforce-object.d.ts +++ b/types/jsforce/salesforce-object.d.ts @@ -3,19 +3,20 @@ import * as stream from 'stream'; import { SObjectCreateOptions } from './create-options'; import { DescribeSObjectResult } from './describe-result'; import { Query } from './query'; -import { Record } from './record'; +import { Record, RecordReference } from './record'; import { RecordResult } from './record-result'; import { Connection } from './connection'; import { SalesforceId } from './salesforce-id'; -export class SObject { - record(options: any, callback?: (err: Error, ret: any) => void): void; - update(record: Partial, options?: Object, callback?: (err: Error, ret: RecordResult) => void): Promise; - update(records: Partial[], options?: Object, callback?: (err: Error, ret: RecordResult[]) => void): Promise; - retrieve(ids: string | string[], callback?: (err: Error, ret: Record | Record[]) => void): Promise; - retrieve(ids: string | string[], options?: Object, callback?: (err: Error, ret: Record | Record[]) => void): Promise; - upsert(records: Record | Record[], extIdField: SalesforceId, options?: Object, callback?: (err: Error, ret: RecordResult) => void): Promise; - upsertBulk(input?: Record[] | stream.Stream | string, callback?: (err: Error, ret: RecordResult) => void): Batch; +export class SObject { + record(id: SalesforceId): RecordReference; + retrieve(id: SalesforceId, options?: Object, callback?:(err: Error, record: Record) => void): Promise>; + retrieve(ids: SalesforceId[], options?: Object, callback?: (err: Error, ret: Record[]) => void): Promise[]>; + update(record: Partial, options?: Object, callback?: (err: Error, ret: RecordResult) => void): Promise; + update(records: Partial[], options?: Object, callback?: (err: Error, ret: RecordResult[]) => void): Promise; + upsert(records: Record, extIdField: SalesforceId, options?: Object, callback?: (err: Error, ret: RecordResult) => void): Promise; + upsert(records: Record[], extIdField: SalesforceId, options?: Object, callback?: (err: Error, ret: RecordResult) => void): Promise; + upsertBulk(input?: Record[] | stream.Stream | string, callback?: (err: Error, ret: RecordResult[] | BatchResultInfo[]) => void): Batch; describeGlobal(callback: (err: Error, res: any) => void): void; describe$(callback: (err: Error, ret: DescribeSObjectResult) => void): void; describeGlobal$(callback: (err: Error, res: any) => void): void; @@ -29,39 +30,37 @@ export class SObject { findOne(query?: any, fields?: Object | string[] | string, options?: Object, callback?: (err: Error, ret: T) => void): void; approvalLayouts(callback?: (layoutInfo: ApprovalLayoutInfo) => void): Promise; - bulkload(operation: string, options?: { extIdField?: string }, input?: Record[] | stream.Stream[] | string[], callback?: (err: Error, ret: RecordResult) => void): Batch; + bulkload(operation: string, options?: { extIdField?: string }, input?: Record[] | stream.Stream[] | string[], callback?: (err: Error, ret: RecordResult) => void): Batch; compactLayouts(callback?: CompactLayoutInfo): Promise; count(conditions?: Object | string, callback?: (err: Error, num: number) => void): Promise; create(options: any | any[], callback?: (err: Error, ret: RecordResult | RecordResult[]) => void): Promise; - createBulk(input?: Record[] | stream.Stream | string, callback?: (err: Error, ret: RecordResult) => void): Batch; + createBulk(input?: Record[] | stream.Stream | string, callback?: (err: Error, ret: RecordResult) => void): Batch; del(ids: string | string[], callback?: (err: Error, ret: any) => void): void; destroy(ids: string | string[], callback?: (err: Error, ret: any) => void): void; delete(ids: string | string[], callback?: (err: Error, ret: any) => void): void; - deleteBulk(input?: Record[] | stream.Stream | string, callback?: (err: Error, ret: RecordResult) => void): Batch; - destroyBulk(input?: Record[] | stream.Stream | string, callback?: (err: Error, ret: RecordResult) => void): Batch; - destroyHardBulk(input?: Record[] | stream.Stream | string, callback?: (err: Error, ret: RecordResult) => void): Batch; + deleteBulk(input?: Record[] | stream.Stream | string, callback?: (err: Error, ret: RecordResult) => void): Batch; + destroyBulk(input?: Record[] | stream.Stream | string, callback?: (err: Error, ret: RecordResult) => void): Batch; + destroyHardBulk(input?: Record[] | stream.Stream | string, callback?: (err: Error, ret: RecordResult) => void): Batch; deleted(start: Date | string, end: Date | string, callback?: (info: DeletedRecordsInfo) => void): Promise; - deleteHardBulk(input?: Record[] | stream.Stream | string, callback?: (err: Error, ret: RecordResult) => void): Batch; + deleteHardBulk(input?: Record[] | stream.Stream | string, callback?: (err: Error, ret: RecordResult) => void): Batch; describe(callback?: (err: Error, ret: DescribeSObjectResult) => void): Promise; insert(options: any | any[], callback?: (err: Error, ret: RecordResult | RecordResult[]) => void): Promise; - insertBulk(input?: Record[] | stream.Stream | string, callback?: (err: Error, ret: RecordResult) => void): Batch; + insertBulk(input?: Record[] | stream.Stream | string, callback?: (err: Error, ret: RecordResult) => void): Batch; layouts(layoutName?: string, callback?: (err: Error, info: LayoutInfo) => void): Promise; listview(id: string): ListView; listviews(callback?: (err: Error, info: ListViewsInfo) => void): Promise; quickAction(actionName: string): QuickAction; quickActions(callback?: (err: Error, info: any) => void): Promise; recent(callback?: (err: Error, ret: RecordResult) => void): Promise; - select(field?: Object | string[] | string, callback?: (err: Error, ret: T[]) => void): Query; + select(callback?: (err: Error, ret: T[]) => void): Promise; + //TODO:use a typed pluck to turn `fields` into a subset of T's fields so that the output is slimmed down appropriately + select(fields?: (keyof T)[] | (keyof T), callback?: (err: Error, ret: Partial[]) => void): Promise[]>; } export interface ApprovalLayoutInfo { approvalLayouts: Object[]; } -export class Record extends Object { - constructor(connection: Connection, type: SObject, id: SalesforceId) -} - export class Batch extends stream.Writable { } @@ -86,7 +85,20 @@ export interface LayoutInfo { } export class ListView { - constructor(connection: Connection, type: SObject, id: SalesforceId) + constructor(connection: Connection, type: string, id: SalesforceId) +} + +export interface BatchInfo { + id: string; + jobId: string; + state: string; + stateMessage: string; +} + +export interface BatchResultInfo { + id: string; + batchId: string; + jobId: string; } export class ListViewsInfo { } From b2098c51a10dcee9784592dba294e6887209fc66 Mon Sep 17 00:00:00 2001 From: Chet Husk Date: Wed, 30 Aug 2017 09:40:22 -0500 Subject: [PATCH 064/156] fix linting --- types/jsforce/connection.d.ts | 12 ++++++------ types/jsforce/index.d.ts | 1 + types/jsforce/salesforce-object.d.ts | 28 ++++++++++++++-------------- 3 files changed, 21 insertions(+), 20 deletions(-) diff --git a/types/jsforce/connection.d.ts b/types/jsforce/connection.d.ts index 189ce234e8..aa32d43ff5 100644 --- a/types/jsforce/connection.d.ts +++ b/types/jsforce/connection.d.ts @@ -5,15 +5,15 @@ import { RecordResult } from './record-result'; import { SObject } from './salesforce-object'; // These are pulled out because according to http://jsforce.github.io/jsforce/doc/connection.js.html#line49 -//the oauth options can either be in the `oauth2` proeprty OR spread across the main connection -interface OAuth2Options { - clientId: string; - clientSecret: string; - loginUrl: string; +// the oauth options can either be in the `oauth2` proeprty OR spread across the main connection +export interface OAuth2Options { + clientId?: string; + clientSecret?: string; + loginUrl?: string; redirectUri?: string; } -export interface ConnectionOptions extends Partial { +export interface ConnectionOptions extends OAuth2Options { accessToken?: string; callOptions?: Object; instanceUrl?: string; diff --git a/types/jsforce/index.d.ts b/types/jsforce/index.d.ts index fc7bd017b2..c7d39c9499 100644 --- a/types/jsforce/index.d.ts +++ b/types/jsforce/index.d.ts @@ -3,6 +3,7 @@ // Definitions by: Dolan Miu // Kamil Ejsymont // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import * as fs from 'fs'; import * as stream from 'stream'; diff --git a/types/jsforce/salesforce-object.d.ts b/types/jsforce/salesforce-object.d.ts index c1f8f61207..2f1f1590bf 100644 --- a/types/jsforce/salesforce-object.d.ts +++ b/types/jsforce/salesforce-object.d.ts @@ -10,13 +10,13 @@ import { SalesforceId } from './salesforce-id'; export class SObject { record(id: SalesforceId): RecordReference; - retrieve(id: SalesforceId, options?: Object, callback?:(err: Error, record: Record) => void): Promise>; - retrieve(ids: SalesforceId[], options?: Object, callback?: (err: Error, ret: Record[]) => void): Promise[]>; + retrieve(id: SalesforceId, options?: Object, callback?: (err: Error, record: Record) => void): Promise>; + retrieve(ids: SalesforceId[], options?: Object, callback?: (err: Error, ret: Array>) => void): Promise>>; update(record: Partial, options?: Object, callback?: (err: Error, ret: RecordResult) => void): Promise; - update(records: Partial[], options?: Object, callback?: (err: Error, ret: RecordResult[]) => void): Promise; + update(records: Array>, options?: Object, callback?: (err: Error, ret: RecordResult[]) => void): Promise; upsert(records: Record, extIdField: SalesforceId, options?: Object, callback?: (err: Error, ret: RecordResult) => void): Promise; - upsert(records: Record[], extIdField: SalesforceId, options?: Object, callback?: (err: Error, ret: RecordResult) => void): Promise; - upsertBulk(input?: Record[] | stream.Stream | string, callback?: (err: Error, ret: RecordResult[] | BatchResultInfo[]) => void): Batch; + upsert(records: Array>, extIdField: SalesforceId, options?: Object, callback?: (err: Error, ret: RecordResult[]) => void): Promise; + upsertBulk(input?: Array> | stream.Stream | string, callback?: (err: Error, ret: RecordResult[] | BatchResultInfo[]) => void): Batch; describeGlobal(callback: (err: Error, res: any) => void): void; describe$(callback: (err: Error, ret: DescribeSObjectResult) => void): void; describeGlobal$(callback: (err: Error, res: any) => void): void; @@ -30,22 +30,22 @@ export class SObject { findOne(query?: any, fields?: Object | string[] | string, options?: Object, callback?: (err: Error, ret: T) => void): void; approvalLayouts(callback?: (layoutInfo: ApprovalLayoutInfo) => void): Promise; - bulkload(operation: string, options?: { extIdField?: string }, input?: Record[] | stream.Stream[] | string[], callback?: (err: Error, ret: RecordResult) => void): Batch; + bulkload(operation: string, options?: { extIdField?: string }, input?: Array> | stream.Stream[] | string[], callback?: (err: Error, ret: RecordResult) => void): Batch; compactLayouts(callback?: CompactLayoutInfo): Promise; count(conditions?: Object | string, callback?: (err: Error, num: number) => void): Promise; create(options: any | any[], callback?: (err: Error, ret: RecordResult | RecordResult[]) => void): Promise; - createBulk(input?: Record[] | stream.Stream | string, callback?: (err: Error, ret: RecordResult) => void): Batch; + createBulk(input?: Array> | stream.Stream | string, callback?: (err: Error, ret: RecordResult) => void): Batch; del(ids: string | string[], callback?: (err: Error, ret: any) => void): void; destroy(ids: string | string[], callback?: (err: Error, ret: any) => void): void; delete(ids: string | string[], callback?: (err: Error, ret: any) => void): void; - deleteBulk(input?: Record[] | stream.Stream | string, callback?: (err: Error, ret: RecordResult) => void): Batch; - destroyBulk(input?: Record[] | stream.Stream | string, callback?: (err: Error, ret: RecordResult) => void): Batch; - destroyHardBulk(input?: Record[] | stream.Stream | string, callback?: (err: Error, ret: RecordResult) => void): Batch; + deleteBulk(input?: Array> | stream.Stream | string, callback?: (err: Error, ret: RecordResult) => void): Batch; + destroyBulk(input?: Array> | stream.Stream | string, callback?: (err: Error, ret: RecordResult) => void): Batch; + destroyHardBulk(input?: Array> | stream.Stream | string, callback?: (err: Error, ret: RecordResult) => void): Batch; deleted(start: Date | string, end: Date | string, callback?: (info: DeletedRecordsInfo) => void): Promise; - deleteHardBulk(input?: Record[] | stream.Stream | string, callback?: (err: Error, ret: RecordResult) => void): Batch; + deleteHardBulk(input?: Array> | stream.Stream | string, callback?: (err: Error, ret: RecordResult) => void): Batch; describe(callback?: (err: Error, ret: DescribeSObjectResult) => void): Promise; insert(options: any | any[], callback?: (err: Error, ret: RecordResult | RecordResult[]) => void): Promise; - insertBulk(input?: Record[] | stream.Stream | string, callback?: (err: Error, ret: RecordResult) => void): Batch; + insertBulk(input?: Array> | stream.Stream | string, callback?: (err: Error, ret: RecordResult) => void): Batch; layouts(layoutName?: string, callback?: (err: Error, info: LayoutInfo) => void): Promise; listview(id: string): ListView; listviews(callback?: (err: Error, info: ListViewsInfo) => void): Promise; @@ -53,8 +53,8 @@ export class SObject { quickActions(callback?: (err: Error, info: any) => void): Promise; recent(callback?: (err: Error, ret: RecordResult) => void): Promise; select(callback?: (err: Error, ret: T[]) => void): Promise; - //TODO:use a typed pluck to turn `fields` into a subset of T's fields so that the output is slimmed down appropriately - select(fields?: (keyof T)[] | (keyof T), callback?: (err: Error, ret: Partial[]) => void): Promise[]>; + // TODO:use a typed pluck to turn `fields` into a subset of T's fields so that the output is slimmed down appropriately + select(fields?: {[P in keyof T]: boolean} | Array<(keyof T)> | (keyof T), callback?: (err: Error, ret: Array>) => void): Promise>>; } export interface ApprovalLayoutInfo { From 0509fcf2a6b4b4b70c70bc692b14016742396ad5 Mon Sep 17 00:00:00 2001 From: Paul Sachs Date: Mon, 21 Aug 2017 18:30:27 -0400 Subject: [PATCH 065/156] Unifying values declaration causes param to cast to any instead of proper generic type Breaks linting but fixes typescript behavior. --- types/ramda/index.d.ts | 2 +- types/ramda/ramda-tests.ts | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index 5a8ea8f332..f36cd90b84 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -1916,7 +1916,7 @@ declare namespace R { * Note that the order of the output array is not guaranteed across * different JS platforms. */ - values(obj: { [index: string]: T } | any): T[]; + values(obj: T): Array; /** * Returns a list of all the properties, including prototype properties, of the supplied diff --git a/types/ramda/ramda-tests.ts b/types/ramda/ramda-tests.ts index 909eba9d5f..2474d78d8e 100644 --- a/types/ramda/ramda-tests.ts +++ b/types/ramda/ramda-tests.ts @@ -1567,7 +1567,19 @@ class Rectangle { }; () => { - const a = R.values({a: 1, b: 2, c: 3}); // => [1, 2, 3] + interface A { + a: string; + b: string; + } + const a1: A = { a: 'something', b: 'else' }; + const v1 = R.values(a1); + + const a = R.values({a: 1, b: 2, c: 3}); // => [1, 2, 3] (number[]) + const addition = a[0] + a[1]; + + const b = R.values({a: 1, b: 'something'}); // b = (string|number)[] + const c = R.values({1: 3}); + // const d = R.values('something'); }; () => { From 916c404aabf071a64bcfe5f8ea62fc57e98b1445 Mon Sep 17 00:00:00 2001 From: John Cao Date: Wed, 30 Aug 2017 12:11:29 -0700 Subject: [PATCH 066/156] Update grantOfflineAccess Update grantOfflineAccess with OfflineAccessOptions --- types/gapi.auth2/index.d.ts | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/types/gapi.auth2/index.d.ts b/types/gapi.auth2/index.d.ts index a8e84d478b..1af7d1464a 100644 --- a/types/gapi.auth2/index.d.ts +++ b/types/gapi.auth2/index.d.ts @@ -42,11 +42,7 @@ declare namespace gapi.auth2 { /** * Get permission from the user to access the specified scopes offline. */ - grantOfflineAccess(options?: { - scope?: string; - prompt?: "select_account" | "consent"; - app_package_name?: string; - }): any; + grantOfflineAccess(options?: OfflineAccessOptions): Promise<{code: string}>; /** * Attaches the sign-in flow to the specified container's click handler. @@ -106,6 +102,18 @@ declare namespace gapi.auth2 { */ scope?: string; } + + + /** + * Definitions by: John + * Interface that represents the different configuration parameters for the GoogleAuth.grantOfflineAccess(options) method. + * Reference: https://developers.google.com/api-client-library/javascript/reference/referencedocs#gapiauth2offlineaccessoptions + */ + interface OfflineAccessOptions { + scope?: string; + prompt?: "select_account" | "consent"; + app_package_name?: string; + } /** * Interface that represents the different configuration parameters for the gapi.auth2.init method. From 617648bf881ba20a2e0bf61f2a6c5f0b92a88ede Mon Sep 17 00:00:00 2001 From: John Cao Date: Wed, 30 Aug 2017 12:33:51 -0700 Subject: [PATCH 067/156] remove whitespaces --- types/gapi.auth2/index.d.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/types/gapi.auth2/index.d.ts b/types/gapi.auth2/index.d.ts index 1af7d1464a..4cdef77a80 100644 --- a/types/gapi.auth2/index.d.ts +++ b/types/gapi.auth2/index.d.ts @@ -102,7 +102,6 @@ declare namespace gapi.auth2 { */ scope?: string; } - /** * Definitions by: John @@ -113,7 +112,7 @@ declare namespace gapi.auth2 { scope?: string; prompt?: "select_account" | "consent"; app_package_name?: string; - } + } /** * Interface that represents the different configuration parameters for the gapi.auth2.init method. From 96da366c9b1bf48bc3d74f33f843c354251c56a5 Mon Sep 17 00:00:00 2001 From: William Lohan Date: Wed, 30 Aug 2017 12:57:33 -0700 Subject: [PATCH 068/156] update uuid --- types/uuid/uuid-tests.ts | 4 ++++ types/uuid/v5.d.ts | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/types/uuid/uuid-tests.ts b/types/uuid/uuid-tests.ts index ec69275db9..dc0bdcbdcf 100644 --- a/types/uuid/uuid-tests.ts +++ b/types/uuid/uuid-tests.ts @@ -48,3 +48,7 @@ const a: string = v5('hello', MY_NAMESPACE); const b: string = v5('world', MY_NAMESPACE); const c: Buffer = v5('world', MY_NAMESPACE, new Buffer(16)); const d: number[] = v5('world', MY_NAMESPACE, [], 0); + +// https://github.com/kelektiv/node-uuid#quickstart---commonjs-recommended +const e = v5('hello.example.com', v5.DNS); +const f = v5('http://example.com/hello', v5.URL); diff --git a/types/uuid/v5.d.ts b/types/uuid/v5.d.ts index 67b8c8d051..170bcdcef4 100644 --- a/types/uuid/v5.d.ts +++ b/types/uuid/v5.d.ts @@ -1,5 +1,12 @@ import { v5 } from './interfaces'; -declare const v5: v5; +interface v5Static { + // https://github.com/kelektiv/node-uuid/blob/master/v5.js#L47 + DNS: string; + // https://github.com/kelektiv/node-uuid/blob/master/v5.js#L48 + URL: string; +} + +declare const v5: v5Static & v5; export = v5; From c510750a119198de8a4a798b54aef367f920fe85 Mon Sep 17 00:00:00 2001 From: Michael Glitzos Date: Wed, 30 Aug 2017 18:33:34 -0400 Subject: [PATCH 069/156] Updated definition of remote Added additional properties to satisfy options for react-bootstrap-table v3. --- types/react-bootstrap-table/index.d.ts | 382 +++++++++++------- .../react-bootstrap-table-tests.tsx | 52 ++- 2 files changed, 277 insertions(+), 157 deletions(-) diff --git a/types/react-bootstrap-table/index.d.ts b/types/react-bootstrap-table/index.d.ts index 1b80e670fa..8efc965c10 100644 --- a/types/react-bootstrap-table/index.d.ts +++ b/types/react-bootstrap-table/index.d.ts @@ -12,48 +12,115 @@ import { ComponentClass, Props, ReactElement } from 'react'; import { EventEmitter } from 'events'; +/** + * Interface spec for sepcifying functionality to handle remotely + * + * Consult [documentation](https://allenfang.github.io/react-bootstrap-table/docs.html#remote) + * for more info + * + * @interface RemoteObjSpec + */ +export interface RemoteObjSpec { + /** + * If set, cell edits will be handled remotely + * + * @type {boolean} + * @memberof RemoteObjSpec + */ + cellEdit?: boolean; + /** + * If set insertions will be handled remotely + * + * @type {boolean} + * @memberof RemoteObjSpec + */ + insertRow?: boolean; + /** + * If set deletion will be handled remotely + * + * @type {boolean} + * @memberof RemoteObjSpec + */ + dropRow?: boolean; + /** + * If set filters will be handled remotely + * + * @type {boolean} + * @memberof RemoteObjSpec + */ + filter?: boolean; + /** + * If set search will be handled remotely + * + * @type {boolean} + * @memberof RemoteObjSpec + */ + search?: boolean; + /** + * If set, exporting CSV will be handled remotely + * + * @type {boolean} + * @memberof RemoteObjSpec + */ + exportCSV?: boolean; + /** + * If set sorting will be handled remotely + * + * @type {boolean} + * @memberof RemoteObjSpec + */ + sort?: boolean; + /** + * If set pagination will be handled remotely + * + * @type {boolean} + * @memberof RemoteObjSpec + */ + pagination?: boolean; +} + export interface BootstrapTableProps extends Props { /** Use data to specify the data that you want to display on table. */ - data: any[]; + data: any[]; /** If set, data is remote (use also fetchInfo) */ - remote?: boolean, + remote?: (remobeObj: RemoteObjSpec) => RemoteObjSpec | boolean, // Updated to support ^3.0.0 /** Use keyField to tell table which column is unique. This is same as isKey in Tips: You need choose one configuration to set key field: keyField or isKey in */ - keyField?: string; + keyField?: string; /** Use height to set the height of table, default is 100%. */ - height?: string; + height?: string; /** Set the max column width (pixels) */ - maxHeight?: string; + maxHeight?: string; /** Enable striped by setting striped to true. Same as Bootstrap table class .table-striped, default is false. */ - striped?: boolean; + striped?: boolean; /** Enable hover by setting hover to true. Same as Bootstrap table class .table-hover, default is false. */ - hover?: boolean; + hover?: boolean; /** Enable condensed by setting condensed to true. Same as Bootstrap table class .table-condensed, default is false. */ - condensed?: boolean; + condensed?: boolean; /** Become a borderless table by setting bordered to false, default is true. */ - bordered?: boolean; + bordered?: boolean; /** Enable pagination by setting pagination to true, default is false. */ - pagination?: boolean; + pagination?: boolean; /** Assign the class name of row(tr). This attribute accept a string or function and function is a better way to do more customization. If a string given, means the value will be presented as the row class. @@ -63,65 +130,65 @@ export interface BootstrapTableProps extends Props { return rowIndex%2==0?"tr-odd":"tr-even"; //return a class name. } */ - trClassName?: string | ((rowData: any, rowIndex: number) => string); + trClassName?: string | ((rowData: any, rowIndex: number) => string); /** Enable row insertion by setting insertRow to true, default is false. If you enable row insertion, there's a button on the upper left side of table. */ - insertRow?: boolean; + insertRow?: boolean; /** Enable row deletion by setting deleteRow to true, default is false. If you enable row deletion, there's a button on the upper left side of table. */ - deleteRow?: boolean; + deleteRow?: boolean; /** Enable column filter by setting columnFilter to true, default is false. If enabled, there're input text field per column under the table, user can input your filter condition by each column. */ - columnFilter?: boolean; + columnFilter?: boolean; /** Enable search by setting search to true, default is false. If enabled, there is a on the upper left side of the table. The default place holder is Search */ - search?: boolean; + search?: boolean; /** Set searchPlaceholder to change the placeholder in search field, default is Search. */ - searchPlaceholder?: string; + searchPlaceholder?: string; /** Enable multi search by multiColumnSearch, default is false. If you want to use multi search, you must enable search at first. Tips: Use space to delimited search text. EX: 3 4, which means match all 3 or 4 datas in table. */ - multiColumnSearch?: boolean; + multiColumnSearch?: boolean; /** Enable export csv function, default is false. If you enable, there's a button on the upper left side of table. */ - exportCSV?: boolean; + exportCSV?: boolean; /** Set CSV filename (e.g. items.csv). Default is spreadsheet.csv */ - csvFileName?: string; + csvFileName?: string; /** Enable row selection on table. selectRow accept an object which have the following properties */ - selectRow?: SelectRow; + selectRow?: SelectRow; /** Enable cell editing on table. cellEdit accept an object which have the following properties */ - cellEdit?: CellEdit; + cellEdit?: CellEdit; /** For some options setting on this component, you can set the options attribute and give an object which contain following properties */ - options?: Options; - fetchInfo?: FetchInfo; + options?: Options; + fetchInfo?: FetchInfo; printable?: boolean; - tableStyle?: any; - containerStyle?: any; - headerStyle?: any; - bodyStyle?: any; - ignoreSinglePage?: boolean; + tableStyle?: any; + containerStyle?: any; + headerStyle?: any; + bodyStyle?: any; + ignoreSinglePage?: boolean; containerClass?: string; tableContainerClass?: string headerContainerClass?: string; @@ -136,37 +203,37 @@ export interface SelectRow { /** For specifing the selection is single(radio) or multiple(checkbox). */ - mode: SelectRowMode; + mode: SelectRowMode; /** Click the row will trigger selection on that row if enable clickToSelect, default is false. */ - clickToSelect?: boolean; + clickToSelect?: boolean; /** If true, click the row will trigger selection on that row and also trigger cell editing if you enabled cell edit. Default is false. */ - clickToSelectAndEditCell?: boolean; + clickToSelectAndEditCell?: boolean; /** You can assign the background color of row which be selected. */ - bgColor?: string; + bgColor?: string; /** You can assign the class name of row which be selected. */ - className?: string; + className?: string; /** Give an array data to perform which rows you want to be selected when table loading. The content of array should be the rowkey which you want to be selected. */ - selected?: string[] | number[]; + selected?: string[] | number[]; /** if true, the radio/checkbox column will be hide. You can enable this attribute if you enable clickToSelect and you don't want to show the selection column. */ - hideSelectColumn?: boolean; + hideSelectColumn?: boolean; /** Default is false, if enabled, there will be a button on top of table for toggling selected rows only. */ - showOnlySelected?: boolean; + showOnlySelected?: boolean; /** Accept a custom callback function, if a row be selected or unselected, this function will be called. This callback function taking three arguments row, isSelected and event: @@ -175,7 +242,7 @@ export interface SelectRow { `event`: The event target object. If return value of this (function) is false, the select or deselect action will not be applied. */ - onSelect?: (row: any, isSelected: Boolean, event: any) => boolean; + onSelect?: (row: any, isSelected: Boolean, event: any) => boolean; /** Accept a custom callback function, if click select all checkbox, this function will be called. This callback function taking two arguments isSelected and currentSelectedAndDisplayData: @@ -183,7 +250,7 @@ export interface SelectRow { `currentSelectedAndDisplayData`: If pagination enabled, this result is the data which in a page. In contrast, this is all data in table. If return value of this function is false, the select all or deselect all action will not be applied. */ - onSelectAll?: (isSelected: boolean, currentSelectedAndDisplayData: any) => boolean; + onSelectAll?: (isSelected: boolean, currentSelectedAndDisplayData: any) => boolean; /** * Provide a list of unselectable row keys. @@ -197,23 +264,23 @@ export interface CellEdit { /** To spectify which condition will trigger cell editing.(click or dbclick) */ - mode: CellEditClickMode; + mode: CellEditClickMode; /** Enable blurToSave will trigger a saving event on cell when mouse blur on the input field. Default is false. In the default condition, you need to press ENTER to save the cell. */ - blurToSave?: boolean; + blurToSave?: boolean; /** Accept a custom callback function, before cell saving, this function will be called. This callback function taking three arguments:row, cellName and cellValue It's necessary to return a bool value which whether apply this cell editing. */ - beforeSaveCell?: (row: any, cellName: string, cellValue: any) => boolean; + beforeSaveCell?: (row: any, cellName: string, cellValue: any) => boolean; /** Accept a custom callback function, after cell saving, this function will be called. This callback function taking three arguments:row, cellName and cellValue */ - afterSaveCell?: (row: any, cellName: string, cellValue: any) => void; + afterSaveCell?: (row: any, cellName: string, cellValue: any) => void; } export type SortOrder = 'asc' | 'desc'; @@ -222,137 +289,137 @@ export interface Options { /** Manage sort field by yourself */ - sortName?: string; + sortName?: string; /** Manage sort order by yourself */ - sortOrder?: SortOrder; + sortOrder?: SortOrder; /** Assign a default sort field. */ - defaultSortName?: string; + defaultSortName?: string; /** Assign a default sort ordering. */ - defaultSortOrder?: SortOrder; + defaultSortOrder?: SortOrder; /** False to disable sort indicator on header column, default is true. */ - sortIndicator?: boolean; + sortIndicator?: boolean; /** Change the displaying text on table if data is empty. */ - noDataText?: string | ReactElement; + noDataText?: string | ReactElement; /** A delay for trigger search after a keyup (millisecond) */ - searchDelayTime?: number; + searchDelayTime?: number; /** A custom text on export csv button */ - exportCSVText?: string; + exportCSVText?: string; /** Default is false, if true means you want to ignore any editable configuration when row insert. */ - ignoreEditable?: boolean; + ignoreEditable?: boolean; /** Only work on enable search. If true, there will be a button beside search input field for clear search field text. */ - clearSearch?: boolean; + clearSearch?: boolean; /** Assign a callback function which will be called after table update. */ - afterTableComplete?: Function; + afterTableComplete?: Function; /** Assign a callback function which will be called after row delete. This function taking one argument: rowKeys, which means the row key you dropped. */ - afterDeleteRow?: (rowKeys: string[]) => void; + afterDeleteRow?: (rowKeys: string[]) => void; /** Assign a callback function which will be called after row insert. This function taking one argument: row, which means the whole row data you added. */ - afterInsertRow?: (row: any) => void; + afterInsertRow?: (row: any) => void; /** Customize the text of previouse page button */ - prePage?: string; + prePage?: string; /** Customize the text of next page button */ - nextPage?: string; + nextPage?: string; /** Customize the text of first page button */ - firstPage?: string; + firstPage?: string; /** Customize the text of last page button */ - lastPage?: string; + lastPage?: string; /** Accept a number, which means the page you want to show as default. */ - page?: number; + page?: number; /** You can change the dropdown list for size per page if you enable pagination. */ - sizePerPageList?: number[]; + sizePerPageList?: number[]; /** Means the size per page you want to locate as default. */ - sizePerPage?: number; + sizePerPage?: number; /** To define the pagination bar length, default is 5. */ - paginationSize?: number; + paginationSize?: number; /** To define where to start counting the pages. */ - pageStartIndex?: number; + pageStartIndex?: number; /** Assign a callback function which will be called after page changed. This function taking two argument: page and sizePerPage. `page`: Current page. `sizePerPage`: The data size which in one page. */ - onPageChange?: (page: number, sizePerPage: number) => void; + onPageChange?: (page: number, sizePerPage: number) => void; /** Assign a callback function which will be called after size per page dropdown changed. This function taking one argument: sizePerPage. `sizePerPage`: The data size which in one page. */ - onSizePerPageList?: (sizePerPage: number) => void; + onSizePerPageList?: (sizePerPage: number) => void; /** Assign a callback function which will be called after trigger sorting. This function taking two argument: `sortName` and `sortOrde`r. `sortName`: The sort column name `sortOrder`: The sort ordering. */ - onSortChange?: (sortName: string, sortOrder: SortOrder) => void; + onSortChange?: (sortName: string, sortOrder: SortOrder) => void; /** Assign a callback function which will be called after trigger searching. This function taking two argument: search and result. `search`: The search text which user input. `result`: The results after searching. */ - afterSearch?: (search: string, result: any) => void; + afterSearch?: (search: string, result: any) => void; /** Assign a callback function which will be called after trigger column filtering. This function taking two argument: filterConds and result. `filterConds`: It's an array object which contain all column filter conditions. `result`: The results after filtering. */ - afterColumnFilter?: (filterConds: any[], result: any) => void; + afterColumnFilter?: (filterConds: any[], result: any) => void; /** Assign a callback function which will be called after a row click. This function taking one argument: row which is the row data which you click on. */ - onRowClick?: (row: any) => void; + onRowClick?: (row: any) => void; /** Assign a callback function which will be called after a row double click. This function taking one argument: row which is the row data which you double click on. */ - onRowDoubleClick?: (row:any)=>void; + onRowDoubleClick?: (row: any) => void; /** Background color on expanded rows. */ @@ -360,21 +427,21 @@ export interface Options { /** Assign a callback function which will be called when mouse enter into the table. */ - onMouseEnter?: Function; + onMouseEnter?: Function; /** Assign a callback function which will be called when mouse leave from the table. */ - onMouseLeave?: Function; + onMouseLeave?: Function; /** Assign a callback function which will be called when mouse over a row in table. This function taking one argument: row which is the row data which mouse over. */ - onRowMouseOver?: Function; + onRowMouseOver?: Function; /** Assign a callback function which will be called when mouse leave from a row in table. This function taking one argument: row which is the row data which mouse out. */ - onRowMouseOut?: Function; + onRowMouseOut?: Function; /** Assign a callback function which will be called when row dropping. @@ -385,60 +452,93 @@ export interface Options { `rowKeys` is the row keys which been deleted, you can call next function to apply this deletion. */ - handleConfirmDeleteRow?: (next: Function, rowKeys: any[]) => void; - paginationShowsTotal?: boolean | ReactElement; - onSearchChange?: Function; - onAddRow?: Function; - onExportToCSV?: Function; + handleConfirmDeleteRow?: (next: Function, rowKeys: any[]) => void; + paginationShowsTotal?: boolean | ReactElement; + onSearchChange?: Function; + onAddRow?: Function; + onExportToCSV?: Function; - insertText?: string; - deleteText?: string; - saveText?: string; - closeText?: string; + insertText?: string; + deleteText?: string; + saveText?: string; + closeText?: string; + // Customization properties + /** + * Callback function to be called when a cell is modified + * + * https://allenfang.github.io/react-bootstrap-table/example.html#remote + * + * @memberof BootstrapTableProps + */ + onCellEdit?: (row: any, field: string, value: any) => any; + /** + * Callback function to be called when filter changing + * + * https://github.com/AllenFang/react-bootstrap-table/blob/master/examples/js/remote/remote-store-filtering.js#L67 + * + * @memberof BootstrapTableProps + */ + onFilterChange?:(filterObj: any) => any; + /** + * Callback function which will be called when a row will be deleted + * + * https://github.com/AllenFang/react-bootstrap-table/blob/master/examples/js/remote/remote-store-delete-row.js#L27 + * + * @memberof BootstrapTableProps + */ + onDeleteRow?: (rows: any[] | any) => any; + /** + * A callback which will be called after page changed + * + * https://github.com/AllenFang/react-bootstrap-table/blob/master/examples/js/remote/remote-store-paging.js#L30 + * + * @memberof BootstrapTableProps + */ + onpageChange?: (page: any, sizePerPage: number) => any; } interface FetchInfo { - dataTotalSize?: number; + dataTotalSize?: number; } export interface BootstrapTable extends ComponentClass { /** * Call this function to insert an new row to table. */ - handleAddRow(row: any): void; + handleAddRow(row: any): void; /** * Call this function to insert an new row as first row on table. */ - handleAddRowAtBegin(row: any): void; + handleAddRowAtBegin(row: any): void; /** * Call this function to drop rows in table. */ - handleDropRow(rowKeys: any[]): void; + handleDropRow(rowKeys: any[]): void; /** * Call this function to do column filtering on table. */ - handleFilterData(filter: any): void; + handleFilterData(filter: any): void; /** * Call this function with search text for fully searching. */ - handleSearch(search: string): void; + handleSearch(search: string): void; /** * Call this function to sort table. */ - handleSort(order: SortOrder, field: string): void; + handleSort(order: SortOrder, field: string): void; /** * Call this function to get the page by a rowkey */ - getPageByRowKey(rowKey: string): any; + getPageByRowKey(rowKey: string): any; /** * Call this function to export table as csv. */ - handleExportCSV(): void; + handleExportCSV(): void; /** * Clean all the selection state on table. */ - cleanSelected(): void; + cleanSelected(): void; } interface BootstrapTable extends ComponentClass { } declare const BootstrapTable: BootstrapTable; @@ -448,20 +548,20 @@ export interface TableHeaderColumnProps extends Props { /** The field of data you want to show on column. */ - dataField?: string; + dataField?: string; /** Use isKey to tell table which column is unique. This is same as keyField in Tips: You need choose one configuration to set key field: isKey or keyField in */ - isKey?: boolean; + isKey?: boolean; /** Set the column width. ex: 150, it's means 150px */ - width?: string; + width?: string; /** Set align in column, value is left, center, right, start and end. */ - dataAlign?: DataAlignType; + dataAlign?: DataAlignType; /** * Alignment of text in the column header. @@ -470,7 +570,7 @@ export interface TableHeaderColumnProps extends Props { /** True to enable table sorting. Default is disabled. */ - dataSort?: boolean; + dataSort?: boolean; /** Default search string. */ @@ -479,27 +579,27 @@ export interface TableHeaderColumnProps extends Props { Allow user to render a custom sort caret. You should give a function and should return a JSX. This function taking one arguments: order which present the sort order currently. */ - caretRender?: Function; - /** - Give an Object like following to able to customize your own editing component. - This Object should contain these two property: - getElement(REQUIRED): Accept a callback function and take two arguments: onUpdate and props. - customEditorParameters: Another extra data for custom cell edit component. - */ - customEditor?: {getElement: (onUpdate: any, props: any) => ReactElement, customEditorParameters?: Object} ; + caretRender?: Function; + /** + Give an Object like following to able to customize your own editing component. + This Object should contain these two property: + getElement(REQUIRED): Accept a callback function and take two arguments: onUpdate and props. + customEditorParameters: Another extra data for custom cell edit component. + */ + customEditor?: { getElement: (onUpdate: any, props: any) => ReactElement, customEditorParameters?: Object }; /** To customize the column. This callback function should return a String or a React Component. In addition, this function taking two argument: cell and row. */ - dataFormat?: (cell: any, row: any, formatExtraData?: any) => string | ReactElement; + dataFormat?: (cell: any, row: any, formatExtraData?: any) => string | ReactElement; /** To to enable search or filter data on formatting. Default is false */ - filterFormatted?: boolean; + filterFormatted?: boolean; /** True to hide column. */ - hidden?: boolean; + hidden?: boolean; /** True to hide the dropdown for sizePerPage. */ @@ -507,28 +607,28 @@ export interface TableHeaderColumnProps extends Props { /** False to disable search functionality on column, default is true. */ - searchable?: boolean; + searchable?: boolean; /** Give a customize function for data sorting. This function taking four arguments: a, b, order, sortField, extraData */ - sortFunc?: (a: any, b: any, order: SortOrder, sortField: any, extraData: any) => number; + sortFunc?: (a: any, b: any, order: SortOrder, sortField: any, extraData: any) => number; /** It's a extra data for custom sort function, if defined, this data will be pass as fifth argument in sortFunc. */ - sortFuncExtraData?: any; + sortFuncExtraData?: any; /** Add custom css class on table header column, this attribute only accept String or Function. If Function, it taking four arguments: cell, row, rowIndex, columnIndex. In addition, this function should return a String which is the class name you want to add on. */ - className?: string | ((cell: any, row: any, rowIndex: number, columnIndex: number) => string); + className?: string | ((cell: any, row: any, rowIndex: number, columnIndex: number) => string); /** Add custom css class on table body column, this attribute only accept String or Function. If Function, it taking four arguments: cell, row, rowIndex, columnIndex. In addition, this function should return a String which is the class name you want to add on. */ - columnClassName?: String | ((cell: any, row: any, rowIndex: number, columnIndex: number) => string); + columnClassName?: String | ((cell: any, row: any, rowIndex: number, columnIndex: number) => string); /** Add True to set column editable, false is non-editable. If give Object, you can do more customization when editing cell. This object have following properties: @@ -541,29 +641,29 @@ export interface TableHeaderColumnProps extends Props { } } */ - editable?: boolean | Editable; + editable?: boolean | Editable; /** It only work when you enable insertRow and be assign on rowKey column. If true, the row key will be generated automatically after a row insertion. */ - autoValue?: boolean; + autoValue?: boolean; /** To Enable a column filter within header column. This feature support a lots of filter type and condition. Please check example Following is the format for filter */ - filter?: Filter; + filter?: Filter; - onSort?: Function; + onSort?: Function; /** * Header for column in generated CSV file */ csvHeader?: string; - csvFormat?: Function; - columnTitle?: boolean; - sort?: SortOrder; - formatExtraData?: any; + csvFormat?: Function; + columnTitle?: boolean; + sort?: SortOrder; + formatExtraData?: any; /** * Row in the header on which this header column present. @@ -583,24 +683,24 @@ export interface TableHeaderColumnProps extends Props { colSpan?: number; } export interface Editable { - type?: string;//edit type, avaiable value is textarea, select, checkbox + type?: string;//edit type, avaiable value is textarea, select, checkbox /** function for validation and taking only one "cell value" as argument. This function should return Bool. */ - validator?: (cell: any) => boolean; + validator?: (cell: any) => boolean; /** { values: //values means data in select or checkbox.If checkbox, use ':'(colon) to separate value, ex: Y:N } */ - options?: any; + options?: any; /** Configuration for the textarea editable type */ - cols?: number; - rows?: number; + cols?: number; + rows?: number; } export type SetFilterCallback = (targetValue: any) => boolean; export interface ApplyFilterParameter { @@ -612,51 +712,51 @@ export interface Filter { /** "TextFilter"||"SelectFilter"||"NumberFilter"||"DateFilter"||"RegexFilter"||"YOUR_CUSTOM_FILTER" */ - type?: FilterType; + type?: FilterType; /** * Default value on filter. If type is NumberFilter or DateFilter, this value will like { number||date: xxx, comparator: '>' } */ - defaultValue?: any; + defaultValue?: any; /** * Assign a millisecond for delay when trigger filtering, default is 500. */ - delay?: number; + delay?: number; /** * Only work on TextFilter. Assign the placeholder text on text and regex filter */ - placeholder?: string | RegExp; + placeholder?: string | RegExp; /** * Only work on NumberFilter. Accept an array which conatin the filter condition, like: ['<','>','='] */ - numberComparators?: string[]; + numberComparators?: string[]; /** * Options for the filter. */ - options?: any; + options?: any; /** * Comparison condition for the NumberFilter */ - condition?: string; + condition?: string; /** * Get element which represent filter. */ - getElement?: (filterHandler: (parameters?: ApplyFilterParameter) => void, filterParameters: any) => JSX.Element; + getElement?: (filterHandler: (parameters?: ApplyFilterParameter) => void, filterParameters: any) => JSX.Element; /** * Parameters for custom filter */ - customFilterParameters?: any; + customFilterParameters?: any; } export interface TableHeaderColumn extends ComponentClass { } declare const TableHeaderColumn: TableHeaderColumn; declare class TableDataSet extends EventEmitter { - constructor(data: any); - setData(data: any): void; - clear(): void; - getData(): any; + constructor(data: any); + setData(data: any): void; + clear(): void; + getData(): any; } diff --git a/types/react-bootstrap-table/react-bootstrap-table-tests.tsx b/types/react-bootstrap-table/react-bootstrap-table-tests.tsx index e501d8de14..76e5bb79b7 100644 --- a/types/react-bootstrap-table/react-bootstrap-table-tests.tsx +++ b/types/react-bootstrap-table/react-bootstrap-table-tests.tsx @@ -21,10 +21,10 @@ function priceFormatter(cell: any, row: any) { render( - Product ID - Product Name - Product Price - , + Product ID + Product Name + Product Price + , document.getElementById("app") ); @@ -41,11 +41,11 @@ function enumFormatter(cell: any, row: any, enumObject: any) { class SelectFilterWithDefaultValue extends React.Component { render() { return ( - - Product ID - Product Name - Product Quality + + Product ID + Product Name + Product Quality ); } @@ -54,9 +54,9 @@ class SelectFilterWithDefaultValue extends React.Component { class TextFilterWithCondition extends React.Component { render() { return ( - + Product ID - Product Name + Product Name Product Price ); @@ -72,15 +72,35 @@ function getCustomFilter(filterHandler: (parameters?: ApplyFilterParameter) => v class CustomFilter extends React.Component { render() { return ( - + Product ID Product Name - Product Is In Stock + Product Is In Stock ); } } +class RemoteProps extends React.Component { + render() { + return ( + { + remoteObj.cellEdit = true; + return remoteObj; + }} + options={{ + onCellEdit: (row: any, fieldName: string, value: any) => { console.info(row); } + }} + > + Product ID + Product Name + Product Is In Stock + + ); + } +} // Adopted from https://github.com/AllenFang/react-bootstrap-table/blob/master/examples/js/column-header-span/column-header-span-complex.js export default class ColumnHeaderSpanComplex extends React.Component { render() { @@ -94,15 +114,15 @@ export default class ColumnHeaderSpanComplex extends React.Component { blurToSave: true }; return ( - - ID + ID Product name price Coupon In stock - Customer + Customer name order From 9ddbcfc2e04572d05f8463f0c09f12540d686a04 Mon Sep 17 00:00:00 2001 From: Eirikur Nilsson Date: Wed, 30 Aug 2017 22:35:42 +0000 Subject: [PATCH 070/156] Update types Add `.when()` method for conditional configuration Add devServer changes. Inherit Config from ChainedMap Export EntryPoint --- types/webpack-chain/index.d.ts | 82 +++++++++++++--------- types/webpack-chain/webpack-chain-tests.ts | 7 ++ 2 files changed, 55 insertions(+), 34 deletions(-) diff --git a/types/webpack-chain/index.d.ts b/types/webpack-chain/index.d.ts index 4a13f91530..68839d423c 100644 --- a/types/webpack-chain/index.d.ts +++ b/types/webpack-chain/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for webpack-chain 3.0 +// Type definitions for webpack-chain 4.0 // Project: https://github.com/mozilla-neutrino/webpack-chain // Definitions by: Eirikur Nilsson , Paul Sachs // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -8,9 +8,42 @@ import * as https from 'https'; export = Config; -declare class Config { +declare namespace __Config { + class Chained { + end(): Parent; + } + + class TypedChainedMap extends Chained { + clear(): this; + delete(key: string): this; + has(key: string): boolean; + get(key: string): Value; + set(key: string, value: Value): this; + merge(obj: { [key: string]: Value }): this; + entries(): { [key: string]: Value }; + values(): Value[]; + when(condition: boolean, trueBrancher: (obj: any) => void, falseBrancher?: (obj: any) => void): this; + } + + class ChainedMap extends TypedChainedMap {} + + class TypedChainedSet extends Chained { + add(value: Value): this; + prepend(value: Value): this; + clear(): this; + delete(key: string): this; + has(key: string): boolean; + merge(arr: Value[]): this; + values(): Value[]; + when(condition: boolean, trueBrancher: (obj: any) => void, falseBrancher?: (obj: any) => void): this; + } + + class ChainedSet extends TypedChainedSet {} +} + +declare class Config extends __Config.ChainedMap { devServer: Config.DevServer; - entryPoints: Config.EntryPoints; + entryPoints: Config.TypedChainedMap; module: Config.Module; node: Config.ChainedMap; output: Config.Output; @@ -35,42 +68,18 @@ declare class Config { watch(value: boolean): this; watchOptions(value: webpack.Options.WatchOptions): this; - entry(name: string): Config.ChainedSet; + entry(name: string): Config.EntryPoint; plugin(name: string): Config.Plugin; toConfig(): webpack.Configuration; - merge(obj: any): this; } declare namespace Config { - class Chained { - end(): Parent; - } - - class TypedChainedMap extends Chained { - clear(): this; - delete(key: string): this; - has(key: string): boolean; - get(key: string): Value; - set(key: string, value: Value): this; - merge(obj: { [key: string]: Value }): this; - entries(): { [key: string]: Value }; - values(): Value[]; - } - - class ChainedMap extends TypedChainedMap {} - - class TypedChainedSet extends Chained { - add(value: Value): this; - prepend(value: Value): this; - clear(): this; - delete(key: string): this; - has(key: string): boolean; - merge(arr: Value[]): this; - values(): Value[]; - } - - class ChainedSet extends TypedChainedSet {} + class Chained extends __Config.Chained {} + class TypedChainedMap extends __Config.TypedChainedMap {} + class ChainedMap extends __Config.TypedChainedMap {} + class TypedChainedSet extends __Config.TypedChainedSet {} + class ChainedSet extends __Config.TypedChainedSet {} class Plugins extends TypedChainedMap> {} @@ -128,11 +137,16 @@ declare namespace Config { noInfo(value: boolean): this; overlay(value: boolean | { warnings?: boolean, errors?: boolean }): this; port(value: number): this; + progress(value: boolean): this; proxy(value: any): this; + public(value: string): this; + publicPath(publicPath: string): this; quiet(value: boolean): this; setup(value: (expressApp: any) => void): this; + staticOptions(value: any): this; stats(value: webpack.Options.Stats): this; watchContentBase(value: boolean): this; + watchOptions(value: any): this; } class Performance extends ChainedMap { @@ -142,7 +156,7 @@ declare namespace Config { assetFilter(value: (assetFilename: string) => boolean): this; } - class EntryPoints extends TypedChainedMap> {} + class EntryPoint extends TypedChainedSet {} class Resolve extends ChainedMap { alias: TypedChainedMap; diff --git a/types/webpack-chain/webpack-chain-tests.ts b/types/webpack-chain/webpack-chain-tests.ts index 1118fe0d26..07593687cf 100644 --- a/types/webpack-chain/webpack-chain-tests.ts +++ b/types/webpack-chain/webpack-chain-tests.ts @@ -29,11 +29,13 @@ config .target('web') .watch(true) .watchOptions({}) + .when(false, config => config.watch(true), config => config.watch(false)) .entry('main') .add('index.js') .delete('index.js') .clear() + .when(false, entry => entry.clear(), entry => entry.clear()) .end() .entryPoints @@ -71,15 +73,20 @@ config errors: true, }) .port(8080) + .progress(true) .proxy({}) + .public('foo') + .publicPath('bar') .quiet(false) .setup(app => {}) + .staticOptions({}) .stats({ reasons: true, errors: true, warnings: false, }) .watchContentBase(true) + .watchOptions({}) .end() .module From aed2ea47a9207127b3e21186b568911fce7a8ba0 Mon Sep 17 00:00:00 2001 From: Eirikur Nilsson Date: Wed, 30 Aug 2017 22:53:46 +0000 Subject: [PATCH 071/156] Fix when type --- types/webpack-chain/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/webpack-chain/index.d.ts b/types/webpack-chain/index.d.ts index 68839d423c..6f6c46daa8 100644 --- a/types/webpack-chain/index.d.ts +++ b/types/webpack-chain/index.d.ts @@ -22,7 +22,7 @@ declare namespace __Config { merge(obj: { [key: string]: Value }): this; entries(): { [key: string]: Value }; values(): Value[]; - when(condition: boolean, trueBrancher: (obj: any) => void, falseBrancher?: (obj: any) => void): this; + when(condition: boolean, trueBrancher: (obj: this) => void, falseBrancher?: (obj: this) => void): this; } class ChainedMap extends TypedChainedMap {} @@ -35,7 +35,7 @@ declare namespace __Config { has(key: string): boolean; merge(arr: Value[]): this; values(): Value[]; - when(condition: boolean, trueBrancher: (obj: any) => void, falseBrancher?: (obj: any) => void): this; + when(condition: boolean, trueBrancher: (obj: this) => void, falseBrancher?: (obj: this) => void): this; } class ChainedSet extends TypedChainedSet {} From c88276a0d4b106d3ec2f6cff8f9112c41f5ac77c Mon Sep 17 00:00:00 2001 From: Joscha Feth Date: Thu, 31 Aug 2017 09:07:35 +1000 Subject: [PATCH 072/156] remove global --- types/xhr-mock/index.d.ts | 1 - types/xhr-mock/xhr-mock-tests.ts | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/types/xhr-mock/index.d.ts b/types/xhr-mock/index.d.ts index eacec1c5fc..2f85e44c8d 100644 --- a/types/xhr-mock/index.d.ts +++ b/types/xhr-mock/index.d.ts @@ -54,4 +54,3 @@ declare namespace mock { declare var mock: mock.XhrMock; export = mock; -export as namespace mock; diff --git a/types/xhr-mock/xhr-mock-tests.ts b/types/xhr-mock/xhr-mock-tests.ts index fd26b3a43f..37fc651d64 100644 --- a/types/xhr-mock/xhr-mock-tests.ts +++ b/types/xhr-mock/xhr-mock-tests.ts @@ -1,3 +1,5 @@ +import mock = require('xhr-mock'); + // replace the real XHR object with the mock XHR object mock.setup(); From 991a5e70fac3dd953e6f888e183c4bf011760282 Mon Sep 17 00:00:00 2001 From: Flaviu Tamas Date: Tue, 22 Aug 2017 19:56:07 -0400 Subject: [PATCH 073/156] Add ToggleButton and ToggleButtonGroup It's a new feature in v0.31.1 --- types/react-bootstrap/index.d.ts | 2 ++ types/react-bootstrap/lib/ToggleButton.d.ts | 11 +++++++++ .../lib/ToggleButtonGroup.d.ts | 21 +++++++++++++++++ types/react-bootstrap/lib/index.d.ts | 4 ++++ .../test/react-bootstrap-tests.tsx | 23 ++++++++++++++++++- 5 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 types/react-bootstrap/lib/ToggleButton.d.ts create mode 100644 types/react-bootstrap/lib/ToggleButtonGroup.d.ts diff --git a/types/react-bootstrap/index.d.ts b/types/react-bootstrap/index.d.ts index b59403cc39..5c55ce6910 100644 --- a/types/react-bootstrap/index.d.ts +++ b/types/react-bootstrap/index.d.ts @@ -119,6 +119,8 @@ export { TabPane, Tabs, Thumbnail, + ToggleButton, + ToggleButtonGroup, Tooltip, Well, utils, diff --git a/types/react-bootstrap/lib/ToggleButton.d.ts b/types/react-bootstrap/lib/ToggleButton.d.ts new file mode 100644 index 0000000000..2de57ca211 --- /dev/null +++ b/types/react-bootstrap/lib/ToggleButton.d.ts @@ -0,0 +1,11 @@ +import * as React from 'react'; + +declare class ToggleButton extends React.Component { } +declare namespace ToggleButton { } +export = ToggleButton + +interface ToggleButtonProps extends React.HTMLProps { + checked?: boolean; + name?: string; + value: number|string; +} diff --git a/types/react-bootstrap/lib/ToggleButtonGroup.d.ts b/types/react-bootstrap/lib/ToggleButtonGroup.d.ts new file mode 100644 index 0000000000..30849be038 --- /dev/null +++ b/types/react-bootstrap/lib/ToggleButtonGroup.d.ts @@ -0,0 +1,21 @@ +import * as React from 'react'; + +declare class ToggleButtonGroup extends React.Component { } +declare namespace ToggleButtonGroup { } +export = ToggleButtonGroup + +interface ToggleButtonGroupProps extends React.HTMLProps { + /** Required if `type` is set to "radio" */ + name?: string; + type: "radio" | "checkbox"; + /** + * You'll usually want to use string|number|string[]|number[] here, + * but you can technically use any|any[]. + */ + defaultValue?: any; + /** + * You'll usually want to use string|number|string[]|number[] here, + * but you can technically use any|any[]. + */ + value?: any; +} diff --git a/types/react-bootstrap/lib/index.d.ts b/types/react-bootstrap/lib/index.d.ts index 28078e1bcd..9cf3b61777 100644 --- a/types/react-bootstrap/lib/index.d.ts +++ b/types/react-bootstrap/lib/index.d.ts @@ -83,6 +83,8 @@ import * as TabPane from './TabPane'; import * as Tabs from './Tabs'; import * as Thumbnail from './Thumbnail'; import * as Tooltip from './Tooltip'; +import * as ToggleButton from './ToggleButton' +import * as ToggleButtonGroup from './ToggleButtonGroup' import * as Well from './Well'; import * as utils from './utils'; @@ -173,6 +175,8 @@ export { Tabs, Thumbnail, Tooltip, + ToggleButton, + ToggleButtonGroup, Well, utils, } diff --git a/types/react-bootstrap/test/react-bootstrap-tests.tsx b/types/react-bootstrap/test/react-bootstrap-tests.tsx index 873132e64b..445e65dc12 100644 --- a/types/react-bootstrap/test/react-bootstrap-tests.tsx +++ b/types/react-bootstrap/test/react-bootstrap-tests.tsx @@ -12,7 +12,8 @@ import { Label, Badge, Jumbotron, PageHeader, Glyphicon, Table, Form, FormGroup, ControlLabel, FormControl, HelpBlock, - Radio, Checkbox, Media, InputGroup + Radio, Checkbox, Media, InputGroup, ToggleButtonGroup, + ToggleButton } from 'react-bootstrap'; export class ReactBootstrapTest extends Component { @@ -1270,6 +1271,26 @@ export class ReactBootstrapTest extends Component { + +
+ + + Checkbox 1 (pre-checked) + Checkbox 2 + Checkbox 3 (pre-checked) + + + + + + + Radio 1 (pre-checked) + + Radio 2 + Radio 3 + + +
); } From bcc93afc0888102247cf4a8435475e80dc1780e2 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 30 Aug 2017 16:20:35 -0700 Subject: [PATCH 074/156] Added type declarations for 'jpeg-js'. --- types/jpeg-js/index.d.ts | 18 ++++++++++++++++++ types/jpeg-js/jpeg-js-tests.ts | 17 +++++++++++++++++ types/jpeg-js/tsconfig.json | 22 ++++++++++++++++++++++ types/jpeg-js/tslint.json | 1 + 4 files changed, 58 insertions(+) create mode 100644 types/jpeg-js/index.d.ts create mode 100644 types/jpeg-js/jpeg-js-tests.ts create mode 100644 types/jpeg-js/tsconfig.json create mode 100644 types/jpeg-js/tslint.json diff --git a/types/jpeg-js/index.d.ts b/types/jpeg-js/index.d.ts new file mode 100644 index 0000000000..b3525b5449 --- /dev/null +++ b/types/jpeg-js/index.d.ts @@ -0,0 +1,18 @@ +// Type definitions for jpeg-js 0.3 +// Project: https://github.com/eugeneware/jpeg-js#readme +// Definitions by: Daniel Rosenwasser +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +export interface RawImageData { + data: D; + width: number; + height: number; +} + +export function decode(jpegData: ArrayLike | Iterable | ArrayBuffer, useTypedArray: true): RawImageData; +export function decode(jpegData: ArrayLike | Iterable | ArrayBuffer, useTypedArray?: false): RawImageData; +export function decode(jpegData: ArrayLike | Iterable | ArrayBuffer, useTypedArray: boolean): RawImageData; + +export function encode(imgData: RawImageData, qu?: number): RawImageData; diff --git a/types/jpeg-js/jpeg-js-tests.ts b/types/jpeg-js/jpeg-js-tests.ts new file mode 100644 index 0000000000..9b66878e5d --- /dev/null +++ b/types/jpeg-js/jpeg-js-tests.ts @@ -0,0 +1,17 @@ +/// + +import fs = require("fs"); +import jpeg = require("jpeg-js"); + +const x = fs.readFileSync("hello.jpg"); +const decoded = jpeg.decode(x, true); + +const { width, height } = decoded; + +width; // $ExpectType number +height; // $ExpectType number +decoded.data; // $ExpectType Uint8Array + +fs.writeFileSync("re-encoded.jpg", jpeg.encode({ + width, height, data: decoded.data +}, 50)); diff --git a/types/jpeg-js/tsconfig.json b/types/jpeg-js/tsconfig.json new file mode 100644 index 0000000000..1e3c116f4f --- /dev/null +++ b/types/jpeg-js/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es2015" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "jpeg-js-tests.ts" + ] +} diff --git a/types/jpeg-js/tslint.json b/types/jpeg-js/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/jpeg-js/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From e2149cb99684a40929b5903e013ec34000b81bec Mon Sep 17 00:00:00 2001 From: loopArray <525029662@qq.com> Date: Thu, 31 Aug 2017 10:25:19 +0800 Subject: [PATCH 075/156] add missing TabBarItem add missing TabBarItem --- types/react-native-vector-icons/Icon.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/react-native-vector-icons/Icon.d.ts b/types/react-native-vector-icons/Icon.d.ts index bb56a01794..07fd38f91b 100644 --- a/types/react-native-vector-icons/Icon.d.ts +++ b/types/react-native-vector-icons/Icon.d.ts @@ -197,6 +197,7 @@ export class Icon extends React.Component { export namespace Icon { class ToolbarAndroid extends React.Component {} + class TabBarItem extends React.Component {} class TabBarItemIOS extends React.Component {} class Button extends React.Component {} } From eb124c3a5757b75bf201abc6e0a52993261f956f Mon Sep 17 00:00:00 2001 From: loopArray <525029662@qq.com> Date: Thu, 31 Aug 2017 10:26:01 +0800 Subject: [PATCH 076/156] add Custom Icon test --- .../react-native-vector-icons-tests.tsx | 49 +++++++++++++++++-- 1 file changed, 46 insertions(+), 3 deletions(-) diff --git a/types/react-native-vector-icons/react-native-vector-icons-tests.tsx b/types/react-native-vector-icons/react-native-vector-icons-tests.tsx index 99a2b3ac8b..7d71ccfc01 100644 --- a/types/react-native-vector-icons/react-native-vector-icons-tests.tsx +++ b/types/react-native-vector-icons/react-native-vector-icons-tests.tsx @@ -1,9 +1,22 @@ import * as React from 'react'; import { View, Text, TabBarIOS } from 'react-native'; +import { createIconSet } from 'react-native-vector-icons'; import MaterialIcon from 'react-native-vector-icons/MaterialIcons'; import FontAwesomeIcon from 'react-native-vector-icons/FontAwesome'; import Ionicon from 'react-native-vector-icons/Ionicons'; +const glyphMap = { + "station": 58918 +} + +const CustomIcon = createIconSet(glyphMap, 'FontCustom', 'FontCustom.ttf'); + +const CustomIconButton = CustomIcon.Button; +const CustomIconTabBarItem = CustomIcon.TabBarItem; +const CustomIconTabBarItemIOS = CustomIcon.TabBarItemIOS; +const CustomIconToolbarAndroid = CustomIcon.ToolbarAndroid; +const CustomIcongetImageSource = CustomIcon.getImageSource; + class Example extends React.Component { handleButton() { console.log('You pressed me'); @@ -30,7 +43,7 @@ class Example extends React.Component { } } -class TabTest extends React.Component { +class TabTest extends React.Component { constructor() { super(); @@ -49,7 +62,7 @@ class TabTest extends React.Component { selectedIconColor="pink" renderAsOriginal selected={this.state.selectedTab === 'tab1'} - onPress={() => this.setState({selectedTab: 'tab1'})} + onPress={() => this.setState({ selectedTab: 'tab1' })} > @@ -61,7 +74,7 @@ class TabTest extends React.Component { selectedIconColor='pink' renderAsOriginal selected={this.state.selectedTab === 'tab2'} - onPress={() => this.setState({selectedTab: 'tab2'})} + onPress={() => this.setState({ selectedTab: 'tab2' })} > @@ -69,3 +82,33 @@ class TabTest extends React.Component { ); } } + +class TestCustomIcon extends React.Component { + constructor() { + super(); + } + + handleButton() { + console.log('You pressed me'); + } + + render() { + return ( + + {/* Custom Icon */} + + + {/* Custom Icon button */} + this.handleButton()} + > + + Hello CustomIcon! + + + + ); + } +} From 65106bb98734b1c652d17668bfa2f9df6ad3aa87 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 30 Aug 2017 20:42:22 -0700 Subject: [PATCH 077/156] Don't reference 'node' in tests for 'jpeg-js'. --- types/jpeg-js/jpeg-js-tests.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/types/jpeg-js/jpeg-js-tests.ts b/types/jpeg-js/jpeg-js-tests.ts index 9b66878e5d..17bbc4fd5f 100644 --- a/types/jpeg-js/jpeg-js-tests.ts +++ b/types/jpeg-js/jpeg-js-tests.ts @@ -1,7 +1,5 @@ -/// - -import fs = require("fs"); import jpeg = require("jpeg-js"); +import fs = require("fs"); const x = fs.readFileSync("hello.jpg"); const decoded = jpeg.decode(x, true); From fab36d348cb3e3efcb2ca54dbea28e84c5eaabb1 Mon Sep 17 00:00:00 2001 From: Samphan Raruenrom Date: Thu, 31 Aug 2017 13:02:37 +0700 Subject: [PATCH 078/156] meteor: fix to allow strictNullChecks --- types/meteor/ejson.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/types/meteor/ejson.d.ts b/types/meteor/ejson.d.ts index 45ae2627c0..a6294fb8be 100644 --- a/types/meteor/ejson.d.ts +++ b/types/meteor/ejson.d.ts @@ -5,10 +5,10 @@ interface EJSONableCustomType { typeName(): string; } interface EJSONable { - [key: string]: number | string | boolean | Object | number[] | string[] | Object[] | Date | Uint8Array | EJSONableCustomType; + [key: string]: number | string | boolean | Object | number[] | string[] | Object[] | Date | Uint8Array | EJSONableCustomType | undefined | null; } interface JSONable { - [key: string]: number | string | boolean | Object | number[] | string[] | Object[]; + [key: string]: number | string | boolean | Object | number[] | string[] | Object[] | undefined | null; } interface EJSON extends EJSONable { } @@ -44,10 +44,10 @@ declare module "meteor/ejson" { typeName(): string; } interface EJSONable { - [key: string]: number | string | boolean | Object | number[] | string[] | Object[] | Date | Uint8Array | EJSONableCustomType; + [key: string]: number | string | boolean | Object | number[] | string[] | Object[] | Date | Uint8Array | EJSONableCustomType | undefined | null; } interface JSONable { - [key: string]: number | string | boolean | Object | number[] | string[] | Object[]; + [key: string]: number | string | boolean | Object | number[] | string[] | Object[] | undefined | null; } interface EJSON extends EJSONable { } From 4e786d53cee6a08fdd1e21bfae02b4c0b0733da8 Mon Sep 17 00:00:00 2001 From: Samphan Raruenrom Date: Thu, 31 Aug 2017 13:13:16 +0700 Subject: [PATCH 079/156] meteor: add methods to Mongo.ObjectID These method are accessible from meteor Mongo.ObjectID but missing. Per https://docs.meteor.com/api/collections.html#Mongo-ObjectID : "Mongo.ObjectID follows the same API as the Node MongoDB driver ObjectID class" When I check the Node.js MongoDB Driver API, only these two methods are interesting. (getTimestamp() doesn't make sense in Meteor). I've a test that call both methods successfully. --- types/meteor/mongo.d.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/types/meteor/mongo.d.ts b/types/meteor/mongo.d.ts index af632bdab1..99f931ec28 100644 --- a/types/meteor/mongo.d.ts +++ b/types/meteor/mongo.d.ts @@ -214,7 +214,10 @@ declare module "meteor/mongo" { interface ObjectIDStatic { new (hexString?: string): ObjectID; } - interface ObjectID { } + interface ObjectID { + toHexString(): string; + equals(otherID: ObjectID): boolean; + } function setConnectionOptions(options: any): void; } From c37768ab5ae36eaab8041878837d6e51f685918e Mon Sep 17 00:00:00 2001 From: loopArray <525029662@qq.com> Date: Thu, 31 Aug 2017 14:48:45 +0800 Subject: [PATCH 080/156] Update react-native-vector-icons-tests.tsx --- .../react-native-vector-icons-tests.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-native-vector-icons/react-native-vector-icons-tests.tsx b/types/react-native-vector-icons/react-native-vector-icons-tests.tsx index 7d71ccfc01..9615de18f4 100644 --- a/types/react-native-vector-icons/react-native-vector-icons-tests.tsx +++ b/types/react-native-vector-icons/react-native-vector-icons-tests.tsx @@ -6,7 +6,7 @@ import FontAwesomeIcon from 'react-native-vector-icons/FontAwesome'; import Ionicon from 'react-native-vector-icons/Ionicons'; const glyphMap = { - "station": 58918 + "custom": 58918 } const CustomIcon = createIconSet(glyphMap, 'FontCustom', 'FontCustom.ttf'); From 9bf1a6a4d656eaf17f64f53ae62aaf91a912ee43 Mon Sep 17 00:00:00 2001 From: maxpaj Date: Thu, 31 Aug 2017 09:03:48 +0200 Subject: [PATCH 081/156] Replaced `String` type with `string` --- types/fluent-ffmpeg/index.d.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/types/fluent-ffmpeg/index.d.ts b/types/fluent-ffmpeg/index.d.ts index 5d45a3d465..1b86816787 100644 --- a/types/fluent-ffmpeg/index.d.ts +++ b/types/fluent-ffmpeg/index.d.ts @@ -144,10 +144,10 @@ declare namespace Ffmpeg { audioFrequency(freq: number): FfmpegCommand; withAudioQuality(quality: number): FfmpegCommand; audioQuality(quality: number): FfmpegCommand; - withAudioFilter(filters: { filter: string, options: any }[] | String | String[]): FfmpegCommand; - withAudioFilters(filters: { filter: string, options: any }[] | String | String[]): FfmpegCommand; - audioFilter(filters: { filter: string, options: any }[] | String | String[]): FfmpegCommand; - audioFilters(filters: { filter: string, options: any }[] | String | String[]): FfmpegCommand; + withAudioFilter(filters: { filter: string, options: any }[] | string | Array): FfmpegCommand; + withAudioFilters(filters: { filter: string, options: any }[] | string | Array): FfmpegCommand; + audioFilter(filters: { filter: string, options: any }[] | string | Array): FfmpegCommand; + audioFilters(filters: { filter: string, options: any }[] | string | Array): FfmpegCommand; // options/video; withNoVideo(): FfmpegCommand; @@ -156,10 +156,10 @@ declare namespace Ffmpeg { videoCodec(codec: string): FfmpegCommand; withVideoBitrate(bitrate: string | number): FfmpegCommand; videoBitrate(bitrate: string | number): FfmpegCommand; - withVideoFilter(filters: { filter: string, options: any }[] | String | String[]): FfmpegCommand; - withVideoFilters(filters: { filter: string, options: any }[] | String | String[]): FfmpegCommand; - videoFilter(filters: { filter: string, options: any }[] | String | String[]): FfmpegCommand; - videoFilters(filters: { filter: string, options: any }[] | String | String[]): FfmpegCommand; + withVideoFilter(filters: { filter: string, options: any }[] | string | Array): FfmpegCommand; + withVideoFilters(filters: { filter: string, options: any }[] | string | Array): FfmpegCommand; + videoFilter(filters: { filter: string, options: any }[] | string | Array): FfmpegCommand; + videoFilters(filters: { filter: string, options: any }[] | string | Array): FfmpegCommand; withOutputFps(fps: number): FfmpegCommand; withOutputFPS(fps: number): FfmpegCommand; withFpsOutput(fps: number): FfmpegCommand; From 27baba70b1aa52050b14fa40fa093928e972523a Mon Sep 17 00:00:00 2001 From: maxpaj Date: Thu, 31 Aug 2017 09:23:24 +0200 Subject: [PATCH 082/156] Corrected parameters and extracted AudoVideoFilter interface --- types/fluent-ffmpeg/index.d.ts | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/types/fluent-ffmpeg/index.d.ts b/types/fluent-ffmpeg/index.d.ts index 1b86816787..2ecd56f1a5 100644 --- a/types/fluent-ffmpeg/index.d.ts +++ b/types/fluent-ffmpeg/index.d.ts @@ -104,6 +104,11 @@ declare namespace Ffmpeg { fastSeek?: boolean; size?: string; } + + interface AudioVideoFilter { + filter: string; + options: string | string[] | Object; + } class FfmpegCommand extends events.EventEmitter { constructor(options?: FfmpegCommandOptions); @@ -144,10 +149,10 @@ declare namespace Ffmpeg { audioFrequency(freq: number): FfmpegCommand; withAudioQuality(quality: number): FfmpegCommand; audioQuality(quality: number): FfmpegCommand; - withAudioFilter(filters: { filter: string, options: any }[] | string | Array): FfmpegCommand; - withAudioFilters(filters: { filter: string, options: any }[] | string | Array): FfmpegCommand; - audioFilter(filters: { filter: string, options: any }[] | string | Array): FfmpegCommand; - audioFilters(filters: { filter: string, options: any }[] | string | Array): FfmpegCommand; + withAudioFilter(filters: string | string[] | Array): FfmpegCommand; + withAudioFilters(filters: string | string[] | Array): FfmpegCommand; + audioFilter(filters: string | string[] | Array): FfmpegCommand; + audioFilters(filters: string | string[] | Array): FfmpegCommand; // options/video; withNoVideo(): FfmpegCommand; @@ -156,10 +161,10 @@ declare namespace Ffmpeg { videoCodec(codec: string): FfmpegCommand; withVideoBitrate(bitrate: string | number): FfmpegCommand; videoBitrate(bitrate: string | number): FfmpegCommand; - withVideoFilter(filters: { filter: string, options: any }[] | string | Array): FfmpegCommand; - withVideoFilters(filters: { filter: string, options: any }[] | string | Array): FfmpegCommand; - videoFilter(filters: { filter: string, options: any }[] | string | Array): FfmpegCommand; - videoFilters(filters: { filter: string, options: any }[] | string | Array): FfmpegCommand; + withVideoFilter(filters: string | string[] | Array): FfmpegCommand; + withVideoFilters(filters: string | string[] | Array): FfmpegCommand; + videoFilter(filters: string | string[] | Array): FfmpegCommand; + videoFilters(filters: string | string[] | Array): FfmpegCommand; withOutputFps(fps: number): FfmpegCommand; withOutputFPS(fps: number): FfmpegCommand; withFpsOutput(fps: number): FfmpegCommand; From 79e7c252f342624e5cca70cebe1db8fbdb467fdc Mon Sep 17 00:00:00 2001 From: maxpaj Date: Thu, 31 Aug 2017 09:34:11 +0200 Subject: [PATCH 083/156] Fix Travis errors --- types/fluent-ffmpeg/index.d.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/types/fluent-ffmpeg/index.d.ts b/types/fluent-ffmpeg/index.d.ts index 2ecd56f1a5..2f57bb8347 100644 --- a/types/fluent-ffmpeg/index.d.ts +++ b/types/fluent-ffmpeg/index.d.ts @@ -104,10 +104,10 @@ declare namespace Ffmpeg { fastSeek?: boolean; size?: string; } - + interface AudioVideoFilter { filter: string; - options: string | string[] | Object; + options: string | string[] | object; } class FfmpegCommand extends events.EventEmitter { @@ -149,10 +149,10 @@ declare namespace Ffmpeg { audioFrequency(freq: number): FfmpegCommand; withAudioQuality(quality: number): FfmpegCommand; audioQuality(quality: number): FfmpegCommand; - withAudioFilter(filters: string | string[] | Array): FfmpegCommand; - withAudioFilters(filters: string | string[] | Array): FfmpegCommand; - audioFilter(filters: string | string[] | Array): FfmpegCommand; - audioFilters(filters: string | string[] | Array): FfmpegCommand; + withAudioFilter(filters: string | string[] | AudioVideoFilter[]): FfmpegCommand; + withAudioFilters(filters: string | string[] | AudioVideoFilter[]): FfmpegCommand; + audioFilter(filters: string | string[] | AudioVideoFilter[]): FfmpegCommand; + audioFilters(filters: string | string[] | AudioVideoFilter[]): FfmpegCommand; // options/video; withNoVideo(): FfmpegCommand; From 7644721413e0d93332f6794454889c86eb92784a Mon Sep 17 00:00:00 2001 From: maxpaj Date: Thu, 31 Aug 2017 09:34:53 +0200 Subject: [PATCH 084/156] Some more fix... --- types/fluent-ffmpeg/index.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/types/fluent-ffmpeg/index.d.ts b/types/fluent-ffmpeg/index.d.ts index 2f57bb8347..97b07c8bd6 100644 --- a/types/fluent-ffmpeg/index.d.ts +++ b/types/fluent-ffmpeg/index.d.ts @@ -161,10 +161,10 @@ declare namespace Ffmpeg { videoCodec(codec: string): FfmpegCommand; withVideoBitrate(bitrate: string | number): FfmpegCommand; videoBitrate(bitrate: string | number): FfmpegCommand; - withVideoFilter(filters: string | string[] | Array): FfmpegCommand; - withVideoFilters(filters: string | string[] | Array): FfmpegCommand; - videoFilter(filters: string | string[] | Array): FfmpegCommand; - videoFilters(filters: string | string[] | Array): FfmpegCommand; + withVideoFilter(filters: string | string[] | AudioVideoFilter[]): FfmpegCommand; + withVideoFilters(filters: string | string[] | AudioVideoFilter[]): FfmpegCommand; + videoFilter(filters: string | string[] | AudioVideoFilter[]): FfmpegCommand; + videoFilters(filters: string | string[] | AudioVideoFilter[]): FfmpegCommand; withOutputFps(fps: number): FfmpegCommand; withOutputFPS(fps: number): FfmpegCommand; withFpsOutput(fps: number): FfmpegCommand; From fe214f98c28b65e99038b59d259b7a73f9340126 Mon Sep 17 00:00:00 2001 From: maxpaj Date: Thu, 31 Aug 2017 09:41:49 +0200 Subject: [PATCH 085/156] Use `{}` instead of `object`. --- types/fluent-ffmpeg/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/fluent-ffmpeg/index.d.ts b/types/fluent-ffmpeg/index.d.ts index 97b07c8bd6..87bdbfe15c 100644 --- a/types/fluent-ffmpeg/index.d.ts +++ b/types/fluent-ffmpeg/index.d.ts @@ -107,7 +107,7 @@ declare namespace Ffmpeg { interface AudioVideoFilter { filter: string; - options: string | string[] | object; + options: string | string[] | {}; } class FfmpegCommand extends events.EventEmitter { From 84b7de8cef99095bc52e0123c602e16e194f7aab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andre=CC=81=20Wachter?= Date: Thu, 31 Aug 2017 11:00:43 +0200 Subject: [PATCH 086/156] [pg] Reexport the 'pg' module under an attribute 'native' Gives optional access to the native client if installed. --- types/pg/index.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/types/pg/index.d.ts b/types/pg/index.d.ts index da6f4db575..d8f41a7e36 100644 --- a/types/pg/index.d.ts +++ b/types/pg/index.d.ts @@ -126,3 +126,7 @@ export declare class Events extends events.EventEmitter { export const types: typeof pgTypes; export const defaults: Defaults & ClientConfig; + +import * as Pg from 'pg'; + +export const native: typeof Pg | null; From 6e75e3644b622e3a7e96d4273d8951c74893e396 Mon Sep 17 00:00:00 2001 From: Leo Liang Date: Thu, 31 Aug 2017 17:57:20 +0800 Subject: [PATCH 087/156] Copy v6 types to its folder --- types/pg/v6/index.d.ts | 128 ++++++++++++++++++++++++++++++++++++++ types/pg/v6/pg-tests.ts | 81 ++++++++++++++++++++++++ types/pg/v6/tsconfig.json | 25 ++++++++ 3 files changed, 234 insertions(+) create mode 100644 types/pg/v6/index.d.ts create mode 100644 types/pg/v6/pg-tests.ts create mode 100644 types/pg/v6/tsconfig.json diff --git a/types/pg/v6/index.d.ts b/types/pg/v6/index.d.ts new file mode 100644 index 0000000000..5624989ac7 --- /dev/null +++ b/types/pg/v6/index.d.ts @@ -0,0 +1,128 @@ +// Type definitions for pg 6.1 +// Project: https://github.com/brianc/node-postgres +// Definitions by: Phips Peter +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +import events = require("events"); +import stream = require("stream"); +import pgTypes = require("pg-types"); + +export declare function connect(connection: string, callback: (err: Error, client: Client, done: (err?: any) => void) => void): void; +export declare function connect(config: ClientConfig, callback: (err: Error, client: Client, done: (err?: any) => void) => void): void; +export declare function end(): void; + +export interface ConnectionConfig { + user?: string; + database?: string; + password?: string; + port?: number; + host?: string; +} + +export interface Defaults extends ConnectionConfig { + poolSize?: number; + poolIdleTimeout?: number; + reapIntervalMillis?: number; + binary?: boolean; + parseInt8?: boolean; +} + +import { TlsOptions } from "tls"; + +export interface ClientConfig extends ConnectionConfig { + ssl?: boolean | TlsOptions; +} + +export interface PoolConfig extends ClientConfig { + // properties from module 'node-pool' + max?: number; + min?: number; + refreshIdle?: boolean; + idleTimeoutMillis?: number; + reapIntervalMillis?: number; + returnToHead?: boolean; + application_name?: string; + Promise?: PromiseConstructorLike; +} + +export interface QueryConfig { + name?: string; + text: string; + values?: any[]; +} + +export interface QueryResult { + command: string; + rowCount: number; + oid: number; + rows: any[]; +} + +export interface ResultBuilder extends QueryResult { + addRow(row: any): void; +} + +export declare class Pool extends events.EventEmitter { + // `new Pool('pg://user@localhost/mydb')` is not allowed. + // But it passes type check because of issue: + // https://github.com/Microsoft/TypeScript/issues/7485 + constructor(config?: PoolConfig); + + connect(): Promise; + connect(callback: (err: Error, client: Client, done: () => void) => void): void; + + end(callback?: () => void): Promise; + + query(queryStream: QueryConfig & stream.Readable): stream.Readable; + query(queryTextOrConfig: string | QueryConfig): Promise; + query(queryText: string, values: any[]): Promise; + + query(queryTextOrConfig: string | QueryConfig, callback: (err: Error, result: QueryResult) => void): Query; + query(queryText: string, values: any[], callback: (err: Error, result: QueryResult) => void): Query; + + on(event: "error", listener: (err: Error, client: Client) => void): this; + on(event: "connect" | "acquire", listener: (client: Client) => void): this; +} + +export declare class Client extends events.EventEmitter { + constructor(connection: string); + constructor(config: ClientConfig); + + connect(callback?: (err: Error) => void): void; + end(callback?: (err: Error) => void): void; + release(err?: Error): void; + + query(queryStream: QueryConfig & stream.Readable): stream.Readable; + query(queryTextOrConfig: string | QueryConfig): Promise; + query(queryText: string, values: any[]): Promise; + + query(queryTextOrConfig: string | QueryConfig, callback: (err: Error, result: QueryResult) => void): Query; + query(queryText: string, values: any[], callback: (err: Error, result: QueryResult) => void): Query; + + copyFrom(queryText: string): stream.Writable; + copyTo(queryText: string): stream.Readable; + + pauseDrain(): void; + resumeDrain(): void; + + on(event: "drain", listener: () => void): this; + on(event: "error", listener: (err: Error) => void): this; + on(event: "notification" | "notice", listener: (message: any) => void): this; + on(event: "end", listener: () => void): this; +} + +export declare class Query extends events.EventEmitter { + on(event: "row", listener: (row: any, result?: ResultBuilder) => void): this; + on(event: "error", listener: (err: Error) => void): this; + on(event: "end", listener: (result: ResultBuilder) => void): this; +} + +export declare class Events extends events.EventEmitter { + on(event: "error", listener: (err: Error, client: Client) => void): this; +} + +export const types: typeof pgTypes; + +export const defaults: Defaults & ClientConfig; diff --git a/types/pg/v6/pg-tests.ts b/types/pg/v6/pg-tests.ts new file mode 100644 index 0000000000..4b4cfba7ec --- /dev/null +++ b/types/pg/v6/pg-tests.ts @@ -0,0 +1,81 @@ +import * as pg from "pg"; + +var conString = "postgres://username:password@localhost/database"; + +// https://github.com/brianc/node-pg-types +pg.types.setTypeParser(20, val => Number(val)); + +// Client pooling +pg.defaults.ssl = true; +pg.connect(conString, (err, client, done) => { + if (err) { + return console.error("Error fetching client from pool", err); + } + client.query("SELECT $1::int AS number", ["1"], (err, result) => { + if (err) { + done(err); + return console.error("Error running query", err); + } + else { + done(); + } + console.log(result.rows[0]["number"]); + return null; + }); + return null; +}); + +// Simple +var client = new pg.Client(conString); +client.connect(err => { + if (err) { + return console.error("Could not connect to postgres", err); + } + client.query("SELECT NOW() AS 'theTime'", (err, result) => { + if (err) { + return console.error("Error running query", err); + } + console.log(result.rowCount); + console.log(result.rows[0]["theTime"]); + client.end(); + return null; + }); + return null; +}); +client.on('end', () => console.log("Client was disconnected.")); + +// client pooling + +var config = { + user: 'foo', //env var: PGUSER + database: 'my_db', //env var: PGDATABASE + password: 'secret', //env var: PGPASSWORD + port: 5432, //env var: PGPORT + max: 10, // max number of clients in the pool + idleTimeoutMillis: 30000, // how long a client is allowed to remain idle before being closed + Promise, +}; +var pool = new pg.Pool(config); + +pool.connect((err, client, done) => { + if(err) { + return console.error('error fetching client from pool', err); + } + client.query('SELECT $1::int AS number', ['1'], (err, result) => { + done(); + + if(err) { + return console.error('error running query', err); + } + console.log(result.rows[0].number); + }); +}); + +pool.on('error', (err, client) => { + console.error('idle client error', err.message, err.stack) +}) + +pool.end(); +pool.end(() => { + console.log("pool is closed"); +}); diff --git a/types/pg/v6/tsconfig.json b/types/pg/v6/tsconfig.json new file mode 100644 index 0000000000..2c44f5862b --- /dev/null +++ b/types/pg/v6/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "paths": { + "pg": [ "pg/v6" ] + }, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "pg-tests.ts" + ] +} From 2a5c1e01447c284ea115981d8f8e69e3f14f208e Mon Sep 17 00:00:00 2001 From: loopArray <525029662@qq.com> Date: Thu, 31 Aug 2017 22:30:16 +0800 Subject: [PATCH 088/156] Update react-native-vector-icons-tests.tsx --- .../react-native-vector-icons-tests.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/react-native-vector-icons/react-native-vector-icons-tests.tsx b/types/react-native-vector-icons/react-native-vector-icons-tests.tsx index 9615de18f4..e6dc2bb600 100644 --- a/types/react-native-vector-icons/react-native-vector-icons-tests.tsx +++ b/types/react-native-vector-icons/react-native-vector-icons-tests.tsx @@ -6,8 +6,8 @@ import FontAwesomeIcon from 'react-native-vector-icons/FontAwesome'; import Ionicon from 'react-native-vector-icons/Ionicons'; const glyphMap = { - "custom": 58918 -} + 'custom': 58918 +}; const CustomIcon = createIconSet(glyphMap, 'FontCustom', 'FontCustom.ttf'); From 3d7c85d2d034d485d4ff0c0a97ad07a9c1652545 Mon Sep 17 00:00:00 2001 From: loopArray <525029662@qq.com> Date: Thu, 31 Aug 2017 22:34:21 +0800 Subject: [PATCH 089/156] Update react-native-vector-icons-tests.tsx --- .../react-native-vector-icons-tests.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-native-vector-icons/react-native-vector-icons-tests.tsx b/types/react-native-vector-icons/react-native-vector-icons-tests.tsx index e6dc2bb600..b6adf8d8c6 100644 --- a/types/react-native-vector-icons/react-native-vector-icons-tests.tsx +++ b/types/react-native-vector-icons/react-native-vector-icons-tests.tsx @@ -6,7 +6,7 @@ import FontAwesomeIcon from 'react-native-vector-icons/FontAwesome'; import Ionicon from 'react-native-vector-icons/Ionicons'; const glyphMap = { - 'custom': 58918 + custom: 58918 }; const CustomIcon = createIconSet(glyphMap, 'FontCustom', 'FontCustom.ttf'); From 76e8326e9f5d8584894de47046c7f1cdc570fb18 Mon Sep 17 00:00:00 2001 From: Graham Mendick Date: Thu, 31 Aug 2017 15:54:51 +0100 Subject: [PATCH 090/156] Updated typings and tests for Navigation 4.0.1 --- types/navigation/index.d.ts | 8 ++++++++ types/navigation/navigation-tests.ts | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/types/navigation/index.d.ts b/types/navigation/index.d.ts index 6f05956a8a..fdc729f11c 100644 --- a/types/navigation/index.d.ts +++ b/types/navigation/index.d.ts @@ -347,6 +347,10 @@ export class StateContext { * Gets the NavigationData for the last displayed State */ oldData: any; + /** + * Gets the Url for the last displayed State + */ + oldUrl: string; /** * Gets the State of the last Crumb in the crumb trail */ @@ -355,6 +359,10 @@ export class StateContext { * Gets the NavigationData of the last Crumb in the crumb trail */ previousData: any; + /** + * Gets the Url of the last Crumb in the crumb trail + */ + previousUrl: string; /** * Gets the current State */ diff --git a/types/navigation/navigation-tests.ts b/types/navigation/navigation-tests.ts index f710670953..37e597f841 100644 --- a/types/navigation/navigation-tests.ts +++ b/types/navigation/navigation-tests.ts @@ -83,12 +83,14 @@ link = stateNavigator.fluent() // State Context let state: State = stateNavigator.stateContext.state; -const url: string = stateNavigator.stateContext.url; +let url: string = stateNavigator.stateContext.url; const title: string = stateNavigator.stateContext.title; let page: number = stateNavigator.stateContext.data.page; state = stateNavigator.stateContext.oldState; +url = stateNavigator.stateContext.oldUrl; page = stateNavigator.stateContext.oldData.page; state = stateNavigator.stateContext.previousState; +url = stateNavigator.stateContext.previousUrl; page = stateNavigator.stateContext.previousData.page; // Navigation Data From 341edc76faabd58a2f184d4c9de66b5787cef26c Mon Sep 17 00:00:00 2001 From: bizen241 Date: Fri, 1 Sep 2017 01:48:38 +0900 Subject: [PATCH 091/156] [vfile]: add types --- types/vfile/index.d.ts | 152 +++++++++++++++++++++++++++++++++++++ types/vfile/tsconfig.json | 22 ++++++ types/vfile/tslint.json | 1 + types/vfile/vfile-tests.ts | 47 ++++++++++++ 4 files changed, 222 insertions(+) create mode 100644 types/vfile/index.d.ts create mode 100644 types/vfile/tsconfig.json create mode 100644 types/vfile/tslint.json create mode 100644 types/vfile/vfile-tests.ts diff --git a/types/vfile/index.d.ts b/types/vfile/index.d.ts new file mode 100644 index 0000000000..590fed550b --- /dev/null +++ b/types/vfile/index.d.ts @@ -0,0 +1,152 @@ +// Type definitions for VFile 2.2 +// Project: https://github.com/vfile/vfile +// Definitions by: bizen241 +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +/// + +import * as Unist from 'unist'; + +export = VFile; + +/** + * Create a new virtual file. + * Path related properties are set in the following order (least specific to most specific): `history`, `path`, `basename`, `stem`, `extname`, `dirname`. + * It’s not possible to set either `dirname` or `extname` without setting either `history`, `path`, `basename`, or `stem` as well. + * @param options If `options` is `string` or `Buffer`, treats it as `{contents: options}`. If `options` is a `VFile`, returns it. All other options are set on the newly created `vfile`. + */ +declare function VFile(options?: string | Buffer | Partial): VFile.VFile; + +declare namespace VFile { + interface VFile { + [key: string]: any; + /** + * Raw value. + */ + contents: string | Buffer | null; + /** + * Base of `path`. + * Defaults to `process.cwd()`. + */ + cwd: string; + /** + * Path of `vfile`. + * Cannot be nullified. + */ + path?: string; + /** + * Current name (including extension) of `vfile`. + * Cannot contain path separators. + * Cannot be nullified either (use `file.path = file.dirname` instead). + */ + basename?: string; + /** + * Name (without extension) of `vfile`. + * Cannot be nullified, and cannot contain path separators. + */ + stem?: string; + /** + * Extension (with dot) of `vfile`. + * Cannot be set if there's no `path` yet and cannot contain path separators. + */ + extname?: string; + /** + * Path to parent directory of `vfile`. + * Cannot be set if there's no `path` yet. + */ + dirname?: string; + /** + * List of file-paths the file moved between. + */ + history: string[]; + /** + * List of messages associated with the file. + */ + messages: VFileMessage[]; + /** + * Place to store custom information. + * It's OK to store custom data directly on the `vfile`, moving it to `data` gives a little more privacy. + */ + data: object; + /** + * Convert contents of `vfile` to string. + * @param encoding If `contents` is a buffer, `encoding` is used to stringify buffers (default: `'utf8'`). + */ + toString(encoding?: string): string; + /** + * Associates a message with the file for `reason` at `position`. + * When an error is passed in as `reason`, copies the stack. + * Each message has a `fatal` property which by default is set to `false` (ie. `warning`). + * @param reason Reason for message. Uses the stack and message of the error if given. + * @param position Place at which the message occurred in `vfile`. + * @param ruleId Category of message. + */ + message(reason: string | Error, position?: Unist.Node | Unist.Point | Unist.Position, ruleId?: string): VFileMessage; + /** + * Associates an informational message with the file, where `fatal` is set to `null`. + * Calls `message()` internally. + * @param reason Reason for message. Uses the stack and message of the error if given. + * @param position Place at which the message occurred in `vfile`. + * @param ruleId Category of message. + */ + info(reason: string | Error, position?: Unist.Node | Unist.Point | Unist.Position, ruleId?: string): VFileMessage; + /** + * Associates a fatal message with the file, then immediately throws it. + * Note: fatal errors mean a file is no longer processable. + * Calls `message()` internally. + * @param reason Reason for message. Uses the stack and message of the error if given. + * @param position Place at which the message occurred in `vfile`. + * @param ruleId Category of message. + */ + fail(reason: string | Error, position?: Unist.Node | Unist.Point | Unist.Position, ruleId?: string): VFileMessage; + } + + /** + * File-related message describing something at certain position. + */ + interface VFileMessage extends Error { + /** + * File-path, when the message was triggered. + */ + file: string; + /** + * Reason for message. + */ + reason: string; + /** + * Category of message. + */ + ruleId: string | null; + /** + * Namespace of warning. + */ + source: string | null; + /** + * If true, marks associated file as no longer processable. + */ + fatal: boolean | null; + /** + * Starting line of error. + */ + line: number | null; + /** + * Starting column of error. + */ + column: number | null; + /** + * Full range information, when available. + * Has start and end properties, both set to an object with line and column, set to number?. + */ + location: { + start: { + line: number | null; + column: number | null; + }; + end: { + line: number | null; + column: number | null; + }; + }; + } +} diff --git a/types/vfile/tsconfig.json b/types/vfile/tsconfig.json new file mode 100644 index 0000000000..7615c6e59a --- /dev/null +++ b/types/vfile/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "vfile-tests.ts" + ] +} diff --git a/types/vfile/tslint.json b/types/vfile/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/vfile/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/vfile/vfile-tests.ts b/types/vfile/vfile-tests.ts new file mode 100644 index 0000000000..aae566154b --- /dev/null +++ b/types/vfile/vfile-tests.ts @@ -0,0 +1,47 @@ +import * as vfile from 'vfile'; +import * as Unist from 'unist'; + +vfile(); +vfile('string'); +vfile(Buffer.from('string')); +vfile(vfile()); +vfile({ stem: 'readme', extname: '.md' }); +vfile({ custom: 'data' }); +try { + vfile({ extname: '.md' }); +} catch (e) { + console.log('Error: set extname without path'); +} + +const file: vfile.VFile = vfile({ contents: 'contents' }); + +file.path = '~/readme.txt'; +file.basename = 'example.txt'; +file.stem = 'readme'; +file.extname = '.md'; +file.data = { + key: 'value', +}; + +const history: string[] = file.history; +const contents: string = file.toString(); + +console.log('file.history =>', history); +console.log('file.contents =>', contents); + +const position: Unist.Point = { + line: 1, + column: 1, +}; + +file.message('reason', position); +file.info('reason', position); +try { + file.fail('reason', position); +} catch (e) { + console.log('Error: associated a fatal message'); +} + +const messages: vfile.VFileMessage[] = file.messages; + +console.log('file.messages =>', messages); From 9a49b95c1a483e2aeddcc6b2e82367e4fbfdfffa Mon Sep 17 00:00:00 2001 From: ikatyang Date: Fri, 1 Sep 2017 09:35:17 +0800 Subject: [PATCH 092/156] feat(prettier): add `sync` option --- types/prettier/index.d.ts | 8 +++++++- types/prettier/prettier-tests.ts | 26 ++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/types/prettier/index.d.ts b/types/prettier/index.d.ts index 48c89a5c57..07cf09fbba 100644 --- a/types/prettier/index.d.ts +++ b/types/prettier/index.d.ts @@ -102,6 +102,10 @@ export interface ResolveConfigOptions { * If set to `false`, all caching will be bypassed. */ useCache?: boolean; + /** + * If set to `true`, result will be returned directly. + */ + sync?: boolean; } /** @@ -114,7 +118,9 @@ export interface ResolveConfigOptions { * * The promise will be rejected if there was an error parsing the configuration file. */ -export function resolveConfig(filePath?: string, options?: ResolveConfigOptions): Promise; +export function resolveConfig(filePath: string | undefined, options: ResolveConfigOptions & { sync: true }): null | Options; +export function resolveConfig(filePath?: string, options?: ResolveConfigOptions & { sync?: false }): Promise; +export function resolveConfig(filePath?: string, options?: ResolveConfigOptions): null | Options | Promise; /** * As you repeatedly call `resolveConfig`, the file system structure will be cached for performance. This function will clear the cache. diff --git a/types/prettier/prettier-tests.ts b/types/prettier/prettier-tests.ts index a51e8902c4..e88ebe4770 100644 --- a/types/prettier/prettier-tests.ts +++ b/types/prettier/prettier-tests.ts @@ -24,4 +24,30 @@ prettier.resolveConfig('path/to/somewhere').then(options => { } }); +prettier.resolveConfig('path/to/somewhere', undefined).then(options => { + if (options !== null) { + const formatted = prettier.format('hello world', options); + } +}); + +prettier.resolveConfig('path/to/somewhere', {}).then(options => { + if (options !== null) { + const formatted = prettier.format('hello world', options); + } +}); + +prettier.resolveConfig('path/to/somewhere', { sync: false }).then(options => { + if (options !== null) { + const formatted = prettier.format('hello world', options); + } +}); + +// $ExpectType Options | Promise | null +prettier.resolveConfig('path/to/somewhere', { sync: true as boolean }); + +const options = prettier.resolveConfig('path/to/somewhere', { sync: true }); +if (options !== null) { + const formatted = prettier.format('hello world', options); +} + prettier.clearConfigCache(); From 1c7070ef2ea0552a868fab0ac4aa73236bd87c11 Mon Sep 17 00:00:00 2001 From: ikatyang Date: Fri, 1 Sep 2017 13:47:54 +0800 Subject: [PATCH 093/156] feat(prettier): replace `sync` option with `.sync()` method --- types/prettier/index.d.ts | 11 ++++------- types/prettier/prettier-tests.ts | 23 +---------------------- 2 files changed, 5 insertions(+), 29 deletions(-) diff --git a/types/prettier/index.d.ts b/types/prettier/index.d.ts index 07cf09fbba..317a514912 100644 --- a/types/prettier/index.d.ts +++ b/types/prettier/index.d.ts @@ -102,10 +102,6 @@ export interface ResolveConfigOptions { * If set to `false`, all caching will be bypassed. */ useCache?: boolean; - /** - * If set to `true`, result will be returned directly. - */ - sync?: boolean; } /** @@ -118,9 +114,10 @@ export interface ResolveConfigOptions { * * The promise will be rejected if there was an error parsing the configuration file. */ -export function resolveConfig(filePath: string | undefined, options: ResolveConfigOptions & { sync: true }): null | Options; -export function resolveConfig(filePath?: string, options?: ResolveConfigOptions & { sync?: false }): Promise; -export function resolveConfig(filePath?: string, options?: ResolveConfigOptions): null | Options | Promise; +export function resolveConfig(filePath?: string, options?: ResolveConfigOptions): Promise; +export namespace resolveConfig { + function sync(filePath?: string, options?: ResolveConfigOptions): null | Options; +} /** * As you repeatedly call `resolveConfig`, the file system structure will be cached for performance. This function will clear the cache. diff --git a/types/prettier/prettier-tests.ts b/types/prettier/prettier-tests.ts index e88ebe4770..8d95196101 100644 --- a/types/prettier/prettier-tests.ts +++ b/types/prettier/prettier-tests.ts @@ -24,28 +24,7 @@ prettier.resolveConfig('path/to/somewhere').then(options => { } }); -prettier.resolveConfig('path/to/somewhere', undefined).then(options => { - if (options !== null) { - const formatted = prettier.format('hello world', options); - } -}); - -prettier.resolveConfig('path/to/somewhere', {}).then(options => { - if (options !== null) { - const formatted = prettier.format('hello world', options); - } -}); - -prettier.resolveConfig('path/to/somewhere', { sync: false }).then(options => { - if (options !== null) { - const formatted = prettier.format('hello world', options); - } -}); - -// $ExpectType Options | Promise | null -prettier.resolveConfig('path/to/somewhere', { sync: true as boolean }); - -const options = prettier.resolveConfig('path/to/somewhere', { sync: true }); +const options = prettier.resolveConfig.sync('path/to/somewhere'); if (options !== null) { const formatted = prettier.format('hello world', options); } From 04338685ff819b05a8353a6397f447fee90a21a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kov=C3=A1cs=20Vince?= Date: Fri, 1 Sep 2017 10:06:57 +0200 Subject: [PATCH 094/156] Make Callback type generic --- types/nano/index.d.ts | 90 +++++++++++++++++++++---------------------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/types/nano/index.d.ts b/types/nano/index.d.ts index ab80e563d4..2378d3eb8b 100644 --- a/types/nano/index.d.ts +++ b/types/nano/index.d.ts @@ -19,7 +19,7 @@ declare namespace nano { request?(params: any): void; } - type Callback = (error: any, result: any, headers?: any) => void; + type Callback = (error: any, response: R, headers?: any) => void; interface ServerScope { readonly config: ServerConfig; @@ -29,77 +29,77 @@ declare namespace nano { request: RequestFunction; relax: RequestFunction; dinosaur: RequestFunction; - auth(username: string, userpass: string, callback?: Callback): Request; - session(callback?: Callback): Request; - updates(params?: UpdatesParams, callback?: Callback): Request; - followUpdates(params?: any, callback?: Callback): EventEmitter; - uuids(num: number, callback: Callback): Request; + auth(username: string, userpass: string, callback?: Callback): Request; + session(callback?: Callback): Request; + updates(params?: UpdatesParams, callback?: Callback): Request; + followUpdates(params?: any, callback?: Callback): EventEmitter; + uuids(num: number, callback: Callback): Request; } interface DatabaseScope { - create(name: string, callback?: Callback): Request; - get(name: string, callback?: Callback): Request; - destroy(name: string, callback?: Callback): Request; - list(callback?: Callback): Request; + create(name: string, callback?: Callback): Request; + get(name: string, callback?: Callback): Request; + destroy(name: string, callback?: Callback): Request; + list(callback?: Callback): Request; use(db: string): DocumentScope; - compact(name: string, designname?: string, callback?: Callback): Request; + compact(name: string, designname?: string, callback?: Callback): Request; replicate( source: string | DocumentScope, target: string | DocumentScope, options?: any, - callback?: Callback + callback?: Callback ): Request; - changes(name: string, params?: any, callback?: Callback): Request; + changes(name: string, params?: any, callback?: Callback): Request; follow( source: string, params?: DatabaseScopeFollowUpdatesParams, - callback?: Callback + callback?: Callback ): EventEmitter; - followUpdates(params?: any, callback?: Callback): EventEmitter; - updates(params?: UpdatesParams, callback?: Callback): Request; + followUpdates(params?: any, callback?: Callback): EventEmitter; + updates(params?: UpdatesParams, callback?: Callback): Request; } interface DocumentScope { readonly config: ServerConfig; - info(callback?: Callback): Request; + info(callback?: Callback): Request; replicate( target: string | DocumentScope, options?: any, - callback?: Callback + callback?: Callback ): Request; - compact(callback?: Callback): Request; - changes(params?: any, callback?: Callback): Request; + compact(callback?: Callback): Request; + changes(params?: any, callback?: Callback): Request; follow( params?: DocumentScopeFollowUpdatesParams, - callback?: Callback + callback?: Callback ): EventEmitter; - auth(username: string, userpass: string, callback?: Callback): Request; - session(callback?: Callback): Request; - insert(document: any, params?: any, callback?: Callback): Request; - get(docname: string, params?: any, callback?: Callback): Request; - head(docname: string, callback: Callback): Request; + auth(username: string, userpass: string, callback?: Callback): Request; + session(callback?: Callback): Request; + insert(document: any, params?: any, callback?: Callback): Request; + get(docname: string, params?: any, callback?: Callback): Request; + head(docname: string, callback: Callback): Request; copy( src_document: string, dst_document: string, options: any, - callback?: Callback + callback?: Callback ): Request; - destroy(docname: string, rev: string, callback?: Callback): Request; + destroy(docname: string, rev: string, callback?: Callback): Request; bulk( docs: BulkModifyDocsWrapper, params?: any, - callback?: Callback + callback?: Callback ): Request; - list(params?: any, callback?: Callback): Request; + list(params?: any, callback?: Callback): Request; fetch( docnames: BulkFetchDocsWrapper, params?: any, - callback?: Callback + callback?: Callback ): Request; fetchRevs( docnames: BulkFetchDocsWrapper, params?: any, - callback?: Callback + callback?: Callback ): Request; multipart: Multipart; attachment: Attachment; @@ -108,46 +108,46 @@ declare namespace nano { showname: string, doc_id: string, params?: any, - callback?: Callback + callback?: Callback ): Request; atomic( designname: string, updatename: string, docname: string, body?: any, - callback?: Callback + callback?: Callback ): Request; updateWithHandler( designname: string, updatename: string, docname: string, body?: any, - callback?: Callback + callback?: Callback ): Request; search( designname: string, searchname: string, params?: any, - callback?: Callback + callback?: Callback ): Request; spatial( ddoc: string, viewname: string, params?: any, - callback?: Callback + callback?: Callback ): Request; view( designname: string, viewname: string, params?: any, - callback?: Callback + callback?: Callback ): Request; viewWithList( designname: string, viewname: string, listname: string, params?: any, - callback?: Callback + callback?: Callback ): Request; server: ServerScope; } @@ -157,9 +157,9 @@ declare namespace nano { doc: any, attachments: any[], params: string | any, - callback?: Callback + callback?: Callback ): Request; - get(docname: string, params?: string | any, callback?: Callback): Request; + get(docname: string, params?: string | any, callback?: Callback): Request; } interface Attachment { @@ -169,19 +169,19 @@ declare namespace nano { att: any, contenttype: string, params?: any, - callback?: Callback + callback?: Callback ): Request; get( docname: string, attname: string, params?: any, - callback?: Callback + callback?: Callback ): Request; destroy( docname: string, attname: string, params?: any, - callback?: Callback + callback?: Callback ): Request; } @@ -192,7 +192,7 @@ declare namespace nano { type RequestFunction = ( options?: RequestOptions | string, - callback?: Callback + callback?: Callback ) => void; interface RequestOptions { From cdeb13e7744226addde443bfabd6df7db1989410 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kov=C3=A1cs=20Vince?= Date: Fri, 1 Sep 2017 10:26:08 +0200 Subject: [PATCH 095/156] Make DocumentScope generic (accepts document model) --- types/nano/index.d.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/types/nano/index.d.ts b/types/nano/index.d.ts index 2378d3eb8b..59ff766010 100644 --- a/types/nano/index.d.ts +++ b/types/nano/index.d.ts @@ -8,7 +8,7 @@ import { Request, CoreOptions } from "request"; declare function nano( config: nano.Configuration | string -): nano.ServerScope | nano.DocumentScope; +): nano.ServerScope | nano.DocumentScope; declare namespace nano { interface Configuration { @@ -24,8 +24,8 @@ declare namespace nano { interface ServerScope { readonly config: ServerConfig; db: DatabaseScope; - use(db: string): DocumentScope; - scope(db: string): DocumentScope; + use(db: string): DocumentScope; + scope(db: string): DocumentScope; request: RequestFunction; relax: RequestFunction; dinosaur: RequestFunction; @@ -41,11 +41,11 @@ declare namespace nano { get(name: string, callback?: Callback): Request; destroy(name: string, callback?: Callback): Request; list(callback?: Callback): Request; - use(db: string): DocumentScope; + use(db: string): DocumentScope; compact(name: string, designname?: string, callback?: Callback): Request; - replicate( - source: string | DocumentScope, - target: string | DocumentScope, + replicate( + source: string | DocumentScope, + target: string | DocumentScope, options?: any, callback?: Callback ): Request; @@ -59,11 +59,11 @@ declare namespace nano { updates(params?: UpdatesParams, callback?: Callback): Request; } - interface DocumentScope { + interface DocumentScope { readonly config: ServerConfig; info(callback?: Callback): Request; replicate( - target: string | DocumentScope, + target: string | DocumentScope, options?: any, callback?: Callback ): Request; From dde5981408bbdda9792ed9fb86f76f7ef05d1d72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kov=C3=A1cs=20Vince?= Date: Fri, 1 Sep 2017 13:22:24 +0200 Subject: [PATCH 096/156] Add overload to many methods to allow skip params attribute --- types/nano/index.d.ts | 162 ++++++++++++++++++++++++++---------------- 1 file changed, 101 insertions(+), 61 deletions(-) diff --git a/types/nano/index.d.ts b/types/nano/index.d.ts index 59ff766010..37e7491436 100644 --- a/types/nano/index.d.ts +++ b/types/nano/index.d.ts @@ -31,8 +31,10 @@ declare namespace nano { dinosaur: RequestFunction; auth(username: string, userpass: string, callback?: Callback): Request; session(callback?: Callback): Request; - updates(params?: UpdatesParams, callback?: Callback): Request; - followUpdates(params?: any, callback?: Callback): EventEmitter; + updates(callback?: Callback): Request; + updates(params: UpdatesParams, callback?: Callback): Request; + followUpdates(callback?: Callback): EventEmitter; + followUpdates(params: any, callback?: Callback): EventEmitter; uuids(num: number, callback: Callback): Request; } @@ -42,145 +44,183 @@ declare namespace nano { destroy(name: string, callback?: Callback): Request; list(callback?: Callback): Request; use(db: string): DocumentScope; - compact(name: string, designname?: string, callback?: Callback): Request; + compact(name: string, callback?: Callback): Request; + compact(name: string, designname: string, callback?: Callback): Request; + replicate( + source: string | DocumentScope, + target: string | DocumentScope, + callback?: Callback + ): Request replicate( source: string | DocumentScope, target: string | DocumentScope, options?: any, callback?: Callback ): Request; - changes(name: string, params?: any, callback?: Callback): Request; - follow( - source: string, - params?: DatabaseScopeFollowUpdatesParams, - callback?: Callback - ): EventEmitter; - followUpdates(params?: any, callback?: Callback): EventEmitter; - updates(params?: UpdatesParams, callback?: Callback): Request; + changes(name: string, callback?: Callback): Request; + changes(name: string, params: any, callback?: Callback): Request; + follow(source: string, callback?: Callback): EventEmitter; + follow(source: string, params: DatabaseScopeFollowUpdatesParams, callback?: Callback): EventEmitter; + followUpdates(callback?: Callback): EventEmitter; + followUpdates(params: any, callback?: Callback): EventEmitter; + updates(callback?: Callback): Request; + updates(params: UpdatesParams, callback?: Callback): Request; } interface DocumentScope { readonly config: ServerConfig; info(callback?: Callback): Request; + replicate( + target: string | DocumentScope, + callback?: Callback + ): Request replicate( target: string | DocumentScope, - options?: any, - callback?: Callback - ): Request; - compact(callback?: Callback): Request; - changes(params?: any, callback?: Callback): Request; - follow( - params?: DocumentScopeFollowUpdatesParams, - callback?: Callback - ): EventEmitter; - auth(username: string, userpass: string, callback?: Callback): Request; - session(callback?: Callback): Request; - insert(document: any, params?: any, callback?: Callback): Request; - get(docname: string, params?: any, callback?: Callback): Request; - head(docname: string, callback: Callback): Request; - copy( - src_document: string, - dst_document: string, options: any, callback?: Callback ): Request; + compact(callback?: Callback): Request; + changes(callback?: Callback): Request; + changes(params: any, callback?: Callback): Request; + follow(callback?: Callback): EventEmitter; + follow(params: DocumentScopeFollowUpdatesParams, callback?: Callback): EventEmitter; + auth(username: string, userpass: string, callback?: Callback): Request; + session(callback?: Callback): Request; + insert(document: any, callback?: Callback): Request; + insert(document: any, params: any, callback?: Callback): Request; + get(docname: string, callback?: Callback): Request; + get(docname: string, params: any, callback?: Callback): Request; + head(docname: string, callback: Callback): Request; + copy(src_document: string, dst_document: string, callback?: Callback): Request; + copy(src_document: string, dst_document: string, options: any, callback?: Callback): Request; destroy(docname: string, rev: string, callback?: Callback): Request; - bulk( - docs: BulkModifyDocsWrapper, - params?: any, - callback?: Callback - ): Request; - list(params?: any, callback?: Callback): Request; - fetch( - docnames: BulkFetchDocsWrapper, - params?: any, - callback?: Callback - ): Request; - fetchRevs( - docnames: BulkFetchDocsWrapper, - params?: any, - callback?: Callback - ): Request; + bulk(docs: BulkModifyDocsWrapper, callback?: Callback): Request; + bulk(docs: BulkModifyDocsWrapper, params?: any, callback?: Callback): Request; + list(callback?: Callback): Request; + list(params: any, callback?: Callback): Request; + fetch(docnames: BulkFetchDocsWrapper, callback?: Callback): Request; + fetch(docnames: BulkFetchDocsWrapper, params: any, callback?: Callback): Request; + fetchRevs(docnames: BulkFetchDocsWrapper, callback?: Callback): Request; + fetchRevs(docnames: BulkFetchDocsWrapper, params?: any, callback?: Callback): Request; multipart: Multipart; attachment: Attachment; show( designname: string, showname: string, doc_id: string, - params?: any, + callback?: Callback + ): Request; + show( + designname: string, + showname: string, + doc_id: string, + params: any, callback?: Callback ): Request; atomic( designname: string, updatename: string, docname: string, - body?: any, + callback?: Callback + ): Request; + atomic( + designname: string, + updatename: string, + docname: string, + body: any, callback?: Callback ): Request; updateWithHandler( designname: string, updatename: string, docname: string, - body?: any, + callback?: Callback + ): Request; + updateWithHandler( + designname: string, + updatename: string, + docname: string, + body: any, callback?: Callback ): Request; search( designname: string, searchname: string, - params?: any, + callback?: Callback + ): Request; + search( + designname: string, + searchname: string, + params: any, callback?: Callback ): Request; spatial( ddoc: string, viewname: string, - params?: any, + callback?: Callback + ): Request; + spatial( + ddoc: string, + viewname: string, + params: any, callback?: Callback ): Request; view( designname: string, viewname: string, - params?: any, + callback?: Callback + ): Request; + view( + designname: string, + viewname: string, + params: any, callback?: Callback ): Request; viewWithList( designname: string, viewname: string, listname: string, - params?: any, + callback?: Callback + ): Request; + viewWithList( + designname: string, + viewname: string, + listname: string, + params: any, callback?: Callback ): Request; server: ServerScope; } interface Multipart { - insert( - doc: any, - attachments: any[], - params: string | any, - callback?: Callback - ): Request; - get(docname: string, params?: string | any, callback?: Callback): Request; + insert(doc: any, attachments: any[], callback?: Callback): Request; + insert(doc: any, attachments: any[], params: string | any, callback?: Callback): Request; + get(docname: string, callback?: Callback): Request; + get(docname: string, params: string | any, callback?: Callback): Request; } interface Attachment { + insert(docname: string, attname: string, att: any, contenttype: string, callback?: Callback): Request; insert( docname: string, attname: string, att: any, contenttype: string, - params?: any, + params: any, callback?: Callback ): Request; + get(docname: string, attname: string, callback?: Callback): Request; get( docname: string, attname: string, - params?: any, + params: any, callback?: Callback ): Request; + destroy(docname: string, attname: string, callback?: Callback): Request; destroy( docname: string, attname: string, - params?: any, + params: any, callback?: Callback ): Request; } From 8a21c431de62d15672802ff248ce1f699a0c787a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kov=C3=A1cs=20Vince?= Date: Fri, 1 Sep 2017 13:23:06 +0200 Subject: [PATCH 097/156] Imports in alphabetic order --- types/nano/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/nano/index.d.ts b/types/nano/index.d.ts index 37e7491436..7a03be1684 100644 --- a/types/nano/index.d.ts +++ b/types/nano/index.d.ts @@ -4,7 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped import { EventEmitter } from "events"; -import { Request, CoreOptions } from "request"; +import { CoreOptions, Request } from "request"; declare function nano( config: nano.Configuration | string From 0b8c9754b2d83107d28a6bcd256b77de4a10ed73 Mon Sep 17 00:00:00 2001 From: Anton Vasin Date: Fri, 1 Sep 2017 14:50:14 +0300 Subject: [PATCH 098/156] Allow to use function for linkTo --- types/storybook__addon-links/index.d.ts | 4 +++- types/storybook__addon-links/storybook__addon-links-tests.tsx | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/types/storybook__addon-links/index.d.ts b/types/storybook__addon-links/index.d.ts index 802e193afb..08f3648855 100644 --- a/types/storybook__addon-links/index.d.ts +++ b/types/storybook__addon-links/index.d.ts @@ -6,4 +6,6 @@ import * as React from 'react'; -export function linkTo(book: string, kind?: string): React.MouseEventHandler; +export type LinkToFunction = (...args: any[]) => string; + +export function linkTo(book: string | LinkToFunction, kind?: string | LinkToFunction): React.MouseEventHandler; diff --git a/types/storybook__addon-links/storybook__addon-links-tests.tsx b/types/storybook__addon-links/storybook__addon-links-tests.tsx index 9b3abb6f6e..2f138daf20 100644 --- a/types/storybook__addon-links/storybook__addon-links-tests.tsx +++ b/types/storybook__addon-links/storybook__addon-links-tests.tsx @@ -8,4 +8,7 @@ storiesOf('Button', module) )) .add('Second', () => ( + )) + .add('With function', () => ( + )); From e84cf3ef7bdc333cb439e615a034ca2bc6176c04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andre=CC=81=20Wachter?= Date: Fri, 1 Sep 2017 14:31:45 +0200 Subject: [PATCH 099/156] [pg]: Add a "Notification" type and pass it to the notification event listener See: https://node-postgres.com/api/client#client-on-39-notification-39-notification-notification-gt-void-gt-void --- types/pg/index.d.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/types/pg/index.d.ts b/types/pg/index.d.ts index da6f4db575..258188c937 100644 --- a/types/pg/index.d.ts +++ b/types/pg/index.d.ts @@ -60,6 +60,12 @@ export interface QueryResult { rows: any[]; } +export interface Notification { + processId: number, + channel: string, + payload?: string +} + export interface ResultBuilder extends QueryResult { addRow(row: any): void; } @@ -109,7 +115,7 @@ export declare class Client extends events.EventEmitter { on(event: "drain", listener: () => void): this; on(event: "error", listener: (err: Error) => void): this; - on(event: "notification" | "notice", listener: (message: any) => void): this; + on(event: "notification" | "notice", listener: (message: Notification) => void): this; on(event: "end", listener: () => void): this; } From 599f7a5876a375449087da4c9481d4d0bd7f7054 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kov=C3=A1cs=20Vince?= Date: Fri, 1 Sep 2017 15:04:09 +0200 Subject: [PATCH 100/156] Update list of authors --- types/nano/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/nano/index.d.ts b/types/nano/index.d.ts index 7a03be1684..4c8a3068a5 100644 --- a/types/nano/index.d.ts +++ b/types/nano/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for nano 6.2 // Project: https://github.com/apache/couchdb-nano // Definitions by: Tim Jacobi +// Kovács Vince // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped import { EventEmitter } from "events"; From d9b76059b989ac5e2515c872823bd247e232c3f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kov=C3=A1cs=20Vince?= Date: Fri, 1 Sep 2017 15:04:44 +0200 Subject: [PATCH 101/156] Add interface for responses --- types/nano/index.d.ts | 850 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 798 insertions(+), 52 deletions(-) diff --git a/types/nano/index.d.ts b/types/nano/index.d.ts index 4c8a3068a5..6457c7b582 100644 --- a/types/nano/index.d.ts +++ b/types/nano/index.d.ts @@ -4,6 +4,8 @@ // Kovács Vince // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +/// + import { EventEmitter } from "events"; import { CoreOptions, Request } from "request"; @@ -30,87 +32,144 @@ declare namespace nano { request: RequestFunction; relax: RequestFunction; dinosaur: RequestFunction; - auth(username: string, userpass: string, callback?: Callback): Request; - session(callback?: Callback): Request; - updates(callback?: Callback): Request; - updates(params: UpdatesParams, callback?: Callback): Request; + // http://docs.couchdb.org/en/latest/api/server/authn.html#cookie-authentication + auth(username: string, userpass: string, callback?: Callback): Request; + // http://docs.couchdb.org/en/latest/api/server/authn.html#get--_session + session(callback?: Callback): Request; + // http://docs.couchdb.org/en/latest/api/server/common.html#get--_db_updates + updates(callback?: Callback): Request; + // http://docs.couchdb.org/en/latest/api/server/common.html#get--_db_updates + updates(params: UpdatesParams, callback?: Callback): Request; followUpdates(callback?: Callback): EventEmitter; followUpdates(params: any, callback?: Callback): EventEmitter; uuids(num: number, callback: Callback): Request; } interface DatabaseScope { - create(name: string, callback?: Callback): Request; - get(name: string, callback?: Callback): Request; - destroy(name: string, callback?: Callback): Request; - list(callback?: Callback): Request; + // http://docs.couchdb.org/en/latest/api/database/common.html#put--db + create(name: string, callback?: Callback): Request; + // http://docs.couchdb.org/en/latest/api/database/common.html#get--db + get(name: string, callback?: Callback): Request; + // http://docs.couchdb.org/en/latest/api/database/common.html#delete--db + destroy(name: string, callback?: Callback): Request; + // http://docs.couchdb.org/en/latest/api/server/common.html#get--_all_dbs + list(callback?: Callback): Request; use(db: string): DocumentScope; compact(name: string, callback?: Callback): Request; - compact(name: string, designname: string, callback?: Callback): Request; + // http://docs.couchdb.org/en/latest/api/database/compact.html#post--db-_compact + compact(name: string, designname: string, callback?: Callback): Request; + // http://docs.couchdb.org/en/latest/api/server/common.html#post--_replicate replicate( source: string | DocumentScope, target: string | DocumentScope, - callback?: Callback + callback?: Callback ): Request + // http://docs.couchdb.org/en/latest/api/server/common.html#post--_replicate replicate( source: string | DocumentScope, target: string | DocumentScope, - options?: any, - callback?: Callback + options: DatabaseReplicateOptions, + callback?: Callback ): Request; - changes(name: string, callback?: Callback): Request; - changes(name: string, params: any, callback?: Callback): Request; + // http://docs.couchdb.org/en/latest/api/database/changes.html#get--db-_changes + changes(name: string, callback?: Callback): Request; + // http://docs.couchdb.org/en/latest/api/database/compact.html#post--db-_compact + changes(name: string, params: DatabaseChangesParams, callback?: Callback): Request; follow(source: string, callback?: Callback): EventEmitter; follow(source: string, params: DatabaseScopeFollowUpdatesParams, callback?: Callback): EventEmitter; - followUpdates(callback?: Callback): EventEmitter; - followUpdates(params: any, callback?: Callback): EventEmitter; - updates(callback?: Callback): Request; - updates(params: UpdatesParams, callback?: Callback): Request; + followUpdates(params?: any, callback?: Callback): EventEmitter; + // http://docs.couchdb.org/en/latest/api/server/common.html#get--_db_updates + updates(callback?: Callback): Request; + // http://docs.couchdb.org/en/latest/api/server/common.html#get--_db_updates + updates(params: UpdatesParams, callback?: Callback): Request; } interface DocumentScope { readonly config: ServerConfig; - info(callback?: Callback): Request; + // http://docs.couchdb.org/en/latest/api/database/common.html#get--db + info(callback?: Callback): Request; + // http://docs.couchdb.org/en/latest/api/server/common.html#post--_replicate replicate( target: string | DocumentScope, - callback?: Callback + callback?: Callback ): Request + // http://docs.couchdb.org/en/latest/api/server/common.html#post--_replicate replicate( target: string | DocumentScope, options: any, - callback?: Callback + callback?: Callback ): Request; + // http://docs.couchdb.org/en/latest/api/database/compact.html#post--db-_compact compact(callback?: Callback): Request; - changes(callback?: Callback): Request; - changes(params: any, callback?: Callback): Request; + // http://docs.couchdb.org/en/latest/api/database/changes.html#get--db-_changes + changes(callback?: Callback): Request; + // http://docs.couchdb.org/en/latest/api/database/changes.html#get--db-_changes + changes(params: DatabaseChangesParams, callback?: Callback): Request; follow(callback?: Callback): EventEmitter; follow(params: DocumentScopeFollowUpdatesParams, callback?: Callback): EventEmitter; - auth(username: string, userpass: string, callback?: Callback): Request; + // http://docs.couchdb.org/en/latest/api/server/authn.html#cookie-authentication + auth(username: string, userpass: string, callback?: Callback): Request; + // http://docs.couchdb.org/en/latest/api/server/authn.html#get--_session session(callback?: Callback): Request; - insert(document: any, callback?: Callback): Request; - insert(document: any, params: any, callback?: Callback): Request; - get(docname: string, callback?: Callback): Request; - get(docname: string, params: any, callback?: Callback): Request; + // http://docs.couchdb.org/en/latest/api/database/common.html#post--db + // http://docs.couchdb.org/en/latest/api/document/common.html#put--db-docid + insert(document: ViewDocument | D & MaybeDocument, callback?: Callback): Request; + // http://docs.couchdb.org/en/latest/api/database/common.html#post--db + // http://docs.couchdb.org/en/latest/api/document/common.html#put--db-docid + insert( + document: ViewDocument | D & MaybeDocument, + params: DocumentInsertParams | string | null, + callback?: Callback + ): Request; + // http://docs.couchdb.org/en/latest/api/document/common.html#get--db-docid + get(docname: string, callback?: Callback): Request; + // http://docs.couchdb.org/en/latest/api/document/common.html#get--db-docid + get(docname: string, params?: DocumentGetParams, callback?: Callback): Request; + // http://docs.couchdb.org/en/latest/api/document/common.html#head--db-docid head(docname: string, callback: Callback): Request; - copy(src_document: string, dst_document: string, callback?: Callback): Request; - copy(src_document: string, dst_document: string, options: any, callback?: Callback): Request; - destroy(docname: string, rev: string, callback?: Callback): Request; + // http://docs.couchdb.org/en/latest/api/document/common.html#copy--db-docid + copy(src_document: string, dst_document: string, callback?: Callback): Request; + // http://docs.couchdb.org/en/latest/api/document/common.html#copy--db-docid + copy( + src_document: string, + dst_document: string, + options: DocumentCopyOptions, + callback?: Callback + ): Request; + // http://docs.couchdb.org/en/latest/api/document/common.html#delete--db-docid + destroy(docname: string, rev: string, callback?: Callback): Request; bulk(docs: BulkModifyDocsWrapper, callback?: Callback): Request; - bulk(docs: BulkModifyDocsWrapper, params?: any, callback?: Callback): Request; - list(callback?: Callback): Request; - list(params: any, callback?: Callback): Request; - fetch(docnames: BulkFetchDocsWrapper, callback?: Callback): Request; - fetch(docnames: BulkFetchDocsWrapper, params: any, callback?: Callback): Request; - fetchRevs(docnames: BulkFetchDocsWrapper, callback?: Callback): Request; - fetchRevs(docnames: BulkFetchDocsWrapper, params?: any, callback?: Callback): Request; - multipart: Multipart; + bulk(docs: BulkModifyDocsWrapper, params: any, callback?: Callback): Request; + // http://docs.couchdb.org/en/latest/api/database/bulk-api.html#get--db-_all_docs + list(callback?: Callback>): Request; + // http://docs.couchdb.org/en/latest/api/database/bulk-api.html#get--db-_all_docs + list(params: DocumentListParams, callback?: Callback>): Request; + // http://docs.couchdb.org/en/latest/api/database/bulk-api.html#post--db-_all_docs + fetch(docnames: BulkFetchDocsWrapper, callback?: Callback>): Request; + // http://docs.couchdb.org/en/latest/api/database/bulk-api.html#post--db-_all_docs + fetch( + docnames: BulkFetchDocsWrapper, + params: DocumentFetchParams, + callback?: Callback> + ): Request; + // http://docs.couchdb.org/en/latest/api/database/bulk-api.html#post--db-_all_docs + fetchRevs(docnames: BulkFetchDocsWrapper, callback?: Callback): Request; + // http://docs.couchdb.org/en/latest/api/database/bulk-api.html#post--db-_all_docs + fetchRevs( + docnames: BulkFetchDocsWrapper, + params: DocumentFetchParams, + callback?: Callback + ): Request; + multipart: Multipart; attachment: Attachment; + // http://docs.couchdb.org/en/latest/api/ddoc/render.html#get--db-_design-ddoc-_show-func show( designname: string, showname: string, doc_id: string, callback?: Callback ): Request; + // http://docs.couchdb.org/en/latest/api/ddoc/render.html#get--db-_design-ddoc-_show-func show( designname: string, showname: string, @@ -118,31 +177,35 @@ declare namespace nano { params: any, callback?: Callback ): Request; + // http://docs.couchdb.org/en/latest/api/ddoc/render.html#put--db-_design-ddoc-_update-func-docid atomic( designname: string, updatename: string, docname: string, - callback?: Callback + callback?: Callback ): Request; + // http://docs.couchdb.org/en/latest/api/ddoc/render.html#put--db-_design-ddoc-_update-func-docid atomic( designname: string, updatename: string, docname: string, body: any, - callback?: Callback + callback?: Callback ): Request; + // http://docs.couchdb.org/en/latest/api/ddoc/render.html#put--db-_design-ddoc-_update-func-docid updateWithHandler( designname: string, updatename: string, docname: string, - callback?: Callback + callback?: Callback ): Request; + // http://docs.couchdb.org/en/latest/api/ddoc/render.html#put--db-_design-ddoc-_update-func-docid updateWithHandler( designname: string, updatename: string, docname: string, body: any, - callback?: Callback + callback?: Callback ): Request; search( designname: string, @@ -166,42 +229,52 @@ declare namespace nano { params: any, callback?: Callback ): Request; - view( + // http://docs.couchdb.org/en/latest/api/ddoc/views.html#get--db-_design-ddoc-_view-view + // http://docs.couchdb.org/en/latest/api/ddoc/views.html#post--db-_design-ddoc-_view-view + view( designname: string, viewname: string, - callback?: Callback + callback?: Callback> ): Request; - view( + // http://docs.couchdb.org/en/latest/api/ddoc/views.html#get--db-_design-ddoc-_view-view + // http://docs.couchdb.org/en/latest/api/ddoc/views.html#post--db-_design-ddoc-_view-view + view( designname: string, viewname: string, - params: any, - callback?: Callback + params: DocumentViewParams, + callback?: Callback> ): Request; + // http://docs.couchdb.org/en/latest/api/ddoc/render.html#db-design-design-doc-list-list-name-view-name viewWithList( designname: string, viewname: string, listname: string, callback?: Callback ): Request; + // http://docs.couchdb.org/en/latest/api/ddoc/render.html#db-design-design-doc-list-list-name-view-name viewWithList( designname: string, viewname: string, listname: string, - params: any, + params: DocumentViewParams, callback?: Callback ): Request; server: ServerScope; } - interface Multipart { - insert(doc: any, attachments: any[], callback?: Callback): Request; - insert(doc: any, attachments: any[], params: string | any, callback?: Callback): Request; + interface Multipart { + // http://docs.couchdb.org/en/latest/api/document/common.html#creating-multiple-attachments + insert(doc: D, attachments: any[], callback?: Callback): Request; + // http://docs.couchdb.org/en/latest/api/document/common.html#creating-multiple-attachments + insert(doc: D, attachments: any[], params: string | any, callback?: Callback): Request; get(docname: string, callback?: Callback): Request; get(docname: string, params: string | any, callback?: Callback): Request; } interface Attachment { + insert(docname: string, attname: string, att: null, contenttype: string): NodeJS.WritableStream; insert(docname: string, attname: string, att: any, contenttype: string, callback?: Callback): Request; + insert(docname: string, attname: string, att: null, contenttype: string, params: any): NodeJS.WritableStream; insert( docname: string, attname: string, @@ -250,10 +323,12 @@ declare namespace nano { multipart?: any[]; } + // http://docs.couchdb.org/en/latest/api/server/common.html#get--_db_updates interface UpdatesParams { feed: "longpoll" | "continuous" | "eventsource"; timeout: number; heartbeat: boolean; + since: string; } interface DocumentScopeFollowUpdatesParams { @@ -284,6 +359,677 @@ declare namespace nano { interface BulkFetchDocsWrapper { keys: string[]; } + + // ------------------------------------- + // Document + // ------------------------------------- + + interface MaybeIdentifiedDocument { + _id?: string; + } + + interface IdentifiedDocument { + _id: string; + } + + interface MaybeRevisionedDocument { + _rev?: string; + } + + interface RevisionedDocument { + _rev: string; + } + + interface MaybeDocument extends MaybeIdentifiedDocument, MaybeRevisionedDocument { + } + + interface Document extends IdentifiedDocument, RevisionedDocument { + } + + // ------------------------------------- + // View + // ------------------------------------- + + interface View { + map?(doc: D & Document): void; + reduce?(doc: D & Document): void; + } + + interface ViewDocument extends IdentifiedDocument { + views: { + [name: string]: View + }; + } + + // ------------------------------------- + // Database scope request and response + // ------------------------------------- + + // http://docs.couchdb.org/en/latest/api/database/common.html#put--db + interface DatabaseCreateResponse { + // Operation status. Available in case of success + ok?: boolean; + + // Error type. Available if response code is 4xx + error?: string; + + // Error description. Available if response code is 4xx + reason?: string; + } + + // http://docs.couchdb.org/en/latest/api/database/common.html#get--db + interface DatabaseGetResponse { + // Set to true if the database compaction routine is operating on this database. + compact_running: boolean; + + // The name of the database. + db_name: string; + + // The version of the physical format used for the data when it is stored on disk. + disk_format_version: number; + + // The number of bytes of live data inside the database file. + data_size: number; + + // The length of the database file on disk. Views indexes are not included in the calculation. + disk_size: number; + + // A count of the documents in the specified database. + doc_count: number; + + // Number of deleted documents + doc_del_count: number; + + // Timestamp of when the database was opened, expressed in microseconds since the epoch. + instance_start_time: string; + + // The number of purge operations on the database. + purge_seq: number; + + sizes: { + // The size of live data inside the database, in bytes. + active: number; + + // The uncompressed size of database contents in bytes. + external: number; + + // The size of the database file on disk in bytes. Views indexes + file: number; + }; + + // The current number of updates to the database. + update_seq: number; + } + + // http://docs.couchdb.org/en/latest/api/database/common.html#delete--db + // http://docs.couchdb.org/en/latest/api/database/compact.html#post--db-_compact + interface OkResponse { + // Operation status + ok: boolean; + } + + // http://docs.couchdb.org/en/latest/api/server/common.html#post--_replicate + interface DatabaseReplicateOptions { + // Cancels the replication + cancel?: boolean; + + // Configure the replication to be continuous + continuous?: boolean; + + // Creates the target database. Required administrator’s privileges on target server. + create_target?: boolean; + + // Array of document IDs to be synchronized + doc_ids?: string[]; + + // The name of a filter function. + filter ?: string; + + // Address of a proxy server through which replication should occur (protocol can be “http” or “socks5”) + proxy ?: string; + + // Source database name or URL + source?: string; + + // Target database name or URL + target?: string; + } + + // http://docs.couchdb.org/en/latest/api/server/common.html#post--_replicate + interface DatabaseReplicationHistoryItem { + // Number of document write failures + doc_write_failures: number; + + // Number of documents read + docs_read: number; + + // Number of documents written to target + docs_written: number; + + // Last sequence number in changes stream + end_last_seq: number; + + // Date/Time replication operation completed in RFC 2822 format + end_time: string; + + // Number of missing documents checked + missing_checked: number; + + // Number of missing documents found + missing_found: number; + + // Last recorded sequence number + recorded_seq: number; + + // Session ID for this replication operation + session_id: string; + + // First sequence number in changes stream + start_last_seq: number; + + // Date/Time replication operation started in RFC 2822 format + start_time: string; + } + + // http://docs.couchdb.org/en/latest/api/server/common.html#post--_replicate + interface DatabaseReplicateResponse { + // Replication history + history: DatabaseReplicationHistoryItem[]; + + // Replication status + ok: boolean; + + // Replication protocol version + replication_id_version: number; + + // Unique session ID + session_id: string; + + // Last sequence number read from source database + source_last_seq: number; + } + + // http://docs.couchdb.org/en/latest/api/database/changes.html#get--db-_changes + interface DatabaseChangesParams { + // List of document IDs to filter the changes feed as valid JSON array. Used with _doc_ids filter. Since length of + // URL is limited, it is better to use POST /{db}/_changes instead. + doc_ids?: string[]; + + // Includes conflicts information in response. Ignored if include_docs isn’t true. Default is false. + conflicts?: boolean; + + // Return the change results in descending sequence order (most recent change first). Default is false. + descending?: boolean; + + // - normal Specifies Normal Polling Mode. All past changes are returned immediately. Default. + // - longpoll Specifies Long Polling Mode. Waits until at least one change has occurred, sends the change, then + // closes the connection. Most commonly used in conjunction with since=now, to wait for the next change. + // - continuous Sets Continuous Mode. Sends a line of JSON per event. Keeps the socket open until timeout. + // - eventsource Sets Event Source Mode. Works the same as Continuous Mode, but sends the events in EventSource + // format. + feed?: "normal" | "longpoll" | "continuous" | "eventsource"; + + // Reference to a filter function from a design document that will filter whole stream emitting only filtered + // events. See the section Change Notifications in the book CouchDB The Definitive Guide for more information. + filter?: string; + + // Period in milliseconds after which an empty line is sent in the results. Only applicable for longpoll, + // continuous, and eventsource feeds. Overrides any timeout to keep the feed alive indefinitely. Default is 60000. + // May be true to use default value. + heartbeat?: number; + + // Include the associated document with each result. If there are conflicts, only the winning revision is returned. + // Default is false. + include_docs?: boolean; + + // Include the Base64-encoded content of attachments in the documents that are included if include_docs is true. + // Ignored if include_docs isn’t true. Default is false. + attachments?: boolean; + + // Include encoding information in attachment stubs if include_docs is true and the particular attachment is + // compressed. Ignored if include_docs isn’t true. Default is false. + att_encoding_info?: boolean; + + // Limit number of result rows to the specified value (note that using 0 here has the same effect as 1). + limit?: number; + + // Start the results from the change immediately after the given update sequence. Can be valid update sequence or + // now value. Default is 0. + since?: number; + + // Specifies how many revisions are returned in the changes array. The default, main_only, will only return the + // current “winning” revision; all_docs will return all leaf revisions (including conflicts and deleted former + // conflicts). + style?: string; + + // Maximum period in milliseconds to wait for a change before the response is sent, even if there are no results. + // Only applicable for longpoll or continuous feeds. Default value is specified by httpd/changes_timeout + // configuration option. Note that 60000 value is also the default maximum timeout to prevent undetected dead + // connections. + timeout?: number; + + // Allows to use view functions as filters. Documents counted as “passed” for view filter in case if map function + // emits at least one record for them. See _view for more info. + view?: string; + } + + // http://docs.couchdb.org/en/latest/api/database/changes.html#get--db-_changes + interface DatabaseChangesResultItem { + // List of document’s leaves with single field rev. + changes: Array<{ rev: string }>; + + // Document ID. + id: string; + + // Update sequence. + seq: any; + + // true if the document is deleted. + deleted: boolean; + } + + // http://docs.couchdb.org/en/latest/api/database/changes.html#get--db-_changes + interface DatabaseChangesResponse { + // Last change update sequence + last_seq: any; + + // Count of remaining items in the feed + pending: number; + + // Changes made to a database + results: DatabaseChangesResultItem[]; + } + + // http://docs.couchdb.org/en/latest/api/server/authn.html#cookie-authentication + interface DatabaseAuthResponse { + // Operation status + ok: boolean; + + // Username + name: string; + + // List of user roles + roles: string[]; + } + + // http://docs.couchdb.org/en/latest/api/server/authn.html#get--_session + interface DatabaseSessionResponse { + // Operation status + ok: boolean; + + // User context for the current user + userCtx: any; + + // Server authentication configuration + info: any; + } + + // http://docs.couchdb.org/en/latest/api/server/common.html#get--_db_updates + interface DatabaseUpdatesResultItem { + // Database name. + db_name: string; + + // A database event is one of created, updated, deleted. + type: string; + + // Update sequence of the event. + seq: any; + } + + // http://docs.couchdb.org/en/latest/api/server/common.html#get--_db_updates + interface DatabaseUpdatesResponse { + // An array of database events. For longpoll and continuous modes, the entire response is the contents of the + // results array. + results: DatabaseUpdatesResultItem[]; + + // The last sequence ID reported. + last_seq: string; + } + + // ------------------------------------- + // Document scope request and response + // ------------------------------------- + + interface DocumentResponseRowMeta { + id: string; + key: string; + value: { + rev: string; + }; + } + + interface DocumentResponseRow extends DocumentResponseRowMeta { + doc?: D & Document; + } + + // http://docs.couchdb.org/en/latest/api/database/common.html#post--db + // http://docs.couchdb.org/en/latest/api/document/common.html#put--db-docid + interface DocumentInsertParams { + // Document’s revision if updating an existing document. Alternative to If-Match header or document key. + rev?: string; + + // Stores document in batch mode. + batch?: "ok"; + + // Prevents insertion of a conflicting document. Possible values: true (default) and false. If false, a + // well-formed _rev must be included in the document. new_edits=false is used by the replicator to insert + // documents into the target database even if that leads to the creation of conflicts. + new_edits?: boolean; + } + + // http://docs.couchdb.org/en/latest/api/database/common.html#post--db + // http://docs.couchdb.org/en/latest/api/document/common.html#put--db-docid + interface DocumentInsertResponse { + // Document ID + id: string; + + // Operation status + ok: boolean; + + // Revision MVCC token + rev: string; + } + + // http://docs.couchdb.org/en/latest/api/document/common.html#delete--db-docid + interface DocumentDestroyResponse { + // Document ID + id: string; + + // Operation status + ok: boolean; + + // Revision MVCC token + rev: string; + } + + // http://docs.couchdb.org/en/latest/api/document/common.html#get--db-docid + interface DocumentGetParams { + // Includes attachments bodies in response. Default is false. + attachments?: boolean; + + // Includes encoding information in attachment stubs if the particular attachment is compressed. Default is + // false. + att_encoding_info?: boolean; + + // Includes attachments only since specified revisions. Doesn’t includes attachments for specified revisions. + atts_since?: any[]; + + // Includes information about conflicts in document. Default is false. + conflicts?: boolean; + + // Includes information about deleted conflicted revisions. Default is false. + deleted_conflicts?: boolean; + + // Forces retrieving latest “leaf” revision, no matter what rev was requested. Default is false. + latest?: boolean; + + // Includes last update sequence for the document. Default is false. + local_seq?: boolean; + + // Acts same as specifying all conflicts, deleted_conflicts and revs_info query parameters. Default is false. + meta?: boolean; + + // Retrieves documents of specified leaf revisions. Additionally, it accepts value as all to return all leaf + // revisions. + open_revs?: any[]; + + // Retrieves document of specified revision. + rev?: string; + + // Includes list of all known document revisions. + revs?: boolean; + + // Includes detailed information for all known document revisions. Default is false. + revs_info?: boolean; + } + + // http://docs.couchdb.org/en/latest/api/document/common.html#get--db-docid + interface DocumentGetResponse { + // Document ID. + _id: string; + + // Revision MVCC token. + _rev: string; + + // Deletion flag. Available if document was removed. + _deleted?: boolean; + + // Attachment’s stubs. Available if document has any attachments. + _attachments?: any; + + // List of conflicted revisions. Available if requested with conflicts=true query parameter. + _conflicts?: any[]; + + // List of deleted conflicted revisions. Available if requested with deleted_conflicts=true query parameter. + _deleted_conflicts?: any[]; + + // Document’s update sequence in current database. Available if requested with local_seq=true query parameter. + _local_seq?: string; + + // List of objects with information about local revisions and their status. Available if requested with + // open_revs query parameter. + _revs_info?: any[]; + + // List of local revision tokens without. Available if requested with revs=true query parameter. + _revisions?: any; + } + + interface DocumentCopyOptions { + overwrite?: boolean; + } + + // http://docs.couchdb.org/en/latest/api/document/common.html#copy--db-docid + interface DocumentCopyResponse { + // Document ID + id: string; + + // Operation status + ok: boolean; + + // Revision MVCC token + rev: string; + } + + // http://docs.couchdb.org/en/latest/api/database/bulk-api.html#get--db-_all_docs + interface DocumentListParams { + // Includes conflicts information in response. Ignored if include_docs isn’t true. Default is false. + conflicts?: boolean; + + // Return the documents in descending by key order. Default is false. + descending?: boolean; + + // Stop returning records when the specified key is reached. + end_key?: string; + + // Stop returning records when the specified document ID is reached. + end_key_doc_id?: string; + + // Include the full content of the documents in the return. Default is false. + include_docs?: boolean; + + // Specifies whether the specified end key should be included in the result. Default is true. + inclusive_end?: boolean; + + // Return only documents that match the specified key. + key?: string; + + // Return only documents that match the specified keys. + keys?: string; // This can be string[] too ??? + + // Limit the number of the returned documents to the specified number. + limit?: number; + + // Skip this number of records before starting to return the results. Default is 0. + skip?: number; + + // Allow the results from a stale view to be used, without triggering a rebuild of all views within the + // encompassing design doc. Supported values: ok and update_after. + stale?: string; + + // Return records starting with the specified key. + start_key?: string; + + // Return records starting with the specified document ID. + start_key_doc_id?: string; + + // Response includes an update_seq value indicating which sequence id of the underlying database the view + // reflects. Default is false. + update_seq?: boolean; + } + + // http://docs.couchdb.org/en/latest/api/database/bulk-api.html#get--db-_all_docs + interface DocumentListResponse { + // Offset where the document list started. + offset: number; + + // Array of view row objects. By default the information returned contains only the document ID and revision. + rows: Array>; + + // Number of documents in the database/view. Note that this is not the number of rows returned in the actual + // query. + total_rows: number; + + // Current update sequence for the database. + update_seq?: number; + } + + interface DocumentFetchParams { + conflicts?: boolean; + descending?: boolean; + end_key?: string; + end_key_doc_id?: string; + inclusive_end?: boolean; + key?: string; + keys?: string; // This can be string[] too ??? + limit?: number; + skip?: number; + stale?: string; + start_key?: string; + start_key_doc_id?: string; + update_seq?: boolean; + } + + interface DocumentFetchResponse { + offset: number; + rows: Array>; + total_rows: number; + update_seq?: number; + } + + interface DocumentFetchRevsResponse { + offset: number; + rows: DocumentResponseRowMeta[]; + total_rows: number; + update_seq?: number; + } + + // http://docs.couchdb.org/en/latest/api/ddoc/views.html#get--db-_design-ddoc-_view-view + interface DocumentViewParams { + // Includes conflicts information in response. Ignored if include_docs isn’t true. Default is false. + conflicts?: boolean; + + // Return the documents in descending by key order. Default is false. + descending?: boolean; + + // Stop returning records when the specified key is reached. + endkey?: any; + + // Alias for endkey param. + end_key?: any; + + // Stop returning records when the specified document ID is reached. Requires endkey to be specified for this + // to have any effect. + endkey_docid?: string; + + // Alias for endkey_docid param. + end_key_doc_id?: string; + + // Group the results using the reduce function to a group or single row. Default is false. + group?: boolean; + + // Specify the group level to be used. + group_level?: number; + + // Include the associated document with each row. Default is false. + include_docs?: boolean; + + // Include the Base64-encoded content of attachments in the documents that are included if include_docs is + // true. Ignored if include_docs isn’t true. Default is false. + attachments?: boolean; + + // Include encoding information in attachment stubs if include_docs is true and the particular attachment is + // compressed. Ignored if include_docs isn’t true. Default is false. + att_encoding_info?: boolean; + + // Specifies whether the specified end key should be included in the result. Default is true. + inclusive_end?: boolean; + + // Return only documents that match the specified key. + key?: any; + + // Return only documents where the key matches one of the keys specified in the array. + keys?: any[]; + + // Limit the number of the returned documents to the specified number. + limit?: number; + + // Use the reduction function. Default is true. + reduce?: boolean; + + // Skip this number of records before starting to return the results. Default is 0. + skip?: number; + + // Sort returned rows. Setting this to false offers a performance boost. The total_rows and offset fields are + // not available when this is set to false. Default is true. + sorted?: boolean; + + // Whether or not the view results should be returned from a stable set of shards. Default is false. + stable?: boolean; + // Allow the results from a stale view to be used. Supported values: ok, update_after and false. ok is + // equivalent to stable=true&update=false. update_after is equivalent to stable=true&update=lazy. false is + // equivalent to stable=false&update=true. + stale?: string; + + // Return records starting with the specified key. + startkey?: any; + + // Alias for startkey param + start_key?: any; + + // Return records starting with the specified document ID. Requires startkey to be specified for this to have + // any effect. + startkey_docid?: string; + + // Alias for startkey_docid param + start_key_doc_id?: string; + + // Whether or not the view in question should be updated prior to responding to the user. Supported values: + // true, false, lazy. Default is true. + update?: string; + + // Response includes an update_seq value indicating which sequence id of the database the view reflects. + // Default is false. + update_seq?: boolean; + } + + // http://docs.couchdb.org/en/latest/api/ddoc/views.html#get--db-_design-ddoc-_view-view + interface DocumentViewResponse { + // Offset where the document list started. + offset: number; + + // Array of view row objects. By default the information returned contains only the document ID and revision. + rows: Array<{ + id: string; + key: string; + value: V; + }>; + + // Number of documents in the database/view. + total_rows: number; + + // Current update sequence for the database + update_seq: any; + } } export = nano; From 96410e7010d4f35cbe530fcde2de36bcd4309999 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kov=C3=A1cs=20Vince?= Date: Fri, 1 Sep 2017 15:04:55 +0200 Subject: [PATCH 102/156] Fix test cases --- types/nano/nano-tests.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/types/nano/nano-tests.ts b/types/nano/nano-tests.ts index 33cfe4534d..522064f993 100644 --- a/types/nano/nano-tests.ts +++ b/types/nano/nano-tests.ts @@ -1,6 +1,5 @@ -import * as nano from "nano"; import * as fs from "fs"; -import * as path from "path"; +import * as nano from "nano"; /* * Instantiate with configuration object @@ -67,10 +66,15 @@ db.replicate("a", "b", (error: any) => {}); /* * Document Scope */ -const mydb: nano.DocumentScope = instance.use("mydb"); +interface SomeDocument{ + name: string +} -mydb.insert({ foo: "baz" }, null, (err, response) => {}); -mydb.insert({ foo: "baz" }, "foobar", (error, foo) => {}); +const mydb: nano.DocumentScope = instance.use("mydb"); + +mydb.insert({ name: "baz" }, null, (err, response) => {}); +mydb.insert({ name: "baz" }, "foobar", (error, foo) => {}); +mydb.insert({ name: "baz" }, { new_edits: true }, (error, foo) => {}); mydb.get("foobaz", { revs_info: true }, (error, foobaz) => {}); mydb.head("foobaz", (error, body, headers) => {}); mydb.copy( @@ -129,7 +133,7 @@ mydb.attachment.get("new_string", "att", (error: any, helloWorld: any) => {}); /* * Multipart */ -mydb.multipart.insert({ foo: "baz" }, [{}], "foobaz", (error, foo) => {}); +mydb.multipart.insert({ name: "baz" }, [{}], "foobaz", (error, foo) => {}); mydb.multipart.get("foobaz", (error: any, foobaz: any, headers: any) => {}); /* From cb2dbfbb50afbff23de701e8d630f5cfde57832e Mon Sep 17 00:00:00 2001 From: Andy Date: Fri, 1 Sep 2017 07:47:52 -0700 Subject: [PATCH 103/156] Add ignores for new lint rules (#19504) --- types/ably/tslint.json | 7 ++++++- types/adone/tslint.json | 2 ++ types/awesomplete/tslint.json | 7 ++++++- types/bittorrent-protocol/tslint.json | 4 +++- types/check-sum/tslint.json | 7 ++++++- types/chocolatechipjs/tslint.json | 1 + types/csv-stringify/tslint.json | 1 + types/cucumber/tslint.json | 5 ++++- types/cwise/tslint.json | 5 ++++- types/d3-queue/tslint.json | 1 + types/d3-request/tslint.json | 4 +++- types/ember/tslint.json | 2 ++ types/esri-leaflet-geocoder/tslint.json | 2 ++ types/exceljs/tslint.json | 7 ++++++- types/fabric/tslint.json | 1 + types/falcor/tslint.json | 9 ++++++++- types/fluent-ffmpeg/tslint.json | 6 +++++- types/from2/tslint.json | 7 ++++++- types/graphql-relay/tslint.json | 7 ++++++- types/handsontable/tslint.json | 1 + types/hellojs/tslint.json | 7 ++++++- types/heredatalens/tslint.json | 7 +++++-- types/i18n/tslint.json | 6 ++++-- types/jsforce/tslint.json | 5 ++++- types/json-rpc-ws/tslint.json | 9 +++++++-- types/jui-grid/tslint.json | 3 ++- types/jui/tslint.json | 8 +++++++- types/kafka-node/tslint.json | 6 +++++- types/leaflet.fullscreen/index.d.ts | 4 ++-- types/linq4js/tslint.json | 9 ++++++++- types/lodash/tslint.json | 2 ++ types/loopback-boot/tslint.json | 7 ++++++- types/loopback/tslint.json | 2 ++ types/marked/tslint.json | 7 ++++++- types/material-ui/tslint.json | 3 ++- types/nano/tslint.json | 8 +++++++- types/nightwatch/tslint.json | 8 +++++++- types/node/tslint.json | 2 ++ types/node/v4/tslint.json | 2 ++ types/node/v6/tslint.json | 2 ++ types/node/v7/tslint.json | 2 ++ types/oauth2-server/tslint.json | 6 +++++- types/orientjs/tslint.json | 9 ++++++++- types/pixi.js/tslint.json | 2 ++ types/pouchdb-find/tslint.json | 7 ++++++- types/pouchdb-mapreduce/tslint.json | 8 +++++++- types/prosemirror-model/tslint.json | 8 +++++++- types/python-shell/tslint.json | 8 +++++++- types/q/tslint.json | 2 ++ types/qlik-visualizationextensions/tslint.json | 2 ++ types/quill/tslint.json | 6 +++++- types/raven/tslint.json | 4 +++- types/rc-slider/tslint.json | 6 +++++- types/react-ga/tslint.json | 8 +++++++- types/react-native-collapsible/tslint.json | 8 +++++++- types/react-native-fetch-blob/tslint.json | 8 +++++++- types/react-sortable-tree/tslint.json | 7 ++++++- types/react-transition-group/tsconfig.json | 1 - types/react-transition-group/tslint.json | 4 +++- types/react/tslint.json | 2 ++ types/react/v15/tslint.json | 2 ++ types/realm/tslint.json | 9 ++++++++- types/recharts/tslint.json | 6 +++++- types/restify/tslint.json | 1 + types/revalidate/tslint.json | 7 ++++++- types/saywhen/tsconfig.json | 2 -- types/saywhen/tslint.json | 8 +++++++- types/semantic-ui-api/tslint.json | 1 + types/semantic-ui-search/tslint.json | 1 + types/sharepoint/tslint.json | 2 ++ types/stripe-v3/tslint.json | 4 +++- types/telebot/tslint.json | 8 +++++++- types/undertaker/tslint.json | 8 +++++++- types/url-search-params/tslint.json | 8 +++++++- types/uuid/tsconfig.json | 1 - types/vis/tslint.json | 8 +++++++- types/webpack-chain/tslint.json | 8 +++++++- types/weixin-app/tslint.json | 1 + types/yandex-maps/tslint.json | 1 + 79 files changed, 328 insertions(+), 59 deletions(-) diff --git a/types/ably/tslint.json b/types/ably/tslint.json index 3db14f85ea..d9d49e375e 100644 --- a/types/ably/tslint.json +++ b/types/ably/tslint.json @@ -1 +1,6 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + "no-any-union": false + } +} diff --git a/types/adone/tslint.json b/types/adone/tslint.json index f0ae61d2bf..ef323bd7a5 100644 --- a/types/adone/tslint.json +++ b/types/adone/tslint.json @@ -5,9 +5,11 @@ "align": false, "no-namespace": false, "strict-export-declare-modifiers": false, + "no-any-union": false, "no-boolean-literal-compare": false, "no-mergeable-namespace": false, "no-single-declare-module": false, + "no-unnecessary-generics": false, "no-unnecessary-qualifier": false, "unified-signatures": false, "space-before-function-paren": false diff --git a/types/awesomplete/tslint.json b/types/awesomplete/tslint.json index 3db14f85ea..d9d49e375e 100644 --- a/types/awesomplete/tslint.json +++ b/types/awesomplete/tslint.json @@ -1 +1,6 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + "no-any-union": false + } +} diff --git a/types/bittorrent-protocol/tslint.json b/types/bittorrent-protocol/tslint.json index dfea11be1a..62d2486032 100644 --- a/types/bittorrent-protocol/tslint.json +++ b/types/bittorrent-protocol/tslint.json @@ -1,6 +1,8 @@ { "extends": "dtslint/dt.json", "rules": { - "no-misused-new": false + // TODOs + "no-misused-new": false, + "no-any-union": false } } diff --git a/types/check-sum/tslint.json b/types/check-sum/tslint.json index 3db14f85ea..d9d49e375e 100644 --- a/types/check-sum/tslint.json +++ b/types/check-sum/tslint.json @@ -1 +1,6 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + "no-any-union": false + } +} diff --git a/types/chocolatechipjs/tslint.json b/types/chocolatechipjs/tslint.json index 04f74b7c27..462a0000f7 100644 --- a/types/chocolatechipjs/tslint.json +++ b/types/chocolatechipjs/tslint.json @@ -5,6 +5,7 @@ "adjacent-overload-signatures": false, "ban-types": false, "dt-header": false, + "no-any-union": false, "unified-signatures": false } } diff --git a/types/csv-stringify/tslint.json b/types/csv-stringify/tslint.json index 11584e5acd..963be749a2 100644 --- a/types/csv-stringify/tslint.json +++ b/types/csv-stringify/tslint.json @@ -1,6 +1,7 @@ { "extends": "dtslint/dt.json", "rules": { + "no-any-union": false, "prefer-method-signature": false } } diff --git a/types/cucumber/tslint.json b/types/cucumber/tslint.json index 3db14f85ea..a9ae3a3856 100644 --- a/types/cucumber/tslint.json +++ b/types/cucumber/tslint.json @@ -1 +1,4 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "no-any-union": false +} diff --git a/types/cwise/tslint.json b/types/cwise/tslint.json index 531fb4ef87..bee01cfc64 100644 --- a/types/cwise/tslint.json +++ b/types/cwise/tslint.json @@ -1,3 +1,6 @@ { - "extends": "dtslint/dt.json" + "extends": "dtslint/dt.json", + "rules": { + "no-any-union": false + } } \ No newline at end of file diff --git a/types/d3-queue/tslint.json b/types/d3-queue/tslint.json index b8825c1674..c3beb085cb 100644 --- a/types/d3-queue/tslint.json +++ b/types/d3-queue/tslint.json @@ -2,6 +2,7 @@ "extends": "dtslint/dt.json", "rules": { // TODO + "no-any-union": false, "no-this-assignment": false, "unified-signatures": false } diff --git a/types/d3-request/tslint.json b/types/d3-request/tslint.json index 70edbfa511..a965459d61 100644 --- a/types/d3-request/tslint.json +++ b/types/d3-request/tslint.json @@ -1,8 +1,10 @@ { "extends": "dtslint/dt.json", "rules": { - // TODO + // TODOs + "no-any-union": false, "no-this-assignment": false, + "no-unnecessary-generics": false, "unified-signatures": false, "max-line-length": [false, 145] } diff --git a/types/ember/tslint.json b/types/ember/tslint.json index 7c941bb9c6..309f39a5d1 100644 --- a/types/ember/tslint.json +++ b/types/ember/tslint.json @@ -4,9 +4,11 @@ // Heavy use of Function type in this older package. "ban-types": false, "jsdoc-format": false, + "no-any-union": false, "no-misused-new": false, // not sure what this means "no-single-declare-module": false, + "no-unnecessary-generics": false, "no-unnecessary-qualifier": false } } diff --git a/types/esri-leaflet-geocoder/tslint.json b/types/esri-leaflet-geocoder/tslint.json index fd2834499c..48743df77b 100644 --- a/types/esri-leaflet-geocoder/tslint.json +++ b/types/esri-leaflet-geocoder/tslint.json @@ -1,6 +1,8 @@ { "extends": "dtslint/dt.json", "rules": { + // TODOs + "no-any-union": false, "no-object-literal-type-assertion": false } } diff --git a/types/exceljs/tslint.json b/types/exceljs/tslint.json index 3db14f85ea..d9d49e375e 100644 --- a/types/exceljs/tslint.json +++ b/types/exceljs/tslint.json @@ -1 +1,6 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + "no-any-union": false + } +} diff --git a/types/fabric/tslint.json b/types/fabric/tslint.json index 8697a364c3..17bb596f5d 100644 --- a/types/fabric/tslint.json +++ b/types/fabric/tslint.json @@ -5,6 +5,7 @@ "adjacent-overload-signatures": false, "ban-types": false, "interface-name": false, + "no-any-union": false, "no-empty-interface": false, "space-within-parens": false, "strict-export-declare-modifiers": false, diff --git a/types/falcor/tslint.json b/types/falcor/tslint.json index 3db14f85ea..3393f9dcca 100644 --- a/types/falcor/tslint.json +++ b/types/falcor/tslint.json @@ -1 +1,8 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + // TODOs + "no-any-union": false, + "no-unnecessary-generics": false + } +} diff --git a/types/fluent-ffmpeg/tslint.json b/types/fluent-ffmpeg/tslint.json index d88586e5bd..6338577095 100644 --- a/types/fluent-ffmpeg/tslint.json +++ b/types/fluent-ffmpeg/tslint.json @@ -1,3 +1,7 @@ { - "extends": "dtslint/dt.json" + "extends": "dtslint/dt.json", + "rules": { + // TODO + "no-any-union": false + } } diff --git a/types/from2/tslint.json b/types/from2/tslint.json index 3db14f85ea..d9d49e375e 100644 --- a/types/from2/tslint.json +++ b/types/from2/tslint.json @@ -1 +1,6 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + "no-any-union": false + } +} diff --git a/types/graphql-relay/tslint.json b/types/graphql-relay/tslint.json index 3db14f85ea..d9d49e375e 100644 --- a/types/graphql-relay/tslint.json +++ b/types/graphql-relay/tslint.json @@ -1 +1,6 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + "no-any-union": false + } +} diff --git a/types/handsontable/tslint.json b/types/handsontable/tslint.json index 40e100fc9e..5f3a731336 100644 --- a/types/handsontable/tslint.json +++ b/types/handsontable/tslint.json @@ -4,6 +4,7 @@ // TODOs "ban-types": false, "dt-header": false, + "no-any-union": false, "no-single-declare-module": false } } diff --git a/types/hellojs/tslint.json b/types/hellojs/tslint.json index 2750cc0197..d9d49e375e 100644 --- a/types/hellojs/tslint.json +++ b/types/hellojs/tslint.json @@ -1 +1,6 @@ -{ "extends": "dtslint/dt.json" } \ No newline at end of file +{ + "extends": "dtslint/dt.json", + "rules": { + "no-any-union": false + } +} diff --git a/types/heredatalens/tslint.json b/types/heredatalens/tslint.json index e60c15844f..d9d49e375e 100644 --- a/types/heredatalens/tslint.json +++ b/types/heredatalens/tslint.json @@ -1,3 +1,6 @@ { - "extends": "dtslint/dt.json" -} \ No newline at end of file + "extends": "dtslint/dt.json", + "rules": { + "no-any-union": false + } +} diff --git a/types/i18n/tslint.json b/types/i18n/tslint.json index bd50eb1958..eb3e5cc86e 100644 --- a/types/i18n/tslint.json +++ b/types/i18n/tslint.json @@ -1,7 +1,9 @@ { "extends": "dtslint/dt.json", "rules": { - "prefer-method-signature": false, - "no-single-declare-module": false + // TODOs + "no-any-union": false, + "no-single-declare-module": false, + "prefer-method-signature": false } } diff --git a/types/jsforce/tslint.json b/types/jsforce/tslint.json index a62d0d4e68..5fdd35f19c 100644 --- a/types/jsforce/tslint.json +++ b/types/jsforce/tslint.json @@ -1,6 +1,9 @@ { "extends": "dtslint/dt.json", "rules": { - "ban-types": false + // TODOs + "ban-types": false, + "no-any-union": false, + "no-unnecessary-generics": false } } diff --git a/types/json-rpc-ws/tslint.json b/types/json-rpc-ws/tslint.json index e60c15844f..3393f9dcca 100644 --- a/types/json-rpc-ws/tslint.json +++ b/types/json-rpc-ws/tslint.json @@ -1,3 +1,8 @@ { - "extends": "dtslint/dt.json" -} \ No newline at end of file + "extends": "dtslint/dt.json", + "rules": { + // TODOs + "no-any-union": false, + "no-unnecessary-generics": false + } +} diff --git a/types/jui-grid/tslint.json b/types/jui-grid/tslint.json index a62d0d4e68..e39908ae45 100644 --- a/types/jui-grid/tslint.json +++ b/types/jui-grid/tslint.json @@ -1,6 +1,7 @@ { "extends": "dtslint/dt.json", "rules": { - "ban-types": false + "ban-types": false, + "no-any-union": false } } diff --git a/types/jui/tslint.json b/types/jui/tslint.json index 3db14f85ea..c92fd86792 100644 --- a/types/jui/tslint.json +++ b/types/jui/tslint.json @@ -1 +1,7 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + // TODOs + "no-any-union": false + } +} diff --git a/types/kafka-node/tslint.json b/types/kafka-node/tslint.json index d88586e5bd..b1439230db 100644 --- a/types/kafka-node/tslint.json +++ b/types/kafka-node/tslint.json @@ -1,3 +1,7 @@ { - "extends": "dtslint/dt.json" + "extends": "dtslint/dt.json", + "rules": { + // TODO + "no-any-union": false + } } diff --git a/types/leaflet.fullscreen/index.d.ts b/types/leaflet.fullscreen/index.d.ts index bc5abc85d2..4e58ede10c 100644 --- a/types/leaflet.fullscreen/index.d.ts +++ b/types/leaflet.fullscreen/index.d.ts @@ -7,7 +7,7 @@ import * as L from 'leaflet'; declare module 'leaflet' { namespace Control { - class Fullscreen extends L.Control { + class Fullscreen extends Control { constructor(options?: FullscreenOptions); options: FullscreenOptions; } @@ -27,6 +27,6 @@ declare module 'leaflet' { /** * Creates a fullscreen control. */ - function fullscreen(options?: Control.FullscreenOptions): L.Control.Fullscreen; + function fullscreen(options?: Control.FullscreenOptions): Control.Fullscreen; } } diff --git a/types/linq4js/tslint.json b/types/linq4js/tslint.json index 3db14f85ea..3393f9dcca 100644 --- a/types/linq4js/tslint.json +++ b/types/linq4js/tslint.json @@ -1 +1,8 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + // TODOs + "no-any-union": false, + "no-unnecessary-generics": false + } +} diff --git a/types/lodash/tslint.json b/types/lodash/tslint.json index 8c17ad248c..02254dbc60 100644 --- a/types/lodash/tslint.json +++ b/types/lodash/tslint.json @@ -13,9 +13,11 @@ "interface-over-type-literal": false, "jsdoc-format": false, "max-line-length": false, + "no-any-union": false, "no-empty-interface": false, "no-namespace": false, "no-mergeable-namespace": false, + "no-unnecessary-generics": false, "no-unnecessary-qualifier": false, "no-unnecessary-type-assertion": false, "no-void-expression": false, diff --git a/types/loopback-boot/tslint.json b/types/loopback-boot/tslint.json index 3db14f85ea..d9d49e375e 100644 --- a/types/loopback-boot/tslint.json +++ b/types/loopback-boot/tslint.json @@ -1 +1,6 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + "no-any-union": false + } +} diff --git a/types/loopback/tslint.json b/types/loopback/tslint.json index 5d2ec41a29..90b290e422 100644 --- a/types/loopback/tslint.json +++ b/types/loopback/tslint.json @@ -3,6 +3,8 @@ "rules": { // TODOs "jsdoc-format": false, + "no-any-union": false, + "no-unnecessary-generics": false, "prefer-method-signature": false } } diff --git a/types/marked/tslint.json b/types/marked/tslint.json index 3db14f85ea..d9d49e375e 100644 --- a/types/marked/tslint.json +++ b/types/marked/tslint.json @@ -1 +1,6 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + "no-any-union": false + } +} diff --git a/types/material-ui/tslint.json b/types/material-ui/tslint.json index ac0584ff62..d462b76190 100644 --- a/types/material-ui/tslint.json +++ b/types/material-ui/tslint.json @@ -1,9 +1,10 @@ { "extends": "dtslint/dt.json", "rules": { - // TODO + // TODOs "ban-types": false, "dt-header": false, + "no-any-union": false, "no-duplicate-imports": false, "no-empty-interface": false, "no-mergeable-namespace": false, diff --git a/types/nano/tslint.json b/types/nano/tslint.json index 3db14f85ea..b1439230db 100644 --- a/types/nano/tslint.json +++ b/types/nano/tslint.json @@ -1 +1,7 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + // TODO + "no-any-union": false + } +} diff --git a/types/nightwatch/tslint.json b/types/nightwatch/tslint.json index 3db14f85ea..b1439230db 100644 --- a/types/nightwatch/tslint.json +++ b/types/nightwatch/tslint.json @@ -1 +1,7 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + // TODO + "no-any-union": false + } +} diff --git a/types/node/tslint.json b/types/node/tslint.json index 43f90d97f7..e60d5e7de9 100644 --- a/types/node/tslint.json +++ b/types/node/tslint.json @@ -5,12 +5,14 @@ "ban-types": false, "dt-header": false, "max-line-length": false, + "no-any-union": false, "no-duplicate-imports": false, "no-duplicate-variable": false, "no-empty-interface": false, "no-inferrable-types": false, "no-internal-module": false, "no-namespace": false, + "no-unnecessary-generics": false, "no-unnecessary-qualifier": false, "no-var-keyword": false, "prefer-const": false, diff --git a/types/node/v4/tslint.json b/types/node/v4/tslint.json index 421a4fe663..86acdea96f 100644 --- a/types/node/v4/tslint.json +++ b/types/node/v4/tslint.json @@ -13,6 +13,7 @@ "interface-over-type-literal": false, "jsdoc-format": false, "max-line-length": false, + "no-any-union": false, "no-consecutive-blank-lines": false, "no-duplicate-imports": false, "no-duplicate-variable": false, @@ -23,6 +24,7 @@ "no-namespace": false, "no-padding": false, "no-string-throw": false, + "no-unnecessary-generics": false, "no-unnecessary-qualifier": false, "no-var-keyword": false, "object-literal-shorthand": false, diff --git a/types/node/v6/tslint.json b/types/node/v6/tslint.json index 421a4fe663..86acdea96f 100644 --- a/types/node/v6/tslint.json +++ b/types/node/v6/tslint.json @@ -13,6 +13,7 @@ "interface-over-type-literal": false, "jsdoc-format": false, "max-line-length": false, + "no-any-union": false, "no-consecutive-blank-lines": false, "no-duplicate-imports": false, "no-duplicate-variable": false, @@ -23,6 +24,7 @@ "no-namespace": false, "no-padding": false, "no-string-throw": false, + "no-unnecessary-generics": false, "no-unnecessary-qualifier": false, "no-var-keyword": false, "object-literal-shorthand": false, diff --git a/types/node/v7/tslint.json b/types/node/v7/tslint.json index 421a4fe663..86acdea96f 100644 --- a/types/node/v7/tslint.json +++ b/types/node/v7/tslint.json @@ -13,6 +13,7 @@ "interface-over-type-literal": false, "jsdoc-format": false, "max-line-length": false, + "no-any-union": false, "no-consecutive-blank-lines": false, "no-duplicate-imports": false, "no-duplicate-variable": false, @@ -23,6 +24,7 @@ "no-namespace": false, "no-padding": false, "no-string-throw": false, + "no-unnecessary-generics": false, "no-unnecessary-qualifier": false, "no-var-keyword": false, "object-literal-shorthand": false, diff --git a/types/oauth2-server/tslint.json b/types/oauth2-server/tslint.json index f93cf8562a..b1439230db 100644 --- a/types/oauth2-server/tslint.json +++ b/types/oauth2-server/tslint.json @@ -1,3 +1,7 @@ { - "extends": "dtslint/dt.json" + "extends": "dtslint/dt.json", + "rules": { + // TODO + "no-any-union": false + } } diff --git a/types/orientjs/tslint.json b/types/orientjs/tslint.json index 3db14f85ea..3393f9dcca 100644 --- a/types/orientjs/tslint.json +++ b/types/orientjs/tslint.json @@ -1 +1,8 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + // TODOs + "no-any-union": false, + "no-unnecessary-generics": false + } +} diff --git a/types/pixi.js/tslint.json b/types/pixi.js/tslint.json index 1b39c5314f..fb2df83ec9 100644 --- a/types/pixi.js/tslint.json +++ b/types/pixi.js/tslint.json @@ -5,10 +5,12 @@ "ban-types": false, "dt-header": false, "interface-name": false, + "no-any-union": false, "no-empty-interface": false, "no-inferrable-types": false, "no-mergeable-namespace": false, "no-single-declare-module": false, + "no-unnecessary-generics": false, "no-unnecessary-qualifier": false, "one-line": false, "prefer-conditional-expression": false, diff --git a/types/pouchdb-find/tslint.json b/types/pouchdb-find/tslint.json index 3db14f85ea..d9d49e375e 100644 --- a/types/pouchdb-find/tslint.json +++ b/types/pouchdb-find/tslint.json @@ -1 +1,6 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + "no-any-union": false + } +} diff --git a/types/pouchdb-mapreduce/tslint.json b/types/pouchdb-mapreduce/tslint.json index 3db14f85ea..c92fd86792 100644 --- a/types/pouchdb-mapreduce/tslint.json +++ b/types/pouchdb-mapreduce/tslint.json @@ -1 +1,7 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + // TODOs + "no-any-union": false + } +} diff --git a/types/prosemirror-model/tslint.json b/types/prosemirror-model/tslint.json index 3db14f85ea..b1439230db 100644 --- a/types/prosemirror-model/tslint.json +++ b/types/prosemirror-model/tslint.json @@ -1 +1,7 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + // TODO + "no-any-union": false + } +} diff --git a/types/python-shell/tslint.json b/types/python-shell/tslint.json index 3db14f85ea..b1439230db 100644 --- a/types/python-shell/tslint.json +++ b/types/python-shell/tslint.json @@ -1 +1,7 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + // TODO + "no-any-union": false + } +} diff --git a/types/q/tslint.json b/types/q/tslint.json index f88914f166..0bded8e292 100644 --- a/types/q/tslint.json +++ b/types/q/tslint.json @@ -2,6 +2,8 @@ "extends": "dtslint/dt.json", "rules": { // TODOs + "no-any-union": false, + "no-unnecessary-generics": false, "no-unnecessary-type-assertion": false, "prefer-declare-function": false, "strict-export-declare-modifiers": false, diff --git a/types/qlik-visualizationextensions/tslint.json b/types/qlik-visualizationextensions/tslint.json index 9a48ae7955..c1a4e40cca 100644 --- a/types/qlik-visualizationextensions/tslint.json +++ b/types/qlik-visualizationextensions/tslint.json @@ -2,7 +2,9 @@ "extends": "dtslint/dt.json", "rules": { "ban-types": false, + "no-any-union": false, "no-empty-interface": false, + "no-unnecessary-generics": false, "interface-name": false } } diff --git a/types/quill/tslint.json b/types/quill/tslint.json index d88586e5bd..b1439230db 100644 --- a/types/quill/tslint.json +++ b/types/quill/tslint.json @@ -1,3 +1,7 @@ { - "extends": "dtslint/dt.json" + "extends": "dtslint/dt.json", + "rules": { + // TODO + "no-any-union": false + } } diff --git a/types/raven/tslint.json b/types/raven/tslint.json index adaee1b55f..466bd50dd0 100644 --- a/types/raven/tslint.json +++ b/types/raven/tslint.json @@ -1,6 +1,8 @@ { "extends": "dtslint/dt.json", "rules": { - "export-just-namespace": false + // TODOs + "export-just-namespace": false, + "no-any-union": false } } diff --git a/types/rc-slider/tslint.json b/types/rc-slider/tslint.json index d88586e5bd..b1439230db 100644 --- a/types/rc-slider/tslint.json +++ b/types/rc-slider/tslint.json @@ -1,3 +1,7 @@ { - "extends": "dtslint/dt.json" + "extends": "dtslint/dt.json", + "rules": { + // TODO + "no-any-union": false + } } diff --git a/types/react-ga/tslint.json b/types/react-ga/tslint.json index 3db14f85ea..b1439230db 100644 --- a/types/react-ga/tslint.json +++ b/types/react-ga/tslint.json @@ -1 +1,7 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + // TODO + "no-any-union": false + } +} diff --git a/types/react-native-collapsible/tslint.json b/types/react-native-collapsible/tslint.json index 3db14f85ea..b1439230db 100644 --- a/types/react-native-collapsible/tslint.json +++ b/types/react-native-collapsible/tslint.json @@ -1 +1,7 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + // TODO + "no-any-union": false + } +} diff --git a/types/react-native-fetch-blob/tslint.json b/types/react-native-fetch-blob/tslint.json index 3db14f85ea..b1439230db 100644 --- a/types/react-native-fetch-blob/tslint.json +++ b/types/react-native-fetch-blob/tslint.json @@ -1 +1,7 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + // TODO + "no-any-union": false + } +} diff --git a/types/react-sortable-tree/tslint.json b/types/react-sortable-tree/tslint.json index 3db14f85ea..d9d49e375e 100644 --- a/types/react-sortable-tree/tslint.json +++ b/types/react-sortable-tree/tslint.json @@ -1 +1,6 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + "no-any-union": false + } +} diff --git a/types/react-transition-group/tsconfig.json b/types/react-transition-group/tsconfig.json index a0616fa5f6..ee34f669fc 100644 --- a/types/react-transition-group/tsconfig.json +++ b/types/react-transition-group/tsconfig.json @@ -5,7 +5,6 @@ "lib": [ "es6", "dom" ], - "strict": true, "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, diff --git a/types/react-transition-group/tslint.json b/types/react-transition-group/tslint.json index 3db14f85ea..f93cf8562a 100644 --- a/types/react-transition-group/tslint.json +++ b/types/react-transition-group/tslint.json @@ -1 +1,3 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json" +} diff --git a/types/react/tslint.json b/types/react/tslint.json index d1c6c0c133..c09aa3940e 100644 --- a/types/react/tslint.json +++ b/types/react/tslint.json @@ -3,7 +3,9 @@ "rules": { // TODOs "dt-header": false, + "no-any-union": false, "no-object-literal-type-assertion": false, + "no-unnecessary-generics": false, "no-void-expression": false } } diff --git a/types/react/v15/tslint.json b/types/react/v15/tslint.json index cd742ae762..10aae0e71c 100644 --- a/types/react/v15/tslint.json +++ b/types/react/v15/tslint.json @@ -3,7 +3,9 @@ "rules": { // TODO "dt-header": false, + "no-any-union": false, "no-object-literal-type-assertion": false, + "no-unnecessary-generics": false, "no-unnecessary-qualifier": false } } diff --git a/types/realm/tslint.json b/types/realm/tslint.json index 3db14f85ea..e6dc9b7f2f 100644 --- a/types/realm/tslint.json +++ b/types/realm/tslint.json @@ -1 +1,8 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + // TODO + "no-any-union": false, + "no-unnecessary-generics": false + } +} diff --git a/types/recharts/tslint.json b/types/recharts/tslint.json index b4b47a0378..2a04bed38c 100644 --- a/types/recharts/tslint.json +++ b/types/recharts/tslint.json @@ -1,3 +1,7 @@ { - "extends": "dtslint/dt.json" + "extends": "dtslint/dt.json", + "rules": { + // TODO + "no-any-union": false + } } diff --git a/types/restify/tslint.json b/types/restify/tslint.json index 1f65cdfcd0..718fb8f298 100644 --- a/types/restify/tslint.json +++ b/types/restify/tslint.json @@ -2,6 +2,7 @@ "extends": "dtslint/dt.json", "rules": { // TODOs + "no-any-union": false, "no-object-literal-type-assertion": false, "no-void-expression": false } diff --git a/types/revalidate/tslint.json b/types/revalidate/tslint.json index 3db14f85ea..d9d49e375e 100644 --- a/types/revalidate/tslint.json +++ b/types/revalidate/tslint.json @@ -1 +1,6 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + "no-any-union": false + } +} diff --git a/types/saywhen/tsconfig.json b/types/saywhen/tsconfig.json index e9a00c4d85..b2221f36e1 100644 --- a/types/saywhen/tsconfig.json +++ b/types/saywhen/tsconfig.json @@ -5,9 +5,7 @@ "es6" ], "forceConsistentCasingInFileNames": true, - "noFallthroughCasesInSwitch": true, "noImplicitAny": true, - "noImplicitReturns": true, "noImplicitThis": true, "noUnusedParameters": false, "noUnusedLocals": true, diff --git a/types/saywhen/tslint.json b/types/saywhen/tslint.json index 2750cc0197..3fc34b8203 100644 --- a/types/saywhen/tslint.json +++ b/types/saywhen/tslint.json @@ -1 +1,7 @@ -{ "extends": "dtslint/dt.json" } \ No newline at end of file +{ + "extends": "dtslint/dt.json", + "rules": { + // TODO + "no-unnecessary-generics": false + } +} diff --git a/types/semantic-ui-api/tslint.json b/types/semantic-ui-api/tslint.json index 758e484744..5584e45058 100644 --- a/types/semantic-ui-api/tslint.json +++ b/types/semantic-ui-api/tslint.json @@ -1,6 +1,7 @@ { "extends": "dtslint/dt.json", "rules": { + "no-any-union": false, "no-empty-interface": false, "unified-signatures": false } diff --git a/types/semantic-ui-search/tslint.json b/types/semantic-ui-search/tslint.json index 758e484744..5584e45058 100644 --- a/types/semantic-ui-search/tslint.json +++ b/types/semantic-ui-search/tslint.json @@ -1,6 +1,7 @@ { "extends": "dtslint/dt.json", "rules": { + "no-any-union": false, "no-empty-interface": false, "unified-signatures": false } diff --git a/types/sharepoint/tslint.json b/types/sharepoint/tslint.json index 8f46a13327..41a338313d 100644 --- a/types/sharepoint/tslint.json +++ b/types/sharepoint/tslint.json @@ -5,10 +5,12 @@ "dt-header": false, "jsdoc-format": false, "max-line-length": false, + "no-any-union": false, "no-duplicate-imports": false, "no-inferrable-types": false, "no-namespace": false, "no-mergeable-namespace": false, + "no-unnecessary-generics": false, "no-unnecessary-qualifier": false, "no-unnecessary-type-assertion": false, "prefer-template": false, diff --git a/types/stripe-v3/tslint.json b/types/stripe-v3/tslint.json index 26bcea6634..a2b9c40f43 100644 --- a/types/stripe-v3/tslint.json +++ b/types/stripe-v3/tslint.json @@ -1,6 +1,8 @@ { "extends": "dtslint/dt.json", "rules": { - "dt-header": false + // TODOs + "dt-header": false, + "no-any-union": false } } diff --git a/types/telebot/tslint.json b/types/telebot/tslint.json index 3db14f85ea..b1439230db 100644 --- a/types/telebot/tslint.json +++ b/types/telebot/tslint.json @@ -1 +1,7 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + // TODO + "no-any-union": false + } +} diff --git a/types/undertaker/tslint.json b/types/undertaker/tslint.json index 3db14f85ea..b1439230db 100644 --- a/types/undertaker/tslint.json +++ b/types/undertaker/tslint.json @@ -1 +1,7 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + // TODO + "no-any-union": false + } +} diff --git a/types/url-search-params/tslint.json b/types/url-search-params/tslint.json index 2750cc0197..b1439230db 100644 --- a/types/url-search-params/tslint.json +++ b/types/url-search-params/tslint.json @@ -1 +1,7 @@ -{ "extends": "dtslint/dt.json" } \ No newline at end of file +{ + "extends": "dtslint/dt.json", + "rules": { + // TODO + "no-any-union": false + } +} diff --git a/types/uuid/tsconfig.json b/types/uuid/tsconfig.json index 9294327588..627132852a 100644 --- a/types/uuid/tsconfig.json +++ b/types/uuid/tsconfig.json @@ -7,7 +7,6 @@ "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, - "strict": true, "baseUrl": "../", "typeRoots": [ "../" diff --git a/types/vis/tslint.json b/types/vis/tslint.json index 3db14f85ea..b1439230db 100644 --- a/types/vis/tslint.json +++ b/types/vis/tslint.json @@ -1 +1,7 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + // TODO + "no-any-union": false + } +} diff --git a/types/webpack-chain/tslint.json b/types/webpack-chain/tslint.json index 3db14f85ea..b1439230db 100644 --- a/types/webpack-chain/tslint.json +++ b/types/webpack-chain/tslint.json @@ -1 +1,7 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + // TODO + "no-any-union": false + } +} diff --git a/types/weixin-app/tslint.json b/types/weixin-app/tslint.json index 971674da9b..28e4bbd73b 100644 --- a/types/weixin-app/tslint.json +++ b/types/weixin-app/tslint.json @@ -2,6 +2,7 @@ "extends": "dtslint/dt.json", "rules": { // TODOs + "no-any-union": false, "no-irregular-whitespace": false, "no-mergeable-namespace": false, "no-unnecessary-qualifier": false diff --git a/types/yandex-maps/tslint.json b/types/yandex-maps/tslint.json index efcd8d3270..80826ab363 100644 --- a/types/yandex-maps/tslint.json +++ b/types/yandex-maps/tslint.json @@ -4,6 +4,7 @@ "array-type": false, "interface-name": false, "comment-format": false, + "no-any-union": false, "strict-export-declare-modifiers": false } } From d74806eb3d3bea0fa39e24501bd01cf1b7f2faa7 Mon Sep 17 00:00:00 2001 From: Andy Date: Fri, 1 Sep 2017 08:34:37 -0700 Subject: [PATCH 104/156] Add lint disables for no-unnecessary-generics (#19508) --- scripts/fix-tslint.ts | 11 ++++- types/aframe/tslint.json | 4 +- types/angular-resource/tslint.json | 3 +- types/bluebird-global/tslint.json | 3 +- types/bunnymq/tslint.json | 4 +- types/chocolatechipjs/tslint.json | 3 +- types/continuation-local-storage/tslint.json | 3 +- types/core-js/tslint.json | 3 +- types/cwise-parser/tslint.json | 4 +- types/d3-array/tslint.json | 3 +- types/d3-axis/tslint.json | 3 +- types/d3-brush/tslint.json | 3 +- types/d3-chord/tslint.json | 3 +- types/d3-collection/tslint.json | 3 +- types/d3-contour/tslint.json | 9 ++-- types/d3-dispatch/tslint.json | 3 +- types/d3-drag/tslint.json | 3 +- types/d3-force/tslint.json | 3 +- types/d3-geo/tslint.json | 6 ++- types/d3-quadtree/tslint.json | 3 +- types/d3-sankey/tslint.json | 3 +- types/d3-scale/tslint.json | 3 +- types/d3-selection/tslint.json | 3 +- types/d3-shape/tslint.json | 3 +- types/d3-transition/tslint.json | 3 +- types/d3-voronoi/tslint.json | 3 +- types/d3-zoom/tslint.json | 3 +- types/delay/tslint.json | 11 ++--- types/documentdb/tslint.json | 2 +- types/enzyme/tslint.json | 13 +++--- types/expect/tslint.json | 13 +++--- types/firebird/tslint.json | 3 +- types/google-protobuf/tslint.json | 29 +++++++------ types/google.analytics/tslint.json | 3 +- types/highcharts/tslint.json | 17 ++++---- types/jest/tslint.json | 3 +- types/jquery.tools/tslint.json | 11 ++--- types/jwt-decode/tslint.json | 4 +- types/jwt-decode/v1/tslint.json | 4 +- types/kii-cloud-sdk/tslint.json | 3 +- types/moonjs/tslint.json | 2 +- types/nedb/tslint.json | 4 +- types/node-cache/tslint.json | 13 +++--- types/node-ral/tslint.json | 7 +-- types/parsimmon/tslint.json | 13 +++--- types/prosemirror-collab/tslint.json | 4 +- types/prosemirror-history/tslint.json | 4 +- types/prosemirror-keymap/tslint.json | 4 +- types/prosemirror-state/tslint.json | 3 +- .../tslint.json | 4 +- types/react-native/tslint.json | 3 +- types/react-navigation/tslint.json | 43 ++++++++++--------- types/react-router-config/tslint.json | 3 +- types/react-router-dom/tslint.json | 9 ++-- types/react-router/tslint.json | 2 +- types/react-router/v2/tslint.json | 3 +- types/react-router/v3/tslint.json | 11 ++--- types/redux-auth-wrapper/tslint.json | 11 ++--- types/redux-auth-wrapper/v1/tslint.json | 3 +- types/redux-localstorage/tslint.json | 3 +- .../tslint.json | 4 +- .../tslint.json | 4 +- types/rewire/tslint.json | 4 +- types/riot/tslint.json | 4 +- types/rx-core-binding/tslint.json | 3 +- types/rx-core/tslint.json | 3 +- types/rx-dom/tslint.json | 3 +- types/rx-lite-coincidence/tslint.json | 3 +- types/rx-lite-testing/tslint.json | 3 +- types/rx-lite-time/tslint.json | 3 +- types/rx-lite/tslint.json | 3 +- types/steed/tslint.json | 3 +- types/sumo-logger/tslint.json | 4 +- types/webdriverio/tslint.json | 15 ++++--- types/wu/tslint.json | 11 ++--- types/xrm/tslint.json | 8 +++- types/yargs/tslint.json | 9 ++-- types/zui/tslint.json | 3 +- 78 files changed, 250 insertions(+), 206 deletions(-) diff --git a/scripts/fix-tslint.ts b/scripts/fix-tslint.ts index 419ebcd0de..36cb23ebbd 100644 --- a/scripts/fix-tslint.ts +++ b/scripts/fix-tslint.ts @@ -39,7 +39,16 @@ function fix(config: any): any { const out: any = {}; for (const key in config) { let value = config[key]; - out[key] = value; + out[key] = key === "rules" ? fixRules(value) : value; } return out; } + +function fixRules(rules: any): any { + const out: any = {}; + for (const key in rules) { + out[key] = rules[key]; + } + return out; +} + diff --git a/types/aframe/tslint.json b/types/aframe/tslint.json index d88586e5bd..3db14f85ea 100644 --- a/types/aframe/tslint.json +++ b/types/aframe/tslint.json @@ -1,3 +1 @@ -{ - "extends": "dtslint/dt.json" -} +{ "extends": "dtslint/dt.json" } diff --git a/types/angular-resource/tslint.json b/types/angular-resource/tslint.json index ff19c22fa3..b4b1464296 100644 --- a/types/angular-resource/tslint.json +++ b/types/angular-resource/tslint.json @@ -8,6 +8,7 @@ "no-object-literal-type-assertion": false, "ban-types": false, "space-before-function-paren": false, - "unified-signatures": false + "unified-signatures": false, + "no-unnecessary-generics": false } } diff --git a/types/bluebird-global/tslint.json b/types/bluebird-global/tslint.json index b936b5e2b9..1d81af2349 100644 --- a/types/bluebird-global/tslint.json +++ b/types/bluebird-global/tslint.json @@ -5,6 +5,7 @@ "no-empty-interface": false, "array-type": false, "unified-signatures": false, - "ban-types": false + "ban-types": false, + "no-unnecessary-generics": false } } diff --git a/types/bunnymq/tslint.json b/types/bunnymq/tslint.json index f93cf8562a..3db14f85ea 100644 --- a/types/bunnymq/tslint.json +++ b/types/bunnymq/tslint.json @@ -1,3 +1 @@ -{ - "extends": "dtslint/dt.json" -} +{ "extends": "dtslint/dt.json" } diff --git a/types/chocolatechipjs/tslint.json b/types/chocolatechipjs/tslint.json index 462a0000f7..ce367ade18 100644 --- a/types/chocolatechipjs/tslint.json +++ b/types/chocolatechipjs/tslint.json @@ -6,6 +6,7 @@ "ban-types": false, "dt-header": false, "no-any-union": false, - "unified-signatures": false + "unified-signatures": false, + "no-unnecessary-generics": false } } diff --git a/types/continuation-local-storage/tslint.json b/types/continuation-local-storage/tslint.json index 4b7077d438..0c26acc12f 100644 --- a/types/continuation-local-storage/tslint.json +++ b/types/continuation-local-storage/tslint.json @@ -7,6 +7,7 @@ "one-variable-per-declaration": false, "space-before-function-paren": false, "no-var": false, - "interface-over-type-literal": false + "interface-over-type-literal": false, + "no-unnecessary-generics": false } } diff --git a/types/core-js/tslint.json b/types/core-js/tslint.json index a62d0d4e68..deb0a8f9b2 100644 --- a/types/core-js/tslint.json +++ b/types/core-js/tslint.json @@ -1,6 +1,7 @@ { "extends": "dtslint/dt.json", "rules": { - "ban-types": false + "ban-types": false, + "no-unnecessary-generics": false } } diff --git a/types/cwise-parser/tslint.json b/types/cwise-parser/tslint.json index 531fb4ef87..3db14f85ea 100644 --- a/types/cwise-parser/tslint.json +++ b/types/cwise-parser/tslint.json @@ -1,3 +1 @@ -{ - "extends": "dtslint/dt.json" -} \ No newline at end of file +{ "extends": "dtslint/dt.json" } diff --git a/types/d3-array/tslint.json b/types/d3-array/tslint.json index 08b1465cd6..54efb0b84e 100644 --- a/types/d3-array/tslint.json +++ b/types/d3-array/tslint.json @@ -1,6 +1,7 @@ { "extends": "dtslint/dt.json", "rules": { - "unified-signatures": false + "unified-signatures": false, + "no-unnecessary-generics": false } } diff --git a/types/d3-axis/tslint.json b/types/d3-axis/tslint.json index 08b1465cd6..54efb0b84e 100644 --- a/types/d3-axis/tslint.json +++ b/types/d3-axis/tslint.json @@ -1,6 +1,7 @@ { "extends": "dtslint/dt.json", "rules": { - "unified-signatures": false + "unified-signatures": false, + "no-unnecessary-generics": false } } diff --git a/types/d3-brush/tslint.json b/types/d3-brush/tslint.json index 08b1465cd6..54efb0b84e 100644 --- a/types/d3-brush/tslint.json +++ b/types/d3-brush/tslint.json @@ -1,6 +1,7 @@ { "extends": "dtslint/dt.json", "rules": { - "unified-signatures": false + "unified-signatures": false, + "no-unnecessary-generics": false } } diff --git a/types/d3-chord/tslint.json b/types/d3-chord/tslint.json index 08b1465cd6..54efb0b84e 100644 --- a/types/d3-chord/tslint.json +++ b/types/d3-chord/tslint.json @@ -1,6 +1,7 @@ { "extends": "dtslint/dt.json", "rules": { - "unified-signatures": false + "unified-signatures": false, + "no-unnecessary-generics": false } } diff --git a/types/d3-collection/tslint.json b/types/d3-collection/tslint.json index 08b1465cd6..54efb0b84e 100644 --- a/types/d3-collection/tslint.json +++ b/types/d3-collection/tslint.json @@ -1,6 +1,7 @@ { "extends": "dtslint/dt.json", "rules": { - "unified-signatures": false + "unified-signatures": false, + "no-unnecessary-generics": false } } diff --git a/types/d3-contour/tslint.json b/types/d3-contour/tslint.json index 08016de61a..54efb0b84e 100644 --- a/types/d3-contour/tslint.json +++ b/types/d3-contour/tslint.json @@ -1,6 +1,7 @@ { - "extends": "dtslint/dt.json", - "rules": { - "unified-signatures": false - } + "extends": "dtslint/dt.json", + "rules": { + "unified-signatures": false, + "no-unnecessary-generics": false + } } diff --git a/types/d3-dispatch/tslint.json b/types/d3-dispatch/tslint.json index 08b1465cd6..54efb0b84e 100644 --- a/types/d3-dispatch/tslint.json +++ b/types/d3-dispatch/tslint.json @@ -1,6 +1,7 @@ { "extends": "dtslint/dt.json", "rules": { - "unified-signatures": false + "unified-signatures": false, + "no-unnecessary-generics": false } } diff --git a/types/d3-drag/tslint.json b/types/d3-drag/tslint.json index b8825c1674..26ee29cf50 100644 --- a/types/d3-drag/tslint.json +++ b/types/d3-drag/tslint.json @@ -3,6 +3,7 @@ "rules": { // TODO "no-this-assignment": false, - "unified-signatures": false + "unified-signatures": false, + "no-unnecessary-generics": false } } diff --git a/types/d3-force/tslint.json b/types/d3-force/tslint.json index b8825c1674..26ee29cf50 100644 --- a/types/d3-force/tslint.json +++ b/types/d3-force/tslint.json @@ -3,6 +3,7 @@ "rules": { // TODO "no-this-assignment": false, - "unified-signatures": false + "unified-signatures": false, + "no-unnecessary-generics": false } } diff --git a/types/d3-geo/tslint.json b/types/d3-geo/tslint.json index 680a816ce2..3020672011 100644 --- a/types/d3-geo/tslint.json +++ b/types/d3-geo/tslint.json @@ -4,6 +4,10 @@ // TODO "no-this-assignment": false, "unified-signatures": false, - "max-line-length": [false, 200] + "max-line-length": [ + false, + 200 + ], + "no-unnecessary-generics": false } } diff --git a/types/d3-quadtree/tslint.json b/types/d3-quadtree/tslint.json index 38aa3fb5b3..9e3df4b94a 100644 --- a/types/d3-quadtree/tslint.json +++ b/types/d3-quadtree/tslint.json @@ -2,6 +2,7 @@ "extends": "dtslint/dt.json", "rules": { "unified-signatures": false, - "no-empty-interface": false + "no-empty-interface": false, + "no-unnecessary-generics": false } } diff --git a/types/d3-sankey/tslint.json b/types/d3-sankey/tslint.json index 08b1465cd6..54efb0b84e 100644 --- a/types/d3-sankey/tslint.json +++ b/types/d3-sankey/tslint.json @@ -1,6 +1,7 @@ { "extends": "dtslint/dt.json", "rules": { - "unified-signatures": false + "unified-signatures": false, + "no-unnecessary-generics": false } } diff --git a/types/d3-scale/tslint.json b/types/d3-scale/tslint.json index 604d5950cf..9846c79a4d 100644 --- a/types/d3-scale/tslint.json +++ b/types/d3-scale/tslint.json @@ -2,6 +2,7 @@ "extends": "dtslint/dt.json", "rules": { "unified-signatures": false, - "callable-types": false + "callable-types": false, + "no-unnecessary-generics": false } } diff --git a/types/d3-selection/tslint.json b/types/d3-selection/tslint.json index b8825c1674..26ee29cf50 100644 --- a/types/d3-selection/tslint.json +++ b/types/d3-selection/tslint.json @@ -3,6 +3,7 @@ "rules": { // TODO "no-this-assignment": false, - "unified-signatures": false + "unified-signatures": false, + "no-unnecessary-generics": false } } diff --git a/types/d3-shape/tslint.json b/types/d3-shape/tslint.json index 108ab49c45..b1ba182ba6 100644 --- a/types/d3-shape/tslint.json +++ b/types/d3-shape/tslint.json @@ -4,6 +4,7 @@ // TODO "no-this-assignment": false, "unified-signatures": false, - "callable-types": false + "callable-types": false, + "no-unnecessary-generics": false } } diff --git a/types/d3-transition/tslint.json b/types/d3-transition/tslint.json index b8825c1674..26ee29cf50 100644 --- a/types/d3-transition/tslint.json +++ b/types/d3-transition/tslint.json @@ -3,6 +3,7 @@ "rules": { // TODO "no-this-assignment": false, - "unified-signatures": false + "unified-signatures": false, + "no-unnecessary-generics": false } } diff --git a/types/d3-voronoi/tslint.json b/types/d3-voronoi/tslint.json index 08b1465cd6..54efb0b84e 100644 --- a/types/d3-voronoi/tslint.json +++ b/types/d3-voronoi/tslint.json @@ -1,6 +1,7 @@ { "extends": "dtslint/dt.json", "rules": { - "unified-signatures": false + "unified-signatures": false, + "no-unnecessary-generics": false } } diff --git a/types/d3-zoom/tslint.json b/types/d3-zoom/tslint.json index b8825c1674..26ee29cf50 100644 --- a/types/d3-zoom/tslint.json +++ b/types/d3-zoom/tslint.json @@ -3,6 +3,7 @@ "rules": { // TODO "no-this-assignment": false, - "unified-signatures": false + "unified-signatures": false, + "no-unnecessary-generics": false } } diff --git a/types/delay/tslint.json b/types/delay/tslint.json index 21fecfef93..bf610ae17f 100644 --- a/types/delay/tslint.json +++ b/types/delay/tslint.json @@ -1,7 +1,8 @@ { - "extends": "dtslint/dt.json", - "rules": { - // TODO - "await-promise": false - } + "extends": "dtslint/dt.json", + "rules": { + // TODO + "await-promise": false, + "no-unnecessary-generics": false + } } diff --git a/types/documentdb/tslint.json b/types/documentdb/tslint.json index 2750cc0197..3db14f85ea 100644 --- a/types/documentdb/tslint.json +++ b/types/documentdb/tslint.json @@ -1 +1 @@ -{ "extends": "dtslint/dt.json" } \ No newline at end of file +{ "extends": "dtslint/dt.json" } diff --git a/types/enzyme/tslint.json b/types/enzyme/tslint.json index 1c1a051bd3..67c3be0ed0 100644 --- a/types/enzyme/tslint.json +++ b/types/enzyme/tslint.json @@ -1,8 +1,9 @@ { - "extends": "dtslint/dt.json", - "rules": { - // TODOs - "dt-header": false, - "no-duplicate-imports": false - } + "extends": "dtslint/dt.json", + "rules": { + // TODOs + "dt-header": false, + "no-duplicate-imports": false, + "no-unnecessary-generics": false + } } diff --git a/types/expect/tslint.json b/types/expect/tslint.json index 420d80e8f3..00e5a6b547 100644 --- a/types/expect/tslint.json +++ b/types/expect/tslint.json @@ -1,8 +1,9 @@ { - "extends": "dtslint/dt.json", - "rules": { - // TODO - "no-void-expression": false, - "no-duplicate-imports": false - } + "extends": "dtslint/dt.json", + "rules": { + // TODO + "no-void-expression": false, + "no-duplicate-imports": false, + "no-unnecessary-generics": false + } } diff --git a/types/firebird/tslint.json b/types/firebird/tslint.json index b63c1c3846..188dc816e2 100644 --- a/types/firebird/tslint.json +++ b/types/firebird/tslint.json @@ -2,6 +2,7 @@ "extends": "dtslint/dt.json", "rules": { // TODO - "no-boolean-literal-compare": false + "no-boolean-literal-compare": false, + "no-unnecessary-generics": false } } diff --git a/types/google-protobuf/tslint.json b/types/google-protobuf/tslint.json index a88c66859c..b04385bb7a 100644 --- a/types/google-protobuf/tslint.json +++ b/types/google-protobuf/tslint.json @@ -1,16 +1,17 @@ { - "extends": "dtslint/dt.json", - "rules": { - "align": false, - "array-type": false, - "new-parens": false, - "no-consecutive-blank-lines": false, - "interface-over-type-literal": false, - "no-relative-import-in-test": false, - "no-var": false, - "prefer-declare-function": false, - "semicolon": false, - "strict-export-declare-modifiers": false, - "trim-file": false - } + "extends": "dtslint/dt.json", + "rules": { + "align": false, + "array-type": false, + "new-parens": false, + "no-consecutive-blank-lines": false, + "interface-over-type-literal": false, + "no-relative-import-in-test": false, + "no-var": false, + "prefer-declare-function": false, + "semicolon": false, + "strict-export-declare-modifiers": false, + "trim-file": false, + "no-unnecessary-generics": false + } } diff --git a/types/google.analytics/tslint.json b/types/google.analytics/tslint.json index 57e94004d5..d802652174 100644 --- a/types/google.analytics/tslint.json +++ b/types/google.analytics/tslint.json @@ -3,6 +3,7 @@ "rules": { "dt-header": false, "ban-types": false, - "unified-signatures": false + "unified-signatures": false, + "no-unnecessary-generics": false } } diff --git a/types/highcharts/tslint.json b/types/highcharts/tslint.json index d8b67d5d1f..df5c6f4ca0 100644 --- a/types/highcharts/tslint.json +++ b/types/highcharts/tslint.json @@ -1,10 +1,11 @@ { - "extends": "dtslint/dt.json", - "rules": { - "ban-types": false, - "unified-signatures": false, - "no-empty-interface": false, - "dt-header": false, - "no-object-literal-type-assertion": false - } + "extends": "dtslint/dt.json", + "rules": { + "ban-types": false, + "unified-signatures": false, + "no-empty-interface": false, + "dt-header": false, + "no-object-literal-type-assertion": false, + "no-unnecessary-generics": false + } } diff --git a/types/jest/tslint.json b/types/jest/tslint.json index a839e8aa9f..86d51194e9 100644 --- a/types/jest/tslint.json +++ b/types/jest/tslint.json @@ -4,6 +4,7 @@ // TODOs "dt-header": false, "no-mergeable-namespace": false, - "no-void-expression": false + "no-void-expression": false, + "no-unnecessary-generics": false } } diff --git a/types/jquery.tools/tslint.json b/types/jquery.tools/tslint.json index 26a0c302a8..9d0759ec89 100644 --- a/types/jquery.tools/tslint.json +++ b/types/jquery.tools/tslint.json @@ -1,7 +1,8 @@ { - "extends": "dtslint/dt.json", - "rules": { - // TODO - "no-void-expression": false - } + "extends": "dtslint/dt.json", + "rules": { + // TODO + "no-void-expression": false, + "no-unnecessary-generics": false + } } diff --git a/types/jwt-decode/tslint.json b/types/jwt-decode/tslint.json index f93cf8562a..3db14f85ea 100644 --- a/types/jwt-decode/tslint.json +++ b/types/jwt-decode/tslint.json @@ -1,3 +1 @@ -{ - "extends": "dtslint/dt.json" -} +{ "extends": "dtslint/dt.json" } diff --git a/types/jwt-decode/v1/tslint.json b/types/jwt-decode/v1/tslint.json index f93cf8562a..3db14f85ea 100644 --- a/types/jwt-decode/v1/tslint.json +++ b/types/jwt-decode/v1/tslint.json @@ -1,3 +1 @@ -{ - "extends": "dtslint/dt.json" -} +{ "extends": "dtslint/dt.json" } diff --git a/types/kii-cloud-sdk/tslint.json b/types/kii-cloud-sdk/tslint.json index 65c83fb1e3..c4fd1ce0bb 100644 --- a/types/kii-cloud-sdk/tslint.json +++ b/types/kii-cloud-sdk/tslint.json @@ -1,6 +1,7 @@ { "extends": "dtslint/dt.json", "rules": { - "dt-header": false + "dt-header": false, + "no-unnecessary-generics": false } } diff --git a/types/moonjs/tslint.json b/types/moonjs/tslint.json index 2750cc0197..3db14f85ea 100644 --- a/types/moonjs/tslint.json +++ b/types/moonjs/tslint.json @@ -1 +1 @@ -{ "extends": "dtslint/dt.json" } \ No newline at end of file +{ "extends": "dtslint/dt.json" } diff --git a/types/nedb/tslint.json b/types/nedb/tslint.json index f93cf8562a..3db14f85ea 100644 --- a/types/nedb/tslint.json +++ b/types/nedb/tslint.json @@ -1,3 +1 @@ -{ - "extends": "dtslint/dt.json" -} +{ "extends": "dtslint/dt.json" } diff --git a/types/node-cache/tslint.json b/types/node-cache/tslint.json index ad5a9e6918..6c1ac808bb 100644 --- a/types/node-cache/tslint.json +++ b/types/node-cache/tslint.json @@ -1,7 +1,8 @@ { - "extends": "dtslint/dt.json", - "rules": { - // TODO - "prefer-const": false - } -} \ No newline at end of file + "extends": "dtslint/dt.json", + "rules": { + // TODO + "prefer-const": false, + "no-unnecessary-generics": false + } +} diff --git a/types/node-ral/tslint.json b/types/node-ral/tslint.json index 96427e1ebe..5b248e6b6b 100644 --- a/types/node-ral/tslint.json +++ b/types/node-ral/tslint.json @@ -3,6 +3,7 @@ "rules": { // TODOs "no-object-literal-type-assertion": false, - "only-arrow-functions": false - } -} \ No newline at end of file + "only-arrow-functions": false, + "no-unnecessary-generics": false + } +} diff --git a/types/parsimmon/tslint.json b/types/parsimmon/tslint.json index a2a1386037..e6f86832c0 100644 --- a/types/parsimmon/tslint.json +++ b/types/parsimmon/tslint.json @@ -1,8 +1,9 @@ { - "extends": "dtslint/dt.json", - "rules": { - // TODOs - "no-unnecessary-qualifier": false, - "no-boolean-literal-compare": false - } + "extends": "dtslint/dt.json", + "rules": { + // TODOs + "no-unnecessary-qualifier": false, + "no-boolean-literal-compare": false, + "no-unnecessary-generics": false + } } diff --git a/types/prosemirror-collab/tslint.json b/types/prosemirror-collab/tslint.json index f93cf8562a..3db14f85ea 100644 --- a/types/prosemirror-collab/tslint.json +++ b/types/prosemirror-collab/tslint.json @@ -1,3 +1 @@ -{ - "extends": "dtslint/dt.json" -} +{ "extends": "dtslint/dt.json" } diff --git a/types/prosemirror-history/tslint.json b/types/prosemirror-history/tslint.json index f93cf8562a..3db14f85ea 100644 --- a/types/prosemirror-history/tslint.json +++ b/types/prosemirror-history/tslint.json @@ -1,3 +1 @@ -{ - "extends": "dtslint/dt.json" -} +{ "extends": "dtslint/dt.json" } diff --git a/types/prosemirror-keymap/tslint.json b/types/prosemirror-keymap/tslint.json index f93cf8562a..3db14f85ea 100644 --- a/types/prosemirror-keymap/tslint.json +++ b/types/prosemirror-keymap/tslint.json @@ -1,3 +1 @@ -{ - "extends": "dtslint/dt.json" -} +{ "extends": "dtslint/dt.json" } diff --git a/types/prosemirror-state/tslint.json b/types/prosemirror-state/tslint.json index 9e23990c45..6371e80ee3 100644 --- a/types/prosemirror-state/tslint.json +++ b/types/prosemirror-state/tslint.json @@ -2,6 +2,7 @@ "extends": "dtslint/dt.json", "rules": { // TODO - "no-object-literal-type-assertion": false + "no-object-literal-type-assertion": false, + "no-unnecessary-generics": false } } diff --git a/types/react-native-google-analytics-bridge/tslint.json b/types/react-native-google-analytics-bridge/tslint.json index d88586e5bd..3db14f85ea 100644 --- a/types/react-native-google-analytics-bridge/tslint.json +++ b/types/react-native-google-analytics-bridge/tslint.json @@ -1,3 +1 @@ -{ - "extends": "dtslint/dt.json" -} +{ "extends": "dtslint/dt.json" } diff --git a/types/react-native/tslint.json b/types/react-native/tslint.json index 39e23d7cb1..57266aecfb 100644 --- a/types/react-native/tslint.json +++ b/types/react-native/tslint.json @@ -21,6 +21,7 @@ "semicolon": false, "space-within-parens": false, "strict-export-declare-modifiers": false, - "use-default-type-parameter": false + "use-default-type-parameter": false, + "no-unnecessary-generics": false } } diff --git a/types/react-navigation/tslint.json b/types/react-navigation/tslint.json index 07cc01e66e..28a2376a18 100644 --- a/types/react-navigation/tslint.json +++ b/types/react-navigation/tslint.json @@ -1,23 +1,24 @@ { - "extends": "dtslint/dt.json", - "rules": { - // Lowercase `object` is available in TypeScript 2.2 only. - "ban-types": false, - // Below are all TODO - "align": false, - "array-type": false, - "comment-format": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "no-misused-new": false, - "no-consecutive-blank-lines": false, - "no-empty-interface": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-var": false, - "prefer-declare-function": false, - "prefer-method-signature": false, - "semicolon": false, - "strict-export-declare-modifiers": false - } + "extends": "dtslint/dt.json", + "rules": { + // Lowercase `object` is available in TypeScript 2.2 only. + "ban-types": false, + // Below are all TODO + "align": false, + "array-type": false, + "comment-format": false, + "interface-over-type-literal": false, + "jsdoc-format": false, + "no-misused-new": false, + "no-consecutive-blank-lines": false, + "no-empty-interface": false, + "no-object-literal-type-assertion": false, + "no-padding": false, + "no-var": false, + "prefer-declare-function": false, + "prefer-method-signature": false, + "semicolon": false, + "strict-export-declare-modifiers": false, + "no-unnecessary-generics": false + } } diff --git a/types/react-router-config/tslint.json b/types/react-router-config/tslint.json index 1bdaea429e..5999f81998 100644 --- a/types/react-router-config/tslint.json +++ b/types/react-router-config/tslint.json @@ -1,6 +1,7 @@ { "extends": "dtslint/dt.json", "rules": { - "void-return": false + "void-return": false, + "no-unnecessary-generics": false } } diff --git a/types/react-router-dom/tslint.json b/types/react-router-dom/tslint.json index e765bc9e16..40726941e3 100644 --- a/types/react-router-dom/tslint.json +++ b/types/react-router-dom/tslint.json @@ -1,6 +1,7 @@ { - "extends": "dtslint/dt.json", - "rules": { - "no-single-declare-module": false - } + "extends": "dtslint/dt.json", + "rules": { + "no-single-declare-module": false, + "no-unnecessary-generics": false + } } diff --git a/types/react-router/tslint.json b/types/react-router/tslint.json index 2750cc0197..3db14f85ea 100644 --- a/types/react-router/tslint.json +++ b/types/react-router/tslint.json @@ -1 +1 @@ -{ "extends": "dtslint/dt.json" } \ No newline at end of file +{ "extends": "dtslint/dt.json" } diff --git a/types/react-router/v2/tslint.json b/types/react-router/v2/tslint.json index 26dae606b6..ff9716ad87 100644 --- a/types/react-router/v2/tslint.json +++ b/types/react-router/v2/tslint.json @@ -2,6 +2,7 @@ "extends": "dtslint/dt.json", "rules": { "ban-types": false, - "no-empty-interface": false + "no-empty-interface": false, + "no-unnecessary-generics": false } } diff --git a/types/react-router/v3/tslint.json b/types/react-router/v3/tslint.json index 440efbd687..f32a9427f5 100644 --- a/types/react-router/v3/tslint.json +++ b/types/react-router/v3/tslint.json @@ -1,7 +1,8 @@ { - "extends": "dtslint/dt.json", - "rules": { - // TODO - "no-duplicate-imports": false - } + "extends": "dtslint/dt.json", + "rules": { + // TODO + "no-duplicate-imports": false, + "no-unnecessary-generics": false + } } diff --git a/types/redux-auth-wrapper/tslint.json b/types/redux-auth-wrapper/tslint.json index 440efbd687..f32a9427f5 100644 --- a/types/redux-auth-wrapper/tslint.json +++ b/types/redux-auth-wrapper/tslint.json @@ -1,7 +1,8 @@ { - "extends": "dtslint/dt.json", - "rules": { - // TODO - "no-duplicate-imports": false - } + "extends": "dtslint/dt.json", + "rules": { + // TODO + "no-duplicate-imports": false, + "no-unnecessary-generics": false + } } diff --git a/types/redux-auth-wrapper/v1/tslint.json b/types/redux-auth-wrapper/v1/tslint.json index 091817f734..f32a9427f5 100644 --- a/types/redux-auth-wrapper/v1/tslint.json +++ b/types/redux-auth-wrapper/v1/tslint.json @@ -2,6 +2,7 @@ "extends": "dtslint/dt.json", "rules": { // TODO - "no-duplicate-imports": false + "no-duplicate-imports": false, + "no-unnecessary-generics": false } } diff --git a/types/redux-localstorage/tslint.json b/types/redux-localstorage/tslint.json index 26dae606b6..ff9716ad87 100644 --- a/types/redux-localstorage/tslint.json +++ b/types/redux-localstorage/tslint.json @@ -2,6 +2,7 @@ "extends": "dtslint/dt.json", "rules": { "ban-types": false, - "no-empty-interface": false + "no-empty-interface": false, + "no-unnecessary-generics": false } } diff --git a/types/redux-persist-transform-encrypt/tslint.json b/types/redux-persist-transform-encrypt/tslint.json index f93cf8562a..3db14f85ea 100644 --- a/types/redux-persist-transform-encrypt/tslint.json +++ b/types/redux-persist-transform-encrypt/tslint.json @@ -1,3 +1 @@ -{ - "extends": "dtslint/dt.json" -} +{ "extends": "dtslint/dt.json" } diff --git a/types/redux-persist-transform-filter/tslint.json b/types/redux-persist-transform-filter/tslint.json index f93cf8562a..3db14f85ea 100644 --- a/types/redux-persist-transform-filter/tslint.json +++ b/types/redux-persist-transform-filter/tslint.json @@ -1,3 +1 @@ -{ - "extends": "dtslint/dt.json" -} +{ "extends": "dtslint/dt.json" } diff --git a/types/rewire/tslint.json b/types/rewire/tslint.json index 30a1bdde2e..3db14f85ea 100644 --- a/types/rewire/tslint.json +++ b/types/rewire/tslint.json @@ -1,3 +1 @@ -{ - "extends": "dtslint/dt.json" -} \ No newline at end of file +{ "extends": "dtslint/dt.json" } diff --git a/types/riot/tslint.json b/types/riot/tslint.json index d88586e5bd..3db14f85ea 100644 --- a/types/riot/tslint.json +++ b/types/riot/tslint.json @@ -1,3 +1 @@ -{ - "extends": "dtslint/dt.json" -} +{ "extends": "dtslint/dt.json" } diff --git a/types/rx-core-binding/tslint.json b/types/rx-core-binding/tslint.json index 4541a9699c..1e909e7010 100644 --- a/types/rx-core-binding/tslint.json +++ b/types/rx-core-binding/tslint.json @@ -5,6 +5,7 @@ "dt-header": false, "no-empty-interface": false, "interface-name": false, - "no-single-declare-module": false + "no-single-declare-module": false, + "no-unnecessary-generics": false } } diff --git a/types/rx-core/tslint.json b/types/rx-core/tslint.json index 0b05bed81d..ffad78663c 100644 --- a/types/rx-core/tslint.json +++ b/types/rx-core/tslint.json @@ -6,6 +6,7 @@ "unified-signatures": false, "no-empty-interface": false, "interface-name": false, - "no-single-declare-module": false + "no-single-declare-module": false, + "no-unnecessary-generics": false } } diff --git a/types/rx-dom/tslint.json b/types/rx-dom/tslint.json index 9dd6362311..8fa8ca2a4c 100644 --- a/types/rx-dom/tslint.json +++ b/types/rx-dom/tslint.json @@ -6,6 +6,7 @@ // it would be particualrly strange to type these functions differently // @ above comment: Use a specific type such as `(x: string) => boolean` instead of just `Function` "ban-types": false, - "no-unnecessary-qualifier": false + "no-unnecessary-qualifier": false, + "no-unnecessary-generics": false } } diff --git a/types/rx-lite-coincidence/tslint.json b/types/rx-lite-coincidence/tslint.json index 6022355a23..0a71468350 100644 --- a/types/rx-lite-coincidence/tslint.json +++ b/types/rx-lite-coincidence/tslint.json @@ -4,6 +4,7 @@ // TODOs "dt-header": false, "unified-signatures": false, - "no-single-declare-module": false + "no-single-declare-module": false, + "no-unnecessary-generics": false } } diff --git a/types/rx-lite-testing/tslint.json b/types/rx-lite-testing/tslint.json index 075fa88707..40726941e3 100644 --- a/types/rx-lite-testing/tslint.json +++ b/types/rx-lite-testing/tslint.json @@ -1,6 +1,7 @@ { "extends": "dtslint/dt.json", "rules": { - "no-single-declare-module": false + "no-single-declare-module": false, + "no-unnecessary-generics": false } } diff --git a/types/rx-lite-time/tslint.json b/types/rx-lite-time/tslint.json index 6022355a23..0a71468350 100644 --- a/types/rx-lite-time/tslint.json +++ b/types/rx-lite-time/tslint.json @@ -4,6 +4,7 @@ // TODOs "dt-header": false, "unified-signatures": false, - "no-single-declare-module": false + "no-single-declare-module": false, + "no-unnecessary-generics": false } } diff --git a/types/rx-lite/tslint.json b/types/rx-lite/tslint.json index a10ea384b1..d545154ac5 100644 --- a/types/rx-lite/tslint.json +++ b/types/rx-lite/tslint.json @@ -10,6 +10,7 @@ "array-type": false, "max-line-length": false, "no-mergeable-namespace": false, - "no-single-declare-module": false + "no-single-declare-module": false, + "no-unnecessary-generics": false } } diff --git a/types/steed/tslint.json b/types/steed/tslint.json index dac87a5a1c..9e8a3fd572 100644 --- a/types/steed/tslint.json +++ b/types/steed/tslint.json @@ -3,6 +3,7 @@ "rules": { // TODOs "ban-types": false, - "no-unnecessary-qualifier": false + "no-unnecessary-qualifier": false, + "no-unnecessary-generics": false } } diff --git a/types/sumo-logger/tslint.json b/types/sumo-logger/tslint.json index f93cf8562a..3db14f85ea 100644 --- a/types/sumo-logger/tslint.json +++ b/types/sumo-logger/tslint.json @@ -1,3 +1 @@ -{ - "extends": "dtslint/dt.json" -} +{ "extends": "dtslint/dt.json" } diff --git a/types/webdriverio/tslint.json b/types/webdriverio/tslint.json index 06f1f46742..c467897cef 100644 --- a/types/webdriverio/tslint.json +++ b/types/webdriverio/tslint.json @@ -1,9 +1,10 @@ { - "extends": "dtslint/dt.json", - "rules": { - // TODOs - "await-promise": false, - "no-single-declare-module": false, - "unified-signatures": false - } + "extends": "dtslint/dt.json", + "rules": { + // TODOs + "await-promise": false, + "no-single-declare-module": false, + "unified-signatures": false, + "no-unnecessary-generics": false + } } diff --git a/types/wu/tslint.json b/types/wu/tslint.json index 26a0c302a8..9d0759ec89 100644 --- a/types/wu/tslint.json +++ b/types/wu/tslint.json @@ -1,7 +1,8 @@ { - "extends": "dtslint/dt.json", - "rules": { - // TODO - "no-void-expression": false - } + "extends": "dtslint/dt.json", + "rules": { + // TODO + "no-void-expression": false, + "no-unnecessary-generics": false + } } diff --git a/types/xrm/tslint.json b/types/xrm/tslint.json index 5e4fd81be5..f4cc3f2d22 100644 --- a/types/xrm/tslint.json +++ b/types/xrm/tslint.json @@ -8,12 +8,16 @@ true, "spaces" ], - "max-line-length": [true, 250], + "max-line-length": [ + true, + 250 + ], "no-unnecessary-type-assertion": false, "quotemark": [ true, "double" ], - "jsdoc-format": true + "jsdoc-format": true, + "no-unnecessary-generics": false } } diff --git a/types/yargs/tslint.json b/types/yargs/tslint.json index fd2834499c..08337e85f7 100644 --- a/types/yargs/tslint.json +++ b/types/yargs/tslint.json @@ -1,6 +1,7 @@ { - "extends": "dtslint/dt.json", - "rules": { - "no-object-literal-type-assertion": false - } + "extends": "dtslint/dt.json", + "rules": { + "no-object-literal-type-assertion": false, + "no-unnecessary-generics": false + } } diff --git a/types/zui/tslint.json b/types/zui/tslint.json index b1439230db..e6dc9b7f2f 100644 --- a/types/zui/tslint.json +++ b/types/zui/tslint.json @@ -2,6 +2,7 @@ "extends": "dtslint/dt.json", "rules": { // TODO - "no-any-union": false + "no-any-union": false, + "no-unnecessary-generics": false } } From f016f71882b76dc60f1bb78492dd514ff20587b1 Mon Sep 17 00:00:00 2001 From: Andy Date: Fri, 1 Sep 2017 08:35:16 -0700 Subject: [PATCH 105/156] Remove global dependency (#19509) --- package.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/package.json b/package.json index b12e3fe2eb..db67595b77 100644 --- a/package.json +++ b/package.json @@ -23,8 +23,5 @@ "devDependencies": { "dtslint": "github:Microsoft/dtslint#production", "types-publisher": "Microsoft/types-publisher#production" - }, - "dependencies": { - "@egjs/axes": "^2.0.0" } } From a9babc189ea272261a96f9b4d1aacc64c972f241 Mon Sep 17 00:00:00 2001 From: Derek Brown Date: Fri, 1 Sep 2017 13:48:21 -0400 Subject: [PATCH 106/156] Add DiskQuota option to HostConfig Added in latest version of API: https://docs.docker.com/engine/api/v1.30/#operation/ContainerCreate --- types/dockerode/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/dockerode/index.d.ts b/types/dockerode/index.d.ts index aa6c03bf29..199fe1de75 100644 --- a/types/dockerode/index.d.ts +++ b/types/dockerode/index.d.ts @@ -488,6 +488,7 @@ declare namespace Dockerode { CpusetCpus: string; CpusetMems: string; Devices?: any; + DiskQuota: number; KernelMemory: number; Memory: number; MemoryReservation: number; From 4f7a218f250c94028d532b3bcda3ddafc8b3f5c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Tabille=20Manjabosco?= Date: Thu, 24 Aug 2017 22:21:18 -0300 Subject: [PATCH 107/156] react-virtualized: Update types for WindowScroller --- .../dist/es/WindowScroller.d.ts | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/types/react-virtualized/dist/es/WindowScroller.d.ts b/types/react-virtualized/dist/es/WindowScroller.d.ts index 5ee54eb178..d19e83c06d 100644 --- a/types/react-virtualized/dist/es/WindowScroller.d.ts +++ b/types/react-virtualized/dist/es/WindowScroller.d.ts @@ -2,23 +2,27 @@ import { Validator, Requireable, PureComponent } from 'react' export type WindowScrollerChildProps = { height: number, + width: number, isScrolling: boolean, - scrollTop: number + scrollTop: number, + onChildScroll: () => void }; export type WindowScrollerProps = { /** * Function responsible for rendering children. * This function should implement the following signature: - * ({ height, isScrolling, scrollTop }) => PropTypes.element + * ({ height: number, width: number, isScrolling: boolean, scrollTop: number, onChildScroll: function }) => PropTypes.element */ children?: (props: WindowScrollerChildProps) => React.ReactNode; /** Callback to be invoked on-resize: ({ height }) */ - onResize?: (prams: { height: number }) => void; + onResize?: (params: { height: number, width: number }) => void; /** Callback to be invoked on-scroll: ({ scrollTop }) */ onScroll?: (params: { scrollTop: number }) => void; /** Element to attach scroll event listeners. Defaults to window. */ scrollElement?: HTMLElement; + /** Wait this amount of time after the last scroll event before resetting WindowScroller pointer-events; defaults to 150ms */ + scrollingResetTimeInterval?: number; /** * PLEASE NOTE * The [key: string]: any; line is here on purpose @@ -28,23 +32,28 @@ export type WindowScrollerProps = { */ [key: string]: any; } + export type WindowScrollerState = { height: number, + width: number, isScrolling: boolean, + scrollLeft: number scrollTop: number } export class WindowScroller extends PureComponent { static propTypes: { - children: Validator<(props: WindowScrollerChildProps) => React.ReactNode>, - onResize: Validator<(params: { height: number }) => void>, + children: Requireable<(props: WindowScrollerChildProps) => React.ReactNode>, + onResize: Validator<(params: { height: number, width: number }) => void>, onScroll: Validator<(params: { scrollTop: number }) => void>, - scrollElement: HTMLElement + scrollElement: Validator, + scrollingResetTimeInterval: Validator }; static defaultProps: { onResize: () => {}, - onScroll: () => {} + onScroll: () => {}, + scrollingResetTimeInterval: 150 }; constructor(props: WindowScrollerProps); From 5895bc8046b1f26d92f9f7929790e63deefc2a94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomek=20=C5=81aziuk?= Date: Fri, 1 Sep 2017 23:58:57 +0200 Subject: [PATCH 108/156] [argparse] Namespace add typeings for Namespace --- types/argparse/index.d.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/types/argparse/index.d.ts b/types/argparse/index.d.ts index 2661b01c12..2701f96ac3 100644 --- a/types/argparse/index.d.ts +++ b/types/argparse/index.d.ts @@ -1,6 +1,7 @@ -// Type definitions for argparse v1.0.3 +// Type definitions for argparse v1.0 // Project: https://github.com/nodeca/argparse // Definitions by: Andrew Schurman +// Tomasz Łaziuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -19,7 +20,15 @@ export declare class ArgumentParser extends ArgumentGroup { error(err: string | Error): void; } -interface Namespace { } +declare class Namespace { + constructor(options: object); + get(key: K, defaultValue?: D): this[K] | D; + isset(key: K): boolean; + set(key: K, value: V): this; + set(key: K, value: V): this & Record; + set(obj: K): this & K; + unset(key: K, defaultValue?: D): this[K] | D; +} declare class SubParser { addParser(name: string, options?: SubArgumentParserOptions): ArgumentParser; From 6dfaa31b61496a51e62d9f78d8c1a4197cbc15bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomek=20=C5=81aziuk?= Date: Sat, 2 Sep 2017 00:06:40 +0200 Subject: [PATCH 109/156] lint --- types/argparse/tslint.json | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 types/argparse/tslint.json diff --git a/types/argparse/tslint.json b/types/argparse/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/argparse/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} From c7607729061e8056b4dac5902b8f9986ae705bda Mon Sep 17 00:00:00 2001 From: Kyle Date: Sat, 2 Sep 2017 01:02:32 -0400 Subject: [PATCH 110/156] [rnmk] Add Indeterminate component to MKProgress --- types/react-native-material-kit/index.d.ts | 9 +++++++++ .../react-native-material-kit-tests.tsx | 1 + 2 files changed, 10 insertions(+) diff --git a/types/react-native-material-kit/index.d.ts b/types/react-native-material-kit/index.d.ts index 5556bd4282..d9564be179 100644 --- a/types/react-native-material-kit/index.d.ts +++ b/types/react-native-material-kit/index.d.ts @@ -305,6 +305,11 @@ export interface MKProgressProperties extends ViewProperties { bufferAniDuration?: number; } +export interface IndeterminateProgressProperties extends ViewProperties { + progressColor?: string; + progressAniDuration?: number; +} + export interface BaseSlider extends ViewProperties { min?: number; max?: number; @@ -382,6 +387,10 @@ export class MKRipple extends React.Component {} export class MKProgress extends React.Component {} +export namespace MKProgress { + class Indeterminate extends React.Component {} +} + export class MKSlider extends React.Component {} export class MKRangeSlider extends diff --git a/types/react-native-material-kit/react-native-material-kit-tests.tsx b/types/react-native-material-kit/react-native-material-kit-tests.tsx index 3a3efa11c0..4cb415d791 100644 --- a/types/react-native-material-kit/react-native-material-kit-tests.tsx +++ b/types/react-native-material-kit/react-native-material-kit-tests.tsx @@ -78,6 +78,7 @@ const MKIconToggleTest = () => //// PROGRESS const MKProgressTest = () => ; +const MKIndeterminateProgressTest = () => ; //// SLIDER interface MKSliderTestState { From 280f1873f1d71927abc7448f88e2f9d85590b101 Mon Sep 17 00:00:00 2001 From: Hagai Cohen Date: Sat, 2 Sep 2017 10:11:14 +0300 Subject: [PATCH 111/156] update subscribe signature --- types/graphql/subscription/subscribe.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/graphql/subscription/subscribe.d.ts b/types/graphql/subscription/subscribe.d.ts index b7b40076bf..30efc010ec 100644 --- a/types/graphql/subscription/subscribe.d.ts +++ b/types/graphql/subscription/subscribe.d.ts @@ -14,7 +14,7 @@ export function subscribe( operationName?: string, fieldResolver?: GraphQLFieldResolver, subscribeFieldResolver?: GraphQLFieldResolver -): AsyncIterator; +): Promise | ExecutionResult>; export function createSourceEventStream( schema: GraphQLSchema, @@ -26,4 +26,4 @@ export function createSourceEventStream( }, operationName?: string, fieldResolver?: GraphQLFieldResolver -): AsyncIterable; +): Promise>; From 20634d7ac57c2bc3adfdf8336f4229c92aed9daf Mon Sep 17 00:00:00 2001 From: Hagai Cohen Date: Sat, 2 Sep 2017 10:15:53 +0300 Subject: [PATCH 112/156] update contributers --- types/graphql/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/graphql/index.d.ts b/types/graphql/index.d.ts index e85060bab5..905dcbdd7b 100644 --- a/types/graphql/index.d.ts +++ b/types/graphql/index.d.ts @@ -7,6 +7,7 @@ // Kepennar // Mikhail Novikov // Ivan Goncharov +// Hagai Cohen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 From 49fe06fc5e2b2dc4c3b7317c62097b5c09bedd57 Mon Sep 17 00:00:00 2001 From: James Kelly Date: Sat, 2 Sep 2017 20:02:33 +1000 Subject: [PATCH 113/156] Add Uint8Array to MIDIOutput send The spec for Web MIDI API MIDIOutput.send at: https://webaudio.github.io/web-midi-api/#dom-midioutput-send suggests that both number[] and Uint8Array are acceptable types for sending data on a MIDI output port. The relevant text that allows for Uint8Array states: "... while still enabling use of Uint8Arrays for efficiency in large ..." An obvious use case is to forward MIDI events received on MIDIInputs as these are already in the form of a Uint8Array types. Tested with Chrome 60.0.3112.113 on Mac OS 10.12.6. --- types/webmidi/index.d.ts | 2 +- types/webmidi/webmidi-tests.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/types/webmidi/index.d.ts b/types/webmidi/index.d.ts index b1f3cb0f61..0d64baaaa7 100644 --- a/types/webmidi/index.d.ts +++ b/types/webmidi/index.d.ts @@ -145,7 +145,7 @@ declare namespace WebMidi { * to zero (or another time in the past), the data is to be sent as soon as * possible. */ - send(data: number[], timestamp?: number): void; + send(data: number[] | Uint8Array, timestamp?: number): void; /** * Clears any pending send data that has not yet been sent from the MIDIOutput 's diff --git a/types/webmidi/webmidi-tests.ts b/types/webmidi/webmidi-tests.ts index da4dca38c2..99335204fa 100644 --- a/types/webmidi/webmidi-tests.ts +++ b/types/webmidi/webmidi-tests.ts @@ -20,6 +20,7 @@ const onFulfilled = (item: WebMidi.MIDIAccess) => { for (const op of outputs) { this._outputs.push(op); op.send([ 0x90, 0x45, 0x7f ]); + op.send(new Uint8Array([ 0x90, 0x45, 0x7f ])); } for (const input of this._inputs) { From d7406dc4d9edc4714ea9866ffa2629fb4028622f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomek=20=C5=81aziuk?= Date: Sat, 2 Sep 2017 14:16:52 +0200 Subject: [PATCH 114/156] lint --- types/argparse/argparse-tests.ts | 288 ++++++++++++++----------------- types/argparse/index.d.ts | 34 ++-- 2 files changed, 146 insertions(+), 176 deletions(-) diff --git a/types/argparse/argparse-tests.ts b/types/argparse/argparse-tests.ts index f5b9e76f81..fe5d4fd765 100644 --- a/types/argparse/argparse-tests.ts +++ b/types/argparse/argparse-tests.ts @@ -1,25 +1,24 @@ - // near copy of each of the tests from https://github.com/nodeca/argparse/tree/master/examples import { ArgumentParser, RawDescriptionHelpFormatter } from 'argparse'; -var args: any; +let args: any; -var simpleExample = new ArgumentParser({ - version: '0.0.1', - addHelp: true, - description: 'Argparse example', +const simpleExample = new ArgumentParser({ + version: '0.0.1', + addHelp: true, + description: 'Argparse example', }); simpleExample.addArgument( - ['-f', '--foo'], - { - help: 'foo bar', - } + ['-f', '--foo'], + { + help: 'foo bar', + } ); simpleExample.addArgument( - ['-b', '--bar'], - { - help: 'bar foo', - } + ['-b', '--bar'], + { + help: 'bar foo', + } ); simpleExample.printHelp(); @@ -35,13 +34,10 @@ args = simpleExample.parseArgs('--foo 5 --bar 6'.split(' ')); console.dir(args); console.log('-----------'); - - - -var choicesExample = new ArgumentParser({ - version: '0.0.1', - addHelp: true, - description: 'Argparse examples: choice' +const choicesExample = new ArgumentParser({ + version: '0.0.1', + addHelp: true, + description: 'Argparse examples: choice' }); choicesExample.addArgument(['foo'], { choices: 'abc' }); @@ -55,56 +51,53 @@ console.log('-----------'); // choicesExample.parseArgs(['X']); // console.dir(args); - - - -var constantExample = new ArgumentParser({ - version: '0.0.1', - addHelp: true, - description: 'Argparse examples: constant' +const constantExample = new ArgumentParser({ + version: '0.0.1', + addHelp: true, + description: 'Argparse examples: constant' }); constantExample.addArgument( - ['-a'], - { - action: 'storeConst', - dest: 'answer', - help: 'store constant', - constant: 42 - } + ['-a'], + { + action: 'storeConst', + dest: 'answer', + help: 'store constant', + constant: 42 + } ); constantExample.addArgument( - ['--str'], - { - action: 'appendConst', - dest: 'types', - help: 'append constant "str" to types', - constant: 'str' - } + ['--str'], + { + action: 'appendConst', + dest: 'types', + help: 'append constant "str" to types', + constant: 'str' + } ); constantExample.addArgument( - ['--int'], - { - action: 'appendConst', - dest: 'types', - help: 'append constant "int" to types', - constant: 'int' - } + ['--int'], + { + action: 'appendConst', + dest: 'types', + help: 'append constant "int" to types', + constant: 'int' + } ); constantExample.addArgument( - ['--true'], - { - action: 'storeTrue', - help: 'store true constant' - } + ['--true'], + { + action: 'storeTrue', + help: 'store true constant' + } ); constantExample.addArgument( - ['--false'], - { - action: 'storeFalse', - help: 'store false constant' - } + ['--false'], + { + action: 'storeFalse', + help: 'store false constant' + } ); constantExample.printHelp(); @@ -113,27 +106,24 @@ console.log('-----------'); args = constantExample.parseArgs('-a --str --int --true'.split(' ')); console.dir(args); - - - -var nargsExample = new ArgumentParser({ - version: '0.0.1', - addHelp: true, - description: 'Argparse examples: nargs' +const nargsExample = new ArgumentParser({ + version: '0.0.1', + addHelp: true, + description: 'Argparse examples: nargs' }); nargsExample.addArgument( - ['-f', '--foo'], - { - help: 'foo bar', - nargs: 1 - } + ['-f', '--foo'], + { + help: 'foo bar', + nargs: 1 + } ); nargsExample.addArgument( - ['-b', '--bar'], - { - help: 'bar foo', - nargs: '*' - } + ['-b', '--bar'], + { + help: 'bar foo', + nargs: '*' + } ); nargsExample.printHelp(); @@ -145,40 +135,34 @@ console.log('-----------'); args = nargsExample.parseArgs('--bar b c f --foo a'.split(' ')); console.dir(args); - - - -var parent_parser = new ArgumentParser({ addHelp: false }); +const parent_parser = new ArgumentParser({ addHelp: false }); // note addHelp:false to prevent duplication of the -h option parent_parser.addArgument( - ['--parent'], - { type: 'int', help: 'parent' } + ['--parent'], + { type: 'int', help: 'parent' } ); -var foo_parser = new ArgumentParser({ - parents: [parent_parser], - description: 'child1' +const foo_parser = new ArgumentParser({ + parents: [parent_parser], + description: 'child1' }); foo_parser.addArgument(['foo']); args = foo_parser.parseArgs(['--parent', '2', 'XXX']); console.log(args); -var bar_parser = new ArgumentParser({ - parents: [parent_parser], - description: 'child2' +const bar_parser = new ArgumentParser({ + parents: [parent_parser], + description: 'child2' }); bar_parser.addArgument(['--bar']); args = bar_parser.parseArgs(['--bar', 'YYY']); console.log(args); - - - -var prefixCharsExample = new ArgumentParser({ - version: '0.0.1', - addHelp: true, - description: 'Argparse examples: prefix_chars', - prefixChars: '-+' +const prefixCharsExample = new ArgumentParser({ + version: '0.0.1', + addHelp: true, + description: 'Argparse examples: prefix_chars', + prefixChars: '-+' }); prefixCharsExample.addArgument(['+f', '++foo']); prefixCharsExample.addArgument(['++bar'], { action: 'storeTrue' }); @@ -193,39 +177,36 @@ console.dir(args); args = prefixCharsExample.parseArgs(['++foo', '2', '++bar']); console.dir(args); - - - -var subparserExample = new ArgumentParser({ - version: '0.0.1', - addHelp: true, - description: 'Argparse examples: sub-commands' +const subparserExample = new ArgumentParser({ + version: '0.0.1', + addHelp: true, + description: 'Argparse examples: sub-commands' }); -var subparsers = subparserExample.addSubparsers({ - title: 'subcommands', - dest: "subcommand_name" +const subparsers = subparserExample.addSubparsers({ + title: 'subcommands', + dest: "subcommand_name" }); -var bar = subparsers.addParser('c1', { addHelp: true, help: 'c1 help' }); +let bar = subparsers.addParser('c1', { addHelp: true, help: 'c1 help' }); bar.addArgument( - ['-f', '--foo'], - { - action: 'store', - help: 'foo3 bar3' - } + ['-f', '--foo'], + { + action: 'store', + help: 'foo3 bar3' + } ); -var bar = subparsers.addParser( - 'c2', - { aliases: ['co'], addHelp: true, help: 'c2 help' } +bar = subparsers.addParser( + 'c2', + { aliases: ['co'], addHelp: true, help: 'c2 help' } ); bar.addArgument( - ['-b', '--bar'], - { - action: 'store', - type: 'int', - help: 'foo3 bar3' - } + ['-b', '--bar'], + { + action: 'store', + type: 'int', + help: 'foo3 bar3' + } ); subparserExample.printHelp(); console.log('-----------'); @@ -241,66 +222,57 @@ console.dir(args); console.log('-----------'); subparserExample.parseArgs(['c1', '-h']); - - - -var functionExample = new ArgumentParser({ description: 'Process some integers.' }); +const functionExample = new ArgumentParser({ description: 'Process some integers.' }); function sum(arr: number[]) { - return arr.reduce(function(a, b) { - return a + b; - }, 0); + return arr.reduce((a, b) => a + b, 0); } function max(arr: number[]) { - return Math.max.apply(Math, arr); + return Math.max.apply(Math, arr); } - functionExample.addArgument(['integers'], { - metavar: 'N', - type: 'int', - nargs: '+', - help: 'an integer for the accumulator' + metavar: 'N', + type: 'int', + nargs: '+', + help: 'an integer for the accumulator' }); functionExample.addArgument(['--sum'], { - dest: 'accumulate', - action: 'storeConst', - constant: sum, - defaultValue: max, - help: 'sum the integers (default: find the max)' + dest: 'accumulate', + action: 'storeConst', + constant: sum, + defaultValue: max, + help: 'sum the integers (default: find the max)' }); args = functionExample.parseArgs('--sum 1 2 -1'.split(' ')); console.log(args.accumulate(args.integers)); - - - -var formatterExample = new ArgumentParser({ - prog: 'PROG', - formatterClass: RawDescriptionHelpFormatter, - description: 'Keep the formatting\n' + - ' exactly as it is written\n' + - '\n' + - 'here\n' +const formatterExample = new ArgumentParser({ + prog: 'PROG', + formatterClass: RawDescriptionHelpFormatter, + description: 'Keep the formatting\n' + + ' exactly as it is written\n' + + '\n' + + 'here\n' }); formatterExample.addArgument(['--foo'], { - help: ' foo help should not\n' + - ' retain this odd formatting' + help: ' foo help should not\n' + + ' retain this odd formatting' }); formatterExample.addArgument(['spam'], { - 'help': 'spam help' + help: 'spam help', }); -var group = formatterExample.addArgumentGroup({ - title: 'title', - description: ' This text\n' + - ' should be indented\n' + - ' exactly like it is here\n' +const group = formatterExample.addArgumentGroup({ + title: 'title', + description: ' This text\n' + + ' should be indented\n' + + ' exactly like it is here\n' }); group.addArgument(['--bar'], { - help: 'bar help' + help: 'bar help' }); formatterExample.printHelp(); diff --git a/types/argparse/index.d.ts b/types/argparse/index.d.ts index 2701f96ac3..1fca8a676f 100644 --- a/types/argparse/index.d.ts +++ b/types/argparse/index.d.ts @@ -1,26 +1,24 @@ -// Type definitions for argparse v1.0 +// Type definitions for argparse 1.0 // Project: https://github.com/nodeca/argparse // Definitions by: Andrew Schurman // Tomasz Łaziuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -export declare class ArgumentParser extends ArgumentGroup { +export class ArgumentParser extends ArgumentGroup { constructor(options?: ArgumentParserOptions); - addSubparsers(options?: SubparserOptions): SubParser; - parseArgs(args?: string[], ns?: Namespace | Object): any; + parseArgs(args?: string[], ns?: Namespace | object): any; printUsage(): void; printHelp(): void; formatUsage(): string; formatHelp(): string; - parseKnownArgs(args?: string[], ns?: Namespace | Object): any[]; + parseKnownArgs(args?: string[], ns?: Namespace | object): any[]; convertArgLineToArg(argLine: string): string[]; exit(status: number, message: string): void; error(err: string | Error): void; } -declare class Namespace { +export class Namespace { constructor(options: object); get(key: K, defaultValue?: D): this[K] | D; isset(key: K): boolean; @@ -30,11 +28,11 @@ declare class Namespace { unset(key: K, defaultValue?: D): this[K] | D; } -declare class SubParser { +export class SubParser { addParser(name: string, options?: SubArgumentParserOptions): ArgumentParser; } -declare class ArgumentGroup { +export class ArgumentGroup { addArgument(args: string[], options?: ArgumentOptions): void; addArgumentGroup(options?: ArgumentGroupOptions): ArgumentGroup; addMutuallyExclusiveGroup(options?: { required: boolean }): ArgumentGroup; @@ -42,7 +40,7 @@ declare class ArgumentGroup { getDefault(dest: string): any; } -interface SubparserOptions { +export interface SubparserOptions { title?: string; description?: string; prog?: string; @@ -53,12 +51,12 @@ interface SubparserOptions { metavar?: string; } -interface SubArgumentParserOptions extends ArgumentParserOptions { +export interface SubArgumentParserOptions extends ArgumentParserOptions { aliases?: string[]; help?: string; } -interface ArgumentParserOptions { +export interface ArgumentParserOptions { description?: string; epilog?: string; addHelp?: boolean; @@ -71,19 +69,19 @@ interface ArgumentParserOptions { version?: string; } -interface ArgumentGroupOptions { +export interface ArgumentGroupOptions { prefixChars?: string; argumentDefault?: any; title?: string; description?: string; } -export declare class HelpFormatter { } -export declare class ArgumentDefaultsHelpFormatter { } -export declare class RawDescriptionHelpFormatter { } -export declare class RawTextHelpFormatter { } +export class HelpFormatter { } +export class ArgumentDefaultsHelpFormatter { } +export class RawDescriptionHelpFormatter { } +export class RawTextHelpFormatter { } -interface ArgumentOptions { +export interface ArgumentOptions { action?: string; optionStrings?: string[]; dest?: string; From 37c7dd3c6d3d93e7963b2a68a91d2c8588cadc1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomek=20=C5=81aziuk?= Date: Sat, 2 Sep 2017 14:23:22 +0200 Subject: [PATCH 115/156] typescript requirements --- types/argparse/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/argparse/index.d.ts b/types/argparse/index.d.ts index 1fca8a676f..509c569999 100644 --- a/types/argparse/index.d.ts +++ b/types/argparse/index.d.ts @@ -3,6 +3,7 @@ // Definitions by: Andrew Schurman // Tomasz Łaziuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 export class ArgumentParser extends ArgumentGroup { constructor(options?: ArgumentParserOptions); From 9f2cfd9d09386fe63a788cdc27e23188ccfab532 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomek=20=C5=81aziuk?= Date: Sat, 2 Sep 2017 14:25:58 +0200 Subject: [PATCH 116/156] ban-types --- types/argparse/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/argparse/index.d.ts b/types/argparse/index.d.ts index 509c569999..f19aadbe96 100644 --- a/types/argparse/index.d.ts +++ b/types/argparse/index.d.ts @@ -89,7 +89,8 @@ export interface ArgumentOptions { nargs?: string | number; constant?: any; defaultValue?: any; - type?: string | Function; + // type may be a string (primitive) or a Function (constructor) + type?: string | Function; // tslint:disable-line:ban-types choices?: string | string[]; required?: boolean; help?: string; From ac013ff25480151fb80b9d345829211ec736dc6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomek=20=C5=81aziuk?= Date: Sat, 2 Sep 2017 14:37:39 +0200 Subject: [PATCH 117/156] formatting --- types/argparse/argparse-tests.ts | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/types/argparse/argparse-tests.ts b/types/argparse/argparse-tests.ts index fe5d4fd765..aef18b665b 100644 --- a/types/argparse/argparse-tests.ts +++ b/types/argparse/argparse-tests.ts @@ -250,15 +250,11 @@ console.log(args.accumulate(args.integers)); const formatterExample = new ArgumentParser({ prog: 'PROG', formatterClass: RawDescriptionHelpFormatter, - description: 'Keep the formatting\n' + - ' exactly as it is written\n' + - '\n' + - 'here\n' + description: `Keep the formatting\nexactly as it is written\n\nhere\n`, }); formatterExample.addArgument(['--foo'], { - help: ' foo help should not\n' + - ' retain this odd formatting' + help: `foo help should not\nretain this odd formatting`, }); formatterExample.addArgument(['spam'], { @@ -267,9 +263,7 @@ formatterExample.addArgument(['spam'], { const group = formatterExample.addArgumentGroup({ title: 'title', - description: ' This text\n' + - ' should be indented\n' + - ' exactly like it is here\n' + description: `This text\nshould be indented\nexactly like it is here\n`, }); group.addArgument(['--bar'], { From d0c49ce6e5b1370837cfba8a2c65d4cf3ca9b4f6 Mon Sep 17 00:00:00 2001 From: huhuanming Date: Mon, 21 Aug 2017 15:38:36 +0800 Subject: [PATCH 118/156] Add MaskedView --- types/react-native/index.d.ts | 15 ++++++++++++++- types/react-native/test/index.tsx | 17 ++++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index 074c90265d..d7648997f5 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-native 0.47 +// Type definitions for react-native 0.48 // Project: https://github.com/facebook/react-native // Definitions by: Eloy Durán // Fedor Nezhivoi @@ -4328,6 +4328,16 @@ export interface MapViewStatic extends NativeMethodsMixin, React.ComponentClass< } } +interface MaskedViewProperties extends ViewProperties { + maskElement: React.ReactElement, +} + +/** + * @see https://facebook.github.io/react-native/docs/maskedviewios.html + */ +export interface MaskedViewStatic extends NativeMethodsMixin, React.ComponentClass { +} + export interface ModalProperties { // Only `animated` is documented. The JS code says `animated` is @@ -8893,6 +8903,9 @@ export type ListView = ListViewStatic export var MapView: MapViewStatic export type MapView = MapViewStatic +export var MaskedView: MaskedViewStatic +export type MaskedView = MaskedViewStatic + export var Modal: ModalStatic export type Modal = ModalStatic diff --git a/types/react-native/test/index.tsx b/types/react-native/test/index.tsx index 57c8bb106a..9771db9bc9 100644 --- a/types/react-native/test/index.tsx +++ b/types/react-native/test/index.tsx @@ -39,7 +39,8 @@ import { ScrollViewProps, RefreshControl, TabBarIOS, - NativeModules + NativeModules, + MaskedView, } from 'react-native'; declare module 'react-native' { @@ -354,3 +355,17 @@ class AlertTest extends React.Component { ); } } + +class MaskedViewTest extends React.Component { + render() { + return ( + + } + > + + + ) + } +} From 8563b0ce6a8b9d842c71feecb1eca05cb350719e Mon Sep 17 00:00:00 2001 From: abrahambotros Date: Sat, 2 Sep 2017 09:42:57 -0700 Subject: [PATCH 119/156] [react-native-video] Add onProgress data --- types/react-native-video/index.d.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/types/react-native-video/index.d.ts b/types/react-native-video/index.d.ts index 8b31bfed0d..b264df6d64 100644 --- a/types/react-native-video/index.d.ts +++ b/types/react-native-video/index.d.ts @@ -1,6 +1,7 @@ -// Type definitions for react-native-video 1.0 +// Type definitions for react-native-video 2.0 // Project: https://github.com/react-native-community/react-native-video // Definitions by: HuHuanming +// abrahambotros // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -48,7 +49,10 @@ export interface VideoProperties extends ViewProperties { onLoad?(): void; onBuffer?(): void; onError?(): void; - onProgress?(): void; + onProgress?(data: { + currentTime: number, + playableDuration: number, + }): void; onSeek?(): void; onEnd?(): void; onFullscreenPlayerWillPresent?(): void; From 0fa3e15d6092dd6794085170bb41c0ff64e4decc Mon Sep 17 00:00:00 2001 From: abrahambotros Date: Sat, 2 Sep 2017 09:49:12 -0700 Subject: [PATCH 120/156] [react-native-video] Add onProgress data test --- .../react-native-video-tests.tsx | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/types/react-native-video/react-native-video-tests.tsx b/types/react-native-video/react-native-video-tests.tsx index e0ec0bad73..b2ea41ce92 100644 --- a/types/react-native-video/react-native-video-tests.tsx +++ b/types/react-native-video/react-native-video-tests.tsx @@ -7,16 +7,27 @@ import { } from 'react-native'; import Video from 'react-native-video'; -class SwiperTest extends React.Component { +class VideoTest extends React.Component { constructor(props: {}) { super(props); } render(): React.ReactElement { return ( -