From 7a338096583f581a4c2733802110f15e8a19e4a5 Mon Sep 17 00:00:00 2001 From: Brian Lee Date: Sat, 27 May 2017 17:35:56 -0700 Subject: [PATCH 001/118] Allow subclass gm function to accept source types other than path strings --- types/gm/gm-tests.ts | 10 ++++++++++ types/gm/index.d.ts | 3 +++ 2 files changed, 13 insertions(+) diff --git a/types/gm/gm-tests.ts b/types/gm/gm-tests.ts index e8bf5787cd..50c124ffc5 100644 --- a/types/gm/gm-tests.ts +++ b/types/gm/gm-tests.ts @@ -346,3 +346,13 @@ var imageMagick = gm.subClass({ imageMagick: true }); var readStream = imageMagick(src) .adjoin() .stream(); + +var passStream = imageMagick(readStream).stream(); + +var buffers: Buffer[] = []; +var buffer: Buffer; +passStream.on('data', (chunk) => buffers.push(chunk as Buffer)).on('close', () => { + buffer = Buffer.concat(buffers); + var readstream = imageMagick(buffer).stream(); +}) + diff --git a/types/gm/index.d.ts b/types/gm/index.d.ts index 7fd419ede3..a08086e58e 100644 --- a/types/gm/index.d.ts +++ b/types/gm/index.d.ts @@ -615,6 +615,9 @@ declare namespace m { export interface SubClass { (image: string): State; + (stream: NodeJS.ReadableStream, image?: string): State + (buffer: Buffer, image?: string): State + (width: number, height: number, color?: string): State } export function compare(filename1: string, filename2: string, callback: CompareCallback): void; From 803b84709699b305f8a84746c0c73bfb955725dc Mon Sep 17 00:00:00 2001 From: Brian Lee Date: Tue, 30 May 2017 13:19:08 -0700 Subject: [PATCH 002/118] Rewrite overloaded function --- types/gm/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/gm/index.d.ts b/types/gm/index.d.ts index a08086e58e..8da081ffd5 100644 --- a/types/gm/index.d.ts +++ b/types/gm/index.d.ts @@ -615,9 +615,9 @@ declare namespace m { export interface SubClass { (image: string): State; - (stream: NodeJS.ReadableStream, image?: string): State - (buffer: Buffer, image?: string): State - (width: number, height: number, color?: string): State + (stream: NodeJS.ReadableStream, image?: string): State; + (buffer: Buffer, image?: string): State; + (width: number, height: number, color?: string): State; } export function compare(filename1: string, filename2: string, callback: CompareCallback): void; From 246ddd52cff782412a25a597029099e53e1fdf43 Mon Sep 17 00:00:00 2001 From: David Philipson Date: Mon, 19 Jun 2017 12:02:45 -0700 Subject: [PATCH 003/118] Fixes to transducers-js types * Remove unnecessary type parameters * Update transduce() and reduce() to accept CompletingTransformers * Fix incorrect definition of transduce() * Fix incorrect definition of reduce() * Fix incorrect definition of completing() * Fix incorrect definition of wrap() * Fix incorrect definition of cat() * Fix overly strict definition of mapcat() * Make into() definition precise with overloads * Use es6 Iterables. * More precise typings for object iteration in reduce(), transduce(), and into() --- types/transducers-js/index.d.ts | 128 +++++++++++++------ types/transducers-js/transducers-js-tests.ts | 48 +++++++ 2 files changed, 137 insertions(+), 39 deletions(-) diff --git a/types/transducers-js/index.d.ts b/types/transducers-js/index.d.ts index cfed8fbbbe..3d9c6f7719 100644 --- a/types/transducers-js/index.d.ts +++ b/types/transducers-js/index.d.ts @@ -1,19 +1,9 @@ // Type definitions for transducers-js 0.4 // Project: https://github.com/cognitect-labs/transducers-js // Definitions by: Colin Kahn +// David Philipson // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -export interface IteratorResult { - done: boolean; - value?: T; -} - -export interface Iterator { - next(value?: any): IteratorResult; - return?(value?: any): IteratorResult; - throw?(e?: any): IteratorResult; -} - export interface Reduced { ['@@transducer/reduced']: boolean; ['@@transducer/value']: TResult; @@ -21,7 +11,7 @@ export interface Reduced { export type Reducer = (result: TResult, input: TInput) => TResult; -export type Transducer = (xf: Transformer) => Transformer; +export type Transducer = (xf: Transformer) => Transformer; export interface CompletingTransformer { ['@@transducer/init'](): TResult | void; @@ -66,7 +56,7 @@ export class Map implements Transformer(f: (x: TInput) => TOutput): Transducer; +export function map(f: (x: TInput) => TOutput): Transducer; export class Filter implements Transformer { constructor(pred: (x: TInput) => boolean, xf: Transformer); @@ -78,13 +68,13 @@ export class Filter implements Transformer { /** * Filtering transducer constructor */ -export function filter(pred: (x: TInput) => boolean): Transducer; +export function filter(pred: (x: TInput) => boolean): Transducer; /** * Similar to filter except the predicate is used to * eliminate values. */ -export function remove(pred: (x: TInput) => boolean): Transducer; +export function remove(pred: (x: TInput) => boolean): Transducer; export class Keep implements Transformer { constructor(f: (x: TInput) => any, xf: Transformer); @@ -97,7 +87,7 @@ export class Keep implements Transformer { * A keeping transducer. Keep inputs as long as the provided * function does not return null or undefined. */ -export function keep(f: (x: TInput) => any): Transducer; +export function keep(f: (x: TInput) => any): Transducer; export class KeepIndexed implements Transformer { constructor(f: (i: number, x: TInput) => any, xf: Transformer); @@ -110,7 +100,7 @@ export class KeepIndexed implements Transformer(f: (i: number, x: TInput) => any): Transducer; +export function keepIndexed(f: (i: number, x: TInput) => any): Transducer; export class Take implements Transformer { constructor(n: number, xf: Transformer); @@ -123,7 +113,7 @@ export class Take implements Transformer { * A take transducer constructor. Will take n values before * returning a reduced result. */ -export function take(n: number): Transducer; +export function take(n: number): Transducer; export class TakeWhile implements Transformer { constructor(pred: (n: TInput) => boolean, xf: Transformer); @@ -136,7 +126,7 @@ export class TakeWhile implements Transformer * Like the take transducer except takes as long as the pred * return true for inputs. */ -export function takeWhile(pred: (n: TInput) => boolean): Transducer; +export function takeWhile(pred: (n: TInput) => boolean): Transducer; export class TakeNth implements Transformer { constructor(n: number, xf: Transformer); @@ -148,7 +138,7 @@ export class TakeNth implements Transformer { /** * A transducer that takes every Nth input */ -export function takeNth(n: number): Transducer; +export function takeNth(n: number): Transducer; export class Drop implements Transformer { constructor(n: number, xf: Transformer); @@ -160,7 +150,7 @@ export class Drop implements Transformer { /** * A dropping transducer constructor */ -export function drop(n: number): Transducer; +export function drop(n: number): Transducer; export class DropWhile implements Transformer { constructor(pred: (input: TInput) => boolean, xf: Transformer); @@ -173,7 +163,7 @@ export class DropWhile implements Transformer * A dropping transducer that drop inputs as long as * pred is true. */ -export function dropWhile(pred: (input: TInput) => boolean): Transducer; +export function dropWhile(pred: (input: TInput) => boolean): Transducer; export class PartitionBy implements Transformer { constructor(f: (input: TInput) => any, xf: Transformer); @@ -187,7 +177,7 @@ export class PartitionBy implements Transformer(f: (input: TInput) => any): Transducer; +export function partitionBy(f: (input: TInput) => any): Transducer; export class PartitionAll implements Transformer { constructor(n: number, xf: Transformer); @@ -200,7 +190,7 @@ export class PartitionAll implements Transformer(n: number): Transducer; +export function partitionAll(n: number): Transducer; export class Completing implements CompletingTransformer { constructor(cf: (result: TResult) => TCompleteResult, xf: Transformer); @@ -213,7 +203,9 @@ export class Completing implements CompletingT * A completing transducer constructor. Useful to provide cleanup * logic at the end of a reduction/transduction. */ -export function completing(cf: (result: TResult) => TCompleteResult): CompletingTransformer; +export function completing( + xf: Transformer | Reducer, + cf: (result: TResult) => TCompleteResult): CompletingTransformer; export class Wrap implements Transformer { constructor(stepFn: Reducer, xf: Transformer); @@ -227,44 +219,102 @@ export class Wrap implements Transformer { * accumluation and the second argument is the next input and convert * it into a transducer transformer object. */ -export function wrap(stepFn: Reducer): Transducer; +export function wrap(stepFn: Reducer): Transformer; /** * Given a transformer return a concatenating transformer */ -export function cat(xf: Transformer): Transformer ; +export function cat(xf: Transformer): Transformer>; /** * A mapping concatenating transformer */ -export function mapcat(f: (arr: TInput[]) => TOutput[]): Transducer; +export function mapcat(f: (arr: TInput) => Iterable): Transducer; /** * Given a transducer, a builder function, an initial value * and a iterable collection - returns the reduction. */ export function transduce( - xf: Transducer, - f: Transformer | Reducer, + xf: Transducer, + f: Reducer, init: TResult, - coll: TInput[] | Iterator | string | Object): TResult; + coll: Iterable): TResult; +export function transduce( + xf: Transducer, + f: CompletingTransformer, + init: TResult, + coll: Iterable): TCompleteResult; +export function transduce( + xf: Transducer, + f: CompletingTransformer, + coll: Iterable): TCompleteResult; +// Overloads for object iteration. +export function transduce( + xf: Transducer<[string, TInput], TOutput>, + f: Reducer, + init: TResult, + coll: { [key: string]: TInput }): TResult; +export function transduce( + xf: Transducer<[string, TInput], TOutput>, + f: CompletingTransformer, + init: TResult, + coll: { [key: string]: TInput }): TCompleteResult; +export function transduce( + xf: Transducer<[string, TInput], TOutput>, + f: CompletingTransformer, + coll: { [key: string]: TInput }): TCompleteResult; /** * Given a transducer, an intial value and a * collection - returns the reduction. */ -export function reduce( - xf: Transducer, +export function reduce( + xf: Transformer | Reducer, init: TResult, - coll: TInput[] | Iterator | string | Object): TResult; + coll: Iterable): TResult; +export function reduce( + xf: CompletingTransformer, + init: TResult, + coll: Iterable): TCompleteResult; +// Overloads for object iteration. +export function reduce( + xf: Transformer | Reducer, + init: TResult, + coll: { [key: string]: TInput }): TResult; +export function reduce( + xf: CompletingTransformer, + init: TResult, + coll: { [key: string]: TInput }): TCompleteResult; /** * Reduce a value into the given empty value using a transducer. */ -export function into( - empty: TResult, - xf: Transducer, - coll: TInput[] | Iterator | string | Object): TResult; +export function into( + empty: TOutput[], + xf: Transducer, + coll: Iterable): TOutput[]; +export function into( + empty: string, + xf: Transducer, + coll: Iterable): string; +export function into( + empty: { [key: string]: TOutput }, + xf: Transducer, + coll: Iterable): { [key: string]: TOutput }; +// Overloads for object iteration. +export function into( + empty: TOutput[], + xf: Transducer<[string, TInput], TOutput>, + coll: { [key: string]: TInput }): TOutput[]; +export function into( + empty: string, + xf: Transducer<[string, TInput], string>, + coll: { [key: string]: TInput }): string; +export function into( + empty: { [key: string]: TOutput }, + xf: Transducer<[string, TInput], [string, TOutput]>, + coll: { [key: string]: TInput }): { [key: string]: TOutput }; /** * Convert a transducer transformer object into a function so @@ -272,7 +322,7 @@ export function into( * Underscore, lodash */ export function toFn( - xf: Transducer, + xf: Transducer, builder: Reducer | Transformer ): Reducer; diff --git a/types/transducers-js/transducers-js-tests.ts b/types/transducers-js/transducers-js-tests.ts index 634309a2b5..f39bf87384 100644 --- a/types/transducers-js/transducers-js-tests.ts +++ b/types/transducers-js/transducers-js-tests.ts @@ -124,3 +124,51 @@ function mapcatExample() { const xf = t.mapcat(reverse); t.into([], xf, [[3, 2, 1], [6, 5, 4]]); // [1, 2, 3, 4, 5, 6] } + +// Original tests + +function transduceExample() { + const { completing, transduce, wrap } = t; + const stringAppendFn = (acc: string, x: number) => acc + x; + const stringAppendTransformer = wrap(stringAppendFn); + const stringAppendThenLengthTransformer = completing( + stringAppendFn, + s => s.length, + ); + const lengthsString1: string = transduce( + t.map((s: string) => s.length), + stringAppendFn, + "", + ["a", "b"], + ); + const lengthsString2: string = transduce( + t.map((s: string) => s.length), + stringAppendTransformer, + "", + ["a", "b"], + ); + const lengthsStringLength: number = transduce( + t.map((s: string) => s.length), + stringAppendThenLengthTransformer, + "", + ["a", "b"], + ); +} + +function advancedIntoExample() { + const array: number[] = into([], t.map((s: string) => s.length), [ + "a", + "b", + ]); + const string: string = into("", t.map((s: string) => s + s), ["a", "b"]); + const object1: { [key: string]: number } = into( + {}, + t.map((s: string) => [s, s.length]), + ["a", "b"], + ); + const object2: { [key: string]: boolean } = into( + {}, + t.map((kv: [string, number]) => [kv[0], true]), + { a: 1, b: 2 } + ); +} From f2df68de0198be12917aab48e1aafe2c4a8812b0 Mon Sep 17 00:00:00 2001 From: Nicolas Voigt Date: Wed, 21 Jun 2017 12:20:28 +0200 Subject: [PATCH 004/118] modified crypto.verfier.verify --- types/node/index.d.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 952cf98e4d..3f8b5d5a4a 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -3632,8 +3632,10 @@ declare module "crypto" { export interface Verify extends NodeJS.WritableStream { update(data: string | Buffer): Verify; update(data: string | Buffer, input_encoding: Utf8AsciiLatin1Encoding): Verify; - verify(object: string, signature: Buffer): boolean; - verify(object: string, signature: string, signature_format: HexBase64Latin1Encoding): boolean; + verify(object: string | Object, signature: Buffer | DataView): boolean; + verify(object: string | Object, signature: string, signature_format: HexBase64Latin1Encoding): boolean; + // https://nodejs.org/api/crypto.html#crypto_verifier_verify_object_signature_signature_format + // The signature field accepts a TypedArray type, but it is only available starting ES2017 } export function createDiffieHellman(prime_length: number, generator?: number): DiffieHellman; export function createDiffieHellman(prime: Buffer): DiffieHellman; From 9d510d71fe139f72b6ae16af24798a732521c845 Mon Sep 17 00:00:00 2001 From: Nicolas Voigt Date: Wed, 21 Jun 2017 12:55:06 +0200 Subject: [PATCH 005/118] added author reference --- types/node/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 3f8b5d5a4a..647bf30cc6 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -6,6 +6,7 @@ // Roberto Desideri // Christian Vaagland Tellnes // Wilco Bakker +// Nicolas Voigt // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 From 23455c0bc57a16fd3a7d7ece4d18028929567f5c Mon Sep 17 00:00:00 2001 From: David Philipson Date: Wed, 21 Jun 2017 04:03:15 -0700 Subject: [PATCH 006/118] Fix toFn typing, tweak comp typing --- types/transducers-js/index.d.ts | 9 ++++++--- types/transducers-js/transducers-js-tests.ts | 8 ++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/types/transducers-js/index.d.ts b/types/transducers-js/index.d.ts index 3d9c6f7719..413cfbfef5 100644 --- a/types/transducers-js/index.d.ts +++ b/types/transducers-js/index.d.ts @@ -34,7 +34,10 @@ export function isReduced(x: any): boolean; /** * Function composition. Take N function and return their composition. */ -export function comp(...args: T[]): T; +// Infers correct return type when all arguments have same type. +export function comp any>(...args: T[]): T; +// Falls back to (any => any) when argument types differ. +export function comp(...args: Array<(x: any) => any>): (x: any) => any; /** * Take a predicate function and return its complement. @@ -323,8 +326,8 @@ export function into( */ export function toFn( xf: Transducer, - builder: Reducer | Transformer -): Reducer; + builder: Reducer | Transformer +): Reducer; /** * A transformer which simply returns the first input. diff --git a/types/transducers-js/transducers-js-tests.ts b/types/transducers-js/transducers-js-tests.ts index f39bf87384..7a82b595c8 100644 --- a/types/transducers-js/transducers-js-tests.ts +++ b/types/transducers-js/transducers-js-tests.ts @@ -172,3 +172,11 @@ function advancedIntoExample() { { a: 1, b: 2 } ); } + +function compExample() { + const fn1: t.Transducer = comp(map(inc), filter(isEven)); + const fn2: t.Transducer = comp( + filter(isEven), + map((x: number) => "" + x), + ); +} From c06dcc56c23293a9e3ef548a951574dd31455845 Mon Sep 17 00:00:00 2001 From: Damien Rajon Date: Wed, 21 Jun 2017 15:04:45 +0200 Subject: [PATCH 007/118] Add type definition for async.nexttick --- types/async.nexttick/async.nexttick-test.ts | 11 ++++++++++ types/async.nexttick/index.d.ts | 1 + types/async.nexttick/tsconfig.json | 24 +++++++++++++++++++++ types/async.nexttick/tslint.json | 3 +++ 4 files changed, 39 insertions(+) create mode 100644 types/async.nexttick/async.nexttick-test.ts create mode 100644 types/async.nexttick/index.d.ts create mode 100644 types/async.nexttick/tsconfig.json create mode 100644 types/async.nexttick/tslint.json diff --git a/types/async.nexttick/async.nexttick-test.ts b/types/async.nexttick/async.nexttick-test.ts new file mode 100644 index 0000000000..9d8acb33aa --- /dev/null +++ b/types/async.nexttick/async.nexttick-test.ts @@ -0,0 +1,11 @@ +import nextTick from 'async.nexttick'; + +function calledOnNextTick(a: string): number { + return parseInt(a, 10); +} + +const aString = 'Hi!'; + +nextTick(() => { + calledOnNextTick(aString); +}); diff --git a/types/async.nexttick/index.d.ts b/types/async.nexttick/index.d.ts new file mode 100644 index 0000000000..7db4a43d87 --- /dev/null +++ b/types/async.nexttick/index.d.ts @@ -0,0 +1 @@ +export default function nextTick(callback: () => void, ...args: any[]): void; diff --git a/types/async.nexttick/tsconfig.json b/types/async.nexttick/tsconfig.json new file mode 100644 index 0000000000..7bf5157ec4 --- /dev/null +++ b/types/async.nexttick/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "target": "es6", + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "async.nexttick-test.ts" + ] +} + diff --git a/types/async.nexttick/tslint.json b/types/async.nexttick/tslint.json new file mode 100644 index 0000000000..4c3a548997 --- /dev/null +++ b/types/async.nexttick/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dtslint.json" +} From 1065599f86fa230995c7aa5bb6ac9ae08513dc9b Mon Sep 17 00:00:00 2001 From: David Philipson Date: Wed, 21 Jun 2017 15:10:21 -0700 Subject: [PATCH 008/118] Fix definition of Wrap --- types/transducers-js/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/transducers-js/index.d.ts b/types/transducers-js/index.d.ts index 413cfbfef5..66073d1cbc 100644 --- a/types/transducers-js/index.d.ts +++ b/types/transducers-js/index.d.ts @@ -211,7 +211,7 @@ export function completing( cf: (result: TResult) => TCompleteResult): CompletingTransformer; export class Wrap implements Transformer { - constructor(stepFn: Reducer, xf: Transformer); + constructor(stepFn: Reducer); ['@@transducer/init'](): TResult; ['@@transducer/step'](result: TResult, input: TInput): TResult; ['@@transducer/result'](result: TResult): TResult; From d4bdb400a0e12b615c4b2bd6d138d4723cf24231 Mon Sep 17 00:00:00 2001 From: David Philipson Date: Wed, 21 Jun 2017 18:27:55 -0700 Subject: [PATCH 009/118] More general Transducer definition --- types/transducers-js/index.d.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/types/transducers-js/index.d.ts b/types/transducers-js/index.d.ts index 66073d1cbc..83dbbe1573 100644 --- a/types/transducers-js/index.d.ts +++ b/types/transducers-js/index.d.ts @@ -11,7 +11,12 @@ export interface Reduced { export type Reducer = (result: TResult, input: TInput) => TResult; -export type Transducer = (xf: Transformer) => Transformer; +// Common case: Transducer = +// Transformer => Transformer. +export type Transducer = + ( + xf: CompletingTransformer + ) => CompletingTransformer; export interface CompletingTransformer { ['@@transducer/init'](): TResult | void; From e86d4cc1269863ef3f8505f119bd689d21f701ea Mon Sep 17 00:00:00 2001 From: Sebastien PUECH Date: Thu, 22 Jun 2017 08:52:51 +0200 Subject: [PATCH 010/118] Fixup for "node" types, fs.createReadStream and fs.createWriteStream functions. --- types/node/index.d.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 952cf98e4d..423fae41f1 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -2497,6 +2497,7 @@ declare module "dgram" { declare module "fs" { import * as stream from "stream"; import * as events from "events"; + import * as url from "url"; interface Stats { isFile(): boolean; @@ -2975,7 +2976,7 @@ declare module "fs" { export function access(path: string | Buffer, mode: number, callback: (err: NodeJS.ErrnoException) => void): void; /** Synchronous version of fs.access. This throws if any accessibility checks fail, and does nothing otherwise. */ export function accessSync(path: string | Buffer, mode?: number): void; - export function createReadStream(path: string | Buffer, options?: { + export function createReadStream(path: string | Buffer | url.URL, options?: string | { flags?: string; encoding?: string; fd?: number; @@ -2984,9 +2985,9 @@ declare module "fs" { start?: number; end?: number; }): ReadStream; - export function createWriteStream(path: string | Buffer, options?: { + export function createWriteStream(path: string | Buffer | url.URL, options?: string | { flags?: string; - encoding?: string; + defaultEncoding?: string; fd?: number; mode?: number; autoClose?: boolean; From 825083d238d7dc3ec72251960c74dfa70b6f08d5 Mon Sep 17 00:00:00 2001 From: Sebastien PUECH Date: Thu, 22 Jun 2017 16:57:50 +0200 Subject: [PATCH 011/118] Fixed the bind method for UDP. --- types/node/index.d.ts | 2 ++ types/node/node-tests.ts | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 423fae41f1..f1fbefbd0a 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -2437,6 +2437,8 @@ declare module "dgram" { send(msg: Buffer | String | any[], port: number, address: string, callback?: (error: Error, bytes: number) => void): void; send(msg: Buffer | String | any[], offset: number, length: number, port: number, address: string, callback?: (error: Error, bytes: number) => void): void; bind(port?: number, address?: string, callback?: () => void): void; + bind(port?: number, callback?: () => void): void; + bind(callback?: () => void): void; bind(options: BindOptions, callback?: Function): void; close(callback?: () => void): void; address(): AddressInfo; diff --git a/types/node/node-tests.ts b/types/node/node-tests.ts index aeefc2bbdc..3bb2ddcc69 100644 --- a/types/node/node-tests.ts +++ b/types/node/node-tests.ts @@ -1045,6 +1045,10 @@ namespace dgram_tests { }); ds.bind(); ds.bind(41234); + ds.bind(4123, 'localhost'); + ds.bind(4123, 'localhost', () => {}); + ds.bind(4123, () => {}); + ds.bind(() => {}); var ai: dgram.AddressInfo = ds.address(); ds.send(new Buffer("hello"), 0, 5, 5000, "127.0.0.1", (error: Error, bytes: number): void => { }); From 247d2506e083afe4ff89d41f412099b9617940c2 Mon Sep 17 00:00:00 2001 From: Sam Beran Date: Thu, 22 Jun 2017 11:29:24 -0500 Subject: [PATCH 012/118] Websocket: Use correct type for incoming message --- types/websocket/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/websocket/index.d.ts b/types/websocket/index.d.ts index 83d127c599..3b41a5f6da 100644 --- a/types/websocket/index.d.ts +++ b/types/websocket/index.d.ts @@ -181,7 +181,7 @@ export interface IExtension { export declare class request extends events.EventEmitter { /** A reference to the original Node HTTP request object */ - httpRequest: http.ClientRequest; + httpRequest: http.IncomingMessage; /** This will include the port number if a non-standard port is used */ host: string; /** A string containing the path that was requested by the client */ @@ -222,7 +222,7 @@ export declare class request extends events.EventEmitter { requestedProtocols: string[]; protocolFullCaseMap: { [key: string]: string }; - constructor(socket: net.Socket, httpRequest: http.ClientRequest, config: IServerConfig); + constructor(socket: net.Socket, httpRequest: http.IncomingMessage, config: IServerConfig); /** * After inspecting the `request` properties, call this function on the @@ -580,7 +580,7 @@ declare class client extends events.EventEmitter { declare class routerRequest extends events.EventEmitter { /** A reference to the original Node HTTP request object */ - httpRequest: http.ClientRequest; + httpRequest: http.IncomingMessage; /** A string containing the path that was requested by the client */ resource: string; /** Parsed resource, including the query string parameters */ From 96306a10b197753817c9dc13ac3a297f5a48d9c6 Mon Sep 17 00:00:00 2001 From: Eli Young Date: Mon, 5 Jun 2017 21:52:32 -0700 Subject: [PATCH 013/118] [convict] Support convict@4 --- types/convict/convict-tests.ts | 8 +++++++- types/convict/index.d.ts | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/types/convict/convict-tests.ts b/types/convict/convict-tests.ts index 3bc0b4565f..e8bc53fdcd 100644 --- a/types/convict/convict-tests.ts +++ b/types/convict/convict-tests.ts @@ -81,7 +81,13 @@ var conf = convict({ default: 0, env: 'PORT', arg: 'port', - } + }, + password: { + doc: 'The database password.', + default: 'secret', + format: String, + sensitive: true, + }, }, primeNumber: { format: 'prime', diff --git a/types/convict/index.d.ts b/types/convict/index.d.ts index 82b22ba2db..e07397aa76 100644 --- a/types/convict/index.d.ts +++ b/types/convict/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for convict 3.0 +// Type definitions for convict 4.0 // Project: https://github.com/mozilla/node-convict // Definitions by: Wim Looman , Vesa Poikajärvi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -45,6 +45,7 @@ declare namespace convict { format?: string | Array | Function; env?: string; arg?: string; + sensitive?: boolean; }; } From c2ada0503c3ce393d666db30f98a96ccf4c0b648 Mon Sep 17 00:00:00 2001 From: Eli Young Date: Mon, 5 Jun 2017 21:53:08 -0700 Subject: [PATCH 014/118] [convict] Clean up type definitions and tests --- types/convict/convict-tests.ts | 37 +++++++++++++++------------------- types/convict/index.d.ts | 29 +++++++++++--------------- types/convict/tslint.json | 7 +++++++ 3 files changed, 35 insertions(+), 38 deletions(-) create mode 100644 types/convict/tslint.json diff --git a/types/convict/convict-tests.ts b/types/convict/convict-tests.ts index e8bc53fdcd..83c9b03c8f 100644 --- a/types/convict/convict-tests.ts +++ b/types/convict/convict-tests.ts @@ -1,48 +1,41 @@ - -/// - import convict = require('convict'); import validator = require('validator'); // define a schema // straight from the convict tests -const format : convict.Format = { +const format: convict.Format = { name: 'float-percent', - validate: function(val) { + validate(val) { if (val !== 0 && (!val || val > 1 || val < 0)) { throw new Error('must be a float between 0 and 1, inclusive'); } }, - coerce: function(val) { - return +( val); + coerce(val) { + return parseFloat(val); } }; - - - convict.addFormat(format); convict.addFormats({ prime: { - validate: function(val) { + validate(val) { function isPrime(n: number) { if (n <= 1) return false; // zero and one are not prime - for (var i=2; i*i <= n; i++) { + for (let i = 2; i * i <= n; i++) { if (n % i === 0) return false; } return true; } if (!isPrime(val)) throw new Error('must be a prime number'); }, - coerce: function(val) { + coerce(val) { return parseInt(val, 10); } } }); - -var conf = convict({ +let conf = convict({ env: { doc: 'The applicaton environment.', format: ['production', 'development', 'test'], @@ -65,7 +58,11 @@ var conf = convict({ }, key: { doc: "API key", - format: (val: string) => validator.isUUID(val), + format: (val: string) => { + if (!validator.isUUID(val)) { + throw new Error('must be a valid UUID'); + } + }, default: '01527E56-8431-11E4-AF91-47B661C210CA' }, db: { @@ -97,14 +94,12 @@ var conf = convict({ format: 'float-percent', default: 0.5 }, - }); - // load environment dependent configuration -var env = conf.get('env'); -var dbip = conf.get('db.ip'); +let env = conf.get('env'); +let dbip = conf.get('db.ip'); conf.loadFile('./config/' + env + '.json'); conf.loadFile(['./configs/always.json', './configs/sometimes.json']); @@ -124,7 +119,7 @@ conf .validate({ allowed: 'warn' }) .toString(); -var port: number = conf.default('port'); +let port: number = conf.default('port'); if (conf.has('key')) { conf.set('the.awesome', true); diff --git a/types/convict/index.d.ts b/types/convict/index.d.ts index e07397aa76..183d91ed91 100644 --- a/types/convict/index.d.ts +++ b/types/convict/index.d.ts @@ -1,11 +1,11 @@ // Type definitions for convict 4.0 // Project: https://github.com/mozilla/node-convict -// Definitions by: Wim Looman , Vesa Poikajärvi +// Definitions by: Wim Looman +// Vesa Poikajärvi +// Eli Young // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - declare namespace convict { - type ValidationMethod = 'strict' | 'warn'; interface ValidateOptions { @@ -23,8 +23,8 @@ declare namespace convict { interface Format { name?: string; - validate?: (val: any) => void; - coerce?: (val: any) => any; + validate?(val: any): void; + coerce?(val: any): any; } interface Schema { @@ -35,14 +35,15 @@ declare namespace convict { * From the implementation: * * format can be a: - * - predefine type, as seen below + * - predefined type, as seen below * - an array of enumerated values, e.g. ["production", "development", "testing"] * - built-in JavaScript type, i.e. Object, Array, String, Number, Boolean - * - or if omitted, the Object.prototype.toString.call of the default value + * - function that performs validation and throws an Error on failure * - * The docs also state that any function that validates is ok too + * If omitted, format will be set to the value of Object.prototype.toString.call + * for the default value */ - format?: string | Array | Function; + format?: string | any[] | ((val: any) => void); env?: string; arg?: string; sensitive?: boolean; @@ -79,17 +80,11 @@ declare namespace convict { */ load(conf: Object): Config; /** - * Loads and merges one JSON configuration file into config + * Loads and merges JSON configuration file(s) into config * * @return {Config} instance */ - loadFile(file: string): Config; - /** - * Loads and merges multiple JSON configuration files into config - * - * @return {Config} instance - */ - loadFile(files: string[]): Config; + loadFile(files: string | string[]): Config; /** * Validates config against the schema used to initialize it * diff --git a/types/convict/tslint.json b/types/convict/tslint.json new file mode 100644 index 0000000000..09f94cd344 --- /dev/null +++ b/types/convict/tslint.json @@ -0,0 +1,7 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + // ban-types needs to be disabled to support TypeScript <2.2 + "ban-types": false + } +} From c564afbcc657b17e7756fcb852aa76f1e45daa02 Mon Sep 17 00:00:00 2001 From: Eli Young Date: Mon, 5 Jun 2017 21:59:21 -0700 Subject: [PATCH 015/118] [convict] Reformat tests --- types/convict/convict-tests.ts | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/types/convict/convict-tests.ts b/types/convict/convict-tests.ts index 83c9b03c8f..daa07c6875 100644 --- a/types/convict/convict-tests.ts +++ b/types/convict/convict-tests.ts @@ -18,22 +18,22 @@ const format: convict.Format = { convict.addFormat(format); convict.addFormats({ - prime: { - validate(val) { - function isPrime(n: number) { - if (n <= 1) return false; // zero and one are not prime - for (let i = 2; i * i <= n; i++) { - if (n % i === 0) return false; - } - return true; - } - if (!isPrime(val)) throw new Error('must be a prime number'); - }, - coerce(val) { - return parseInt(val, 10); + prime: { + validate(val) { + function isPrime(n: number) { + if (n <= 1) return false; // zero and one are not prime + for (let i = 2; i * i <= n; i++) { + if (n % i === 0) return false; } + return true; } - }); + if (!isPrime(val)) throw new Error('must be a prime number'); + }, + coerce(val) { + return parseInt(val, 10); + } + } +}); let conf = convict({ env: { From 45f22ec21e3b253c3264e2f28c8bf33a36a104bb Mon Sep 17 00:00:00 2001 From: David Philipson Date: Thu, 22 Jun 2017 18:05:21 -0700 Subject: [PATCH 016/118] Improve complement definition --- types/transducers-js/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/transducers-js/index.d.ts b/types/transducers-js/index.d.ts index 83dbbe1573..96fce6f671 100644 --- a/types/transducers-js/index.d.ts +++ b/types/transducers-js/index.d.ts @@ -47,7 +47,7 @@ export function comp(...args: Array<(x: any) => any>): (x: any) => any; /** * Take a predicate function and return its complement. */ -export function complement(f: Function): Function; +export function complement(f: (x: T) => boolean): (x: T) => boolean; /** * Identity function. From 3c34fad19420946701afa98b71a228f3e26ffd26 Mon Sep 17 00:00:00 2001 From: codemannz Date: Fri, 23 Jun 2017 13:31:50 +1200 Subject: [PATCH 017/118] Updated Application to include root region --- types/backbone.marionette/index.d.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/types/backbone.marionette/index.d.ts b/types/backbone.marionette/index.d.ts index 8b3d338293..d8ced49217 100644 --- a/types/backbone.marionette/index.d.ts +++ b/types/backbone.marionette/index.d.ts @@ -1265,17 +1265,17 @@ declare namespace Marionette { */ start(options?: any): void; - /** Deprecated! nstead of using the Application as the root of your view tree, you should use a Layout View.*/ - addRegions(regions: any): any; + /** Root region of the application*/ + region: string; - /** Deprecated! nstead of using the Application as the root of your view tree, you should use a Layout View.*/ - emptyRegions(): void; + /** Get the root region */ + getRegion(): Region; - /** Deprecated! nstead of using the Application as the root of your view tree, you should use a Layout View.*/ - removeRegion(region: Region): void; + /** Show a view in the root region */ + showView(view: any): void; - /** Deprecated! nstead of using the Application as the root of your view tree, you should use a Layout View.*/ - getRegion(regionName: string): Region; + /** Get the view from the root region*/ + getView(): any; module(moduleNames: any, moduleDefinition: any): Module; From 468858a1f209f9d201ab14b988784a445c56690f Mon Sep 17 00:00:00 2001 From: Marcus Noble Date: Fri, 23 Jun 2017 11:44:07 +0100 Subject: [PATCH 018/118] Added ping method to MySQL IConnection --- types/mysql/index.d.ts | 2 ++ types/mysql/mysql-tests.ts | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/types/mysql/index.d.ts b/types/mysql/index.d.ts index 9212d59ef6..d98ef82216 100644 --- a/types/mysql/index.d.ts +++ b/types/mysql/index.d.ts @@ -58,6 +58,8 @@ interface IConnection { end(callback: (err: IError, ...args: any[]) => void): void; end(options: any, callback: (err: IError, ...args: any[]) => void): void; + ping(callback: (err: IError) => void): void; + destroy(): void; pause(): void; diff --git a/types/mysql/mysql-tests.ts b/types/mysql/mysql-tests.ts index a6d9afc07e..d2c44e21ee 100644 --- a/types/mysql/mysql-tests.ts +++ b/types/mysql/mysql-tests.ts @@ -148,6 +148,11 @@ connection.connect(function (err) { console.log('connected as id ' + connection.threadId); }); +connection.ping(function (err) { + if (err) throw err; + console.log('Ping was successful'); +}) + /// Pools var poolConfig = { From ae4c64b79ddc3acab27c88ea818151cf15f9fa64 Mon Sep 17 00:00:00 2001 From: Sergey Tregub Date: Fri, 23 Jun 2017 14:18:28 +0300 Subject: [PATCH 019/118] bsClass attribute missing for some components --- types/react-bootstrap/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/react-bootstrap/index.d.ts b/types/react-bootstrap/index.d.ts index 3030e7d6a5..a696c4ac6d 100644 --- a/types/react-bootstrap/index.d.ts +++ b/types/react-bootstrap/index.d.ts @@ -847,6 +847,7 @@ declare namespace ReactBootstrap { // interface BadgeProps extends React.HTMLProps { + bsClass?: string; pullRight?: boolean; } type Badge = React.ClassicComponent; @@ -908,6 +909,7 @@ declare namespace ReactBootstrap { responsive?: boolean; striped?: boolean; fill?: boolean; + bsClass?: string; } type Table = React.ClassicComponent; var Table: React.ClassicComponentClass; From 94b781d6ae6d4b668030641ee506983a6ef90b43 Mon Sep 17 00:00:00 2001 From: Mahdi Abedi Date: Fri, 23 Jun 2017 18:25:45 +0430 Subject: [PATCH 020/118] add parameter for RTL --- types/jquery.fancytree/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/jquery.fancytree/index.d.ts b/types/jquery.fancytree/index.d.ts index e2c79b0341..cea0b4c8e4 100644 --- a/types/jquery.fancytree/index.d.ts +++ b/types/jquery.fancytree/index.d.ts @@ -721,6 +721,8 @@ declare namespace Fancytree { restore?(event: JQueryEventObject, data: EventData): void; /** `data.node` was selected */ select?(event: JQueryEventObject, data: EventData): void; + /** Enable RTL version, default is false */ + rtl?: boolean; } interface FancytreeOptions extends FancytreeEvents { From d4a36a80865d85d8455626faa22a2f151e92203d Mon Sep 17 00:00:00 2001 From: Mahdi Abedi Date: Fri, 23 Jun 2017 18:32:17 +0430 Subject: [PATCH 021/118] add contributor name --- types/jquery.fancytree/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/jquery.fancytree/index.d.ts b/types/jquery.fancytree/index.d.ts index cea0b4c8e4..f4e6ac7be8 100644 --- a/types/jquery.fancytree/index.d.ts +++ b/types/jquery.fancytree/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for jquery.fancytree 2.7.0 // Project: https://github.com/mar10/fancytree // Definitions by: Peter Palotas +// Mahdi Abedi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 From b0a675ccaad2cd33d5f08c5deebe07abaa4603f5 Mon Sep 17 00:00:00 2001 From: John J Czaplewski Date: Fri, 23 Jun 2017 12:04:17 -0500 Subject: [PATCH 022/118] Add maxTileCacheSize --- types/mapbox-gl/index.d.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/types/mapbox-gl/index.d.ts b/types/mapbox-gl/index.d.ts index 9438bfafac..46b5cd7d90 100644 --- a/types/mapbox-gl/index.d.ts +++ b/types/mapbox-gl/index.d.ts @@ -254,6 +254,9 @@ declare namespace mapboxgl { /** Initial zoom level */ zoom?: number; + + /** Maximum tile cache size for each layer. */ + maxTileCacheSize?: number; } export interface PaddingOptions { From 4ba0506fb710ac58cd141cd3e896d7ea287ea489 Mon Sep 17 00:00:00 2001 From: John J Czaplewski Date: Fri, 23 Jun 2017 12:08:09 -0500 Subject: [PATCH 023/118] Bump version number --- types/mapbox-gl/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/mapbox-gl/index.d.ts b/types/mapbox-gl/index.d.ts index 46b5cd7d90..18ee4bbf1a 100644 --- a/types/mapbox-gl/index.d.ts +++ b/types/mapbox-gl/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Mapbox GL JS v0.38.0 +// Type definitions for Mapbox GL JS v0.39.0 // Project: https://github.com/mapbox/mapbox-gl-js // Definitions by: Dominik Bruderer // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 937b1fc4016d3d13c14f46f06fd3de372da71924 Mon Sep 17 00:00:00 2001 From: Yui T Date: Fri, 23 Jun 2017 10:50:13 -0700 Subject: [PATCH 024/118] Fix linting: line exceed max length of 200 --- types/react-native/index.d.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index 06e777a270..5f9e6e3856 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -1,6 +1,10 @@ // Type definitions for react-native 0.44 // Project: https://github.com/facebook/react-native -// Definitions by: Eloy Durán , Fedor Nezhivoi , HuHuanming , Jeremi Stadler , Kyle Roach +// Definitions by: Eloy Durán +// Fedor Nezhivoi +// HuHuanming +// Jeremi Stadler +// Kyle Roach // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 From dddc76636954b1a3ddbdd827e08563f06743bbf3 Mon Sep 17 00:00:00 2001 From: Nicolas Voigt Date: Sat, 24 Jun 2017 14:35:27 +0200 Subject: [PATCH 025/118] setEncoding in stream interface --- types/node/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 131dbc96a1..2d15ee12c2 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -6,6 +6,7 @@ // Roberto Desideri // Christian Vaagland Tellnes // Wilco Bakker +// Nicolas Voigt // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -307,7 +308,7 @@ declare namespace NodeJS { export interface ReadableStream extends EventEmitter { readable: boolean; read(size?: number): string | Buffer; - setEncoding(encoding: string | null): this; + setEncoding(encoding?: string): this; pause(): this; resume(): this; isPaused(): boolean; From f8c68213bf02e6a29bfa6f3ef4b2cc85049e3d44 Mon Sep 17 00:00:00 2001 From: Michiel de Bruijne Date: Sat, 24 Jun 2017 16:41:47 +0200 Subject: [PATCH 026/118] [node] set correct type for process.env and fix node dependents --- types/dockerode/index.d.ts | 3 ++- types/jake/index.d.ts | 1 + types/libpq/index.d.ts | 2 +- types/main-bower-files/index.d.ts | 1 + types/node/index.d.ts | 6 ++++- types/passport-beam/index.d.ts | 3 ++- types/passport-facebook-token/index.d.ts | 1 + types/passport-facebook/index.d.ts | 1 + types/passport-github/index.d.ts | 1 + .../passport-github/passport-github-tests.ts | 22 ++++++++++++++++--- types/passport-google-oauth/index.d.ts | 1 + types/passport-twitter/index.d.ts | 1 + types/pg-types/package.json | 2 +- types/pty.js/index.d.ts | 1 + types/stylus/index.d.ts | 1 + types/swagger-express-mw/index.d.ts | 1 + types/swagger-hapi/index.d.ts | 1 + types/swagger-node-runner/index.d.ts | 1 + types/swagger-restify-mw/index.d.ts | 1 + types/swagger-tools/index.d.ts | 1 + 20 files changed, 44 insertions(+), 8 deletions(-) diff --git a/types/dockerode/index.d.ts b/types/dockerode/index.d.ts index a4a1144872..ec2808cf3d 100644 --- a/types/dockerode/index.d.ts +++ b/types/dockerode/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/apocas/dockerode // Definitions by: Carl Winkler , Nicolas Laplante // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /// @@ -637,7 +638,7 @@ declare namespace Dockerode { interface DockerOptions { socketPath?: string; host?: string; - port?: number; + port?: number | string; ca?: string; cert?: string; key?: string; diff --git a/types/jake/index.d.ts b/types/jake/index.d.ts index cb23f992f0..6abb7e125c 100644 --- a/types/jake/index.d.ts +++ b/types/jake/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/mde/jake // Definitions by: Kon // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /// diff --git a/types/libpq/index.d.ts b/types/libpq/index.d.ts index 49c00db818..d336d95c9f 100644 --- a/types/libpq/index.d.ts +++ b/types/libpq/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/brianc/node-libpq#readme // Definitions by: Vlad Rindevich // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.1 +// TypeScript Version: 2.2 /// diff --git a/types/main-bower-files/index.d.ts b/types/main-bower-files/index.d.ts index 0a00b19b8b..f3cc5e7228 100644 --- a/types/main-bower-files/index.d.ts +++ b/types/main-bower-files/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/ck86/main-bower-files // Definitions by: Keita Kagurazaka // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /// diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 131dbc96a1..21d48b504a 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -400,6 +400,10 @@ declare namespace NodeJS { isTTY?: true; } + export interface ProcessEnv { + [key: string]: string | undefined + } + export interface Process extends EventEmitter { stdout: Socket; stderr: Socket; @@ -413,7 +417,7 @@ declare namespace NodeJS { chdir(directory: string): void; cwd(): string; emitWarning(warning: string | Error, name?: string, ctor?: Function): void; - env: any; + env: ProcessEnv; exit(code?: number): never; exitCode: number; getgid(): number; diff --git a/types/passport-beam/index.d.ts b/types/passport-beam/index.d.ts index 7d34ef4173..852ac6f698 100644 --- a/types/passport-beam/index.d.ts +++ b/types/passport-beam/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/alfw/passport-beam // Definitions by: AtlasDev // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /// /// @@ -31,4 +32,4 @@ export namespace Strategy { _raw: any; _json: any; } -} \ No newline at end of file +} diff --git a/types/passport-facebook-token/index.d.ts b/types/passport-facebook-token/index.d.ts index 173992a701..49bfc62d11 100644 --- a/types/passport-facebook-token/index.d.ts +++ b/types/passport-facebook-token/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/drudge/passport-facebook-token // Definitions by: Ray Martone // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /// diff --git a/types/passport-facebook/index.d.ts b/types/passport-facebook/index.d.ts index cd35cbe0c8..01db85012d 100644 --- a/types/passport-facebook/index.d.ts +++ b/types/passport-facebook/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/jaredhanson/passport-facebook // Definitions by: James Roland Cabresos , Lucas Acosta // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /// diff --git a/types/passport-github/index.d.ts b/types/passport-github/index.d.ts index 38704a0a88..0b0880bb05 100644 --- a/types/passport-github/index.d.ts +++ b/types/passport-github/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/jaredhanson/passport-github // Definitions by: Yasunori Ohoka // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 import passport = require('passport'); import express = require('express'); diff --git a/types/passport-github/passport-github-tests.ts b/types/passport-github/passport-github-tests.ts index 72697a7dd2..10c24a366d 100644 --- a/types/passport-github/passport-github-tests.ts +++ b/types/passport-github/passport-github-tests.ts @@ -11,11 +11,27 @@ const User = { } }; +const callbackURL = process.env.PASSPORT_GITHUB_CALLBACK_URL; +const clientID = process.env.PASSPORT_GITHUB_CONSUMER_KEY; +const clientSecret = process.env.PASSPORT_GITHUB_CONSUMER_SECRET; + +if (typeof callbackURL === "undefined") { + throw new Error("callbackURL is undefined"); +} + +if (typeof clientID === "undefined") { + throw new Error("clientID is undefined"); +} + +if (typeof clientSecret === "undefined") { + throw new Error("clientSecret is undefined"); +} + passport.use(new github.Strategy( { - clientID: process.env.PASSPORT_GITHUB_CONSUMER_KEY, - clientSecret: process.env.PASSPORT_GITHUB_CONSUMER_SECRET, - callbackURL: process.env.PASSPORT_GITHUB_CALLBACK_URL + callbackURL, + clientID, + clientSecret }, (accessToken: string, refreshToken: string, profile: github.Profile, done: (error: any, user?: any) => void) => { User.findOrCreate(profile.id, profile.provider, (err, user) => { diff --git a/types/passport-google-oauth/index.d.ts b/types/passport-google-oauth/index.d.ts index 50930a45ad..cefd05fe20 100644 --- a/types/passport-google-oauth/index.d.ts +++ b/types/passport-google-oauth/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/jaredhanson/passport-facebook // Definitions by: James Roland Cabresos // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /// diff --git a/types/passport-twitter/index.d.ts b/types/passport-twitter/index.d.ts index f819ef721d..41cee10286 100644 --- a/types/passport-twitter/index.d.ts +++ b/types/passport-twitter/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/jaredhanson/passport-twitter // Definitions by: James Roland Cabresos // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /// diff --git a/types/pg-types/package.json b/types/pg-types/package.json index 4c6d24a445..d33ff913ce 100644 --- a/types/pg-types/package.json +++ b/types/pg-types/package.json @@ -2,4 +2,4 @@ "dependencies": { "moment": ">=2.14.0" } -} \ No newline at end of file +} diff --git a/types/pty.js/index.d.ts b/types/pty.js/index.d.ts index 49acad6260..c54022279b 100644 --- a/types/pty.js/index.d.ts +++ b/types/pty.js/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/chjj/pty.js // Definitions by: Vadim Macagon // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /// diff --git a/types/stylus/index.d.ts b/types/stylus/index.d.ts index a2a75b2ebc..47854aaf60 100644 --- a/types/stylus/index.d.ts +++ b/types/stylus/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/LearnBoost/stylus // Definitions by: Maxime LUCE // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /// diff --git a/types/swagger-express-mw/index.d.ts b/types/swagger-express-mw/index.d.ts index 04c09866d6..104bd0fc39 100644 --- a/types/swagger-express-mw/index.d.ts +++ b/types/swagger-express-mw/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/apigee-127/swagger-express#readme // Definitions by: Michael Mrowetz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /* =================== USAGE =================== diff --git a/types/swagger-hapi/index.d.ts b/types/swagger-hapi/index.d.ts index 2c723cbf61..7e62dbbdbb 100644 --- a/types/swagger-hapi/index.d.ts +++ b/types/swagger-hapi/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/apigee-127/swagger-hapi#readme // Definitions by: Michael Mrowetz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /* =================== USAGE =================== diff --git a/types/swagger-node-runner/index.d.ts b/types/swagger-node-runner/index.d.ts index 033abb434b..79118bb2e5 100644 --- a/types/swagger-node-runner/index.d.ts +++ b/types/swagger-node-runner/index.d.ts @@ -2,6 +2,7 @@ // Project: https://www.npmjs.com/package/swagger-node-runner // Definitions by: Michael Mrowetz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /* =================== USAGE =================== diff --git a/types/swagger-restify-mw/index.d.ts b/types/swagger-restify-mw/index.d.ts index c9518b2ecb..efc63693f3 100644 --- a/types/swagger-restify-mw/index.d.ts +++ b/types/swagger-restify-mw/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/apigee-127/swagger-restify#readme // Definitions by: Michael Mrowetz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /* =================== USAGE =================== import * as SwaggerRestify from "swagger-restify-mw"; diff --git a/types/swagger-tools/index.d.ts b/types/swagger-tools/index.d.ts index 09d42138b6..a697e9d7e8 100644 --- a/types/swagger-tools/index.d.ts +++ b/types/swagger-tools/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/apigee-127/swagger-tools // Definitions by: Alex Brick // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 import { NextHandleFunction } from 'connect'; import { IncomingMessage } from 'http'; From d1f7e5ff1b321728c63496a2a56b0fbd568528c9 Mon Sep 17 00:00:00 2001 From: Michael Handley Date: Wed, 21 Jun 2017 18:09:19 -0700 Subject: [PATCH 027/118] Update react-sortable-hoc to 0.6.3 --- types/react-sortable-hoc/index.d.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/types/react-sortable-hoc/index.d.ts b/types/react-sortable-hoc/index.d.ts index f4886cd7d6..767cf1405c 100644 --- a/types/react-sortable-hoc/index.d.ts +++ b/types/react-sortable-hoc/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for nes 0.0.7 +// Type definitions for nes 0.6.3 // Project: https://github.com/clauderic/react-sortable-hoc // Definitions by: Ivo Stratev , Charles Rey // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -33,12 +33,20 @@ declare module 'react-sortable-hoc' { export type ContainerGetter = (element: React.ReactElement) => HTMLElement; + export interface Dimensions { + width: number; + height: number; + } + export interface SortableContainerProps { axis?: Axis; lockAxis?: Axis; helperClass?: string; transitionDuration?: number; pressDelay?: number; + pressThreshold?: number; + distance?: number; + shouldCancelStart?: (event: SortEvent) => boolean; onSortStart?: SortStartHandler; onSortMove?: SortMoveHandler; onSortEnd?: SortEndHandler; @@ -48,7 +56,7 @@ declare module 'react-sortable-hoc' { lockToContainerEdges?: boolean; lockOffset?: Offset | [Offset, Offset]; getContainer?: ContainerGetter; - shouldCancelStart?: (event: SortEvent) => boolean; + getHelperDimensions?: (sort: SortStart) => Dimensions; } export interface SortableElementProps { From 763c1347f1eac4f3d6f07dcdeb14e31f68cc908f Mon Sep 17 00:00:00 2001 From: Michael Handley Date: Wed, 21 Jun 2017 18:09:37 -0700 Subject: [PATCH 028/118] Test typings for 0.6.3 update --- .../react-sortable-hoc-tests.tsx | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/types/react-sortable-hoc/react-sortable-hoc-tests.tsx b/types/react-sortable-hoc/react-sortable-hoc-tests.tsx index 4700612d01..af742734bf 100644 --- a/types/react-sortable-hoc/react-sortable-hoc-tests.tsx +++ b/types/react-sortable-hoc/react-sortable-hoc-tests.tsx @@ -35,21 +35,38 @@ const SortableList = ReactSortableHOC.SortableContainer((props: SortableListProp class SortableComponent extends React.Component<{}, SortableComponentState> { private _onSortEnd: ReactSortableHOC.SortEndHandler; - private _handleSotEnd(sort: ReactSortableHOC.SortEnd, event: ReactSortableHOC.SortEvent): void { + private _handleSortEnd(sort: ReactSortableHOC.SortEnd, event: ReactSortableHOC.SortEvent): void { this.setState({items: ReactSortableHOC.arrayMove(this.state.items, sort.oldIndex, sort.newIndex)}); } + private _getHelperDimensions(sort: ReactSortableHOC.SortStart): ReactSortableHOC.Dimensions { + if (sort.node instanceof HTMLElement) { + return ({ + width: sort.node.offsetWidth, + height: sort.node.offsetHeight + }); + } + return {width: 0, height: 0}; + } + public constructor() { super(); this.state = { items: ['Item 1', 'Item 2', 'Item 3', 'Item 4', 'Item 5', 'Item 6'], axis: 'x' }; - this._onSortEnd = this._handleSotEnd.bind(this); + this._onSortEnd = this._handleSortEnd.bind(this); } public render(): JSX.Element { - return ; + return ; } } From d8957d2d4314df556ed1304930af3d2bbc424015 Mon Sep 17 00:00:00 2001 From: Donald Pipowitch Date: Mon, 26 Jun 2017 09:48:48 +0200 Subject: [PATCH 029/118] Update index.d.ts --- types/autoprefixer/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/autoprefixer/index.d.ts b/types/autoprefixer/index.d.ts index b5249746d1..1957632053 100644 --- a/types/autoprefixer/index.d.ts +++ b/types/autoprefixer/index.d.ts @@ -7,7 +7,7 @@ import { Plugin, Transformer as PostcssTransformer } from 'postcss'; declare namespace autoprefixer { interface Options { - browsers?: string[]; + browsers?: string[] | string; env?: string; cascade?: boolean; add?: boolean; From 834287de2653a19b479a3715275f8cd750be595e Mon Sep 17 00:00:00 2001 From: Wouter Hardeman Date: Mon, 26 Jun 2017 10:06:33 +0200 Subject: [PATCH 030/118] Added types for react-sortable-tree 0.1 --- types/react-sortable-tree/index.d.ts | 120 ++++++++++++++++++ .../react-sortable-tree-tests.tsx | 66 ++++++++++ types/react-sortable-tree/tsconfig.json | 23 ++++ types/react-sortable-tree/tslint.json | 1 + .../utils/default-handlers.d.ts | 4 + .../utils/tree-data-utils.d.ts | 21 +++ 6 files changed, 235 insertions(+) create mode 100644 types/react-sortable-tree/index.d.ts create mode 100644 types/react-sortable-tree/react-sortable-tree-tests.tsx create mode 100644 types/react-sortable-tree/tsconfig.json create mode 100644 types/react-sortable-tree/tslint.json create mode 100644 types/react-sortable-tree/utils/default-handlers.d.ts create mode 100644 types/react-sortable-tree/utils/tree-data-utils.d.ts diff --git a/types/react-sortable-tree/index.d.ts b/types/react-sortable-tree/index.d.ts new file mode 100644 index 0000000000..961b218be4 --- /dev/null +++ b/types/react-sortable-tree/index.d.ts @@ -0,0 +1,120 @@ +// Type definitions for react-sortable-tree 0.1 +// Project: https://fritz-c.github.io/react-sortable-tree +// Definitions by: Wouter Hardeman +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import * as React from 'react'; +import { ListProps, Index } from 'react-virtualized'; +import { ConnectDragSource, ConnectDragPreview, DragSourceMonitor } from 'react-dnd'; + +export * from './utils/tree-data-utils'; +export * from './utils/default-handlers'; + +export interface TreeItem { + title?: string; + subtitle?: string; + expanded?: boolean; + children: TreeItem[]; + [x: string]: any; +} + +export interface TreeNode { + node: TreeItem; +} + +export interface TreePath { + path: NumberArrayOrStringArray; +} + +export interface TreeIndex { + treeIndex: number; +} + +export interface FullTree { + treeData: TreeItem[]; +} + +export interface NodeData extends TreeNode, TreePath, TreeIndex {} + +export interface SearchData extends NodeData { + searchQuery: any; +} + +export interface ExtendedNodeData extends NodeData { + lowerSiblingsCounts: number[]; + isSearchMatch: boolean; + isSearchFocus: boolean; +} + +export interface OnVisibilityToggleData extends FullTree, TreeNode { + expanded: boolean; +} +export interface PreviousAnNextLocation { + prevPath: number[]; + prevParent: TreeItem; + prevTreeIndex: number; + nextPath: number[]; + nextParent: TreeItem; + nextTreeIndex: number; +} + +export type NodeRenderer = React.Component; + +export interface NodeRendererProps { + node: TreeItem; + path: NumberArrayOrStringArray; + treeIndex: number; + isSearchMatch: boolean; + isSearchFocus: boolean; + canDrag: boolean; + scaffoldBlockPxWidth: number; + toggleChildrenVisibility?(data: NodeData): void; + buttons?: any[]; + className?: string; + style?: {[index: string]: any}; + + connectDragPreview: ConnectDragPreview; + connectDragSource: ConnectDragSource; + parentNode?: {[index: string]: any}; + startDrag: any; + endDrag: any; + isDragging: boolean; + didDrop: boolean; + draggedNode?: {[index: string]: any}; + isOver: boolean; + canDrop?: boolean; +} + +type NumberArrayOrStringArray = string[] | number[]; + +export interface ReactSortableTreeProps { + treeData: TreeItem[]; + onChange(treeData: TreeItem[]): void; + style?: {[index: string]: any; }; + className?: string; + innerStyle?: {[index: string]: any; }; + maxDepth?: number; + searchMethod?(data: SearchData): boolean; + searchQuery?: string | any; + searchFocusOffset?: number; + searchFinishCallback?(matches: NodeData[]): void; + generateNodeProps?(data: ExtendedNodeData): {[index: string]: any}; + getNodeKey?(data: TreeNode & TreeIndex): string | number; + onMoveNode?(data: NodeData & FullTree): void; + onVisibilityToggle?(data: OnVisibilityToggleData): void; + canDrag?: ((data: ExtendedNodeData) => boolean) | boolean; + canDrop?(data: PreviousAnNextLocation & NodeData): boolean; + reactVirtualizedListProps?: ListProps; + rowHeight?: ((info: Index) => number) | number; + slideRegionSize?: number; + scaffoldBlockPxWidth?: number; + isVirtualized?: boolean; + nodeContentRenderer?: NodeRenderer; +} + +declare const SortableTree: React.ComponentClass; + +export const SortableTreeWithoutDndContext: React.ComponentClass; + +export default SortableTree; diff --git a/types/react-sortable-tree/react-sortable-tree-tests.tsx b/types/react-sortable-tree/react-sortable-tree-tests.tsx new file mode 100644 index 0000000000..21c18410e5 --- /dev/null +++ b/types/react-sortable-tree/react-sortable-tree-tests.tsx @@ -0,0 +1,66 @@ +import * as React from "react"; +import SortableTree, + { + SortableTreeWithoutDndContext, + defaultGetNodeKey, + NodeRenderer, + TreeItem, + defaultSearchMethod, + SearchData, + NodeData, + ExtendedNodeData, + FullTree, + OnVisibilityToggleData, + PreviousAnNextLocation + } from "react-sortable-tree"; +import { ListProps, ListRowRenderer } from "react-virtualized"; + +class Test extends React.Component { + render() { + const treeData = [ + { + title: "Title", subtitle: "Subtitle", children: [ + {title: "Child 1", subtitle: "Subtitle", children: []}, + {title: "Child 2", subtitle: "Subtitle", children: []} + ] + } + ]; + const reactVirtualizedListProps: ListProps = { + width: 100, height: 44, rowCount: 3, rowHeight: 44, rowRenderer: "test" as any as ListRowRenderer + }; + const nodeRenderer: NodeRenderer = "test" as any as NodeRenderer; + return ( +
+ {}} + style={{width: "100%"}} + className="test-class" + innerStyle={{backgroundColor: "#3A3A3A"}} + maxDepth={3} + searchMethod={defaultSearchMethod} + searchQuery={"Child 1"} + searchFocusOffset={1} + searchFinishCallback={(matches: NodeData[]) => { const firstTitle = matches[0].node.title; }} + generateNodeProps={(data: ExtendedNodeData) => ({buttons: [data.node.title]}) } + getNodeKey={defaultGetNodeKey} + onMoveNode={(data: NodeData & FullTree) => {}} + onVisibilityToggle={(data: OnVisibilityToggleData) => {}} + canDrag={true} + canDrop={(data: PreviousAnNextLocation & NodeData) => true} + reactVirtualizedListProps={reactVirtualizedListProps} + rowHeight={62} + slideRegionSize={100} + scaffoldBlockPxWidth={44} + isVirtualized={true} + nodeContentRenderer={nodeRenderer} + /> + {}} + style={{width: "100px"}} + /> +
+ ); + } +} diff --git a/types/react-sortable-tree/tsconfig.json b/types/react-sortable-tree/tsconfig.json new file mode 100644 index 0000000000..f82f976d38 --- /dev/null +++ b/types/react-sortable-tree/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "jsx": "react", + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "react-sortable-tree-tests.tsx" + ] +} diff --git a/types/react-sortable-tree/tslint.json b/types/react-sortable-tree/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-sortable-tree/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/react-sortable-tree/utils/default-handlers.d.ts b/types/react-sortable-tree/utils/default-handlers.d.ts new file mode 100644 index 0000000000..4d24792196 --- /dev/null +++ b/types/react-sortable-tree/utils/default-handlers.d.ts @@ -0,0 +1,4 @@ +import { TreeIndex, SearchData } from "../"; + +export function defaultGetNodeKey(data: TreeIndex): number; +export function defaultSearchMethod(data: SearchData): boolean; \ No newline at end of file diff --git a/types/react-sortable-tree/utils/tree-data-utils.d.ts b/types/react-sortable-tree/utils/tree-data-utils.d.ts new file mode 100644 index 0000000000..0446b00ed4 --- /dev/null +++ b/types/react-sortable-tree/utils/tree-data-utils.d.ts @@ -0,0 +1,21 @@ +import { FullTree, TreePath, TreeItem, TreeIndex, SearchData, NodeData, TreeNode } from "../"; + +type GetNodeKeyFunction = (data: TreeIndex & TreeNode) => string | number; +type WalkAndMapFunctionParameters = FullTree & {getNodeKey: GetNodeKeyFunction, callback: Function, ignoreCollapsed?: boolean} +type FlattenedData = (TreeNode & TreePath & {lowerSiblingsCounts: number[]})[]; + +export function getDescendantCount(data: TreeNode & {ignoreCollapsed?: boolean}): number; +export function getVisibleNodeCount(data: FullTree): number; +export function getVisibleNodeInfoAtIndex(data: FullTree & {targetIndex: number, getNodeKey: GetNodeKeyFunction}): TreeNode & TreePath & {lowerSiblingsCounts: number[]}; +export function walk(data: WalkAndMapFunctionParameters): void; +export function map(data: WalkAndMapFunctionParameters): TreeItem[]; +export function changeNodeAtPath(data: FullTree & TreePath & {newNode: Function | any, getNodeKey: GetNodeKeyFunction, ignoreCollapsed?: boolean}): TreeItem[]; +export function removeNodeAtPath(data: FullTree & TreePath & {getNodeKey: GetNodeKeyFunction, ignoreCollapsed?: boolean}): TreeItem[]; +export function getNodeAtPath(data: FullTree & TreePath & {getNodeKey: GetNodeKeyFunction, ignoreCollapsed?: boolean}): TreeItem | null; +export function addNodeUnderParent(data: FullTree & {newNode: TreeItem, parentKey?: number | string, getNodeKey: GetNodeKeyFunction, ignoreCollapsed?: boolean, expandParent?: boolean}): FullTree & TreeIndex; +export function insertNode(data: FullTree & {depth: number, newNode: TreeItem, minimumTreeIndex: number, ignoreCollapsed?: boolean, expandParent?: boolean, getNodeKey: GetNodeKeyFunction}): FullTree & TreeIndex & TreePath & {parentNode: TreeItem}; +export function getFlatDataFromTree(data: FullTree & {getNodeKey: GetNodeKeyFunction, ignoreCollapsed?: boolean}): (TreeNode & TreePath & {lowerSiblingsCounts: number[], parentNode: TreeItem})[]; +export function getTreeFromFlatData(data: {flatData: FlattenedData, getKey?: GetNodeKeyFunction, getParentKey?: GetNodeKeyFunction, rootKey?: string | number}): TreeItem[] +export function isDescendant(older: TreeItem, younger: TreeItem): boolean; +export function getDepth(node: TreeItem, depth?: number): number; +export function find(data: FullTree & {getNodeKey: GetNodeKeyFunction, searchQuery?: string | number, searchMethod: (data: SearchData) => boolean, searchFocusOffset?: number, expandAllMatchPaths?: boolean, expandFocusMatchPaths?: boolean}): {matches: NodeData[]} & FullTree; From 5ab8522e7fc07458ed60b4cb6cf41e2d8e468a8d Mon Sep 17 00:00:00 2001 From: clarenceh Date: Mon, 26 Jun 2017 17:27:04 +0800 Subject: [PATCH 031/118] Updates to Table interface definition --- types/massive/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/massive/index.d.ts b/types/massive/index.d.ts index 67be093bb0..ccf6469d91 100644 --- a/types/massive/index.d.ts +++ b/types/massive/index.d.ts @@ -50,9 +50,9 @@ declare namespace massive { count(criteria: object): Promise; where(query: string, params: any[] | object): Promise; search(criteria: SearchCriteria, queryOptions?: QueryOptions): Promise; - save(data: object): Promise; - insert(data: object): Promise; - update(dataOrCriteria: object, changesMap?: object): Promise; + save(data: object | object[]): Promise | Promise; + insert(data: object | object[]): Promise | Promise; + update(dataOrCriteria: object | object[], changesMap?: object): Promise | Promise; destroy(criteria: object): Promise; } From 51995773e3f48b3e91df767a737e9b3727669a6d Mon Sep 17 00:00:00 2001 From: Wouter Hardeman Date: Mon, 26 Jun 2017 11:54:04 +0200 Subject: [PATCH 032/118] Fixed NodeRenderer type --- types/react-sortable-tree/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-sortable-tree/index.d.ts b/types/react-sortable-tree/index.d.ts index 961b218be4..a7805cd90e 100644 --- a/types/react-sortable-tree/index.d.ts +++ b/types/react-sortable-tree/index.d.ts @@ -59,7 +59,7 @@ export interface PreviousAnNextLocation { nextTreeIndex: number; } -export type NodeRenderer = React.Component; +export type NodeRenderer = React.ComponentClass; export interface NodeRendererProps { node: TreeItem; From 922fbf29014c072181ced556f570a09cac906de2 Mon Sep 17 00:00:00 2001 From: Wouter Hardeman Date: Mon, 26 Jun 2017 12:10:59 +0200 Subject: [PATCH 033/118] Fixed parent references for react-sortable-tree --- types/react-sortable-tree/utils/default-handlers.d.ts | 2 +- types/react-sortable-tree/utils/tree-data-utils.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/types/react-sortable-tree/utils/default-handlers.d.ts b/types/react-sortable-tree/utils/default-handlers.d.ts index 4d24792196..5b00de104d 100644 --- a/types/react-sortable-tree/utils/default-handlers.d.ts +++ b/types/react-sortable-tree/utils/default-handlers.d.ts @@ -1,4 +1,4 @@ -import { TreeIndex, SearchData } from "../"; +import { TreeIndex, SearchData } from 'react-sortable-tree'; export function defaultGetNodeKey(data: TreeIndex): number; export function defaultSearchMethod(data: SearchData): boolean; \ No newline at end of file diff --git a/types/react-sortable-tree/utils/tree-data-utils.d.ts b/types/react-sortable-tree/utils/tree-data-utils.d.ts index 0446b00ed4..84f68840c7 100644 --- a/types/react-sortable-tree/utils/tree-data-utils.d.ts +++ b/types/react-sortable-tree/utils/tree-data-utils.d.ts @@ -1,4 +1,4 @@ -import { FullTree, TreePath, TreeItem, TreeIndex, SearchData, NodeData, TreeNode } from "../"; +import { FullTree, TreePath, TreeItem, TreeIndex, SearchData, NodeData, TreeNode } from 'react-sortable-tree'; type GetNodeKeyFunction = (data: TreeIndex & TreeNode) => string | number; type WalkAndMapFunctionParameters = FullTree & {getNodeKey: GetNodeKeyFunction, callback: Function, ignoreCollapsed?: boolean} From 787dc502fa84b87234a84852c06d425658ef7332 Mon Sep 17 00:00:00 2001 From: yairm210 Date: Mon, 26 Jun 2017 13:15:08 +0300 Subject: [PATCH 034/118] Added .withCredentials to CoreOptions Although not specified on the main page, as per https://github.com/request/request/blob/b12a6245d9acdb1e13c6486d427801e123fdafae/tests/browser/test.js we can see that this is part of the request module. More practically: local testing shows adding the {withCredentials:false} option allows us to create a request that accepts an "*" value for the Access-Control-Allow-Origin header. --- types/request/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/request/index.d.ts b/types/request/index.d.ts index fae6a2f65c..2cf7b08cf9 100644 --- a/types/request/index.d.ts +++ b/types/request/index.d.ts @@ -143,6 +143,7 @@ declare namespace request { gzip?: boolean; preambleCRLF?: boolean; postambleCRLF?: boolean; + withCredentials?: boolean; key?: Buffer; cert?: Buffer; passphrase?: string; From 6711c77b2f40e99832820ecc33400dea87d35851 Mon Sep 17 00:00:00 2001 From: SkyAo Date: Mon, 26 Jun 2017 18:22:52 +0800 Subject: [PATCH 035/118] [mongoose] add useMongoClient in ConnectOpenOptionsBase Interface --- types/mongoose/v3/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/mongoose/v3/index.d.ts b/types/mongoose/v3/index.d.ts index 80cca9da2f..c914af0813 100644 --- a/types/mongoose/v3/index.d.ts +++ b/types/mongoose/v3/index.d.ts @@ -68,6 +68,7 @@ declare module "mongoose" { pass?: string; /** Options for authentication */ auth?: any; + useMongoClient?: boolean; } export interface ConnectionOptions extends ConnectOpenOptionsBase { @@ -656,4 +657,4 @@ declare module "mongoose" { error(err: any): Promise; } -} \ No newline at end of file +} From 3510b58e50b1be69baa640cf96b0dd284ee11d71 Mon Sep 17 00:00:00 2001 From: york yao Date: Mon, 26 Jun 2017 19:49:33 +0800 Subject: [PATCH 036/118] update types of uppercaselcase --- types/uppercamelcase/index.d.ts | 1 + types/uppercamelcase/uppercamelcase-tests.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/types/uppercamelcase/index.d.ts b/types/uppercamelcase/index.d.ts index cbdfed1925..b1e0ff34ba 100644 --- a/types/uppercamelcase/index.d.ts +++ b/types/uppercamelcase/index.d.ts @@ -5,3 +5,4 @@ declare function upperCamelCase(...args: string[]): string; export = upperCamelCase; +declare namespace upperCamelCase { } diff --git a/types/uppercamelcase/uppercamelcase-tests.ts b/types/uppercamelcase/uppercamelcase-tests.ts index 29d31d58e6..eb850ee8cd 100644 --- a/types/uppercamelcase/uppercamelcase-tests.ts +++ b/types/uppercamelcase/uppercamelcase-tests.ts @@ -1,4 +1,5 @@ import upperCamelCase = require('uppercamelcase'); +import * as upperCamelCase2 from "uppercamelcase"; upperCamelCase('foo-bar'); //=> FooBar From 3fe74104369b0f02dd28185f09e76f54136767f0 Mon Sep 17 00:00:00 2001 From: Alex Brick Date: Mon, 26 Jun 2017 17:35:10 +0200 Subject: [PATCH 037/118] [superagent] Adding types for custom serializers --- types/superagent/index.d.ts | 4 ++++ types/superagent/superagent-tests.ts | 16 ++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/types/superagent/index.d.ts b/types/superagent/index.d.ts index 4032a9d543..e9b0018ed7 100644 --- a/types/superagent/index.d.ts +++ b/types/superagent/index.d.ts @@ -12,6 +12,8 @@ import * as https from 'https'; type CallbackHandler = (err: any, res: request.Response) => void; +type Serializer = (obj: any) => string; + declare const request: request.SuperAgentStatic; declare namespace request { @@ -28,6 +30,7 @@ declare namespace request { (method: string, url: string): SuperAgentRequest; agent(): SuperAgent; + serialize: { [type: string]: Serializer }; } interface SuperAgent extends stream.Stream { @@ -109,6 +112,7 @@ declare namespace request { redirects(n: number): this; responseType(type: string): this; send(data?: string | object): this; + serialize(serializer: Serializer): this; set(field: string, val: string): this; set(field: object): this; timeout(ms: number | { deadline?: number, response?: number }): this; diff --git a/types/superagent/superagent-tests.ts b/types/superagent/superagent-tests.ts index a6d07c3eaa..f38dcb31ea 100644 --- a/types/superagent/superagent-tests.ts +++ b/types/superagent/superagent-tests.ts @@ -171,6 +171,22 @@ request .send({post: 'data', here: 'wahoo'}) .end(callback); +// Custom request serializer +function testParser(data: any) { + return JSON.stringify(data); +} + +request + .post('/user') + .serialize(testParser) + .type('json') + .send({ foo: 123 }) + .end(callback); + +// Default serialization map + +request.serialize['application/xml'] = (obj: any) => 'generated xml here'; + // Parsing response bodies request('/search') .end((res: request.Response) => { From e2c87fc5b8660d2a8607b67382fe2ecb32e17f01 Mon Sep 17 00:00:00 2001 From: Joscha Feth Date: Mon, 26 Jun 2017 17:52:16 +0200 Subject: [PATCH 038/118] add @storybook/addon-actions --- types/storybook__addon-actions/index.d.ts | 16 +++++++++++ .../storybook__addon-actions-tests.tsx | 19 +++++++++++++ types/storybook__addon-actions/tsconfig.json | 28 +++++++++++++++++++ types/storybook__addon-actions/tslint.json | 1 + 4 files changed, 64 insertions(+) create mode 100644 types/storybook__addon-actions/index.d.ts create mode 100644 types/storybook__addon-actions/storybook__addon-actions-tests.tsx create mode 100644 types/storybook__addon-actions/tsconfig.json create mode 100644 types/storybook__addon-actions/tslint.json diff --git a/types/storybook__addon-actions/index.d.ts b/types/storybook__addon-actions/index.d.ts new file mode 100644 index 0000000000..b650cd2d55 --- /dev/null +++ b/types/storybook__addon-actions/index.d.ts @@ -0,0 +1,16 @@ +// Type definitions for @storybook/addon-actions 3.0 +// Project: https://github.com/storybooks/storybook +// Definitions by: Joscha Feth +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +// TODO: Once https://github.com/DefinitelyTyped/DefinitelyTyped/pull/17434 is merged +// Remove the `declare module` wrapper. +// tslint:disable-next-line no-single-declare-module +declare module '@storybook/addon-actions' { + type HandlerFunction = (...args: any[]) => undefined; + type DecoratorFunction = (args: any[]) => any[]; + + function decorateAction(decorators: DecoratorFunction[]): HandlerFunction; + function action(name: string): HandlerFunction; +} diff --git a/types/storybook__addon-actions/storybook__addon-actions-tests.tsx b/types/storybook__addon-actions/storybook__addon-actions-tests.tsx new file mode 100644 index 0000000000..837a4ba214 --- /dev/null +++ b/types/storybook__addon-actions/storybook__addon-actions-tests.tsx @@ -0,0 +1,19 @@ +import * as React from 'react'; +import { storiesOf } from '@storybook/react'; +import { action, decorateAction } from '@storybook/addon-actions'; + +const firstArgAction = decorateAction([ + args => args.slice(0, 1) +]); + +storiesOf('Button', module) + .add('action', () => ( + + )) + .add('decorated action', () => ( + + )); diff --git a/types/storybook__addon-actions/tsconfig.json b/types/storybook__addon-actions/tsconfig.json new file mode 100644 index 0000000000..1e05a92628 --- /dev/null +++ b/types/storybook__addon-actions/tsconfig.json @@ -0,0 +1,28 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "dom", + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "jsx": "react", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "paths": { + "@storybook/addon-actions": ["storybook__addon-actions"], + "@storybook/react": ["storybook__react"] + } + }, + "files": [ + "index.d.ts", + "storybook__addon-actions-tests.tsx" + ] +} diff --git a/types/storybook__addon-actions/tslint.json b/types/storybook__addon-actions/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/storybook__addon-actions/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From c176e0bedcf36f66029ed38d2de955d0017126e4 Mon Sep 17 00:00:00 2001 From: Joscha Feth Date: Mon, 26 Jun 2017 18:13:32 +0200 Subject: [PATCH 039/118] remove path mapping --- types/storybook__addon-actions/tsconfig.json | 1 - 1 file changed, 1 deletion(-) diff --git a/types/storybook__addon-actions/tsconfig.json b/types/storybook__addon-actions/tsconfig.json index 1e05a92628..00d0b235e5 100644 --- a/types/storybook__addon-actions/tsconfig.json +++ b/types/storybook__addon-actions/tsconfig.json @@ -17,7 +17,6 @@ "noEmit": true, "forceConsistentCasingInFileNames": true, "paths": { - "@storybook/addon-actions": ["storybook__addon-actions"], "@storybook/react": ["storybook__react"] } }, From 63dca8150f09650b8db24a2fe0c54b579fd302db Mon Sep 17 00:00:00 2001 From: Joscha Feth Date: Mon, 26 Jun 2017 18:19:38 +0200 Subject: [PATCH 040/118] make tests pass --- .../storybook__addon-actions-tests.tsx | 2 ++ types/storybook__addon-actions/tsconfig.json | 5 +---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/types/storybook__addon-actions/storybook__addon-actions-tests.tsx b/types/storybook__addon-actions/storybook__addon-actions-tests.tsx index 837a4ba214..77ba80985b 100644 --- a/types/storybook__addon-actions/storybook__addon-actions-tests.tsx +++ b/types/storybook__addon-actions/storybook__addon-actions-tests.tsx @@ -1,3 +1,5 @@ +/// + import * as React from 'react'; import { storiesOf } from '@storybook/react'; import { action, decorateAction } from '@storybook/addon-actions'; diff --git a/types/storybook__addon-actions/tsconfig.json b/types/storybook__addon-actions/tsconfig.json index 00d0b235e5..e22f8849a3 100644 --- a/types/storybook__addon-actions/tsconfig.json +++ b/types/storybook__addon-actions/tsconfig.json @@ -15,10 +15,7 @@ ], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": true, - "paths": { - "@storybook/react": ["storybook__react"] - } + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", From f78f1e3523c950048982aca90d17efb4ba90795a Mon Sep 17 00:00:00 2001 From: rzymek Date: Mon, 26 Jun 2017 18:22:03 +0200 Subject: [PATCH 041/118] lodash - Add _.multiply --- types/lodash/index.d.ts | 28 ++++++++++++++++++++++++++++ types/lodash/lodash-tests.ts | 17 +++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/types/lodash/index.d.ts b/types/lodash/index.d.ts index 6326773899..9e58196fd1 100644 --- a/types/lodash/index.d.ts +++ b/types/lodash/index.d.ts @@ -13543,6 +13543,34 @@ declare namespace _ { ): T; } + //_.multiply + interface LoDashStatic { + /** + * Multiply two numbers. + * @param multiplier The first number in a multiplication. + * @param multiplicand The second number in a multiplication. + * @returns Returns the product. + */ + multiply( + multiplier: number, + multiplicand: number + ): number; + } + + interface LoDashImplicitWrapper { + /** + * @see _.multiply + */ + multiply(multiplicand: number): number; + } + + interface LoDashExplicitWrapper { + /** + * @see _.multiply + */ + multiply(multiplicand: number): LoDashExplicitWrapper; + } + //_.round interface LoDashStatic { /** diff --git a/types/lodash/lodash-tests.ts b/types/lodash/lodash-tests.ts index b260df8ee5..311d5078c9 100644 --- a/types/lodash/lodash-tests.ts +++ b/types/lodash/lodash-tests.ts @@ -7937,6 +7937,23 @@ namespace TestMinBy { result = _(dictionary).minBy<{a: number}, number>({a: 42}); } +// _.multiply +namespace TestMultiply { + { + let result: number; + + result = _.multiply(6, 4); + + result = _(6).multiply(4); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(6).chain().multiply(4); + } +} + // _.round namespace TestRound { { From 2160e7b86f8ab70daf07f7bac3ad0dfcc1982fdf Mon Sep 17 00:00:00 2001 From: rzymek Date: Mon, 26 Jun 2017 18:12:46 +0200 Subject: [PATCH 042/118] lodash - Add _.divide --- types/lodash/divide/index.d.ts | 2 ++ types/lodash/index.d.ts | 29 +++++++++++++++++++++++++++++ types/lodash/lodash-tests.ts | 17 +++++++++++++++++ types/lodash/tsconfig.json | 1 + 4 files changed, 49 insertions(+) create mode 100644 types/lodash/divide/index.d.ts diff --git a/types/lodash/divide/index.d.ts b/types/lodash/divide/index.d.ts new file mode 100644 index 0000000000..2df6f40e3a --- /dev/null +++ b/types/lodash/divide/index.d.ts @@ -0,0 +1,2 @@ +import { divide } from "../index"; +export = divide; diff --git a/types/lodash/index.d.ts b/types/lodash/index.d.ts index 6326773899..5d203ebb6d 100644 --- a/types/lodash/index.d.ts +++ b/types/lodash/index.d.ts @@ -13198,6 +13198,35 @@ declare namespace _ { ceil(precision?: number): LoDashExplicitWrapper; } + //_.divide + interface LoDashStatic { + /** + * Divide two numbers. + * + * @param dividend The first number in a division. + * @param divisor The second number in a division. + * @returns Returns the quotient. + */ + divide( + dividend: number, + divisor: number + ): number; + } + + interface LoDashImplicitWrapper { + /** + * @see _.divide + */ + divide(divisor: number): number; + } + + interface LoDashExplicitWrapper { + /** + * @see _.divide + */ + divide(divisor: number): LoDashExplicitWrapper; + } + //_.floor interface LoDashStatic { /** diff --git a/types/lodash/lodash-tests.ts b/types/lodash/lodash-tests.ts index b260df8ee5..f3c1b22495 100644 --- a/types/lodash/lodash-tests.ts +++ b/types/lodash/lodash-tests.ts @@ -7789,6 +7789,23 @@ namespace TestCeil { } } +// _.divide +namespace TestDivide { + { + let result: number; + + result = _.divide(6, 4); + + result = _(6).divide(4); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(6).chain().floor(4); + } +} + // _.floor namespace TestFloor { { diff --git a/types/lodash/tsconfig.json b/types/lodash/tsconfig.json index 419b6142b1..864cc03249 100644 --- a/types/lodash/tsconfig.json +++ b/types/lodash/tsconfig.json @@ -19,6 +19,7 @@ "capitalize/index.d.ts", "castArray/index.d.ts", "ceil/index.d.ts", + "divide/index.d.ts", "chain/index.d.ts", "chunk/index.d.ts", "clamp/index.d.ts", From e57c630919234111329e5a0b306e281c11fef936 Mon Sep 17 00:00:00 2001 From: rzymek Date: Mon, 26 Jun 2017 18:36:18 +0200 Subject: [PATCH 043/118] lodash - Enabled _.flow & _.flowRight to accept an array of functions --- types/lodash/index.d.ts | 23 ++++++++++++++++++++++- types/lodash/lodash-tests.ts | 7 +++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/types/lodash/index.d.ts b/types/lodash/index.d.ts index 6326773899..282a98d789 100644 --- a/types/lodash/index.d.ts +++ b/types/lodash/index.d.ts @@ -189,7 +189,7 @@ Misc: - [ ] _.extendWith as an alias of _.assignInWith - [ ] Added clear method to _.memoize.Cache - [ ] Added support for ES6 maps, sets, & symbols to _.clone, _.isEqual, & _.toArray -- [ ] Enabled _.flow & _.flowRight to accept an array of functions +- [x] Enabled _.flow & _.flowRight to accept an array of functions - [ ] Ensured “Collection” methods treat functions as objects - [ ] Ensured _.assign, _.defaults, & _.merge coerce object values to objects - [ ] Ensured _.bindKey bound functions call object[key] when called with the new operator @@ -10475,6 +10475,7 @@ declare namespace _ { flow(f1: (a1: A1, a2: A2, a3: A3, a4: A4) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7): (a1: A1, a2: A2, a3: A3, a4: A4) => R7; // generic function flow(...funcs: Function[]): TResult; + flow(funcs: Function[]): TResult; } interface LoDashImplicitObjectWrapper { @@ -10482,6 +10483,10 @@ declare namespace _ { * @see _.flow */ flow(...funcs: Function[]): LoDashImplicitObjectWrapper; + /** + * @see _.flow + */ + flow(funcs: Function[]): LoDashImplicitObjectWrapper; } interface LoDashExplicitObjectWrapper { @@ -10489,6 +10494,10 @@ declare namespace _ { * @see _.flow */ flow(...funcs: Function[]): LoDashExplicitObjectWrapper; + /** + * @see _.flow + */ + flow(funcs: Function[]): LoDashExplicitObjectWrapper; } //_.flowRight @@ -10501,6 +10510,10 @@ declare namespace _ { * @return Returns the new function. */ flowRight(...funcs: Function[]): TResult; + /** + * @see _.flowRight + */ + flowRight(funcs: Function[]): TResult; } interface LoDashImplicitObjectWrapper { @@ -10508,6 +10521,10 @@ declare namespace _ { * @see _.flowRight */ flowRight(...funcs: Function[]): LoDashImplicitObjectWrapper; + /** + * @see _.flowRight + */ + flowRight(funcs: Function[]): LoDashImplicitObjectWrapper; } interface LoDashExplicitObjectWrapper { @@ -10515,6 +10532,10 @@ declare namespace _ { * @see _.flowRight */ flowRight(...funcs: Function[]): LoDashExplicitObjectWrapper; + /** + * @see _.flowRight + */ + flowRight(funcs: Function[]): LoDashExplicitObjectWrapper; } diff --git a/types/lodash/lodash-tests.ts b/types/lodash/lodash-tests.ts index b260df8ee5..b504e73288 100644 --- a/types/lodash/lodash-tests.ts +++ b/types/lodash/lodash-tests.ts @@ -5823,6 +5823,7 @@ namespace TestFlow { result = _.flow(Fn2, Fn1, Fn1, Fn1, Fn1, Fn1); result = _.flow(Fn2, Fn1, Fn1, Fn1, Fn1, Fn1, Fn1); result = _.flow(Fn2, Fn1, Fn3, Fn4); + result = _.flow<(m: number, n: number) => number>([Fn2, Fn1, Fn3, Fn4]); } { @@ -5831,6 +5832,7 @@ namespace TestFlow { result = _.flow<(m: number, n: number) => number>(Fn1, Fn2); result = _.flow<(m: number, n: number) => number>(Fn1, Fn1, Fn2); result = _.flow<(m: number, n: number) => number>(Fn1, Fn1, Fn1, Fn2); + result = _.flow<(m: number, n: number) => number>([Fn1, Fn1, Fn1, Fn2]); } { @@ -5839,6 +5841,7 @@ namespace TestFlow { result = _(Fn1).flow<(m: number, n: number) => number>(Fn2); result = _(Fn1).flow<(m: number, n: number) => number>(Fn1, Fn2); result = _(Fn1).flow<(m: number, n: number) => number>(Fn1, Fn1, Fn2); + result = _(Fn1).flow<(m: number, n: number) => number>([Fn1, Fn1, Fn2]); } { @@ -5847,6 +5850,7 @@ namespace TestFlow { result = _(Fn1).chain().flow<(m: number, n: number) => number>(Fn2); result = _(Fn1).chain().flow<(m: number, n: number) => number>(Fn1, Fn2); result = _(Fn1).chain().flow<(m: number, n: number) => number>(Fn1, Fn1, Fn2); + result = _(Fn1).chain().flow<(m: number, n: number) => number>([Fn1, Fn1, Fn2]); } } @@ -5861,6 +5865,7 @@ namespace TestFlowRight { result = _.flowRight<(m: number, n: number) => number>(Fn1, Fn2); result = _.flowRight<(m: number, n: number) => number>(Fn1, Fn1, Fn2); result = _.flowRight<(m: number, n: number) => number>(Fn1, Fn1, Fn1, Fn2); + result = _.flowRight<(m: number, n: number) => number>([Fn1, Fn1, Fn1, Fn2]); } { @@ -5869,6 +5874,7 @@ namespace TestFlowRight { result = _(Fn1).flowRight<(m: number, n: number) => number>(Fn2); result = _(Fn1).flowRight<(m: number, n: number) => number>(Fn1, Fn2); result = _(Fn1).flowRight<(m: number, n: number) => number>(Fn1, Fn1, Fn2); + result = _(Fn1).flowRight<(m: number, n: number) => number>([Fn1, Fn1, Fn2]); } { @@ -5877,6 +5883,7 @@ namespace TestFlowRight { result = _(Fn1).chain().flowRight<(m: number, n: number) => number>(Fn2); result = _(Fn1).chain().flowRight<(m: number, n: number) => number>(Fn1, Fn2); result = _(Fn1).chain().flowRight<(m: number, n: number) => number>(Fn1, Fn1, Fn2); + result = _(Fn1).chain().flowRight<(m: number, n: number) => number>([Fn1, Fn1, Fn2]); } } From 0a2007983a7d9812fce2f1cd6e4acdd1aec25727 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Mon, 26 Jun 2017 11:21:36 -0700 Subject: [PATCH 044/118] createElement splits SVG/HTML props based on type parameter This is required for 2.4 to avoid a weak type error since DOMAttributes is a weak type. --- types/react/index.d.ts | 16 +++++++++++----- types/react/test/index.ts | 2 ++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/types/react/index.d.ts b/types/react/index.d.ts index b0356ae4b6..99e9de616f 100644 --- a/types/react/index.d.ts +++ b/types/react/index.d.ts @@ -136,8 +136,12 @@ declare namespace React { type: ClassType): CFactory; function createFactory

(type: ComponentClass

): Factory

; - function createElement

, T extends Element>( - type: string, + function createElement

, T extends Element>( + type: keyof ReactHTML, + props?: ClassAttributes & P, + ...children: ReactNode[]): DOMElement; + function createElement

, T extends Element>( + type: keyof ReactSVG, props?: ClassAttributes & P, ...children: ReactNode[]): DOMElement; function createElement

( @@ -2526,8 +2530,7 @@ declare namespace React { // React.DOM // ---------------------------------------------------------------------- - interface ReactDOM { - // HTML + interface ReactHTML { a: HTMLFactory; abbr: HTMLFactory; address: HTMLFactory; @@ -2641,8 +2644,9 @@ declare namespace React { "var": HTMLFactory; video: HTMLFactory; wbr: HTMLFactory; + } - // SVG + interface ReactSVG { svg: SVGFactory; animate: SVGFactory; circle: SVGFactory; @@ -2666,6 +2670,8 @@ declare namespace React { use: SVGFactory; } + interface ReactDOM extends ReactHTML, ReactSVG { } + // // React.PropTypes // ---------------------------------------------------------------------- diff --git a/types/react/test/index.ts b/types/react/test/index.ts index 77e46e49aa..27acc07d34 100644 --- a/types/react/test/index.ts +++ b/types/react/test/index.ts @@ -190,6 +190,8 @@ var classicElement: React.ClassicElement = React.createElement(ClassicComponent, props); var domElement: React.ReactHTMLElement = React.createElement("div"); +var htmlElement = React.createElement("input", { type: "text" }); +var svgElement = React.createElement("svg", { accentHeight: 12 }); // React.cloneElement var clonedElement: React.CElement = From d937ac72392faaf31e0c1e4af1a816429e94d62f Mon Sep 17 00:00:00 2001 From: Kyle Roach Date: Mon, 26 Jun 2017 14:46:20 -0400 Subject: [PATCH 045/118] Added react-native-vector-icons definitions --- types/react-native-vector-icons/Entypo.d.ts | 2 + .../react-native-vector-icons/EvilIcons.d.ts | 2 + .../FontAwesome.d.ts | 2 + .../react-native-vector-icons/Foundation.d.ts | 2 + types/react-native-vector-icons/Icon.d.ts | 197 ++++++++++++++++++ types/react-native-vector-icons/Ionicons.d.ts | 2 + .../MaterialCommunityIcons.d.ts | 2 + .../MaterialIcons.d.ts | 2 + types/react-native-vector-icons/Octicons.d.ts | 2 + .../SimpleLineIcons.d.ts | 2 + types/react-native-vector-icons/Zocial.d.ts | 2 + types/react-native-vector-icons/index.d.ts | 61 ++++++ .../react-native-vector-icons-tests.tsx | 30 +++ types/react-native-vector-icons/tsconfig.json | 35 ++++ types/react-native-vector-icons/tslint.json | 1 + 15 files changed, 344 insertions(+) create mode 100644 types/react-native-vector-icons/Entypo.d.ts create mode 100644 types/react-native-vector-icons/EvilIcons.d.ts create mode 100644 types/react-native-vector-icons/FontAwesome.d.ts create mode 100644 types/react-native-vector-icons/Foundation.d.ts create mode 100644 types/react-native-vector-icons/Icon.d.ts create mode 100644 types/react-native-vector-icons/Ionicons.d.ts create mode 100644 types/react-native-vector-icons/MaterialCommunityIcons.d.ts create mode 100644 types/react-native-vector-icons/MaterialIcons.d.ts create mode 100644 types/react-native-vector-icons/Octicons.d.ts create mode 100644 types/react-native-vector-icons/SimpleLineIcons.d.ts create mode 100644 types/react-native-vector-icons/Zocial.d.ts create mode 100644 types/react-native-vector-icons/index.d.ts create mode 100644 types/react-native-vector-icons/react-native-vector-icons-tests.tsx create mode 100644 types/react-native-vector-icons/tsconfig.json create mode 100644 types/react-native-vector-icons/tslint.json diff --git a/types/react-native-vector-icons/Entypo.d.ts b/types/react-native-vector-icons/Entypo.d.ts new file mode 100644 index 0000000000..b4e8bbc633 --- /dev/null +++ b/types/react-native-vector-icons/Entypo.d.ts @@ -0,0 +1,2 @@ +import { Icon } from './Icon'; +export default Icon; diff --git a/types/react-native-vector-icons/EvilIcons.d.ts b/types/react-native-vector-icons/EvilIcons.d.ts new file mode 100644 index 0000000000..b4e8bbc633 --- /dev/null +++ b/types/react-native-vector-icons/EvilIcons.d.ts @@ -0,0 +1,2 @@ +import { Icon } from './Icon'; +export default Icon; diff --git a/types/react-native-vector-icons/FontAwesome.d.ts b/types/react-native-vector-icons/FontAwesome.d.ts new file mode 100644 index 0000000000..b4e8bbc633 --- /dev/null +++ b/types/react-native-vector-icons/FontAwesome.d.ts @@ -0,0 +1,2 @@ +import { Icon } from './Icon'; +export default Icon; diff --git a/types/react-native-vector-icons/Foundation.d.ts b/types/react-native-vector-icons/Foundation.d.ts new file mode 100644 index 0000000000..b4e8bbc633 --- /dev/null +++ b/types/react-native-vector-icons/Foundation.d.ts @@ -0,0 +1,2 @@ +import { Icon } from './Icon'; +export default Icon; diff --git a/types/react-native-vector-icons/Icon.d.ts b/types/react-native-vector-icons/Icon.d.ts new file mode 100644 index 0000000000..3ae4916eea --- /dev/null +++ b/types/react-native-vector-icons/Icon.d.ts @@ -0,0 +1,197 @@ +import * as React from 'react'; +import { + TextStyle, + ViewStyle, + TextProperties, + TouchableHighlightProperties, + TouchableNativeFeedbackProperties, + TabBarIOSProperties, + ToolbarAndroidProperties +} from 'react-native'; + +export interface IconProps extends TextProperties { + /** + * Size of the icon, can also be passed as fontSize in the style object. + * + * @default 12 + * @type {string} + * @memberof IconProps + */ + size?: number; + + /** + * Name of the icon to show + * + * See Icon Explorer app + * {@link https://github.com/oblador/react-native-vector-icons/tree/master/Examples/IconExplorer} + * @type {string} + * @memberof IconProps + */ + name: string; + + /** + * Color of the icon + * + * @type {string} + * @memberof IconProps + */ + color?: string; +} + +export interface IconButtonProps extends IconProps, TouchableHighlightProperties, TouchableNativeFeedbackProperties { + /** + * Text and icon color + * Use iconStyle or nest a Text component if you need different colors. + * + * @default 'white' + * @type {string} + * @memberof IconButtonProps + */ + color?: string; + + /** + * Border radius of the button + * Set to 0 to disable. + * + * @default 5 + * @type {number} + * @memberof IconButtonProps + */ + borderRadius?: number; + + /** + * Styles applied to the icon only + * Good for setting margins or a different color. + * + * @default {marginRight: 10} + * @type {ViewStyle} + * @memberof IconButtonProps + */ + iconStyle?: ViewStyle; + + /** + * Style prop inherited from TextProperties and TouchableWithoutFeedbackProperties + * Only exist here so we can have ViewStyle or TextStyle + * + * @type {(ViewStyle | TextStyle)} + * @memberof IconButtonProps + */ + style?: ViewStyle | TextStyle; + + /** + * Background color of the button + * + * @default '#007AFF' + * @type {string} + * @memberof IconButtonProps + */ + backgroundColor?: string; +} + +export type ImageSource = any; + +export interface TabBarIOSProps extends TabBarIOSProperties { + /** + * Name of the default icon (similar to TabBarIOS.Item icon) + * + * @type {string} + * @memberof TabBarIOSProps + */ + iconName: string; + + /** + * Name of the selected icon (similar to TabBarIOS.Item selectedIcon). + * + * @default iconName + * @type {string} + * @memberof TabBarIOSProps + */ + selectedIconName: string; + + /** + * Size of the icon. + * + * @default 30 + * @type {number} + * @memberof TabBarIOSProps + */ + iconSize: number; + + /** + * Color of the icon + * + * @type {string} + * @memberof TabBarIOSProps + */ + iconColor: string; + + /** + * Color of the selected icon. + * + * @default iconColor + * @type {string} + * @memberof TabBarIOSProps + */ + selectedIconColor: string; +} + +export interface ToolbarAndroidProps extends ToolbarAndroidProperties { + /** + * Name of the navigation logo icon + * (similar to ToolbarAndroid logo) + * + * @type {string} + * @memberof ToolbarAndroidProps + */ + logoName: string; + + /** + * Name of the navigation icon + * (similar to ToolbarAndroid navIcon) + * + * @type {string} + * @memberof ToolbarAndroidProps + */ + navIconName: string; + + /** + * Name of the overflow icon + * (similar to ToolbarAndroid overflowIcon) + * + * @type {string} + * @memberof ToolbarAndroidProps + */ + overflowIconName: string; + + /** + * Size of the icons + * + * @default 24 + * @type {number} + * @memberof ToolbarAndroidProps + */ + iconSize: number; + + /** + * Color of the icons + * + * @default 'black' + * @type {string} + * @memberof ToolbarAndroidProps + */ + iconColor: string; +} + +export class Icon extends React.Component { + static getImageSource( + name: string, + color: string, + size?: number + ): Promise; +} + +export namespace Icon { + class ToolbarAndroid extends React.Component {} + class TabBarIOS extends React.Component {} + class Button extends React.Component {} +} diff --git a/types/react-native-vector-icons/Ionicons.d.ts b/types/react-native-vector-icons/Ionicons.d.ts new file mode 100644 index 0000000000..b4e8bbc633 --- /dev/null +++ b/types/react-native-vector-icons/Ionicons.d.ts @@ -0,0 +1,2 @@ +import { Icon } from './Icon'; +export default Icon; diff --git a/types/react-native-vector-icons/MaterialCommunityIcons.d.ts b/types/react-native-vector-icons/MaterialCommunityIcons.d.ts new file mode 100644 index 0000000000..b4e8bbc633 --- /dev/null +++ b/types/react-native-vector-icons/MaterialCommunityIcons.d.ts @@ -0,0 +1,2 @@ +import { Icon } from './Icon'; +export default Icon; diff --git a/types/react-native-vector-icons/MaterialIcons.d.ts b/types/react-native-vector-icons/MaterialIcons.d.ts new file mode 100644 index 0000000000..b4e8bbc633 --- /dev/null +++ b/types/react-native-vector-icons/MaterialIcons.d.ts @@ -0,0 +1,2 @@ +import { Icon } from './Icon'; +export default Icon; diff --git a/types/react-native-vector-icons/Octicons.d.ts b/types/react-native-vector-icons/Octicons.d.ts new file mode 100644 index 0000000000..b4e8bbc633 --- /dev/null +++ b/types/react-native-vector-icons/Octicons.d.ts @@ -0,0 +1,2 @@ +import { Icon } from './Icon'; +export default Icon; diff --git a/types/react-native-vector-icons/SimpleLineIcons.d.ts b/types/react-native-vector-icons/SimpleLineIcons.d.ts new file mode 100644 index 0000000000..b4e8bbc633 --- /dev/null +++ b/types/react-native-vector-icons/SimpleLineIcons.d.ts @@ -0,0 +1,2 @@ +import { Icon } from './Icon'; +export default Icon; diff --git a/types/react-native-vector-icons/Zocial.d.ts b/types/react-native-vector-icons/Zocial.d.ts new file mode 100644 index 0000000000..b4e8bbc633 --- /dev/null +++ b/types/react-native-vector-icons/Zocial.d.ts @@ -0,0 +1,2 @@ +import { Icon } from './Icon'; +export default Icon; diff --git a/types/react-native-vector-icons/index.d.ts b/types/react-native-vector-icons/index.d.ts new file mode 100644 index 0000000000..d46847b1ae --- /dev/null +++ b/types/react-native-vector-icons/index.d.ts @@ -0,0 +1,61 @@ +// Type definitions for react-native-vector-icons 4.2 +// Project: https://github.com/oblador/react-native-vector-icons +// Definitions by: Kyle Roach +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import * as React from 'react'; +import { Icon } from './Icon'; +import { TextProperties } from 'react-native'; + +/** + * Returns your own custom font based on the glyphMap where the key is the icon name + * and the value is either a UTF-8 character or it's character code. fontFamily is the name + * of the font NOT the filename. Open the font in Font Book.app or similar to learn the name. + * Optionally pass the third fontFile argument for android support, it should be a path + * to the font file in you asset folder. + * + * @param glyphMap + * @param fontFamily + * @param fontFile + */ +export function createIconSet( + glyphMap: {}, + fontFamily: string, + fontFile?: string +): Icon; + +/** + * Convenience method to create a custom font based on a fontello config file. + * Don't forget to import the font as described above and drop the config.json + * somewhere convenient in your project. + * + * Example usage + * import { createIconSetFromFontello } from 'react-native-vector-icons'; + * import fontelloConfig from './config.json'; + * const Icon = createIconSetFromFontello(fontelloConfig); + * + * @see http://fontello.com + * @export + * @param {{}} config + * @returns {Icon} + */ +export function createIconSetFromFontello(config: {}): Icon; + +/** + * Convenience method to create a custom font from IcoMoon + * Make sure you're using the Download option in IcoMoon, and use the .json file that's + * included in the .zip you've downloaded. You'll also need to import the .ttf font + * file into your project + * + * Example usage + * import { createIconSetFromIcoMoon } from 'react-native-vector-icons'; + * import icoMoonConfig from './config.json'; + * const Icon = createIconSetFromIcoMoon(icoMoonConfig); + * + * @see https://icomoon.io/app + * @export + * @param {{}} config + * @returns {Icon} + */ +export function createIconSetFromIcoMoon(config: {}): Icon; 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 new file mode 100644 index 0000000000..270c8fbdc4 --- /dev/null +++ b/types/react-native-vector-icons/react-native-vector-icons-tests.tsx @@ -0,0 +1,30 @@ +import * as React from 'react'; +import { View, Text } from 'react-native'; +import MaterialIcon from 'react-native-vector-icons/MaterialIcons'; +import FontAwesomeIcon from 'react-native-vector-icons/FontAwesome'; + +class Example extends React.Component<{}, {}> { + handleButton() { + console.log('You pressed me'); + } + + render() { + return ( + + {/* Normal Icon */} + + + {/* Icon button */} + this.handleButton()} + > + + Login with Facebook + + + + ); + } +} diff --git a/types/react-native-vector-icons/tsconfig.json b/types/react-native-vector-icons/tsconfig.json new file mode 100644 index 0000000000..746ae7e0ff --- /dev/null +++ b/types/react-native-vector-icons/tsconfig.json @@ -0,0 +1,35 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "dom", + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react" + }, + "files": [ + "index.d.ts", + "Icon.d.ts", + "Entypo.d.ts", + "EvilIcons.d.ts", + "FontAwesome.d.ts", + "Foundation.d.ts", + "Ionicons.d.ts", + "MaterialCommunityIcons.d.ts", + "MaterialIcons.d.ts", + "Octicons.d.ts", + "SimpleLineIcons.d.ts", + "Zocial.d.ts", + "react-native-vector-icons-tests.tsx" + ] +} diff --git a/types/react-native-vector-icons/tslint.json b/types/react-native-vector-icons/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-native-vector-icons/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From c4b70febc65857900ee5c4a4332bb219dfd2a78e Mon Sep 17 00:00:00 2001 From: amikhalev Date: Mon, 26 Jun 2017 15:21:56 -0600 Subject: [PATCH 046/118] Added string literal types for @types/semver --- types/semver/index.d.ts | 8 +++++--- types/semver/semver-tests.ts | 18 +++++++++++++++--- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/types/semver/index.d.ts b/types/semver/index.d.ts index 60e7275f7a..336fa85574 100644 --- a/types/semver/index.d.ts +++ b/types/semver/index.d.ts @@ -5,6 +5,8 @@ export const SEMVER_SPEC_VERSION: "2.0.0"; +export type ReleaseType = "major" | "premajor" | "minor" | "preminor" | "patch" | "prepatch" | "prerelease"; + /** * Return the parsed version, or null if it's not valid. */ @@ -16,7 +18,7 @@ export function clean(version: string, loose?: boolean): string; /** * Return the version incremented by the release type (major, minor, patch, or prerelease), or null if it's not valid. */ -export function inc(v: string, release: string, loose?: boolean): string; +export function inc(v: string, release: ReleaseType, loose?: boolean): string; /** * Return the major version number. */ @@ -76,7 +78,7 @@ export function rcompare(v1: string, v2: string, loose?: boolean): number; /** * Returns difference between two versions by the release type (major, premajor, minor, preminor, patch, prepatch, or prerelease), or null if the versions are the same. */ -export function diff(v1: string, v2: string, loose?: boolean): string; +export function diff(v1: string, v2: string, loose?: boolean): ReleaseType; // Ranges /** @@ -127,7 +129,7 @@ export class SemVer { compare(other: SemVer): number; compareMain(other: SemVer): number; comparePre(other: SemVer): number; - inc(release: string): SemVer; + inc(release: ReleaseType): SemVer; } export class Comparator { diff --git a/types/semver/semver-tests.ts b/types/semver/semver-tests.ts index b7a1299ad3..42088eef4d 100644 --- a/types/semver/semver-tests.ts +++ b/types/semver/semver-tests.ts @@ -4,7 +4,7 @@ let obj: {}; let bool: boolean; let num: number; let str: string; -let diff: string; +let diff: semver.ReleaseType; let x: any = null; let arr: any[]; let exp: RegExp; @@ -22,7 +22,13 @@ str = semver.clean(str); str = semver.valid(str, loose); str = semver.clean(str, loose); -str = semver.inc(str, str, loose); +str = semver.inc(str, "major", loose); +str = semver.inc(str, "premajor", loose); +str = semver.inc(str, "minor", loose); +str = semver.inc(str, "preminor", loose); +str = semver.inc(str, "patch", loose); +str = semver.inc(str, "prepatch", loose); +str = semver.inc(str, "prerelease", loose); num = semver.major(str, loose); num = semver.minor(str, loose); num = semver.patch(str, loose); @@ -66,7 +72,13 @@ strArr = ver.prerelease; num = ver.compare(ver); num = ver.compareMain(ver); num = ver.comparePre(ver); -ver = ver.inc(str); +ver = ver.inc("major"); +ver = ver.inc("premajor"); +ver = ver.inc("minor"); +ver = ver.inc("preminor"); +ver = ver.inc("patch"); +ver = ver.inc("prepatch"); +ver = ver.inc("prerelease"); const comp = new semver.Comparator(str, bool); str = comp.toString(); From efc67e63d92187669026441e7c43c68a1f2ea795 Mon Sep 17 00:00:00 2001 From: Leonard Thieu Date: Mon, 26 Jun 2017 17:36:16 -0400 Subject: [PATCH 047/118] [angular][jquery] Fix merge issue with cssPropertySetter. --- types/angular/index.d.ts | 5 ++++- types/angular/jqlite.d.ts | 4 +++- types/jquery/v1/index.d.ts | 4 +++- types/jquery/v2/index.d.ts | 4 +++- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/types/angular/index.d.ts b/types/angular/index.d.ts index 4f8d55f9dc..3683c1aed6 100644 --- a/types/angular/index.d.ts +++ b/types/angular/index.d.ts @@ -1,6 +1,9 @@ // Type definitions for Angular JS 1.6 // Project: http://angularjs.org -// Definitions by: Diego Vilar , Georgii Dolzhykov , Caleb St-Denis +// Definitions by: Diego Vilar +// Georgii Dolzhykov +// Caleb St-Denis +// Leonard Thieu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 diff --git a/types/angular/jqlite.d.ts b/types/angular/jqlite.d.ts index 36509143fa..016411c848 100644 --- a/types/angular/jqlite.d.ts +++ b/types/angular/jqlite.d.ts @@ -796,7 +796,9 @@ interface JQueryEventObject extends BaseJQueryEventObject, JQueryInputEventObjec /** * The interface used to specify the properties parameter in css() */ -type cssPropertySetter = (index: number, value?: string) => string | number; +interface cssPropertySetter { + (index: number, value?: string): string | number; +} interface JQueryCssProperties { [propertyName: string]: string | number | cssPropertySetter; } diff --git a/types/jquery/v1/index.d.ts b/types/jquery/v1/index.d.ts index a3c2d42979..ee66781019 100644 --- a/types/jquery/v1/index.d.ts +++ b/types/jquery/v1/index.d.ts @@ -702,7 +702,9 @@ interface JQueryCoordinates { /** * The interface used to specify the properties parameter in css() */ -type cssPropertySetter = (index: number, value?: string) => string | number; +interface cssPropertySetter { + (index: number, value?: string): string | number; +} interface JQueryCssProperties { [propertyName: string]: string | number | cssPropertySetter; } diff --git a/types/jquery/v2/index.d.ts b/types/jquery/v2/index.d.ts index b01e4ceda7..9d30f12c38 100644 --- a/types/jquery/v2/index.d.ts +++ b/types/jquery/v2/index.d.ts @@ -702,7 +702,9 @@ interface JQueryCoordinates { /** * The interface used to specify the properties parameter in css() */ -type cssPropertySetter = (index: number, value?: string) => string | number; +interface cssPropertySetter { + (index: number, value?: string): string | number; +} interface JQueryCssProperties { [propertyName: string]: string | number | cssPropertySetter; } From af76b010ba6445595185d435dc1730c92488c7ba Mon Sep 17 00:00:00 2001 From: Selkin Vitaly Date: Tue, 27 Jun 2017 00:39:59 +0300 Subject: [PATCH 048/118] added types for bem-cn --- types/bem-cn/bem-cn-tests.ts | 46 ++++++++++++++++++++++++++++++++++++ types/bem-cn/index.d.ts | 41 ++++++++++++++++++++++++++++++++ types/bem-cn/tsconfig.json | 22 +++++++++++++++++ types/bem-cn/tslint.json | 3 +++ 4 files changed, 112 insertions(+) create mode 100644 types/bem-cn/bem-cn-tests.ts create mode 100644 types/bem-cn/index.d.ts create mode 100644 types/bem-cn/tsconfig.json create mode 100644 types/bem-cn/tslint.json diff --git a/types/bem-cn/bem-cn-tests.ts b/types/bem-cn/bem-cn-tests.ts new file mode 100644 index 0000000000..d57e138777 --- /dev/null +++ b/types/bem-cn/bem-cn-tests.ts @@ -0,0 +1,46 @@ +import * as block from "bem-cn"; + +// expected 'block' +block("block")(); + +// expected 'block__elem' +block("block")("elem")(); + +// expected 'block__elem block__elem_disabled block__elem_size_small' +block("block")("elem", { disabled: true, size: 'small' })(); + +// expected 'block block_disabled' +block("block")({ disabled: true})(); + +// expected 'block mix' +block("block").mix("mix"); + +// expected 'block mix mix2' +block("block").mix(["mix", "mix2"]); + +// expected 'block is-hidden' +block("block").state({ hidden: true }); + +// expected 'block' +block("block").state({ hidden: false }); + +// expected 'block is-hidden is-error' +block("block").state({ hidden: true, error: true }); + +// expected 'block is-loading' +block("block").is({ loading: true }); + +// expected 'block has-content' +block("block").has({ content: true }); + +block.setup({ + el: '~~', + mod: '--', + modValue: '-' +}); + +// expected 'block~~elem' +block("block")("elem"); + +// expected 'block block--mod-value' +block("block")({ mod: "value"}); diff --git a/types/bem-cn/index.d.ts b/types/bem-cn/index.d.ts new file mode 100644 index 0000000000..5a78df4435 --- /dev/null +++ b/types/bem-cn/index.d.ts @@ -0,0 +1,41 @@ +// Type definitions for bem-cn 2.1 +// Project: https://github.com/albburtsev/bem-cn +// Definitions by: Vitaly Selkin +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +type StateFn = (states: { [key: string]: boolean }) => Inner; + +interface Modifications { + [key: string]: (string | boolean); +} + +interface Block { + (name: string): Inner; + + reset(): void; + setup(settings?: Settings): void; +} + +interface Inner { + (elem: string | Modifications): Inner; + (elem: string, mods: Modifications): Inner; + (): string; + + mix(mixes: string | string[]): Inner; + has: StateFn; + state: StateFn; + is: StateFn; + toString(): string; + split(separator: string, limit?: number): string[]; +} + +interface Settings { + ns?: string; + el?: string; + mod?: string; + modValue?: string; + classMap?: { [className: string]: string } | null; +} + +declare const block: Block; +export = block; diff --git a/types/bem-cn/tsconfig.json b/types/bem-cn/tsconfig.json new file mode 100644 index 0000000000..a4c2cd86cb --- /dev/null +++ b/types/bem-cn/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", + "bem-cn-tests.ts" + ] +} diff --git a/types/bem-cn/tslint.json b/types/bem-cn/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/bem-cn/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} From e6a401f7dafb11114e07cf6a4b2c8528da639452 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Mon, 26 Jun 2017 14:48:23 -0700 Subject: [PATCH 049/118] React.createElement has more specific return types --- types/react/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/react/index.d.ts b/types/react/index.d.ts index 99e9de616f..c70dbaa3fa 100644 --- a/types/react/index.d.ts +++ b/types/react/index.d.ts @@ -136,14 +136,14 @@ declare namespace React { type: ClassType): CFactory; function createFactory

(type: ComponentClass

): Factory

; - function createElement

, T extends Element>( + function createElement

, T extends HTMLElement>( type: keyof ReactHTML, props?: ClassAttributes & P, - ...children: ReactNode[]): DOMElement; + ...children: ReactNode[]): ReactHTMLElement; function createElement

, T extends Element>( type: keyof ReactSVG, props?: ClassAttributes & P, - ...children: ReactNode[]): DOMElement; + ...children: ReactNode[]): ReactSVGElement; function createElement

( type: SFC

, props?: Attributes & P, From 4bbd7803bd9f2faba8cb22333b763ed82d2549f0 Mon Sep 17 00:00:00 2001 From: Leonard Thieu Date: Mon, 26 Jun 2017 17:55:25 -0400 Subject: [PATCH 050/118] [angular][jquery] Workaround duplicate index signature. --- types/angular/jqlite.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/angular/jqlite.d.ts b/types/angular/jqlite.d.ts index 016411c848..7c8975b8bb 100644 --- a/types/angular/jqlite.d.ts +++ b/types/angular/jqlite.d.ts @@ -169,7 +169,7 @@ interface JQuery { * @param properties An object of property-value pairs to set. * @see {@link https://api.jquery.com/css/#css-properties} */ - css(properties: JQueryCssProperties): JQuery; + css(properties: JQLiteCssProperties): JQuery; /** * Store arbitrary data associated with the matched elements. @@ -799,6 +799,6 @@ interface JQueryEventObject extends BaseJQueryEventObject, JQueryInputEventObjec interface cssPropertySetter { (index: number, value?: string): string | number; } -interface JQueryCssProperties { +interface JQLiteCssProperties { [propertyName: string]: string | number | cssPropertySetter; } From 70e1029f3a6f52262ab1881e0129cfa9920fc038 Mon Sep 17 00:00:00 2001 From: Leonard Thieu Date: Mon, 26 Jun 2017 18:17:27 -0400 Subject: [PATCH 051/118] [angular] Linty --- types/angular/jqlite.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/angular/jqlite.d.ts b/types/angular/jqlite.d.ts index 7c8975b8bb..ee7d6acf1c 100644 --- a/types/angular/jqlite.d.ts +++ b/types/angular/jqlite.d.ts @@ -796,6 +796,7 @@ interface JQueryEventObject extends BaseJQueryEventObject, JQueryInputEventObjec /** * The interface used to specify the properties parameter in css() */ +// tslint:disable-next-line:class-name interface cssPropertySetter { (index: number, value?: string): string | number; } From b5eb45232a190879384e731c8b57fcf0b7cc0d92 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Mon, 26 Jun 2017 15:31:09 -0700 Subject: [PATCH 052/118] Better constraint for React.createElement for SVG --- types/react/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react/index.d.ts b/types/react/index.d.ts index c70dbaa3fa..577959ae7b 100644 --- a/types/react/index.d.ts +++ b/types/react/index.d.ts @@ -140,7 +140,7 @@ declare namespace React { type: keyof ReactHTML, props?: ClassAttributes & P, ...children: ReactNode[]): ReactHTMLElement; - function createElement

, T extends Element>( + function createElement

, T extends SVGElement>( type: keyof ReactSVG, props?: ClassAttributes & P, ...children: ReactNode[]): ReactSVGElement; From c326dd87d4549561c7008089b7a7022c91084898 Mon Sep 17 00:00:00 2001 From: Chigozirim C Date: Mon, 26 Jun 2017 18:36:35 -0500 Subject: [PATCH 053/118] node: Add cork and uncork type definitions Fixes: #16726 --- types/node/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 131dbc96a1..e9a40754d4 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -3823,6 +3823,8 @@ declare module "stream" { end(): void; end(chunk: any, cb?: Function): void; end(chunk: any, encoding?: string, cb?: Function): void; + cork(): void; + uncork(): void; /** * Event emitter From 135e6ac043cf15d01263c1d6db13c89faf676a38 Mon Sep 17 00:00:00 2001 From: Chigozirim C Date: Mon, 26 Jun 2017 18:36:35 -0500 Subject: [PATCH 054/118] node: Add cork and uncork type definitions Fixes: #16726 --- types/node/index.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 131dbc96a1..f76c3a7607 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -6,6 +6,7 @@ // Roberto Desideri // Christian Vaagland Tellnes // Wilco Bakker +// Chigozirim C. // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -3823,6 +3824,8 @@ declare module "stream" { end(): void; end(chunk: any, cb?: Function): void; end(chunk: any, encoding?: string, cb?: Function): void; + cork(): void; + uncork(): void; /** * Event emitter @@ -3908,6 +3911,8 @@ declare module "stream" { end(): void; end(chunk: any, cb?: Function): void; end(chunk: any, encoding?: string, cb?: Function): void; + cork(): void; + uncork(): void; } export interface TransformOptions extends DuplexOptions { From 67bcf68325a56630a1d33aeebe41307770c6feeb Mon Sep 17 00:00:00 2001 From: Ruslan Voronkov Date: Mon, 26 Jun 2017 10:03:19 +0300 Subject: [PATCH 055/118] Move firstDay attribute out of days object *firstDay* attribute should be in calendar object --- types/kendo-ui/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/kendo-ui/index.d.ts b/types/kendo-ui/index.d.ts index 8c58c182be..733845e514 100644 --- a/types/kendo-ui/index.d.ts +++ b/types/kendo-ui/index.d.ts @@ -16,8 +16,8 @@ declare namespace kendo { names: string[]; namesAbbr: string[]; namesShort: string[]; - firstDay: number; }; + firstDay: number; months: { names: string[]; namesAbbr: string[]; From ffd486c5373bfbac125830746a57b5b5833b515e Mon Sep 17 00:00:00 2001 From: Paul Datsiuk Date: Tue, 27 Jun 2017 10:49:28 +0300 Subject: [PATCH 056/118] add typescript definition for browser-report --- types/browser-report/browser-report-tests.ts | 13 +++++ types/browser-report/index.d.ts | 56 ++++++++++++++++++++ types/browser-report/tsconfig.json | 22 ++++++++ 3 files changed, 91 insertions(+) create mode 100644 types/browser-report/browser-report-tests.ts create mode 100644 types/browser-report/index.d.ts create mode 100644 types/browser-report/tsconfig.json diff --git a/types/browser-report/browser-report-tests.ts b/types/browser-report/browser-report-tests.ts new file mode 100644 index 0000000000..11734d810c --- /dev/null +++ b/types/browser-report/browser-report-tests.ts @@ -0,0 +1,13 @@ +import 'browser-report'; + +function test_sync() { + var browserInfo = window.browserReportSync(); + console.log(browserInfo.browser.name); +} + +function test_async() { + window.browserReport((error, result) => { + console.log(result.ip + ' ' + result.browser.name); + debugger; + }); +} \ No newline at end of file diff --git a/types/browser-report/index.d.ts b/types/browser-report/index.d.ts new file mode 100644 index 0000000000..8c7dec2b5d --- /dev/null +++ b/types/browser-report/index.d.ts @@ -0,0 +1,56 @@ +// Type definitions for browser-report v2.2.9 +// Project: https://github.com/JTOne123/browser-report +// Definitions by: Paul Datsiuk +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +interface Window { + browserReport(result: (error: ErrorEvent, report: ReportResult) => any): void; + browserReportSync(): ReportResult; +} + +interface ReportResult { + "browser": { + "name": (string), + "version": (string) + }, + "cookies": (boolean), + "flash": { + "version": (string) + }, + "ip": (string), + "country": { + "name": (string), + "code": (string), + "city": (string), + "latitude" : (string), + "longitude": (string), + "timezone": (string) + }, + "java": { + "version": (string) + }, + "lang": (Array), + "os": { + "name": (string), + "version": (string) + }, + "screen": { + "colors": (number), + "dppx": (number), + "height": (number), + "width": (number) + }, + "scripts": (boolean), + "timestamp": (string), + "userAgent": (string), + "viewport": { + "height": (number), + "layout": { + "height": (number), + "width": (number) + } + "width": (number), + "zoom": (number) + } + "websockets": (boolean) +} \ No newline at end of file diff --git a/types/browser-report/tsconfig.json b/types/browser-report/tsconfig.json new file mode 100644 index 0000000000..fa2a017bdd --- /dev/null +++ b/types/browser-report/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "browser-report-tests.ts" + ] +} \ No newline at end of file From 130cf981c3e8026d44ad835c396cccb51e7dc567 Mon Sep 17 00:00:00 2001 From: Paul Datsiuk Date: Tue, 27 Jun 2017 10:56:25 +0300 Subject: [PATCH 057/118] fix test --- types/browser-report/browser-report-tests.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/types/browser-report/browser-report-tests.ts b/types/browser-report/browser-report-tests.ts index 11734d810c..9f50b5b0f2 100644 --- a/types/browser-report/browser-report-tests.ts +++ b/types/browser-report/browser-report-tests.ts @@ -8,6 +8,5 @@ function test_sync() { function test_async() { window.browserReport((error, result) => { console.log(result.ip + ' ' + result.browser.name); - debugger; }); } \ No newline at end of file From 2a104b3dcc8c5e1d49987541033b9a33a5372e09 Mon Sep 17 00:00:00 2001 From: Paul Datsiuk Date: Tue, 27 Jun 2017 11:08:12 +0300 Subject: [PATCH 058/118] add dom lib --- types/browser-report/tsconfig.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/browser-report/tsconfig.json b/types/browser-report/tsconfig.json index fa2a017bdd..997b307339 100644 --- a/types/browser-report/tsconfig.json +++ b/types/browser-report/tsconfig.json @@ -2,7 +2,8 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6" + "es6", + "dom" ], "noImplicitAny": true, "noImplicitThis": true, From 24803718e1608c107b005a2dd250ace4302f5796 Mon Sep 17 00:00:00 2001 From: Wouter Hardeman Date: Tue, 27 Jun 2017 10:09:30 +0200 Subject: [PATCH 059/118] Removed useless props and state from react-sortable-tree-tests --- types/react-sortable-tree/react-sortable-tree-tests.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-sortable-tree/react-sortable-tree-tests.tsx b/types/react-sortable-tree/react-sortable-tree-tests.tsx index 21c18410e5..8b89db5196 100644 --- a/types/react-sortable-tree/react-sortable-tree-tests.tsx +++ b/types/react-sortable-tree/react-sortable-tree-tests.tsx @@ -15,7 +15,7 @@ import SortableTree, } from "react-sortable-tree"; import { ListProps, ListRowRenderer } from "react-virtualized"; -class Test extends React.Component { +class Test extends React.Component { render() { const treeData = [ { From d3641c0ab18b2cb2a40ac32c56c4c51bd9f92a76 Mon Sep 17 00:00:00 2001 From: Gyusun Yeom Date: Thu, 22 Jun 2017 18:27:38 +0900 Subject: [PATCH 060/118] add types for @mapbox/shelf-pack --- types/mapbox__shelf-pack/index.d.ts | 59 +++++++++++++++++++ .../mapbox__shelf-pack-tests.ts | 30 ++++++++++ types/mapbox__shelf-pack/tsconfig.json | 22 +++++++ types/mapbox__shelf-pack/tslint.json | 1 + 4 files changed, 112 insertions(+) create mode 100644 types/mapbox__shelf-pack/index.d.ts create mode 100644 types/mapbox__shelf-pack/mapbox__shelf-pack-tests.ts create mode 100644 types/mapbox__shelf-pack/tsconfig.json create mode 100644 types/mapbox__shelf-pack/tslint.json diff --git a/types/mapbox__shelf-pack/index.d.ts b/types/mapbox__shelf-pack/index.d.ts new file mode 100644 index 0000000000..3ef3ec3507 --- /dev/null +++ b/types/mapbox__shelf-pack/index.d.ts @@ -0,0 +1,59 @@ +// Type definitions for @mapbox/shelf-pack 3.0 +// Project: https://github.com/mapbox/shelf-pack +// Definitions by: Gyusun Yeom +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// tslint:disable-next-line no-single-declare-module +declare module "@mapbox/shelf-pack" { + export = ShelfPack; + + class ShelfPack { + constructor(width?: number, height?: number, options?: ShelfPack.CreateOption); + + pack(bins: Array, options?: ShelfPack.PackOption): ShelfPack.Bin[]; + packOne(w: number, h: number, id?: ShelfPack.ID): ShelfPack.Bin; + getBin(id: ShelfPack.ID): ShelfPack.Bin; + ref(bin: ShelfPack.Bin): number; + unref(bin: ShelfPack.Bin): number; + clear(): void; + resize(w: number, h: number): boolean; + + w: number; + h: number; + } + + namespace ShelfPack { + class Bin { + constructor(id: ID, x: number, y: number, w: number, h: number, maxw?: number, maxh?: number); + + id: ID; + x: number; + y: number; + w: number; + h: number; + } + + type ID = number | string; + interface Request { + id?: ID; + } + interface RequestShort extends Request { + w: number; + h: number; + } + interface RequestLong extends Request { + width: number; + height: number; + } + + interface PackOption { + /// If true , the supplied bin objects will be updated inplace with x and y properties + inPlace?: boolean; + } + + interface CreateOption { + /// If true , the sprite will automatically grow + autoResize?: boolean; + } + } +} diff --git a/types/mapbox__shelf-pack/mapbox__shelf-pack-tests.ts b/types/mapbox__shelf-pack/mapbox__shelf-pack-tests.ts new file mode 100644 index 0000000000..3baff984cb --- /dev/null +++ b/types/mapbox__shelf-pack/mapbox__shelf-pack-tests.ts @@ -0,0 +1,30 @@ +import * as ShelfPack from '@mapbox/shelf-pack'; + +let sprite = new ShelfPack(64, 64); + +for (let i = 0; i < 5; i++) { + const bin = sprite.packOne(32, 32); +} + +sprite.clear(); + +sprite.resize(128, 128); + +sprite = new ShelfPack(64, 64); + +[100, 101, 102].forEach(id => { + const bin = sprite.packOne(16, 16, id); +}); + +const bin102 = sprite.packOne(16, 16, 102); + +const bin101 = sprite.getBin(101); +sprite.ref(bin101); + +const bin100 = sprite.getBin(100); +sprite.unref(bin100); + +const bin103 = sprite.packOne(16, 15, 103); +sprite.unref(bin103); + +const bin104 = sprite.packOne(16, 16, 104); diff --git a/types/mapbox__shelf-pack/tsconfig.json b/types/mapbox__shelf-pack/tsconfig.json new file mode 100644 index 0000000000..540d660492 --- /dev/null +++ b/types/mapbox__shelf-pack/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", + "mapbox__shelf-pack-tests.ts" + ] +} diff --git a/types/mapbox__shelf-pack/tslint.json b/types/mapbox__shelf-pack/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/mapbox__shelf-pack/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From abf87f7c822b61d78c2496fe26011c4657c3765a Mon Sep 17 00:00:00 2001 From: arminbaljic Date: Tue, 27 Jun 2017 11:03:49 +0200 Subject: [PATCH 061/118] Added type definitions for iframe-resizer --- types/iframe-resizer/iframe-resizer-tests.ts | 1 + types/iframe-resizer/index.d.ts | 184 +++++++++++++++++++ types/iframe-resizer/tsconfig.json | 25 +++ types/iframe-resizer/tslint.json | 1 + 4 files changed, 211 insertions(+) create mode 100644 types/iframe-resizer/iframe-resizer-tests.ts create mode 100644 types/iframe-resizer/index.d.ts create mode 100644 types/iframe-resizer/tsconfig.json create mode 100644 types/iframe-resizer/tslint.json diff --git a/types/iframe-resizer/iframe-resizer-tests.ts b/types/iframe-resizer/iframe-resizer-tests.ts new file mode 100644 index 0000000000..1996490390 --- /dev/null +++ b/types/iframe-resizer/iframe-resizer-tests.ts @@ -0,0 +1 @@ +import resizer = require('iframe-resizer'); diff --git a/types/iframe-resizer/index.d.ts b/types/iframe-resizer/index.d.ts new file mode 100644 index 0000000000..04ff130667 --- /dev/null +++ b/types/iframe-resizer/index.d.ts @@ -0,0 +1,184 @@ +// Type definitions for iframe-resizer +// Project: https://github.com/davidjbradshaw/iframe-resizer +// Definitions by: Armin Baljic +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module 'iframe-resizer' { + export interface IFrameObject { + close(): void; + moveToAnchor(anchor): void; + resize(): void; + sendMessage(message: any): void; + } + + export interface IFrameComponent extends HTMLIFrameElement { + iFrameResizer: IFrameObject + } + + export interface IFrameOptions { + /** + * When enabled changes to the Window size or the DOM will cause the iFrame to resize to the new content size. + * Disable if using size method with custom dimensions. + */ + autoResize?: boolean; + /** + * Override the body background style in the iFrame. + */ + bodyBackground?: string; + /** + * Override the default body margin style in the iFrame. A string can be any valid value for the + * CSS margin attribute, for example '8px 3em'. A number value is converted into px. + */ + bodyMargin?: number; + /** + * When set to true, only allow incoming messages from the domain listed in the src property of the iFrame tag. + * If your iFrame navigates between different domains, ports or protocols; then you will need to + * provide an array of URLs or disable this option. + */ + checkOrigin?: boolean; + /** + * When enabled in page linking inside the iFrame and from the iFrame to the parent page will be enabled. + */ + inPageLinks?: boolean; + /** + * Height calculation method. + */ + heightCalculationMethod?: string; + /** + * Set iFrame Id + */ + id?: string; + /** + * In browsers that don't support mutationObserver, such as IE10, the library falls back to using + * setInterval, to check for changes to the page size. + */ + interval?: number; + /** + * Setting the log option to true will make the scripts in both the host page and the iFrame output + * everything they do to the JavaScript console so you can see the communication between the two scripts. + */ + log?: boolean; + /** + * Set maximum height of iFrame. + */ + maxHeight?: number; + /** + * Set maximum width of iFrame. + */ + maxWidth?: number; + /** + * Set minimum height of iFrame. + */ + minHeight?: number; + /** + * Set minimum width of iFrame. + */ + minWidth?: number; + /** + * Listen for resize events from the parent page, or the iFrame. Select the 'child' value if the iFrame + * can be resized independently of the browser window. Selecting this value can cause issues with some + * height calculation methods on mobile devices. + */ + resizeFrom?: string; + /** + * Enable scroll bars in iFrame. + */ + scrolling?: boolean; + /** + * Resize iFrame to content height. + */ + sizeHeight?: boolean; + /** + * Resize iFrame to content width. + */ + sizeWidth?: boolean; + /** + * Set the number of pixels the iFrame content size has to change by, before triggering a resize of the iFrame. + */ + tolerance?: number; + /** + * Width calculation method. + */ + widthCalculationMethod?: string; + /** + * Called when iFrame is closed via parentIFrame.close() or iframe.iframeResizer.close() methods. + */ + closedCallback?: (iframeId: string) => void; + /** + * Initial setup callback function. + */ + initCallback?: (iframe: IFrameComponent) => void; + /** + * Receive message posted from iFrame with the parentIFrame.sendMessage() method. + */ + messageCallback?: (data: IFrameMessageData) => void; + /** + * Function called after iFrame resized. Passes in messageData object containing the iFrame, height, width + * and the type of event that triggered the iFrame to resize. + */ + resizedCallback?: (data: IFrameResizedData) => void; + /** + * Called before the page is repositioned after a request from the iFrame, due to either an in page link, + * or a direct request from either parentIFrame.scrollTo() or parentIFrame.scrollToOffset(). + * If this callback function returns false, it will stop the library from repositioning the page, so that + * you can implement your own animated page scrolling instead. + */ + scrollCallback?: (data: IFrameScrollData) => boolean; + } + + export interface IFramePageOptions { + /** + * This option allows you to restrict the domain of the parent page, + * to prevent other sites mimicking your parent page. + */ + targetOrigin?: string; + /** + * Receive message posted from the parent page with the iframe.iFrameResizer.sendMessage() method. + */ + messageCallback?: (message: any) => void; + /** + * This function is called once iFrame-Resizer has been initialized after receiving a call from the parent page. + */ + readyCallback?: () => void; + /** + * These option can be used to override the option set in the parent page + */ + heightCalculationMethod?: string; + /** + * These option can be used to override the option set in the parent page + */ + widthCalculationMethod?: string; + } + + export interface IFramePage { + autoResize(resize?: boolean): boolean; + close(): void; + getId(): string; + getPageInfo(callback: (data: any) => void | false): void; + scrollTo(x: number, y: number); + scrollToOffset(x: number, y: number); + sendMessage(message: any): void; + setHeightCalculationMethod(method: string): void; + size(customHeight?, customWidth?): void + } + + + export interface IFrameResizedData { + iframe: IFrameComponent; + height: number; + width: number; + type: string; + } + + export interface IFrameMessageData { + iframe: IFrameComponent; + message: string; + } + + export interface IFrameScrollData { + x: number; + y: number; + } + + export function iframeResizer(options: IFrameOptions, target: HTMLElement): IFrameComponent; +} \ No newline at end of file diff --git a/types/iframe-resizer/tsconfig.json b/types/iframe-resizer/tsconfig.json new file mode 100644 index 0000000000..ef96a6d33a --- /dev/null +++ b/types/iframe-resizer/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "exclude": [ + "node_modules" + ], + "files": [ + "index.d.ts", + "iframe-resizer-tests.ts" + ] +} \ No newline at end of file diff --git a/types/iframe-resizer/tslint.json b/types/iframe-resizer/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/iframe-resizer/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 3314dd9601333818b0cb63fd0c38082b4201d207 Mon Sep 17 00:00:00 2001 From: Arturs Vonda Date: Tue, 27 Jun 2017 12:13:01 +0300 Subject: [PATCH 062/118] Add missing methods for opening date picker dialog --- types/material-ui/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/material-ui/index.d.ts b/types/material-ui/index.d.ts index a7b13f2bb4..16c6b5dce7 100644 --- a/types/material-ui/index.d.ts +++ b/types/material-ui/index.d.ts @@ -942,6 +942,8 @@ declare namespace __MaterialUI { utils?: propTypes.utils; } export class DatePicker extends React.Component { + focus(): void; + openDialog(): void; } interface DatePickerDialogProps { From 6a66c72a8ed8ac56aba0e5da3220310215aee738 Mon Sep 17 00:00:00 2001 From: arminbaljic Date: Tue, 27 Jun 2017 11:27:34 +0200 Subject: [PATCH 063/118] Finished type definitions for iframe-resizer. --- types/iframe-resizer/iframe-resizer-tests.ts | 33 ++++++++++++- types/iframe-resizer/index.d.ts | 52 ++++++++++++-------- types/iframe-resizer/tsconfig.json | 5 +- types/iframe-resizer/tslint.json | 4 +- 4 files changed, 70 insertions(+), 24 deletions(-) diff --git a/types/iframe-resizer/iframe-resizer-tests.ts b/types/iframe-resizer/iframe-resizer-tests.ts index 1996490390..d127f8bf36 100644 --- a/types/iframe-resizer/iframe-resizer-tests.ts +++ b/types/iframe-resizer/iframe-resizer-tests.ts @@ -1 +1,32 @@ -import resizer = require('iframe-resizer'); +import {IFrameComponent, IFrameOptions, iframeResizer} from "iframe-resizer"; + +function testOne(): void { + let iframe: HTMLIFrameElement = document.createElement('iframe'); + let options: IFrameOptions = {log: true}; + let components: IFrameComponent[] = iframeResizer(options, iframe); + if (components) { + components.forEach(component => console.log(component.iFrameResizer)); + } else { + console.log("No components"); + } +} + +function testTwo(): void { + let iframe: HTMLIFrameElement = document.createElement('iframe'); + let components: IFrameComponent[] = iframeResizer({ + initCallback: () => { + console.log('Init'); + }, + closedCallback: () => { + console.log('Closed'); + } + }, iframe); + if (components) { + components.forEach(component => console.log(component.iFrameResizer)); + } else { + console.log("No components"); + } +} + +testOne(); +testTwo(); diff --git a/types/iframe-resizer/index.d.ts b/types/iframe-resizer/index.d.ts index 04ff130667..1a05833692 100644 --- a/types/iframe-resizer/index.d.ts +++ b/types/iframe-resizer/index.d.ts @@ -1,21 +1,26 @@ -// Type definitions for iframe-resizer +// Type definitions for iframe-resizer 3.5 // Project: https://github.com/davidjbradshaw/iframe-resizer // Definitions by: Armin Baljic // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// tslint:disable:prefer-method-signature +// tslint:disable-next-line:no-single-declare-module declare module 'iframe-resizer' { - export interface IFrameObject { + // tslint:disable-next-line:interface-name + interface IFrameObject { close(): void; - moveToAnchor(anchor): void; + moveToAnchor(anchor: string): void; resize(): void; sendMessage(message: any): void; } - export interface IFrameComponent extends HTMLIFrameElement { - iFrameResizer: IFrameObject + // tslint:disable-next-line:interface-name + interface IFrameComponent extends HTMLIFrameElement { + iFrameResizer: IFrameObject; } - export interface IFrameOptions { + // tslint:disable-next-line:interface-name + interface IFrameOptions { /** * When enabled changes to the Window size or the DOM will cause the iFrame to resize to the new content size. * Disable if using size method with custom dimensions. @@ -103,11 +108,11 @@ declare module 'iframe-resizer' { /** * Called when iFrame is closed via parentIFrame.close() or iframe.iframeResizer.close() methods. */ - closedCallback?: (iframeId: string) => void; + closedCallback?: (iframeId?: string) => void; /** * Initial setup callback function. */ - initCallback?: (iframe: IFrameComponent) => void; + initCallback?: (iframe?: IFrameComponent) => void; /** * Receive message posted from iFrame with the parentIFrame.sendMessage() method. */ @@ -126,7 +131,8 @@ declare module 'iframe-resizer' { scrollCallback?: (data: IFrameScrollData) => boolean; } - export interface IFramePageOptions { + // tslint:disable-next-line:interface-name + interface IFramePageOptions { /** * This option allows you to restrict the domain of the parent page, * to prevent other sites mimicking your parent page. @@ -150,35 +156,41 @@ declare module 'iframe-resizer' { widthCalculationMethod?: string; } - export interface IFramePage { + // tslint:disable-next-line:interface-name + interface IFramePage { autoResize(resize?: boolean): boolean; close(): void; getId(): string; getPageInfo(callback: (data: any) => void | false): void; - scrollTo(x: number, y: number); - scrollToOffset(x: number, y: number); - sendMessage(message: any): void; + scrollTo(x: number, y: number): void; + scrollToOffset(x: number, y: number): void; + sendMessage(message: any, targetOrigin: string): void; setHeightCalculationMethod(method: string): void; - size(customHeight?, customWidth?): void + setWidthCalculationMethod(method: string): void; + setTargetOrigin(targetOrigin: string): void; + size(customHeight: string, customWidth: string): void; } - - export interface IFrameResizedData { + // tslint:disable-next-line:interface-name + interface IFrameResizedData { iframe: IFrameComponent; height: number; width: number; type: string; } - export interface IFrameMessageData { + // tslint:disable-next-line:interface-name + interface IFrameMessageData { iframe: IFrameComponent; message: string; } - export interface IFrameScrollData { + // tslint:disable-next-line:interface-name + interface IFrameScrollData { x: number; y: number; } - export function iframeResizer(options: IFrameOptions, target: HTMLElement): IFrameComponent; -} \ No newline at end of file + function iframeResizer(options: IFrameOptions, target: HTMLElement): IFrameComponent[]; +} +// tslint:enable:prefer-method-signature diff --git a/types/iframe-resizer/tsconfig.json b/types/iframe-resizer/tsconfig.json index ef96a6d33a..d2b812a1f7 100644 --- a/types/iframe-resizer/tsconfig.json +++ b/types/iframe-resizer/tsconfig.json @@ -2,11 +2,12 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6" + "es6", + "dom" ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" diff --git a/types/iframe-resizer/tslint.json b/types/iframe-resizer/tslint.json index 3db14f85ea..30a1bdde2e 100644 --- a/types/iframe-resizer/tslint.json +++ b/types/iframe-resizer/tslint.json @@ -1 +1,3 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file From 4ebb655fa656caf8319d44660a4c3b9d250d6a59 Mon Sep 17 00:00:00 2001 From: Nicolas Voigt Date: Tue, 27 Jun 2017 12:01:43 +0200 Subject: [PATCH 064/118] setEncoding argument to be mandatory --- types/node/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 2d15ee12c2..c6307a8a13 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -308,7 +308,7 @@ declare namespace NodeJS { export interface ReadableStream extends EventEmitter { readable: boolean; read(size?: number): string | Buffer; - setEncoding(encoding?: string): this; + setEncoding(encoding: string): this; pause(): this; resume(): this; isPaused(): boolean; From 6f9e67bb1813218a5c8497c7100140f39d26b935 Mon Sep 17 00:00:00 2001 From: Donald Pipowitch Date: Tue, 27 Jun 2017 13:01:41 +0200 Subject: [PATCH 065/118] Update index.d.ts --- types/webpack/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/webpack/index.d.ts b/types/webpack/index.d.ts index cc686b93b0..24012bcd8b 100644 --- a/types/webpack/index.d.ts +++ b/types/webpack/index.d.ts @@ -504,7 +504,7 @@ declare namespace webpack { * Turns hints on/off. In addition, tells webpack to throw either an error or a warning when hints are * found. This property is set to "warning" by default. */ - hints?: 'warning' | 'error' | boolean; + hints?: 'warning' | 'error' | false; /** * An asset is any emitted file from webpack. This option controls when webpack emits a performance hint * based on individual asset size. The default value is 250000 (bytes). From d28f0c306c6390f0120272029f9ee42d1ef59709 Mon Sep 17 00:00:00 2001 From: Donald Pipowitch Date: Tue, 27 Jun 2017 13:06:05 +0200 Subject: [PATCH 066/118] Update index.d.ts --- types/webpack/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/webpack/index.d.ts b/types/webpack/index.d.ts index cc686b93b0..26b95b01f4 100644 --- a/types/webpack/index.d.ts +++ b/types/webpack/index.d.ts @@ -1216,7 +1216,7 @@ declare namespace webpack { * Target of compilation. Passed from configuration options. * Example values: "web", "node" */ - target: 'web' | 'node' | string; + target: 'web' | 'webworker' | 'async-node' | 'node' | 'electron-main' | 'electron-renderer' | 'node-webkit' | string; /** * This boolean is set to true when this is compiled by webpack. From 909d2e994dc62b90da9f57ee5c84b2bdfd326e0c Mon Sep 17 00:00:00 2001 From: Uwe Quitter Date: Tue, 27 Jun 2017 15:45:52 +0200 Subject: [PATCH 067/118] Update index.d.ts In SelectRow interface type add an alternative type of number[] to the selected property. That resolves compiler errors if the key field of the row data is of type number. --- types/react-bootstrap-table/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-bootstrap-table/index.d.ts b/types/react-bootstrap-table/index.d.ts index 06e965c04b..1b80e670fa 100644 --- a/types/react-bootstrap-table/index.d.ts +++ b/types/react-bootstrap-table/index.d.ts @@ -157,7 +157,7 @@ export interface SelectRow { 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[]; + 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. From e3f59cc5e8915383c54c92a9537d184438933eaf Mon Sep 17 00:00:00 2001 From: Leonard Thieu Date: Tue, 27 Jun 2017 09:48:55 -0400 Subject: [PATCH 068/118] [angular] Add Document to JQueryStatic(). Add full header for JQLite definitions. --- types/angular/jqlite.d.ts | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/types/angular/jqlite.d.ts b/types/angular/jqlite.d.ts index ee7d6acf1c..9702ee8f6d 100644 --- a/types/angular/jqlite.d.ts +++ b/types/angular/jqlite.d.ts @@ -1,3 +1,5 @@ +// Type definitions for jQuery 2.0 +// Project: http://jquery.com/ // Definitions by: Boris Yankov // Christian Hoffmeister // Steve Fenton @@ -19,6 +21,20 @@ // Dick van den Brink // Thomas Schulz // Leonard Thieu +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/* ***************************************************************************** + Copyright (c) Microsoft Corporation. All rights reserved. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of the + License at http://www.apache.org/licenses/LICENSE-2.0 + THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED + WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, + MERCHANTABLITY OR NON-INFRINGEMENT. + See the Apache Version 2.0 License for specific language governing permissions + and limitations under the License. + ***************************************************************************** */ // Definitions copied from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/0480c5ec87fab41aa23047a02b27f0ea71aaf975/types/jquery/v2/index.d.ts @@ -664,7 +680,7 @@ interface JQuery { } interface JQueryStatic { - (element: string | Element): JQuery; + (element: string | Element | Document): JQuery; } /** From afb3c676648232deefc6e2aeba716947d3afc7dd Mon Sep 17 00:00:00 2001 From: Leonard Thieu Date: Tue, 27 Jun 2017 10:05:00 -0400 Subject: [PATCH 069/118] [angular] types-publisher doesn't like a full header. --- types/angular/jqlite.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/types/angular/jqlite.d.ts b/types/angular/jqlite.d.ts index 9702ee8f6d..ee8eea9928 100644 --- a/types/angular/jqlite.d.ts +++ b/types/angular/jqlite.d.ts @@ -1,4 +1,3 @@ -// Type definitions for jQuery 2.0 // Project: http://jquery.com/ // Definitions by: Boris Yankov // Christian Hoffmeister From 1c4ffe1b607aa1ec76f6753580e8c667f4c8e595 Mon Sep 17 00:00:00 2001 From: Matt Lewis Date: Tue, 27 Jun 2017 15:08:50 +0100 Subject: [PATCH 070/118] webpack: remove myself from the authors list --- types/webpack/index.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/types/webpack/index.d.ts b/types/webpack/index.d.ts index cc686b93b0..f1337e7c0d 100644 --- a/types/webpack/index.d.ts +++ b/types/webpack/index.d.ts @@ -1,7 +1,6 @@ // Type definitions for webpack 3.0 // Project: https://github.com/webpack/webpack // Definitions by: Qubo -// Matt Lewis // Benjamin Lim // Boris Cherny // Tommy Troy Lin From 968741c3b62aaf96ae2ce88e2e070fd43c027918 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konrad=20Ksi=C4=99ski?= Date: Tue, 27 Jun 2017 16:36:13 +0200 Subject: [PATCH 071/118] Update Node interface methods for dockerode package --- types/dockerode/dockerode-tests.ts | 33 ++++++++++++++++++++++++++++++ types/dockerode/index.d.ts | 8 ++++++++ 2 files changed, 41 insertions(+) diff --git a/types/dockerode/dockerode-tests.ts b/types/dockerode/dockerode-tests.ts index 8dd9a380de..ef2ed924d1 100644 --- a/types/dockerode/dockerode-tests.ts +++ b/types/dockerode/dockerode-tests.ts @@ -145,3 +145,36 @@ secret.remove((err, response) => { secret.update((err, response) => { // NOOP }); + +const node = docker.getNode('nodeName'); +node.inspect((err, reponse) => { + // NOOP +}); + +node.inspect().then(response => { + // NOOP +}); + +node.update({}, (err, response) => { + // NOOP +}); + +node.update((err, response) => { + // NOOP +}); + +node.update({}).then(response => { + // NOOP; +}); + +node.remove({}, (err, response) => { + // NOOP +}); + +node.remove((err, response) => { + // NOOP +}); + +node.remove({}).then(response => { + // NOOP; +}); diff --git a/types/dockerode/index.d.ts b/types/dockerode/index.d.ts index ec2808cf3d..1b456e8f45 100644 --- a/types/dockerode/index.d.ts +++ b/types/dockerode/index.d.ts @@ -170,6 +170,14 @@ declare namespace Dockerode { inspect(callback: Callback): void; inspect(): Promise; + update(options: {}, callback: Callback): void; + update(callback: Callback): void; + update(options?: {}): Promise; + + remove(options: {}, callback: Callback): void; + remove(callback: Callback): void; + remove(options?: {}): Promise; + modem: any; id?: string; } From 123aa2984e6faccac17dc6a16b7480b446ae2e73 Mon Sep 17 00:00:00 2001 From: Leonard Thieu Date: Tue, 27 Jun 2017 10:59:45 -0400 Subject: [PATCH 072/118] [DefinitelyTyped] Increase nProcesses from 1 to 4. (#17511) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1be6d06c89..8e734f2b89 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "scripts": { "compile-scripts": "tsc -p scripts", "not-needed": "node scripts/not-needed.js", - "test": "node node_modules/types-publisher/bin/tester/test.js --run-from-definitely-typed --nProcesses 1", + "test": "node node_modules/types-publisher/bin/tester/test.js --run-from-definitely-typed --nProcesses 4", "lint": "dtslint types" }, "devDependencies": { From 7bff99cf63c2516be2155bc321ff2ea04b28d650 Mon Sep 17 00:00:00 2001 From: Hussein Shabbir Date: Tue, 27 Jun 2017 21:00:24 +0400 Subject: [PATCH 073/118] Export the ReactDatePickerProps interface This is useful when wrapping the date picker in a custom component so that the props of the custom component can extend ReactDatePickerProps. --- types/react-datepicker/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-datepicker/index.d.ts b/types/react-datepicker/index.d.ts index f31f0316e1..aeb44be606 100644 --- a/types/react-datepicker/index.d.ts +++ b/types/react-datepicker/index.d.ts @@ -9,7 +9,7 @@ import * as React from "react"; import * as moment from "moment"; -interface ReactDatePickerProps { +export interface ReactDatePickerProps { autoComplete?: string; autoFocus?: boolean; calendarClassName?: string; From dc1ea691f9916fc5774b73e3e17a349ace77bf1e Mon Sep 17 00:00:00 2001 From: Ed Staub Date: Tue, 27 Jun 2017 13:36:34 -0400 Subject: [PATCH 074/118] Update formatError.d.ts See e.g. the flow definition in https://github.com/graphql/graphql-js/blob/master/src/error/formatError.js, where they are defined as optional. I'm no GraphQL expert; caveat emptor. --- types/graphql/error/formatError.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/graphql/error/formatError.d.ts b/types/graphql/error/formatError.d.ts index 712c68c77b..5b974d5461 100644 --- a/types/graphql/error/formatError.d.ts +++ b/types/graphql/error/formatError.d.ts @@ -8,11 +8,11 @@ export function formatError(error: GraphQLError): GraphQLFormattedError; export type GraphQLFormattedError = { message: string, - locations: Array, - path: Array + locations?: Array, + path?: Array }; export type GraphQLErrorLocation = { line: number, column: number -}; \ No newline at end of file +}; From 38c6c6691ee3b7c37ab294bcccc0f0a3458be16f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Par=C3=A9?= Date: Tue, 27 Jun 2017 14:09:51 -0400 Subject: [PATCH 075/118] fix typo --- types/mapbox-gl/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/mapbox-gl/index.d.ts b/types/mapbox-gl/index.d.ts index 9438bfafac..59611440b3 100644 --- a/types/mapbox-gl/index.d.ts +++ b/types/mapbox-gl/index.d.ts @@ -173,7 +173,7 @@ declare namespace mapboxgl { keyboard: KeyboardHandler; - doublClickZoom: DoubleClickZoomHandler; + doubleClickZoom: DoubleClickZoomHandler; touchZoomRotate: TouchZoomRotateHandler; } From 0e32c73f0c36905de3a828371aa6f9487e9ccc7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ro=CC=81bert=20Kiss?= Date: Tue, 27 Jun 2017 21:13:04 +0200 Subject: [PATCH 076/118] node-hid: Add 'usagePage' and 'usage' properties to Device --- types/node-hid/index.d.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/types/node-hid/index.d.ts b/types/node-hid/index.d.ts index 34afff06b1..e1196cf53e 100644 --- a/types/node-hid/index.d.ts +++ b/types/node-hid/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for node-hid 0.5 // Project: https://github.com/node-hid/node-hid#readme // Definitions by: Mohamed Hegazy +// Robert Kiss // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export interface Device { @@ -12,6 +13,8 @@ export interface Device { product: string; release: number; interface: number; + usagePage: number; + usage: number; } export class HID { From aa5ba74640cbf935fc995f900291f38c5896c152 Mon Sep 17 00:00:00 2001 From: Peter Jihoon Kim Date: Mon, 26 Jun 2017 22:35:09 -0700 Subject: [PATCH 077/118] [react-navigation] Fixed type definitions for NavigationActions.* --- types/react-navigation/index.d.ts | 66 ++++++++++++------- .../react-navigation-tests.tsx | 50 ++++++++++++-- 2 files changed, 86 insertions(+), 30 deletions(-) diff --git a/types/react-navigation/index.d.ts b/types/react-navigation/index.d.ts index 5286540963..1d07494104 100644 --- a/types/react-navigation/index.d.ts +++ b/types/react-navigation/index.d.ts @@ -4,6 +4,7 @@ // mhcgrq // fangpenlin // abrahambotros +// petejkim // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -188,46 +189,63 @@ export interface NavigationParams { [key: string]: any, } -export type NavigationNavigateAction = { - type: 'Navigation/NAVIGATE', +export interface NavigationNavigateActionPayload { routeName: string, params?: NavigationParams, // The action to run inside the sub-router action?: NavigationNavigateAction, -}; +} -export type NavigationBackAction = { - type: 'Navigation/BACK', +export interface NavigationNavigateAction extends NavigationNavigateActionPayload { + type: 'Navigation/NAVIGATE', +} + +export interface NavigationBackActionPayload { key?: string | null, -}; +} -export type NavigationSetParamsAction = { - type: 'Navigation/SET_PARAMS', +export interface NavigationBackAction extends NavigationBackActionPayload { + type: 'Navigation/BACK', +} +export interface NavigationSetParamsActionPayload { // The key of the route where the params should be set key: string, // The new params to merge into the existing route params params?: NavigationParams, -}; +} -export type NavigationInitAction = { - type: 'Navigation/INIT', +export interface NavigationSetParamsAction extends NavigationSetParamsActionPayload { + type: 'Navigation/SET_PARAMS', +} + +export interface NavigationInitActionPayload { params?: NavigationParams, -}; +} -export type NavigationResetAction = { - type: 'Navigation/RESET', +export interface NavigationInitAction extends NavigationInitActionPayload { + type: 'Navigation/INIT', +} + +export interface NavigationResetActionPayload { index: number, key?: string | null, actions: Array, -}; +} -export type NavigationUriAction = { - type: 'Navigation/URI', +export interface NavigationResetAction extends NavigationResetActionPayload { + type: 'Navigation/RESET', +} + +export interface NavigationUriActionPayload { uri: string, -}; +} + +export interface NavigationUriAction extends NavigationUriActionPayload { + type: 'Navigation/URI', +} export interface NavigationStackViewConfig { mode?: 'card' | 'modal', @@ -575,15 +593,13 @@ export const TabBarBottom: React.ComponentClass; /** * NavigationActions - * @todo Is this necessary, or can we remove? Not referenced anywhere else here, but it seems a - * recent commit or two touches these. Can anyone provide a strong use case for keeping this in? */ export namespace NavigationActions { - function init(options?: NavigationInitAction): NavigationInitAction; - function navigate(options: NavigationNavigateAction): NavigationNavigateAction; - function reset(options: NavigationResetAction): NavigationResetAction; - function back(options?: NavigationBackAction): NavigationBackAction; - function setParams(options: NavigationSetParamsAction): NavigationSetParamsAction; + export function init(options?: NavigationInitActionPayload): NavigationInitAction; + export function navigate(options: NavigationNavigateActionPayload): NavigationNavigateAction; + export function reset(options: NavigationResetActionPayload): NavigationResetAction; + export function back(options?: NavigationBackActionPayload): NavigationBackAction; + export function setParams(options: NavigationSetParamsActionPayload): NavigationSetParamsAction; } /** diff --git a/types/react-navigation/react-navigation-tests.tsx b/types/react-navigation/react-navigation-tests.tsx index 835e63d756..1840fd7ccf 100644 --- a/types/react-navigation/react-navigation-tests.tsx +++ b/types/react-navigation/react-navigation-tests.tsx @@ -5,22 +5,28 @@ import { ViewStyle, } from 'react-native'; import { - addNavigationHelpers, + NavigationAction, + NavigationActions, + NavigationBackAction, + NavigationInitAction, + NavigationNavigateAction, + NavigationProp, + NavigationResetAction, NavigationRouteConfigMap, NavigationScreenProp, NavigationScreenProps, + NavigationSetParamsAction, NavigationStackAction, NavigationStackScreenOptions, NavigationTabScreenOptions, + NavigationTransitionProps, StackNavigator, StackNavigatorConfig, + TabBarTop, TabNavigator, TabNavigatorConfig, - TabBarTop, Transitioner, - NavigationProp, - NavigationAction, - NavigationTransitionProps, + addNavigationHelpers, } from 'react-navigation'; // Constants @@ -42,6 +48,7 @@ interface StartScreenNavigationParams { id: number, s: string, } + interface StartScreenProps extends NavigationScreenProps { } class StartScreen extends React.Component { render() { @@ -219,3 +226,36 @@ class CustomTransitioner extends React.Component return {} } } + +const initAction: NavigationInitAction = NavigationActions.init({ + params: { + foo: "bar" + } +}) + +const navigateAction: NavigationNavigateAction = NavigationActions.navigate({ + routeName: "FooScreen", + params: { + foo: "bar" + }, + action: NavigationActions.navigate({ routeName: "BarScreen" }) +}) + +const resetAction: NavigationResetAction = NavigationActions.reset({ + index: 0, + key: "foo", + actions: [ + NavigationActions.navigate({ routeName: "FooScreen" }) + ] +}) + +const backAction: NavigationBackAction = NavigationActions.back({ + key: "foo" +}) + +const setParamsAction: NavigationSetParamsAction = NavigationActions.setParams({ + key: "foo", + params: { + foo: "bar" + } +}) From 6f114653600265e936e1c88e8ebcc8776c53fc1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ro=CC=81bert=20Kiss?= Date: Tue, 27 Jun 2017 22:55:55 +0200 Subject: [PATCH 078/118] node-hid: set optional properties --- types/node-hid/index.d.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/types/node-hid/index.d.ts b/types/node-hid/index.d.ts index e1196cf53e..92ffd4a60a 100644 --- a/types/node-hid/index.d.ts +++ b/types/node-hid/index.d.ts @@ -7,14 +7,14 @@ export interface Device { vendorId: number; productId: number; - path: string; - serialNumber: string; - manufacturer: string; - product: string; + path?: string; + serialNumber?: string; + manufacturer?: string; + product?: string; release: number; interface: number; - usagePage: number; - usage: number; + usagePage?: number; + usage?: number; } export class HID { From 86e255d38bf3add28248d1a795ede453b81e93ac Mon Sep 17 00:00:00 2001 From: Paul Datsiuk Date: Wed, 28 Jun 2017 00:15:03 +0300 Subject: [PATCH 079/118] parentheses was deleted --- types/browser-report/index.d.ts | 56 ++++++++++++++++----------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/types/browser-report/index.d.ts b/types/browser-report/index.d.ts index 8c7dec2b5d..c5852aae97 100644 --- a/types/browser-report/index.d.ts +++ b/types/browser-report/index.d.ts @@ -10,47 +10,47 @@ interface Window { interface ReportResult { "browser": { - "name": (string), - "version": (string) + "name": string, + "version": string }, - "cookies": (boolean), + "cookies": boolean, "flash": { - "version": (string) + "version": string }, - "ip": (string), + "ip": string, "country": { - "name": (string), - "code": (string), - "city": (string), - "latitude" : (string), - "longitude": (string), - "timezone": (string) + "name": string, + "code": string, + "city": string, + "latitude" : string, + "longitude": string, + "timezone": string }, "java": { - "version": (string) + "version": string }, - "lang": (Array), + "lang": Array, "os": { - "name": (string), - "version": (string) + "name": string, + "version": string }, "screen": { - "colors": (number), - "dppx": (number), - "height": (number), - "width": (number) + "colors": number, + "dppx": number, + "height": number, + "width": number }, - "scripts": (boolean), - "timestamp": (string), - "userAgent": (string), + "scripts": boolean, + "timestamp": string, + "userAgent": string, "viewport": { - "height": (number), + "height": number, "layout": { - "height": (number), - "width": (number) + "height": number, + "width": number } - "width": (number), - "zoom": (number) + "width": number, + "zoom": number } - "websockets": (boolean) + "websockets": boolean } \ No newline at end of file From b8fa44da6133029913edd27e4d14b8e916664305 Mon Sep 17 00:00:00 2001 From: Damien Rajon Date: Tue, 27 Jun 2017 23:22:51 +0200 Subject: [PATCH 080/118] Added header for async.nexttick definitions --- types/async.nexttick/index.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/types/async.nexttick/index.d.ts b/types/async.nexttick/index.d.ts index 7db4a43d87..8971239963 100644 --- a/types/async.nexttick/index.d.ts +++ b/types/async.nexttick/index.d.ts @@ -1 +1,6 @@ +// Type definitions for async.nexttick 0.5.2 +// Project: https://www.npmjs.com/package/async.nexttick +// Definitions by: Damien "pyrho" Rajon +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + export default function nextTick(callback: () => void, ...args: any[]): void; From 67b71f679b5e0c22340996549e87a4dcaaf7446b Mon Sep 17 00:00:00 2001 From: Sam Baxter Date: Tue, 27 Jun 2017 17:27:27 -0400 Subject: [PATCH 081/118] gapi.drive: refactor typings and fix bugs --- types/gapi.drive/index.d.ts | 510 +++++++++++++++++++----------------- 1 file changed, 273 insertions(+), 237 deletions(-) diff --git a/types/gapi.drive/index.d.ts b/types/gapi.drive/index.d.ts index ad8c64aa50..e0d4037ec9 100644 --- a/types/gapi.drive/index.d.ts +++ b/types/gapi.drive/index.d.ts @@ -6,8 +6,24 @@ /// -declare namespace gapi.client.drive { - export namespace files { +declare namespace gapi.client { + export module drive { + const files: { + get: (parameters: GetParameters) => HttpRequest; + patch: (parameters: PatchParameters) => HttpRequest; + copy: (parameters: CopyParameters) => HttpRequest; + delete: (parameters: DeleteParameters) => HttpRequest; + emptyTrash: () => HttpRequest; + export: (parameters: ExportParameters) => HttpRequest; + generateIds: (parameters: GenerateIdsParameters) => HttpRequest; + insert: (parameters: InsertParameters) => HttpRequest; + list: (parameters: ListParameters) => HttpRequest; + touch: (parameters: TouchParameters) => HttpRequest; + trash: (parameters: TrashParameters) => HttpRequest; + untrash: (parameters: UntrashParameters) => HttpRequest; + watch: (parameters: WatchParameters) => HttpRequest; + } + interface GetParameters { fileId: string; acknowledgeAbuse?: boolean; @@ -17,8 +33,6 @@ declare namespace gapi.client.drive { updateViewedDate?: boolean; } - export function get(parameters: GetParameters): HttpRequest; - interface PatchParameters { fileId: string; resource?: FileResource @@ -37,8 +51,6 @@ declare namespace gapi.client.drive { useContentAsIndexableText?: boolean; } - export function patch(parameters: PatchParameters): HttpRequest; - interface CopyParameters { fileId: string; resource?: FileResource; @@ -52,13 +64,39 @@ declare namespace gapi.client.drive { visibility?: string; } - export function copy(parameters: CopyParameters): HttpRequest; + interface DeleteParameters { + fileId: string; + supportsTeamDrives?: boolean; + } + + interface ExportParameters { + fileId: string; + mimeType: string; + } + + interface GenerateIdsParameters { + maxResults?: number; + space?: string; + } + + interface InsertParameters { + uploadType: string; + convert?: boolean; + ocr?: boolean; + ocrLanguage?: string; + pinned?: boolean; + supportsTeamDrives?: boolean; + timedTextLanguage?: string; + timedTextTrackName?: string; + usecontentAsIndexableText?: boolean; + visibility?: string; + } interface ListParameters { corpora?: string; corpus?: string; includeTeamDriveItems?: boolean; - maxResults: number; + maxResults?: number; orderBy?: string; pageToken?: string; projection?: string; @@ -68,28 +106,22 @@ declare namespace gapi.client.drive { teamDriveId?: string; } - export function list(parameters: ListParameters): HttpRequest; - interface TouchParameters { fileId: string; supportsTeamDrives?: boolean; } - export function touch(parameters: TouchParameters): HttpRequest; - interface TrashParameters { fileId: string; supportsTeamDrives?: boolean; } - export function trash(parameters: TrashParameters): HttpRequest; interface UntrashParameters { fileId: string; supportsTeamDrives?: boolean; } - export function untrash(parameters: UntrashParameters): HttpRequest; interface WatchParameters { fileId: string; @@ -98,239 +130,243 @@ declare namespace gapi.client.drive { supportsTeamDrives?: boolean; } - export function watch(parameters: WatchParameters): HttpRequest; - } - - export interface FileResource { - kind: 'drive#file'; - id?: string; - // etag - selfLink?: string; - webContentLink?: string; - webViewLink?: string; - alternateLink?: string; - embedLink?: string; - // openWithLinks - defaultOpenWithLink?: string; - iconLink?: string; - hasThumbnail?: boolean; - thumbnailLink?: string; - thumbnail?: { - image: Uint8Array; - mimType: string; - }; - title?: string; - mimeType?: string; - description?: string; - labels?: { - starred?: boolean; - hidden?: boolean; - trashed?: boolean; - restricted?: boolean; - viewed?: boolean; - modified?: boolean; - }; - createdDate?: Date; - modifiedDate?: Date; - modifiedByMeDate?: Date; - lastViewedByMeDate?: Date; - markedViewedByMeDate?: Date; - sharedWithMeDate?: Date; - version?: number; - sharingUser?: { - kind: 'drive#user'; - displayName?: string; - picture?: { - url: string; + interface FileResource { + kind: 'drive#file'; + id: string; + etag: string; + selfLink: string; + webContentLink: string; + webViewLink: string; + alternateLink: string; + embedLink: string; + // openWithLinks + defaultOpenWithLink: string; + iconLink: string; + hasThumbnail: boolean; + thumbnailLink: string; + thumbnail: { + image: Uint8Array; + mimType: string; }; - isAuthenticatedUser?: boolean; - permissionId?: string; - emailAddress?: string; - }; - parents?: ParentResource[]; - downloadUrl?: string; - // exportLinks - indexableText?: { - text: string; - }; - userPermission?: PermissionResource; - permissions?: PermissionResource[]; - hasAugmentedPermissions?: boolean; - originalFilename?: string; - fileExtension?: string; - fullFileExtension?: string; - md5Checksum?: string; - fileSize?: number; - quotaBytesUsed?: number; - ownerNames?: string[]; - owners?: { - kind: 'drive#user'; - displayName?: string; - picture?: { - url: string; + title: string; + mimeType: string; + description: string; + labels: { + starred: boolean; + hidden: boolean; + trashed: boolean; + restricted: boolean; + viewed: boolean; + modified: boolean; }; - isAuthenticatedUser?: boolean; - permissionId?: string; - emailAddress?: string; - }[]; - teamDriveId?: string; - lastModifyingUserName?: string; - lastModifyingUser?: { - kind: 'drive#user'; - displayName?: string; - picture?: { - url: string; + createdDate: Date; + modifiedDate: Date; + modifiedByMeDate: Date; + lastViewedByMeDate: Date; + markedViewedByMeDate: Date; + sharedWithMeDate: Date; + version: number; + sharingUser: { + kind: 'drive#user'; + displayName: string; + picture: { + url: string; + }; + isAuthenticatedUser: boolean; + permissionId: string; + emailAddress: string; }; - isAuthenticatedUser?: boolean; - permissionId?: string; - emailAddress?: string; - }; - ownedByMe?: boolean; - capabilities?: { - canAddChildren?: boolean; - canChangeRestrictedDownload?: boolean; - canComment?: boolean; - canCopy?: boolean; - canDelete?: boolean; - canDownload?: boolean; - canEdit?: boolean; - canListChildren?: boolean; - canMoveItemIntoTeamDrive?: boolean; - canMoveTeamDriveItem?: boolean; - canReadRevisions?: boolean; - canReadTeamDrive?: boolean; - canRemoveChildren?: boolean; - canRename?: boolean; - canShare?: boolean; - canTrash?: boolean; - canUntrash?: boolean; - }; - editable?: boolean; - canComment?: boolean; - canReadRevisions?: boolean; - shareable?: boolean; - copyable?: boolean; - writersCanShare?: boolean; - shared?: boolean; - explicitlyTrashed?: boolean; - trashingUser?: { - kind: 'drive#user'; - displayName?: string; - picture?: { - url: string; + parents: ParentResource[]; + downloadUrl: string; + // exportLinks + indexableText: { + text: string; }; - isAuthenticatedUser?: boolean; - permissionId?: string; - emailAddress?: string; - }; - trashedDate?: Date; - appDataContents?: boolean; - headRevisionId?: string; - properties?: PropertiesResource[]; - folderColorRgb?: string; - imageMediaMetadata?: { - width?: number; - height?: number; - rotation?: number; - location?: { - latitude?: number; - longitude?: number; - altitude?: number; + userPermission: PermissionResource; + permissions: PermissionResource[]; + hasAugmentedPermissions: boolean; + originalFilename: string; + fileExtension: string; + fullFileExtension: string; + md5Checksum: string; + fileSize: number; + quotaBytesUsed: number; + ownerNames: string[]; + owners: { + kind: 'drive#user'; + displayName: string; + picture: { + url: string; + }; + isAuthenticatedUser: boolean; + permissionId: string; + emailAddress: string; + }[]; + teamDriveId: string; + lastModifyingUserName: string; + lastModifyingUser: { + kind: 'drive#user'; + displayName: string; + picture: { + url: string; + }; + isAuthenticatedUser: boolean; + permissionId: string; + emailAddress: string; }; - date?: string; - cameraMake?: string; - cameraModel?: string; - exposureTime?: number; - aperture?: number; - flashUsed?: boolean; - focalLength?: number; - isoSpeed?: number; - meteringMode?: string; - sensor?: string; - exposureMode?: string; - colorSpace?: string; - whiteBalance?: string; - exposureBias?: number; - maxApertureValue?: number; - subjectDistance?: number; - lens?: string; - }; - videoMediaMetadata?: { - width?: number; - height?: number; - durationMillis?: number; - }; - spaces?: string[]; - isAppAuthorized?: boolean; - } + ownedByMe: boolean; + capabilities: { + canAddChildren: boolean; + canChangeRestrictedDownload: boolean; + canComment: boolean; + canCopy: boolean; + canDelete: boolean; + canDownload: boolean; + canEdit: boolean; + canListChildren: boolean; + canMoveItemIntoTeamDrive: boolean; + canMoveTeamDriveItem: boolean; + canReadRevisions: boolean; + canReadTeamDrive: boolean; + canRemoveChildren: boolean; + canRename: boolean; + canShare: boolean; + canTrash: boolean; + canUntrash: boolean; + }; + editable: boolean; + canComment: boolean; + canReadRevisions: boolean; + shareable: boolean; + copyable: boolean; + writersCanShare: boolean; + shared: boolean; + explicitlyTrashed: boolean; + trashingUser: { + kind: 'drive#user'; + displayName: string; + picture: { + url: string; + }; + isAuthenticatedUser: boolean; + permissionId: string; + emailAddress: string; + }; + trashedDate: Date; + appDataContents: boolean; + headRevisionId: string; + properties: PropertiesResource[]; + folderColorRgb: string; + imageMediaMetadata: { + width: number; + height: number; + rotation: number; + location: { + latitude: number; + longitude: number; + altitude: number; + }; + date: string; + cameraMake: string; + cameraModel: string; + exposureTime: number; + aperture: number; + flashUsed: boolean; + focalLength: number; + isoSpeed: number; + meteringMode: string; + sensor: string; + exposureMode: string; + colorSpace: string; + whiteBalance: string; + exposureBias: number; + maxApertureValue: number; + subjectDistance: number; + lens: string; + }; + videoMediaMetadata: { + width: number; + height: number; + durationMillis: number; + }; + spaces: string[]; + isAppAuthorized: boolean; + } - export interface FileListResource { - kind: 'drive#fileList'; - // etag - selfLink?: string; - nextPageToken?: string; - nextLink?: string; - incompleteSearch?: boolean; - items: FileResource[]; - } + interface FileListResource { + kind: 'drive#fileList'; + etag: string; + selfLink: string; + nextPageToken: string; + nextLink: string; + incompleteSearch: boolean; + items: FileResource[]; + } - export interface ParentResource { - kind: 'drive#parentReference'; - id?: string; - selfLink?: string; - parentLink?: string; - isRoot?: boolean; - } + interface ParentResource { + kind: 'drive#parentReference'; + id: string; + selfLink: string; + parentLink: string; + isRoot: boolean; + } - export interface PermissionResource { - kind: 'drive#permission'; - // etag - id?: string; - selfLink?: string; - name?: string; - emailAddress?: string; - domain?: string; - role?: string; - additionalRoles?: string[]; - type?: string; - value?: string; - authKey?: string; - withLink?: boolean; - photoLink?: string; - expirationDate?: Date; - teamDrivePermissionDetails?: { - teamDrivePermissionType?: string; - role?: string; - additionalRoles?: string[]; - inheritedFrom?: string; - inherited?: boolean; - }[]; - deleted?: boolean; - } + interface PermissionResource { + kind: 'drive#permission'; + etag: string; + id: string; + selfLink: string; + name: string; + emailAddress: string; + domain: string; + role: string; + additionalRoles: string[]; + type: string; + value: string; + authKey: string; + withLink: boolean; + photoLink: string; + expirationDate: Date; + teamDrivePermissionDetails: { + teamDrivePermissionType: string; + role: string; + additionalRoles: string[]; + inheritedFrom: string; + inherited: boolean; + }[]; + deleted: boolean; + } - export interface PropertiesResource { - kind: 'drive$property'; - // etag - selfLink?: string; - key?: string; - visibility?: string; - value?: string; - } + interface PropertiesResource { + kind: 'drive$property'; + etag: string; + selfLink: string; + key: string; + visibility: string; + value: string; + } - export interface WatchResource { - id?: string; - expiration?: number; - token?: string; - type?: string; - address?: string; - } + interface WatchResource { + id: string; + expiration: number; + token: string; + type: string; + address: string; + } - export interface ChannelResource { - kind: 'api#channel'; - id?: string; - resourceId?: string; - resourceUri?: string; - token?: string; - expiration?: number; + interface ChannelResource { + kind: 'api#channel'; + id: string; + resourceId: string; + resourceUri: string; + token: string; + expiration: number; + } + + interface IdsResource { + kind: 'drive#generatedIds'; + space: string; + ids: string[]; + } } } From 56fe50613524f1005ec89c229bb510241137593d Mon Sep 17 00:00:00 2001 From: Leonard Thieu Date: Tue, 27 Jun 2017 17:30:57 -0400 Subject: [PATCH 082/118] [angular] Remove copyright header. --- types/angular/jqlite.d.ts | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/types/angular/jqlite.d.ts b/types/angular/jqlite.d.ts index ee8eea9928..727e7718d7 100644 --- a/types/angular/jqlite.d.ts +++ b/types/angular/jqlite.d.ts @@ -22,19 +22,6 @@ // Leonard Thieu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/* ***************************************************************************** - Copyright (c) Microsoft Corporation. All rights reserved. - Licensed under the Apache License, Version 2.0 (the "License"); you may not use - this file except in compliance with the License. You may obtain a copy of the - License at http://www.apache.org/licenses/LICENSE-2.0 - THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED - WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, - MERCHANTABLITY OR NON-INFRINGEMENT. - See the Apache Version 2.0 License for specific language governing permissions - and limitations under the License. - ***************************************************************************** */ - // Definitions copied from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/0480c5ec87fab41aa23047a02b27f0ea71aaf975/types/jquery/v2/index.d.ts interface JQuery { From 7f6ae49875bdbdd9d2871a2c8d55319d048f3b9b Mon Sep 17 00:00:00 2001 From: Paul van Brenk Date: Tue, 27 Jun 2017 14:33:28 -0700 Subject: [PATCH 083/118] Rename async.nexttick-test.ts to async.nexttick-tests.ts --- .../{async.nexttick-test.ts => async.nexttick-tests.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename types/async.nexttick/{async.nexttick-test.ts => async.nexttick-tests.ts} (100%) diff --git a/types/async.nexttick/async.nexttick-test.ts b/types/async.nexttick/async.nexttick-tests.ts similarity index 100% rename from types/async.nexttick/async.nexttick-test.ts rename to types/async.nexttick/async.nexttick-tests.ts From 6f62d6b556029db44b7e4b527f10efb70fa3bd7c Mon Sep 17 00:00:00 2001 From: Paul van Brenk Date: Tue, 27 Jun 2017 14:33:53 -0700 Subject: [PATCH 084/118] Update tsconfig.json --- types/async.nexttick/tsconfig.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/async.nexttick/tsconfig.json b/types/async.nexttick/tsconfig.json index 7bf5157ec4..16e1714611 100644 --- a/types/async.nexttick/tsconfig.json +++ b/types/async.nexttick/tsconfig.json @@ -1,4 +1,4 @@ -{ +s{ "compilerOptions": { "target": "es6", "module": "commonjs", @@ -18,7 +18,7 @@ }, "files": [ "index.d.ts", - "async.nexttick-test.ts" + "async.nexttick-tests.ts" ] } From 6524517cd50dd71dbcd297629e02d16293db329d Mon Sep 17 00:00:00 2001 From: benbayard Date: Tue, 27 Jun 2017 14:36:41 -0700 Subject: [PATCH 085/118] Use new typescript definition for exported classes --- types/react-dropzone/index.d.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/types/react-dropzone/index.d.ts b/types/react-dropzone/index.d.ts index 0c944b99cd..59eec06fe0 100644 --- a/types/react-dropzone/index.d.ts +++ b/types/react-dropzone/index.d.ts @@ -38,6 +38,9 @@ declare module "react-dropzone" { onFileDialogCancel?: () => void; } - let Dropzone: React.ClassicComponentClass; + export declare class Dropzone extends React.Component { + open(): void; + render(): JSX.Element; + } export = Dropzone; } From b5de291251cbf6ff2d8ceeaeefc3895efe820406 Mon Sep 17 00:00:00 2001 From: benbayard Date: Tue, 27 Jun 2017 14:46:04 -0700 Subject: [PATCH 086/118] Add self to contributors --- types/react-dropzone/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/react-dropzone/index.d.ts b/types/react-dropzone/index.d.ts index 59eec06fe0..94c6fc94b1 100644 --- a/types/react-dropzone/index.d.ts +++ b/types/react-dropzone/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for react-dropzone // Project: https://github.com/okonet/react-dropzone -// Definitions by: Mathieu Larouche Dube , Ivo Jesus , Luís Rodrigues +// Definitions by: Mathieu Larouche Dube , Ivo Jesus , Luís Rodrigues , Ben Bayard + // Definitions: https://github.com/Vooban/DefinitelyTyped // TypeScript Version: 2.3 From 40a01c220ab44433ee014cea45daf7111a1718f5 Mon Sep 17 00:00:00 2001 From: Paul van Brenk Date: Tue, 27 Jun 2017 15:01:08 -0700 Subject: [PATCH 087/118] Update tsconfig.json Typing is hard.... --- types/async.nexttick/tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/async.nexttick/tsconfig.json b/types/async.nexttick/tsconfig.json index 16e1714611..68011bfd96 100644 --- a/types/async.nexttick/tsconfig.json +++ b/types/async.nexttick/tsconfig.json @@ -1,4 +1,4 @@ -s{ +{ "compilerOptions": { "target": "es6", "module": "commonjs", From d8b5452ec029053a3c1ed79cb8c15625d251bc51 Mon Sep 17 00:00:00 2001 From: benbayard Date: Tue, 27 Jun 2017 15:01:43 -0700 Subject: [PATCH 088/118] Remove render declaration. --- types/react-dropzone/index.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/types/react-dropzone/index.d.ts b/types/react-dropzone/index.d.ts index 94c6fc94b1..1ef7932e0d 100644 --- a/types/react-dropzone/index.d.ts +++ b/types/react-dropzone/index.d.ts @@ -41,7 +41,6 @@ declare module "react-dropzone" { export declare class Dropzone extends React.Component { open(): void; - render(): JSX.Element; } export = Dropzone; } From 0439f1542d657c06e57e770fd2f9968a3a4cb4b6 Mon Sep 17 00:00:00 2001 From: Paul van Brenk Date: Tue, 27 Jun 2017 15:14:01 -0700 Subject: [PATCH 089/118] Update tslint.json Fix up tslint.json --- types/async.nexttick/tslint.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/async.nexttick/tslint.json b/types/async.nexttick/tslint.json index 4c3a548997..d0858559ac 100644 --- a/types/async.nexttick/tslint.json +++ b/types/async.nexttick/tslint.json @@ -1,3 +1,3 @@ -{ - "extends": "dtslint/dtslint.json" +{ + "extends": "dtslint/dt.json" } From a2b40c9f1074150eccdbe6c40a98d7cf13fa0e14 Mon Sep 17 00:00:00 2001 From: codemannz Date: Wed, 28 Jun 2017 10:15:18 +1200 Subject: [PATCH 090/118] Added View variable type --- types/backbone.marionette/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/backbone.marionette/index.d.ts b/types/backbone.marionette/index.d.ts index d8ced49217..52d8c7a492 100644 --- a/types/backbone.marionette/index.d.ts +++ b/types/backbone.marionette/index.d.ts @@ -1272,7 +1272,7 @@ declare namespace Marionette { getRegion(): Region; /** Show a view in the root region */ - showView(view: any): void; + showView(view: View): void; /** Get the view from the root region*/ getView(): any; From b684f1353171aaefa3e309e27faa44b1770164c5 Mon Sep 17 00:00:00 2001 From: Kevin Leung Date: Wed, 28 Jun 2017 06:21:16 +0800 Subject: [PATCH 091/118] [fabric] Lower case Boolean --- types/fabric/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/fabric/index.d.ts b/types/fabric/index.d.ts index 1596d7d428..96c4ec4e5a 100644 --- a/types/fabric/index.d.ts +++ b/types/fabric/index.d.ts @@ -3086,7 +3086,7 @@ interface ITextOptions extends IObjectOptions { textBackgroundColor?: string; path?: string; - useNative?: Boolean; + useNative?: boolean; text?: string; } export interface Text extends ITextOptions {} From 970140449f22ee0be56a225488bafc6b4bf61e98 Mon Sep 17 00:00:00 2001 From: Paul van Brenk Date: Tue, 27 Jun 2017 15:26:30 -0700 Subject: [PATCH 092/118] Update index.d.ts --- types/async.nexttick/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/async.nexttick/index.d.ts b/types/async.nexttick/index.d.ts index 8971239963..22efd68fc7 100644 --- a/types/async.nexttick/index.d.ts +++ b/types/async.nexttick/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for async.nexttick 0.5.2 +// Type definitions for async.nexttick 0.5 // Project: https://www.npmjs.com/package/async.nexttick // Definitions by: Damien "pyrho" Rajon // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From d1a4134e773639eadfa6c2e3ee73283029045f02 Mon Sep 17 00:00:00 2001 From: Ben Bayard Date: Tue, 27 Jun 2017 15:29:54 -0700 Subject: [PATCH 093/118] Use correct export for generated classes - Use semicolons in interface declaration. - Use correct function syntax for onDrop methods --- types/react-dropzone/index.d.ts | 46 ++++++++-------- types/react-dropzone/react-dropzone-tests.tsx | 53 ++++++++++--------- 2 files changed, 51 insertions(+), 48 deletions(-) diff --git a/types/react-dropzone/index.d.ts b/types/react-dropzone/index.d.ts index 1ef7932e0d..dfa2a861b2 100644 --- a/types/react-dropzone/index.d.ts +++ b/types/react-dropzone/index.d.ts @@ -1,7 +1,6 @@ // Type definitions for react-dropzone // Project: https://github.com/okonet/react-dropzone // Definitions by: Mathieu Larouche Dube , Ivo Jesus , Luís Rodrigues , Ben Bayard - // Definitions: https://github.com/Vooban/DefinitelyTyped // TypeScript Version: 2.3 @@ -10,37 +9,36 @@ declare module "react-dropzone" { interface DropzoneProps { // Drop behavior - onDrop?: Function, - onDropAccepted?: Function, - onDropRejected?: Function, + onDrop?: (accepted: File[], rejected: File[]) => any; + onDropAccepted?: (accepted: File[]) => any; + onDropRejected?: (rejected: File[]) => any; // Drag behavior - onDragStart?: Function, - onDragEnter?: Function, - onDragLeave?: Function, + onDragStart?: Function; + onDragEnter?: Function; + onDragLeave?: Function; - style?: Object, // CSS styles to apply - activeStyle?: Object, // CSS styles to apply when drop will be accepted - rejectStyle?: Object, // CSS styles to apply when drop will be rejected - className?: string, // Optional className - activeClassName?: string, // className for accepted state - rejectClassName?: string, // className for rejected state + style?: React.CSSProperties; // CSS styles to apply + activeStyle?: React.CSSProperties; // CSS styles to apply when drop will be accepted + rejectStyle?: React.CSSProperties; // CSS styles to apply when drop will be rejected + className?: string; // Optional className + activeClassName?: string; // className for accepted state + rejectClassName?: string; // className for rejected state - disablePreview?: boolean, // Enable/disable preview generation - disableClick?: boolean, // Disallow clicking on the dropzone container to open file dialog + disablePreview?: boolean; // Enable/disable preview generation + disableClick?: boolean; // Disallow clicking on the dropzone container to open file dialog - inputProps?: Object, // Pass additional attributes to the tag - multiple?: boolean, // Allow dropping multiple files - accept?: string, // Allow specific types of files. See https://github.com/okonet/attr-accept for more information - name?: string, // name attribute for the input tag - maxSize?: number, - minSize?: number + inputProps?: React.ChangeTargetHTMLProps; // Pass additional attributes to the tag + multiple?: boolean; // Allow dropping multiple files + accept?: string; // Allow specific types of files. See https://github.com/okonet/attr-accept for more information + name?: string; // name attribute for the input tag + maxSize?: number; + minSize?: number; onFileDialogCancel?: () => void; } - export declare class Dropzone extends React.Component { - open(): void; - } + class Dropzone extends React.Component {} + export = Dropzone; } diff --git a/types/react-dropzone/react-dropzone-tests.tsx b/types/react-dropzone/react-dropzone-tests.tsx index aaa499a3e3..b4398b5780 100644 --- a/types/react-dropzone/react-dropzone-tests.tsx +++ b/types/react-dropzone/react-dropzone-tests.tsx @@ -1,36 +1,41 @@ import * as React from 'react'; -import * as Dropzone from 'react-dropzone'; +import Dropzone = require('react-dropzone'); class Test extends React.Component { constructor(props: any) { super(props); } + dz: Dropzone; + render() { - return (

- { e.preventDefault(); } } - onDropAccepted={(e: any) => { e.preventDefault(); } } - onDropRejected={(e: any) => { e.preventDefault(); } } - onDragStart={(e: any) => { e.preventDefault(); } } - onDragEnter={(e: any) => { e.preventDefault(); } } - onDragLeave={(e: any) => { e.preventDefault(); } } - style={{ borderStyle: "dashed" }} - activeStyle={{ borderStyle: "dotted" }} - rejectStyle={{ borderStyle: "dotted" }} - className="regular" - activeClassName="active" - rejectClassName="reject" - minSize={2000} - maxSize={Infinity} - disablePreview={true} - disableClick={true} - multiple={false} - accept="*.png" - name="dropzone" - inputProps={{ id: "dropzone" }} + return ( +
+ { this.dz = node } } + onDrop={(e: any) => { e.preventDefault(); } } + onDropAccepted={(e: any) => { e.preventDefault(); } } + onDropRejected={(e: any) => { e.preventDefault(); } } + onDragStart={(e: any) => { e.preventDefault(); } } + onDragEnter={(e: any) => { e.preventDefault(); } } + onDragLeave={(e: any) => { e.preventDefault(); } } + style={{ borderStyle: "dashed" }} + activeStyle={{ borderStyle: "dotted" }} + rejectStyle={{ borderStyle: "dotted" }} + className="regular" + activeClassName="active" + rejectClassName="reject" + minSize={2000} + maxSize={Infinity} + disablePreview={true} + disableClick={true} + multiple={false} + accept="*.png" + name="dropzone" + inputProps={{ id: "dropzone" }} /> -
); +
+ ); } } From 7dc0047930f17430a6c68e603bc9370211b12a10 Mon Sep 17 00:00:00 2001 From: Ben Bayard Date: Tue, 27 Jun 2017 15:34:17 -0700 Subject: [PATCH 094/118] Add typescript definition for open method - Include test --- types/react-dropzone/index.d.ts | 4 +++- types/react-dropzone/react-dropzone-tests.tsx | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/types/react-dropzone/index.d.ts b/types/react-dropzone/index.d.ts index dfa2a861b2..c47b64d9bc 100644 --- a/types/react-dropzone/index.d.ts +++ b/types/react-dropzone/index.d.ts @@ -38,7 +38,9 @@ declare module "react-dropzone" { onFileDialogCancel?: () => void; } - class Dropzone extends React.Component {} + class Dropzone extends React.Component { + open(): void; + } export = Dropzone; } diff --git a/types/react-dropzone/react-dropzone-tests.tsx b/types/react-dropzone/react-dropzone-tests.tsx index b4398b5780..95c3886454 100644 --- a/types/react-dropzone/react-dropzone-tests.tsx +++ b/types/react-dropzone/react-dropzone-tests.tsx @@ -8,6 +8,10 @@ class Test extends React.Component { dz: Dropzone; + open() { + this.dz.open(); + } + render() { return (
From d9d37590649a62b211bd079edef66bafc8b9ef51 Mon Sep 17 00:00:00 2001 From: Andre Wiggins Date: Tue, 27 Jun 2017 16:01:43 -0700 Subject: [PATCH 095/118] Extend Angular jqLite static interface --- types/angular/angular-tests.ts | 6 ++++-- types/angular/jqlite.d.ts | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/types/angular/angular-tests.ts b/types/angular/angular-tests.ts index 6a601910d0..20de01f71f 100644 --- a/types/angular/angular-tests.ts +++ b/types/angular/angular-tests.ts @@ -627,11 +627,13 @@ function test_angular_forEach() { } // angular.element() tests -let element = angular.element('div.myApp'); +let element = angular.element('
'); let scope: ng.IScope = element.scope(); let isolateScope: ng.IScope = element.isolateScope(); -isolateScope = element.find('div.foo').isolateScope(); +isolateScope = element.find('div').isolateScope(); isolateScope = element.children().isolateScope(); +let element2 = angular.element(element); +let elementArray = angular.element(document.querySelectorAll('div')); // $timeout signature tests namespace TestTimeout { diff --git a/types/angular/jqlite.d.ts b/types/angular/jqlite.d.ts index 727e7718d7..150c50b5dd 100644 --- a/types/angular/jqlite.d.ts +++ b/types/angular/jqlite.d.ts @@ -20,6 +20,7 @@ // Dick van den Brink // Thomas Schulz // Leonard Thieu +// Andre Wiggins // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // Definitions copied from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/0480c5ec87fab41aa23047a02b27f0ea71aaf975/types/jquery/v2/index.d.ts @@ -666,7 +667,7 @@ interface JQuery { } interface JQueryStatic { - (element: string | Element | Document): JQuery; + (element: string | Element | Document | JQuery | ArrayLike): JQuery; } /** From a70a977fe4acee57c5f5cf5a9e16575284cde81d Mon Sep 17 00:00:00 2001 From: Brian Lee Date: Tue, 27 Jun 2017 17:22:48 -0700 Subject: [PATCH 096/118] Add additional tests --- types/node/node-tests.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/types/node/node-tests.ts b/types/node/node-tests.ts index aeefc2bbdc..ea177760cb 100644 --- a/types/node/node-tests.ts +++ b/types/node/node-tests.ts @@ -544,6 +544,11 @@ namespace util_tests { maxArrayLength: null, breakLength: Infinity }) + assert(typeof util.inspect.custom === 'symbol') + // util.promisify + var readPromised = util.promisify(fs.readFile) + var sampleRead: Promise = readPromised(__filename).then((data: string): void => {}).catch((error: Error): void => {}) + assert(typeof util.promisify.custom === 'symbol') } } From b6cc60050834200596b74ceb44c715e85261c24e Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Wed, 28 Jun 2017 02:23:02 +0200 Subject: [PATCH 097/118] null! => null thanks to PR #17021 --- types/react-router/test/ModalGallery.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-router/test/ModalGallery.tsx b/types/react-router/test/ModalGallery.tsx index f4b55aca20..211e62aa49 100644 --- a/types/react-router/test/ModalGallery.tsx +++ b/types/react-router/test/ModalGallery.tsx @@ -130,7 +130,7 @@ const ImageView: React.SFC> = ({ match }) => const Modal: React.SFC> = ({ match, history }) => { const image = IMAGES[parseInt(match.params.id, 10)]; if (!image) { - return null!; + return null; } const back = (e: React.MouseEvent) => { e.stopPropagation(); From 42af84cc3a5f629c4d49e896f4f80fdb16147213 Mon Sep 17 00:00:00 2001 From: Brian Lee Date: Tue, 27 Jun 2017 17:24:31 -0700 Subject: [PATCH 098/118] Add properties for util.inspect and util.promisify --- types/node/index.d.ts | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 21d48b504a..23aceac90c 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -3938,8 +3938,17 @@ declare module "util" { export function puts(...param: any[]): void; export function print(...param: any[]): void; export function log(string: string): void; - export function inspect(object: any, showHidden?: boolean, depth?: number | null, color?: boolean): string; - export function inspect(object: any, options: InspectOptions): string; + export var inspect: { + (object: any, showHidden?: boolean, depth?: number | null, color?: boolean): string; + (object: any, options: InspectOptions): string; + colors: { + [color: string]: [number, number] + } + styles: { + [style: string]: string + } + custom: symbol + } export function isArray(object: any): object is any[]; export function isRegExp(object: any): object is RegExp; export function isDate(object: any): object is Date; @@ -3958,7 +3967,10 @@ declare module "util" { export function isSymbol(object: any): object is symbol; export function isUndefined(object: any): object is undefined; export function deprecate(fn: Function, message: string): Function; - export function promisify(fn: Function): Function; + export var promisify: { + (fn: Function): Function; + custom: symbol + } } declare module "assert" { From 43c90a8a839851cac01c15ad1c75113647176cc5 Mon Sep 17 00:00:00 2001 From: codemannz Date: Wed, 28 Jun 2017 12:49:05 +1200 Subject: [PATCH 099/118] changed to Backbone.View --- types/backbone.marionette/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/backbone.marionette/index.d.ts b/types/backbone.marionette/index.d.ts index 52d8c7a492..9ffe1460e9 100644 --- a/types/backbone.marionette/index.d.ts +++ b/types/backbone.marionette/index.d.ts @@ -1272,7 +1272,7 @@ declare namespace Marionette { getRegion(): Region; /** Show a view in the root region */ - showView(view: View): void; + showView(view: Backbone.View): void; /** Get the view from the root region*/ getView(): any; From 13a594f24e60ef9e93aacd8ba40db18aa6fc88d8 Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Wed, 28 Jun 2017 03:03:42 +0200 Subject: [PATCH 100/118] Move the official examples to directory examples-from-react-router-website --- types/react-router/test/README.md | 1 - .../Ambiguous.tsx | 0 .../Animation.tsx | 0 .../Auth.tsx | 0 .../Basic.tsx | 0 .../CustomLink.tsx | 0 .../ModalGallery.tsx | 0 .../NoMatch.tsx | 0 .../Params.tsx | 0 .../PreventingTransitions.tsx | 0 .../README.md | 5 ++++ .../Recursive.tsx | 0 .../RouteConfig.tsx | 0 .../Sidebar.tsx | 0 .../StaticRouter.tsx | 0 types/react-router/tsconfig.json | 28 ++++++++++--------- 16 files changed, 20 insertions(+), 14 deletions(-) delete mode 100644 types/react-router/test/README.md rename types/react-router/test/{ => examples-from-react-router-website}/Ambiguous.tsx (100%) rename types/react-router/test/{ => examples-from-react-router-website}/Animation.tsx (100%) rename types/react-router/test/{ => examples-from-react-router-website}/Auth.tsx (100%) rename types/react-router/test/{ => examples-from-react-router-website}/Basic.tsx (100%) rename types/react-router/test/{ => examples-from-react-router-website}/CustomLink.tsx (100%) rename types/react-router/test/{ => examples-from-react-router-website}/ModalGallery.tsx (100%) rename types/react-router/test/{ => examples-from-react-router-website}/NoMatch.tsx (100%) rename types/react-router/test/{ => examples-from-react-router-website}/Params.tsx (100%) rename types/react-router/test/{ => examples-from-react-router-website}/PreventingTransitions.tsx (100%) create mode 100644 types/react-router/test/examples-from-react-router-website/README.md rename types/react-router/test/{ => examples-from-react-router-website}/Recursive.tsx (100%) rename types/react-router/test/{ => examples-from-react-router-website}/RouteConfig.tsx (100%) rename types/react-router/test/{ => examples-from-react-router-website}/Sidebar.tsx (100%) rename types/react-router/test/{ => examples-from-react-router-website}/StaticRouter.tsx (100%) diff --git a/types/react-router/test/README.md b/types/react-router/test/README.md deleted file mode 100644 index 341bd29130..0000000000 --- a/types/react-router/test/README.md +++ /dev/null @@ -1 +0,0 @@ -Examples taken from https://github.com/ReactTraining/react-router/tree/22bd52c901ef0312348c2b02549c7102bd5653ae/packages/react-router-website/modules/examples diff --git a/types/react-router/test/Ambiguous.tsx b/types/react-router/test/examples-from-react-router-website/Ambiguous.tsx similarity index 100% rename from types/react-router/test/Ambiguous.tsx rename to types/react-router/test/examples-from-react-router-website/Ambiguous.tsx diff --git a/types/react-router/test/Animation.tsx b/types/react-router/test/examples-from-react-router-website/Animation.tsx similarity index 100% rename from types/react-router/test/Animation.tsx rename to types/react-router/test/examples-from-react-router-website/Animation.tsx diff --git a/types/react-router/test/Auth.tsx b/types/react-router/test/examples-from-react-router-website/Auth.tsx similarity index 100% rename from types/react-router/test/Auth.tsx rename to types/react-router/test/examples-from-react-router-website/Auth.tsx diff --git a/types/react-router/test/Basic.tsx b/types/react-router/test/examples-from-react-router-website/Basic.tsx similarity index 100% rename from types/react-router/test/Basic.tsx rename to types/react-router/test/examples-from-react-router-website/Basic.tsx diff --git a/types/react-router/test/CustomLink.tsx b/types/react-router/test/examples-from-react-router-website/CustomLink.tsx similarity index 100% rename from types/react-router/test/CustomLink.tsx rename to types/react-router/test/examples-from-react-router-website/CustomLink.tsx diff --git a/types/react-router/test/ModalGallery.tsx b/types/react-router/test/examples-from-react-router-website/ModalGallery.tsx similarity index 100% rename from types/react-router/test/ModalGallery.tsx rename to types/react-router/test/examples-from-react-router-website/ModalGallery.tsx diff --git a/types/react-router/test/NoMatch.tsx b/types/react-router/test/examples-from-react-router-website/NoMatch.tsx similarity index 100% rename from types/react-router/test/NoMatch.tsx rename to types/react-router/test/examples-from-react-router-website/NoMatch.tsx diff --git a/types/react-router/test/Params.tsx b/types/react-router/test/examples-from-react-router-website/Params.tsx similarity index 100% rename from types/react-router/test/Params.tsx rename to types/react-router/test/examples-from-react-router-website/Params.tsx diff --git a/types/react-router/test/PreventingTransitions.tsx b/types/react-router/test/examples-from-react-router-website/PreventingTransitions.tsx similarity index 100% rename from types/react-router/test/PreventingTransitions.tsx rename to types/react-router/test/examples-from-react-router-website/PreventingTransitions.tsx diff --git a/types/react-router/test/examples-from-react-router-website/README.md b/types/react-router/test/examples-from-react-router-website/README.md new file mode 100644 index 0000000000..6648c853d0 --- /dev/null +++ b/types/react-router/test/examples-from-react-router-website/README.md @@ -0,0 +1,5 @@ +Examples taken from react-router website. + +Please keep them in sync and as close as possible to the original ones. + +See https://github.com/ReactTraining/react-router/tree/22bd52c901ef0312348c2b02549c7102bd5653ae/packages/react-router-website/modules/examples diff --git a/types/react-router/test/Recursive.tsx b/types/react-router/test/examples-from-react-router-website/Recursive.tsx similarity index 100% rename from types/react-router/test/Recursive.tsx rename to types/react-router/test/examples-from-react-router-website/Recursive.tsx diff --git a/types/react-router/test/RouteConfig.tsx b/types/react-router/test/examples-from-react-router-website/RouteConfig.tsx similarity index 100% rename from types/react-router/test/RouteConfig.tsx rename to types/react-router/test/examples-from-react-router-website/RouteConfig.tsx diff --git a/types/react-router/test/Sidebar.tsx b/types/react-router/test/examples-from-react-router-website/Sidebar.tsx similarity index 100% rename from types/react-router/test/Sidebar.tsx rename to types/react-router/test/examples-from-react-router-website/Sidebar.tsx diff --git a/types/react-router/test/StaticRouter.tsx b/types/react-router/test/examples-from-react-router-website/StaticRouter.tsx similarity index 100% rename from types/react-router/test/StaticRouter.tsx rename to types/react-router/test/examples-from-react-router-website/StaticRouter.tsx diff --git a/types/react-router/tsconfig.json b/types/react-router/tsconfig.json index 4790f0b53d..438e3c9647 100644 --- a/types/react-router/tsconfig.json +++ b/types/react-router/tsconfig.json @@ -14,22 +14,24 @@ }, "files": [ "index.d.ts", - "test/Ambiguous.tsx", - "test/Animation.tsx", - "test/Auth.tsx", - "test/Basic.tsx", + + "test/examples-from-react-router-website/Ambiguous.tsx", + "test/examples-from-react-router-website/Animation.tsx", + "test/examples-from-react-router-website/Auth.tsx", + "test/examples-from-react-router-website/Basic.tsx", + "test/examples-from-react-router-website/CustomLink.tsx", + "test/examples-from-react-router-website/ModalGallery.tsx", + "test/examples-from-react-router-website/NoMatch.tsx", + "test/examples-from-react-router-website/Params.tsx", + "test/examples-from-react-router-website/PreventingTransitions.tsx", + "test/examples-from-react-router-website/Recursive.tsx", + "test/examples-from-react-router-website/RouteConfig.tsx", + "test/examples-from-react-router-website/Sidebar.tsx", + "test/examples-from-react-router-website/StaticRouter.tsx", + "test/Children.tsx", - "test/CustomLink.tsx", - "test/ModalGallery.tsx", "test/NavigateWithContext.tsx", "test/MemoryRouter.tsx", - "test/NoMatch.tsx", - "test/Params.tsx", - "test/PreventingTransitions.tsx", - "test/Recursive.tsx", - "test/RouteConfig.tsx", - "test/Sidebar.tsx", - "test/StaticRouter.tsx", "test/Switch.tsx", "test/WithRouter.tsx" ] From f3b410c756d251d16c1c67910ec50f27d3c65d01 Mon Sep 17 00:00:00 2001 From: codemannz Date: Wed, 28 Jun 2017 13:27:24 +1200 Subject: [PATCH 101/118] Updated to Backbone.Model --- types/backbone.marionette/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/backbone.marionette/index.d.ts b/types/backbone.marionette/index.d.ts index 9ffe1460e9..ad623aa078 100644 --- a/types/backbone.marionette/index.d.ts +++ b/types/backbone.marionette/index.d.ts @@ -1272,7 +1272,7 @@ declare namespace Marionette { getRegion(): Region; /** Show a view in the root region */ - showView(view: Backbone.View): void; + showView(view: Backbone.View): void; /** Get the view from the root region*/ getView(): any; From b66d4b85f0d72e001eb4978a6a6c5bb23bcee374 Mon Sep 17 00:00:00 2001 From: hjin-me Date: Wed, 28 Jun 2017 10:43:10 +0800 Subject: [PATCH 102/118] add missing MaterialParameters --- types/three/three-core.d.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/types/three/three-core.d.ts b/types/three/three-core.d.ts index 02cbe672e8..7a6a6ec9ac 100644 --- a/types/three/three-core.d.ts +++ b/types/three/three-core.d.ts @@ -2318,6 +2318,9 @@ export interface MaterialParameters { lights?: boolean; shading?: Shading; vertexColors?: Colors; + clippingPlanes?: Plane[]; + clipIntersection?: boolean; + clipShadows?: boolean; } /** From 1205f064bd7fc3fed402f0dd681560525a8fe2cd Mon Sep 17 00:00:00 2001 From: kimu_shu Date: Wed, 28 Jun 2017 11:58:01 +0900 Subject: [PATCH 103/118] Add fs.writeFileSync overloads and tests --- types/node/index.d.ts | 1 + types/node/node-tests.ts | 3 +++ types/node/v0/node-tests.ts | 2 ++ types/node/v4/index.d.ts | 1 + types/node/v4/node-tests.ts | 3 +++ types/node/v6/index.d.ts | 1 + types/node/v6/node-tests.ts | 3 +++ types/node/v7/index.d.ts | 1 + types/node/v7/node-tests.ts | 3 +++ 9 files changed, 18 insertions(+) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 7691c2c9af..9e69aca71e 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -2835,6 +2835,7 @@ declare module "fs" { export function writeFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void; export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; + export function writeFileSync(filename: string, data: any, encoding: string): void; export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void; export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void; export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; diff --git a/types/node/node-tests.ts b/types/node/node-tests.ts index aeefc2bbdc..0297bc375b 100644 --- a/types/node/node-tests.ts +++ b/types/node/node-tests.ts @@ -169,6 +169,9 @@ namespace fs_tests { encoding: "ascii" }, assert.ifError); + + fs.writeFileSync("testfile", "content", "utf8"); + fs.writeFileSync("testfile", "content", { encoding: "utf8" }); } { diff --git a/types/node/v0/node-tests.ts b/types/node/v0/node-tests.ts index 30dfd2bd72..8bb4ac371d 100644 --- a/types/node/v0/node-tests.ts +++ b/types/node/v0/node-tests.ts @@ -47,6 +47,8 @@ fs.writeFile("Harry Potter", }, assert.ifError); +fs.writeFileSync("testfile", "content", { encoding: "utf8" }); + var content: string, buffer: Buffer; diff --git a/types/node/v4/index.d.ts b/types/node/v4/index.d.ts index 3c5a7745e9..30b40dc2f0 100644 --- a/types/node/v4/index.d.ts +++ b/types/node/v4/index.d.ts @@ -1775,6 +1775,7 @@ declare module "fs" { export function writeFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void; export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; + export function writeFileSync(filename: string, data: any, encoding: string): void; export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void; export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void; export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; diff --git a/types/node/v4/node-tests.ts b/types/node/v4/node-tests.ts index b56bb224e1..247f6969ea 100644 --- a/types/node/v4/node-tests.ts +++ b/types/node/v4/node-tests.ts @@ -151,6 +151,9 @@ namespace fs_tests { encoding: "ascii" }, assert.ifError); + + fs.writeFileSync("testfile", "content", "utf8"); + fs.writeFileSync("testfile", "content", { encoding: "utf8" }); } { diff --git a/types/node/v6/index.d.ts b/types/node/v6/index.d.ts index d0c3a44311..21c363e95a 100644 --- a/types/node/v6/index.d.ts +++ b/types/node/v6/index.d.ts @@ -2564,6 +2564,7 @@ declare module "fs" { export function writeFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void; export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; + export function writeFileSync(filename: string, data: any, encoding: string): void; export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void; export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void; export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; diff --git a/types/node/v6/node-tests.ts b/types/node/v6/node-tests.ts index f7474844e8..057e0858e7 100644 --- a/types/node/v6/node-tests.ts +++ b/types/node/v6/node-tests.ts @@ -168,6 +168,9 @@ namespace fs_tests { encoding: "ascii" }, assert.ifError); + + fs.writeFileSync("testfile", "content", "utf8"); + fs.writeFileSync("testfile", "content", { encoding: "utf8" }); } { diff --git a/types/node/v7/index.d.ts b/types/node/v7/index.d.ts index 31e068cec8..b9763c08fc 100644 --- a/types/node/v7/index.d.ts +++ b/types/node/v7/index.d.ts @@ -2693,6 +2693,7 @@ declare module "fs" { export function writeFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void; export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; + export function writeFileSync(filename: string, data: any, encoding: string): void; export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void; export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void; export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; diff --git a/types/node/v7/node-tests.ts b/types/node/v7/node-tests.ts index de401eb0fc..67b6d9f26f 100644 --- a/types/node/v7/node-tests.ts +++ b/types/node/v7/node-tests.ts @@ -169,6 +169,9 @@ namespace fs_tests { encoding: "ascii" }, assert.ifError); + + fs.writeFileSync("testfile", "content", "utf8"); + fs.writeFileSync("testfile", "content", { encoding: "utf8" }); } { From f8156fb34adb09aa89acb1fe67644928d745f756 Mon Sep 17 00:00:00 2001 From: Brian Lee Date: Wed, 28 Jun 2017 00:48:12 -0700 Subject: [PATCH 104/118] Add util.inspect.defaultOptions property --- types/node/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 7bc703db58..b87382f103 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -3953,7 +3953,8 @@ declare module "util" { styles: { [style: string]: string } - custom: symbol + defaultOptions: InspectOptions; + custom: symbol; } export function isArray(object: any): object is any[]; export function isRegExp(object: any): object is RegExp; From 867079b87c5da7108c945ad0e13da79e0e8673ae Mon Sep 17 00:00:00 2001 From: scarabedore Date: Wed, 28 Jun 2017 10:09:57 +0200 Subject: [PATCH 105/118] Fixed fs-extra-promise with node typings --- types/fs-extra-promise/fs-extra-promise-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/fs-extra-promise/fs-extra-promise-tests.ts b/types/fs-extra-promise/fs-extra-promise-tests.ts index 9f5a8b32bf..c50115871b 100644 --- a/types/fs-extra-promise/fs-extra-promise-tests.ts +++ b/types/fs-extra-promise/fs-extra-promise-tests.ts @@ -205,7 +205,7 @@ readStream = fs.createReadStream(path, { writeStream = fs.createWriteStream(path); writeStream = fs.createWriteStream(path, { flags: str, - encoding: str + defaultEncoding: str }); let isDirectoryCallback = (err: Error, isDirectory: boolean) => { From cd8e349fe7aa27a8445ab7c03d993dff0efdae95 Mon Sep 17 00:00:00 2001 From: Douglas Duteil Date: Wed, 28 Jun 2017 11:18:37 +0200 Subject: [PATCH 106/118] feat(globby): add typings for `globby` --- types/globby/globby-tests.ts | 27 +++++++++++++++++++++++++++ types/globby/index.d.ts | 17 +++++++++++++++++ types/globby/tsconfig.json | 22 ++++++++++++++++++++++ types/globby/tslint.json | 1 + 4 files changed, 67 insertions(+) create mode 100644 types/globby/globby-tests.ts create mode 100644 types/globby/index.d.ts create mode 100644 types/globby/tsconfig.json create mode 100644 types/globby/tslint.json diff --git a/types/globby/globby-tests.ts b/types/globby/globby-tests.ts new file mode 100644 index 0000000000..0e08024c63 --- /dev/null +++ b/types/globby/globby-tests.ts @@ -0,0 +1,27 @@ +// + +import { IOptions } from 'glob'; + +import * as globby from "globby"; + +(async () => { + let result: string[]; + result = await globby('*.tmp') + result = await globby(['a.tmp', '*.tmp', '!{c,d,e}.tmp']) + + result = globby.sync('*.tmp') + result = globby.sync(['a.tmp', '*.tmp', '!{c,d,e}.tmp']) + + result = await globby('*.tmp', Object.freeze({ignore: Object.freeze([])})) + result = globby.sync('*.tmp', Object.freeze({ignore: Object.freeze([])})) +})() + + +const tasks: Array<{ + pattern: string, + options: IOptions +}> = globby.generateGlobTasks(['*.tmp', '!b.tmp'], {ignore: ['c.tmp']}); + +console.log(globby.hasMagic('**') === true); +console.log(globby.hasMagic(['**', 'path1', 'path2']) === true); +console.log(globby.hasMagic(['path1', 'path2']) === false); diff --git a/types/globby/index.d.ts b/types/globby/index.d.ts new file mode 100644 index 0000000000..a469cc3a0b --- /dev/null +++ b/types/globby/index.d.ts @@ -0,0 +1,17 @@ +// Type definitions for globby 0.6 +// Project: https://github.com/sindresorhus/globby#readme +// Definitions by: Douglas Duteil +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import { IOptions } from 'glob'; + +declare function globby(patterns: string | string[], options?: Partial): Promise; + +declare namespace globby { + function sync(patterns: string | string[], options?: Partial): string[]; + function generateGlobTasks(patterns: string | string[], options?: Partial): Array<{pattern: string, options: IOptions}>; + function hasMagic(patterns: string | string[], options?: Partial): boolean; +} + +export = globby; diff --git a/types/globby/tsconfig.json b/types/globby/tsconfig.json new file mode 100644 index 0000000000..fd75c832f1 --- /dev/null +++ b/types/globby/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", + "globby-tests.ts" + ] +} diff --git a/types/globby/tslint.json b/types/globby/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/globby/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 4afe9ac8321711d8258dd78520e91425e1af7054 Mon Sep 17 00:00:00 2001 From: Douglas Duteil Date: Wed, 28 Jun 2017 11:28:16 +0200 Subject: [PATCH 107/118] chore(globby): test on all TypeScript versions --- types/globby/index.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/types/globby/index.d.ts b/types/globby/index.d.ts index a469cc3a0b..8452dc36ff 100644 --- a/types/globby/index.d.ts +++ b/types/globby/index.d.ts @@ -2,7 +2,6 @@ // Project: https://github.com/sindresorhus/globby#readme // Definitions by: Douglas Duteil // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 import { IOptions } from 'glob'; From 9d37d490249c857a9a4ad191f5f5a0179dc7d7b1 Mon Sep 17 00:00:00 2001 From: Douglas Duteil Date: Wed, 28 Jun 2017 11:28:46 +0200 Subject: [PATCH 108/118] fix(globby): lint error --- types/globby/globby-tests.ts | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/types/globby/globby-tests.ts b/types/globby/globby-tests.ts index 0e08024c63..0722b5fb37 100644 --- a/types/globby/globby-tests.ts +++ b/types/globby/globby-tests.ts @@ -1,21 +1,18 @@ -// - import { IOptions } from 'glob'; import * as globby from "globby"; (async () => { let result: string[]; - result = await globby('*.tmp') - result = await globby(['a.tmp', '*.tmp', '!{c,d,e}.tmp']) + result = await globby('*.tmp'); + result = await globby(['a.tmp', '*.tmp', '!{c,d,e}.tmp']); - result = globby.sync('*.tmp') - result = globby.sync(['a.tmp', '*.tmp', '!{c,d,e}.tmp']) - - result = await globby('*.tmp', Object.freeze({ignore: Object.freeze([])})) - result = globby.sync('*.tmp', Object.freeze({ignore: Object.freeze([])})) -})() + result = globby.sync('*.tmp'); + result = globby.sync(['a.tmp', '*.tmp', '!{c,d,e}.tmp']); + result = await globby('*.tmp', Object.freeze({ignore: Object.freeze([])})); + result = globby.sync('*.tmp', Object.freeze({ignore: Object.freeze([])})); +})(); const tasks: Array<{ pattern: string, From 23bb7eed66e50b535c4ce78e1247c59bbb0781fe Mon Sep 17 00:00:00 2001 From: Douglas Duteil Date: Wed, 28 Jun 2017 11:35:01 +0200 Subject: [PATCH 109/118] fix(globby): remove unnecessary "Partial" --- types/globby/index.d.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/types/globby/index.d.ts b/types/globby/index.d.ts index 8452dc36ff..4752b3d6ad 100644 --- a/types/globby/index.d.ts +++ b/types/globby/index.d.ts @@ -2,15 +2,17 @@ // Project: https://github.com/sindresorhus/globby#readme // Definitions by: Douglas Duteil // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 import { IOptions } from 'glob'; -declare function globby(patterns: string | string[], options?: Partial): Promise; +declare function globby(patterns: string | string[], options?: IOptions): Promise; declare namespace globby { - function sync(patterns: string | string[], options?: Partial): string[]; - function generateGlobTasks(patterns: string | string[], options?: Partial): Array<{pattern: string, options: IOptions}>; - function hasMagic(patterns: string | string[], options?: Partial): boolean; + function sync(patterns: string | string[], options?: IOptions): string[]; + function generateGlobTasks(patterns: string | string[], options?: IOptions): Array<{pattern: string, options: IOptions}>; + function hasMagic(patterns: string | string[], options?: IOptions): boolean; } export = globby; + From 5e53b881264a9c9ea0f0019911bfd3aced29acd2 Mon Sep 17 00:00:00 2001 From: Douglas Duteil Date: Wed, 28 Jun 2017 11:38:23 +0200 Subject: [PATCH 110/118] style(globby): remove consecutive blank lines --- types/globby/index.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/types/globby/index.d.ts b/types/globby/index.d.ts index 4752b3d6ad..d06091551c 100644 --- a/types/globby/index.d.ts +++ b/types/globby/index.d.ts @@ -15,4 +15,3 @@ declare namespace globby { } export = globby; - From c7fcc1172979b5152f26499c197884ae74edd145 Mon Sep 17 00:00:00 2001 From: Jacob Rask Date: Wed, 28 Jun 2017 13:32:59 +0200 Subject: [PATCH 111/118] Remove references to removed section in React README setState issues were removed. --- types/react/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react/README.md b/types/react/README.md index e38ba90175..594b16d48f 100644 --- a/types/react/README.md +++ b/types/react/README.md @@ -1,7 +1,7 @@ ## Known Problems & Workarounds ### **The type of `cloneElement` is incorrect.** -This is similar to the `setState` problem, in that `cloneElement(element, props)` should should accept a `props` object with a subset of the properties on `element.props`. There is an additional complication, however—React attributes, such as `key` and `ref`, should also be accepted in `props`, but should not exist on `element.props`. The "correct" way to model this, then, is with +`cloneElement(element, props)` should should accept a `props` object with a subset of the properties on `element.props`. React attributes such as `key` and `ref` should also be accepted in `props`, but should not exist on `element.props`. The "correct" way to model this, then, is with ```ts declare function cloneElement

( element: ReactElement

, From 1b5e242876792f750dbe6af33fcae9eb107d91df Mon Sep 17 00:00:00 2001 From: kimu_shu Date: Wed, 28 Jun 2017 21:55:08 +0900 Subject: [PATCH 112/118] Add overloads for writeFile, appendFile and appendFileSync --- types/node/index.d.ts | 3 +++ types/node/node-tests.ts | 9 +++++++++ types/node/v0/node-tests.ts | 3 +++ types/node/v4/index.d.ts | 3 +++ types/node/v4/node-tests.ts | 9 +++++++++ types/node/v6/index.d.ts | 3 +++ types/node/v6/node-tests.ts | 9 +++++++++ types/node/v7/index.d.ts | 3 +++ types/node/v7/node-tests.ts | 9 +++++++++ 9 files changed, 51 insertions(+) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 9e69aca71e..acf69fefd9 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -2833,14 +2833,17 @@ declare module "fs" { */ export function readFileSync(filename: string, options?: { flag?: string; }): Buffer; export function writeFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void; + export function writeFile(filename: string, data: any, encoding: string, callback?: (err: NodeJS.ErrnoException) => void): void; export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function writeFileSync(filename: string, data: any, encoding: string): void; export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void; export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void; + export function appendFile(filename: string, data: any, encoding: string, callback?: (err: NodeJS.ErrnoException) => void): void; export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function appendFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void; + export function appendFileSync(filename: string, data: any, encoding: string): void; export function appendFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void; export function appendFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void; export function watchFile(filename: string, listener: (curr: Stats, prev: Stats) => void): void; diff --git a/types/node/node-tests.ts b/types/node/node-tests.ts index 0297bc375b..d99b4b8030 100644 --- a/types/node/node-tests.ts +++ b/types/node/node-tests.ts @@ -170,10 +170,19 @@ namespace fs_tests { }, assert.ifError); + fs.writeFile("testfile", "content", "utf8", assert.ifError); + fs.writeFileSync("testfile", "content", "utf8"); fs.writeFileSync("testfile", "content", { encoding: "utf8" }); } + { + fs.appendFile("testfile", "foobar", "utf8", assert.ifError); + fs.appendFile("testfile", "foobar", { encoding: "utf8" }, assert.ifError); + fs.appendFileSync("testfile", "foobar", "utf8"); + fs.appendFileSync("testfile", "foobar", { encoding: "utf8" }); + } + { var content: string; var buffer: Buffer; diff --git a/types/node/v0/node-tests.ts b/types/node/v0/node-tests.ts index 8bb4ac371d..57019bfe86 100644 --- a/types/node/v0/node-tests.ts +++ b/types/node/v0/node-tests.ts @@ -49,6 +49,9 @@ fs.writeFile("Harry Potter", fs.writeFileSync("testfile", "content", { encoding: "utf8" }); +fs.appendFile("testfile", "foobar", { encoding: "utf8" }, assert.ifError); +fs.appendFileSync("testfile", "foobar", { encoding: "utf8" }); + var content: string, buffer: Buffer; diff --git a/types/node/v4/index.d.ts b/types/node/v4/index.d.ts index 30b40dc2f0..14e0a58d1a 100644 --- a/types/node/v4/index.d.ts +++ b/types/node/v4/index.d.ts @@ -1773,14 +1773,17 @@ declare module "fs" { */ export function readFileSync(filename: string, options?: { flag?: string; }): Buffer; export function writeFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void; + export function writeFile(filename: string, data: any, encoding: string, callback?: (err: NodeJS.ErrnoException) => void): void; export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function writeFileSync(filename: string, data: any, encoding: string): void; export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void; export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void; + export function appendFile(filename: string, data: any, encoding: string, callback?: (err: NodeJS.ErrnoException) => void): void; export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function appendFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void; + export function appendFileSync(filename: string, data: any, encoding: string): void; export function appendFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void; export function appendFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void; export function watchFile(filename: string, listener: (curr: Stats, prev: Stats) => void): void; diff --git a/types/node/v4/node-tests.ts b/types/node/v4/node-tests.ts index 247f6969ea..a3e1cca18a 100644 --- a/types/node/v4/node-tests.ts +++ b/types/node/v4/node-tests.ts @@ -152,10 +152,19 @@ namespace fs_tests { }, assert.ifError); + fs.writeFile("testfile", "content", "utf8", assert.ifError); + fs.writeFileSync("testfile", "content", "utf8"); fs.writeFileSync("testfile", "content", { encoding: "utf8" }); } + { + fs.appendFile("testfile", "foobar", "utf8", assert.ifError); + fs.appendFile("testfile", "foobar", { encoding: "utf8" }, assert.ifError); + fs.appendFileSync("testfile", "foobar", "utf8"); + fs.appendFileSync("testfile", "foobar", { encoding: "utf8" }); + } + { var content: string; var buffer: Buffer; diff --git a/types/node/v6/index.d.ts b/types/node/v6/index.d.ts index 21c363e95a..f1e7cc8fdb 100644 --- a/types/node/v6/index.d.ts +++ b/types/node/v6/index.d.ts @@ -2562,14 +2562,17 @@ declare module "fs" { */ export function readFileSync(filename: string, options?: { flag?: string; }): Buffer; export function writeFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void; + export function writeFile(filename: string, data: any, encoding: string, callback?: (err: NodeJS.ErrnoException) => void): void; export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function writeFileSync(filename: string, data: any, encoding: string): void; export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void; export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void; + export function appendFile(filename: string, data: any, encoding: string, callback?: (err: NodeJS.ErrnoException) => void): void; export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function appendFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void; + export function appendFileSync(filename: string, data: any, encoding: string): void; export function appendFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void; export function appendFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void; export function watchFile(filename: string, listener: (curr: Stats, prev: Stats) => void): void; diff --git a/types/node/v6/node-tests.ts b/types/node/v6/node-tests.ts index 057e0858e7..191f1128c2 100644 --- a/types/node/v6/node-tests.ts +++ b/types/node/v6/node-tests.ts @@ -169,10 +169,19 @@ namespace fs_tests { }, assert.ifError); + fs.writeFile("testfile", "content", "utf8", assert.ifError); + fs.writeFileSync("testfile", "content", "utf8"); fs.writeFileSync("testfile", "content", { encoding: "utf8" }); } + { + fs.appendFile("testfile", "foobar", "utf8", assert.ifError); + fs.appendFile("testfile", "foobar", { encoding: "utf8" }, assert.ifError); + fs.appendFileSync("testfile", "foobar", "utf8"); + fs.appendFileSync("testfile", "foobar", { encoding: "utf8" }); + } + { var content: string; var buffer: Buffer; diff --git a/types/node/v7/index.d.ts b/types/node/v7/index.d.ts index b9763c08fc..34a05d33f3 100644 --- a/types/node/v7/index.d.ts +++ b/types/node/v7/index.d.ts @@ -2691,14 +2691,17 @@ declare module "fs" { */ export function readFileSync(filename: string, options?: { flag?: string; }): Buffer; export function writeFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void; + export function writeFile(filename: string, data: any, encoding: string, callback?: (err: NodeJS.ErrnoException) => void): void; export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function writeFileSync(filename: string, data: any, encoding: string): void; export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void; export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void; + export function appendFile(filename: string, data: any, encoding: string, callback?: (err: NodeJS.ErrnoException) => void): void; export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function appendFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void; + export function appendFileSync(filename: string, data: any, encoding: string): void; export function appendFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void; export function appendFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void; export function watchFile(filename: string, listener: (curr: Stats, prev: Stats) => void): void; diff --git a/types/node/v7/node-tests.ts b/types/node/v7/node-tests.ts index 67b6d9f26f..4a2f53ab67 100644 --- a/types/node/v7/node-tests.ts +++ b/types/node/v7/node-tests.ts @@ -170,10 +170,19 @@ namespace fs_tests { }, assert.ifError); + fs.writeFile("testfile", "content", "utf8", assert.ifError); + fs.writeFileSync("testfile", "content", "utf8"); fs.writeFileSync("testfile", "content", { encoding: "utf8" }); } + { + fs.appendFile("testfile", "foobar", "utf8", assert.ifError); + fs.appendFile("testfile", "foobar", { encoding: "utf8" }, assert.ifError); + fs.appendFileSync("testfile", "foobar", "utf8"); + fs.appendFileSync("testfile", "foobar", { encoding: "utf8" }); + } + { var content: string; var buffer: Buffer; From ff3da11908f963a9a3c8463f755115577b1b5468 Mon Sep 17 00:00:00 2001 From: kimu_shu Date: Wed, 28 Jun 2017 23:02:55 +0900 Subject: [PATCH 113/118] Make callback parameter mandatory --- types/node/index.d.ts | 4 ++-- types/node/v4/index.d.ts | 4 ++-- types/node/v6/index.d.ts | 4 ++-- types/node/v7/index.d.ts | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index acf69fefd9..1946277010 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -2833,13 +2833,13 @@ declare module "fs" { */ export function readFileSync(filename: string, options?: { flag?: string; }): Buffer; export function writeFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void; - export function writeFile(filename: string, data: any, encoding: string, callback?: (err: NodeJS.ErrnoException) => void): void; + export function writeFile(filename: string, data: any, encoding: string, callback: (err: NodeJS.ErrnoException) => void): void; export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function writeFileSync(filename: string, data: any, encoding: string): void; export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void; export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void; - export function appendFile(filename: string, data: any, encoding: string, callback?: (err: NodeJS.ErrnoException) => void): void; + export function appendFile(filename: string, data: any, encoding: string, callback: (err: NodeJS.ErrnoException) => void): void; export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function appendFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void; diff --git a/types/node/v4/index.d.ts b/types/node/v4/index.d.ts index 14e0a58d1a..a79f49e35d 100644 --- a/types/node/v4/index.d.ts +++ b/types/node/v4/index.d.ts @@ -1773,13 +1773,13 @@ declare module "fs" { */ export function readFileSync(filename: string, options?: { flag?: string; }): Buffer; export function writeFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void; - export function writeFile(filename: string, data: any, encoding: string, callback?: (err: NodeJS.ErrnoException) => void): void; + export function writeFile(filename: string, data: any, encoding: string, callback: (err: NodeJS.ErrnoException) => void): void; export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function writeFileSync(filename: string, data: any, encoding: string): void; export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void; export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void; - export function appendFile(filename: string, data: any, encoding: string, callback?: (err: NodeJS.ErrnoException) => void): void; + export function appendFile(filename: string, data: any, encoding: string, callback: (err: NodeJS.ErrnoException) => void): void; export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function appendFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void; diff --git a/types/node/v6/index.d.ts b/types/node/v6/index.d.ts index f1e7cc8fdb..b71a70e537 100644 --- a/types/node/v6/index.d.ts +++ b/types/node/v6/index.d.ts @@ -2562,13 +2562,13 @@ declare module "fs" { */ export function readFileSync(filename: string, options?: { flag?: string; }): Buffer; export function writeFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void; - export function writeFile(filename: string, data: any, encoding: string, callback?: (err: NodeJS.ErrnoException) => void): void; + export function writeFile(filename: string, data: any, encoding: string, callback: (err: NodeJS.ErrnoException) => void): void; export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function writeFileSync(filename: string, data: any, encoding: string): void; export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void; export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void; - export function appendFile(filename: string, data: any, encoding: string, callback?: (err: NodeJS.ErrnoException) => void): void; + export function appendFile(filename: string, data: any, encoding: string, callback: (err: NodeJS.ErrnoException) => void): void; export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function appendFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void; diff --git a/types/node/v7/index.d.ts b/types/node/v7/index.d.ts index 34a05d33f3..f075587a95 100644 --- a/types/node/v7/index.d.ts +++ b/types/node/v7/index.d.ts @@ -2691,13 +2691,13 @@ declare module "fs" { */ export function readFileSync(filename: string, options?: { flag?: string; }): Buffer; export function writeFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void; - export function writeFile(filename: string, data: any, encoding: string, callback?: (err: NodeJS.ErrnoException) => void): void; + export function writeFile(filename: string, data: any, encoding: string, callback: (err: NodeJS.ErrnoException) => void): void; export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function writeFileSync(filename: string, data: any, encoding: string): void; export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void; export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void; - export function appendFile(filename: string, data: any, encoding: string, callback?: (err: NodeJS.ErrnoException) => void): void; + export function appendFile(filename: string, data: any, encoding: string, callback: (err: NodeJS.ErrnoException) => void): void; export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function appendFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void; From 9bda5e1be0e15f988ccd28ded41212a23f78f9b2 Mon Sep 17 00:00:00 2001 From: Joscha Feth Date: Wed, 28 Jun 2017 16:09:12 +0200 Subject: [PATCH 114/118] add 'enzyme-to-json' --- types/enzyme-to-json/enzyme-to-json-tests.tsx | 6 +++++ types/enzyme-to-json/index.d.ts | 9 +++++++ types/enzyme-to-json/tsconfig.json | 24 +++++++++++++++++++ types/enzyme-to-json/tslint.json | 1 + 4 files changed, 40 insertions(+) create mode 100644 types/enzyme-to-json/enzyme-to-json-tests.tsx create mode 100644 types/enzyme-to-json/index.d.ts create mode 100644 types/enzyme-to-json/tsconfig.json create mode 100644 types/enzyme-to-json/tslint.json diff --git a/types/enzyme-to-json/enzyme-to-json-tests.tsx b/types/enzyme-to-json/enzyme-to-json-tests.tsx new file mode 100644 index 0000000000..13827a3cdb --- /dev/null +++ b/types/enzyme-to-json/enzyme-to-json-tests.tsx @@ -0,0 +1,6 @@ +import * as React from 'react'; +import { shallow } from 'enzyme'; +import toJson from 'enzyme-to-json'; + +const wrapper = shallow(Hello World!); +const result: object = toJson(wrapper); diff --git a/types/enzyme-to-json/index.d.ts b/types/enzyme-to-json/index.d.ts new file mode 100644 index 0000000000..cba4561649 --- /dev/null +++ b/types/enzyme-to-json/index.d.ts @@ -0,0 +1,9 @@ +// Type definitions for enzyme-to-json 1.5 +// Project: https://github.com/adriantoine/enzyme-to-json#readme +// Definitions by: Joscha Feth +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import { ReactWrapper, ShallowWrapper } from 'enzyme'; + +export default function toJson(wrapper: ShallowWrapper | ReactWrapper | Cheerio): object; diff --git a/types/enzyme-to-json/tsconfig.json b/types/enzyme-to-json/tsconfig.json new file mode 100644 index 0000000000..257f8797e0 --- /dev/null +++ b/types/enzyme-to-json/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "dom", + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "jsx": "react", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "enzyme-to-json-tests.tsx" + ] +} diff --git a/types/enzyme-to-json/tslint.json b/types/enzyme-to-json/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/enzyme-to-json/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 4a877d3484136ae8fa35b1a53bf192fccb5b45f0 Mon Sep 17 00:00:00 2001 From: Leonard Thieu Date: Mon, 26 Jun 2017 11:17:38 -0400 Subject: [PATCH 115/118] [sizzle] Add type definitions. --- types/sizzle/index.d.ts | 63 ++++++++++++++++++++++++++++++++++++ types/sizzle/sizzle-tests.ts | 54 +++++++++++++++++++++++++++++++ types/sizzle/tsconfig.json | 23 +++++++++++++ types/sizzle/tslint.json | 6 ++++ 4 files changed, 146 insertions(+) create mode 100644 types/sizzle/index.d.ts create mode 100644 types/sizzle/sizzle-tests.ts create mode 100644 types/sizzle/tsconfig.json create mode 100644 types/sizzle/tslint.json diff --git a/types/sizzle/index.d.ts b/types/sizzle/index.d.ts new file mode 100644 index 0000000000..bfe24791bf --- /dev/null +++ b/types/sizzle/index.d.ts @@ -0,0 +1,63 @@ +// Type definitions for sizzle 2.3 +// Project: https://sizzlejs.com +// Definitions by: Leonard Thieu +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export as namespace Sizzle; + +declare const Sizzle: SizzleStatic; +export = Sizzle; + +interface SizzleStatic { + selectors: Sizzle.Selectors; + >(selector: string, context: Element | Document | DocumentFragment, results: TArrayLike): TArrayLike; + (selector: string, context?: Element | Document | DocumentFragment): Element[]; + // tslint:disable-next-line:ban-types + compile(selector: string): Function; + matchSelector(element: Element, selector: string): boolean; + matches(selector: string, elements: Element[]): Element[]; +} + +declare namespace Sizzle { + interface Selectors { + cacheLength: number; + match: { [name: string]: RegExp; }; + find: { [name: string]: Selectors.FindFunction; }; + preFilter: { [name: string]: Selectors.PreFilterFunction; }; + filter: { [name: string]: Selectors.FilterFunction; }; + attrHandle: { [name: string]: Selectors.AttrHandleFunction; }; + pseudos: { [name: string]: Selectors.PseudoFunction; }; + setFilters: { [name: string]: Selectors.SetFilterFunction; }; + createPseudo(fn: Selectors.CreatePseudoFunction): Selectors.PseudoFunction; + } + + namespace Selectors { + interface FindFunction { + (match: RegExpMatchArray, context: Element | Document, isXML: boolean): Element[] | void; + } + + interface PreFilterFunction { + (match: RegExpMatchArray): string[]; + } + + interface FilterFunction { + (element: string, ...matches: string[]): boolean; + } + + interface AttrHandleFunction { + (elem: any, casePreservedName: string, isXML: boolean): string; + } + + interface PseudoFunction { + (elem: Element): boolean; + } + + interface CreatePseudoFunction { + (...args: any[]): PseudoFunction; + } + + interface SetFilterFunction { + (elements: Element[], argument: number, not: boolean): Element[]; + } + } +} diff --git a/types/sizzle/sizzle-tests.ts b/types/sizzle/sizzle-tests.ts new file mode 100644 index 0000000000..3c6d17dc64 --- /dev/null +++ b/types/sizzle/sizzle-tests.ts @@ -0,0 +1,54 @@ +/// + +function pseudos() { + const $test = jQuery(document); + Sizzle.selectors.pseudos['fixed'] = (elem) => { + // $test[0] = elem as HTMLElement; + return $test.css('position') === 'fixed'; + }; +} + +function createPseudos_0() { + Sizzle.selectors.pseudos['not'] = + Sizzle.selectors.createPseudo((subSelector) => { + const matcher = Sizzle.compile(subSelector); + return (elem) => { + return !matcher(elem); + }; + }); +} + +function createPseudos_1() { + // An implementation of a case-insensitive contains pseudo + // made for all versions of jQuery + (($) => { + function icontains(elem: HTMLElement, text: string) { + return ( + elem.textContent || + elem.innerText || + $(elem).text() || + '' + ).toLowerCase().indexOf((text || '').toLowerCase()) > -1; + } + + // $.expr.pseudos.icontains = $.expr.createPseudo(function(text) { + // return function(elem) { + // return icontains(elem as HTMLElement, text); + // }; + // }); + })(jQuery); +} + +function setFilters_0() { + Sizzle.selectors.setFilters['first'] = (elements, argument, not) => { + // No argument for first + return not ? elements.slice(1) : [elements[0]]; + }; +} + +function setFilters_1(oldPOS: RegExp) { + Sizzle.selectors.match['POS'] = new RegExp(oldPOS.source.replace('first', 'uno'), 'gi'); + Sizzle.selectors.setFilters['uno'] = Sizzle.selectors.setFilters['first']; + delete Sizzle.selectors.setFilters['first']; + Sizzle('div:uno'); // ==> [

] +} diff --git a/types/sizzle/tsconfig.json b/types/sizzle/tsconfig.json new file mode 100644 index 0000000000..aa10d374d5 --- /dev/null +++ b/types/sizzle/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", + "sizzle-tests.ts" + ] +} diff --git a/types/sizzle/tslint.json b/types/sizzle/tslint.json new file mode 100644 index 0000000000..a4bcc87748 --- /dev/null +++ b/types/sizzle/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "callable-types": false + } +} From 0d99852dfab367b2f4a3bbd639bbb627b7b0c29c Mon Sep 17 00:00:00 2001 From: cjackson234 Date: Wed, 28 Jun 2017 11:58:06 -0400 Subject: [PATCH 116/118] Update index.d.ts --- types/datatables.net/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/datatables.net/index.d.ts b/types/datatables.net/index.d.ts index 37c57198c9..68e26ee048 100644 --- a/types/datatables.net/index.d.ts +++ b/types/datatables.net/index.d.ts @@ -7,7 +7,7 @@ // missing: // - Static methods that are defined in JQueryStatic.fn are not typed. // - Plugin and extension definitions are not typed. -// - Some return types are not fully wokring +// - Some return types are not fully working /// From eff196f9ae7a329e515c911136b4dcbd0c19b383 Mon Sep 17 00:00:00 2001 From: Damien Rajon Date: Wed, 28 Jun 2017 18:27:30 +0200 Subject: [PATCH 117/118] Function is not a default export --- types/async.nexttick/async.nexttick-tests.ts | 2 +- types/async.nexttick/index.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/types/async.nexttick/async.nexttick-tests.ts b/types/async.nexttick/async.nexttick-tests.ts index 9d8acb33aa..90f6ae7f15 100644 --- a/types/async.nexttick/async.nexttick-tests.ts +++ b/types/async.nexttick/async.nexttick-tests.ts @@ -1,4 +1,4 @@ -import nextTick from 'async.nexttick'; +import {nextTick} from 'async.nexttick'; function calledOnNextTick(a: string): number { return parseInt(a, 10); diff --git a/types/async.nexttick/index.d.ts b/types/async.nexttick/index.d.ts index 22efd68fc7..a8572cc087 100644 --- a/types/async.nexttick/index.d.ts +++ b/types/async.nexttick/index.d.ts @@ -3,4 +3,4 @@ // Definitions by: Damien "pyrho" Rajon // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -export default function nextTick(callback: () => void, ...args: any[]): void; +export function nextTick(callback: () => void, ...args: any[]): void; From c0ec19e2d0fe3060b7dd490f74115a4e39840ba2 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Wed, 28 Jun 2017 09:50:28 -0700 Subject: [PATCH 118/118] Fix underscore tests for TS 2.4 A test in underscore mistakenly used the truthiness of _.identity as a predicate for _.every, even though the predicate is supposed to return boolean. The new code wraps _.identity in an arrow and prefixes a `!!` to coerce truthy values to true. --- types/underscore/underscore-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/underscore/underscore-tests.ts b/types/underscore/underscore-tests.ts index 11dcf477a0..f72bb3ca68 100644 --- a/types/underscore/underscore-tests.ts +++ b/types/underscore/underscore-tests.ts @@ -156,7 +156,7 @@ _.where(listOfPlays, { author: "Shakespeare", year: 1611 }); var odds = _.reject([1, 2, 3, 4, 5, 6], (num) => num % 2 == 0); -_.every([true, 1, null, 'yes'], _.identity); +_.every([true, 1, null, 'yes'], x => !!_.identity(x)); _.any([null, 0, 'yes', false]);