From 0f4e20b7fa690c18ead85bee5280e73c407ecd5b Mon Sep 17 00:00:00 2001 From: AdrianFarmadin Date: Fri, 5 May 2017 17:28:52 +0200 Subject: [PATCH 01/42] Point, Polygon definitions --- types/rethinkdb/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/rethinkdb/index.d.ts b/types/rethinkdb/index.d.ts index f375a50fc7..94130520d1 100644 --- a/types/rethinkdb/index.d.ts +++ b/types/rethinkdb/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for RethinkDB 2.3 // Project: http://rethinkdb.com/ // Definitions by: Alex Gorbatchev +// Definitions by: Adrian Farmadin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // // Reference: https://rethinkdb.com/api/javascript/ From 96b6817d5e442e2c5329af0c5e860d11dc60d6db Mon Sep 17 00:00:00 2001 From: AdrianFarmadin Date: Fri, 5 May 2017 17:30:47 +0200 Subject: [PATCH 02/42] Point, Polygon definitions --- types/rethinkdb/index.d.ts | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/types/rethinkdb/index.d.ts b/types/rethinkdb/index.d.ts index 94130520d1..a4cbd64313 100644 --- a/types/rethinkdb/index.d.ts +++ b/types/rethinkdb/index.d.ts @@ -1,7 +1,7 @@ // Type definitions for RethinkDB 2.3 // Project: http://rethinkdb.com/ // Definitions by: Alex Gorbatchev -// Definitions by: Adrian Farmadin +// Definitions by: Adrian Farmadin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // // Reference: https://rethinkdb.com/api/javascript/ @@ -38,6 +38,9 @@ declare module "rethinkdb" { export function asc(property: string): Sort; export function desc(property: string): Sort; + export function point(lng: number, lat: number): Point; + export function polygon(...point: Point[]): Polygon; + export var count: Aggregator; export function sum(prop: string): Aggregator; export function avg(prop: string): Aggregator; @@ -222,6 +225,18 @@ declare module "rethinkdb" { * See: https://rethinkdb.com/api/javascript/has_fields/ */ hasFields(...fields: string[]): T; + } + + interface Geometry { + + } + + interface Point { + + } + + interface Polygon extends Geometry { + } interface Table extends Sequence, HasFields { @@ -235,6 +250,8 @@ declare module "rethinkdb" { get(key: string): Sequence; // primary key getAll(key: string, index?: Index): Sequence; // without index defaults to primary key getAll(...keys: string[]): Sequence; + + getIntersecting(geometry: Geometry, index: Index): Sequence; } interface Sequence extends Operation, Writeable { From dc86e5222e397c382a99c36219f8fe5679a9ffa7 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Fri, 5 May 2017 09:56:00 -0700 Subject: [PATCH 03/42] fix header --- types/rethinkdb/index.d.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/types/rethinkdb/index.d.ts b/types/rethinkdb/index.d.ts index a4cbd64313..afe672468e 100644 --- a/types/rethinkdb/index.d.ts +++ b/types/rethinkdb/index.d.ts @@ -1,7 +1,6 @@ // Type definitions for RethinkDB 2.3 // Project: http://rethinkdb.com/ -// Definitions by: Alex Gorbatchev -// Definitions by: Adrian Farmadin +// Definitions by: Alex Gorbatchev , Adrian Farmadin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // // Reference: https://rethinkdb.com/api/javascript/ From 0da14f6a5bd20ba88055fbcd162e79c6c13d6848 Mon Sep 17 00:00:00 2001 From: Ariel Saldana Date: Fri, 23 Feb 2018 10:00:58 -0500 Subject: [PATCH 04/42] Support for helper functions --- .github/CODEOWNERS | 2 +- types/showdown/index.d.ts | 15 +++++++++++++-- types/showdown/showdown-tests.ts | 2 ++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index a03915a264..8ce8955c37 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -3379,7 +3379,7 @@ /types/shopify-buy/ @openminder /types/shortid/ @stpettersens @despairblue /types/shot/ @AJamesPhillips -/types/showdown/ @cbowdon @tan9 +/types/showdown/ @cbowdon @tan9 @arielsaldana /types/shrink-ray/ @forabi /types/siema/ @Irmiz @0x6368656174 @samnau /types/siesta/ @bquarmby diff --git a/types/showdown/index.d.ts b/types/showdown/index.d.ts index 3a1accb411..948fd966ec 100644 --- a/types/showdown/index.d.ts +++ b/types/showdown/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Showdown 1.7.2 +// Type definitions for Showdown 1.7.3 // Project: https://github.com/coreyti/showdown -// Definitions by: cbowdon , Pei-Tang Huang +// Definitions by: cbowdon , Pei-Tang Huang , Ariel-Saldana // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export = Showdown; @@ -362,10 +362,21 @@ declare namespace Showdown { */ new (converterOptions?: ConverterOptions): Converter; } + /** + * Helper Interface + */ + interface Helper { + replaceRecursiveRegExp(...args: any[]): string; + } /** Constructor function for a Converter */ var Converter: ConverterStatic; + /** + * Showdown helper + */ + var helper: Helper; + /** * Setting a "global" option affects all instances of showdown */ diff --git a/types/showdown/showdown-tests.ts b/types/showdown/showdown-tests.ts index e0d9093bc1..09a04b920c 100644 --- a/types/showdown/showdown-tests.ts +++ b/types/showdown/showdown-tests.ts @@ -17,6 +17,8 @@ var preloadedExtensions = [ 'my-ext' ], var configuredConverter = new showdown.Converter(); configuredConverter.addExtension({type: 'output', filter: (text, converter)=>{return text.replace('#', '*')}}, 'myext'); +console.log(showdown.helper); + console.log(converter.makeHtml(exampleMarkdown)); // should log '

hello, markdown

' From d2e34706c978ac15569c9d65cd4ea0215e523e1a Mon Sep 17 00:00:00 2001 From: Silas Rech Date: Sun, 25 Feb 2018 19:20:33 +0100 Subject: [PATCH 05/42] Add options for webp and tiff --- types/sharp/index.d.ts | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/types/sharp/index.d.ts b/types/sharp/index.d.ts index 69f4bc970a..432be5346d 100644 --- a/types/sharp/index.d.ts +++ b/types/sharp/index.d.ts @@ -382,14 +382,14 @@ declare namespace sharp { * @throws {Error} Invalid options * @returns A sharp instance that can be used to chain operations */ - webp(options?: OutputOptions): SharpInstance; + webp(options?: WebpOptions): SharpInstance; /** * Use these TIFF options for output image. * @param options Output options. * @throws {Error} Invalid options * @returns A sharp instance that can be used to chain operations */ - tiff(options?: OutputOptions): SharpInstance; + tiff(options?: TiffOptions): SharpInstance; /** * Force output to be raw, uncompressed uint8 pixel data. * @returns A sharp instance that can be used to chain operations @@ -498,6 +498,28 @@ declare namespace sharp { optimizeScans?: boolean; } + interface WebpOptions extends OutputOptions { + /** Quality of alpha layer, number from 0-100 (optional, default 100) */ + alphaQuality?: number; + /** Use lossless compression mode (optional, default false) */ + lossless?: boolean; + /** Use near_lossless compression mode (optional, default false) */ + nearLossless?: boolean; + } + + interface TiffOptions extends OutputOptions { + /** Compression options: lzw, deflate, jpeg (optional, default 'jpeg') */ + compression?: string; + /** Compression predictor options: none, horizontal, float (optional, default 'horizontal') */ + predictor?: string; + /** Horizontal resolution in pixels/mm (optional, default 1.0) */ + xres?: number; + /** Vertical resolution in pixels/mm (optional, default 1.0) */ + yres?: number; + /** Squash 8-bit images down to 1 bit (optional, default false) */ + squash?: boolean; + } + interface PngOptions { /** Use progressive (interlace) scan (optional, default false) */ progressive?: boolean; From 7121790b73fade321587d43bd7041a742c33cc96 Mon Sep 17 00:00:00 2001 From: Benjamin Riggs Date: Sun, 25 Feb 2018 21:20:02 -0600 Subject: [PATCH 06/42] Fixed bugs, added dependency on 'events'. --- types/kurento-utils/index.d.ts | 14 +++++++++----- types/kurento-utils/kurento-utils-tests.ts | 4 ++++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/types/kurento-utils/index.d.ts b/types/kurento-utils/index.d.ts index 8074661881..a8a30005b6 100644 --- a/types/kurento-utils/index.d.ts +++ b/types/kurento-utils/index.d.ts @@ -1,10 +1,13 @@ -// Type definitions for kurento-utils 6.6 +// Type definitions for kurento-utils 6.7 // Project: https://github.com/Kurento/kurento-utils-js // Definitions by: Miloslav Nenadál +// Benjamin Riggs // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 -export class WebRtcPeer { +import { EventEmitter } from 'events'; + +export class WebRtcPeer extends EventEmitter { /** * Using this property the user can get the peerConnection and use it directly. */ @@ -60,7 +63,7 @@ export class WebRtcPeer { */ addIceCandidate: ( iceCandidate: RTCIceCandidate, - callback?: () => void + callback?: (error: string | undefined) => void ) => void; /** * Using this method the user can get peerconnection’s local session descriptor. @@ -73,8 +76,9 @@ export class WebRtcPeer { /** * Creates an offer that is a request to find a remote peer with a specific configuration. */ - generateOffer: (error: string | undefined, sdp: string) => void; - + generateOffer: ( + callback: (error: string | undefined, sdp: string) => void + ) => void; /** * Create a WebRtcPeer as receive only. */ diff --git a/types/kurento-utils/kurento-utils-tests.ts b/types/kurento-utils/kurento-utils-tests.ts index 5866a2e157..380b1b1019 100644 --- a/types/kurento-utils/kurento-utils-tests.ts +++ b/types/kurento-utils/kurento-utils-tests.ts @@ -4,6 +4,10 @@ import * as kurentoUtils from 'kurento-utils'; const peer = kurentoUtils.WebRtcPeer.WebRtcPeerSendrecv({}, error => {}); peer.showLocalVideo(); peer.getLocalStream().getAudioTracks(); + peer.generateOffer((error, sdp) => {}); + peer.on('icecandidate', (candidate: any) => { + peer.addIceCandidate(candidate, error => {}); + }); peer.getRemoteStream().getAudioTracks(); peer.processAnswer('answer', error => {}); peer.processOffer('offer', (error, {}) => {}); From be24886f7a4b628636a6dda8bfdb60fc47937556 Mon Sep 17 00:00:00 2001 From: Oleg Repin Date: Mon, 26 Feb 2018 11:28:31 +0300 Subject: [PATCH 07/42] [bull] add `defaultJobOptions` to `QueueOptions` --- types/bull/index.d.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/types/bull/index.d.ts b/types/bull/index.d.ts index a7a9ea350b..97844cfbbb 100644 --- a/types/bull/index.d.ts +++ b/types/bull/index.d.ts @@ -5,6 +5,7 @@ // Marshall Cottrell // Weeco // Gabriel Terwesten +// Oleg Repin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -51,6 +52,8 @@ declare namespace Bull { settings?: AdvancedSettings; limiter?: RateLimiter; + + defaultJobOptions?: JobOptions; } interface AdvancedSettings { From 0428c407f07b7c5619c790cd96fe2deb88644a95 Mon Sep 17 00:00:00 2001 From: Hasse Feldthaus Date: Mon, 26 Feb 2018 09:40:41 +0100 Subject: [PATCH 08/42] Update index.d.ts Added Window to selector_object_callback type so $(window) is possible --- types/jquery/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/jquery/index.d.ts b/types/jquery/index.d.ts index 90f6ffbd03..8422f3ec5c 100644 --- a/types/jquery/index.d.ts +++ b/types/jquery/index.d.ts @@ -152,7 +152,7 @@ interface JQueryStatic { * @since 1.4 */ (selector_object_callback?: JQuery.Selector | JQuery.htmlString | JQuery.TypeOrArray | JQuery | - JQuery.PlainObject | + JQuery.PlainObject | Window | ((this: Document, $: JQueryStatic) => void)): JQuery; /** * A multi-purpose callbacks list object that provides a powerful way to manage callback lists. From 0535a1af2d8d7bf2de60d284e5a304a33b1dd9fe Mon Sep 17 00:00:00 2001 From: James Hulse Date: Mon, 26 Feb 2018 17:56:13 +0000 Subject: [PATCH 09/42] Add missing word to promise constructor explanation --- types/es6-shim/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/es6-shim/index.d.ts b/types/es6-shim/index.d.ts index 51824fc932..2cf61a9362 100644 --- a/types/es6-shim/index.d.ts +++ b/types/es6-shim/index.d.ts @@ -500,7 +500,7 @@ interface PromiseConstructor { /** * Creates a new Promise. * @param executor A callback used to initialize the promise. This callback is passed two arguments: - * a resolve callback used resolve the promise with a value or the result of another promise, + * a resolve callback used to resolve the promise with a value or the result of another promise, * and a reject callback used to reject the promise with a provided reason or error. */ new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void): Promise; From c79832e00141c34b9a49c09d6368175b58d0bb78 Mon Sep 17 00:00:00 2001 From: Adrian Farmadin Date: Mon, 26 Feb 2018 21:37:36 +0100 Subject: [PATCH 10/42] Point and Polygon functions for RethinkDb Geometry --- types/rethinkdb/index.d.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/types/rethinkdb/index.d.ts b/types/rethinkdb/index.d.ts index d45f359359..038a9d48e6 100644 --- a/types/rethinkdb/index.d.ts +++ b/types/rethinkdb/index.d.ts @@ -40,6 +40,9 @@ declare module "rethinkdb" { export function asc(property: string): Sort; export function desc(property: string): Sort; + export function point(lng: number, lat: number): Point; + export function polygon(...point: Point[]): Polygon; + export var count: Aggregator; export function sum(prop: string): Aggregator; export function avg(prop: string): Aggregator; @@ -233,7 +236,13 @@ declare module "rethinkdb" { * See: https://rethinkdb.com/api/javascript/has_fields/ */ hasFields(...fields: string[]): T; - } + } + + interface Geometry { } + + interface Point { } + + interface Polygon extends Geometry { } interface Table extends Sequence, HasFields { indexCreate(name: string, index?: ExpressionFunction): Operation; From c04400ee4be3aa5b6c272fae0e8693547f049a1f Mon Sep 17 00:00:00 2001 From: Netanel Draiman Date: Tue, 27 Feb 2018 18:05:22 +0200 Subject: [PATCH 11/42] [Dragula] updated moves() function arguments in DragulaOptions Updated moves() function arguments in DragulaOptions to include a sibling argument. --- types/dragula/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/dragula/index.d.ts b/types/dragula/index.d.ts index f91e8b70ac..51998fb583 100644 --- a/types/dragula/index.d.ts +++ b/types/dragula/index.d.ts @@ -13,7 +13,7 @@ declare namespace dragula { interface DragulaOptions { containers?: Element[]; isContainer?: (el?: Element) => boolean; - moves?: (el?: Element, container?: Element, handle?: Element) => boolean; + moves?: (el?: Element, container?: Element, handle?: Element, sibling?: Element) => boolean; accepts?: (el?: Element, target?: Element, source?: Element, sibling?: Element) => boolean; invalid?: (el?: Element, target?: Element) => boolean; direction?: string; From d1d1d18d98245d457c03947bf63079da71e714cd Mon Sep 17 00:00:00 2001 From: Dave Keen Date: Mon, 26 Feb 2018 19:59:43 +0100 Subject: [PATCH 12/42] Added chmod method to rsync types --- types/rsync/index.d.ts | 3 ++- types/rsync/rsync-tests.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/types/rsync/index.d.ts b/types/rsync/index.d.ts index e86d22647a..b67932eb5a 100644 --- a/types/rsync/index.d.ts +++ b/types/rsync/index.d.ts @@ -48,7 +48,7 @@ interface Rsync { stdout: StreamDataHandler, stderr: StreamDataHandler ): child_process.ChildProcess; - + // cwd cwd(cwd: string): string; @@ -63,6 +63,7 @@ interface Rsync { quiet(): Rsync; dirs(): Rsync; links(): Rsync; + chmod(flags: string): Rsync; dry(): Rsync; // accessor methods diff --git a/types/rsync/rsync-tests.ts b/types/rsync/rsync-tests.ts index 41ec4dd9b1..fe9bf39558 100644 --- a/types/rsync/rsync-tests.ts +++ b/types/rsync/rsync-tests.ts @@ -114,6 +114,7 @@ rsync.shell('ssh') .quiet() .dirs() .links() + .chmod("ug=rwX") .dry(); @@ -152,4 +153,4 @@ rsync.include('/a/file') .include('/b/file'); // as Array -rsync.include(['/a/file', '/b/file']); \ No newline at end of file +rsync.include(['/a/file', '/b/file']); From 1b53b01f4084b83fd301c8360486722799532047 Mon Sep 17 00:00:00 2001 From: Nick Schultz Date: Tue, 27 Feb 2018 15:57:47 -0500 Subject: [PATCH 13/42] add returning option to upsert and change return type accordingly --- types/sequelize/index.d.ts | 8 +++++--- types/sequelize/sequelize-tests.ts | 4 +++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/types/sequelize/index.d.ts b/types/sequelize/index.d.ts index 643a9a8167..fc4fc03409 100644 --- a/types/sequelize/index.d.ts +++ b/types/sequelize/index.d.ts @@ -3445,7 +3445,7 @@ declare namespace sequelize { /** * Options for Model.upsert method */ - interface UpsertOptions extends FieldsOptions, LoggingOptions, SearchPathOptions { + interface UpsertOptions extends FieldsOptions, LoggingOptions, SearchPathOptions, ReturningOptions { } /** @@ -3993,8 +3993,10 @@ declare namespace sequelize { * because SQLite always runs INSERT OR IGNORE + UPDATE, in a single query, so there is no way to know * whether the row was inserted or not. */ - upsert(values: TAttributes, options?: UpsertOptions): Promise; - insertOrUpdate(values: TAttributes, options?: UpsertOptions): Promise; + upsert(values: TAttributes, options?: UpsertOptions & { returning: false | undefined }): Promise; + upsert(values: TAttributes, options?: UpsertOptions & { returning: true }): Promise<[boolean, TInstance]>; + insertOrUpdate(values: TAttributes, options?: UpsertOptions & { returning: false | undefined }): Promise; + insertOrUpdate(values: TAttributes, options?: UpsertOptions & { returning: true }): Promise<[boolean, TInstance]>; /** * Create and insert multiple instances in bulk. diff --git a/types/sequelize/sequelize-tests.ts b/types/sequelize/sequelize-tests.ts index eea19959bd..2eabc511f2 100644 --- a/types/sequelize/sequelize-tests.ts +++ b/types/sequelize/sequelize-tests.ts @@ -1036,7 +1036,9 @@ findOrRetVal = User.findOrCreate( { where : { id : undefined }, defaults : { nam findOrRetVal = User.findOrCreate( { where : { email : 'unique.email.@d.com', companyId : Math.floor( Math.random() * 5 ) } } ); findOrRetVal = User.findOrCreate( { where : { objectId : 1 }, defaults : { bool : false } } ); -User.upsert( { id : 42, username : 'doe', foo : s.fn( 'upper', 'mixedCase2' ) } ); +let upsertPromiseNoOptions: Bluebird = User.upsert( { id : 42, username : 'doe', foo : s.fn( 'upper', 'mixedCase2' ) } ); +let upsertPromiseReturning: Bluebird<[boolean, AnyInstance]> = User.upsert( { id : 42, username : 'doe', foo : s.fn( 'upper', 'mixedCase2' ) }, { returning: true } ); +let upsertPromiseNotReturning: Bluebird = User.upsert( { id : 42, username : 'doe', foo : s.fn( 'upper', 'mixedCase2' ) }, { returning: false } ); User.bulkCreate( [{ aNumber : 10 }, { aNumber : 12 }] ).then( ( i ) => i[0].isNewRecord ); User.bulkCreate( [{ username : 'bar' }, { username : 'bar' }, { username : 'bar' }] ); From b996d556729d14f0f106747bdbf57bc84e1a64c9 Mon Sep 17 00:00:00 2001 From: Nick Schultz Date: Tue, 27 Feb 2018 16:08:58 -0500 Subject: [PATCH 14/42] bump version to reflect a change from current npm version --- types/sequelize/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/sequelize/index.d.ts b/types/sequelize/index.d.ts index fc4fc03409..7a9c64db6a 100644 --- a/types/sequelize/index.d.ts +++ b/types/sequelize/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Sequelize 4.27.0 +// Type definitions for Sequelize 4.27.8 // Project: http://sequelizejs.com // Definitions by: samuelneff // Peter Harris From 1de3b5999f753bcccc4b0e1f9aea7e0ebe659d2f Mon Sep 17 00:00:00 2001 From: petitspois Date: Wed, 28 Feb 2018 11:40:02 +0800 Subject: [PATCH 15/42] Modify the contentFormat and initialContent types --- types/braft-editor/braft-editor-tests.tsx | 2 +- types/braft-editor/index.d.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/types/braft-editor/braft-editor-tests.tsx b/types/braft-editor/braft-editor-tests.tsx index 354c4cbb5b..d62356a318 100644 --- a/types/braft-editor/braft-editor-tests.tsx +++ b/types/braft-editor/braft-editor-tests.tsx @@ -12,7 +12,7 @@ class BraftEditorTest extends React.Component { height: 500, initialContent: this.state.content, onChange: this.handleChange, - onHTMLChange: this.handleHTMLChange + onHTMLChange: this.handleHTMLChange, }; return (
diff --git a/types/braft-editor/index.d.ts b/types/braft-editor/index.d.ts index 225d32722d..a989ec736c 100644 --- a/types/braft-editor/index.d.ts +++ b/types/braft-editor/index.d.ts @@ -15,8 +15,8 @@ declare namespace BraftEditor { } interface editorProps { editorState?: any; - contentFormat?: RawDraftContentState; - initialContent?: RawDraftContentState | null; + contentFormat?: 'raw' | 'html'; + initialContent?: string | null; onChange?: (content: RawDraftContentState) => void; onRawChange?: (content: RawDraftContentState) => void; onHTMLChange?: (content: string) => void; From ab744a9b6f88ebc5663d4a26052c9a40bd02b351 Mon Sep 17 00:00:00 2001 From: Jonathan Skeate Date: Tue, 27 Feb 2018 22:40:48 -0500 Subject: [PATCH 16/42] [recompose] Make StateHandler use Partial The state handlers in withStateHandlers do not need to return the full state every time, since recompose will merge the states together. Their own flow-types specify $Shape, which as far as I can tell is analogous to Partial. --- types/recompose/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/recompose/index.d.ts b/types/recompose/index.d.ts index b6a9f21b14..edff2061b5 100644 --- a/types/recompose/index.d.ts +++ b/types/recompose/index.d.ts @@ -133,7 +133,7 @@ declare module 'recompose' { >; // withStateHandlers: https://github.com/acdlite/recompose/blob/master/docs/API.md#withstatehandlers - type StateHandler = (...payload: any[]) => TState | undefined; + type StateHandler = (...payload: any[]) => Partial | undefined; type StateHandlerMap = { [updaterName: string]: StateHandler; }; From 2a39618c9c51cf662fd733fc81901d679b411a64 Mon Sep 17 00:00:00 2001 From: Thomas Bruun Date: Fri, 23 Feb 2018 09:30:48 +0100 Subject: [PATCH 17/42] Stripe: Add status property to IRefund definition As described in the Stripe documentation: https://stripe.com/docs/api/node\#refund_object --- types/stripe/index.d.ts | 7 +++++++ types/stripe/stripe-tests.ts | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/types/stripe/index.d.ts b/types/stripe/index.d.ts index 12f2b4abea..2289e02e55 100644 --- a/types/stripe/index.d.ts +++ b/types/stripe/index.d.ts @@ -7,6 +7,7 @@ // Brannon Jones // Kyle Kamperschroer // Kensuke Hoshikawa +// Thomas Bruun // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -4688,6 +4689,12 @@ declare namespace Stripe { * This is the transaction number that appears on email receipts sent for this refund. */ receipt_number: string; + + /** + * Status of the refund. For credit card refunds, this can be succeeded or failed. + * For other types of refunds, it can be pending, succeeded, failed, or canceled. + */ + status: "pending" | "succeeded" | "failed" | "canceled"; } interface IRefundCreationOptions extends IDataOptionsWithMetadata { diff --git a/types/stripe/stripe-tests.ts b/types/stripe/stripe-tests.ts index b887ae6228..ff909076b2 100644 --- a/types/stripe/stripe-tests.ts +++ b/types/stripe/stripe-tests.ts @@ -66,7 +66,7 @@ stripe.charges.create({ }); charge.refunds.retrieve("re_15jzA4Ee31JkLCeQcxbTbjaL").then(function (refund) { - + var status: "pending" | "succeeded" | "failed" | "canceled" = refund.status; }); charge.refunds.update("re_15jzA4Ee31JkLCeQcxbTbjaL", { metadata: { test: "data" } }).then(function (refund) { From dcb034264e9a90926ca1927f4bb24752947677a6 Mon Sep 17 00:00:00 2001 From: Sean Zhu Date: Wed, 28 Feb 2018 17:52:24 -0800 Subject: [PATCH 18/42] Update "compact" in underscore/index.d.ts See https://github.com/DefinitelyTyped/DefinitelyTyped/blob/81b3b60696aeb6cab25c323219483f7fcf9c30ce/types/lodash/common/array.d.ts#L50 --- types/underscore/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/underscore/index.d.ts b/types/underscore/index.d.ts index 72a2c23c33..8822deca98 100644 --- a/types/underscore/index.d.ts +++ b/types/underscore/index.d.ts @@ -856,7 +856,7 @@ declare module _ { * @param array Array to compact. * @return Copy of `array` without false values. **/ - compact(array: _.List): T[]; + compact(array: _.List | null | undefined): T[] /** * Flattens a nested array (the nesting can be to any depth). If you pass shallow, the array will From 9760b4ae7901e8d934907d90c689871b7014d8c3 Mon Sep 17 00:00:00 2001 From: Adrian Leonhard Date: Thu, 1 Mar 2018 10:49:33 +0100 Subject: [PATCH 19/42] [chroma-js] fix bug with Scale.colors. --- types/chroma-js/chroma-js-tests.ts | 9 +++++++++ types/chroma-js/index.d.ts | 8 ++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/types/chroma-js/chroma-js-tests.ts b/types/chroma-js/chroma-js-tests.ts index 82cfb7274d..fdd1b5946b 100644 --- a/types/chroma-js/chroma-js-tests.ts +++ b/types/chroma-js/chroma-js-tests.ts @@ -1,3 +1,6 @@ +import { Color } from "chroma-js"; +import chroma = require("chroma-js"); + function test_chroma() { chroma('hotpink'); chroma('#ff3399'); @@ -187,3 +190,9 @@ function test_types() { const color: chroma.Color = chroma('orange'); const scale: chroma.Scale = chroma.scale('RdYlBu'); } + +// the following should actually, pass, but TS can't disambiguate between a parameter +// which is passed as undefined/null or not passed at all +// const scaleColors1: Color[] = chroma.scale(['black', 'white']).colors(12); +const scaleColors2: Color[] = chroma.scale(['black', 'white']).colors(12, null); +const scaleColors3: Color[] = chroma.scale(['black', 'white']).colors(12, undefined); diff --git a/types/chroma-js/index.d.ts b/types/chroma-js/index.d.ts index c18484dc1f..797752c8ad 100644 --- a/types/chroma-js/index.d.ts +++ b/types/chroma-js/index.d.ts @@ -303,10 +303,10 @@ declare namespace chroma { * You can call scale.colors(n) to quickly grab `c` equi-distant colors from a color scale. If called with no * arguments, scale.colors returns the original array of colors used to create the scale. */ - colors(c?: number, format?: 'hex' | 'name'): string[]; - colors(c?: number, format?: null | 'alpha' | 'darken' | 'brighten' | 'saturate' | 'desaturate'): Color[]; - colors(c?: number, format?: 'luminance' | 'temperature'): number[]; - colors(c?: number, format?: K): Array; + colors(c: number | undefined, format: undefined | null | 'alpha' | 'darken' | 'brighten' | 'saturate' | 'desaturate'): Color[]; + colors(c: number | undefined, format: 'luminance' | 'temperature'): number[]; + colors(c: number | undefined, format: K): Array; + colors(c: number | undefined, format?: 'hex' | 'name'): string[]; /** * If you want the scale function to return a distinct set of colors instead of a continuous gradient, you can From 07eb4e8a70f1ae23d37d283f0c33bd41c9f433f0 Mon Sep 17 00:00:00 2001 From: James Garbutt <43081j@users.noreply.github.com> Date: Thu, 1 Mar 2018 15:59:23 +0000 Subject: [PATCH 20/42] ace: fix tokeninfo types --- types/ace/index.d.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/types/ace/index.d.ts b/types/ace/index.d.ts index 822c394a32..1f7dd9752b 100644 --- a/types/ace/index.d.ts +++ b/types/ace/index.d.ts @@ -52,6 +52,10 @@ declare namespace AceAjax { export interface TokenInfo { value: string; + + index?: number; + + start?: number; } export interface Position { @@ -575,7 +579,7 @@ declare namespace AceAjax { * @param row The row number to retrieve from * @param column The column number to retrieve from **/ - getTokenAt(row: number, column: number): TokenInfo; + getTokenAt(row: number, column: number): TokenInfo|null; /** * Sets the undo manager. From f23f06b301377fb81e79ef57be624e8a99828171 Mon Sep 17 00:00:00 2001 From: Yuliya Date: Fri, 2 Mar 2018 17:55:56 +0300 Subject: [PATCH 21/42] fix(react-table): fix FilterRender params --- types/react-table/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/react-table/index.d.ts b/types/react-table/index.d.ts index 2ab2d2a821..2915a24857 100644 --- a/types/react-table/index.d.ts +++ b/types/react-table/index.d.ts @@ -5,12 +5,12 @@ // TypeScript Version: 2.6 import * as React from 'react'; -export type ReactTableFunction = () => void; +export type ReactTableFunction = (value?: any) => void; export type AccessorFunction = (row: object) => any; export type Accessor = string | string[] | object | AccessorFunction; export type Aggregator = (values: any, rows: any) => any; export type TableCellRenderer = ((data: any, column: any) => React.ReactNode) | React.ReactNode; -export type FilterRender = (params: { column: Column, filter: any, onFilterChange: ReactTableFunction, key?: string }) => React.ReactElement; +export type FilterRender = (params: { column: Column, filter: any, onChange: ReactTableFunction, key?: string }) => React.ReactElement; export type PivotRenderer = ((cellInfo: any) => React.ReactNode) | (() => any) | string | React.ReactNode; export type ComponentPropsGetter0 = (finalState: any, rowInfo: undefined, column: undefined, instance?: any) => object | undefined; From 407c264b357f9c7f0b857dfbd4cfc9744aec508c Mon Sep 17 00:00:00 2001 From: Nick Zelei Date: Fri, 2 Mar 2018 09:53:16 -0600 Subject: [PATCH 22/42] Updated message properties and fields Updated message properties and fields --- types/amqplib/index.d.ts | 2 +- types/amqplib/properties.d.ts | 49 +++++++++++++++++++++++++++++++++-- 2 files changed, 48 insertions(+), 3 deletions(-) diff --git a/types/amqplib/index.d.ts b/types/amqplib/index.d.ts index 25b0ef04e9..269ed0112e 100644 --- a/types/amqplib/index.d.ts +++ b/types/amqplib/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for amqplib 0.5 // Project: https://github.com/squaremo/amqp.node -// Definitions by: Michael Nahkies , Ab Reitsma , Nicolás Fantone +// Definitions by: Michael Nahkies , Ab Reitsma , Nicolás Fantone , Nick Zelei // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 diff --git a/types/amqplib/properties.d.ts b/types/amqplib/properties.d.ts index af90909d8c..2445a6f401 100644 --- a/types/amqplib/properties.d.ts +++ b/types/amqplib/properties.d.ts @@ -141,6 +141,51 @@ export namespace Options { export interface Message { content: Buffer; - fields: any; - properties: any; + fields: MessageFields; + properties: MessageProperties; +} + +export interface MessageFields { + deliveryTag: number; + redelivered: boolean; + exchange: string; + routingKey: string; + messageCount: string; +} + +export interface MessageProperties { + contentType: any | undefined; + contentEncoding: any | undefined; + headers: MessagePropertyHeaders; + deliveryMode: any | undefined; + priority: any | undefined; + correlationId: any | undefined; + replyTo: any | undefined; + expiration: any | undefined; + messageId: any | undefined; + timestamp: any | undefined; + type: any | undefined; + userId: any | undefined; + appId: any | undefined; + clusterId: any | undefined; +} + +export interface MessagePropertyHeaders { + "x-first-death-exchange"?: string; + "x-first-death-queue"?: string; + "x-first-death-reason"?: string; + "x-death"?: XDeath[]; + [key: string]: any; +} + +export interface XDeath { + count: number; + reason: string; + queue: string; + time: { + "!": "timestamp"; + value: number; + }; + exchange: string; + "routing-keys": string[]; } From 2915a02f3160b26107fdeca419ce5809ac38a3f8 Mon Sep 17 00:00:00 2001 From: Nick Zelei Date: Fri, 2 Mar 2018 10:04:11 -0600 Subject: [PATCH 23/42] tweaked types per documentation --- types/amqplib/properties.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/amqplib/properties.d.ts b/types/amqplib/properties.d.ts index 2445a6f401..9f96b14f5c 100644 --- a/types/amqplib/properties.d.ts +++ b/types/amqplib/properties.d.ts @@ -180,12 +180,13 @@ export interface MessagePropertyHeaders { export interface XDeath { count: number; - reason: string; + reason: "rejected" | "expired" | "maxlen"; queue: string; time: { "!": "timestamp"; value: number; }; exchange: string; + "original-expiration"?: any; "routing-keys": string[]; } From 5e125557340ef360a4114c9e62ec7e04faea766a Mon Sep 17 00:00:00 2001 From: Jamie Bliss Date: Fri, 2 Mar 2018 16:31:12 -0500 Subject: [PATCH 24/42] Add missing label to WrappedFieldProps All of the redux-form examples show `label` being passed to the `component` of a `Field`, and `label` is on `BaseFieldProps` for what's passed to the `Field`. However, `label` is missing from `WrappedFieldProps`, which is what's passed to the thing referenced by `component`. --- types/redux-form/lib/Field.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/redux-form/lib/Field.d.ts b/types/redux-form/lib/Field.d.ts index 7a3c11af3f..a6c2b2e5bb 100644 --- a/types/redux-form/lib/Field.d.ts +++ b/types/redux-form/lib/Field.d.ts @@ -72,6 +72,7 @@ export class Field

extends Comp export interface WrappedFieldProps { input: WrappedFieldInputProps; meta: WrappedFieldMetaProps; + label?: string; } export interface WrappedFieldInputProps extends CommonFieldInputProps { From 61a3511bdeaba47501942d1cf1cc1bbecd00df71 Mon Sep 17 00:00:00 2001 From: Jamie Bliss Date: Fri, 2 Mar 2018 16:55:30 -0500 Subject: [PATCH 25/42] Update tests --- types/redux-form/redux-form-tests.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/types/redux-form/redux-form-tests.tsx b/types/redux-form/redux-form-tests.tsx index 8949fa6ec2..f4317ade87 100644 --- a/types/redux-form/redux-form-tests.tsx +++ b/types/redux-form/redux-form-tests.tsx @@ -109,6 +109,7 @@ interface MyFieldCustomProps { type MyFieldProps = MyFieldCustomProps & WrappedFieldProps; const MyField: React.StatelessComponent = ({ children, + label, input, meta, foo From 465bcc532a1d41cef2d6f31822d5305faeffd033 Mon Sep 17 00:00:00 2001 From: Ragg Date: Sat, 3 Mar 2018 18:42:10 +0900 Subject: [PATCH 26/42] Add type for `react-rnd` --- types/react-rnd/index.d.ts | 105 ++++++++++++++++++++++++++++ types/react-rnd/react-rnd-tests.tsx | 4 ++ types/react-rnd/tsconfig.json | 24 +++++++ types/react-rnd/tslint.json | 1 + 4 files changed, 134 insertions(+) create mode 100644 types/react-rnd/index.d.ts create mode 100644 types/react-rnd/react-rnd-tests.tsx create mode 100644 types/react-rnd/tsconfig.json create mode 100644 types/react-rnd/tslint.json diff --git a/types/react-rnd/index.d.ts b/types/react-rnd/index.d.ts new file mode 100644 index 0000000000..24cef31e45 --- /dev/null +++ b/types/react-rnd/index.d.ts @@ -0,0 +1,105 @@ +// Type definitions for react-rnd 7.3 +// Project: https://github.com/bokuweb/react-rnd +// Definitions by: Ragg +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 +import * as React from 'react'; + +type CSSProperties = React.CSSProperties; + +interface HandleClasses { + bottom?: string; + bottomLeft?: string; + bottomRight?: string; + left?: string; + right?: string; + top?: string; + topLeft?: string; + topRight?: string; +} + +interface HandleStyles { + bottom?: CSSProperties; + bottomLeft?: CSSProperties; + bottomRight?: CSSProperties; + left?: CSSProperties; + right?: CSSProperties; + top?: CSSProperties; + topLeft?: CSSProperties; + topRight?: CSSProperties; +} + +type Direction = + | 'bottom' + | 'bottomLeft' + | 'bottomRight' + | 'left' + | 'right' + | 'top' + | 'topLeft' + | 'topRight'; + +interface Position { + x: number; + y: number; +} + +interface Size { + width: number; + height: number; +} + +interface DraggableData { + node: HTMLElement; + x: number; + y: number; + deltaX: number; + deltaY: number; + lastX: number; + lastY: number; +} + +type DraggableEventHandler = (e: MouseEvent | TouchEvent, data: DraggableData) => void|false; + +type ResizeHandler = ( + e: MouseEvent|TouchEvent, + direction: Direction, + ref: HTMLDivElement, + delta: Size, + position: Position +) => void; + +interface Options { + default: { + x?: number; + y?: number; + width?: number|string; + height?: number|string; + }; + className: string; + style: any; + width: number|string; + height: number|string; + minWidth: number|string; + minHeight: number|string; + maxWidth: number|string; + maxHeight: number|string; + z: number; + resizeHandleClasses: HandleClasses; + resizeHandleStyles: HandleStyles; + + lockAspectRatio: boolean; + enableResizing: boolean; + + onResizeStart: () => void; + onResize: () => void; + onResizeStop: ResizeHandler; + + onDragStart: DraggableEventHandler; + onDrag: DraggableEventHandler; + onDragStop: DraggableEventHandler; +} + +declare class Rnd extends React.Component> {} + +export default Rnd; diff --git a/types/react-rnd/react-rnd-tests.tsx b/types/react-rnd/react-rnd-tests.tsx new file mode 100644 index 0000000000..1586daadbf --- /dev/null +++ b/types/react-rnd/react-rnd-tests.tsx @@ -0,0 +1,4 @@ +import * as React from 'react'; +import Rnd from 'react-rnd'; + +; diff --git a/types/react-rnd/tsconfig.json b/types/react-rnd/tsconfig.json new file mode 100644 index 0000000000..b28250424f --- /dev/null +++ b/types/react-rnd/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react" + }, + "files": [ + "index.d.ts", + "react-rnd-tests.tsx" + ] +} diff --git a/types/react-rnd/tslint.json b/types/react-rnd/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-rnd/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 55e319a33580fc89fbcab067c4368f23e0655100 Mon Sep 17 00:00:00 2001 From: Ragg Date: Sat, 3 Mar 2018 18:56:54 +0900 Subject: [PATCH 27/42] Export handler and options types --- types/react-rnd/index.d.ts | 188 ++++++++++++++-------------- types/react-rnd/react-rnd-tests.tsx | 18 ++- types/react-rnd/tsconfig.json | 1 + 3 files changed, 113 insertions(+), 94 deletions(-) diff --git a/types/react-rnd/index.d.ts b/types/react-rnd/index.d.ts index 24cef31e45..5e053c28c4 100644 --- a/types/react-rnd/index.d.ts +++ b/types/react-rnd/index.d.ts @@ -2,104 +2,106 @@ // Project: https://github.com/bokuweb/react-rnd // Definitions by: Ragg // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; type CSSProperties = React.CSSProperties; -interface HandleClasses { - bottom?: string; - bottomLeft?: string; - bottomRight?: string; - left?: string; - right?: string; - top?: string; - topLeft?: string; - topRight?: string; +declare namespace Rnd { + type Direction = + | 'bottom' + | 'bottomLeft' + | 'bottomRight' + | 'left' + | 'right' + | 'top' + | 'topLeft' + | 'topRight'; + + export interface HandleClasses { + bottom?: string; + bottomLeft?: string; + bottomRight?: string; + left?: string; + right?: string; + top?: string; + topLeft?: string; + topRight?: string; + } + + export interface HandleStyles { + bottom?: CSSProperties; + bottomLeft?: CSSProperties; + bottomRight?: CSSProperties; + left?: CSSProperties; + right?: CSSProperties; + top?: CSSProperties; + topLeft?: CSSProperties; + topRight?: CSSProperties; + } + + export interface Position { + x: number; + y: number; + } + + export interface Size { + width: number; + height: number; + } + + export interface DraggableData { + node: HTMLElement; + x: number; + y: number; + deltaX: number; + deltaY: number; + lastX: number; + lastY: number; + } + + export type DraggableEventHandler = (e: MouseEvent | TouchEvent, data: DraggableData) => void|false; + + export type ResizeHandler = ( + e: MouseEvent|TouchEvent, + direction: Direction, + ref: HTMLDivElement, + delta: Size, + position: Position + ) => void; + + export interface Options { + default: { + x?: number; + y?: number; + width?: number|string; + height?: number|string; + }; + className: string; + style: any; + width: number|string; + height: number|string; + minWidth: number|string; + minHeight: number|string; + maxWidth: number|string; + maxHeight: number|string; + z: number; + resizeHandleClasses: HandleClasses; + resizeHandleStyles: HandleStyles; + + lockAspectRatio: boolean; + enableResizing: boolean; + + onResizeStart: () => void; + onResize: () => void; + onResizeStop: ResizeHandler; + + onDragStart: DraggableEventHandler; + onDrag: DraggableEventHandler; + onDragStop: DraggableEventHandler; + } } -interface HandleStyles { - bottom?: CSSProperties; - bottomLeft?: CSSProperties; - bottomRight?: CSSProperties; - left?: CSSProperties; - right?: CSSProperties; - top?: CSSProperties; - topLeft?: CSSProperties; - topRight?: CSSProperties; -} - -type Direction = - | 'bottom' - | 'bottomLeft' - | 'bottomRight' - | 'left' - | 'right' - | 'top' - | 'topLeft' - | 'topRight'; - -interface Position { - x: number; - y: number; -} - -interface Size { - width: number; - height: number; -} - -interface DraggableData { - node: HTMLElement; - x: number; - y: number; - deltaX: number; - deltaY: number; - lastX: number; - lastY: number; -} - -type DraggableEventHandler = (e: MouseEvent | TouchEvent, data: DraggableData) => void|false; - -type ResizeHandler = ( - e: MouseEvent|TouchEvent, - direction: Direction, - ref: HTMLDivElement, - delta: Size, - position: Position -) => void; - -interface Options { - default: { - x?: number; - y?: number; - width?: number|string; - height?: number|string; - }; - className: string; - style: any; - width: number|string; - height: number|string; - minWidth: number|string; - minHeight: number|string; - maxWidth: number|string; - maxHeight: number|string; - z: number; - resizeHandleClasses: HandleClasses; - resizeHandleStyles: HandleStyles; - - lockAspectRatio: boolean; - enableResizing: boolean; - - onResizeStart: () => void; - onResize: () => void; - onResizeStop: ResizeHandler; - - onDragStart: DraggableEventHandler; - onDrag: DraggableEventHandler; - onDragStop: DraggableEventHandler; -} - -declare class Rnd extends React.Component> {} +declare class Rnd extends React.Component> {} export default Rnd; diff --git a/types/react-rnd/react-rnd-tests.tsx b/types/react-rnd/react-rnd-tests.tsx index 1586daadbf..1e29d0c5d7 100644 --- a/types/react-rnd/react-rnd-tests.tsx +++ b/types/react-rnd/react-rnd-tests.tsx @@ -1,4 +1,20 @@ import * as React from 'react'; import Rnd from 'react-rnd'; -; +const onResize: Rnd.ResizeHandler = (e, direction, ref, delta, position) => { + direction === 'right'; + delta.width; + delta.height; + position.x; + position.y; +}; + +; diff --git a/types/react-rnd/tsconfig.json b/types/react-rnd/tsconfig.json index b28250424f..61a1ff7b55 100644 --- a/types/react-rnd/tsconfig.json +++ b/types/react-rnd/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { "module": "commonjs", "lib": [ + "dom", "es6" ], "noImplicitAny": true, From a6dc77b61c9a15f17e778b6a3beab865464f0a9a Mon Sep 17 00:00:00 2001 From: Ragg Date: Sat, 3 Mar 2018 19:02:08 +0900 Subject: [PATCH 28/42] Fix exporting --- types/react-rnd/index.d.ts | 2 +- types/react-rnd/react-rnd-tests.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/types/react-rnd/index.d.ts b/types/react-rnd/index.d.ts index 5e053c28c4..2c34ff7e74 100644 --- a/types/react-rnd/index.d.ts +++ b/types/react-rnd/index.d.ts @@ -104,4 +104,4 @@ declare namespace Rnd { declare class Rnd extends React.Component> {} -export default Rnd; +export = Rnd; diff --git a/types/react-rnd/react-rnd-tests.tsx b/types/react-rnd/react-rnd-tests.tsx index 1e29d0c5d7..46f964603b 100644 --- a/types/react-rnd/react-rnd-tests.tsx +++ b/types/react-rnd/react-rnd-tests.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import Rnd from 'react-rnd'; +import * as Rnd from 'react-rnd'; const onResize: Rnd.ResizeHandler = (e, direction, ref, delta, position) => { direction === 'right'; From 33cb41e573e260ccacaf4523c98be6b80cabf6b5 Mon Sep 17 00:00:00 2001 From: Ragg Date: Sun, 4 Mar 2018 00:17:35 +0900 Subject: [PATCH 29/42] Lint fixes --- types/react-rnd/index.d.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/types/react-rnd/index.d.ts b/types/react-rnd/index.d.ts index 2c34ff7e74..e358ceb3d1 100644 --- a/types/react-rnd/index.d.ts +++ b/types/react-rnd/index.d.ts @@ -18,7 +18,7 @@ declare namespace Rnd { | 'topLeft' | 'topRight'; - export interface HandleClasses { + interface HandleClasses { bottom?: string; bottomLeft?: string; bottomRight?: string; @@ -29,7 +29,7 @@ declare namespace Rnd { topRight?: string; } - export interface HandleStyles { + interface HandleStyles { bottom?: CSSProperties; bottomLeft?: CSSProperties; bottomRight?: CSSProperties; @@ -40,17 +40,17 @@ declare namespace Rnd { topRight?: CSSProperties; } - export interface Position { + interface Position { x: number; y: number; } - export interface Size { + interface Size { width: number; height: number; } - export interface DraggableData { + interface DraggableData { node: HTMLElement; x: number; y: number; @@ -60,9 +60,9 @@ declare namespace Rnd { lastY: number; } - export type DraggableEventHandler = (e: MouseEvent | TouchEvent, data: DraggableData) => void|false; + type DraggableEventHandler = (e: MouseEvent | TouchEvent, data: DraggableData) => void|false; - export type ResizeHandler = ( + type ResizeHandler = ( e: MouseEvent|TouchEvent, direction: Direction, ref: HTMLDivElement, @@ -70,7 +70,7 @@ declare namespace Rnd { position: Position ) => void; - export interface Options { + interface Options { default: { x?: number; y?: number; From 1465d62d6e1eb5eecde9aae43820b51a03c03b42 Mon Sep 17 00:00:00 2001 From: Matt Steele Date: Sat, 3 Mar 2018 11:37:51 -0600 Subject: [PATCH 30/42] Update pin.read callback See http://johnny-five.io/api/pin/ --- types/johnny-five/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/johnny-five/index.d.ts b/types/johnny-five/index.d.ts index b8c108f63b..0bd9f75a31 100644 --- a/types/johnny-five/index.d.ts +++ b/types/johnny-five/index.d.ts @@ -602,7 +602,7 @@ export declare class Pin { high(): void; low(): void; write(value: number): void; - read(cb: (value: number) => void): void; + read(cb: (error: Error, value: number) => void): void; on(event: string, cb: () => void): this; on(event: "high", cb: () => void): this; on(event: "low", cb: () => void): this; From b26647b7ca4a76cef39acfb757b20dda233d8b5e Mon Sep 17 00:00:00 2001 From: Matt Steele Date: Sat, 3 Mar 2018 11:49:02 -0600 Subject: [PATCH 31/42] Update Ping.read() callback --- types/johnny-five/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/johnny-five/index.d.ts b/types/johnny-five/index.d.ts index 0bd9f75a31..297069f0f1 100644 --- a/types/johnny-five/index.d.ts +++ b/types/johnny-five/index.d.ts @@ -597,7 +597,7 @@ export declare class Pin { mode: number; static write(pin: number, value: number): void; - static read(pin: number, cb: (data: number) => void): void; + static read(pin: number, cb: (error: Error, data: number) => void): void; query(cb: (pin: PinState) => void): void; high(): void; low(): void; From f6761be6ba8f430303f2121748433dbd4a770553 Mon Sep 17 00:00:00 2001 From: paolostyle Date: Sat, 3 Mar 2018 20:03:07 +0100 Subject: [PATCH 32/42] added type property to WorkbookSheetRow --- types/kendo-ui/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/kendo-ui/index.d.ts b/types/kendo-ui/index.d.ts index 6ea7fea725..b854d92b29 100644 --- a/types/kendo-ui/index.d.ts +++ b/types/kendo-ui/index.d.ts @@ -18894,6 +18894,7 @@ declare namespace kendo.ooxml { cells?: WorkbookSheetRowCell[]; index?: number; height?: number; + type?: "header" | "footer" | "groupHeader" | "groupFooter" | "data"; } interface WorkbookSheet { From 7966bd48afd471ab2aba19d5c2d33fc287e826fe Mon Sep 17 00:00:00 2001 From: Luke Sanwick Date: Tue, 6 Mar 2018 14:33:39 -0800 Subject: [PATCH 33/42] [react-select] [bugfix] Properly provide types for optionComponent attribute. --- types/react-select/index.d.ts | 63 ++++++++++++++++++++++- types/react-select/react-select-tests.tsx | 10 ++++ 2 files changed, 72 insertions(+), 1 deletion(-) diff --git a/types/react-select/index.d.ts b/types/react-select/index.d.ts index 084f878618..d256bb437e 100644 --- a/types/react-select/index.d.ts +++ b/types/react-select/index.d.ts @@ -130,6 +130,67 @@ export interface MenuRendererProps { valueArray: Options; } +export interface OptionComponentProps { + /** + * Classname(s) to apply to the option component. + */ + className?: string; + + /** + * Currently focused option. + */ + focusOption?: Option; + + inputValue?: string; + instancePrefix?: string; + + /** + * True if this option is disabled. + */ + isDisabled?: boolean; + + /** + * True if this option is focused. + */ + isFocused?: boolean; + + /** + * True if this option is selected. + */ + isSelected?: boolean; + + /** + * Callback to be invoked when this option is focused. + */ + onFocus?: (option: Option, event: any) => void; + + /** + * Callback to be invoked when this option is selected. + */ + onSelect?: (option: Option, event: any) => void; + + /** + * Option to be rendered by this component. + */ + option: Option; + + /** + * Index of the option being rendered in the list + */ + optionIndex?: number; + + /** + * Callback to invoke when removing an option from a multi-selection. (Not necessarily the one + * being rendered) + */ + removeValue?: (value: TValue | TValue[]) => void; + + /** + * Callback to invoke to select an option. (Not necessarily the one being rendered) + */ + selectValue?: (value: TValue | TValue[]) => void; +} + export interface ArrowRendererProps { /** * Arrow mouse down event handler. @@ -388,7 +449,7 @@ export interface ReactSelectProps extends React.Props; + optionComponent?: React.ComponentType>; /** * function which returns a custom way to render the options in the menu */ diff --git a/types/react-select/react-select-tests.tsx b/types/react-select/react-select-tests.tsx index b048343555..3635fe3145 100644 --- a/types/react-select/react-select-tests.tsx +++ b/types/react-select/react-select-tests.tsx @@ -339,6 +339,16 @@ describe("Examples", () => { />; }); + it("Custom option component", () => { + class OptionComponent extends React.Component { + render() { + return

{this.props.option.label}
; + } + } + + ; + }); + it("Value render with custom value option", () => { const valueRenderer = (option: ReactSelectModule.Option): ReactSelectModule.HandlerRendererResult => null; From 0c038b19a814ef079b86bdc502ebcfd17a74d759 Mon Sep 17 00:00:00 2001 From: Ragg Date: Wed, 7 Mar 2018 22:03:59 +0900 Subject: [PATCH 34/42] Fix import statements --- types/react-rnd/index.d.ts | 2 +- types/react-rnd/react-rnd-tests.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/types/react-rnd/index.d.ts b/types/react-rnd/index.d.ts index e358ceb3d1..9164b409ce 100644 --- a/types/react-rnd/index.d.ts +++ b/types/react-rnd/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Ragg // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 -import * as React from 'react'; +import React = require('react'); type CSSProperties = React.CSSProperties; diff --git a/types/react-rnd/react-rnd-tests.tsx b/types/react-rnd/react-rnd-tests.tsx index 46f964603b..ee434117fe 100644 --- a/types/react-rnd/react-rnd-tests.tsx +++ b/types/react-rnd/react-rnd-tests.tsx @@ -1,5 +1,5 @@ -import * as React from 'react'; -import * as Rnd from 'react-rnd'; +import React = require('react'); +import Rnd = require('react-rnd'); const onResize: Rnd.ResizeHandler = (e, direction, ref, delta, position) => { direction === 'right'; From 4387312b094f0ce2c5e7456b68909e713399705d Mon Sep 17 00:00:00 2001 From: Olivier Sechet Date: Wed, 7 Mar 2018 23:42:04 +0100 Subject: [PATCH 35/42] Issue #24115 - Fix DragAndDropOptions' formatConstructors --- types/openlayers/index.d.ts | 2 +- types/openlayers/openlayers-tests.ts | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/types/openlayers/index.d.ts b/types/openlayers/index.d.ts index 333ee0f621..0fdb353fd7 100644 --- a/types/openlayers/index.d.ts +++ b/types/openlayers/index.d.ts @@ -12962,7 +12962,7 @@ declare module olx { * source: (ol.source.Vector|undefined)}} */ interface DragAndDropOptions { - formatConstructors?: Array<((n: ol.format.Feature) => any)>; + formatConstructors?: Array; projection: ol.ProjectionLike; target?: Element; source?: ol.source.Vector; diff --git a/types/openlayers/openlayers-tests.ts b/types/openlayers/openlayers-tests.ts index ce13ae8385..77985150d1 100644 --- a/types/openlayers/openlayers-tests.ts +++ b/types/openlayers/openlayers-tests.ts @@ -896,6 +896,16 @@ let modifySource: ol.interaction.Modify = new ol.interaction.Modify({ }), }); +const dragAndDrop: ol.interaction.DragAndDrop = new ol.interaction.DragAndDrop({ + formatConstructors: [ol.format.KML], + projection: projectionLike, + source: vectorSource, +}); + +const dragAndDropWithUndefined: ol.interaction.DragAndDrop = new ol.interaction.DragAndDrop({ + projection: projectionLike, +}); + let draw: ol.interaction.Draw = new ol.interaction.Draw({ type: "Point", clickTolerance: numberValue, From 0f99dbb97dfd8ce606a81e143d6242c7e0f3251a Mon Sep 17 00:00:00 2001 From: Max Date: Thu, 8 Mar 2018 13:25:48 +0100 Subject: [PATCH 36/42] [steam-totp] Add types --- types/steam-totp/index.d.ts | 68 ++++++++++++++++++++++++++++ types/steam-totp/steam-totp-tests.ts | 3 ++ types/steam-totp/tsconfig.json | 23 ++++++++++ types/steam-totp/tslint.json | 1 + 4 files changed, 95 insertions(+) create mode 100644 types/steam-totp/index.d.ts create mode 100644 types/steam-totp/steam-totp-tests.ts create mode 100644 types/steam-totp/tsconfig.json create mode 100644 types/steam-totp/tslint.json diff --git a/types/steam-totp/index.d.ts b/types/steam-totp/index.d.ts new file mode 100644 index 0000000000..e405ef7ea1 --- /dev/null +++ b/types/steam-totp/index.d.ts @@ -0,0 +1,68 @@ +// Type definitions for steam-totp 2.0 +// Project: https://github.com/DoctorMcKay/node-steam-totp +// Definitions by: Max Uetrecht +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +export type TimeOffsetFunction = () => number; + +/** + * Returns the current local Unix time + * @param [timeOffset=0] - This many seconds will be added to the returned time + * @returns the current local Unix time + */ +export function time(timeOffset?: number): number; + +/** + * Generate a Steam-style TOTP authentication code. + * @param secret - Your TOTP shared_secret as a Buffer, hex, or base64 + * @param [timeOffset=0] - If you know how far off your clock is from the Steam servers, put the offset here in seconds + * @returns the generated auth code + */ +export function generateAuthCode(secret: string, timeOffset: number | TimeOffsetFunction): string; + +/** + * Generate a Steam-style TOTP authentication code. + * @param secret - Your TOTP shared_secret as a Buffer, hex, or base64 + * @param [timeOffset=0] - If you know how far off your clock is from the Steam servers, put the offset here in seconds + * @returns the generated auth code + */ +export function getAuthCode(secret: string, timeOffset: number | TimeOffsetFunction): string; + +/** + * Generate a base64 confirmation key for use with mobile trade confirmations. The key can only be used once. + * @param identitySecret - The identity_secret that you received when enabling two-factor authentication + * @param time - The Unix time for which you are generating this secret. Generally should be the current time. + * @param tag - The tag which identifies what this request (and therefore key) will be for. + * "conf" to load the confirmations page, "details" to load details about a trade, "allow" to confirm a trade, "cancel" to cancel it. + * @returns the generated confirmation key + */ +export function generateConfirmationKey(identitySecret: Buffer | string, time: number, tag: string): string; + +/** + * Generate a base64 confirmation key for use with mobile trade confirmations. The key can only be used once. + * @param identitySecret - The identity_secret that you received when enabling two-factor authentication + * @param time - The Unix time for which you are generating this secret. Generally should be the current time. + * @param tag - The tag which identifies what this request (and therefore key) will be for. + * "conf" to load the confirmations page, "details" to load details about a trade, "allow" to confirm a trade, "cancel" to cancel it. + * @returns the generated confirmation key + */ +export function getConfirmationKey(identitySecret: Buffer | string, time: number, tag: string): string; + +export type Callback = (error: Error, offset?: number, elapsedTime?: number) => void; + +/** + * Requests the time offset from the Steam API. + * @param callback - The result of the steam api request + * @param [timeOffset=0] - If you know how far off your clock is from the Steam servers, put the offset here in seconds + * @returns the time offset + */ +export function getTimeOffset(callback: Callback): void; + +/** + * Get a standardized device ID based on your SteamID. + * @param steamID - Your SteamID, either as a string or as an object which has a toString() method that returns the SteamID + * @returns the device ID + */ +export function getDeviceID(steamID: string | object): string; diff --git a/types/steam-totp/steam-totp-tests.ts b/types/steam-totp/steam-totp-tests.ts new file mode 100644 index 0000000000..57702ccaaa --- /dev/null +++ b/types/steam-totp/steam-totp-tests.ts @@ -0,0 +1,3 @@ +import steamTotp = require('steam-totp'); + +const time: number = steamTotp.time(); diff --git a/types/steam-totp/tsconfig.json b/types/steam-totp/tsconfig.json new file mode 100644 index 0000000000..01223cacba --- /dev/null +++ b/types/steam-totp/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", + "steam-totp-tests.ts" + ] +} diff --git a/types/steam-totp/tslint.json b/types/steam-totp/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/steam-totp/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From b4f8c54fa3f99d8808d60cf24bfa79cb4bf4c940 Mon Sep 17 00:00:00 2001 From: Silas Rech Date: Thu, 8 Mar 2018 16:28:17 +0100 Subject: [PATCH 37/42] Fix CI --- types/steam-totp/index.d.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/types/steam-totp/index.d.ts b/types/steam-totp/index.d.ts index e405ef7ea1..a3ff963428 100644 --- a/types/steam-totp/index.d.ts +++ b/types/steam-totp/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/DoctorMcKay/node-steam-totp // Definitions by: Max Uetrecht // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /// @@ -50,15 +51,13 @@ export function generateConfirmationKey(identitySecret: Buffer | string, time: n */ export function getConfirmationKey(identitySecret: Buffer | string, time: number, tag: string): string; -export type Callback = (error: Error, offset?: number, elapsedTime?: number) => void; - /** * Requests the time offset from the Steam API. * @param callback - The result of the steam api request * @param [timeOffset=0] - If you know how far off your clock is from the Steam servers, put the offset here in seconds * @returns the time offset */ -export function getTimeOffset(callback: Callback): void; +export function getTimeOffset(callback: (error: Error, offset?: number, elapsedTime?: number) => void): void; /** * Get a standardized device ID based on your SteamID. From 0d61fbd75ba3dfb186d9a0c4cbf988175312ce51 Mon Sep 17 00:00:00 2001 From: nayni Date: Thu, 8 Mar 2018 18:12:23 +0100 Subject: [PATCH 38/42] graphql-resolve-batch: Batch function should return an array or a promise with an array - This solves: issue #24153 --- .../graphql-resolve-batch-tests.ts | 51 ++++++++----------- types/graphql-resolve-batch/index.d.ts | 4 +- 2 files changed, 22 insertions(+), 33 deletions(-) diff --git a/types/graphql-resolve-batch/graphql-resolve-batch-tests.ts b/types/graphql-resolve-batch/graphql-resolve-batch-tests.ts index 1e9a2395a4..519a3a4088 100644 --- a/types/graphql-resolve-batch/graphql-resolve-batch-tests.ts +++ b/types/graphql-resolve-batch/graphql-resolve-batch-tests.ts @@ -16,6 +16,17 @@ interface SomeTestResult { someTestResultProp: string; } +const asyncBatchFunction = async (sources: ReadonlyArray) => { + return new Promise(resolve => { + const res = [ + { + someTestResultProp: "" + } + ]; + resolve(res); + }); +}; + const withSourceAndResultTyped = createBatchResolver< SomeTestSource, SomeTestResult @@ -32,40 +43,25 @@ const withSourceAndResultTyped = createBatchResolver< const withSourceAndResultTypedAsPromise = createBatchResolver< SomeTestSource, SomeTestResult ->((sources, _, __) => { +>(async (sources, _, __) => { // $ExpectType ReadonlyArray const verifySources = sources; - - return sources.map(source => { - return new Promise(resolve => { - const res: SomeTestResult = { - someTestResultProp: "" - }; - - resolve(res); - }); - }); + const result = await asyncBatchFunction(sources); + return result; }); const withSourceAndArgsAndResultTyped = createBatchResolver< SomeTestSource, SomeTestResult, SomeTestArgs ->((sources, args, _) => { +>(async (sources, args, _) => { // $ExpectType ReadonlyArray const verifySources = sources; // $ExpectType string const verifyArgs = args.someArg; - return sources.map(source => { - return new Promise(resolve => { - const res: SomeTestResult = { - someTestResultProp: "" - }; - - resolve(res); - }); - }); + const result = await asyncBatchFunction(sources); + return result; }); const withSourceAndArgsAndContextTyped = createBatchResolver< @@ -73,7 +69,7 @@ const withSourceAndArgsAndContextTyped = createBatchResolver< SomeTestResult, SomeTestArgs, SomeTestContext ->((sources, args, context) => { +>(async (sources, args, context) => { // $ExpectType ReadonlyArray const verifySources = sources; // $ExpectType string @@ -81,13 +77,6 @@ const withSourceAndArgsAndContextTyped = createBatchResolver< // $ExpectType string const verifyContext = context.someContextProp; - return sources.map(source => { - return new Promise(resolve => { - const res: SomeTestResult = { - someTestResultProp: "" - }; - - resolve(res); - }); - }); + const result = await asyncBatchFunction(sources); + return result; }); diff --git a/types/graphql-resolve-batch/index.d.ts b/types/graphql-resolve-batch/index.d.ts index 46f354f7b7..ef188e536a 100644 --- a/types/graphql-resolve-batch/index.d.ts +++ b/types/graphql-resolve-batch/index.d.ts @@ -17,10 +17,10 @@ export type ResolverFunction = ( source: TSource, args: TArgs, context: TContext -) => Promise; +) => Promise; export type BatchResolveFunction = ( sources: ReadonlyArray, args: TArgs, context: TContext -) => TReturn[] | Array>; +) => TReturn[] | Promise; From 4b05fa0d9ddbdcf32f412f3e932f06967f7194e6 Mon Sep 17 00:00:00 2001 From: nayni Date: Thu, 8 Mar 2018 18:17:09 +0100 Subject: [PATCH 39/42] graphql-resolve-batch: bump version --- types/graphql-resolve-batch/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/graphql-resolve-batch/index.d.ts b/types/graphql-resolve-batch/index.d.ts index ef188e536a..ec0c0249e7 100644 --- a/types/graphql-resolve-batch/index.d.ts +++ b/types/graphql-resolve-batch/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for graphql-resolve-batch 1.0 +// Type definitions for graphql-resolve-batch 1.1 // Project: https://github.com/calebmer/graphql-resolve-batch#readme // Definitions by: Rutger Hendrickx // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From d8c5833d338c60058981bc80ddc0796b63dd8064 Mon Sep 17 00:00:00 2001 From: nayni Date: Thu, 8 Mar 2018 18:45:02 +0100 Subject: [PATCH 40/42] graphql-resolve-batch: resulting resolver can also return a single value --- types/graphql-resolve-batch/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/graphql-resolve-batch/index.d.ts b/types/graphql-resolve-batch/index.d.ts index ec0c0249e7..e78ddafb37 100644 --- a/types/graphql-resolve-batch/index.d.ts +++ b/types/graphql-resolve-batch/index.d.ts @@ -17,7 +17,7 @@ export type ResolverFunction = ( source: TSource, args: TArgs, context: TContext -) => Promise; +) => Promise | Promise; export type BatchResolveFunction = ( sources: ReadonlyArray, From 61c84aeeeec89a6bc5460a0dd3b55c79e38699b1 Mon Sep 17 00:00:00 2001 From: Olivier Sechet Date: Thu, 8 Mar 2018 19:56:34 +0100 Subject: [PATCH 41/42] Fix no-any-union lint --- types/openlayers/index.d.ts | 2 +- types/openlayers/openlayers-tests.ts | 82 +++++++++++++++++++++++----- types/openlayers/tslint.json | 4 +- 3 files changed, 69 insertions(+), 19 deletions(-) diff --git a/types/openlayers/index.d.ts b/types/openlayers/index.d.ts index 333ee0f621..c75b3e2ef2 100644 --- a/types/openlayers/index.d.ts +++ b/types/openlayers/index.d.ts @@ -14100,7 +14100,7 @@ declare module olx { anchorYUnits?: ol.style.IconAnchorUnits; color?: (ol.Color | string); crossOrigin?: (string); - img?: (any | HTMLCanvasElement); + img?: (HTMLImageElement | HTMLCanvasElement); offset?: number[]; offsetOrigin?: ol.style.IconOrigin; opacity?: number; diff --git a/types/openlayers/openlayers-tests.ts b/types/openlayers/openlayers-tests.ts index ce13ae8385..457ab61de4 100644 --- a/types/openlayers/openlayers-tests.ts +++ b/types/openlayers/openlayers-tests.ts @@ -1,22 +1,25 @@ // Basic type variables for test functions let anyValue: any; -let numberValue: number; let booleanValue: boolean; -let stringValue: string; -let stringArray: string[]; -let jsonValue: JSON; +let canvas: HTMLCanvasElement; let domEventTarget: EventTarget; let fn: Function; +let image: HTMLImageElement; +let jsonValue: JSON; +let numberArray: number[]; +let numberValue: number; let object: Object; +let stringArray: string[]; +let stringValue: string; // Callback predefinitions for OpenLayers +let coordinateFormatType: ol.CoordinateFormatType; +let drawGeometryFunction: ol.DrawGeometryFunctionType; +let easingFunction: (t: number) => number; +let featureLoader: ol.FeatureLoader; +let featureStyleFunction: ol.FeatureStyleFunction; let preRenderFunction: ol.PreRenderFunction; let transformFunction: ol.TransformFunction; -let coordinateFormatType: ol.CoordinateFormatType; -let featureStyleFunction: ol.FeatureStyleFunction; -let featureLoader: ol.FeatureLoader; -let easingFunction: (t: number) => number; -let drawGeometryFunction: ol.DrawGeometryFunctionType; drawGeometryFunction([0, 0], new ol.geom.Point([0, 0])); drawGeometryFunction([0, 0]); @@ -24,27 +27,29 @@ drawGeometryFunction([0, 0]); let attribution: ol.Attribution; let boundingCoordinates: ol.Coordinate[]; let circle: ol.geom.Circle; +let clusterSource: ol.source.Cluster; let color: ol.Color; let coordinate: ol.Coordinate; let coordinatesArray: ol.Coordinate[]; let coordinatesArrayDim2: ol.Coordinate[][]; -let extent: ol.Extent; -let olEvent: ol.events.Event; let eventKey: ol.EventsKey; let eventKeyArray: ol.EventsKey[]; let eventKeyMixed: ol.EventsKey | ol.EventsKey[]; let eventTarget: ol.events.EventTarget; +let extent: ol.Extent; let feature: ol.Feature; let featureArray: ol.Feature[]; let featureCollection: ol.Collection; let featureFormat: ol.format.Feature; let featureUrlFunction: ol.FeatureUrlFunction; -let graticule: ol.Graticule; let geometriesArray: ol.geom.Geometry[]; let geometry: ol.geom.Geometry; let geometryCollection: ol.geom.GeometryCollection; let geometryLayout: ol.geom.GeometryLayout; let geometryType: ol.geom.GeometryType; +let graticule: ol.Graticule; +let iconAnchorUnits: ol.style.IconAnchorUnits; +let iconOrigin: ol.style.IconOrigin; let linearRing: ol.geom.LinearRing; let lineString: ol.geom.LineString; let loadingStrategy: ol.LoadingStrategy; @@ -53,6 +58,7 @@ let mapBrowserEvent: ol.MapBrowserEvent; let multiLineString: ol.geom.MultiLineString; let multiPoint: ol.geom.MultiPoint; let multiPolygon: ol.geom.MultiPolygon; +let olEvent: ol.events.Event; let pixel: ol.Pixel; let point: ol.geom.Point; let polygon: ol.geom.Polygon; @@ -63,12 +69,11 @@ let size: ol.Size; let style: ol.style.Style; let styleArray: ol.style.Style[]; let styleFunction: ol.StyleFunction; +let styleRegularShape: ol.style.RegularShape; let tilegrid: ol.tilegrid.TileGrid; let transformFn: ol.TransformFunction; -let clusterSource: ol.source.Cluster; -let vectorSource: ol.source.Vector; let units: ol.proj.Units; -let styleRegularShape: ol.style.RegularShape; +let vectorSource: ol.source.Vector; // // ol.Attribution @@ -975,6 +980,53 @@ let mouseWheelZoom: ol.interaction.MouseWheelZoom = new ol.interaction.MouseWhee timeout: numberValue, useAnchor: booleanValue }); + +// +// ol.style.Icon +// + +let iconWithUndefined = new ol.style.Icon({}); +let icon: ol.style.Icon; + +icon = new ol.style.Icon({ + anchor: numberArray, + anchorOrigin: iconOrigin, + anchorXUnits: iconAnchorUnits, + anchorYUnits: iconAnchorUnits, + color: stringValue, + crossOrigin: stringValue, + img: image, + offset: numberArray, + offsetOrigin: iconOrigin, + opacity: numberValue, + scale: numberValue, + snapToPixel: booleanValue, + rotateWithView: booleanValue, + rotation: numberValue, + size, + imgSize: size, + src: stringValue, +}); +icon = new ol.style.Icon({ + anchor: numberArray, + anchorOrigin: iconOrigin, + anchorXUnits: iconAnchorUnits, + anchorYUnits: iconAnchorUnits, + color, + crossOrigin: stringValue, + img: canvas, + offset: numberArray, + offsetOrigin: iconOrigin, + opacity: numberValue, + scale: numberValue, + snapToPixel: booleanValue, + rotateWithView: booleanValue, + rotation: numberValue, + size, + imgSize: size, + src: stringValue, +}); + // // ol.style.RegularShape // diff --git a/types/openlayers/tslint.json b/types/openlayers/tslint.json index 2effdd6100..186a07be8c 100644 --- a/types/openlayers/tslint.json +++ b/types/openlayers/tslint.json @@ -3,9 +3,7 @@ "rules": { // It appears somewhat difficult to remove the Function and Object types "ban-types": false, - // This currently fails for an option that does not appear to be in OL 4 - "no-any-union": false, - // Not sure how to work around this, or if it's necessary to + // Not sure how to work around this, or if it's necessary to "no-declare-current-package": false, "no-internal-module": false, "no-redundant-jsdoc-2": false, From e4aa17e077f28c88abc3f71f9f83c9785fc2242c Mon Sep 17 00:00:00 2001 From: Diogo Correa Date: Wed, 7 Mar 2018 18:38:32 -0300 Subject: [PATCH 42/42] add react-avatar-editor definitions --- types/react-avatar-editor/index.d.ts | 51 +++++++++++++++++++ .../react-avatar-editor-tests.tsx | 47 +++++++++++++++++ types/react-avatar-editor/tsconfig.json | 25 +++++++++ types/react-avatar-editor/tslint.json | 1 + 4 files changed, 124 insertions(+) create mode 100644 types/react-avatar-editor/index.d.ts create mode 100644 types/react-avatar-editor/react-avatar-editor-tests.tsx create mode 100644 types/react-avatar-editor/tsconfig.json create mode 100644 types/react-avatar-editor/tslint.json diff --git a/types/react-avatar-editor/index.d.ts b/types/react-avatar-editor/index.d.ts new file mode 100644 index 0000000000..a3bbf49f3b --- /dev/null +++ b/types/react-avatar-editor/index.d.ts @@ -0,0 +1,51 @@ +// Type definitions for react-avatar-editor 10.3 +// Project: https://github.com/mosch/react-avatar-editor +// Definitions by: Diogo Corrêa +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +import * as React from "react"; + +export interface ImageState { + height: number; + width: number; + x: number; + y: number; + resource: ImageData; +} + +export interface CroppedRect { + x: number; + y: number; + width: number; + height: number; +} + +export interface AvatarEditorProps { + image: string | File; + width?: number; + height?: number; + border?: number | number[]; + borderRadius?: number; + color?: number[]; + style?: object; + scale?: number; + position?: object; + rotate?: number; + crossOrigin?: string; + disableDrop?: boolean; + onDropFile?(event: DragEvent): void; + onLoadFailure?(event: Event): void; + onLoadSuccess?(imgInfo: ImageState): void; + onImageReady?(event: Event): void; + onMouseUp?(): void; + onMouseMove?(event: Event): void; + onImageChange?(): void; + onPositionChange?(): void; +} + +export default class AvatarEditor extends React.Component { + static getImage(): HTMLCanvasElement; + static getImageScaledToCanvas(): HTMLCanvasElement; + static getCroppingRect(): CroppedRect; +} diff --git a/types/react-avatar-editor/react-avatar-editor-tests.tsx b/types/react-avatar-editor/react-avatar-editor-tests.tsx new file mode 100644 index 0000000000..063d083f3f --- /dev/null +++ b/types/react-avatar-editor/react-avatar-editor-tests.tsx @@ -0,0 +1,47 @@ +import * as React from "react"; +import AvatarEditor, { ImageState, CroppedRect } from "react-avatar-editor"; + +const file: File = new File(["str"], "image.jpg"); +const image: ImageData = new ImageData(1, 2); +const imageState: ImageState = { + height: 1, + width: 1, + x: 1, + y: 1, + resource: image +}; + +class AvatarEditorTest extends React.Component { + render() { + return ( +
+ + + + + + + + + + + + + + + {}} /> + {}} /> + {}} /> + {}} /> + {}} /> + {}} /> + {}} /> + {}} /> +
+ ); + } +} + +const getImage: HTMLCanvasElement = AvatarEditor.getImage(); +const getImageScaledToCanvas: HTMLCanvasElement = AvatarEditor.getImageScaledToCanvas(); +const getCroppingRect: CroppedRect = AvatarEditor.getCroppingRect(); diff --git a/types/react-avatar-editor/tsconfig.json b/types/react-avatar-editor/tsconfig.json new file mode 100644 index 0000000000..b947d3271a --- /dev/null +++ b/types/react-avatar-editor/tsconfig.json @@ -0,0 +1,25 @@ +{ + "files": [ + "index.d.ts", + "react-avatar-editor-tests.tsx" + ], + "compilerOptions": { + "jsx": "react", + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + } +} diff --git a/types/react-avatar-editor/tslint.json b/types/react-avatar-editor/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-avatar-editor/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }