From 7cbe3ae33abcaa74f47bf2a927dc93b6c077660f Mon Sep 17 00:00:00 2001 From: Hugues Stefanski Date: Sun, 27 Jan 2019 12:51:22 +0100 Subject: [PATCH 001/469] d3-array : Added group, rollup, and quickselect methods --- types/d3-array/d3-array-tests.ts | 26 ++++++++++++++- types/d3-array/index.d.ts | 57 +++++++++++++++++++++++++++++++- 2 files changed, 81 insertions(+), 2 deletions(-) diff --git a/types/d3-array/d3-array-tests.ts b/types/d3-array/d3-array-tests.ts index 11f208f869..76e7773732 100644 --- a/types/d3-array/d3-array-tests.ts +++ b/types/d3-array/d3-array-tests.ts @@ -485,6 +485,12 @@ num = mixedObjectDateBisectorObject.right(readonlyMixedObjectArray, new Date(201 num = mixedObjectDateBisectorObject.right(readonlyMixedObjectArray, new Date(2015, 3, 14), 1); num = mixedObjectDateBisectorObject.right(readonlyMixedObjectArray, new Date(2015, 3, 14), 3, 4); +// quickselect +numbersArray = d3Array.quickselect(numbersArray, 3); +numbersArray = d3Array.quickselect(numbersArray, 3, 0); +numbersArray = d3Array.quickselect(numbersArray, 3, 0, 5); +numbersArray = d3Array.quickselect(numbersArray, 3, 0, 5, d3Array.descending); + // ascending() ----------------------------------------------------------------- num = d3Array.ascending(undefined, 20); @@ -536,6 +542,24 @@ mergedArray = d3Array.merge([testArray1, [15, 30]]); // fails, type mismatch mergedArray = d3Array.merge(readonlyTestArrays); // inferred type mergedArray = d3Array.merge(readonlyTestArrays); // explicit type +interface ObjDefinition { + name: string; + amount: string; + date: string; +} + +const objArray: Array = [ + { name: "jim", amount: "34.0", date: "11/12/2015" }, + { name: "carl", amount: "120.11", date: "11/12/2015" }, + { name: "stacy", amount: "12.01", date: "01/04/2016" }, + { name: "stacy", amount: "34.05", date: "01/04/2016" } +]; + +let myMap: Map; + +myMap = d3Array.group(objArray, d => d.name); +myMap = d3Array.rollup(objArray, d => d.length, d => d.name); + // cross() --------------------------------------------------------------------- let crossed: Array<[string, number]>; @@ -779,7 +803,7 @@ histoMixedObject_Date = histoMixedObject_Date.domain(timeScale.domain()); // fai domainFnDate = histoMixedObject_Date.domain(); histoMixedObject_DateOrUndefined = histoMixedObject_DateOrUndefined.domain([new Date(2014, 3, 15), new Date(2017, 4, 15)]); histoMixedObject_DateOrUndefined = histoMixedObject_DateOrUndefined.domain([domain[0], domain[domain.length]]); -histoMixedObject_DateOrUndefined = histoMixedObject_DateOrUndefined.domain((values) => [values[0]!, values[values.length]!]); +histoMixedObject_DateOrUndefined = histoMixedObject_DateOrUndefined.domain((values) => [values[0]!, values[values.length]!]); // thresholds(...) ------------------------------------------------------------- diff --git a/types/d3-array/index.d.ts b/types/d3-array/index.d.ts index 391e2786be..37c725a6dd 100644 --- a/types/d3-array/index.d.ts +++ b/types/d3-array/index.d.ts @@ -3,7 +3,8 @@ // Definitions by: Alex Ford // Boris Yankov // Tom Wanzek -// denisname +// denisname , +// Hugues Stefanski // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -173,6 +174,44 @@ export interface Bisector { export function bisector(comparator: (a: T, b: U) => number): Bisector; export function bisector(accessor: (x: T) => U): Bisector; +/** + * Rearranges items so that all items in the [left, k] are the smallest. The k-th element will have the (k - left + 1)-th smallest value in [left, right]. + * + * @param array The array to partially sort (in place). + * @param k The middle index for partial sorting. + */ +export function quickselect(array: Array, k: number): Array; + +/** + * Rearranges items so that all items in the [left, k] are the smallest. The k-th element will have the (k - left + 1)-th smallest value in [left, right]. + * + * @param array The array to partially sort (in place). + * @param k The middle index for partial sorting. + * @param left The left index of the range to sort. + */ +export function quickselect(array: Array, k: number, left: number): Array; + +/** + * Rearranges items so that all items in the [left, k] are the smallest. The k-th element will have the (k - left + 1)-th smallest value in [left, right]. + * + * @param array The array to partially sort (in place). + * @param k The middle index for partial sorting. + * @param left The left index of the range to sort. + * @param right The right index. + */ +export function quickselect(array: Array, k: number, left: number, right: number): Array; + +/** + * Rearranges items so that all items in the [left, k] are the smallest. The k-th element will have the (k - left + 1)-th smallest value in [left, right]. + * + * @param array The array to partially sort (in place). + * @param k The middle index for partial sorting. + * @param left The left index of the range to sort. + * @param right The right index. + * @param compare The compare function. + */ +export function quickselect(array: Array, k: number, left: number, right: number, compare: (a: Primitive | undefined, b: Primitive | undefined) => number): Array; + // NB. this is limited to primitive values due to D3's use of the <, >, and >= operators. Results get weird for object instances. /** * Compares two primitive values for sorting (in ascending order). @@ -189,6 +228,22 @@ export function descending(a: Primitive | undefined, b: Primitive | undefined): // Transforming Arrays // -------------------------------------------------------------------------------------- +/** + * Groups the specified array of values into a Map from key to array of value. + * @param a The array to group. + * @param key The key function. + */ +export function group(a: ArrayLike, key: (value: TObject) => TKey): Map; + + +/** + * Groups and reduces the specified array of values into a Map from key to value. + * @param a The array to group. + * @param reduce The reduce function. + * @param key The key function. + */ +export function rollup(a: ArrayLike, reduce: (value: Array) => number, key: (value: TObject) => TKey): Map; + /** * Returns the Cartesian product of the two arrays a and b. * For each element i in the specified array a and each element j in the specified array b, in order, From a6ad97bab4373efd361df2692b99b8aada92e2b7 Mon Sep 17 00:00:00 2001 From: Hugues Stefanski Date: Sun, 27 Jan 2019 12:54:26 +0100 Subject: [PATCH 002/469] d3-array : Updated version number --- types/d3-array/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/d3-array/index.d.ts b/types/d3-array/index.d.ts index 37c725a6dd..9a48411b4e 100644 --- a/types/d3-array/index.d.ts +++ b/types/d3-array/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for D3JS d3-array module 1.2 +// Type definitions for D3JS d3-array module 2.0 // Project: https://github.com/d3/d3-array // Definitions by: Alex Ford // Boris Yankov @@ -8,7 +8,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 -// Last module patch version validated against: 1.2.1 +// Last module patch version validated against: 2.0.3 // -------------------------------------------------------------------------- // Shared Types and Interfaces From 5251033d220a1a1958e8519ac671c2fca2dec7cb Mon Sep 17 00:00:00 2001 From: Hugues Stefanski Date: Sun, 27 Jan 2019 13:00:35 +0100 Subject: [PATCH 003/469] d3-array : fix linting errors --- types/d3-array/d3-array-tests.ts | 2 +- types/d3-array/index.d.ts | 30 +++++++++++++++--------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/types/d3-array/d3-array-tests.ts b/types/d3-array/d3-array-tests.ts index 76e7773732..a957213bbc 100644 --- a/types/d3-array/d3-array-tests.ts +++ b/types/d3-array/d3-array-tests.ts @@ -548,7 +548,7 @@ interface ObjDefinition { date: string; } -const objArray: Array = [ +const objArray: ObjDefinition[] = [ { name: "jim", amount: "34.0", date: "11/12/2015" }, { name: "carl", amount: "120.11", date: "11/12/2015" }, { name: "stacy", amount: "12.01", date: "01/04/2016" }, diff --git a/types/d3-array/index.d.ts b/types/d3-array/index.d.ts index 9a48411b4e..eae332ca54 100644 --- a/types/d3-array/index.d.ts +++ b/types/d3-array/index.d.ts @@ -176,41 +176,41 @@ export function bisector(accessor: (x: T) => U): Bisector; /** * Rearranges items so that all items in the [left, k] are the smallest. The k-th element will have the (k - left + 1)-th smallest value in [left, right]. - * + * * @param array The array to partially sort (in place). - * @param k The middle index for partial sorting. + * @param k The middle index for partial sorting. */ -export function quickselect(array: Array, k: number): Array; +export function quickselect(array: ArrayLike, k: number): T[]; /** * Rearranges items so that all items in the [left, k] are the smallest. The k-th element will have the (k - left + 1)-th smallest value in [left, right]. - * + * * @param array The array to partially sort (in place). - * @param k The middle index for partial sorting. + * @param k The middle index for partial sorting. * @param left The left index of the range to sort. */ -export function quickselect(array: Array, k: number, left: number): Array; +export function quickselect(array: ArrayLike, k: number, left: number): T[]; /** * Rearranges items so that all items in the [left, k] are the smallest. The k-th element will have the (k - left + 1)-th smallest value in [left, right]. - * + * * @param array The array to partially sort (in place). - * @param k The middle index for partial sorting. + * @param k The middle index for partial sorting. * @param left The left index of the range to sort. * @param right The right index. */ -export function quickselect(array: Array, k: number, left: number, right: number): Array; +export function quickselect(array: ArrayLike, k: number, left: number, right: number): T[]; /** * Rearranges items so that all items in the [left, k] are the smallest. The k-th element will have the (k - left + 1)-th smallest value in [left, right]. - * + * * @param array The array to partially sort (in place). - * @param k The middle index for partial sorting. + * @param k The middle index for partial sorting. * @param left The left index of the range to sort. * @param right The right index. * @param compare The compare function. */ -export function quickselect(array: Array, k: number, left: number, right: number, compare: (a: Primitive | undefined, b: Primitive | undefined) => number): Array; +export function quickselect(array: ArrayLike, k: number, left: number, right: number, compare: (a: Primitive | undefined, b: Primitive | undefined) => number): T[]; // NB. this is limited to primitive values due to D3's use of the <, >, and >= operators. Results get weird for object instances. /** @@ -235,14 +235,14 @@ export function descending(a: Primitive | undefined, b: Primitive | undefined): */ export function group(a: ArrayLike, key: (value: TObject) => TKey): Map; - /** - * Groups and reduces the specified array of values into a Map from key to value. + * Groups and reduces the specified array of values into a Map from key to value. + * * @param a The array to group. * @param reduce The reduce function. * @param key The key function. */ -export function rollup(a: ArrayLike, reduce: (value: Array) => number, key: (value: TObject) => TKey): Map; +export function rollup(a: ArrayLike, reduce: (value: ArrayLike) => number, key: (value: TObject) => TKey): Map; /** * Returns the Cartesian product of the two arrays a and b. From 677187f7ad49195546aaade3f5b00d8995977e94 Mon Sep 17 00:00:00 2001 From: Hugues Stefanski Date: Sun, 3 Feb 2019 08:53:06 +0100 Subject: [PATCH 004/469] d3-array : fixed group and rollup types #32528 --- types/d3-array/d3-array-tests.ts | 7 +++---- types/d3-array/index.d.ts | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/types/d3-array/d3-array-tests.ts b/types/d3-array/d3-array-tests.ts index a957213bbc..381d49869c 100644 --- a/types/d3-array/d3-array-tests.ts +++ b/types/d3-array/d3-array-tests.ts @@ -555,10 +555,9 @@ const objArray: ObjDefinition[] = [ { name: "stacy", amount: "34.05", date: "01/04/2016" } ]; -let myMap: Map; - -myMap = d3Array.group(objArray, d => d.name); -myMap = d3Array.rollup(objArray, d => d.length, d => d.name); +const grouped: Map = d3Array.group(objArray, d => d.name); +const rolledup: Map = d3Array.rollup(objArray, d => d.length, d => d.name); +const rolledup2: Map = d3Array.rollup(objArray, d => d.map(u => u.name).join(' '), d => d.name); // cross() --------------------------------------------------------------------- diff --git a/types/d3-array/index.d.ts b/types/d3-array/index.d.ts index eae332ca54..7971478581 100644 --- a/types/d3-array/index.d.ts +++ b/types/d3-array/index.d.ts @@ -233,7 +233,7 @@ export function descending(a: Primitive | undefined, b: Primitive | undefined): * @param a The array to group. * @param key The key function. */ -export function group(a: ArrayLike, key: (value: TObject) => TKey): Map; +export function group(a: ArrayLike, key: (value: TObject) => TKey): Map; /** * Groups and reduces the specified array of values into a Map from key to value. @@ -242,7 +242,7 @@ export function group(a: ArrayLike, key: (value: TObject * @param reduce The reduce function. * @param key The key function. */ -export function rollup(a: ArrayLike, reduce: (value: ArrayLike) => number, key: (value: TObject) => TKey): Map; +export function rollup(a: ArrayLike, reduce: (value: TObject[]) => TReduce, key: (value: TObject) => TKey): Map; /** * Returns the Cartesian product of the two arrays a and b. From f04d918623b3e16862a335b1caa7587e3f8ce3be Mon Sep 17 00:00:00 2001 From: Hugues Stefanski Date: Sun, 3 Feb 2019 09:06:07 +0100 Subject: [PATCH 005/469] d3-array v2 : added paths for other libraries --- types/d3-array/v1/d3-array-tests.ts | 941 ++++++++++++++++++++++++++++ types/d3-array/v1/index.d.ts | 547 ++++++++++++++++ types/d3-array/v1/tsconfig.json | 24 + types/d3-array/v1/tslint.json | 7 + types/d3/tsconfig.json | 5 + types/d3/v4/tsconfig.json | 3 + 6 files changed, 1527 insertions(+) create mode 100644 types/d3-array/v1/d3-array-tests.ts create mode 100644 types/d3-array/v1/index.d.ts create mode 100644 types/d3-array/v1/tsconfig.json create mode 100644 types/d3-array/v1/tslint.json diff --git a/types/d3-array/v1/d3-array-tests.ts b/types/d3-array/v1/d3-array-tests.ts new file mode 100644 index 0000000000..66d99dc9b1 --- /dev/null +++ b/types/d3-array/v1/d3-array-tests.ts @@ -0,0 +1,941 @@ +/** + * Typescript definition tests for d3/d3-array module + * + * Note: These tests are intended to test the definitions only + * in the sense of typing and call signature consistency. They + * are not intended as functional tests. + */ + +import * as d3Array from 'd3-array'; +import { scaleTime } from 'd3-scale'; +import { timeYear } from 'd3-time'; + +// ----------------------------------------------------------------------------- +// Preparatory Steps +// ----------------------------------------------------------------------------- + +class NumCoercible { + a: number; + + constructor(a: number) { + this.a = a; + } + valueOf() { + return this.a; + } +} + +class MixedObject { + num: number; + str: string; + numeric: NumCoercible; + date: Date; + + constructor(a: number, date: Date) { + this.num = a; + this.str = a.toString(); + this.numeric = new NumCoercible(a); + this.date = date; + } +} + +let num: number; +let undef: undefined; +let mixedObject: MixedObject; + +let numOrUndefined: number | undefined; +let strOrUndefined: string | undefined; +let numericOrUndefined: NumCoercible | undefined; +let dateOrUndefined: Date | undefined; +let mixedObjectOrUndefined: MixedObject | undefined; +let numOrUndefinedExtent: [number, number] | [undefined, undefined]; +let strOrUndefinedExtent: [string, string] | [undefined, undefined]; +let numericOrUndefinedExtent: [NumCoercible, NumCoercible] | [undefined, undefined]; +let dateMixedOrUndefined: [Date, Date] | [undefined, undefined]; +let mixedOrUndefinedExtent: [d3Array.Primitive | NumCoercible, d3Array.Primitive | NumCoercible] | [undefined, undefined]; +let dateOrUndefinedExtent: [Date, Date] | [undefined, undefined]; + +let numbersArray = [10, 20, 30, 40, 50]; +const numbersOrUndefinedArray = [10, 20, undefined, null, 40, 50]; +let stringyNumbersArray = ['10', '20', '30', '40', '50']; +const numericArray = [new NumCoercible(10), new NumCoercible(20), new NumCoercible(30), new NumCoercible(40), new NumCoercible(50)]; +let dateArray = [new Date(2016, 6, 1), new Date(2016, 7, 30), new Date(2015, 3, 15)]; + +const mixedObjectArray = [ + new MixedObject(10, new Date(2016, 6, 1)), + new MixedObject(20, new Date(2016, 7, 30)), + new MixedObject(30, new Date(2015, 3, 15)), + new MixedObject(40, new Date(2014, 3, 15)), + new MixedObject(50, new Date(2017, 4, 15)) +]; + +const mixedObjectOrUndefinedArray = [...mixedObjectArray, undefined]; +const mixedObjectArrayLike = mixedObjectArray as ArrayLike; + +let typedArray = Uint8Array.from(numbersArray); +let readonlyNumbersArray = numbersArray as ReadonlyArray; +const readonlyNumbersOrUndefinedArray = numbersOrUndefinedArray as ReadonlyArray; +const readonlyStringyNumbersArray = stringyNumbersArray as ReadonlyArray; +const readonlyNumericArray = numericArray as ReadonlyArray; +const readonlyDateArray = dateArray as ReadonlyArray; +const readonlyMixedObjectArray = mixedObjectArray as ReadonlyArray; +const readonlyMixedObjectOrUndefinedArray = mixedObjectOrUndefinedArray as ReadonlyArray; + +function accessorMixedObjectToNum(datum: MixedObject, index: number, array: ArrayLike): number { + return datum.num; +} + +function accessorMixedObjectToStr(datum: MixedObject, index: number, array: ArrayLike): string { + return datum.str; +} + +function accessorMixedObjectToNumeric(datum: MixedObject, index: number, array: ArrayLike): NumCoercible { + return datum.numeric; +} + +function accessorMixedObjectToDate(datum: MixedObject, index: number, array: ArrayLike): Date { + return datum.date; +} + +function accessorMixedObjectToNumOrUndefined(datum: MixedObject | undefined, index: number, array: ArrayLike): number | undefined | null { + return datum ? datum.num : undefined; +} + +function accessorMixedObjectToStrOrUndefined(datum: MixedObject | undefined, index: number, array: ArrayLike): string | undefined | null { + return datum ? datum.str : undefined; +} + +function accessorLikeMixedObjectToNum(datum: MixedObject, index: number, array: ArrayLike): number { + return datum.num; +} + +function accessorLikeMixedObjectToStr(datum: MixedObject, index: number, array: ArrayLike): string { + return datum.str; +} + +function accessorLikeMixedObjectToNumeric(datum: MixedObject, index: number, array: ArrayLike): NumCoercible { + return datum.numeric; +} + +function accessorLikeMixedObjectToDate(datum: MixedObject, index: number, array: ArrayLike): Date { + return datum.date; +} + +function accessorLikeMixedObjectToNumOrUndefined(datum: MixedObject | undefined, index: number, array: ArrayLike): number | undefined | null { + return datum ? datum.num : undefined; +} + +function accessorLikeMixedObjectToStrOrUndefined(datum: MixedObject | undefined, index: number, array: ArrayLike): string | undefined | null { + return datum ? datum.str : undefined; +} + +function accessorReadOnlyMixedObjectToNumOrUndefined(datum: MixedObject | undefined, index: number, array: ArrayLike): number | undefined | null { + return datum ? datum.num : undefined; +} + +// ----------------------------------------------------------------------------- +// Test Statistics +// ----------------------------------------------------------------------------- + +// max() ----------------------------------------------------------------------- + +// without accessors + +numOrUndefined = d3Array.max(numbersArray); +strOrUndefined = d3Array.max(stringyNumbersArray); +numericOrUndefined = d3Array.max(numericArray); +dateOrUndefined = d3Array.max(dateArray); + +// ArrayLike test cases + +numOrUndefined = d3Array.max(typedArray); +numOrUndefined = d3Array.max(readonlyNumbersOrUndefinedArray); +strOrUndefined = d3Array.max(readonlyStringyNumbersArray); +numericOrUndefined = d3Array.max(readonlyNumericArray); +dateOrUndefined = d3Array.max(readonlyDateArray); + +// with accessors + +numOrUndefined = d3Array.max(mixedObjectArray, accessorMixedObjectToNum); +strOrUndefined = d3Array.max(mixedObjectArray, accessorMixedObjectToStr); +numericOrUndefined = d3Array.max(mixedObjectArray, accessorMixedObjectToNumeric); +dateOrUndefined = d3Array.max(mixedObjectArray, accessorMixedObjectToDate); +numOrUndefined = d3Array.max(mixedObjectArray, accessorMixedObjectToNumOrUndefined); +strOrUndefined = d3Array.max(mixedObjectArray, accessorMixedObjectToStrOrUndefined); +numOrUndefined = d3Array.max(readonlyMixedObjectOrUndefinedArray, accessorReadOnlyMixedObjectToNumOrUndefined); + +numOrUndefined = d3Array.max(mixedObjectArrayLike, accessorLikeMixedObjectToNum); +numOrUndefined = d3Array.max(mixedObjectArray, accessorLikeMixedObjectToNum); +numOrUndefined = d3Array.max(mixedObjectArray, accessorReadOnlyMixedObjectToNumOrUndefined); + +numOrUndefined = d3Array.max(mixedObjectArray, (d) => { + const l: MixedObject = d; + return l.num; +}); + +strOrUndefined = d3Array.max(mixedObjectArray, (d) => { + const l: MixedObject = d; + return l.str; +}); + +// $ExpectError +numOrUndefined = d3Array.max(readonlyNumbersArray, (d, i, a) => { a.push(3); return 0; }); + +// min() ----------------------------------------------------------------------- + +// without accessors + +numOrUndefined = d3Array.min(numbersArray); +strOrUndefined = d3Array.min(stringyNumbersArray); +numericOrUndefined = d3Array.min(numericArray); +dateOrUndefined = d3Array.min(dateArray); + +// ArrayLike test cases + +numOrUndefined = d3Array.min(typedArray); +numOrUndefined = d3Array.min(readonlyNumbersOrUndefinedArray); +strOrUndefined = d3Array.min(readonlyStringyNumbersArray); +numericOrUndefined = d3Array.min(readonlyNumericArray); +dateOrUndefined = d3Array.min(readonlyDateArray); + +// with accessors + +numOrUndefined = d3Array.min(mixedObjectArray, accessorMixedObjectToNum); +strOrUndefined = d3Array.min(mixedObjectArray, accessorMixedObjectToStr); +numericOrUndefined = d3Array.min(mixedObjectArray, accessorMixedObjectToNumeric); +dateOrUndefined = d3Array.min(mixedObjectArray, accessorMixedObjectToDate); +numOrUndefined = d3Array.min(mixedObjectArray, accessorMixedObjectToNumOrUndefined); +strOrUndefined = d3Array.min(mixedObjectArray, accessorMixedObjectToStrOrUndefined); +numOrUndefined = d3Array.min(readonlyMixedObjectOrUndefinedArray, accessorReadOnlyMixedObjectToNumOrUndefined); + +// extent() -------------------------------------------------------------------- + +// without accessors + +numOrUndefinedExtent = d3Array.extent(numbersArray); +strOrUndefinedExtent = d3Array.extent(stringyNumbersArray); +numericOrUndefinedExtent = d3Array.extent(numericArray); +dateOrUndefinedExtent = d3Array.extent(dateArray); + +// ArrayLike test cases + +numOrUndefinedExtent = d3Array.extent(typedArray); +numOrUndefinedExtent = d3Array.extent(readonlyNumbersOrUndefinedArray); +strOrUndefinedExtent = d3Array.extent(readonlyStringyNumbersArray); +numericOrUndefinedExtent = d3Array.extent(readonlyNumericArray); +dateOrUndefinedExtent = d3Array.extent(readonlyDateArray); + +// with accessors + +numOrUndefinedExtent = d3Array.extent(mixedObjectArray, accessorMixedObjectToNum); +strOrUndefinedExtent = d3Array.extent(mixedObjectArray, accessorMixedObjectToStr); +mixedOrUndefinedExtent = d3Array.extent(mixedObjectArray, accessorMixedObjectToNumeric); +dateMixedOrUndefined = d3Array.extent(mixedObjectArray, accessorMixedObjectToDate); +numOrUndefinedExtent = d3Array.extent(mixedObjectArray, accessorMixedObjectToNumOrUndefined); +strOrUndefinedExtent = d3Array.extent(mixedObjectArray, accessorMixedObjectToStrOrUndefined); +numOrUndefinedExtent = d3Array.extent(readonlyMixedObjectOrUndefinedArray, accessorReadOnlyMixedObjectToNumOrUndefined); + +// mean() ---------------------------------------------------------------------- + +numOrUndefined = d3Array.mean(numbersArray); +numOrUndefined = d3Array.mean(numericArray); +numOrUndefined = d3Array.mean(numbersOrUndefinedArray); + +numOrUndefined = d3Array.mean(typedArray); +numOrUndefined = d3Array.mean(readonlyNumbersOrUndefinedArray); +numOrUndefined = d3Array.mean(readonlyNumericArray); +numOrUndefined = d3Array.mean(readonlyNumbersOrUndefinedArray); + +numOrUndefined = d3Array.mean(mixedObjectArray, accessorMixedObjectToNum); +numOrUndefined = d3Array.mean(mixedObjectOrUndefinedArray, accessorMixedObjectToNumOrUndefined); +numOrUndefined = d3Array.mean(readonlyMixedObjectOrUndefinedArray, accessorReadOnlyMixedObjectToNumOrUndefined); + +// median() -------------------------------------------------------------------- + +numOrUndefined = d3Array.median(numbersArray); +numOrUndefined = d3Array.median(numericArray); +numOrUndefined = d3Array.median(numbersOrUndefinedArray); + +numOrUndefined = d3Array.median(typedArray); +numOrUndefined = d3Array.median(readonlyNumbersArray); +numOrUndefined = d3Array.median(readonlyNumericArray); +numOrUndefined = d3Array.median(readonlyNumbersOrUndefinedArray); + +numOrUndefined = d3Array.median(mixedObjectArray, accessorMixedObjectToNum); +numOrUndefined = d3Array.median(mixedObjectOrUndefinedArray, accessorMixedObjectToNumOrUndefined); +numOrUndefined = d3Array.median(readonlyMixedObjectOrUndefinedArray, accessorReadOnlyMixedObjectToNumOrUndefined); + +// quantile() ------------------------------------------------------------------ + +numOrUndefined = d3Array.quantile(numbersArray, 0.5); +numOrUndefined = d3Array.quantile(numericArray, 0.5); +numOrUndefined = d3Array.quantile(numbersOrUndefinedArray, 0.5); + +numOrUndefined = d3Array.quantile(typedArray, 0.5); +numOrUndefined = d3Array.quantile(readonlyNumbersArray, 0.5); +numOrUndefined = d3Array.quantile(readonlyNumericArray, 0.5); +numOrUndefined = d3Array.quantile(readonlyNumbersOrUndefinedArray, 0.5); + +numOrUndefined = d3Array.quantile(mixedObjectArray, 0.5, accessorMixedObjectToNum); +numOrUndefined = d3Array.quantile(mixedObjectOrUndefinedArray, 0.5, accessorMixedObjectToNumOrUndefined); +numOrUndefined = d3Array.quantile(readonlyMixedObjectOrUndefinedArray, 0.5, accessorReadOnlyMixedObjectToNumOrUndefined); + +// sum() ----------------------------------------------------------------------- + +numOrUndefined = d3Array.sum(numbersArray); +numOrUndefined = d3Array.sum(numericArray); +numOrUndefined = d3Array.sum(numbersOrUndefinedArray); + +numOrUndefined = d3Array.sum(typedArray); +numOrUndefined = d3Array.sum(readonlyNumbersArray); +numOrUndefined = d3Array.sum(readonlyNumericArray); +numOrUndefined = d3Array.sum(readonlyNumbersOrUndefinedArray); + +numOrUndefined = d3Array.sum(mixedObjectArray, accessorMixedObjectToNum); +numOrUndefined = d3Array.sum(mixedObjectOrUndefinedArray, accessorMixedObjectToNumOrUndefined); +numOrUndefined = d3Array.sum(readonlyMixedObjectOrUndefinedArray, accessorReadOnlyMixedObjectToNumOrUndefined); + +// deviation() ----------------------------------------------------------------- + +numOrUndefined = d3Array.deviation(numbersArray); +numOrUndefined = d3Array.deviation(numericArray); +numOrUndefined = d3Array.deviation(numbersOrUndefinedArray); + +numOrUndefined = d3Array.deviation(typedArray); +numOrUndefined = d3Array.deviation(readonlyNumbersArray); +numOrUndefined = d3Array.deviation(readonlyNumericArray); +numOrUndefined = d3Array.deviation(readonlyNumbersOrUndefinedArray); + +numOrUndefined = d3Array.deviation(mixedObjectArray, accessorMixedObjectToNum); +numOrUndefined = d3Array.deviation(mixedObjectOrUndefinedArray, accessorMixedObjectToNumOrUndefined); +numOrUndefined = d3Array.deviation(readonlyMixedObjectOrUndefinedArray, accessorReadOnlyMixedObjectToNumOrUndefined); + +// variance() ------------------------------------------------------------------ + +numOrUndefined = d3Array.variance(numbersArray); +numOrUndefined = d3Array.variance(numericArray); +numOrUndefined = d3Array.variance(numbersOrUndefinedArray); + +numOrUndefined = d3Array.variance(typedArray); +numOrUndefined = d3Array.variance(readonlyNumbersArray); +numOrUndefined = d3Array.variance(readonlyNumericArray); +numOrUndefined = d3Array.variance(readonlyNumbersOrUndefinedArray); + +numOrUndefined = d3Array.variance(mixedObjectArray, accessorMixedObjectToNum); +numOrUndefined = d3Array.variance(mixedObjectOrUndefinedArray, accessorMixedObjectToNumOrUndefined); +numOrUndefined = d3Array.variance(readonlyMixedObjectOrUndefinedArray, accessorReadOnlyMixedObjectToNumOrUndefined); + +// ----------------------------------------------------------------------------- +// Test Searching Arrays +// ----------------------------------------------------------------------------- + +numbersArray = [0, 2, 3, 4, 7, 8]; +stringyNumbersArray = ['0', '2', '3', '4', '7', '8']; +dateArray = [new Date(2010, 1, 1), new Date(2011, 1, 1), new Date(2012, 1, 1), new Date(2013, 1, 1)]; +typedArray = Uint8Array.from(numbersArray); + +// scan() ---------------------------------------------------------------------- + +numOrUndefined = d3Array.scan(numbersArray); +numOrUndefined = d3Array.scan(typedArray); +numOrUndefined = d3Array.scan(readonlyNumbersArray); + +numOrUndefined = d3Array.scan(mixedObjectArray, (a, b) => { + const aElem: MixedObject = a; + const bElem: MixedObject = b; + return a.num - b.num; +}); + +numOrUndefined = d3Array.scan(readonlyMixedObjectArray, (a, b) => { + const aElem: MixedObject = a; + const bElem: MixedObject = b; + return a.num - b.num; +}); + +numOrUndefined = d3Array.scan(mixedObjectOrUndefinedArray, (a, b) => { + const aElem: MixedObject | undefined = a; + const bElem: MixedObject | undefined = b; + return a && b ? a.num - b.num : NaN; +}); + +numOrUndefined = d3Array.scan(readonlyMixedObjectOrUndefinedArray, (a, b) => { + const aElem: MixedObject | undefined = a; + const bElem: MixedObject | undefined = b; + return a && b ? a.num - b.num : NaN; +}); + +// bisectLeft() ---------------------------------------------------------------- + +num = d3Array.bisectLeft(numbersArray, 4); +num = d3Array.bisectLeft(numbersArray, 4, 1); +num = d3Array.bisectLeft(numbersArray, 4, 1, 4); + +num = d3Array.bisectLeft(stringyNumbersArray, '21'); +num = d3Array.bisectLeft(stringyNumbersArray, '21', 1); +num = d3Array.bisectLeft(stringyNumbersArray, '21', 1, 4); + +num = d3Array.bisectLeft(dateArray, new Date(2011, 2, 1)); +num = d3Array.bisectLeft(dateArray, new Date(2011, 2, 1), 1); +num = d3Array.bisectLeft(dateArray, new Date(2011, 2, 1), 1, 2); + +num = d3Array.bisectLeft(typedArray, 4); +num = d3Array.bisectLeft(typedArray, 4, 1); +num = d3Array.bisectLeft(typedArray, 4, 1, 4); + +num = d3Array.bisectLeft(readonlyNumbersArray, 4); +num = d3Array.bisectLeft(readonlyNumbersArray, 4, 1); +num = d3Array.bisectLeft(readonlyNumbersArray, 4, 1, 4); + +num = d3Array.bisectLeft(readonlyStringyNumbersArray, '21'); +num = d3Array.bisectLeft(readonlyStringyNumbersArray, '21', 1); +num = d3Array.bisectLeft(readonlyStringyNumbersArray, '21', 1, 4); + +num = d3Array.bisectLeft(readonlyDateArray, new Date(2011, 2, 1)); +num = d3Array.bisectLeft(readonlyDateArray, new Date(2011, 2, 1), 1); +num = d3Array.bisectLeft(readonlyDateArray, new Date(2011, 2, 1), 1, 2); + +// bisectRight() --------------------------------------------------------------- + +num = d3Array.bisectRight(numbersArray, 4); +num = d3Array.bisectRight(numbersArray, 4, 1); +num = d3Array.bisectRight(numbersArray, 4, 1, 4); + +num = d3Array.bisectRight(stringyNumbersArray, '21'); +num = d3Array.bisectRight(stringyNumbersArray, '21', 1); +num = d3Array.bisectRight(stringyNumbersArray, '21', 1, 4); + +num = d3Array.bisectRight(dateArray, new Date(2011, 2, 1)); +num = d3Array.bisectRight(dateArray, new Date(2011, 2, 1), 1); +num = d3Array.bisectRight(dateArray, new Date(2011, 2, 1), 1, 2); + +num = d3Array.bisectRight(typedArray, 4); +num = d3Array.bisectRight(typedArray, 4, 1); +num = d3Array.bisectRight(typedArray, 4, 1, 4); + +num = d3Array.bisectRight(readonlyNumbersArray, 4); +num = d3Array.bisectRight(readonlyNumbersArray, 4, 1); +num = d3Array.bisectRight(readonlyNumbersArray, 4, 1, 4); + +num = d3Array.bisectRight(readonlyStringyNumbersArray, '21'); +num = d3Array.bisectRight(readonlyStringyNumbersArray, '21', 1); +num = d3Array.bisectRight(readonlyStringyNumbersArray, '21', 1, 4); + +num = d3Array.bisectRight(readonlyDateArray, new Date(2011, 2, 1)); +num = d3Array.bisectRight(readonlyDateArray, new Date(2011, 2, 1), 1); +num = d3Array.bisectRight(readonlyDateArray, new Date(2011, 2, 1), 1, 2); + +// bisect() -------------------------------------------------------------------- + +num = d3Array.bisect(numbersArray, 4); +num = d3Array.bisect(numbersArray, 4, 1); +num = d3Array.bisect(numbersArray, 4, 1, 4); + +num = d3Array.bisect(stringyNumbersArray, '21'); +num = d3Array.bisect(stringyNumbersArray, '21', 1); +num = d3Array.bisect(stringyNumbersArray, '21', 1, 4); + +num = d3Array.bisect(dateArray, new Date(2011, 2, 1)); +num = d3Array.bisect(dateArray, new Date(2011, 2, 1), 1); +num = d3Array.bisect(dateArray, new Date(2011, 2, 1), 1, 2); + +num = d3Array.bisect(typedArray, 4); +num = d3Array.bisect(typedArray, 4, 1); +num = d3Array.bisect(typedArray, 4, 1, 4); + +num = d3Array.bisect(readonlyNumbersArray, 4); +num = d3Array.bisect(readonlyNumbersArray, 4, 1); +num = d3Array.bisect(readonlyNumbersArray, 4, 1, 4); + +num = d3Array.bisect(readonlyStringyNumbersArray, '21'); +num = d3Array.bisect(readonlyStringyNumbersArray, '21', 1); +num = d3Array.bisect(readonlyStringyNumbersArray, '21', 1, 4); + +num = d3Array.bisect(readonlyDateArray, new Date(2011, 2, 1)); +num = d3Array.bisect(readonlyDateArray, new Date(2011, 2, 1), 1); +num = d3Array.bisect(readonlyDateArray, new Date(2011, 2, 1), 1, 2); + +// bisector() ------------------------------------------------------------------ + +mixedObjectArray.sort((a, b) => a.date.valueOf() - b.date.valueOf()); + +let mixedObjectDateBisectorObject: d3Array.Bisector; + +// define using accessor +mixedObjectDateBisectorObject = d3Array.bisector(el => el.date); + +// define using comparator +mixedObjectDateBisectorObject = d3Array.bisector((el, x) => + el.date.valueOf() - x.valueOf()); + +// bisect left +num = mixedObjectDateBisectorObject.left(mixedObjectArray, new Date(2015, 3, 14)); +num = mixedObjectDateBisectorObject.left(mixedObjectArray, new Date(2015, 3, 14), 1); +num = mixedObjectDateBisectorObject.left(mixedObjectArray, new Date(2015, 3, 14), 3, 4); + +num = mixedObjectDateBisectorObject.left(readonlyMixedObjectArray, new Date(2015, 3, 14)); +num = mixedObjectDateBisectorObject.left(readonlyMixedObjectArray, new Date(2015, 3, 14), 1); +num = mixedObjectDateBisectorObject.left(readonlyMixedObjectArray, new Date(2015, 3, 14), 3, 4); + +// bisect right +num = mixedObjectDateBisectorObject.right(mixedObjectArray, new Date(2015, 3, 14)); +num = mixedObjectDateBisectorObject.right(mixedObjectArray, new Date(2015, 3, 14), 1); +num = mixedObjectDateBisectorObject.right(mixedObjectArray, new Date(2015, 3, 14), 3, 4); + +num = mixedObjectDateBisectorObject.right(readonlyMixedObjectArray, new Date(2015, 3, 14)); +num = mixedObjectDateBisectorObject.right(readonlyMixedObjectArray, new Date(2015, 3, 14), 1); +num = mixedObjectDateBisectorObject.right(readonlyMixedObjectArray, new Date(2015, 3, 14), 3, 4); + +// ascending() ----------------------------------------------------------------- + +num = d3Array.ascending(undefined, 20); +num = d3Array.ascending(10, 20); +num = d3Array.ascending('10', '20'); +num = d3Array.ascending(new Date(2016, 6, 13), new Date(2016, 6, 14)); + +// descending() ---------------------------------------------------------------- + +num = d3Array.descending(undefined, 20); +num = d3Array.descending(10, 20); +num = d3Array.descending('10', '20'); +num = d3Array.descending(new Date(2016, 6, 13), new Date(2016, 6, 14)); + +// ----------------------------------------------------------------------------- +// Test Transforming Arrays +// ----------------------------------------------------------------------------- + +// merge() --------------------------------------------------------------------- + +const testArray1 = [ + new MixedObject(10, new Date(2016, 6, 1)), + new MixedObject(20, new Date(2016, 7, 30)), + new MixedObject(30, new Date(2015, 3, 15)), + new MixedObject(40, new Date(2014, 3, 15)), + new MixedObject(50, new Date(2017, 4, 15)) +]; + +const testArray2 = [ + new MixedObject(40, new Date(2016, 3, 1)), + new MixedObject(50, new Date(2016, 9, 30)), +]; + +let testArrays: MixedObject[][] = [testArray1, testArray2]; + +const readonlyTestArray1 = testArray1 as ReadonlyArray; +const readonlyTestArray2 = testArray2 as ReadonlyArray; +const readonlyTestArrays = [testArray1, testArray2] as ReadonlyArray>; + +let mergedArray: MixedObject[]; + +mergedArray = d3Array.merge(testArrays); // inferred type +mergedArray = d3Array.merge(testArrays); // explicit type +// $ExpectError +mergedArray = d3Array.merge([[10, 40, 30], [15, 30]]); // fails, type mismatch +// $ExpectError +mergedArray = d3Array.merge([testArray1, [15, 30]]); // fails, type mismatch + +mergedArray = d3Array.merge(readonlyTestArrays); // inferred type +mergedArray = d3Array.merge(readonlyTestArrays); // explicit type + +// cross() --------------------------------------------------------------------- + +let crossed: Array<[string, number]>; + +const chars = ['x', 'y']; +const nums = [1, 2]; + +crossed = d3Array.cross(chars, nums); +crossed = d3Array.cross(chars, nums); + +let strArray: string[] = d3Array.cross([2, 3], [5, 6], (a, b) => (a + b) + 'px'); +strArray = d3Array.cross([2, 3], [5, 6], (a, b) => { + const aa: number = a; + const bb: number = b; + return (aa + bb) + 'px'; +}); + +const readonlyChars = chars as ReadonlyArray; +const readonlyNums = new Uint8Array(nums); + +crossed = d3Array.cross(readonlyChars, readonlyNums); +crossed = d3Array.cross(readonlyChars, readonlyNums); + +strArray = d3Array.cross([2, 3] as ReadonlyArray, new Uint8ClampedArray([5, 6]), (a, b) => (a + b) + 'px'); +strArray = d3Array.cross([2, 3] as ReadonlyArray, new Uint8ClampedArray([5, 6]), (a, b) => { + const aa: number = a; + const bb: number = b; + return (aa + bb) + 'px'; +}); + +d3Array.cross(new Uint8Array([1, 2, 3, 4, 5]), new Uint8Array([10, 20, 30, 40, 50])); + +// pairs() --------------------------------------------------------------------- + +let pairs: Array<[MixedObject, MixedObject]>; + +pairs = d3Array.pairs(mergedArray); + +numbersArray = d3Array.pairs(mergedArray, (a, b) => b.num - a.num); +numbersArray = d3Array.pairs(mergedArray, (a, b) => { + const aa: MixedObject = a; + const bb: MixedObject = b; + return bb.num - aa.num; +}); + +const readonlyMergedArray = mergedArray as ReadonlyArray; +pairs = d3Array.pairs(readonlyMergedArray); + +numbersArray = d3Array.pairs(readonlyMergedArray, (a, b) => b.num - a.num); +numbersArray = d3Array.pairs(readonlyMergedArray, (a, b) => { + const aa: MixedObject = a; + const bb: MixedObject = b; + return bb.num - aa.num; +}); + +// permute() ------------------------------------------------------------------- + +// getting a permutation of array elements +mergedArray = d3Array.permute(mergedArray, [1, 0, 2, 5, 3, 4, 6]); +mergedArray = d3Array.permute(readonlyMergedArray, [1, 0, 2, 5, 3, 4, 6]); +mergedArray = d3Array.permute(readonlyMergedArray, nums); + +// Getting an ordered array with object properties + +const testObject = { + val: 10, + name: 'Test', + when: new Date(), + more: [10, 30, 40] +}; + +const p1: Array = d3Array.permute(testObject, ['name', 'val', 'when', 'more']); +const p2: Array = d3Array.permute(testObject, ['when', 'more']); +// $ExpectError +const p3 = d3Array.permute(testObject, ['when', 'unknown']); + +// range() --------------------------------------------------------------------- + +numbersArray = d3Array.range(10); +numbersArray = d3Array.range(1, 10); +numbersArray = d3Array.range(1, 10, 0.5); + +// shuffle() ------------------------------------------------------------------- + +mergedArray = d3Array.shuffle(mergedArray); +mergedArray = d3Array.shuffle(mergedArray, 1); +mergedArray = d3Array.shuffle(mergedArray, 1, 3); +// $ExpectError +mergedArray = d3Array.shuffle(readonlyMergedArray); // fails, shuffle mutates input array in-place + +// Test each TypedArray explicitly. Can't use ArrayLike in this case because shuffle is mutable and ArrayLike would include ReadonlyArray +const resultInt8: Int8Array = d3Array.shuffle(new Int8Array(numbersArray)); +const resultUint8: Uint8Array = d3Array.shuffle(new Uint8Array(numbersArray)); +const resultUint8Clamped: Uint8ClampedArray = d3Array.shuffle(new Uint8ClampedArray(numbersArray)); +const resultInt16: Int16Array = d3Array.shuffle(new Int16Array(numbersArray)); +const resultUint6: Uint16Array = d3Array.shuffle(new Uint16Array(numbersArray)); +const resultInt32: Int32Array = d3Array.shuffle(new Int32Array(numbersArray)); +const resultUint32: Uint32Array = d3Array.shuffle(new Uint32Array(numbersArray)); +const resultFloat32: Float32Array = d3Array.shuffle(new Float32Array(numbersArray)); +const resultFloat64: Float64Array = d3Array.shuffle(new Float64Array(numbersArray)); + +// ticks() --------------------------------------------------------------------- + +numbersArray = d3Array.ticks(1, 10, 5); + +// tickIncrement() ------------------------------------------------------------------ + +let numDiff: number = d3Array.tickIncrement(1, 10, 5); + +// tickStep() ------------------------------------------------------------------ + +numDiff = d3Array.tickStep(1, 10, 5); + +// transpose() ----------------------------------------------------------------- + +testArrays = d3Array.transpose([testArray1, testArray2]); +testArrays = d3Array.transpose([readonlyTestArray1, readonlyTestArray2] as ReadonlyArray>); + +// zip() ----------------------------------------------------------------------- + +testArrays = d3Array.zip(testArray1, testArray2); +testArrays = d3Array.zip(readonlyTestArray1, readonlyTestArray2); + +// ----------------------------------------------------------------------------- +// Test Histogram +// ----------------------------------------------------------------------------- + +const timeScale = scaleTime(); + +// Create histogram generator ================================================== + +// number - number +let histoNumber_Number: d3Array.HistogramGeneratorNumber; +histoNumber_Number = d3Array.histogram(); +histoNumber_Number = d3Array.histogram(); + +// MixedObject - number | undefined +let histoMixed_NumberOrUndefined: d3Array.HistogramGeneratorNumber; +histoMixed_NumberOrUndefined = d3Array.histogram(); + +// MixedObject | undefined - number | undefined +let histoMixedOrUndefined_NumberOrUndefined: d3Array.HistogramGeneratorNumber; +histoMixedOrUndefined_NumberOrUndefined = d3Array.histogram(); + +// MixedObject | undefined - number +let histoMixedOrUndefined_Number: d3Array.HistogramGeneratorNumber; +histoMixedOrUndefined_Number = d3Array.histogram(); + +// MixedObject - Date +let histoMixedObject_Date: d3Array.HistogramGeneratorDate; +histoMixedObject_Date = d3Array.histogram(); + +// MixedObject - Date | undefined +let histoMixedObject_DateOrUndefined: d3Array.HistogramGeneratorDate; +histoMixedObject_DateOrUndefined = d3Array.histogram(); + +let defaultHistogram: d3Array.HistogramGeneratorNumber; +defaultHistogram = d3Array.histogram(); + +// Configure histogram generator =============================================== + +// value(...) ------------------------------------------------------------------ + +let valueAccessorFn: (d: MixedObject, i: number, data: MixedObject[]) => Date; +valueAccessorFn = histoMixedObject_Date.value(); + +type valueAccessor = (d: D, i: number, data: D[]) => V; + +// number - number +const valueFnNumber_Number: valueAccessor = histoNumber_Number.value(); +histoNumber_Number = histoNumber_Number.value((d: number, i: number, data: ArrayLike) => { + return d - num; +}); + +// MixedObject - number | undefined +const valueFnMixedObject_NumberOrUndefined: valueAccessor = histoMixed_NumberOrUndefined.value(); +histoMixed_NumberOrUndefined = histoMixed_NumberOrUndefined.value((d: MixedObject, i: number, data: ArrayLike) => { + return d.str === "NA" ? undefined : d.num; +}); + +// MixedObject | undefined - number | undefined +const valueFnMixedOrUndefined_NumberOrUndefined: valueAccessor = histoMixedOrUndefined_NumberOrUndefined.value(); +histoMixedOrUndefined_NumberOrUndefined = histoMixedOrUndefined_NumberOrUndefined.value((d: MixedObject | undefined, i: number, data: ArrayLike) => { + return d ? d.num : undefined; +}); + +// MixedObject | undefined - number +const valueFnMixedOrUndefined_Number: valueAccessor = histoMixedOrUndefined_Number.value(); +histoMixedOrUndefined_Number = histoMixedOrUndefined_Number.value((d: MixedObject | undefined, i: number, data: ArrayLike) => { + return d ? d.num : 0; +}); + +// MixedObject - Date +const valueFnMixedObject_Date: valueAccessor = histoMixedObject_Date.value(); +histoMixedObject_Date = histoMixedObject_Date.value((d: MixedObject, i: number, data: ArrayLike) => { + return d.date; +}); + +// MixedObject - Date | undefined +const valueFnMixedObject_DateOrUndefined: valueAccessor = histoMixedObject_DateOrUndefined.value(); +histoMixedObject_DateOrUndefined = histoMixedObject_DateOrUndefined.value((d: MixedObject, i: number, data: ArrayLike) => { + return d.date; +}); + +// domain(...) ----------------------------------------------------------------- + +const domain = timeScale.domain(); +let domainFnNumber: (array: number[]) => [number, number] | [undefined, undefined]; +let domainFnNumberOrUndef: (array: Array) => [number, number] | [undefined, undefined]; +let domainFnDate: (values: Date[]) => [Date, Date]; + +// number - number +domainFnNumber = histoNumber_Number.domain(); +histoNumber_Number = histoNumber_Number.domain([0, 100]); +histoNumber_Number = histoNumber_Number.domain(d3Array.extent); + +// MixedObject - number | undefined +domainFnNumber = histoNumber_Number.domain(); +histoMixed_NumberOrUndefined = histoMixed_NumberOrUndefined.domain([0, 100]); +histoMixed_NumberOrUndefined = histoMixed_NumberOrUndefined.domain(d3Array.extent); + +// MixedObject | undefined - number | undefined +domainFnNumberOrUndef = histoMixedOrUndefined_NumberOrUndefined.domain(); +histoMixedOrUndefined_NumberOrUndefined = histoMixedOrUndefined_NumberOrUndefined.domain([0, 100]); +histoMixedOrUndefined_NumberOrUndefined = histoMixedOrUndefined_NumberOrUndefined.domain(d3Array.extent); + +// MixedObject | undefined - number +domainFnNumber = histoMixedOrUndefined_Number.domain(); +histoMixedOrUndefined_Number = histoMixedOrUndefined_Number.domain([0, 100]); +histoMixedOrUndefined_Number = histoMixedOrUndefined_Number.domain(d3Array.extent); + +// MixedObject - Date +domainFnDate = histoMixedObject_Date.domain(); +histoMixedObject_Date = histoMixedObject_Date.domain([new Date(2014, 3, 15), new Date(2017, 4, 15)]); +histoMixedObject_Date = histoMixedObject_Date.domain([domain[0], domain[domain.length]]); +histoMixedObject_Date = histoMixedObject_Date.domain((values) => [values[0], values[values.length]]); +// $ExpectError +histoMixedObject_Date = histoMixedObject_Date.domain(timeScale.domain()); // fails, as scale domain is an array with possibly more than the two elements expected by histogram + +// MixedObject - Date | undefined +domainFnDate = histoMixedObject_Date.domain(); +histoMixedObject_DateOrUndefined = histoMixedObject_DateOrUndefined.domain([new Date(2014, 3, 15), new Date(2017, 4, 15)]); +histoMixedObject_DateOrUndefined = histoMixedObject_DateOrUndefined.domain([domain[0], domain[domain.length]]); +histoMixedObject_DateOrUndefined = histoMixedObject_DateOrUndefined.domain((values) => [values[0]!, values[values.length]!]); + +// thresholds(...) ------------------------------------------------------------- + +type thresholdsWithUndefinedCont = d3Array.ThresholdCountGenerator; +type thresholdsWithUndefinedArray = d3Array.ThresholdNumberArrayGenerator; + +let thresholds: d3Array.ThresholdCountGenerator | d3Array.ThresholdNumberArrayGenerator; +let thresholdsWithUndefined: thresholdsWithUndefinedCont | thresholdsWithUndefinedArray; +const thresholdsArray: d3Array.ThresholdNumberArrayGenerator = (x: ArrayLike) => [5, 10, 20]; + +let thresholdsDate: d3Array.ThresholdDateArrayGenerator; +let thresholdsDateOrUndefined: d3Array.ThresholdDateArrayGenerator; + +// number - number +thresholds = histoNumber_Number.thresholds(); +histoNumber_Number = histoNumber_Number.thresholds(3); +histoNumber_Number = histoNumber_Number.thresholds([5, 10, 20]); +histoNumber_Number = histoNumber_Number.thresholds(d3Array.thresholdScott); +histoNumber_Number = histoNumber_Number.thresholds(thresholdsArray); + +// MixedObject - number | undefined +thresholdsWithUndefined = histoMixed_NumberOrUndefined.thresholds(); +histoMixed_NumberOrUndefined = histoMixed_NumberOrUndefined.thresholds(3); +histoMixed_NumberOrUndefined = histoMixed_NumberOrUndefined.thresholds([5, 10, 20]); +histoMixed_NumberOrUndefined = histoMixed_NumberOrUndefined.thresholds(d3Array.thresholdScott); + +// MixedObject | undefined - number | undefined +thresholdsWithUndefined = histoMixedOrUndefined_NumberOrUndefined.thresholds(); +histoMixedOrUndefined_NumberOrUndefined = histoMixedOrUndefined_NumberOrUndefined.thresholds(3); +histoMixedOrUndefined_NumberOrUndefined = histoMixedOrUndefined_NumberOrUndefined.thresholds([5, 10, 20]); +histoMixedOrUndefined_NumberOrUndefined = histoMixedOrUndefined_NumberOrUndefined.thresholds(d3Array.thresholdScott); + +// MixedObject | undefined - number +thresholds = histoMixedOrUndefined_Number.thresholds(); +histoMixedOrUndefined_Number = histoMixedOrUndefined_Number.thresholds(5); +histoMixedOrUndefined_Number = histoMixedOrUndefined_Number.thresholds([5, 10, 20]); +histoMixedOrUndefined_Number = histoMixedOrUndefined_Number.thresholds(d3Array.thresholdSturges); + +// MixedObject - Date +thresholdsDate = histoMixedObject_Date.thresholds(); +histoMixedObject_Date = histoMixedObject_Date.thresholds([new Date(2015, 11, 15), new Date(2016, 6, 1), new Date(2016, 8, 30)]); +histoMixedObject_Date = histoMixedObject_Date.thresholds(timeScale.ticks(timeYear)); +histoMixedObject_Date = histoMixedObject_Date.thresholds((values: ArrayLike) => [new Date(2015, 11, 15), new Date(2016, 6, 1), new Date(2016, 8, 30)]); +histoMixedObject_Date = histoMixedObject_Date.thresholds((values: ArrayLike, min: Date, max: Date) => { + const thresholds: Date[] = [values[0], values[2], values[4]]; + return thresholds; +}); +// $ExpectError +histoMixedObject_Date = histoMixedObject_Date.thresholds(d3Array.thresholdScott); + +// MixedObject - Date | undefined +thresholdsDateOrUndefined = histoMixedObject_DateOrUndefined.thresholds(); +histoMixedObject_DateOrUndefined = histoMixedObject_DateOrUndefined.thresholds([new Date(2015, 11, 15), new Date(2016, 6, 1), new Date(2016, 8, 30)]); +histoMixedObject_DateOrUndefined = histoMixedObject_DateOrUndefined.thresholds(timeScale.ticks(timeYear)); +histoMixedObject_DateOrUndefined = histoMixedObject_DateOrUndefined.thresholds((values: ArrayLike, min: Date, max: Date) => { + const thresholds: Date[] = [values[0]!, new Date(2015, 11, 15), values[values.length]!]; + return thresholds; +}); + +// Use histogram generator ===================================================== + +undef = d3Array.histogram()([])[0].x0 as undefined; +undef = d3Array.histogram()([undefined])[0].x0 as undefined; + +// number - number +let binsNumber_Number: Array>; +binsNumber_Number = histoNumber_Number([-1, 0, 1, 1, 3, 20, 234]); + +let binNumber_Number: d3Array.Bin; +binNumber_Number = binsNumber_Number[0]; + +num = binNumber_Number.length; +num = binNumber_Number[0]; +numOrUndefined = binNumber_Number.x0; +numOrUndefined = binNumber_Number.x1; + +// MixedObject - number | undefined +let binsNumberMixed_NumberOrUndefined: Array>; +binsNumberMixed_NumberOrUndefined = histoMixed_NumberOrUndefined(mixedObjectArray); + +let binNumberMixed_NumberOrUndefined: d3Array.Bin; +binNumberMixed_NumberOrUndefined = binsNumberMixed_NumberOrUndefined[0]; + +num = binNumberMixed_NumberOrUndefined.length; +mixedObject = binNumberMixed_NumberOrUndefined[0]; +numOrUndefined = binNumberMixed_NumberOrUndefined.x0; +numOrUndefined = binNumberMixed_NumberOrUndefined.x1; + +// MixedObject | undefined - number | undefined +let binsNumberMixedOrUndefined_NumberOrUndefined: Array>; +binsNumberMixedOrUndefined_NumberOrUndefined = histoMixedOrUndefined_NumberOrUndefined(mixedObjectArray); + +let binNumberMixedOrUndefined_NumberOrUndefined: d3Array.Bin; +binNumberMixedOrUndefined_NumberOrUndefined = binsNumberMixedOrUndefined_NumberOrUndefined[0]; + +num = binNumberMixedOrUndefined_NumberOrUndefined.length; +mixedObjectOrUndefined = binNumberMixedOrUndefined_NumberOrUndefined[0]; +numOrUndefined = binNumberMixedOrUndefined_NumberOrUndefined.x0; +numOrUndefined = binNumberMixedOrUndefined_NumberOrUndefined.x1; + +// MixedObject | undefined - number +let binsNumberMixedOrUndefined_Number: Array>; +binsNumberMixedOrUndefined_Number = histoMixedOrUndefined_Number(mixedObjectArray); + +let binNumberMixedOrUndefined_Number: d3Array.Bin; +binNumberMixedOrUndefined_Number = binsNumberMixedOrUndefined_Number[0]; + +num = binNumberMixedOrUndefined_Number.length; +mixedObjectOrUndefined = binNumberMixedOrUndefined_Number[0]; +numOrUndefined = binNumberMixedOrUndefined_Number.x0; +numOrUndefined = binNumberMixedOrUndefined_Number.x1; + +// MixedObject - Date +let binsMixedObject_Date: Array>; +binsMixedObject_Date = histoMixedObject_Date(mixedObjectArray); +binsMixedObject_Date = histoMixedObject_Date(readonlyMixedObjectArray); + +let binMixedObject_Date: d3Array.Bin; +binMixedObject_Date = binsMixedObject_Date[0]; + +num = binMixedObject_Date.length; +mixedObject = binMixedObject_Date[0]; +dateOrUndefined = binMixedObject_Date.x0; +dateOrUndefined = binMixedObject_Date.x1; + +// MixedObject - Date | undefined +let binsMixedObject_DateOrUndefined: Array>; +binsMixedObject_DateOrUndefined = histoMixedObject_DateOrUndefined(mixedObjectArray); + +let binMixedObject_DateOrUndefined: d3Array.Bin; +binMixedObject_DateOrUndefined = binsMixedObject_DateOrUndefined[0]; + +num = binMixedObject_DateOrUndefined.length; +mixedObject = binMixedObject_DateOrUndefined[0]; +dateOrUndefined = binMixedObject_DateOrUndefined.x0; +dateOrUndefined = binMixedObject_DateOrUndefined.x1; + +// Histogram Thresholds ======================================================== + +numbersArray = [-1, 0, 1, 1, 3, 20, 234]; +typedArray = new Uint8Array(numbersArray); +readonlyNumbersArray = numbersArray as ReadonlyArray; + +num = d3Array.thresholdFreedmanDiaconis(numbersArray, -1, 234); +num = d3Array.thresholdFreedmanDiaconis(typedArray, -1, 234); +num = d3Array.thresholdFreedmanDiaconis(readonlyNumbersArray, -1, 234); + +num = d3Array.thresholdScott(numbersArray, -1, 234); +num = d3Array.thresholdScott(typedArray, -1, 234); +num = d3Array.thresholdScott(readonlyNumbersArray, -1, 234); + +num = d3Array.thresholdSturges(numbersArray); +num = d3Array.thresholdSturges(typedArray); +num = d3Array.thresholdSturges(readonlyNumbersArray); + +// Deprecated ================================================================== + +const histDeprecatedNumber: d3Array.HistogramGenerator = d3Array.histogram(); +const histDeprecatedDate: d3Array.HistogramGenerator = d3Array.histogram(); diff --git a/types/d3-array/v1/index.d.ts b/types/d3-array/v1/index.d.ts new file mode 100644 index 0000000000..7320e1c223 --- /dev/null +++ b/types/d3-array/v1/index.d.ts @@ -0,0 +1,547 @@ +// Type definitions for D3JS d3-array module 1.2 +// Project: https://github.com/d3/d3-array +// Definitions by: Alex Ford +// Boris Yankov +// Tom Wanzek +// denisname , +// Hugues Stefanski +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +// Last module patch version validated against: 1.2.1 + +// -------------------------------------------------------------------------- +// Shared Types and Interfaces +// -------------------------------------------------------------------------- + +/** + * Administrivia: JavaScript primitive types and Date + */ +export type Primitive = number | string | boolean | Date; + +/** + * Administrivia: anything with a valueOf(): number method is comparable, so we allow it in numeric operations + */ +export interface Numeric { + valueOf(): number; +} + +// -------------------------------------------------------------------------------------- +// Descriptive Statistics +// -------------------------------------------------------------------------------------- + +/** + * Return the maximum value in the array of strings using natural order. + */ +export function max(array: ArrayLike): string | undefined; + +/** + * Return the maximum value in the array of numbers using natural order. + */ +export function max(array: ArrayLike): T | undefined; + +/** + * Return the maximum value in the array using natural order and a projection function to map values to strings. + */ +export function max(array: ArrayLike, accessor: (datum: T, index: number, array: ArrayLike) => string | undefined | null): string | undefined; + +/** + * Return the maximum value in the array using natural order and a projection function to map values to easily-sorted values. + */ +export function max(array: ArrayLike, accessor: (datum: T, index: number, array: ArrayLike) => U | undefined | null): U | undefined; + +/** + * Return the minimum value in the array using natural order. + */ +export function min(array: ArrayLike): string | undefined; + +/** + * Return the minimum value in the array using natural order. + */ +export function min(array: ArrayLike): T | undefined; + +/** + * Return the minimum value in the array using natural order. + */ +export function min(array: ArrayLike, accessor: (datum: T, index: number, array: ArrayLike) => string | undefined | null): string | undefined; + +/** + * Return the minimum value in the array using natural order. + */ +export function min(array: ArrayLike, accessor: (datum: T, index: number, array: ArrayLike) => U | undefined | null): U | undefined; + +/** + * Return the min and max simultaneously. + */ +export function extent(array: ArrayLike): [string, string] | [undefined, undefined]; + +/** + * Return the min and max simultaneously. + */ +export function extent(array: ArrayLike): [T, T] | [undefined, undefined]; + +/** + * Return the min and max simultaneously. + */ +export function extent(array: ArrayLike, accessor: (datum: T, index: number, array: ArrayLike) => string | undefined | null): [string, string] | [undefined, undefined]; + +/** + * Return the min and max simultaneously. + */ +export function extent(array: ArrayLike, accessor: (datum: T, index: number, array: ArrayLike) => U | undefined | null): [U, U] | [undefined, undefined]; + +/** + * Return the mean of an array of numbers + */ +export function mean(array: ArrayLike): number | undefined; + +/** + * Return the mean of an array of numbers + */ +export function mean(array: ArrayLike, accessor: (datum: T, index: number, array: ArrayLike) => number | undefined | null): number | undefined; + +/** + * Return the median of an array of numbers + */ +export function median(array: ArrayLike): number | undefined; + +/** + * Return the median of an array of numbers + */ +export function median(array: ArrayLike, accessor: (element: T, i: number, array: ArrayLike) => number | undefined | null): number | undefined; + +/** + * Returns the p-quantile of an array of numbers + */ +export function quantile(array: ArrayLike, p: number): number | undefined; + +export function quantile(array: ArrayLike, p: number, accessor: (element: T, i: number, array: ArrayLike) => number | undefined | null): number | undefined; + +/** + * Compute the sum of an array of numbers. + */ +export function sum(array: ArrayLike): number; + +/** + * Compute the sum of an array, using the given accessor to convert values to numbers. + */ +export function sum(array: ArrayLike, accessor: (datum: T, index: number, array: ArrayLike) => number | undefined | null): number; + +/** + * Compute the standard deviation, defined as the square root of the bias-corrected variance, of the given array of numbers. + */ +export function deviation(array: ArrayLike): number | undefined; + +/** + * Compute the standard deviation, defined as the square root of the bias-corrected variance, of the given array, + * using the given accessor to convert values to numbers. + */ +export function deviation(array: ArrayLike, accessor: (datum: T, index: number, array: ArrayLike) => number | undefined | null): number | undefined; + +/** + * Compute an unbiased estimator of the population variance of the given array of numbers. + */ +export function variance(array: ArrayLike): number | undefined; + +/** + * Compute an unbiased estimator of the population variance of the given array, + * using the given accessor to convert values to numbers. + */ +export function variance(array: ArrayLike, accessor: (datum: T, index: number, array: ArrayLike) => number | undefined | null): number | undefined; + +// -------------------------------------------------------------------------------------- +// Searching Arrays +// -------------------------------------------------------------------------------------- + +export function scan(array: ArrayLike, comparator?: (a: number, b: number) => number): number | undefined; +export function scan(array: ArrayLike, comparator: (a: T, b: T) => number): number | undefined; + +export function bisectLeft(array: ArrayLike, x: number, lo?: number, hi?: number): number; +export function bisectLeft(array: ArrayLike, x: string, lo?: number, hi?: number): number; +export function bisectLeft(array: ArrayLike, x: Date, lo?: number, hi?: number): number; + +export function bisectRight(array: ArrayLike, x: number, lo?: number, hi?: number): number; +export function bisectRight(array: ArrayLike, x: string, lo?: number, hi?: number): number; +export function bisectRight(array: ArrayLike, x: Date, lo?: number, hi?: number): number; + +export const bisect: typeof bisectRight; + +export interface Bisector { + left(array: ArrayLike, x: U, lo?: number, hi?: number): number; + right(array: ArrayLike, x: U, lo?: number, hi?: number): number; +} + +export function bisector(comparator: (a: T, b: U) => number): Bisector; +export function bisector(accessor: (x: T) => U): Bisector; + +/** + * Rearranges items so that all items in the [left, k] are the smallest. The k-th element will have the (k - left + 1)-th smallest value in [left, right]. + * + * @param array The array to partially sort (in place). + * @param k The middle index for partial sorting. + */ +export function quickselect(array: ArrayLike, k: number): T[]; + +/** + * Rearranges items so that all items in the [left, k] are the smallest. The k-th element will have the (k - left + 1)-th smallest value in [left, right]. + * + * @param array The array to partially sort (in place). + * @param k The middle index for partial sorting. + * @param left The left index of the range to sort. + */ +export function quickselect(array: ArrayLike, k: number, left: number): T[]; + +/** + * Rearranges items so that all items in the [left, k] are the smallest. The k-th element will have the (k - left + 1)-th smallest value in [left, right]. + * + * @param array The array to partially sort (in place). + * @param k The middle index for partial sorting. + * @param left The left index of the range to sort. + * @param right The right index. + */ +export function quickselect(array: ArrayLike, k: number, left: number, right: number): T[]; + +/** + * Rearranges items so that all items in the [left, k] are the smallest. The k-th element will have the (k - left + 1)-th smallest value in [left, right]. + * + * @param array The array to partially sort (in place). + * @param k The middle index for partial sorting. + * @param left The left index of the range to sort. + * @param right The right index. + * @param compare The compare function. + */ +export function quickselect(array: ArrayLike, k: number, left: number, right: number, compare: (a: Primitive | undefined, b: Primitive | undefined) => number): T[]; + +// NB. this is limited to primitive values due to D3's use of the <, >, and >= operators. Results get weird for object instances. +/** + * Compares two primitive values for sorting (in ascending order). + */ +export function ascending(a: Primitive | undefined, b: Primitive | undefined): number; + +// NB. this is limited to primitive values due to D3's use of the <, >, and >= operators. Results get weird for object instances. +/** + * Compares two primitive values for sorting (in ascending order). + */ +export function descending(a: Primitive | undefined, b: Primitive | undefined): number; + +// -------------------------------------------------------------------------------------- +// Transforming Arrays +// -------------------------------------------------------------------------------------- + +/** + * Groups the specified array of values into a Map from key to array of value. + * @param a The array to group. + * @param key The key function. + */ +export function group(a: ArrayLike, key: (value: TObject) => TKey): Map; + +/** + * Groups and reduces the specified array of values into a Map from key to value. + * + * @param a The array to group. + * @param reduce The reduce function. + * @param key The key function. + */ +export function rollup(a: ArrayLike, reduce: (value: TObject[]) => TReduce, key: (value: TObject) => TKey): Map; + +/** + * Returns the Cartesian product of the two arrays a and b. + * For each element i in the specified array a and each element j in the specified array b, in order, + * it creates a two-element array for each pair. + * + * @param a First input array. + * @param b Second input array. + */ +export function cross(a: ArrayLike, b: ArrayLike): Array<[S, T]>; + +/** + * Returns the Cartesian product of the two arrays a and b. + * For each element i in the specified array a and each element j in the specified array b, in order, + * invokes the specified reducer function passing the element i and element j. + * + * @param a First input array. + * @param b Second input array. + * @param reducer A reducer function taking as input an element from "a" and "b" and returning a reduced value. + */ +export function cross(a: ArrayLike, b: ArrayLike, reducer: (a: S, b: T) => U): U[]; + +/** + * Merges the specified arrays into a single array. + */ +export function merge(arrays: ArrayLike>): T[]; + +/** + * For each adjacent pair of elements in the specified array, returns a new array of tuples of elements i and i - 1. + * Returns the empty array if the input array has fewer than two elements. + * + * @param array Array of input elements + */ +export function pairs(array: ArrayLike): Array<[T, T]>; +/** + * For each adjacent pair of elements in the specified array, in order, invokes the specified reducer function passing the element i and element i - 1. + * Returns the resulting array of pair-wise reduced elements. + * Returns the empty array if the input array has fewer than two elements. + * + * @param array Array of input elements + * @param reducer A reducer function taking as input to adjacent elements of the input array and returning a reduced value. + */ +export function pairs(array: ArrayLike, reducer: (a: T, b: T) => U): U[]; + +/** + * Returns a permutation of the specified array using the specified array of indexes. + * The returned array contains the corresponding element in array for each index in indexes, in order. + * For example, `permute(["a", "b", "c"], [1, 2, 0]) // ["b", "c", "a"]` + */ +export function permute(array: { [key: number]: T }, keys: ArrayLike): T[]; + +/** + * Extract the values from an object into an array with a stable order. For example: + * `var object = {yield: 27, year: 1931, site: "University Farm"};` + * `d3.permute(object, ["site", "yield"]); // ["University Farm", 27]` + */ +export function permute(object: T, keys: ArrayLike): Array; + +/** + * Generates a 0-based numeric sequence. The output range does not include 'stop'. + */ +export function range(stop: number): number[]; + +/** + * Generates a numeric sequence starting from the given start and stop values. 'step' defaults to 1. The output range does not include 'stop'. + */ +export function range(start: number, stop: number, step?: number): number[]; + +/** + * Randomizes the order of the specified array using the Fisher–Yates shuffle. + */ +export function shuffle(array: T[], lo?: number, hi?: number): T[]; +export function shuffle(array: Int8Array, lo?: number, hi?: number): Int8Array; +export function shuffle(array: Uint8Array, lo?: number, hi?: number): Uint8Array; +export function shuffle(array: Uint8ClampedArray, lo?: number, hi?: number): Uint8ClampedArray; +export function shuffle(array: Int16Array, lo?: number, hi?: number): Int16Array; +export function shuffle(array: Uint16Array, lo?: number, hi?: number): Uint16Array; +export function shuffle(array: Int32Array, lo?: number, hi?: number): Int32Array; +export function shuffle(array: Uint32Array, lo?: number, hi?: number): Uint32Array; +export function shuffle(array: Float32Array, lo?: number, hi?: number): Float32Array; +export function shuffle(array: Float64Array, lo?: number, hi?: number): Float64Array; + +/** + * Generate an array of approximately count + 1 uniformly-spaced, nicely-rounded values between start and stop (inclusive). + * Each value is a power of ten multiplied by 1, 2 or 5. See also d3.tickIncrement, d3.tickStep and linear.ticks. + * + * Ticks are inclusive in the sense that they may include the specified start and stop values if (and only if) they are exact, + * nicely-rounded values consistent with the inferred step. More formally, each returned tick t satisfies start ≤ t and t ≤ stop. + * + * @param start Start value for ticks + * @param stop Stop value for ticks + * @param count count + 1 is the approximate number of ticks to be returned by d3.ticks. + */ +export function ticks(start: number, stop: number, count: number): number[]; + +/** + * Returns the difference between adjacent tick values if the same arguments were passed to d3.ticks: + * a nicely-rounded value that is a power of ten multiplied by 1, 2 or 5. + * + * Like d3.tickStep, except requires that start is always less than or equal to step, and if the tick step for the given start, + * stop and count would be less than one, returns the negative inverse tick step instead. + * + * This method is always guaranteed to return an integer, and is used by d3.ticks to avoid guarantee that the returned tick values + * are represented as precisely as possible in IEEE 754 floating point. + * + * @param start Start value for ticks + * @param stop Stop value for ticks + * @param count count + 1 is the approximate number of ticks to be returned by d3.ticks. + */ +export function tickIncrement(start: number, stop: number, count: number): number; + +/** + * Returns the difference between adjacent tick values if the same arguments were passed to d3.ticks: + * a nicely-rounded value that is a power of ten multiplied by 1, 2 or 5. + * + * Note that due to the limited precision of IEEE 754 floating point, the returned value may not be exact decimals; + * use d3-format to format numbers for human consumption. + * + * @param start Start value for ticks + * @param stop Stop value for ticks + * @param count count + 1 is the approximate number of ticks to be returned by d3.ticks. + */ +export function tickStep(start: number, stop: number, count: number): number; + +/** + * Transpose a matrix provided in Array of Arrays format. + */ +export function transpose(matrix: ArrayLike>): T[][]; + +/** + * Returns an array of arrays, where the ith array contains the ith element from each of the argument arrays. + * The returned array is truncated in length to the shortest array in arrays. If arrays contains only a single array, the returned array + * contains one-element arrays. With no arguments, the returned array is empty. + */ +export function zip(...arrays: Array>): T[][]; + +// -------------------------------------------------------------------------------------- +// Histogram +// -------------------------------------------------------------------------------------- + +export interface Bin extends Array { + x0: Value | undefined; + x1: Value | undefined; +} + +/** + * Type definition for threshold generator which returns the count of recommended thresholds + */ +export type ThresholdCountGenerator = + (values: ArrayLike, min: number, max: number) => number; + +/** + * Type definition for threshold generator which returns an array of recommended numbers thresholds + */ +export type ThresholdNumberArrayGenerator = + (values: ArrayLike, min: number, max: number) => Value[]; + +/** + * Type definition for threshold generator which returns an array of recommended dates thresholds + */ +export type ThresholdDateArrayGenerator = + (values: ArrayLike, min: Date, max: Date) => Value[]; + +/** + * @deprecated Use ThresholdNumberArrayGenerator or ThresholdDateArrayGenerator. + */ +export type ThresholdArrayGenerator = ThresholdNumberArrayGenerator; + +/** + * @deprecated Use `HistogramGeneratorNumber` for `number` values and `HistogramGeneratorDate for `Date` values. + */ +export interface HistogramGenerator { + (data: ArrayLike): Array>; + + value(): (d: Datum, i: number, data: ArrayLike) => Value; + value(valueAccessor: (d: Datum, i: number, data: ArrayLike) => Value): this; + + domain(): (values: ArrayLike) => [Value, Value] | [undefined, undefined]; + domain(domain: [Value, Value]): this; + domain(domainAccessor: (values: ArrayLike) => [Value, Value] | [undefined, undefined]): this; + + /** + * Set the array of values to be used as thresholds in determining the bins. + * + * Any threshold values outside the domain are ignored. The first bin.x0 is always equal to the minimum domain value, + * and the last bin.x1 is always equal to the maximum domain value. + * + * @param thresholds Array of threshold values used for binning. The elements must + * be of the same type as the materialized values of the histogram. + */ + thresholds(thresholds: ArrayLike): this; +} + +export interface HistogramCommon { + (data: ArrayLike): Array>; + + value(): (d: Datum, i: number, data: ArrayLike) => Value; + value(valueAccessor: (d: Datum, i: number, data: ArrayLike) => Value): this; +} + +export interface HistogramGeneratorDate extends HistogramCommon { + domain(): (values: ArrayLike) => [Date, Date]; + domain(domain: [Date, Date]): this; + domain(domainAccessor: (values: ArrayLike) => [Date, Date]): this; + + thresholds(): ThresholdDateArrayGenerator; + /** + * Set the array of values to be used as thresholds in determining the bins. + * + * Any threshold values outside the domain are ignored. The first bin.x0 is always equal to the minimum domain value, + * and the last bin.x1 is always equal to the maximum domain value. + * + * @param thresholds Array of threshold values used for binning. The elements must + * be of the same type as the materialized values of the histogram. + */ + thresholds(thresholds: ArrayLike): this; + /** + * Set a threshold accessor function, which returns the array of values to be used as + * thresholds in determining the bins. + * + * Any threshold values outside the domain are ignored. The first bin.x0 is always equal to the minimum domain value, + * and the last bin.x1 is always equal to the maximum domain value. + * + * @param thresholds A function which accepts as arguments the array of materialized values, and + * optionally the domain minimum and maximum. The function calculates and returns the array of values to be used as + * thresholds in determining the bins. + */ + thresholds(thresholds: ThresholdDateArrayGenerator): this; +} + +export interface HistogramGeneratorNumber extends HistogramCommon { + domain(): (values: ArrayLike) => [number, number] | [undefined, undefined]; + domain(domain: [number, number]): this; + domain(domainAccessor: (values: ArrayLike) => [number, number] | [undefined, undefined]): this; + + thresholds(): ThresholdCountGenerator | ThresholdNumberArrayGenerator; + /** + * Divide the domain uniformly into approximately count bins. IMPORTANT: This threshold + * setting approach only works, when the materialized values are numbers! + * + * Any threshold values outside the domain are ignored. The first bin.x0 is always equal to the minimum domain value, + * and the last bin.x1 is always equal to the maximum domain value. + * + * @param count The desired number of uniform bins. + */ + thresholds(count: number): this; + /** + * Set a threshold accessor function, which returns the desired number of bins. + * Divides the domain uniformly into approximately count bins. IMPORTANT: This threshold + * setting approach only works, when the materialized values are numbers! + * + * Any threshold values outside the domain are ignored. The first bin.x0 is always equal to the minimum domain value, + * and the last bin.x1 is always equal to the maximum domain value. + * + * @param count A function which accepts as arguments the array of materialized values, and + * optionally the domain minimum and maximum. The function calculates and returns the suggested + * number of bins. + */ + thresholds(count: ThresholdCountGenerator): this; + /** + * Set the array of values to be used as thresholds in determining the bins. + * + * Any threshold values outside the domain are ignored. The first bin.x0 is always equal to the minimum domain value, + * and the last bin.x1 is always equal to the maximum domain value. + * + * @param thresholds Array of threshold values used for binning. The elements must + * be of the same type as the materialized values of the histogram. + */ + thresholds(thresholds: ArrayLike): this; + /** + * Set a threshold accessor function, which returns the array of values to be used as + * thresholds in determining the bins. + * + * Any threshold values outside the domain are ignored. The first bin.x0 is always equal to the minimum domain value, + * and the last bin.x1 is always equal to the maximum domain value. + * + * @param thresholds A function which accepts as arguments the array of materialized values, and + * optionally the domain minimum and maximum. The function calculates and returns the array of values to be used as + * thresholds in determining the bins. + */ + thresholds(thresholds: ThresholdNumberArrayGenerator): this; +} + +export function histogram(): HistogramGeneratorNumber; +export function histogram(): HistogramGeneratorNumber; +export function histogram(): HistogramGeneratorDate; + +/** + * @deprecated Do not use Value generic which mixes number and Date types. Use either number or Date + * (in combination with undefined, as applicable) to obtain a type-specific histogram generator. + */ +export function histogram(): HistogramGenerator; + +// -------------------------------------------------------------------------------------- +// Histogram Thresholds +// -------------------------------------------------------------------------------------- + +export function thresholdFreedmanDiaconis(values: ArrayLike, min: number, max: number): number; // of type ThresholdCountGenerator + +export function thresholdScott(values: ArrayLike, min: number, max: number): number; // of type ThresholdCountGenerator + +export function thresholdSturges(values: ArrayLike): number; // of type ThresholdCountGenerator diff --git a/types/d3-array/v1/tsconfig.json b/types/d3-array/v1/tsconfig.json new file mode 100644 index 0000000000..978bc1a042 --- /dev/null +++ b/types/d3-array/v1/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "d3-array-tests.ts" + ] +} \ No newline at end of file diff --git a/types/d3-array/v1/tslint.json b/types/d3-array/v1/tslint.json new file mode 100644 index 0000000000..54efb0b84e --- /dev/null +++ b/types/d3-array/v1/tslint.json @@ -0,0 +1,7 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "unified-signatures": false, + "no-unnecessary-generics": false + } +} diff --git a/types/d3/tsconfig.json b/types/d3/tsconfig.json index bc3e8cf886..9a4848b338 100644 --- a/types/d3/tsconfig.json +++ b/types/d3/tsconfig.json @@ -13,6 +13,11 @@ "typeRoots": [ "../" ], + "paths": { + "d3-array": [ + "d3-array/v1" + ] + }, "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true diff --git a/types/d3/v4/tsconfig.json b/types/d3/v4/tsconfig.json index bf267af99d..6b2cee09dd 100644 --- a/types/d3/v4/tsconfig.json +++ b/types/d3/v4/tsconfig.json @@ -19,6 +19,9 @@ ], "d3": [ "d3/v4" + ], + "d3-array": [ + "d3-array/v1" ] }, "types": [], From a9867db3728248437c89851894be42301160f6e3 Mon Sep 17 00:00:00 2001 From: Hugues Stefanski Date: Sun, 3 Feb 2019 09:12:40 +0100 Subject: [PATCH 006/469] d3-array v2 : fix path mapping --- types/d3-array/v1/tsconfig.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/types/d3-array/v1/tsconfig.json b/types/d3-array/v1/tsconfig.json index 978bc1a042..3edd84862c 100644 --- a/types/d3-array/v1/tsconfig.json +++ b/types/d3-array/v1/tsconfig.json @@ -14,6 +14,11 @@ "../../" ], "types": [], + "paths": { + "d3-array": [ + "d3-array/v1" + ] + }, "noEmit": true, "forceConsistentCasingInFileNames": true }, From 8a7b21dd73cdf6c0bd44aab2fb12d8d97c3af922 Mon Sep 17 00:00:00 2001 From: Hugues Stefanski Date: Sun, 3 Feb 2019 09:21:26 +0100 Subject: [PATCH 007/469] d3-array v2.0 : fixed c3 paths --- types/c3/tsconfig.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/c3/tsconfig.json b/types/c3/tsconfig.json index aa923e91c0..c1485cd666 100644 --- a/types/c3/tsconfig.json +++ b/types/c3/tsconfig.json @@ -11,7 +11,8 @@ "types": [], "paths": { "d3-scale": ["d3-scale/v1"], - "d3": ["d3/v4"] + "d3": ["d3/v4"], + "d3-array": ["d3-array/v1"], }, "noEmit": true, "forceConsistentCasingInFileNames": true From 597464103021eeeac805309ba44547e0d63f0e61 Mon Sep 17 00:00:00 2001 From: Hugues Stefanski Date: Sun, 3 Feb 2019 09:24:59 +0100 Subject: [PATCH 008/469] d3-array v2.0 : Deleted useless comma --- types/c3/tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/c3/tsconfig.json b/types/c3/tsconfig.json index c1485cd666..60849b491f 100644 --- a/types/c3/tsconfig.json +++ b/types/c3/tsconfig.json @@ -12,7 +12,7 @@ "paths": { "d3-scale": ["d3-scale/v1"], "d3": ["d3/v4"], - "d3-array": ["d3-array/v1"], + "d3-array": ["d3-array/v1"] }, "noEmit": true, "forceConsistentCasingInFileNames": true From 31edcdfd3a32356d0d0b0482a8af404e9c6e29ba Mon Sep 17 00:00:00 2001 From: Hugues Stefanski Date: Sun, 3 Feb 2019 09:37:07 +0100 Subject: [PATCH 009/469] d3-array v2 : updated d3Kit --- types/d3kit/tsconfig.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/types/d3kit/tsconfig.json b/types/d3kit/tsconfig.json index 40e266f6f9..79051ab233 100644 --- a/types/d3kit/tsconfig.json +++ b/types/d3kit/tsconfig.json @@ -13,6 +13,11 @@ "typeRoots": [ "../" ], + "paths": { + "d3-array": [ + "d3-array/v1" + ] + }, "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true From a07a4f7b5502d67a75ee9250d0e70a203f12914e Mon Sep 17 00:00:00 2001 From: Hugues Stefanski Date: Sun, 3 Feb 2019 10:08:13 +0100 Subject: [PATCH 010/469] d3-array v2 : fixed react-faux-dom --- types/react-faux-dom/tsconfig.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/types/react-faux-dom/tsconfig.json b/types/react-faux-dom/tsconfig.json index 198db32576..ed6a386404 100644 --- a/types/react-faux-dom/tsconfig.json +++ b/types/react-faux-dom/tsconfig.json @@ -13,6 +13,11 @@ "typeRoots": [ "../" ], + "paths": { + "d3-array": [ + "d3-array/v1" + ] + }, "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true, From 211311f18c28e930a893d94a4cdf2d9c4114668e Mon Sep 17 00:00:00 2001 From: Hugues Stefanski Date: Sun, 3 Feb 2019 10:15:30 +0100 Subject: [PATCH 011/469] d3-arrray v2.0 : fixed reference in venn --- types/venn/tsconfig.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/types/venn/tsconfig.json b/types/venn/tsconfig.json index 1c2dcb77e6..4981507227 100644 --- a/types/venn/tsconfig.json +++ b/types/venn/tsconfig.json @@ -13,6 +13,11 @@ "typeRoots": [ "../" ], + "paths": { + "d3-array": [ + "d3-array/v1" + ] + }, "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true From 6bbbd1695a47f0d646b23798f33a79df7bad8911 Mon Sep 17 00:00:00 2001 From: Hugues Stefanski Date: Sun, 3 Feb 2019 15:09:56 +0100 Subject: [PATCH 012/469] d3-array v2 : Replace ArrayLike by Iterable --- types/d3-array/d3-array-tests.ts | 28 ++++----- types/d3-array/index.d.ts | 100 +++++++++++++++---------------- 2 files changed, 64 insertions(+), 64 deletions(-) diff --git a/types/d3-array/d3-array-tests.ts b/types/d3-array/d3-array-tests.ts index 381d49869c..ab6338b965 100644 --- a/types/d3-array/d3-array-tests.ts +++ b/types/d3-array/d3-array-tests.ts @@ -70,7 +70,7 @@ const mixedObjectArray = [ ]; const mixedObjectOrUndefinedArray = [...mixedObjectArray, undefined]; -const mixedObjectArrayLike = mixedObjectArray as ArrayLike; +const mixedObjectArrayLike = mixedObjectArray as Iterable; let typedArray = Uint8Array.from(numbersArray); let readonlyNumbersArray = numbersArray as ReadonlyArray; @@ -81,55 +81,55 @@ const readonlyDateArray = dateArray as ReadonlyArray; const readonlyMixedObjectArray = mixedObjectArray as ReadonlyArray; const readonlyMixedObjectOrUndefinedArray = mixedObjectOrUndefinedArray as ReadonlyArray; -function accessorMixedObjectToNum(datum: MixedObject, index: number, array: ArrayLike): number { +function accessorMixedObjectToNum(datum: MixedObject, index: number, array: Iterable): number { return datum.num; } -function accessorMixedObjectToStr(datum: MixedObject, index: number, array: ArrayLike): string { +function accessorMixedObjectToStr(datum: MixedObject, index: number, array: Iterable): string { return datum.str; } -function accessorMixedObjectToNumeric(datum: MixedObject, index: number, array: ArrayLike): NumCoercible { +function accessorMixedObjectToNumeric(datum: MixedObject, index: number, array: Iterable): NumCoercible { return datum.numeric; } -function accessorMixedObjectToDate(datum: MixedObject, index: number, array: ArrayLike): Date { +function accessorMixedObjectToDate(datum: MixedObject, index: number, array: Iterable): Date { return datum.date; } -function accessorMixedObjectToNumOrUndefined(datum: MixedObject | undefined, index: number, array: ArrayLike): number | undefined | null { +function accessorMixedObjectToNumOrUndefined(datum: MixedObject | undefined, index: number, array: Iterable): number | undefined | null { return datum ? datum.num : undefined; } -function accessorMixedObjectToStrOrUndefined(datum: MixedObject | undefined, index: number, array: ArrayLike): string | undefined | null { +function accessorMixedObjectToStrOrUndefined(datum: MixedObject | undefined, index: number, array: Iterable): string | undefined | null { return datum ? datum.str : undefined; } -function accessorLikeMixedObjectToNum(datum: MixedObject, index: number, array: ArrayLike): number { +function accessorLikeMixedObjectToNum(datum: MixedObject, index: number, array: Iterable): number { return datum.num; } -function accessorLikeMixedObjectToStr(datum: MixedObject, index: number, array: ArrayLike): string { +function accessorLikeMixedObjectToStr(datum: MixedObject, index: number, array: Iterable): string { return datum.str; } -function accessorLikeMixedObjectToNumeric(datum: MixedObject, index: number, array: ArrayLike): NumCoercible { +function accessorLikeMixedObjectToNumeric(datum: MixedObject, index: number, array: Iterable): NumCoercible { return datum.numeric; } -function accessorLikeMixedObjectToDate(datum: MixedObject, index: number, array: ArrayLike): Date { +function accessorLikeMixedObjectToDate(datum: MixedObject, index: number, array: Iterable): Date { return datum.date; } -function accessorLikeMixedObjectToNumOrUndefined(datum: MixedObject | undefined, index: number, array: ArrayLike): number | undefined | null { +function accessorLikeMixedObjectToNumOrUndefined(datum: MixedObject | undefined, index: number, array: Iterable): number | undefined | null { return datum ? datum.num : undefined; } -function accessorLikeMixedObjectToStrOrUndefined(datum: MixedObject | undefined, index: number, array: ArrayLike): string | undefined | null { +function accessorLikeMixedObjectToStrOrUndefined(datum: MixedObject | undefined, index: number, array: Iterable): string | undefined | null { return datum ? datum.str : undefined; } -function accessorReadOnlyMixedObjectToNumOrUndefined(datum: MixedObject | undefined, index: number, array: ArrayLike): number | undefined | null { +function accessorReadOnlyMixedObjectToNumOrUndefined(datum: MixedObject | undefined, index: number, array: Iterable): number | undefined | null { return datum ? datum.num : undefined; } diff --git a/types/d3-array/index.d.ts b/types/d3-array/index.d.ts index 7971478581..b7949ec870 100644 --- a/types/d3-array/index.d.ts +++ b/types/d3-array/index.d.ts @@ -33,142 +33,142 @@ export interface Numeric { /** * Return the maximum value in the array of strings using natural order. */ -export function max(array: ArrayLike): string | undefined; +export function max(array: Iterable): string | undefined; /** * Return the maximum value in the array of numbers using natural order. */ -export function max(array: ArrayLike): T | undefined; +export function max(array: Iterable): T | undefined; /** * Return the maximum value in the array using natural order and a projection function to map values to strings. */ -export function max(array: ArrayLike, accessor: (datum: T, index: number, array: ArrayLike) => string | undefined | null): string | undefined; +export function max(array: Iterable, accessor: (datum: T, index: number, array: Iterable) => string | undefined | null): string | undefined; /** * Return the maximum value in the array using natural order and a projection function to map values to easily-sorted values. */ -export function max(array: ArrayLike, accessor: (datum: T, index: number, array: ArrayLike) => U | undefined | null): U | undefined; +export function max(array: Iterable, accessor: (datum: T, index: number, array: Iterable) => U | undefined | null): U | undefined; /** * Return the minimum value in the array using natural order. */ -export function min(array: ArrayLike): string | undefined; +export function min(array: Iterable): string | undefined; /** * Return the minimum value in the array using natural order. */ -export function min(array: ArrayLike): T | undefined; +export function min(array: Iterable): T | undefined; /** * Return the minimum value in the array using natural order. */ -export function min(array: ArrayLike, accessor: (datum: T, index: number, array: ArrayLike) => string | undefined | null): string | undefined; +export function min(array: Iterable, accessor: (datum: T, index: number, array: Iterable) => string | undefined | null): string | undefined; /** * Return the minimum value in the array using natural order. */ -export function min(array: ArrayLike, accessor: (datum: T, index: number, array: ArrayLike) => U | undefined | null): U | undefined; +export function min(array: Iterable, accessor: (datum: T, index: number, array: Iterable) => U | undefined | null): U | undefined; /** * Return the min and max simultaneously. */ -export function extent(array: ArrayLike): [string, string] | [undefined, undefined]; +export function extent(array: Iterable): [string, string] | [undefined, undefined]; /** * Return the min and max simultaneously. */ -export function extent(array: ArrayLike): [T, T] | [undefined, undefined]; +export function extent(array: Iterable): [T, T] | [undefined, undefined]; /** * Return the min and max simultaneously. */ -export function extent(array: ArrayLike, accessor: (datum: T, index: number, array: ArrayLike) => string | undefined | null): [string, string] | [undefined, undefined]; +export function extent(array: Iterable, accessor: (datum: T, index: number, array: Iterable) => string | undefined | null): [string, string] | [undefined, undefined]; /** * Return the min and max simultaneously. */ -export function extent(array: ArrayLike, accessor: (datum: T, index: number, array: ArrayLike) => U | undefined | null): [U, U] | [undefined, undefined]; +export function extent(array: Iterable, accessor: (datum: T, index: number, array: Iterable) => U | undefined | null): [U, U] | [undefined, undefined]; /** * Return the mean of an array of numbers */ -export function mean(array: ArrayLike): number | undefined; +export function mean(array: Iterable): number | undefined; /** * Return the mean of an array of numbers */ -export function mean(array: ArrayLike, accessor: (datum: T, index: number, array: ArrayLike) => number | undefined | null): number | undefined; +export function mean(array: Iterable, accessor: (datum: T, index: number, array: Iterable) => number | undefined | null): number | undefined; /** * Return the median of an array of numbers */ -export function median(array: ArrayLike): number | undefined; +export function median(array: Iterable): number | undefined; /** * Return the median of an array of numbers */ -export function median(array: ArrayLike, accessor: (element: T, i: number, array: ArrayLike) => number | undefined | null): number | undefined; +export function median(array: Iterable, accessor: (element: T, i: number, array: Iterable) => number | undefined | null): number | undefined; /** * Returns the p-quantile of an array of numbers */ -export function quantile(array: ArrayLike, p: number): number | undefined; +export function quantile(array: Iterable, p: number): number | undefined; -export function quantile(array: ArrayLike, p: number, accessor: (element: T, i: number, array: ArrayLike) => number | undefined | null): number | undefined; +export function quantile(array: Iterable, p: number, accessor: (element: T, i: number, array: Iterable) => number | undefined | null): number | undefined; /** * Compute the sum of an array of numbers. */ -export function sum(array: ArrayLike): number; +export function sum(array: Iterable): number; /** * Compute the sum of an array, using the given accessor to convert values to numbers. */ -export function sum(array: ArrayLike, accessor: (datum: T, index: number, array: ArrayLike) => number | undefined | null): number; +export function sum(array: Iterable, accessor: (datum: T, index: number, array: Iterable) => number | undefined | null): number; /** * Compute the standard deviation, defined as the square root of the bias-corrected variance, of the given array of numbers. */ -export function deviation(array: ArrayLike): number | undefined; +export function deviation(array: Iterable): number | undefined; /** * Compute the standard deviation, defined as the square root of the bias-corrected variance, of the given array, * using the given accessor to convert values to numbers. */ -export function deviation(array: ArrayLike, accessor: (datum: T, index: number, array: ArrayLike) => number | undefined | null): number | undefined; +export function deviation(array: Iterable, accessor: (datum: T, index: number, array: Iterable) => number | undefined | null): number | undefined; /** * Compute an unbiased estimator of the population variance of the given array of numbers. */ -export function variance(array: ArrayLike): number | undefined; +export function variance(array: Iterable): number | undefined; /** * Compute an unbiased estimator of the population variance of the given array, * using the given accessor to convert values to numbers. */ -export function variance(array: ArrayLike, accessor: (datum: T, index: number, array: ArrayLike) => number | undefined | null): number | undefined; +export function variance(array: Iterable, accessor: (datum: T, index: number, array: Iterable) => number | undefined | null): number | undefined; // -------------------------------------------------------------------------------------- // Searching Arrays // -------------------------------------------------------------------------------------- -export function scan(array: ArrayLike, comparator?: (a: number, b: number) => number): number | undefined; -export function scan(array: ArrayLike, comparator: (a: T, b: T) => number): number | undefined; +export function scan(array: Iterable, comparator?: (a: number, b: number) => number): number | undefined; +export function scan(array: Iterable, comparator: (a: T, b: T) => number): number | undefined; -export function bisectLeft(array: ArrayLike, x: number, lo?: number, hi?: number): number; -export function bisectLeft(array: ArrayLike, x: string, lo?: number, hi?: number): number; -export function bisectLeft(array: ArrayLike, x: Date, lo?: number, hi?: number): number; +export function bisectLeft(array: Iterable, x: number, lo?: number, hi?: number): number; +export function bisectLeft(array: Iterable, x: string, lo?: number, hi?: number): number; +export function bisectLeft(array: Iterable, x: Date, lo?: number, hi?: number): number; -export function bisectRight(array: ArrayLike, x: number, lo?: number, hi?: number): number; -export function bisectRight(array: ArrayLike, x: string, lo?: number, hi?: number): number; -export function bisectRight(array: ArrayLike, x: Date, lo?: number, hi?: number): number; +export function bisectRight(array: Iterable, x: number, lo?: number, hi?: number): number; +export function bisectRight(array: Iterable, x: string, lo?: number, hi?: number): number; +export function bisectRight(array: Iterable, x: Date, lo?: number, hi?: number): number; export const bisect: typeof bisectRight; export interface Bisector { - left(array: ArrayLike, x: U, lo?: number, hi?: number): number; - right(array: ArrayLike, x: U, lo?: number, hi?: number): number; + left(array: Iterable, x: U, lo?: number, hi?: number): number; + right(array: Iterable, x: U, lo?: number, hi?: number): number; } export function bisector(comparator: (a: T, b: U) => number): Bisector; @@ -180,7 +180,7 @@ export function bisector(accessor: (x: T) => U): Bisector; * @param array The array to partially sort (in place). * @param k The middle index for partial sorting. */ -export function quickselect(array: ArrayLike, k: number): T[]; +export function quickselect(array: Iterable, k: number): T[]; /** * Rearranges items so that all items in the [left, k] are the smallest. The k-th element will have the (k - left + 1)-th smallest value in [left, right]. @@ -189,7 +189,7 @@ export function quickselect(array: ArrayLike, k: number): T[]; * @param k The middle index for partial sorting. * @param left The left index of the range to sort. */ -export function quickselect(array: ArrayLike, k: number, left: number): T[]; +export function quickselect(array: Iterable, k: number, left: number): T[]; /** * Rearranges items so that all items in the [left, k] are the smallest. The k-th element will have the (k - left + 1)-th smallest value in [left, right]. @@ -199,7 +199,7 @@ export function quickselect(array: ArrayLike, k: number, left: number): T[ * @param left The left index of the range to sort. * @param right The right index. */ -export function quickselect(array: ArrayLike, k: number, left: number, right: number): T[]; +export function quickselect(array: Iterable, k: number, left: number, right: number): T[]; /** * Rearranges items so that all items in the [left, k] are the smallest. The k-th element will have the (k - left + 1)-th smallest value in [left, right]. @@ -210,7 +210,7 @@ export function quickselect(array: ArrayLike, k: number, left: number, rig * @param right The right index. * @param compare The compare function. */ -export function quickselect(array: ArrayLike, k: number, left: number, right: number, compare: (a: Primitive | undefined, b: Primitive | undefined) => number): T[]; +export function quickselect(array: Iterable, k: number, left: number, right: number, compare: (a: Primitive | undefined, b: Primitive | undefined) => number): T[]; // NB. this is limited to primitive values due to D3's use of the <, >, and >= operators. Results get weird for object instances. /** @@ -233,7 +233,7 @@ export function descending(a: Primitive | undefined, b: Primitive | undefined): * @param a The array to group. * @param key The key function. */ -export function group(a: ArrayLike, key: (value: TObject) => TKey): Map; +export function group(a: Iterable, key: (value: TObject) => TKey): Map; /** * Groups and reduces the specified array of values into a Map from key to value. @@ -242,7 +242,7 @@ export function group(a: ArrayLike, key: (value: TObject * @param reduce The reduce function. * @param key The key function. */ -export function rollup(a: ArrayLike, reduce: (value: TObject[]) => TReduce, key: (value: TObject) => TKey): Map; +export function rollup(a: Iterable, reduce: (value: TObject[]) => TReduce, key: (value: TObject) => TKey): Map; /** * Returns the Cartesian product of the two arrays a and b. @@ -252,7 +252,7 @@ export function rollup(a: ArrayLike, reduce: (v * @param a First input array. * @param b Second input array. */ -export function cross(a: ArrayLike, b: ArrayLike): Array<[S, T]>; +export function cross(a: Iterable, b: ArrayLike): Array<[S, T]>; /** * Returns the Cartesian product of the two arrays a and b. @@ -263,12 +263,12 @@ export function cross(a: ArrayLike, b: ArrayLike): Array<[S, T]>; * @param b Second input array. * @param reducer A reducer function taking as input an element from "a" and "b" and returning a reduced value. */ -export function cross(a: ArrayLike, b: ArrayLike, reducer: (a: S, b: T) => U): U[]; +export function cross(a: Iterable, b: Iterable, reducer: (a: S, b: T) => U): U[]; /** * Merges the specified arrays into a single array. */ -export function merge(arrays: ArrayLike>): T[]; +export function merge(arrays: Iterable>): T[]; /** * For each adjacent pair of elements in the specified array, returns a new array of tuples of elements i and i - 1. @@ -276,7 +276,7 @@ export function merge(arrays: ArrayLike>): T[]; * * @param array Array of input elements */ -export function pairs(array: ArrayLike): Array<[T, T]>; +export function pairs(array: Iterable): Array<[T, T]>; /** * For each adjacent pair of elements in the specified array, in order, invokes the specified reducer function passing the element i and element i - 1. * Returns the resulting array of pair-wise reduced elements. @@ -285,7 +285,7 @@ export function pairs(array: ArrayLike): Array<[T, T]>; * @param array Array of input elements * @param reducer A reducer function taking as input to adjacent elements of the input array and returning a reduced value. */ -export function pairs(array: ArrayLike, reducer: (a: T, b: T) => U): U[]; +export function pairs(array: Iterable, reducer: (a: T, b: T) => U): U[]; /** * Returns a permutation of the specified array using the specified array of indexes. @@ -415,14 +415,14 @@ export type ThresholdArrayGenerator = ThresholdNumberArrayGenerator; * @deprecated Use `HistogramGeneratorNumber` for `number` values and `HistogramGeneratorDate for `Date` values. */ export interface HistogramGenerator { - (data: ArrayLike): Array>; + (data: Iterable): Array>; - value(): (d: Datum, i: number, data: ArrayLike) => Value; - value(valueAccessor: (d: Datum, i: number, data: ArrayLike) => Value): this; + value(): (d: Datum, i: number, data: Iterable) => Value; + value(valueAccessor: (d: Datum, i: number, data: Iterable) => Value): this; - domain(): (values: ArrayLike) => [Value, Value] | [undefined, undefined]; + domain(): (values: Iterable) => [Value, Value] | [undefined, undefined]; domain(domain: [Value, Value]): this; - domain(domainAccessor: (values: ArrayLike) => [Value, Value] | [undefined, undefined]): this; + domain(domainAccessor: (values: Iterable) => [Value, Value] | [undefined, undefined]): this; /** * Set the array of values to be used as thresholds in determining the bins. From 5bf8a129ba7b22f1df1bb8fb140994d795b87477 Mon Sep 17 00:00:00 2001 From: Hugues Stefanski Date: Sun, 3 Feb 2019 15:29:04 +0100 Subject: [PATCH 013/469] Replaced d3-array v1 tests with previous version --- types/d3-array/v1/d3-array-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/d3-array/v1/d3-array-tests.ts b/types/d3-array/v1/d3-array-tests.ts index 66d99dc9b1..11f208f869 100644 --- a/types/d3-array/v1/d3-array-tests.ts +++ b/types/d3-array/v1/d3-array-tests.ts @@ -779,7 +779,7 @@ histoMixedObject_Date = histoMixedObject_Date.domain(timeScale.domain()); // fai domainFnDate = histoMixedObject_Date.domain(); histoMixedObject_DateOrUndefined = histoMixedObject_DateOrUndefined.domain([new Date(2014, 3, 15), new Date(2017, 4, 15)]); histoMixedObject_DateOrUndefined = histoMixedObject_DateOrUndefined.domain([domain[0], domain[domain.length]]); -histoMixedObject_DateOrUndefined = histoMixedObject_DateOrUndefined.domain((values) => [values[0]!, values[values.length]!]); +histoMixedObject_DateOrUndefined = histoMixedObject_DateOrUndefined.domain((values) => [values[0]!, values[values.length]!]); // thresholds(...) ------------------------------------------------------------- From 61d9b36abe11b677132428c2dc1544b407119c9f Mon Sep 17 00:00:00 2001 From: Hugues Stefanski Date: Sun, 3 Feb 2019 15:43:37 +0100 Subject: [PATCH 014/469] d3-array v2.0 : changed typing for testing purpose --- types/d3-array/v1/d3-array-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/d3-array/v1/d3-array-tests.ts b/types/d3-array/v1/d3-array-tests.ts index 11f208f869..01529191b8 100644 --- a/types/d3-array/v1/d3-array-tests.ts +++ b/types/d3-array/v1/d3-array-tests.ts @@ -608,7 +608,7 @@ const testObject = { }; const p1: Array = d3Array.permute(testObject, ['name', 'val', 'when', 'more']); -const p2: Array = d3Array.permute(testObject, ['when', 'more']); +const p2: Array = d3Array.permute(testObject, ['when', 'more']); // $ExpectError const p3 = d3Array.permute(testObject, ['when', 'unknown']); From a9fed9d7eb4ac99d562422f989f4251a4019b259 Mon Sep 17 00:00:00 2001 From: Hugues Stefanski Date: Sun, 3 Feb 2019 15:54:47 +0100 Subject: [PATCH 015/469] d3-array v2.0 : augmented type --- types/d3-array/d3-array-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/d3-array/d3-array-tests.ts b/types/d3-array/d3-array-tests.ts index 381d49869c..a4d21546d9 100644 --- a/types/d3-array/d3-array-tests.ts +++ b/types/d3-array/d3-array-tests.ts @@ -631,7 +631,7 @@ const testObject = { }; const p1: Array = d3Array.permute(testObject, ['name', 'val', 'when', 'more']); -const p2: Array = d3Array.permute(testObject, ['when', 'more']); +const p2: Array = d3Array.permute(testObject, ['when', 'more']); // $ExpectError const p3 = d3Array.permute(testObject, ['when', 'unknown']); From 52727c99f10e6b7a5b563b982ca0b86cdae0d248 Mon Sep 17 00:00:00 2001 From: Hugues Stefanski Date: Wed, 20 Feb 2019 18:39:17 +0100 Subject: [PATCH 016/469] d3-array : removed deprecated Corrected ArrayLike vs Iterable --- types/d3-array/d3-array-tests.ts | 5 ----- types/d3-array/index.d.ts | 26 +++++++++++++------------- 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/types/d3-array/d3-array-tests.ts b/types/d3-array/d3-array-tests.ts index 04478567e6..f202ab2fb9 100644 --- a/types/d3-array/d3-array-tests.ts +++ b/types/d3-array/d3-array-tests.ts @@ -957,8 +957,3 @@ num = d3Array.thresholdScott(readonlyNumbersArray, -1, 234); num = d3Array.thresholdSturges(numbersArray); num = d3Array.thresholdSturges(typedArray); num = d3Array.thresholdSturges(readonlyNumbersArray); - -// Deprecated ================================================================== - -const histDeprecatedNumber: d3Array.HistogramGenerator = d3Array.histogram(); -const histDeprecatedDate: d3Array.HistogramGenerator = d3Array.histogram(); diff --git a/types/d3-array/index.d.ts b/types/d3-array/index.d.ts index b7949ec870..1e73813965 100644 --- a/types/d3-array/index.d.ts +++ b/types/d3-array/index.d.ts @@ -156,19 +156,19 @@ export function variance(array: Iterable, accessor: (datum: T, index: numb export function scan(array: Iterable, comparator?: (a: number, b: number) => number): number | undefined; export function scan(array: Iterable, comparator: (a: T, b: T) => number): number | undefined; -export function bisectLeft(array: Iterable, x: number, lo?: number, hi?: number): number; -export function bisectLeft(array: Iterable, x: string, lo?: number, hi?: number): number; -export function bisectLeft(array: Iterable, x: Date, lo?: number, hi?: number): number; +export function bisectLeft(array: ArrayLike, x: number, lo?: number, hi?: number): number; +export function bisectLeft(array: ArrayLike, x: string, lo?: number, hi?: number): number; +export function bisectLeft(array: ArrayLike, x: Date, lo?: number, hi?: number): number; -export function bisectRight(array: Iterable, x: number, lo?: number, hi?: number): number; -export function bisectRight(array: Iterable, x: string, lo?: number, hi?: number): number; -export function bisectRight(array: Iterable, x: Date, lo?: number, hi?: number): number; +export function bisectRight(array: ArrayLike, x: number, lo?: number, hi?: number): number; +export function bisectRight(array: ArrayLike, x: string, lo?: number, hi?: number): number; +export function bisectRight(array: ArrayLike, x: Date, lo?: number, hi?: number): number; export const bisect: typeof bisectRight; export interface Bisector { - left(array: Iterable, x: U, lo?: number, hi?: number): number; - right(array: Iterable, x: U, lo?: number, hi?: number): number; + left(array: ArrayLike, x: U, lo?: number, hi?: number): number; + right(array: ArrayLike, x: U, lo?: number, hi?: number): number; } export function bisector(comparator: (a: T, b: U) => number): Bisector; @@ -180,7 +180,7 @@ export function bisector(accessor: (x: T) => U): Bisector; * @param array The array to partially sort (in place). * @param k The middle index for partial sorting. */ -export function quickselect(array: Iterable, k: number): T[]; +export function quickselect(array: ArrayLike, k: number): T[]; /** * Rearranges items so that all items in the [left, k] are the smallest. The k-th element will have the (k - left + 1)-th smallest value in [left, right]. @@ -189,7 +189,7 @@ export function quickselect(array: Iterable, k: number): T[]; * @param k The middle index for partial sorting. * @param left The left index of the range to sort. */ -export function quickselect(array: Iterable, k: number, left: number): T[]; +export function quickselect(array: ArrayLike, k: number, left: number): T[]; /** * Rearranges items so that all items in the [left, k] are the smallest. The k-th element will have the (k - left + 1)-th smallest value in [left, right]. @@ -199,7 +199,7 @@ export function quickselect(array: Iterable, k: number, left: number): T[] * @param left The left index of the range to sort. * @param right The right index. */ -export function quickselect(array: Iterable, k: number, left: number, right: number): T[]; +export function quickselect(array: ArrayLike, k: number, left: number, right: number): T[]; /** * Rearranges items so that all items in the [left, k] are the smallest. The k-th element will have the (k - left + 1)-th smallest value in [left, right]. @@ -210,7 +210,7 @@ export function quickselect(array: Iterable, k: number, left: number, righ * @param right The right index. * @param compare The compare function. */ -export function quickselect(array: Iterable, k: number, left: number, right: number, compare: (a: Primitive | undefined, b: Primitive | undefined) => number): T[]; +export function quickselect(array: ArrayLike, k: number, left: number, right: number, compare: (a: Primitive | undefined, b: Primitive | undefined) => number): T[]; // NB. this is limited to primitive values due to D3's use of the <, >, and >= operators. Results get weird for object instances. /** @@ -252,7 +252,7 @@ export function rollup(a: Iterable, reduce: (va * @param a First input array. * @param b Second input array. */ -export function cross(a: Iterable, b: ArrayLike): Array<[S, T]>; +export function cross(a: Iterable, b: Iterable): Array<[S, T]>; /** * Returns the Cartesian product of the two arrays a and b. From 4e92922dea7ea1752461fa6ae001532977af3b94 Mon Sep 17 00:00:00 2001 From: Hugues Stefanski Date: Wed, 20 Feb 2019 18:46:44 +0100 Subject: [PATCH 017/469] d3-array : fixed last Iterable vs ArrayLike --- types/d3-array/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/d3-array/index.d.ts b/types/d3-array/index.d.ts index 1e73813965..6d128323f5 100644 --- a/types/d3-array/index.d.ts +++ b/types/d3-array/index.d.ts @@ -474,9 +474,9 @@ export interface HistogramGeneratorDate e } export interface HistogramGeneratorNumber extends HistogramCommon { - domain(): (values: ArrayLike) => [number, number] | [undefined, undefined]; + domain(): (values: Iterable) => [number, number] | [undefined, undefined]; domain(domain: [number, number]): this; - domain(domainAccessor: (values: ArrayLike) => [number, number] | [undefined, undefined]): this; + domain(domainAccessor: (values: Iterable) => [number, number] | [undefined, undefined]): this; thresholds(): ThresholdCountGenerator | ThresholdNumberArrayGenerator; /** From bfc6fa1f4f7b9bb2bcda4f917d84d75563934f68 Mon Sep 17 00:00:00 2001 From: Hugues Stefanski Date: Wed, 20 Feb 2019 19:01:40 +0100 Subject: [PATCH 018/469] Re added npm url --- types/d3-array/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/d3-array/index.d.ts b/types/d3-array/index.d.ts index bc271ccffd..083fa77940 100644 --- a/types/d3-array/index.d.ts +++ b/types/d3-array/index.d.ts @@ -1,5 +1,5 @@ // Type definitions for D3JS d3-array module 2.0 -// Project: https://github.com/d3/d3-array +// Project: https://github.com/d3/d3-array, https://d3js.org/d3-array // Definitions by: Alex Ford // Boris Yankov // Tom Wanzek From c746ba11416c96d340a909ec6b15f364757dbab9 Mon Sep 17 00:00:00 2001 From: Hugues Stefanski Date: Wed, 20 Feb 2019 21:00:03 +0100 Subject: [PATCH 019/469] d3-array : removed deprecated methods --- types/d3-array/index.d.ts | 36 ------------------------------------ 1 file changed, 36 deletions(-) diff --git a/types/d3-array/index.d.ts b/types/d3-array/index.d.ts index 083fa77940..5de77e4e10 100644 --- a/types/d3-array/index.d.ts +++ b/types/d3-array/index.d.ts @@ -406,36 +406,6 @@ export type ThresholdNumberArrayGenerator = export type ThresholdDateArrayGenerator = (values: ArrayLike, min: Date, max: Date) => Value[]; -/** - * @deprecated Use ThresholdNumberArrayGenerator or ThresholdDateArrayGenerator. - */ -export type ThresholdArrayGenerator = ThresholdNumberArrayGenerator; - -/** - * @deprecated Use `HistogramGeneratorNumber` for `number` values and `HistogramGeneratorDate for `Date` values. - */ -export interface HistogramGenerator { - (data: Iterable): Array>; - - value(): (d: Datum, i: number, data: Iterable) => Value; - value(valueAccessor: (d: Datum, i: number, data: Iterable) => Value): this; - - domain(): (values: Iterable) => [Value, Value] | [undefined, undefined]; - domain(domain: [Value, Value]): this; - domain(domainAccessor: (values: Iterable) => [Value, Value] | [undefined, undefined]): this; - - /** - * Set the array of values to be used as thresholds in determining the bins. - * - * Any threshold values outside the domain are ignored. The first bin.x0 is always equal to the minimum domain value, - * and the last bin.x1 is always equal to the maximum domain value. - * - * @param thresholds Array of threshold values used for binning. The elements must - * be of the same type as the materialized values of the histogram. - */ - thresholds(thresholds: ArrayLike): this; -} - export interface HistogramCommon { (data: ArrayLike): Array>; @@ -530,12 +500,6 @@ export function histogram(): HistogramGeneratorNumber; export function histogram(): HistogramGeneratorNumber; export function histogram(): HistogramGeneratorDate; -/** - * @deprecated Do not use Value generic which mixes number and Date types. Use either number or Date - * (in combination with undefined, as applicable) to obtain a type-specific histogram generator. - */ -export function histogram(): HistogramGenerator; - // -------------------------------------------------------------------------------------- // Histogram Thresholds // -------------------------------------------------------------------------------------- From 8484128935801c923936b3afc4095851e2ef104c Mon Sep 17 00:00:00 2001 From: Jonathan Ly Date: Mon, 4 Mar 2019 12:05:55 +1100 Subject: [PATCH 020/469] [react-request] add more types --- types/react-request/index.d.ts | 63 +++++++++++++++++++++++----------- 1 file changed, 43 insertions(+), 20 deletions(-) diff --git a/types/react-request/index.d.ts b/types/react-request/index.d.ts index 0806dda260..a161ff9339 100644 --- a/types/react-request/index.d.ts +++ b/types/react-request/index.d.ts @@ -1,50 +1,73 @@ // Type definitions for react-request 3.1 // Project: https://github.com/jamesplease/react-request // Definitions by: Danny Cochran +// Angus Fretwell +// Jonathan Ly // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.9 import * as React from 'react'; -export interface RenderProps { - requestName: string; - requestKey: string; - fetching: boolean; - failed: boolean; - error: Error | null; - response: Response | null; - url: string; - data: T | null; +export interface FetchResponse { + url: string; + init: any; + failed: boolean; + requestKey: string; + response: Response | null; + data: T | null; + error: Error | null; + didUnmount: boolean; +} + +export interface RenderProps extends FetchResponse { + requestName: string; + fetching: boolean; + doFetch: DoFetch; } export interface FetchRequestProps extends RequestInit { - lazy?: boolean; - url: string; + lazy?: boolean; + url: string; } export interface FetchProps extends FetchRequestProps { - children?: (renderProps: RenderProps) => React.ReactNode; + afterFetch?: (args: FetchResponse) => void; + transformData?: (data: any) => T; + children?: (renderProps: RenderProps) => React.ReactNode; } +export interface DoFetchOptions extends RequestInit { + url?: string; +} + +export type DoFetch = ( + options?: DoFetchOptions +) => Promise>; + // TODO(dannycochran) RequestKeyOptions, ProxyRequest, fetchDedupe, getRequestKey, isRequestInFlight, clearRequestCache // should all be defined in an adjacent typings directory for fetch-dedupe. export interface RequestKeyOptions { - url?: string; - method?: string; - responseType?: string; - body?: string; + url?: string; + method?: string; + responseType?: string; + body?: string; } export interface ProxyRequest { - requestKey: string; - res: Response; + requestKey: string; + res: Response; } // TODO(dannycochran) Fill out fetchDedupe options. -export function fetchDedupe(input: any, init?: any, dedupeOptions?: any): Promise; +export function fetchDedupe( + input: any, + init?: any, + dedupeOptions?: any +): Promise; + export function getRequestKey(keyOptions?: RequestKeyOptions): string; export function isRequestInFlight(): boolean; export function clearRequestCache(): void; export function clearResponseCache(): void; -export class Fetch extends React.Component> { } +export class Fetch extends React.Component> {} From 46f86b5961f9a625cb91c59abcda9c2ee5b68e43 Mon Sep 17 00:00:00 2001 From: Tyler Krupicka Date: Thu, 7 Mar 2019 13:38:51 -0800 Subject: [PATCH 021/469] update axe-webdriverjs analyze --- types/axe-webdriverjs/axe-webdriverjs-tests.ts | 2 +- types/axe-webdriverjs/index.d.ts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/types/axe-webdriverjs/axe-webdriverjs-tests.ts b/types/axe-webdriverjs/axe-webdriverjs-tests.ts index 47eeadc8c5..d269b1ef28 100644 --- a/types/axe-webdriverjs/axe-webdriverjs-tests.ts +++ b/types/axe-webdriverjs/axe-webdriverjs-tests.ts @@ -20,7 +20,7 @@ const inTest = async (webDriver: WebDriver) => { .disableRules("rule") .disableRules(["rule", "rule"]) .configure(spec) - .analyze((internalResults: AxeAnalysis) => {}); + .analyze((err: Error, internalResults: AxeAnalysis) => {}); const inapplicable: Result[] = analysis.inapplicable; const incomplete: Result[] = analysis.incomplete; diff --git a/types/axe-webdriverjs/index.d.ts b/types/axe-webdriverjs/index.d.ts index 3c8ae27249..f9d7ed2bbc 100644 --- a/types/axe-webdriverjs/index.d.ts +++ b/types/axe-webdriverjs/index.d.ts @@ -74,7 +74,9 @@ export interface AxeBuilder { * Perform analysis and retrieve results. * @param callback Function to execute when analysis completes. */ - analyze(callback: (results: AxeAnalysis) => void): Promise; + analyze( + callback?: (err: Error, results: AxeAnalysis) => void + ): Promise; } export const AxeBuilder: { From 587f09d9bc235af1ad86d35bb55f60501cb6a645 Mon Sep 17 00:00:00 2001 From: Tyler Krupicka Date: Thu, 7 Mar 2019 14:05:43 -0800 Subject: [PATCH 022/469] axe-webdriverjs increment version --- types/axe-webdriverjs/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/axe-webdriverjs/index.d.ts b/types/axe-webdriverjs/index.d.ts index f9d7ed2bbc..bbd054f7e4 100644 --- a/types/axe-webdriverjs/index.d.ts +++ b/types/axe-webdriverjs/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for axe-webdriverjs 2.0 +// Type definitions for axe-webdriverjs 2.1 // Project: https://github.com/dequelabs/axe-webdriverjs#readme // Definitions by: My Self // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 87632ff8f1032c866cc83884c6a3a8ee117248ca Mon Sep 17 00:00:00 2001 From: Flexmonster Date: Fri, 8 Mar 2019 14:18:01 +0200 Subject: [PATCH 023/469] Updated to 2.7 API --- types/flexmonster/index.d.ts | 104 ++++++++++++++++++++++++++++------- 1 file changed, 85 insertions(+), 19 deletions(-) diff --git a/types/flexmonster/index.d.ts b/types/flexmonster/index.d.ts index fad76ca64d..6d92a20ddc 100644 --- a/types/flexmonster/index.d.ts +++ b/types/flexmonster/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for flexmonster 2.6 +// Type definitions for flexmonster 2.7 // Project: https://flexmonster.com/ // Definitions by: Flexmonster // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -10,7 +10,7 @@ declare const Flexmonster: FlexmonsterConstructor; export = Flexmonster; interface FlexmonsterConstructor { - new (params: Flexmonster.Params): Flexmonster.Pivot; + new(params: Flexmonster.Params): Flexmonster.Pivot; (params: Flexmonster.Params): Flexmonster.Pivot; } @@ -75,7 +75,7 @@ declare namespace Flexmonster { clear(): void; clearFilter(hierarchyName: string): void; clearXMLACache(proxyUrl: string, databaseId: string, callbackHandler: ((reponse: object) => void) | string, cubeId: string, measuresGroupId: string, - username?: string, password?: string): void; + username?: string, password?: string): void; closeFieldsList(): void; collapseAllData(): void; collapseData(hierarchyName: string): void; @@ -93,8 +93,7 @@ declare namespace Flexmonster { getColumns(): Hierarchy[]; getCondition(id: string): ConditionalFormat; getData(options: { slice?: Slice }, callbackHandler: ((rawData: any) => void) | string, updateHandler?: ((rawData: any) => void) | string): void; - getFilter(hierarchyName: string): FilterItem[]; - getFilterProperties(hierarchyName: string): FilterProperties; + getFilter(hierarchyName: string): Filter; getFormat(measureName: string): Format; getMeasures(): Measure[]; getMembers(hierarchyName: string, memberName: string, callbackHandler: ((members: Member[]) => void) | string): Member[]; @@ -123,13 +122,11 @@ declare namespace Flexmonster { removeSelection(): void; runQuery(slice: Slice): void; save(filename: string, destination: string, callbackHandler?: (() => void) | string, url?: string, embedData?: boolean): string; - setBottomX(hierarchyName: string, num: number, measure: MeasureObject): void; - setFilter(hierarchyName: string, items: string[], negation?: boolean): void; + setFilter(hierarchyName: string, filter: Filter): void; setFormat(format: Format, measureName: string): void; setOptions(options: Options): void; setReport(report: Report): void; setSort(hierarchyName: string, sortName: string, customSorting?: string[]): void; - setTopX(hierarchyName: string, num: number, measure: MeasureObject): void; showCharts(type?: string, multiple?: boolean): void; showGrid(): void; showGridAndCharts(type?: string, position?: string, multiple?: boolean): void; @@ -140,18 +137,18 @@ declare namespace Flexmonster { version: string; fusioncharts?: { getData(options: { type: string; slice?: Slice; prepareDataFunction?: (rawData: any) => any }, callbackHandler: ((rawData: any) => void) | string, - updateHandler?: ((rawData: any) => void) | string): void; + updateHandler?: ((rawData: any) => void) | string): void; getNumberFormat(format: object): object; }; googlecharts?: { getData(options: { type?: string; slice?: Slice; prepareDataFunction?: (rawData: any) => any }, callbackHandler: ((rawData: any) => void) | string, - updateHandler?: ((rawData: any) => void) | string): void; + updateHandler?: ((rawData: any) => void) | string): void; getNumberFormat(format: object): object; getNumberFormatPattern(format: object): string; }; highcharts?: { getData(options: { type?: string; slice?: Slice; xAxisType?: string; valuesOnly?: boolean, withDrilldown?: boolean, prepareDataFunction?: (rawData: any) => any }, - callbackHandler: ((rawData: any) => void) | string, updateHandler?: ((rawData: any) => void) | string): void; + callbackHandler: ((rawData: any) => void) | string, updateHandler?: ((rawData: any) => void) | string): void; getAxisFormat(format: object): string; getPointXFormat(format: object): string; getPointYFormat(format: object): string; @@ -194,7 +191,11 @@ declare namespace Flexmonster { username?: string; password?: string; requestHeader?: object; - subquery?: string; + subquery?: string | object; + // elasticsearch + host?: string | string[] | object; + index?: string; + mapping?: object; } interface Slice { @@ -256,6 +257,11 @@ declare namespace Flexmonster { grandTotalsPosition?: string; drillThroughMaxRows?: number; }; + filter?: { + timezoneOffset?: number; + weekOffset?: number; + dateFormat?: string; + }; configuratorActive?: boolean; configuratorButton?: boolean; dateTimezoneOffset?: number; @@ -354,18 +360,78 @@ declare namespace Flexmonster { interface Hierarchy { caption?: string; dimensionName?: string; - filter?: { - members?: string[]; - negation?: boolean; - measure?: MeasureObject; - quantity?: number; - type?: string; - }; + filter?: Filter; sortName?: string; sortOrder?: string[]; uniqueName?: string; } + interface Filter { + members?: string[]; + exclude?: string[]; + include?: string[]; + query?: NumberQuery | LabelQuery | DateQuery | TimeQuery | ValueQuery; + measure?: string | MeasureObject; + } + + interface NumberQuery { + equal?: number; + not_equal?: number; + greater?: number; + greater_equal?: number; + less?: number; + less_equal?: number; + between?: number[]; + not_between?: number[]; + } + + interface LabelQuery { + equal?: string; + not_equal?: string; + begin?: string; + not_begin?: string; + end?: string; + not_end?: string; + contain?: string; + not_contain?: string; + greater?: string; + greater_equal?: string; + less?: string; + less_equal?: string; + between?: string[]; + not_between?: string[]; + } + + interface DateQuery { + equal?: string; + not_equal?: string; + before?: string; + before_equal?: string; + after?: string; + after_equal?: string; + between?: string[]; + not_between?: string[]; + last?: string; + current?: string; + next?: string; + } + + interface TimeQuery { + equal?: string; + not_equal?: string; + greater?: string; + greater_equal?: string; + less?: string; + less_equal?: string; + between?: string[]; + not_between?: string[]; + } + + interface ValueQuery extends NumberQuery { + top?: number; + bottom?: number; + } + interface Measure { uniqueName?: string; active?: boolean; From e632ad855598b9e17604c95f6db657a90d165417 Mon Sep 17 00:00:00 2001 From: Tyler Krupicka Date: Fri, 8 Mar 2019 09:45:28 -0800 Subject: [PATCH 024/469] axe-webdriverjs - error can be null --- types/axe-webdriverjs/axe-webdriverjs-tests.ts | 2 +- types/axe-webdriverjs/index.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/types/axe-webdriverjs/axe-webdriverjs-tests.ts b/types/axe-webdriverjs/axe-webdriverjs-tests.ts index d269b1ef28..14bd0fd0bd 100644 --- a/types/axe-webdriverjs/axe-webdriverjs-tests.ts +++ b/types/axe-webdriverjs/axe-webdriverjs-tests.ts @@ -20,7 +20,7 @@ const inTest = async (webDriver: WebDriver) => { .disableRules("rule") .disableRules(["rule", "rule"]) .configure(spec) - .analyze((err: Error, internalResults: AxeAnalysis) => {}); + .analyze((err: Error | null, internalResults: AxeAnalysis) => {}); const inapplicable: Result[] = analysis.inapplicable; const incomplete: Result[] = analysis.incomplete; diff --git a/types/axe-webdriverjs/index.d.ts b/types/axe-webdriverjs/index.d.ts index bbd054f7e4..c557746a64 100644 --- a/types/axe-webdriverjs/index.d.ts +++ b/types/axe-webdriverjs/index.d.ts @@ -75,7 +75,7 @@ export interface AxeBuilder { * @param callback Function to execute when analysis completes. */ analyze( - callback?: (err: Error, results: AxeAnalysis) => void + callback?: (err: Error | null, results: AxeAnalysis) => void ): Promise; } From bb08f89827df36ddb21ed15061ffdf26165c9bf4 Mon Sep 17 00:00:00 2001 From: Tyler Krupicka Date: Sun, 10 Mar 2019 20:00:07 -0700 Subject: [PATCH 025/469] axe-webdriverjs: try method overloading --- types/axe-webdriverjs/index.d.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/types/axe-webdriverjs/index.d.ts b/types/axe-webdriverjs/index.d.ts index c557746a64..d455e07354 100644 --- a/types/axe-webdriverjs/index.d.ts +++ b/types/axe-webdriverjs/index.d.ts @@ -70,6 +70,13 @@ export interface AxeBuilder { */ configure(config: Spec): this; + /** + * Perform analysis and retrieve results. + * Old API without error parameter for callback + * @param callback Function to execute when analysis completes. + */ + analyze(callback?: (results: AxeAnalysis) => void): Promise; + /** * Perform analysis and retrieve results. * @param callback Function to execute when analysis completes. From 80521fca637bb8c61b4054afd9b6294cb522af26 Mon Sep 17 00:00:00 2001 From: Tyler Krupicka Date: Sun, 10 Mar 2019 20:09:10 -0700 Subject: [PATCH 026/469] axe-wedriverjs: move to unified analyze signature --- types/axe-webdriverjs/index.d.ts | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/types/axe-webdriverjs/index.d.ts b/types/axe-webdriverjs/index.d.ts index d455e07354..1e6323f331 100644 --- a/types/axe-webdriverjs/index.d.ts +++ b/types/axe-webdriverjs/index.d.ts @@ -16,6 +16,9 @@ export interface AxeAnalysis { violations: Result[]; } +type OldAnalyzeCallbackType = (results: AxeAnalysis) => void; +type AnalyzeCallbackType = (err: Error | null, results: AxeAnalysis) => void; + export interface AxeBuilder { /** * Includes a selector in analysis. @@ -70,19 +73,12 @@ export interface AxeBuilder { */ configure(config: Spec): this; - /** - * Perform analysis and retrieve results. - * Old API without error parameter for callback - * @param callback Function to execute when analysis completes. - */ - analyze(callback?: (results: AxeAnalysis) => void): Promise; - /** * Perform analysis and retrieve results. * @param callback Function to execute when analysis completes. */ analyze( - callback?: (err: Error | null, results: AxeAnalysis) => void + callback?: OldAnalyzeCallbackType | AnalyzeCallbackType ): Promise; } From 5cc526244c4df4bed79065135da915767a7c4a9c Mon Sep 17 00:00:00 2001 From: Tyler Krupicka Date: Sun, 10 Mar 2019 20:17:13 -0700 Subject: [PATCH 027/469] axe-webdriverjs: explict exports --- types/axe-webdriverjs/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/axe-webdriverjs/index.d.ts b/types/axe-webdriverjs/index.d.ts index 1e6323f331..13aeff0fc5 100644 --- a/types/axe-webdriverjs/index.d.ts +++ b/types/axe-webdriverjs/index.d.ts @@ -16,8 +16,8 @@ export interface AxeAnalysis { violations: Result[]; } -type OldAnalyzeCallbackType = (results: AxeAnalysis) => void; -type AnalyzeCallbackType = (err: Error | null, results: AxeAnalysis) => void; +export type DeprecatedAnalyzeCallback = (results: AxeAnalysis) => void; +export type AnalyzeCallback = (err: Error | null, results: AxeAnalysis) => void; export interface AxeBuilder { /** @@ -78,7 +78,7 @@ export interface AxeBuilder { * @param callback Function to execute when analysis completes. */ analyze( - callback?: OldAnalyzeCallbackType | AnalyzeCallbackType + callback?: DeprecatedAnalyzeCallback | AnalyzeCallback ): Promise; } From fc03469ff506dc28501c3d1c7916d69fa0e67a2d Mon Sep 17 00:00:00 2001 From: Tyler Krupicka Date: Sun, 10 Mar 2019 20:20:48 -0700 Subject: [PATCH 028/469] axe-webdriverjs: add deprecated analyze test --- types/axe-webdriverjs/axe-webdriverjs-tests.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/types/axe-webdriverjs/axe-webdriverjs-tests.ts b/types/axe-webdriverjs/axe-webdriverjs-tests.ts index 14bd0fd0bd..963e430c62 100644 --- a/types/axe-webdriverjs/axe-webdriverjs-tests.ts +++ b/types/axe-webdriverjs/axe-webdriverjs-tests.ts @@ -22,6 +22,10 @@ const inTest = async (webDriver: WebDriver) => { .configure(spec) .analyze((err: Error | null, internalResults: AxeAnalysis) => {}); + const deprecatedAnalysis: AxeAnalysis = await AxeBuilder(webDriver).analyze( + (internalResults: AxeAnalysis) => {} + ); + const inapplicable: Result[] = analysis.inapplicable; const incomplete: Result[] = analysis.incomplete; const passes: Result[] = analysis.passes; From 6f1e198243cd0cfb6398fb988886c80464d4d234 Mon Sep 17 00:00:00 2001 From: Tyler Krupicka Date: Sun, 10 Mar 2019 20:23:14 -0700 Subject: [PATCH 029/469] axe-wedriverjs: analyze callback type order --- types/axe-webdriverjs/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/axe-webdriverjs/index.d.ts b/types/axe-webdriverjs/index.d.ts index 13aeff0fc5..7d5d013afb 100644 --- a/types/axe-webdriverjs/index.d.ts +++ b/types/axe-webdriverjs/index.d.ts @@ -78,7 +78,7 @@ export interface AxeBuilder { * @param callback Function to execute when analysis completes. */ analyze( - callback?: DeprecatedAnalyzeCallback | AnalyzeCallback + callback?: AnalyzeCallback | DeprecatedAnalyzeCallback ): Promise; } From b0ddea4f92d95a4432f1f38f92a7bc51fc133fd5 Mon Sep 17 00:00:00 2001 From: Tyler Krupicka Date: Sun, 10 Mar 2019 20:41:32 -0700 Subject: [PATCH 030/469] axe-webdriverjs: update authors based on new linting rules --- types/axe-webdriverjs/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/axe-webdriverjs/index.d.ts b/types/axe-webdriverjs/index.d.ts index 7d5d013afb..3b6aab18ce 100644 --- a/types/axe-webdriverjs/index.d.ts +++ b/types/axe-webdriverjs/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for axe-webdriverjs 2.1 // Project: https://github.com/dequelabs/axe-webdriverjs#readme -// Definitions by: My Self +// Definitions by: Joshua Goldberg +// Tyler Krupicka // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 From 342e36c3356724014a9ec55c7c67426998e3a87f Mon Sep 17 00:00:00 2001 From: Flexmonster Pivot Table Date: Tue, 12 Mar 2019 18:48:45 +0200 Subject: [PATCH 031/469] update package to version 2.7 the package was updated to version 2.7 --- types/flexmonster/index.d.ts | 2 +- types/flexmonster/v2.6/flexmonster-tests.ts | 7 + types/flexmonster/v2.6/index.d.ts | 513 ++++++++++++++++++++ types/flexmonster/v2.6/tsconfig.json | 31 ++ types/flexmonster/v2.6/tslint.json | 3 + 5 files changed, 555 insertions(+), 1 deletion(-) create mode 100644 types/flexmonster/v2.6/flexmonster-tests.ts create mode 100644 types/flexmonster/v2.6/index.d.ts create mode 100644 types/flexmonster/v2.6/tsconfig.json create mode 100644 types/flexmonster/v2.6/tslint.json diff --git a/types/flexmonster/index.d.ts b/types/flexmonster/index.d.ts index 6d92a20ddc..eeb8ed56d7 100644 --- a/types/flexmonster/index.d.ts +++ b/types/flexmonster/index.d.ts @@ -2,7 +2,7 @@ // Project: https://flexmonster.com/ // Definitions by: Flexmonster // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.8 +// TypeScript Version: 2.9 export as namespace Flexmonster; diff --git a/types/flexmonster/v2.6/flexmonster-tests.ts b/types/flexmonster/v2.6/flexmonster-tests.ts new file mode 100644 index 0000000000..fb9840c6cb --- /dev/null +++ b/types/flexmonster/v2.6/flexmonster-tests.ts @@ -0,0 +1,7 @@ +import Flexmonster = require('flexmonster'); + +new Flexmonster({ + container: 'pivot-container', + height: '550px', + width: '100%' +}); diff --git a/types/flexmonster/v2.6/index.d.ts b/types/flexmonster/v2.6/index.d.ts new file mode 100644 index 0000000000..fad76ca64d --- /dev/null +++ b/types/flexmonster/v2.6/index.d.ts @@ -0,0 +1,513 @@ +// Type definitions for flexmonster 2.6 +// Project: https://flexmonster.com/ +// Definitions by: Flexmonster +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +export as namespace Flexmonster; + +declare const Flexmonster: FlexmonsterConstructor; +export = Flexmonster; + +interface FlexmonsterConstructor { + new (params: Flexmonster.Params): Flexmonster.Pivot; + (params: Flexmonster.Params): Flexmonster.Pivot; +} + +declare namespace Flexmonster { + interface Params { + // params + toolbar?: boolean; + licenseKey?: string; + width?: string | number; + height?: string | number; + componentFolder?: string; + report?: Report | string; + global?: Report; + customizeCell?: (cell: CellBuilder, data: CellData) => void; + customizeContextMenu?: (items: ContextMenuItem[], data: CellData | ChartData, viewType: string) => ContextMenuItem[]; + // events + afterchartdraw?: () => void; + aftergriddraw?: (param: object) => void; + beforegriddraw?: (param: object) => void; + beforetoolbarcreated?: (toolbar: Toolbar) => void; + cellclick?: (cell: CellData) => void; + celldoubleclick?: (cell: CellData) => void; + datachanged?: (param: object) => void; + dataerror?: (param: object) => void; + datafilecancelled?: () => void; + dataloaded?: () => void; + exportcomplete?: () => void; + exportstart?: () => void; + fieldslistclose?: () => void; + fieldslistopen?: () => void; + filterclose?: () => void; + filteropen?: () => void; + loadingdata?: () => void; + loadinglocalization?: () => void; + loadingolapstructure?: () => void; + loadingreportfile?: () => void; + localizationerror?: () => void; + localizationloaded?: () => void; + olapstructureerror?: () => void; + olapstructureloaded?: () => void; + openingreportfile?: () => void; + printcomplete?: () => void; + printstart?: () => void; + querycomplete?: () => void; + queryerror?: () => void; + ready?: () => void; + reportchange?: () => void; + reportcomplete?: () => void; + reportfilecancelled?: () => void; + reportfileerror?: () => void; + runningquery?: () => void; + update?: () => void; + // other + container?: string; + } + + interface Pivot { + addCalculatedMeasure(measure: Measure): void; + addCondition(condition: ConditionalFormat): void; + addJSON(json: object[]): void; + alert(options: { title?: string; message?: string; type?: string; buttons?: Array<{ label: string; handler?: () => void; }>; blocking?: boolean; }): void; + clear(): void; + clearFilter(hierarchyName: string): void; + clearXMLACache(proxyUrl: string, databaseId: string, callbackHandler: ((reponse: object) => void) | string, cubeId: string, measuresGroupId: string, + username?: string, password?: string): void; + closeFieldsList(): void; + collapseAllData(): void; + collapseData(hierarchyName: string): void; + connectTo(object: DataSource): void; + customizeCell(customizeCellFunction: (cell: CellBuilder, data: CellData) => void): void; + customizeContextMenu(customizeFunction: (items: ContextMenuItem[], data: CellData | ChartData, viewType: string) => ContextMenuItem[]): void; + dispose(): void; + expandAllData(withAllChildren?: boolean): void; + expandData(hierarchyName: string): void; + exportTo(type: string, exportOptions?: ExportOptions, callbackHandler?: ((result: object) => void) | string): void; + getAllConditions(): ConditionalFormat[]; + getAllHierarchies(): Hierarchy[]; + getAllMeasures(): Measure[]; + getCell(rowIdx: number, colIdx: number): CellData; + getColumns(): Hierarchy[]; + getCondition(id: string): ConditionalFormat; + getData(options: { slice?: Slice }, callbackHandler: ((rawData: any) => void) | string, updateHandler?: ((rawData: any) => void) | string): void; + getFilter(hierarchyName: string): FilterItem[]; + getFilterProperties(hierarchyName: string): FilterProperties; + getFormat(measureName: string): Format; + getMeasures(): Measure[]; + getMembers(hierarchyName: string, memberName: string, callbackHandler: ((members: Member[]) => void) | string): Member[]; + getOptions(): Options; + getReport(format?: string): Report | string; + getReportFilters(): Hierarchy[]; + getRows(): Hierarchy[]; + getSelectedCell(): CellData | CellData[]; + getSort(hierarchyName: string): string; + getXMLACatalogs(proxyURL: string, dataSource: string, callbackHandler: ((response: any) => void) | string, username?: string, password?: string): void; + getXMLACubes(proxyURL: string, dataSource: string, catalog: string, callbackHandler: ((response: any) => void) | string, username?: string, password?: string): void; + getXMLADataSources(proxyURL: string, callbackHandler: ((response: any) => void) | string, username?: string, password?: string): void; + getXMLAProviderName(proxyURL: string, callbackHandler: ((response: any) => void) | string, username?: string, password?: string): string; + load(url: string, componentFolder?: string): void; + off(eventType: string, handler?: ((...args: any[]) => any) | string): void; + on(eventType: string, handler: ((...args: any[]) => any) | string): void; + open(): void; + openFieldsList(): void; + openFilter(hierarchyName: string): void; + print(options?: PrintOptions): void; + refresh(): void; + removeAllCalculatedMeasures(): void; + removeAllConditions(): void; + removeCalculatedMeasure(uniqueName: string): void; + removeCondition(id: string): void; + removeSelection(): void; + runQuery(slice: Slice): void; + save(filename: string, destination: string, callbackHandler?: (() => void) | string, url?: string, embedData?: boolean): string; + setBottomX(hierarchyName: string, num: number, measure: MeasureObject): void; + setFilter(hierarchyName: string, items: string[], negation?: boolean): void; + setFormat(format: Format, measureName: string): void; + setOptions(options: Options): void; + setReport(report: Report): void; + setSort(hierarchyName: string, sortName: string, customSorting?: string[]): void; + setTopX(hierarchyName: string, num: number, measure: MeasureObject): void; + showCharts(type?: string, multiple?: boolean): void; + showGrid(): void; + showGridAndCharts(type?: string, position?: string, multiple?: boolean): void; + sortingMethod(hierarchyName: string, compareFunction: (a: string, b: string) => boolean): void; + sortValues(axisName: string, type: string, tuple: number[], measure: MeasureObject): void; + toolbar: Toolbar; + updateData(object: DataSource | object[]): void; + version: string; + fusioncharts?: { + getData(options: { type: string; slice?: Slice; prepareDataFunction?: (rawData: any) => any }, callbackHandler: ((rawData: any) => void) | string, + updateHandler?: ((rawData: any) => void) | string): void; + getNumberFormat(format: object): object; + }; + googlecharts?: { + getData(options: { type?: string; slice?: Slice; prepareDataFunction?: (rawData: any) => any }, callbackHandler: ((rawData: any) => void) | string, + updateHandler?: ((rawData: any) => void) | string): void; + getNumberFormat(format: object): object; + getNumberFormatPattern(format: object): string; + }; + highcharts?: { + getData(options: { type?: string; slice?: Slice; xAxisType?: string; valuesOnly?: boolean, withDrilldown?: boolean, prepareDataFunction?: (rawData: any) => any }, + callbackHandler: ((rawData: any) => void) | string, updateHandler?: ((rawData: any) => void) | string): void; + getAxisFormat(format: object): string; + getPointXFormat(format: object): string; + getPointYFormat(format: object): string; + getPointZFormat(format: object): string; + }; + } + + interface Report { + dataSource?: DataSource; + slice?: Slice; + options?: Options; + conditions?: ConditionalFormat[]; + formats?: Format[]; + tableSizes?: { + columns?: ColumnSize[]; + rows?: RowSize[]; + }; + localization?: object | string; + } + + interface DataSource { + browseForFile?: boolean; + catalog?: string; + cube?: string; + data?: object[]; + dataSourceInfo?: string; + dataSourceType?: string; + fieldSeparator?: string; + thousandSeparator?: string; + filename?: string; + ignoreQuotedLineBreaks?: boolean; + proxyUrl?: string; + recordsetDelimiter?: string; + binary?: boolean; + roles?: string; + localeIdentifier?: string; + effectiveUserName?: string; + customData?: string; + hash?: string; + username?: string; + password?: string; + requestHeader?: object; + subquery?: string; + } + + interface Slice { + columns?: Hierarchy[]; + measures?: Measure[]; + reportFilters?: Hierarchy[]; + rows?: Hierarchy[]; + drills?: { + drillAll?: boolean; + columns?: Array<{ tuple: string[]; measure?: MeasureObject; }>; + rows?: Array<{ tuple: string[]; measure?: MeasureObject; }>; + }; + expands?: { + expandAll?: boolean; + columns?: Array<{ tuple: string[]; measure?: MeasureObject; }>; + rows?: Array<{ tuple: string[]; measure?: MeasureObject; }>; + }; + sorting?: { + column?: Array<{ type: string; tuple: string[]; measure: MeasureObject; }>; + row?: Array<{ type: string; tuple: string[]; measure: MeasureObject; }>; + }; + drillThrough?: string[]; + } + + interface Options { + chart?: { + activeMeasure?: MeasureObject; + activeTupleIndex?: number; + autoRange?: boolean; + labelsHierarchy?: string; + multipleMeasures?: boolean; + oneLevel?: boolean; + showFilter?: boolean; + showLegend?: boolean; + showLegendButton?: boolean; + showMeasures?: boolean; + showWarning?: boolean; + title?: string; + type?: string; + showDataLabels?: boolean; + reversedAxes?: boolean; + showAllLabels?: boolean; + showOneMeasureSelection?: boolean; + position?: string; + pieDataIndex?: string; + }; + grid?: { + showFilter?: boolean; + showGrandTotals?: string; + showHeaders?: boolean; + showHierarchies?: boolean; + showHierarchyCaptions?: boolean; + showReportFiltersArea?: boolean; + showTotals?: boolean; + title?: string; + type?: string; + showAutoCalculationBar?: boolean; + dragging?: boolean; + grandTotalsPosition?: string; + drillThroughMaxRows?: number; + }; + configuratorActive?: boolean; + configuratorButton?: boolean; + dateTimezoneOffset?: number; + datePattern?: string; + dateTimePattern?: string; + defaultHierarchySortName?: string; + drillThrough?: boolean; + editing?: boolean; + selectEmptyCells?: boolean; + showAggregations?: boolean; + showCalculatedValuesButton?: boolean; + showDefaultSlice?: boolean; + showMemberProperties?: boolean; + sorting?: string; + viewType?: string; + showAggregationLabels?: boolean; + useOlapFormatting?: boolean; + defaultDateType?: string; + timePattern?: string; + showOutdatedDataAlert?: boolean; + showEmptyData?: boolean; + saveAllFormats?: boolean; + showDrillThroughConfigurator?: boolean; + grouping?: boolean; + showAllFieldsDrillThrough?: boolean; + } + + interface PrintOptions { + header?: string; + footer?: string; + } + + interface Member { + caption?: string; + uniqueName?: string; + hierarchyName?: string; + children?: Member[]; + isLeaf?: boolean; + parentMember?: string; + } + + interface FilterProperties { + type: string; + members?: FilterItem[]; + quantity?: number; + measure?: MeasureObject; + } + + interface FilterItem { + caption?: string; + uniqueName?: string; + hierarchyName?: string; + } + + interface CellData { + columnIndex?: number; + columns?: object[]; + escapedLabel?: string; + height?: number; + hierarchy?: Hierarchy; + isClassicTotalRow?: boolean; + isDrillThrough?: boolean; + isGrandTotal?: boolean; + isGrandTotalColumn?: boolean; + isGrandTotalRow?: boolean; + isTotal?: boolean; + isTotalColumn?: boolean; + isTotalRow?: boolean; + member?: Member; + width?: number; + x?: number; + y?: number; + label?: string; + measure?: MeasureObject; + rowIndex?: number; + rows?: object[]; + type?: string; + value?: number; + } + + interface ExportOptions { + filename?: string; + destinationType?: string; + excelSheetName?: string; + footer?: string; + header?: string; + pageOrientation?: string; + showFilters?: boolean; + url?: string; + useOlapFormattingInExcel?: boolean; + useCustomizeCellForData?: boolean; + excelExportAll?: boolean; + requestHeader?: object; + } + + interface Hierarchy { + caption?: string; + dimensionName?: string; + filter?: { + members?: string[]; + negation?: boolean; + measure?: MeasureObject; + quantity?: number; + type?: string; + }; + sortName?: string; + sortOrder?: string[]; + uniqueName?: string; + } + + interface Measure { + uniqueName?: string; + active?: boolean; + aggregation?: string; + availableAggregations?: string[]; + caption?: string; + formula?: string; + format?: string; + grandTotalCaption?: string; + } + + interface MeasureObject { + uniqueName: string; + aggregation?: string; + } + + interface ConditionalFormat { + formula?: string; + format?: Style; + formatCSS?: string; + row?: number; + column?: number; + measureName?: string; + hierarchy?: string; + member?: string; + isTotal?: number; + } + + interface Style { + color?: string; + backgroundColor?: string; + backgroundImage?: string; + borderColor?: string; + fontSize?: string; + fontWeight?: string; + fill?: string; + textAlign?: string; + fontFamily?: string; + width?: number; + maxWidth?: number; + height?: number; + maxHeight?: number; + } + + interface Format { + name?: string; + thousandsSeparator?: string; + decimalSeparator?: string; + decimalPlaces?: number; + maxDecimalPlaces?: number; + maxSymbols?: number; + currencySymbol?: string; + currencySymbolAlign?: string; + nullValue?: string; + infinityValue?: string; + divideByZeroValue?: string; + textAlign?: string; + isPercent?: boolean; + beautifyFloatingPoint?: boolean; + } + + interface ColumnSize { + width?: number; + idx?: number; + tuple?: string[]; + measure?: MeasureObject; + } + + interface RowSize { + height?: number; + idx?: number; + tuple?: string[]; + measure?: MeasureObject; + } + + interface CellBuilder { + attr?: object; + classes?: string[]; + style?: object; + tag?: string; + text?: string; + addClass(value?: string): void; + toHtml(): string; + } + + interface ContextMenuItem { + label?: string; + handler?: (() => void) | string; + submenu?: ContextMenuItem[]; + isSelected?: boolean; + } + + interface ChartData { + columnTuple?: number[]; + id?: string; + label?: string; + measure?: MeasureObject; + rawTuple?: number[]; + value?: number; + } + + interface Toolbar { + getTabs: () => ToolbarTab[]; + // Connect tab + connectLocalCSVHandler: () => void; + connectLocalJSONHandler: () => void; + connectRemoteCSV: () => void; + connectRemoteJSON: () => void; + connectOLAP: () => void; + // Open tab + openLocalReport: () => void; + openRemoteReport: () => void; + // Save tab + saveHandler: () => void; + // Export tab + printHandler: () => void; + exportHandler: (type: string) => void; + // Grid tab + gridHandler: () => void; + // Charts tab + chartsHandler: (type: string) => void; + chartsMultipleHandler: () => void; + // Format tab + formatCellsHandler: () => void; + conditionalFormattingHandler: () => void; + // Options tab + optionsHandler: () => void; + // Fields tab + fieldsHandler: () => void; + // Fullscreen tab + fullscreenHandler: () => void; + } + + interface ToolbarTab { + android: boolean; + args: any; + handler: (() => void) | string; + icon: string; + id: string; + ios: boolean; + mobile: boolean; + menu: ToolbarTab[]; + title: string; + } +} diff --git a/types/flexmonster/v2.6/tsconfig.json b/types/flexmonster/v2.6/tsconfig.json new file mode 100644 index 0000000000..fd6a531526 --- /dev/null +++ b/types/flexmonster/v2.6/tsconfig.json @@ -0,0 +1,31 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "paths": { + "flexmonster": [ + "flexmonster/v2.6" + ], + "flexmonster/*": [ + "flexmonster/v2.6/*" + ] + }, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "flexmonster-tests.ts" + ] +} \ No newline at end of file diff --git a/types/flexmonster/v2.6/tslint.json b/types/flexmonster/v2.6/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/flexmonster/v2.6/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} From 566da0ba32abccebc591d2d3d074c7c49f8101da Mon Sep 17 00:00:00 2001 From: Flexmonster Pivot Table Date: Tue, 12 Mar 2019 19:17:42 +0200 Subject: [PATCH 032/469] 2.7 version tests update --- types/flexmonster/flexmonster-tests.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/types/flexmonster/flexmonster-tests.ts b/types/flexmonster/flexmonster-tests.ts index fb9840c6cb..2deb24ccfc 100644 --- a/types/flexmonster/flexmonster-tests.ts +++ b/types/flexmonster/flexmonster-tests.ts @@ -1,7 +1,11 @@ import Flexmonster = require('flexmonster'); new Flexmonster({ + componentFolder: '', container: 'pivot-container', + global: {}, height: '550px', - width: '100%' + width: '100%', + report: {}, + toolbar: true }); From de0525fe631bd57394c2ccc1d52afccf9d78f794 Mon Sep 17 00:00:00 2001 From: Flexmonster Pivot Table Date: Tue, 12 Mar 2019 19:32:54 +0200 Subject: [PATCH 033/469] 2.6 tsconfig update --- types/flexmonster/v2.6/tsconfig.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/types/flexmonster/v2.6/tsconfig.json b/types/flexmonster/v2.6/tsconfig.json index fd6a531526..700754b991 100644 --- a/types/flexmonster/v2.6/tsconfig.json +++ b/types/flexmonster/v2.6/tsconfig.json @@ -15,9 +15,6 @@ "paths": { "flexmonster": [ "flexmonster/v2.6" - ], - "flexmonster/*": [ - "flexmonster/v2.6/*" ] }, "types": [], From 041c529d61858d3d955449ee472c512301c999f6 Mon Sep 17 00:00:00 2001 From: Flexmonster Pivot Table Date: Tue, 12 Mar 2019 19:42:33 +0200 Subject: [PATCH 034/469] package update --- types/flexmonster/v2.6/flexmonster-tests.ts | 7 - types/flexmonster/v2.6/index.d.ts | 513 -------------------- types/flexmonster/v2.6/tsconfig.json | 28 -- types/flexmonster/v2.6/tslint.json | 3 - 4 files changed, 551 deletions(-) delete mode 100644 types/flexmonster/v2.6/flexmonster-tests.ts delete mode 100644 types/flexmonster/v2.6/index.d.ts delete mode 100644 types/flexmonster/v2.6/tsconfig.json delete mode 100644 types/flexmonster/v2.6/tslint.json diff --git a/types/flexmonster/v2.6/flexmonster-tests.ts b/types/flexmonster/v2.6/flexmonster-tests.ts deleted file mode 100644 index fb9840c6cb..0000000000 --- a/types/flexmonster/v2.6/flexmonster-tests.ts +++ /dev/null @@ -1,7 +0,0 @@ -import Flexmonster = require('flexmonster'); - -new Flexmonster({ - container: 'pivot-container', - height: '550px', - width: '100%' -}); diff --git a/types/flexmonster/v2.6/index.d.ts b/types/flexmonster/v2.6/index.d.ts deleted file mode 100644 index fad76ca64d..0000000000 --- a/types/flexmonster/v2.6/index.d.ts +++ /dev/null @@ -1,513 +0,0 @@ -// Type definitions for flexmonster 2.6 -// Project: https://flexmonster.com/ -// Definitions by: Flexmonster -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.8 - -export as namespace Flexmonster; - -declare const Flexmonster: FlexmonsterConstructor; -export = Flexmonster; - -interface FlexmonsterConstructor { - new (params: Flexmonster.Params): Flexmonster.Pivot; - (params: Flexmonster.Params): Flexmonster.Pivot; -} - -declare namespace Flexmonster { - interface Params { - // params - toolbar?: boolean; - licenseKey?: string; - width?: string | number; - height?: string | number; - componentFolder?: string; - report?: Report | string; - global?: Report; - customizeCell?: (cell: CellBuilder, data: CellData) => void; - customizeContextMenu?: (items: ContextMenuItem[], data: CellData | ChartData, viewType: string) => ContextMenuItem[]; - // events - afterchartdraw?: () => void; - aftergriddraw?: (param: object) => void; - beforegriddraw?: (param: object) => void; - beforetoolbarcreated?: (toolbar: Toolbar) => void; - cellclick?: (cell: CellData) => void; - celldoubleclick?: (cell: CellData) => void; - datachanged?: (param: object) => void; - dataerror?: (param: object) => void; - datafilecancelled?: () => void; - dataloaded?: () => void; - exportcomplete?: () => void; - exportstart?: () => void; - fieldslistclose?: () => void; - fieldslistopen?: () => void; - filterclose?: () => void; - filteropen?: () => void; - loadingdata?: () => void; - loadinglocalization?: () => void; - loadingolapstructure?: () => void; - loadingreportfile?: () => void; - localizationerror?: () => void; - localizationloaded?: () => void; - olapstructureerror?: () => void; - olapstructureloaded?: () => void; - openingreportfile?: () => void; - printcomplete?: () => void; - printstart?: () => void; - querycomplete?: () => void; - queryerror?: () => void; - ready?: () => void; - reportchange?: () => void; - reportcomplete?: () => void; - reportfilecancelled?: () => void; - reportfileerror?: () => void; - runningquery?: () => void; - update?: () => void; - // other - container?: string; - } - - interface Pivot { - addCalculatedMeasure(measure: Measure): void; - addCondition(condition: ConditionalFormat): void; - addJSON(json: object[]): void; - alert(options: { title?: string; message?: string; type?: string; buttons?: Array<{ label: string; handler?: () => void; }>; blocking?: boolean; }): void; - clear(): void; - clearFilter(hierarchyName: string): void; - clearXMLACache(proxyUrl: string, databaseId: string, callbackHandler: ((reponse: object) => void) | string, cubeId: string, measuresGroupId: string, - username?: string, password?: string): void; - closeFieldsList(): void; - collapseAllData(): void; - collapseData(hierarchyName: string): void; - connectTo(object: DataSource): void; - customizeCell(customizeCellFunction: (cell: CellBuilder, data: CellData) => void): void; - customizeContextMenu(customizeFunction: (items: ContextMenuItem[], data: CellData | ChartData, viewType: string) => ContextMenuItem[]): void; - dispose(): void; - expandAllData(withAllChildren?: boolean): void; - expandData(hierarchyName: string): void; - exportTo(type: string, exportOptions?: ExportOptions, callbackHandler?: ((result: object) => void) | string): void; - getAllConditions(): ConditionalFormat[]; - getAllHierarchies(): Hierarchy[]; - getAllMeasures(): Measure[]; - getCell(rowIdx: number, colIdx: number): CellData; - getColumns(): Hierarchy[]; - getCondition(id: string): ConditionalFormat; - getData(options: { slice?: Slice }, callbackHandler: ((rawData: any) => void) | string, updateHandler?: ((rawData: any) => void) | string): void; - getFilter(hierarchyName: string): FilterItem[]; - getFilterProperties(hierarchyName: string): FilterProperties; - getFormat(measureName: string): Format; - getMeasures(): Measure[]; - getMembers(hierarchyName: string, memberName: string, callbackHandler: ((members: Member[]) => void) | string): Member[]; - getOptions(): Options; - getReport(format?: string): Report | string; - getReportFilters(): Hierarchy[]; - getRows(): Hierarchy[]; - getSelectedCell(): CellData | CellData[]; - getSort(hierarchyName: string): string; - getXMLACatalogs(proxyURL: string, dataSource: string, callbackHandler: ((response: any) => void) | string, username?: string, password?: string): void; - getXMLACubes(proxyURL: string, dataSource: string, catalog: string, callbackHandler: ((response: any) => void) | string, username?: string, password?: string): void; - getXMLADataSources(proxyURL: string, callbackHandler: ((response: any) => void) | string, username?: string, password?: string): void; - getXMLAProviderName(proxyURL: string, callbackHandler: ((response: any) => void) | string, username?: string, password?: string): string; - load(url: string, componentFolder?: string): void; - off(eventType: string, handler?: ((...args: any[]) => any) | string): void; - on(eventType: string, handler: ((...args: any[]) => any) | string): void; - open(): void; - openFieldsList(): void; - openFilter(hierarchyName: string): void; - print(options?: PrintOptions): void; - refresh(): void; - removeAllCalculatedMeasures(): void; - removeAllConditions(): void; - removeCalculatedMeasure(uniqueName: string): void; - removeCondition(id: string): void; - removeSelection(): void; - runQuery(slice: Slice): void; - save(filename: string, destination: string, callbackHandler?: (() => void) | string, url?: string, embedData?: boolean): string; - setBottomX(hierarchyName: string, num: number, measure: MeasureObject): void; - setFilter(hierarchyName: string, items: string[], negation?: boolean): void; - setFormat(format: Format, measureName: string): void; - setOptions(options: Options): void; - setReport(report: Report): void; - setSort(hierarchyName: string, sortName: string, customSorting?: string[]): void; - setTopX(hierarchyName: string, num: number, measure: MeasureObject): void; - showCharts(type?: string, multiple?: boolean): void; - showGrid(): void; - showGridAndCharts(type?: string, position?: string, multiple?: boolean): void; - sortingMethod(hierarchyName: string, compareFunction: (a: string, b: string) => boolean): void; - sortValues(axisName: string, type: string, tuple: number[], measure: MeasureObject): void; - toolbar: Toolbar; - updateData(object: DataSource | object[]): void; - version: string; - fusioncharts?: { - getData(options: { type: string; slice?: Slice; prepareDataFunction?: (rawData: any) => any }, callbackHandler: ((rawData: any) => void) | string, - updateHandler?: ((rawData: any) => void) | string): void; - getNumberFormat(format: object): object; - }; - googlecharts?: { - getData(options: { type?: string; slice?: Slice; prepareDataFunction?: (rawData: any) => any }, callbackHandler: ((rawData: any) => void) | string, - updateHandler?: ((rawData: any) => void) | string): void; - getNumberFormat(format: object): object; - getNumberFormatPattern(format: object): string; - }; - highcharts?: { - getData(options: { type?: string; slice?: Slice; xAxisType?: string; valuesOnly?: boolean, withDrilldown?: boolean, prepareDataFunction?: (rawData: any) => any }, - callbackHandler: ((rawData: any) => void) | string, updateHandler?: ((rawData: any) => void) | string): void; - getAxisFormat(format: object): string; - getPointXFormat(format: object): string; - getPointYFormat(format: object): string; - getPointZFormat(format: object): string; - }; - } - - interface Report { - dataSource?: DataSource; - slice?: Slice; - options?: Options; - conditions?: ConditionalFormat[]; - formats?: Format[]; - tableSizes?: { - columns?: ColumnSize[]; - rows?: RowSize[]; - }; - localization?: object | string; - } - - interface DataSource { - browseForFile?: boolean; - catalog?: string; - cube?: string; - data?: object[]; - dataSourceInfo?: string; - dataSourceType?: string; - fieldSeparator?: string; - thousandSeparator?: string; - filename?: string; - ignoreQuotedLineBreaks?: boolean; - proxyUrl?: string; - recordsetDelimiter?: string; - binary?: boolean; - roles?: string; - localeIdentifier?: string; - effectiveUserName?: string; - customData?: string; - hash?: string; - username?: string; - password?: string; - requestHeader?: object; - subquery?: string; - } - - interface Slice { - columns?: Hierarchy[]; - measures?: Measure[]; - reportFilters?: Hierarchy[]; - rows?: Hierarchy[]; - drills?: { - drillAll?: boolean; - columns?: Array<{ tuple: string[]; measure?: MeasureObject; }>; - rows?: Array<{ tuple: string[]; measure?: MeasureObject; }>; - }; - expands?: { - expandAll?: boolean; - columns?: Array<{ tuple: string[]; measure?: MeasureObject; }>; - rows?: Array<{ tuple: string[]; measure?: MeasureObject; }>; - }; - sorting?: { - column?: Array<{ type: string; tuple: string[]; measure: MeasureObject; }>; - row?: Array<{ type: string; tuple: string[]; measure: MeasureObject; }>; - }; - drillThrough?: string[]; - } - - interface Options { - chart?: { - activeMeasure?: MeasureObject; - activeTupleIndex?: number; - autoRange?: boolean; - labelsHierarchy?: string; - multipleMeasures?: boolean; - oneLevel?: boolean; - showFilter?: boolean; - showLegend?: boolean; - showLegendButton?: boolean; - showMeasures?: boolean; - showWarning?: boolean; - title?: string; - type?: string; - showDataLabels?: boolean; - reversedAxes?: boolean; - showAllLabels?: boolean; - showOneMeasureSelection?: boolean; - position?: string; - pieDataIndex?: string; - }; - grid?: { - showFilter?: boolean; - showGrandTotals?: string; - showHeaders?: boolean; - showHierarchies?: boolean; - showHierarchyCaptions?: boolean; - showReportFiltersArea?: boolean; - showTotals?: boolean; - title?: string; - type?: string; - showAutoCalculationBar?: boolean; - dragging?: boolean; - grandTotalsPosition?: string; - drillThroughMaxRows?: number; - }; - configuratorActive?: boolean; - configuratorButton?: boolean; - dateTimezoneOffset?: number; - datePattern?: string; - dateTimePattern?: string; - defaultHierarchySortName?: string; - drillThrough?: boolean; - editing?: boolean; - selectEmptyCells?: boolean; - showAggregations?: boolean; - showCalculatedValuesButton?: boolean; - showDefaultSlice?: boolean; - showMemberProperties?: boolean; - sorting?: string; - viewType?: string; - showAggregationLabels?: boolean; - useOlapFormatting?: boolean; - defaultDateType?: string; - timePattern?: string; - showOutdatedDataAlert?: boolean; - showEmptyData?: boolean; - saveAllFormats?: boolean; - showDrillThroughConfigurator?: boolean; - grouping?: boolean; - showAllFieldsDrillThrough?: boolean; - } - - interface PrintOptions { - header?: string; - footer?: string; - } - - interface Member { - caption?: string; - uniqueName?: string; - hierarchyName?: string; - children?: Member[]; - isLeaf?: boolean; - parentMember?: string; - } - - interface FilterProperties { - type: string; - members?: FilterItem[]; - quantity?: number; - measure?: MeasureObject; - } - - interface FilterItem { - caption?: string; - uniqueName?: string; - hierarchyName?: string; - } - - interface CellData { - columnIndex?: number; - columns?: object[]; - escapedLabel?: string; - height?: number; - hierarchy?: Hierarchy; - isClassicTotalRow?: boolean; - isDrillThrough?: boolean; - isGrandTotal?: boolean; - isGrandTotalColumn?: boolean; - isGrandTotalRow?: boolean; - isTotal?: boolean; - isTotalColumn?: boolean; - isTotalRow?: boolean; - member?: Member; - width?: number; - x?: number; - y?: number; - label?: string; - measure?: MeasureObject; - rowIndex?: number; - rows?: object[]; - type?: string; - value?: number; - } - - interface ExportOptions { - filename?: string; - destinationType?: string; - excelSheetName?: string; - footer?: string; - header?: string; - pageOrientation?: string; - showFilters?: boolean; - url?: string; - useOlapFormattingInExcel?: boolean; - useCustomizeCellForData?: boolean; - excelExportAll?: boolean; - requestHeader?: object; - } - - interface Hierarchy { - caption?: string; - dimensionName?: string; - filter?: { - members?: string[]; - negation?: boolean; - measure?: MeasureObject; - quantity?: number; - type?: string; - }; - sortName?: string; - sortOrder?: string[]; - uniqueName?: string; - } - - interface Measure { - uniqueName?: string; - active?: boolean; - aggregation?: string; - availableAggregations?: string[]; - caption?: string; - formula?: string; - format?: string; - grandTotalCaption?: string; - } - - interface MeasureObject { - uniqueName: string; - aggregation?: string; - } - - interface ConditionalFormat { - formula?: string; - format?: Style; - formatCSS?: string; - row?: number; - column?: number; - measureName?: string; - hierarchy?: string; - member?: string; - isTotal?: number; - } - - interface Style { - color?: string; - backgroundColor?: string; - backgroundImage?: string; - borderColor?: string; - fontSize?: string; - fontWeight?: string; - fill?: string; - textAlign?: string; - fontFamily?: string; - width?: number; - maxWidth?: number; - height?: number; - maxHeight?: number; - } - - interface Format { - name?: string; - thousandsSeparator?: string; - decimalSeparator?: string; - decimalPlaces?: number; - maxDecimalPlaces?: number; - maxSymbols?: number; - currencySymbol?: string; - currencySymbolAlign?: string; - nullValue?: string; - infinityValue?: string; - divideByZeroValue?: string; - textAlign?: string; - isPercent?: boolean; - beautifyFloatingPoint?: boolean; - } - - interface ColumnSize { - width?: number; - idx?: number; - tuple?: string[]; - measure?: MeasureObject; - } - - interface RowSize { - height?: number; - idx?: number; - tuple?: string[]; - measure?: MeasureObject; - } - - interface CellBuilder { - attr?: object; - classes?: string[]; - style?: object; - tag?: string; - text?: string; - addClass(value?: string): void; - toHtml(): string; - } - - interface ContextMenuItem { - label?: string; - handler?: (() => void) | string; - submenu?: ContextMenuItem[]; - isSelected?: boolean; - } - - interface ChartData { - columnTuple?: number[]; - id?: string; - label?: string; - measure?: MeasureObject; - rawTuple?: number[]; - value?: number; - } - - interface Toolbar { - getTabs: () => ToolbarTab[]; - // Connect tab - connectLocalCSVHandler: () => void; - connectLocalJSONHandler: () => void; - connectRemoteCSV: () => void; - connectRemoteJSON: () => void; - connectOLAP: () => void; - // Open tab - openLocalReport: () => void; - openRemoteReport: () => void; - // Save tab - saveHandler: () => void; - // Export tab - printHandler: () => void; - exportHandler: (type: string) => void; - // Grid tab - gridHandler: () => void; - // Charts tab - chartsHandler: (type: string) => void; - chartsMultipleHandler: () => void; - // Format tab - formatCellsHandler: () => void; - conditionalFormattingHandler: () => void; - // Options tab - optionsHandler: () => void; - // Fields tab - fieldsHandler: () => void; - // Fullscreen tab - fullscreenHandler: () => void; - } - - interface ToolbarTab { - android: boolean; - args: any; - handler: (() => void) | string; - icon: string; - id: string; - ios: boolean; - mobile: boolean; - menu: ToolbarTab[]; - title: string; - } -} diff --git a/types/flexmonster/v2.6/tsconfig.json b/types/flexmonster/v2.6/tsconfig.json deleted file mode 100644 index 700754b991..0000000000 --- a/types/flexmonster/v2.6/tsconfig.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../../", - "typeRoots": [ - "../../" - ], - "paths": { - "flexmonster": [ - "flexmonster/v2.6" - ] - }, - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "flexmonster-tests.ts" - ] -} \ No newline at end of file diff --git a/types/flexmonster/v2.6/tslint.json b/types/flexmonster/v2.6/tslint.json deleted file mode 100644 index f93cf8562a..0000000000 --- a/types/flexmonster/v2.6/tslint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "dtslint/dt.json" -} From bf27bf7455ea59a5ea89a37d366a540edbfed426 Mon Sep 17 00:00:00 2001 From: Erin Noe-Payne Date: Fri, 15 Mar 2019 15:28:13 -0600 Subject: [PATCH 035/469] Adds support for @rebass/grid/emotion --- types/rebass__grid/emotion.d.ts | 1 + types/rebass__grid/index.d.ts | 1 + types/rebass__grid/rebass__grid-tests.tsx | 9 +++++++++ types/rebass__grid/tsconfig.json | 4 +++- 4 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 types/rebass__grid/emotion.d.ts diff --git a/types/rebass__grid/emotion.d.ts b/types/rebass__grid/emotion.d.ts new file mode 100644 index 0000000000..34c6161062 --- /dev/null +++ b/types/rebass__grid/emotion.d.ts @@ -0,0 +1 @@ +export * from './index' \ No newline at end of file diff --git a/types/rebass__grid/index.d.ts b/types/rebass__grid/index.d.ts index 3f5012851f..918004bfca 100644 --- a/types/rebass__grid/index.d.ts +++ b/types/rebass__grid/index.d.ts @@ -4,6 +4,7 @@ // Victor Orlov // Louis Hache // Adam Lavin +// Erin Noe-Payne // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.9 diff --git a/types/rebass__grid/rebass__grid-tests.tsx b/types/rebass__grid/rebass__grid-tests.tsx index 147f3ff084..562091952b 100644 --- a/types/rebass__grid/rebass__grid-tests.tsx +++ b/types/rebass__grid/rebass__grid-tests.tsx @@ -1,6 +1,7 @@ import * as React from "react"; import { Flex, Box } from "@rebass/grid"; import { css } from "styled-components"; +import * as Emotion from "@rebass/grid/emotion"; const Layout = () => ( @@ -9,3 +10,11 @@ const Layout = () => ( ); const cssTest = ; + +const EmotionLayout = () => ( + + + +); + +const emotionCssTest = ; diff --git a/types/rebass__grid/tsconfig.json b/types/rebass__grid/tsconfig.json index 419413e066..b2c3ecb0e5 100644 --- a/types/rebass__grid/tsconfig.json +++ b/types/rebass__grid/tsconfig.json @@ -14,7 +14,8 @@ "../" ], "paths": { - "@rebass/grid": ["rebass__grid"] + "@rebass/grid": ["rebass__grid"], + "@rebass/grid/emotion": ["rebass__grid/emotion"] }, "types": [], "noEmit": true, @@ -23,6 +24,7 @@ }, "files": [ "index.d.ts", + "emotion.d.ts", "rebass__grid-tests.tsx" ] } \ No newline at end of file From e060dd0398d5aedf8d01330749bbd05366c849e8 Mon Sep 17 00:00:00 2001 From: Eric Hwang Date: Fri, 22 Mar 2019 18:28:50 -0700 Subject: [PATCH 036/469] [sharedb] Update type signatures for Backend #use and #addProjection Backend#use(action, listener) now gets rich type information on listener params, by using the same pattern as addEventListener in TypeScript's built-in DOM type definitions. This also tweaks some method param types on the base sharedb Backend class, to better match the JS. --- types/sharedb/index.d.ts | 128 +++++++++++++++++++++++++++++++-- types/sharedb/lib/sharedb.d.ts | 14 +++- types/sharedb/sharedb-tests.ts | 87 ++++++++++++++++++++++ 3 files changed, 221 insertions(+), 8 deletions(-) diff --git a/types/sharedb/index.d.ts b/types/sharedb/index.d.ts index 0f0f5575fd..7657075f8e 100644 --- a/types/sharedb/index.d.ts +++ b/types/sharedb/index.d.ts @@ -1,7 +1,9 @@ // Type definitions for sharedb 1.0 // Project: https://github.com/share/sharedb // Definitions by: Steve Oney +// Eric Hwang // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// @@ -18,20 +20,33 @@ export = sharedb; declare class sharedb { constructor(options?: {db?: any, pubsub?: sharedb.PubSub, disableDocAction?: boolean, disableSpaceDelimitedActions?: boolean}); - connect: () => sharedb.Connection; - addProjection(name: string, collection: string, fields: {}): any; + connect: (connection?: any, req?: any) => sharedb.Connection; + /** + * Registers a projection that can be used from clients just like a normal collection. + * + * @param name name of the projection + * @param collection name of the backing collection + * @param fields field whitelist for the projection + */ + addProjection(name: string, collection: string, fields: ProjectionFields): void; listen(stream: any): void; - close(callback?: (err: Error) => any): void; - use(action: sharedb.UseAction, fn: sharedb.UseCallback): void; + close(callback?: (err?: Error) => any): void; + /** + * Registers a server middleware function. + * + * @param action name of an action from https://github.com/share/sharedb#middlewares + * @param fn listener invoked when the specified action occurs + */ + use( + action: A, + fn: (context: middleware.ActionContextMap[A], callback: (err?: any) => void) => void, + ): void; static types: { register: (type: { name?: string, uri?: string, [key: string]: any}) => void; }; } declare namespace sharedb { - type UseAction = 'connect' | 'op' | 'doc' | 'query' | 'submit' | 'apply' | 'commit' | 'after submit' | 'receive'; - type UseCallback = ((request: {action: UseAction, agent: any, req: any, collection: string, id: string, query: any, op: ShareDB.RawOp}, callback: () => void) => void); - abstract class DB { projectsSnapshots: boolean; disableSubscribe: boolean; @@ -100,3 +115,102 @@ declare namespace sharedb { type Path = ShareDB.Path; type ShareDBSourceOptions = ShareDB.ShareDBSourceOptions; } + +declare namespace middleware { + interface ActionContextMap { + afterSubmit: SubmitContext; + apply: ApplyContext; + commit: CommitContext; + connect: ConnectContext; + doc: DocContext; // Deprecated, use 'readSnapshots' instead. + op: OpContext; + query: QueryContext; + receive: ReceiveContext; + readSnapshots: ReadSnapshotsContext; + submit: SubmitContext; + } + + interface BaseContext { + action: keyof ActionContextMap; + agent: any; + backend: sharedb; + } + + interface ApplyContext extends BaseContext, SubmitRequest { + } + + interface CommitContext extends BaseContext, SubmitRequest { + } + + interface ConnectContext extends BaseContext { + stream: any; + req: any; // Property always exists, value may be undefined + } + + interface DocContext extends BaseContext { + collection: string; + id: string; + snapshot: ShareDB.Snapshot; + } + + interface OpContext extends BaseContext { + collection: string; + id: string; + op: ShareDB.Op; + } + + interface QueryContext extends BaseContext { + index: string; + collection: string; + projection: Projection | undefined; + fields: ProjectionFields | undefined; + channel: string; + query: any; + options: any; + db: sharedb.DB | null; + snapshotProjection: Projection | null; + } + + interface ReceiveContext extends BaseContext { + data: any; + } + + interface ReadSnapshotsContext extends BaseContext { + collection: string; + snapshots: ShareDB.Snapshot[]; + snapshotType: SnapshotType; + } + + type SnapshotType = 'current' | 'byVersion' | 'byTimestamp'; + + interface SubmitContext extends BaseContext, SubmitRequest { + } +} + +interface Projection { + target: string; + fields: ProjectionFields; +} + +interface ProjectionFields { + [propertyName: string]: true; +} + +interface SubmitRequest { + index: string; + projection: Projection | undefined; + collection: string; + id: string; + op: sharedb.Op; + options: any; + start: number; + + saveMilestoneSnapshot: boolean | null; + suppressPublish: boolean | null; + maxRetries: number | null; + retries: number; + + snapshot: ShareDB.Snapshot | null; + ops: ShareDB.Op[]; + channels: string[] | null; +} diff --git a/types/sharedb/lib/sharedb.d.ts b/types/sharedb/lib/sharedb.d.ts index 426eac5a0e..169b7e6674 100644 --- a/types/sharedb/lib/sharedb.d.ts +++ b/types/sharedb/lib/sharedb.d.ts @@ -1,7 +1,19 @@ import { EventEmitter } from 'events'; export type Path = ReadonlyArray; -export type Snapshot = number; +export interface Snapshot { + id: string; + v: number; + type: string | null; + data: any; // JSON object, could be undefined + m: SnapshotMeta | null; +} + +export interface SnapshotMeta { + ctime: number; + mtime: number; + [key: string]: any; +} export interface AddNumOp { p: Path; na: number; } diff --git a/types/sharedb/sharedb-tests.ts b/types/sharedb/sharedb-tests.ts index 55c3dc797d..a4e35d3507 100644 --- a/types/sharedb/sharedb-tests.ts +++ b/types/sharedb/sharedb-tests.ts @@ -30,7 +30,94 @@ class WebSocketJSONStream extends Duplex { } const backend = new ShareDB(); + +backend.addProjection('notes_minimal', 'notes', {title: true, creator: true, lastUpdateTime: true}); + +// Exercise middleware (backend.use) +type SubmitRelatedActions = 'afterSubmit' | 'apply' | 'commit' | 'submit'; +const submitRelatedActions: SubmitRelatedActions[] = ['afterSubmit', 'apply', 'commit', 'submit']; +for (const action of submitRelatedActions) { + backend.use(action, (request, callback) => { + console.log( + request.action, + request.agent, + request.backend, + request.index, + request.collection, + request.projection, + request.id, + request.op, + request.options, + request.snapshot, + request.ops, + request.channels, + ); + callback(); + }); +} +backend.use('connect', (context, callback) => { + console.log( + context.action, + context.agent, + context.backend, + context.stream, + context.req, + ); + callback(); +}); +backend.use('op', (context, callback) => { + console.log( + context.action, + context.agent, + context.backend, + context.collection, + context.id, + context.op, + ); + callback(); +}); +backend.use('query', (context, callback) => { + console.log( + context.action, + context.agent, + context.backend, + context.index, + context.collection, + context.projection, + context.fields, + context.channel, + context.query, + context.options, + context.snapshotProjection, + ); + callback(); +}); +backend.use('receive', (context, callback) => { + console.log( + context.action, + context.agent, + context.backend, + context.data, + ); + callback(); +}); +backend.use('readSnapshots', (context, callback) => { + console.log( + context.action, + context.agent, + context.backend, + context.collection, + context.snapshots, + context.snapshotType, + ); + callback(); +}); + const connection = backend.connect(); +const netRequest = {}; // Passed through to 'connect' middleware, not used by sharedb itself +const connectionWithReq = backend.connect(null, netRequest); +const reboundConnection = backend.connect(backend.connect(), netRequest); + const doc = connection.get('examples', 'counter'); doc.fetch((err) => { From f6b15715e2b7131bb84105f50d114549d8ff244a Mon Sep 17 00:00:00 2001 From: breeze9527 Date: Sat, 23 Mar 2019 12:28:03 +0800 Subject: [PATCH 037/469] Added type definition for non-npm package amap-js-api-place-search --- .../amap-js-api-place-search-tests.ts | 435 +++++++++++ types/amap-js-api-place-search/index.d.ts | 737 ++++++++++++++++++ types/amap-js-api-place-search/tsconfig.json | 24 + types/amap-js-api-place-search/tslint.json | 3 + 4 files changed, 1199 insertions(+) create mode 100644 types/amap-js-api-place-search/amap-js-api-place-search-tests.ts create mode 100644 types/amap-js-api-place-search/index.d.ts create mode 100644 types/amap-js-api-place-search/tsconfig.json create mode 100644 types/amap-js-api-place-search/tslint.json diff --git a/types/amap-js-api-place-search/amap-js-api-place-search-tests.ts b/types/amap-js-api-place-search/amap-js-api-place-search-tests.ts new file mode 100644 index 0000000000..b4c787c301 --- /dev/null +++ b/types/amap-js-api-place-search/amap-js-api-place-search-tests.ts @@ -0,0 +1,435 @@ +declare const map: AMap.Map; +declare const div: HTMLElement; +declare const lnglat: AMap.LngLat; +declare const lnglatTuple: [number, number]; +declare const bounds: AMap.Bounds; +declare const polygon: AMap.Polygon; +declare const lang: AMap.Lang; + +// $ExpectType PlaceSearch +const placeSearch = new AMap.PlaceSearch(); +// $ExpectType PlaceSearch +new AMap.PlaceSearch({}); +// $ExpectType PlaceSearch +new AMap.PlaceSearch({ + city: '深圳', + citylimit: true, + children: 1, + type: '餐饮服务', + lang: 'zh_cn', + pageSize: 10, + pageIndex: 10, + extensions: 'all', + map, + panel: div, + showCover: true, + renderStyle: 'newpc', + autoFitView: true +}); + +// $ExpectType void +placeSearch.search('keyword', (status, result) => { + const temp: 'error' | 'complete' | 'no_data' = status; + // $ExpectType string | SearchResult + result; + if (typeof result !== 'string') { + // $ExpectType string + result.info; + // $ExpectType PoiList + result.poiList; + // $ExpectType string[] | undefined + result.keywordList; + // $ExpectType CityInfo[] | undefined + result.cityList; + + const poiList = result.poiList; + // $ExpectType number + poiList.pageIndex; + // $ExpectType number + poiList.pageSize; + // $ExpectType number + poiList.count; + + const poi = poiList.pois[0]; + // $ExpectType string + poi.address; + // $ExpectType number + poi.distance; + // $ExpectType string + poi.id; + // $ExpectType LngLat | null + poi.location; + // $ExpectType string + poi.name; + // $ExpectType string + poi.shopinfo; + // $ExpectType string + poi.tel; + // $ExpectType string + poi.type; + if ('website' in poi) { + // $ExpectType string + poi.adcode; + // $ExpectType string + poi.adname; + // $ExpectType string + poi.citycode; + // $ExpectType string + poi.cityname; + // $ExpectType boolean + poi.discount; + // $ExpectType string + poi.email; + // $ExpectType LngLat | null + poi.entr_location; + // $ExpectType LngLat | null + poi.exit_location; + // $ExpectType boolean + poi.groupbuy; + if (poi.indoor_map) { + const indoorData = poi.indoor_data; + // $ExpectType string + indoorData.cpid; + // $ExpectType string + indoorData.floor; + // $ExpectType string + indoorData.truefloor; + } + poi.pcode; + // $ExpectType PoiPhoto[] + poi.photos; + // $ExpectType string + poi.pname; + // $ExpectType string + poi.postcode; + // $ExpectType string + poi.website; + + const photo = poi.photos[0]; + // $ExpectType string + photo.title; + // $ExpectType string + photo.url; + // $ExpectType Groupbuy[] | undefined + poi.groupbuys; + if (poi.groupbuys) { + const groupbuy = poi.groupbuys[0]; + // $ExpectType string + groupbuy.title; + // $ExpectType string + groupbuy.type_code; + // $ExpectType string + groupbuy.type; + // $ExpectType string + groupbuy.detail; + // $ExpectType string + groupbuy.stime; + // $ExpectType string + groupbuy.etime; + // $ExpectType number + groupbuy.count; + // $ExpectType number + groupbuy.sold_num; + // $ExpectType number + groupbuy.original_price; + // $ExpectType number + groupbuy.groupbuy_price; + // $ExpectType number + groupbuy.discount; + // $ExpectType string + groupbuy.ticket_address; + // $ExpectType string + groupbuy.ticket_tel; + // $ExpectType PoiPhoto[] + groupbuy.photos; + // $ExpectType string + groupbuy.url; + // $ExpectType string + groupbuy.provider; + } + // $ExpectType Discount[] | undefined + poi.discounts; + if (poi.discounts) { + const discount = poi.discounts[0]; + // $ExpectType string + discount.title; + // $ExpectType string + discount.detail; + // $ExpectType string + discount.start_time; + // $ExpectType string + discount.end_time; + // $ExpectType number + discount.sold_num; + // $ExpectType PoiPhoto[] + discount.photos; + // $ExpectType string + discount.url; + // $ExpectType string + discount.provider; + } + if (poi.deep_type === 'CINEMA') { + // $ExpectType Cinema + const cinema = poi.cinema; + // $ExpectType string + cinema.intro; + // $ExpectType string + cinema.rating; + // $ExpectType string + cinema.deep_src; + // $ExpectType string + cinema.parking; + // $ExpectType string + cinema.opentime_GDF; + // $ExpectType string + cinema.opentime; + // $ExpectType PoiPhoto[] + cinema.photos; + } + if (poi.deep_type === 'DINING') { + // $ExpectType Dining + const dining = poi.dining; + // $ExpectType string + dining.cuisines; + // $ExpectType string + dining.tag; + // $ExpectType string + dining.intro; + // $ExpectType string + dining.rating; + // $ExpectType string + dining.cp_rating; + // $ExpectType string + dining.deep_src; + // $ExpectType string + dining.taste_rating; + // $ExpectType string + dining.environment_rating; + // $ExpectType string + dining.service_rating; + // $ExpectType string + dining.cost; + // $ExpectType string + dining.recommend; + // $ExpectType string + dining.atmosphere; + // $ExpectType string + dining.ordering_wap_url; + // $ExpectType string + dining.ordering_web_url; + // $ExpectType string + dining.ordering_app_url; + // $ExpectType string + dining.opentime_GDF; + // $ExpectType string + dining.opentime; + // $ExpectType string + dining.addition; + // $ExpectType PoiPhoto[] + dining.photos; + } + if (poi.deep_type === 'SCENIC') { + // $ExpectType Scenic + const scenic = poi.scenic; + // $ExpectType string + scenic.intro; + // $ExpectType string + scenic.rating; + // $ExpectType string + scenic.deep_src; + // $ExpectType string + scenic.level; + // $ExpectType string + scenic.price; + // $ExpectType string + scenic.season; + // $ExpectType string + scenic.recommend; + // $ExpectType string + scenic.theme; + // $ExpectType string + scenic.ordering_wap_url; + // $ExpectType string + scenic.ordering_web_url; + // $ExpectType string + scenic.opentime_GDF; + // $ExpectType string + scenic.opentime; + // $ExpectType PoiPhoto[] + scenic.photos; + } + if (poi.deep_type === 'HOTEL') { + // $ExpectType Hotel + const hotel = poi.hotel; + // $ExpectType string + hotel.rating; + // $ExpectType string + hotel.star; + // $ExpectType string + hotel.intro; + // $ExpectType string + hotel.lowest_price; + // $ExpectType string + hotel.faci_rating; + // $ExpectType string + hotel.health_rating; + // $ExpectType string + hotel.environment_rating; + // $ExpectType string + hotel.service_rating; + // $ExpectType string + hotel.traffic; + // $ExpectType string + hotel.addition; + // $ExpectType string + hotel.deep_src; + // $ExpectType PoiPhoto[] + hotel.photos; + } + } + + if (result.cityList) { + const city = result.cityList[0]; + // $ExpectType string + city.adcode; + // $ExpectType string + city.citycode; + // $ExpectType number + city.count; + // $ExpectType string + city.name; + } + } else { + // $ExpectType string + result; + } +}); + +// $ExpectType void +placeSearch.searchNearBy('keyword', lnglat, 10, (status, result) => { + const temp: 'error' | 'complete' | 'no_data' = status; + // $ExpectType string | SearchResult + result; +}); +// $ExpectType void +placeSearch.searchNearBy('keyword', lnglatTuple, 10, () => { }); + +// $ExpectType void +placeSearch.searchInBounds('keyword', bounds, (status, result) => { + const temp: 'error' | 'complete' | 'no_data' = status; + // $ExpectType string | SearchResult + result; +}); +// $ExpectType void +placeSearch.searchInBounds('keyword', polygon, () => { }); + +// $ExpectType void +placeSearch.getDetails('id', (status, result) => { + const temp: 'error' | 'complete' | 'no_data' = status; + // $ExpectType string | SearchResult + result; +}); + +// $ExpectType void +placeSearch.setType('type'); +// $ExpectType void +placeSearch.setType(); + +// $ExpectType void +placeSearch.setCityLimit(true); +// $ExpectType void +placeSearch.setCityLimit(); + +// $ExpectType void +placeSearch.setPageIndex(1); +// $ExpectType void +placeSearch.setPageIndex(); + +// $ExpectType void +placeSearch.setPageSize(1); +// $ExpectType void +placeSearch.setPageSize(); + +// $ExpectType void +placeSearch.setCity('city'); +// $ExpectType void +placeSearch.setCity(); + +// $ExpectType void +placeSearch.setLang(lang); +// $ExpectType void +placeSearch.setLang(); + +// $ExpectType "zh_cn" | "en" | "zh_en" | undefined +placeSearch.getLang(); + +// $ExpectType void +placeSearch.clear(); + +// $ExpectType void +placeSearch.poiOnAMAP({ + id: 'id', +}); +// $ExpectType void +placeSearch.poiOnAMAP({ + location: lnglat, + id: 'id', + name: 'name' +}); + +// $ExpectType void +placeSearch.detailOnAMAP({ + id: 'id', +}); +// $ExpectType void +placeSearch.detailOnAMAP({ + location: lnglat, + id: 'id', + name: 'name' +}); + +// $ExpectType void +placeSearch.open(); + +// $ExpectType void +placeSearch.close(); + +placeSearch.on('complete', (event: AMap.PlaceSearch.EventMap['complete']) => { + // $ExpectType "complete" + event.type; + // $ExpectType string + event.info; + // $ExpectType PoiList + event.poiList; + // $ExpectType string[] | undefined + event.keywordList; + // $ExpectType CityInfo[] | undefined + event.cityList; +}); + +placeSearch.on('listElementClick', (event: AMap.PlaceSearch.EventMap['listElementClick']) => { + // $ExpectType MouseEvent + event.event; + // $ExpectType string + event.id; + // $ExpectType number + event.index; + // $ExpectType Marker + event.marker; + // $ExpectType HTMLLIElement + event.listElement; +}); + +placeSearch.on('markerClick', (event: AMap.PlaceSearch.EventMap['markerClick']) => { + const markerEvent = event.event; + // $ExpectType Marker + markerEvent.target; + // $ExpectType string + event.id; + // $ExpectType number + event.index; + // $ExpectType Marker + event.marker; + // $ExpectType HTMLLIElement + event.listElement; +}); diff --git a/types/amap-js-api-place-search/index.d.ts b/types/amap-js-api-place-search/index.d.ts new file mode 100644 index 0000000000..4a333f3b2b --- /dev/null +++ b/types/amap-js-api-place-search/index.d.ts @@ -0,0 +1,737 @@ +// Type definitions for non-npm package amap-js-api-place-search 1.4 +// Project: https://lbs.amap.com/api/javascript-api/reference/search#m_AMap.PlaceSearch +// Definitions by: breeze9527 +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +/// + +declare namespace AMap { + namespace PlaceSearch { + interface EventMap { + complete: Event<'complete', SearchResult>; + error: Event<'error', { info: string }>; + selectChanged: Event<'selectChanged', { + selected: SelectChangeEventData | EventMap['markerClick'] | EventMap['listElementClick']; + lastSelected: SelectChangeEventData | EventMap['markerClick'] | EventMap['listElementClick'] | null; + }>; + listElementClick: SelectChangeEvent<'listElementClick', MouseEvent>; + markerClick: SelectChangeEvent<'markerClick', Marker.EventMap['click']>; + // internal + renderComplete: Event<'renderComplete', { + result: SelectChangeEventData[]; + markers: Marker[]; + listElements: HTMLElement[]; + }>; + infoWindowClick: Event<'infoWindowClick', SelectChangeEventData & { + event: MouseEvent; + infoWindow: InfoWindow; + infoWindowContentDom: HTMLDivElement; + }>; + willClear: Event<'willClear', { + id: string; + index: number; + data: Poi[]; + }>; + markerDestoryed: Event<'markerDestoryed', SelectChangeEventData>; // typo in source code + listElementDetroyed: Event<'listElementDetroyed', SelectChangeEventData>; // typo too + } + + interface SelectChangeEventData { + /** + * 当前选中的POI的ID + */ + id: string; + /** + * 索引 + */ + index: number; + /** + * 当前选中的POI对应的在地图中的Marker对象 + */ + marker: Marker; + /** + * 当前选中的POI在结果面板中对应的列表项 + */ + listElement: HTMLLIElement; + /** + * 当前选中的POI的信息 + */ + data: Poi[]; + } + type SelectChangeEvent = Event; + interface PoiPhoto { + /** + * 图片名称 + */ + title: string; + /** + * 图片url + */ + url: string; + } + interface PoiBase { + /** + * 全局唯一ID + */ + id: string; + /** + * 名称 + */ + name: string; + /** + * 兴趣点类型 + */ + type: string; + /** + * 兴趣点经纬度 + */ + location: LngLat | null; + /** + * 地址 + */ + address: string; + /** + * 离中心点距离 + */ + distance: number; + /** + * 电话 + */ + tel: string; + shopinfo: string; + children?: any[]; // TODO Array<{location: LngLat | null}> + } + interface Groupbuy { + /** + * 团购标题 + */ + title: string; + /** + * 团购分类代码 + */ + type_code: string; + /** + * 团购分类 + */ + type: string; + /** + * 团购详情 + */ + detail: string; + /** + * 团购开始时间 + */ + stime: string; + /** + * 团购结束时间 + */ + etime: string; + /** + * 团购总量 + */ + count: number; + /** + * 已卖出数量 + */ + sold_num: number; + /** + * 原价 + */ + original_price: number; + /** + * 折扣价 + */ + groupbuy_price: number; + /** + * 折扣 + */ + discount: number; + /** + * 取票地址 + */ + ticket_address: string; + /** + * 取票电话 + */ + ticket_tel: string; + /** + * 图片信息 + */ + photos: PoiPhoto[]; + /** + * 来源url + */ + url: string; + /** + * 来源标识 + */ + provider: string; + } + interface Discount { + /** + * 优惠标题 + */ + title: string; + /** + * 优惠详情 + */ + detail: string; + /** + * 开始时间 + */ + start_time: string; + /** + * 结束时间 + */ + end_time: string; + /** + * 已卖出数量 + */ + sold_num: number; + /** + * 图片信息列表 + */ + photos: PoiPhoto[]; + /** + * 来源url + */ + url: string; + /** + * 来源标识 + */ + provider: string; + } + interface Cinema { + /** + * 简介 + */ + intro: string; + /** + * 综合评分 + */ + rating: string; + /** + * 信息来源 + */ + deep_src: string; + /** + * 停车场设施 + */ + parking: string; + /** + * 规范格式的营业时间 + */ + opentime_GDF: string; + /** + * 非规范格式的营业时间 + */ + opentime: string; + /** + * 图片信息列表 + */ + photos: PoiPhoto[]; + } + interface Dining { + /** + * 菜系 + */ + cuisines: string; + /** + * 标签 + */ + tag: string; + /** + * 简介 + */ + intro: string; + /** + * 综合评分 + */ + rating: string; + /** + * 单数据源的评分 + */ + cp_rating: string; + /** + * 信息来源 + */ + deep_src: string; + /** + * 口味评分 + */ + taste_rating: string; + /** + * 环境评分 + */ + environment_rating: string; + /** + * 服务评分 + */ + service_rating: string; + /** + * 人均消费 + */ + cost: string; + /** + * 特色菜 + */ + recommend: string; + /** + * 氛围 + */ + atmosphere: string; + /** + * 订餐wap链接 + */ + ordering_wap_url: string; + /** + * 订餐web链接 + */ + ordering_web_url: string; + /** + * 订餐APP URL + */ + ordering_app_url: string; + /** + * 规范格式的营业时间 + */ + opentime_GDF: string; + /** + * 非规范格式的营业时间 + */ + opentime: string; + /** + * 餐厅特色 + */ + addition: string; + /** + * 图片信息列表 + */ + photos: PoiPhoto[]; + } + interface Scenic { + /** + * 简介 + */ + intro: string; + /** + * 综合评分 + */ + rating: string; + /** + * 信息来源 + */ + deep_src: string; + /** + * 景区国标级别 + */ + level: string; + /** + * 门票价格 + */ + price: string; + /** + * 适合游玩的季节 + */ + season: string; + /** + * 推荐景点 + */ + recommend: string; + /** + * 景区主题 + */ + theme: string; + /** + * wap购票链接 + */ + ordering_wap_url: string; + /** + * web购票链接 + */ + ordering_web_url: string; + /** + * 规范格式的营业时间 + */ + opentime_GDF: string; + /** + * 非规范格式的营业时间 + */ + opentime: string; + /** + * 图片信息列表 + */ + photos: PoiPhoto[]; + } + interface Hotel { + /** + * 综合评分 + */ + rating: string; + /** + * 星级 + */ + star: string; + /** + * 简介 + */ + intro: string; + /** + * 最低房价 + */ + lowest_price: string; + /** + * 设施评分 + */ + faci_rating: string; + /** + * 卫生评分 + */ + health_rating: string; + /** + * 环境评分 + */ + environment_rating: string; + /** + * 服务评分 + */ + service_rating: string; + /** + * 交通提示 + */ + traffic: string; + /** + * 特色服务 + */ + addition: string; + /** + * 信息来源 + */ + deep_src: string; + /** + * 图片信息列表 + */ + photos: PoiPhoto[]; + } + type PoiExt = PoiBase & { + /** + * 网址 + */ + website: string; + /** + * 所在省份编码 + */ + pcode: string; + /** + * 所在城市编码 + */ + citycode: string; + /** + * 所在区域编码 + */ + adcode: string; + /** + * 邮编 + */ + postcode: string; + /** + * 所在省份 + */ + pname: string; + /** + * 所在城市名称 + */ + cityname: string; + /** + * 所在行政区名称 + */ + adname: string; + /** + * 电子邮箱 + */ + email: string; + /** + * 照片 + */ + photos: PoiPhoto[]; + /** + * 入口经纬度 + */ + entr_location: LngLat | null; + /** + * 出口经纬度 + */ + exit_location: LngLat | null; + /** + * @deprecated 是否有团购信息 + */ + groupbuy: boolean; + /** + * @deprecated 是否有优惠信息 + */ + discount: boolean; + } & ({ + indoor_map: true; + indoor_data: { + cpid: string; + floor: string; + truefloor: string; + }; + } | { + indoor_map: false; + }) & { + /** + * @deprecated 团购信息 + */ + groupbuys?: Groupbuy[]; + /** + * @deprecated 优惠信息 + */ + discounts?: Discount[]; + } & ({ + deep_type: 'CINEMA'; + /** + * @deprecated 影院类深度信息 + */ + cinema: Cinema; + } | { + deep_type: 'DINING'; + /** + * @deprecated 餐饮类深度信息 + */ + dining: Dining; + } | { + deep_type: 'SCENIC'; + /** + * @deprecated 景点类深度信息 + */ + scenic: Scenic; + } | { + deep_type: 'HOTEL'; + /** + * @deprecated 酒店类深度信息 + */ + hotel: Hotel; + }); + interface Options { + /** + * 兴趣点城市 + */ + city?: string; + /** + * 是否强制限制在设置的城市内搜索 + */ + citylimit?: boolean; + /** + * 是否按照层级展示子POI数据 + * children=1,展示子节点POI数据,children=0,不展示子节点数据 + */ + children?: number; + /** + * 兴趣点类别,多个类别用“|”分割 + */ + type?: string; + /** + * 检索语言类型 + */ + lang?: Lang; + /** + * 单页显示结果条数 + */ + pageSize?: number; + /** + * 页码 + */ + pageIndex?: number; + /** + * 是否返回详细信息 + * base返回基本地址信息;all返回基本+详细信息 + */ + extensions?: 'base' | 'all'; + /** + * Map对象 + */ + map?: Map; + /** + * 结果列表的HTML容器id或容器元素 + */ + panel?: string | HTMLElement; + /** + * 是否在地图上显示周边搜索的圆或者范围搜索的多边形 + */ + showCover?: boolean; + /** + * 绘制的UI风格 + */ + renderStyle?: 'newpc' | 'default'; + /** + * 是否自动调整地图视野使绘制的Marker点都处于视口的可见范围 + */ + autoFitView?: boolean; + + // internal + renderEngine?: string; + rankBy?: string; + } + interface PoiList { + /** + * Poi列表 + */ + pois: Poi[]; // PlaceSearchPoiBase[] | PlaceSearchPoiExt[]; + /** + * 页码 + */ + pageIndex: number; + /** + * 单页结果数 + */ + pageSize: number; + /** + * 查询结果总数 + */ + count: number; + } + interface CityInfo { + /** + * 建议城市名称 + */ + name: string; + /** + * 城市编码 + */ + citycode: string; + /** + * 行政区编码 + */ + adcode: string; + /** + * 该城市的建议结果数目 + */ + count: number; + } + interface SearchResult { + /** + * 成功状态说明 + */ + info: string; + /** + * 兴趣点列表 + */ + poiList: PoiList; + /** + * 建议关键字列表 + */ + keywordList?: string[]; + /** + * 城市建议列表 + */ + cityList?: CityInfo[]; + } + type Poi = PoiBase | PoiExt; + type SearchStatus = 'complete' | 'error' | 'no_data'; + } + class PlaceSearch extends EventEmitter { + /** + * 地点搜索服务 + * @param options 选项 + */ + constructor(options?: PlaceSearch.Options); + /** + * 根据关键字搜索 + * @param keyword 根据关键字搜索 + * @param callback 回调 + */ + search( + keyword: string, + callback: (status: PlaceSearch.SearchStatus, result: string | PlaceSearch.SearchResult) => void + ): void; + /** + * 周边查询 + * @param keyword 关键字 + * @param center 搜索中心 + * @param radius 搜索半径 + * @param callback 回调 + */ + searchNearBy( + keyword: string, + center: LocationValue, + radius: number, + callback: (status: PlaceSearch.SearchStatus, result: string | PlaceSearch.SearchResult) => void + ): void; + /** + * 根据范围和关键词进行范围查询 + * @param keyword 关键字 + * @param bounds 搜索范围 + * @param callback 回调 + */ + searchInBounds( + keyword: string, + bounds: Bounds | Polygon, + callback: (status: PlaceSearch.SearchStatus, result: string | PlaceSearch.SearchResult) => void + ): void; + /** + * 根据POIID 查询POI 详细信息 + * @param POIID POIID + * @param callback 搜索回调 + */ + getDetails( + POIID: string, + callback: (status: PlaceSearch.SearchStatus, result: string | PlaceSearch.SearchResult) => void + ): void; + /** + * 设置查询类别 + * @param type 查询类别 + */ + setType(type?: string): void; + /** + * 设置是否强制限制城市 + * @param limit 是否强制限制城市 + */ + setCityLimit(limit?: boolean): void; + /** + * 设置查询结果特定页数 + * @param pageIndex 页码 + */ + setPageIndex(pageIndex?: number): void; + /** + * 设置查询单页结果数 + * @param pageSize 结果数 + */ + setPageSize(pageSize?: number): void; + /** + * 设置查询城市 + * @param city 城市 + */ + setCity(city?: string): void; + /** + * 设置检索语言类型 + * @param lang 语言类型 + */ + setLang(lang?: Lang): void; + /** + * 获取检索语言类型 + */ + getLang(): Lang | undefined; + /** + * 清除搜索结果 + */ + clear(): void; + /** + * 唤起高德地图客户端marker页 + * @param obj 唤起参数 + */ + poiOnAMAP(obj: { location?: LocationValue; id: string; name?: string; }): void; + /** + * 唤起高德地图客户端POI详情页 + * @param obj 唤起参数 + */ + detailOnAMAP(obj: { location?: LocationValue; id: string; name?: string; }): void; + + // internal + open(): void; + close(): void; + } +} diff --git a/types/amap-js-api-place-search/tsconfig.json b/types/amap-js-api-place-search/tsconfig.json new file mode 100644 index 0000000000..e3259e1b01 --- /dev/null +++ b/types/amap-js-api-place-search/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noEmit": true, + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "amap-js-api-place-search-tests.ts" + ] +} diff --git a/types/amap-js-api-place-search/tslint.json b/types/amap-js-api-place-search/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/amap-js-api-place-search/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} From 81e531f9ad95adaaf59fbd6d5e9d6be775bb5d2e Mon Sep 17 00:00:00 2001 From: Ivan Ha Date: Sat, 16 Mar 2019 19:08:45 +0800 Subject: [PATCH 038/469] ramda: support R.__ in R.propOr --- types/ramda/index.d.ts | 2 ++ types/ramda/ramda-tests.ts | 2 ++ 2 files changed, 4 insertions(+) diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index 1078d9a51a..f3dd54dbb5 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -2332,6 +2332,8 @@ declare namespace R { * If the given, non-null object has an own property with the specified name, returns the value of that property. * Otherwise returns the provided default value. */ + propOr(val: T, __: Placeholder, obj: U): (p: string) => V; + propOr(__: Placeholder, p: string, obj: U): (val: T) => V; propOr(val: T, p: string, obj: U): V; propOr(val: T, p: string): (obj: U) => V; propOr(val: T): (p: string, obj: U) => V; diff --git a/types/ramda/ramda-tests.ts b/types/ramda/ramda-tests.ts index 6f88d82200..782a85a90b 100644 --- a/types/ramda/ramda-tests.ts +++ b/types/ramda/ramda-tests.ts @@ -1967,6 +1967,8 @@ class Rectangle { const favoriteWithDefault = R.propOr("Ramda", "favoriteLibrary"); const s2 = favoriteWithDefault(alice); // => 'Ramda' + R.propOr('Ramda', R.__, alice)('name'); // => 'ALICE' + R.propOr(R.__, 'foo', alice)('default'); // => 'default' }; () => { From 26ee14fa13ecf40bdc52cdc962bdd858dfd5c4c6 Mon Sep 17 00:00:00 2001 From: Anton Bortnikov <6088046+ntnbrtnkv@users.noreply.github.com> Date: Sat, 23 Mar 2019 16:49:51 +0500 Subject: [PATCH 039/469] feat: add react-tabs-redux types --- types/react-tabs-redux/TabContent.d.ts | 15 +++++++ types/react-tabs-redux/TabLink.d.ts | 19 ++++++++ types/react-tabs-redux/Tabs.d.ts | 14 ++++++ types/react-tabs-redux/index.d.ts | 8 ++++ .../react-tabs-redux-tests.tsx | 44 +++++++++++++++++++ types/react-tabs-redux/tsconfig.json | 28 ++++++++++++ types/react-tabs-redux/tslint.json | 6 +++ 7 files changed, 134 insertions(+) create mode 100644 types/react-tabs-redux/TabContent.d.ts create mode 100644 types/react-tabs-redux/TabLink.d.ts create mode 100644 types/react-tabs-redux/Tabs.d.ts create mode 100644 types/react-tabs-redux/index.d.ts create mode 100644 types/react-tabs-redux/react-tabs-redux-tests.tsx create mode 100644 types/react-tabs-redux/tsconfig.json create mode 100644 types/react-tabs-redux/tslint.json diff --git a/types/react-tabs-redux/TabContent.d.ts b/types/react-tabs-redux/TabContent.d.ts new file mode 100644 index 0000000000..9c3d5c24a6 --- /dev/null +++ b/types/react-tabs-redux/TabContent.d.ts @@ -0,0 +1,15 @@ +import * as React from 'react'; + +export interface TabContentProps { + children?: React.ReactNode; + for: string | number; + visibleStyle?: object; + isVisible?: boolean; + renderActiveTabContentOnly?: boolean; + disableInlineStyles?: boolean; + className?: string; + visibleClassName?: string; + style?: object; +} + +export declare class TabContent extends React.Component {} diff --git a/types/react-tabs-redux/TabLink.d.ts b/types/react-tabs-redux/TabLink.d.ts new file mode 100644 index 0000000000..392fec2d73 --- /dev/null +++ b/types/react-tabs-redux/TabLink.d.ts @@ -0,0 +1,19 @@ +import * as React from 'react'; + +export interface TabLinkProps { + to: number | string; + component?: string; + handleSelect?: (tab: string, name: string) => void; + onClick?: (event: Event) => void; + children?: React.ReactNode; + isActive?: boolean; + namespace?: string; + activeStyle?: object; + disableInlineStyles?: boolean; + className?: string; + activeClassName?: string; + style?: object; + default?: boolean; +} + +export declare class TabLink extends React.Component {} diff --git a/types/react-tabs-redux/Tabs.d.ts b/types/react-tabs-redux/Tabs.d.ts new file mode 100644 index 0000000000..8f0599c0f5 --- /dev/null +++ b/types/react-tabs-redux/Tabs.d.ts @@ -0,0 +1,14 @@ +import * as React from 'react'; + +export interface TabsProps { + name?: string; + onChange?: (selectedTab: string, name: string) => void; + handleSelect?: (tab: string, name: string) => void; + selectedTab?: string; + activeLinkStyle?: object; + visibleTabStyle?: object; + disableInlineStyles?: boolean; + renderActiveTabContentOnly?: boolean; +} + +export declare class Tabs extends React.Component {} diff --git a/types/react-tabs-redux/index.d.ts b/types/react-tabs-redux/index.d.ts new file mode 100644 index 0000000000..62ee5cc5d1 --- /dev/null +++ b/types/react-tabs-redux/index.d.ts @@ -0,0 +1,8 @@ +// Type definitions for react-tabs-redux 4.0 +// Project: https://github.com/patrik-piskay/react-tabs-redux#readme +// Definitions by: Anton Bortnikov +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export {Tabs, TabsProps} from './Tabs'; +export {TabLink, TabLinkProps} from './TabLink'; +export {TabContent, TabContentProps} from './TabContent'; diff --git a/types/react-tabs-redux/react-tabs-redux-tests.tsx b/types/react-tabs-redux/react-tabs-redux-tests.tsx new file mode 100644 index 0000000000..758ba7b5c9 --- /dev/null +++ b/types/react-tabs-redux/react-tabs-redux-tests.tsx @@ -0,0 +1,44 @@ +import * as React from 'react'; +import * as ReactDOM from 'react-dom'; +import { + Tabs, + TabLink, + TabContent, + TabsProps, + TabLinkProps, + TabContentProps +} from 'react-tabs-redux'; + +interface TestTabsProps extends TabsProps {} +interface TestTabLinkProps extends TabLinkProps {} +interface TestTabContentProps extends TabContentProps {} + +class TestApp extends React.Component { + onChange = (selectedTab: string, name: string) => { + console.log(`selectedTab: ${selectedTab}`); + console.log(`namespace: ${name}`); + } + + onClick = (event: Event) => { + console.log(`event: ${event.type}`); + } + + render() { + return ( + + Tab1 + Tab2 + Tab3 + + Content1 + Content2 + Content3 + + ); + } +} + +ReactDOM.render( + , + document.getElementById("test-app") +); diff --git a/types/react-tabs-redux/tsconfig.json b/types/react-tabs-redux/tsconfig.json new file mode 100644 index 0000000000..8872a8cb4f --- /dev/null +++ b/types/react-tabs-redux/tsconfig.json @@ -0,0 +1,28 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "jsx": "react", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "strictFunctionTypes": true + }, + "files": [ + "index.d.ts", + "Tabs.d.ts", + "TabLink.d.ts", + "TabContent.d.ts", + "react-tabs-redux-tests.tsx" + ] +} diff --git a/types/react-tabs-redux/tslint.json b/types/react-tabs-redux/tslint.json new file mode 100644 index 0000000000..4f44991c3c --- /dev/null +++ b/types/react-tabs-redux/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "no-empty-interface": false + } +} From f5f06bf3dec952e9d6b679b7faa1fbf9de87c6ed Mon Sep 17 00:00:00 2001 From: Anton Bortnikov <6088046+ntnbrtnkv@users.noreply.github.com> Date: Sat, 23 Mar 2019 17:04:46 +0500 Subject: [PATCH 040/469] set ts version --- types/react-tabs-redux/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/react-tabs-redux/index.d.ts b/types/react-tabs-redux/index.d.ts index 62ee5cc5d1..38c563f22c 100644 --- a/types/react-tabs-redux/index.d.ts +++ b/types/react-tabs-redux/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/patrik-piskay/react-tabs-redux#readme // Definitions by: Anton Bortnikov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 export {Tabs, TabsProps} from './Tabs'; export {TabLink, TabLinkProps} from './TabLink'; From 4edec4dfad5da8cb8d10deb8df4ded113f66c8b8 Mon Sep 17 00:00:00 2001 From: Anton Bortnikov <6088046+ntnbrtnkv@users.noreply.github.com> Date: Sat, 23 Mar 2019 17:42:23 +0500 Subject: [PATCH 041/469] style: fix lint --- types/react-tabs-redux/TabContent.d.ts | 2 +- types/react-tabs-redux/TabLink.d.ts | 2 +- types/react-tabs-redux/Tabs.d.ts | 2 +- types/react-tabs-redux/index.d.ts | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/types/react-tabs-redux/TabContent.d.ts b/types/react-tabs-redux/TabContent.d.ts index 9c3d5c24a6..d2a1f68926 100644 --- a/types/react-tabs-redux/TabContent.d.ts +++ b/types/react-tabs-redux/TabContent.d.ts @@ -12,4 +12,4 @@ export interface TabContentProps { style?: object; } -export declare class TabContent extends React.Component {} +export class TabContent extends React.Component {} diff --git a/types/react-tabs-redux/TabLink.d.ts b/types/react-tabs-redux/TabLink.d.ts index 392fec2d73..dc1dd2f91b 100644 --- a/types/react-tabs-redux/TabLink.d.ts +++ b/types/react-tabs-redux/TabLink.d.ts @@ -16,4 +16,4 @@ export interface TabLinkProps { default?: boolean; } -export declare class TabLink extends React.Component {} +export class TabLink extends React.Component {} diff --git a/types/react-tabs-redux/Tabs.d.ts b/types/react-tabs-redux/Tabs.d.ts index 8f0599c0f5..a8be4dacfc 100644 --- a/types/react-tabs-redux/Tabs.d.ts +++ b/types/react-tabs-redux/Tabs.d.ts @@ -11,4 +11,4 @@ export interface TabsProps { renderActiveTabContentOnly?: boolean; } -export declare class Tabs extends React.Component {} +export class Tabs extends React.Component {} diff --git a/types/react-tabs-redux/index.d.ts b/types/react-tabs-redux/index.d.ts index 38c563f22c..c6f2f5181a 100644 --- a/types/react-tabs-redux/index.d.ts +++ b/types/react-tabs-redux/index.d.ts @@ -4,6 +4,6 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 -export {Tabs, TabsProps} from './Tabs'; -export {TabLink, TabLinkProps} from './TabLink'; -export {TabContent, TabContentProps} from './TabContent'; +export { Tabs, TabsProps } from './Tabs'; +export { TabLink, TabLinkProps } from './TabLink'; +export { TabContent, TabContentProps } from './TabContent'; From c6cac22911d067b9d2e9863d67004844f2b9773e Mon Sep 17 00:00:00 2001 From: Paul Melnikow Date: Mon, 25 Mar 2019 02:20:55 -0400 Subject: [PATCH 042/469] [recharts] Remove myself (#34159) I stopped using Recharts and prefer not to get notifications each time someone wants to change it. --- types/recharts/index.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/types/recharts/index.d.ts b/types/recharts/index.d.ts index 56ffd20265..d7c17a0cdd 100644 --- a/types/recharts/index.d.ts +++ b/types/recharts/index.d.ts @@ -8,7 +8,6 @@ // Dan Torberg // Peter Keuter // Jamie Saunders -// Paul Melnikow // Harry Cruse // Andrew Palugniok // Robert Stigsson From 0ff72beea9b70a7fa54b247e22d1846be12f7792 Mon Sep 17 00:00:00 2001 From: Flexmonster Date: Mon, 25 Mar 2019 10:45:07 +0200 Subject: [PATCH 043/469] Fix customData & sortingMethod --- types/flexmonster/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/flexmonster/index.d.ts b/types/flexmonster/index.d.ts index 6d92a20ddc..dbf42871dd 100644 --- a/types/flexmonster/index.d.ts +++ b/types/flexmonster/index.d.ts @@ -130,7 +130,7 @@ declare namespace Flexmonster { showCharts(type?: string, multiple?: boolean): void; showGrid(): void; showGridAndCharts(type?: string, position?: string, multiple?: boolean): void; - sortingMethod(hierarchyName: string, compareFunction: (a: string, b: string) => boolean): void; + sortingMethod(hierarchyName: string, compareFunction: (a: string, b: string) => number): void; sortValues(axisName: string, type: string, tuple: number[], measure: MeasureObject): void; toolbar: Toolbar; updateData(object: DataSource | object[]): void; @@ -186,7 +186,7 @@ declare namespace Flexmonster { roles?: string; localeIdentifier?: string; effectiveUserName?: string; - customData?: string; + customData?: object; hash?: string; username?: string; password?: string; From 1dfa3d1eaae1bc71b413f7bf62196232bc6159e6 Mon Sep 17 00:00:00 2001 From: Flexmonster Date: Mon, 25 Mar 2019 11:05:35 +0200 Subject: [PATCH 044/469] Revert customData --- types/flexmonster/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/flexmonster/index.d.ts b/types/flexmonster/index.d.ts index 9c43b0a57d..2854b19a81 100644 --- a/types/flexmonster/index.d.ts +++ b/types/flexmonster/index.d.ts @@ -186,7 +186,7 @@ declare namespace Flexmonster { roles?: string; localeIdentifier?: string; effectiveUserName?: string; - customData?: object; + customData?: string; hash?: string; username?: string; password?: string; From 40caec87f13272f32169ea35f1addd1372ccd831 Mon Sep 17 00:00:00 2001 From: Leo Chen Date: Mon, 25 Mar 2019 21:41:36 +1100 Subject: [PATCH 045/469] Set parameters to optional on filter.applyTo() --- types/ckeditor/ckeditor-tests.ts | 1 + types/ckeditor/index.d.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/types/ckeditor/ckeditor-tests.ts b/types/ckeditor/ckeditor-tests.ts index 1321d5b83d..13f6268d9d 100644 --- a/types/ckeditor/ckeditor-tests.ts +++ b/types/ckeditor/ckeditor-tests.ts @@ -620,6 +620,7 @@ function test_filter() { allowed = filter.allow('rule', 'name', false); var apply: boolean = filter.applyTo(CKEDITOR.htmlParser.fragment.fromHtml('string'), true, false, 1); + apply = filter.applyTo(new CKEDITOR.htmlParser.element('name', null)); apply = filter.applyTo(new CKEDITOR.htmlParser.element('name', null), true, false, 1); var checked: boolean = filter.check(style); diff --git a/types/ckeditor/index.d.ts b/types/ckeditor/index.d.ts index 3d35877b9d..bf2d51b3db 100644 --- a/types/ckeditor/index.d.ts +++ b/types/ckeditor/index.d.ts @@ -1436,7 +1436,7 @@ declare namespace CKEDITOR { addFeature(feature: feature): boolean; addTransformations(transformations: Array>): void; allow(newRules: filter.allowedContentRules, featureName?: string, overrideCustom?: boolean): boolean; - applyTo(fragment: htmlParser.fragment | htmlParser.element, toHrml: boolean, transformOnly: boolean, enterMode: number): boolean; + applyTo(fragment: htmlParser.fragment | htmlParser.element, toHtml?: boolean, transformOnly?: boolean, enterMode?: number): boolean; check(test: filter.contentRule, applyTransformations?: boolean, strictCheck?: boolean): boolean; checkFeature(feature: feature): boolean; clone(): filter; From 92b0d5bb4e631a39228e4263306a61f155661683 Mon Sep 17 00:00:00 2001 From: Benjamin Evenson Date: Tue, 26 Mar 2019 00:41:00 +1000 Subject: [PATCH 046/469] [Slate-JS] Add type for setDecorations on Editor (#34174) --- types/slate/index.d.ts | 2 ++ types/slate/slate-tests.ts | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/types/slate/index.d.ts b/types/slate/index.d.ts index 9b7717e6b8..eb7de74f94 100644 --- a/types/slate/index.d.ts +++ b/types/slate/index.d.ts @@ -9,6 +9,7 @@ // Irwan Fario Subastian // Hanna Greaves // Jack Allen +// Benjamin Evenson // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 import * as Immutable from "immutable"; @@ -1226,6 +1227,7 @@ export class Editor implements Controller { replaceNodeByPath(path: Path, newNode: Node): Editor; removeTextByKey(key: string, offset: number, length: number): Editor; removeTextByPath(path: Path, offset: number, length: number): Editor; + setDecorations(decorations: Immutable.List | Decoration[]): Editor; setMarkByKey( key: string, offset: number, diff --git a/types/slate/slate-tests.ts b/types/slate/slate-tests.ts index 0bb2595165..9dc72093c0 100644 --- a/types/slate/slate-tests.ts +++ b/types/slate/slate-tests.ts @@ -1,4 +1,4 @@ -import { Block, Value, Data, BlockJSON, Document, Editor, KeyUtils, Range, Point, Inline, Mark, SchemaProperties } from "slate"; +import { Block, Value, Data, BlockJSON, Document, Editor, KeyUtils, Range, Point, Inline, Mark, SchemaProperties, Decoration } from "slate"; const data = Data.create({ foo: "bar " }); const value = Value.create({ data }); @@ -36,6 +36,7 @@ const point = Point.create({ key: "a", offset: 0 }); const range = Range.create({ anchor: point, focus: point }); const inline = Inline.create("text"); const mark = Mark.create("bold"); +const decorations = Decoration.createList([{ anchor: Point.create({ key: "a", offset: 0 }), focus: Point.create({ key: "a", offset: 0 }), mark }]); editor.registerQuery("testQuery"); editor.registerCommand("testCommand"); @@ -238,6 +239,7 @@ editor .replaceNodeByKey("a", inline) .replaceNodeByPath("a", inline) .select(range) +.setDecorations(decorations) .setBlocks("paragraph") .setBlocksAtRange(range, "paragraph") .setInlines("paragraph") From 22e9e404270d0bce467d0c10548fe9d3c2036f1c Mon Sep 17 00:00:00 2001 From: chivesrs Date: Mon, 25 Mar 2019 07:43:27 -0700 Subject: [PATCH 047/469] Add types for $mdUtil (#34115) --- types/angular-material/angular-material-tests.ts | 11 +++++++++++ types/angular-material/index.d.ts | 6 ++++++ 2 files changed, 17 insertions(+) diff --git a/types/angular-material/angular-material-tests.ts b/types/angular-material/angular-material-tests.ts index f29de44222..6deaa605d0 100644 --- a/types/angular-material/angular-material-tests.ts +++ b/types/angular-material/angular-material-tests.ts @@ -419,3 +419,14 @@ myApp.controller('StickyController', ($scope: TestScope, $mdSticky: ng.material. $mdSticky($scope, stickyElement); $mdSticky($scope, stickyElement, cloneStickyElement); }); + +function mdUtil($mdUtil: ng.material.IUtilService) { + // $ExpectType void + $mdUtil.enableScrolling(); + + // $ExpectType () => void + $mdUtil.debounce(() => {}); + + // $ExpectType () => string + $mdUtil.debounce((): string => ""); +} diff --git a/types/angular-material/index.d.ts b/types/angular-material/index.d.ts index 444e043210..11ec689cf1 100644 --- a/types/angular-material/index.d.ts +++ b/types/angular-material/index.d.ts @@ -517,5 +517,11 @@ declare module 'angular' { getLastInteractionType(): string|null; isUserInvoked(checkDelay?: number): boolean; } + + interface IUtilService { + // tslint:disable-next-line:ban-types debounce takes in a user provided function + debounce(func: T, wait?: number, scope?: any, invokeApply?: boolean): T; + enableScrolling(): void; + } } } From 9f9a54254ce91ddfe49166a08e6539c279d4f75f Mon Sep 17 00:00:00 2001 From: Daniel Fischer Date: Mon, 25 Mar 2019 15:44:21 +0100 Subject: [PATCH 048/469] [nodemailer] add messageId() method to MimeNode (#34160) * [nodemailer] add messageId() method to MimeNode The [example transport plugin](https://nodemailer.com/plugins/create/#transport-send-mail-callback) currently fails to compile in TypeScript because of the missing `messageId()` method on `MimeNode`. * remove whitespace * Update mime-node.d.ts --- types/nodemailer/lib/mime-node.d.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/types/nodemailer/lib/mime-node.d.ts b/types/nodemailer/lib/mime-node.d.ts index 047770ce57..67228f839c 100644 --- a/types/nodemailer/lib/mime-node.d.ts +++ b/types/nodemailer/lib/mime-node.d.ts @@ -126,6 +126,9 @@ declare class MimeNode { /** Generates and returns SMTP envelope with the sender address and a list of recipients addresses */ getEnvelope(): MimeNode.Envelope; + /** Returns Message-Id value. If it does not exist, then creates one */ + messageId(): string; + /** Sets pregenerated content that will be used as the output of this node */ setRaw(raw: string | Buffer | Readable): this; } From 0f65a072176f8249006920c5e775c7dbf6cbdc9e Mon Sep 17 00:00:00 2001 From: James DiGioia Date: Mon, 25 Mar 2019 10:45:10 -0400 Subject: [PATCH 049/469] Allow callback to take `null` in the error param (#34180) Most nodebacks use `null` there to indicate no error, so the types for `fromNodeCallback` should allow `null`. --- types/kefir/index.d.ts | 4 ++-- types/kefir/kefir-tests.ts | 2 +- types/kefir/tsconfig.json | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/types/kefir/index.d.ts b/types/kefir/index.d.ts index 05fd7a7aab..f1209b312a 100644 --- a/types/kefir/index.d.ts +++ b/types/kefir/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Kefir 3.8.0 +// Type definitions for Kefir 3.8.1 // Project: http://rpominov.github.io/kefir/ // Definitions by: Aya Morisawa // Piotr Hitori Bosak @@ -162,7 +162,7 @@ export function sequentially(interval: number, values: T[]): Stream export function fromPoll(interval: number, fn: () => T): Stream; export function withInterval(interval: number, handler: (emitter: Emitter) => void): Stream; export function fromCallback(fn: (callback: (value: T) => void) => void): Stream; -export function fromNodeCallback(fn: (callback: (error: S, result: T) => void) => void): Stream; +export function fromNodeCallback(fn: (callback: (error: S | null, result: T) => void) => void): Stream; export function fromEvents(target: EventTarget | NodeJS.EventEmitter | { on: Function, off: Function }, eventName: string, transform?: (value: T) => S): Stream; export function stream(subscribe: (emitter: Emitter) => Function | void): Stream; export function fromESObservable(observable: any): Stream diff --git a/types/kefir/kefir-tests.ts b/types/kefir/kefir-tests.ts index 0fba9c5d21..f93da894e1 100644 --- a/types/kefir/kefir-tests.ts +++ b/types/kefir/kefir-tests.ts @@ -24,7 +24,7 @@ import { Observable, Pool, Stream, Property, Event, Emitter } from 'kefir'; }); } let stream07: Stream = Kefir.fromCallback(callback => setTimeout(() => callback(1), 1000)); - let stream08: Stream = Kefir.fromNodeCallback(callback => setTimeout(() => callback(null, 1), 1000)); + let stream08: Stream = Kefir.fromNodeCallback(callback => setTimeout(() => callback(null, 1), 1000)); let stream09: Stream = Kefir.fromEvents(document.body, 'click'); let stream10: Stream = Kefir.stream(emitter => { let count = 0; diff --git a/types/kefir/tsconfig.json b/types/kefir/tsconfig.json index e1d57fe2e3..a0190e45d7 100644 --- a/types/kefir/tsconfig.json +++ b/types/kefir/tsconfig.json @@ -7,7 +7,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ @@ -21,4 +21,4 @@ "index.d.ts", "kefir-tests.ts" ] -} \ No newline at end of file +} From 242fc8cb640db948cbae0ecb4c7df3b5c4181554 Mon Sep 17 00:00:00 2001 From: Ryo Ota Date: Tue, 26 Mar 2019 00:02:23 +0900 Subject: [PATCH 050/469] Add a description about asOfVersion in "Removing a package" --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b50272dbf4..9c52808682 100644 --- a/README.md +++ b/README.md @@ -169,7 +169,7 @@ When a package [bundles](http://www.typescriptlang.org/docs/handbook/declaration You can remove it by running `npm run not-needed -- typingsPackageName asOfVersion sourceRepoURL [libraryName]`. - `typingsPackageName`: This is the name of the directory to delete. -- `asOfVersion`: A stub will be published to `@types/foo` with this version. Should be higher than any currently published version. +- `asOfVersion`: A stub will be published to `@types/foo` with this version. Should be higher than any currently published version, and should be a version of `foo` on npm. - `sourceRepoURL`: This should point to the repository that contains the typings. - `libraryName`: Name of npm package that replaces the Definitely Typed types. Usually this is identical to "typingsPackageName", in which case you can omit it. From afea35d9ffcf281b227009008fb285ba16893331 Mon Sep 17 00:00:00 2001 From: TypeScript Bot Date: Mon, 25 Mar 2019 08:08:58 -0700 Subject: [PATCH 051/469] Update CODEOWNERS (#34143) --- .github/CODEOWNERS | 126 ++++++++++++++++++++------------------------- 1 file changed, 55 insertions(+), 71 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 81913375f9..ab933d6019 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -55,7 +55,6 @@ /types/aframe/ @devpaul @bertoritger @twastvedt /types/agenda/ @meirgottlieb @princjef /types/agent-base/ @Shinigami92 -/types/aggregate-error/ @BendingBender /types/agora-rtc-sdk/ @menthays /types/airbnb-prop-types/ @milesj /types/ajv-errors/ @afshawnlotfi @@ -75,6 +74,8 @@ /types/almost-equal/ @cmaddalozzo /types/alt/ @Shearerbeard /types/amap-js-api/ @breeze9527 +/types/amap-js-api-indoor-map/ @breeze9527 +/types/amap-js-api-map3d/ @breeze9527 /types/amap-js-sdk/ @agasbzj /types/amazon-cognito-auth-js/ @scottescue /types/amazon-product-api/ @MattiLehtinen @alien35 @@ -268,7 +269,7 @@ /types/auto-bind/ @sseppola /types/auto-launch/ @rhysd @unindented /types/auto-sni/ @janwo -/types/autobahn/ @darkl @a904guy @valepu @glenroy37 +/types/autobahn/ @darkl @a904guy @valepu @glenroy37 @spcfran /types/autolinker/ @leonyu /types/autoprefixer/ @odnamrataizem @murt /types/autosize/ @kingdango @keika299 @NeekSandhu @@ -387,7 +388,7 @@ /types/bl/ @Bartvds @reconbot /types/blacklist/ @mhegazy /types/blazy/ @julienpa -/types/blessed/ @brynbellomy @skellock +/types/blessed/ @brynbellomy @skellock @mamachanko /types/blissfuljs/ @fskorzec /types/blob-stream/ @erichillah /types/blob-to-buffer/ @nrlquaker @@ -462,6 +463,7 @@ /types/browserslist-useragent/ @nju33 /types/bs58/ @chrootsu @BendingBender /types/bs58/v3/ @chrootsu +/types/bser/ @claasahl /types/bson/ @horiuchi @CaselIT @justingrant /types/btoa/ @johngeorgewright @bricka /types/buble/ @Kocal @@ -476,7 +478,7 @@ /types/bufferstream/ @Bartvds /types/build-output-script/ @BendingBender /types/builtin-modules/ @ajafff -/types/bull/ @bgrieder @JProgrammer @marshall007 @weeco @blaugold @iamolegga @koblas @bondz @wuha-team @aleccool213 @danmana @kjellmorten @pc-jedi +/types/bull/ @bgrieder @JProgrammer @marshall007 @weeco @blaugold @iamolegga @koblas @bondz @wuha-team @aleccool213 @danmana @kjellmorten @pc-jedi @lenovouser /types/bull/v2/ @bgrieder @JProgrammer /types/bump-regex/ @silkentrance /types/bunnymq/ @cyrilschumacher @@ -581,6 +583,7 @@ /types/cheerio/ @blittle @wmaurer @umarniz @LiJinyao @chennakrishna8 @AzSiAz @nwtgck /types/chess.js/ @JacobFischer /types/chessboardjs/ @sliverb @davidmpaz +/types/child-process-promise/ @TheDSCPL /types/chmodr/ @BendingBender /types/chordsheetjs/ @adamsbloom /types/chosen-js/ @borisyankov @denisname @@ -594,6 +597,7 @@ /types/chromedriver/ @pe8ter /types/cipher-base/ @adamzerella /types/circuit-breaker-js/ @DeTeam +/types/circular-dependency-plugin/ @jeremejevs /types/circular-json/ @jpevarnek /types/ckeditor/ @wittwert @stuartlong @viktorpegy /types/ckeditor/v2/ @wittwert @@ -642,6 +646,7 @@ /types/cloudflare-apps/ @MartynasZilinskas /types/clovelced-plugin-audiomanagement/ @marckassay /types/cls-hooked/ @aleung +/types/clui/ @farzadmf /types/clusterize.js/ @Pr1st0n /types/cmd-shim/ @cspotcode /types/co/ @doniyor2109 @@ -949,7 +954,6 @@ /types/decode-entities/ @waspothegreat /types/decode-uri-component/ @BendingBender /types/decompress/ @plantain-00 @jbethke -/types/decompress-response/ @DanielRosenwasser /types/decorum/ @dflor003 /types/dedent/ @douglasduteil /types/deep-assign/ @souldreamer @@ -1038,7 +1042,6 @@ /types/dom-clipboard-api/ @43081j /types/dom-helpers/ @mctep /types/dom-inputevent/ @diagramatics -/types/dom-loaded/ @ltetzlaff /types/dom-mediacapture-record/ @eliasmeire /types/dom-to-image/ @JipSterk /types/dom4/ @adidahiya @giladgray @@ -1144,12 +1147,12 @@ /types/electron-window-state/ @rhysd /types/electron-winstaller/ @shiftkey @unindented /types/elegant-spinner/ @danwbyrne -/types/element-ready/ @BendingBender /types/element-resize-detector/ @saranshkataria @franklixuefei /types/element-resize-event/ @rogierschouten @plgregoire /types/elementtree/ @dwieeb /types/elliptic/ @danwbyrne @Gilthoniel /types/elm/ @thSoft +/types/elo-rank/ @apavlinovic /types/email-templates/ @cyrilschumacher @gurisko @blankstar85 /types/ember/ @jedmao @bttf @dwickern @chriskrycho @theroncross @mfeckie @alexlafroscia @mike-north @BryanCrotaz /types/ember/v2/ @jedmao @bttf @dwickern @chriskrycho @theroncross @mfeckie @alexlafroscia @mike-north @@ -1300,7 +1303,7 @@ /types/express-brute-memcached/ @cyrilschumacher /types/express-brute-mongo/ @cyrilschumacher /types/express-brute-redis/ @scottharwell -/types/express-bunyan-logger/ @shreyjain1994 +/types/express-bunyan-logger/ @shreyjain1994 @mastermatt /types/express-busboy/ @pinguet62 /types/express-cluster/ @nenadalm /types/express-correlation-id/ @natemara @@ -1430,8 +1433,6 @@ /types/file-exists/ @BendingBender /types/file-saver/ @cyrilschumacher @DaIgeb @chrismbarr /types/file-url/ @coderslagoon -/types/filenamify/ @rokt33r -/types/filenamify-url/ @cprecioso /types/filesize/ @GiedriusGrabauskas @renchap @Ky6uk @ffxsam /types/fill-pdf/ @westy92 /types/filter-console/ @BendingBender @@ -1464,13 +1465,12 @@ /types/first-run/ @BendingBender /types/fixed-data-table/ @pepaar @stephenjelfs /types/fixed-data-table-2/ @ilivit -/types/fkill/ @BendingBender /types/flagged-respawn/ @BendingBender /types/flat/ @chrootsu /types/fleximap/ @DanielRose /types/flexmonster/ @flexmonster /types/flexslider/ @diullei -/types/flickity/ @clmcgrath @wagich +/types/flickity/ @clmcgrath @wagich @aheber /types/flight/ @jonathanhedren /types/flightplan/ @borislavjivkov /types/flipsnap/ @kubosho @gsino @mayuki @@ -1725,7 +1725,6 @@ /types/get-range/ @BendingBender /types/get-res/ @satyarohith /types/get-stdin/ @DanielRosenwasser -/types/get-stream/ @douglasduteil @BendingBender /types/get-urls/ @BendingBender /types/get-value/ @DanielRosenwasser /types/getenv/ @impankratov @@ -1796,6 +1795,7 @@ /types/google-cloud__kms/ @ben-tbotlabs /types/google-cloud__pubsub/ @pheromonez @LunaPg @msiviero /types/google-cloud__tasks/ @ifiokjr +/types/google-cloud__text-to-speech/ @benhjames /types/google-earth/ @icholy /types/google-images/ @dolanmiu /types/google-libphonenumber/ @leonyu @winfinit @@ -1962,11 +1962,9 @@ /types/harmony-proxy/ @remojansen /types/has-ansi/ @BendingBender /types/has-emoji/ @BendingBender -/types/has-yarn/ @BendgingBender /types/hash-file/ @HiromiShikata /types/hash-stream/ @BendingBender /types/hash-sum/ @DanielRosenwasser -/types/hasha/ @BendgingBender /types/hasher/ @flyfishMT /types/hashids/ @pocesar /types/hashmap/ @outring @@ -1994,7 +1992,7 @@ /types/hexo-fs/ @segayuu /types/hexo-log/ @segayuu /types/hexo-util/ @segayuu -/types/highcharts/ @damianog @baltie @AlbertOzimek @hanssens @jgresham +/types/highcharts/ @damianog @baltie @AlbertOzimek @hanssens @jgresham @Arunkeshavareddy /types/highcharts-ng/ @scatcher /types/highland/ @Bartvds @hgwood @iwllyu @alvis @notbobthebuilder /types/highlight.js/ @nikeee @sourrust @joshuakgoldberg @@ -2121,6 +2119,7 @@ /types/iniparser/ @chrootsu /types/init-package-json/ @kfarnung /types/ink/ @cprecioso +/types/ink-select-input/ @lukostry /types/ink-spinner/ @lukostry /types/ink-table/ @lukostry /types/ink-testing-library/ @MancunianSam @@ -2128,7 +2127,7 @@ /types/inline-css/ @philipisapain /types/inline-style-prefixer/ @ahz @dpetrezselyova @franklixuefei /types/inputmask/ @dmester -/types/inquirer/ @tkQubo @ppathan @jouderianjr @bang88 @bitjson @synarque @jrockwood @kwkelly @Ailrun +/types/inquirer/ @tkQubo @ppathan @jouderianjr @bang88 @bitjson @synarque @jrockwood @kwkelly @Ailrun @chigix /types/inquirer-npm-name/ @manuth /types/insert-css/ @hvoecking /types/insert-module-globals/ @leonard-thieu @@ -2139,13 +2138,13 @@ /types/intercom-web/ @fongandrew @salbahra @onatm /types/intercomjs/ @spencerwi /types/interpret/ @BendingBender +/types/intersects/ @voxylu /types/intl/ @RagibHasin /types/intl-locales-supported/ @Slessi /types/intl-messageformat/ @mhegazy /types/intl-relativeformat/ @mohsen1 /types/intl-tel-input/ @fdnhkj @leonard-thieu @molnarm /types/intl-tel-input/v13/ @fdnhkj @leonard-thieu -/types/into-stream/ @BendingBender /types/intrinsic-scale/ @shalomdotnet /types/intro.js/ @anahkiasen /types/invariant/ @bennett000 @@ -2181,6 +2180,7 @@ /types/is-ci/ @atd-schubert /types/is-color/ @VitorLuizC /types/is-compressed/ @mhegazy +/types/is-date-object/ @adamzerella /types/is-docker/ @YashdalfTheGray /types/is-dotdir/ @BendingBender /types/is-dotfile/ @BendingBender @@ -2216,7 +2216,6 @@ /types/is-root/ @mhegazy /types/is-root-path/ @mhegazy /types/is-running/ @danwbyrne -/types/is-scoped/ @postcrafter /types/is-stream/ @me /types/is-text-path/ @mhegazy /types/is-touch-device/ @screendriver @@ -2561,6 +2560,7 @@ /types/k6/ @MajorBreakfast /types/kafka-node/ @dansitu @bkim54 @sfrooster @amiram @insanehong /types/kafkajs/ @michal-b-kaminski +/types/kamailio-kemi/ @bonan /types/karma/ @tkrotoff @43081j @devoto13 /types/karma/v1/ @tkrotoff @43081j /types/karma-chai/ @JayAndCatchFire @@ -2598,7 +2598,6 @@ /types/klaw/v1/ @mceachen /types/klaw-sync/ @shiftkey /types/kms-json/ @sunnyone -/types/knex/ @tkQubo @MeLlamoPablo @mastermatt @micksatana @shreyjain1994 @joelshepherd /types/knex-postgis/ @vesse /types/knockback/ @borisyankov /types/knockout/ @borisyankov @Igorbek @moonpyk @EnableSoftware @BenjaminEckardt @ffMathy @ltlombardi @Retsam @@ -2693,7 +2692,6 @@ /types/lasso/ @darkwebdev /types/later/ @jasond-s /types/latest-semver/ @BendingBender -/types/latest-version/ @BendingBender /types/latinize/ @GiedriusGrabauskas /types/latlon-geohash/ @rimig /types/launchpad/ @rictic @@ -2749,14 +2747,13 @@ /types/leveldown/v1/ @tarruda @LinusU /types/levelup/ @MeirionHughes @danwbyrne /types/levelup/v1/ @blittle @tarruda -/types/leven/ @jmalonzo /types/levenshtein/ @geoffreak /types/libpq/ @Lodin /types/libsodium-wrappers/ @ffflorian /types/libsodium-wrappers-sumo/ @ffflorian /types/libxmljs/ @fdecampredon @ComFreek /types/libxslt/ @alejo90 -/types/license-checker/ @rogierschouten @unindented +/types/license-checker/ @rogierschouten @unindented @alechemy /types/liftoff/ @BendingBender /types/lil-uri/ @wcarson /types/lil-uuid/ @Pr1st0n @@ -3220,7 +3217,6 @@ /types/media-typer/ @BendingBender /types/medium-editor/ @keika299 @pascaliske /types/megajs/ @danwbyrne -/types/mem/ @SamVerschueren /types/mem-cache/ @MutterPedro /types/mem-fs/ @MyFoodBag /types/mem-fs-editor/ @MyFoodBag @@ -3379,7 +3375,7 @@ /types/msgpack5/ @wokim @heycalmdown /types/msnodesql/ @borisyankov @SomaticIT /types/msportalfx-test/ @julioct -/types/mssql/ @jaminfarr @buzinas @mrrichar @elhaard @pkeuter @mcdado +/types/mssql/ @jaminfarr @buzinas @mrrichar @elhaard @pkeuter @mcdado @woodenconsulting /types/mu2/ @jedigo /types/mui-datatables/ @favna @ankithkonda /types/muicss/ @samuelneff @@ -3433,6 +3429,7 @@ /types/nconf/ @jedigo @jmthibault @ew73 /types/ncp/ @bartvds /types/ndarray/ @pawsong @taoqf +/types/ndn-js/ @yoursunny /types/nearley/ @deltaidea @BendingBender /types/neat-csv/ @calamitizer /types/nedb/ @reppners @anthonynichols @afharo @@ -3515,9 +3512,9 @@ /types/node-dir/ @panuhorsmalahti /types/node-dogstatsd/ @chrisbobo @xzyfer /types/node-emoji/ @jonestristand @styu @rimiti -/types/node-fetch/ @torstenwerner @nikcorg @vinaybedre @kyranet +/types/node-fetch/ @torstenwerner @nikcorg @vinaybedre @kyranet @AndrewLeedham /types/node-fibers/ @caryhaynie -/types/node-forge/ @westy92 @flynetworks @a-k-g @rafal2228 @beenotung @joeflateau @Apologiz @timhwang21 @supaiku0 @andersk +/types/node-forge/ @westy92 @flynetworks @a-k-g @rafal2228 @beenotung @joeflateau @Apologiz @timhwang21 @supaiku0 @andersk @saschazar21 /types/node-gcm/ @horiuchi /types/node-geocoder/ @rosek86 /types/node-getopt/ @kcauchy @@ -3577,6 +3574,7 @@ /types/nodeunit/ @jedigo /types/noisejs/ @izmhr /types/nomnom/ @panopticoncentral +/types/nonogram-solver/ @me /types/nookies/ @andreasbergqvist /types/nopt/ @jbondc /types/normalize-package-data/ @jdxcode @@ -3591,15 +3589,12 @@ /types/nouislider/v7/ @acoreyj /types/novnc-core/ @smithkl42 @BendingBender /types/npm/ @SomaticIT -/types/npm-email/ @BendingBender -/types/npm-keyword/ @BendingBender /types/npm-license-crawler/ @ffflorian /types/npm-list-author-packages/ @ffflorian /types/npm-package-arg/ @mgroenhoff @OiYouYeahYou /types/npm-packlist/ @ajafff /types/npm-paths/ @BendingBender /types/npm-registry-package-info/ @ffflorian -/types/npm-user/ @BendingBender /types/npm-user-packages/ @BendingBender /types/npmlog/ @DanielMSchmidt @littlepiggy03 /types/ns-api/ @Archcry @@ -3684,7 +3679,7 @@ /types/openlayers/v2/ @bolhovsky /types/openpgp/ @errietta @damonpam @po5i @ecamellini @SardineFish /types/openstack-wrapper/ @sanjaymadane -/types/opentok/ @westy92 @CatGuardian +/types/opentok/ @westy92 @CatGuardian @pronebird /types/opentype.js/ @danmarshall @edzis /types/opn/ @shinnn @SomaticIT @tlent /types/opossum/ @quinnlangille @merufm @lance @mastermatt @@ -3712,34 +3707,16 @@ /types/owl.carousel/ @igorissen @KennethanCeyer /types/owlcarousel/ @dpiatkowski /types/p-all/ @BendingBender -/types/p-any/ @BendingBender -/types/p-cancelable/ @BendingBender -/types/p-catch-if/ @LinusU -/types/p-debounce/ @BendingBender /types/p-defer/ @SamVerschueren @BendingBender /types/p-do-whilst/ @BendingBender -/types/p-each-series/ @BendingBender -/types/p-every/ @BendingBender /types/p-forever/ @BendingBender /types/p-is-promise/ @BendingBender /types/p-lazy/ @BendingBender /types/p-loading/ @renjfk -/types/p-locate/ @BendingBender -/types/p-log/ @BendingBender -/types/p-map-series/ @BendingBender -/types/p-memoize/ @forabi /types/p-min-delay/ @BendingBender -/types/p-one/ @BendingBender -/types/p-progress/ @icopp -/types/p-props/ @BendingBender -/types/p-reduce/ @BendingBender /types/p-reflect/ @BendingBender -/types/p-retry/ @BendingBender -/types/p-series/ @BendingBender /types/p-settle/ @natesilva -/types/p-tap/ @BendingBender /types/p-time/ @BendingBender -/types/p-timeout/ @BendingBender /types/p-times/ @BendingBender /types/p-try/ @BendingBender @LinusU /types/p-wait-for/ @BendingBender @@ -3748,7 +3725,6 @@ /types/p-whilst/ @BendingBender /types/p2/ @clark-stevenson @jramstedt /types/p5/ @p5-types -/types/package-json/ @jinwoo @BendingBender /types/packery/ @piraveen @hanssens /types/pad/ @mhegazy /types/page/ @43081j @@ -3768,7 +3744,7 @@ /types/parity-pmr/ @leovujanic /types/parity-poe/ @leovujanic /types/park-miller/ @BendingBender -/types/parse/ @dpoetzsch @jaeggerr @flavionegrao @wesleygrimes @owsas @agoldis @AlexandreHetu +/types/parse/ @dpoetzsch @jaeggerr @flavionegrao @wesleygrimes @owsas @agoldis @AlexandreHetu @dplewis @yomybaby /types/parse/v1/ @dpoetzsch @jaeggerr @flavionegrao @wesleygrimes @owsas /types/parse-columns/ @BendingBender /types/parse-filepath/ @BendingBender @@ -3821,7 +3797,7 @@ /types/passport-oauth2/ @pasieronen @WangZishi @EduardoAC @ivan94 /types/passport-oauth2-client-password/ @akaNightmare /types/passport-remember-me-extended/ @AylaJK -/types/passport-saml/ @cjbarth @dassennato @ksamborski +/types/passport-saml/ @cjbarth @dassennato @ksamborski @josecolella /types/passport-steam/ @kzay /types/passport-strategy/ @liorm /types/passport-twitter/ @staticfunction @@ -3835,7 +3811,6 @@ /types/path-is-absolute/ @mhegazy /types/path-is-inside/ @aomarks /types/path-regex/ @BendingBender -/types/path-type/ @BendingBender /types/pathfinding/ @BNedry /types/pathjs/ @lokeshpeta /types/pathwatcher/ @GlenCFL @@ -3907,9 +3882,7 @@ /types/piwik-tracker/ @lbguilherme /types/pixelmatch/ @iamolegga /types/pixi.js/ @clark-stevenson -/types/pkg-dir/ @NK-WEB-Git /types/pkg-up/ @forivall -/types/pkg-versions/ @BendingBender /types/pkgcloud/ @dantman /types/pkijs/ @microshine /types/platform/ @JakeH @@ -3939,6 +3912,8 @@ /types/pollyjs__persister-fs/ @feinoujc /types/pollyjs__utils/ @feinoujc /types/polyfill-service/ @Alorel +/types/polygon/ @Nielio +/types/polygons-intersect/ @Nielio /types/polylabel/ @DenisCarriere /types/polyline/ @Kern0 /types/polymer/ @lgrignon @laco0416 @@ -3978,6 +3953,7 @@ /types/pouchdb-upsert/ @keithdmoore @hotforfeature @apolkingg8 @zamb3zi /types/power-assert/ @vvakame /types/power-assert-formatter/ @vvakame +/types/powerapps-component-framework/ @jopursle /types/powerbi-visuals-tools/ @zBritva @Microsoft /types/preact-i18n/ @ltetzlaff /types/precise/ @codeanimal @@ -4330,7 +4306,7 @@ /types/react-loader/ @artfuldev /types/react-lottie/ @Kana00 @Ricki-BumbleDev /types/react-mailchimp-subscribe/ @osdiab -/types/react-map-gl/ @rimig @fnberta +/types/react-map-gl/ @rimig @fnberta @sandersiim /types/react-maskedinput/ @LKay @lavoaster @CarlosBonetti /types/react-material-ui-form-validator/ @FrankBrullo /types/react-mce/ @morphologue @@ -4351,6 +4327,7 @@ /types/react-native-background-timer/ @chillkroeteTTS /types/react-native-bluetooth-serial/ @RodrigoAWeber /types/react-native-calendars/ @Tyler-Zhang @DavidNorena @FabianMeul +/types/react-native-canvas/ @hmajid2301 /types/react-native-communications/ @huhuanming @PaitoAnderson /types/react-native-custom-tabs/ @philnova /types/react-native-datepicker/ @jacobbaskin @nossbigg @@ -4492,6 +4469,7 @@ /types/react-s-alert/ @mitsuruog /types/react-scroll/ @sudoplz @GiedriusGrabauskas /types/react-scroll-into-view-if-needed/ @angusfretwell @allanpope @jonathanly +/types/react-scrollable-anchor/ @AntoineDoubovetzky /types/react-scrollbar/ @stephenjelfs /types/react-scrollspy/ @ZhangYiJiang /types/react-select/ @claasahl @jonfreedman @@ -4524,7 +4502,7 @@ /types/react-svg-pan-zoom/ @huy-nguyen /types/react-swf/ @stepancar /types/react-swipe/ @DeividasBakanas @AAlakkad -/types/react-swipeable/ @GiedriusGrabauskas @mctep @horiuchi +/types/react-swipeable/ @GiedriusGrabauskas @mctep @horiuchi @adambowles /types/react-swipeable-views/ @mxl @DeividasBakanas /types/react-syntax-highlighter/ @NoHomey @ajgamble-milner /types/react-table/ @royxue @psakalo @Havret @andys8 @Gelio @@ -4539,6 +4517,7 @@ /types/react-test-renderer/v15/ @arvitaly @lochbrunner @lochbrunner @johnnyreilly /types/react-tether/ @ryprice /types/react-text-mask/ @guilhermehubner @cavarzan @needpower +/types/react-text-truncate/ @adriantoine /types/react-textarea-autosize/ @asvetliakov @zry656565 /types/react-timeago/ @koss-lebedev /types/react-timeout/ @kerwynrg @@ -4565,7 +4544,7 @@ /types/react-weui/ @tairan /types/react-widgets/ @rogierschouten @sanyatuning @frodehansen2 @r3nya @MBillemaz @georg94 @tzarger @vegtelenseg /types/react-widgets-moment/ @dawnmist -/types/react-window/ @martynaskadisa @heyimalex +/types/react-window/ @martynaskadisa @heyimalex @jgoz /types/react-window-size/ @jakejrichards /types/react-wow/ @mikepthomas /types/react-youtube/ @kgtkr @salguerooo @@ -4576,7 +4555,7 @@ /types/reactstrap/v4/ @alihammad @mfal @danilobjr @fabiopaiva /types/read/ @timjk /types/read-package-tree/ @mgroenhoff -/types/read-pkg/ @jdxcode +/types/read-pkg/ @jdxcode @arichardsmith /types/read-pkg-up/ @dudeofawesome @jdxcode /types/readable-stream/ @TeamworkGuy2 /types/readdir-enhanced/ @mrmlnc @@ -4610,11 +4589,11 @@ /types/reduce-reducers/ @huy-nguyen @daliusd /types/redux-action/ @newraina /types/redux-action-utils/ @tkqubo -/types/redux-actions/ @jaysoo @alexgorbatchev @alechill @alexey-pelykh @7hi4g0 +/types/redux-actions/ @jaysoo @alexgorbatchev @alechill @alexey-pelykh @7hi4g0 @oddui /types/redux-async-queue/ @andreiho /types/redux-auth-wrapper/ @LKay /types/redux-auth-wrapper/v1/ @LKay -/types/redux-batched-subscribe/ @mDibyo +/types/redux-batched-subscribe/ @mDibyo @azizhk /types/redux-debounced/ @seansfkelley /types/redux-devtools/ @mc-petry /types/redux-devtools-dock-monitor/ @mc-petry @@ -4624,7 +4603,7 @@ /types/redux-first-router-link/ @janb87 /types/redux-first-router-restore-scroll/ @icopp /types/redux-first-routing/ @tlaziuk -/types/redux-form/ @carsonf @aikoven @LKay @bancek @alsiola @tehbi4 @huwmartin @ethanresnick @reggino @maddijoyce @smifun @mshaaban088 @esetnik @bwlt +/types/redux-form/ @carsonf @aikoven @LKay @bancek @alsiola @tehbi4 @huwmartin @ethanresnick @reggino @maddijoyce @smifun @mshaaban088 @esetnik @bwlt @mrsekut /types/redux-form/v7/ @carsonf @aikoven @LKay @bancek @alsiola @tehbi4 @huwmartin @ethanresnick @reggino @maddijoyce @smifun @mshaaban088 @esetnik /types/redux-form/v6/ @carsonf @aikoven @LKay @bancek @mshaaban088 /types/redux-form/v4/ @aikoven @@ -4649,6 +4628,7 @@ /types/redux-recycle/ @LKay /types/redux-router/ @stepancar /types/redux-saga-tester/ @BenLorantfy @lawsumisu +/types/redux-seamless-immutable/ @SoaresMG /types/redux-sentry-middleware/ @dolezel /types/redux-shortcuts/ @tstirrat /types/redux-socket.io/ @snakeego @@ -4711,6 +4691,7 @@ /types/resolve-from/ @unional @BendingBender /types/resolve-from/v2/ @unional /types/resolve-global/ @BendingBender +/types/resolve-options/ @delprzemo /types/resolve-pkg/ @mabels @BendingBender /types/resourcejs/ @shaunluttin /types/response-time/ @urossmolnik @TonyPythoneer @danmana @@ -4857,13 +4838,12 @@ /types/schema-registry/ @bonzzy /types/schwifty/ @ozum /types/scoped-http-client/ @mattvperry @rianadon -/types/screenfull/ @icholy @lionelb @joelshepherd @BendingBender -/types/screenfull/v3/ @icholy @lionelb @joelshepherd /types/screeps/ @MarkoSulamagi @NhanHo @bryanbecker @resir014 @Arcath @dmarcuse /types/screeps-profiler/ @ramblurr /types/script-ext-html-webpack-plugin/ @davecardwell /types/scriptjs/ @ssttevee /types/scroll-into-view/ @zivni +/types/scroll-to-element/ @kirillurgant /types/scroller/ @haskellcamargo /types/scrollparent/ @Sintifo /types/scrollreveal/ @Davidblkx @@ -5006,7 +4986,6 @@ /types/simplesmtp/ @rogierschouten /types/simplestorage.js/ @axelcostaspena @mxl /types/sindresorhus__class-names/ @BendingBender -/types/sindresorhus__df/ @whatknight /types/sindresorhus__djb2a/ @BendingBender /types/sindresorhus__fnv1a/ @BendingBender /types/sindresorhus__string-hash/ @BendingBender @@ -5046,6 +5025,7 @@ /types/slate-react/ @andykent @majelbstoat @JanLoebel @PatrickSachs @YangusKhan @isubasti @sgreav @Kornil @jackall3n /types/sleep/ @rajarz /types/slice-ansi/ @dwieeb +/types/slick-carousel/ @Kocal /types/slickgrid/ @jbaldwin /types/slideout/ @ToastHawaii /types/slimerjs/ @alexwall @@ -5227,7 +5207,7 @@ /types/stripe/ @wjohnsto @codeanimal @sampsonjoliver @LinusU @brannon @kkamperschroer @starhoshi @bruun @galtalmor @htunnicliff @squirly @tzarger @ifiokjr @SimonSchick @yultyyev @cpsoinos @adamduren @saranshkataria @0xJoKe @delianides /types/stripe-checkout/ @cgwrench /types/stripe-v2/ @ejsmith @amritk @adamcmiel @jleider @galuszkak -/types/stripe-v3/ @ejsmith @amritk @adamcmiel @jleider @galuszkak @slangeder +/types/stripe-v3/ @ejsmith @amritk @adamcmiel @jleider @galuszkak @slangeder @marlosin /types/stripejs/ @RobinvanTienhoven @mattferderer /types/strong-cluster-control/ @shuntksh /types/strong-error-handler/ @blankstar85 @@ -5241,7 +5221,7 @@ /types/styled-react-modal/ @Lavoaster /types/styled-system/ @maxdeviant @phobon @zephraph @damassi @alloy @maoueh @lavoaster @jschuler @adam187 @gretzky @chrislopresto /types/styled-theming/ @ArjanJ -/types/stylelint/ @alan-agius4 @filipsalpe +/types/stylelint/ @alan-agius4 @filipsalpe @43081j /types/stylelint/v7/ @alan-agius4 /types/stylelint-webpack-plugin/ @bahlo /types/stylenames/ @bengry @@ -5368,6 +5348,7 @@ /types/texzilla/ @m93a /types/tgfancy/ @Dabolus /types/theming/ @eps1lon +/types/then-eos/ @seangenabe /types/theo/ @petekp @laitine /types/thepiratebay/ @jsorrell /types/three/ @gyohk @florentpoujol @omni360 @ivoisbelongtous @piranha771 @qszhusightp @nakakura @Pro @efokschaner @PsychoSTS @apurvaojas @NotWoods @Methuselah96 @Dukuo @JulianSSS @devilsparta @KonstantinLukaschenko @danyim @saranshkataria @psuter @@ -5512,6 +5493,7 @@ /types/underscore.string/ @rygine /types/undertaker/ @tkqubo @GiedriusGrabauskas /types/undertaker-registry/ @GiedriusGrabauskas +/types/uni-app/ @dcloudio /types/unidecode/ @vfernandestoptal /types/uniq/ @hansrwindhoff /types/uniqid/ @idchlife @@ -5527,7 +5509,6 @@ /types/unorm/ @chbrown /types/unsplash-js/ @markupcode /types/untildify/ @BendingBender -/types/unused-filename/ @BendingBender /types/unzip/ @coding2012 /types/unzipper/ @s73obrien @natemara @bartje321 /types/update-notifier/ @vvakame @nchen63 @bitjson @grinich @@ -5588,9 +5569,11 @@ /types/validatorjs/ @LKay @danmana @MatiasOlivera /types/vanilla-modal/ @samnau /types/vanilla-tilt/ @BrunnerLivio +/types/vara/ @Chnapy /types/varint/ @dbrockman /types/vary/ @BendingBender /types/vast-client/ @jgainfort @kobawan +/types/vec2/ @Nielio /types/vec3/ @xstoudi /types/vectorious/ @erikgerrits /types/velocity-animate/ @smrq @@ -5658,7 +5641,6 @@ /types/walk/ @poppa /types/wallabyjs/ @andrewconnell /types/wallop/ @leemcd56 -/types/wallpaper/ @BendingBender /types/wampy/ @KSDaemon /types/warning/ @cvle /types/watch/ @soywiz @Perlmint @@ -5772,6 +5754,7 @@ /types/word-list-json/ @dovidm /types/word2vector/ @renekeijzer /types/wordcloud/ @joeskeen +/types/wordpress__jest-console/ @mistic100 /types/words-to-numbers/ @James-Frowen /types/wordwrap/ @ark120202 /types/workbox-sw/ @wessberg @@ -5801,7 +5784,7 @@ /types/xml-parser/ @mhfrantz /types/xml2js/ @michelsalib @jasonrm @ccurrens @edwardhinkle @BehindTheMath @claasahl /types/xml2json/ @dolanmiu -/types/xmlbuilder/ @wallymathieu +/types/xmlbuilder/ @wallymathieu @GaikwadPratik /types/xmldoc/ @Xstoudi @ajsheehan @notlaforge /types/xmldom/ @tkqubo /types/xmlpoke/ @garthk @@ -5834,7 +5817,7 @@ /types/ydn-db/ @yathit @gabrielmaldi /types/year-days/ @BendingBender /types/yeoman-assert/ @Toilal -/types/yeoman-generator/ @armorik83 @janslow @ikatyang @tasadar2 @haggen +/types/yeoman-generator/ @armorik83 @janslow @ikatyang @tasadar2 @haggen @chigix /types/yeoman-test/ @ikatyang /types/yesql/ @Sumolari /types/yn/ @BendingBender @@ -5850,6 +5833,7 @@ /types/yui/ @giabao /types/yup/ @dhardtke @vtserman @MoretonBayRC @sseppola @YashdalfTheGray @vincentjames501 @robertbullen @sat0yu @dancrumb /types/z-schema/ @pgonzal +/types/zeit__next-source-maps/ @ldthorne /types/zeit__next-typescript/ @icopp /types/zen-observable/ @aicest @JounQin @itomtom /types/zen-push/ @daprahamian From ca0bad23e6aecd259c924ed728772c932197af71 Mon Sep 17 00:00:00 2001 From: Bert Verhelst Date: Mon, 25 Mar 2019 16:15:17 +0100 Subject: [PATCH 052/469] Attempts are passed to onRetry function https://github.com/zeit/async-retry/blob/master/lib/index.js#L33 --- types/async-retry/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/async-retry/index.d.ts b/types/async-retry/index.d.ts index 6b50c71b63..992b78ddcc 100644 --- a/types/async-retry/index.d.ts +++ b/types/async-retry/index.d.ts @@ -16,7 +16,7 @@ declare namespace AsyncRetry { minTimeout?: number; maxTimeout?: number; randomize?: boolean; - onRetry?: (e: Error) => any; + onRetry?: (e: Error, attempt: number) => any; } type RetryFunction = (bail: (e: Error) => void, attempt: number) => A|Promise; From 54bc43d1d82ac9487d88816c949be69b798a2f7a Mon Sep 17 00:00:00 2001 From: Bert Verhelst Date: Mon, 25 Mar 2019 16:16:29 +0100 Subject: [PATCH 053/469] Update version number --- types/async-retry/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/async-retry/index.d.ts b/types/async-retry/index.d.ts index 992b78ddcc..8c66a2f370 100644 --- a/types/async-retry/index.d.ts +++ b/types/async-retry/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for async-retry 1.2 +// Type definitions for async-retry 1.2.1 // Project: https://github.com/zeit/async-retry#readme // Definitions by: Albert Wu // Pablo Rodríguez From 97b73b32723374e6350a74a68a2b2711cadae323 Mon Sep 17 00:00:00 2001 From: Alexander Tesfamichael Date: Mon, 25 Mar 2019 17:25:30 +0100 Subject: [PATCH 054/469] Add instance methods to React Native Material Textfield (#34175) * Add methods * Add examples of method use --- .../index.d.ts | 27 ++++++++++++- .../react-native-material-textfield-tests.tsx | 39 +++++++++++++------ 2 files changed, 54 insertions(+), 12 deletions(-) diff --git a/types/react-native-material-textfield/index.d.ts b/types/react-native-material-textfield/index.d.ts index c21caa15b4..1aed9e03aa 100644 --- a/types/react-native-material-textfield/index.d.ts +++ b/types/react-native-material-textfield/index.d.ts @@ -66,4 +66,29 @@ export interface TextFieldProps extends TextInputProps { * Material Style Text Field * @see https://github.com/n4kz/react-native-material-textfield/blob/master/src/components/field/index.js */ -export class TextField extends React.Component {} +export class TextField extends React.Component { + /* + * Acquire focus + */ + focus(): void; + /* + * Release focus + */ + blur(): void; + /* + * Clear text field + */ + clear(): void; + /* + * Get current value + */ + value(): string; + /* + * Get current focus state + */ + isFocused(): boolean; + /* + * Get current restriction state + */ + isRestricted(): boolean; +} diff --git a/types/react-native-material-textfield/react-native-material-textfield-tests.tsx b/types/react-native-material-textfield/react-native-material-textfield-tests.tsx index 50fb2b166b..7219dd9a3f 100644 --- a/types/react-native-material-textfield/react-native-material-textfield-tests.tsx +++ b/types/react-native-material-textfield/react-native-material-textfield-tests.tsx @@ -2,14 +2,31 @@ import * as React from 'react'; import { View } from 'react-native'; import { TextField } from 'react-native-material-textfield'; -const Example = () => ( - - - -); +export class Example extends React.Component { + textFieldRef = React.createRef(); + + componentDidMount() { + if (this.textFieldRef.current) { + this.textFieldRef.current.focus(); + this.textFieldRef.current.blur(); + this.textFieldRef.current.clear(); + this.textFieldRef.current.value(); + this.textFieldRef.current.isFocused(); + this.textFieldRef.current.isRestricted(); + } + } + + render() { + return ( + + + + ); + } +} From 919f6b0dc7649e7e3b912d4ddff42f95c6d91a70 Mon Sep 17 00:00:00 2001 From: codert Date: Tue, 26 Mar 2019 00:26:02 +0800 Subject: [PATCH 055/469] fabric.Image.setElement method has no callback argument (#34173) * fix: setElement type definition * chore: add definitions by --- types/fabric/fabric-impl.d.ts | 4 ++-- types/fabric/index.d.ts | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/types/fabric/fabric-impl.d.ts b/types/fabric/fabric-impl.d.ts index 96034c0b5f..cd52bd54e5 100644 --- a/types/fabric/fabric-impl.d.ts +++ b/types/fabric/fabric-impl.d.ts @@ -2212,10 +2212,10 @@ export class Image { * Sets image element for this instance to a specified one. * If filters defined they are applied to new image. * You might need to call `canvas.renderAll` and `object.setCoords` after replacing, to render new image and update controls area. - * @param [callback] Callback is invoked when all filters have been applied and new image is generated + * @param element image element * @param [options] Options object */ - setElement(element: HTMLImageElement, callback: Function, options: IImageOptions): Image; + setElement(element: HTMLImageElement, options?: IImageOptions): Image; /** * Delete a single texture if in webgl mode */ diff --git a/types/fabric/index.d.ts b/types/fabric/index.d.ts index 3897987589..7444f481b8 100644 --- a/types/fabric/index.d.ts +++ b/types/fabric/index.d.ts @@ -9,6 +9,7 @@ // Bradley Hill // Bryan Krol // Glenn Gartner +// Codertx // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 export import fabric = require("./fabric-impl"); From f51241ad20f948467a73e34168f72fab5c879b95 Mon Sep 17 00:00:00 2001 From: Ryo Ota Date: Tue, 26 Mar 2019 01:27:33 +0900 Subject: [PATCH 056/469] Remove the type definition of get-port (#34165) --- notNeededPackages.json | 6 ++++++ types/get-port/get-port-tests.ts | 10 ---------- types/get-port/index.d.ts | 12 ------------ types/get-port/tsconfig.json | 23 ----------------------- types/get-port/tslint.json | 3 --- 5 files changed, 6 insertions(+), 48 deletions(-) delete mode 100644 types/get-port/get-port-tests.ts delete mode 100644 types/get-port/index.d.ts delete mode 100644 types/get-port/tsconfig.json delete mode 100644 types/get-port/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index cf61daf58d..33ac19b762 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -786,6 +786,12 @@ "sourceRepoURL": "https://github.com/manuelbieh/Geolib", "asOfVersion": "2.0.23" }, + { + "libraryName": "get-port", + "typingsPackageName": "get-port", + "sourceRepoURL": "https://github.com/sindresorhus/get-port", + "asOfVersion": "4.2.0" + }, { "libraryName": "get-stream", "typingsPackageName": "get-stream", diff --git a/types/get-port/get-port-tests.ts b/types/get-port/get-port-tests.ts deleted file mode 100644 index 5e47c33c1a..0000000000 --- a/types/get-port/get-port-tests.ts +++ /dev/null @@ -1,10 +0,0 @@ -import getPort = require('get-port'); - -// $ExpectType Promise -getPort(); -// $ExpectType Promise -getPort({ port: 3000 }); -// $ExpectType Promise -getPort({ port: [3000, 3001] }); -// $ExpectType Promise -getPort({ host: 'foo.local' }); diff --git a/types/get-port/index.d.ts b/types/get-port/index.d.ts deleted file mode 100644 index 9af3b311fc..0000000000 --- a/types/get-port/index.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -// Type definitions for get-port 4.0 -// Project: https://github.com/sindresorhus/get-port -// Definitions by: York Yao -// BendingBender -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -declare function getPort(options?: { - port?: number | ReadonlyArray; - host?: string; -}): Promise; - -export = getPort; diff --git a/types/get-port/tsconfig.json b/types/get-port/tsconfig.json deleted file mode 100644 index 0d9f3a8975..0000000000 --- a/types/get-port/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "get-port-tests.ts" - ] -} diff --git a/types/get-port/tslint.json b/types/get-port/tslint.json deleted file mode 100644 index f93cf8562a..0000000000 --- a/types/get-port/tslint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "dtslint/dt.json" -} From ded108693b02df1041b2d00a052ca63071ee1717 Mon Sep 17 00:00:00 2001 From: Paul Melnikow Date: Mon, 25 Mar 2019 12:28:10 -0400 Subject: [PATCH 057/469] [cacheable-request] Include type alias for cache adapter (#34155) * [cacheable-request] Include type alias for cache adapter This allows easily declaring a parameter that will be passed into the constructor. Ref https://github.com/sindresorhus/got/pull/760#discussion_r268277506 * Fix missing semicolon * Move StorageAdapter into namespace --- types/cacheable-request/index.d.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/types/cacheable-request/index.d.ts b/types/cacheable-request/index.d.ts index 98d858d3f6..16e778274a 100644 --- a/types/cacheable-request/index.d.ts +++ b/types/cacheable-request/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for cacheable-request 6.0 // Project: https://github.com/lukechilds/cacheable-request#readme // Definitions by: BendingBender +// Paul Melnikow // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -20,7 +21,7 @@ declare const CacheableRequest: CacheableRequest; type RequestFn = typeof request; interface CacheableRequest { - new (requestFn: RequestFn, storageAdapter?: string | Store): ( + new (requestFn: RequestFn, storageAdapter?: string | CacheableRequest.StorageAdapter): ( opts: string | URL | (RequestOptions & CacheSemanticsOptions), cb?: (response: ServerResponse | ResponseLike) => void ) => CacheableRequest.Emitter; @@ -30,6 +31,8 @@ interface CacheableRequest { } declare namespace CacheableRequest { + type StorageAdapter = Store; + interface Options { /** * If the cache should be used. Setting this to `false` will completely bypass the cache for the current request. From de12981020aebe17afb2c81dbe52d853285b2789 Mon Sep 17 00:00:00 2001 From: Silas Rech Date: Mon, 25 Mar 2019 17:29:06 +0100 Subject: [PATCH 058/469] [bull] allow supplying of the queue type when creating a new instance (#34154) --- types/bull/index.d.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/types/bull/index.d.ts b/types/bull/index.d.ts index 07de38e05d..648e2ba360 100644 --- a/types/bull/index.d.ts +++ b/types/bull/index.d.ts @@ -26,10 +26,12 @@ import { EventEmitter } from "events"; * Everytime the same queue is instantiated it tries to process all the old jobs that may exist from a previous unfinished session. */ declare const Bull: { - (queueName: string, opts?: Bull.QueueOptions): Bull.Queue; - (queueName: string, url: string, opts?: Bull.QueueOptions): Bull.Queue; // tslint:disable-line unified-signatures - new (queueName: string, opts?: Bull.QueueOptions): Bull.Queue; - new (queueName: string, url: string, opts?: Bull.QueueOptions): Bull.Queue; // tslint:disable-line unified-signatures + /* tslint:disable:no-unnecessary-generics unified-signatures */ + (queueName: string, opts?: Bull.QueueOptions): Bull.Queue; + (queueName: string, url: string, opts?: Bull.QueueOptions): Bull.Queue; + new (queueName: string, opts?: Bull.QueueOptions): Bull.Queue; + new (queueName: string, url: string, opts?: Bull.QueueOptions): Bull.Queue; + /* tslint:enable:no-unnecessary-generics unified-signatures */ }; declare namespace Bull { From 0cbf2d2865db2f26c696209d830d9bae99629bf9 Mon Sep 17 00:00:00 2001 From: TokugawaT_YD <41653501+TokugawaTakesi@users.noreply.github.com> Date: Tue, 26 Mar 2019 01:31:33 +0900 Subject: [PATCH 059/469] Types for gulp-tap (#31917) * Types for "gulp-tap" added * Types for "gulp-tap" added * Requested changes applied * Requested changes applied --- types/gulp-tap/gulp-tap-tests.ts | 11 +++++++++++ types/gulp-tap/index.d.ts | 22 ++++++++++++++++++++++ types/gulp-tap/tsconfig.json | 23 +++++++++++++++++++++++ types/gulp-tap/tslint.json | 3 +++ 4 files changed, 59 insertions(+) create mode 100644 types/gulp-tap/gulp-tap-tests.ts create mode 100644 types/gulp-tap/index.d.ts create mode 100644 types/gulp-tap/tsconfig.json create mode 100644 types/gulp-tap/tslint.json diff --git a/types/gulp-tap/gulp-tap-tests.ts b/types/gulp-tap/gulp-tap-tests.ts new file mode 100644 index 0000000000..7d89c50ba0 --- /dev/null +++ b/types/gulp-tap/gulp-tap-tests.ts @@ -0,0 +1,11 @@ +import gulpTap = require('gulp-tap'); +import gulp = require('gulp'); +import Vinyl = require('vinyl'); + +gulp.task('testTask', () => { + return gulp.src(['src/*.html']) + .pipe(gulpTap((sourceFile: Vinyl) => { + console.log(sourceFile.path); + })) + .pipe(gulp.dest('dist/')); +}); diff --git a/types/gulp-tap/index.d.ts b/types/gulp-tap/index.d.ts new file mode 100644 index 0000000000..30af7663f8 --- /dev/null +++ b/types/gulp-tap/index.d.ts @@ -0,0 +1,22 @@ +// Type definitions for gulp-tap 1.0 +// Project: https://github.com/geejs/gulp-tap +// Definitions by: Takesi Tokugawa +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +import Vinyl = require('vinyl'); + +declare namespace tap { + interface Tap { + (tapFunction: TapFunction, t?: any): NodeJS.ReadWriteStream; + } + + interface TapFunction { + (file: Vinyl): any; + } +} + +declare function tap(tapFunction: (file: Vinyl, t?: {}) => void): NodeJS.ReadWriteStream; + +export = tap; diff --git a/types/gulp-tap/tsconfig.json b/types/gulp-tap/tsconfig.json new file mode 100644 index 0000000000..d48ac90475 --- /dev/null +++ b/types/gulp-tap/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "gulp-tap-tests.ts" + ] +} diff --git a/types/gulp-tap/tslint.json b/types/gulp-tap/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/gulp-tap/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} From a4e52c5eb19eed6e30aaa31439cdbaadd6a75694 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matheus=20Gon=C3=A7alves=20da=20Silva?= Date: Mon, 25 Mar 2019 13:34:48 -0300 Subject: [PATCH 060/469] Add type definitions to webpack-plugin-serve (#33948) * feat(wps): add webpack-plugin-serve types * fix export method * fix declaration * add strictFunctionTypes * fix declaration problems * remove redundant declare * add correct level types * export history api interfaces * reuse koa-compress and koa-static * fix padding --- types/connect-history-api-fallback/index.d.ts | 38 +++++----- types/koa-compress/index.d.ts | 22 +++--- types/webpack-plugin-serve/index.d.ts | 69 +++++++++++++++++++ types/webpack-plugin-serve/tsconfig.json | 23 +++++++ types/webpack-plugin-serve/tslint.json | 1 + .../webpack-plugin-serve-tests.ts | 39 +++++++++++ 6 files changed, 162 insertions(+), 30 deletions(-) create mode 100644 types/webpack-plugin-serve/index.d.ts create mode 100644 types/webpack-plugin-serve/tsconfig.json create mode 100644 types/webpack-plugin-serve/tslint.json create mode 100644 types/webpack-plugin-serve/webpack-plugin-serve-tests.ts diff --git a/types/connect-history-api-fallback/index.d.ts b/types/connect-history-api-fallback/index.d.ts index a39fbfdbd6..b32e61e147 100644 --- a/types/connect-history-api-fallback/index.d.ts +++ b/types/connect-history-api-fallback/index.d.ts @@ -10,26 +10,28 @@ import { Url } from 'url'; import * as core from "express-serve-static-core"; -declare function historyApiFallback(options?: Options): core.RequestHandler; -declare namespace historyApiFallback {} export = historyApiFallback; -interface Options { - disableDotRule?: true; - htmlAcceptHeaders?: string[]; - index?: string; - logger?: typeof console.log; - rewrites?: Rewrite[]; - verbose?: boolean; -} +declare function historyApiFallback(options?: historyApiFallback.Options): core.RequestHandler; -interface Context { - match: RegExpMatchArray; - parsedUrl: Url; -} -type RewriteTo = (context: Context) => string; +declare namespace historyApiFallback { + interface Options { + disableDotRule?: true; + htmlAcceptHeaders?: string[]; + index?: string; + logger?: typeof console.log; + rewrites?: Rewrite[]; + verbose?: boolean; + } -interface Rewrite { - from: RegExp; - to: string | RegExp | RewriteTo; + interface Context { + match: RegExpMatchArray; + parsedUrl: Url; + } + type RewriteTo = (context: Context) => string; + + interface Rewrite { + from: RegExp; + to: string | RegExp | RewriteTo; + } } diff --git a/types/koa-compress/index.d.ts b/types/koa-compress/index.d.ts index 24b7a1e1af..9b0a4415be 100644 --- a/types/koa-compress/index.d.ts +++ b/types/koa-compress/index.d.ts @@ -16,12 +16,18 @@ /// /// -declare module "koa-compress" { +import * as Koa from "koa"; +import * as zlib from "zlib"; - import * as Koa from "koa"; - import * as zlib from "zlib"; +/** + * Compress middleware for Koa + */ +declare function koaCompress(options?: koaCompress.CompressOptions): Koa.Middleware; - interface CompressOptions extends zlib.ZlibOptions { +export = koaCompress; + +declare namespace koaCompress { + export interface CompressOptions extends zlib.ZlibOptions { /** * An optional function that checks the response content type to decide whether to compress. By default, it uses compressible. */ @@ -32,12 +38,4 @@ declare module "koa-compress" { */ threshold?: number } - - /** - * Compress middleware for Koa - */ - function compress(options?: CompressOptions): Koa.Middleware; - - namespace compress {} - export = compress; } diff --git a/types/webpack-plugin-serve/index.d.ts b/types/webpack-plugin-serve/index.d.ts new file mode 100644 index 0000000000..1233333ebc --- /dev/null +++ b/types/webpack-plugin-serve/index.d.ts @@ -0,0 +1,69 @@ +// Type definitions for webpack-plugin-serve 0.7 +// Project: https://github.com/shellscape/webpack-plugin-serve +// Definitions by: Matheus Gonçalves da Silva +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 +/// + +import { Url } from 'url'; +import { Config as HttpProxyMiddlewareConfig, Proxy } from 'http-proxy-middleware'; +import * as Koa from 'koa'; +import { + ServerOptions as Http2ServerOptions, + SecureServerOptions as Http2SecureServerOptions, +} from 'http2'; +import { ServerOptions as HttpsServerOptions } from 'https'; +import { ZlibOptions } from 'zlib'; +import { Compiler } from 'webpack'; +import { Options as HistoryApiFallbackOptions } from 'connect-history-api-fallback'; +import { CompressOptions } from 'koa-compress'; +import { Options as KoaStaticOptions } from 'koa-static'; + +export interface Builtins { + proxy: (args: HttpProxyMiddlewareConfig) => Proxy; + compress: (opts: CompressOptions) => void; + static: (paths: string[], opts?: KoaStaticOptions) => void; + historyFallback: (opts: HistoryApiFallbackOptions) => void; + websocket: () => void; + four0four: (fn?: (ctx: Koa.Context) => void) => void; +} + +export interface WebpackPluginServeOptions { + client?: { + address?: string; + retry?: boolean; + silent?: boolean; + }; + compress?: boolean; + historyFallback?: boolean | HistoryApiFallbackOptions; + hmr?: boolean; + host?: string | Promise; + http2?: boolean | Http2ServerOptions | Http2SecureServerOptions; + https?: HttpsServerOptions; + liveReload?: boolean; + log?: { + level: 'trace' | 'debug' | 'info' | 'warn' | 'error'; + timestamp?: boolean; + }; + middleware?: (app: Koa, builtins: Builtins) => void; + open?: + | boolean + | { + wait?: boolean; + app?: string | ReadonlyArray; + }; + port?: number | Promise; + progress?: boolean | 'minimal'; + static?: string | string[]; + status?: boolean; + waitForBuild?: boolean; +} + +export class WebpackPluginServe { + constructor(opts?: WebpackPluginServeOptions); + attach(): { + apply(compiler: Compiler): void; + }; + hook(compiler: Compiler): void; + apply(compiler: Compiler): void; +} diff --git a/types/webpack-plugin-serve/tsconfig.json b/types/webpack-plugin-serve/tsconfig.json new file mode 100644 index 0000000000..8b70e1d1d4 --- /dev/null +++ b/types/webpack-plugin-serve/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "strictFunctionTypes": true, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "webpack-plugin-serve-tests.ts" + ] +} diff --git a/types/webpack-plugin-serve/tslint.json b/types/webpack-plugin-serve/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/webpack-plugin-serve/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/webpack-plugin-serve/webpack-plugin-serve-tests.ts b/types/webpack-plugin-serve/webpack-plugin-serve-tests.ts new file mode 100644 index 0000000000..7abddcc600 --- /dev/null +++ b/types/webpack-plugin-serve/webpack-plugin-serve-tests.ts @@ -0,0 +1,39 @@ +import { WebpackPluginServe } from 'webpack-plugin-serve'; +import { Configuration } from 'webpack'; + +const usage = (config: Configuration) => { + (config.entry as string[]).push('webpack-plugin-serve/client'); + + config.watch = true; + + config.plugins!.push( + new WebpackPluginServe({ + compress: true, + historyFallback: true, + host: '0.0.0.0', + port: 3808, + liveReload: true, + middleware: (app: any, builtins: any) => + app.use(async (ctx: any, next: any) => { + await next(); + ctx.set('Access-Control-Allow-Headers', '*'); + ctx.set('Access-Control-Allow-Methods', 'GET, POST, OPTIONS'); + ctx.set('Access-Control-Allow-Origin', '*'); + }), + static: '/', + + status: true, + progress: true, + }), + ); + + config.output!.publicPath = '/'; + + return config; +}; + +const baseConfig = { + entry: 'index.js' +}; + +const configWithServer = usage(baseConfig); From 30468b4db176a0aed810d880dfc42006465dc2af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20F=C3=BCrst?= Date: Mon, 25 Mar 2019 17:36:43 +0100 Subject: [PATCH 061/469] [@types/react-color] Fix wrong color type on swatch hover (#33984) * Fix wrong type on swatch hover * Change variable name for consistency * Add user as definitions author * Change major version due to breaking changes --- types/react-color/index.d.ts | 5 +++-- types/react-color/lib/components/block/Block.d.ts | 4 ++-- types/react-color/lib/components/circle/Circle.d.ts | 2 +- types/react-color/lib/components/compact/Compact.d.ts | 4 ++-- types/react-color/lib/components/github/Github.d.ts | 4 ++-- types/react-color/lib/components/sketch/Sketch.d.ts | 4 ++-- types/react-color/lib/components/swatches/Swatches.d.ts | 4 ++-- types/react-color/lib/components/twitter/Twitter.d.ts | 4 ++-- 8 files changed, 16 insertions(+), 15 deletions(-) diff --git a/types/react-color/index.d.ts b/types/react-color/index.d.ts index 9935814feb..3e0b0f3989 100644 --- a/types/react-color/index.d.ts +++ b/types/react-color/index.d.ts @@ -1,10 +1,11 @@ -// Type definitions for react-color 2.17 +// Type definitions for react-color 3.0 // Project: https://github.com/casesandberg/react-color/, http://casesandberg.github.io/react-color // Definitions by: Karol Janyst , // Marks Polakovs , // Matthieu Montaudouin , // Nokogiri , -// 0815Strohhut +// 0815Strohhut , +// Daniel Fürst // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 diff --git a/types/react-color/lib/components/block/Block.d.ts b/types/react-color/lib/components/block/Block.d.ts index 20ea123eed..6761cf3f90 100644 --- a/types/react-color/lib/components/block/Block.d.ts +++ b/types/react-color/lib/components/block/Block.d.ts @@ -1,11 +1,11 @@ import { Component } from "react"; -import { ColorPickerProps, Color } from "../../.."; +import { ColorPickerProps, ColorResult } from "../../.."; export interface BlockPickerProps extends ColorPickerProps { colors?: string[]; width?: string; triangle?: 'hide' | 'top'; - onSwatchHover?(color: Color, event: MouseEvent): void; + onSwatchHover?(color: ColorResult, event: MouseEvent): void; } export default class BlockPicker extends Component {} diff --git a/types/react-color/lib/components/circle/Circle.d.ts b/types/react-color/lib/components/circle/Circle.d.ts index 98eec039a0..df230cf71d 100644 --- a/types/react-color/lib/components/circle/Circle.d.ts +++ b/types/react-color/lib/components/circle/Circle.d.ts @@ -6,7 +6,7 @@ export interface CirclePickerProps extends ColorPickerProps { width?: string; circleSize?: number; circleSpacing?: number; - onSwatchHover?(colorResult: ColorResult, event: MouseEvent): void; + onSwatchHover?(color: ColorResult, event: MouseEvent): void; } export default class CirclePicker extends Component {} diff --git a/types/react-color/lib/components/compact/Compact.d.ts b/types/react-color/lib/components/compact/Compact.d.ts index 5609899128..c79e331a33 100644 --- a/types/react-color/lib/components/compact/Compact.d.ts +++ b/types/react-color/lib/components/compact/Compact.d.ts @@ -1,9 +1,9 @@ import { Component } from "react"; -import { ColorPickerProps, Color } from "../../.."; +import { ColorPickerProps, ColorResult } from "../../.."; export interface CompactPickerProps extends ColorPickerProps { colors?: string[]; - onSwatchHover?(color: Color, event: MouseEvent): void; + onSwatchHover?(color: ColorResult, event: MouseEvent): void; } export default class CompactPicker extends Component {} diff --git a/types/react-color/lib/components/github/Github.d.ts b/types/react-color/lib/components/github/Github.d.ts index 18b6a21121..8155152f28 100644 --- a/types/react-color/lib/components/github/Github.d.ts +++ b/types/react-color/lib/components/github/Github.d.ts @@ -1,11 +1,11 @@ import { Component } from "react"; -import { ColorPickerProps, Color } from "../../.."; +import { ColorPickerProps, ColorResult } from "../../.."; export interface GithubPickerProps extends ColorPickerProps { colors?: string[]; width?: string; triangle?: 'hide' | 'top-left' | 'top-right'; - onSwatchHover?(color: Color, event: MouseEvent): void; + onSwatchHover?(color: ColorResult, event: MouseEvent): void; } export default class GithubPicker extends Component {} diff --git a/types/react-color/lib/components/sketch/Sketch.d.ts b/types/react-color/lib/components/sketch/Sketch.d.ts index 7aec9fb82f..bf11556a98 100644 --- a/types/react-color/lib/components/sketch/Sketch.d.ts +++ b/types/react-color/lib/components/sketch/Sketch.d.ts @@ -1,11 +1,11 @@ import { Component } from "react"; -import { ColorPickerProps, Color } from "../../.."; +import { ColorPickerProps, ColorResult } from "../../.."; export interface SketchPickerProps extends ColorPickerProps { disableAlpha?: boolean; presetColors?: string[]; width?: string; - onSwatchHover?(color: Color, event: MouseEvent): void; + onSwatchHover?(color: ColorResult, event: MouseEvent): void; } export default class SketchPicker extends Component {} diff --git a/types/react-color/lib/components/swatches/Swatches.d.ts b/types/react-color/lib/components/swatches/Swatches.d.ts index b2a7f72dc2..bf0b9dbd4a 100644 --- a/types/react-color/lib/components/swatches/Swatches.d.ts +++ b/types/react-color/lib/components/swatches/Swatches.d.ts @@ -1,11 +1,11 @@ import { Component } from "react"; -import { ColorPickerProps, Color } from "../../.."; +import { ColorPickerProps, ColorResult } from "../../.."; export interface SwatchesPickerProps extends ColorPickerProps { colors?: string[][]; height?: number; width?: number; - onSwatchHover?(color: Color, event: MouseEvent): void; + onSwatchHover?(color: ColorResult, event: MouseEvent): void; } export default class SwatchesPicker extends Component {} diff --git a/types/react-color/lib/components/twitter/Twitter.d.ts b/types/react-color/lib/components/twitter/Twitter.d.ts index 8d5eb2e6dd..73fbd6f984 100644 --- a/types/react-color/lib/components/twitter/Twitter.d.ts +++ b/types/react-color/lib/components/twitter/Twitter.d.ts @@ -1,11 +1,11 @@ import { Component } from "react"; -import { ColorPickerProps, Color } from "../../.."; +import { ColorPickerProps, ColorResult } from "../../.."; export interface TwitterPickerProps extends ColorPickerProps { colors?: string[]; width?: string; triangle?: 'hide' | 'top-left' | 'top-right'; - onSwatchHover?(color: Color, event: MouseEvent): void; + onSwatchHover?(color: ColorResult, event: MouseEvent): void; } export default class TwitterPicker extends Component {} From d9437c4fd6e18bccc0784d1dbe1604fa4535d287 Mon Sep 17 00:00:00 2001 From: James Nimlos Date: Mon, 25 Mar 2019 09:38:31 -0700 Subject: [PATCH 062/469] Update fluent definitions for v0.11 (#33859) * update fluent definitions for v0.11 * remove circular reference * add typescript version requiring fix * downgrade ts version definitelytyped-header-parser errors on prereleases versions but TS v3.4 is not actually released so it also errors --- types/fluent-react/index.d.ts | 4 ++-- types/fluent/fluent-tests.ts | 6 ++++++ types/fluent/index.d.ts | 6 ++++-- types/fluent/tsconfig.json | 1 + 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/types/fluent-react/index.d.ts b/types/fluent-react/index.d.ts index 5ffc93d874..b3fa7c9dec 100644 --- a/types/fluent-react/index.d.ts +++ b/types/fluent-react/index.d.ts @@ -2,7 +2,7 @@ // Project: http://projectfluent.org // Definitions by: Huy Nguyen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.8 +// TypeScript Version: 3.3 import * as React from 'react'; import { @@ -76,7 +76,7 @@ export type Matching = { */ export type Shared< InjectedProps, - DecorationTargetProps extends Shared + DecorationTargetProps > = { [P in Extract]?: InjectedProps[P] extends DecorationTargetProps[P] ? DecorationTargetProps[P] : never; }; diff --git a/types/fluent/fluent-tests.ts b/types/fluent/fluent-tests.ts index d2fcd4a6c4..90b4bffa61 100644 --- a/types/fluent/fluent-tests.ts +++ b/types/fluent/fluent-tests.ts @@ -29,6 +29,7 @@ const bundle4 = new FluentBundle(['en-US'], { // FluentBundle addMessages examples: bundle1.addMessages('foo = Foo'); +bundle2.hasMessage('foo'); bundle2.getMessage('foo'); // FluentBundle addResource examples: @@ -42,3 +43,8 @@ bundle1.addMessages('hello = Hello, { $name }!'); const hello = bundle2.getMessage('hello'); bundle3.format(hello, { name: 'Jane' }, errors2); bundle3.format(hello, undefined, errors2); + +for (const [id, message] of bundle1.messages) { + bundle1.getMessage(id); + bundle1.format(message); +} diff --git a/types/fluent/index.d.ts b/types/fluent/index.d.ts index 56014044ab..8520443354 100644 --- a/types/fluent/index.d.ts +++ b/types/fluent/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for fluent 0.10 +// Type definitions for fluent 0.11 // Project: http://projectfluent.org -// Definitions by: Huy Nguyen +// Definitions by: Huy Nguyen , James Nimlos // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -28,6 +28,8 @@ export class FluentResource extends Map { export class FluentBundle { constructor(locales: string | string[], options?: FluentBundleContructorOptions); + messages: IterableIterator<[string, FluentNode[]]>; + hasMessage(source: string): boolean; addMessages(source: string): string[]; getMessage(id: string): FluentNode[]; format(message: FluentNode[], args?: object, errors?: string[]): string; diff --git a/types/fluent/tsconfig.json b/types/fluent/tsconfig.json index 64e2460dcd..c08fe97570 100644 --- a/types/fluent/tsconfig.json +++ b/types/fluent/tsconfig.json @@ -4,6 +4,7 @@ "lib": [ "es6" ], + "target": "es6", "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, From 3c9fd4a6920d779cbfecffc296b0054559ab02a1 Mon Sep 17 00:00:00 2001 From: Johan Davidsson Date: Mon, 25 Mar 2019 17:39:20 +0100 Subject: [PATCH 063/469] [@types/htmlparser2] Update typings for Htmlparser2 (and related modules) to match updates (#33921) * Added new types for domelementtype * Modify existing types for htmlparser2 * Updating PULL_REQUEST_TEMPLATE.md * Revert changes to .github/PULL_REQUEST_TEMPLATE.md * Fixed missing optional * Adding DomUtils * Update dependencies * Removed requirement for TypeScript 2.1 and updated test * Updated test to include DomUtils and DomHandlerOptions. * Updated domhandler tests * Remove incorrect constructor in Parser * Remove incorrect constructor in WritableStream * Change way of importing in tests * Adding deprecated fallback to Options * Add deprecated Options as a fallback to sanitize-html * Add ParserOptions * Use the deprecated Options --- types/domhandler/domhandler-tests.ts | 8 +-- types/domhandler/index.d.ts | 1 - types/domutils/index.d.ts | 1 - types/htmlparser2/htmlparser2-tests.ts | 37 ++++++++------ types/htmlparser2/index.d.ts | 68 ++++++++++++++++++-------- types/sanitize-html/index.d.ts | 1 + 6 files changed, 74 insertions(+), 42 deletions(-) diff --git a/types/domhandler/domhandler-tests.ts b/types/domhandler/domhandler-tests.ts index eea6441ad7..4b1c5406ec 100644 --- a/types/domhandler/domhandler-tests.ts +++ b/types/domhandler/domhandler-tests.ts @@ -1,6 +1,6 @@ -import { DomHandler, DomHandlerOptions, Node } from "domhandler"; +import { DomHandler, DomHandlerOptions, Node, DomElement } from "domhandler"; -const handler = new DomHandler((error: Error, dom: any) => { +const handler = new DomHandler((error: Error, dom: DomElement[]) => { if (error) console.error('There has been an error...'); else @@ -8,7 +8,7 @@ const handler = new DomHandler((error: Error, dom: any) => { }); handler.ontext = (data: string) => { console.log(data); }; handler.onreset = () => { console.log('We have a reset.'); }; -handler.onerror = (error: Error) => { console.error(Error); }; -handler.onopentag = (name: string, attribs) => { console.log(name, attribs); }; +handler.onerror = (error: Error) => { console.error(error); }; +handler.onopentag = (name: string, attribs: { [s: string]: string }) => { console.log(name, attribs); }; const dho: DomHandlerOptions = { normalizeWhitespace: true, withDomLvl1: true, withEndIndices: true, withStartIndices: true }; diff --git a/types/domhandler/index.d.ts b/types/domhandler/index.d.ts index 9d33055bbd..49dcd6325f 100644 --- a/types/domhandler/index.d.ts +++ b/types/domhandler/index.d.ts @@ -2,7 +2,6 @@ // Project: https://github.com/fb55/DomHandler#readme // Definitions by: Johan Davidsson // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.1 export interface DomHandlerOptions { /*** diff --git a/types/domutils/index.d.ts b/types/domutils/index.d.ts index 5300a68a8c..6790f9bf82 100644 --- a/types/domutils/index.d.ts +++ b/types/domutils/index.d.ts @@ -2,7 +2,6 @@ // Project: https://github.com/FB55/domutils#readme // Definitions by: Johan Davidsson // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.1 import { DomElement } from "domhandler"; /*** diff --git a/types/htmlparser2/htmlparser2-tests.ts b/types/htmlparser2/htmlparser2-tests.ts index 21289b96f5..807f2fe904 100644 --- a/types/htmlparser2/htmlparser2-tests.ts +++ b/types/htmlparser2/htmlparser2-tests.ts @@ -1,23 +1,30 @@ /** * Created by staticfunction on 8/4/14. */ -import htmlparser = require("htmlparser2"); +import htmlparser = require('htmlparser2'); -var parser = new htmlparser.Parser({ - onopentag: (name:string, attribs:{[s:string]:string}) => { - if(name === "script" && attribs['type'] === "text/javascript"){ - console.log("JS! Hooray!"); - } - }, - ontext: (text: string) => { - console.log("-->", text); - }, - onclosetag: (tagname:string) => { - if(tagname === "script"){ - console.log("That's it?!"); - } +const options: htmlparser.DomHandlerOptions = { withEndIndices: false, withDomLvl1: true } +const dh = new htmlparser.DomHandler((err: Error, dom: htmlparser.DomElement[]) => { + if(err) { + throw err; } -}); + + // Use DomUtils to get name of first element in dom + console.log(htmlparser.DomUtils.getName(dom[0])); +}, options); +dh.onopentag = (name:string, attribs:{[s:string]:string}) => { + if(name === "script" && attribs['type'] === "text/javascript"){ + console.log("JS! Hooray!"); + } +}; +dh.ontext = (text: string) => { + console.log("-->", text); +}; +dh.onclosetag = () => { + console.log("That's it?!"); +}; + +var parser = new htmlparser.Parser(dh); parser.write("Xyz "); parser.end(); diff --git a/types/htmlparser2/index.d.ts b/types/htmlparser2/index.d.ts index 313ff56a96..c10dea047e 100644 --- a/types/htmlparser2/index.d.ts +++ b/types/htmlparser2/index.d.ts @@ -1,30 +1,20 @@ -// Type definitions for htmlparser2 v3.7.x +// Type definitions for htmlparser2 v3.10.x // Project: https://github.com/fb55/htmlparser2/ // Definitions by: James Roland Cabresos // Linus Unnebäck +// Johan Davidsson // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// +/// +/// import { Writable } from 'stream' +import { DomHandler } from 'domhandler'; +import * as DomUtils from 'domutils'; +export { DomElement, DomHandlerOptions, DomHandler, Element, Node } from 'domhandler'; -export interface Handler { - onopentag?: (name: string, attribs: { [type: string]: string }) => void; - onopentagname?: (name: string) => void; - onattribute?: (name: string, value: string) => void; - ontext?: (text: string) => void; - onclosetag?: (text: string) => void; - onprocessinginstruction?: (name: string, data: string) => void; - oncomment?: (data: string) => void; - oncommentend?: () => void; - oncdatastart?: () => void; - oncdataend?: () => void; - onerror?: (error: Error) => void; - onreset?: () => void; - onend?: () => void; -} - -export interface Options { +export interface ParserOptions { /*** * Indicates whether special tags ("); parser.end(); diff --git a/types/htmlparser2/index.d.ts b/types/htmlparser2/index.d.ts index 313ff56a96..c10dea047e 100644 --- a/types/htmlparser2/index.d.ts +++ b/types/htmlparser2/index.d.ts @@ -1,30 +1,20 @@ -// Type definitions for htmlparser2 v3.7.x +// Type definitions for htmlparser2 v3.10.x // Project: https://github.com/fb55/htmlparser2/ // Definitions by: James Roland Cabresos // Linus Unnebäck +// Johan Davidsson // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// +/// +/// import { Writable } from 'stream' +import { DomHandler } from 'domhandler'; +import * as DomUtils from 'domutils'; +export { DomElement, DomHandlerOptions, DomHandler, Element, Node } from 'domhandler'; -export interface Handler { - onopentag?: (name: string, attribs: { [type: string]: string }) => void; - onopentagname?: (name: string) => void; - onattribute?: (name: string, value: string) => void; - ontext?: (text: string) => void; - onclosetag?: (text: string) => void; - onprocessinginstruction?: (name: string, data: string) => void; - oncomment?: (data: string) => void; - oncommentend?: () => void; - oncdatastart?: () => void; - oncdataend?: () => void; - onerror?: (error: Error) => void; - onreset?: () => void; - onend?: () => void; -} - -export interface Options { +export interface ParserOptions { /*** * Indicates whether special tags (