From 5251033d220a1a1958e8519ac671c2fca2dec7cb Mon Sep 17 00:00:00 2001 From: Hugues Stefanski Date: Sun, 27 Jan 2019 13:00:35 +0100 Subject: [PATCH] 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.