From 0f4e20b7fa690c18ead85bee5280e73c407ecd5b Mon Sep 17 00:00:00 2001 From: AdrianFarmadin Date: Fri, 5 May 2017 17:28:52 +0200 Subject: [PATCH 001/357] Point, Polygon definitions --- types/rethinkdb/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/rethinkdb/index.d.ts b/types/rethinkdb/index.d.ts index f375a50fc7..94130520d1 100644 --- a/types/rethinkdb/index.d.ts +++ b/types/rethinkdb/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for RethinkDB 2.3 // Project: http://rethinkdb.com/ // Definitions by: Alex Gorbatchev +// Definitions by: Adrian Farmadin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // // Reference: https://rethinkdb.com/api/javascript/ From 96b6817d5e442e2c5329af0c5e860d11dc60d6db Mon Sep 17 00:00:00 2001 From: AdrianFarmadin Date: Fri, 5 May 2017 17:30:47 +0200 Subject: [PATCH 002/357] Point, Polygon definitions --- types/rethinkdb/index.d.ts | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/types/rethinkdb/index.d.ts b/types/rethinkdb/index.d.ts index 94130520d1..a4cbd64313 100644 --- a/types/rethinkdb/index.d.ts +++ b/types/rethinkdb/index.d.ts @@ -1,7 +1,7 @@ // Type definitions for RethinkDB 2.3 // Project: http://rethinkdb.com/ // Definitions by: Alex Gorbatchev -// Definitions by: Adrian Farmadin +// Definitions by: Adrian Farmadin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // // Reference: https://rethinkdb.com/api/javascript/ @@ -38,6 +38,9 @@ declare module "rethinkdb" { export function asc(property: string): Sort; export function desc(property: string): Sort; + export function point(lng: number, lat: number): Point; + export function polygon(...point: Point[]): Polygon; + export var count: Aggregator; export function sum(prop: string): Aggregator; export function avg(prop: string): Aggregator; @@ -222,6 +225,18 @@ declare module "rethinkdb" { * See: https://rethinkdb.com/api/javascript/has_fields/ */ hasFields(...fields: string[]): T; + } + + interface Geometry { + + } + + interface Point { + + } + + interface Polygon extends Geometry { + } interface Table extends Sequence, HasFields { @@ -235,6 +250,8 @@ declare module "rethinkdb" { get(key: string): Sequence; // primary key getAll(key: string, index?: Index): Sequence; // without index defaults to primary key getAll(...keys: string[]): Sequence; + + getIntersecting(geometry: Geometry, index: Index): Sequence; } interface Sequence extends Operation, Writeable { From dc86e5222e397c382a99c36219f8fe5679a9ffa7 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Fri, 5 May 2017 09:56:00 -0700 Subject: [PATCH 003/357] fix header --- types/rethinkdb/index.d.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/types/rethinkdb/index.d.ts b/types/rethinkdb/index.d.ts index a4cbd64313..afe672468e 100644 --- a/types/rethinkdb/index.d.ts +++ b/types/rethinkdb/index.d.ts @@ -1,7 +1,6 @@ // Type definitions for RethinkDB 2.3 // Project: http://rethinkdb.com/ -// Definitions by: Alex Gorbatchev -// Definitions by: Adrian Farmadin +// Definitions by: Alex Gorbatchev , Adrian Farmadin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // // Reference: https://rethinkdb.com/api/javascript/ From 836e57e76558b4a97189c4ccf65c751807db7655 Mon Sep 17 00:00:00 2001 From: Kyle Buzby Date: Fri, 1 Sep 2017 13:54:42 -0500 Subject: [PATCH 004/357] Update dts-gen example with proper command line option --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4b16884273..5631d78375 100644 --- a/README.md +++ b/README.md @@ -119,7 +119,7 @@ Your package should have this structure: | tsconfig.json | This allows you to run `tsc` within the package. | | tslint.json | Enables linting. | -Generate these by running `npm install -g dts-gen` and `dts-gen --dt --name my-package-name --template module`. +Generate these by running `npm install -g dts-gen` and `dts-gen --dt --name my-package-name --module module`. See all options at [dts-gen](https://github.com/Microsoft/dts-gen). You may edit the `tsconfig.json` to add new files, to add `"target": "es6"` (needed for async functions), to add to `"lib"`, or to add the `"jsx"` compiler option. From a02acb4da8a2bf72e49533956e7a24253a82d915 Mon Sep 17 00:00:00 2001 From: Hugues Stefanski Date: Sat, 7 Oct 2017 17:38:07 +0200 Subject: [PATCH 005/357] Updated d3-geo to reflect version 1.9.0: added fitWidth and fitHeight methods --- types/d3-geo/index.d.ts | 61 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 58 insertions(+), 3 deletions(-) diff --git a/types/d3-geo/index.d.ts b/types/d3-geo/index.d.ts index 6860031224..75f23d94a2 100644 --- a/types/d3-geo/index.d.ts +++ b/types/d3-geo/index.d.ts @@ -1,9 +1,9 @@ -// Type definitions for D3JS d3-geo module 1.8 +// Type definitions for D3JS d3-geo module 1.9 // Project: https://github.com/d3/d3-geo/ // Definitions by: Hugues Stefanski , Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// Last module patch version validated against: 1.8.1 +// Last module patch version validated against: 1.9.0 import * as GeoJSON from 'geojson'; @@ -804,7 +804,62 @@ export interface GeoProjection extends GeoStreamWrapper { * @param object A geographic geometry collection supported by d3-geo (An extension of GeoJSON geometry collection). */ fitSize(size: [number, number], object: ExtendedGeometryCollection): this; - + /** + *A convenience method for projection.fitSize where the height is automatically chosen from the aspect ratio of object and the given constraint on width. + * + * @param width The width of the extent. + * @param object A geographic feature supported by d3-geo (An extension of GeoJSON feature). + */ + fitWidth(width: number, object: ExtendedFeature): this; + /** + *A convenience method for projection.fitSize where the height is automatically chosen from the aspect ratio of object and the given constraint on width. + * + * @param width The width of the extent. + * @param object A GeoJson Geometry Object or GeoSphere object supported by d3-geo (An extension of GeoJSON). + */ + fitWidth(width: number, object: ExtendedFeatureCollection>): this; + /** + *A convenience method for projection.fitSize where the height is automatically chosen from the aspect ratio of object and the given constraint on width. + * + * @param width The width of the extent. + * @param object A geographic feature supported by d3-geo (An extension of GeoJSON feature). + */ + fitWidth(width: number, object: GeoGeometryObjects): this; + /** + *A convenience method for projection.fitSize where the height is automatically chosen from the aspect ratio of object and the given constraint on width. + * + * @param width The width of the extent. + * @param object A geographic geometry collection supported by d3-geo (An extension of GeoJSON geometry collection). + */ + fitWidth(width: number, object: ExtendedGeometryCollection): this; + /** + *A convenience method for projection.fitSize where the width is automatically chosen from the aspect ratio of object and the given constraint on height. + * + * @param height The height of the extent. + * @param object A geographic feature supported by d3-geo (An extension of GeoJSON feature). + */ + fitHeight(height: number, object: ExtendedFeature): this; + /** + *A convenience method for projection.fitSize where the width is automatically chosen from the aspect ratio of object and the given constraint on height. + * + * @param height The height of the extent. + * @param object A GeoJson Geometry Object or GeoSphere object supported by d3-geo (An extension of GeoJSON). + */ + fitHeight(height: number, object: ExtendedFeatureCollection>): this; + /** + *A convenience method for projection.fitSize where the width is automatically chosen from the aspect ratio of object and the given constraint on height. + * + * @param height The height of the extent. + * @param object A geographic feature supported by d3-geo (An extension of GeoJSON feature). + */ + fitHeight(height: number, object: GeoGeometryObjects): this; + /** + *A convenience method for projection.fitSize where the width is automatically chosen from the aspect ratio of object and the given constraint on height. + * + * @param height The height of the extent. + * @param object A geographic geometry collection supported by d3-geo (An extension of GeoJSON geometry collection). + */ + fitHeight(height: number, object: ExtendedGeometryCollection): this; /** * Returns a new array [longitude, latitude] in degrees representing the unprojected point of the given projected point. * May return null if the specified point has no defined projected position, such as when the point is outside the clipping bounds of the projection. From 1194c013de62f1aa8092de15fbbf426c1f92523b Mon Sep 17 00:00:00 2001 From: Hugues Stefanski Date: Sat, 7 Oct 2017 19:32:08 +0200 Subject: [PATCH 006/357] Fix asterisk position --- types/d3-geo/index.d.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/types/d3-geo/index.d.ts b/types/d3-geo/index.d.ts index 75f23d94a2..1a3ae3d295 100644 --- a/types/d3-geo/index.d.ts +++ b/types/d3-geo/index.d.ts @@ -806,56 +806,56 @@ export interface GeoProjection extends GeoStreamWrapper { fitSize(size: [number, number], object: ExtendedGeometryCollection): this; /** *A convenience method for projection.fitSize where the height is automatically chosen from the aspect ratio of object and the given constraint on width. - * + * * @param width The width of the extent. * @param object A geographic feature supported by d3-geo (An extension of GeoJSON feature). */ fitWidth(width: number, object: ExtendedFeature): this; /** *A convenience method for projection.fitSize where the height is automatically chosen from the aspect ratio of object and the given constraint on width. - * + * * @param width The width of the extent. * @param object A GeoJson Geometry Object or GeoSphere object supported by d3-geo (An extension of GeoJSON). */ fitWidth(width: number, object: ExtendedFeatureCollection>): this; /** *A convenience method for projection.fitSize where the height is automatically chosen from the aspect ratio of object and the given constraint on width. - * + * * @param width The width of the extent. * @param object A geographic feature supported by d3-geo (An extension of GeoJSON feature). */ fitWidth(width: number, object: GeoGeometryObjects): this; /** *A convenience method for projection.fitSize where the height is automatically chosen from the aspect ratio of object and the given constraint on width. - * + * * @param width The width of the extent. * @param object A geographic geometry collection supported by d3-geo (An extension of GeoJSON geometry collection). */ fitWidth(width: number, object: ExtendedGeometryCollection): this; /** *A convenience method for projection.fitSize where the width is automatically chosen from the aspect ratio of object and the given constraint on height. - * + * * @param height The height of the extent. * @param object A geographic feature supported by d3-geo (An extension of GeoJSON feature). */ fitHeight(height: number, object: ExtendedFeature): this; /** *A convenience method for projection.fitSize where the width is automatically chosen from the aspect ratio of object and the given constraint on height. - * + * * @param height The height of the extent. * @param object A GeoJson Geometry Object or GeoSphere object supported by d3-geo (An extension of GeoJSON). */ fitHeight(height: number, object: ExtendedFeatureCollection>): this; /** *A convenience method for projection.fitSize where the width is automatically chosen from the aspect ratio of object and the given constraint on height. - * + * * @param height The height of the extent. * @param object A geographic feature supported by d3-geo (An extension of GeoJSON feature). */ fitHeight(height: number, object: GeoGeometryObjects): this; /** *A convenience method for projection.fitSize where the width is automatically chosen from the aspect ratio of object and the given constraint on height. - * + * * @param height The height of the extent. * @param object A geographic geometry collection supported by d3-geo (An extension of GeoJSON geometry collection). */ From 9fba8310108c681596ea5ec70fcd290fca72a92c Mon Sep 17 00:00:00 2001 From: Hugues Stefanski Date: Sat, 7 Oct 2017 19:53:36 +0200 Subject: [PATCH 007/357] Missing space --- types/d3-geo/index.d.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/types/d3-geo/index.d.ts b/types/d3-geo/index.d.ts index 1a3ae3d295..4d9def3565 100644 --- a/types/d3-geo/index.d.ts +++ b/types/d3-geo/index.d.ts @@ -805,56 +805,56 @@ export interface GeoProjection extends GeoStreamWrapper { */ fitSize(size: [number, number], object: ExtendedGeometryCollection): this; /** - *A convenience method for projection.fitSize where the height is automatically chosen from the aspect ratio of object and the given constraint on width. + * A convenience method for projection.fitSize where the height is automatically chosen from the aspect ratio of object and the given constraint on width. * * @param width The width of the extent. * @param object A geographic feature supported by d3-geo (An extension of GeoJSON feature). */ fitWidth(width: number, object: ExtendedFeature): this; /** - *A convenience method for projection.fitSize where the height is automatically chosen from the aspect ratio of object and the given constraint on width. + * A convenience method for projection.fitSize where the height is automatically chosen from the aspect ratio of object and the given constraint on width. * * @param width The width of the extent. * @param object A GeoJson Geometry Object or GeoSphere object supported by d3-geo (An extension of GeoJSON). */ fitWidth(width: number, object: ExtendedFeatureCollection>): this; /** - *A convenience method for projection.fitSize where the height is automatically chosen from the aspect ratio of object and the given constraint on width. + * A convenience method for projection.fitSize where the height is automatically chosen from the aspect ratio of object and the given constraint on width. * * @param width The width of the extent. * @param object A geographic feature supported by d3-geo (An extension of GeoJSON feature). */ fitWidth(width: number, object: GeoGeometryObjects): this; /** - *A convenience method for projection.fitSize where the height is automatically chosen from the aspect ratio of object and the given constraint on width. + * A convenience method for projection.fitSize where the height is automatically chosen from the aspect ratio of object and the given constraint on width. * * @param width The width of the extent. * @param object A geographic geometry collection supported by d3-geo (An extension of GeoJSON geometry collection). */ fitWidth(width: number, object: ExtendedGeometryCollection): this; /** - *A convenience method for projection.fitSize where the width is automatically chosen from the aspect ratio of object and the given constraint on height. + * A convenience method for projection.fitSize where the width is automatically chosen from the aspect ratio of object and the given constraint on height. * * @param height The height of the extent. * @param object A geographic feature supported by d3-geo (An extension of GeoJSON feature). */ fitHeight(height: number, object: ExtendedFeature): this; /** - *A convenience method for projection.fitSize where the width is automatically chosen from the aspect ratio of object and the given constraint on height. + * A convenience method for projection.fitSize where the width is automatically chosen from the aspect ratio of object and the given constraint on height. * * @param height The height of the extent. * @param object A GeoJson Geometry Object or GeoSphere object supported by d3-geo (An extension of GeoJSON). */ fitHeight(height: number, object: ExtendedFeatureCollection>): this; /** - *A convenience method for projection.fitSize where the width is automatically chosen from the aspect ratio of object and the given constraint on height. + * A convenience method for projection.fitSize where the width is automatically chosen from the aspect ratio of object and the given constraint on height. * * @param height The height of the extent. * @param object A geographic feature supported by d3-geo (An extension of GeoJSON feature). */ fitHeight(height: number, object: GeoGeometryObjects): this; /** - *A convenience method for projection.fitSize where the width is automatically chosen from the aspect ratio of object and the given constraint on height. + * A convenience method for projection.fitSize where the width is automatically chosen from the aspect ratio of object and the given constraint on height. * * @param height The height of the extent. * @param object A geographic geometry collection supported by d3-geo (An extension of GeoJSON geometry collection). From c4fdefb8d39e84b0d17d3b34a0e447829df9137e Mon Sep 17 00:00:00 2001 From: Hugues Stefanski Date: Sat, 7 Oct 2017 22:26:28 +0200 Subject: [PATCH 008/357] Added spacing between methods --- types/d3-geo/index.d.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/types/d3-geo/index.d.ts b/types/d3-geo/index.d.ts index 4d9def3565..40ec500f90 100644 --- a/types/d3-geo/index.d.ts +++ b/types/d3-geo/index.d.ts @@ -804,6 +804,7 @@ export interface GeoProjection extends GeoStreamWrapper { * @param object A geographic geometry collection supported by d3-geo (An extension of GeoJSON geometry collection). */ fitSize(size: [number, number], object: ExtendedGeometryCollection): this; + /** * A convenience method for projection.fitSize where the height is automatically chosen from the aspect ratio of object and the given constraint on width. * @@ -832,6 +833,7 @@ export interface GeoProjection extends GeoStreamWrapper { * @param object A geographic geometry collection supported by d3-geo (An extension of GeoJSON geometry collection). */ fitWidth(width: number, object: ExtendedGeometryCollection): this; + /** * A convenience method for projection.fitSize where the width is automatically chosen from the aspect ratio of object and the given constraint on height. * @@ -860,6 +862,7 @@ export interface GeoProjection extends GeoStreamWrapper { * @param object A geographic geometry collection supported by d3-geo (An extension of GeoJSON geometry collection). */ fitHeight(height: number, object: ExtendedGeometryCollection): this; + /** * Returns a new array [longitude, latitude] in degrees representing the unprojected point of the given projected point. * May return null if the specified point has no defined projected position, such as when the point is outside the clipping bounds of the projection. From 8b26070d2a557744ec6581df8338f758263fe1bc Mon Sep 17 00:00:00 2001 From: Hugues Stefanski Date: Sun, 8 Oct 2017 10:06:28 +0200 Subject: [PATCH 009/357] Added tests for d3-geo `fitHeight` and `fitWidth` --- types/d3-geo/d3-geo-tests.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/types/d3-geo/d3-geo-tests.ts b/types/d3-geo/d3-geo-tests.ts index 4d423aa5a3..876461e3e9 100644 --- a/types/d3-geo/d3-geo-tests.ts +++ b/types/d3-geo/d3-geo-tests.ts @@ -422,6 +422,26 @@ constructedProjection = constructedProjection.fitSize([960, 500], sampleExtended constructedProjection = constructedProjection.fitSize([960, 500], sampleFeatureCollection); constructedProjection = constructedProjection.fitSize([960, 500], sampleExtendedFeatureCollection); +constructedProjection = constructedProjection.fitWidth(960, samplePolygon); +constructedProjection = constructedProjection.fitWidth(960, sampleSphere); +constructedProjection = constructedProjection.fitWidth(960, sampleGeometryCollection); +constructedProjection = constructedProjection.fitWidth(960, sampleExtendedGeometryCollection); +constructedProjection = constructedProjection.fitWidth(960, sampleFeature); +constructedProjection = constructedProjection.fitWidth(960, sampleExtendedFeature1); +constructedProjection = constructedProjection.fitWidth(960, sampleExtendedFeature2); +constructedProjection = constructedProjection.fitWidth(960, sampleFeatureCollection); +constructedProjection = constructedProjection.fitWidth(960, sampleExtendedFeatureCollection); + +constructedProjection = constructedProjection.fitHeight(500, samplePolygon); +constructedProjection = constructedProjection.fitHeight(500, sampleSphere); +constructedProjection = constructedProjection.fitHeight(500, sampleGeometryCollection); +constructedProjection = constructedProjection.fitHeight(500, sampleExtendedGeometryCollection); +constructedProjection = constructedProjection.fitHeight(500, sampleFeature); +constructedProjection = constructedProjection.fitHeight(500, sampleExtendedFeature1); +constructedProjection = constructedProjection.fitHeight(500, sampleExtendedFeature2); +constructedProjection = constructedProjection.fitHeight(500, sampleFeatureCollection); +constructedProjection = constructedProjection.fitHeight(500, sampleExtendedFeatureCollection); + // ---------------------------------------------------------------------- // GeoConicProjection interface // ---------------------------------------------------------------------- From 2a858618c3f721512c52cbf8bbe943d8b7be4931 Mon Sep 17 00:00:00 2001 From: Hugues Stefanski Date: Mon, 29 Jan 2018 20:44:25 +0100 Subject: [PATCH 010/357] Backbone for d3-fetch --- types/d3-fetch/d3-fetch-tests.ts | 0 types/d3-fetch/index.d.ts | 5 +++++ types/d3-fetch/tsconfig.json | 22 ++++++++++++++++++++++ types/d3-fetch/tslint.json | 1 + 4 files changed, 28 insertions(+) create mode 100644 types/d3-fetch/d3-fetch-tests.ts create mode 100644 types/d3-fetch/index.d.ts create mode 100644 types/d3-fetch/tsconfig.json create mode 100644 types/d3-fetch/tslint.json diff --git a/types/d3-fetch/d3-fetch-tests.ts b/types/d3-fetch/d3-fetch-tests.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/types/d3-fetch/index.d.ts b/types/d3-fetch/index.d.ts new file mode 100644 index 0000000000..f5b195ca04 --- /dev/null +++ b/types/d3-fetch/index.d.ts @@ -0,0 +1,5 @@ +// Type definitions for d3-fetch 1.0.1 +// Project: https://d3js.org/d3-fetch/ +// Definitions by: Hugues Stefanski +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + diff --git a/types/d3-fetch/tsconfig.json b/types/d3-fetch/tsconfig.json new file mode 100644 index 0000000000..d4e382e338 --- /dev/null +++ b/types/d3-fetch/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "d3-fetch-tests.ts" + ] +} diff --git a/types/d3-fetch/tslint.json b/types/d3-fetch/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/d3-fetch/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From d25d2ee1b42624281a7a36bbe2daf7970ecb02a8 Mon Sep 17 00:00:00 2001 From: Hugues Stefanski Date: Mon, 29 Jan 2018 21:12:59 +0100 Subject: [PATCH 011/357] Completed fetch API --- types/d3-fetch/d3-fetch-tests.ts | 15 ++++++++++++ types/d3-fetch/index.d.ts | 42 ++++++++++++++++++++++++++++++++ types/d3-fetch/tsconfig.json | 3 ++- 3 files changed, 59 insertions(+), 1 deletion(-) diff --git a/types/d3-fetch/d3-fetch-tests.ts b/types/d3-fetch/d3-fetch-tests.ts index e69de29bb2..b82ea8ffbe 100644 --- a/types/d3-fetch/d3-fetch-tests.ts +++ b/types/d3-fetch/d3-fetch-tests.ts @@ -0,0 +1,15 @@ +import * as d3Fetch from 'd3-fetch'; + +interface MyType { + foo: string; +} + +let promise: Promise; +const url = 'foo.bar'; + +const init: RequestInit = {}; + +promise = d3Fetch.blob(url); +promise = d3Fetch.blob(url, init); +promise = d3Fetch.buffer(url); +promise = d3Fetch.buffer(url, init); diff --git a/types/d3-fetch/index.d.ts b/types/d3-fetch/index.d.ts index f5b195ca04..f46a779003 100644 --- a/types/d3-fetch/index.d.ts +++ b/types/d3-fetch/index.d.ts @@ -3,3 +3,45 @@ // Definitions by: Hugues Stefanski // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +/**Fetches the binary file at the specified input URL as a Blob. */ +export function blob(input: string): Promise; +/**Fetches the binary file at the specified input URL as a Blob. Passes init along to the underlying call to fetch. */ +export function blob(input: string, init: RequestInit): Promise; +/**Fetches the binary file at the specified input URL as an ArrayBuffer. */ +export function buffer(input: string): Promise; +/**Fetches the binary file at the specified input URL as an ArrayBuffer. Passes init along to the underlying call to fetch. */ +export function buffer(input: string, init: RequestInit): Promise; + +/**Equivalent to d3.dsv with the comma character as the delimiter. */ +export function csv(input: string): Promise; +/**Equivalent to d3.dsv with the comma character as the delimiter. */ +export function csv(input: string, init: RequestInit): Promise; +/**Equivalent to d3.dsv with the comma character as the delimiter. */ +export function csv(input: string, init: RequestInit, row: (d: any) => any): Promise; + +/**Fetches the DSV file at the specified input URL. */ +export function dsv(delimiter: string, input: string): Promise; +export function dsv(delimiter: string, input: string, init: RequestInit): Promise; +export function dsv(delimiter: string, input: string, init: RequestInit, row: any): Promise; + +/**Fetches the image at the specified input URL. */ +export function image(input: string): Promise; +/**Fetches the image at the specified input URL. Passes init along to the underlying call to fetch. */ +export function image(input: string, init: RequestInit): Promise; + +/**Fetches the json file at the specified input URL. */ +export function json(input: string): Promise; +/**Fetches the json file at the specified input URL. Passes init along to the underlying call to fetch. */ +export function json(input: string, init: RequestInit): Promise; + +/**Fetches the text file at the specified input URL. */ +export function text(input: string): Promise; +/**Fetches the text file at the specified input URL. Passes init along to the underlying call to fetch. */ +export function text(input: string, init: RequestInit): Promise; + +/**Equivalent to d3.dsv with the tab character as the delimiter. */ +export function tsv(input: string): Promise; +/**Equivalent to d3.dsv with the tab character as the delimiter. */ +export function tsv(input: string, init: RequestInit): Promise; +/**Equivalent to d3.dsv with the tab character as the delimiter. */ +export function tsv(input: string, init: RequestInit, row: (d: any) => any): Promise; diff --git a/types/d3-fetch/tsconfig.json b/types/d3-fetch/tsconfig.json index d4e382e338..4d18bd9ade 100644 --- a/types/d3-fetch/tsconfig.json +++ b/types/d3-fetch/tsconfig.json @@ -2,7 +2,8 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6" + "es2017", + "dom" ], "noImplicitAny": true, "noImplicitThis": true, From a1e32e69642cd3ca0f7a80946412e138d5649982 Mon Sep 17 00:00:00 2001 From: Hugues Stefanski Date: Mon, 29 Jan 2018 21:23:56 +0100 Subject: [PATCH 012/357] Strong typings of parsing methods --- types/d3-fetch/index.d.ts | 55 +++++++++++++++++++++++++-------------- 1 file changed, 36 insertions(+), 19 deletions(-) diff --git a/types/d3-fetch/index.d.ts b/types/d3-fetch/index.d.ts index f46a779003..6a62630808 100644 --- a/types/d3-fetch/index.d.ts +++ b/types/d3-fetch/index.d.ts @@ -3,45 +3,62 @@ // Definitions by: Hugues Stefanski // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +import { DSVParsedArray, DSVRowString, DSVRowAny } from 'd3-dsv'; + /**Fetches the binary file at the specified input URL as a Blob. */ -export function blob(input: string): Promise; +export function blob(url: string): Promise; /**Fetches the binary file at the specified input URL as a Blob. Passes init along to the underlying call to fetch. */ -export function blob(input: string, init: RequestInit): Promise; +export function blob(url: string, init: RequestInit): Promise; /**Fetches the binary file at the specified input URL as an ArrayBuffer. */ -export function buffer(input: string): Promise; +export function buffer(url: string): Promise; /**Fetches the binary file at the specified input URL as an ArrayBuffer. Passes init along to the underlying call to fetch. */ -export function buffer(input: string, init: RequestInit): Promise; +export function buffer(url: string, init: RequestInit): Promise; /**Equivalent to d3.dsv with the comma character as the delimiter. */ -export function csv(input: string): Promise; +export function csv(url: string): Promise>; /**Equivalent to d3.dsv with the comma character as the delimiter. */ -export function csv(input: string, init: RequestInit): Promise; +export function csv(url: string, init: RequestInit): Promise>; /**Equivalent to d3.dsv with the comma character as the delimiter. */ -export function csv(input: string, init: RequestInit, row: (d: any) => any): Promise; +export function csv( + url: string, + init: RequestInit, + row: (d: DSVRowAny) => ParsedRow +): Promise>; /**Fetches the DSV file at the specified input URL. */ -export function dsv(delimiter: string, input: string): Promise; -export function dsv(delimiter: string, input: string, init: RequestInit): Promise; -export function dsv(delimiter: string, input: string, init: RequestInit, row: any): Promise; +export function dsv(delimiter: string, url: string): Promise>; +/**Fetches the DSV file at the specified input URL. */ +export function dsv(delimiter: string, url: string, init: RequestInit): Promise>; +/**Fetches the DSV file at the specified input URL. */ +export function dsv( + delimiter: string, + url: string, + init: RequestInit, + row: (d: DSVRowAny) => ParsedRow +): Promise>; /**Fetches the image at the specified input URL. */ -export function image(input: string): Promise; +export function image(url: string): Promise; /**Fetches the image at the specified input URL. Passes init along to the underlying call to fetch. */ -export function image(input: string, init: RequestInit): Promise; +export function image(url: string, init: RequestInit): Promise; /**Fetches the json file at the specified input URL. */ -export function json(input: string): Promise; +export function json(url: string): Promise; /**Fetches the json file at the specified input URL. Passes init along to the underlying call to fetch. */ -export function json(input: string, init: RequestInit): Promise; +export function json(url: string, init: RequestInit): Promise; /**Fetches the text file at the specified input URL. */ -export function text(input: string): Promise; +export function text(url: string): Promise; /**Fetches the text file at the specified input URL. Passes init along to the underlying call to fetch. */ -export function text(input: string, init: RequestInit): Promise; +export function text(url: string, init: RequestInit): Promise; /**Equivalent to d3.dsv with the tab character as the delimiter. */ -export function tsv(input: string): Promise; +export function tsv(url: string): Promise>; /**Equivalent to d3.dsv with the tab character as the delimiter. */ -export function tsv(input: string, init: RequestInit): Promise; +export function tsv(url: string, init: RequestInit): Promise>; /**Equivalent to d3.dsv with the tab character as the delimiter. */ -export function tsv(input: string, init: RequestInit, row: (d: any) => any): Promise; +export function tsv( + url: string, + init: RequestInit, + row: (d: DSVRowAny) => ParsedRow +): Promise>; From 1d9a51fd97c2496378fb4507c390aa46ec75db7f Mon Sep 17 00:00:00 2001 From: Hugues Stefanski Date: Mon, 29 Jan 2018 21:29:16 +0100 Subject: [PATCH 013/357] Partial d3-fetch tests --- types/d3-fetch/d3-fetch-tests.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/types/d3-fetch/d3-fetch-tests.ts b/types/d3-fetch/d3-fetch-tests.ts index b82ea8ffbe..9c88ed8674 100644 --- a/types/d3-fetch/d3-fetch-tests.ts +++ b/types/d3-fetch/d3-fetch-tests.ts @@ -13,3 +13,10 @@ promise = d3Fetch.blob(url); promise = d3Fetch.blob(url, init); promise = d3Fetch.buffer(url); promise = d3Fetch.buffer(url, init); + +promise = d3Fetch.image(url); +promise = d3Fetch.image(url, init); +promise = d3Fetch.json(url); +promise = d3Fetch.json(url, init); +let myString: Promise = d3Fetch.text(url); +myString = d3Fetch.text(url, init); From 24c16d91da489001a967cc03e9fdb5915c6ec66b Mon Sep 17 00:00:00 2001 From: Hugues Stefanski Date: Mon, 29 Jan 2018 21:36:08 +0100 Subject: [PATCH 014/357] Completed tests for d3-fetch --- types/d3-fetch/d3-fetch-tests.ts | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/types/d3-fetch/d3-fetch-tests.ts b/types/d3-fetch/d3-fetch-tests.ts index 9c88ed8674..1dfff0e04f 100644 --- a/types/d3-fetch/d3-fetch-tests.ts +++ b/types/d3-fetch/d3-fetch-tests.ts @@ -1,4 +1,5 @@ import * as d3Fetch from 'd3-fetch'; +import { DSVParsedArray, DSVRowString, DSVRowAny } from 'd3-dsv'; interface MyType { foo: string; @@ -13,10 +14,26 @@ promise = d3Fetch.blob(url); promise = d3Fetch.blob(url, init); promise = d3Fetch.buffer(url); promise = d3Fetch.buffer(url, init); - promise = d3Fetch.image(url); promise = d3Fetch.image(url, init); promise = d3Fetch.json(url); promise = d3Fetch.json(url, init); -let myString: Promise = d3Fetch.text(url); + +let myString: Promise; +myString = d3Fetch.text(url); myString = d3Fetch.text(url, init); + +const parseRow = (d: {}) => { + const myType: MyType = { foo: 'foo' }; + return myType; +}; +let promise2: Promise>; +promise2 = d3Fetch.csv(url); +promise2 = d3Fetch.csv(url, init); +promise2 = d3Fetch.csv(url, init, parseRow); +promise2 = d3Fetch.dsv(';', url); +promise2 = d3Fetch.dsv(';', url, init); +promise2 = d3Fetch.dsv(';', url, init, parseRow); +promise2 = d3Fetch.tsv(url); +promise2 = d3Fetch.tsv(url, init); +promise2 = d3Fetch.tsv(url, init, parseRow); From 86f5c0fe17177d25f20ed82aefb71b29366b8a67 Mon Sep 17 00:00:00 2001 From: Hugues Stefanski Date: Mon, 29 Jan 2018 21:40:18 +0100 Subject: [PATCH 015/357] Reste library to es6 in d3-fetch --- types/d3-fetch/tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/d3-fetch/tsconfig.json b/types/d3-fetch/tsconfig.json index 4d18bd9ade..ea7938966e 100644 --- a/types/d3-fetch/tsconfig.json +++ b/types/d3-fetch/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es2017", + "es6", "dom" ], "noImplicitAny": true, From e8920bb7a943e2cc28a4f62f5192be9961bf4a5b Mon Sep 17 00:00:00 2001 From: Hugues Stefanski Date: Mon, 29 Jan 2018 22:04:52 +0100 Subject: [PATCH 016/357] Fix linting errors --- types/d3-fetch/index.d.ts | 62 ++++++++++++------------------------ types/d3-fetch/tsconfig.json | 1 + 2 files changed, 21 insertions(+), 42 deletions(-) diff --git a/types/d3-fetch/index.d.ts b/types/d3-fetch/index.d.ts index 6a62630808..6d4d4c7303 100644 --- a/types/d3-fetch/index.d.ts +++ b/types/d3-fetch/index.d.ts @@ -1,64 +1,42 @@ -// Type definitions for d3-fetch 1.0.1 +// Type definitions for d3-fetch 1.0 // Project: https://d3js.org/d3-fetch/ // Definitions by: Hugues Stefanski // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped import { DSVParsedArray, DSVRowString, DSVRowAny } from 'd3-dsv'; -/**Fetches the binary file at the specified input URL as a Blob. */ -export function blob(url: string): Promise; -/**Fetches the binary file at the specified input URL as a Blob. Passes init along to the underlying call to fetch. */ -export function blob(url: string, init: RequestInit): Promise; -/**Fetches the binary file at the specified input URL as an ArrayBuffer. */ -export function buffer(url: string): Promise; -/**Fetches the binary file at the specified input URL as an ArrayBuffer. Passes init along to the underlying call to fetch. */ -export function buffer(url: string, init: RequestInit): Promise; +/** Fetches the binary file at the specified input URL as a Blob. If init is specified, it is passed along to the underlying call to fetch. */ +export function blob(url: string, init?: RequestInit): Promise; +/** Fetches the binary file at the specified input URL as an ArrayBuffer. If init is specified, it is passed along to the underlying call to fetch. */ +export function buffer(url: string, init?: RequestInit): Promise; -/**Equivalent to d3.dsv with the comma character as the delimiter. */ -export function csv(url: string): Promise>; -/**Equivalent to d3.dsv with the comma character as the delimiter. */ -export function csv(url: string, init: RequestInit): Promise>; -/**Equivalent to d3.dsv with the comma character as the delimiter. */ +/** Equivalent to d3.dsv with the comma character as the delimiter. */ export function csv( url: string, - init: RequestInit, - row: (d: DSVRowAny) => ParsedRow + init?: RequestInit, + row?: (d: DSVRowAny) => ParsedRow ): Promise>; -/**Fetches the DSV file at the specified input URL. */ -export function dsv(delimiter: string, url: string): Promise>; -/**Fetches the DSV file at the specified input URL. */ -export function dsv(delimiter: string, url: string, init: RequestInit): Promise>; -/**Fetches the DSV file at the specified input URL. */ +/** Fetches the DSV file at the specified input URL. */ export function dsv( delimiter: string, url: string, - init: RequestInit, - row: (d: DSVRowAny) => ParsedRow + init?: RequestInit, + row?: (d: DSVRowAny) => ParsedRow ): Promise>; -/**Fetches the image at the specified input URL. */ -export function image(url: string): Promise; -/**Fetches the image at the specified input URL. Passes init along to the underlying call to fetch. */ -export function image(url: string, init: RequestInit): Promise; +/** Fetches the image at the specified input URL. If init is specified, it is passed along to the underlying call to fetch. */ +export function image(url: string, init?: RequestInit): Promise; -/**Fetches the json file at the specified input URL. */ -export function json(url: string): Promise; -/**Fetches the json file at the specified input URL. Passes init along to the underlying call to fetch. */ -export function json(url: string, init: RequestInit): Promise; +/** Fetches the json file at the specified input URL. If init is specified, it is passed along to the underlying call to fetch. */ +export function json(url: string, init?: RequestInit): Promise; -/**Fetches the text file at the specified input URL. */ -export function text(url: string): Promise; -/**Fetches the text file at the specified input URL. Passes init along to the underlying call to fetch. */ -export function text(url: string, init: RequestInit): Promise; +/** Fetches the text file at the specified input URL. If init is specified, it is passed along to the underlying call to fetch. */ +export function text(url: string, init?: RequestInit): Promise; -/**Equivalent to d3.dsv with the tab character as the delimiter. */ -export function tsv(url: string): Promise>; -/**Equivalent to d3.dsv with the tab character as the delimiter. */ -export function tsv(url: string, init: RequestInit): Promise>; -/**Equivalent to d3.dsv with the tab character as the delimiter. */ +/** Equivalent to d3.dsv with the tab character as the delimiter. */ export function tsv( url: string, - init: RequestInit, - row: (d: DSVRowAny) => ParsedRow + init?: RequestInit, + row?: (d: DSVRowAny) => ParsedRow ): Promise>; diff --git a/types/d3-fetch/tsconfig.json b/types/d3-fetch/tsconfig.json index ea7938966e..f9b9d190dd 100644 --- a/types/d3-fetch/tsconfig.json +++ b/types/d3-fetch/tsconfig.json @@ -8,6 +8,7 @@ "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, + "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ "../" From 0134384872fa0cbc434c25de5d8af358c491dd5e Mon Sep 17 00:00:00 2001 From: Hugues Stefanski Date: Mon, 29 Jan 2018 22:11:21 +0100 Subject: [PATCH 017/357] tentative fix TS 2.1 --- types/d3-fetch/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/d3-fetch/index.d.ts b/types/d3-fetch/index.d.ts index 6d4d4c7303..103f0f505c 100644 --- a/types/d3-fetch/index.d.ts +++ b/types/d3-fetch/index.d.ts @@ -2,7 +2,7 @@ // Project: https://d3js.org/d3-fetch/ // Definitions by: Hugues Stefanski // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - +// TypeScript Version: 2.2 import { DSVParsedArray, DSVRowString, DSVRowAny } from 'd3-dsv'; /** Fetches the binary file at the specified input URL as a Blob. If init is specified, it is passed along to the underlying call to fetch. */ From ba310edd776755af165cac8b52a9b74ede22e135 Mon Sep 17 00:00:00 2001 From: Hugues Stefanski Date: Wed, 31 Jan 2018 21:27:37 +0100 Subject: [PATCH 018/357] Specific types for d3-fetch --- types/d3-fetch/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/d3-fetch/index.d.ts b/types/d3-fetch/index.d.ts index 103f0f505c..16cce19e70 100644 --- a/types/d3-fetch/index.d.ts +++ b/types/d3-fetch/index.d.ts @@ -6,9 +6,9 @@ import { DSVParsedArray, DSVRowString, DSVRowAny } from 'd3-dsv'; /** Fetches the binary file at the specified input URL as a Blob. If init is specified, it is passed along to the underlying call to fetch. */ -export function blob(url: string, init?: RequestInit): Promise; +export function blob(url: string, init?: RequestInit): Promise; /** Fetches the binary file at the specified input URL as an ArrayBuffer. If init is specified, it is passed along to the underlying call to fetch. */ -export function buffer(url: string, init?: RequestInit): Promise; +export function buffer(url: string, init?: RequestInit): Promise; /** Equivalent to d3.dsv with the comma character as the delimiter. */ export function csv( @@ -26,7 +26,7 @@ export function dsv( ): Promise>; /** Fetches the image at the specified input URL. If init is specified, it is passed along to the underlying call to fetch. */ -export function image(url: string, init?: RequestInit): Promise; +export function image(url: string, init?: RequestInit): Promise; /** Fetches the json file at the specified input URL. If init is specified, it is passed along to the underlying call to fetch. */ export function json(url: string, init?: RequestInit): Promise; From 284c05386176ddd79c1aeab96d002186b1d0dea3 Mon Sep 17 00:00:00 2001 From: Hugues Stefanski Date: Wed, 31 Jan 2018 21:32:28 +0100 Subject: [PATCH 019/357] Fix test on d3-fetch --- types/d3-fetch/d3-fetch-tests.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/types/d3-fetch/d3-fetch-tests.ts b/types/d3-fetch/d3-fetch-tests.ts index 1dfff0e04f..dc4729fced 100644 --- a/types/d3-fetch/d3-fetch-tests.ts +++ b/types/d3-fetch/d3-fetch-tests.ts @@ -10,12 +10,12 @@ const url = 'foo.bar'; const init: RequestInit = {}; -promise = d3Fetch.blob(url); -promise = d3Fetch.blob(url, init); -promise = d3Fetch.buffer(url); -promise = d3Fetch.buffer(url, init); -promise = d3Fetch.image(url); -promise = d3Fetch.image(url, init); +let p1: Promise = d3Fetch.blob(url); +p1 = d3Fetch.blob(url, init); +let p2: Promise = d3Fetch.buffer(url); +p2 = d3Fetch.buffer(url, init); +let p3: Promise = d3Fetch.image(url); +p3 = d3Fetch.image(url, init); promise = d3Fetch.json(url); promise = d3Fetch.json(url, init); From 1c607f2fc49ccf15b10a06d1b05f55b193c74175 Mon Sep 17 00:00:00 2001 From: Hugues Stefanski Date: Wed, 31 Jan 2018 21:40:53 +0100 Subject: [PATCH 020/357] Removed generic used only once for json function in d3-fetch --- types/d3-fetch/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/d3-fetch/index.d.ts b/types/d3-fetch/index.d.ts index 16cce19e70..9fd19fe8ed 100644 --- a/types/d3-fetch/index.d.ts +++ b/types/d3-fetch/index.d.ts @@ -29,7 +29,7 @@ export function dsv( export function image(url: string, init?: RequestInit): Promise; /** Fetches the json file at the specified input URL. If init is specified, it is passed along to the underlying call to fetch. */ -export function json(url: string, init?: RequestInit): Promise; +export function json(url: string, init?: RequestInit): Promise<{}>; /** Fetches the text file at the specified input URL. If init is specified, it is passed along to the underlying call to fetch. */ export function text(url: string, init?: RequestInit): Promise; From 06b18847055218f1bbea97461d4d80fd215d25fa Mon Sep 17 00:00:00 2001 From: Hugues Stefanski Date: Wed, 31 Jan 2018 21:41:43 +0100 Subject: [PATCH 021/357] Fix d3-fetch test --- types/d3-fetch/d3-fetch-tests.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/types/d3-fetch/d3-fetch-tests.ts b/types/d3-fetch/d3-fetch-tests.ts index dc4729fced..24c6783997 100644 --- a/types/d3-fetch/d3-fetch-tests.ts +++ b/types/d3-fetch/d3-fetch-tests.ts @@ -5,7 +5,6 @@ interface MyType { foo: string; } -let promise: Promise; const url = 'foo.bar'; const init: RequestInit = {}; @@ -16,8 +15,8 @@ let p2: Promise = d3Fetch.buffer(url); p2 = d3Fetch.buffer(url, init); let p3: Promise = d3Fetch.image(url); p3 = d3Fetch.image(url, init); -promise = d3Fetch.json(url); -promise = d3Fetch.json(url, init); +let p4: Promise = d3Fetch.json(url); +p4 = d3Fetch.json(url, init); let myString: Promise; myString = d3Fetch.text(url); From 570c7db5d8b02755269dc32e2faf97088d418fc5 Mon Sep 17 00:00:00 2001 From: Andrea Ascari Date: Wed, 7 Feb 2018 17:34:36 +0100 Subject: [PATCH 022/357] Created react-native-auth0 types --- types/react-native-auth0/index.d.ts | 171 ++++++++++++++++++ .../react-native-auth0-tests.ts | 66 +++++++ types/react-native-auth0/tsconfig.json | 17 ++ types/react-native-auth0/tslint.json | 7 + 4 files changed, 261 insertions(+) create mode 100644 types/react-native-auth0/index.d.ts create mode 100644 types/react-native-auth0/react-native-auth0-tests.ts create mode 100644 types/react-native-auth0/tsconfig.json create mode 100644 types/react-native-auth0/tslint.json diff --git a/types/react-native-auth0/index.d.ts b/types/react-native-auth0/index.d.ts new file mode 100644 index 0000000000..45016da9ca --- /dev/null +++ b/types/react-native-auth0/index.d.ts @@ -0,0 +1,171 @@ +// Type definitions for react-native 1.2 +// Project: https://github.com/auth0/react-native-auth0 +// Definitions by: Andrea Ascari +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +/** + * Auth + */ + +export interface AuthorizationUrlParams { + responseType: string; + redirectUri: string; + state: string; +} + +export interface CreateUserParams { + email: string; + username?: string; + password: string; + connection: string; + metadata?: T; +} + +export interface CreateUserResponse { + Id: string; + emailVerified: boolean; + email: string; +} + +export interface ExchangeParams { + code: string; + redirectUri: string; + verifier: string; +} + +export interface LogoutParams { + federated: boolean; + clientId?: string; + returnTo?: string; +} + +export interface PasswordRealmParams { + username: string; + password: string; + realm: string; + audience?: string; + scope?: string; +} + +export interface PasswordRealmResponse { + accessToken: string; + expiresIn: number; + idToken: string; + scope: string; + tokenType: "Bearer"; +} + +export interface RefreshTokenParams { + refreshToken: string; + scope?: string; +} + +export interface RevokeParams { + refreshToken: string; +} + +export interface UserInfoParams { + token: string; +} + +export interface UserInfo { + email: string; + emailVerified: boolean; + name: string; + nickname: string; + picture: string; + sub: string; + updatedAt: string; +} +export class Auth { + authorizationUrl(params: AuthorizationUrlParams): string; + createUser(user: CreateUserParams): Promise; + exchange(params: ExchangeParams): Promise; + logoutUrl(params: LogoutParams): string; + passwordRealm(params: PasswordRealmParams): Promise; + + refreshToken(params: RefreshTokenParams): Promise; + revoke(params: RevokeParams): Promise; + userInfo(params: UserInfoParams): Promise; +} + +/** + * Users + */ +export interface Auth0User { + created_at: string; + email: string; + emailVerified: boolean; + identities: any[]; + last_ip?: string; + last_login?: string; + logins_count: number; + name: string; + nickname: string; + picture?: string; + updated_at: string; + userId: string; + userMetadata?: T; +} + +export interface GetUserParams { + id: string; +} + +export interface PatchUserParams { + id: string; + metadata: T; +} + +export class Users { + constructor(options: UsersOptions); + /* tslint:disable-next-line no-unnecessary-generics */ + getUser(parameters: GetUserParams): Promise>; + patchUser( + parameters: PatchUserParams + ): Promise>; +} + +export const users: Users; + +/** + * Web Auth + */ +export interface AuthorizeParams { + state?: string; + nonce?: string; + audience?: string; + scope?: string; +} + +export interface ClearSessionParams { + federated: boolean; +} + +export class WebAuth { + authorize(parameters: AuthorizeParams): Promise; + clearSession(parameters: ClearSessionParams): Promise; +} + +export interface UsersOptions { + baseUrl: Options["domain"]; + token: string; +} + +export interface Options { + domain: string; + clientId: string; +} + +/** + * Auth0 + */ + +export default class Auth0 { + auth: Auth; + webAuth: WebAuth; + constructor(options: Options); + + users(token: string): Users; +} diff --git a/types/react-native-auth0/react-native-auth0-tests.ts b/types/react-native-auth0/react-native-auth0-tests.ts new file mode 100644 index 0000000000..53eca829eb --- /dev/null +++ b/types/react-native-auth0/react-native-auth0-tests.ts @@ -0,0 +1,66 @@ +import Auth0, { UserInfo } from "react-native-auth0"; + +const auth0 = new Auth0({ + domain: "definitely-typed", + clientId: "definitely-typed" +}); + +auth0.auth.createUser({ + email: "me@example.com", + username: "johndoe", + password: "password", + connection: "db-connection" +}); + +auth0.auth.authorizationUrl({ + responseType: "json", + redirectUri: "http://localhost:3000", + state: "my-state" +}); + +auth0.auth.exchange({ + code: "my-code", + redirectUri: "http://localhost:3000", + verifier: "verifier" +}); + +auth0.auth.logoutUrl({ + federated: true, + clientId: "client-id", + returnTo: "http://localhost:3000" +}); + +auth0.auth.passwordRealm({ + username: "me@example.com", + password: "password", + realm: "realm", + audience: "user-info" +}); + +auth0.auth.refreshToken({ + refreshToken: "refresh-token", + scope: "openid" +}); + +auth0.auth.revoke({ + refreshToken: "refresh-token" +}); + +auth0.auth.userInfo({ + token: "token" +}); + +auth0.webAuth.authorize({ + state: "state", + nonce: "nonce", + scope: "openid" +}); + +auth0.webAuth.clearSession({ federated: false }); + +auth0.users("token").getUser({ id: "userId" }); + +auth0.users("token").patchUser<{ firstName: string; lastName: string }>({ + id: "userId", + metadata: { firstName: "John", lastName: "Dow" } +}); diff --git a/types/react-native-auth0/tsconfig.json b/types/react-native-auth0/tsconfig.json new file mode 100644 index 0000000000..f694a107be --- /dev/null +++ b/types/react-native-auth0/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "react-native-auth0-tests.ts"] +} diff --git a/types/react-native-auth0/tslint.json b/types/react-native-auth0/tslint.json new file mode 100644 index 0000000000..fd90cce501 --- /dev/null +++ b/types/react-native-auth0/tslint.json @@ -0,0 +1,7 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + // Lowercase `object` is available in TypeScript 2.2 only. + "ban-types": false + } +} From 4531a3601c108cf612d9a57c92773e5a0ceba2e4 Mon Sep 17 00:00:00 2001 From: samuelneff Date: Wed, 14 Feb 2018 04:56:11 +0000 Subject: [PATCH 023/357] Typings for MUI's React libary (muicss/react) --- types/muicss-react/index.d.ts | 264 ++++++++++++++++++++++ types/muicss-react/muicss-react-tests.tsx | 203 +++++++++++++++++ types/muicss-react/tsconfig.json | 27 +++ types/muicss-react/tslint.json | 17 ++ 4 files changed, 511 insertions(+) create mode 100644 types/muicss-react/index.d.ts create mode 100644 types/muicss-react/muicss-react-tests.tsx create mode 100644 types/muicss-react/tsconfig.json create mode 100644 types/muicss-react/tslint.json diff --git a/types/muicss-react/index.d.ts b/types/muicss-react/index.d.ts new file mode 100644 index 0000000000..65982f21af --- /dev/null +++ b/types/muicss-react/index.d.ts @@ -0,0 +1,264 @@ +// Type definitions for muicss React bindings v09.36 +// Project: https://www.muicss.com/ +// Definitions by: Samuel Neff +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +/// + +declare module "muicss/react" { + export import Appbar = Muicss.Appbar; + export import Button = Muicss.Button; + export import Checkbox = Muicss.Checkbox; + export import Col = Muicss.Col; + export import Container = Muicss.Container; + export import Divider = Muicss.Divider; + export import Dropdown = Muicss.Dropdown; + export import DropdownItem = Muicss.DropdownItem; + export import Form = Muicss.Form; + export import Input = Muicss.Input; + export import Option = Muicss.Option; + export import Panel = Muicss.Panel; + export import Radio = Muicss.Radio; + export import Row = Muicss.Row; + export import Select = Muicss.Select; + export import Tab = Muicss.Tab; + export import Tabs = Muicss.Tabs; + export import Textarea = Muicss.Textarea; +} + +declare module 'muicss/lib/react/appbar' { + export import Appbar = Muicss.Appbar; + export default Appbar; +} + +declare module 'muicss/lib/react/button' { + export import Button = Muicss.Button; + export default Button; +} + +declare module 'muicss/lib/react/checkbox' { + export import Checkbox = Muicss.Checkbox; + export default Checkbox; +} + +declare module 'muicss/lib/react/col' { + export import Col = Muicss.Col; + export default Col; +} + +declare module 'muicss/lib/react/container' { + export import Container = Muicss.Container; + export default Container; +} + +declare module 'muicss/lib/react/divider' { + export import Divider = Muicss.Divider; + export default Divider; +} + +declare module 'muicss/lib/react/dropdown' { + export import Dropdown = Muicss.Dropdown; + export default Dropdown; +} + +declare module 'muicss/lib/react/dropdown-item' { + export import DropdownItem = Muicss.DropdownItem; + export default DropdownItem; +} + +declare module 'muicss/lib/react/form' { + export import Form = Muicss.Form; + export default Form; +} + +declare module 'muicss/lib/react/input' { + export import Input = Muicss.Input; + export default Input; +} + +declare module 'muicss/lib/react/option' { + export import Option = Muicss.Option; + export default Option; +} + +declare module 'muicss/lib/react/panel' { + export import Panel = Muicss.Panel; + export default Panel; +} + +declare module 'muicss/lib/react/radio' { + export import Radio = Muicss.Radio; + export default Radio; +} + +declare module 'muicss/lib/react/row' { + export import Row = Muicss.Row; + export default Row; +} + +declare module 'muicss/lib/react/select' { + export import Select = Muicss.Select; + export default Select; +} + +declare module 'muicss/lib/react/tab' { + export import Tab = Muicss.Tab; + export default Tab; +} + +declare module 'muicss/lib/react/tabs' { + export import Tabs = Muicss.Tabs; + export default Tabs; +} + +declare module 'muicss/lib/react/textarea' { + export import Textarea = Muicss.Textarea; + export default Textarea; +} + +declare namespace Muicss { + export class Appbar extends React.Component {} + export class Button extends React.Component {} + export class Checkbox extends React.Component {} + export class Col extends React.Component {} + export class Container extends React.Component {} + export class Divider extends React.Component {} + export class Dropdown extends React.Component {} + export class DropdownItem extends React.Component {} + export class Form extends React.Component {} + export class Input extends React.Component {} + export class Panel extends React.Component {} + export class Option extends React.Component {} + export class Radio extends React.Component {} + export class Row extends React.Component {} + export class Select extends React.Component {} + export class Tab extends React.Component {} + export class Tabs extends React.Component {} + export class Textarea extends React.Component {} + + export interface ButtonProps extends React.DetailedHTMLFactory, HTMLButtonElement> { + color?: string; + size?: string; + variant?: string; + onMouseDown?: React.MouseEventHandler<{}>; + onMouseUp?: React.MouseEventHandler<{}>; + onMouseLeave?: React.MouseEventHandler<{}>; + onTouchStart?: React.MouseEventHandler<{}>; + onTouchEnd?: React.MouseEventHandler<{}>; + } + + export interface CheckboxProps extends React.DetailedHTMLFactory, HTMLDivElement> { + label?: React.ReactNode; + autoFocus?: boolean; + checked?: boolean; + defaultChecked?: boolean; + defaultValue?: string | string[]; + disabled?: boolean; + form?: string; + name?: string; + required?: boolean; + value?: string | string[] | number; + onChange?: React.ChangeEventHandler; + } + + export interface ColProps extends DivProps { + xs?: number; + sm?: number; + md?: number; + lg?: number; + xl?: number; + 'xs-offset'?: number; + 'sm-offset'?: number; + 'md-offset'?: number; + 'lg-offset'?: number; + 'xl-offset'?: number; + } + + export interface ContainerProps extends DivProps { + fluid?: boolean; + } + + export interface DivProps extends React.DetailedHTMLFactory, HTMLDivElement> {} + export interface DividerProps extends DivProps {} + + export interface DropdownItemProps extends React.DetailedHTMLFactory, HTMLLIElement> { + link?: string; + target?: string; + value?: any; + } + + export interface DropdownProps extends React.DetailedHTMLFactory, HTMLDivElement> { + onSelect?: React.MouseEventHandler; // proxy of menu item's onClick + onClick?: React.MouseEventHandler; // click the button to show dropdown + onOutsideClick?: React.MouseEventHandler; + onKeyDown?: React.KeyboardEventHandler; + + color?: string; + variant?: string; + size?: string; + label?: React.ReactNode; + alignMenu?: 'left' | 'right'; + disabled?: boolean; + } + + export interface FormProps extends React.DetailedHTMLFactory, HTMLFormElement> { + inline?: boolean; + } + + export interface InputProps extends React.DetailedHTMLFactory, HTMLInputElement> { + inputRef?: React.Ref; + onLabelClick?: React.MouseEventHandler; + hint?: string; // placeholder + invalid?: boolean; + label?: React.ReactNode; + floatingLabel?: boolean; + } + + export interface OptionProps extends React.DetailedHTMLFactory, HTMLOptionElement> { + label?: string; + value?: string | string[] | number; + } + + export interface PanelProps extends DivProps {} + export interface RadioProps extends CheckboxProps {} + + export interface RowProps extends DivProps { + xs?: number; + sm?: number; + md?: number; + lg?: number; + } + + export interface SelectProps extends DivProps { + label?: React.ReactNode; + name?: string; + readOnly?: boolean; + useDefault?: boolean; + onChange?: React.ChangeEventHandler; + onClick?: React.MouseEventHandler; + onKeyDown?: React.KeyboardEventHandler; + } + + export interface TabProps { + value?: any; + label?: React.ReactNode; + onActive?: (tab: Tab) => void; + } + + export interface TabsProps extends DivProps { + defaultSelectedIndex?: number; + selectedIndex?: number; + justified?: boolean; + onChange?: (index: number, value: any, tab: Tab, event: Event) => void; + } + + export interface TextareaProps extends React.DetailedHTMLFactory, HTMLTextAreaElement> { + inputRef?: React.Ref; + onLabelClick?: React.MouseEventHandler; + hint?: string; // placeholder + invalid?: boolean; + label?: React.ReactNode; + floatingLabel?: boolean; + } +} diff --git a/types/muicss-react/muicss-react-tests.tsx b/types/muicss-react/muicss-react-tests.tsx new file mode 100644 index 0000000000..6fcdf76cb5 --- /dev/null +++ b/types/muicss-react/muicss-react-tests.tsx @@ -0,0 +1,203 @@ +import * as React from 'react'; +import { Component } from 'react'; +import * as ReactDOM from 'react-dom'; + +import { + Appbar, + Button, + Checkbox, + Col, + Container, + Divider, + Dropdown, + DropdownItem, + Form, + Input, + Option, + Panel, + Radio, + Row, + Select, + Tab, + Tabs, + Textarea +} from 'muicss/react'; + +import Appbar2 from 'muicss/lib/react/appbar'; +import Button2 from 'muicss/lib/react/button'; +import Checkbox2 from 'muicss/lib/react/checkbox'; +import Col2 from 'muicss/lib/react/col'; +import Container2 from 'muicss/lib/react/container'; +import Divider2 from 'muicss/lib/react/divider'; +import Dropdown2 from 'muicss/lib/react/dropdown'; +import DropdownItem2 from 'muicss/lib/react/dropdown-item'; +import Form2 from 'muicss/lib/react/form'; +import Input2 from 'muicss/lib/react/input'; +import Option2 from 'muicss/lib/react/option'; +import Panel2 from 'muicss/lib/react/panel'; +import Radio2 from 'muicss/lib/react/radio'; +import Row2 from 'muicss/lib/react/row'; +import Select2 from 'muicss/lib/react/select'; +import Tab2 from 'muicss/lib/react/tab'; +import Tabs2 from 'muicss/lib/react/tabs'; +import Textarea2 from 'muicss/lib/react/textarea'; + +interface Props {} + +class Test extends Component { + render() { + return ( +
+ Test application + + + + Link + + Link + + + + +
+ Test form + + + +