From 46356052281b869c51e3e2d94a194262ab84322e Mon Sep 17 00:00:00 2001 From: Silas Rech Date: Mon, 30 Jul 2018 14:34:34 +0200 Subject: [PATCH 01/56] mapbox.Marker is evented and has the draggable option --- types/mapbox-gl/index.d.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/types/mapbox-gl/index.d.ts b/types/mapbox-gl/index.d.ts index 5f64b7470b..f52ac4ed98 100644 --- a/types/mapbox-gl/index.d.ts +++ b/types/mapbox-gl/index.d.ts @@ -752,7 +752,7 @@ declare namespace mapboxgl { /** * Marker */ - export class Marker { + export class Marker extends Evented { constructor(options?: mapboxgl.MarkerOptions); constructor(element?: HTMLElement, options?: mapboxgl.MarkerOptions); @@ -784,6 +784,8 @@ declare namespace mapboxgl { anchor?: Anchor; color?: string + + draggable?: boolean; } /** From 12be6e51b75212221322a8d078c293abe0aa06da Mon Sep 17 00:00:00 2001 From: Scott Trinh Date: Thu, 2 Aug 2018 14:26:48 -0400 Subject: [PATCH 02/56] [knex] Allow QueryBuilder in union parameters --- types/knex/index.d.ts | 6 +++--- types/knex/knex-tests.ts | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/types/knex/index.d.ts b/types/knex/index.d.ts index fe8d46658a..8ef03fa704 100644 --- a/types/knex/index.d.ts +++ b/types/knex/index.d.ts @@ -312,9 +312,9 @@ declare namespace Knex { } interface Union { - (callback: QueryCallback, wrap?: boolean): QueryBuilder; - (callbacks: QueryCallback[], wrap?: boolean): QueryBuilder; - (...callbacks: QueryCallback[]): QueryBuilder; + (callback: QueryCallback | QueryBuilder, wrap?: boolean): QueryBuilder; + (callbacks: (QueryCallback | QueryBuilder)[], wrap?: boolean): QueryBuilder; + (...callbacks: (QueryCallback | QueryBuilder)[]): QueryBuilder; // (...callbacks: QueryCallback[], wrap?: boolean): QueryInterface; } diff --git a/types/knex/knex-tests.ts b/types/knex/knex-tests.ts index 329ed9d414..0037948415 100644 --- a/types/knex/knex-tests.ts +++ b/types/knex/knex-tests.ts @@ -1145,3 +1145,19 @@ knex('characters') .whereIn(['name', 'class'], function() { this.select('name', 'class').from('characters'); }); + +knex('characters') + .select() + .where({ name: 'Bar', class: 'Fighter' }) + .union(knex('characters').select().where({ name: 'Foo', class: 'Druid' })); +knex('characters') + .select() + .where({ name: 'Bar', class: 'Fighter' }) + .union([knex('characters').select().where({ name: 'Foo', class: 'Druid' })]); +knex('characters') + .select() + .where({ name: 'Bar', class: 'Fighter' }) + .union( + knex('characters').select().where({ name: 'Foo', class: 'Druid' }), + knex('characters').select().where({ name: 'Baz', class: 'Paladin' }) + ); From d6504f702ad5b9d60f4c65ca2f7fd8c82ec0b50d Mon Sep 17 00:00:00 2001 From: Scott Trinh Date: Thu, 2 Aug 2018 15:24:58 -0400 Subject: [PATCH 03/56] Add Raw to union argument type-union --- types/knex/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/knex/index.d.ts b/types/knex/index.d.ts index 8ef03fa704..c1fb224fa0 100644 --- a/types/knex/index.d.ts +++ b/types/knex/index.d.ts @@ -312,9 +312,9 @@ declare namespace Knex { } interface Union { - (callback: QueryCallback | QueryBuilder, wrap?: boolean): QueryBuilder; - (callbacks: (QueryCallback | QueryBuilder)[], wrap?: boolean): QueryBuilder; - (...callbacks: (QueryCallback | QueryBuilder)[]): QueryBuilder; + (callback: QueryCallback | QueryBuilder | Raw, wrap?: boolean): QueryBuilder; + (callbacks: (QueryCallback | QueryBuilder | Raw)[], wrap?: boolean): QueryBuilder; + (...callbacks: (QueryCallback | QueryBuilder | Raw)[]): QueryBuilder; // (...callbacks: QueryCallback[], wrap?: boolean): QueryInterface; } From 4ee926dbad683b2b8702f567dadde08b6cfc9843 Mon Sep 17 00:00:00 2001 From: Andrew MacLeay Date: Thu, 2 Aug 2018 16:33:31 -0400 Subject: [PATCH 04/56] Allow readonly parameters to storybook knobs Since these functions don't modify their parameters, they may be readonly. Non-breaking change as mutable arrays are still allowed as well. --- types/storybook__addon-knobs/index.d.ts | 5 +++-- .../storybook__addon-knobs-tests.tsx | 8 ++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/types/storybook__addon-knobs/index.d.ts b/types/storybook__addon-knobs/index.d.ts index 3c9bbe0fc4..4d6eff536f 100644 --- a/types/storybook__addon-knobs/index.d.ts +++ b/types/storybook__addon-knobs/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/storybooks/storybook // Definitions by: Joscha Feth // Martynas Kadisa +// A.MacLeay // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -49,11 +50,11 @@ export function object(name: string, value: T, groupId?: string): T; export type SelectValue = string | number; export function select(name: string, options: { [s: string]: string }, value: T, groupId?: string): T; export function select(name: string, options: { [s: number]: string }, value: T, groupId?: string): T; -export function select(name: string, options: T[], value: T, groupId?: string): T; +export function select(name: string, options: ReadonlyArray, value: T, groupId?: string): T; export function date(name: string, value?: Date, groupId?: string): Date; -export function array(name: string, value: T[], separator?: string, groupId?: string): T[]; +export function array(name: string, value: ReadonlyArray, separator?: string, groupId?: string): T[]; export function button(name: string, handler: () => any, groupId?: string): void; diff --git a/types/storybook__addon-knobs/storybook__addon-knobs-tests.tsx b/types/storybook__addon-knobs/storybook__addon-knobs-tests.tsx index c35268ac6b..ee8f58893c 100644 --- a/types/storybook__addon-knobs/storybook__addon-knobs-tests.tsx +++ b/types/storybook__addon-knobs/storybook__addon-knobs-tests.tsx @@ -90,6 +90,14 @@ stories.add('dynamic knobs', () => { ); }); +const readonlyOptionsArray: ReadonlyArray = ['hi']; +select('With readonly array', readonlyOptionsArray, readonlyOptionsArray[0]); + +const genericArray = array('With regular array', ['hi', 'there']); + +const userInputArray = array('With readonly array', readonlyOptionsArray); +userInputArray.push('Make sure that the output is still mutable although the input need not be!'); + // groups const groupId = 'GROUP-ID1'; From 5c3924cd39c56d26b8569c69910ac4a05cfafee9 Mon Sep 17 00:00:00 2001 From: LexSwed Date: Sun, 5 Aug 2018 16:35:45 +0300 Subject: [PATCH 05/56] Sync latest parse-git-config api changes --- types/parse-git-config/index.d.ts | 8 ++++---- types/parse-git-config/parse-git-config-tests.ts | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/types/parse-git-config/index.d.ts b/types/parse-git-config/index.d.ts index b3302106b0..9ed1f04155 100644 --- a/types/parse-git-config/index.d.ts +++ b/types/parse-git-config/index.d.ts @@ -36,10 +36,10 @@ interface Parse { * If no arguments are passed, the .git/config file relative to process.cwd() is used. */ sync(options?: (Options | object) | string): Config; - /** - * Returns an object with only the properties that had ini-style keys converted to objects. - */ - keys(config: Config): Config; + /** + * Returns an object with only the properties that had ini-style keys converted to objects. + */ + expandKeys(config: Config): Config; } // no-empty-interface is disabled for a better debugging experience. Empty interfaces are used to alias a type alias. diff --git a/types/parse-git-config/parse-git-config-tests.ts b/types/parse-git-config/parse-git-config-tests.ts index c5ce43040a..a6d2a4c983 100644 --- a/types/parse-git-config/parse-git-config-tests.ts +++ b/types/parse-git-config/parse-git-config-tests.ts @@ -99,12 +99,12 @@ function test_sync() { } } -function test_keys() { +function test_expandKeys() { const config = { 'foo "bar"': { doStuff: true }, 'foo "baz"': { doStuff: true } }; - const keys = parse.keys(config); + const keys = parse.expandKeys(config); keys.foo.bar.doStuff === true; keys.foo.baz.doStuff === true; From 92796daeb7141e903115b089425815dd62e678ec Mon Sep 17 00:00:00 2001 From: LexSwed Date: Sun, 5 Aug 2018 16:43:14 +0300 Subject: [PATCH 06/56] parse-git-config - fix tabulation --- types/parse-git-config/index.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/types/parse-git-config/index.d.ts b/types/parse-git-config/index.d.ts index 9ed1f04155..cae3e74a45 100644 --- a/types/parse-git-config/index.d.ts +++ b/types/parse-git-config/index.d.ts @@ -36,10 +36,10 @@ interface Parse { * If no arguments are passed, the .git/config file relative to process.cwd() is used. */ sync(options?: (Options | object) | string): Config; - /** - * Returns an object with only the properties that had ini-style keys converted to objects. - */ - expandKeys(config: Config): Config; + /** + * Returns an object with only the properties that had ini-style keys converted to objects. + */ + expandKeys(config: Config): Config; } // no-empty-interface is disabled for a better debugging experience. Empty interfaces are used to alias a type alias. From 88e98cbc6b53b148eec2dc379a101d100d6a84a9 Mon Sep 17 00:00:00 2001 From: jansule Date: Mon, 6 Aug 2018 08:55:06 +0200 Subject: [PATCH 07/56] add-lineDashOffset-type --- types/openlayers/index.d.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/types/openlayers/index.d.ts b/types/openlayers/index.d.ts index a6122c8477..01d7e120f5 100644 --- a/types/openlayers/index.d.ts +++ b/types/openlayers/index.d.ts @@ -9,6 +9,7 @@ // Yair Tawil // Pierre Marchand // Hauke Stieler +// Jan Suleiman // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // Definitions partially generated using tsd-jsdoc (https://github.com/englercj/tsd-jsdoc) @@ -10135,6 +10136,13 @@ export namespace style { */ getLineDash(): number[]; + /** + * Get the line dash offset style for the stroke. + * @return Line dash offset + * @api + */ + getLineDashOffset(): number; + /** * Get the line join type for the stroke. * @return Line join. @@ -10186,6 +10194,14 @@ export namespace style { */ setLineDash(lineDash: number[]): void; + /** + * Set the line dash offset. + * + * @param lineDashOffset Line dash offset. + * @api + */ + setLineDashOffset(lineDashOffset: number): void; + /** * Set the line join. * @@ -12347,6 +12363,7 @@ export namespace olx { lineCap?: string; lineJoin?: string; lineDash?: number[]; + lineDashOffset?: number; miterLimit?: number; width?: number; } From bbf5ad55bb874bffbf9ae6b39c48b5defbc0d130 Mon Sep 17 00:00:00 2001 From: jansule Date: Mon, 6 Aug 2018 11:56:51 +0200 Subject: [PATCH 08/56] add unit tests for ol.style.Stroke --- types/openlayers/openlayers-tests.ts | 30 ++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/types/openlayers/openlayers-tests.ts b/types/openlayers/openlayers-tests.ts index fcf925886d..240f77d033 100644 --- a/types/openlayers/openlayers-tests.ts +++ b/types/openlayers/openlayers-tests.ts @@ -74,6 +74,7 @@ const style = new ol.style.Style(); const styleArray: ol.style.Style[] = []; const styleFunction: ol.StyleFunction = (feature, resolution) => style; let styleRegularShape: ol.style.RegularShape; +let styleStroke: ol.style.Stroke; const tilegrid = new ol.tilegrid.TileGrid({resolutions: numberArray}); const transformFn: ol.TransformFunction = (array, out, dimension) => numberArray; let units: ol.proj.Units; @@ -1111,6 +1112,35 @@ styleRegularShape = new ol.style.RegularShape({ points: 4, }); +// +// ol.style.Stroke +// + +styleStroke = new ol.style.Stroke(); +styleStroke.setColor('#FF0000'); +styleStroke.setColor('red'); +styleStroke.setColor('#CCC'); +styleStroke.setColor('rgb(255, 255, 255)'); +styleStroke.setColor('rgb(255, 255, 255, 0.7)'); +styleStroke.setLineCap('butt'); +styleStroke.setLineCap('round'); +styleStroke.setLineCap('square'); +styleStroke.setLineJoin('bevel'); +styleStroke.setLineJoin('round'); +styleStroke.setLineJoin('miter'); +styleStroke.setLineDash([10, 5]); +styleStroke.setLineDashOffset(10); +styleStroke.setMiterLimit(20); +styleStroke.setWidth(5); + +styleStroke.getColor(); +styleStroke.getLineCap(); +styleStroke.getLineJoin(); +styleStroke.getLineDash(); +styleStroke.getLineDashOffset(); +styleStroke.getMiterLimit(); +styleStroke.getWidth(); + // // ol.proj // From 4c1a28f43b8e152db7ac524aebdb2ae5cc03776d Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Mon, 6 Aug 2018 10:25:48 -0700 Subject: [PATCH 09/56] fork-ts-checker-webpack-plugin: Fix no-outside-dependencies lint failure --- types/fork-ts-checker-webpack-plugin/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/fork-ts-checker-webpack-plugin/package.json b/types/fork-ts-checker-webpack-plugin/package.json index bc1b130102..2371372125 100644 --- a/types/fork-ts-checker-webpack-plugin/package.json +++ b/types/fork-ts-checker-webpack-plugin/package.json @@ -1,6 +1,7 @@ { "private": true, "dependencies": { - "tslint": "*" + "tslint": "*", + "typescript": "*" } } From 0e95fac93cacc3a43b57849b9aef9f88eb068a0f Mon Sep 17 00:00:00 2001 From: Tereza Tomcova Date: Mon, 6 Aug 2018 20:15:44 +0200 Subject: [PATCH 10/56] fork-ts-checker-webpack-plugin: Don't limit Options.logger to Console type --- .../fork-ts-checker-webpack-plugin-tests.ts | 12 ++++++++++++ types/fork-ts-checker-webpack-plugin/index.d.ts | 8 +++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/types/fork-ts-checker-webpack-plugin/fork-ts-checker-webpack-plugin-tests.ts b/types/fork-ts-checker-webpack-plugin/fork-ts-checker-webpack-plugin-tests.ts index 78ead793b4..7f28a37597 100644 --- a/types/fork-ts-checker-webpack-plugin/fork-ts-checker-webpack-plugin-tests.ts +++ b/types/fork-ts-checker-webpack-plugin/fork-ts-checker-webpack-plugin-tests.ts @@ -21,4 +21,16 @@ config = { ] }; +config = { + plugins: [ + new ForkTsCheckerWebpackPlugin({ + logger: { + error: message => console.error(message), + warn: message => console.warn(message), + info: message => console.info(message), + } + }) + ] +}; + export default config; diff --git a/types/fork-ts-checker-webpack-plugin/index.d.ts b/types/fork-ts-checker-webpack-plugin/index.d.ts index ace3db5b24..715b1fe41b 100644 --- a/types/fork-ts-checker-webpack-plugin/index.d.ts +++ b/types/fork-ts-checker-webpack-plugin/index.d.ts @@ -73,6 +73,12 @@ declare namespace ForkTsCheckerWebpackPlugin { type Formatter = (message: NormalizedMessage, useColors: boolean) => string; + interface Logger { + error(message?: any): void; + warn(message?: any): void; + info(message?: any): void; + } + interface Options { tsconfig?: string; tslint?: string | true; @@ -81,7 +87,7 @@ declare namespace ForkTsCheckerWebpackPlugin { ignoreDiagnostics?: number[]; ignoreLints?: string[]; colors?: boolean; - logger?: Console; + logger?: Logger; formatter?: 'default' | 'codeframe' | Formatter; formatterOptions?: { highlightCode?: boolean From 6d4581efc2185408563229dddf7bd2fd2bb152d3 Mon Sep 17 00:00:00 2001 From: Michael Su Date: Tue, 7 Aug 2018 04:49:31 +1000 Subject: [PATCH 11/56] Fix signature of Picker.setCallback() (#27746) --- types/google.picker/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/google.picker/index.d.ts b/types/google.picker/index.d.ts index b5fc91404d..9a0c95f920 100644 --- a/types/google.picker/index.d.ts +++ b/types/google.picker/index.d.ts @@ -83,7 +83,7 @@ declare namespace google { */ export interface Picker { isVisible(): boolean; - setCallback():Picker; + setCallback(method:Function):Picker; setRelayUrl(url:string):Picker; setVisible(visible:boolean):Picker; } From c1c132972d8db7e9d3a2b095fa1eddd746a1d5dc Mon Sep 17 00:00:00 2001 From: Terry Mun Date: Mon, 6 Aug 2018 20:50:12 +0200 Subject: [PATCH 12/56] [@types/vimeo__player] Updating typings to match Vimeo's player.js v2.6.3 (#27749) * Updated typings to match Vimeo's player.js v2.6.3, updated tests to reflect new methods, properties, and events * Cleanup of unused boilerplate lines * setPlaybackRate may return RangeError * options argument in constructor is optional --- types/vimeo__player/index.d.ts | 19 +++++--- types/vimeo__player/vimeo__player-tests.ts | 50 +++++++++++++++++++++- 2 files changed, 62 insertions(+), 7 deletions(-) diff --git a/types/vimeo__player/index.d.ts b/types/vimeo__player/index.d.ts index d5f224975e..6fac1db7d9 100755 --- a/types/vimeo__player/index.d.ts +++ b/types/vimeo__player/index.d.ts @@ -1,13 +1,11 @@ -// Type definitions for @vimeo/player 2.0 +// Type definitions for @vimeo/player 2.6.3 // Project: https://github.com/vimeo/player.js // Definitions by: Denis Yılmaz // Felix Albert // Tim Chen +// Terry Mun // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -export function myMethod(a: string): string; -export function myOtherMethod(a: number): number; - export type CallbackFunction = (...args: any[]) => any; export interface Error {name: string; message: string; method: string; } @@ -22,11 +20,12 @@ export interface InvalidCuePoint extends Error {name: "InvalidCuePoint"; message export interface RangeError extends Error {name: "RangeError"; message: string; method: string; } export interface TypeError extends Error {name: "TypeError"; message: string; method: string; } -export type EventName = "play" | "pause" | "ended" | "timeupdate" | "progress" | "seeked" | "texttrackchange" | "cuechange" | "cuepoint" | "volumechange" | "error" | "loaded" | string; +export type EventName = "play" | "pause" | "ended" | "timeupdate" | "progress" | "seeked" | "texttrackchange" | + "cuechange" | "cuepoint" | "volumechange" | "playbackratechange" | "bufferstart" | "bufferend" | "error" | "loaded" | string; export type EventCallback = (data: any) => any; export class Player { - constructor(element: HTMLIFrameElement|HTMLElement|string, options: Options); + constructor(element: HTMLIFrameElement|HTMLElement|string, options?: Options); on(event: EventName, callback: EventCallback): void; off(event: EventName, callback?: EventCallback): void; @@ -51,6 +50,8 @@ export class Player { getLoop(): VimeoPromise; setLoop(loop: boolean): VimeoPromise; getPaused(): VimeoPromise; + getPlaybackRate(): VimeoPromise; + setPlaybackRate(playbackRate: number): VimeoPromise; getTextTracks(): VimeoPromise; getVideoEmbedCode(): VimeoPromise; getVideoId(): VimeoPromise; @@ -85,14 +86,20 @@ export interface Options { url?: string; autopause?: boolean; autoplay?: boolean; + background?: boolean; byline?: boolean; color?: string; height?: number; loop?: boolean; maxheight?: number; maxwidth?: number; + muted?: boolean; + playsinline?: boolean; portrait?: boolean; + responsive?: boolean; + speed?: boolean; title?: boolean; + transparent?: boolean; width?: number; } diff --git a/types/vimeo__player/vimeo__player-tests.ts b/types/vimeo__player/vimeo__player-tests.ts index bf5a637762..0dbba1a3a8 100644 --- a/types/vimeo__player/vimeo__player-tests.ts +++ b/types/vimeo__player/vimeo__player-tests.ts @@ -6,7 +6,21 @@ let player: Player ; player = new Player('handstick', { id: 19231868, - width: 640 + width: 640, + + // Use default values for settings, to test typings + autopause: true, + autoplay: false, + background: false, + byline: true, + color: '#00adef', + loop: false, + muted: false, + playsinline: true, + portrait: true, + speed: false, + title: true, + transparent: true }); const onPlay = (data: any) => { @@ -281,12 +295,33 @@ player.getPaused().then((paused) => { // an error occurred }); +player.getPlaybackRate().then((playbackRate) => { + // playbackRate = a numeric value of the current playback rate +}).catch((error) => { + // an error occurred +}); + +player.setPlaybackRate(0.5).then((playbackRate) => { + // playback rate was set +}).catch((error) => { + switch (error.name) { + case 'RangeError': + // the playback rate was less than 0.5 or greater than 2 + break; + + default: + // some other error occurred + break; + } +}); + player.getTextTracks().then((tracks) => { // tracks = an array of track objects tracks.forEach((track) => { console.log(track.label); console.log(track.kind); console.log(track.language); + console.log(track.mode); }); }).catch((error) => { // an error occurred @@ -436,6 +471,19 @@ player.on('volumechange', (data) => { console.log(data.volume); }); +player.on('playbackratechange', (data) => { + // data is an object containing properties specific to that event + console.log(data.playbackRate); +}); + +player.on('bufferstart', (data) => { + // no associated data with this event +}); + +player.on('bufferend', (data) => { + // no associated data with this event +}); + player.on('error', (data) => { // data is an object containing properties specific to that event console.log(data.message); From 80e003836d42901e8a83519b99195c2391aaf94c Mon Sep 17 00:00:00 2001 From: Stoian Ivanov Date: Mon, 6 Aug 2018 21:50:43 +0300 Subject: [PATCH 13/56] timezoneJS.Date.toString have a handy format parameter so we daclare it (#27755) --- types/timezone-js/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/timezone-js/index.d.ts b/types/timezone-js/index.d.ts index 5a648ab41e..ee39a7ee7b 100644 --- a/types/timezone-js/index.d.ts +++ b/types/timezone-js/index.d.ts @@ -19,7 +19,7 @@ export declare class Date { setTimezone: (timezone: string) => void; // regular Date members - toString(): string; + toString(format?:string): string; toDateString(): string; toTimeString(): string; toLocaleString(): string; From c687ee5d0cfb254cad4b74b1e6187c89594a6987 Mon Sep 17 00:00:00 2001 From: Tyler Johnson Date: Mon, 6 Aug 2018 12:52:06 -0600 Subject: [PATCH 14/56] PouchDB Database is an EventEmitter (#27771) --- types/pouchdb-core/index.d.ts | 2 +- types/pouchdb-core/pouchdb-core-tests.ts | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/types/pouchdb-core/index.d.ts b/types/pouchdb-core/index.d.ts index ddecfe843b..0dbf5def5b 100644 --- a/types/pouchdb-core/index.d.ts +++ b/types/pouchdb-core/index.d.ts @@ -626,7 +626,7 @@ declare namespace PouchDB { }; } - interface Database { + interface Database extends EventEmitter { /** The name passed to the PouchDB constructor and unique identifier of the database. */ name: string; diff --git a/types/pouchdb-core/pouchdb-core-tests.ts b/types/pouchdb-core/pouchdb-core-tests.ts index fe79997461..f8accd1c3a 100644 --- a/types/pouchdb-core/pouchdb-core-tests.ts +++ b/types/pouchdb-core/pouchdb-core-tests.ts @@ -114,6 +114,8 @@ function testBasics() { const db = new PouchDB(); + db.on("closed", () => {}); + db.post(model).then((result) => { isString(result.id); }); From b5d97138d0f10f785b57ed083b0cf9677a6899e8 Mon Sep 17 00:00:00 2001 From: Maxim-Alexandre Lalancette <5281703+malalancette@users.noreply.github.com> Date: Mon, 6 Aug 2018 14:52:30 -0400 Subject: [PATCH 15/56] Add autoHeight option (#27783) --- types/owl.carousel/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/owl.carousel/index.d.ts b/types/owl.carousel/index.d.ts index b1b093ef77..9b4fbe5e89 100644 --- a/types/owl.carousel/index.d.ts +++ b/types/owl.carousel/index.d.ts @@ -61,6 +61,7 @@ declare namespace OwlCarousel { dotsContainer?: string | boolean; checkVisible?: boolean; slideTransition?: string; + autoHeight?: boolean; // CLASSES refreshClass?: string; loadingClass?: string; From c16655d79794c636051d00a8256c4316d81e3d27 Mon Sep 17 00:00:00 2001 From: SagaTious <38312007+SagaTious@users.noreply.github.com> Date: Mon, 6 Aug 2018 20:52:43 +0200 Subject: [PATCH 16/56] material__menu CornerBit interface is wrong (#27836) * fix: The const Corner that this interface shall describe is using | as bitwise operator, in the interface description | is logical or though, so the interface is wrong. * style: Rearranged values to match @material/menu constants definition again --- types/material__menu/constants.d.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/types/material__menu/constants.d.ts b/types/material__menu/constants.d.ts index 8bec0c2e0c..8c76365ef8 100644 --- a/types/material__menu/constants.d.ts +++ b/types/material__menu/constants.d.ts @@ -66,12 +66,12 @@ export interface CornerBit extends MDCNumbers { * Likewise END maps to RIGHT or LEFT depending on the directionality. */ export interface Corner extends MDCNumbers { - TOP_LEFT: 0; - TOP_RIGHT: CornerBit["RIGHT"]; - BOTTOM_LEFT: CornerBit["BOTTOM"]; - BOTTOM_RIGHT: CornerBit["BOTTOM"] | CornerBit["RIGHT"]; - TOP_START: CornerBit["FLIP_RTL"]; - TOP_END: CornerBit["FLIP_RTL"] | CornerBit["RIGHT"]; - BOTTOM_START: CornerBit["BOTTOM"] | CornerBit["FLIP_RTL"]; - BOTTOM_END: CornerBit["BOTTOM"] | CornerBit["RIGHT"] | CornerBit["FLIP_RTL"]; + TOP_LEFT: 0; + TOP_RIGHT: 4; + BOTTOM_LEFT: 1; + BOTTOM_RIGHT: 5; + TOP_START: 8; + TOP_END: 12; + BOTTOM_START: 9; + BOTTOM_END: 13; } From 49e5c50d62e4d9000d34bf35ba9d844fb1eefaf3 Mon Sep 17 00:00:00 2001 From: Steven Sinatra <5153378+diagramatics@users.noreply.github.com> Date: Tue, 7 Aug 2018 04:53:34 +1000 Subject: [PATCH 17/56] Add selectV2 definition to @storybook/addon-knobs (#27848) --- types/storybook__addon-knobs/index.d.ts | 5 ++++- .../storybook__addon-knobs/storybook__addon-knobs-tests.tsx | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/types/storybook__addon-knobs/index.d.ts b/types/storybook__addon-knobs/index.d.ts index f421303f94..0ae9ace04b 100644 --- a/types/storybook__addon-knobs/index.d.ts +++ b/types/storybook__addon-knobs/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for @storybook/addon-knobs 3.3 +// Type definitions for @storybook/addon-knobs 3.4 // Project: https://github.com/storybooks/storybook // Definitions by: Joscha Feth // Martynas Kadisa @@ -51,6 +51,9 @@ export function select(name: string, options: { [s: string]: s export function select(name: string, options: { [s: number]: string }, value: T, groupId?: string): T; export function select(name: string, options: T[], value: T, groupId?: string): T; +export function selectV2(name: string, options: { [s: string]: T | T[] }, value: T | T[], groupId?: string): T; +export function selectV2(name: string, options: T[], value: T, groupId?: string): T; + export function date(name: string, value?: Date, groupId?: string): Date; export function array(name: string, value: T[], separator?: string, groupId?: string): T[]; diff --git a/types/storybook__addon-knobs/storybook__addon-knobs-tests.tsx b/types/storybook__addon-knobs/storybook__addon-knobs-tests.tsx index c35268ac6b..fb4d077109 100644 --- a/types/storybook__addon-knobs/storybook__addon-knobs-tests.tsx +++ b/types/storybook__addon-knobs/storybook__addon-knobs-tests.tsx @@ -14,6 +14,7 @@ import { array, button, knob, + selectV2, } from '@storybook/addon-knobs'; enum SomeEnum { @@ -49,13 +50,16 @@ stories.add('with all knobs', () => { type X = 'a' | 'b'; - const genericSelect: X = select('Some generic select', { a: 'type a', b: 'type b'}, 'b'); + const genericSelect: X = select('Some generic select', { a: 'type a', b: 'type b' }, 'b'); const enumSelectOptions: { [s: number]: string } = {}; enumSelectOptions[SomeEnum.Type1] = "Type 1"; enumSelectOptions[SomeEnum.Type2] = "Type 2"; const genericSelect2: SomeEnum = select('Some generic select', enumSelectOptions, SomeEnum.Type1); + const genericSelectV2: X = selectV2('Some generic select', { 'type a': 'a', 'type b': 'b' }, 'b'); + const genericSelectV2Enum: SomeEnum = selectV2('Some generic select v2', { 'type a': SomeEnum.Type1, 'type b': SomeEnum.Type2 }, SomeEnum.Type2); + const genericArray: string[] = array('Some generic array', ['red', 'green', 'blue']); const genericKnob: X = knob('Some generic knob', { value: 'a', type: 'text' }); From 9e26d926ebb8a172db1b18f5a9a5f7cb995c30d6 Mon Sep 17 00:00:00 2001 From: nemoinho Date: Mon, 6 Aug 2018 20:55:43 +0200 Subject: [PATCH 18/56] Update version of redom-types (#27856) --- types/redom/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/redom/index.d.ts b/types/redom/index.d.ts index 2814b63c61..fde67bfb12 100644 --- a/types/redom/index.d.ts +++ b/types/redom/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for redom 3.6 +// Type definitions for redom 3.12 // Project: https://github.com/redom/redom/ // Definitions by: Rauli Laine // Felix Nehrke From 059cf948f833f66e3fe6d74636c2323d25413159 Mon Sep 17 00:00:00 2001 From: remin Date: Tue, 7 Aug 2018 03:57:43 +0900 Subject: [PATCH 19/56] @types/react-resize-detector: Update to v3.1.0 (#27860) * update react-resize-detector to allow undefined onResize * update react-resize-detector * update test of react-resize-detector * fix format * add an author --- types/react-resize-detector/index.d.ts | 17 +++++-- .../react-resize-detector-tests.tsx | 48 ++++++++++++++----- 2 files changed, 49 insertions(+), 16 deletions(-) mode change 100644 => 100755 types/react-resize-detector/index.d.ts mode change 100644 => 100755 types/react-resize-detector/react-resize-detector-tests.tsx diff --git a/types/react-resize-detector/index.d.ts b/types/react-resize-detector/index.d.ts old mode 100644 new mode 100755 index ee9341a358..68f0382dba --- a/types/react-resize-detector/index.d.ts +++ b/types/react-resize-detector/index.d.ts @@ -1,6 +1,8 @@ -// Type definitions for react-resize-detector 2.2 +// Type definitions for react-resize-detector 3.1 // Project: https://github.com/maslianok/react-resize-detector -// Definitions by: Matthew James , James Greenleaf +// Definitions by: Matthew James +// James Greenleaf +// Remin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -8,7 +10,7 @@ import * as React from "react"; interface ReactResizeDetectorProps extends React.Props { /** Function that will be invoked with width and height arguments */ - onResize: (width: number, height: number) => void; + onResize?: (width: number, height: number) => void; /** Trigger onResize on height change. Default: false */ handleHeight?: boolean; /** Trigger onResize on width change. Default: false */ @@ -18,11 +20,18 @@ interface ReactResizeDetectorProps extends React.Props { /** Id of the element we want to observe. If none provided, parentElement of the component will be used. Default: "" */ resizableElementId?: string; /** Possible values: throttle and debounce */ - refreshMode?: 'throttle' | 'debounce'; + refreshMode?: "throttle" | "debounce"; /** Makes sense only when refreshMode is set. Default: 1000. */ refreshRate?: number; + + render?: (props: any) => React.ReactNode; } declare class ReactResizeDetector extends React.PureComponent { } +export declare function withResizeDetector( + WrappedComponent: React.ReactNode, + props?: ReactResizeDetectorProps +): React.Component; + export default ReactResizeDetector; diff --git a/types/react-resize-detector/react-resize-detector-tests.tsx b/types/react-resize-detector/react-resize-detector-tests.tsx old mode 100644 new mode 100755 index 42a76d8a52..d6e471f340 --- a/types/react-resize-detector/react-resize-detector-tests.tsx +++ b/types/react-resize-detector/react-resize-detector-tests.tsx @@ -2,8 +2,11 @@ import * as React from "react"; import * as ReactDOM from "react-dom"; +import ReactResizeDetector, { withResizeDetector } from "react-resize-detector"; -import ReactResizeRouter from "react-resize-detector"; +const CustomComponent = ({ width, height }: any) => ( +
{`${width}x${height}`}
+); class App extends React.PureComponent { constructor(props: {}) { @@ -13,17 +16,38 @@ class App extends React.PureComponent { } render(): JSX.Element { - return
-
Some child content
- -
; + return ( +
+
Some child content
+ + + {(width: number, height: number) => ( +
{`${width}x${height}`}
+ )} +
+ + + + {withResizeDetector(CustomComponent)} + ( +
+ Width:{width}, Height:{height} +
+ )} + /> +
+ ); } private handleResize(width: number, height: number) { From 3bf0d7c946487e8e5b977594060ef70fac342084 Mon Sep 17 00:00:00 2001 From: York Yao Date: Tue, 7 Aug 2018 02:59:01 +0800 Subject: [PATCH 20/56] [@types/node] add missing optional padding and saltLength (#27866) --- types/node/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 49fd7364e3..ed04749756 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -5863,8 +5863,8 @@ declare module "crypto" { export interface Signer extends NodeJS.WritableStream { update(data: string | Buffer | NodeJS.TypedArray | DataView): Signer; update(data: string, input_encoding: Utf8AsciiLatin1Encoding): Signer; - sign(private_key: string | { key: string; passphrase: string }): Buffer; - sign(private_key: string | { key: string; passphrase: string }, output_format: HexBase64Latin1Encoding): string; + sign(private_key: string | { key: string; passphrase: string, padding?: number, saltLength?: number }): Buffer; + sign(private_key: string | { key: string; passphrase: string, padding?: number, saltLength?: number }, output_format: HexBase64Latin1Encoding): string; } export function createVerify(algorith: string, options?: stream.WritableOptions): Verify; export interface Verify extends NodeJS.WritableStream { From 33698bbac399c50504b0108c725673307333de98 Mon Sep 17 00:00:00 2001 From: Francis Gulotta Date: Mon, 6 Aug 2018 15:00:56 -0400 Subject: [PATCH 21/56] ioredis: add some missing overloads and methods (#27870) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added the following for base redis and pipeline methods - Corrected the `set()` method’s arguments and returns - added the `setBuffer()` method - added the `hsetBuffer()` method - added the `hgetBuffer()` method --- types/ioredis/index.d.ts | 32 ++++++++++++++++++++++++++++++-- types/ioredis/ioredis-tests.ts | 19 ++++++++++++++++++- 2 files changed, 48 insertions(+), 3 deletions(-) diff --git a/types/ioredis/index.d.ts b/types/ioredis/index.d.ts index 45b334a205..e593f4dcc3 100644 --- a/types/ioredis/index.d.ts +++ b/types/ioredis/index.d.ts @@ -6,6 +6,7 @@ // Ebrahim // Shahar Mor // Whemoon Jang +// Francis Gulotta // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -65,10 +66,23 @@ declare namespace IORedis { get(key: string, callback: (err: Error, res: string) => void): void; get(key: string): Promise; + getBuffer(key: string, callback: (err: Error, res: Buffer) => void): void; getBuffer(key: string): Promise; - set(key: string, value: any, ...args: any[]): any; + set(key: string, value: any, expiryMode?: string | any[], time?: number | string, setMode?: number | string): Promise; + + set(key: string, value: any, callback: (err: Error, res: string) => void): void; + set(key: string, value: any, setMode: string | any[], callback: (err: Error, res: string) => void): void; + set(key: string, value: any, expiryMode: string, time: number | string, callback: (err: Error, res: string) => void): void; + set(key: string, value: any, expiryMode: string, time: number | string, setMode: number | string, callback: (err: Error, res: string) => void): void; + + setBuffer(key: string, value: any, expiryMode?: string | any[], time?: number | string, setMode?: number | string): Promise; + + setBuffer(key: string, value: any, callback: (err: Error, res: Buffer) => void): void; + setBuffer(key: string, value: any, setMode: string, callback: (err: Error, res: Buffer) => void): void; + setBuffer(key: string, value: any, expiryMode: string, time: number, callback: (err: Error, res: Buffer) => void): void; + setBuffer(key: string, value: any, expiryMode: string, time: number | string, setMode: number | string, callback: (err: Error, res: Buffer) => void): void; setnx(key: string, value: any, callback: (err: Error, res: any) => void): void; setnx(key: string, value: any): Promise; @@ -241,12 +255,16 @@ declare namespace IORedis { hset(key: string, field: string, value: any, callback: (err: Error, res: 0 | 1) => void): void; hset(key: string, field: string, value: any): Promise<0 | 1>; + hsetBuffer(key: string, field: string, value: any, callback: (err: Error, res: 0 | 1) => void): void; + hsetBuffer(key: string, field: string, value: any): Promise; hsetnx(key: string, field: string, value: any, callback: (err: Error, res: 0 | 1) => void): void; hsetnx(key: string, field: string, value: any): Promise<0 | 1>; hget(key: string, field: string, callback: (err: Error, res: string) => void): void; hget(key: string, field: string): Promise; + hgetBuffer(key: string, field: string, callback: (err: Error, res: Buffer) => void): void; + hgetBuffer(key: string, field: string): Promise; hmset(key: string, field: string, value: any, ...args: string[]): Promise<0 | 1>; hmset(key: string, data: any, callback: (err: Error, res: 0 | 1) => void): void; @@ -471,7 +489,15 @@ declare namespace IORedis { get(key: string, callback?: (err: Error, res: string) => void): Pipeline; getBuffer(key: string, callback?: (err: Error, res: Buffer) => void): Pipeline; - set(key: string, value: any, ...args: any[]): Pipeline; + set(key: string, value: any, callback?: (err: Error, res: string) => void): Pipeline; + set(key: string, value: any, setMode: string, callback?: (err: Error, res: string) => void): Pipeline; + set(key: string, value: any, expiryMode: string, time: number, callback?: (err: Error, res: string) => void): Pipeline; + set(key: string, value: any, expiryMode: string, time: number, setMode: string, callback?: (err: Error, res: string) => void): Pipeline; + + setBuffer(key: string, value: any, callback?: (err: Error, res: Buffer) => void): Pipeline; + setBuffer(key: string, value: any, setMode: string, callback?: (err: Error, res: Buffer) => void): Pipeline; + setBuffer(key: string, value: any, expiryMode: string, time: number, callback?: (err: Error, res: Buffer) => void): Pipeline; + setBuffer(key: string, value: any, expiryMode: string, time: number, setMode: string, callback?: (err: Error, res: Buffer) => void): Pipeline; setnx(key: string, value: any, callback?: (err: Error, res: any) => void): Pipeline; @@ -602,10 +628,12 @@ declare namespace IORedis { zrevrank(key: string, member: string, callback?: (err: Error, res: number) => void): Pipeline; hset(key: string, field: string, value: any, callback?: (err: Error, res: 0 | 1) => void): Pipeline; + hsetBuffer(key: string, field: string, value: any, callback?: (err: Error, res: Buffer) => void): Pipeline; hsetnx(key: string, field: string, value: any, callback?: (err: Error, res: 0 | 1) => void): Pipeline; hget(key: string, field: string, callback?: (err: Error, res: string) => void): Pipeline; + hgetBuffer(key: string, field: string, callback?: (err: Error, res: Buffer) => void): Pipeline; hmset(key: string, field: string, value: any, ...args: string[]): Pipeline; hmset(key: string, data: any, callback?: (err: Error, res: 0 | 1) => void): Pipeline; diff --git a/types/ioredis/ioredis-tests.ts b/types/ioredis/ioredis-tests.ts index 7dd98879a5..32ae5c24d5 100644 --- a/types/ioredis/ioredis-tests.ts +++ b/types/ioredis/ioredis-tests.ts @@ -16,7 +16,20 @@ redis.sadd('set', 1, 3, 5, 7); redis.sadd('set', [1, 3, 5, 7]); // All arguments are passed directly to the redis server: -redis.set('key', '100', 'EX', 10); +redis.set('key', '100'); +redis.set('key', '100', 'XX'); +redis.set('key', '100', 'PX', 10); +redis.set('key', '100', 'EX', 10, 'NX'); +redis.set('key', '100', 'NX', 'EX', 10); +redis.set('key', '100', ['EX', 10, 'NX']); +redis.setBuffer('key', '100', 'NX', 'EX', 10); + +redis.set('key', '100', (err, data) => {}); +redis.set('key', '100', 'XX', (err, data) => {}); +redis.set('key', '100', 'PX', 10, (err, data) => {}); +redis.set('key', '100', 'EX', 10, 'NX', (err, data) => {}); +redis.set('key', '100', ['EX', 10, 'NX'], (err, data) => {}); +redis.setBuffer('key', '100', 'NX', 'EX', 10, (err, data) => {}); new Redis(); // Connect to 127.0.0.1:6379 new Redis(6380); // 127.0.0.1:6380 @@ -59,6 +72,10 @@ redis.on('messageBuffer', (channel: any, message: any) => { const pipeline = redis.pipeline(); pipeline.set('foo', 'bar'); pipeline.del('cc'); +pipeline.hset('hash', 'foo', 4); +pipeline.hget('hash', 'foo'); +pipeline.hsetBuffer('hash', 'fooBuffer', 4); +pipeline.hgetBuffer('hash', 'fooBuffer'); pipeline.exec((err, results) => { // `err` is always null, and `results` is an array of responses // corresponding to the sequence of queued commands. From 135d115688b907ea3b714be83f8508ef45ae0f5a Mon Sep 17 00:00:00 2001 From: Jon Freedman Date: Mon, 6 Aug 2018 20:01:51 +0100 Subject: [PATCH 22/56] [react-select] switch DOM Node for ReactNode as per other files (#27871) * as elsewhere Node type should refer to ReactNode not a DOM node * lint fix :( * remove ReactNode -> Node alias and use ReactNode type throughout --- types/react-select/lib/Creatable.d.ts | 4 ++-- types/react-select/lib/Select.d.ts | 24 +++++++++---------- types/react-select/lib/builtins.d.ts | 4 ++-- .../react-select/lib/components/Control.d.ts | 4 ++-- types/react-select/lib/components/Group.d.ts | 6 ++--- types/react-select/lib/components/Menu.d.ts | 8 +++---- .../lib/components/MultiValue.d.ts | 10 ++++---- types/react-select/lib/components/Option.d.ts | 4 ++-- .../lib/components/Placeholder.d.ts | 4 ++-- .../lib/components/containers.d.ts | 8 +++---- 10 files changed, 38 insertions(+), 38 deletions(-) diff --git a/types/react-select/lib/Creatable.d.ts b/types/react-select/lib/Creatable.d.ts index ac67bf039c..5cae63021c 100644 --- a/types/react-select/lib/Creatable.d.ts +++ b/types/react-select/lib/Creatable.d.ts @@ -11,13 +11,13 @@ export interface CreatableProps { allowCreateWhileLoading?: boolean; /* Gets the label for the "create new ..." option in the menu. Is given the current input value. */ - formatCreateLabel?: (inputValue: string) => Node; + formatCreateLabel?: (inputValue: string) => React.ReactNode; /* Determines whether the "create new ..." option should be displayed based on the current input value, select value and options array. */ isValidNewOption?: (inputValue: string, value: ValueType, options: OptionsType) => boolean; /* Returns the data for the new option when it is created. Used to display the value, and is passed to `onChange`. */ - getNewOptionData?: (inputValue: string, optionLabel: Node) => OptionType; + getNewOptionData?: (inputValue: string, optionLabel: React.ReactNode) => OptionType; /* If provided, this will be called with the input value when a new option is created, and `onChange` will **not** be called. Use this when you need more control over what happens when new options are created. */ diff --git a/types/react-select/lib/Select.d.ts b/types/react-select/lib/Select.d.ts index 3e89a139ac..aa8524103e 100644 --- a/types/react-select/lib/Select.d.ts +++ b/types/react-select/lib/Select.d.ts @@ -107,7 +107,7 @@ export interface Props { /* Formats group labels in the menu as React components */ formatGroupLabel?: typeof formatGroupLabel; /* Formats option labels in the menu and control as React components */ - formatOptionLabel?: (option: OptionType, labelMeta: FormatOptionLabelMeta) => Node; + formatOptionLabel?: (option: OptionType, labelMeta: FormatOptionLabelMeta) => React.ReactNode; /* Resolves option data to a string to be displayed as the label by components */ getOptionLabel?: typeof getOptionLabel; /* Resolves option data to a string to compare options and specify value attributes */ @@ -311,7 +311,7 @@ export default class Select extends React.Component void; setValue: (newValue: ValueType, action: ActionTypes, option?: OptionType) => void; selectProps: Readonly<{ - children?: Node; + children?: React.ReactNode; }> & Readonly>; }; @@ -343,8 +343,8 @@ export default class Select extends React.Component): boolean; isOptionSelected(option: OptionType, selectValue: OptionsType): boolean; filterOption(option: {}, inputValue: string): boolean; - formatOptionLabel(data: OptionType, context: FormatOptionLabelContext): Node; - formatGroupLabel(data: GroupType): Node; + formatOptionLabel(data: OptionType, context: FormatOptionLabelContext): React.ReactNode; + formatGroupLabel(data: GroupType): React.ReactNode; // ============================== // Mouse Handlers @@ -406,14 +406,14 @@ export default class Select extends React.Component | null; - renderClearIndicator(): Node; - renderLoadingIndicator(): Node; - renderIndicatorSeparator(): Node; - renderDropdownIndicator(): Node; - renderMenu(): Node; - renderFormField(): Node; + renderClearIndicator(): React.ReactNode; + renderLoadingIndicator(): React.ReactNode; + renderIndicatorSeparator(): React.ReactNode; + renderDropdownIndicator(): React.ReactNode; + renderMenu(): React.ReactNode; + renderFormField(): React.ReactNode; - renderLiveRegion(): Node; + renderLiveRegion(): React.ReactNode; } diff --git a/types/react-select/lib/builtins.d.ts b/types/react-select/lib/builtins.d.ts index b1e1c37cc8..5d404230cd 100644 --- a/types/react-select/lib/builtins.d.ts +++ b/types/react-select/lib/builtins.d.ts @@ -1,7 +1,7 @@ -import { ReactNode as Node } from 'react'; +import { ReactNode } from 'react'; import { GroupType } from './types'; -export function formatGroupLabel(group: GroupType): Node; +export function formatGroupLabel(group: GroupType): ReactNode; export function getOptionLabel(option: any): string; diff --git a/types/react-select/lib/components/Control.d.ts b/types/react-select/lib/components/Control.d.ts index c48dee76d4..8a9513197b 100644 --- a/types/react-select/lib/components/Control.d.ts +++ b/types/react-select/lib/components/Control.d.ts @@ -1,4 +1,4 @@ -import { ComponentType, ReactNode as Node, Ref as ElementRef } from 'react'; +import { ComponentType, ReactNode, Ref as ElementRef } from 'react'; import { borderRadius, colors, spacing } from '../theme'; import { CommonProps, PropsWithStyles } from '../types'; @@ -14,7 +14,7 @@ export type ControlProps = CommonProps & PropsWithStyles & State & { /** Children to render. */ - children: Node, + children: ReactNode, innerRef: ElementRef, /** The mouse down event and the innerRef to pass down to the controller element. */ innerProps: { diff --git a/types/react-select/lib/components/Group.d.ts b/types/react-select/lib/components/Group.d.ts index 9e05263224..39c3489bce 100644 --- a/types/react-select/lib/components/Group.d.ts +++ b/types/react-select/lib/components/Group.d.ts @@ -1,15 +1,15 @@ -import { ReactNode as Node, ComponentType } from 'react'; +import { ReactNode, ComponentType } from 'react'; import { spacing } from '../theme'; import { CommonProps } from '../types'; interface ComponentProps { /** The children to be rendered. */ - children: Node; + children: ReactNode; /** Component to wrap the label, recieves headingProps. */ Heading: ComponentType; /** Label to be displayed in the heading component. */ - label: Node; + label: ReactNode; } export type GroupProps = CommonProps & ComponentProps; diff --git a/types/react-select/lib/components/Menu.d.ts b/types/react-select/lib/components/Menu.d.ts index d91288cdeb..0af2bf16c1 100644 --- a/types/react-select/lib/components/Menu.d.ts +++ b/types/react-select/lib/components/Menu.d.ts @@ -2,7 +2,7 @@ import { Component, ReactElement, Ref as ElementRef, - ReactNode as Node, + ReactNode, ComponentType } from 'react'; import { createPortal } from 'react-dom'; @@ -89,7 +89,7 @@ interface MenuListState { export interface MenuListProps { /** The children to be rendered. */ - children: Node; + children: ReactNode; /** Inner ref to DOM Node */ innerRef: InnerRef; } @@ -108,7 +108,7 @@ export function loadingMessageCSS(): React.CSSProperties; export type NoticeProps = CommonProps & { /** The children to be rendered. */ - children: Node, + children: ReactNode, /** Props to be passed on to the wrapper. */ innerProps: { [key: string]: any }, }; @@ -129,7 +129,7 @@ export const LoadingMessage: ComponentType>; export type MenuPortalProps = CommonProps & { appendTo: HTMLElement, - children: Node, // ideally Menu + children: ReactNode, // ideally Menu controlElement: HTMLElement, menuPlacement: MenuPlacement, menuPosition: MenuPosition, diff --git a/types/react-select/lib/components/MultiValue.d.ts b/types/react-select/lib/components/MultiValue.d.ts index ac304bd42a..59974fbc46 100644 --- a/types/react-select/lib/components/MultiValue.d.ts +++ b/types/react-select/lib/components/MultiValue.d.ts @@ -1,10 +1,10 @@ -import { ComponentType, Component, ReactNode as Node } from 'react'; +import { ComponentType, Component, ReactNode } from 'react'; import { borderRadius, colors, spacing } from '../theme'; import { CommonProps } from '../types'; export type MultiValueProps = CommonProps &{ - children: Node, + children: ReactNode, components: any, cropWithEllipsis: boolean, data: OptionType, @@ -23,7 +23,7 @@ export function multiValueLabelCSS(props: MultiValueProps): React.CSSProper export function multiValueRemoveCSS(props: MultiValueProps): React.CSSProperties; export interface MultiValueGenericProps { - children: Node; + children: ReactNode; data: OptionType; innerProps: { className?: string }; selectProps: any; @@ -33,7 +33,7 @@ export const MultiValueGeneric: ComponentType>; export const MultiValueContainer: typeof MultiValueGeneric; export const MultiValueLabel: typeof MultiValueGeneric; export type MultiValueRemoveProps = CommonProps & { - children: Node, + children: ReactNode, innerProps: { className: string, onTouchEnd: (event: any) => void, @@ -44,7 +44,7 @@ export type MultiValueRemoveProps = CommonProps & { }; export class MultiValueRemove extends Component> { static defaultProps: { - children: Node, + children: ReactNode, }; } diff --git a/types/react-select/lib/components/Option.d.ts b/types/react-select/lib/components/Option.d.ts index 81ab38e401..defe37711a 100644 --- a/types/react-select/lib/components/Option.d.ts +++ b/types/react-select/lib/components/Option.d.ts @@ -1,4 +1,4 @@ -import { ComponentType, ReactNode as Node, MouseEventHandler } from 'react'; +import { ComponentType, ReactNode, MouseEventHandler } from 'react'; import { colors, spacing } from '../theme'; import { CommonProps, PropsWithStyles, InnerRef } from '../types'; @@ -22,7 +22,7 @@ export type OptionProps = PropsWithStyles & CommonProps & State & { /** The children to be rendered. */ - children: Node, + children: ReactNode, /** Inner ref to DOM Node */ innerRef: InnerRef, /** props passed to the wrapping element for the group. */ diff --git a/types/react-select/lib/components/Placeholder.d.ts b/types/react-select/lib/components/Placeholder.d.ts index 6f674d70a8..1a72bd69a7 100644 --- a/types/react-select/lib/components/Placeholder.d.ts +++ b/types/react-select/lib/components/Placeholder.d.ts @@ -1,11 +1,11 @@ -import { ComponentType, ReactNode as Node } from 'react'; +import { ComponentType, ReactNode } from 'react'; import { colors, spacing } from '../theme'; import { CommonProps } from '../types'; export type PlaceholderProps = CommonProps & { /** The children to be rendered. */ - children: Node, + children: ReactNode, /** props passed to the wrapping element for the group. */ innerProps: { [key: string]: any }, }; diff --git a/types/react-select/lib/components/containers.d.ts b/types/react-select/lib/components/containers.d.ts index e75de6d756..c72609bf31 100644 --- a/types/react-select/lib/components/containers.d.ts +++ b/types/react-select/lib/components/containers.d.ts @@ -1,4 +1,4 @@ -import { Component, ReactNode as Node, ComponentType } from 'react'; +import { Component, ReactNode, ComponentType } from 'react'; import { spacing } from '../theme'; import { CommonProps, KeyboardEventHandler } from '../types'; @@ -16,7 +16,7 @@ export interface ContainerState { export type ContainerProps = CommonProps & ContainerState & { /** The children to be rendered. */ - children: Node, + children: ReactNode, /** Inner props to be passed down to the container. */ innerProps: { onKeyDown: KeyboardEventHandler }, }; @@ -33,7 +33,7 @@ export type ValueContainerProps = CommonProps & { /** Whether the value container currently holds a value. */ hasValue: boolean, /** The children to be rendered. */ - children: Node, + children: ReactNode, }; export function valueContainerCSS(): React.CSSProperties; export class ValueContainer extends Component> {} @@ -50,7 +50,7 @@ export interface IndicatorsState { export type IndicatorContainerProps = CommonProps & IndicatorsState & { /** The children to be rendered. */ - children: Node, + children: ReactNode, }; export function indicatorsContainerCSS(): React.CSSProperties; From 563ac4735f9273c3796f96e26c74052f83b13d3f Mon Sep 17 00:00:00 2001 From: Lexie Hankins <425572+AlexHankins@users.noreply.github.com> Date: Mon, 6 Aug 2018 15:02:40 -0400 Subject: [PATCH 23/56] Add types for extsprintf (#27875) * Add types for extsprintf * Fix extprintf.Stream callback type. --- types/extsprintf/extsprintf-tests.ts | 8 ++++++++ types/extsprintf/index.d.ts | 12 ++++++++++++ types/extsprintf/tsconfig.json | 23 +++++++++++++++++++++++ types/extsprintf/tslint.json | 1 + 4 files changed, 44 insertions(+) create mode 100644 types/extsprintf/extsprintf-tests.ts create mode 100644 types/extsprintf/index.d.ts create mode 100644 types/extsprintf/tsconfig.json create mode 100644 types/extsprintf/tslint.json diff --git a/types/extsprintf/extsprintf-tests.ts b/types/extsprintf/extsprintf-tests.ts new file mode 100644 index 0000000000..4b45462487 --- /dev/null +++ b/types/extsprintf/extsprintf-tests.ts @@ -0,0 +1,8 @@ +import { sprintf, fprintf, printf } from "extsprintf"; + +fprintf({write: (s: string) => {}}, ''); +fprintf({write: (s: string) => {}}, '', {}, [], null, 0, ''); +printf(''); +printf('', {}, [], null, 0, ''); +sprintf(''); // $ExpectType string +sprintf('', {}, [], null, 0, ''); // $ExpectType string diff --git a/types/extsprintf/index.d.ts b/types/extsprintf/index.d.ts new file mode 100644 index 0000000000..29d073b4c5 --- /dev/null +++ b/types/extsprintf/index.d.ts @@ -0,0 +1,12 @@ +// Type definitions for extsprintf 1.4 +// Project: https://github.com/joyent/node-extsprintf#readme +// Definitions by: Alex Hankins +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export interface Stream { + write(str: string): void; +} + +export function fprintf(stream: Stream, format: string, ...args: any[]): any; +export function printf(format: string, ...args: any[]): any; +export function sprintf(format: string, ...args: any[]): string; diff --git a/types/extsprintf/tsconfig.json b/types/extsprintf/tsconfig.json new file mode 100644 index 0000000000..bc9783f347 --- /dev/null +++ b/types/extsprintf/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "extsprintf-tests.ts" + ] +} diff --git a/types/extsprintf/tslint.json b/types/extsprintf/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/extsprintf/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From a04576e8000854a4ba527c155901f7f4e72bf18a Mon Sep 17 00:00:00 2001 From: Max Rumpf Date: Mon, 6 Aug 2018 21:02:58 +0200 Subject: [PATCH 24/56] [@types/dnssd] More fixes according the original source (#27877) * Another set of fixes * Fix lint * Fix support for object type --- types/dnssd/index.d.ts | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/types/dnssd/index.d.ts b/types/dnssd/index.d.ts index 80de2900f3..8ef8aa84fd 100644 --- a/types/dnssd/index.d.ts +++ b/types/dnssd/index.d.ts @@ -3,13 +3,14 @@ // Definitions by: Angel Merino // Max Rumpf // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /// import { EventEmitter } from 'events'; /** Declaration file generated by dts-gen */ -export class Advertisement { +export class Advertisement extends EventEmitter { constructor(type: string | string[] | ServiceType, port: number, ...args: any[]); start(): Advertisement; @@ -43,7 +44,7 @@ export class Service { } export class ServiceType { - constructor(...args: string[]) + constructor(...args: Array) constructor(args: ServiceType); name: string; @@ -60,29 +61,29 @@ export class ServiceType { } export class Browser extends EventEmitter { - constructor(type: any, ...args: any[]); + constructor(type: string | string[] | ServiceType, ...args: any[]); - list(): any; + start(): Browser; - start(): any; + stop(): void; - stop(): any; + list(): any[]; } -export const resolveA: any; +export function resolve(name: string, type: string, args: object): Promise; -export const resolveAAAA: any; +export function resolve4(name: string, type: string, args: object): Promise; -export function all(): ServiceType; +export function resolve6(name: string, type: string, args: object): Promise; -export function resolve(name: any, type: any, ...args: any[]): any; +export function resolveSRV(name: string, args: object): Promise; -export function resolveSRV(name: any, opts: any): any; +export function resolveTXT(name: string, args: object): Promise; -export function resolveService(name: any, ...args: any[]): any; - -export function resolveTXT(name: any, opts: any): any; +export function resolveService(name: string, args: object): Promise; export function tcp(...args: string[]): ServiceType; export function udp(...args: string[]): ServiceType; + +export function all(): ServiceType; From ef1f0f87e88c96f2f6a32e267b009995cd3c8e2b Mon Sep 17 00:00:00 2001 From: Brandon Hall Date: Mon, 6 Aug 2018 15:05:06 -0400 Subject: [PATCH 25/56] [react-virtualized] Fix WindowScrollerChildProps (#27880) --- .../dist/es/WindowScroller.d.ts | 16 +++------------- types/react-virtualized/index.d.ts | 1 + 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/types/react-virtualized/dist/es/WindowScroller.d.ts b/types/react-virtualized/dist/es/WindowScroller.d.ts index 628d58744d..c3074208d6 100644 --- a/types/react-virtualized/dist/es/WindowScroller.d.ts +++ b/types/react-virtualized/dist/es/WindowScroller.d.ts @@ -11,26 +11,16 @@ export type WindowScrollerChildProps = { width: number; isScrolling: boolean; scrollTop: number; - onChildScroll: () => void; + onChildScroll: (params: { scrollTop: number }) => void; }; export type WindowScrollerProps = { /** * Function responsible for rendering children. * This function should implement the following signature: - * ({ height, isScrolling, scrollLeft, scrollTop, width }) => PropTypes.element + * ({ height, isScrolling, scrollLeft, scrollTop, width, onChildScroll }) => PropTypes.element */ - children: ( - params: { - onChildScroll: (params: { scrollTop: number }) => void; - registerChild: (params?: Element) => void; - height: number; - isScrolling: boolean; - scrollLeft: number; - scrollTop: number; - width: number; - } - ) => React.ReactNode; + children: (params: WindowScrollerChildProps) => React.ReactNode; /** Callback to be invoked on-resize: ({ height, width }) */ onResize?: (params: { height: number; width: number }) => void; diff --git a/types/react-virtualized/index.d.ts b/types/react-virtualized/index.d.ts index b7c557d875..4cbc644bc8 100644 --- a/types/react-virtualized/index.d.ts +++ b/types/react-virtualized/index.d.ts @@ -7,6 +7,7 @@ // Kræn Hansen // Steve Zhang // Maciej Goszczycki +// Brandon Hall // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 From 347bdf75c3d079100592760c1c54a901d6f3b82e Mon Sep 17 00:00:00 2001 From: Simon Schick Date: Mon, 6 Aug 2018 21:05:57 +0200 Subject: [PATCH 26/56] feat(stripe): add failure_reason for refunds (#27884) --- types/stripe/index.d.ts | 13 +++++++++---- types/stripe/stripe-tests.ts | 1 + 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/types/stripe/index.d.ts b/types/stripe/index.d.ts index e05908e579..cc944284e0 100644 --- a/types/stripe/index.d.ts +++ b/types/stripe/index.d.ts @@ -189,7 +189,7 @@ declare namespace Stripe { * account holder to setup a username and password, and handle all account * management directly with them. Possible values are custom and standard. */ - type: 'custom' | 'standard'; + type: "custom" | "standard"; } interface IAccountShared { @@ -1470,7 +1470,7 @@ declare namespace Stripe { source?: sources.ISourceCreationOptionsExtended; } - interface ICustomerListOptions extends IListOptionsCreated { + interface ICustomerListOptions extends IListOptionsCreated { /** * A filter on the list based on the customer’s email field. The value must be a string. */ @@ -4347,7 +4347,7 @@ declare namespace Stripe { /** * Value is 'card' */ - object: 'card'; + object: "card"; /** * The card number @@ -4680,7 +4680,7 @@ declare namespace Stripe { trial_period_days?: number; /** - * Indicates if a plan’s trial_period_days should be applied to the subscription. Setting trial_end per subscription is preferred, + * Indicates if a plan’s trial_period_days should be applied to the subscription. Setting trial_end per subscription is preferred, * and this defaults to false. Setting this flag to true together with trial_end is not allowed. */ trial_from_plan?: boolean; @@ -5039,6 +5039,11 @@ declare namespace Stripe { * For other types of refunds, it can be pending, succeeded, failed, or canceled. */ status: "pending" | "succeeded" | "failed" | "canceled"; + + /** + * If the refund failed, the reason for refund failure if known. + */ + failure_reason?: "lost_or_stolen_card" | "expired_or_canceled_card" | "unknown"; } interface IRefundCreationOptions extends IDataOptionsWithMetadata { diff --git a/types/stripe/stripe-tests.ts b/types/stripe/stripe-tests.ts index ef30b621b2..4e538abddb 100644 --- a/types/stripe/stripe-tests.ts +++ b/types/stripe/stripe-tests.ts @@ -59,6 +59,7 @@ stripe.charges.create({ // asynchronously called charge.refunds.create().then(function (refund) { + const reason = refund.failure_reason; // asynchronously called }); charge.refunds.create({ amount: 100 }).then(function (refund) { From 320cebc6f37701b871ff76c6b62330f9cf4ab213 Mon Sep 17 00:00:00 2001 From: Auston Zahrt Date: Mon, 6 Aug 2018 12:07:01 -0700 Subject: [PATCH 27/56] Add types for capture-console (#27891) Adds type definitions for the NPM package "capture-console" v1.0.1 --- .../capture-console/capture-console-tests.ts | 53 +++++ types/capture-console/index.d.ts | 190 ++++++++++++++++++ types/capture-console/tsconfig.json | 23 +++ types/capture-console/tslint.json | 1 + 4 files changed, 267 insertions(+) create mode 100644 types/capture-console/capture-console-tests.ts create mode 100644 types/capture-console/index.d.ts create mode 100644 types/capture-console/tsconfig.json create mode 100644 types/capture-console/tslint.json diff --git a/types/capture-console/capture-console-tests.ts b/types/capture-console/capture-console-tests.ts new file mode 100644 index 0000000000..45dd3a7130 --- /dev/null +++ b/types/capture-console/capture-console-tests.ts @@ -0,0 +1,53 @@ +import * as captureconsole from "capture-console"; + +captureconsole.capture(process.stdout, () => { }); // $ExpectType string[] +captureconsole.capture(process.stdout, {}, () => { }); // $ExpectType string[] +captureconsole.capture(process.stdout, { quiet: true }, () => { }); // $ExpectType string[] + +captureconsole.capture([process.stdout, process.stdin], () => { }); // $ExpectType string[] +captureconsole.capture([process.stdout, process.stdin], {}, () => { }); // $ExpectType string[] +captureconsole.capture([process.stdout, process.stdin], { quiet: true }, () => { }); // $ExpectType string[] + +captureconsole.captureStderr(() => { }); // $ExpectType string +captureconsole.captureStderr({}, () => { }); // $ExpectType string +captureconsole.captureStderr({ quiet: true }, () => { }); // $ExpectType string + +captureconsole.captureStdio(() => { }); // $ExpectType { stdout: string; stderr: string; } +captureconsole.captureStdio({}, () => { }); // $ExpectType { stdout: string; stderr: string; } +captureconsole.captureStdio({ quiet: true }, () => { }); // $ExpectType { stdout: string; stderr: string; } + +captureconsole.captureStdout(() => { }); // $ExpectType string +captureconsole.captureStdout({}, () => { }); // $ExpectType string +captureconsole.captureStdout({ quiet: true }, () => { }); // $ExpectType string + +captureconsole.hook(process.stdout, (string: string, encoding?: string, fd?: (error?: any) => void) => { }); // $ExpectType () => boolean +captureconsole.hook(process.stdout, {}, (string: string, encoding?: string, fd?: (error?: any) => void) => { }); // $ExpectType () => boolean +captureconsole.hook(process.stdout, { quiet: true }, (string: string, encoding?: string, fd?: (error?: any) => void) => { }); // $ExpectType () => boolean + +captureconsole.intercept(process.stdout, () => { }); // $ExpectType string[] +captureconsole.intercept(process.stdout, {}, () => { }); // $ExpectType string[] +captureconsole.intercept(process.stdout, { quiet: true }, () => { }); // $ExpectType string[] + +captureconsole.interceptStderr(() => { }); // $ExpectType string +captureconsole.interceptStderr({}, () => { }); // $ExpectType string +captureconsole.interceptStderr({ quiet: true }, () => { }); // $ExpectType string + +captureconsole.interceptStdio(() => { }); // $ExpectType { stdout: string; stderr: string; } +captureconsole.interceptStdio({}, () => { }); // $ExpectType { stdout: string; stderr: string; } +captureconsole.interceptStdio({ quiet: true }, () => { }); // $ExpectType { stdout: string; stderr: string; } + +captureconsole.interceptStdout(() => { }); // $ExpectType string +captureconsole.interceptStdout({}, () => { }); // $ExpectType string +captureconsole.interceptStdout({ quiet: true }, () => { }); // $ExpectType string + +captureconsole.startCapture(process.stdout, (string: string, encoding?: string, fd?: (error?: any) => void) => { }); // $ExpectType boolean +captureconsole.startCapture(process.stdout, {}, (string: string, encoding?: string, fd?: (error?: any) => void) => { }); // $ExpectType boolean +captureconsole.startCapture(process.stdout, { quiet: true }, (string: string, encoding?: string, fd?: (error?: any) => void) => { }); // $ExpectType boolean + +captureconsole.startIntercept(process.stdout, () => { }); // $ExpectType boolean +captureconsole.startIntercept(process.stdout, {}, () => { }); // $ExpectType boolean +captureconsole.startIntercept(process.stdout, { quiet: true }, () => { }); // $ExpectType boolean + +captureconsole.stopCapture(process.stdout); // $ExpectType boolean + +captureconsole.stopIntercept(process.stdout); // $ExpectType boolean diff --git a/types/capture-console/index.d.ts b/types/capture-console/index.d.ts new file mode 100644 index 0000000000..d3ebd914f9 --- /dev/null +++ b/types/capture-console/index.d.ts @@ -0,0 +1,190 @@ +// Type definitions for capture-console 1.0 +// Project: https://github.com/zackehh/capture-console +// Definitions by: Auston Zahrt +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +/** + * Options controlling behavior when capturing + */ +export interface CaptureOptions { + /** + * Option to silence the output going to the console + */ + quiet?: boolean; +} + +/** + * Executes the provided function with the output + * on the provided streams. + */ +export function capture( + streams: ReadonlyArray | NodeJS.WritableStream, + exec: () => void +): string[]; + +/** + * Executes the provided function with the output + * on the provided streams. Accepts options to silence + * the output going to the console. + */ +export function capture( + streams: ReadonlyArray | NodeJS.WritableStream, + opts: CaptureOptions, + exec: () => void +): string[]; + +/** + * Captures stderr for the provided execution scope. + */ +export function captureStderr(exec: () => void): string; + +/** + * Captures stderr for the provided execution scope. + */ +export function captureStderr(opts: CaptureOptions, exec: () => void): string; + +/** + * Captures stdout and stderr into an object for + * the provided execution scope. + */ +export function captureStdio(exec: () => void): { stdout: string; stderr: string; }; + +/** + * Captures stdout and stderr into an object for + * the provided execution scope. + */ +export function captureStdio(opts: CaptureOptions, exec: () => void): { stdout: string; stderr: string; }; + +/** + * Captures stdout for the provided execution scope. + */ +export function captureStdout(exec: () => void): string; + +/** + * Captures stdout for the provided execution scope. + */ +export function captureStdout(opts: CaptureOptions, exec: () => void): string; + +/** + * Listens to a provided stream, and executes the provided + * function for every write call. Accepts options to silence + * the output going to the console. + * + * Returns a function to call when you wish to stop listening + * to the call. + */ +export function hook( + stream: NodeJS.WritableStream, + exec: ( + string: string, + encoding?: string, + fd?: (error?: any) => void + ) => void +): () => boolean; + +/** + * Listens to a provided stream, and executes the provided + * function for every write call. Accepts options to silence + * the output going to the console. + * + * Returns a function to call when you wish to stop listening + * to the call. + */ +export function hook( + stream: NodeJS.WritableStream, + opts: CaptureOptions, + exec: ( + string: string, + encoding?: string, + fd?: (error?: any) => void + ) => void +): () => boolean; + +/** + * Delegate to #capture with a quiet passthrough. + */ +export function intercept(stream: NodeJS.WritableStream, exec: () => void): string[]; + +/** + * Delegate to #capture with a quiet passthrough. + */ +export function intercept(stream: NodeJS.WritableStream, opts: CaptureOptions, exec: () => void): string[]; + +/** + * Delegate to #captureStderr with a quiet passthrough. + */ +export function interceptStderr(exec: () => void): string; + +/** + * Delegate to #captureStderr with a quiet passthrough. + */ +export function interceptStderr(opts: CaptureOptions, exec: () => void): string; + +/** + * Delegate to #captureStdio with a quiet passthrough. + */ +export function interceptStdio(exec: () => void): { stdout: string; stderr: string; }; + +/** + * Delegate to #captureStdio with a quiet passthrough. + */ +export function interceptStdio(opts: CaptureOptions, exec: () => void): { stdout: string; stderr: string; }; + +/** + * Delegate to #captureStdout with a quiet passthrough. + */ +export function interceptStdout(exec: () => void): string; + +/** + * Delegate to #captureStdout with a quiet passthrough. + */ +export function interceptStdout(opts: CaptureOptions, exec: () => void): string; + +/** + * Starts a capture on the provided stream using the + * provided options and stream execution. + */ +export function startCapture( + stream: NodeJS.WritableStream, + exec: ( + string: string, + encoding?: string, + fd?: (error?: any) => void + ) => void +): boolean; + +/** + * Starts a capture on the provided stream using the + * provided options and stream execution. + */ +export function startCapture( + stream: NodeJS.WritableStream, + opts: CaptureOptions, + exec: ( + string: string, + encoding?: string, + fd?: (error?: any) => void + ) => void +): boolean; + +/** + * Delegate to #startCapture with a quiet passthrough. + */ +export function startIntercept(stream: NodeJS.WritableStream, exec: () => void): boolean; + +/** + * Delegate to #startCapture with a quiet passthrough. + */ +export function startIntercept(stream: NodeJS.WritableStream, opts: CaptureOptions, exec: () => void): boolean; + +/** + * Stops a capture on the provided stream. + */ +export function stopCapture(stream: NodeJS.WritableStream): boolean; + +/** + * Delegate to #stopCapture with a quiet passthrough. + */ +export function stopIntercept(stream: NodeJS.WritableStream): boolean; diff --git a/types/capture-console/tsconfig.json b/types/capture-console/tsconfig.json new file mode 100644 index 0000000000..01807d6e22 --- /dev/null +++ b/types/capture-console/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "strictFunctionTypes": true + }, + "files": [ + "index.d.ts", + "capture-console-tests.ts" + ] +} \ No newline at end of file diff --git a/types/capture-console/tslint.json b/types/capture-console/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/capture-console/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From a0eb795fa91ac733a3ef832e19ac43778168401d Mon Sep 17 00:00:00 2001 From: Masafumi Koba Date: Tue, 7 Aug 2018 04:07:43 +0900 Subject: [PATCH 28/56] [react-transition-group] Restrict Transition child function's argument type (#27894) > A `function` child can be used instead of a React element. > This function is called with the current transition status > ('entering', 'entered', 'exiting', 'exited', 'unmounted'), which can be used > to apply context specific props to a component. https://github.com/reactjs/react-transition-group/blob/b8da4f2f2314b23a6471d78cb14c22efe13481dd/src/Transition.js#L379 See also #27693 --- types/react-transition-group/Transition.d.ts | 8 +++++++- types/react-transition-group/index.d.ts | 1 + .../react-transition-group-tests.tsx | 11 ++++++++++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/types/react-transition-group/Transition.d.ts b/types/react-transition-group/Transition.d.ts index 123f8b1622..f8722a41d8 100644 --- a/types/react-transition-group/Transition.d.ts +++ b/types/react-transition-group/Transition.d.ts @@ -16,7 +16,13 @@ export interface TransitionActions { exit?: boolean; } -export type TransitionChildren = React.ReactNode | ((status: string) => React.ReactNode); +type TransitionStatus = + typeof ENTERING | + typeof ENTERED | + typeof EXITING | + typeof EXITED | + typeof UNMOUNTED; +export type TransitionChildren = React.ReactNode | ((status: TransitionStatus) => React.ReactNode); export interface TransitionProps extends TransitionActions { in?: boolean; mountOnEnter?: boolean; diff --git a/types/react-transition-group/index.d.ts b/types/react-transition-group/index.d.ts index 785e1f1941..2d97f64ce6 100644 --- a/types/react-transition-group/index.d.ts +++ b/types/react-transition-group/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/reactjs/react-transition-group // Definitions by: Karol Janyst // Epskampie +// Masafumi Koba // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 diff --git a/types/react-transition-group/react-transition-group-tests.tsx b/types/react-transition-group/react-transition-group-tests.tsx index ce096f3dc7..172d91ce54 100644 --- a/types/react-transition-group/react-transition-group-tests.tsx +++ b/types/react-transition-group/react-transition-group-tests.tsx @@ -52,7 +52,16 @@ const Test: React.StatelessComponent = () => {
{ "test" }
- {(status) =>
{status}
} + {(status) => { + switch (status) { + case ENTERING: + case ENTERED: + case EXITING: + case EXITED: + case UNMOUNTED: + return
{status}
; + } + }}
Date: Tue, 7 Aug 2018 03:08:15 +0800 Subject: [PATCH 29/56] react-i18next: allow React.ReactNode as I18nextProvider's children and I18n's render function return value (#27895) --- types/react-i18next/index.d.ts | 1 + types/react-i18next/src/I18n.d.ts | 2 +- types/react-i18next/src/I18nextProvider.d.ts | 2 +- types/react-i18next/test/react-i18next-tests.tsx | 8 ++++++++ 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/types/react-i18next/index.d.ts b/types/react-i18next/index.d.ts index e7b9c88526..979c648f50 100644 --- a/types/react-i18next/index.d.ts +++ b/types/react-i18next/index.d.ts @@ -3,6 +3,7 @@ // Definitions by: Giedrius Grabauskas // Simon Baumann // Benedict Etzel +// Wu Haotian // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 diff --git a/types/react-i18next/src/I18n.d.ts b/types/react-i18next/src/I18n.d.ts index 6bc1cf8f0f..91de868caf 100644 --- a/types/react-i18next/src/I18n.d.ts +++ b/types/react-i18next/src/I18n.d.ts @@ -15,7 +15,7 @@ export interface i18nProps { i18n?: i18n; initialI18nStore?: any; initialLanguage?: string; - children: (t: TranslationFunction, options: Options) => JSX.Element; + children: (t: TranslationFunction, options: Options) => React.ReactNode; } export default class I18n extends React.Component { } diff --git a/types/react-i18next/src/I18nextProvider.d.ts b/types/react-i18next/src/I18nextProvider.d.ts index 2cd4e333e3..2db5d0361b 100644 --- a/types/react-i18next/src/I18nextProvider.d.ts +++ b/types/react-i18next/src/I18nextProvider.d.ts @@ -6,7 +6,7 @@ export interface I18nextProviderProps { i18n: i18n; initialI18nStore?: any; initialLanguage?: string; - children: JSX.Element; + children: React.ReactNode; } export default class I18nextProvider extends React.Component { } diff --git a/types/react-i18next/test/react-i18next-tests.tsx b/types/react-i18next/test/react-i18next-tests.tsx index d3afe7643a..30b95ece24 100644 --- a/types/react-i18next/test/react-i18next-tests.tsx +++ b/types/react-i18next/test/react-i18next-tests.tsx @@ -107,6 +107,10 @@ class App extends React.Component { ; + + 123 +; + loadNamespaces({components: [App], i18n}).then(() => { }).catch(error => { }); @@ -182,6 +186,10 @@ interface CustomTranslateFunctionProps { } ; + + {t => '123'} +; + const defaults: ReactI18NextOptions = { wait: true, withRef: true, From 378202e21677fdd66f7fe13045c1519289afcff4 Mon Sep 17 00:00:00 2001 From: Ange Picard Date: Mon, 6 Aug 2018 21:09:43 +0200 Subject: [PATCH 30/56] [Create] definitions for markdown-pdf (#27897) * Add typings for markdown-pdf * Fix test * Change import style to require. --- types/markdown-pdf/index.d.ts | 92 ++++++++++++++++++++++++ types/markdown-pdf/markdown-pdf-tests.ts | 11 +++ types/markdown-pdf/tsconfig.json | 23 ++++++ types/markdown-pdf/tslint.json | 3 + 4 files changed, 129 insertions(+) create mode 100644 types/markdown-pdf/index.d.ts create mode 100644 types/markdown-pdf/markdown-pdf-tests.ts create mode 100644 types/markdown-pdf/tsconfig.json create mode 100644 types/markdown-pdf/tslint.json diff --git a/types/markdown-pdf/index.d.ts b/types/markdown-pdf/index.d.ts new file mode 100644 index 0000000000..1df6a9f314 --- /dev/null +++ b/types/markdown-pdf/index.d.ts @@ -0,0 +1,92 @@ +// Type definitions for MarkdownPDF (markdown-pdf) 9.0 +// Project: https://github.com/alanshaw/markdown-pdf +// Definitions by: Ange PICARD +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = MarkdownPDF; + +declare function MarkdownPDF(options?: MarkdownPDF.Options): MarkdownPDF.OptionsBuilder; + +declare namespace MarkdownPDF { + /** Configuration options */ + interface Options { + /** Current working directory. */ + cwd?: string; + /** Path to the phantomjs library. */ + phantomPath?: string; + /** Path to custom CSS file, relative to current directory. */ + cssPath?: string; + /** Path to custorm highlight CSS file (for code highlighting with highlight.js), relative to the current directory. */ + highlightCssPath?: string; + /** Path to CommonJS module which sets the page header and footer (see runnings.js). */ + runningsPath?: string; + /** Delay (in ms) before the PDF is rendered. */ + renderDelay?: number; + /** If renderDelay option isn't set, this is the timeout (in ms) before the page is rendered in case the page.onLoadFinished event doesn't fire. */ + loadTimeout?: number; + /** Supported dimension units are: 'mm', 'cm', 'in', 'px' */ + paperBorder?: string; + paperFormat?: PaperFormat; + paperOrientation?: PaperOrientation; + /** A function that returns a through2 stream that transforms the markdown before it is converted to HTML. */ + preProcessMd?: () => any; + /** A function that returns a through2 stream that transforms the HTML before it is converted to PDF. */ + preProcessHtml?: () => any; + /** A config object that is passed to remarkable, the underlying markdown parser */ + remarkable?: any; // FIXME: remarkable config types + } + type PaperFormat = "A3" | "A4" | "A5" | "Legal" | "Letter" | "Tabloid"; + type PaperOrientation = "portait" | "landscape"; + + interface OptionsBuilder { + /** Create a readable stream and pipe it to markdown pdf. */ + from: FromOptionsBuilder & FromFunction; + /** Concatenates stream and pipe them to markdown pdf. */ + concat: ConcatOptionsBuilder; + } + + type FromFunction = + /** Create a readable stream from path and pipe to markdown-pdf. path can be a single path or array of paths. */ + (path: string | string[]) => ToOptionsBuilder; + interface FromOptionsBuilder { + /** Create a readable stream from string and pipe to markdown-pdf. string can be a single string or array of strings. */ + string(markdown: string | string[]): ToOptionsBuilder; + /** Create a readable stream from path and pipe to markdown-pdf. path can be a single path or array of paths. */ + path(path: string | string[], opts: any): ToOptionsBuilder; + } + + interface ConcatOptionsBuilder { + from: ConcatFromOptionsBuilder; + } + interface ConcatFromOptionsBuilder { + /** Create and concatenate readable streams from strings and pipe to markdown-pdf. */ + strings(markdownTexts: string[], opts: any): ToOptionsBuilder; + /** Create and concatenate readable streams from paths and pipe to markdown-pdf. */ + paths(paths: string[], opts: any): ToOptionsBuilder; + } + + interface ToOptionsBuilder { + to: ToBuilder & ToFunction; + } + + interface ToBuilder { + /** + * Create a writeable stream to path and pipe output from markdown-pdf to it. + * path can be a single path, or array of output paths if you specified an array of inputs. + * The callback function cb will be invoked when data has finished being written. + */ + path(path: string, callback?: () => void): void; + /** Create a concat-stream and pipe output from markdown-pdf to it. The callback function cb will be invoked when the buffer has been created. */ + buffer(opts: any, callback?: () => void): void; + /** Create a concat-stream and pipe output from markdown-pdf to it. The callback function cb will be invoked when the string has been created. */ + string(opts: any, callback?: () => void): void; + } + + type ToFunction = + /** + * Create a writeable stream to path and pipe output from markdown-pdf to it. + * path can be a single path, or array of output paths if you specified an array of inputs. + * The callback function cb will be invoked when data has finished being written. + */ + (path: string, callback?: () => void) => void; +} diff --git a/types/markdown-pdf/markdown-pdf-tests.ts b/types/markdown-pdf/markdown-pdf-tests.ts new file mode 100644 index 0000000000..429028bf8b --- /dev/null +++ b/types/markdown-pdf/markdown-pdf-tests.ts @@ -0,0 +1,11 @@ +import mdPdf = require('markdown-pdf'); + +mdPdf().from('path').to('path', () => { }); // $ExpectType void +mdPdf().from.string('markdown').to('path', () => { }); // $ExpectType void +mdPdf({ paperOrientation: 'landscape', paperFormat: 'A3' }).from('lol').to('lol', () => { }); // $ExpectType void +mdPdf().concat.from.paths(['lol', 'lol'], {}).to('path', () => { }); // $ExpectType void +mdPdf().concat.from.strings(['lol', 'lol'], {}).to('path', () => { }); // $ExpectType void +mdPdf().from('path').to.path('path', () => { }); // $ExpectType void +mdPdf().from('path').to('path'); // $ExpectType void + +mdPdf({ paperFormat: 'wrongFormat' }); // $ExpectError diff --git a/types/markdown-pdf/tsconfig.json b/types/markdown-pdf/tsconfig.json new file mode 100644 index 0000000000..8ce150383b --- /dev/null +++ b/types/markdown-pdf/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "markdown-pdf-tests.ts" + ] +} diff --git a/types/markdown-pdf/tslint.json b/types/markdown-pdf/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/markdown-pdf/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} From 10bc3fc48a5f762ecf57cf007484eec3cd3f63f6 Mon Sep 17 00:00:00 2001 From: Thomas den Hollander Date: Mon, 6 Aug 2018 21:11:11 +0200 Subject: [PATCH 31/56] Move from namespace to static attributes (#27900) --- .../google-cloud__datastore-tests.ts | 2 +- types/google-cloud__datastore/index.d.ts | 21 +++++++++---------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/types/google-cloud__datastore/google-cloud__datastore-tests.ts b/types/google-cloud__datastore/google-cloud__datastore-tests.ts index cb723d0d5b..df48a70f59 100644 --- a/types/google-cloud__datastore/google-cloud__datastore-tests.ts +++ b/types/google-cloud__datastore/google-cloud__datastore-tests.ts @@ -72,7 +72,7 @@ const complexQuery = ds.createQuery('special_namespace', kind) .offset(10); // Running queries: -const queryCallback: QueryCallback = (err: Error, entities: TestEntity[]) => entities[0][Datastore.KEY]; +const queryCallback: QueryCallback = (err: Error, entities: TestEntity[]) => entities[0][ds.KEY]; ds.runQuery(query, queryCallback); ds.runQuery(query, options, queryCallback); diff --git a/types/google-cloud__datastore/index.d.ts b/types/google-cloud__datastore/index.d.ts index e0ef60b4bb..c6b7ed3462 100644 --- a/types/google-cloud__datastore/index.d.ts +++ b/types/google-cloud__datastore/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/googleapis/nodejs-datastore // Definitions by: Antoine Beauvais-Lacasse // Futa Ogawa +// Thomas den Hollander // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.7 @@ -35,6 +36,15 @@ declare module '@google-cloud/datastore' { import { DatastoreTransaction } from '@google-cloud/datastore/transaction'; class Datastore extends DatastoreRequest_ { + static readonly KEY: unique symbol; + static readonly MORE_RESULTS_AFTER_CURSOR: MoreResultsAfterCursor; + static readonly MORE_RESULTS_AFTER_LIMIT: MoreResultsAfterLimit; + static readonly NO_MORE_RESULTS: NoMoreResults; + + static readonly Query: typeof DatastoreQuery; + static readonly DatastoreRequest: typeof DatastoreRequest_; + static readonly Transaction: typeof DatastoreTransaction; + constructor(options?: InitOptions); readonly KEY: typeof Datastore.KEY; @@ -80,17 +90,6 @@ declare module '@google-cloud/datastore' { keyFilename?: string; credentials?: object; } - - namespace Datastore { - const KEY: unique symbol; - const MORE_RESULTS_AFTER_CURSOR: MoreResultsAfterCursor; - const MORE_RESULTS_AFTER_LIMIT: MoreResultsAfterLimit; - const NO_MORE_RESULTS: NoMoreResults; - - const Query: typeof DatastoreQuery; - const DatastoreRequest: typeof DatastoreRequest_; - const Transaction: typeof DatastoreTransaction; - } } declare module '@google-cloud/datastore/entity' { From 11413d1988d3d7e081dc29e16356a85597885cd9 Mon Sep 17 00:00:00 2001 From: 43081j <43081j@users.noreply.github.com> Date: Mon, 6 Aug 2018 20:13:55 +0100 Subject: [PATCH 32/56] quill: fix signature for clipboard api --- types/quill/index.d.ts | 2 +- types/quill/quill-tests.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/types/quill/index.d.ts b/types/quill/index.d.ts index 4fdeef44a0..0eda9a4eff 100644 --- a/types/quill/index.d.ts +++ b/types/quill/index.d.ts @@ -43,7 +43,7 @@ export interface KeyboardStatic { } export interface ClipboardStatic { - convert(html: string|Blot): DeltaStatic; + convert(html?: string): DeltaStatic; addMatcher(selectorOrNodeType: string|number, callback: (node: any, delta: DeltaStatic) => DeltaStatic): void; dangerouslyPasteHTML(html: string, source?: Sources): void; dangerouslyPasteHTML(index: number, html: string, source?: Sources): void; diff --git a/types/quill/quill-tests.ts b/types/quill/quill-tests.ts index 96527a8158..073e68f115 100644 --- a/types/quill/quill-tests.ts +++ b/types/quill/quill-tests.ts @@ -148,6 +148,7 @@ function test_setHtmlContents() { const html = "this is a bold text"; const delta = quillEditor.clipboard.convert(html); quillEditor.setContents(delta); + quillEditor.clipboard.convert(); } function test_getSelection() { From 8dc75d71b5119b6df24e8c1d185890e4879b2936 Mon Sep 17 00:00:00 2001 From: Simon Date: Tue, 7 Aug 2018 01:07:33 +0200 Subject: [PATCH 33/56] fix(joi): add global exist function --- types/joi/index.d.ts | 7 ++++++- types/joi/joi-tests.ts | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/types/joi/index.d.ts b/types/joi/index.d.ts index 12aa17b643..2f6b8679f6 100644 --- a/types/joi/index.d.ts +++ b/types/joi/index.d.ts @@ -1122,7 +1122,7 @@ export function ref(key: string, options?: ReferenceOptions): Reference; export function isRef(ref: any): ref is Reference; /** - * Get a sub-schema of an existing schema based on a `path` that can be either a string or an array + * Get a sub-schema of an existing schema based on a `path` that can be either a string or an array * of strings For string values path separator is a dot (`.`) */ export function reach(schema: ObjectSchema, path: string): Schema; @@ -1189,6 +1189,11 @@ export function not(values: any[]): Schema; */ export function required(): Schema; +/** + * Alias of `required`. + */ +export function exist(): Schema; + /** * Marks a key as optional which will allow undefined as values. Used to annotate the schema for readability as all keys are optional by default. */ diff --git a/types/joi/joi-tests.ts b/types/joi/joi-tests.ts index def9eaafd4..6eb7950682 100644 --- a/types/joi/joi-tests.ts +++ b/types/joi/joi-tests.ts @@ -1110,6 +1110,7 @@ schema = Joi.not(x, x); schema = Joi.not([x, x, x]); schema = Joi.required(); +schema = Joi.exist(); schema = Joi.optional(); schema = Joi.forbidden(); schema = Joi.strip(); From 2f341e0c798be97a8bb1fb00ee98feda95db7dce Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Mon, 6 Aug 2018 17:27:14 -0700 Subject: [PATCH 34/56] klaw/v1: Minor cleanup --- types/klaw/v1/index.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/types/klaw/v1/index.d.ts b/types/klaw/v1/index.d.ts index 74939f30c2..f65da7af6f 100644 --- a/types/klaw/v1/index.d.ts +++ b/types/klaw/v1/index.d.ts @@ -5,7 +5,7 @@ /// -import * as fs from "fs"; +import { Stats } from "fs"; import { Readable, ReadableOptions } from 'stream'; declare function K(root: string, options?: K.Options): K.Walker; @@ -13,16 +13,16 @@ declare function K(root: string, options?: K.Options): K.Walker; declare namespace K { interface Item { path: string; - stats: fs.Stats; + stats: Stats; } type QueueMethod = "shift" | "pop"; interface Options extends ReadableOptions { queueMethod?: QueueMethod; - pathSorter?: (pathA: string, pathB: string) => number; + pathSorter?(pathA: string, pathB: string): number; fs?: any; // fs or mock-fs - filter?: (path: string) => boolean; + filter?(path: string): boolean; } type Event = "close" | "data" | "end" | "readable" | "error"; From a2bd22304223ec91d802872abadfed07fe6df7fa Mon Sep 17 00:00:00 2001 From: Andy Date: Mon, 6 Aug 2018 17:36:51 -0700 Subject: [PATCH 35/56] velocity-animate: Support HTMLCollection in addition to NodeListOf (#27794) --- types/velocity-animate/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/velocity-animate/index.d.ts b/types/velocity-animate/index.d.ts index f6b696870f..24dc53b4be 100644 --- a/types/velocity-animate/index.d.ts +++ b/types/velocity-animate/index.d.ts @@ -87,8 +87,8 @@ declare namespace jquery.velocity { interface VelocityStatic { Sequences: any; mock: any; - animate(options: {elements: NodeListOf; properties: Properties; options: Options}): any; - animate(elements: HTMLElement|NodeListOf, properties: Properties, options: Options): any; + animate(options: {elements: HTMLCollection | NodeListOf; properties: Properties; options: Options}): any; + animate(elements: HTMLElement | HTMLCollection | NodeListOf, properties: Properties, options: Options): any; RegisterEffect(name: string, options: RegisterEffectOptions): VelocityStatic; RunSequence(sequence: SequenceCall[]): VelocityStatic; From 480f7557d281a451302b4f50f1ff3ce0b26aaf8c Mon Sep 17 00:00:00 2001 From: Andy Date: Mon, 6 Aug 2018 17:38:22 -0700 Subject: [PATCH 36/56] webappsec-credential-management: Fix lib.dom error (#27797) --- types/webappsec-credential-management/index.d.ts | 3 +++ .../webappsec-credential-management-tests.ts | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/types/webappsec-credential-management/index.d.ts b/types/webappsec-credential-management/index.d.ts index 9ab3292c3b..ba9058a9a0 100644 --- a/types/webappsec-credential-management/index.d.ts +++ b/types/webappsec-credential-management/index.d.ts @@ -25,6 +25,9 @@ interface GlobalFetch { // variant for navigator.credentials monkey patching fetch(url: Request|string, init?: CMRequestInit): Promise; } +interface WindowOrWorkerGlobalScope { + fetch(url: Request|string, init?: CMRequestInit): Promise; +} /** * Variant of TS 2.2 {@link RequestInit} that permits a diff --git a/types/webappsec-credential-management/webappsec-credential-management-tests.ts b/types/webappsec-credential-management/webappsec-credential-management-tests.ts index 2afa9f8785..9d20ed37dc 100644 --- a/types/webappsec-credential-management/webappsec-credential-management-tests.ts +++ b/types/webappsec-credential-management/webappsec-credential-management-tests.ts @@ -214,7 +214,7 @@ function signOutDeprecated() { } navigator.credentials.requireUserMediation().then(() => { - document.location.assign('/'); + document.location!.assign('/'); }); } @@ -224,7 +224,7 @@ function signOut() { } navigator.credentials.preventSilentAccess().then(() => { - document.location.assign('/'); + document.location!.assign('/'); }); } From d00526b1b5facfd9ece356b0c6aa0cc2a22d7aad Mon Sep 17 00:00:00 2001 From: Mikael Hermansson Date: Tue, 7 Aug 2018 10:55:42 +0200 Subject: [PATCH 37/56] radium: Remove myself as author --- types/radium/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/radium/index.d.ts b/types/radium/index.d.ts index 6e46ce4ddd..d8d56caf26 100644 --- a/types/radium/index.d.ts +++ b/types/radium/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for radium 0.24.0 // Project: https://github.com/formidablelabs/radium -// Definitions by: Alex Gorbatchev , Philipp Holzer , Alexey Svetliakov , Mikael Hermansson +// Definitions by: Alex Gorbatchev , Philipp Holzer , Alexey Svetliakov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 From 44db229c6eda231ebb6f54752b6d6ca17f68b952 Mon Sep 17 00:00:00 2001 From: jansule Date: Tue, 7 Aug 2018 11:08:30 +0200 Subject: [PATCH 38/56] Affect returned value to typed variables in getters Also, remove name from contributors list --- types/openlayers/index.d.ts | 1 - types/openlayers/openlayers-tests.ts | 14 +++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/types/openlayers/index.d.ts b/types/openlayers/index.d.ts index 01d7e120f5..37cac7e65d 100644 --- a/types/openlayers/index.d.ts +++ b/types/openlayers/index.d.ts @@ -9,7 +9,6 @@ // Yair Tawil // Pierre Marchand // Hauke Stieler -// Jan Suleiman // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // Definitions partially generated using tsd-jsdoc (https://github.com/englercj/tsd-jsdoc) diff --git a/types/openlayers/openlayers-tests.ts b/types/openlayers/openlayers-tests.ts index 240f77d033..6e28ad4cd2 100644 --- a/types/openlayers/openlayers-tests.ts +++ b/types/openlayers/openlayers-tests.ts @@ -1133,13 +1133,13 @@ styleStroke.setLineDashOffset(10); styleStroke.setMiterLimit(20); styleStroke.setWidth(5); -styleStroke.getColor(); -styleStroke.getLineCap(); -styleStroke.getLineJoin(); -styleStroke.getLineDash(); -styleStroke.getLineDashOffset(); -styleStroke.getMiterLimit(); -styleStroke.getWidth(); +const strokeColor: ol.Color|ol.ColorLike = styleStroke.getColor(); +const strokeLineCap: string = styleStroke.getLineCap(); +const strokeLineJoin: string = styleStroke.getLineJoin(); +const strokeLineDash: number[] = styleStroke.getLineDash(); +const strokeLineDashOffset: number = styleStroke.getLineDashOffset(); +const strokeMiterLimit: number = styleStroke.getMiterLimit(); +const strokeWidth: number = styleStroke.getWidth(); // // ol.proj From b665b3927ab9169e3ba3122d7ffa63ccb8496229 Mon Sep 17 00:00:00 2001 From: Chanaka Date: Tue, 7 Aug 2018 14:46:40 +0530 Subject: [PATCH 39/56] Added few missing properties --- types/leaflet-routing-machine/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/leaflet-routing-machine/index.d.ts b/types/leaflet-routing-machine/index.d.ts index 16da37f7c5..7ad4bdaf74 100644 --- a/types/leaflet-routing-machine/index.d.ts +++ b/types/leaflet-routing-machine/index.d.ts @@ -111,6 +111,7 @@ declare module 'leaflet' { profile?: string; polylinePrecision?: number; useHints?: boolean; + routingOptions?:any; } class Formatter { @@ -190,6 +191,7 @@ declare module 'leaflet' { allowUTurns: boolean; geometryOnly: boolean; fileFormat: string; + simplifyGeometry:boolean; } // tslint:disable-next-line interface-name From 7a0c74a5e609a4448203720e9a2b2857f90469d4 Mon Sep 17 00:00:00 2001 From: chanakadrathnayaka Date: Tue, 7 Aug 2018 15:21:05 +0530 Subject: [PATCH 40/56] Issue fix --- types/leaflet-routing-machine/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/leaflet-routing-machine/index.d.ts b/types/leaflet-routing-machine/index.d.ts index 7ad4bdaf74..2ec6d9ef27 100644 --- a/types/leaflet-routing-machine/index.d.ts +++ b/types/leaflet-routing-machine/index.d.ts @@ -111,7 +111,7 @@ declare module 'leaflet' { profile?: string; polylinePrecision?: number; useHints?: boolean; - routingOptions?:any; + routingOptions?: any; } class Formatter { @@ -191,7 +191,7 @@ declare module 'leaflet' { allowUTurns: boolean; geometryOnly: boolean; fileFormat: string; - simplifyGeometry:boolean; + simplifyGeometry: boolean; } // tslint:disable-next-line interface-name From 4603f233267c3c86422cff3e82fd243bcbe3c641 Mon Sep 17 00:00:00 2001 From: LexSwed Date: Tue, 7 Aug 2018 14:26:47 +0300 Subject: [PATCH 41/56] [parse-git-config] add missing options --- types/parse-git-config/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/parse-git-config/index.d.ts b/types/parse-git-config/index.d.ts index cae3e74a45..3ca55b897a 100644 --- a/types/parse-git-config/index.d.ts +++ b/types/parse-git-config/index.d.ts @@ -49,6 +49,8 @@ interface Options extends Pick<_Options, keyof _Options> { } interface _Options { cwd: string; path: string; + include?: boolean; + expandKeys?: boolean; } type ParseCallback = ((err: Error | null, config: Config) => void); From bceea928ac1252ea1c0765ab4967f4e1da200e5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Tue, 7 Aug 2018 14:56:25 +0200 Subject: [PATCH 42/56] [auth0-js] Add prompt value in AuthorizeOptions --- types/auth0-js/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/auth0-js/index.d.ts b/types/auth0-js/index.d.ts index 62047bae71..e66cd5f712 100644 --- a/types/auth0-js/index.d.ts +++ b/types/auth0-js/index.d.ts @@ -761,6 +761,7 @@ export interface AuthorizeOptions { scope?: string; audience?: string; language?: string; + prompt?: string; } export interface CheckSessionOptions extends AuthorizeOptions { From 63788e8495f897cf6577211cb091a3bdbd1231e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Tue, 7 Aug 2018 14:58:02 +0200 Subject: [PATCH 43/56] Update test --- types/auth0-js/auth0-js-tests.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/auth0-js/auth0-js-tests.ts b/types/auth0-js/auth0-js-tests.ts index 79277e04c9..f13599ebae 100644 --- a/types/auth0-js/auth0-js-tests.ts +++ b/types/auth0-js/auth0-js-tests.ts @@ -10,7 +10,8 @@ webAuth.authorize({ scope: 'read:order write:order', responseType: 'token', redirectUri: 'https://example.com/auth/callback', - language: 'en' + language: 'en', + prompt: 'login', }); webAuth.parseHash((err, authResult) => { From 6e89722230dd7505630539ee386d57c61239a77b Mon Sep 17 00:00:00 2001 From: Tiger Oakes Date: Tue, 7 Aug 2018 09:48:34 -0400 Subject: [PATCH 44/56] Removes interactjs types The interactjs package has provided a index.d.ts file since August 2017. --- notNeededPackages.json | 6 + types/interact.js/index.d.ts | 259 ------------------------- types/interact.js/interact.js-tests.ts | 110 ----------- types/interact.js/tsconfig.json | 24 --- types/interact.js/tslint.json | 79 -------- 5 files changed, 6 insertions(+), 472 deletions(-) delete mode 100644 types/interact.js/index.d.ts delete mode 100644 types/interact.js/interact.js-tests.ts delete mode 100644 types/interact.js/tsconfig.json delete mode 100644 types/interact.js/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 7c6d2629a8..8b56dbd9b5 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -678,6 +678,12 @@ "sourceRepoURL": "https://github.com/facebook/immutable-js", "asOfVersion": "3.8.7" }, + { + "libraryName": "interactjs", + "typingsPackageName": "interact.js", + "sourceRepoURL": "https://github.com/taye/interact.js", + "asOfVersion": "1.3.0" + }, { "libraryName": "inversify", "typingsPackageName": "inversify", diff --git a/types/interact.js/index.d.ts b/types/interact.js/index.d.ts deleted file mode 100644 index 866ced2216..0000000000 --- a/types/interact.js/index.d.ts +++ /dev/null @@ -1,259 +0,0 @@ -// Type definitions for Interacting for interact.js v1.0.25 -// Project: https://github.com/taye/interact.js -// Definitions by: Douglas Eichelberger , Adi Dahiya , Tom Hasner -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -// API documentation: http://interactjs.io/docs - -declare namespace Interact { - interface Interactable { - // returns Element or string - accept(): any; - accept(newValue: Element): Interactable; - accept(newValue: string): Interactable; - actionChecker(): Function; - actionChecker(checker: Function): Interactable; - // returns boolean or {[key: string]: any} - autoScroll(): any; - autoScroll(options: boolean): Interactable; - autoScroll(options: {[key: string]: any}): Interactable; - context(): Node; - defaultActionChecker(event: any): string; - deltaSource(): string; - // returns Interactable if newValue is "page" or "client", otherwise returns string - deltaSource(newValue: String): Interactable; - draggable(): boolean; - draggable(options: boolean): Interactable; - draggable(options: {[key: string]: any}): Interactable; - dropCheck(event: MouseEvent): boolean; - dropCheck(event: TouchEvent): boolean; - dropChecker(): Function; - dropChecker(checker: Function): Interactable; - // returns boolean or {[key: string]: any} - dropzone(): any; - dropzone(options: boolean): Interactable; - dropzone(options: {[key: string]: any}): Interactable; - // return HTMLElement or SVGElement - element(): Element; - fire(iEvent: InteractEvent): Interactable; - // returns boolean or {[key: string]: any} - gesturable(): any; - gesturable(options: boolean): Interactable; - gesturable(options: {[key: string]: any}): Interactable; - getRect(): ClientRect; - // returns Element or string - ignoreFrom(): any; - ignoreFrom(newValue: string): Interactable; - ignoreFrom(newValue: Element): Interactable; - // returns boolean or {[key: string]: any} - inertia(): any; - inertia(options: boolean): Interactable; - inertia(options: {[key: string]: any}): Interactable; - off(eventType: string, listener: Function, useCapture?: boolean): Interactable; - on(eventType: string, listener: Function, useCapture?: boolean): Interactable; - origin(): Point; - origin(newValue: HTMLElement): Interactable; - origin(newValue: SVGElement): Interactable; - origin(newValue: Point): Interactable; - preventDefault(newValue: boolean | string): Interactable; - rectChecker(): Function; - rectChecker(newValue: Function): Interactable; - resizable(): Interactable; - resizable(options: boolean): Interactable; - resizable(options: {[key: string]: any}): Interactable; - restrict(): Restrict; - restrict(newValue: Restrict): Interactable; - set(options: {[key: string]: any}): Interactable; - // returns boolean or {[key: string]: any} - snap(): any; - snap(options: boolean): Interactable; - snap(options: {[key: string]: any}): Interactable; - squareResize(): boolean; - squareResize(newValue: boolean): Interactable; - styleCursor(): boolean; - styleCursor(newValue: boolean): Interactable; - unset(): InteractStatic; - validateSetting(context: string, option: string, value: any): any; - } - - interface Coordinates { - clientX: number; - clientY: number; - pageX: number; - pageY: number; - timeStamp: number; - } - - interface Debug { - target: any; - dragging: any; - resizing: any; - gesturing: any; - prepared: any; - - prevCoords: Coordinates; - downCoords: Coordinates; - - pointerIds: any[]; - pointerMoves: any[]; - addPointer: any; - removePointer: any; - recordPointers: any; - - inertia: InertiaStatus; - - downTime: any; - downEvent: any; - prevEvent: any; - - Interactable: any; - IOptions: any; - interactables: any; - dropzones: any; - pointerIsDown: any; - defaultOptions: any; - defaultActionChecker: any; - - actions: any; - dragMove: any; - resizeMove: any; - gestureMove: any; - pointerUp: any; - pointerDown: any; - pointerMove: any; - pointerHover: any; - - events: any; - globalEvents: any; - delegatedEvents: any; - } - - interface InertiaStatus { - active: boolean; - target: any; - targetElement: any; - - startEvent: any; - pointerUp: any - - xe: number; - ye: number; - duration: number; - - t0: number; - vx0: number; - vys: number; - - lambda_v0: number; - one_ve_v0: number; - i: any; - } - - interface Point { - x: number; - y: number; - } - - // value types are either ClientRect or Element - interface Restrict { - drag?: any; - gesture?: any; - resize?: any; - elementRect?: {[direction: string]: number}; - } - - interface InteractEvent { - altKey: boolean; - axes: string; - button: number - clientX0: number; - clientX: number - clientY0: number; - clientY: number - ctrlKey: boolean - dt: number; - duration: number; - dx: number; - dy: number; - metaKey: boolean; - pageX: number; - pageY: number; - shiftKey: boolean; - speed: number; - t0: number; - target: any; - timeStamp: number; - type: string; - velocityX: number; - velocityY: number; - x0: number; - y0: number; - } - - interface TouchEvent { - pageX: number; - pageY: number; - type: string; - } - - interface InteractStatic { - (element: HTMLElement): Interactable; - (element: SVGElement): Interactable; - (element: string): Interactable; - (element: string, options: {context: Element}): Interactable; - // returns boolean or {[key: string]: any} - autoScroll(): any; - autoScroll(options: boolean): InteractStatic; - autoScroll(options: {[key: string]: any}): InteractStatic; - currentAction(): string - debug(): Debug; - deltaSource(): string; - // "page" and "client" are the valid parameters - deltaSource(newValue: string): InteractStatic; - dynamicDrop(): boolean; - dynamicDrop(newValue: boolean): InteractStatic; - enableDragging(): boolean; - enableDragging(newValue: boolean): InteractStatic; - enableGesturing(): boolean; - enableGesturing(newValue: boolean): InteractStatic; - enableResizing(): boolean; - enableResizing(newValue: boolean): InteractStatic; - // returns boolean or {[key: string]: any} - inertia(): any; - inertia(options: boolean): InteractStatic; - inertia(options: {[key: string]: any}): InteractStatic; - isSet(element: Element): boolean; - margin(): number; - margin(newvalue: number): InteractStatic; - off(type: string, listener: Function, useCapture?: boolean): InteractStatic; - on(type: string, listener: Function, useCapture?: boolean): InteractStatic; - restrict(): Restrict; - restrict(newValue: Restrict): InteractStatic; - simulate(action: string, element: Element, pointerEvent?: any): InteractStatic; - // returns boolean or {[key: string]: any} - snap(): any; - snap(options: boolean): InteractStatic; - snap(options: {[key: string]: any}): InteractStatic; - stop(event: Event): InteractStatic; - styleCursor(): boolean; - styleCursor(newValue: boolean): InteractStatic; - supportsTouch(): boolean - } -} - -declare var interact: Interact.InteractStatic; - -// CommonJS module name until version 1.2.6 is "interact.js" - declare module "interact.js" { - export = interact; - } - -// CommonJS module name from version 1.2.7 onward is "interactjs" -declare module "interactjs" { - export = interact; -} - -// AMD module name is "interact" -declare module "interact" { - export = interact; -} diff --git a/types/interact.js/interact.js-tests.ts b/types/interact.js/interact.js-tests.ts deleted file mode 100644 index f2a735e2da..0000000000 --- a/types/interact.js/interact.js-tests.ts +++ /dev/null @@ -1,110 +0,0 @@ - - -import interact = require("interact.js"); - -var button: HTMLElement = document.createElement("BUTTON"); -var rectangle: ClientRect = { - left: 100, - width: 100, - right: 100, - top: 100, - bottom: 100, - height: 100 -}; -let context = document.createElement("a"); -let interactable = interact(".foo", {context: context}); -interactable = interact(button); - -interactable.draggable(); -interactable.draggable(true); -interactable.draggable({ - onstart: (event: Interact.InteractEvent) => {}, - onmove : (event: Interact.InteractEvent) => {}, - onend : (event: Interact.InteractEvent) => {} -}); -interactable.dropzone(); -interactable.dropzone(true); -interactable.dropChecker(() => {}); -interactable.accept(); -interactable.accept("button"); -interactable.accept(button); -interactable.resizable(); -interactable.resizable(true); -interactable.squareResize(); -interactable.squareResize(true); -interactable.gesturable(); -interactable.gesturable(true); -interactable.gesturable({ - onmove: () => {} -}); -interactable.autoScroll(); -interactable.autoScroll(true); -interactable.snap(); -interactable.snap(true); -interactable.inertia(); -interactable.inertia({ - resistance: 1 -}); -interactable.inertia(true); -interactable.actionChecker(); -interactable.actionChecker((event: MouseEvent, defaultAction: string, interactable2: Interact.Interactable) => defaultAction); -var rect: ClientRect = interactable.getRect(); -interactable.rectChecker(); -interactable.styleCursor(); -interactable.origin(); -interactable.origin({x: 0, y: 0}); -interactable.origin(button); -interactable.deltaSource(); -interactable.deltaSource("client"); -interactable.restrict(); -interactable.restrict({ - "drag": button, - "resize": button, - "gesture": button -}); -interactable.context(); -interactable.ignoreFrom(); -interactable.ignoreFrom("button"); -interactable.ignoreFrom(button); -interactable.validateSetting("restrict", "drag", button); -interactable.element(); -interactable.on("click", () => {}, true); -interactable.off("click", () => {}, true); -interactable.unset(); - -interact.isSet(button); -interact.on("click", () => {}, true); -interact.off("click", () => {}, true); -interact.enableDragging(); -interact.enableDragging(true); -interact.enableResizing(); -interact.enableResizing(true); -interact.enableGesturing(); -interact.enableGesturing(true); -interact.debug(); -interact.margin(); -interact.margin(10); -interact.styleCursor(); -interact.styleCursor(true); -interact.autoScroll(true); -interact.autoScroll(); -interact.snap(); -interact.snap(true); -interact.snap({ - mode: "grid" -}); -interact.inertia(); -interact.inertia(true); -interact.supportsTouch(); -interact.currentAction(); -interact.dynamicDrop(); -interact.dynamicDrop(true); -interact.deltaSource(); -interact.deltaSource("page"); - -interact.restrict({ - "drag": rectangle, - "resize": rectangle, - "gesture": rectangle, - "elementRect": { top: 0, left: 0, bottom: 1, right: 1 } -}); diff --git a/types/interact.js/tsconfig.json b/types/interact.js/tsconfig.json deleted file mode 100644 index 6d4887d0f1..0000000000 --- a/types/interact.js/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "interact.js-tests.ts" - ] -} \ No newline at end of file diff --git a/types/interact.js/tslint.json b/types/interact.js/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/interact.js/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} From 2ddb0343a29b6e0f51f9f95089aba87440b7660e Mon Sep 17 00:00:00 2001 From: "Krzysztof \"Bushee\" Nowaczyk" Date: Tue, 7 Aug 2018 15:49:08 +0200 Subject: [PATCH 45/56] added missing context param in angular-gettext's gettext.getPlural() --- types/angular-gettext/angular-gettext-tests.ts | 2 ++ types/angular-gettext/index.d.ts | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/types/angular-gettext/angular-gettext-tests.ts b/types/angular-gettext/angular-gettext-tests.ts index 766b16a963..1b1d5b6342 100644 --- a/types/angular-gettext/angular-gettext-tests.ts +++ b/types/angular-gettext/angular-gettext-tests.ts @@ -24,6 +24,8 @@ angular.module("myApp").controller("helloController", function (gettextCatalog: angular.module("myApp").controller("helloController", function (gettextCatalog: angular.gettext.gettextCatalog) { var myString2: string = gettextCatalog.getPlural(3, "Bird", "Birds"); + var myStringWithScope: string = gettextCatalog.getPlural(4, "{{color}} Bird", "{{color}} Birds", {color: 'Blue'}); + var myStringWithContext: string = gettextCatalog.getPlural(5, "pick", "picks", null, 'noun'); }); angular.module("myApp").controller("helloController", function (gettextCatalog: angular.gettext.gettextCatalog) { diff --git a/types/angular-gettext/index.d.ts b/types/angular-gettext/index.d.ts index 5b6eb1d90f..6b5fe29e73 100644 --- a/types/angular-gettext/index.d.ts +++ b/types/angular-gettext/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for angular-gettext v2.1.0 +// Type definitions for angular-gettext v2.1.1 // Project: https://angular-gettext.rocketeer.be/ // Definitions by: Ákos Lukács // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -66,7 +66,7 @@ declare module 'angular' { getString(string: string, scope?: any, context?: string): string; /** Translate a plural string with the given context. */ - getPlural(n: number, string: string, stringPlural: string, context?: any): string; + getPlural(n: number, string: string, stringPlural: string, scope?: any, context?: string): string; /** Load a set of translation strings from a given URL.This should be a JSON catalog generated with grunt-angular-gettext. More details https://angular-gettext.rocketeer.be/dev-guide/lazy-loading/ */ loadRemote(url: string): ng.IHttpPromise; From 1151563af9b1a3f8f5654d511d389be3f4f18db2 Mon Sep 17 00:00:00 2001 From: Andy Date: Tue, 7 Aug 2018 08:27:21 -0700 Subject: [PATCH 46/56] Change all `document.body!` to `document.body` (#27920) --- types/bricks.js/bricks.js-tests.ts | 2 +- types/clipboard-js/clipboard-js-tests.ts | 2 +- types/d3-dispatch/d3-dispatch-tests.ts | 8 ++++---- types/deku/deku-tests.ts | 8 ++++---- types/jquery.notify/jquery.notify-tests.ts | 2 +- types/jsdom/jsdom-tests.ts | 8 ++++---- types/mark.js/mark.js-tests.ts | 2 +- types/marko/marko-tests.ts | 6 +++--- types/mithril/test/test-api.ts | 14 +++++++------- types/mithril/test/test-class-component.ts | 2 +- types/mithril/test/test-factory-component.ts | 2 +- types/mithril/test/test-misc.ts | 6 +++--- types/mithril/test/test-route.ts | 2 +- types/webcomponents.js/webcomponents.js-tests.ts | 2 +- types/webtorrent/webtorrent-tests.ts | 2 +- 15 files changed, 34 insertions(+), 34 deletions(-) diff --git a/types/bricks.js/bricks.js-tests.ts b/types/bricks.js/bricks.js-tests.ts index b916e97aca..dbef221df0 100644 --- a/types/bricks.js/bricks.js-tests.ts +++ b/types/bricks.js/bricks.js-tests.ts @@ -1,7 +1,7 @@ import Bricks from 'bricks.js'; const bricks = Bricks({ - container: document.body!.firstChild!, + container: document.body.firstChild!, packed: 'packed', sizes: [ { columns: 2, gutter: 10 }, diff --git a/types/clipboard-js/clipboard-js-tests.ts b/types/clipboard-js/clipboard-js-tests.ts index bcc576b7c9..ef1bfbdf5d 100644 --- a/types/clipboard-js/clipboard-js-tests.ts +++ b/types/clipboard-js/clipboard-js-tests.ts @@ -1,4 +1,4 @@ clipboard.copy("Hello World"); -clipboard.copy(document.body!).then(() => console.log("success")); +clipboard.copy(document.body).then(() => console.log("success")); clipboard.paste().then(val => console.log(val)); diff --git a/types/d3-dispatch/d3-dispatch-tests.ts b/types/d3-dispatch/d3-dispatch-tests.ts index b4f44ad4d2..4e8d2cfb31 100644 --- a/types/d3-dispatch/d3-dispatch-tests.ts +++ b/types/d3-dispatch/d3-dispatch-tests.ts @@ -47,12 +47,12 @@ undef = dispatch.on('unknown') as undefined; dispatch.on('bar', dispatch.on('bar')!); dispatch.call('foo'); -dispatch.call('foo', document.body!); -dispatch.call('foo', document.body!, { a: 3, b: 'test' }, 1); +dispatch.call('foo', document.body); +dispatch.call('foo', document.body, { a: 3, b: 'test' }, 1); dispatch.apply('bar'); -dispatch.apply('bar', document.body!); -dispatch.apply('bar', document.body!, [{ a: 3, b: 'test' }, 1]); +dispatch.apply('bar', document.body); +dispatch.apply('bar', document.body, [{ a: 3, b: 'test' }, 1]); dispatch.on('bar', null); diff --git a/types/deku/deku-tests.ts b/types/deku/deku-tests.ts index d0467adead..d123c7b8f7 100644 --- a/types/deku/deku-tests.ts +++ b/types/deku/deku-tests.ts @@ -24,7 +24,7 @@ }) } - let render = createApp(document.body!) + let render = createApp(document.body) function main(state: any){ let vnode = view(state, (action: any) => main({ count: 0 })) @@ -43,7 +43,7 @@ return element('div', { class: `size-${ props.size }` }) } - const render = createApp(document.body!) + const render = createApp(document.body) render(element(App, { size: 'small' })) @@ -82,11 +82,11 @@ (function (){ const { createApp, element } = deku - let render: Function = createApp(document.body!) + let render: Function = createApp(document.body) render(element('div')) - render = createApp(document.body!, (action: any) => { + render = createApp(document.body, (action: any) => { render(element('div')) }) diff --git a/types/jquery.notify/jquery.notify-tests.ts b/types/jquery.notify/jquery.notify-tests.ts index 1d872e92fa..1af31996a1 100644 --- a/types/jquery.notify/jquery.notify-tests.ts +++ b/types/jquery.notify/jquery.notify-tests.ts @@ -1,4 +1,4 @@ -let $container: JQueryNotifyWidget = $("").appendTo(document.body!).notify(); +let $container: JQueryNotifyWidget = $("").appendTo(document.body).notify(); let notification: JQueryNotifyInstance = $container.notify( "create", diff --git a/types/jsdom/jsdom-tests.ts b/types/jsdom/jsdom-tests.ts index 24b136e5ad..2dbbdca601 100644 --- a/types/jsdom/jsdom-tests.ts +++ b/types/jsdom/jsdom-tests.ts @@ -17,7 +17,7 @@ function test_executing_scripts1() { `); // The script will not be executed, by default: - dom.window.document.body!.children.length === 1; + dom.window.document.body.children.length === 1; } function test_executing_scripts2() { @@ -26,14 +26,14 @@ function test_executing_scripts2() { `, { runScripts: 'dangerously' }); // The script will be executed and modify the DOM: - dom.window.document.body!.children.length === 2; + dom.window.document.body.children.length === 2; } function test_executing_scripts3() { const window = (new JSDOM(``, { runScripts: 'outside-only' })).window; window.eval(`document.body.innerHTML = "

Hello, world!

";`); - window.document.body!.children.length === 1; + window.document.body.children.length === 1; } function test_virtualConsole() { @@ -86,7 +86,7 @@ function test_nodeLocation() { ); const document = dom.window.document; - const bodyEl = document.body!; // implicitly created + const bodyEl = document.body; // implicitly created const pEl = document.querySelector('p')!; const textNode = pEl.firstChild!; const imgEl = document.querySelector('img')!; diff --git a/types/mark.js/mark.js-tests.ts b/types/mark.js/mark.js-tests.ts index 2f4bb62d9a..a979990521 100644 --- a/types/mark.js/mark.js-tests.ts +++ b/types/mark.js/mark.js-tests.ts @@ -3,7 +3,7 @@ import * as Mark from 'mark.js'; /* test instance */ const mark = new Mark(document.querySelectorAll('div')); const markBySelector = new Mark('div'); -const markByElement = new Mark(document.body!); +const markByElement = new Mark(document.body); mark.mark('keyword'); mark.mark('keyword', { diff --git a/types/marko/marko-tests.ts b/types/marko/marko-tests.ts index e43f61d8b5..623ad12e5f 100644 --- a/types/marko/marko-tests.ts +++ b/types/marko/marko-tests.ts @@ -18,7 +18,7 @@ const template: Template = require('template.marko'); // $ExpectType RenderResult template .renderSync({ name: 'Marko' }) - .appendTo(document.body!); + .appendTo(document.body); createServer((req, res) => { res.setHeader('content-type', 'text/html'); @@ -30,12 +30,12 @@ const template: Template = require('template.marko'); .render({ $global: { flags: ['mobile'] } }) .then((result) => { // $ExpectType RenderResult - result.appendTo(document.body!); + result.appendTo(document.body); }); template.render({}, (err: Error | null, result: RenderResult) => { // $ExpectType RenderResult - result.appendTo(document.body!); + result.appendTo(document.body); }); }; diff --git a/types/mithril/test/test-api.ts b/types/mithril/test/test-api.ts index 66c026f47d..73e03edeae 100644 --- a/types/mithril/test/test-api.ts +++ b/types/mithril/test/test-api.ts @@ -142,7 +142,7 @@ const FRAME_BUDGET = 100; }); }; - m.render(document.body!, userInputs(users)); + m.render(document.body, userInputs(users)); } //////////////////////////////////////////////////////////////////////////////// @@ -246,7 +246,7 @@ const FRAME_BUDGET = 100; }; // example 1 - m.route(document.body!, "/", { + m.route(document.body, "/", { "/": { view() { return m(Layout, m(Home)); @@ -260,7 +260,7 @@ const FRAME_BUDGET = 100; }); // example 2 - m.route(document.body!, "/", { + m.route(document.body, "/", { "/": { render() { return m(Layout, m(Home)); @@ -285,7 +285,7 @@ const FRAME_BUDGET = 100; }, }; - m.route(document.body!, "/", { + m.route(document.body, "/", { "/": { render() { return m(Anon1); @@ -313,7 +313,7 @@ const FRAME_BUDGET = 100; } }; - m.route(document.body!, "/user/list", { + m.route(document.body, "/user/list", { "/user/list": { onmatch: state.loadUsers, render() { @@ -330,7 +330,7 @@ const FRAME_BUDGET = 100; { let progress = 0; - m.mount(document.body!, { + m.mount(document.body, { view() { return [ m("input[type=file]", { onchange: upload }), @@ -396,7 +396,7 @@ const FRAME_BUDGET = 100; deserialize: value => value }) .then(svg => { - m.render(document.body!, m.trust(svg)); + m.render(document.body, m.trust(svg)); }); } diff --git a/types/mithril/test/test-class-component.ts b/types/mithril/test/test-class-component.ts index 44c81a8b56..0b70773c9e 100644 --- a/types/mithril/test/test-class-component.ts +++ b/types/mithril/test/test-class-component.ts @@ -112,7 +112,7 @@ class Comp4 implements ClassComponent { // // Test that all are mountable components // -m.route(document.body!, '/', { +m.route(document.body, '/', { '/comp0': Comp0, '/comp1': Comp1, '/comp2': Comp2, diff --git a/types/mithril/test/test-factory-component.ts b/types/mithril/test/test-factory-component.ts index b53619fbf1..6d0102fe38 100644 --- a/types/mithril/test/test-factory-component.ts +++ b/types/mithril/test/test-factory-component.ts @@ -148,7 +148,7 @@ function comp5(): Component { // // Test that all are mountable components // -m.route(document.body!, '/', { +m.route(document.body, '/', { '/comp0': comp0, '/comp1': comp1, '/comp2': comp2, diff --git a/types/mithril/test/test-misc.ts b/types/mithril/test/test-misc.ts index 548811247d..3f377fec60 100644 --- a/types/mithril/test/test-misc.ts +++ b/types/mithril/test/test-misc.ts @@ -10,9 +10,9 @@ const params = parseQueryString('?id=123'); const qstr = buildQueryString({id: 123}); -render(document.body!, 'Hello'); -render(document.body!, h('h1', 'Test')); -render(document.body!, [ +render(document.body, 'Hello'); +render(document.body, h('h1', 'Test')); +render(document.body, [ h('h1', 'Test'), "abc", null, 123, false, h('p', 'Vnode array'), ['a', 123, undefined, h('div', 'Nested')] ]); diff --git a/types/mithril/test/test-route.ts b/types/mithril/test/test-route.ts index 63f10e510e..7f82c9fa40 100644 --- a/types/mithril/test/test-route.ts +++ b/types/mithril/test/test-route.ts @@ -66,7 +66,7 @@ const routeResolver: RouteResolver & RRState = { } }; -route(document.body!, '/', { +route(document.body, '/', { '/': component1, '/test1': { onmatch(args, path) { diff --git a/types/webcomponents.js/webcomponents.js-tests.ts b/types/webcomponents.js/webcomponents.js-tests.ts index 8fb40bd824..2ed224ef23 100644 --- a/types/webcomponents.js/webcomponents.js-tests.ts +++ b/types/webcomponents.js/webcomponents.js-tests.ts @@ -16,7 +16,7 @@ const XFoo = document.registerElement("x-foo", { const xFoo = new XFoo(); xFoo.textContent = ""; -document.body!.appendChild(xFoo); +document.body.appendChild(xFoo); window.CustomElements.hasNative; window.CustomElements.flags; diff --git a/types/webtorrent/webtorrent-tests.ts b/types/webtorrent/webtorrent-tests.ts index d8ffba389d..63a9647902 100644 --- a/types/webtorrent/webtorrent-tests.ts +++ b/types/webtorrent/webtorrent-tests.ts @@ -31,7 +31,7 @@ client.add(magnetURI, {}, torrent => { a.href = url; } a.textContent = 'Download ' + file.name; - document.body!.appendChild(a); + document.body.appendChild(a); }); }); From 61173dfe08d4cc9c05961ffe2eefd716753698c5 Mon Sep 17 00:00:00 2001 From: Dobes Vandermeer Date: Tue, 7 Aug 2018 00:28:41 -0700 Subject: [PATCH 47/56] Fix typings for zipcodes The typings didn't match the library. * `lookup` takes a `string` (or a `number` if you so choose): https://github.com/davglass/zipcodes/blob/master/lib/index.js#L13 * `distance` takes two `string`s, not `ZipCode` objects: https://github.com/davglass/zipcodes/blob/master/lib/index.js#L56 * similarly, `radius` takes a string rather than a `ZipCode` object, and always returns an array (of `string`s or `ZipCode` objects): https://github.com/davglass/zipcodes/blob/master/lib/index.js#L80 * Many return values are optional, with `null` or `undefined` returned for an invalid input. --- types/zipcodes/index.d.ts | 12 ++++++------ types/zipcodes/zipcodes-tests.ts | 10 +++++----- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/types/zipcodes/index.d.ts b/types/zipcodes/index.d.ts index b1903ad48b..276db5cbac 100644 --- a/types/zipcodes/index.d.ts +++ b/types/zipcodes/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for zipcodes 6.0 +// Type definitions for zipcodes 6.1 // Project: https://github.com/davglass/zipcodes#readme -// Definitions by: Brayden Lopez +// Definitions by: Brayden Lopez , Dobes Vandermeer // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export as namespace ZipCodes; @@ -14,18 +14,18 @@ export interface ZipCode { country: string; } -export function lookup(zip: any): ZipCode; +export function lookup(zip: string|number): ZipCode | undefined; export function lookupByName(city: string, state: string): ZipCode[]; export function lookupByState(state: string): ZipCode[]; -export function distance(zipA: ZipCode, zipB: ZipCode): number; +export function distance(zipA: string|number, zipB: string|number): number | null; -export function radius(zip: ZipCode, miles: number, full: boolean): string | ZipCode[]; +export function radius(zip: string|number, miles: number, full: boolean): string[] | ZipCode[]; export function toMiles(kilos: number): number; export function toKilometers(miles: number): number; -export function lookupByCoords(lat: number, lon: number): ZipCode; +export function lookupByCoords(lat: number, lon: number): string | null; diff --git a/types/zipcodes/zipcodes-tests.ts b/types/zipcodes/zipcodes-tests.ts index 43bb711474..acaa6a0d46 100644 --- a/types/zipcodes/zipcodes-tests.ts +++ b/types/zipcodes/zipcodes-tests.ts @@ -18,19 +18,19 @@ const zipB: ZipCodes.ZipCode = { country: 'US' }; -ZipCodes.lookup(zipA); // $ExpectType ZipCode +ZipCodes.lookup(zipA.zip); // $ExpectType ZipCode | undefined ZipCodes.lookupByName('Cupertino', 'CA'); // $ExpectType ZipCode[] ZipCodes.lookupByState('CA'); // $ExpectType ZipCode[] -ZipCodes.distance(zipA, zipB); // $ExpectType number +ZipCodes.distance(zipA.zip, zipB.zip); // $ExpectType number | null -ZipCodes.radius(zipA, 1, true); // $ExpectType string | ZipCode[] -ZipCodes.radius(zipA, 1, false); // $ExpectType string | ZipCode[] +ZipCodes.radius(zipA.zip, 1, true); // $ExpectType ZipCode[] | string[] +ZipCodes.radius(zipA.zip, 1, false); // $ExpectType ZipCode[] | string[] ZipCodes.toMiles(3); // $ExpectType number ZipCodes.toKilometers(3); // $ExpectType number -ZipCodes.lookupByCoords(37.323, -122.0527); // $ExpectType ZipCode +ZipCodes.lookupByCoords(37.323, -122.0527); // $ExpectType string | null From c7e213857e5fed133974b6a59ef65da7baa2e6c4 Mon Sep 17 00:00:00 2001 From: Sebastian Kropp Date: Tue, 7 Aug 2018 12:25:48 -0400 Subject: [PATCH 48/56] BFS returns void if search not successful return true if search has found the node return false if search is aborted before finding anything returns void/undefined if search should continue therefore return type is a union type of `=> boolean | void` --- types/cytoscape/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/cytoscape/index.d.ts b/types/cytoscape/index.d.ts index c38acead19..59482ad507 100644 --- a/types/cytoscape/index.d.ts +++ b/types/cytoscape/index.d.ts @@ -2819,13 +2819,13 @@ declare namespace cytoscape { /** * The handler returns true when it finds the desired node, and it returns false to cancel the search. - * i - The index indicating this node is the ith visited node. - * depth - How many edge hops away this node is from the root nodes. * v - The current node. * e - The edge connecting the previous node to the current node. * u - The previous node. + * i - The index indicating this node is the ith visited node. + * depth - How many edge hops away this node is from the root nodes. */ - type SearchVisitFunction = (i: number, depth: number, v: NodeCollection, e: EdgeCollection, u: NodeCollection) => boolean; + type SearchVisitFunction = (v: NodeCollection, e: EdgeCollection, u: NodeCollection, i: number, depth: number) => boolean | void; interface SearchFirstOptions { /** * The root nodes (selector or collection) to start the search from. From 99b5e31c780c49d0ad03b3b1b005a17d7a87d367 Mon Sep 17 00:00:00 2001 From: Elizabeth Samuel Date: Tue, 7 Aug 2018 09:56:51 -0700 Subject: [PATCH 49/56] clean up formatting --- types/office-js/index.d.ts | 90 +++++++++++++++++++++++++------------- 1 file changed, 59 insertions(+), 31 deletions(-) diff --git a/types/office-js/index.d.ts b/types/office-js/index.d.ts index d24d35d469..8f187c79ea 100644 --- a/types/office-js/index.d.ts +++ b/types/office-js/index.d.ts @@ -613,7 +613,20 @@ declare namespace Office { * True, if the current platform allows the add-in to display a UI for selling or upgrading; otherwise returns False. * * @remarks - * The iOS App Store doesn't support apps with add-ins that provide links to additional payment systems. However, Office Add-ins running on the Windows desktop or for Office Online in the browser, do allow such links. If you want the UI of your add-in to provide a link to an external payment system on platforms other than iOS, you can use the commerceAllowed property to control when that link is displayed. + * The iOS App Store doesn't support apps with add-ins that provide links to additional payment systems. However, Office Add-ins running on the Windows desktop or for Office Online in the browser do allow such links. If you want the UI of your add-in to provide a link to an external payment system on platforms other than iOS, you can use the commerceAllowed property to control when that link is displayed. + * + * **Support details** + * + * A capital Y in the following matrix indicates that this property is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this enumeration. + * + * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * + * *Supported hosts, by platform* + * + * + * + * + *
Office for iPad
Excel Y
Word Y
*/ commerceAllowed: boolean; /** @@ -698,7 +711,7 @@ declare namespace Office { * Word Y Y Y * */ - document: Document; + document: Office.Document; /** * Contains the Office application host in which the add-in is running. */ @@ -725,7 +738,7 @@ declare namespace Office { * * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or read */ - mailbox: Mailbox; + mailbox: Office.Mailbox; /** * Provides access to the properties for Office theme colors. */ @@ -750,12 +763,26 @@ declare namespace Office { * * {@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}Compose or read */ - roamingSettings: RoamingSettings; + roamingSettings: Office.RoamingSettings; /** - * Specifies whether the platform and device allows touch interaction. + * Specifies whether the platform and device allows touch interaction. True if the add-in is running on a touch device, such as an iPad; False otherwise. * * @remarks * Use the touchEnabled property to determine when your add-in is running on a touch device and if necessary, adjust the kind of controls, and size and spacing of elements in your add-in's UI to accommodate touch interactions. + * + * **Support details** + * + * A capital Y in the following matrix indicates that this property is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this enumeration. + * + * For more information about Office host application and server requirements, see {@link https://docs.microsoft.com/office/dev/add-ins/concepts/requirements-for-running-office-add-ins | Requirements for running Office Add-ins}. + * + * *Supported hosts, by platform* + * + * + * + * + * + *
Office for iPad
Excel Y
PowerPoint Y
Word Y
*/ touchEnabled: boolean; /** @@ -2048,11 +2075,11 @@ declare namespace Office { * Represents a binding to a section of the document. * * @remarks - * Requirement SetsMatrixBinding, TableBinding, TextBinding + *
Requirement SetsMatrixBinding, TableBinding, TextBinding
* * The Binding object exposes the functionality possessed by all bindings regardless of type. * - * The Binding object is never called directly. It is the abstract parent class of the objects that represent each type of binding: MatrixBinding, TableBinding, or TextBinding. All three of these objects inherit the getDataAsync and setDataAsync methods from the Binding object that enable to you interact with the data in the binding. They also inherit the id and type properties for querying those property values. Additionally, the MatrixBinding and TableBinding objects expose additional methods for matrix- and table-specific features, such as counting the number of rows and columns. + * The Binding object is never called directly. It is the abstract parent class of the objects that represent each type of binding: {@link Office.MatrixBinding}, {@link Office.TableBinding}, or {@link Office.TextBinding}. All three of these objects inherit the getDataAsync and setDataAsync methods from the Binding object that enable to you interact with the data in the binding. They also inherit the id and type properties for querying those property values. Additionally, the MatrixBinding and TableBinding objects expose additional methods for matrix- and table-specific features, such as counting the number of rows and columns. * * **Support details** * @@ -2074,15 +2101,15 @@ declare namespace Office { /** * Get the Document object associated with the binding. */ - document: Document; + document: Office.Document; /** - * A string that uniquely identifies this binding among the bindings in the same Document object. + * A string that uniquely identifies this binding among the bindings in the same {@link Office.Document} object. */ id: string; /** * Gets the type of the binding. */ - type: BindingType; + type: Office.BindingType; /** * Adds an event handler to the object for the specified {@link Office.EventType}. Supported EventTypes are `Office.EventType.BindingDataChanged` and `Office.EventType.BindingSelectionChanged`. * @@ -2092,26 +2119,26 @@ declare namespace Office { * @param eventType The event type. For bindings, it can be `Office.EventType.BindingDataChanged` or `Office.EventType.BindingSelectionChanged`. * @param handler The event handler function to add, whose only parameter is of type {@link Office.BindingDataChangedEventArgs} or {@link Office.BindingSelectionChangedEventArgs}. * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. */ - addHandlerAsync(eventType: Office.EventType, handler: any, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult) => void): void; + addHandlerAsync(eventType: Office.EventType, handler: any, options?: Office.AsyncContextOptions, callback?: (result: Office.AsyncResult) => void): void; /** * Returns the data contained within the binding. * * @remarks - * Requirement SetsMatrixBindings, TableBindings, TextBindings + *
Requirement SetsMatrixBindings, TableBindings, TextBindings
* * When called from a MatrixBinding or TableBinding, the getDataAsync method will return a subset of the bound values if the optional startRow, startColumn, rowCount, and columnCount parameters are specified (and they specify a contiguous and valid range). * * @param options Provides options for how to get the data in a binding. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. */ getDataAsync(options?: GetBindingDataOptions, callback?: (result: AsyncResult) => void): void; /** * Removes the specified handler from the binding for the specified event type. * * @remarks - * Requirement SetsBindingEvents + *
Requirement SetsBindingEvents
* * @param eventType The event type. For bindings, it can be `Office.EventType.BindingDataChanged` or `Office.EventType.BindingSelectionChanged`. * @param options Provides options to determine which event handler or handlers are removed. @@ -2123,7 +2150,7 @@ declare namespace Office { * * @remarks * - * Requirement SetsMatrixBindings, TableBindings, TextBindings + *
Requirement SetsMatrixBindings, TableBindings, TextBindings
* * The value passed for data contains the data to be written in the binding. The kind of value passed determines what will be written as described in the following table. * @@ -2341,7 +2368,7 @@ declare namespace Office { * Creates a binding against a named object in the document. * * @remarks - * Requirement SetsMatrixBindings, TableBindings, TextBindings + *
Requirement SetsMatrixBindings, TableBindings, TextBindings
* * For Excel, the itemName parameter can refer to a named range or a table. * @@ -2378,7 +2405,7 @@ declare namespace Office { * Create a binding by prompting the user to make a selection on the document. * * @remarks - * Requirement SetsNot in a set + *
Requirement SetsNot in a set
* * Adds a binding object of the specified type to the Bindings collection, which will be identified with the supplied id. The method fails if the specified selection cannot be bound. * @@ -2404,7 +2431,7 @@ declare namespace Office { * Create a binding based on the user's current selection. * * @remarks - * Requirement SetsMatrixBindings, TableBindings, TextBindings + *
Requirement SetsMatrixBindings, TableBindings, TextBindings
* * Adds the specified type of binding object to the Bindings collection, which will be identified with the supplied id. * @@ -2434,7 +2461,7 @@ declare namespace Office { * Gets all bindings that were previously created. * * @remarks - * Requirement SetsMatrixBindings, TableBindings, TextBindings + *
Requirement SetsMatrixBindings, TableBindings, TextBindings
* * **Support details** * @@ -2458,7 +2485,7 @@ declare namespace Office { * Retrieves a binding based on its Name * * @remarks - * Requirement SetsCustomXmlParts, MatrixBindings, TableBindings, TextBindings + *
Requirement SetsCustomXmlParts, MatrixBindings, TableBindings, TextBindings
* * Fails if the specified id does not exist. * @@ -2485,7 +2512,7 @@ declare namespace Office { * Removes the binding from the document * * @remarks - * Requirement SetsMatrixBindings, TableBindings, TextBindings + *
Requirement SetsMatrixBindings, TableBindings, TextBindings
* * Fails if the specified id does not exist. * @@ -2532,28 +2559,28 @@ declare namespace Office { * Gets the base name of the node without the namespace prefix, if one exists. * * @remarks - * Requirement SetsCustomXmlParts + *
Requirement SetsCustomXmlParts
*/ baseName: string; /** * Retrieves the string GUID of the CustomXMLPart. * * @remarks - * Requirement SetsCustomXmlParts + *
Requirement SetsCustomXmlParts
*/ namespaceUri: string; /** * Gets the type of the CustomXMLNode. * * @remarks - * Requirement SetsCustomXmlParts + *
Requirement SetsCustomXmlParts
*/ nodeType: string; /** * Gets the nodes associated with the XPath expression. * * @remarks - * Requirement SetsCustomXmlParts + *
Requirement SetsCustomXmlParts
* * @param xPath The XPath expression that specifies the nodes to get. Required. * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. @@ -2564,7 +2591,7 @@ declare namespace Office { * Gets the node value. * * @remarks - * Requirement SetsCustomXmlParts + *
Requirement SetsCustomXmlParts
* * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. @@ -2574,7 +2601,7 @@ declare namespace Office { * Gets the text of an XML node in a custom XML part. * * @remarks - * Requirement SetsCustomXmlParts + *
Requirement SetsCustomXmlParts
* * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. @@ -2584,7 +2611,7 @@ declare namespace Office { * Gets the node's XML. * * @remarks - * Requirement SetsCustomXmlParts + *
Requirement SetsCustomXmlParts
* * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. @@ -2594,7 +2621,7 @@ declare namespace Office { * Sets the node value. * * @remarks - * Requirement SetsCustomXmlParts + *
Requirement SetsCustomXmlParts
* * @param value The value to be set on the node * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. @@ -2618,7 +2645,7 @@ declare namespace Office { * Sets the node XML. * * @remarks - * Requirement SetsCustomXmlParts + *
Requirement SetsCustomXmlParts
* * @param xml The XML to be set on the node * @param options Provides an option for preserving context data of any type, unchanged, for use in a callback. @@ -2779,6 +2806,7 @@ declare namespace Office { /** * Provides information about the replaced node that raised the nodeReplaced event. * + * @remarks * **Support details** * * A capital Y in the following matrix indicates that this interface is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this interface. From 72fee7be892fe5825ffc9fcb3e2a3423b9be43d3 Mon Sep 17 00:00:00 2001 From: Elizabeth Samuel Date: Tue, 7 Aug 2018 10:21:00 -0700 Subject: [PATCH 50/56] update based on feedback --- types/office-js/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/office-js/index.d.ts b/types/office-js/index.d.ts index 8f187c79ea..36af5da50a 100644 --- a/types/office-js/index.d.ts +++ b/types/office-js/index.d.ts @@ -765,7 +765,7 @@ declare namespace Office { */ roamingSettings: Office.RoamingSettings; /** - * Specifies whether the platform and device allows touch interaction. True if the add-in is running on a touch device, such as an iPad; False otherwise. + * Specifies whether the platform and device allows touch interaction. True if the add-in is running on a touch device, such as an iPad; false otherwise. * * @remarks * Use the touchEnabled property to determine when your add-in is running on a touch device and if necessary, adjust the kind of controls, and size and spacing of elements in your add-in's UI to accommodate touch interactions. From 0ca6d87b78b2170fcfa1499f8f3861758db0d5ca Mon Sep 17 00:00:00 2001 From: Andy Date: Tue, 7 Aug 2018 10:53:43 -0700 Subject: [PATCH 51/56] d3-selection: Fix tests (#27768) --- types/d3-selection/d3-selection-tests.ts | 4 ++-- types/d3-selection/index.d.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/types/d3-selection/d3-selection-tests.ts b/types/d3-selection/d3-selection-tests.ts index 54ddb5ea11..b99c81e39a 100644 --- a/types/d3-selection/d3-selection-tests.ts +++ b/types/d3-selection/d3-selection-tests.ts @@ -796,7 +796,7 @@ newDiv2 = body.append(function(d, i, g) { const index: number = i; const group: HTMLBodyElement[] | d3Selection.ArrayLike = g; console.log('Body element foo property: ', d.foo); // data of type BodyDatum - return this.ownerDocument.createElement('div'); // this-type HTMLBodyElement + return this.ownerDocument!.createElement('div'); // this-type HTMLBodyElement }); // newDiv2 = body.append(function(d) { @@ -828,7 +828,7 @@ const typeValueFunction = function( i: number, g: HTMLBodyElement[] | d3Selection.ArrayLike ) { - return this.ownerDocument.createElement('p'); // this-type HTMLParagraphElement + return this.ownerDocument!.createElement('p'); // this-type HTMLParagraphElement }; const beforeValueFunction = function( diff --git a/types/d3-selection/index.d.ts b/types/d3-selection/index.d.ts index d1e127dfdf..d9988636fd 100644 --- a/types/d3-selection/index.d.ts +++ b/types/d3-selection/index.d.ts @@ -22,7 +22,7 @@ export type BaseType = Element | EnterElement | Document | Window | null; */ export interface ArrayLike { length: number; - item(index: number): T; + item(index: number): T | null; [index: number]: T; } From 73227df0fd0428a0b32e2d41f486b84ed4b851b6 Mon Sep 17 00:00:00 2001 From: Andy Date: Tue, 7 Aug 2018 12:11:07 -0700 Subject: [PATCH 52/56] Jquery: change disables in tslint.json to disables in specific files (#27919) --- types/jquery/test/example-tests.ts | 22 ++++++++++++++++++---- types/jquery/test/learn-tests.ts | 4 ++-- types/jquery/test/longdesc-tests.ts | 15 +++++++++++++-- types/jquery/tslint.json | 17 +---------------- 4 files changed, 34 insertions(+), 24 deletions(-) diff --git a/types/jquery/test/example-tests.ts b/types/jquery/test/example-tests.ts index f725cb2bcb..60fbd431bb 100644 --- a/types/jquery/test/example-tests.ts +++ b/types/jquery/test/example-tests.ts @@ -1,3 +1,17 @@ +// tslint:disable:no-arg +// tslint:disable:no-var-keyword +// tslint:disable:object-literal-key-quotes +// tslint:disable:object-literal-shorthand +// tslint:disable:one-variable-per-declaration +// tslint:disable:only-arrow-functions +// tslint:disable:prefer-conditional-expression +// tslint:disable:prefer-const +// tslint:disable:prefer-for-of +// tslint:disable:prefer-switch +// tslint:disable:prefer-template +// tslint:disable:space-within-parens +// tslint:disable:triple-equals + function examples() { function add_0() { $('div').css('border', '2px solid red') @@ -816,7 +830,7 @@ function examples() { var len = kids.addClass('hilite').length; $('#results span:first').text(len); - $('#results span:last').text(( event.target).tagName); + $('#results span:last').text(event.target.tagName); event.preventDefault(); }); @@ -1600,7 +1614,7 @@ function examples() { function event_target_0() { $('body').click(function(event) { - $('#log').html('clicked: ' + ( event.target).nodeName); + $('#log').html('clicked: ' + event.target.nodeName); }); } @@ -2320,8 +2334,8 @@ function examples() { } function jQuery_contains_0() { - $.contains(document.documentElement, document.body); // true - $.contains(document.body, document.documentElement); // false + $.contains(document.documentElement!, document.body); // true + $.contains(document.body, document.documentElement!); // false } function jQuery_data_0() { diff --git a/types/jquery/test/learn-tests.ts b/types/jquery/test/learn-tests.ts index 17fc7cd285..ef52084da5 100644 --- a/types/jquery/test/learn-tests.ts +++ b/types/jquery/test/learn-tests.ts @@ -11,7 +11,7 @@ interface GreenifyPlugin { } jQuery.fn.greenify = function() { - this.css( "color", "green" ); + this.css("color", "green"); }; -jQuery( "a" ).greenify(); // Makes all the links green. +jQuery("a").greenify(); // Makes all the links green. diff --git a/types/jquery/test/longdesc-tests.ts b/types/jquery/test/longdesc-tests.ts index 3405bb83b5..5275191b5b 100644 --- a/types/jquery/test/longdesc-tests.ts +++ b/types/jquery/test/longdesc-tests.ts @@ -1,3 +1,14 @@ +// tslint:disable:no-var-keyword +// tslint:disable:object-literal-key-quotes +// tslint:disable:object-literal-shorthand +// tslint:disable:one-variable-per-declaration +// tslint:disable:only-arrow-functions +// tslint:disable:prefer-const +// tslint:disable:prefer-for-of +// tslint:disable:prefer-template +// tslint:disable:space-within-parens +// tslint:disable:triple-equals + function longdesc() { function add_0() { $('p').add('div').addClass('widget'); @@ -2358,9 +2369,9 @@ function longdesc() { } function toggle_3(display: boolean) { - if (display === true) { + if (display) { $('#foo').show(); - } else if (display === false) { + } else { $('#foo').hide(); } } diff --git a/types/jquery/tslint.json b/types/jquery/tslint.json index 1d12f59138..93e1f3e072 100644 --- a/types/jquery/tslint.json +++ b/types/jquery/tslint.json @@ -7,21 +7,6 @@ "no-declare-current-package": false, "ban-types": false, - "no-arg": false, - "no-boolean-literal-compare": false, - "no-object-literal-type-assertion": false, - "no-unnecessary-type-assertion": false, - "no-var-keyword": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-for-of": false, - "prefer-switch": false, - "prefer-template": false, - "space-within-parens": false, - "triple-equals": false + "no-object-literal-type-assertion": false } } From ba67bffd31f7073cf1cb5348e2312141803dce55 Mon Sep 17 00:00:00 2001 From: Simon Date: Tue, 7 Aug 2018 01:26:39 +0200 Subject: [PATCH 53/56] feat(catbox-redis): add typings --- types/catbox-redis/catbox-redis-tests.ts | 12 +++++ types/catbox-redis/index.d.ts | 60 ++++++++++++++++++++++++ types/catbox-redis/tsconfig.json | 23 +++++++++ types/catbox-redis/tslint.json | 1 + types/catbox/index.d.ts | 3 ++ 5 files changed, 99 insertions(+) create mode 100644 types/catbox-redis/catbox-redis-tests.ts create mode 100644 types/catbox-redis/index.d.ts create mode 100644 types/catbox-redis/tsconfig.json create mode 100644 types/catbox-redis/tslint.json diff --git a/types/catbox-redis/catbox-redis-tests.ts b/types/catbox-redis/catbox-redis-tests.ts new file mode 100644 index 0000000000..d7fb5eb701 --- /dev/null +++ b/types/catbox-redis/catbox-redis-tests.ts @@ -0,0 +1,12 @@ +import * as CatbotRedis from 'catbox-redis'; + +const cache = new CatbotRedis({ + host: 'localhost', + partition: 'test', + port: 2018, +}); + +cache.get({ + segment: 'test', + id: 'test', +}); diff --git a/types/catbox-redis/index.d.ts b/types/catbox-redis/index.d.ts new file mode 100644 index 0000000000..a0d3590953 --- /dev/null +++ b/types/catbox-redis/index.d.ts @@ -0,0 +1,60 @@ +// Type definitions for catbox-redis 4.1 +// Project: https://github.com/hapijs/catbox-redis#readme +// Definitions by: Simon Schick +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +// tslint:disable-next-line +declare module 'catbox-redis' { + import { Redis } from 'ioredis'; + import { EnginePrototype, ClientOptions, Client } from 'catbox'; + namespace CatboxRedis { + interface CatboxRedisOptions extends ClientOptions { + /** + * Raw client. + */ + client?: Redis; + /** + * the Redis server URL (if url is provided, host, port, and socket are ignored) + */ + url?: string; + /** + * the Redis server hostname. + * Defaults to '127.0.0.1'. + */ + host?: string; + /** + * the Redis server port or unix domain socket path. + * Defaults to 6379. + */ + port?: number; + /** + * the unix socket string to connect to (if socket is provided, host and port are ignored) + */ + socket?: string; + /** + * the Redis authentication password when required. + */ + password?: string; + /** + * the Redis database. + */ + database?: string; + /** + * an array of redis sentinel addresses to connect to. + */ + sentinels?: Array<{ + host: string; + }>; + /** + * the name of the sentinel master. + * (Only needed when sentinels is specified) + */ + sentinelName?: string; + } + } + class CatboxRedis extends Client { + constructor(options: CatboxRedis.CatboxRedisOptions); + } + export = CatboxRedis; + } diff --git a/types/catbox-redis/tsconfig.json b/types/catbox-redis/tsconfig.json new file mode 100644 index 0000000000..2d31a4bc59 --- /dev/null +++ b/types/catbox-redis/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "catbox-redis-tests.ts" + ] +} diff --git a/types/catbox-redis/tslint.json b/types/catbox-redis/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/catbox-redis/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/catbox/index.d.ts b/types/catbox/index.d.ts index 6d51e48696..f6881b1aef 100644 --- a/types/catbox/index.d.ts +++ b/types/catbox/index.d.ts @@ -112,6 +112,9 @@ export interface CachedObject { export type CacheItem = any; export interface ClientOptions { + /** + * this will store items under keys that start with this value. + */ partition: string; } From 0139f258c2873ad00c74c794e2a6396a639c7c7b Mon Sep 17 00:00:00 2001 From: Petrus Olofsson Date: Wed, 8 Aug 2018 07:53:27 +0200 Subject: [PATCH 54/56] Added timeCaption?: string; prop --- types/react-datepicker/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/react-datepicker/index.d.ts b/types/react-datepicker/index.d.ts index 7cee82930b..23e542d322 100644 --- a/types/react-datepicker/index.d.ts +++ b/types/react-datepicker/index.d.ts @@ -86,6 +86,7 @@ export interface ReactDatePickerProps { startDate?: moment.Moment; startOpen?: boolean; tabIndex?: number; + timeCaption?: string; timeFormat?: string; timeIntervals?: number; title?: string; From 5ec01c736b53863f63eca97f962f064bdb2a8752 Mon Sep 17 00:00:00 2001 From: Konstantin Melnikov Date: Wed, 8 Aug 2018 13:04:58 +0300 Subject: [PATCH 55/56] web3: added static utils property to the Web3 class --- types/web3/index.d.ts | 2 ++ types/web3/web3-tests.ts | 1 + 2 files changed, 3 insertions(+) diff --git a/types/web3/index.d.ts b/types/web3/index.d.ts index c93e9c2ebd..9ddbc7a00b 100644 --- a/types/web3/index.d.ts +++ b/types/web3/index.d.ts @@ -14,6 +14,7 @@ // André Vitor de Lima Matos // Levin Keller // Dmitry Radkovskiy +// Konstantin Melnikov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 import BigNumber = require("bn.js"); @@ -34,6 +35,7 @@ declare class Web3 { Shh: new (provider: Provider) => Shh; Bzz: new (provider: Provider) => Bzz; }; + static utils: Utils; constructor(provider?: Provider | string); version: string; BatchRequest: new () => BatchRequest; diff --git a/types/web3/web3-tests.ts b/types/web3/web3-tests.ts index 85e4bc9b0a..fc4be8534a 100644 --- a/types/web3/web3-tests.ts +++ b/types/web3/web3-tests.ts @@ -20,3 +20,4 @@ myContract.options.gas = 5000000; const weiStr: string = web3.utils.toWei("100", "gwei"); const weiBn: BigNumber = web3.utils.toWei(web3.utils.toBN("1")); +const rndHex: string = Web3.utils.randomHex(10); From 69e3a5078970dc7f856ebd019fd91189a1dfe54d Mon Sep 17 00:00:00 2001 From: Jake <> Date: Thu, 9 Aug 2018 00:43:24 +0800 Subject: [PATCH 56/56] [@types/react-navigation] Added missing `NavigationReplaceAction` type variant to `NavigationStackAction` --- types/react-navigation/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/react-navigation/index.d.ts b/types/react-navigation/index.d.ts index 2573315c09..5e3e1f749d 100644 --- a/types/react-navigation/index.d.ts +++ b/types/react-navigation/index.d.ts @@ -19,6 +19,7 @@ // Jérémy Magrin // Luca Campana // Ullrich Schaefer +// Jake // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -441,6 +442,7 @@ export type NavigationStackAction = | NavigationBackAction | NavigationSetParamsAction | NavigationResetAction + | NavigationReplaceAction | NavigationPopAction | NavigationPushAction | NavigationPopToTopAction;