From 7adfaa04907c33fb37e7bb6943dd46a4b8f05122 Mon Sep 17 00:00:00 2001 From: benishouga Date: Fri, 3 Nov 2017 16:38:15 +0900 Subject: [PATCH 01/46] [react-mdl] Fixed title type of HeaderRowProps. --- types/react-mdl/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-mdl/index.d.ts b/types/react-mdl/index.d.ts index 33dccccd07..8e70852190 100644 --- a/types/react-mdl/index.d.ts +++ b/types/react-mdl/index.d.ts @@ -418,7 +418,7 @@ declare namespace __ReactMDL { hideSpacer?: boolean; } interface HeaderRowProps extends __MDLOtherProps { - title?: string; + title?: any; // string | JSX.Element hideSpacer?: boolean; } interface HeaderTabsProps extends __MDLOtherProps, RippleComponent { From 74e9d5594a459c2622285bcdd51128e006735bc9 Mon Sep 17 00:00:00 2001 From: Konrad Mattheis Date: Fri, 10 Nov 2017 11:08:35 +0100 Subject: [PATCH 02/46] move on / emit out of engine-api Signed-off-by: Konrad Mattheis --- types/qlik-engineapi/index.d.ts | 36 ++++++------------- types/qlik-visualizationextensions/index.d.ts | 20 +++++++++++ 2 files changed, 30 insertions(+), 26 deletions(-) diff --git a/types/qlik-engineapi/index.d.ts b/types/qlik-engineapi/index.d.ts index 19c9274cae..17f7a7892b 100644 --- a/types/qlik-engineapi/index.d.ts +++ b/types/qlik-engineapi/index.d.ts @@ -5070,32 +5070,11 @@ declare namespace EngineAPI { qAttrDims?: INxAttributeDimValues; } - /** - * ImplementOn... - */ - interface IImplementOn { - /** - * register a function for events - * @param event - function called if this event occures - * @param func - function that is called - */ - on(event: "changed" | "closed", func: () => void): void; - - /** - * manual emit an events - * @param event - event that occures - */ - emit(event: "changed" | "closed"): void; - - // ? not in Docu - id: string; - } - /** * This class describes all the methods that apply at generic object level. * The handle member in the JSON request for all methods listed in this section is the handle of the generic object. */ - interface IGenericObject extends IImplementOn { + interface IGenericObject extends enigmaJS.IGeneratedAPI { /** * app describes all the methods that apply at app level. */ @@ -6010,7 +5989,7 @@ declare namespace EngineAPI { interface IGenericDerivedFieldProperties extends IGenericProperties { } - interface IGenericDerivedFields extends IImplementOn { + interface IGenericDerivedFields extends enigmaJS.IGeneratedAPI { /** * Shows the properties of an object. * Returns the identifier and the definition of the derived field. @@ -6054,7 +6033,7 @@ declare namespace EngineAPI { * This class describes all the methods that apply at measure level. * The handle member in the JSON request for all methods listed in this section is the handle of the measure. */ - interface IGenericMeasure extends IImplementOn { + interface IGenericMeasure extends enigmaJS.IGeneratedAPI { /** * Applies a patch to the properties of an object. Allows an update to some of the properties. * @@ -6122,7 +6101,7 @@ declare namespace EngineAPI { * This class describes all the methods that apply at generic variable level. * The handle member in the JSON request for all methods listed in this section is the handle of the generic variable. */ - interface IGenericVariable extends IImplementOn { + interface IGenericVariable extends enigmaJS.IGeneratedAPI { /** * Applies a patch to the properties of a variable. Allows an update to some of the properties. * @@ -6245,7 +6224,7 @@ declare namespace EngineAPI { * * The handle member in the JSON request for all methods listed in this section is the handle of the variable. */ - interface IVariable extends IImplementOn { + interface IVariable extends enigmaJS.IGeneratedAPI { /** * Sets the value of a dual variable overriding any input constraints. * @@ -9714,3 +9693,8 @@ declare namespace EngineAPI { } } //#endregion + +declare namespace enigmaJS { + interface IGeneratedAPI { + } +} diff --git a/types/qlik-visualizationextensions/index.d.ts b/types/qlik-visualizationextensions/index.d.ts index 7e6f3384b4..5d10ff9bcb 100644 --- a/types/qlik-visualizationextensions/index.d.ts +++ b/types/qlik-visualizationextensions/index.d.ts @@ -2565,3 +2565,23 @@ declare module "qvangular" { const e: IQVAngular; export = e; } + +declare namespace enigmaJS { + interface IGeneratedAPI { + /** + * register a function for events + * @param event - function called if this event occures + * @param func - function that is called + */ + on(event: "changed" | "closed", func: () => void): void; + + /** + * manual emit an events + * @param event - event that occures + */ + emit(event: "changed" | "closed"): void; + + // ? not in Docu + id: string; + } +} From 632e081d9b55c58a8bd61d499e9fc3bc9d1d3f3d Mon Sep 17 00:00:00 2001 From: Thomas Chandelle Date: Fri, 10 Nov 2017 14:53:59 +0100 Subject: [PATCH 03/46] Fixes tooltip callbacks, set return and data type http://www.chartjs.org/docs/latest/configuration/tooltip.html#tooltip-callbacks All functions are called with the same arguments: a tooltip item and the data object passed to the chart. All functions must return either a string or an array of strings --- types/chart.js/index.d.ts | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/types/chart.js/index.d.ts b/types/chart.js/index.d.ts index ef9e8b0675..54e9f4ddda 100644 --- a/types/chart.js/index.d.ts +++ b/types/chart.js/index.d.ts @@ -115,17 +115,17 @@ declare namespace Chart { } interface ChartTooltipCallback { - beforeTitle?(item?: ChartTooltipItem[], data?: any): void; - title?(item?: ChartTooltipItem[], data?: any): void; - afterTitle?(item?: ChartTooltipItem[], data?: any): void; - beforeBody?(item?: ChartTooltipItem[], data?: any): void; - beforeLabel?(tooltipItem?: ChartTooltipItem, data?: any): void; - label?(tooltipItem?: ChartTooltipItem, data?: any): void; - afterLabel?(tooltipItem?: ChartTooltipItem, data?: any): void; - afterBody?(item?: ChartTooltipItem[], data?: any): void; - beforeFooter?(item?: ChartTooltipItem[], data?: any): void; - footer?(item?: ChartTooltipItem[], data?: any): void; - afterFooter?(item?: ChartTooltipItem[], data?: any): void; + beforeTitle?(item?: ChartTooltipItem[], data?: ChartData): string | string[]; + title?(item?: ChartTooltipItem[], data?: ChartData): string | string[]; + afterTitle?(item?: ChartTooltipItem[], data?: ChartData): string | string[]; + beforeBody?(item?: ChartTooltipItem[], data?: ChartData): string | string[]; + beforeLabel?(tooltipItem?: ChartTooltipItem, data?: ChartData): string | string[]; + label?(tooltipItem?: ChartTooltipItem, data?: ChartData): string | string[]; + afterLabel?(tooltipItem?: ChartTooltipItem, data?: ChartData): string | string[]; + afterBody?(item?: ChartTooltipItem[], data?: ChartData): string | string[]; + beforeFooter?(item?: ChartTooltipItem[], data?: ChartData): string | string[]; + footer?(item?: ChartTooltipItem[], data?: ChartData): string | string[]; + afterFooter?(item?: ChartTooltipItem[], data?: ChartData): string | string[]; } interface ChartAnimationParameter { From 112b361c313dbd4b754eaf08473668082b85a7e6 Mon Sep 17 00:00:00 2001 From: Steven Date: Fri, 10 Nov 2017 16:31:07 -0500 Subject: [PATCH 04/46] Add width property on ColHTMLAttributes in react --- types/react/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/react/index.d.ts b/types/react/index.d.ts index 9134406735..ad5ada5e0a 100644 --- a/types/react/index.d.ts +++ b/types/react/index.d.ts @@ -2656,6 +2656,7 @@ declare namespace React { interface ColHTMLAttributes extends HTMLAttributes { span?: number; + width?: number | string; } interface ColgroupHTMLAttributes extends HTMLAttributes { From db5e11dc792e6a4842428c0e86e39745768039b7 Mon Sep 17 00:00:00 2001 From: Erik Vullings Date: Fri, 10 Nov 2017 23:05:50 +0100 Subject: [PATCH 05/46] Added two missing properties in OptionDefinition Missing options: description and typeLabel. Also changed documentation style (using 'Document-this') and changed version from 4.0.6 to 4.0.7. --- types/command-line-args/index.d.ts | 131 +++++++++++++++++++---------- 1 file changed, 88 insertions(+), 43 deletions(-) diff --git a/types/command-line-args/index.d.ts b/types/command-line-args/index.d.ts index 442ee5cb93..f5545f6514 100644 --- a/types/command-line-args/index.d.ts +++ b/types/command-line-args/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for command-line-args 4.0.6 +// Type definitions for command-line-args 4.0.7 // Project: https://github.com/75lb/command-line-args // Definitions by: CzBuCHi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -25,50 +25,95 @@ */ declare function commandLineArgs(optionDefinitions: commandLineArgs.OptionDefinition[], options?: commandLineArgs.Options): any; -declare module commandLineArgs { +declare module commandLineArgs { - export interface OptionDefinition { - /** - * The only required definition property is name, the value of each option will be either a Boolean or string. - */ - name: string, - /** - * The type value is a setter function (you receive the output from this), enabling you to be specific about the type and value received. - */ - type?: (arg: string) => any, - /** - * getopt-style short option names. Can be any single character (unicode included) except a digit or hypen. - */ - alias?: string, - /** - * Set this flag if the option takes a list of values. You will receive an array of values, each passed through the type function (if specified). - */ - multiple?: boolean, - /** - * Any unclaimed command-line args will be set on this option. This flag is typically set on the most commonly-used option to make for more concise usage (i.e. $ myapp *.js instead of $ myapp --files *.js). - */ - defaultOption?: boolean, - /** - * An initial value for the option. - */ - defaultValue?: any, - /** - * When your app has a large amount of options it makes sense to organise them in groups. - * There are two automatic groups: _all (contains all options) and _none (contains options without a group specified in their definition). - */ - group?: string | string[], - } + export interface OptionDefinition { + /** + * The only required definition property is name, the value of each option will be either a Boolean or string. + * + * @type {string} + * @memberof OptionDefinition + */ + name: string, + /** + * The type value is a setter function (you receive the output from this), + * enabling you to be specific about the type and value received. + * + * @memberof OptionDefinition + */ + type?: (arg: string) => any, + /** + * getopt-style short option names. Can be any single character (unicode included) except a digit or hypen. + * + * @type {string} + * @memberof OptionDefinition + */ + alias?: string, + /** + * Set this flag if the option takes a list of values. You will receive an array of values, each passed + * through the type function (if specified). + * + * @type {boolean} + * @memberof OptionDefinition + */ + multiple?: boolean, + /** + * Any unclaimed command-line args will be set on this option. This flag is typically set on + * the most commonly-used option to make for more concise usage + * (i.e. $ myapp *.js instead of $ myapp --files *.js). + * + * @type {boolean} + * @memberof OptionDefinition + */ + defaultOption?: boolean, + /** + * An initial value for the option. + * + * @type {*} + * @memberof OptionDefinition + */ + defaultValue?: any, + /** + * When your app has a large amount of options it makes sense to organise them in groups. + * There are two automatic groups: _all (contains all options) and _none (contains options + * without a group specified in their definition). + * + * @type {(string | string[])} + * @memberof OptionDefinition + */ + group?: string | string[], + /** + * Describes the option. + * + * @type {string} + * @memberof OptionDefinition + */ + description?: string, + /** + * A label for the type, e.g. . + * + * @type {string} + * @memberof OptionDefinition + */ + typeLabel?: string; + } - export interface Options { - /** - * An array of strings, which if passed will be parsed instead of `process.argv`. - */ - argv?: string[]; - /** - * If `true`, an array of unknown arguments is returned in the `_unknown` property of the output. - */ - partial?: boolean; - } + export interface Options { + /** + * An array of strings, which if passed will be parsed instead of `process.argv`. + * + * @type {string[]} + * @memberof Options + */ + argv?: string[]; + /** + * If `true`, an array of unknown arguments is returned in the `_unknown` property of the output. + * + * @type {boolean} + * @memberof Options + */ + partial?: boolean; + } } export = commandLineArgs; From 01d17fcb390ed1da239f97b91ba53e36ad2ac098 Mon Sep 17 00:00:00 2001 From: rcannon Date: Fri, 10 Nov 2017 23:29:21 -0800 Subject: [PATCH 06/46] [hystrixjs] Strengthen type hints This adds type hints for builders, commands and their respective callbacks functions out to seven arity, while leaving the nonspecific versions for backwards compatibility. This allows `commandFactory.getOrCreate()` to create fully type hinted callback signatures, both for the builder and the command. ```js const command = commandFactory. getOrCreate(); ``` I also replaced all references to `Q` with `PromiseLike`, and added the missing `hystrix.promise.implementation` configuration option, which allows changing the underlying promise implementation. This allows things like: ```js const Bluebird = require("bluebird"); HystrixConfig.init({ "hystrix.promise.implementation": Bluebird }); (command.execute() as Bluebird).catch(() => true); ``` ...although I couldn't figure out how to more elegantly express that Bluebird type. Also made the fallback signature match the implementation. --- types/hystrixjs/hystrixjs-tests.ts | 2 +- types/hystrixjs/index.d.ts | 206 ++++++++++++++++++++++++++++- types/hystrixjs/tsconfig.json | 8 +- 3 files changed, 202 insertions(+), 14 deletions(-) diff --git a/types/hystrixjs/hystrixjs-tests.ts b/types/hystrixjs/hystrixjs-tests.ts index 676015be06..7ed7819fb7 100644 --- a/types/hystrixjs/hystrixjs-tests.ts +++ b/types/hystrixjs/hystrixjs-tests.ts @@ -4,7 +4,7 @@ import q = require('q'); var commandFactory = hystrixjs.commandFactory; var command = commandFactory - .getOrCreate('testCommand', 'testGroup') + .getOrCreate('testCommand', 'testGroup') .circuitBreakerSleepWindowInMilliseconds(5000) .errorHandler((error) => { return false; diff --git a/types/hystrixjs/index.d.ts b/types/hystrixjs/index.d.ts index 865f2b3916..b49cd40ba4 100644 --- a/types/hystrixjs/index.d.ts +++ b/types/hystrixjs/index.d.ts @@ -4,7 +4,6 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 -import * as Q from "q"; import * as RX from "rx"; export as namespace hystrixjs; @@ -23,7 +22,8 @@ export interface HystrixProperties { "hystrix.metrics.statistical.window.bucketsNumber"?: number, "hystrix.metrics.percentile.window.timeInMilliseconds"?: number, "hystrix.metrics.percentile.window.bucketsNumber"?: number, - "hystrix.request.volume.rejectionThreshold"?: number + "hystrix.request.volume.rejectionThreshold"?: number, + "hystrix.promise.implementation"?: PromiseConstructorLike, } export interface HystrixConfig { @@ -46,7 +46,39 @@ export interface HystrixConfig { } export interface Command { - execute(...args: any[]): Q.Promise; + execute(...args: any[]): PromiseLike +} + +export interface CommandA0 { + execute(): PromiseLike +} + +export interface CommandA1 { + execute(t: T): PromiseLike +} + +export interface CommandA2 { + execute(t: T, u: U): PromiseLike +} + +export interface CommandA3 { + execute(t: T, u: U, v: V): PromiseLike +} + +export interface CommandA4 { + execute(t: T, u: U, v: V, w: W): PromiseLike +} + +export interface CommandA5 { + execute(t: T, u: U, v: V, w: W, x: X): PromiseLike +} + +export interface CommandA6 { + execute(t: T, u: U, v: V, w: W, x: X, y: Y): PromiseLike +} + +export interface CommandA7 { + execute(t: T, u: U, v: V, w: W, x: X, y: Y, z: Z): PromiseLike } export interface CommandBuilder { @@ -62,14 +94,174 @@ export interface CommandBuilder { percentileWindowNumberOfBuckets(value: number): CommandBuilder; percentileWindowLength(value: number): CommandBuilder; circuitBreakerErrorThresholdPercentage(value: number): CommandBuilder; - run(value: (args: any) => Q.Promise): CommandBuilder; - fallbackTo(value: (...args: any[]) => Q.Promise): CommandBuilder; context(value: any): CommandBuilder; - build(): Command; + run(value: (...args: any[]) => PromiseLike): CommandBuilder; + fallbackTo(value: (error: Error, args ?: any[]) => PromiseLike): CommandBuilder; + build() : Command; +} + +export interface CommandBuilderA0 { + circuitBreakerSleepWindowInMilliseconds(value: number): CommandBuilderA0; + errorHandler(value: (error: any) => boolean): CommandBuilderA0; + timeout(value: number): CommandBuilderA0; + circuitBreakerRequestVolumeThreshold(value: number): CommandBuilderA0; + requestVolumeRejectionThreshold(value: number): CommandBuilderA0; + circuitBreakerForceOpened(value: boolean): CommandBuilderA0; + circuitBreakerForceClosed(value: boolean): CommandBuilderA0; + statisticalWindowNumberOfBuckets(value: number): CommandBuilderA0; + statisticalWindowLength(value: number): CommandBuilderA0; + percentileWindowNumberOfBuckets(value: number): CommandBuilderA0; + percentileWindowLength(value: number): CommandBuilderA0; + circuitBreakerErrorThresholdPercentage(value: number): CommandBuilderA0; + context(value: any): CommandBuilderA0; + run(value: () => PromiseLike): CommandBuilderA0; + fallbackTo(value: (error: Error) => PromiseLike): CommandBuilderA0; + build() : CommandA0; +} + +export interface CommandBuilderA1 { + circuitBreakerSleepWindowInMilliseconds(value: number): CommandBuilderA1; + errorHandler(value: (error: any) => boolean): CommandBuilderA1; + timeout(value: number): CommandBuilderA1; + circuitBreakerRequestVolumeThreshold(value: number): CommandBuilderA1; + requestVolumeRejectionThreshold(value: number): CommandBuilderA1; + circuitBreakerForceOpened(value: boolean): CommandBuilderA1; + circuitBreakerForceClosed(value: boolean): CommandBuilderA1; + statisticalWindowNumberOfBuckets(value: number): CommandBuilderA1; + statisticalWindowLength(value: number): CommandBuilderA1; + percentileWindowNumberOfBuckets(value: number): CommandBuilderA1; + percentileWindowLength(value: number): CommandBuilderA1; + circuitBreakerErrorThresholdPercentage(value: number): CommandBuilderA1; + context(value: any): CommandBuilderA1; + run(value: (t: T) => PromiseLike): CommandBuilderA1; + fallbackTo(value: (error: Error, args : [T]) => PromiseLike): CommandBuilderA1; + build(): CommandA1; +} + +export interface CommandBuilderA2 { + circuitBreakerSleepWindowInMilliseconds(value: number): CommandBuilderA2; + errorHandler(value: (error: any) => boolean): CommandBuilderA2; + timeout(value: number): CommandBuilderA2; + circuitBreakerRequestVolumeThreshold(value: number): CommandBuilderA2; + requestVolumeRejectionThreshold(value: number): CommandBuilderA2; + circuitBreakerForceOpened(value: boolean): CommandBuilderA2; + circuitBreakerForceClosed(value: boolean): CommandBuilderA2; + statisticalWindowNumberOfBuckets(value: number): CommandBuilderA2; + statisticalWindowLength(value: number): CommandBuilderA2; + percentileWindowNumberOfBuckets(value: number): CommandBuilderA2; + percentileWindowLength(value: number): CommandBuilderA2; + circuitBreakerErrorThresholdPercentage(value: number): CommandBuilderA2; + context(value: any): CommandBuilderA2; + run(value: (t: T, u: U) => PromiseLike): CommandBuilderA2; + fallbackTo(value: (error: Error, args: [T, U]) => PromiseLike): CommandBuilderA2; + build(): CommandA2; +} + +export interface CommandBuilderA3 { + circuitBreakerSleepWindowInMilliseconds(value: number): CommandBuilderA3; + errorHandler(value: (error: any) => boolean): CommandBuilderA3; + timeout(value: number): CommandBuilderA3; + circuitBreakerRequestVolumeThreshold(value: number): CommandBuilderA3; + requestVolumeRejectionThreshold(value: number): CommandBuilderA3; + circuitBreakerForceOpened(value: boolean): CommandBuilderA3; + circuitBreakerForceClosed(value: boolean): CommandBuilderA3; + statisticalWindowNumberOfBuckets(value: number): CommandBuilderA3; + statisticalWindowLength(value: number): CommandBuilderA3; + percentileWindowNumberOfBuckets(value: number): CommandBuilderA3; + percentileWindowLength(value: number): CommandBuilderA3; + circuitBreakerErrorThresholdPercentage(value: number): CommandBuilderA3; + context(value: any): CommandBuilderA3; + run(value: (t: T, u: U, v: V) => PromiseLike): CommandBuilderA3; + fallbackTo(value: (error: Error, args: [T, U, V]) => PromiseLike): CommandBuilderA3; + build(): CommandA3; +} + +export interface CommandBuilderA4 { + circuitBreakerSleepWindowInMilliseconds(value: number): CommandBuilderA4; + errorHandler(value: (error: any) => boolean): CommandBuilderA4; + timeout(value: number): CommandBuilderA4; + circuitBreakerRequestVolumeThreshold(value: number): CommandBuilderA4; + requestVolumeRejectionThreshold(value: number): CommandBuilderA4; + circuitBreakerForceOpened(value: boolean): CommandBuilderA4; + circuitBreakerForceClosed(value: boolean): CommandBuilderA4; + statisticalWindowNumberOfBuckets(value: number): CommandBuilderA4; + statisticalWindowLength(value: number): CommandBuilderA4; + percentileWindowNumberOfBuckets(value: number): CommandBuilderA4; + percentileWindowLength(value: number): CommandBuilderA4; + circuitBreakerErrorThresholdPercentage(value: number): CommandBuilderA4; + context(value: any): CommandBuilderA4; + run(value: (t: T, u: U, v: V, w: W) => PromiseLike): CommandBuilderA4; + fallbackTo(value: (error: Error, args: [T, U, V, W]) => PromiseLike): CommandBuilderA4; + build(): CommandA4; +} + +export interface CommandBuilderA5 { + circuitBreakerSleepWindowInMilliseconds(value: number): CommandBuilderA5; + errorHandler(value: (error: any) => boolean): CommandBuilderA5; + timeout(value: number): CommandBuilderA5; + circuitBreakerRequestVolumeThreshold(value: number): CommandBuilderA5; + requestVolumeRejectionThreshold(value: number): CommandBuilderA5; + circuitBreakerForceOpened(value: boolean): CommandBuilderA5; + circuitBreakerForceClosed(value: boolean): CommandBuilderA5; + statisticalWindowNumberOfBuckets(value: number): CommandBuilderA5; + statisticalWindowLength(value: number): CommandBuilderA5; + percentileWindowNumberOfBuckets(value: number): CommandBuilderA5; + percentileWindowLength(value: number): CommandBuilderA5; + circuitBreakerErrorThresholdPercentage(value: number): CommandBuilderA5; + context(value: any): CommandBuilderA5; + run(value: (t: T, u: U, v: V, w: W, x: X) => PromiseLike): CommandBuilderA5; + fallbackTo(value: (error: Error, args: [T, U, V, W, X]) => PromiseLike): CommandBuilderA5; + build(): CommandA5; +} + +export interface CommandBuilderA6 { + circuitBreakerSleepWindowInMilliseconds(value: number): CommandBuilderA6; + errorHandler(value: (error: any) => boolean): CommandBuilderA6; + timeout(value: number): CommandBuilderA6; + circuitBreakerRequestVolumeThreshold(value: number): CommandBuilderA6; + requestVolumeRejectionThreshold(value: number): CommandBuilderA6; + circuitBreakerForceOpened(value: boolean): CommandBuilderA6; + circuitBreakerForceClosed(value: boolean): CommandBuilderA6; + statisticalWindowNumberOfBuckets(value: number): CommandBuilderA6; + statisticalWindowLength(value: number): CommandBuilderA6; + percentileWindowNumberOfBuckets(value: number): CommandBuilderA6; + percentileWindowLength(value: number): CommandBuilderA6; + circuitBreakerErrorThresholdPercentage(value: number): CommandBuilderA6; + context(value: any): CommandBuilderA6; + run(value: (t: T, u: U, v: V, w: W, x: X, y: Y) => PromiseLike): CommandBuilderA6; + fallbackTo(value: (error: Error, args: [T, U, V, W, X, Y]) => PromiseLike): CommandBuilderA6; + build(): CommandA6; +} + +export interface CommandBuilderA7 { + circuitBreakerSleepWindowInMilliseconds(value: number): CommandBuilderA7; + errorHandler(value: (error: any) => boolean): CommandBuilderA7; + timeout(value: number): CommandBuilderA7; + circuitBreakerRequestVolumeThreshold(value: number): CommandBuilderA7; + requestVolumeRejectionThreshold(value: number): CommandBuilderA7; + circuitBreakerForceOpened(value: boolean): CommandBuilderA7; + circuitBreakerForceClosed(value: boolean): CommandBuilderA7; + statisticalWindowNumberOfBuckets(value: number): CommandBuilderA7; + statisticalWindowLength(value: number): CommandBuilderA7; + percentileWindowNumberOfBuckets(value: number): CommandBuilderA7; + percentileWindowLength(value: number): CommandBuilderA7; + circuitBreakerErrorThresholdPercentage(value: number): CommandBuilderA7; + context(value: any): CommandBuilderA7; + run(value: (t: T, u: U, v: V, w: W, x: X, y: Y, z: Z) => PromiseLike): CommandBuilderA7; + fallbackTo(value: (error: Error, args: [T, U, V, W, X, Y, Z]) => PromiseLike): CommandBuilderA7; + build(): CommandA7; } export interface CommandFactory { getOrCreate(commandKey: string, commandGroup?: string): CommandBuilder; + getOrCreate(commandKey: string, commandGroup?: string): CommandBuilderA0; + getOrCreate(commandKey: string, commandGroup?: string): CommandBuilderA1; + getOrCreate(commandKey: string, commandGroup?: string): CommandBuilderA2; + getOrCreate(commandKey: string, commandGroup?: string): CommandBuilderA3; + getOrCreate(commandKey: string, commandGroup?: string): CommandBuilderA4; + getOrCreate(commandKey: string, commandGroup?: string): CommandBuilderA5; + getOrCreate(commandKey: string, commandGroup?: string): CommandBuilderA6; + getOrCreate(commandKey: string, commandGroup?: string): CommandBuilderA7; resetCache(): void; } @@ -141,4 +333,4 @@ export var commandFactory: CommandFactory; export var metricsFactory: MetricsFactory; export var circuitFactory: CircuitFactory; export var hystrixSSEStream: HystrixSSEStream; -export var hystrixConfig: HystrixConfig; \ No newline at end of file +export var hystrixConfig: HystrixConfig; diff --git a/types/hystrixjs/tsconfig.json b/types/hystrixjs/tsconfig.json index 0cf5de7b81..480476e8d1 100644 --- a/types/hystrixjs/tsconfig.json +++ b/types/hystrixjs/tsconfig.json @@ -13,11 +13,7 @@ "typeRoots": [ "../" ], - "paths": { - "q": [ - "q/v0" - ] - }, + "paths": {}, "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true @@ -26,4 +22,4 @@ "index.d.ts", "hystrixjs-tests.ts" ] -} \ No newline at end of file +} From 66b805edf20a32416537adc161f1857817aca04e Mon Sep 17 00:00:00 2001 From: Shaun Luttin Date: Sat, 11 Nov 2017 08:27:36 -0800 Subject: [PATCH 07/46] Update Resource.js typings --- types/resourcejs/index.d.ts | 2 +- types/resourcejs/resourcejs-tests.ts | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/types/resourcejs/index.d.ts b/types/resourcejs/index.d.ts index bb4bffa197..ec5e938745 100644 --- a/types/resourcejs/index.d.ts +++ b/types/resourcejs/index.d.ts @@ -94,7 +94,7 @@ declare namespace resourcejs { interface Resource { status: number; error: Error; - item: mongoose.Document | mongoose.Document[]; + item: any; } interface Error { diff --git a/types/resourcejs/resourcejs-tests.ts b/types/resourcejs/resourcejs-tests.ts index b3d2604933..603d31c255 100644 --- a/types/resourcejs/resourcejs-tests.ts +++ b/types/resourcejs/resourcejs-tests.ts @@ -11,7 +11,17 @@ const model = mongoose.model(resourceName, schema); resourcejs(app, route, resourceName, model) .get() - .post() + .post({ + after(req: resourcejs.Request, res: resourcejs.Response, next: express.NextFunction) { + res.resource.item = { + foo: "foo", + bar: "bar", + baz: "baz", + }; + + next(); + }, + }) .delete() .put() .patch() From f4b539d95334d5c0be91409f5fc7465020b3d1e9 Mon Sep 17 00:00:00 2001 From: Konrad Mattheis Date: Sat, 11 Nov 2017 20:47:34 +0100 Subject: [PATCH 08/46] add new types for enigma.js Signed-off-by: Konrad Mattheis --- types/enigma.js/index.d.ts | 196 ++++++++++++++++++++++++++++++++++ types/enigma.js/tsconfig.json | 23 ++++ types/enigma.js/tslint.json | 10 ++ 3 files changed, 229 insertions(+) create mode 100644 types/enigma.js/index.d.ts create mode 100644 types/enigma.js/tsconfig.json create mode 100644 types/enigma.js/tslint.json diff --git a/types/enigma.js/index.d.ts b/types/enigma.js/index.d.ts new file mode 100644 index 0000000000..5a316b669c --- /dev/null +++ b/types/enigma.js/index.d.ts @@ -0,0 +1,196 @@ +// Type definitions for enigma.js 2.2 +// Project: https://github.com/qlik-oss/enigma.js/ +// Definitions by: Konrad Mattheis +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +declare module "enigma.js" { + const e: IEnigmaJSClass; + export = e; +} + +interface IEnigmaJSClass { + /** + * Create a session object. + * @returns - Returns a session. + * Note: See Configuration for the configuration options. + */ + create(config: enigmaJS.IConfig): enigmaJS.ISession; +} + +declare namespace enigmaJS { + type MixinType = "Doc"| "GenericObject"| "GenericBookmark" | string; + + interface IMixin { + /** + * QIX Engine types like for example GenericObject, Doc, GenericBookmark, are supported but also custom GenericObject + * types such as barchart, story and myCustomType. + * An API will get both their generic type as well as custom type mixins applied. + */ + types: [MixinType]; + + init(args: {config: any, api: IGeneratedAPI}): void; + + /** + * mixin.extend is an object containing methods to extend the generated API with. These method names cannot already exist or enigma.js will throw an error. + */ + extend?: [any]; + + /** + * mixin.override is an object containing methods that overrides existing API methods. + * These method names needs to exist already* or engima.js will throw an error. + * Be careful when overriding, you may break expected behaviors in other mixins or your application. + * base is a reference to the previous mixin method, can be used to invoke the mixin chain before this mixin method. + */ + override?: [any]; + } + + interface IProtocol { + // Set to false to disable the use of the bandwidth-reducing delta protocol. + delta?: boolean; + } + + /** + * This section describes the configuration object that is sent into enigma.create(config). + */ + interface IConfig { + /** + * Object containing the specification for the API to generate. Corresponds to a specific version of the QIX Engine API. + */ + schema: object; + /** + * String containing a proper websocket URL to QIX Engine. + */ + url: string; + /** + * A function to use when instantiating the WebSocket, mandatory for Node.js. + */ + createSocket?: any; + /** + * ES6-compatible Promise library. + */ + Promise?: any; + /** + * Set to true if the session should be suspended instead of closed when the websocket is closed. + */ + suspendOnClose?: boolean; + /** + * Mixins to extend/augment the QIX Engine API. + * See Mixins section for more information how each entry in this array should look like. + * Mixins are applied in the array order. + */ + mixins?: [any]; + /** + * Interceptors for augmenting responses before they are passed into mixins and end-users. + * See Interceptors section for more information how each entry in this array should look like. + * Interceptors are applied in the array order. + */ + interceptors?: [any]; + /** + * An object containing additional JSON-RPC request parameters. + * protocol.delta : Set to false to disable the use of the bandwidth-reducing delta protocol. + */ + protocol?: any; + } + + interface ISession { + /** + * Establishes the websocket against the configured URL. Eventually resolved with the QIX global interface when the connection has been established. + * @return Promise. + */ + open(): Promise; + + /** + * Establishes the websocket against the configured URL. Eventually resolved with the QIX global interface when the connection has been established. + * @return Promise. + */ + open(): Promise; + + /** + * Closes the websocket and cleans up internal caches, also triggers the closed event on all generated APIs. + * Eventually resolved when the websocket has been closed. + * + * Note: you need to manually invoke this when you want to close a session and config.suspendOnClose is true. + * @return Promise. + */ + close(): Promise; + + /** + * Suspends the enigma.js session by closing the websocket and rejecting all method calls until it has been resumed again. + * @return Promise. + */ + suspend(): Promise; + + /** + * Resume a previously suspended enigma.js session by re-creating the websocket and, if possible, re-open the document + * as well as refreshing the internal caches. If successful, changed events will be triggered on all generated APIs, + * and on the ones it was unable to restore, the closed event will be triggered. + * @param onlyIfAttached onlyIfAttached can be used to only allow resuming if the QIX Engine session was reattached properly. + * @return Promise. + * Note: Eventually resolved when the websocket (and potentially the previously opened document, and generated APIs) has been restored, + * rejected when it fails any of those steps, or when onlyIfAttached is true and a new QIX Engine session was created. + */ + resume(onlyIfAttached?: boolean): Promise; + + /** + * Handle opened state. This event is triggered whenever the websocket is connected and ready for communication. + * + * Handle closed state. This event is triggered when the underlying websocket is closed and config.suspendOnClose is false. + * + * Handle suspended state. This event is triggered in two cases (listed below). It is useful in scenarios where you for example + * want to block interaction in your application until you are resumed again. + * If config.suspendOnClose is true and there was a network disconnect (socked closed) + * If you ran session.suspend() + * The evt.initiator value is a string indicating what triggered the suspended state. Possible values: network, manual. + * + * Handle resumed state. This event is triggered when the session was properly resumed. + * It is useful in scenarios where you for example can close blocking modal dialogs and allow the user to interact with your application again. + * + * notification:* + * @param event - Event that triggers the function + * @param func - Called function + */ + on(event: "opened" | "close" | "suspended" | "resumed" | string, func: any): void; + } + + interface IGeneratedAPI { + /** + * This property contains the unique identifier for this API. + */ + id: string; + + /** + * This property contains the schema class name for this API. + */ + type: string; + + /** + * Despite the name, this property corresponds to the qInfo.qType property on your generic object's properties object. + */ + genericType: string; + + /** + * This property contains a reference to the session that this API belongs to. + */ + session: ISession; + + /** + * This property contains the handle QIX Engine assigned to the API. + * Used internally in enigma.js for caches and JSON-RPC + */ + handle: number; + + /** + * register a function for events + * @param event - function called if this event occures + * @param func - function that is called + */ + on(event: "changed" | "closed", func: () => void): void; + + /** + * manual emit an events + * @param event - event that occures + */ + emit(event: "changed" | "closed"): void; + } +} diff --git a/types/enigma.js/tsconfig.json b/types/enigma.js/tsconfig.json new file mode 100644 index 0000000000..2eae92bb60 --- /dev/null +++ b/types/enigma.js/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts" + ] +} \ No newline at end of file diff --git a/types/enigma.js/tslint.json b/types/enigma.js/tslint.json new file mode 100644 index 0000000000..5d8cce7b04 --- /dev/null +++ b/types/enigma.js/tslint.json @@ -0,0 +1,10 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + // TODOs + "interface-name": false, + "no-unnecessary-generics": false, + "no-single-declare-module": false, + "no-declare-current-package": false + } +} From 0d5a1ef2696bf64ce1fcf8083b65bb3f723cad3b Mon Sep 17 00:00:00 2001 From: Konrad Mattheis Date: Sat, 11 Nov 2017 20:47:50 +0100 Subject: [PATCH 09/46] fix small issues --- types/qlik-engineapi/index.d.ts | 2 +- types/qlik-visualizationextensions/index.d.ts | 28 +++++++++++++++++-- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/types/qlik-engineapi/index.d.ts b/types/qlik-engineapi/index.d.ts index 17f7a7892b..d908d5a313 100644 --- a/types/qlik-engineapi/index.d.ts +++ b/types/qlik-engineapi/index.d.ts @@ -6911,7 +6911,7 @@ declare namespace EngineAPI { * This class describes all the methods that apply at global level. * The handle member in the JSON request for all methods listed in this section is -1. */ - interface IGlobal { + interface IGlobal extends enigmaJS.IGeneratedAPI { /** * Sets an abort flag on all pending and ongoing requests in the current engine session. * If an abort flag is set on a pending request, the request is aborted. diff --git a/types/qlik-visualizationextensions/index.d.ts b/types/qlik-visualizationextensions/index.d.ts index 5d10ff9bcb..6baee98c1b 100644 --- a/types/qlik-visualizationextensions/index.d.ts +++ b/types/qlik-visualizationextensions/index.d.ts @@ -2566,8 +2566,33 @@ declare module "qvangular" { export = e; } +/** + * This section is added because the Qlik Sense Client after > 3.2 contains a engineapi + * an this makes the handling more fluent for users of that files. + */ declare namespace enigmaJS { interface IGeneratedAPI { + /** + * This property contains the unique identifier for this API. + */ + id: string; + + /** + * This property contains the schema class name for this API. + */ + type: string; + + /** + * Despite the name, this property corresponds to the qInfo.qType property on your generic object's properties object. + */ + genericType: string; + + /** + * This property contains the handle QIX Engine assigned to the API. + * Used internally in enigma.js for caches and JSON-RPC + */ + handle: number; + /** * register a function for events * @param event - function called if this event occures @@ -2580,8 +2605,5 @@ declare namespace enigmaJS { * @param event - event that occures */ emit(event: "changed" | "closed"): void; - - // ? not in Docu - id: string; } } From 904f3cc6c6780b9c07c960abb67b8f674b0916f1 Mon Sep 17 00:00:00 2001 From: Thomas Chandelle Date: Sun, 12 Nov 2017 14:48:44 +0100 Subject: [PATCH 10/46] Add labelColor and labelTextColor in tooltip callbacks --- types/chart.js/index.d.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/types/chart.js/index.d.ts b/types/chart.js/index.d.ts index 54e9f4ddda..51bbc3b49e 100644 --- a/types/chart.js/index.d.ts +++ b/types/chart.js/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Chart.js 2.6 +// Type definitions for Chart.js 2.7 // Project: https://github.com/nnnick/Chart.js // Definitions by: Alberto Nuti // Fabien Lavocat @@ -114,6 +114,11 @@ declare namespace Chart { index?: number; } + interface ChartTooltipLabelColor { + borderColor: ChartColor; + backgroundColor: ChartColor; + } + interface ChartTooltipCallback { beforeTitle?(item?: ChartTooltipItem[], data?: ChartData): string | string[]; title?(item?: ChartTooltipItem[], data?: ChartData): string | string[]; @@ -121,6 +126,8 @@ declare namespace Chart { beforeBody?(item?: ChartTooltipItem[], data?: ChartData): string | string[]; beforeLabel?(tooltipItem?: ChartTooltipItem, data?: ChartData): string | string[]; label?(tooltipItem?: ChartTooltipItem, data?: ChartData): string | string[]; + labelColor?(tooltipItem?: ChartTooltipItem, chart?: Chart): ChartTooltipLabelColor; + labelTextColor?(tooltipItem?: ChartTooltipItem, chart?: Chart): string; afterLabel?(tooltipItem?: ChartTooltipItem, data?: ChartData): string | string[]; afterBody?(item?: ChartTooltipItem[], data?: ChartData): string | string[]; beforeFooter?(item?: ChartTooltipItem[], data?: ChartData): string | string[]; From 70406cb8e7e8667415a32f4b26558c2fe61591b9 Mon Sep 17 00:00:00 2001 From: Konrad Mattheis Date: Wed, 15 Nov 2017 15:25:28 +0100 Subject: [PATCH 11/46] * add test-enigma.js.ts * fix small types Signed-off-by: Konrad Mattheis --- types/enigma.js/index.d.ts | 15 +++++++++------ types/enigma.js/test-enigma.js.ts | 8 ++++++++ types/enigma.js/tsconfig.json | 3 ++- types/enigma.js/tslint.json | 7 ++++--- 4 files changed, 23 insertions(+), 10 deletions(-) create mode 100644 types/enigma.js/test-enigma.js.ts diff --git a/types/enigma.js/index.d.ts b/types/enigma.js/index.d.ts index 5a316b669c..5f252844c9 100644 --- a/types/enigma.js/index.d.ts +++ b/types/enigma.js/index.d.ts @@ -4,12 +4,15 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 -declare module "enigma.js" { - const e: IEnigmaJSClass; - export = e; -} +// declare module "enigma.js" { +// const e: IEnigmaJSClass; +// export = e; +// } +declare const enigmaJS: IEnigmaClass; +export = enigmaJS; +export as namespace enigmaJS; -interface IEnigmaJSClass { +interface IEnigmaClass { /** * Create a session object. * @returns - Returns a session. @@ -27,7 +30,7 @@ declare namespace enigmaJS { * types such as barchart, story and myCustomType. * An API will get both their generic type as well as custom type mixins applied. */ - types: [MixinType]; + types: MixinType[]; init(args: {config: any, api: IGeneratedAPI}): void; diff --git a/types/enigma.js/test-enigma.js.ts b/types/enigma.js/test-enigma.js.ts new file mode 100644 index 0000000000..6a88b2d2ff --- /dev/null +++ b/types/enigma.js/test-enigma.js.ts @@ -0,0 +1,8 @@ +import * as enigma from "enigma.js"; + +enigma.create({ + url: "http://127.0.0.1:4848/", + schema: {} +}).open().then((global) => { + console.log("connect fine"); +}); diff --git a/types/enigma.js/tsconfig.json b/types/enigma.js/tsconfig.json index 2eae92bb60..0882d8c8cf 100644 --- a/types/enigma.js/tsconfig.json +++ b/types/enigma.js/tsconfig.json @@ -18,6 +18,7 @@ "forceConsistentCasingInFileNames": true }, "files": [ - "index.d.ts" + "index.d.ts", + "test-enigma.js.ts" ] } \ No newline at end of file diff --git a/types/enigma.js/tslint.json b/types/enigma.js/tslint.json index 5d8cce7b04..2abb55f448 100644 --- a/types/enigma.js/tslint.json +++ b/types/enigma.js/tslint.json @@ -2,9 +2,10 @@ "extends": "dtslint/dt.json", "rules": { // TODOs - "interface-name": false, + "ban-types": false, + "no-empty-interface": false, + "no-mergeable-namespace": false, "no-unnecessary-generics": false, - "no-single-declare-module": false, - "no-declare-current-package": false + "interface-name": false } } From a79a56acb419fabf6ec33cedaa17d2a2c57a75a2 Mon Sep 17 00:00:00 2001 From: Konrad Mattheis Date: Wed, 15 Nov 2017 15:29:33 +0100 Subject: [PATCH 12/46] fix enigma.js-tests.ts naming --- types/enigma.js/{test-enigma.js.ts => enigma.js-tests.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename types/enigma.js/{test-enigma.js.ts => enigma.js-tests.ts} (100%) diff --git a/types/enigma.js/test-enigma.js.ts b/types/enigma.js/enigma.js-tests.ts similarity index 100% rename from types/enigma.js/test-enigma.js.ts rename to types/enigma.js/enigma.js-tests.ts From b91ee1ec9c4b80c1162e8672a820f347ff8990d6 Mon Sep 17 00:00:00 2001 From: Konrad Mattheis Date: Wed, 15 Nov 2017 15:55:11 +0100 Subject: [PATCH 13/46] fix module Signed-off-by: Konrad Mattheis --- types/enigma.js/index.d.ts | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/types/enigma.js/index.d.ts b/types/enigma.js/index.d.ts index 5f252844c9..29a5dcfb5b 100644 --- a/types/enigma.js/index.d.ts +++ b/types/enigma.js/index.d.ts @@ -4,15 +4,12 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 -// declare module "enigma.js" { -// const e: IEnigmaJSClass; -// export = e; -// } -declare const enigmaJS: IEnigmaClass; -export = enigmaJS; -export as namespace enigmaJS; +declare module "enigma.js" { + const e: IEnigmaJSClass; + export = e; +} -interface IEnigmaClass { +interface IEnigmaJSClass { /** * Create a session object. * @returns - Returns a session. From ed4172cedd0694f0f24eb47309742af55026cccc Mon Sep 17 00:00:00 2001 From: Ebrahim Date: Wed, 15 Nov 2017 18:31:55 +0330 Subject: [PATCH 14/46] [ioredis] updated multi param types --- types/ioredis/index.d.ts | 8 ++++++-- types/ioredis/ioredis-tests.ts | 14 ++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/types/ioredis/index.d.ts b/types/ioredis/index.d.ts index f1d7f6eb95..6cb165c9bd 100644 --- a/types/ioredis/index.d.ts +++ b/types/ioredis/index.d.ts @@ -3,6 +3,7 @@ // Definitions by: York Yao // Christopher Eck // Yoga Aliarham +// Ebrahim // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /* =================== USAGE =================== @@ -344,8 +345,7 @@ declare namespace IORedis { type(key: string, callback: (err: Error, res: string) => void): void; type(key: string): Promise; - multi(callback: (err: Error, res: string) => void): void; - multi(): Promise; + multi(commands?: string[][], options?: MultiOptions): Pipeline; exec(callback: (err: Error, res: any) => void): void; exec(): Promise; @@ -844,4 +844,8 @@ declare namespace IORedis { retryDelayOnTryAgain?: number; redisOptions?: RedisOptions; } + + interface MultiOptions { + pipeline: boolean; + } } diff --git a/types/ioredis/ioredis-tests.ts b/types/ioredis/ioredis-tests.ts index 2be342c2bd..02b62def62 100644 --- a/types/ioredis/ioredis-tests.ts +++ b/types/ioredis/ioredis-tests.ts @@ -90,3 +90,17 @@ Redis.Command.setArgumentTransformer('set', args => { Redis.Command.setReplyTransformer('get', (result: any) => { return result; }); + +// multi +redis.multi().set('foo', 'bar').set('foo', 'baz').get('foo', (err, result) => { + // result === 'QUEUED' +}).exec((err, results) => { + // results = [[null, 'OK'], [null, 'OK'], [null, 'baz']] +}); + +redis.multi([ + ['set', 'foo', 'bar'], + ['get', 'foo'] +]).exec((err, results) => { + // results = [[null, 'OK'], [null, 'bar']] +}); From 67895448db288f0661e7677127d4aca66b4ac572 Mon Sep 17 00:00:00 2001 From: Konrad Mattheis Date: Wed, 15 Nov 2017 16:26:21 +0100 Subject: [PATCH 15/46] fix tsconfig.json Signed-off-by: Konrad Mattheis --- types/enigma.js/tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/enigma.js/tsconfig.json b/types/enigma.js/tsconfig.json index 0882d8c8cf..b3b93456f0 100644 --- a/types/enigma.js/tsconfig.json +++ b/types/enigma.js/tsconfig.json @@ -19,6 +19,6 @@ }, "files": [ "index.d.ts", - "test-enigma.js.ts" + "enigma.js-tests.ts" ] } \ No newline at end of file From d109f464a61b44b6d9eb050190f6ec0d2ecb3022 Mon Sep 17 00:00:00 2001 From: Konrad Mattheis Date: Wed, 15 Nov 2017 16:40:22 +0100 Subject: [PATCH 16/46] fix tslint.json --- types/enigma.js/tslint.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/enigma.js/tslint.json b/types/enigma.js/tslint.json index 2abb55f448..84cbb5f289 100644 --- a/types/enigma.js/tslint.json +++ b/types/enigma.js/tslint.json @@ -6,6 +6,8 @@ "no-empty-interface": false, "no-mergeable-namespace": false, "no-unnecessary-generics": false, + "no-single-declare-module": false, + "no-declare-current-package": false, "interface-name": false } } From b8125f9a78a0e9882ab5f8bebf7c197759d67fea Mon Sep 17 00:00:00 2001 From: Edward Knowles Date: Wed, 15 Nov 2017 16:01:52 +0000 Subject: [PATCH 17/46] add mdAriaProvider to angular material --- types/angular-material/angular-material-tests.ts | 4 ++++ types/angular-material/index.d.ts | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/types/angular-material/angular-material-tests.ts b/types/angular-material/angular-material-tests.ts index d46a51d578..ce5a9bf71e 100644 --- a/types/angular-material/angular-material-tests.ts +++ b/types/angular-material/angular-material-tests.ts @@ -5,6 +5,7 @@ interface TestScope extends ng.IScope { } myApp.config(( + $mdAriaProvider: ng.material.IAriaProvider, $mdThemingProvider: ng.material.IThemingProvider, $mdIconProvider: ng.material.IIconProvider, $mdProgressCircularProvider: ng.material.IProgressCircularProvider) => { @@ -52,6 +53,9 @@ myApp.config(( return c * Math.pow(2, (t / d - 1) * 10) + b; } }); + + // Globally disables all ARIA warnings. + $mdAriaProvider.disableWarnings(); }); myApp.controller('BottomSheetController', ($scope: TestScope, $mdBottomSheet: ng.material.IBottomSheetService, $q: ng.IQService) => { diff --git a/types/angular-material/index.d.ts b/types/angular-material/index.d.ts index 4bfadbf9b3..2dca0c66da 100644 --- a/types/angular-material/index.d.ts +++ b/types/angular-material/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for angular-material 1.1 // Project: https://github.com/angular/material -// Definitions by: Blake Bigelow , Peter Hajdu , Davide Donadello , Geert Jansen +// Definitions by: Blake Bigelow , Peter Hajdu , Davide Donadello , Geert Jansen , Edward Knowles // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -11,6 +11,10 @@ export = _; declare module 'angular' { namespace material { + interface IAriaProvider { + disableWarnings(): void; + } + interface ResolveObject { [name: string]: Injectable<(...args: any[]) => PromiseLike>; } From a2eb64753f58f4b81f1f379c0fc24887d57a688f Mon Sep 17 00:00:00 2001 From: Andrew Makarov Date: Thu, 16 Nov 2017 01:08:19 +0300 Subject: [PATCH 18/46] [case-sensitive-paths-webpack-plugin] Add typings --- ...se-sensitive-paths-webpack-plugin-tests.ts | 11 +++++++++ .../index.d.ts | 21 +++++++++++++++++ .../tsconfig.json | 23 +++++++++++++++++++ .../tslint.json | 1 + 4 files changed, 56 insertions(+) create mode 100644 types/case-sensitive-paths-webpack-plugin/case-sensitive-paths-webpack-plugin-tests.ts create mode 100644 types/case-sensitive-paths-webpack-plugin/index.d.ts create mode 100644 types/case-sensitive-paths-webpack-plugin/tsconfig.json create mode 100644 types/case-sensitive-paths-webpack-plugin/tslint.json diff --git a/types/case-sensitive-paths-webpack-plugin/case-sensitive-paths-webpack-plugin-tests.ts b/types/case-sensitive-paths-webpack-plugin/case-sensitive-paths-webpack-plugin-tests.ts new file mode 100644 index 0000000000..4ac73dadc9 --- /dev/null +++ b/types/case-sensitive-paths-webpack-plugin/case-sensitive-paths-webpack-plugin-tests.ts @@ -0,0 +1,11 @@ +import { Configuration } from 'webpack'; +import * as CaseSensitivePathsWebpackPlugin from 'case-sensitive-paths-webpack-plugin'; + +const c: Configuration = { + plugins: [ + new CaseSensitivePathsWebpackPlugin(), + new CaseSensitivePathsWebpackPlugin({ + debug: true + }), + ], +}; diff --git a/types/case-sensitive-paths-webpack-plugin/index.d.ts b/types/case-sensitive-paths-webpack-plugin/index.d.ts new file mode 100644 index 0000000000..360d3d6d08 --- /dev/null +++ b/types/case-sensitive-paths-webpack-plugin/index.d.ts @@ -0,0 +1,21 @@ +// Type definitions for case-sensitive-paths-webpack-plugin 2.1 +// Project: https://github.com/Urthen/case-sensitive-paths-webpack-plugin#readme +// Definitions by: Andrew Makarov +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import { Plugin } from 'webpack'; + +export = CaseSensitivePathsWebpackPlugin; + +declare class CaseSensitivePathsWebpackPlugin extends Plugin { + constructor(options?: CaseSensitivePathsWebpackPlugin.Options); +} + +declare namespace CaseSensitivePathsWebpackPlugin { + interface Options { + /** + * Show more information + */ + debug?: boolean; + } +} diff --git a/types/case-sensitive-paths-webpack-plugin/tsconfig.json b/types/case-sensitive-paths-webpack-plugin/tsconfig.json new file mode 100644 index 0000000000..b8cb05390a --- /dev/null +++ b/types/case-sensitive-paths-webpack-plugin/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", + "case-sensitive-paths-webpack-plugin-tests.ts" + ] +} diff --git a/types/case-sensitive-paths-webpack-plugin/tslint.json b/types/case-sensitive-paths-webpack-plugin/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/case-sensitive-paths-webpack-plugin/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 21a6375a9902187a92b20f68a57753490d64908b Mon Sep 17 00:00:00 2001 From: Andrew Makarov Date: Thu, 16 Nov 2017 02:11:17 +0300 Subject: [PATCH 19/46] [webpack-manifest-plugin] Added typings --- types/webpack-manifest-plugin/index.d.ts | 84 +++++++++++++++++++ types/webpack-manifest-plugin/tsconfig.json | 23 +++++ types/webpack-manifest-plugin/tslint.json | 1 + .../webpack-manifest-plugin-tests.ts | 15 ++++ 4 files changed, 123 insertions(+) create mode 100644 types/webpack-manifest-plugin/index.d.ts create mode 100644 types/webpack-manifest-plugin/tsconfig.json create mode 100644 types/webpack-manifest-plugin/tslint.json create mode 100644 types/webpack-manifest-plugin/webpack-manifest-plugin-tests.ts diff --git a/types/webpack-manifest-plugin/index.d.ts b/types/webpack-manifest-plugin/index.d.ts new file mode 100644 index 0000000000..736bcedef7 --- /dev/null +++ b/types/webpack-manifest-plugin/index.d.ts @@ -0,0 +1,84 @@ +// Type definitions for webpack-manifest-plugin 1.3 +// Project: https://github.com/danethurber/webpack-manifest-plugin +// Definitions by: Andrew Makarov +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +import { Plugin } from 'webpack'; + +export = WebpackManifestPlugin; + +declare class WebpackManifestPlugin extends Plugin { + constructor(options?: WebpackManifestPlugin.Options); +} + +declare namespace WebpackManifestPlugin { + interface Chunk { + id: string; + parents: string[]; + [propName: string]: any; + } + + interface HooksOptions { + path?: string; + chunk?: Chunk; + name?: string; + isChunk?: boolean; + isInitial?: boolean; + isAsset?: boolean; + isModuleAsset?: boolean; + } + + interface Options { + /** + * The manifest filename in your output directory. + * Default: manifest.json + */ + filename?: string; + + /** + * A path prefix for all file references. Useful for including your output path in the manifest. + */ + basePath?: string; + + /** + * A path prefix used only on output files, similar to Webpack's output.publicPath. Ignored if basePath was also provided. + */ + publicPath?: string; + + /** + * Removes unwanted strings from source filenames. + */ + stripSrc?: string | RegExp; + + /** + * If set to true will emit to build folder and memory in combination with webpack-dev-server + * Default: false + */ + writeToFileEmit?: boolean; + + /** + * A cache of key/value pairs to used to seed the manifest. This may include a set of custom key/value pairs to include in your manifest, + * or may be used to combine manifests across compilations in multi-compiler mode. + * To combine manifests, pass a shared seed object to each compiler's ManifestPlugin instance. + * Default: {} + */ + seed?: object; + + /** + * Filter out files. + */ + filter?: (options: HooksOptions) => void; + + /** + * Modify files details before the manifest is created. + */ + map?: (options: HooksOptions) => void; + + /** + * Create the manifest. It can return anything as long as it's serialisable by JSON.stringify. Use the seed options to populate manifest. + * Default: (manifest, {name, path}) => ({...manifest, [name]: path}) + */ + reduce?: (options: HooksOptions) => void; + } +} diff --git a/types/webpack-manifest-plugin/tsconfig.json b/types/webpack-manifest-plugin/tsconfig.json new file mode 100644 index 0000000000..9ff3d85f05 --- /dev/null +++ b/types/webpack-manifest-plugin/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", + "webpack-manifest-plugin-tests.ts" + ] +} diff --git a/types/webpack-manifest-plugin/tslint.json b/types/webpack-manifest-plugin/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/webpack-manifest-plugin/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/webpack-manifest-plugin/webpack-manifest-plugin-tests.ts b/types/webpack-manifest-plugin/webpack-manifest-plugin-tests.ts new file mode 100644 index 0000000000..aae6739a4d --- /dev/null +++ b/types/webpack-manifest-plugin/webpack-manifest-plugin-tests.ts @@ -0,0 +1,15 @@ +import { Configuration } from 'webpack'; +import * as WebpackManifestPlugin from 'webpack-manifest-plugin'; + +const c: Configuration = { + plugins: [ + new WebpackManifestPlugin(), + new WebpackManifestPlugin({ + filename: 'my-manifest.json', + basePath: '/app/', + seed: { + name: 'My Manifest', + }, + }), + ], +}; From 4e59af1992aafff6774ec951fd7ab5325fe87bbf Mon Sep 17 00:00:00 2001 From: Andrew Makarov Date: Thu, 16 Nov 2017 02:38:01 +0300 Subject: [PATCH 20/46] [react-native-datepicker] add typings for version 1.6 --- types/react-native-datepicker/index.d.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/types/react-native-datepicker/index.d.ts b/types/react-native-datepicker/index.d.ts index 7d2fd0c21e..548de52db4 100644 --- a/types/react-native-datepicker/index.d.ts +++ b/types/react-native-datepicker/index.d.ts @@ -1,16 +1,20 @@ -// Type definitions for react-native-datepicker 1.4 +// Type definitions for react-native-datepicker 1.6 // Project: https://github.com/xgfe/react-native-datepicker // Definitions by: Jacob Baskin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 import * as React from 'react'; +import { ImageURISource } from 'react-native'; export interface DatePickerProps { mode?: 'date' | 'datetime' | 'time'; androidMode?: 'default' | 'calendar' | 'spinner'; date?: string | Date; format?: string; + iconSource?: ImageURISource; + iconComponent?: JSX.Element; + hideText?: boolean; minDate?: string | Date; maxDate?: string | Date; height?: number; @@ -20,12 +24,16 @@ export interface DatePickerProps { showIcon?: boolean; disabled?: boolean; onDateChange?(dateStr: string, date: Date): void; + onOpenModal?: () => void; + onCloseModal?: () => void; + onPressMask?: () => void; placeholder?: string; modalOnResponderTerminationRequest?(e: any): boolean; is24Hour?: boolean; style?: any; customStyles?: any; minuteInterval?: number; + TouchableComponent?: React.Component; } declare class DatePicker extends React.Component { From fea4f65365e7915fb1b7ae1124da71e6cb191e3b Mon Sep 17 00:00:00 2001 From: Christian Svensson Date: Thu, 16 Nov 2017 00:58:26 +0100 Subject: [PATCH 21/46] added input option, removed deprecated entry "entry" is deprecated. "input" property should be used to select entry file: https://github.com/rollup/rollup/blob/master/src/rollup/index.js#L71-L76 Also, `string[]` cannot be used for entry/input. Using array results in error. --- types/rollup/index.d.ts | 2 +- types/rollup/rollup-tests.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/types/rollup/index.d.ts b/types/rollup/index.d.ts index 0f7a3e2163..fcad3a9064 100644 --- a/types/rollup/index.d.ts +++ b/types/rollup/index.d.ts @@ -86,7 +86,7 @@ export interface Bundle { export interface Options { /** The bundle's entry point (e.g. your `main.js` or `app.js` or `index.js`) */ - entry: string | string[] + input: string /** A previous bundle. Use it to speed up subsequent bundles :) */ cache?: Bundle /** diff --git a/types/rollup/rollup-tests.ts b/types/rollup/rollup-tests.ts index b600fe25ee..43ef6aa2bf 100644 --- a/types/rollup/rollup-tests.ts +++ b/types/rollup/rollup-tests.ts @@ -4,7 +4,7 @@ let cache: Bundle | undefined async function main() { const bundle = await rollup({ - entry: 'main.js', + input: 'main.js', cache, }) From 2813d29432e9a5e40296cf4ab7de02f90366be7d Mon Sep 17 00:00:00 2001 From: Christian Svensson Date: Thu, 16 Nov 2017 01:41:40 +0100 Subject: [PATCH 22/46] added additional test code --- types/rollup/rollup-tests.ts | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/types/rollup/rollup-tests.ts b/types/rollup/rollup-tests.ts index 43ef6aa2bf..ddbd099e16 100644 --- a/types/rollup/rollup-tests.ts +++ b/types/rollup/rollup-tests.ts @@ -1,15 +1,25 @@ -import { rollup, Bundle } from 'rollup' +import { rollup, Bundle, Plugin } from 'rollup' let cache: Bundle | undefined +let plugin: Plugin async function main() { const bundle = await rollup({ input: 'main.js', + external: ['external-module'], + plugins: [plugin], cache, }) + const bundle2 = await rollup({ + input: 'main.js', + external: id => /^rxjs/.test(id), + plugins: plugin + }) + const result = bundle.generate({ format: 'cjs', + indent: false, }) cache = bundle @@ -17,6 +27,15 @@ async function main() { await bundle.write({ format: 'cjs', dest: 'bundle.js', + globals: { + jquery: '$', + lodash: '_', + }, + banner: '/* Banner */', + footer: '/* Footer */', + intro: 'var ENV = "production";', + outro: 'var VERSION = "1.0.0";', + indent: ' ', }) } From d97047d4f561a0787cedf2a4d3ad1eb7e3ccd7aa Mon Sep 17 00:00:00 2001 From: Christian Svensson Date: Thu, 16 Nov 2017 02:17:44 +0100 Subject: [PATCH 23/46] Updated deprecated and moved properties Renamed properties: https://github.com/rollup/rollup/blob/6fc2088bfaf6b47b7225223398d1335f167a0aea/src/rollup/index.js#L82-L88 Paths as an output option: https://github.com/rollup/rollup/blob/master/CHANGELOG.md#0482 --- types/rollup/index.d.ts | 32 ++++++++++++++++---------------- types/rollup/rollup-tests.ts | 20 +++++++++++++++++++- 2 files changed, 35 insertions(+), 17 deletions(-) diff --git a/types/rollup/index.d.ts b/types/rollup/index.d.ts index fcad3a9064..19dcb12f27 100644 --- a/types/rollup/index.d.ts +++ b/types/rollup/index.d.ts @@ -29,9 +29,14 @@ export interface BundleOptions { /** An ID to use for AMD/UMD bundles. */ moduleId?: string /** The name to use for the module for UMD/IIFE bundles (required for bundles with exports). */ - moduleName?: string + name?: string /** Mapping of IDs → global variable names. Used for UMD/IIFE bundles. */ globals?: { [id: string]: string } + /** + * Function that takes an ID and returns a path, or Object of id: path pairs. + * Where supplied, these paths will be used in the generated bundle instead of the module ID, allowing you to (for example) load dependencies from a CDN. + */ + paths?: ((id: string) => string) | { [id: string]: string } /** * The indent string to use, for formats that require code to be indented (AMD, IIFE, UMD). * Can also be false (no indent), or true (the default – auto-indent) @@ -55,26 +60,26 @@ export interface BundleOptions { * Whether to include the 'use strict' pragma at the top of generated non-ES6 bundles. * Strictly-speaking (geddit?), ES6 modules are always in strict mode, so you shouldn't disable this without good reason. */ - useStrict?: boolean + strict?: boolean } export interface GenerateOptions extends BundleOptions { /** Whether to generate a sourcemap. If true, the return value from `bundle.generate(...)` will include a map property */ - sourceMap?: boolean + sourcemap?: boolean /** * The location of the generated bundle. If this is an absolute path, all the sources paths in the sourcemap will be relative to it. - * The map.file property is the basename of sourceMapFile, as the location of the sourcemap is assumed to be adjacent to the bundle. + * The map.file property is the basename of sourcemapFile, as the location of the sourcemap is assumed to be adjacent to the bundle. */ - sourceMapFile?: string + sourcemapFile?: string } export interface WriteOptions extends BundleOptions { - /** The file to write to. If `options.sourceMap === true`, two files will be created – `dest` and `dest + '.map`. */ - dest: string - /** If `true`, a separate sourcemap file will be created. If `'inline'`, the sourcemap will be appended to the resulting dest file as a data URI. */ - sourceMap?: boolean | 'inline' - /** This option is unnecessary, as it defaults to the value of dest. */ - sourceMapFile?: string + /** The file to write to. If `options.sourcemap === true`, two files will be created – `file` and `file + '.map`. */ + file: string + /** If `true`, a separate sourcemap file will be created. If `'inline'`, the sourcemap will be appended to the resulting file as a data URI. */ + sourcemap?: boolean | 'inline' + /** This option is unnecessary, as it defaults to the value of file. */ + sourcemapFile?: string } export interface Bundle { @@ -94,11 +99,6 @@ export interface Options { * The IDs should be either the name of an external dependency or a resolved ID (like an absolute path to a file) */ external?: ((id: string) => boolean) | string[] - /** - * Function that takes an ID and returns a path, or Object of id: path pairs. - * Where supplied, these paths will be used in the generated bundle instead of the module ID, allowing you to (for example) load dependencies from a CDN. - */ - paths?: ((id: string) => string) | { [id: string]: string } /** Function that will intercept warning messages. If not supplied, warnings will be deduplicated and printed to the console. */ onwarn?(warning: Warning): void /** Array of plugin objects or a single plugin object */ diff --git a/types/rollup/rollup-tests.ts b/types/rollup/rollup-tests.ts index ddbd099e16..4c0e95a1a6 100644 --- a/types/rollup/rollup-tests.ts +++ b/types/rollup/rollup-tests.ts @@ -1,5 +1,7 @@ import { rollup, Bundle, Plugin } from 'rollup' +let console: any + let cache: Bundle | undefined let plugin: Plugin @@ -8,6 +10,16 @@ async function main() { input: 'main.js', external: ['external-module'], plugins: [plugin], + onwarn: ({ code, frame, loc, message }) => { + if (loc) { + const { file, line, column } = loc + console.log(`[${code}] - ${file}(${line},${column}): ${message}`) + } else { + console.log(`[${code}] - ${message}`) + } + + if (frame) console.warn(frame) + }, cache, }) @@ -20,13 +32,16 @@ async function main() { const result = bundle.generate({ format: 'cjs', indent: false, + sourcemap: true, }) cache = bundle await bundle.write({ format: 'cjs', - dest: 'bundle.js', + file: 'bundle.js', + name: 'myLib', + interop: false, globals: { jquery: '$', lodash: '_', @@ -36,6 +51,9 @@ async function main() { intro: 'var ENV = "production";', outro: 'var VERSION = "1.0.0";', indent: ' ', + sourcemap: 'inline', + sourcemapFile: 'bundle.js.map', + strict: true, }) } From 139e3769dc3e191284ff119cbf596a674bff097f Mon Sep 17 00:00:00 2001 From: Christian Svensson Date: Thu, 16 Nov 2017 02:30:49 +0100 Subject: [PATCH 24/46] Generate returns a promise https://github.com/rollup/rollup/blob/master/src/rollup/index.js#L157-L188 "map" will be null if GenerateOptions.sourceMap is false --- types/rollup/index.d.ts | 2 +- types/rollup/rollup-tests.ts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/types/rollup/index.d.ts b/types/rollup/index.d.ts index 19dcb12f27..f4afd2c804 100644 --- a/types/rollup/index.d.ts +++ b/types/rollup/index.d.ts @@ -84,7 +84,7 @@ export interface WriteOptions extends BundleOptions { export interface Bundle { /** Generate bundled code as an object */ - generate(options: GenerateOptions): { code: string, map: SourceMap } + generate(options: GenerateOptions): Promise<{ code: string, map: SourceMap | null }> /** writes the file (and accompanying sourcemap file, if appropriate) to the file system. */ write(options: WriteOptions): Promise } diff --git a/types/rollup/rollup-tests.ts b/types/rollup/rollup-tests.ts index 4c0e95a1a6..b3306ef7f3 100644 --- a/types/rollup/rollup-tests.ts +++ b/types/rollup/rollup-tests.ts @@ -29,12 +29,14 @@ async function main() { plugins: plugin }) - const result = bundle.generate({ + const { code, map } = await bundle.generate({ format: 'cjs', indent: false, sourcemap: true, }) + console.log(code, map) + cache = bundle await bundle.write({ From 00fa22a35ea9617a4019ab793ad7ff8f8bed0884 Mon Sep 17 00:00:00 2001 From: Christian Svensson Date: Thu, 16 Nov 2017 02:46:01 +0100 Subject: [PATCH 25/46] Transform method for plugins has correct 'this' context See link for more info: https://github.com/rollup/rollup/wiki/Plugins#warnings-and-errors --- types/rollup/index.d.ts | 10 +++++++++- types/rollup/rollup-tests.ts | 14 +++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/types/rollup/index.d.ts b/types/rollup/index.d.ts index f4afd2c804..6e980fde6e 100644 --- a/types/rollup/index.d.ts +++ b/types/rollup/index.d.ts @@ -133,7 +133,7 @@ export interface Plugin { */ resolveId?(importee: string, importer: string): string | null | undefined | false | 0 | '' /** A module transformer function */ - transform?(source: string, id: string): string | { code: string, map: SourceMap } + transform?(this: TransformContext, source: string, id: string): string | { code: string, map: SourceMap } /** A bundle transformer function */ transformBundle?(source: string, options: { format: Format }): string | { code: string, map: SourceMap } /** Function hook called when bundle.generate() is being executed. */ @@ -150,5 +150,13 @@ export interface Plugin { footer?: string | (() => string) } +// See https://github.com/rollup/rollup/wiki/Plugins#warnings-and-errors +export interface TransformContext { + /** Emit warnings to Rollup which will be logged during bundling */ + warn(message: string | { message: string }, pos?: number | { line: number, column: number }): void; + /** Emit an error, which will abort the bundling process */ + error(message: string | { message: string }, pos?: number | { line: number, column: number }): void; +} + /** Returns a Promise that resolves with a bundle */ export function rollup(options: Options): Promise diff --git a/types/rollup/rollup-tests.ts b/types/rollup/rollup-tests.ts index b3306ef7f3..90c9569d11 100644 --- a/types/rollup/rollup-tests.ts +++ b/types/rollup/rollup-tests.ts @@ -3,7 +3,19 @@ import { rollup, Bundle, Plugin } from 'rollup' let console: any let cache: Bundle | undefined -let plugin: Plugin +let plugin: Plugin = { + name: 'test-plugin', + transform(source, id) { + if (id === 'rxjs') { + this.error(new Error(`Don't import this directly`)) + } + let indexOfQuote = source.indexOf('"') + if (indexOfQuote >= 0) { + this.warn(`Prefer ' over " for strings`, indexOfQuote) + } + return source + } +} async function main() { const bundle = await rollup({ From ad97bcd2e3582e6c504a5db946a9a20cb9518102 Mon Sep 17 00:00:00 2001 From: Christian Svensson Date: Thu, 16 Nov 2017 02:51:52 +0100 Subject: [PATCH 26/46] "format" is not optional See Javascript API for details: https://rollupjs.org/#rollup-rollup --- types/rollup/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/rollup/index.d.ts b/types/rollup/index.d.ts index 6e980fde6e..aaf82a07fe 100644 --- a/types/rollup/index.d.ts +++ b/types/rollup/index.d.ts @@ -23,7 +23,7 @@ export interface Warning { export interface BundleOptions { /** The format of the generated bundle. */ - format?: Format + format: Format /** What export mode to use. Defaults to auto, which guesses your intentions based on what the `entry` module exports. */ exports?: 'auto' | 'default' | 'named' | 'none' /** An ID to use for AMD/UMD bundles. */ From bc0c1631e6524963f6f03ce4463be580e963511b Mon Sep 17 00:00:00 2001 From: Christian Svensson Date: Thu, 16 Nov 2017 03:00:18 +0100 Subject: [PATCH 27/46] Added interface for configuration files See https://rollupjs.org/#configuration-files for the format --- types/rollup/index.d.ts | 4 ++++ types/rollup/rollup-tests.ts | 25 ++++++++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/types/rollup/index.d.ts b/types/rollup/index.d.ts index aaf82a07fe..41deabb9aa 100644 --- a/types/rollup/index.d.ts +++ b/types/rollup/index.d.ts @@ -118,6 +118,10 @@ export interface Options { legacy?: boolean } +export interface ConfigFileOptions extends Options { + output: WriteOptions | WriteOptions[] +} + // https://github.com/rollup/rollup/wiki/Plugins#creating-plugins export interface Plugin { /** The name of the plugin, for use in error messages and warnings */ diff --git a/types/rollup/rollup-tests.ts b/types/rollup/rollup-tests.ts index 90c9569d11..4c745b70f4 100644 --- a/types/rollup/rollup-tests.ts +++ b/types/rollup/rollup-tests.ts @@ -1,4 +1,4 @@ -import { rollup, Bundle, Plugin } from 'rollup' +import { rollup, Bundle, Plugin, ConfigFileOptions } from 'rollup' let console: any @@ -72,3 +72,26 @@ async function main() { } main() + + +export const defaultConfig: ConfigFileOptions = { + input: 'main.js', + output: { + file: 'bundle.js', + format: 'iife', + } +} + +export const multiConfig: ConfigFileOptions = { + input: 'main.js', + output: [ + { + file: 'bundle.esm.js', + format: 'es', + }, + { + file: 'bundle.cjs.js', + format: 'cjs', + } + ] +} From 0cc1edd2c6f91f99f8dea66b22d819602b8428ce Mon Sep 17 00:00:00 2001 From: Christian Svensson Date: Thu, 16 Nov 2017 03:12:45 +0100 Subject: [PATCH 28/46] Linting and add me to authors --- types/rollup/index.d.ts | 6 +++--- types/rollup/rollup-tests.ts | 7 +++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/types/rollup/index.d.ts b/types/rollup/index.d.ts index 41deabb9aa..092c0d078e 100644 --- a/types/rollup/index.d.ts +++ b/types/rollup/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for rollup 0.41 // Project: https://github.com/rollup/rollup -// Definitions by: Philipp A. +// Definitions by: Philipp A. , Christian Svensson // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped import { RawSourceMap } from 'source-map' @@ -157,9 +157,9 @@ export interface Plugin { // See https://github.com/rollup/rollup/wiki/Plugins#warnings-and-errors export interface TransformContext { /** Emit warnings to Rollup which will be logged during bundling */ - warn(message: string | { message: string }, pos?: number | { line: number, column: number }): void; + warn(message: string | { message: string }, pos?: number | { line: number, column: number }): void /** Emit an error, which will abort the bundling process */ - error(message: string | { message: string }, pos?: number | { line: number, column: number }): void; + error(message: string | { message: string }, pos?: number | { line: number, column: number }): void } /** Returns a Promise that resolves with a bundle */ diff --git a/types/rollup/rollup-tests.ts b/types/rollup/rollup-tests.ts index 4c745b70f4..924e675373 100644 --- a/types/rollup/rollup-tests.ts +++ b/types/rollup/rollup-tests.ts @@ -1,15 +1,15 @@ import { rollup, Bundle, Plugin, ConfigFileOptions } from 'rollup' -let console: any +declare const console: { log(...messages: any[]): void, warn(message: string): void } let cache: Bundle | undefined -let plugin: Plugin = { +const plugin: Plugin = { name: 'test-plugin', transform(source, id) { if (id === 'rxjs') { this.error(new Error(`Don't import this directly`)) } - let indexOfQuote = source.indexOf('"') + const indexOfQuote = source.indexOf('"') if (indexOfQuote >= 0) { this.warn(`Prefer ' over " for strings`, indexOfQuote) } @@ -73,7 +73,6 @@ async function main() { main() - export const defaultConfig: ConfigFileOptions = { input: 'main.js', output: { From b49d02fae12600fac11dc8ef51c1dc39e4403289 Mon Sep 17 00:00:00 2001 From: Christian Svensson Date: Thu, 16 Nov 2017 03:25:08 +0100 Subject: [PATCH 29/46] Updated the targeted rollup version --- types/rollup/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/rollup/index.d.ts b/types/rollup/index.d.ts index 092c0d078e..946b4f6786 100644 --- a/types/rollup/index.d.ts +++ b/types/rollup/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for rollup 0.41 +// Type definitions for rollup 0.51 // Project: https://github.com/rollup/rollup // Definitions by: Philipp A. , Christian Svensson // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 7e61489f7dee34227e77cc0afeb5c34107822e3c Mon Sep 17 00:00:00 2001 From: Ebrahim Date: Thu, 16 Nov 2017 07:13:38 +0330 Subject: [PATCH 30/46] [ioredis] added multi() non-pipelined overload --- types/ioredis/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/ioredis/index.d.ts b/types/ioredis/index.d.ts index 6cb165c9bd..ec1dbe3512 100644 --- a/types/ioredis/index.d.ts +++ b/types/ioredis/index.d.ts @@ -346,6 +346,7 @@ declare namespace IORedis { type(key: string): Promise; multi(commands?: string[][], options?: MultiOptions): Pipeline; + multi(options: { pipeline: false }): Promise; exec(callback: (err: Error, res: any) => void): void; exec(): Promise; From 04ee02e9c8c44ed26e4a7f3d8729af59da9d5289 Mon Sep 17 00:00:00 2001 From: Thomas Chandelle Date: Thu, 16 Nov 2017 08:53:18 +0100 Subject: [PATCH 31/46] Make the arguments non-optional, they will always be set by Chart.js --- types/chart.js/index.d.ts | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/types/chart.js/index.d.ts b/types/chart.js/index.d.ts index 51bbc3b49e..549c8041ab 100644 --- a/types/chart.js/index.d.ts +++ b/types/chart.js/index.d.ts @@ -120,19 +120,19 @@ declare namespace Chart { } interface ChartTooltipCallback { - beforeTitle?(item?: ChartTooltipItem[], data?: ChartData): string | string[]; - title?(item?: ChartTooltipItem[], data?: ChartData): string | string[]; - afterTitle?(item?: ChartTooltipItem[], data?: ChartData): string | string[]; - beforeBody?(item?: ChartTooltipItem[], data?: ChartData): string | string[]; - beforeLabel?(tooltipItem?: ChartTooltipItem, data?: ChartData): string | string[]; - label?(tooltipItem?: ChartTooltipItem, data?: ChartData): string | string[]; - labelColor?(tooltipItem?: ChartTooltipItem, chart?: Chart): ChartTooltipLabelColor; - labelTextColor?(tooltipItem?: ChartTooltipItem, chart?: Chart): string; - afterLabel?(tooltipItem?: ChartTooltipItem, data?: ChartData): string | string[]; - afterBody?(item?: ChartTooltipItem[], data?: ChartData): string | string[]; - beforeFooter?(item?: ChartTooltipItem[], data?: ChartData): string | string[]; - footer?(item?: ChartTooltipItem[], data?: ChartData): string | string[]; - afterFooter?(item?: ChartTooltipItem[], data?: ChartData): string | string[]; + beforeTitle?(item: ChartTooltipItem[], data: ChartData): string | string[]; + title?(item: ChartTooltipItem[], data: ChartData): string | string[]; + afterTitle?(item: ChartTooltipItem[], data: ChartData): string | string[]; + beforeBody?(item: ChartTooltipItem[], data: ChartData): string | string[]; + beforeLabel?(tooltipItem: ChartTooltipItem, data: ChartData): string | string[]; + label?(tooltipItem: ChartTooltipItem, data: ChartData): string | string[]; + labelColor?(tooltipItem: ChartTooltipItem, chart: Chart): ChartTooltipLabelColor; + labelTextColor?(tooltipItem: ChartTooltipItem, chart: Chart): string; + afterLabel?(tooltipItem: ChartTooltipItem, data: ChartData): string | string[]; + afterBody?(item: ChartTooltipItem[], data: ChartData): string | string[]; + beforeFooter?(item: ChartTooltipItem[], data: ChartData): string | string[]; + footer?(item: ChartTooltipItem[], data: ChartData): string | string[]; + afterFooter?(item: ChartTooltipItem[], data: ChartData): string | string[]; } interface ChartAnimationParameter { From 6a0ff2107446c2a8ad8dbae16d8d06440b91886a Mon Sep 17 00:00:00 2001 From: Konrad Mattheis Date: Thu, 16 Nov 2017 09:34:21 +0100 Subject: [PATCH 32/46] codereview changes --- types/enigma.js/enigma.js-tests.ts | 10 ++++++---- types/enigma.js/index.d.ts | 14 ++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/types/enigma.js/enigma.js-tests.ts b/types/enigma.js/enigma.js-tests.ts index 6a88b2d2ff..10f6aae226 100644 --- a/types/enigma.js/enigma.js-tests.ts +++ b/types/enigma.js/enigma.js-tests.ts @@ -1,8 +1,10 @@ import * as enigma from "enigma.js"; +// import enigma = require("enigma.js"); -enigma.create({ - url: "http://127.0.0.1:4848/", - schema: {} -}).open().then((global) => { +const config: enigmaJS.IConfig = { + url: "http://127.0.0.1:4848/", + schema: {} + }; +enigma.create(config).open().then((global) => { console.log("connect fine"); }); diff --git a/types/enigma.js/index.d.ts b/types/enigma.js/index.d.ts index 29a5dcfb5b..38fc18da16 100644 --- a/types/enigma.js/index.d.ts +++ b/types/enigma.js/index.d.ts @@ -5,11 +5,15 @@ // TypeScript Version: 2.2 declare module "enigma.js" { - const e: IEnigmaJSClass; + const e: IEnigmaClass; export = e; } -interface IEnigmaJSClass { +// declare const enigmaJS: IEnigmaClass; +// export = enigmaJS; +// export as namespace enigmaJS; + +interface IEnigmaClass { /** * Create a session object. * @returns - Returns a session. @@ -94,12 +98,6 @@ declare namespace enigmaJS { } interface ISession { - /** - * Establishes the websocket against the configured URL. Eventually resolved with the QIX global interface when the connection has been established. - * @return Promise. - */ - open(): Promise; - /** * Establishes the websocket against the configured URL. Eventually resolved with the QIX global interface when the connection has been established. * @return Promise. From d561d987680396e10bb47268d07840b69a1a15a9 Mon Sep 17 00:00:00 2001 From: Kevin Date: Thu, 16 Nov 2017 10:07:21 +0100 Subject: [PATCH 33/46] Add missings typings --- types/react-onsenui/index.d.ts | 70 +++++++++++++++++---- types/react-onsenui/react-onsenui-tests.tsx | 10 +-- 2 files changed, 63 insertions(+), 17 deletions(-) diff --git a/types/react-onsenui/index.d.ts b/types/react-onsenui/index.d.ts index a910b94adf..72cd5658e8 100644 --- a/types/react-onsenui/index.d.ts +++ b/types/react-onsenui/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for React OnSenui (react-onsenui) 2.1 +// Type definitions for React OnSenui (react-onsenui) 2.7 // Project: https://onsen.io/v2/docs/guide/react/ // Definitions by: Ozytis // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -48,7 +48,9 @@ export class Splitter extends Component { } /*** toolbar ***/ -export class Toolbar extends Component {} +export class Toolbar extends Component<{ + modifier?: string +}, any> {} export class BottomToolbar extends Component<{ modifier?: string @@ -57,7 +59,7 @@ export class BottomToolbar extends Component<{ export class ToolbarButton extends Component<{ modifier?: string, disabled?: boolean, - onClick?(e?: Event): void + onClick?(e?: React.MouseEvent): void }, any> {} /*** icon ***/ @@ -101,7 +103,7 @@ export class BackButton extends Component<{ }, any> {} export class Navigator extends Component<{ - renderPage(route: any, navigator: Navigator): JSX.Element, + renderPage(route: any): JSX.Element, initialRouteStack?: string[], initialRoute?: any, onPrePush?(): void, @@ -109,8 +111,10 @@ export class Navigator extends Component<{ onPrePop?(): void, onPostPop?(): void, animation?: "slide" | "lift" | "fade" | "none" | string, - animationOptions?: AnimationOptions + animationOptions?: AnimationOptions, }, any> { + pages: any[]; + routes: any[]; resetPage(route: any, options?: any): void; resetPageStack(route: any, options?: any): void; pushPage(route: any, options?: any): void; @@ -196,6 +200,29 @@ export class Popover extends Component<{ onPostHide?(): void, }, any> {} +export class ActionSheet extends Component<{ + onCancel?(): void, + isOpen?: boolean, + isCancelable?: boolean, + isDisabled?: boolean, + animation?: string, + modifier?: string + maskColor?: string, + animationOptions?: {}, + title?: string + onPreShow?(): void, + onPostShow?(): void, + onPreHide?(): void, + onPostHide?(): void, + onDeviceBackButton?(): void +}, any> {} + +export class ActionSheetButton extends Component<{ + modifier?: string, + icon?: string, + onClick?(e?: React.MouseEvent): void +}, any> {} + export class ProgressBar extends Component<{ modifier?: string, value?: number, @@ -222,20 +249,21 @@ export class Fab extends Component<{ ripple?: boolean, position?: string, disabled?: boolean, - onClick?: React.MouseEventHandler, + onClick?(e?: React.MouseEvent): void, }, any> {} export class Button extends Component<{ modifier?: string, disabled?: boolean, ripple?: boolean, - onClick?: React.MouseEventHandler, + className?: string, + onClick?(e?: React.MouseEvent): void }, any> {} export class Input extends Component<{ modifier?: string, disabled?: boolean, - onChange?: React.ChangeEventHandler, + onChange?: (e: React.ChangeEvent) => void, value?: string, checked?: boolean, placeholder?: string, @@ -243,18 +271,36 @@ export class Input extends Component<{ inputId?: string, float?: boolean, name?: string, + className?: string +}, any> {} + +export class Radio extends Component<{ + modifier?: string, + disabled?: boolean, + onChange?(e: Event): void, + value?: string, + checked?: boolean, + inputId?: string +}, any> {} + +export class Checkbox extends Component<{ + modifier?: string, + disabled?: boolean, + onChange?(e: Event): void, + value?: string, + checked?: boolean, + inputId?: string }, any> {} export class Range extends Component<{ modifier?: string, - onChange?: React.ChangeEventHandler, + onChange?(e: Event): void, value?: number, disabled?: boolean, }, any> {} export class Switch extends Component<{ - modifier?: string, - onChange?: React.ChangeEventHandler, + onChange?(e: Event): void, checked?: boolean, disabled?: boolean, inputId?: string @@ -309,7 +355,7 @@ export class ListItem extends Component<{ tappable?: boolean, tapBackgroundColor?: string, lockOnDrag?: boolean, - onClick?: React.MouseEventHandler, + onClick?: React.MouseEventHandler, }, any> {} export class Card extends Component { } diff --git a/types/react-onsenui/react-onsenui-tests.tsx b/types/react-onsenui/react-onsenui-tests.tsx index 9d5c86682f..fc472b96d6 100644 --- a/types/react-onsenui/react-onsenui-tests.tsx +++ b/types/react-onsenui/react-onsenui-tests.tsx @@ -21,6 +21,9 @@ export class App extends React.Component { this.setState({ isOpen: false }); } + onChange(event: React.ChangeEvent) {} + onClick(event: React.MouseEvent) {} + render() { return ( @@ -37,8 +40,8 @@ export class App extends React.Component { Test page - -