From 0f4e20b7fa690c18ead85bee5280e73c407ecd5b Mon Sep 17 00:00:00 2001 From: AdrianFarmadin Date: Fri, 5 May 2017 17:28:52 +0200 Subject: [PATCH 0001/1382] 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 0002/1382] 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 0003/1382] 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 0004/1382] 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 57c70f83b8604b7eabc2c69a4cf5f1bcd56b1369 Mon Sep 17 00:00:00 2001 From: Jovica Zoric Date: Tue, 26 Sep 2017 13:29:50 +0200 Subject: [PATCH 0005/1382] fix(react-sortable-tree): Add missing prop Add missing dndType prop. --- types/react-sortable-tree/index.d.ts | 2 ++ types/react-sortable-tree/react-sortable-tree-tests.tsx | 1 + 2 files changed, 3 insertions(+) diff --git a/types/react-sortable-tree/index.d.ts b/types/react-sortable-tree/index.d.ts index a6a04f4968..dfed930e2f 100644 --- a/types/react-sortable-tree/index.d.ts +++ b/types/react-sortable-tree/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for react-sortable-tree 0.1 // Project: https://fritz-c.github.io/react-sortable-tree // Definitions by: Wouter Hardeman +// Jovica Zoric // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -111,6 +112,7 @@ export interface ReactSortableTreeProps { scaffoldBlockPxWidth?: number; isVirtualized?: boolean; nodeContentRenderer?: NodeRenderer; + dndType?: string; } declare const SortableTree: React.ComponentClass; diff --git a/types/react-sortable-tree/react-sortable-tree-tests.tsx b/types/react-sortable-tree/react-sortable-tree-tests.tsx index 1a5e2dfcd0..106415744b 100644 --- a/types/react-sortable-tree/react-sortable-tree-tests.tsx +++ b/types/react-sortable-tree/react-sortable-tree-tests.tsx @@ -54,6 +54,7 @@ class Test extends React.Component { scaffoldBlockPxWidth={44} isVirtualized={true} nodeContentRenderer={nodeRenderer} + dndType="testNodeType" /> Date: Sat, 7 Oct 2017 17:38:07 +0200 Subject: [PATCH 0006/1382] 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 0007/1382] 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 0008/1382] 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 0009/1382] 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 0010/1382] 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 109298354cabba3ee9959f213ce456c7e424971c Mon Sep 17 00:00:00 2001 From: Brice BERNARD Date: Sat, 9 Dec 2017 18:19:19 +0100 Subject: [PATCH 0011/1382] Prettier test --- types/jsonwebtoken/jsonwebtoken-tests.ts | 76 +++++++++++++----------- 1 file changed, 42 insertions(+), 34 deletions(-) diff --git a/types/jsonwebtoken/jsonwebtoken-tests.ts b/types/jsonwebtoken/jsonwebtoken-tests.ts index 9e495d31cb..3ced0ccfb5 100644 --- a/types/jsonwebtoken/jsonwebtoken-tests.ts +++ b/types/jsonwebtoken/jsonwebtoken-tests.ts @@ -11,39 +11,44 @@ var token: string; var cert: Buffer; interface ITestObject { - 'foo': string + foo: string; } -const testObject = { foo: 'bar' } +const testObject = { foo: "bar" }; /** * jwt.sign * https://github.com/auth0/node-jsonwebtoken#usage */ // sign with default (HMAC SHA256) -token = jwt.sign(testObject, 'shhhhh'); +token = jwt.sign(testObject, "shhhhh"); // sign with default (HMAC SHA256) and single audience -token = jwt.sign(testObject, 'shhhhh', { audience: "theAudience"}); +token = jwt.sign(testObject, "shhhhh", { audience: "theAudience" }); // sign with default (HMAC SHA256) and multiple audiences -token = jwt.sign(testObject, 'shhhhh', { audience: ["audience1", "audience2"]}); +token = jwt.sign(testObject, "shhhhh", { + audience: ["audience1", "audience2"], +}); // sign with default (HMAC SHA256) and a keyid -token = jwt.sign(testObject, 'shhhhh', { keyid: "theKeyId"}); +token = jwt.sign(testObject, "shhhhh", { keyid: "theKeyId" }); // sign with RSA SHA256 -cert = fs.readFileSync('private.key'); // get private key -token = jwt.sign(testObject, cert, { algorithm: 'RS256'}); +cert = fs.readFileSync("private.key"); // get private key +token = jwt.sign(testObject, cert, { algorithm: "RS256" }); // sign with encrypted RSA SHA256 private key (only PEM encoding is supported) -const privKey: Buffer = fs.readFileSync('encrypted_private.key'); // get private key -const secret = {key: privKey.toString(), passphrase: 'keypwd'} -token = jwt.sign(testObject, secret, { algorithm: 'RS256' }); // the algorithm option is mandatory in this case +const privKey: Buffer = fs.readFileSync("encrypted_private.key"); // get private key +const secret = { key: privKey.toString(), passphrase: "keypwd" }; +token = jwt.sign(testObject, secret, { algorithm: "RS256" }); // the algorithm option is mandatory in this case // sign asynchronously -jwt.sign(testObject, cert, { algorithm: 'RS256' }, function(err: Error, token: string) { - console.log(token); +jwt.sign(testObject, cert, { algorithm: "RS256" }, function( + err: Error, + token: string, +) { + console.log(token); }); /** @@ -51,48 +56,51 @@ jwt.sign(testObject, cert, { algorithm: 'RS256' }, function(err: Error, token: s * https://github.com/auth0/node-jsonwebtoken#jwtverifytoken-secretorpublickey-options-callback */ // verify a token symmetric -jwt.verify(token, 'shhhhh', function(err, decoded) { - const result = decoded as ITestObject +jwt.verify(token, "shhhhh", function(err, decoded) { + const result = decoded as ITestObject; - console.log(result.foo) // bar + console.log(result.foo); // bar }); // invalid token -jwt.verify(token, 'wrong-secret', function(err, decoded) { - // err - // decoded undefined +jwt.verify(token, "wrong-secret", function(err, decoded) { + // err + // decoded undefined }); // verify a token asymmetric -cert = fs.readFileSync('public.pem'); // get public key -jwt.verify(token, cert, function (err, decoded) { - const result = decoded as ITestObject +cert = fs.readFileSync("public.pem"); // get public key +jwt.verify(token, cert, function(err, decoded) { + const result = decoded as ITestObject; - console.log(result.foo) // bar + console.log(result.foo); // bar }); // verify audience -cert = fs.readFileSync('public.pem'); // get public key -jwt.verify(token, cert, { audience: 'urn:foo' }, function(err, decoded) { - // if audience mismatch, err == invalid audience +cert = fs.readFileSync("public.pem"); // get public key +jwt.verify(token, cert, { audience: "urn:foo" }, function(err, decoded) { + // if audience mismatch, err == invalid audience }); // verify issuer -cert = fs.readFileSync('public.pem'); // get public key -jwt.verify(token, cert, { audience: 'urn:foo', issuer: 'urn:issuer' }, function(err, decoded) { - // if issuer mismatch, err == invalid issuer +cert = fs.readFileSync("public.pem"); // get public key +jwt.verify(token, cert, { audience: "urn:foo", issuer: "urn:issuer" }, function( + err, + decoded, +) { + // if issuer mismatch, err == invalid issuer }); // verify algorithm -cert = fs.readFileSync('public.pem'); // get public key -jwt.verify(token, cert, { algorithms: ['RS256'] }, function(err, decoded) { - // if algorithm mismatch, err == invalid algorithm +cert = fs.readFileSync("public.pem"); // get public key +jwt.verify(token, cert, { algorithms: ["RS256"] }, function(err, decoded) { + // if algorithm mismatch, err == invalid algorithm }); // verify without expiration check -cert = fs.readFileSync('public.pem'); // get public key +cert = fs.readFileSync("public.pem"); // get public key jwt.verify(token, cert, { ignoreExpiration: true }, function(err, decoded) { - // if ignoreExpration == false and token is expired, err == expired token + // if ignoreExpration == false and token is expired, err == expired token }); /** From ed28cd0b50ea04fb5d458710b403e1bfc371c8db Mon Sep 17 00:00:00 2001 From: Brice BERNARD Date: Sat, 9 Dec 2017 18:22:02 +0100 Subject: [PATCH 0012/1382] Add test and related fix --- types/jsonwebtoken/index.d.ts | 2 +- types/jsonwebtoken/jsonwebtoken-tests.ts | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/types/jsonwebtoken/index.d.ts b/types/jsonwebtoken/index.d.ts index 766042e627..6455eeb1ba 100644 --- a/types/jsonwebtoken/index.d.ts +++ b/types/jsonwebtoken/index.d.ts @@ -166,4 +166,4 @@ declare function verify( declare function decode( token: string, options?: DecodeOptions, -): null | object | string; +): null | { [key: string]: any } | string; diff --git a/types/jsonwebtoken/jsonwebtoken-tests.ts b/types/jsonwebtoken/jsonwebtoken-tests.ts index 3ced0ccfb5..87e3a56390 100644 --- a/types/jsonwebtoken/jsonwebtoken-tests.ts +++ b/types/jsonwebtoken/jsonwebtoken-tests.ts @@ -111,6 +111,10 @@ var decoded = jwt.decode(token); decoded = jwt.decode(token, { complete: false }); +if (decoded !== null && typeof decoded === "object") { + console.log(decoded.foo); +} + decoded = jwt.decode(token, { json: false }); decoded = jwt.decode(token, { complete: false, json: false }); From 8a94d4a3d434602d3fbc7d6b768bb9d535410d3b Mon Sep 17 00:00:00 2001 From: Brice BERNARD Date: Sat, 9 Dec 2017 18:32:00 +0100 Subject: [PATCH 0013/1382] Bump version --- types/jsonwebtoken/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/jsonwebtoken/index.d.ts b/types/jsonwebtoken/index.d.ts index 6455eeb1ba..cd05b54d69 100644 --- a/types/jsonwebtoken/index.d.ts +++ b/types/jsonwebtoken/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for jsonwebtoken 7.2.1 +// Type definitions for jsonwebtoken 7.2.2 // Project: https://github.com/auth0/node-jsonwebtoken // Definitions by: Maxime LUCE , // Daniel Heim , From 34b42dbf696847ce0dd1282f5dc3d872cb0f79a0 Mon Sep 17 00:00:00 2001 From: Craig Kovatch Date: Fri, 29 Dec 2017 17:44:19 -0800 Subject: [PATCH 0014/1382] Add WAI-ARIA 1.1 attributes to React typings --- types/react/index.d.ts | 136 +++++++++++++++++++++++++++++++++++++ types/react/v15/index.d.ts | 136 +++++++++++++++++++++++++++++++++++++ 2 files changed, 272 insertions(+) diff --git a/types/react/index.d.ts b/types/react/index.d.ts index c5c1c76d17..a4784caa41 100644 --- a/types/react/index.d.ts +++ b/types/react/index.d.ts @@ -2498,6 +2498,142 @@ declare namespace React { unselectable?: boolean; } + // All the WAI-ARIA 1.1 attributes + // https://www.w3.org/TR/wai-aria-1.1/ + interface HTMLAttributes extends DOMAttributes { + /** Identifies the currently active element when DOM focus is on a composite widget, textbox, group, or application. */ + 'aria-activedescendant'?: string; + /** Indicates whether assistive technologies will present all, or only parts of, the changed region based on the change + * notifications defined by the aria-relevant attribute. */ + 'aria-atomic'?: boolean; + /** Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for + * an input and specifies how predictions would be presented if they are made. */ + 'aria-autocomplete'?: 'none' | 'inline' | 'list' | 'both'; + /** Indicates an element is being modified and that assistive technologies MAY want to wait until the modifications are + * complete before exposing them to the user. */ + 'aria-busy'?: boolean; + /** Indicates the current "checked" state of checkboxes, radio buttons, and other widgets. + * @see aria-pressed @see aria-selected. */ + 'aria-checked'?: boolean | 'false' | 'mixed' | 'true'; + /** Defines the total number of columns in a table, grid, or treegrid. + * @see aria-colindex. */ + 'aria-colcount'?: number; + /** Defines an element's column index or position with respect to the total number of columns within a table, grid, or + * treegrid. + * @see aria-colcount @see aria-colspan. */ + 'aria-colindex'?: number; + /** Defines the number of columns spanned by a cell or gridcell within a table, grid, or treegrid. + * @see aria-colindex @see aria-rowspan. */ + 'aria-colspan'?: number; + /** Indicates the element that represents the current item within a container or set of related elements. */ + 'aria-current'?: boolean | 'false' | 'true' | 'page' | 'step' | 'location' | 'date' | 'time'; + /** Identifies the element (or elements) that describes the object. + * @see aria-labelledby */ + 'aria-describedby'?: string; + /** Identifies the element that provides a detailed, extended description for the object. + * @see aria-describedby. */ + 'aria-details'?: string; + /** Indicates that the element is perceivable but disabled, so it is not editable or otherwise operable. + * @see aria-hidden @see aria-readonly. */ + 'aria-disabled'?: boolean; + /** Indicates what functions can be performed when a dragged object is released on the drop target. + * @deprecated in ARIA 1.1 */ + 'aria-dropeffect'?: 'none' | 'copy' | 'execute' | 'link' | 'move' | 'popup'; + /** Identifies the element that provides an error message for the object. + * @see aria-invalid @see aria-describedby. */ + 'aria-errormessage'?: string; + /** Indicates whether the element, or another grouping element it controls, is currently expanded or collapsed. */ + 'aria-expanded'?: boolean; + /** Identifies the next element (or elements) in an alternate reading order of content which, at the user's discretion, + * allows assistive technology to override the general default of reading in document source order. */ + 'aria-flowto'?: string; + /** Indicates an element's "grabbed" state in a drag-and-drop operation. + * @deprecated in ARIA 1.1 */ + 'aria-grabbed'?: boolean; + /** Indicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an + * element. */ + 'aria-haspopup'?: boolean | 'false' | 'true' | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog'; + /** Indicates whether the element is exposed to an accessibility API. + * @see aria-disabled. */ + 'aria-hidden'?: boolean; + /** Indicates the entered value does not conform to the format expected by the application. + * @see aria-errormessage. */ + 'aria-invalid'?: boolean | 'false' | 'true' | 'grammar' | 'spelling'; + /** Indicates keyboard shortcuts that an author has implemented to activate or give focus to an element. */ + 'aria-keyshortcuts'?: string; + /** Defines a string value that labels the current element. + * @see aria-labelledby. */ + 'aria-label'?: string; + /** Identifies the element (or elements) that labels the current element. + * @see aria-describedby. */ + 'aria-labelledby'?: string; + /** Defines the hierarchical level of an element within a structure. */ + 'aria-level'?: number; + /** Indicates that an element will be updated, and describes the types of updates the user agents, assistive technologies, + * and user can expect from the live region. */ + 'aria-live'?: 'off' | 'assertive' | 'polite'; + /** Indicates whether an element is modal when displayed. */ + 'aria-modal'?: boolean; + /** Indicates whether a text box accepts multiple lines of input or only a single line. */ + 'aria-multiline'?: boolean; + /** Indicates that the user may select more than one item from the current selectable descendants. */ + 'aria-multiselectable'?: boolean; + /** Indicates whether the element's orientation is horizontal, vertical, or unknown/ambiguous. */ + 'aria-orientation'?: 'undefined' | 'horizontal' | 'vertical'; + /** Identifies an element (or elements) in order to define a visual, functional, or contextual parent/child relationship + * between DOM + * elements where the DOM hierarchy cannot be used to represent the relationship. + * @see aria-controls. */ + 'aria-owns'?: string; + /** Defines a short hint (a word or short phrase) intended to aid the user with data entry when the control has no value. + * A hint could be a sample value or a brief description of the expected format. */ + 'aria-placeholder'?: string; + /** Defines an element's number or position in the current set of listitems or treeitems. Not required if all elements in + * the set are present in the DOM. + * @see aria-setsize. */ + 'aria-posinset'?: number; + /** Indicates the current "pressed" state of toggle buttons. + * @see aria-checked @see aria-selected. */ + 'aria-pressed'?: boolean | 'undefined' | 'false' | 'mixed' | 'true'; + /** Indicates that the element is not editable, but is otherwise operable. + * @see aria-disabled. */ + 'aria-readonly'?: boolean; + /** Indicates what notifications the user agent will trigger when the accessibility tree within a live region is modified. + * @see aria-atomic. */ + 'aria-relevant'?: 'additions' | 'additions text' | 'all' | 'removals' | 'text'; + /** Indicates that user input is required on the element before a form may be submitted. */ + 'aria-required'?: boolean; + /** Defines a human-readable, author-localized description for the role of an element. */ + 'aria-roledescription'?: string; + /** Defines the total number of rows in a table, grid, or treegrid. + * @see aria-rowindex. */ + 'aria-rowcount'?: number; + /** Defines an element's row index or position with respect to the total number of rows within a table, grid, or treegrid. + * @see aria-rowcount @see aria-rowspan. */ + 'aria-rowindex'?: number; + /** Defines the number of rows spanned by a cell or gridcell within a table, grid, or treegrid. + * @see aria-rowindex @see aria-colspan. */ + 'aria-rowspan'?: number; + /** Indicates the current "selected" state of various widgets. + * @see aria-checked @see aria-pressed. */ + 'aria-selected'?: boolean | 'undefined' | 'false' | 'true'; + /** Defines the number of items in the current set of listitems or treeitems. Not required if all elements in the set are + * present in the DOM. + * @see aria-posinset. */ + 'aria-setsize'?: number; + /** Indicates if items in a table or grid are sorted in ascending or descending order. */ + 'aria-sort'?: 'none' | 'ascending' | 'descending' | 'other'; + /** Defines the maximum allowed value for a range widget. */ + 'aria-valuemax'?: number; + /** Defines the minimum allowed value for a range widget. */ + 'aria-valuemin'?: number; + /** Defines the current value for a range widget. + * @see aria-valuetext. */ + 'aria-valuenow'?: number; + /** Defines the human readable text alternative of aria-valuenow for a range widget. */ + 'aria-valuetext'?: string; + } + interface AllHTMLAttributes extends HTMLAttributes { // Standard HTML Attributes accept?: string; diff --git a/types/react/v15/index.d.ts b/types/react/v15/index.d.ts index 12b25439aa..72a14d9abb 100644 --- a/types/react/v15/index.d.ts +++ b/types/react/v15/index.d.ts @@ -2428,6 +2428,142 @@ declare namespace React { unselectable?: boolean; } + // All the WAI-ARIA 1.1 attributes + // https://www.w3.org/TR/wai-aria-1.1/ + interface HTMLAttributes extends DOMAttributes { + /** Identifies the currently active element when DOM focus is on a composite widget, textbox, group, or application. */ + 'aria-activedescendant'?: string; + /** Indicates whether assistive technologies will present all, or only parts of, the changed region based on the change + * notifications defined by the aria-relevant attribute. */ + 'aria-atomic'?: boolean; + /** Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for + * an input and specifies how predictions would be presented if they are made. */ + 'aria-autocomplete'?: 'none' | 'inline' | 'list' | 'both'; + /** Indicates an element is being modified and that assistive technologies MAY want to wait until the modifications are + * complete before exposing them to the user. */ + 'aria-busy'?: boolean; + /** Indicates the current "checked" state of checkboxes, radio buttons, and other widgets. + * @see aria-pressed @see aria-selected. */ + 'aria-checked'?: boolean | 'false' | 'mixed' | 'true'; + /** Defines the total number of columns in a table, grid, or treegrid. + * @see aria-colindex. */ + 'aria-colcount'?: number; + /** Defines an element's column index or position with respect to the total number of columns within a table, grid, or + * treegrid. + * @see aria-colcount @see aria-colspan. */ + 'aria-colindex'?: number; + /** Defines the number of columns spanned by a cell or gridcell within a table, grid, or treegrid. + * @see aria-colindex @see aria-rowspan. */ + 'aria-colspan'?: number; + /** Indicates the element that represents the current item within a container or set of related elements. */ + 'aria-current'?: boolean | 'false' | 'true' | 'page' | 'step' | 'location' | 'date' | 'time'; + /** Identifies the element (or elements) that describes the object. + * @see aria-labelledby */ + 'aria-describedby'?: string; + /** Identifies the element that provides a detailed, extended description for the object. + * @see aria-describedby. */ + 'aria-details'?: string; + /** Indicates that the element is perceivable but disabled, so it is not editable or otherwise operable. + * @see aria-hidden @see aria-readonly. */ + 'aria-disabled'?: boolean; + /** Indicates what functions can be performed when a dragged object is released on the drop target. + * @deprecated in ARIA 1.1 */ + 'aria-dropeffect'?: 'none' | 'copy' | 'execute' | 'link' | 'move' | 'popup'; + /** Identifies the element that provides an error message for the object. + * @see aria-invalid @see aria-describedby. */ + 'aria-errormessage'?: string; + /** Indicates whether the element, or another grouping element it controls, is currently expanded or collapsed. */ + 'aria-expanded'?: boolean; + /** Identifies the next element (or elements) in an alternate reading order of content which, at the user's discretion, + * allows assistive technology to override the general default of reading in document source order. */ + 'aria-flowto'?: string; + /** Indicates an element's "grabbed" state in a drag-and-drop operation. + * @deprecated in ARIA 1.1 */ + 'aria-grabbed'?: boolean; + /** Indicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an + * element. */ + 'aria-haspopup'?: boolean | 'false' | 'true' | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog'; + /** Indicates whether the element is exposed to an accessibility API. + * @see aria-disabled. */ + 'aria-hidden'?: boolean; + /** Indicates the entered value does not conform to the format expected by the application. + * @see aria-errormessage. */ + 'aria-invalid'?: boolean | 'false' | 'true' | 'grammar' | 'spelling'; + /** Indicates keyboard shortcuts that an author has implemented to activate or give focus to an element. */ + 'aria-keyshortcuts'?: string; + /** Defines a string value that labels the current element. + * @see aria-labelledby. */ + 'aria-label'?: string; + /** Identifies the element (or elements) that labels the current element. + * @see aria-describedby. */ + 'aria-labelledby'?: string; + /** Defines the hierarchical level of an element within a structure. */ + 'aria-level'?: number; + /** Indicates that an element will be updated, and describes the types of updates the user agents, assistive technologies, + * and user can expect from the live region. */ + 'aria-live'?: 'off' | 'assertive' | 'polite'; + /** Indicates whether an element is modal when displayed. */ + 'aria-modal'?: boolean; + /** Indicates whether a text box accepts multiple lines of input or only a single line. */ + 'aria-multiline'?: boolean; + /** Indicates that the user may select more than one item from the current selectable descendants. */ + 'aria-multiselectable'?: boolean; + /** Indicates whether the element's orientation is horizontal, vertical, or unknown/ambiguous. */ + 'aria-orientation'?: 'undefined' | 'horizontal' | 'vertical'; + /** Identifies an element (or elements) in order to define a visual, functional, or contextual parent/child relationship + * between DOM + * elements where the DOM hierarchy cannot be used to represent the relationship. + * @see aria-controls. */ + 'aria-owns'?: string; + /** Defines a short hint (a word or short phrase) intended to aid the user with data entry when the control has no value. + * A hint could be a sample value or a brief description of the expected format. */ + 'aria-placeholder'?: string; + /** Defines an element's number or position in the current set of listitems or treeitems. Not required if all elements in + * the set are present in the DOM. + * @see aria-setsize. */ + 'aria-posinset'?: number; + /** Indicates the current "pressed" state of toggle buttons. + * @see aria-checked @see aria-selected. */ + 'aria-pressed'?: boolean | 'undefined' | 'false' | 'mixed' | 'true'; + /** Indicates that the element is not editable, but is otherwise operable. + * @see aria-disabled. */ + 'aria-readonly'?: boolean; + /** Indicates what notifications the user agent will trigger when the accessibility tree within a live region is modified. + * @see aria-atomic. */ + 'aria-relevant'?: 'additions' | 'additions text' | 'all' | 'removals' | 'text'; + /** Indicates that user input is required on the element before a form may be submitted. */ + 'aria-required'?: boolean; + /** Defines a human-readable, author-localized description for the role of an element. */ + 'aria-roledescription'?: string; + /** Defines the total number of rows in a table, grid, or treegrid. + * @see aria-rowindex. */ + 'aria-rowcount'?: number; + /** Defines an element's row index or position with respect to the total number of rows within a table, grid, or treegrid. + * @see aria-rowcount @see aria-rowspan. */ + 'aria-rowindex'?: number; + /** Defines the number of rows spanned by a cell or gridcell within a table, grid, or treegrid. + * @see aria-rowindex @see aria-colspan. */ + 'aria-rowspan'?: number; + /** Indicates the current "selected" state of various widgets. + * @see aria-checked @see aria-pressed. */ + 'aria-selected'?: boolean | 'undefined' | 'false' | 'true'; + /** Defines the number of items in the current set of listitems or treeitems. Not required if all elements in the set are + * present in the DOM. + * @see aria-posinset. */ + 'aria-setsize'?: number; + /** Indicates if items in a table or grid are sorted in ascending or descending order. */ + 'aria-sort'?: 'none' | 'ascending' | 'descending' | 'other'; + /** Defines the maximum allowed value for a range widget. */ + 'aria-valuemax'?: number; + /** Defines the minimum allowed value for a range widget. */ + 'aria-valuemin'?: number; + /** Defines the current value for a range widget. + * @see aria-valuetext. */ + 'aria-valuenow'?: number; + /** Defines the human readable text alternative of aria-valuenow for a range widget. */ + 'aria-valuetext'?: string; + } + interface AllHTMLAttributes extends HTMLAttributes { // Standard HTML Attributes accept?: string; From 8ffe91a4d8eb3f647c6548a7c91ed0f180f37225 Mon Sep 17 00:00:00 2001 From: Craig Kovatch Date: Fri, 29 Dec 2017 18:05:53 -0800 Subject: [PATCH 0015/1382] Fix linting errors --- types/react/index.d.ts | 191 +++++++++++++--------- types/react/v15/index.d.ts | 313 +++++++++++++++++++++---------------- 2 files changed, 299 insertions(+), 205 deletions(-) diff --git a/types/react/index.d.ts b/types/react/index.d.ts index a4784caa41..e3c3f53bb8 100644 --- a/types/react/index.d.ts +++ b/types/react/index.d.ts @@ -2498,79 +2498,105 @@ declare namespace React { unselectable?: boolean; } - // All the WAI-ARIA 1.1 attributes - // https://www.w3.org/TR/wai-aria-1.1/ + // All the WAI-ARIA 1.1 attributes from https://www.w3.org/TR/wai-aria-1.1/ interface HTMLAttributes extends DOMAttributes { - /** Identifies the currently active element when DOM focus is on a composite widget, textbox, group, or application. */ + /** Identifies the currently active element when DOM focus is on a composite widget, textbox, group, or application. */ 'aria-activedescendant'?: string; - /** Indicates whether assistive technologies will present all, or only parts of, the changed region based on the change - * notifications defined by the aria-relevant attribute. */ + /** Indicates whether assistive technologies will present all, or only parts of, the changed region based on the change notifications defined by the aria-relevant attribute. */ 'aria-atomic'?: boolean; - /** Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for - * an input and specifies how predictions would be presented if they are made. */ + /** + * Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for an input and specifies how predictions would be + * presented if they are made. + */ 'aria-autocomplete'?: 'none' | 'inline' | 'list' | 'both'; - /** Indicates an element is being modified and that assistive technologies MAY want to wait until the modifications are - * complete before exposing them to the user. */ + /** Indicates an element is being modified and that assistive technologies MAY want to wait until the modifications are complete before exposing them to the user. */ 'aria-busy'?: boolean; - /** Indicates the current "checked" state of checkboxes, radio buttons, and other widgets. - * @see aria-pressed @see aria-selected. */ + /** + * Indicates the current "checked" state of checkboxes, radio buttons, and other widgets. + * @see aria-pressed @see aria-selected. + */ 'aria-checked'?: boolean | 'false' | 'mixed' | 'true'; - /** Defines the total number of columns in a table, grid, or treegrid. - * @see aria-colindex. */ + /** + * Defines the total number of columns in a table, grid, or treegrid. + * @see aria-colindex. + */ 'aria-colcount'?: number; - /** Defines an element's column index or position with respect to the total number of columns within a table, grid, or - * treegrid. - * @see aria-colcount @see aria-colspan. */ + /** + * Defines an element's column index or position with respect to the total number of columns within a table, grid, or treegrid. + * @see aria-colcount @see aria-colspan. + */ 'aria-colindex'?: number; - /** Defines the number of columns spanned by a cell or gridcell within a table, grid, or treegrid. - * @see aria-colindex @see aria-rowspan. */ + /** + * Defines the number of columns spanned by a cell or gridcell within a table, grid, or treegrid. + * @see aria-colindex @see aria-rowspan. + */ 'aria-colspan'?: number; /** Indicates the element that represents the current item within a container or set of related elements. */ 'aria-current'?: boolean | 'false' | 'true' | 'page' | 'step' | 'location' | 'date' | 'time'; - /** Identifies the element (or elements) that describes the object. - * @see aria-labelledby */ + /** + * Identifies the element (or elements) that describes the object. + * @see aria-labelledby + */ 'aria-describedby'?: string; - /** Identifies the element that provides a detailed, extended description for the object. - * @see aria-describedby. */ + /** + * Identifies the element that provides a detailed, extended description for the object. + * @see aria-describedby. + */ 'aria-details'?: string; - /** Indicates that the element is perceivable but disabled, so it is not editable or otherwise operable. - * @see aria-hidden @see aria-readonly. */ + /** + * Indicates that the element is perceivable but disabled, so it is not editable or otherwise operable. + * @see aria-hidden @see aria-readonly. + */ 'aria-disabled'?: boolean; - /** Indicates what functions can be performed when a dragged object is released on the drop target. - * @deprecated in ARIA 1.1 */ + /** + * Indicates what functions can be performed when a dragged object is released on the drop target. + * @deprecated in ARIA 1.1 + */ 'aria-dropeffect'?: 'none' | 'copy' | 'execute' | 'link' | 'move' | 'popup'; - /** Identifies the element that provides an error message for the object. - * @see aria-invalid @see aria-describedby. */ + /** + * Identifies the element that provides an error message for the object. + * @see aria-invalid @see aria-describedby. + */ 'aria-errormessage'?: string; /** Indicates whether the element, or another grouping element it controls, is currently expanded or collapsed. */ 'aria-expanded'?: boolean; - /** Identifies the next element (or elements) in an alternate reading order of content which, at the user's discretion, - * allows assistive technology to override the general default of reading in document source order. */ + /** + * Identifies the next element (or elements) in an alternate reading order of content which, at the user's discretion, + * allows assistive technology to override the general default of reading in document source order. + */ 'aria-flowto'?: string; - /** Indicates an element's "grabbed" state in a drag-and-drop operation. - * @deprecated in ARIA 1.1 */ + /** + * Indicates an element's "grabbed" state in a drag-and-drop operation. + * @deprecated in ARIA 1.1 + */ 'aria-grabbed'?: boolean; - /** Indicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an - * element. */ + /** Indicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an element. */ 'aria-haspopup'?: boolean | 'false' | 'true' | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog'; - /** Indicates whether the element is exposed to an accessibility API. - * @see aria-disabled. */ + /** + * Indicates whether the element is exposed to an accessibility API. + * @see aria-disabled. + */ 'aria-hidden'?: boolean; - /** Indicates the entered value does not conform to the format expected by the application. - * @see aria-errormessage. */ + /** + * Indicates the entered value does not conform to the format expected by the application. + * @see aria-errormessage. + */ 'aria-invalid'?: boolean | 'false' | 'true' | 'grammar' | 'spelling'; /** Indicates keyboard shortcuts that an author has implemented to activate or give focus to an element. */ 'aria-keyshortcuts'?: string; - /** Defines a string value that labels the current element. - * @see aria-labelledby. */ + /** + * Defines a string value that labels the current element. + * @see aria-labelledby. + */ 'aria-label'?: string; - /** Identifies the element (or elements) that labels the current element. - * @see aria-describedby. */ + /** + * Identifies the element (or elements) that labels the current element. + * @see aria-describedby. + */ 'aria-labelledby'?: string; /** Defines the hierarchical level of an element within a structure. */ 'aria-level'?: number; - /** Indicates that an element will be updated, and describes the types of updates the user agents, assistive technologies, - * and user can expect from the live region. */ + /** Indicates that an element will be updated, and describes the types of updates the user agents, assistive technologies, and user can expect from the live region. */ 'aria-live'?: 'off' | 'assertive' | 'polite'; /** Indicates whether an element is modal when displayed. */ 'aria-modal'?: boolean; @@ -2580,46 +2606,65 @@ declare namespace React { 'aria-multiselectable'?: boolean; /** Indicates whether the element's orientation is horizontal, vertical, or unknown/ambiguous. */ 'aria-orientation'?: 'undefined' | 'horizontal' | 'vertical'; - /** Identifies an element (or elements) in order to define a visual, functional, or contextual parent/child relationship - * between DOM - * elements where the DOM hierarchy cannot be used to represent the relationship. - * @see aria-controls. */ + /** + * Identifies an element (or elements) in order to define a visual, functional, or contextual parent/child relationship + * between DOM elements where the DOM hierarchy cannot be used to represent the relationship. + * @see aria-controls. + */ 'aria-owns'?: string; - /** Defines a short hint (a word or short phrase) intended to aid the user with data entry when the control has no value. - * A hint could be a sample value or a brief description of the expected format. */ + /** + * Defines a short hint (a word or short phrase) intended to aid the user with data entry when the control has no value. + * A hint could be a sample value or a brief description of the expected format. + */ 'aria-placeholder'?: string; - /** Defines an element's number or position in the current set of listitems or treeitems. Not required if all elements in - * the set are present in the DOM. - * @see aria-setsize. */ + /** + * Defines an element's number or position in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM. + * @see aria-setsize. + */ 'aria-posinset'?: number; - /** Indicates the current "pressed" state of toggle buttons. - * @see aria-checked @see aria-selected. */ + /** + * Indicates the current "pressed" state of toggle buttons. + * @see aria-checked @see aria-selected. + */ 'aria-pressed'?: boolean | 'undefined' | 'false' | 'mixed' | 'true'; - /** Indicates that the element is not editable, but is otherwise operable. - * @see aria-disabled. */ + /** + * Indicates that the element is not editable, but is otherwise operable. + * @see aria-disabled. + */ 'aria-readonly'?: boolean; - /** Indicates what notifications the user agent will trigger when the accessibility tree within a live region is modified. - * @see aria-atomic. */ + /** + * Indicates what notifications the user agent will trigger when the accessibility tree within a live region is modified. + * @see aria-atomic. + */ 'aria-relevant'?: 'additions' | 'additions text' | 'all' | 'removals' | 'text'; /** Indicates that user input is required on the element before a form may be submitted. */ 'aria-required'?: boolean; /** Defines a human-readable, author-localized description for the role of an element. */ 'aria-roledescription'?: string; - /** Defines the total number of rows in a table, grid, or treegrid. - * @see aria-rowindex. */ + /** + * Defines the total number of rows in a table, grid, or treegrid. + * @see aria-rowindex. + */ 'aria-rowcount'?: number; - /** Defines an element's row index or position with respect to the total number of rows within a table, grid, or treegrid. - * @see aria-rowcount @see aria-rowspan. */ + /** + * Defines an element's row index or position with respect to the total number of rows within a table, grid, or treegrid. + * @see aria-rowcount @see aria-rowspan. + */ 'aria-rowindex'?: number; - /** Defines the number of rows spanned by a cell or gridcell within a table, grid, or treegrid. - * @see aria-rowindex @see aria-colspan. */ + /** + * Defines the number of rows spanned by a cell or gridcell within a table, grid, or treegrid. + * @see aria-rowindex @see aria-colspan. + */ 'aria-rowspan'?: number; - /** Indicates the current "selected" state of various widgets. - * @see aria-checked @see aria-pressed. */ + /** + * Indicates the current "selected" state of various widgets. + * @see aria-checked @see aria-pressed. + */ 'aria-selected'?: boolean | 'undefined' | 'false' | 'true'; - /** Defines the number of items in the current set of listitems or treeitems. Not required if all elements in the set are - * present in the DOM. - * @see aria-posinset. */ + /** + * Defines the number of items in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM. + * @see aria-posinset. + */ 'aria-setsize'?: number; /** Indicates if items in a table or grid are sorted in ascending or descending order. */ 'aria-sort'?: 'none' | 'ascending' | 'descending' | 'other'; @@ -2627,8 +2672,10 @@ declare namespace React { 'aria-valuemax'?: number; /** Defines the minimum allowed value for a range widget. */ 'aria-valuemin'?: number; - /** Defines the current value for a range widget. - * @see aria-valuetext. */ + /** + * Defines the current value for a range widget. + * @see aria-valuetext. + */ 'aria-valuenow'?: number; /** Defines the human readable text alternative of aria-valuenow for a range widget. */ 'aria-valuetext'?: string; diff --git a/types/react/v15/index.d.ts b/types/react/v15/index.d.ts index 72a14d9abb..5169c8d2e8 100644 --- a/types/react/v15/index.d.ts +++ b/types/react/v15/index.d.ts @@ -2428,141 +2428,188 @@ declare namespace React { unselectable?: boolean; } - // All the WAI-ARIA 1.1 attributes - // https://www.w3.org/TR/wai-aria-1.1/ + // All the WAI-ARIA 1.1 attributes from https://www.w3.org/TR/wai-aria-1.1/ interface HTMLAttributes extends DOMAttributes { /** Identifies the currently active element when DOM focus is on a composite widget, textbox, group, or application. */ - 'aria-activedescendant'?: string; - /** Indicates whether assistive technologies will present all, or only parts of, the changed region based on the change - * notifications defined by the aria-relevant attribute. */ - 'aria-atomic'?: boolean; - /** Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for - * an input and specifies how predictions would be presented if they are made. */ - 'aria-autocomplete'?: 'none' | 'inline' | 'list' | 'both'; - /** Indicates an element is being modified and that assistive technologies MAY want to wait until the modifications are - * complete before exposing them to the user. */ - 'aria-busy'?: boolean; - /** Indicates the current "checked" state of checkboxes, radio buttons, and other widgets. - * @see aria-pressed @see aria-selected. */ - 'aria-checked'?: boolean | 'false' | 'mixed' | 'true'; - /** Defines the total number of columns in a table, grid, or treegrid. - * @see aria-colindex. */ - 'aria-colcount'?: number; - /** Defines an element's column index or position with respect to the total number of columns within a table, grid, or - * treegrid. - * @see aria-colcount @see aria-colspan. */ - 'aria-colindex'?: number; - /** Defines the number of columns spanned by a cell or gridcell within a table, grid, or treegrid. - * @see aria-colindex @see aria-rowspan. */ - 'aria-colspan'?: number; - /** Indicates the element that represents the current item within a container or set of related elements. */ - 'aria-current'?: boolean | 'false' | 'true' | 'page' | 'step' | 'location' | 'date' | 'time'; - /** Identifies the element (or elements) that describes the object. - * @see aria-labelledby */ - 'aria-describedby'?: string; - /** Identifies the element that provides a detailed, extended description for the object. - * @see aria-describedby. */ - 'aria-details'?: string; - /** Indicates that the element is perceivable but disabled, so it is not editable or otherwise operable. - * @see aria-hidden @see aria-readonly. */ - 'aria-disabled'?: boolean; - /** Indicates what functions can be performed when a dragged object is released on the drop target. - * @deprecated in ARIA 1.1 */ - 'aria-dropeffect'?: 'none' | 'copy' | 'execute' | 'link' | 'move' | 'popup'; - /** Identifies the element that provides an error message for the object. - * @see aria-invalid @see aria-describedby. */ - 'aria-errormessage'?: string; - /** Indicates whether the element, or another grouping element it controls, is currently expanded or collapsed. */ - 'aria-expanded'?: boolean; - /** Identifies the next element (or elements) in an alternate reading order of content which, at the user's discretion, - * allows assistive technology to override the general default of reading in document source order. */ - 'aria-flowto'?: string; - /** Indicates an element's "grabbed" state in a drag-and-drop operation. - * @deprecated in ARIA 1.1 */ - 'aria-grabbed'?: boolean; - /** Indicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an - * element. */ - 'aria-haspopup'?: boolean | 'false' | 'true' | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog'; - /** Indicates whether the element is exposed to an accessibility API. - * @see aria-disabled. */ - 'aria-hidden'?: boolean; - /** Indicates the entered value does not conform to the format expected by the application. - * @see aria-errormessage. */ - 'aria-invalid'?: boolean | 'false' | 'true' | 'grammar' | 'spelling'; - /** Indicates keyboard shortcuts that an author has implemented to activate or give focus to an element. */ - 'aria-keyshortcuts'?: string; - /** Defines a string value that labels the current element. - * @see aria-labelledby. */ - 'aria-label'?: string; - /** Identifies the element (or elements) that labels the current element. - * @see aria-describedby. */ - 'aria-labelledby'?: string; - /** Defines the hierarchical level of an element within a structure. */ - 'aria-level'?: number; - /** Indicates that an element will be updated, and describes the types of updates the user agents, assistive technologies, - * and user can expect from the live region. */ - 'aria-live'?: 'off' | 'assertive' | 'polite'; - /** Indicates whether an element is modal when displayed. */ - 'aria-modal'?: boolean; - /** Indicates whether a text box accepts multiple lines of input or only a single line. */ - 'aria-multiline'?: boolean; - /** Indicates that the user may select more than one item from the current selectable descendants. */ - 'aria-multiselectable'?: boolean; - /** Indicates whether the element's orientation is horizontal, vertical, or unknown/ambiguous. */ - 'aria-orientation'?: 'undefined' | 'horizontal' | 'vertical'; - /** Identifies an element (or elements) in order to define a visual, functional, or contextual parent/child relationship - * between DOM - * elements where the DOM hierarchy cannot be used to represent the relationship. - * @see aria-controls. */ - 'aria-owns'?: string; - /** Defines a short hint (a word or short phrase) intended to aid the user with data entry when the control has no value. - * A hint could be a sample value or a brief description of the expected format. */ - 'aria-placeholder'?: string; - /** Defines an element's number or position in the current set of listitems or treeitems. Not required if all elements in - * the set are present in the DOM. - * @see aria-setsize. */ - 'aria-posinset'?: number; - /** Indicates the current "pressed" state of toggle buttons. - * @see aria-checked @see aria-selected. */ - 'aria-pressed'?: boolean | 'undefined' | 'false' | 'mixed' | 'true'; - /** Indicates that the element is not editable, but is otherwise operable. - * @see aria-disabled. */ - 'aria-readonly'?: boolean; - /** Indicates what notifications the user agent will trigger when the accessibility tree within a live region is modified. - * @see aria-atomic. */ - 'aria-relevant'?: 'additions' | 'additions text' | 'all' | 'removals' | 'text'; - /** Indicates that user input is required on the element before a form may be submitted. */ - 'aria-required'?: boolean; - /** Defines a human-readable, author-localized description for the role of an element. */ - 'aria-roledescription'?: string; - /** Defines the total number of rows in a table, grid, or treegrid. - * @see aria-rowindex. */ - 'aria-rowcount'?: number; - /** Defines an element's row index or position with respect to the total number of rows within a table, grid, or treegrid. - * @see aria-rowcount @see aria-rowspan. */ - 'aria-rowindex'?: number; - /** Defines the number of rows spanned by a cell or gridcell within a table, grid, or treegrid. - * @see aria-rowindex @see aria-colspan. */ - 'aria-rowspan'?: number; - /** Indicates the current "selected" state of various widgets. - * @see aria-checked @see aria-pressed. */ - 'aria-selected'?: boolean | 'undefined' | 'false' | 'true'; - /** Defines the number of items in the current set of listitems or treeitems. Not required if all elements in the set are - * present in the DOM. - * @see aria-posinset. */ - 'aria-setsize'?: number; - /** Indicates if items in a table or grid are sorted in ascending or descending order. */ - 'aria-sort'?: 'none' | 'ascending' | 'descending' | 'other'; - /** Defines the maximum allowed value for a range widget. */ - 'aria-valuemax'?: number; - /** Defines the minimum allowed value for a range widget. */ - 'aria-valuemin'?: number; - /** Defines the current value for a range widget. - * @see aria-valuetext. */ - 'aria-valuenow'?: number; - /** Defines the human readable text alternative of aria-valuenow for a range widget. */ - 'aria-valuetext'?: string; - } + 'aria-activedescendant'?: string; + /** Indicates whether assistive technologies will present all, or only parts of, the changed region based on the change notifications defined by the aria-relevant attribute. */ + 'aria-atomic'?: boolean; + /** + * Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for an input and specifies how predictions would be + * presented if they are made. + */ + 'aria-autocomplete'?: 'none' | 'inline' | 'list' | 'both'; + /** Indicates an element is being modified and that assistive technologies MAY want to wait until the modifications are complete before exposing them to the user. */ + 'aria-busy'?: boolean; + /** + * Indicates the current "checked" state of checkboxes, radio buttons, and other widgets. + * @see aria-pressed @see aria-selected. + */ + 'aria-checked'?: boolean | 'false' | 'mixed' | 'true'; + /** + * Defines the total number of columns in a table, grid, or treegrid. + * @see aria-colindex. + */ + 'aria-colcount'?: number; + /** + * Defines an element's column index or position with respect to the total number of columns within a table, grid, or treegrid. + * @see aria-colcount @see aria-colspan. + */ + 'aria-colindex'?: number; + /** + * Defines the number of columns spanned by a cell or gridcell within a table, grid, or treegrid. + * @see aria-colindex @see aria-rowspan. + */ + 'aria-colspan'?: number; + /** Indicates the element that represents the current item within a container or set of related elements. */ + 'aria-current'?: boolean | 'false' | 'true' | 'page' | 'step' | 'location' | 'date' | 'time'; + /** + * Identifies the element (or elements) that describes the object. + * @see aria-labelledby + */ + 'aria-describedby'?: string; + /** + * Identifies the element that provides a detailed, extended description for the object. + * @see aria-describedby. + */ + 'aria-details'?: string; + /** + * Indicates that the element is perceivable but disabled, so it is not editable or otherwise operable. + * @see aria-hidden @see aria-readonly. + */ + 'aria-disabled'?: boolean; + /** + * Indicates what functions can be performed when a dragged object is released on the drop target. + * @deprecated in ARIA 1.1 + */ + 'aria-dropeffect'?: 'none' | 'copy' | 'execute' | 'link' | 'move' | 'popup'; + /** + * Identifies the element that provides an error message for the object. + * @see aria-invalid @see aria-describedby. + */ + 'aria-errormessage'?: string; + /** Indicates whether the element, or another grouping element it controls, is currently expanded or collapsed. */ + 'aria-expanded'?: boolean; + /** + * Identifies the next element (or elements) in an alternate reading order of content which, at the user's discretion, + * allows assistive technology to override the general default of reading in document source order. + */ + 'aria-flowto'?: string; + /** + * Indicates an element's "grabbed" state in a drag-and-drop operation. + * @deprecated in ARIA 1.1 + */ + 'aria-grabbed'?: boolean; + /** Indicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an element. */ + 'aria-haspopup'?: boolean | 'false' | 'true' | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog'; + /** + * Indicates whether the element is exposed to an accessibility API. + * @see aria-disabled. + */ + 'aria-hidden'?: boolean; + /** + * Indicates the entered value does not conform to the format expected by the application. + * @see aria-errormessage. + */ + 'aria-invalid'?: boolean | 'false' | 'true' | 'grammar' | 'spelling'; + /** Indicates keyboard shortcuts that an author has implemented to activate or give focus to an element. */ + 'aria-keyshortcuts'?: string; + /** + * Defines a string value that labels the current element. + * @see aria-labelledby. + */ + 'aria-label'?: string; + /** + * Identifies the element (or elements) that labels the current element. + * @see aria-describedby. + */ + 'aria-labelledby'?: string; + /** Defines the hierarchical level of an element within a structure. */ + 'aria-level'?: number; + /** Indicates that an element will be updated, and describes the types of updates the user agents, assistive technologies, and user can expect from the live region. */ + 'aria-live'?: 'off' | 'assertive' | 'polite'; + /** Indicates whether an element is modal when displayed. */ + 'aria-modal'?: boolean; + /** Indicates whether a text box accepts multiple lines of input or only a single line. */ + 'aria-multiline'?: boolean; + /** Indicates that the user may select more than one item from the current selectable descendants. */ + 'aria-multiselectable'?: boolean; + /** Indicates whether the element's orientation is horizontal, vertical, or unknown/ambiguous. */ + 'aria-orientation'?: 'undefined' | 'horizontal' | 'vertical'; + /** + * Identifies an element (or elements) in order to define a visual, functional, or contextual parent/child relationship + * between DOM elements where the DOM hierarchy cannot be used to represent the relationship. + * @see aria-controls. + */ + 'aria-owns'?: string; + /** + * Defines a short hint (a word or short phrase) intended to aid the user with data entry when the control has no value. + * A hint could be a sample value or a brief description of the expected format. + */ + 'aria-placeholder'?: string; + /** + * Defines an element's number or position in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM. + * @see aria-setsize. + */ + 'aria-posinset'?: number; + /** + * Indicates the current "pressed" state of toggle buttons. + * @see aria-checked @see aria-selected. + */ + 'aria-pressed'?: boolean | 'undefined' | 'false' | 'mixed' | 'true'; + /** + * Indicates that the element is not editable, but is otherwise operable. + * @see aria-disabled. + */ + 'aria-readonly'?: boolean; + /** + * Indicates what notifications the user agent will trigger when the accessibility tree within a live region is modified. + * @see aria-atomic. + */ + 'aria-relevant'?: 'additions' | 'additions text' | 'all' | 'removals' | 'text'; + /** Indicates that user input is required on the element before a form may be submitted. */ + 'aria-required'?: boolean; + /** Defines a human-readable, author-localized description for the role of an element. */ + 'aria-roledescription'?: string; + /** + * Defines the total number of rows in a table, grid, or treegrid. + * @see aria-rowindex. + */ + 'aria-rowcount'?: number; + /** + * Defines an element's row index or position with respect to the total number of rows within a table, grid, or treegrid. + * @see aria-rowcount @see aria-rowspan. + */ + 'aria-rowindex'?: number; + /** + * Defines the number of rows spanned by a cell or gridcell within a table, grid, or treegrid. + * @see aria-rowindex @see aria-colspan. + */ + 'aria-rowspan'?: number; + /** + * Indicates the current "selected" state of various widgets. + * @see aria-checked @see aria-pressed. + */ + 'aria-selected'?: boolean | 'undefined' | 'false' | 'true'; + /** + * Defines the number of items in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM. + * @see aria-posinset. + */ + 'aria-setsize'?: number; + /** Indicates if items in a table or grid are sorted in ascending or descending order. */ + 'aria-sort'?: 'none' | 'ascending' | 'descending' | 'other'; + /** Defines the maximum allowed value for a range widget. */ + 'aria-valuemax'?: number; + /** Defines the minimum allowed value for a range widget. */ + 'aria-valuemin'?: number; + /** + * Defines the current value for a range widget. + * @see aria-valuetext. + */ + 'aria-valuenow'?: number; + /** Defines the human readable text alternative of aria-valuenow for a range widget. */ + 'aria-valuetext'?: string; + } interface AllHTMLAttributes extends HTMLAttributes { // Standard HTML Attributes From eebfcef80eec96a3c823b0e73e32f297050241bf Mon Sep 17 00:00:00 2001 From: Craig Kovatch Date: Thu, 4 Jan 2018 14:23:28 -0800 Subject: [PATCH 0016/1382] Add 'true' and 'false' options to boolean attributes, remove incorrect 'undefined' options --- types/react/index.d.ts | 28 ++++++++++++++-------------- types/react/v15/index.d.ts | 28 ++++++++++++++-------------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/types/react/index.d.ts b/types/react/index.d.ts index e3c3f53bb8..9277ed2986 100644 --- a/types/react/index.d.ts +++ b/types/react/index.d.ts @@ -2503,14 +2503,14 @@ declare namespace React { /** Identifies the currently active element when DOM focus is on a composite widget, textbox, group, or application. */ 'aria-activedescendant'?: string; /** Indicates whether assistive technologies will present all, or only parts of, the changed region based on the change notifications defined by the aria-relevant attribute. */ - 'aria-atomic'?: boolean; + 'aria-atomic'?: boolean | 'false' | 'true'; /** * Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for an input and specifies how predictions would be * presented if they are made. */ 'aria-autocomplete'?: 'none' | 'inline' | 'list' | 'both'; /** Indicates an element is being modified and that assistive technologies MAY want to wait until the modifications are complete before exposing them to the user. */ - 'aria-busy'?: boolean; + 'aria-busy'?: boolean | 'false' | 'true'; /** * Indicates the current "checked" state of checkboxes, radio buttons, and other widgets. * @see aria-pressed @see aria-selected. @@ -2547,7 +2547,7 @@ declare namespace React { * Indicates that the element is perceivable but disabled, so it is not editable or otherwise operable. * @see aria-hidden @see aria-readonly. */ - 'aria-disabled'?: boolean; + 'aria-disabled'?: boolean | 'false' | 'true'; /** * Indicates what functions can be performed when a dragged object is released on the drop target. * @deprecated in ARIA 1.1 @@ -2559,7 +2559,7 @@ declare namespace React { */ 'aria-errormessage'?: string; /** Indicates whether the element, or another grouping element it controls, is currently expanded or collapsed. */ - 'aria-expanded'?: boolean; + 'aria-expanded'?: boolean | 'false' | 'true'; /** * Identifies the next element (or elements) in an alternate reading order of content which, at the user's discretion, * allows assistive technology to override the general default of reading in document source order. @@ -2569,14 +2569,14 @@ declare namespace React { * Indicates an element's "grabbed" state in a drag-and-drop operation. * @deprecated in ARIA 1.1 */ - 'aria-grabbed'?: boolean; + 'aria-grabbed'?: boolean | 'false' | 'true'; /** Indicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an element. */ 'aria-haspopup'?: boolean | 'false' | 'true' | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog'; /** * Indicates whether the element is exposed to an accessibility API. * @see aria-disabled. */ - 'aria-hidden'?: boolean; + 'aria-hidden'?: boolean | 'false' | 'true'; /** * Indicates the entered value does not conform to the format expected by the application. * @see aria-errormessage. @@ -2599,13 +2599,13 @@ declare namespace React { /** Indicates that an element will be updated, and describes the types of updates the user agents, assistive technologies, and user can expect from the live region. */ 'aria-live'?: 'off' | 'assertive' | 'polite'; /** Indicates whether an element is modal when displayed. */ - 'aria-modal'?: boolean; + 'aria-modal'?: boolean | 'false' | 'true'; /** Indicates whether a text box accepts multiple lines of input or only a single line. */ - 'aria-multiline'?: boolean; + 'aria-multiline'?: boolean | 'false' | 'true'; /** Indicates that the user may select more than one item from the current selectable descendants. */ - 'aria-multiselectable'?: boolean; + 'aria-multiselectable'?: boolean | 'false' | 'true'; /** Indicates whether the element's orientation is horizontal, vertical, or unknown/ambiguous. */ - 'aria-orientation'?: 'undefined' | 'horizontal' | 'vertical'; + 'aria-orientation'?: 'horizontal' | 'vertical'; /** * Identifies an element (or elements) in order to define a visual, functional, or contextual parent/child relationship * between DOM elements where the DOM hierarchy cannot be used to represent the relationship. @@ -2626,19 +2626,19 @@ declare namespace React { * Indicates the current "pressed" state of toggle buttons. * @see aria-checked @see aria-selected. */ - 'aria-pressed'?: boolean | 'undefined' | 'false' | 'mixed' | 'true'; + 'aria-pressed'?: boolean | 'false' | 'mixed' | 'true'; /** * Indicates that the element is not editable, but is otherwise operable. * @see aria-disabled. */ - 'aria-readonly'?: boolean; + 'aria-readonly'?: boolean | 'false' | 'true'; /** * Indicates what notifications the user agent will trigger when the accessibility tree within a live region is modified. * @see aria-atomic. */ 'aria-relevant'?: 'additions' | 'additions text' | 'all' | 'removals' | 'text'; /** Indicates that user input is required on the element before a form may be submitted. */ - 'aria-required'?: boolean; + 'aria-required'?: boolean | 'false' | 'true'; /** Defines a human-readable, author-localized description for the role of an element. */ 'aria-roledescription'?: string; /** @@ -2660,7 +2660,7 @@ declare namespace React { * Indicates the current "selected" state of various widgets. * @see aria-checked @see aria-pressed. */ - 'aria-selected'?: boolean | 'undefined' | 'false' | 'true'; + 'aria-selected'?: boolean | 'false' | 'true'; /** * Defines the number of items in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM. * @see aria-posinset. diff --git a/types/react/v15/index.d.ts b/types/react/v15/index.d.ts index 5169c8d2e8..797d21f0d8 100644 --- a/types/react/v15/index.d.ts +++ b/types/react/v15/index.d.ts @@ -2433,14 +2433,14 @@ declare namespace React { /** Identifies the currently active element when DOM focus is on a composite widget, textbox, group, or application. */ 'aria-activedescendant'?: string; /** Indicates whether assistive technologies will present all, or only parts of, the changed region based on the change notifications defined by the aria-relevant attribute. */ - 'aria-atomic'?: boolean; + 'aria-atomic'?: boolean | 'false' | 'true'; /** * Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for an input and specifies how predictions would be * presented if they are made. */ 'aria-autocomplete'?: 'none' | 'inline' | 'list' | 'both'; /** Indicates an element is being modified and that assistive technologies MAY want to wait until the modifications are complete before exposing them to the user. */ - 'aria-busy'?: boolean; + 'aria-busy'?: boolean | 'false' | 'true'; /** * Indicates the current "checked" state of checkboxes, radio buttons, and other widgets. * @see aria-pressed @see aria-selected. @@ -2477,7 +2477,7 @@ declare namespace React { * Indicates that the element is perceivable but disabled, so it is not editable or otherwise operable. * @see aria-hidden @see aria-readonly. */ - 'aria-disabled'?: boolean; + 'aria-disabled'?: boolean | 'false' | 'true'; /** * Indicates what functions can be performed when a dragged object is released on the drop target. * @deprecated in ARIA 1.1 @@ -2489,7 +2489,7 @@ declare namespace React { */ 'aria-errormessage'?: string; /** Indicates whether the element, or another grouping element it controls, is currently expanded or collapsed. */ - 'aria-expanded'?: boolean; + 'aria-expanded'?: boolean | 'false' | 'true'; /** * Identifies the next element (or elements) in an alternate reading order of content which, at the user's discretion, * allows assistive technology to override the general default of reading in document source order. @@ -2499,14 +2499,14 @@ declare namespace React { * Indicates an element's "grabbed" state in a drag-and-drop operation. * @deprecated in ARIA 1.1 */ - 'aria-grabbed'?: boolean; + 'aria-grabbed'?: boolean | 'false' | 'true'; /** Indicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an element. */ 'aria-haspopup'?: boolean | 'false' | 'true' | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog'; /** * Indicates whether the element is exposed to an accessibility API. * @see aria-disabled. */ - 'aria-hidden'?: boolean; + 'aria-hidden'?: boolean | 'false' | 'true'; /** * Indicates the entered value does not conform to the format expected by the application. * @see aria-errormessage. @@ -2529,13 +2529,13 @@ declare namespace React { /** Indicates that an element will be updated, and describes the types of updates the user agents, assistive technologies, and user can expect from the live region. */ 'aria-live'?: 'off' | 'assertive' | 'polite'; /** Indicates whether an element is modal when displayed. */ - 'aria-modal'?: boolean; + 'aria-modal'?: boolean | 'false' | 'true'; /** Indicates whether a text box accepts multiple lines of input or only a single line. */ - 'aria-multiline'?: boolean; + 'aria-multiline'?: boolean | 'false' | 'true'; /** Indicates that the user may select more than one item from the current selectable descendants. */ - 'aria-multiselectable'?: boolean; + 'aria-multiselectable'?: boolean | 'false' | 'true'; /** Indicates whether the element's orientation is horizontal, vertical, or unknown/ambiguous. */ - 'aria-orientation'?: 'undefined' | 'horizontal' | 'vertical'; + 'aria-orientation'?: 'horizontal' | 'vertical'; /** * Identifies an element (or elements) in order to define a visual, functional, or contextual parent/child relationship * between DOM elements where the DOM hierarchy cannot be used to represent the relationship. @@ -2556,19 +2556,19 @@ declare namespace React { * Indicates the current "pressed" state of toggle buttons. * @see aria-checked @see aria-selected. */ - 'aria-pressed'?: boolean | 'undefined' | 'false' | 'mixed' | 'true'; + 'aria-pressed'?: boolean | 'false' | 'mixed' | 'true'; /** * Indicates that the element is not editable, but is otherwise operable. * @see aria-disabled. */ - 'aria-readonly'?: boolean; + 'aria-readonly'?: boolean | 'false' | 'true'; /** * Indicates what notifications the user agent will trigger when the accessibility tree within a live region is modified. * @see aria-atomic. */ 'aria-relevant'?: 'additions' | 'additions text' | 'all' | 'removals' | 'text'; /** Indicates that user input is required on the element before a form may be submitted. */ - 'aria-required'?: boolean; + 'aria-required'?: boolean | 'false' | 'true'; /** Defines a human-readable, author-localized description for the role of an element. */ 'aria-roledescription'?: string; /** @@ -2590,7 +2590,7 @@ declare namespace React { * Indicates the current "selected" state of various widgets. * @see aria-checked @see aria-pressed. */ - 'aria-selected'?: boolean | 'undefined' | 'false' | 'true'; + 'aria-selected'?: boolean | 'false' | 'true'; /** * Defines the number of items in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM. * @see aria-posinset. From 0565f573b66721dd76b625ed3696ecc561d8b95d Mon Sep 17 00:00:00 2001 From: Craig Kovatch Date: Sat, 6 Jan 2018 11:11:44 -0800 Subject: [PATCH 0017/1382] Add tests --- types/react/test/index.ts | 6 +++++- types/react/test/tsx.tsx | 11 +++++++++++ types/react/v15/test/index.ts | 6 +++++- types/react/v15/test/tsx.tsx | 11 +++++++++++ 4 files changed, 32 insertions(+), 2 deletions(-) diff --git a/types/react/test/index.ts b/types/react/test/index.ts index e8aabfa35c..06a72c2bcb 100644 --- a/types/react/test/index.ts +++ b/types/react/test/index.ts @@ -307,7 +307,11 @@ const htmlAttr: React.HTMLProps = { }, dangerouslySetInnerHTML: { __html: "STRONG" - } + }, + 'aria-atomic': false, + 'aria-checked': 'true', + 'aria-colcount': 7, + 'aria-label': 'test' }; DOM.div(htmlAttr); DOM.span(htmlAttr); diff --git a/types/react/test/tsx.tsx b/types/react/test/tsx.tsx index 38d902c387..26c2ff9d41 100644 --- a/types/react/test/tsx.tsx +++ b/types/react/test/tsx.tsx @@ -41,6 +41,17 @@ StatelessComponent2.defaultProps = { foo ; +// WAI-ARIA 1.1 Attributes +
+ bar +
; + interface Props { hello: string; } diff --git a/types/react/v15/test/index.ts b/types/react/v15/test/index.ts index 340ea94ec2..e4b324916d 100644 --- a/types/react/v15/test/index.ts +++ b/types/react/v15/test/index.ts @@ -346,7 +346,11 @@ const htmlAttr: React.HTMLProps = { }, dangerouslySetInnerHTML: { __html: "STRONG" - } + }, + 'aria-atomic': false, + 'aria-checked': 'true', + 'aria-colcount': 7, + 'aria-label': 'test' }; React.DOM.div(htmlAttr); React.DOM.span(htmlAttr); diff --git a/types/react/v15/test/tsx.tsx b/types/react/v15/test/tsx.tsx index 8afb75d9a8..7f781cb8fc 100644 --- a/types/react/v15/test/tsx.tsx +++ b/types/react/v15/test/tsx.tsx @@ -41,6 +41,17 @@ StatelessComponent2.defaultProps = { foo ; +// WAI-ARIA 1.1 Attributes +
+ bar +
; + interface Props { hello: string; } From b540b2e9e0f95ebb59798bbf4dff5d8c36dd5041 Mon Sep 17 00:00:00 2001 From: Craig Kovatch Date: Sat, 6 Jan 2018 11:13:19 -0800 Subject: [PATCH 0018/1382] Revert incorrect use of $ExpectError --- types/react/test/tsx.tsx | 1 - types/react/v15/test/tsx.tsx | 1 - 2 files changed, 2 deletions(-) diff --git a/types/react/test/tsx.tsx b/types/react/test/tsx.tsx index 26c2ff9d41..bc48add9a4 100644 --- a/types/react/test/tsx.tsx +++ b/types/react/test/tsx.tsx @@ -47,7 +47,6 @@ StatelessComponent2.defaultProps = { aria-checked='true' aria-colcount={7} aria-label='test' - ariaExpanded='false' // $ExpectError > bar ; diff --git a/types/react/v15/test/tsx.tsx b/types/react/v15/test/tsx.tsx index 7f781cb8fc..289a912a3f 100644 --- a/types/react/v15/test/tsx.tsx +++ b/types/react/v15/test/tsx.tsx @@ -47,7 +47,6 @@ StatelessComponent2.defaultProps = { aria-checked='true' aria-colcount={7} aria-label='test' - ariaExpanded='false' // $ExpectError > bar ; From 3cda7bec3b72d0fb0b2d1ca554939856c620c512 Mon Sep 17 00:00:00 2001 From: Jovica Zoric Date: Thu, 11 Jan 2018 15:14:01 +0100 Subject: [PATCH 0019/1382] Add missing placeholderRenderer prop --- types/react-sortable-tree/index.d.ts | 9 +++++++++ .../react-sortable-tree/react-sortable-tree-tests.tsx | 11 ++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/types/react-sortable-tree/index.d.ts b/types/react-sortable-tree/index.d.ts index dfed930e2f..2b9d1d1a6c 100644 --- a/types/react-sortable-tree/index.d.ts +++ b/types/react-sortable-tree/index.d.ts @@ -87,6 +87,14 @@ export interface NodeRendererProps { canDrop?: boolean; } +export type PlaceholderRenderer = React.ComponentClass; + +export interface PlaceholderRendererProps { + isOver: boolean; + canDrop: boolean; + draggedNode: {[index: string]: any}; +} + type NumberArrayOrStringArray = string[] | number[]; export interface ReactSortableTreeProps { @@ -113,6 +121,7 @@ export interface ReactSortableTreeProps { isVirtualized?: boolean; nodeContentRenderer?: NodeRenderer; dndType?: string; + placeholderRenderer?: PlaceholderRenderer; } declare const SortableTree: React.ComponentClass; diff --git a/types/react-sortable-tree/react-sortable-tree-tests.tsx b/types/react-sortable-tree/react-sortable-tree-tests.tsx index 106415744b..154a7284c6 100644 --- a/types/react-sortable-tree/react-sortable-tree-tests.tsx +++ b/types/react-sortable-tree/react-sortable-tree-tests.tsx @@ -11,10 +11,18 @@ import SortableTree, ExtendedNodeData, FullTree, OnVisibilityToggleData, - PreviousAnNextLocation + PreviousAnNextLocation, + PlaceholderRendererProps } from "react-sortable-tree"; import { ListProps, ListRowRenderer } from "react-virtualized"; +class PlaceholderRenderer extends React.Component { + render() { + const backgroundColor = this.props.isOver ? 'green' : 'red'; + return
Custom Placeholder class
; + } +} + class Test extends React.Component { render() { const treeData = [ @@ -55,6 +63,7 @@ class Test extends React.Component { isVirtualized={true} nodeContentRenderer={nodeRenderer} dndType="testNodeType" + placeholderRenderer={PlaceholderRenderer} /> Date: Wed, 17 Jan 2018 16:39:49 +0900 Subject: [PATCH 0020/1382] Adding definition for Database#configure --- types/sqlite3/index.d.ts | 2 ++ types/sqlite3/sqlite3-tests.ts | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/types/sqlite3/index.d.ts b/types/sqlite3/index.d.ts index 921845e5a0..26f69d526d 100644 --- a/types/sqlite3/index.d.ts +++ b/types/sqlite3/index.d.ts @@ -83,6 +83,8 @@ export class Database extends events.EventEmitter { on(event: "error", listener: (err: Error) => void): this; on(event: "open" | "close", listener: () => void): this; on(event: string, listener: (...args: any[]) => void): this; + + configure(option: "busyTimeout", value: number): void; } export function verbose(): void; diff --git a/types/sqlite3/sqlite3-tests.ts b/types/sqlite3/sqlite3-tests.ts index 4ddfa0a502..ee5e4b17d7 100644 --- a/types/sqlite3/sqlite3-tests.ts +++ b/types/sqlite3/sqlite3-tests.ts @@ -5,7 +5,8 @@ let db: sqlite3.Database = new sqlite3.Database('chain.sqlite3', () => {}); function createDb() { console.log("createDb chain"); - db = new sqlite3.Database('chain.sqlite3', createTable); + db = new sqlite3.Database('chain.sqlite3', createTable); + db.configure("busyTimeout", 1000); } function createTable() { From 7ae2eba53391edc454d0f75a2f04ad7db5475434 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Sun, 21 Jan 2018 19:29:28 -0800 Subject: [PATCH 0021/1382] Allowed functions in jest's describe As of 22.0.5, jest allows classes for describe blocks. --- types/jest/index.d.ts | 2 +- types/jest/jest-tests.ts | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/types/jest/index.d.ts b/types/jest/index.d.ts index 0ba1762485..669a96fa23 100644 --- a/types/jest/index.d.ts +++ b/types/jest/index.d.ts @@ -220,7 +220,7 @@ declare namespace jest { } interface Describe { - (name: string, fn: EmptyFunction): void; + (name: string | Function, fn: EmptyFunction): void; only: Describe; skip: Describe; } diff --git a/types/jest/jest-tests.ts b/types/jest/jest-tests.ts index 4d8ae05e1c..146c848a72 100644 --- a/types/jest/jest-tests.ts +++ b/types/jest/jest-tests.ts @@ -10,6 +10,10 @@ declare const $: any; // Tests based on the Jest website jest.unmock('../sum'); +class TestClass { } + +describe(TestClass, () => { }); + describe('sum', () => { it('adds 1 + 2 to equal 3', () => { const sum: (a: number, b: number) => number = require('../sum'); From 983acb16764911e46947688579d0e5129c737a11 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Sun, 21 Jan 2018 19:33:28 -0800 Subject: [PATCH 0022/1382] Bumped jest version in types to 22.0.5 --- types/jest/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/jest/index.d.ts b/types/jest/index.d.ts index 669a96fa23..218eef8457 100644 --- a/types/jest/index.d.ts +++ b/types/jest/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Jest 22.0 +// Type definitions for Jest 22.0.5 // Project: http://facebook.github.io/jest/ // Definitions by: Asana // Ivo Stratev From 4b3b60fd821a294f33abf5095a4dca0b68b54c4e Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Sun, 21 Jan 2018 22:05:01 -0800 Subject: [PATCH 0023/1382] Used a ClassLike interface because of ban-types --- types/jest/index.d.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/types/jest/index.d.ts b/types/jest/index.d.ts index 218eef8457..ba36a036d6 100644 --- a/types/jest/index.d.ts +++ b/types/jest/index.d.ts @@ -199,6 +199,10 @@ declare namespace jest { type Lifecycle = (fn: ProvidesCallback, timeout?: number) => any; + interface IClassLike { + readonly name: string; + } + /** * Creates a test closure */ @@ -220,7 +224,7 @@ declare namespace jest { } interface Describe { - (name: string | Function, fn: EmptyFunction): void; + (name: number | string | IClassLike, fn: EmptyFunction): void; only: Describe; skip: Describe; } From 2a858618c3f721512c52cbf8bbe943d8b7be4931 Mon Sep 17 00:00:00 2001 From: Hugues Stefanski Date: Mon, 29 Jan 2018 20:44:25 +0100 Subject: [PATCH 0024/1382] 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 0025/1382] 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 0026/1382] 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 0027/1382] 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 0028/1382] 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 0029/1382] 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 0030/1382] 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 0031/1382] 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 0032/1382] 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 0033/1382] 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 0034/1382] 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 0035/1382] 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 1621caf0dfdceac25e5ecc5748184c9edcefb079 Mon Sep 17 00:00:00 2001 From: Mathieu Masy Date: Mon, 5 Feb 2018 16:57:56 -0500 Subject: [PATCH 0036/1382] [react-form] Updated typings --- types/react-form/index.d.ts | 9 ++++-- types/react-form/react-form-tests.tsx | 44 +++++++++++++++++++++++++++ types/react-form/tsconfig.json | 2 +- 3 files changed, 52 insertions(+), 3 deletions(-) diff --git a/types/react-form/index.d.ts b/types/react-form/index.d.ts index 965f55e7e7..debc89488c 100644 --- a/types/react-form/index.d.ts +++ b/types/react-form/index.d.ts @@ -1,6 +1,7 @@ -// Type definitions for react-form 2.12 +// Type definitions for react-form 2.16 // Project: https://github.com/tannerlinsley/react-form#readme // Definitions by: Cameron McAteer +// Mathieu Masy // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -18,7 +19,7 @@ export interface FormErrors { [key: string]: FormError; } export type NestedErrors = Nested; -export type RenderReturn = JSX.Element | false | null; +export type RenderReturn = JSX.Element | false | null | never[]; export interface FormState { values: FormValues; @@ -29,7 +30,10 @@ export interface FormState { } export interface FormProps { + component?: React.ReactType<{ formApi: FormApi }>; + render?: (formApi: FormApi) => RenderReturn; dontValidateOnMount?: boolean; + validateOnSubmit?: boolean; defaultValues?: FormValues; onSubmit?(values: FormValues, submissionEvent: React.SyntheticEvent, formApi: FormApi): void; preSubmit?(values: FormValues, formApi: FormApi): FormValues; @@ -43,6 +47,7 @@ export interface FormProps { [field: string]: (value: FormValue) => Promise }; dontPreventDefault?: boolean; + getApi?: (formApi: FormApi) => void; } export interface FormApi { diff --git a/types/react-form/react-form-tests.tsx b/types/react-form/react-form-tests.tsx index 2d08cc4b8a..36aa86db94 100644 --- a/types/react-form/react-form-tests.tsx +++ b/types/react-form/react-form-tests.tsx @@ -21,6 +21,50 @@ import { FormApi } from 'react-form'; +// Form Api +class FormApiMethods extends React.Component { + constructor(props: {}) { + super(props); + this.state = {}; + } + + render() { + const FormContent = (props: { formApi?: FormApi }) => ( +
{}}> + + + + ); + + return ( +
+
+ { formApi => ( + + + + + )} + + +
( + + + + + )}> + + +
+ + + +
+
+ ); + } +} + // Basic Form Example const statusOptions = [ { diff --git a/types/react-form/tsconfig.json b/types/react-form/tsconfig.json index cc5dcb26ba..43d05d6dc6 100644 --- a/types/react-form/tsconfig.json +++ b/types/react-form/tsconfig.json @@ -23,4 +23,4 @@ "index.d.ts", "react-form-tests.tsx" ] -} \ No newline at end of file +} From 3eb8d0c31adb111d48011296ae2ddaec327143fa Mon Sep 17 00:00:00 2001 From: Mathieu Masy Date: Wed, 7 Feb 2018 14:20:16 -0500 Subject: [PATCH 0037/1382] [react-form] Added placeholder prop on Select component --- types/react-form/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/react-form/index.d.ts b/types/react-form/index.d.ts index debc89488c..4dc7e4b1b2 100644 --- a/types/react-form/index.d.ts +++ b/types/react-form/index.d.ts @@ -142,6 +142,7 @@ export type SelectOptions = Array<{ export interface SelectProps extends FieldProps, React.SelectHTMLAttributes { options: SelectOptions; + placeholder: string; } export const Select: React.StatelessComponent; From b47fc25da9455080fd29806247a38b8b27fb9cfe Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Wed, 7 Feb 2018 16:36:08 -0800 Subject: [PATCH 0038/1382] Renamed to FunctionLike; allowed Function --- types/jest/index.d.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/types/jest/index.d.ts b/types/jest/index.d.ts index ba36a036d6..2d67c8fa97 100644 --- a/types/jest/index.d.ts +++ b/types/jest/index.d.ts @@ -199,7 +199,7 @@ declare namespace jest { type Lifecycle = (fn: ProvidesCallback, timeout?: number) => any; - interface IClassLike { + interface FunctionLike { readonly name: string; } @@ -224,7 +224,8 @@ declare namespace jest { } interface Describe { - (name: number | string | IClassLike, fn: EmptyFunction): void; + // tslint:disable-next-line ban-types + (name: number | string | Function | FunctionLike, fn: EmptyFunction): void; only: Describe; skip: Describe; } From 4e7c1db217790ca5aacf9851c64663b85aaf3a7f Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Wed, 7 Feb 2018 16:36:59 -0800 Subject: [PATCH 0039/1382] Added my name there too; why not? --- types/jest/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/jest/index.d.ts b/types/jest/index.d.ts index 2d67c8fa97..f58540fbe2 100644 --- a/types/jest/index.d.ts +++ b/types/jest/index.d.ts @@ -10,6 +10,7 @@ // Waseem Dahman // Jamie Mason // Douglas Duteil +// Josh Goldberg // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 From 570c7db5d8b02755269dc32e2faf97088d418fc5 Mon Sep 17 00:00:00 2001 From: Andrea Ascari Date: Wed, 7 Feb 2018 17:34:36 +0100 Subject: [PATCH 0040/1382] 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 9f14ab9919d4b18bcf9252288285ababbf448b16 Mon Sep 17 00:00:00 2001 From: Wayne Dela Cruz Date: Mon, 12 Feb 2018 23:02:55 +0800 Subject: [PATCH 0041/1382] Create filter query typing --- types/mongodb/index.d.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/types/mongodb/index.d.ts b/types/mongodb/index.d.ts index dd4f44f38a..a2a30c9f1e 100644 --- a/types/mongodb/index.d.ts +++ b/types/mongodb/index.d.ts @@ -635,6 +635,21 @@ export interface Collection { watch(pipeline?: Object[], options?: ChangeStreamOptions & { session?: ClientSession }): ChangeStream; } +type FilterQuery = { + [P in keyof T]?: T[P] | { + $eq?: T[P]; + $gt?: T[P]; + $gte?: T[P]; + $in?: T[P][]; + $lt?: T[P]; + $lte?: T[P]; + $ne?: T[P]; + $nin?: T[P][]; + $and?: FilterQuery[]; + $not?: FilterQuery[] | T[P]; + }; +}; + // Documentation: http://docs.mongodb.org/manual/reference/command/collStats/ export interface CollStats { // Namespace. From 3a4de187b2edaf2d09e60e6269c05e5509005e49 Mon Sep 17 00:00:00 2001 From: Wayne Dela Cruz Date: Mon, 12 Feb 2018 23:06:36 +0800 Subject: [PATCH 0042/1382] Collection use filter query --- types/mongodb/index.d.ts | 60 ++++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/types/mongodb/index.d.ts b/types/mongodb/index.d.ts index a2a30c9f1e..d9d6a21bdc 100644 --- a/types/mongodb/index.d.ts +++ b/types/mongodb/index.d.ts @@ -482,13 +482,13 @@ export interface Collection { createIndexes(indexSpecs: Object[], options?: {session?: ClientSession}): Promise; createIndexes(indexSpecs: Object[], options: {session?: ClientSession}, callback: MongoCallback): void; /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#deleteMany */ - deleteMany(filter: Object, callback: MongoCallback): void; - deleteMany(filter: Object, options?: CommonOptions): Promise; - deleteMany(filter: Object, options: CommonOptions, callback: MongoCallback): void; + deleteMany(filter: FilterQuery, callback: MongoCallback): void; + deleteMany(filter: FilterQuery, options?: CommonOptions): Promise; + deleteMany(filter: FilterQuery, options: CommonOptions, callback: MongoCallback): void; /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#deleteOne */ - deleteOne(filter: Object, callback: MongoCallback): void; - deleteOne(filter: Object, options?: CommonOptions & { bypassDocumentValidation?: boolean }): Promise; - deleteOne(filter: Object, options: CommonOptions & { bypassDocumentValidation?: boolean }, callback: MongoCallback): void; + deleteOne(filter: FilterQuery, callback: MongoCallback): void; + deleteOne(filter: FilterQuery, options?: CommonOptions & { bypassDocumentValidation?: boolean }): Promise; + deleteOne(filter: FilterQuery, options: CommonOptions & { bypassDocumentValidation?: boolean }, callback: MongoCallback): void; /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#distinct */ distinct(key: string, query: Object, callback: MongoCallback): void; distinct(key: string, query: Object, options?: { readPreference?: ReadPreference | string, maxTimeMS?: number, session?: ClientSession }): Promise; @@ -510,21 +510,21 @@ export interface Collection { /** @deprecated */ find(query: Object, options?: FindOneOptions): Cursor; /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#findOne */ - findOne(filter: Object, callback: MongoCallback): void; - findOne(filter: Object, options?: FindOneOptions): Promise; - findOne(filter: Object, options: FindOneOptions, callback: MongoCallback): void; + findOne(filter: FilterQuery, callback: MongoCallback): void; + findOne(filter: FilterQuery, options?: FindOneOptions): Promise; + findOne(filter: FilterQuery, options: FindOneOptions, callback: MongoCallback): void; /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#findOneAndDelete */ - findOneAndDelete(filter: Object, callback: MongoCallback>): void; - findOneAndDelete(filter: Object, options?: { projection?: Object, sort?: Object, maxTimeMS?: number, session?: ClientSession }): Promise>; - findOneAndDelete(filter: Object, options: { projection?: Object, sort?: Object, maxTimeMS?: number, session?: ClientSession }, callback: MongoCallback>): void; + findOneAndDelete(filter: FilterQuery, callback: MongoCallback>): void; + findOneAndDelete(filter: FilterQuery, options?: { projection?: Object, sort?: Object, maxTimeMS?: number, session?: ClientSession }): Promise>; + findOneAndDelete(filter: FilterQuery, options: { projection?: Object, sort?: Object, maxTimeMS?: number, session?: ClientSession }, callback: MongoCallback>): void; /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#findOneAndReplace */ - findOneAndReplace(filter: Object, replacement: Object, callback: MongoCallback>): void; - findOneAndReplace(filter: Object, replacement: Object, options?: FindOneAndReplaceOption): Promise>; - findOneAndReplace(filter: Object, replacement: Object, options: FindOneAndReplaceOption, callback: MongoCallback>): void; + findOneAndReplace(filter: FilterQuery, replacement: Object, callback: MongoCallback>): void; + findOneAndReplace(filter: FilterQuery, replacement: Object, options?: FindOneAndReplaceOption): Promise>; + findOneAndReplace(filter: FilterQuery, replacement: Object, options: FindOneAndReplaceOption, callback: MongoCallback>): void; /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#findOneAndUpdate */ - findOneAndUpdate(filter: Object, update: Object, callback: MongoCallback>): void; - findOneAndUpdate(filter: Object, update: Object, options?: FindOneAndReplaceOption): Promise>; - findOneAndUpdate(filter: Object, update: Object, options: FindOneAndReplaceOption, callback: MongoCallback>): void; + findOneAndUpdate(filter: FilterQuery, update: Object, callback: MongoCallback>): void; + findOneAndUpdate(filter: FilterQuery, update: Object, options?: FindOneAndReplaceOption): Promise>; + findOneAndUpdate(filter: FilterQuery, update: Object, options: FindOneAndReplaceOption, callback: MongoCallback>): void; /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#geoHaystackSearch */ geoHaystackSearch(x: number, y: number, callback: MongoCallback): void; geoHaystackSearch(x: number, y: number, options?: GeoHaystackSearchOptions): Promise; @@ -602,9 +602,9 @@ export interface Collection { rename(newName: string, options?: { dropTarget?: boolean, session?: ClientSession }): Promise>; rename(newName: string, options: { dropTarget?: boolean, session?: ClientSession }, callback: MongoCallback>): void; /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#replaceOne */ - replaceOne(filter: Object, doc: Object, callback: MongoCallback): void; - replaceOne(filter: Object, doc: Object, options?: ReplaceOneOptions): Promise; - replaceOne(filter: Object, doc: Object, options: ReplaceOneOptions, callback: MongoCallback): void; + replaceOne(filter: FilterQuery, doc: Object, callback: MongoCallback): void; + replaceOne(filter: FilterQuery, doc: Object, options?: ReplaceOneOptions): Promise; + replaceOne(filter: FilterQuery, doc: Object, options: ReplaceOneOptions, callback: MongoCallback): void; /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#save */ /** @deprecated Use insertOne, insertMany, updateOne or updateMany */ save(doc: Object, callback: MongoCallback): void; @@ -618,19 +618,19 @@ export interface Collection { stats(options: { scale: number, session?: ClientSession }, callback: MongoCallback): void; /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#update */ /** @deprecated use updateOne, updateMany or bulkWrite */ - update(filter: Object, update: Object, callback: MongoCallback): void; + update(filter: FilterQuery, update: Object, callback: MongoCallback): void; /** @deprecated use updateOne, updateMany or bulkWrite */ - update(filter: Object, update: Object, options?: ReplaceOneOptions & { multi?: boolean }): Promise; + update(filter: FilterQuery, update: Object, options?: ReplaceOneOptions & { multi?: boolean }): Promise; /** @deprecated use updateOne, updateMany or bulkWrite */ - update(filter: Object, update: Object, options: ReplaceOneOptions & { multi?: boolean }, callback: MongoCallback): void; + update(filter: FilterQuery, update: Object, options: ReplaceOneOptions & { multi?: boolean }, callback: MongoCallback): void; /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#updateMany */ - updateMany(filter: Object, update: Object, callback: MongoCallback): void; - updateMany(filter: Object, update: Object, options?: CommonOptions & { upsert?: boolean }): Promise; - updateMany(filter: Object, update: Object, options: CommonOptions & { upsert?: boolean }, callback: MongoCallback): void; + updateMany(filter: FilterQuery, update: Object, callback: MongoCallback): void; + updateMany(filter: FilterQuery, update: Object, options?: CommonOptions & { upsert?: boolean }): Promise; + updateMany(filter: FilterQuery, update: Object, options: CommonOptions & { upsert?: boolean }, callback: MongoCallback): void; /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#updateOne */ - updateOne(filter: Object, update: Object, callback: MongoCallback): void; - updateOne(filter: Object, update: Object, options?: ReplaceOneOptions): Promise; - updateOne(filter: Object, update: Object, options: ReplaceOneOptions, callback: MongoCallback): void; + updateOne(filter: FilterQuery, update: Object, callback: MongoCallback): void; + updateOne(filter: FilterQuery, update: Object, options?: ReplaceOneOptions): Promise; + updateOne(filter: FilterQuery, update: Object, options: ReplaceOneOptions, callback: MongoCallback): void; /** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#watch */ watch(pipeline?: Object[], options?: ChangeStreamOptions & { session?: ClientSession }): ChangeStream; } From cad9bcefb7eca399a54ec52d774f70ad011c6da6 Mon Sep 17 00:00:00 2001 From: Wayne Dela Cruz Date: Mon, 12 Feb 2018 23:31:22 +0800 Subject: [PATCH 0043/1382] Add more typings --- types/mongodb/index.d.ts | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/types/mongodb/index.d.ts b/types/mongodb/index.d.ts index d9d6a21bdc..cebf31e32c 100644 --- a/types/mongodb/index.d.ts +++ b/types/mongodb/index.d.ts @@ -645,8 +645,30 @@ type FilterQuery = { $lte?: T[P]; $ne?: T[P]; $nin?: T[P][]; - $and?: FilterQuery[]; - $not?: FilterQuery[] | T[P]; + $and?: (FilterQuery | T[P])[]; + $not?: (FilterQuery | T[P])[] | T[P]; + $expr?: any; + $jsonSchema?: any; + $mod?: [number, number]; + $regex?: RegExp; + $options?: string; + $text?: { + $search: string; + $language?: string; + $caseSensitive?: boolean; + $diacraticSensitive?: boolean; + }; + $where: Object; + $geoIntersects?: Object; + $geoWithin?: Object; + $near?: Object; + $nearSphere?: Object; + $elemMatch?: Object; + $size?: number; + $bitsAllClear?: Object; + $bitsAllSet?: Object; + $bitsAnyClear?: Object; + $bitsAnySet?: Object; }; }; From 4c8fb4edcb6567474e00564e0431cbffa8e93b1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20H=C3=B8is=C3=A6ther=20Rasch?= Date: Tue, 13 Feb 2018 22:03:10 +0100 Subject: [PATCH 0044/1382] add new chrome.devtools.inspectedWindow.eval overload Additional Overload accepts the new optional options parameter. fixes https://github.com/DefinitelyTyped/DefinitelyTyped/issues/23597 --- types/chrome/index.d.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/types/chrome/index.d.ts b/types/chrome/index.d.ts index cd12179213..8d3a8a80ab 100644 --- a/types/chrome/index.d.ts +++ b/types/chrome/index.d.ts @@ -1678,6 +1678,17 @@ declare namespace chrome.devtools.inspectedWindow { * Parameter exceptionInfo: An object providing details if an exception occurred while evaluating the expression. */ export function eval(expression: string, callback?: (result: T, exceptionInfo: EvaluationExceptionInfo) => void): void; + /** + * Evaluates a JavaScript expression in the context of the main frame of the inspected page. The expression must evaluate to a JSON-compliant object, otherwise an exception is thrown. The eval function can report either a DevTools-side error or a JavaScript exception that occurs during evaluation. In either case, the result parameter of the callback is undefined. In the case of a DevTools-side error, the isException parameter is non-null and has isError set to true and code set to an error code. In the case of a JavaScript error, isException is set to true and value is set to the string value of thrown object. + * @param expression An expression to evaluate. + * @param options The options parameter can contain one or more options. + * @param callback A function called when evaluation completes. + * If you specify the callback parameter, it should be a function that looks like this: + * function(object result, object exceptionInfo) {...}; + * Parameter result: The result of evaluation. + * Parameter exceptionInfo: An object providing details if an exception occurred while evaluating the expression. + */ + export function eval(expression: string, options: EvalOptions, callback?: (result: T, exceptionInfo: EvaluationExceptionInfo) => void): void; /** * Retrieves the list of resources from the inspected page. * @param callback A function that receives the list of resources when the request completes. @@ -1690,6 +1701,15 @@ declare namespace chrome.devtools.inspectedWindow { export var onResourceAdded: ResourceAddedEvent; /** Fired when a new revision of the resource is committed (e.g. user saves an edited version of the resource in the Developer Tools). */ export var onResourceContentCommitted: ResourceContentCommittedEvent; + + export interface EvalOptions { + /** If specified, the expression is evaluated on the iframe whose URL matches the one specified. By default, the expression is evaluated in the top frame of the inspected page. */ + frameURL?: string; + /** Evaluate the expression in the context of the content script of the calling extension, provided that the content script is already injected into the inspected page. If not, the expression is not evaluated and the callback is invoked with the exception parameter set to an object that has the isError field set to true and the code field set to E_NOTFOUND. */ + useContentScriptContext?: boolean; + /** Evaluate the expression in the context of a content script of an extension that matches the specified origin. If given, contextSecurityOrigin overrides the 'true' setting on userContentScriptContext. */ + contextSecurityOrigin?: string; + } } //////////////////// From 866f915fbe5d3cfb4e05b2a2f9ed7c3bb0f44c14 Mon Sep 17 00:00:00 2001 From: Andrew Shepherd Date: Wed, 14 Feb 2018 08:14:06 +1000 Subject: [PATCH 0045/1382] TS7006 error on showNativeTouchCallibration Compiling with `noImplicitAny` set to `true` created the following warning: > node_modules/@types/chrome/chrome-app.d.ts(1192,71): error TS7006: Parameter 'success' implicitly has an 'any' type. The method `showNativeTouchCalibration` is documented here: https://developer.chrome.com/apps/system_display#method-showNativeTouchCalibration It describes callback as such: > If you specify the callback parameter, it should be a function that looks like this: > > `function(boolean success) {...};` --- types/chrome/chrome-app.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/chrome/chrome-app.d.ts b/types/chrome/chrome-app.d.ts index 4ecf1d344a..65d80f3290 100644 --- a/types/chrome/chrome-app.d.ts +++ b/types/chrome/chrome-app.d.ts @@ -1189,7 +1189,7 @@ declare namespace chrome.system.display { * @param {string} id The display's unique identifier. * @param {(success) => void} callback Optional callback to inform the caller that the touch calibration has ended. The argument of the callback informs if the calibration was a success or not. */ - export function showNativeTouchCalibration(id: string, callback: (success) => void): void; + export function showNativeTouchCalibration(id: string, callback: (success: boolean) => void): void; /** * @description Starts custom touch calibration for a display. This should be called when using a custom UX for collecting calibration data. If another touch calibration is already in progress this will throw an error. From 4531a3601c108cf612d9a57c92773e5a0ceba2e4 Mon Sep 17 00:00:00 2001 From: samuelneff Date: Wed, 14 Feb 2018 04:56:11 +0000 Subject: [PATCH 0046/1382] 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 + + + +