From a364bb7a8caa2dceb212f1dfe3c58f4cb3fb5b87 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Thu, 9 Nov 2017 13:55:03 -0800 Subject: [PATCH 1/3] Fix incorrect tuple usage and syntax --- types/aws-lambda/index.d.ts | 4 ++-- types/fingerprintjs2/index.d.ts | 2 +- types/fixed-data-table/fixed-data-table-tests.tsx | 2 +- types/heredatalens/index.d.ts | 2 +- types/highcharts/index.d.ts | 6 +++--- types/highcharts/test/index.ts | 10 +++++----- types/leaflet/leaflet-tests.ts | 7 ++++--- types/validate.js/index.d.ts | 2 +- types/xml2js/index.d.ts | 8 ++++---- 9 files changed, 22 insertions(+), 21 deletions(-) diff --git a/types/aws-lambda/index.d.ts b/types/aws-lambda/index.d.ts index 523aafd41f..342d489d68 100644 --- a/types/aws-lambda/index.d.ts +++ b/types/aws-lambda/index.d.ts @@ -331,9 +331,9 @@ interface PolicyDocument { * http://docs.aws.amazon.com/apigateway/latest/developerguide/use-custom-authorizer.html#api-gateway-custom-authorizer-output */ interface Statement { - Action: string | [string]; + Action: string | string[]; Effect: string; - Resource: string | [string]; + Resource: string | string[]; } /** diff --git a/types/fingerprintjs2/index.d.ts b/types/fingerprintjs2/index.d.ts index c9fc9b2a39..94b705b807 100644 --- a/types/fingerprintjs2/index.d.ts +++ b/types/fingerprintjs2/index.d.ts @@ -13,7 +13,7 @@ declare class Fingerprint2 { interface Fingerprint2Options { swfContainerId?: string; swfPath?: string; - userDefinedFonts?: [string]; + userDefinedFonts?: string[]; excludeUserAgent?: boolean; excludeLanguage?: boolean; excludeColorDepth?: boolean; diff --git a/types/fixed-data-table/fixed-data-table-tests.tsx b/types/fixed-data-table/fixed-data-table-tests.tsx index cdbd46eb6c..bb09fedcaf 100644 --- a/types/fixed-data-table/fixed-data-table-tests.tsx +++ b/types/fixed-data-table/fixed-data-table-tests.tsx @@ -36,7 +36,7 @@ class MyTable2 extends React.Component { // provide Custom Data interface MyTable3State { - myTableData: [{name: string}]; + myTableData: {name: string}[]; } class MyTable3 extends React.Component<{}, MyTable3State> { diff --git a/types/heredatalens/index.d.ts b/types/heredatalens/index.d.ts index 0fcf4dc3e1..cb9a4d7807 100644 --- a/types/heredatalens/index.d.ts +++ b/types/heredatalens/index.d.ts @@ -141,7 +141,7 @@ declare namespace H.datalens { /** Column names */ columns: string[]; /** Rows of data */ - rows: [any[]]; + rows: any[][]; } } diff --git a/types/highcharts/index.d.ts b/types/highcharts/index.d.ts index b026403b48..a79441dd47 100644 --- a/types/highcharts/index.d.ts +++ b/types/highcharts/index.d.ts @@ -1036,7 +1036,7 @@ declare namespace Highcharts { * Datetime axis only. An array determining what time intervals the ticks are allowed to fall on. Each array item is * an array where the first value is the time unit and the second value another array of allowed multiples. */ - units?: [[string, [number]]]; + units?: [string, number[]][]; /** * Whether axis, including axis title, line, ticks and labels, should be visible. * @default true @@ -2040,7 +2040,7 @@ declare namespace Highcharts { * switchRowsAndColumns is set, the columns are interpreted as series. * @since 4.0 */ - columns?: Array<[string | number]>; + columns?: Array>; /** * The callback that is evaluated when the data is finished loading, optionally from an external source, and parsed. * The first argument passed is a finished chart options object, containing the series. These options can be @@ -6575,7 +6575,7 @@ declare namespace Highcharts { * a subset is supported: absolute moveTo (M), absolute lineTo (L), absolute curveTo (C) and close (Z). * @param path An SVG path split up in array form. */ - path(path: [string | number]): ElementObject; + path(path: (string | number)[]): ElementObject; /** * Add a rectangle. * @param x The x position of the rectangle's upper left corner. diff --git a/types/highcharts/test/index.ts b/types/highcharts/test/index.ts index e96a0665e8..717e875362 100644 --- a/types/highcharts/test/index.ts +++ b/types/highcharts/test/index.ts @@ -1345,11 +1345,11 @@ function test_BoxPlot() { series: [{ name: 'Observations', data: [ - [760, 801, 848, 895, 965], - [733, 853, 939, 980, 1080], - [714, 762, 817, 870, 918], - [724, 802, 806, 871, 950], - [834, 836, 864, 882, 910] + 760, 801, 848, 895, 965, + 733, 853, 939, 980, 1080, + 714, 762, 817, 870, 918, + 724, 802, 806, 871, 950, + 834, 836, 864, 882, 910 ] }] }); diff --git a/types/leaflet/leaflet-tests.ts b/types/leaflet/leaflet-tests.ts index b85c8bf4d7..3315d33bc0 100644 --- a/types/leaflet/leaflet-tests.ts +++ b/types/leaflet/leaflet-tests.ts @@ -380,12 +380,13 @@ draggable.disable(); draggable.on('drag', () => {}); let twoCoords: [number, number] = [1, 2]; +let outCoords: [number, number] | [number, number, number]; latLng = L.GeoJSON.coordsToLatLng(twoCoords); -twoCoords = L.GeoJSON.latLngToCoords(latLng); +outCoords = L.GeoJSON.latLngToCoords(latLng); -let threeCoords: [number, number] = [1, 2]; +let threeCoords: [number, number, number] = [1, 2, 3]; latLng = L.GeoJSON.coordsToLatLng(threeCoords); -threeCoords = L.GeoJSON.latLngToCoords(latLng); +outCoords = L.GeoJSON.latLngToCoords(latLng); let nestedTwoCoords = [ [12, 13], [13, 14], [14, 15] ]; const nestedLatLngs: L.LatLng[] = L.GeoJSON.coordsToLatLngs(nestedTwoCoords, 1); diff --git a/types/validate.js/index.d.ts b/types/validate.js/index.d.ts index 35754e844c..ed0a964d3e 100644 --- a/types/validate.js/index.d.ts +++ b/types/validate.js/index.d.ts @@ -84,7 +84,7 @@ declare namespace ValidateJS { export interface Presence extends Validator {} export interface Url extends Validator { - schemes?: [string | RegExp]; + schemes?: (string | RegExp)[]; allowLocal?: boolean; } } diff --git a/types/xml2js/index.d.ts b/types/xml2js/index.d.ts index 59af909a09..6685185376 100644 --- a/types/xml2js/index.d.ts +++ b/types/xml2js/index.d.ts @@ -31,8 +31,8 @@ export class Parser extends EventEmitter { export interface Options { async?: boolean; attrkey?: string; - attrNameProcessors?: [(name: string) => any]; - attrValueProcessors?: [(name: string) => any]; + attrNameProcessors?: ((name: string) => any)[]; + attrValueProcessors?: ((name: string) => any)[]; charkey?: string; charsAsChildren?: boolean; childkey?: string; @@ -47,10 +47,10 @@ export interface Options { normalize?: boolean; normalizeTags?: boolean; strict?: boolean; - tagNameProcessors?: [(name: string) => any]; + tagNameProcessors?: ((name: string) => any)[]; trim?: boolean; validator?: Function; - valueProcessors?: [(name: string) => any]; + valueProcessors?: ((name: string) => any)[]; xmlns?: boolean; } From 75f3e71531a4c89dd4b791ea6bca36918652bd64 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Thu, 9 Nov 2017 14:10:02 -0800 Subject: [PATCH 2/3] leaflet:Cast back to original coords --- types/leaflet/leaflet-tests.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/types/leaflet/leaflet-tests.ts b/types/leaflet/leaflet-tests.ts index 3315d33bc0..04e1b08f27 100644 --- a/types/leaflet/leaflet-tests.ts +++ b/types/leaflet/leaflet-tests.ts @@ -380,13 +380,12 @@ draggable.disable(); draggable.on('drag', () => {}); let twoCoords: [number, number] = [1, 2]; -let outCoords: [number, number] | [number, number, number]; latLng = L.GeoJSON.coordsToLatLng(twoCoords); -outCoords = L.GeoJSON.latLngToCoords(latLng); +twoCoords = L.GeoJSON.latLngToCoords(latLng) as [number, number]; let threeCoords: [number, number, number] = [1, 2, 3]; latLng = L.GeoJSON.coordsToLatLng(threeCoords); -outCoords = L.GeoJSON.latLngToCoords(latLng); +threeCoords = L.GeoJSON.latLngToCoords(latLng) as [number, number, number]; let nestedTwoCoords = [ [12, 13], [13, 14], [14, 15] ]; const nestedLatLngs: L.LatLng[] = L.GeoJSON.coordsToLatLngs(nestedTwoCoords, 1); From 1667c4c45b78bbeefbf3c4d7865d37eaeac1bbb2 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Thu, 9 Nov 2017 14:27:41 -0800 Subject: [PATCH 3/3] lint:Use Array<> for non-simple array types --- types/highcharts/index.d.ts | 4 ++-- types/xml2js/index.d.ts | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/types/highcharts/index.d.ts b/types/highcharts/index.d.ts index a79441dd47..3ce85ed9e2 100644 --- a/types/highcharts/index.d.ts +++ b/types/highcharts/index.d.ts @@ -1036,7 +1036,7 @@ declare namespace Highcharts { * Datetime axis only. An array determining what time intervals the ticks are allowed to fall on. Each array item is * an array where the first value is the time unit and the second value another array of allowed multiples. */ - units?: [string, number[]][]; + units?: Array<[string, number[]]>; /** * Whether axis, including axis title, line, ticks and labels, should be visible. * @default true @@ -6575,7 +6575,7 @@ declare namespace Highcharts { * a subset is supported: absolute moveTo (M), absolute lineTo (L), absolute curveTo (C) and close (Z). * @param path An SVG path split up in array form. */ - path(path: (string | number)[]): ElementObject; + path(path: Array): ElementObject; /** * Add a rectangle. * @param x The x position of the rectangle's upper left corner. diff --git a/types/xml2js/index.d.ts b/types/xml2js/index.d.ts index 6685185376..9e228c6784 100644 --- a/types/xml2js/index.d.ts +++ b/types/xml2js/index.d.ts @@ -31,8 +31,8 @@ export class Parser extends EventEmitter { export interface Options { async?: boolean; attrkey?: string; - attrNameProcessors?: ((name: string) => any)[]; - attrValueProcessors?: ((name: string) => any)[]; + attrNameProcessors?: Array<(name: string) => any>; + attrValueProcessors?: Array<(name: string) => any>; charkey?: string; charsAsChildren?: boolean; childkey?: string; @@ -47,10 +47,10 @@ export interface Options { normalize?: boolean; normalizeTags?: boolean; strict?: boolean; - tagNameProcessors?: ((name: string) => any)[]; + tagNameProcessors?: Array<(name: string) => any>; trim?: boolean; validator?: Function; - valueProcessors?: ((name: string) => any)[]; + valueProcessors?: Array<(name: string) => any>; xmlns?: boolean; }