From 057754cfd31cf552d2617769667109a7441761ca Mon Sep 17 00:00:00 2001 From: aj-r Date: Sat, 23 Dec 2017 12:34:07 -0500 Subject: [PATCH 001/575] lodash: _.get should with numeric keys, too. Also added some better tests. --- types/lodash/index.d.ts | 51 ++++++++++++++++++++++++++++++++++++ types/lodash/lodash-tests.ts | 20 ++++++++++++-- 2 files changed, 69 insertions(+), 2 deletions(-) diff --git a/types/lodash/index.d.ts b/types/lodash/index.d.ts index caa92006b8..cc90e15559 100644 --- a/types/lodash/index.d.ts +++ b/types/lodash/index.d.ts @@ -13372,6 +13372,23 @@ declare namespace _ { defaultValue: TDefault ): TObject[TKey] | TDefault; + /** + * @see _.get + */ + get( + object: NumericDictionary | null | undefined, + path: number + ): T | undefined; + + /** + * @see _.get + */ + get( + object: NumericDictionary | null | undefined, + path: number, + defaultValue: TDefault + ): T | TDefault; + /** * @see _.get */ @@ -13424,6 +13441,23 @@ declare namespace _ { defaultValue: TDefault ): TObject[TKey] | TDefault; + /** + * @see _.get + */ + get( + this: LoDashImplicitWrapper | null | undefined>, + path: number + ): T | undefined; + + /** + * @see _.get + */ + get( + this: LoDashImplicitWrapper | null | undefined>, + path: number, + defaultValue: TDefault + ): T | TDefault; + /** * @see _.get */ @@ -13475,6 +13509,23 @@ declare namespace _ { defaultValue: TDefault ): LoDashExplicitWrapper; + /** + * @see _.get + */ + get( + this: LoDashExplicitWrapper | null | undefined>, + path: number + ): LoDashExplicitWrapper; + + /** + * @see _.get + */ + get( + this: LoDashExplicitWrapper | null | undefined>, + path: number, + defaultValue: TDefault + ): LoDashExplicitWrapper; + /** * @see _.get */ diff --git a/types/lodash/lodash-tests.ts b/types/lodash/lodash-tests.ts index 774e58ef9f..fe1f1eb9ca 100644 --- a/types/lodash/lodash-tests.ts +++ b/types/lodash/lodash-tests.ts @@ -11266,6 +11266,22 @@ namespace TestGet { _.get([], Symbol.iterator); _.get([], [Symbol.iterator]); + _.get('abc', 4); // $ExpectType string | undefined + _('abc').get(4); // $ExpectType string | undefined + _.chain('abc').get(4); // $ExpectType LoDashExplicitWrapper + + _.get({ a: { b: true } }, "a"); // $ExpectType { b: boolean; } + _({ a: { b: true } }).get("a"); // $ExpectType { b: boolean; } + _.chain({ a: { b: true } }).get("a"); // $ExpectType LoDashExplicitWrapper<{ b: boolean; }> + + _.get({ a: { b: true } }, ["a"]); // $ExpectType { b: boolean; } + _({ a: { b: true } }).get(["a"]); // $ExpectType { b: boolean; } + _.chain({ a: { b: true } }).get(["a"]); // $ExpectType LoDashExplicitWrapper<{ b: boolean; }> + + _.get({ a: { b: true } }, ["a", "b"]); // $ExpectType any + _({ a: { b: true } }).get(["a", "b"]); // $ExpectType any + _.chain({ a: { b: true } }).get(["a", "b"]); // $ExpectType LoDashExplicitWrapper + { let result: string; @@ -11322,7 +11338,7 @@ namespace TestGet { result = _({a: true}).get(['a']); result = _({a: true}).get(['a'], false); } - +/* { let result: _.LoDashExplicitWrapper; @@ -11348,7 +11364,7 @@ namespace TestGet { result = _({a: true}).chain().get('a', false); result = _({a: true}).chain().get(['a']); result = _({a: true}).chain().get(['a'], false); - } + }*/ } // _.has From 6e0532c130119f75734ccb934baf22974b889749 Mon Sep 17 00:00:00 2001 From: AJ Richardson Date: Tue, 2 Jan 2018 09:06:13 -0500 Subject: [PATCH 002/575] lodash: add one more NumericDictionary overload for _.get --- types/lodash/index.d.ts | 24 ++++++++++++++++++++++++ types/lodash/lodash-tests.ts | 10 +++++----- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/types/lodash/index.d.ts b/types/lodash/index.d.ts index cc90e15559..00a1cd63b2 100644 --- a/types/lodash/index.d.ts +++ b/types/lodash/index.d.ts @@ -13372,6 +13372,14 @@ declare namespace _ { defaultValue: TDefault ): TObject[TKey] | TDefault; + /** + * @see _.get + */ + get( + object: NumericDictionary, + path: number + ): T; + /** * @see _.get */ @@ -13441,6 +13449,14 @@ declare namespace _ { defaultValue: TDefault ): TObject[TKey] | TDefault; + /** + * @see _.get + */ + get( + this: LoDashImplicitWrapper>, + path: number + ): T; + /** * @see _.get */ @@ -13509,6 +13525,14 @@ declare namespace _ { defaultValue: TDefault ): LoDashExplicitWrapper; + /** + * @see _.get + */ + get( + this: LoDashExplicitWrapper>, + path: number + ): LoDashExplicitWrapper; + /** * @see _.get */ diff --git a/types/lodash/lodash-tests.ts b/types/lodash/lodash-tests.ts index fe1f1eb9ca..d3886537a1 100644 --- a/types/lodash/lodash-tests.ts +++ b/types/lodash/lodash-tests.ts @@ -11266,9 +11266,9 @@ namespace TestGet { _.get([], Symbol.iterator); _.get([], [Symbol.iterator]); - _.get('abc', 4); // $ExpectType string | undefined - _('abc').get(4); // $ExpectType string | undefined - _.chain('abc').get(4); // $ExpectType LoDashExplicitWrapper + _.get('abc', 4); // $ExpectType string + _('abc').get(4); // $ExpectType string + _.chain('abc').get(4); // $ExpectType LoDashExplicitWrapper _.get({ a: { b: true } }, "a"); // $ExpectType { b: boolean; } _({ a: { b: true } }).get("a"); // $ExpectType { b: boolean; } @@ -11338,7 +11338,7 @@ namespace TestGet { result = _({a: true}).get(['a']); result = _({a: true}).get(['a'], false); } -/* + { let result: _.LoDashExplicitWrapper; @@ -11364,7 +11364,7 @@ namespace TestGet { result = _({a: true}).chain().get('a', false); result = _({a: true}).chain().get(['a']); result = _({a: true}).chain().get(['a'], false); - }*/ + } } // _.has From 5b606cac973d358d6c5141fea915a03b124b16d3 Mon Sep 17 00:00:00 2001 From: AJ Richardson Date: Wed, 3 Jan 2018 18:46:29 -0500 Subject: [PATCH 003/575] lodash: more reasonable index for _.get tests --- types/lodash/lodash-tests.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/lodash/lodash-tests.ts b/types/lodash/lodash-tests.ts index d3886537a1..69fe88b341 100644 --- a/types/lodash/lodash-tests.ts +++ b/types/lodash/lodash-tests.ts @@ -11266,9 +11266,9 @@ namespace TestGet { _.get([], Symbol.iterator); _.get([], [Symbol.iterator]); - _.get('abc', 4); // $ExpectType string - _('abc').get(4); // $ExpectType string - _.chain('abc').get(4); // $ExpectType LoDashExplicitWrapper + _.get('abc', 1); // $ExpectType string + _('abc').get(1); // $ExpectType string + _.chain('abc').get(1); // $ExpectType LoDashExplicitWrapper _.get({ a: { b: true } }, "a"); // $ExpectType { b: boolean; } _({ a: { b: true } }).get("a"); // $ExpectType { b: boolean; } From 04b8281f8760bd2e416806115053dc35db972f43 Mon Sep 17 00:00:00 2001 From: leanazulyoro Date: Mon, 16 Apr 2018 10:28:18 -0300 Subject: [PATCH 004/575] Add definitions for restify's conditionalHandler plugin --- types/restify/index.d.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/types/restify/index.d.ts b/types/restify/index.d.ts index b5f6dd6fe5..30a5220022 100644 --- a/types/restify/index.d.ts +++ b/types/restify/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for restify 5.0 // Project: https://github.com/restify/node-restify -// Definitions by: Bret Little , Steve Hipwell +// Definitions by: Bret Little , Steve Hipwell , Leandro Almeida // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -946,6 +946,17 @@ export namespace plugins { */ function authorizationParser(options?: any): RequestHandler; + interface HandlerCandidate { + handler: RequestHandler | RequestHandler[]; + version?: string | string[]; + contentType?: string | string[]; + } + + /** + * Runs first handler that matches to the condition + */ + function conditionalHandler(candidates: HandlerCandidate | HandlerCandidate[]): RequestHandler[]; + /** * Conditional headers (If-*) */ From b130408774ba0622125682402446ede98f514a08 Mon Sep 17 00:00:00 2001 From: leanazulyoro Date: Mon, 16 Apr 2018 10:36:38 -0300 Subject: [PATCH 005/575] Changed: restify's version in header of definitions --- types/restify/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/restify/index.d.ts b/types/restify/index.d.ts index 30a5220022..8a07519121 100644 --- a/types/restify/index.d.ts +++ b/types/restify/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for restify 5.0 +// Type definitions for restify 7.1.1 // Project: https://github.com/restify/node-restify // Definitions by: Bret Little , Steve Hipwell , Leandro Almeida // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 74a624759ba410b6f941f01d47c9156f49199c62 Mon Sep 17 00:00:00 2001 From: leanazulyoro Date: Mon, 16 Apr 2018 16:46:00 -0300 Subject: [PATCH 006/575] reverted version --- types/restify/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/restify/index.d.ts b/types/restify/index.d.ts index 8a07519121..30a5220022 100644 --- a/types/restify/index.d.ts +++ b/types/restify/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for restify 7.1.1 +// Type definitions for restify 5.0 // Project: https://github.com/restify/node-restify // Definitions by: Bret Little , Steve Hipwell , Leandro Almeida // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 2421842822c0f83801d2af4b825bb4b3f3690584 Mon Sep 17 00:00:00 2001 From: Unknown Date: Fri, 20 Apr 2018 17:27:18 -0600 Subject: [PATCH 007/575] Add definitions for ace-diff --- types/ace-diff/ace-diff-tests.ts | 18 ++++++++++++ types/ace-diff/index.d.ts | 47 ++++++++++++++++++++++++++++++++ types/ace-diff/tsconfig.json | 24 ++++++++++++++++ types/ace-diff/tslint.json | 1 + 4 files changed, 90 insertions(+) create mode 100644 types/ace-diff/ace-diff-tests.ts create mode 100644 types/ace-diff/index.d.ts create mode 100644 types/ace-diff/tsconfig.json create mode 100644 types/ace-diff/tslint.json diff --git a/types/ace-diff/ace-diff-tests.ts b/types/ace-diff/ace-diff-tests.ts new file mode 100644 index 0000000000..9c9eb4cfb9 --- /dev/null +++ b/types/ace-diff/ace-diff-tests.ts @@ -0,0 +1,18 @@ +import AceDiff = require('ace-diff'); + +new AceDiff(); // $ExpectError + +const aceDiffOpts = { + element: '.acediff', + left: { content: 'left content' }, + right: { content: 'left content' }, +}; +new AceDiff(aceDiffOpts); // $ExpectType AceDiff + +const differ = new AceDiff(aceDiffOpts); + +differ.getEditors(); // $ExpectType { left: any; right: any; } +differ.setOptions(); // $ExpectType void +differ.getNumDiffs(); // $ExpectType number +differ.diff(); // $ExpectType void +differ.destroy(); // $ExpectType void diff --git a/types/ace-diff/index.d.ts b/types/ace-diff/index.d.ts new file mode 100644 index 0000000000..f381aedfed --- /dev/null +++ b/types/ace-diff/index.d.ts @@ -0,0 +1,47 @@ +// Type definitions for ace-diff 2.1 +// Project: https://ace-diff.github.io/ace-diff/ +// Definitions by: Mike Dodge +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export as namespace AceDiff; + +export = AceDiff; + +declare class AceDiff { + constructor(opts: AceDiff.AceDiffOpts); + getEditors(): { + left: any; + right: any; + }; + setOptions(): void; + getNumDiffs(): number; + diff(): void; + destroy(): void; +} +declare namespace AceDiff { + interface AceDiffLROpts { + content?: string | null; + mode?: string; + theme?: string; + editable?: boolean; + copyLinkEnabled?: boolean; + } + + interface AceDiffOpts { + element: string | HTMLElement; + mode?: string; + theme?: string; + diffGranularity?: 'specific' | 'broad'; + showDiffs?: boolean; + showConnectors?: boolean; + maxDiffs?: number; + left: AceDiffLROpts; + right: AceDiffLROpts; + classes?: { + diff: string; + connector: string; + newCodeConnectorLinkContent: string; + deletedCodeConnectorLinkContent: string; + }; + } +} diff --git a/types/ace-diff/tsconfig.json b/types/ace-diff/tsconfig.json new file mode 100644 index 0000000000..00fb70bbcd --- /dev/null +++ b/types/ace-diff/tsconfig.json @@ -0,0 +1,24 @@ +{ + "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", + "ace-diff-tests.ts" + ] +} diff --git a/types/ace-diff/tslint.json b/types/ace-diff/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/ace-diff/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 689c9abdb257bc88346a572880fc62df879866d6 Mon Sep 17 00:00:00 2001 From: Wouter van Heeswijk Date: Wed, 25 Apr 2018 11:40:14 +0200 Subject: [PATCH 008/575] .tz() can also return undefined as per the docs --- types/moment-timezone/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/moment-timezone/index.d.ts b/types/moment-timezone/index.d.ts index c3927415c6..727c91cad4 100644 --- a/types/moment-timezone/index.d.ts +++ b/types/moment-timezone/index.d.ts @@ -57,7 +57,7 @@ declare module "moment" { } interface Moment { - tz(): string; + tz(): string | undefined; tz(timezone: string): Moment; zoneAbbr(): string; zoneName(): string; From 7f22b29fc516ad5e4828ab413a979cc574d93c16 Mon Sep 17 00:00:00 2001 From: Wouter van Heeswijk Date: Fri, 27 Apr 2018 20:28:44 +0200 Subject: [PATCH 009/575] Added a test that type checks the .tz() function --- types/moment-timezone/moment-timezone-tests.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/moment-timezone/moment-timezone-tests.ts b/types/moment-timezone/moment-timezone-tests.ts index 66bb7403ea..44b00abf10 100644 --- a/types/moment-timezone/moment-timezone-tests.ts +++ b/types/moment-timezone/moment-timezone-tests.ts @@ -83,3 +83,5 @@ moment.tz.guess(true); const zoneAbbr: string = moment.tz('America/Los_Angeles').zoneAbbr(); const zoneName: string = moment.tz('America/Los_Angeles').zoneName(); + +const zoneType: string | undefined = moment.tz('2013-11-18 11:55').tz(); From c326abb53bce78217cd74fe9f400ffdedcaa2d9b Mon Sep 17 00:00:00 2001 From: Michael Dodge Date: Wed, 2 May 2018 17:05:37 -0600 Subject: [PATCH 010/575] Fix missing setOptions arg --- types/ace-diff/ace-diff-tests.ts | 14 +++++++++----- types/ace-diff/index.d.ts | 15 ++++++++++----- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/types/ace-diff/ace-diff-tests.ts b/types/ace-diff/ace-diff-tests.ts index 9c9eb4cfb9..52e64589a3 100644 --- a/types/ace-diff/ace-diff-tests.ts +++ b/types/ace-diff/ace-diff-tests.ts @@ -2,17 +2,21 @@ import AceDiff = require('ace-diff'); new AceDiff(); // $ExpectError -const aceDiffOpts = { +const aceDiffConstructorOpts = { element: '.acediff', left: { content: 'left content' }, - right: { content: 'left content' }, + right: { content: 'right content' }, }; -new AceDiff(aceDiffOpts); // $ExpectType AceDiff +new AceDiff(aceDiffConstructorOpts); // $ExpectType AceDiff -const differ = new AceDiff(aceDiffOpts); +const differ = new AceDiff(aceDiffConstructorOpts); differ.getEditors(); // $ExpectType { left: any; right: any; } -differ.setOptions(); // $ExpectType void +differ.setOptions(); // $ExpectError +const aceDiffOpts = { + diffGranularity: 'broad' as 'broad', // workaround: cast to avoid https://github.com/Microsoft/TypeScript/issues/11465#issuecomment-252453037 +}; +differ.setOptions(aceDiffOpts); // $ExpectType void differ.getNumDiffs(); // $ExpectType number differ.diff(); // $ExpectType void differ.destroy(); // $ExpectType void diff --git a/types/ace-diff/index.d.ts b/types/ace-diff/index.d.ts index f381aedfed..b59b3d25e2 100644 --- a/types/ace-diff/index.d.ts +++ b/types/ace-diff/index.d.ts @@ -8,12 +8,12 @@ export as namespace AceDiff; export = AceDiff; declare class AceDiff { - constructor(opts: AceDiff.AceDiffOpts); + constructor(opts: AceDiff.AceDiffConstructorOpts); getEditors(): { left: any; right: any; }; - setOptions(): void; + setOptions(options: AceDiff.AceDiffOpts): void; getNumDiffs(): number; diff(): void; destroy(): void; @@ -27,16 +27,21 @@ declare namespace AceDiff { copyLinkEnabled?: boolean; } - interface AceDiffOpts { + interface AceDiffConstructorOpts extends AceDiffOpts { element: string | HTMLElement; + left: AceDiffLROpts; + right: AceDiffLROpts; + } + + interface AceDiffOpts { mode?: string; theme?: string; diffGranularity?: 'specific' | 'broad'; showDiffs?: boolean; showConnectors?: boolean; maxDiffs?: number; - left: AceDiffLROpts; - right: AceDiffLROpts; + left?: AceDiffLROpts; + right?: AceDiffLROpts; classes?: { diff: string; connector: string; From 1e7f4242377340083bb988f6cbc58869b603d44a Mon Sep 17 00:00:00 2001 From: AJ Richardson Date: Thu, 3 May 2018 21:22:50 -0400 Subject: [PATCH 011/575] lodash: improve omit/unset/mergeAll (#25361,#25365,#25382), fix partial --- types/lodash/common/common.d.ts | 3 + types/lodash/common/object.d.ts | 36 ++- types/lodash/fp.d.ts | 329 +++++++++++++++++++++++++--- types/lodash/lodash-tests.ts | 36 +-- types/lodash/scripts/generate-fp.ts | 35 ++- types/lowdb/_lodash.d.ts | 20 +- 6 files changed, 392 insertions(+), 67 deletions(-) diff --git a/types/lodash/common/common.d.ts b/types/lodash/common/common.d.ts index 28c4437073..b5da2a8080 100644 --- a/types/lodash/common/common.d.ts +++ b/types/lodash/common/common.d.ts @@ -217,6 +217,9 @@ declare module "../index" { type PropertyName = string | number | symbol; type PropertyPath = Many; + type Diff = ({ [P in T]: P } & { [P in U]: never } & { [x: string]: never })[T]; + type Omit = Pick>; + /** Common interface between Arrays and jQuery objects */ type List = ArrayLike; diff --git a/types/lodash/common/object.d.ts b/types/lodash/common/object.d.ts index e0b1f3ebf1..5e2d539c23 100644 --- a/types/lodash/common/object.d.ts +++ b/types/lodash/common/object.d.ts @@ -2860,15 +2860,23 @@ declare module "../index" { */ omit( object: T | null | undefined, - ...paths: PropertyPath[] + ...paths: Array> ): T; + /** + * @see _.omit + */ + omit( + object: T | null | undefined, + ...paths: Array> + ): Omit; + /** * @see _.omit */ omit( object: T | null | undefined, - ...paths: PropertyPath[] + ...paths: Array> ): PartialObject; } @@ -2878,15 +2886,23 @@ declare module "../index" { */ omit( this: LoDashImplicitWrapper, - ...paths: PropertyPath[] + ...paths: Array> ): LoDashImplicitWrapper; + /** + * @see _.omit + */ + omit( + this: LoDashImplicitWrapper, + ...paths: Array> + ): LoDashImplicitWrapper>; + /** * @see _.omit */ omit( this: LoDashImplicitWrapper, - ...paths: PropertyPath[] + ...paths: Array> ): LoDashImplicitWrapper>; } @@ -2896,15 +2912,23 @@ declare module "../index" { */ omit( this: LoDashExplicitWrapper, - ...paths: PropertyPath[] + ...paths: Array> ): LoDashExplicitWrapper; + /** + * @see _.omit + */ + omit( + this: LoDashExplicitWrapper, + ...paths: Array> + ): LoDashExplicitWrapper>; + /** * @see _.omit */ omit( this: LoDashExplicitWrapper, - ...paths: PropertyPath[] + ...paths: Array> ): LoDashExplicitWrapper>; } diff --git a/types/lodash/fp.d.ts b/types/lodash/fp.d.ts index d577414aa4..da68ea250e 100644 --- a/types/lodash/fp.d.ts +++ b/types/lodash/fp.d.ts @@ -1,6 +1,6 @@ // AUTO-GENERATED: do not modify this file directly. // If you need to make changes, modify generate-fp.ts (if necessary), then open a terminal in types/lodash/scripts, and do: -// npm run fp +// npm install && npm run generate import lodash = require("./index"); @@ -60,7 +60,14 @@ declare namespace _ { } type LodashAssign1x1 = (source: TSource) => TObject & TSource; type LodashAssign1x2 = (object: TObject) => TObject & TSource; - type LodashAssignAll = (object: ReadonlyArray) => any; + interface LodashAssignAll { + (object: [TObject, TSource]): TObject & TSource; + (object: [TObject, TSource1, TSource2]): TObject & TSource1 & TSource2; + (object: [TObject, TSource1, TSource2, TSource3]): TObject & TSource1 & TSource2 & TSource3; + (object: [TObject, TSource1, TSource2, TSource3, TSource4]): TObject & TSource1 & TSource2 & TSource3 & TSource4; + (object: [TObject]): TObject; + (object: ReadonlyArray): any; + } interface LodashAssignAllWith { (customizer: lodash.AssignCustomizer): LodashAssignAllWith1x1; (customizer: lodash.__, args: ReadonlyArray): LodashAssignAllWith1x2; @@ -75,7 +82,14 @@ declare namespace _ { } type LodashAssignIn1x1 = (source: TSource) => TObject & TSource; type LodashAssignIn1x2 = (object: TObject) => TObject & TSource; - type LodashAssignInAll = (object: ReadonlyArray) => TResult; + interface LodashAssignInAll { + (object: [TObject, TSource]): TObject & TSource; + (object: [TObject, TSource1, TSource2]): TObject & TSource1 & TSource2; + (object: [TObject, TSource1, TSource2, TSource3]): TObject & TSource1 & TSource2 & TSource3; + (object: [TObject, TSource1, TSource2, TSource3, TSource4]): TObject & TSource1 & TSource2 & TSource3 & TSource4; + (object: [TObject]): TObject; + (object: ReadonlyArray): TResult; + } interface LodashAssignInAllWith { (customizer: lodash.AssignCustomizer): LodashAssignInAllWith1x1; (customizer: lodash.__, args: ReadonlyArray): LodashAssignInAllWith1x2; @@ -453,7 +467,14 @@ declare namespace _ { } type LodashDefaults1x1 = (object: TObject) => TSource & TObject; type LodashDefaults1x2 = (source: TSource) => TSource & TObject; - type LodashDefaultsAll = (object: ReadonlyArray) => any; + interface LodashDefaultsAll { + (object: [TObject, TSource]): TSource & TObject; + (object: [TObject, TSource1, TSource2]): TSource2 & TSource1 & TObject; + (object: [TObject, TSource1, TSource2, TSource3]): TSource3 & TSource2 & TSource1 & TObject; + (object: [TObject, TSource1, TSource2, TSource3, TSource4]): TSource4 & TSource3 & TSource2 & TSource1 & TObject; + (object: [TObject]): TObject; + (object: ReadonlyArray): any; + } interface LodashDefaultsDeep { (sources: any): LodashDefaultsDeep1x1; (sources: lodash.__, object: any): LodashDefaultsDeep1x2; @@ -546,11 +567,11 @@ declare namespace _ { type LodashDifferenceWith1x6 = (comparator: lodash.Comparator2) => T1[]; interface LodashUnset { (path: lodash.PropertyPath): LodashUnset1x1; - (path: lodash.__, object: any): LodashUnset1x2; - (path: lodash.PropertyPath, object: any): boolean; + (path: lodash.__, object: T): LodashUnset1x2; + (path: lodash.PropertyPath, object: T): T; } - type LodashUnset1x1 = (object: any) => boolean; - type LodashUnset1x2 = (path: lodash.PropertyPath) => boolean; + type LodashUnset1x1 = (object: T) => T; + type LodashUnset1x2 = (path: lodash.PropertyPath) => T; interface LodashDivide { (dividend: number): LodashDivide1x1; (dividend: lodash.__, divisor: number): LodashDivide1x2; @@ -704,7 +725,14 @@ declare namespace _ { } type LodashExtend1x1 = (source: TSource) => TObject & TSource; type LodashExtend1x2 = (object: TObject) => TObject & TSource; - type LodashExtendAll = (object: ReadonlyArray) => TResult; + interface LodashExtendAll { + (object: [TObject, TSource]): TObject & TSource; + (object: [TObject, TSource1, TSource2]): TObject & TSource1 & TSource2; + (object: [TObject, TSource1, TSource2, TSource3]): TObject & TSource1 & TSource2 & TSource3; + (object: [TObject, TSource1, TSource2, TSource3, TSource4]): TObject & TSource1 & TSource2 & TSource3 & TSource4; + (object: [TObject]): TObject; + (object: ReadonlyArray): TResult; + } interface LodashExtendAllWith { (customizer: lodash.AssignCustomizer): LodashExtendAllWith1x1; (customizer: lodash.__, args: ReadonlyArray): LodashExtendAllWith1x2; @@ -2171,7 +2199,13 @@ declare namespace _ { } type LodashMerge1x1 = (source: TSource) => TObject & TSource; type LodashMerge1x2 = (object: TObject) => TObject & TSource; - type LodashMergeAll = (object: ReadonlyArray) => any; + interface LodashMergeAll { + (object: [TObject, TSource]): TObject & TSource; + (object: [TObject, TSource1, TSource2]): TObject & TSource1 & TSource2; + (object: [TObject, TSource1, TSource2, TSource3]): TObject & TSource1 & TSource2 & TSource3; + (object: [TObject, TSource1, TSource2, TSource3, TSource4]): TObject & TSource1 & TSource2 & TSource3 & TSource4; + (object: ReadonlyArray): any; + } interface LodashMergeAllWith { (customizer: lodash.MergeWithCustomizer): LodashMergeAllWith1x1; (customizer: lodash.__, args: ReadonlyArray): LodashMergeAllWith1x2; @@ -2235,18 +2269,24 @@ declare namespace _ { type LodashNth1x2 = (n: number) => T | undefined; type LodashNthArg = (n: number) => (...args: any[]) => any; interface LodashOmit { - (paths: lodash.PropertyPath): LodashOmit1x1; + (paths: lodash.Many): LodashOmit1x1; (paths: lodash.__, object: T | null | undefined): LodashOmit1x2; - (paths: lodash.PropertyPath, object: T | null | undefined): T; + (paths: lodash.Many, object: T | null | undefined): T; + (paths: lodash.Many): LodashOmit2x1; (paths: lodash.__, object: T | null | undefined): LodashOmit2x2; - (paths: lodash.PropertyPath, object: T | null | undefined): lodash.PartialObject; + (paths: lodash.Many, object: T | null | undefined): lodash.Omit; + (paths: lodash.Many, object: T | null | undefined): lodash.PartialObject; } interface LodashOmit1x1 { (object: T | null | undefined): T; (object: T | null | undefined): lodash.PartialObject; } - type LodashOmit1x2 = (paths: lodash.PropertyPath) => T; - type LodashOmit2x2 = (paths: lodash.PropertyPath) => lodash.PartialObject; + type LodashOmit1x2 = (paths: lodash.Many) => T; + type LodashOmit2x1 = (object: T | null | undefined) => lodash.Omit; + interface LodashOmit2x2 { + (paths: lodash.Many): lodash.Omit; + (paths: lodash.Many): lodash.PartialObject; + } interface LodashOmitBy { (predicate: lodash.ValueKeyIteratee): LodashOmitBy1x1; (predicate: lodash.__, object: T | null | undefined): LodashOmitBy1x2; @@ -2435,21 +2475,252 @@ declare namespace _ { type LodashParseInt1x1 = (string: string) => number; type LodashParseInt1x2 = (radix: number) => number; interface LodashPartial { - (args: ReadonlyArray): LodashPartial1x1; - (args: lodash.__, func: (...args: any[]) => any): LodashPartial1x2; - (args: ReadonlyArray, func: (...args: any[]) => any): (...args: any[]) => any; + (func: lodash.Function1): LodashPartial1x1; + (func: lodash.__, arg1: [T1]): LodashPartial1x2; + (func: lodash.Function1, arg1: [T1]): lodash.Function0; + (func: lodash.Function2): LodashPartial2x1; + (func: lodash.Function2, arg1: [T1]): lodash.Function1< T2, R>; + (func: lodash.__, plc1: [lodash.__, T2]): LodashPartial3x2; + (func: lodash.Function2, plc1: [lodash.__, T2]): lodash.Function1; + (func: lodash.__, arg1: [T1, T2]): LodashPartial4x2; + (func: lodash.Function2, arg1: [T1, T2]): lodash.Function0< R>; + (func: lodash.Function3): LodashPartial5x1; + (func: lodash.Function3, arg1: [T1]): lodash.Function2< T2, T3, R>; + (func: lodash.Function3, plc1: [lodash.__, T2]): lodash.Function2; + (func: lodash.Function3, arg1: [T1, T2]): lodash.Function1< T3, R>; + (func: lodash.__, plc1: [lodash.__, lodash.__, T3]): LodashPartial8x2; + (func: lodash.Function3, plc1: [lodash.__, lodash.__, T3]): lodash.Function2; + (func: lodash.__, arg1: [T1, lodash.__, T3]): LodashPartial9x2; + (func: lodash.Function3, arg1: [T1, lodash.__, T3]): lodash.Function1< T2, R>; + (func: lodash.__, plc1: [lodash.__, T2, T3]): LodashPartial10x2; + (func: lodash.Function3, plc1: [lodash.__, T2, T3]): lodash.Function1; + (func: lodash.__, arg1: [T1, T2, T3]): LodashPartial11x2; + (func: lodash.Function3, arg1: [T1, T2, T3]): lodash.Function0< R>; + (func: lodash.Function4): LodashPartial12x1; + (func: lodash.Function4, arg1: [T1]): lodash.Function3< T2, T3, T4, R>; + (func: lodash.Function4, plc1: [lodash.__, T2]): lodash.Function3; + (func: lodash.Function4, arg1: [T1, T2]): lodash.Function2< T3, T4, R>; + (func: lodash.Function4, plc1: [lodash.__, lodash.__, T3]): lodash.Function3; + (func: lodash.Function4, arg1: [T1, lodash.__, T3]): lodash.Function2< T2, T4, R>; + (func: lodash.Function4, plc1: [lodash.__, T2, T3]): lodash.Function2; + (func: lodash.Function4, arg1: [T1, T2, T3]): lodash.Function1< T4, R>; + (func: lodash.__, plc1: [lodash.__, lodash.__, lodash.__, T4]): LodashPartial19x2; + (func: lodash.Function4, plc1: [lodash.__, lodash.__, lodash.__, T4]): lodash.Function3; + (func: lodash.__, arg1: [T1, lodash.__, lodash.__, T4]): LodashPartial20x2; + (func: lodash.Function4, arg1: [T1, lodash.__, lodash.__, T4]): lodash.Function2< T2, T3, R>; + (func: lodash.__, plc1: [lodash.__, T2, lodash.__, T4]): LodashPartial21x2; + (func: lodash.Function4, plc1: [lodash.__, T2, lodash.__, T4]): lodash.Function2; + (func: lodash.__, arg1: [T1, T2, lodash.__, T4]): LodashPartial22x2; + (func: lodash.Function4, arg1: [T1, T2, lodash.__, T4]): lodash.Function1< T3, R>; + (func: lodash.__, plc1: [lodash.__, lodash.__, T3, T4]): LodashPartial23x2; + (func: lodash.Function4, plc1: [lodash.__, lodash.__, T3, T4]): lodash.Function2; + (func: lodash.__, arg1: [T1, lodash.__, T3, T4]): LodashPartial24x2; + (func: lodash.Function4, arg1: [T1, lodash.__, T3, T4]): lodash.Function1< T2, R>; + (func: lodash.__, plc1: [lodash.__, T2, T3, T4]): LodashPartial25x2; + (func: lodash.Function4, plc1: [lodash.__, T2, T3, T4]): lodash.Function1; + (func: lodash.__, arg1: [T1, T2, T3, T4]): LodashPartial26x2; + (func: lodash.Function4, arg1: [T1, T2, T3, T4]): lodash.Function0< R>; + (func: (...args: any[]) => any): LodashPartial27x1; + (func: lodash.__, args: ReadonlyArray): LodashPartial27x2; + (func: (...args: any[]) => any, args: ReadonlyArray): (...args: any[]) => any; placeholder: lodash.__; } - type LodashPartial1x1 = (func: (...args: any[]) => any) => (...args: any[]) => any; - type LodashPartial1x2 = (args: ReadonlyArray) => (...args: any[]) => any; + type LodashPartial1x1 = (arg1: [T1]) => lodash.Function0; + interface LodashPartial1x2 { + (func: lodash.Function1): lodash.Function0; + (func: lodash.Function2): lodash.Function1< T2, R>; + (func: lodash.Function3): lodash.Function2< T2, T3, R>; + (func: lodash.Function4): lodash.Function3< T2, T3, T4, R>; + } + interface LodashPartial2x1 { + (arg1: [T1]): lodash.Function1< T2, R>; + (plc1: [lodash.__, T2]): lodash.Function1; + (arg1: [T1, T2]): lodash.Function0< R>; + } + interface LodashPartial3x2 { + (func: lodash.Function2): lodash.Function1; + (func: lodash.Function3): lodash.Function2; + (func: lodash.Function4): lodash.Function3; + } + interface LodashPartial4x2 { + (func: lodash.Function2): lodash.Function0< R>; + (func: lodash.Function3): lodash.Function1< T3, R>; + (func: lodash.Function4): lodash.Function2< T3, T4, R>; + } + interface LodashPartial5x1 { + (arg1: [T1]): lodash.Function2< T2, T3, R>; + (plc1: [lodash.__, T2]): lodash.Function2; + (arg1: [T1, T2]): lodash.Function1< T3, R>; + (plc1: [lodash.__, lodash.__, T3]): lodash.Function2; + (arg1: [T1, lodash.__, T3]): lodash.Function1< T2, R>; + (plc1: [lodash.__, T2, T3]): lodash.Function1; + (arg1: [T1, T2, T3]): lodash.Function0< R>; + } + interface LodashPartial8x2 { + (func: lodash.Function3): lodash.Function2; + (func: lodash.Function4): lodash.Function3; + } + interface LodashPartial9x2 { + (func: lodash.Function3): lodash.Function1< T2, R>; + (func: lodash.Function4): lodash.Function2< T2, T4, R>; + } + interface LodashPartial10x2 { + (func: lodash.Function3): lodash.Function1; + (func: lodash.Function4): lodash.Function2; + } + interface LodashPartial11x2 { + (func: lodash.Function3): lodash.Function0< R>; + (func: lodash.Function4): lodash.Function1< T4, R>; + } + interface LodashPartial12x1 { + (arg1: [T1]): lodash.Function3< T2, T3, T4, R>; + (plc1: [lodash.__, T2]): lodash.Function3; + (arg1: [T1, T2]): lodash.Function2< T3, T4, R>; + (plc1: [lodash.__, lodash.__, T3]): lodash.Function3; + (arg1: [T1, lodash.__, T3]): lodash.Function2< T2, T4, R>; + (plc1: [lodash.__, T2, T3]): lodash.Function2; + (arg1: [T1, T2, T3]): lodash.Function1< T4, R>; + (plc1: [lodash.__, lodash.__, lodash.__, T4]): lodash.Function3; + (arg1: [T1, lodash.__, lodash.__, T4]): lodash.Function2< T2, T3, R>; + (plc1: [lodash.__, T2, lodash.__, T4]): lodash.Function2; + (arg1: [T1, T2, lodash.__, T4]): lodash.Function1< T3, R>; + (plc1: [lodash.__, lodash.__, T3, T4]): lodash.Function2; + (arg1: [T1, lodash.__, T3, T4]): lodash.Function1< T2, R>; + (plc1: [lodash.__, T2, T3, T4]): lodash.Function1; + (arg1: [T1, T2, T3, T4]): lodash.Function0< R>; + } + type LodashPartial19x2 = (func: lodash.Function4) => lodash.Function3; + type LodashPartial20x2 = (func: lodash.Function4) => lodash.Function2< T2, T3, R>; + type LodashPartial21x2 = (func: lodash.Function4) => lodash.Function2; + type LodashPartial22x2 = (func: lodash.Function4) => lodash.Function1< T3, R>; + type LodashPartial23x2 = (func: lodash.Function4) => lodash.Function2; + type LodashPartial24x2 = (func: lodash.Function4) => lodash.Function1< T2, R>; + type LodashPartial25x2 = (func: lodash.Function4) => lodash.Function1; + type LodashPartial26x2 = (func: lodash.Function4) => lodash.Function0< R>; + type LodashPartial27x1 = (args: ReadonlyArray) => (...args: any[]) => any; + type LodashPartial27x2 = (func: (...args: any[]) => any) => (...args: any[]) => any; interface LodashPartialRight { - (args: ReadonlyArray): LodashPartialRight1x1; - (args: lodash.__, func: (...args: any[]) => any): LodashPartialRight1x2; - (args: ReadonlyArray, func: (...args: any[]) => any): (...args: any[]) => any; + (func: lodash.Function1): LodashPartialRight1x1; + (func: lodash.__, arg1: [T1]): LodashPartialRight1x2; + (func: lodash.Function1, arg1: [T1]): lodash.Function0; + (func: lodash.Function2): LodashPartialRight2x1; + (func: lodash.__, arg1: [T1, lodash.__]): LodashPartialRight2x2; + (func: lodash.Function2, arg1: [T1, lodash.__]): lodash.Function1< T2, R>; + (func: lodash.__, arg2: [T2]): LodashPartialRight3x2; + (func: lodash.Function2, arg2: [T2]): lodash.Function1; + (func: lodash.__, arg1: [T1, T2]): LodashPartialRight4x2; + (func: lodash.Function2, arg1: [T1, T2]): lodash.Function0< R>; + (func: lodash.Function3): LodashPartialRight5x1; + (func: lodash.__, arg1: [T1, lodash.__, lodash.__]): LodashPartialRight5x2; + (func: lodash.Function3, arg1: [T1, lodash.__, lodash.__]): lodash.Function2< T2, T3, R>; + (func: lodash.__, arg2: [T2, lodash.__]): LodashPartialRight6x2; + (func: lodash.Function3, arg2: [T2, lodash.__]): lodash.Function2; + (func: lodash.__, arg1: [T1, T2, lodash.__]): LodashPartialRight7x2; + (func: lodash.Function3, arg1: [T1, T2, lodash.__]): lodash.Function1< T3, R>; + (func: lodash.__, arg3: [T3]): LodashPartialRight8x2; + (func: lodash.Function3, arg3: [T3]): lodash.Function2; + (func: lodash.__, arg1: [T1, lodash.__, T3]): LodashPartialRight9x2; + (func: lodash.Function3, arg1: [T1, lodash.__, T3]): lodash.Function1< T2, R>; + (func: lodash.__, arg2: [T2, T3]): LodashPartialRight10x2; + (func: lodash.Function3, arg2: [T2, T3]): lodash.Function1; + (func: lodash.__, arg1: [T1, T2, T3]): LodashPartialRight11x2; + (func: lodash.Function3, arg1: [T1, T2, T3]): lodash.Function0< R>; + (func: lodash.Function4): LodashPartialRight12x1; + (func: lodash.__, arg1: [T1, lodash.__, lodash.__, lodash.__]): LodashPartialRight12x2; + (func: lodash.Function4, arg1: [T1, lodash.__, lodash.__, lodash.__]): lodash.Function3< T2, T3, T4, R>; + (func: lodash.__, arg2: [T2, lodash.__, lodash.__]): LodashPartialRight13x2; + (func: lodash.Function4, arg2: [T2, lodash.__, lodash.__]): lodash.Function3; + (func: lodash.__, arg1: [T1, T2, lodash.__, lodash.__]): LodashPartialRight14x2; + (func: lodash.Function4, arg1: [T1, T2, lodash.__, lodash.__]): lodash.Function2< T3, T4, R>; + (func: lodash.__, arg3: [T3, lodash.__]): LodashPartialRight15x2; + (func: lodash.Function4, arg3: [T3, lodash.__]): lodash.Function3; + (func: lodash.__, arg1: [T1, lodash.__, T3, lodash.__]): LodashPartialRight16x2; + (func: lodash.Function4, arg1: [T1, lodash.__, T3, lodash.__]): lodash.Function2< T2, T4, R>; + (func: lodash.__, arg2: [T2, T3, lodash.__]): LodashPartialRight17x2; + (func: lodash.Function4, arg2: [T2, T3, lodash.__]): lodash.Function2; + (func: lodash.__, arg1: [T1, T2, T3, lodash.__]): LodashPartialRight18x2; + (func: lodash.Function4, arg1: [T1, T2, T3, lodash.__]): lodash.Function1< T4, R>; + (func: lodash.__, arg4: [T4]): LodashPartialRight19x2; + (func: lodash.Function4, arg4: [T4]): lodash.Function3; + (func: lodash.__, arg1: [T1, lodash.__, lodash.__, T4]): LodashPartialRight20x2; + (func: lodash.Function4, arg1: [T1, lodash.__, lodash.__, T4]): lodash.Function2< T2, T3, R>; + (func: lodash.__, arg2: [T2, lodash.__, T4]): LodashPartialRight21x2; + (func: lodash.Function4, arg2: [T2, lodash.__, T4]): lodash.Function2; + (func: lodash.__, arg1: [T1, T2, lodash.__, T4]): LodashPartialRight22x2; + (func: lodash.Function4, arg1: [T1, T2, lodash.__, T4]): lodash.Function1< T3, R>; + (func: lodash.__, arg3: [T3, T4]): LodashPartialRight23x2; + (func: lodash.Function4, arg3: [T3, T4]): lodash.Function2; + (func: lodash.__, arg1: [T1, lodash.__, T3, T4]): LodashPartialRight24x2; + (func: lodash.Function4, arg1: [T1, lodash.__, T3, T4]): lodash.Function1< T2, R>; + (func: lodash.__, arg2: [T2, T3, T4]): LodashPartialRight25x2; + (func: lodash.Function4, arg2: [T2, T3, T4]): lodash.Function1; + (func: lodash.__, arg1: [T1, T2, T3, T4]): LodashPartialRight26x2; + (func: lodash.Function4, arg1: [T1, T2, T3, T4]): lodash.Function0< R>; + (func: (...args: any[]) => any): LodashPartialRight27x1; + (func: lodash.__, args: ReadonlyArray): LodashPartialRight27x2; + (func: (...args: any[]) => any, args: ReadonlyArray): (...args: any[]) => any; placeholder: lodash.__; } - type LodashPartialRight1x1 = (func: (...args: any[]) => any) => (...args: any[]) => any; - type LodashPartialRight1x2 = (args: ReadonlyArray) => (...args: any[]) => any; + type LodashPartialRight1x1 = (arg1: [T1]) => lodash.Function0; + type LodashPartialRight1x2 = (func: lodash.Function1) => lodash.Function0; + interface LodashPartialRight2x1 { + (arg1: [T1, lodash.__]): lodash.Function1< T2, R>; + (arg2: [T2]): lodash.Function1; + (arg1: [T1, T2]): lodash.Function0< R>; + } + type LodashPartialRight2x2 = (func: lodash.Function2) => lodash.Function1< T2, R>; + type LodashPartialRight3x2 = (func: lodash.Function2) => lodash.Function1; + type LodashPartialRight4x2 = (func: lodash.Function2) => lodash.Function0< R>; + interface LodashPartialRight5x1 { + (arg1: [T1, lodash.__, lodash.__]): lodash.Function2< T2, T3, R>; + (arg2: [T2, lodash.__]): lodash.Function2; + (arg1: [T1, T2, lodash.__]): lodash.Function1< T3, R>; + (arg3: [T3]): lodash.Function2; + (arg1: [T1, lodash.__, T3]): lodash.Function1< T2, R>; + (arg2: [T2, T3]): lodash.Function1; + (arg1: [T1, T2, T3]): lodash.Function0< R>; + } + type LodashPartialRight5x2 = (func: lodash.Function3) => lodash.Function2< T2, T3, R>; + type LodashPartialRight6x2 = (func: lodash.Function3) => lodash.Function2; + type LodashPartialRight7x2 = (func: lodash.Function3) => lodash.Function1< T3, R>; + type LodashPartialRight8x2 = (func: lodash.Function3) => lodash.Function2; + type LodashPartialRight9x2 = (func: lodash.Function3) => lodash.Function1< T2, R>; + type LodashPartialRight10x2 = (func: lodash.Function3) => lodash.Function1; + type LodashPartialRight11x2 = (func: lodash.Function3) => lodash.Function0< R>; + interface LodashPartialRight12x1 { + (arg1: [T1, lodash.__, lodash.__, lodash.__]): lodash.Function3< T2, T3, T4, R>; + (arg2: [T2, lodash.__, lodash.__]): lodash.Function3; + (arg1: [T1, T2, lodash.__, lodash.__]): lodash.Function2< T3, T4, R>; + (arg3: [T3, lodash.__]): lodash.Function3; + (arg1: [T1, lodash.__, T3, lodash.__]): lodash.Function2< T2, T4, R>; + (arg2: [T2, T3, lodash.__]): lodash.Function2; + (arg1: [T1, T2, T3, lodash.__]): lodash.Function1< T4, R>; + (arg4: [T4]): lodash.Function3; + (arg1: [T1, lodash.__, lodash.__, T4]): lodash.Function2< T2, T3, R>; + (arg2: [T2, lodash.__, T4]): lodash.Function2; + (arg1: [T1, T2, lodash.__, T4]): lodash.Function1< T3, R>; + (arg3: [T3, T4]): lodash.Function2; + (arg1: [T1, lodash.__, T3, T4]): lodash.Function1< T2, R>; + (arg2: [T2, T3, T4]): lodash.Function1; + (arg1: [T1, T2, T3, T4]): lodash.Function0< R>; + } + type LodashPartialRight12x2 = (func: lodash.Function4) => lodash.Function3< T2, T3, T4, R>; + type LodashPartialRight13x2 = (func: lodash.Function4) => lodash.Function3; + type LodashPartialRight14x2 = (func: lodash.Function4) => lodash.Function2< T3, T4, R>; + type LodashPartialRight15x2 = (func: lodash.Function4) => lodash.Function3; + type LodashPartialRight16x2 = (func: lodash.Function4) => lodash.Function2< T2, T4, R>; + type LodashPartialRight17x2 = (func: lodash.Function4) => lodash.Function2; + type LodashPartialRight18x2 = (func: lodash.Function4) => lodash.Function1< T4, R>; + type LodashPartialRight19x2 = (func: lodash.Function4) => lodash.Function3; + type LodashPartialRight20x2 = (func: lodash.Function4) => lodash.Function2< T2, T3, R>; + type LodashPartialRight21x2 = (func: lodash.Function4) => lodash.Function2; + type LodashPartialRight22x2 = (func: lodash.Function4) => lodash.Function1< T3, R>; + type LodashPartialRight23x2 = (func: lodash.Function4) => lodash.Function2; + type LodashPartialRight24x2 = (func: lodash.Function4) => lodash.Function1< T2, R>; + type LodashPartialRight25x2 = (func: lodash.Function4) => lodash.Function1; + type LodashPartialRight26x2 = (func: lodash.Function4) => lodash.Function0< R>; + type LodashPartialRight27x1 = (args: ReadonlyArray) => (...args: any[]) => any; + type LodashPartialRight27x2 = (func: (...args: any[]) => any) => (...args: any[]) => any; interface LodashPartition { (callback: lodash.ValueIteratee): LodashPartition1x1; (callback: lodash.__, collection: lodash.List | null | undefined): LodashPartition1x2; @@ -4055,7 +4326,13 @@ declare namespace _ { } type LodashZip1x1 = (arrays2: lodash.List) => Array<[T1 | undefined, T2 | undefined]>; type LodashZip1x2 = (arrays1: lodash.List) => Array<[T1 | undefined, T2 | undefined]>; - type LodashZipAll = (arrays: ReadonlyArray | null | undefined>) => Array>; + interface LodashZipAll { + (arrays1: [lodash.List, lodash.List]): Array<[T1 | undefined, T2 | undefined]>; + (arrays1: [lodash.List, lodash.List, lodash.List]): Array<[T1 | undefined, T2 | undefined, T3 | undefined]>; + (arrays1: [lodash.List, lodash.List, lodash.List, lodash.List]): Array<[T1 | undefined, T2 | undefined, T3 | undefined, T4 | undefined]>; + (arrays1: [lodash.List, lodash.List, lodash.List, lodash.List, lodash.List]): Array<[T1 | undefined, T2 | undefined, T3 | undefined, T4 | undefined, T5 | undefined]>; + (arrays: ReadonlyArray | null | undefined>): Array>; + } interface LodashZipObject { (props: lodash.List): LodashZipObject1x1; (props: lodash.__, values: lodash.List): LodashZipObject1x2; diff --git a/types/lodash/lodash-tests.ts b/types/lodash/lodash-tests.ts index fbb164c4c5..08dcd31639 100644 --- a/types/lodash/lodash-tests.ts +++ b/types/lodash/lodash-tests.ts @@ -5788,24 +5788,24 @@ fp.now(); // $ExpectType number const dictionary: _.Dictionary = anything; const numericDictionary: _.NumericDictionary = anything; - _.omit(obj, "a"); // $ExpectType Partial + _.omit(obj, "a"); // ExpectType Pick // NOTE: ExpectType disabled because it fails in TS2.4 _.omit(obj, ["b", 1], 0, "a"); // $ExpectType Partial _.omit(dictionary, "a"); // $ExpectType Dictionary _.omit(numericDictionary, "a"); // $ExpectType NumericDictionary - _(obj).omit("a"); // $ExpectType LoDashImplicitWrapper> + _(obj).omit("a"); // ExpectType LoDashImplicitWrapper> // NOTE: ExpectType disabled because it fails in TS2.4 _(obj).omit(["b", 1], 0, "a"); // $ExpectType LoDashImplicitWrapper> _(dictionary).omit("a"); // $ExpectType LoDashImplicitWrapper> _(numericDictionary).omit("a"); // $ExpectType LoDashImplicitWrapper> - _.chain(obj).omit("a"); // $ExpectType LoDashExplicitWrapper> + _.chain(obj).omit("a"); // ExpectType LoDashExplicitWrapper> // NOTE: ExpectType disabled because it fails in TS2.4 _.chain(obj).omit(["b", 1], 0, "a"); // $ExpectType LoDashExplicitWrapper> _.chain(dictionary).omit("a"); // $ExpectType LoDashExplicitWrapper> _.chain(numericDictionary).omit("a"); // $ExpectType LoDashExplicitWrapper> - fp.omit("a", obj); // $ExpectType Partial - fp.omit("a")(obj); // $ExpectType Partial - fp.omit(["a", "b"])(obj); // $ExpectType Partial + fp.omit("a", obj); // ExpectType Pick // NOTE: ExpectType disabled because it fails in TS2.4 + fp.omit("a")(obj); // ExpectType Pick // NOTE: ExpectType disabled because it fails in TS2.3 + fp.omit(["a", "b"])(obj); // ExpectType Pick // NOTE: ExpectType disabled because it fails in TS2.3 } // _.omitBy @@ -5825,7 +5825,7 @@ fp.now(); // $ExpectType number const obj1: AbcObject | null | undefined = anything; const obj2: AbcObject = anything; const readonlyArray: string[] = ["a", "b"]; // TODO: Should be ReadonlyArray, but see comment on type Many - const literalsArray = ["a" as "a", "b" as "b"]; + const literalsArray: Array<"a" | "b"> = ["a", "b"]; const roLiteralsArray: Array<"a" | "b"> = literalsArray; // TODO: Should be ReadonlyArray, but see comment on type Many _.pick(obj1, "a"); // $ExpectType PartialDeep @@ -5857,7 +5857,7 @@ fp.now(); // $ExpectType number fp.pick("a", obj2); // $ExpectType Pick fp.pick("a")(obj2); // $ExpectType Pick - fp.pick(["a" as "a", "b" as "b"])(obj2); // $ExpectType Pick + fp.pick(literalsArray)(obj2); // $ExpectType Pick } // _.pickBy @@ -6060,9 +6060,10 @@ fp.now(); // $ExpectType number _(object).unset(["a", "b"]); // $ExpectType LoDashImplicitWrapper _.chain(object).unset("a.b"); // $ExpectType LoDashExplicitWrapper _.chain(object).unset(["a", "b"]); // $ExpectType LoDashExplicitWrapper - fp.unset("a.b", object); // $ExpectType boolean - fp.unset("a.b")(object); // $ExpectType boolean - fp.unset(["a", "b"])(object); // $ExpectType boolean + + fp.unset("a.b", object); // $ExpectType { a: { b: string; c: boolean; }; } + fp.unset("a.b")(object); // $ExpectType { a: { b: string; c: boolean; }; } + fp.unset(["a", "b"])(object); // $ExpectType { a: { b: string; c: boolean; }; } } // _.update @@ -7251,11 +7252,10 @@ _.templateSettings; // $ExpectType TemplateSettings // with arity 3 function _.partialRight(func3, 42, _, true); - fp.partial([], func0); // $ExpectType (...args: any[]) => any - fp.partial([])(func0); // $ExpectType (...args: any[]) => any - fp.partial([42])(func1); // $ExpectType (...args: any[]) => any - fp.partial([fp.partial.placeholder, "foo"])(func2); - fp.partialRight([])(func0); // $ExpectType (...args: any[]) => any - fp.partialRight([42])(func1); // $ExpectType (...args: any[]) => any - fp.partialRight([fp.partialRight.placeholder, "foo"])(func2); + fp.partial(func1, [42]); // $ExpectType Function0 + fp.partial(func1)([42]); // $ExpectType Function0 + fp.partial(func2)([fp.partial.placeholder, "foo"]); // $ExpectType Function1 + fp.partialRight(func1, [42]); // $ExpectType Function0 + fp.partialRight(func1)([42]); // $ExpectType Function0 + fp.partialRight(func2)([42, fp.partialRight.placeholder]); // $ExpectType Function1 } diff --git a/types/lodash/scripts/generate-fp.ts b/types/lodash/scripts/generate-fp.ts index 77f11b46ac..9a03fef544 100644 --- a/types/lodash/scripts/generate-fp.ts +++ b/types/lodash/scripts/generate-fp.ts @@ -174,15 +174,14 @@ async function processDefinitions(filePaths: string[], commonTypes: string[]): P } else if (args.length > 4 || definition.name === "flow" || definition.name === "flowRight") { // Arity wasn't fixed by convert() isFixed = false; - } else { - // For some reason, convert() doesn't seems to tell us which functions have unchanged argument order. - // So we have to hard-code it. - const unchangedOrders = ["add", "assign", "assignIn", "bind", "bindKey", "concat", "difference", "divide", "eq", - "gt", "gte", "isEqual", "lt", "lte", "matchesProperty", "merge", "multiply", "overArgs", "partial", "partialRight", - "propertyOf", "random", "range", "rangeRight", "subtract", "zip", "zipObject", "zipObjectDeep"]; - if (unchangedOrders.includes(definition.name)) - args = _.sortBy(args as number[][], (a: number[]) => a[0]); } + // For some reason, convert() doesn't seems to tell us which functions have unchanged argument order. + // So we have to hard-code it. + const unchangedOrders = ["add", "assign", "assignIn", "bind", "bindKey", "concat", "difference", "divide", "eq", + "gt", "gte", "isEqual", "lt", "lte", "matchesProperty", "merge", "multiply", "overArgs", "partial", "partialRight", + "propertyOf", "random", "range", "rangeRight", "subtract", "zip", "zipObject", "zipObjectDeep"]; + if (unchangedOrders.includes(definition.name)) + args = _.sortBy(args, a => typeof a === "number" ? a : a[0]); return () => curryDefinition(definition, _.flatten(args), spreadIndex, isFixed); }; @@ -324,6 +323,12 @@ function parseDefinitions(definitionString: string, startIndex: number, endIndex .map(o => _.trim(o, ",")) .filter(o => !!o); overload.returnType = overloadString.substring(paramEndIndex + 2).trim(); + // Special case for unset: the return type should be the input type, not bolean. See https://github.com/DefinitelyTyped/DefinitelyTyped/issues/25361 + if (name === "unset") { + overload.typeParams = [{ name: "T" }]; + overload.params[0] = overload.params[0].replace(/\bany\b/, "T"); + overload.returnType = "T"; + } currentDefinition.overloads.push(overload); } else { // This overload actually points to an interface. Try to find said interface and get the overloads from there. @@ -433,25 +438,33 @@ function curryDefinition(definition: Definition, paramOrder: number[], spreadInd // Spread/rest parameters could be in any of the following formats: // 1. The rest parameter is at spreadIndex, and it is the last parameter. // 2. The rest parameter is immediately after spreadIndex, e.g. assign(object, ...sources[]). In this case, convert it to assignAll(...object[]) - // 3. The rest parameter is not the last parameter, e.g. assignWith(object, ...sources[], customizer) + // 3. The overload defines no rest parameters, e.g. mergeAll(T1, T2, T3) + // 4. The rest parameter is not the last parameter, e.g. assignWith(object, ...sources[], customizer) if (spreadIndex === arity - 1) { - // cases 1-2 for (let i = 0; i < overloads.length; ++i) { const overload = overloads[i]; if (overload.params.length === arity && overload.params[spreadIndex] && overload.params[spreadIndex].startsWith("...")) { + // case 1 overload.params[spreadIndex] = overload.params[spreadIndex].replace("...", ""); } else if (overload.params.length === arity + 1 && overload.params[spreadIndex + 1] && overload.params[spreadIndex + 1].startsWith("...")) { + // case 2 overload.params.splice(spreadIndex + 1, 1); const parts = overload.params[spreadIndex].split(":").map(_.trim); parts[1] = `ReadonlyArray<${parts[1]}>`; overload.params[spreadIndex] = `${parts[0]}: ${parts[1]}`; + } else if (overload.params.length >= arity && overload.params[spreadIndex] && !overload.params.some(p => p.startsWith("..."))) { + // case 3 + const paramName = getParamName(overload.params[spreadIndex]); + const spreadParamTypes = overload.params.slice(spreadIndex).map(getParamType); + overload.params = overload.params.slice(0, spreadIndex); + overload.params.push(`${paramName}: [${spreadParamTypes.join(", ")}]`); } else { _.pull(overloads, overload); --i; } } } else { - // case 3 + // case 4 const overload = overloads[0]; overloads = [{ jsdoc: overload.jsdoc, diff --git a/types/lowdb/_lodash.d.ts b/types/lowdb/_lodash.d.ts index 78ff4901af..982826fe5b 100644 --- a/types/lowdb/_lodash.d.ts +++ b/types/lowdb/_lodash.d.ts @@ -127,7 +127,7 @@ declare module "./index" { first(this: LoDashExplicitSyncWrapper<_.List | null | undefined>): LoDashExplicitSyncWrapper; flatten(this: LoDashExplicitSyncWrapper<_.List<_.Many> | null | undefined>): LoDashExplicitSyncWrapper; flattenDeep(this: LoDashExplicitSyncWrapper<_.ListOfRecursiveArraysOrValues | null | undefined>): LoDashExplicitSyncWrapper; - flattenDepth(this: LoDashExplicitSyncWrapper<_.ListOfRecursiveArraysOrValues | null | undefined>, depth?: number): LoDashExplicitSyncWrapper; + flattenDepth(this: LoDashExplicitSyncWrapper<_.ListOfRecursiveArraysOrValues | null | undefined>, depth?: number): LoDashExplicitSyncWrapper; fromPairs( this: LoDashExplicitSyncWrapper<_.List<[_.PropertyName, T]> | null | undefined> ): LoDashExplicitSyncWrapper<_.Dictionary>; @@ -1263,11 +1263,15 @@ declare module "./index" { ): LoDashExplicitSyncWrapper; omit( this: LoDashExplicitSyncWrapper, - ...paths: _.PropertyPath[] + ...paths: Array<_.Many<_.PropertyName>> ): LoDashExplicitSyncWrapper; + omit( + this: LoDashExplicitSyncWrapper, + ...paths: Array<_.Many> + ): LoDashExplicitSyncWrapper<_.Omit>; omit( this: LoDashExplicitSyncWrapper, - ...paths: _.PropertyPath[] + ...paths: Array<_.Many<_.PropertyName>> ): LoDashExplicitSyncWrapper<_.PartialObject>; omitBy( this: LoDashExplicitSyncWrapper, @@ -1691,7 +1695,7 @@ declare module "./index" { first(this: LoDashExplicitAsyncWrapper<_.List | null | undefined>): LoDashExplicitAsyncWrapper; flatten(this: LoDashExplicitAsyncWrapper<_.List<_.Many> | null | undefined>): LoDashExplicitAsyncWrapper; flattenDeep(this: LoDashExplicitAsyncWrapper<_.ListOfRecursiveArraysOrValues | null | undefined>): LoDashExplicitAsyncWrapper; - flattenDepth(this: LoDashExplicitAsyncWrapper<_.ListOfRecursiveArraysOrValues | null | undefined>, depth?: number): LoDashExplicitAsyncWrapper; + flattenDepth(this: LoDashExplicitAsyncWrapper<_.ListOfRecursiveArraysOrValues | null | undefined>, depth?: number): LoDashExplicitAsyncWrapper; fromPairs( this: LoDashExplicitAsyncWrapper<_.List<[_.PropertyName, T]> | null | undefined> ): LoDashExplicitAsyncWrapper<_.Dictionary>; @@ -2827,11 +2831,15 @@ declare module "./index" { ): LoDashExplicitAsyncWrapper; omit( this: LoDashExplicitAsyncWrapper, - ...paths: _.PropertyPath[] + ...paths: Array<_.Many<_.PropertyName>> ): LoDashExplicitAsyncWrapper; + omit( + this: LoDashExplicitAsyncWrapper, + ...paths: Array<_.Many> + ): LoDashExplicitAsyncWrapper<_.Omit>; omit( this: LoDashExplicitAsyncWrapper, - ...paths: _.PropertyPath[] + ...paths: Array<_.Many<_.PropertyName>> ): LoDashExplicitAsyncWrapper<_.PartialObject>; omitBy( this: LoDashExplicitAsyncWrapper, From d45c6ed0629a47f49f412b7a3872fccafe5c6929 Mon Sep 17 00:00:00 2001 From: AJ Richardson Date: Sat, 5 May 2018 17:01:11 -0400 Subject: [PATCH 012/575] lodash: fix test failures --- types/lodash/common/common.d.ts | 3 +-- types/lodash/lodash-tests.ts | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/types/lodash/common/common.d.ts b/types/lodash/common/common.d.ts index b5da2a8080..d0856a006b 100644 --- a/types/lodash/common/common.d.ts +++ b/types/lodash/common/common.d.ts @@ -217,8 +217,7 @@ declare module "../index" { type PropertyName = string | number | symbol; type PropertyPath = Many; - type Diff = ({ [P in T]: P } & { [P in U]: never } & { [x: string]: never })[T]; - type Omit = Pick>; + type Omit = Pick; /** Common interface between Arrays and jQuery objects */ type List = ArrayLike; diff --git a/types/lodash/lodash-tests.ts b/types/lodash/lodash-tests.ts index 08dcd31639..6f4fae8529 100644 --- a/types/lodash/lodash-tests.ts +++ b/types/lodash/lodash-tests.ts @@ -5396,7 +5396,7 @@ fp.now(); // $ExpectType number _.chain("abc").get(1); // $ExpectType LoDashExplicitWrapper _.chain("abc").get(["0"], "_"); - _.chain([42]).get(0, -1); // $ExpectType LoDashExplicitWrapper + _.chain([42]).get(0, -1); // ExpectType LoDashExplicitWrapper _.chain({ a: { b: true } }).get("a"); // $ExpectType LoDashExplicitWrapper<{ b: boolean; }> _.chain({ a: { b: true } }).get(["a"]); // $ExpectType LoDashExplicitWrapper<{ b: boolean; }> _.chain({ a: { b: true } }).get(["a", "b"]); // $ExpectType LoDashExplicitWrapper @@ -6939,13 +6939,13 @@ fp.now(); // $ExpectType number { const object: AbcObject = anything; - _.methodOf(object); // $ExpectType (path: Many) => any - _.methodOf(object, anything, anything, anything); // $ExpectType (path: Many) => any - _(object).methodOf(); // $ExpectType LoDashImplicitWrapper<(path: Many) => any> - _(object).methodOf(anything, anything, anything); // $ExpectType LoDashImplicitWrapper<(path: Many) => any> - _.chain(object).methodOf(); // $ExpectType LoDashExplicitWrapper<(path: Many) => any> - _.chain(object).methodOf(anything, anything, anything); // $ExpectType LoDashExplicitWrapper<(path: Many) => any> - fp.methodOf(object); // $ExpectType (path: Many) => any + _.methodOf(object) as (path: _.Many<_.PropertyName>) => any; + _.methodOf(object, anything, anything, anything) as (path: _.Many<_.PropertyName>) => any; + _(object).methodOf() as _.LoDashImplicitWrapper<(path: _.Many<_.PropertyName>) => any>; + _(object).methodOf(anything, anything, anything) as _.LoDashImplicitWrapper<(path: _.Many<_.PropertyName>) => any>; + _.chain(object).methodOf() as _.LoDashExplicitWrapper<(path: _.Many<_.PropertyName>) => any>; + _.chain(object).methodOf(anything, anything, anything) as _.LoDashExplicitWrapper<(path: _.Many<_.PropertyName>) => any>; + fp.methodOf(object) as (path: _.Many<_.PropertyName>) => any; } // _.mixin @@ -7077,9 +7077,9 @@ fp.now(); // $ExpectType number // _.propertyOf { - _.propertyOf({}); // $ExpectType (path: Many) => any - _({}).propertyOf(); // $ExpectType LoDashImplicitWrapper<(path: Many) => any> - _.chain({}).propertyOf(); // $ExpectType LoDashExplicitWrapper<(path: Many) => any> + _.propertyOf({}) as (path: _.Many<_.PropertyName>) => any; + _({}).propertyOf() as _.LoDashImplicitWrapper<(path: _.Many<_.PropertyName>) => any>; + _.chain({}).propertyOf() as _.LoDashExplicitWrapper<(path: _.Many<_.PropertyName>) => any>; fp.propertyOf(Symbol.iterator)([]); // $ExpectType any fp.propertyOf([Symbol.iterator], []); // $ExpectType any From 22c541a2ba3a113a8bee23cd650325e754fa8775 Mon Sep 17 00:00:00 2001 From: Hugues Stefanski Date: Mon, 7 May 2018 21:22:21 +0200 Subject: [PATCH 013/575] #25583 : update d3-color to 1.2.0 Added hex method --- types/d3-color/d3-color-tests.ts | 5 +++++ types/d3-color/index.d.ts | 37 ++++++++++++++++++++++++++++++-- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/types/d3-color/d3-color-tests.ts b/types/d3-color/d3-color-tests.ts index 47f191073b..135456a005 100644 --- a/types/d3-color/d3-color-tests.ts +++ b/types/d3-color/d3-color-tests.ts @@ -36,6 +36,7 @@ cRGB = cRGB.darker(0.2); cRGB = cRGB.rgb(); displayable = cRGB.displayable(); cString = cRGB.toString(); +cString = cRGB.hex(); console.log('Channels = (r : %d, g: %d, b: %d)', cRGB.r, cRGB.g, cRGB.b); console.log('Opacity = %d', cRGB.opacity); @@ -51,6 +52,7 @@ cHSL = cHSL.darker(0.2); cRGB = cHSL.rgb(); displayable = cHSL.displayable(); cString = cHSL.toString(); +cString = cHSL.hex(); console.log('Channels = (h : %d, s: %d, l: %d)', cHSL.h, cHSL.s, cHSL.l); console.log('Opacity = %d', cHSL.opacity); @@ -70,6 +72,7 @@ cLab = cLab.darker(0.2); cRGB = cLab.rgb(); displayable = cLab.displayable(); cString = cLab.toString(); +cString = cLab.hex(); console.log('Channels = (l : %d, a: %d, b: %d)', cLab.l, cLab.a, cLab.b); console.log('Opacity = %d', cLab.opacity); @@ -89,6 +92,7 @@ cHcl = cHcl.darker(0.2); cRGB = cHcl.rgb(); displayable = cHcl.displayable(); cString = cHcl.toString(); +cString = cHcl.hex(); console.log('Channels = (h : %d, c: %d, l: %d)', cHcl.h, cHcl.c, cHcl.l); console.log('Opacity = %d', cHcl.opacity); @@ -108,6 +112,7 @@ cCubehelix = cCubehelix.darker(0.2); cRGB = cCubehelix.rgb(); displayable = cCubehelix.displayable(); cString = cCubehelix.toString(); +cString = cCubehelix.hex(); console.log('Channels = (h : %d, s: %d, l: %d)', cCubehelix.h, cCubehelix.s, cCubehelix.l); console.log('Opacity = %d', cCubehelix.opacity); diff --git a/types/d3-color/index.d.ts b/types/d3-color/index.d.ts index 825b82d9c4..1682fe653f 100644 --- a/types/d3-color/index.d.ts +++ b/types/d3-color/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for D3JS d3-color module 1.0 +// Type definitions for D3JS d3-color module 1.2 // Project: https://github.com/d3/d3-color/ // Definitions by: Tom Wanzek // Alex Ford @@ -6,7 +6,7 @@ // denisname // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// Last module patch version validated against: 1.0.3 +// Last module patch version validated against: 1.2.0 // --------------------------------------------------------------------------- // Shared Type Definitions and Interfaces @@ -27,6 +27,11 @@ export interface ColorCommonInstance { brighter(k?: number): this; darker(k?: number): this; rgb(): RGBColor; + /** + * Returns a hexadecimal string representing this color. + * If this color is not displayable, a suitable displayable color is returned instead. For example, RGB channel values greater than 255 are clamped to 255. + */ + hex(): string; } export interface Color { @@ -47,7 +52,15 @@ export interface RGBColor extends Color { opacity: number; brighter(k?: number): this; darker(k?: number): this; + /** + * Returns the RGB equivalent of this color. + */ rgb(): this; + /** + * Returns a hexadecimal string representing this color. + * If this color is not displayable, a suitable displayable color is returned instead. For example, RGB channel values greater than 255 are clamped to 255. + */ + hex(): string; } export interface RGBColorFactory extends Function { @@ -65,6 +78,11 @@ export interface HSLColor extends Color { brighter(k?: number): this; darker(k?: number): this; rgb(): RGBColor; + /** + * Returns a hexadecimal string representing this color. + * If this color is not displayable, a suitable displayable color is returned instead. For example, RGB channel values greater than 255 are clamped to 255. + */ + hex(): string; } export interface HSLColorFactory extends Function { @@ -82,6 +100,11 @@ export interface LabColor extends Color { brighter(k?: number): this; darker(k?: number): this; rgb(): RGBColor; + /** + * Returns a hexadecimal string representing this color. + * If this color is not displayable, a suitable displayable color is returned instead. For example, RGB channel values greater than 255 are clamped to 255. + */ + hex(): string; } export interface LabColorFactory extends Function { @@ -99,6 +122,11 @@ export interface HCLColor extends Color { brighter(k?: number): this; darker(k?: number): this; rgb(): RGBColor; + /** + * Returns a hexadecimal string representing this color. + * If this color is not displayable, a suitable displayable color is returned instead. For example, RGB channel values greater than 255 are clamped to 255. + */ + hex(): string; } export interface HCLColorFactory extends Function { @@ -116,6 +144,11 @@ export interface CubehelixColor extends Color { brighter(k?: number): this; darker(k?: number): this; rgb(): RGBColor; + /** + * Returns a hexadecimal string representing this color. + * If this color is not displayable, a suitable displayable color is returned instead. For example, RGB channel values greater than 255 are clamped to 255. + */ + hex(): string; } export interface CubehelixColorFactory extends Function { From 415972a8af1e742b23894e706042f59f6276dcb6 Mon Sep 17 00:00:00 2001 From: Hugues Stefanski Date: Mon, 7 May 2018 21:38:32 +0200 Subject: [PATCH 014/575] #25583 : added gray method --- types/d3-color/d3-color-tests.ts | 6 ++++ types/d3-color/index.d.ts | 60 +++++++++++++++++++------------- types/d3-geo/index.d.ts | 2 +- 3 files changed, 43 insertions(+), 25 deletions(-) diff --git a/types/d3-color/d3-color-tests.ts b/types/d3-color/d3-color-tests.ts index 135456a005..d8ea79b637 100644 --- a/types/d3-color/d3-color-tests.ts +++ b/types/d3-color/d3-color-tests.ts @@ -76,6 +76,10 @@ cString = cLab.hex(); console.log('Channels = (l : %d, a: %d, b: %d)', cLab.l, cLab.a, cLab.b); console.log('Opacity = %d', cLab.opacity); +// Signature tests for Gray +cLab = d3Color.gray(120); +cLab = d3Color.gray(120, 0.5); + // Signature tests for HCL let cHcl: d3Color.HCLColor; @@ -126,6 +130,8 @@ if (color instanceof d3Color.rgb) { cHSL = color; } else if (color instanceof d3Color.lab) { cLab = color; +} else if (color instanceof d3Color.gray) { + cLab = color; } else if (color instanceof d3Color.hcl) { cHcl = color; } else if (color instanceof d3Color.cubehelix) { diff --git a/types/d3-color/index.d.ts b/types/d3-color/index.d.ts index 1682fe653f..465618b5e8 100644 --- a/types/d3-color/index.d.ts +++ b/types/d3-color/index.d.ts @@ -1,9 +1,10 @@ // Type definitions for D3JS d3-color module 1.2 // Project: https://github.com/d3/d3-color/ -// Definitions by: Tom Wanzek -// Alex Ford -// Boris Yankov -// denisname +// Definitions by: Tom Wanzek , +// Alex Ford , +// Boris Yankov , +// denisname , +// Hugues Stefanski // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // Last module patch version validated against: 1.2.0 @@ -27,10 +28,10 @@ export interface ColorCommonInstance { brighter(k?: number): this; darker(k?: number): this; rgb(): RGBColor; - /** - * Returns a hexadecimal string representing this color. - * If this color is not displayable, a suitable displayable color is returned instead. For example, RGB channel values greater than 255 are clamped to 255. - */ + /** + * Returns a hexadecimal string representing this color. + * If this color is not displayable, a suitable displayable color is returned instead. For example, RGB channel values greater than 255 are clamped to 255. + */ hex(): string; } @@ -78,10 +79,10 @@ export interface HSLColor extends Color { brighter(k?: number): this; darker(k?: number): this; rgb(): RGBColor; - /** - * Returns a hexadecimal string representing this color. - * If this color is not displayable, a suitable displayable color is returned instead. For example, RGB channel values greater than 255 are clamped to 255. - */ + /** + * Returns a hexadecimal string representing this color. + * If this color is not displayable, a suitable displayable color is returned instead. For example, RGB channel values greater than 255 are clamped to 255. + */ hex(): string; } @@ -100,10 +101,10 @@ export interface LabColor extends Color { brighter(k?: number): this; darker(k?: number): this; rgb(): RGBColor; - /** - * Returns a hexadecimal string representing this color. - * If this color is not displayable, a suitable displayable color is returned instead. For example, RGB channel values greater than 255 are clamped to 255. - */ + /** + * Returns a hexadecimal string representing this color. + * If this color is not displayable, a suitable displayable color is returned instead. For example, RGB channel values greater than 255 are clamped to 255. + */ hex(): string; } @@ -114,6 +115,15 @@ export interface LabColorFactory extends Function { readonly prototype: LabColor; } +/** + * Constructs a new Lab color with the specified l value and a = b = 0. + */ +export interface GrayColorFactory extends Function { + (l: number, opacity?: number): LabColor; + readonly prototype: LabColor; + +} + export interface HCLColor extends Color { h: number; c: number; @@ -122,10 +132,10 @@ export interface HCLColor extends Color { brighter(k?: number): this; darker(k?: number): this; rgb(): RGBColor; - /** - * Returns a hexadecimal string representing this color. - * If this color is not displayable, a suitable displayable color is returned instead. For example, RGB channel values greater than 255 are clamped to 255. - */ + /** + * Returns a hexadecimal string representing this color. + * If this color is not displayable, a suitable displayable color is returned instead. For example, RGB channel values greater than 255 are clamped to 255. + */ hex(): string; } @@ -144,10 +154,10 @@ export interface CubehelixColor extends Color { brighter(k?: number): this; darker(k?: number): this; rgb(): RGBColor; - /** - * Returns a hexadecimal string representing this color. - * If this color is not displayable, a suitable displayable color is returned instead. For example, RGB channel values greater than 255 are clamped to 255. - */ + /** + * Returns a hexadecimal string representing this color. + * If this color is not displayable, a suitable displayable color is returned instead. For example, RGB channel values greater than 255 are clamped to 255. + */ hex(): string; } @@ -170,6 +180,8 @@ export const hsl: HSLColorFactory; export const lab: LabColorFactory; +export const gray: GrayColorFactory; + export const hcl: HCLColorFactory; export const cubehelix: CubehelixColorFactory; diff --git a/types/d3-geo/index.d.ts b/types/d3-geo/index.d.ts index a41f67618a..5dd835026d 100644 --- a/types/d3-geo/index.d.ts +++ b/types/d3-geo/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for D3JS d3-geo module 1.10 // Project: https://github.com/d3/d3-geo/ -// Definitions by: Hugues Stefanski , Tom Wanzek , Alex Ford , Boris Yankov +// Definitions by: Hugues Stefanski , Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 From 3d87842d8b21a84ac0d71c0aa1c5701c1b107a46 Mon Sep 17 00:00:00 2001 From: Hugues Stefanski Date: Mon, 7 May 2018 21:41:37 +0200 Subject: [PATCH 015/575] #25583 : added lch method --- types/d3-color/d3-color-tests.ts | 8 ++++++++ types/d3-color/index.d.ts | 9 +++++++++ 2 files changed, 17 insertions(+) diff --git a/types/d3-color/d3-color-tests.ts b/types/d3-color/d3-color-tests.ts index d8ea79b637..9be5a3d067 100644 --- a/types/d3-color/d3-color-tests.ts +++ b/types/d3-color/d3-color-tests.ts @@ -100,6 +100,12 @@ cString = cHcl.hex(); console.log('Channels = (h : %d, c: %d, l: %d)', cHcl.h, cHcl.c, cHcl.l); console.log('Opacity = %d', cHcl.opacity); +cHcl = d3Color.lch(40, 50, 120); +cHcl = d3Color.lch(40, 50, 120, 0.5); +cHcl = d3Color.lch('steelblue'); +cHcl = d3Color.lch('rgba(20, 100, 200, 0.5)'); +cHcl = d3Color.lch(c); + // Signature tests for Cubehelix let cCubehelix: d3Color.CubehelixColor; @@ -134,6 +140,8 @@ if (color instanceof d3Color.rgb) { cLab = color; } else if (color instanceof d3Color.hcl) { cHcl = color; +} else if (color instanceof d3Color.lch) { + cHcl = color; } else if (color instanceof d3Color.cubehelix) { cCubehelix = color; } else if (color === null) { diff --git a/types/d3-color/index.d.ts b/types/d3-color/index.d.ts index 465618b5e8..70ff67477e 100644 --- a/types/d3-color/index.d.ts +++ b/types/d3-color/index.d.ts @@ -146,6 +146,13 @@ export interface HCLColorFactory extends Function { readonly prototype: HCLColor; } +export interface LCHColorFactory extends Function { + (l: number, c: number, h: number, opacity?: number): HCLColor; + (cssColorSpecifier: string): HCLColor; + (color: ColorSpaceObject | ColorCommonInstance): HCLColor; + readonly prototype: HCLColor; +} + export interface CubehelixColor extends Color { h: number; s: number; @@ -184,4 +191,6 @@ export const gray: GrayColorFactory; export const hcl: HCLColorFactory; +export const lch: LCHColorFactory; + export const cubehelix: CubehelixColorFactory; From 4b4c00c4bb1832e668a9818521f57202dc71d64a Mon Sep 17 00:00:00 2001 From: Hugues Stefanski Date: Mon, 7 May 2018 22:04:42 +0200 Subject: [PATCH 016/575] Fix comments --- types/d3-color/index.d.ts | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/types/d3-color/index.d.ts b/types/d3-color/index.d.ts index 70ff67477e..3c11d8f88d 100644 --- a/types/d3-color/index.d.ts +++ b/types/d3-color/index.d.ts @@ -28,11 +28,6 @@ export interface ColorCommonInstance { brighter(k?: number): this; darker(k?: number): this; rgb(): RGBColor; - /** - * Returns a hexadecimal string representing this color. - * If this color is not displayable, a suitable displayable color is returned instead. For example, RGB channel values greater than 255 are clamped to 255. - */ - hex(): string; } export interface Color { @@ -57,10 +52,10 @@ export interface RGBColor extends Color { * Returns the RGB equivalent of this color. */ rgb(): this; - /** - * Returns a hexadecimal string representing this color. - * If this color is not displayable, a suitable displayable color is returned instead. For example, RGB channel values greater than 255 are clamped to 255. - */ + /** + * Returns a hexadecimal string representing this color. + * If this color is not displayable, a suitable displayable color is returned instead. For example, RGB channel values greater than 255 are clamped to 255. + */ hex(): string; } @@ -79,7 +74,7 @@ export interface HSLColor extends Color { brighter(k?: number): this; darker(k?: number): this; rgb(): RGBColor; - /** + /** * Returns a hexadecimal string representing this color. * If this color is not displayable, a suitable displayable color is returned instead. For example, RGB channel values greater than 255 are clamped to 255. */ @@ -101,7 +96,7 @@ export interface LabColor extends Color { brighter(k?: number): this; darker(k?: number): this; rgb(): RGBColor; - /** + /** * Returns a hexadecimal string representing this color. * If this color is not displayable, a suitable displayable color is returned instead. For example, RGB channel values greater than 255 are clamped to 255. */ @@ -121,7 +116,6 @@ export interface LabColorFactory extends Function { export interface GrayColorFactory extends Function { (l: number, opacity?: number): LabColor; readonly prototype: LabColor; - } export interface HCLColor extends Color { @@ -132,10 +126,10 @@ export interface HCLColor extends Color { brighter(k?: number): this; darker(k?: number): this; rgb(): RGBColor; - /** - * Returns a hexadecimal string representing this color. - * If this color is not displayable, a suitable displayable color is returned instead. For example, RGB channel values greater than 255 are clamped to 255. - */ + /** + * Returns a hexadecimal string representing this color. + * If this color is not displayable, a suitable displayable color is returned instead. For example, RGB channel values greater than 255 are clamped to 255. + */ hex(): string; } @@ -161,7 +155,7 @@ export interface CubehelixColor extends Color { brighter(k?: number): this; darker(k?: number): this; rgb(): RGBColor; - /** + /** * Returns a hexadecimal string representing this color. * If this color is not displayable, a suitable displayable color is returned instead. For example, RGB channel values greater than 255 are clamped to 255. */ From ee0fd76b1ac8258cdc8daaed11b4e8877a088f28 Mon Sep 17 00:00:00 2001 From: jethro larson Date: Mon, 7 May 2018 19:43:25 -0700 Subject: [PATCH 017/575] Add checkPropTypes definition to @types/prop-types I used the jsdoc as guide in https://github.com/facebook/prop-types/blob/master/checkPropTypes.js --- types/prop-types/index.d.ts | 12 ++++++++++++ types/prop-types/prop-types-tests.ts | 2 ++ 2 files changed, 14 insertions(+) diff --git a/types/prop-types/index.d.ts b/types/prop-types/index.d.ts index ebeef159b0..67146e6cc7 100644 --- a/types/prop-types/index.d.ts +++ b/types/prop-types/index.d.ts @@ -28,3 +28,15 @@ export function oneOfType(types: Array>): Requireable; export function arrayOf(type: Validator): Requireable; export function objectOf(type: Validator): Requireable; export function shape(type: ValidationMap): Requireable; + +/** + * Assert that the values match with the type specs. + * Error messages are memorized and will only be shown once. + * + * @param typeSpecs Map of name to a ReactPropType + * @param values Runtime values that need to be type-checked + * @param location e.g. "prop", "context", "child context" + * @param componentName Name of the component for error messages. + * @param getStack Returns the component stack. + */ +export function checkPropTypes(typeSpecs: any, values: any, location: string, componentName: string, getStack?: () => any): void; diff --git a/types/prop-types/prop-types-tests.ts b/types/prop-types/prop-types-tests.ts index 238a22b1ef..4d5a939b6e 100644 --- a/types/prop-types/prop-types-tests.ts +++ b/types/prop-types/prop-types-tests.ts @@ -25,3 +25,5 @@ const propTypes: PropTypes.ValidationMap = { node: PropTypes.node.isRequired, element: PropTypes.element.isRequired }; + +PropTypes.checkPropTypes({xs: PropTypes.array}, {xs: []}, 'location', 'componentName'); From 097f69c5878da16b861f3e69870e79fe63559340 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Tue, 8 May 2018 13:33:16 +0400 Subject: [PATCH 018/575] PouchDB: update options with find selector and others --- types/pouchdb-core/index.d.ts | 38 +++++++++++++++++++++++++++- types/pouchdb-replication/index.d.ts | 8 +++++- 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/types/pouchdb-core/index.d.ts b/types/pouchdb-core/index.d.ts index 4b1d56d860..c077051ffb 100644 --- a/types/pouchdb-core/index.d.ts +++ b/types/pouchdb-core/index.d.ts @@ -2,11 +2,12 @@ // Project: https://pouchdb.com/ // Definitions by: Simon Paulger , Jakub Navratil , // Brian Geppert , Frederico Galvão , -// Tobias Bales +// Tobias Bales , Sebastián Ramírez // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 /// +/// interface Buffer extends Uint8Array { write(string: string, offset?: number, length?: number, encoding?: string): number; @@ -412,6 +413,41 @@ declare namespace PouchDB { * Note: options.filter must be set to '_view' for this option to work. */ view?: string; + + /** + * Filter using a query/pouchdb-find selector. Note: Selectors are not supported in CouchDB 1.x. + * Cannot be used in combination with the filter option. + */ + selector?: PouchDB.Find.Selector; + + /** + * (previously options.returnDocs): Is available for non-http databases and defaults to true. + * Passing false prevents the changes feed from keeping all the documents in memory – in other + * words complete always has an empty results array, and the change event is the only way to get the event. + * Useful for large change sets where otherwise you would run out of memory. + */ + return_docs?: boolean; + + /** + * Only available for http databases, this configures how many changes to fetch at a time. + * Increasing this can reduce the number of requests made. Default is 25. + */ + batch_size?: number; + + /** + * Specifies how many revisions are returned in the changes array. + * The default, 'main_only', will only return the current “winning” revision; + * 'all_docs' will return all leaf revisions (including conflicts and deleted former conflicts). + * Most likely you won’t need this unless you’re writing a replicator. + */ + style?: 'main_only' | 'all_docs'; + + /** + * Only available for http databases. Specifies that seq information only be generated every N changes. + * Larger values can improve changes throughput with CouchDB 2.0 and later. + * Note that last_seq is always populated regardless. + */ + seq_interval?: number; } interface ChangesResponseChange { diff --git a/types/pouchdb-replication/index.d.ts b/types/pouchdb-replication/index.d.ts index b0611b840a..97dbc238a6 100644 --- a/types/pouchdb-replication/index.d.ts +++ b/types/pouchdb-replication/index.d.ts @@ -1,10 +1,11 @@ // Type definitions for pouchdb-replication 6.1 // Project: https://pouchdb.com/ -// Definitions by: Jakub Navratil +// Definitions by: Jakub Navratil , Sebastián Ramírez // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 /// +/// declare namespace PouchDB { namespace Replication { @@ -43,6 +44,11 @@ declare namespace PouchDB { */ view?: string; + /** + * Filter using a query/pouchdb-find selector. Note: Selectors are not supported in CouchDB 1.x. + */ + selector?: PouchDB.Find.Selector; + /** Replicate changes after the given sequence number. */ since?: any; From b76cc39de3e26cc3430b3ac6c8048e97207a1f47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Tue, 8 May 2018 13:44:13 +0400 Subject: [PATCH 019/575] Update versions of packages --- types/pouchdb-core/index.d.ts | 2 +- types/pouchdb-replication/index.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/types/pouchdb-core/index.d.ts b/types/pouchdb-core/index.d.ts index c077051ffb..01c856fb57 100644 --- a/types/pouchdb-core/index.d.ts +++ b/types/pouchdb-core/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for pouchdb-core 6.1 +// Type definitions for pouchdb-core 6.4.3 // Project: https://pouchdb.com/ // Definitions by: Simon Paulger , Jakub Navratil , // Brian Geppert , Frederico Galvão , diff --git a/types/pouchdb-replication/index.d.ts b/types/pouchdb-replication/index.d.ts index 97dbc238a6..b16256bff0 100644 --- a/types/pouchdb-replication/index.d.ts +++ b/types/pouchdb-replication/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for pouchdb-replication 6.1 +// Type definitions for pouchdb-replication 6.4.3 // Project: https://pouchdb.com/ // Definitions by: Jakub Navratil , Sebastián Ramírez // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 44a334cfb920b9badbb95f16d38cdccdb04894be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Tue, 8 May 2018 14:06:13 +0400 Subject: [PATCH 020/575] PouchDB update version, remove PATCH --- types/pouchdb-core/index.d.ts | 2 +- types/pouchdb-replication/index.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/types/pouchdb-core/index.d.ts b/types/pouchdb-core/index.d.ts index 01c856fb57..16758500e5 100644 --- a/types/pouchdb-core/index.d.ts +++ b/types/pouchdb-core/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for pouchdb-core 6.4.3 +// Type definitions for pouchdb-core 6.4 // Project: https://pouchdb.com/ // Definitions by: Simon Paulger , Jakub Navratil , // Brian Geppert , Frederico Galvão , diff --git a/types/pouchdb-replication/index.d.ts b/types/pouchdb-replication/index.d.ts index b16256bff0..dab75401d5 100644 --- a/types/pouchdb-replication/index.d.ts +++ b/types/pouchdb-replication/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for pouchdb-replication 6.4.3 +// Type definitions for pouchdb-replication 6.4 // Project: https://pouchdb.com/ // Definitions by: Jakub Navratil , Sebastián Ramírez // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 9fdadb327a9b42907ed416b1fd13b3f0a4dce025 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Tue, 8 May 2018 14:12:01 +0400 Subject: [PATCH 021/575] PouchDB: remove unnecessary qualifier --- types/pouchdb-core/index.d.ts | 2 +- types/pouchdb-replication/index.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/types/pouchdb-core/index.d.ts b/types/pouchdb-core/index.d.ts index 16758500e5..7534ad902c 100644 --- a/types/pouchdb-core/index.d.ts +++ b/types/pouchdb-core/index.d.ts @@ -418,7 +418,7 @@ declare namespace PouchDB { * Filter using a query/pouchdb-find selector. Note: Selectors are not supported in CouchDB 1.x. * Cannot be used in combination with the filter option. */ - selector?: PouchDB.Find.Selector; + selector?: Find.Selector; /** * (previously options.returnDocs): Is available for non-http databases and defaults to true. diff --git a/types/pouchdb-replication/index.d.ts b/types/pouchdb-replication/index.d.ts index dab75401d5..a0f581b40a 100644 --- a/types/pouchdb-replication/index.d.ts +++ b/types/pouchdb-replication/index.d.ts @@ -47,7 +47,7 @@ declare namespace PouchDB { /** * Filter using a query/pouchdb-find selector. Note: Selectors are not supported in CouchDB 1.x. */ - selector?: PouchDB.Find.Selector; + selector?: Find.Selector; /** Replicate changes after the given sequence number. */ since?: any; From e54e1ba90ece9c45226be130b85030bc7d00eb5a Mon Sep 17 00:00:00 2001 From: leanazulyoro Date: Tue, 8 May 2018 11:36:44 -0300 Subject: [PATCH 022/575] Fix: return type for restify's conditionaHandler; Added: test for restify's conditionalHandler --- types/restify/index.d.ts | 2 +- types/restify/restify-tests.ts | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/types/restify/index.d.ts b/types/restify/index.d.ts index 30a5220022..bacea67cab 100644 --- a/types/restify/index.d.ts +++ b/types/restify/index.d.ts @@ -955,7 +955,7 @@ export namespace plugins { /** * Runs first handler that matches to the condition */ - function conditionalHandler(candidates: HandlerCandidate | HandlerCandidate[]): RequestHandler[]; + function conditionalHandler(candidates: HandlerCandidate | HandlerCandidate[]): RequestHandler; /** * Conditional headers (If-*) diff --git a/types/restify/restify-tests.ts b/types/restify/restify-tests.ts index 1ba9b05768..8601d912ac 100644 --- a/types/restify/restify-tests.ts +++ b/types/restify/restify-tests.ts @@ -148,6 +148,14 @@ server.use(restify.plugins.throttle({ } } })); +server.use(restify.plugins.conditionalHandler([{ + contentType: ['text/plain'], + handler: (req: restify.Request, res: restify.Response, next: restify.Next): void => { + res.send('OK'); + next(); + }, + version: '0.0.0', +}])); const logger = Logger.createLogger({ name: "test" }); From ded5430271d96e7438e202caae82ece7e7dda2c5 Mon Sep 17 00:00:00 2001 From: Sinziana Nicolae Date: Tue, 8 May 2018 19:10:40 +0300 Subject: [PATCH 023/575] Add types for daySize and verticalBorderSpacing in DayPickerRangeControllerShape --- types/react-dates/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/react-dates/index.d.ts b/types/react-dates/index.d.ts index dc852dde3b..e9dc35bf05 100644 --- a/types/react-dates/index.d.ts +++ b/types/react-dates/index.d.ts @@ -224,10 +224,12 @@ declare namespace ReactDates { renderCalendarInfo?: () => (string | JSX.Element), onOutsideClick?: (e: any) => void, keepOpenOnDateSelect?: boolean, + verticalBorderSpacing?: number, // navigation related props navPrev?: string | JSX.Element, navNext?: string | JSX.Element, + daySize?: number, hideKeyboardShortcutsPanel?: boolean; onPrevMonthClick?: (e: React.EventHandler>) => void, onNextMonthClick?: (e: React.EventHandler>) => void, From a66d69a74651b8d584c849111017265c1e2b4b1b Mon Sep 17 00:00:00 2001 From: Sinziana Nicolae Date: Tue, 8 May 2018 19:32:03 +0300 Subject: [PATCH 024/575] Change order of types --- types/react-dates/index.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/types/react-dates/index.d.ts b/types/react-dates/index.d.ts index 1d42034e78..92fa68e8d7 100644 --- a/types/react-dates/index.d.ts +++ b/types/react-dates/index.d.ts @@ -166,7 +166,7 @@ declare namespace ReactDates { hideKeyboardShortcutsPanel?: boolean, daySize?: number, isRTL?: boolean, - verticalSpacing?: number, + verticalSpacing?: number, verticalHeight?: number| null, // navigation related props @@ -242,20 +242,20 @@ declare namespace ReactDates { renderCalendarInfo?: () => (string | JSX.Element), onOutsideClick?: (e: any) => void, keepOpenOnDateSelect?: boolean, - verticalBorderSpacing?: number, + hideKeyboardShortcutsPanel?: boolean; noBorder?: boolean, + verticalBorderSpacing?: number, firstDayOfWeek? : 0 | 1 | 2 | 3 | 4 | 5 | 6, // navigation related props navPrev?: string | JSX.Element, navNext?: string | JSX.Element, - daySize?: number, - hideKeyboardShortcutsPanel?: boolean; onPrevMonthClick?: (newCurrentMonth: momentPropTypes.momentObj) => void, onNextMonthClick?: (newCurrentMonth: momentPropTypes.momentObj) => void, transitionDuration?: number, // day presentation and interaction related props + daySize?: number, renderCalendarDay?: (day: momentPropTypes.momentObj) => (string | JSX.Element), renderDayContents?: (day: momentPropTypes.momentObj) => (string | JSX.Element), minimumNights?: number, From aa10525f10489fcbd69898e4e1622ea1278d44fe Mon Sep 17 00:00:00 2001 From: Zanaxhir Date: Wed, 9 May 2018 09:17:47 +0200 Subject: [PATCH 025/575] add keepFocusOnInput https://github.com/airbnb/react-dates/blob/master/src/components/DateRangePicker.jsx#L68 --- types/react-dates/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/react-dates/index.d.ts b/types/react-dates/index.d.ts index f9444c1b7c..c4c65b582c 100644 --- a/types/react-dates/index.d.ts +++ b/types/react-dates/index.d.ts @@ -41,6 +41,7 @@ declare namespace ReactDates { endDateId?: string, endDatePlaceholderText?: string, disabled?: boolean, + keepFocusOnInput?: boolean, required?: boolean, readOnly?: boolean, screenReaderInputMessage?: string, From eb77b54d756a418e1714ecb93b3a813e715fbcac Mon Sep 17 00:00:00 2001 From: Damien Sandras Date: Wed, 9 May 2018 11:12:30 +0200 Subject: [PATCH 026/575] sip.js: Add P-Asserted-Identity property This was part of upstream merge request 549. --- types/sip.js/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/sip.js/index.d.ts b/types/sip.js/index.d.ts index 65aa453a68..65466ee840 100644 --- a/types/sip.js/index.d.ts +++ b/types/sip.js/index.d.ts @@ -102,6 +102,7 @@ export interface Session { request?: IncomingRequest | OutgoingRequest; localIdentity?: NameAddrHeader; remoteIdentity?: NameAddrHeader; + assertedIdentity?: NameAddrHeader; data: ClientContext | ServerContext; sessionDescriptionHandler: SessionDescriptionHandler; From 233bdad5ad2ae9beada01d533937929cf1982b04 Mon Sep 17 00:00:00 2001 From: Matthew Bull Date: Wed, 9 May 2018 14:54:57 +0100 Subject: [PATCH 027/575] Fixing export to match package chai-jest-snapshots doesn't use `export default`, so `import * as chaiJestSnapshots from 'chai-jest-snapshots'` gives compiler errors and `import chaiJestSnapshots from 'chai-jest-snapshots'` gives runtime errors --- types/chai-jest-snapshot/chai-jest-snapshot-tests.ts | 2 +- types/chai-jest-snapshot/index.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/types/chai-jest-snapshot/chai-jest-snapshot-tests.ts b/types/chai-jest-snapshot/chai-jest-snapshot-tests.ts index c93c4a1d04..cd35998db8 100644 --- a/types/chai-jest-snapshot/chai-jest-snapshot-tests.ts +++ b/types/chai-jest-snapshot/chai-jest-snapshot-tests.ts @@ -1,4 +1,4 @@ -import chaiJestSnapshot from 'chai-jest-snapshot'; +import * as chaiJestSnapshot from 'chai-jest-snapshot'; import { expect } from 'chai'; chai.use(chaiJestSnapshot); diff --git a/types/chai-jest-snapshot/index.d.ts b/types/chai-jest-snapshot/index.d.ts index 470e4fa423..27ec049b14 100644 --- a/types/chai-jest-snapshot/index.d.ts +++ b/types/chai-jest-snapshot/index.d.ts @@ -40,4 +40,4 @@ interface ChaiJestSnapshot { } declare var ChaiJestSnapshot: ChaiJestSnapshot; -export default ChaiJestSnapshot; +export = ChaiJestSnapshot; From ebfd51b6d2fb5227e22745dc0d5067248aa68633 Mon Sep 17 00:00:00 2001 From: stuckupfool Date: Wed, 9 May 2018 09:28:36 -0500 Subject: [PATCH 028/575] Update README.md --- types/rc-slider/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/rc-slider/README.md b/types/rc-slider/README.md index 622c75a90e..6c56f6c2e1 100644 --- a/types/rc-slider/README.md +++ b/types/rc-slider/README.md @@ -1,5 +1,5 @@ # Installation -> `npm install --save @types/rc-select` +> `npm install --save @types/rc-slider` # Summary This package contains type definitions for rc-slider (https://github.com/react-component/slider). From 583174c2f39b4ccc8d191df32a5676b0e5e7c15e Mon Sep 17 00:00:00 2001 From: Todd Brannam Date: Wed, 9 May 2018 16:00:26 -0400 Subject: [PATCH 029/575] Update index.d.ts Add support for alternative Provider options, such as ApolloProvider exposing new-ish `options` parameter in `Navigatiotor` `function registerComponent(screenID, generator, store = undefined, Provider = undefined, options = {})` --- types/react-native-navigation/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-native-navigation/index.d.ts b/types/react-native-navigation/index.d.ts index 75c0d51be0..16da706d06 100644 --- a/types/react-native-navigation/index.d.ts +++ b/types/react-native-navigation/index.d.ts @@ -7,7 +7,7 @@ import * as React from 'react'; export namespace Navigation { - function registerComponent(screenID: string, generator: () => React.ComponentType, store?: any, provider?: any): void; + function registerComponent(screenID: string, generator: () => React.ComponentType, store?: any, provider?: any, options?: any): void; function startTabBasedApp(params: TabBasedApp): void; function startSingleScreenApp(params: SingleScreenApp): void; function showModal(params: ModalScreen): void; From 0496cb27f7a980d2d3061d9d1175d66c86c4fcf9 Mon Sep 17 00:00:00 2001 From: Dmytro Kossa Date: Wed, 9 May 2018 18:14:46 -0700 Subject: [PATCH 030/575] polymer/index.d.ts - add observeNodes / unobserveNodes Documented here: https://www.polymer-project.org/1.0/docs/devguide/local-dom#observe-nodes --- types/polymer/index.d.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/types/polymer/index.d.ts b/types/polymer/index.d.ts index a4eca3e70b..569842066a 100644 --- a/types/polymer/index.d.ts +++ b/types/polymer/index.d.ts @@ -232,6 +232,12 @@ declare global { flush():void; } + interface ObservedNodeInfo { + target: Node; + addedNodes: Node[]; + removedNode: Node[]; + } + interface DomApi { appendChild(node: Node): Node; @@ -257,6 +263,10 @@ declare global { setAttribute(name: string, value: any):void; removeAttribute(name: string):void; + + observeNodes(callback: (info: ObservedNodeInfo) => void): {}; + + unobserveNodes(observer: {}): void; childNodes:Node[]; From 5af75097bb469ebf4be90279038bf020c9a1a9b1 Mon Sep 17 00:00:00 2001 From: Todd Brannam Date: Wed, 9 May 2018 21:27:42 -0400 Subject: [PATCH 031/575] Update react-native-navigation-tests.tsx Add example that exercises the expanded function `registerComponent` --- .../react-native-navigation-tests.tsx | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/types/react-native-navigation/react-native-navigation-tests.tsx b/types/react-native-navigation/react-native-navigation-tests.tsx index 004673e10a..371465b1c9 100644 --- a/types/react-native-navigation/react-native-navigation-tests.tsx +++ b/types/react-native-navigation/react-native-navigation-tests.tsx @@ -63,7 +63,23 @@ const Drawer = (props: NavigationComponentProps) => { ); }; -Navigation.registerComponent('example.Screen1', () => Screen1); +interface TestProviderProps { + test: string; +} + +class TestProvider extends React.Component { + getChildContext() { + return { + test: this.props.test + }; + } + + render() { + return this.props.children; + } +} + +Navigation.registerComponent('example.Screen1', () => Screen1, {}, TestProvider, {test: "test"}); Navigation.registerComponent('example.Screen2', () => Screen2); Navigation.registerComponent('example.Drawer', () => Drawer); From 349b0b7dc839ecfd1399e9f9aba0e29c125a47a3 Mon Sep 17 00:00:00 2001 From: Pascal Iske Date: Thu, 10 May 2018 13:08:58 +0200 Subject: [PATCH 032/575] fix(medium-editor): toolbar flag should also accept a boolean --- types/medium-editor/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/medium-editor/index.d.ts b/types/medium-editor/index.d.ts index c5724fd665..d5b84f1553 100644 --- a/types/medium-editor/index.d.ts +++ b/types/medium-editor/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for medium-editor 5.0 // Project: https://yabwe.github.io/medium-editor/ // Definitions by: keika299 +// pascaliske // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace MediumEditor { @@ -76,7 +77,7 @@ declare namespace MediumEditor { ownerDocument?: Document; spellcheck?: boolean; targetBlank?: boolean; - toolbar?: ToolbarOptions; + toolbar?: ToolbarOptions | boolean; anchorPreview?: AnchorPreviewOptions | boolean; placeholder?: PlaceholderOptions | boolean; anchor?: AnchorFormOptions; From 2016139475410827edcbbbcc17d6794e14c65bee Mon Sep 17 00:00:00 2001 From: Zev Spitz Date: Thu, 10 May 2018 16:37:44 +0200 Subject: [PATCH 033/575] Interop definitions - https://github.com/Microsoft/TypeScript/issues/21440 --- .../activex-interop/activex-interop-tests.ts | 49 ++++++++ types/activex-interop/index.d.ts | 113 ++++++++++++++++++ types/activex-interop/tsconfig.json | 21 ++++ types/activex-interop/tslint.json | 3 + 4 files changed, 186 insertions(+) create mode 100644 types/activex-interop/activex-interop-tests.ts create mode 100644 types/activex-interop/index.d.ts create mode 100644 types/activex-interop/tsconfig.json create mode 100644 types/activex-interop/tslint.json diff --git a/types/activex-interop/activex-interop-tests.ts b/types/activex-interop/activex-interop-tests.ts new file mode 100644 index 0000000000..e2ece7401e --- /dev/null +++ b/types/activex-interop/activex-interop-tests.ts @@ -0,0 +1,49 @@ +// copied from the definitions in activex-scripting +interface Dictionary { + /** Add a new key and item to the dictionary. */ + Add(Key: TKey, Item: TItem): void; + + /** Get the number of items in the dictionary. */ + readonly Count: number; + + /** Determine if a given key is in the dictionary. */ + Exists(Key: TKey): boolean; + HashVal(Key: TKey): any; + + /** Set or get the item for a given key */ + Item(Key: TKey): TItem; + + /** Get an array containing all items in the dictionary. */ + Items(): SafeArray; + + /** Change a key to a different key. */ + Key(Key: TKey): TKey; + + /** Get an array containing all keys in the dictionary. */ + Keys(): SafeArray; + + /** Remove a given key from the dictionary. */ + Remove(Key: TKey): void; + + /** Remove all information from the dictionary. */ + RemoveAll(): void; + + /** Set or get the item for a given key */ + (Key: TKey): TItem; +} + +interface ActiveXObjectNameMap { + 'Scripting.Dictionary': Dictionary; +} + +const dict: Dictionary = new ActiveXObject('Scripting.Dictionary'); +dict.Add('one', 1); +dict.Add('two', 2); +dict.Add('three', 3); + +const keyEnumerator = new Enumerator(dict.Keys()); +keyEnumerator.moveFirst(); +while (!keyEnumerator.atEnd()) { + const item = dict(keyEnumerator.item()); + const power = Math.pow(item, 2); +} diff --git a/types/activex-interop/index.d.ts b/types/activex-interop/index.d.ts new file mode 100644 index 0000000000..5b2a0acc42 --- /dev/null +++ b/types/activex-interop/index.d.ts @@ -0,0 +1,113 @@ +// Type definitions for Javascript Automation interop 0.0 +// Project: https://msdn.microsoft.com/en-us/library/ff521046(v=vs.85).aspx +// Definitions by: Zev Spitz +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +// tslint:disable-next-line no-empty-interface +interface ActiveXObjectNameMap { } + +interface ActiveXObject { + new (progid: K): ActiveXObjectNameMap[K]; + new(s: string): any; +} +declare var ActiveXObject: ActiveXObject; + +/** + * Represents an Automation SAFEARRAY + */ +declare class SafeArray { + private constructor(); + private SafeArray_typekey: SafeArray; +} + +/** + * Allows enumerating over a COM collection, which may not have indexed item access. + */ +interface Enumerator { + /** + * Returns true if the current item is the last one in the collection, or the collection is empty, + * or the current item is undefined. + */ + atEnd(): boolean; + + /** + * Returns the current item in the collection + */ + item(): T; + + /** + * Resets the current item in the collection to the first item. If there are no items in the collection, + * the current item is set to undefined. + */ + moveFirst(): void; + + /** + * Moves the current item to the next item in the collection. If the enumerator is at the end of + * the collection or the collection is empty, the current item is set to undefined. + */ + moveNext(): void; +} + +interface EnumeratorConstructor { + new (collection: SafeArray | { Item(index: any): T }): Enumerator; + new (collection: any): Enumerator; +} + +declare var Enumerator: EnumeratorConstructor; + +/** + * Enables reading from a COM safe array, which might have an alternate lower bound, or multiple dimensions. + */ +interface VBArray { + /** + * Returns the number of dimensions (1-based). + */ + dimensions(): number; + + /** + * Takes an index for each dimension in the array, and returns the item at the corresponding location. + */ + getItem(dimension1Index: number, ...dimensionNIndexes: number[]): T; + + /** + * Returns the smallest available index for a given dimension. + * @param dimension 1-based dimension (defaults to 1) + */ + lbound(dimension?: number): number; + + /** + * Returns the largest available index for a given dimension. + * @param dimension 1-based dimension (defaults to 1) + */ + ubound(dimension?: number): number; + + /** + * Returns a Javascript array with all the elements in the VBArray. If there are multiple dimensions, + * each successive dimension is appended to the end of the array. + * Example: [[1,2,3],[4,5,6]] becomes [1,2,3,4,5,6] + */ + toArray(): T[]; +} + +interface VBArrayConstructor { + new (safeArray: SafeArray): VBArray; +} + +declare var VBArray: VBArrayConstructor; + +/** + * Automation date (VT_DATE) + */ +declare class VarDate { + private constructor(); + private VarDate_typekey: VarDate; +} + +interface DateConstructor { + new(vd: VarDate): Date; +} + +interface Date { + getVarDate: () => VarDate; +} diff --git a/types/activex-interop/tsconfig.json b/types/activex-interop/tsconfig.json new file mode 100644 index 0000000000..49c7698384 --- /dev/null +++ b/types/activex-interop/tsconfig.json @@ -0,0 +1,21 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es5" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ "../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "activex-interop-tests.ts" + ] +} \ No newline at end of file diff --git a/types/activex-interop/tslint.json b/types/activex-interop/tslint.json new file mode 100644 index 0000000000..e60c15844f --- /dev/null +++ b/types/activex-interop/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file From 1a13b1ee20ed4f5a97eacc2fcc73e9aec8a0e2f6 Mon Sep 17 00:00:00 2001 From: Aankhen Date: Wed, 9 May 2018 12:08:59 +0530 Subject: [PATCH 034/575] Mention `npx` when talking about `dts-gen` in README.md. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7c58fe8901..02c1d979d8 100644 --- a/README.md +++ b/README.md @@ -120,7 +120,7 @@ Your package should have this structure: | tsconfig.json | This allows you to run `tsc` within the package. | | tslint.json | Enables linting. | -Generate these by running `npm install -g dts-gen` and `dts-gen --dt --name my-package-name --template module`. +Generate these by running `npx dts-gen --dt --name my-package-name --template module` if you have npm ≥ 5.2.0, `npm install -g dts-gen` and `dts-gen --dt --name my-package-name --template module` otherwise. See all options at [dts-gen](https://github.com/Microsoft/dts-gen). You may edit the `tsconfig.json` to add new files, to add `"target": "es6"` (needed for async functions), to add to `"lib"`, or to add the `"jsx"` compiler option. From ebd3517511fe6252993f48b9481f7b602ec9ce17 Mon Sep 17 00:00:00 2001 From: Zev Spitz Date: Thu, 10 May 2018 17:05:31 +0200 Subject: [PATCH 035/575] WSH definitions --- types/windows-script-host/index.d.ts | 201 ++++++++++++++++++ types/windows-script-host/package.json | 6 + types/windows-script-host/tsconfig.json | 23 ++ types/windows-script-host/tslint.json | 1 + .../windows-script-host-tests.ts | 1 + 5 files changed, 232 insertions(+) create mode 100644 types/windows-script-host/index.d.ts create mode 100644 types/windows-script-host/package.json create mode 100644 types/windows-script-host/tsconfig.json create mode 100644 types/windows-script-host/tslint.json create mode 100644 types/windows-script-host/windows-script-host-tests.ts diff --git a/types/windows-script-host/index.d.ts b/types/windows-script-host/index.d.ts new file mode 100644 index 0000000000..2130ecc805 --- /dev/null +++ b/types/windows-script-host/index.d.ts @@ -0,0 +1,201 @@ +// Type definitions for Windows Script Host 5.8 +// Project: https://msdn.microsoft.com/en-us/library/9bbdkx3k.aspx +// Definitions by: Zev Spitz +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// tslint:disable-next-line interface-name +interface ITextWriter { + Write(s: string): void; + WriteLine(s: string): void; + Close(): void; +} + +interface TextStreamBase { + /** + * The column number of the current character position in an input stream. + */ + Column: number; + + /** + * The current line number in an input stream. + */ + Line: number; + + /** + * Closes a text stream. + * It is not necessary to close standard streams; they close automatically when the process ends. If + * you close a standard stream, be aware that any other pointers to that standard stream become invalid. + */ + Close(): void; +} + +interface TextStreamWriter extends TextStreamBase { + /** + * Sends a string to an output stream. + */ + Write(s: string): void; + + /** + * Sends a specified number of blank lines (newline characters) to an output stream. + */ + WriteBlankLines(intLines: number): void; + + /** + * Sends a string followed by a newline character to an output stream. + */ + WriteLine(s: string): void; +} + +interface TextStreamReader extends TextStreamBase { + /** + * Returns a specified number of characters from an input stream, starting at the current pointer position. + * Does not return until the ENTER key is pressed. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + */ + Read(characters: number): string; + + /** + * Returns all characters from an input stream. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + */ + ReadAll(): string; + + /** + * Returns an entire line from an input stream. + * Although this method extracts the newline character, it does not add it to the returned string. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + */ + ReadLine(): string; + + /** + * Skips a specified number of characters when reading from an input text stream. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + * @param characters Positive number of characters to skip forward. (Backward skipping is not supported.) + */ + Skip(characters: number): void; + + /** + * Skips the next line when reading from an input text stream. + * Can only be used on a stream in reading mode, not writing or appending mode. + */ + SkipLine(): void; + + /** + * Indicates whether the stream pointer position is at the end of a line. + */ + AtEndOfLine: boolean; + + /** + * Indicates whether the stream pointer position is at the end of a stream. + */ + AtEndOfStream: boolean; +} + +declare var WScript: { + /** + * Outputs text to either a message box (under WScript.exe) or the command console window followed by + * a newline (under CScript.exe). + */ + Echo(s: any): void; + + /** + * Exposes the write-only error output stream for the current script. + * Can be accessed only while using CScript.exe. + */ + StdErr: TextStreamWriter; + + /** + * Exposes the write-only output stream for the current script. + * Can be accessed only while using CScript.exe. + */ + StdOut: TextStreamWriter; + Arguments: { length: number; Item(n: number): string; }; + + /** + * The full path of the currently running script. + */ + ScriptFullName: string; + + /** + * Forces the script to stop immediately, with an optional exit code. + */ + Quit(exitCode?: number): number; + + /** + * The Windows Script Host build version number. + */ + BuildVersion: number; + + /** + * Fully qualified path of the host executable. + */ + FullName: string; + + /** + * Gets/sets the script mode - interactive(true) or batch(false). + */ + Interactive: boolean; + + /** + * The name of the host executable (WScript.exe or CScript.exe). + */ + Name: string; + + /** + * Path of the directory containing the host executable. + */ + Path: string; + + /** + * The filename of the currently running script. + */ + ScriptName: string; + + /** + * Exposes the read-only input stream for the current script. + * Can be accessed only while using CScript.exe. + */ + StdIn: TextStreamReader; + + /** + * Windows Script Host version + */ + Version: string; + + /** + * Connects a COM object's event sources to functions named with a given prefix, in the form prefix_event. + */ + ConnectObject(objEventSource: any, strPrefix: string): void; + + /** + * Creates a COM object. + * @param strProgiID + * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events. + */ + CreateObject(strProgID: string, strPrefix?: string): any; + + /** + * Disconnects a COM object from its event sources. + */ + DisconnectObject(obj: any): void; + + /** + * Retrieves an existing object with the specified ProgID from memory, or creates a new one from a file. + * @param strPathname Fully qualified path to the file containing the object persisted to disk. + * For objects in memory, pass a zero-length string. + * @param strProgID + * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events. + */ + GetObject(strPathname: string, strProgID?: string, strPrefix?: string): any; + + /** + * Suspends script execution for a specified length of time, then continues execution. + * @param intTime Interval (in milliseconds) to suspend script execution. + */ + Sleep(intTime: number): void; +}; + +/** + * WSH is an alias for WScript under Windows Script Host + */ +declare var WSH: typeof WScript; diff --git a/types/windows-script-host/package.json b/types/windows-script-host/package.json new file mode 100644 index 0000000000..731af0072b --- /dev/null +++ b/types/windows-script-host/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "activex-interop": "*" + } +} \ No newline at end of file diff --git a/types/windows-script-host/tsconfig.json b/types/windows-script-host/tsconfig.json new file mode 100644 index 0000000000..d53dad8a20 --- /dev/null +++ b/types/windows-script-host/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es5" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "windows-script-host-tests.ts" + ] +} diff --git a/types/windows-script-host/tslint.json b/types/windows-script-host/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/windows-script-host/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/windows-script-host/windows-script-host-tests.ts b/types/windows-script-host/windows-script-host-tests.ts new file mode 100644 index 0000000000..7bd4e876b5 --- /dev/null +++ b/types/windows-script-host/windows-script-host-tests.ts @@ -0,0 +1 @@ +WScript.Echo(WScript.Arguments.length); From 56986bfcb639dcc8144a50cb7717fb257a151ba6 Mon Sep 17 00:00:00 2001 From: denis Date: Thu, 10 May 2018 17:21:13 +0200 Subject: [PATCH 036/575] Add old jQuery type definition compatibility --- types/select2/index.d.ts | 53 ++++++++++++++++++++++++++-------- types/select2/select2-tests.ts | 7 +++++ 2 files changed, 48 insertions(+), 12 deletions(-) diff --git a/types/select2/index.d.ts b/types/select2/index.d.ts index 6a7d7c6aaf..e78ef74572 100644 --- a/types/select2/index.d.ts +++ b/types/select2/index.d.ts @@ -6,9 +6,36 @@ // TypeScript Version: 2.3 /// +/// export as namespace Select2; +// -------------------------------------------------------------------------- +// For jQuery v1 and v2 backward compatibility +// -------------------------------------------------------------------------- + +export type Sub = + {[K in O]: (Record & Record)[K]}[O]; + +/** + * Same as jQuery v3 `JQuery.AjaxSettingsBase`. + */ +export type JQueryAjaxSettingsBase = + Pick>; + +/** + * Same as jQuery v3 `JQuery.EventHandlerBase`. + */ +export type JQueryEventHandlerBase = + (this: TContext, t: T, ...args: any[]) => void | false; + +/** + * Same as jQuery v3 `JQuery.PlainObject`. + */ +export interface PlainObject { + [key: string]: T; +} + // -------------------------------------------------------------------------- // Some Interfaces // -------------------------------------------------------------------------- @@ -110,7 +137,7 @@ export interface Translation { export interface DataParams { data: OptionData; // TODO: must be data source - originalEvent: JQuery.Event; + originalEvent: BaseJQueryEventObject; } export interface IngParams { @@ -118,7 +145,7 @@ export interface IngParams { prevented: boolean; } -export interface Event extends JQuery.Event { +export interface Event extends BaseJQueryEventObject { params: T; } @@ -133,10 +160,10 @@ export interface Trigger { // Ajax Option // -------------------------------------------------------------------------- -export interface AjaxOptions extends JQuery.Ajax.AjaxSettingsBase { +export interface AjaxOptions extends JQueryAjaxSettingsBase { delay?: number; url?: string | ((params: QueryOptions) => string); - data?: (params: QueryOptions) => JQuery.PlainObject; + data?: (params: QueryOptions) => PlainObject; transport?: (settings: JQueryAjaxSettings, success?: (data: RemoteResult) => undefined, failure?: () => undefined) => void; processResults?: (data: RemoteResult, params: QueryOptions) => ProcessedResult; } @@ -195,6 +222,8 @@ export interface Options { + amd: { require: Require; }; + defaults: { set: (key: string, value: any) => void; reset: () => void; @@ -230,13 +259,13 @@ declare global { trigger(events: Trigger): void; // TODO: events "change" and "change.select2" - on(events: "select2:closing", handler?: JQuery.EventHandlerBase>): this; - on(events: "select2:close", handler?: JQuery.EventHandlerBase>): this; - on(events: "select2:opening", handler?: JQuery.EventHandlerBase>): this; - on(events: "select2:open", handler?: JQuery.EventHandlerBase>): this; - on(events: "select2:selecting", handler?: JQuery.EventHandlerBase>): this; - on(events: "select2:select", handler?: JQuery.EventHandlerBase>): this; - on(events: "select2:unselecting", handler?: JQuery.EventHandlerBase>): this; - on(events: "select2:unselect", handler?: JQuery.EventHandlerBase>): this; + on(events: "select2:closing", handler?: JQueryEventHandlerBase>): this; + on(events: "select2:close", handler?: JQueryEventHandlerBase>): this; + on(events: "select2:opening", handler?: JQueryEventHandlerBase>): this; + on(events: "select2:open", handler?: JQueryEventHandlerBase>): this; + on(events: "select2:selecting", handler?: JQueryEventHandlerBase>): this; + on(events: "select2:select", handler?: JQueryEventHandlerBase>): this; + on(events: "select2:unselecting", handler?: JQueryEventHandlerBase>): this; + on(events: "select2:unselect", handler?: JQueryEventHandlerBase>): this; } } diff --git a/types/select2/select2-tests.ts b/types/select2/select2-tests.ts index 7da04a1be5..b3ce0d5896 100644 --- a/types/select2/select2-tests.ts +++ b/types/select2/select2-tests.ts @@ -733,6 +733,13 @@ $(".js-example-rtl").select2({ // ===================================================== // See: https://select2.org/advanced +$.fn.select2.amd.require( + ["select2/utils", "select2/selection/single", "select2/selection/placeholder"], + (Utils: any, SingleSelection: any, Placeholder: any) => { + const CustomSelectionAdapter = Utils.Decorate(SingleSelection, Placeholder); + } +); + // TODO (Adapters) // ===================================================== From f5b66558be0dbb6f5b2292368627c61afbec7eb5 Mon Sep 17 00:00:00 2001 From: denis Date: Thu, 10 May 2018 17:32:57 +0200 Subject: [PATCH 037/575] Fix TS version --- types/select2/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/select2/index.d.ts b/types/select2/index.d.ts index e78ef74572..a0c1ce3b1d 100644 --- a/types/select2/index.d.ts +++ b/types/select2/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Boris Yankov // denisname // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 /// /// From 2341c608c142049274d331fff83bbe0ce878ab56 Mon Sep 17 00:00:00 2001 From: Zev Spitz Date: Fri, 11 May 2018 02:58:34 +0200 Subject: [PATCH 038/575] Merge IWshRuntimeLibrary; -Object methods use ActiveXObjectNameMap --- types/activex-interop/index.d.ts | 4 +- types/windows-script-host/index.d.ts | 501 ++++++++++++++++++++++---- types/windows-script-host/tslint.json | 7 +- 3 files changed, 431 insertions(+), 81 deletions(-) diff --git a/types/activex-interop/index.d.ts b/types/activex-interop/index.d.ts index 5b2a0acc42..caa74fff38 100644 --- a/types/activex-interop/index.d.ts +++ b/types/activex-interop/index.d.ts @@ -96,9 +96,7 @@ interface VBArrayConstructor { declare var VBArray: VBArrayConstructor; -/** - * Automation date (VT_DATE) - */ +/** Automation date (VT_DATE) */ declare class VarDate { private constructor(); private VarDate_typekey: VarDate; diff --git a/types/windows-script-host/index.d.ts b/types/windows-script-host/index.d.ts index 2130ecc805..b74ba7736c 100644 --- a/types/windows-script-host/index.d.ts +++ b/types/windows-script-host/index.d.ts @@ -2,93 +2,401 @@ // Project: https://msdn.microsoft.com/en-us/library/9bbdkx3k.aspx // Definitions by: Zev Spitz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 -// tslint:disable-next-line interface-name -interface ITextWriter { - Write(s: string): void; - WriteLine(s: string): void; - Close(): void; -} +/// -interface TextStreamBase { - /** - * The column number of the current character position in an input stream. - */ - Column: number; +declare namespace IWshRuntimeLibrary { + type WindowStyle = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10; + type ShortcutWindowStyle = 1 | 3 | 7; - /** - * The current line number in an input stream. - */ - Line: number; + const enum ButtonType { + OK, + OKCancel, + AbortRetryIgnore, + YesNoCancel, + YesNo, + RetryCancel, + CancelTryagainContinue + } - /** - * Closes a text stream. - * It is not necessary to close standard streams; they close automatically when the process ends. If - * you close a standard stream, be aware that any other pointers to that standard stream become invalid. - */ - Close(): void; -} + const enum EventType { + AuditFailure = 5, + AuditSuccess = 4, + Error = 1, + Information = 3, + Success = 0, + Warning = 2 + } -interface TextStreamWriter extends TextStreamBase { - /** - * Sends a string to an output stream. - */ - Write(s: string): void; + const enum IconType { + Stop = 16, + QuestionMark = 32, + ExclamationMakr = 48, + InformationMark = 64, + } - /** - * Sends a specified number of blank lines (newline characters) to an output stream. - */ - WriteBlankLines(intLines: number): void; + const enum PopupType { + SecondButtonDefault = 256, + ThirdButtonDefault = 512, + Modal = 4096, + RightJustified = 524288, + RTL = 1048576, + } - /** - * Sends a string followed by a newline character to an output stream. - */ - WriteLine(s: string): void; -} + const enum PopupSelection { + NoButton = -1, + OK = 1, + Cancel = 2, + Abort = 3, + Retry = 4, + Ignore = 5, + Yes = 6, + No = 7, + TryAgain = 10, + Continue = 11, + } -interface TextStreamReader extends TextStreamBase { - /** - * Returns a specified number of characters from an input stream, starting at the current pointer position. - * Does not return until the ENTER key is pressed. - * Can only be used on a stream in reading mode; causes an error in writing or appending mode. - */ - Read(characters: number): string; + const enum WshExecStatus { + WshFailed = 2, + WshFinished = 1, + WshRunning = 0, + } - /** - * Returns all characters from an input stream. - * Can only be used on a stream in reading mode; causes an error in writing or appending mode. - */ - ReadAll(): string; + const enum WshWindowStyle { + WshHide = 0, + WshMaximizedFocus = 3, + WshMinimizedFocus = 2, + WshMinimizedNoFocus = 6, + WshNormalFocus = 1, + WshNormalNoFocus = 4, + } - /** - * Returns an entire line from an input stream. - * Although this method extracts the newline character, it does not add it to the returned string. - * Can only be used on a stream in reading mode; causes an error in writing or appending mode. - */ - ReadLine(): string; + class TextStreamBase { + /** + * The column number of the current character position in an input stream. + */ + Column: number; - /** - * Skips a specified number of characters when reading from an input text stream. - * Can only be used on a stream in reading mode; causes an error in writing or appending mode. - * @param characters Positive number of characters to skip forward. (Backward skipping is not supported.) - */ - Skip(characters: number): void; + /** + * The current line number in an input stream. + */ + Line: number; - /** - * Skips the next line when reading from an input text stream. - * Can only be used on a stream in reading mode, not writing or appending mode. - */ - SkipLine(): void; + /** + * Closes a text stream. + * It is not necessary to close standard streams; they close automatically when the process ends. If + * you close a standard stream, be aware that any other pointers to that standard stream become invalid. + */ + Close(): void; + } - /** - * Indicates whether the stream pointer position is at the end of a line. - */ - AtEndOfLine: boolean; + class TextStreamWriter extends TextStreamBase { + private 'IWshRuntimeLibrary.TextStreamWriter_typekey': TextStreamWriter; + private constructor(); - /** - * Indicates whether the stream pointer position is at the end of a stream. - */ - AtEndOfStream: boolean; + /** + * Sends a string to an output stream. + */ + Write(s: string): void; + + /** + * Sends a specified number of blank lines (newline characters) to an output stream. + */ + WriteBlankLines(intLines: number): void; + + /** + * Sends a string followed by a newline character to an output stream. + */ + WriteLine(s: string): void; + } + + class TextStreamReader extends TextStreamBase { + private 'IWshRuntimeLibrary.TextStreamReader_typekey': TextStreamReader; + private constructor(); + + /** + * Returns a specified number of characters from an input stream, starting at the current pointer position. + * Does not return until the ENTER key is pressed. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + */ + Read(characters: number): string; + + /** + * Returns all characters from an input stream. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + */ + ReadAll(): string; + + /** + * Returns an entire line from an input stream. + * Although this method extracts the newline character, it does not add it to the returned string. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + */ + ReadLine(): string; + + /** + * Skips a specified number of characters when reading from an input text stream. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + * @param characters Positive number of characters to skip forward. (Backward skipping is not supported.) + */ + Skip(characters: number): void; + + /** + * Skips the next line when reading from an input text stream. + * Can only be used on a stream in reading mode, not writing or appending mode. + */ + SkipLine(): void; + + /** + * Indicates whether the stream pointer position is at the end of a line. + */ + AtEndOfLine: boolean; + + /** + * Indicates whether the stream pointer position is at the end of a stream. + */ + AtEndOfStream: boolean; + } + + /** Generic Collection Object */ + interface WshCollection { + Count(): number; + Item(Index: any): any; + readonly length: number; + (Index: any): any; + } + + /** Environment Variables Collection Object */ + interface WshEnvironment { + Count(): number; + Item(Name: string): string; + readonly length: number; + Remove(Name: string): void; + (Name: string): string; + } + + /** WSHExec object */ + class WshExec { + private 'IWshRuntimeLibrary.WshExec_typekey': WshExec; + private constructor(); + readonly ExitCode: number; + readonly ProcessID: number; + readonly Status: WshExecStatus; + readonly StdErr: TextStreamWriter; + readonly StdIn: TextStreamReader; + readonly StdOut: TextStreamWriter; + Terminate(): void; + } + + /** Network Object */ + class WshNetwork { + private 'IWshRuntimeLibrary.WshNetwork_typekey': WshNetwork; + private constructor(); + + /** + * Adds a remote MS-DOS-based printer connection to your computer system. + * @param LocalName Local name to assign to the connected printer. + * @param RemoteName Name of the remote printer. + * @param UpdateProfile [false] Whether the printer mapping is stored in the current user's profile. + * + * If you are mapping a remote printer using the profile of someone other than current user, you can specify _UserName_ and _Password_. + */ + AddPrinterConnection(LocalName: string, RemoteName: string, UpdateProfile?: boolean, UserName?: string, Password?: string): void; + + /** + * @param string Path to printer connection + * @param string [DriverName=''] + * @param string [Port='LPT1'] + * + * Unlike the **AddPrinterConnection** method, this method allows you to create a printer connection without directing it to a specific port, such as LPT1. + */ + AddWindowsPrinterConnection(PrinterName: string, DriverName?: string, Port?: string): void; + readonly ComputerName: string; + EnumNetworkDrives(): WshCollection; + EnumPrinterConnections(): WshCollection; + + /** + * Adds a remote MS-DOS-based printer connection to your computer system. + * @param LocalName Name by which the mapped drive will be known locally + * @param RemoteName Share's UNC name (\\xxx\yyy) + * @param UpdateProfile [false] Whether the printer mapping is stored in the current user's profile. + * + * If you are mapping a network drive using the profile of someone other than current user, you can specify _UserName_ and _Password_. + */ + MapNetworkDrive(LocalName: string, RemoteName: string, UpdateProfile?: boolean, UserName?: string, Password?: string): void; + readonly Organization: string; + + /** + * Removes a shared network drive from your computer system + * @param Name Name of the mapped drive you want to remove. This will be the drive letter if the drive has a mapping between a local name (drive letter) and a remote name (UNC name); + * it will be the UNC path if there is no such mapping + * @param Force [false] Remove the connections even if the resource is in use + * @param UpdateProfile [false] Remove the mapping from the user's profile + */ + RemoveNetworkDrive(Name: string, Force?: boolean, UpdateProfile?: boolean): void; + + /** + * Removes a shared network printer connection from your computer system + * @param Name Name that identifies the printer. Can be a UNC name (in the form `\\xxx\yyy`) or a local name (such as `LPT1`) + * @param Force [false] Remove printer connection even if a user is still connected + * @param UpdateProfile [false] Remove the printer connection from the user's profile + * + * The **RemovePrinterConnection** method removes both Windows and MS-DOS based printer connections. If the printer was connected using the method **AddPrinterConnection**, + * _Name_ must be the printer's local name. If the printer was connected using the **AddWindowsPrinterConnection** method or was added manually (using the Add Printer wizard), + * then _Name_ must be the printer's UNC name. + */ + RemovePrinterConnection(Name: string, Force?: true, UpdateProfile?: true): void; + SetDefaultPrinter(Name: string): void; + readonly Site: string; + readonly UserDomain: string; + readonly UserName: string; + readonly UserProfile: string; + } + + /** Shell Object */ + class WshShell { + private 'IWshRuntimeLibrary.WshShell_typekey': WshShell; + private constructor(); + + /** + * Activates an application window + * @param App Title of application as it appears in the title bar, or the process ID + * @param Wait + * + * This method changes the focus to the named application or window. The window must be attached to the calling thread's message queue. It does not affect whether it is maximized or + * minimized. Focus moves from the activated application window when the user takes action to change the focus (or closes the window). + * + * In determining which application to activate, the specified title is compared to the title string of each running application. If no exact match exists, any application whose title + * string begins with title is activated. If an application still cannot be found, any application whose title string ends with title is activated. If more than one instance of the + * application named by title exists, one instance is arbitrarily activated. + * + * The method might return `false` under the following conditions: + * + * * The window is not brought to the foreground. + * * The window is brought to the foreground but is not given keyboard focus. + * * A Command Prompt window (`cmd.exe`) is brought to the foreground and is given keyboard focus. + */ + AppActivate(App: string | number, Wait?: any): boolean; + + /** + * Creates a shortcut + * @param PathLink Path where the shortcut should be created + * + * The shortcut object exists in memory until you save it to disk with the **Save** method. + */ + CreateShortcut(PathLink: string): WshShortcut | WshURLShortcut; + CurrentDirectory: string; + + /** + * Note that **Environment** doesn't actually return a callable object; the call is only usable in the context of the **Environment** property. The following: + * + * let env = new ActiveXObject('WScript.Shell').Environment; + * WScript.Echo(env('System')); + * + * will return an empty string, unless there is an environment variable named `System` + */ + Environment: WshEnvironment & ((Type: 'System' | 'User' | 'Process' | 'Volatile') => WshEnvironment); + Exec(Command: string): WshExec; + ExpandEnvironmentStrings(Src: string): string; + + /** @param string [Target=''] Name of the computer system where the event should be logged; default is the local computer system */ + LogEvent(Type: EventType, Message: string, Target?: string): boolean; + Popup(Text: string, SecondsToWait?: number, Title?: string, Type?: ButtonType | IconType | PopupType): PopupSelection; + RegDelete(Name: string): void; + + /** + * Returns the value of a key or value-name from the registry + * @param Name Key (ends with a final `\`) or value-name (doesn't end with a final `\`) + * + * Returns one of the following, based on the registry value type: + * + * * **REG_SZ** -- a string + * * **REG_DWORD** -- a number + * * **REG_SBINARY** -- a binary value, as a COM SafeArray containing integers + * * **REG_EXPAND_SZ** -- an expandable string + * * **REG_MULTI_SZ** -- an array of srings, as a COM SafeArray + */ + RegRead(Name: string): string | number | SafeArray | SafeArray; + + /** + * Creates a new key, adds another value-name to an existing key and assigns it a value, or changes the value of an existing value-name + * @param Name Key (ends with a final `\`) or value-name (doesn't end with a final `\`) + * @param Value Will be coerced to `string` or `integer` based on the value-name type: + * `REG_SZ | REG_EXPAND_SZ` will be converted to `string`; + * `REG_DWORD | REG_BINARY` will be converted to `integer` + * @param Type + */ + RegWrite(Name: string, Value: any, Type?: 'REG_SZ' | 'REG_DWORD' | 'REG_BINARY' | 'REG_EXPAND_SZ'): void; + + /** + * Runs a program in a new process. + * @param Command Command-line, including any parameters you want to pass to the executable file. + * @param WindowStyle Appearance of the program window. Not all programs make use of this information. + * @param WaitOnReturn Block script until program finishes executing. + * + * If `false` is passed into **WaitOnReturn**, the **Run** method will return 0 immediately. If `true` is passed in, **Run** will return the program's error code, if any. + * + * Environment variables will be expanded within the command line. + * + * Passing a registered file type will automatically open the program registered to the file type. + * + * Possible values for **WindowStyle**: + * + * * **0** -- Hides the window and activates another window. + * * **1** -- Activates and displays a window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag + * when displaying the window for the first time. + * * **2** -- Activates the window and displays it as a minimized window. + * * **3** -- Activates the window and displays it as a maximized window. + * * **4** -- Displays a window in its most recent size and position. The active window remains active. + * * **5** -- Activates the window and displays it in its current size and position. + * * **6** -- Minimizes the specified window and activates the next top-level window in the Z order. + * * **7** -- Displays the window as a minimized window. The active window remains active. + * * **8** -- Displays the window in its current state. The active window remains active. + * * **9** -- Activates and displays the window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag + * when restoring a minimized window. + * * **10** -- Sets the show-state based on the state of the program that started the application. + */ + Run(Command: string, WindowStyle?: WindowStyle, WaitOnReturn?: boolean): number; + SendKeys(Keys: string, Wait?: boolean): void; + readonly SpecialFolders: WshCollection; + } + + /** Shortcut Object */ + class WshShortcut { + private 'IWshRuntimeLibrary.WshShortcut_typekey': WshShortcut; + private constructor(); + Arguments: string; + Description: string; + readonly FullName: string; + Hotkey: string; + IconLocation: string; + Load(PathLink: string): void; + readonly RelativePath: string; + Save(): void; + TargetPath: string; + + /** + * Possible values: + * + * * **1** -- Activates and displays a window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag + * when displaying the window for the first time. + * * **3** -- Activates the window and displays it as a maximized window. + * * **7** -- Displays the window as a minimized window. The active window remains active. + */ + WindowStyle: ShortcutWindowStyle; + WorkingDirectory: string; + } + + /** URLShortcut Object */ + class WshURLShortcut { + private 'IWshRuntimeLibrary.WshURLShortcut_typekey': WshURLShortcut; + private constructor(); + readonly FullName: string; + Load(PathLink: string): void; + Save(): void; + TargetPath: string; + } } declare var WScript: { @@ -102,13 +410,13 @@ declare var WScript: { * Exposes the write-only error output stream for the current script. * Can be accessed only while using CScript.exe. */ - StdErr: TextStreamWriter; + StdErr: IWshRuntimeLibrary.TextStreamWriter; /** * Exposes the write-only output stream for the current script. * Can be accessed only while using CScript.exe. */ - StdOut: TextStreamWriter; + StdOut: IWshRuntimeLibrary.TextStreamWriter; Arguments: { length: number; Item(n: number): string; }; /** @@ -155,7 +463,7 @@ declare var WScript: { * Exposes the read-only input stream for the current script. * Can be accessed only while using CScript.exe. */ - StdIn: TextStreamReader; + StdIn: IWshRuntimeLibrary.TextStreamReader; /** * Windows Script Host version @@ -172,7 +480,7 @@ declare var WScript: { * @param strProgiID * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events. */ - CreateObject(strProgID: string, strPrefix?: string): any; + CreateObject(strProgID: K, strPrefix?: string): ActiveXObjectNameMap[K]; /** * Disconnects a COM object from its event sources. @@ -186,6 +494,7 @@ declare var WScript: { * @param strProgID * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events. */ + GetObject(strPathname: string, strProgID: K, strPrefix?: string): ActiveXObjectNameMap[K]; GetObject(strPathname: string, strProgID?: string, strPrefix?: string): any; /** @@ -199,3 +508,41 @@ declare var WScript: { * WSH is an alias for WScript under Windows Script Host */ declare var WSH: typeof WScript; + +declare namespace WSHControllerLibrary { + class WSHController { + private 'WSHControllerLibrary.WSHController_typekey': WSHController; + private constructor(); + CreateScript(Command: string, Server?: any): any; + } +} + +declare namespace ScriptSigner { + class Signer { + private 'ScriptSigner.Signer_typekey': Signer; + private constructor(); + + /** @param Store [Store='my'] */ + Sign(FileExtension: string, Text: string, Certificate: string, Store?: string): string; + + /** @param Store [Store='my'] */ + SignFile(FileName: string, Certificate: string, Store?: string): void; + + /** @param ShowUI [ShowUI=false] */ + Verify(FileExtension: string, Text: string, ShowUI?: boolean): boolean; + + /** @param ShowUI [ShowUI=false] */ + VerifyFile(FileName: string, ShowUI?: boolean): boolean; + } +} + +interface ActiveXObjectNameMap { + 'WSHController': WSHControllerLibrary.WSHController; + 'Scripting.Signer': ScriptSigner.Signer; + 'WScript.Network': IWshRuntimeLibrary.WshNetwork; + 'WScript.Shell': IWshRuntimeLibrary.WshShell; +} + +interface ActiveXObject { + set(obj: IWshRuntimeLibrary.WshEnvironment, propertyName: 'Item', parameterTypes: [string], newValue: string): void; +} diff --git a/types/windows-script-host/tslint.json b/types/windows-script-host/tslint.json index 3db14f85ea..ed91c31f9c 100644 --- a/types/windows-script-host/tslint.json +++ b/types/windows-script-host/tslint.json @@ -1 +1,6 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + "no-const-enum": false + } +} \ No newline at end of file From 4eacdfac29c3c1fc59e15aa279d3d491147bdf7f Mon Sep 17 00:00:00 2001 From: Zev Spitz Date: Fri, 11 May 2018 04:02:23 +0200 Subject: [PATCH 039/575] WshNamed, WshUnnamed and default properties --- types/windows-script-host/index.d.ts | 42 ++++++++++++++++++- .../windows-script-host-tests.ts | 31 +++++++++++++- 2 files changed, 70 insertions(+), 3 deletions(-) diff --git a/types/windows-script-host/index.d.ts b/types/windows-script-host/index.d.ts index b74ba7736c..d348f3d20d 100644 --- a/types/windows-script-host/index.d.ts +++ b/types/windows-script-host/index.d.ts @@ -159,6 +159,23 @@ declare namespace IWshRuntimeLibrary { AtEndOfStream: boolean; } + /** Provides access to the entire collection of command-line parameters, in the order in which they were originally entered. */ + interface WshArguments { + Count(): number; + Item(index: number): string; + Length: number; + Named: WshNamed; + + /** + * When you run the **ShowUsage** method, a help screen (referred to as the usage) appears and displays details about the script's command line options. + * This information comes from the runtime section of the `*.WSF` file. Everything written between the `` and `` tags is pieced together + * to produce what is called a "usage statement." The usage statement tells the user how to use the script. + */ + ShowUsage(): void; + Unnamed: WshUnnamed; + (index: number): string; + } + /** Generic Collection Object */ interface WshCollection { Count(): number; @@ -171,7 +188,7 @@ declare namespace IWshRuntimeLibrary { interface WshEnvironment { Count(): number; Item(Name: string): string; - readonly length: number; + readonly Length: number; Remove(Name: string): void; (Name: string): string; } @@ -189,6 +206,19 @@ declare namespace IWshRuntimeLibrary { Terminate(): void; } + /** + * Provides access to the named command-line arguments + * + * Note that enumerating over this object returns the **names** of the arguments, not the values + */ + interface WshNamed { + Count(): number; + Exists(Key: string): boolean; + Item(name: string): string; + Length: number; + (name: string): string; + } + /** Network Object */ class WshNetwork { private 'IWshRuntimeLibrary.WshNetwork_typekey': WshNetwork; @@ -388,6 +418,14 @@ declare namespace IWshRuntimeLibrary { WorkingDirectory: string; } + /** Provides access to the unnamed command-line arguments */ + interface WshUnnamed { + Count(): number; + Item(index: number): string; + Length: number; + (index: number): string; + } + /** URLShortcut Object */ class WshURLShortcut { private 'IWshRuntimeLibrary.WshURLShortcut_typekey': WshURLShortcut; @@ -417,7 +455,7 @@ declare var WScript: { * Can be accessed only while using CScript.exe. */ StdOut: IWshRuntimeLibrary.TextStreamWriter; - Arguments: { length: number; Item(n: number): string; }; + Arguments: IWshRuntimeLibrary.WshArguments; /** * The full path of the currently running script. diff --git a/types/windows-script-host/windows-script-host-tests.ts b/types/windows-script-host/windows-script-host-tests.ts index 7bd4e876b5..d4851f2626 100644 --- a/types/windows-script-host/windows-script-host-tests.ts +++ b/types/windows-script-host/windows-script-host-tests.ts @@ -1 +1,30 @@ -WScript.Echo(WScript.Arguments.length); +const collectionToArray = (col: { Item(key: any): T }): T[] => { + const results: T[] = []; + const enumerator = new Enumerator(col); + enumerator.moveFirst(); + while (!enumerator.atEnd()) { + results.push(enumerator.item()); + enumerator.moveNext(); + } + return results; +}; + +// Show all of the arguments. +WScript.Echo(`${WScript.Arguments.Length} arguments`); + +for (const arg of collectionToArray(WScript.Arguments)) { + WScript.Echo(` ${arg}`); +} + +// Show the unnamed arguments. +WScript.Echo(`${WScript.Arguments.Unnamed.Length} unnamed arguments`); + +for (const unnamed of collectionToArray(WScript.Arguments.Unnamed)) { + WScript.Echo(` ${unnamed}`); +} + +// Show the named arguments. +WScript.Echo(`${WScript.Arguments.Named.Length} named arguments`); +for (const key of collectionToArray(WScript.Arguments.Named)) { + WScript.Echo(` ${key}=${WScript.Arguments.Named(key)}`); +} From 54d571dec83a159d56da5849794343404d7fa786 Mon Sep 17 00:00:00 2001 From: Zev Spitz Date: Fri, 11 May 2018 04:06:05 +0200 Subject: [PATCH 040/575] Merge activex-iwshruntimelibrary into windows-script-host --- .../activex-iwshruntimelibrary-tests.ts | 49 --- types/activex-iwshruntimelibrary/index.d.ts | 348 ------------------ types/activex-iwshruntimelibrary/package.json | 6 - .../activex-iwshruntimelibrary/tsconfig.json | 24 -- types/activex-iwshruntimelibrary/tslint.json | 3 - .../windows-script-host-tests.ts | 50 +++ 6 files changed, 50 insertions(+), 430 deletions(-) delete mode 100644 types/activex-iwshruntimelibrary/activex-iwshruntimelibrary-tests.ts delete mode 100644 types/activex-iwshruntimelibrary/index.d.ts delete mode 100644 types/activex-iwshruntimelibrary/package.json delete mode 100644 types/activex-iwshruntimelibrary/tsconfig.json delete mode 100644 types/activex-iwshruntimelibrary/tslint.json diff --git a/types/activex-iwshruntimelibrary/activex-iwshruntimelibrary-tests.ts b/types/activex-iwshruntimelibrary/activex-iwshruntimelibrary-tests.ts deleted file mode 100644 index 14a90f9a8a..0000000000 --- a/types/activex-iwshruntimelibrary/activex-iwshruntimelibrary-tests.ts +++ /dev/null @@ -1,49 +0,0 @@ -const wshn = new ActiveXObject('WScript.Network'); - -// https://msdn.microsoft.com/en-us/library/s6wt333f(v=vs.84).aspx -// https://msdn.microsoft.com/en-us/library/wck0hkd7(v=vs.84).aspx -// https://msdn.microsoft.com/en-us/library/tte130y1(v=vs.84).aspx -// https://msdn.microsoft.com/en-us/library/3fxhka75(v=vs.84).aspx -{ - WScript.Echo('Domain = ' + wshn.UserDomain); - WScript.Echo('Computer Name = ' + wshn.ComputerName); - WScript.Echo('User Name = ' + wshn.UserName); -} - -// https://msdn.microsoft.com/en-us/library/zsdh7hkb(v=vs.84).aspx -wshn.AddWindowsPrinterConnection('\\\\printserv\\DefaultPrinter'); - -// https://msdn.microsoft.com/en-us/library/kxsdca3c(v=vs.84).aspx -wshn.AddPrinterConnection("LPT1", "\\\\Server\\Print1"); - -// https://msdn.microsoft.com/en-us/library/t9zt39at(v=vs.84).aspx -// https://msdn.microsoft.com/en-us/library/zhds6k80(v=vs.84).aspx -{ - const drives = wshn.EnumNetworkDrives(); - const printers = wshn.EnumPrinterConnections(); - WScript.Echo("Network drive mappings:"); - for (let i = 0; i < drives.length; i += 2) { - WScript.Echo(`Drive ${drives.Item(i)} = ${drives.Item(i + 1)}`); - } - WScript.Echo(''); - WScript.Echo("Network printer mappings:"); - for (let i = 0; i < printers.length; i += 2) { - WScript.Echo(`Port ${printers.Item(i)} = ${printers.Item(i + 1)}`); - } -} - -// https://msdn.microsoft.com/en-us/library/8kst88h6(v=vs.84).aspx -wshn.MapNetworkDrive('E:', '\\\\Server\\Public'); - -// https://msdn.microsoft.com/en-us/library/d16d7wbf(v=vs.84).aspx -wshn.RemoveNetworkDrive('E:'); - -// https://msdn.microsoft.com/en-us/library/tsbh2yy7(v=vs.84).aspx -wshn.RemovePrinterConnection('\\\\PRN-CORP1\\B41-4523-A', true, true); - -// https://msdn.microsoft.com/en-us/library/2ccwwdct(v=vs.84).aspx -{ - const printerPath = "\\\\research\\library1"; - wshn.AddWindowsPrinterConnection(printerPath); - wshn.SetDefaultPrinter(printerPath); -} diff --git a/types/activex-iwshruntimelibrary/index.d.ts b/types/activex-iwshruntimelibrary/index.d.ts deleted file mode 100644 index d5b052eaae..0000000000 --- a/types/activex-iwshruntimelibrary/index.d.ts +++ /dev/null @@ -1,348 +0,0 @@ -// Type definitions for Windows Script Host Object Model - IWshRuntimeLibrary 1.0 -// Project: https://msdn.microsoft.com/en-us/library/9bbdkx3k(v=vs.84).aspx -// Definitions by: Zev Spitz -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 - -declare namespace IWshRuntimeLibrary { - type WindowStyle = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10; - type ShortcutWindowStyle = 1 | 3 | 7; - - // tslint:disable-next-line no-const-enum - const enum ButtonType { - OK, - OKCancel, - AbortRetryIgnore, - YesNoCancel, - YesNo, - RetryCancel, - CancelTryagainContinue - } - - // tslint:disable-next-line no-const-enum - const enum EventType { - AuditFailure = 5, - AuditSuccess = 4, - Error = 1, - Information = 3, - Success = 0, - Warning = 2 - } - - // tslint:disable-next-line no-const-enum - const enum IconType { - Stop = 16, - QuestionMark = 32, - ExclamationMakr = 48, - InformationMark = 64, - } - - // tslint:disable-next-line no-const-enum - const enum PopupType { - SecondButtonDefault = 256, - ThirdButtonDefault = 512, - Modal = 4096, - RightJustified = 524288, - RTL = 1048576, - } - - // tslint:disable-next-line no-const-enum - const enum PopupSelection { - NoButton = -1, - OK = 1, - Cancel = 2, - Abort = 3, - Retry = 4, - Ignore = 5, - Yes = 6, - No = 7, - TryAgain = 10, - Continue = 11, - } - - // tslint:disable-next-line no-const-enum - const enum WshExecStatus { - WshFailed = 2, - WshFinished = 1, - WshRunning = 0, - } - - // tslint:disable-next-line no-const-enum - const enum WshWindowStyle { - WshHide = 0, - WshMaximizedFocus = 3, - WshMinimizedFocus = 2, - WshMinimizedNoFocus = 6, - WshNormalFocus = 1, - WshNormalNoFocus = 4, - } - - class TextStream { - private 'IWshRuntimeLibrary.TextStream_typekey': TextStream; - private constructor(); - readonly AtEndOfLine: boolean; - readonly AtEndOfStream: boolean; - Close(): void; - readonly Column: number; - readonly Line: number; - Read(Characters: number): string; - ReadAll(): string; - ReadLine(): string; - Skip(Characters: number): void; - SkipLine(): void; - Write(Text: string): void; - WriteBlankLines(Lines: number): void; - - /** @param string [Text=''] */ - WriteLine(Text?: string): void; - } - - /** Generic Collection Object */ - interface WshCollection { - Count(): number; - Item(Index: any): any; - readonly length: number; - (Index: any): any; - } - - /** Environment Variables Collection Object */ - interface WshEnvironment { - Count(): number; - Item(Name: string): string; - readonly length: number; - Remove(Name: string): void; - (Name: string): string; - } - - /** WSHExec object */ - class WshExec { - private 'IWshRuntimeLibrary.WshExec_typekey': WshExec; - private constructor(); - readonly ExitCode: number; - readonly ProcessID: number; - readonly Status: WshExecStatus; - readonly StdErr: TextStream; - readonly StdIn: TextStream; - readonly StdOut: TextStream; - Terminate(): void; - } - - /** Network Object */ - class WshNetwork { - private 'IWshRuntimeLibrary.WshNetwork_typekey': WshNetwork; - private constructor(); - - /** - * Adds a remote MS-DOS-based printer connection to your computer system. - * @param LocalName Local name to assign to the connected printer. - * @param RemoteName Name of the remote printer. - * @param UpdateProfile [false] Whether the printer mapping is stored in the current user's profile. - * - * If you are mapping a remote printer using the profile of someone other than current user, you can specify _UserName_ and _Password_. - */ - AddPrinterConnection(LocalName: string, RemoteName: string, UpdateProfile?: boolean, UserName?: string, Password?: string): void; - - /** - * @param string Path to printer connection - * @param string [DriverName=''] - * @param string [Port='LPT1'] - * - * Unlike the **AddPrinterConnection** method, this method allows you to create a printer connection without directing it to a specific port, such as LPT1. - */ - AddWindowsPrinterConnection(PrinterName: string, DriverName?: string, Port?: string): void; - readonly ComputerName: string; - EnumNetworkDrives(): WshCollection; - EnumPrinterConnections(): WshCollection; - - /** - * Adds a remote MS-DOS-based printer connection to your computer system. - * @param LocalName Name by which the mapped drive will be known locally - * @param RemoteName Share's UNC name (\\xxx\yyy) - * @param UpdateProfile [false] Whether the printer mapping is stored in the current user's profile. - * - * If you are mapping a network drive using the profile of someone other than current user, you can specify _UserName_ and _Password_. - */ - MapNetworkDrive(LocalName: string, RemoteName: string, UpdateProfile?: boolean, UserName?: string, Password?: string): void; - readonly Organization: string; - - /** - * Removes a shared network drive from your computer system - * @param Name Name of the mapped drive you want to remove. This will be the drive letter if the drive has a mapping between a local name (drive letter) and a remote name (UNC name); - * it will be the UNC path if there is no such mapping - * @param Force [false] Remove the connections even if the resource is in use - * @param UpdateProfile [false] Remove the mapping from the user's profile - */ - RemoveNetworkDrive(Name: string, Force?: boolean, UpdateProfile?: boolean): void; - - /** - * Removes a shared network printer connection from your computer system - * @param Name Name that identifies the printer. Can be a UNC name (in the form `\\xxx\yyy`) or a local name (such as `LPT1`) - * @param Force [false] Remove printer connection even if a user is still connected - * @param UpdateProfile [false] Remove the printer connection from the user's profile - * - * The **RemovePrinterConnection** method removes both Windows and MS-DOS based printer connections. If the printer was connected using the method **AddPrinterConnection**, - * _Name_ must be the printer's local name. If the printer was connected using the **AddWindowsPrinterConnection** method or was added manually (using the Add Printer wizard), - * then _Name_ must be the printer's UNC name. - */ - RemovePrinterConnection(Name: string, Force?: true, UpdateProfile?: true): void; - SetDefaultPrinter(Name: string): void; - readonly Site: string; - readonly UserDomain: string; - readonly UserName: string; - readonly UserProfile: string; - } - - /** Shell Object */ - class WshShell { - private 'IWshRuntimeLibrary.WshShell_typekey': WshShell; - private constructor(); - - /** - * Activates an application window - * @param App Title of application as it appears in the title bar, or the process ID - * @param Wait - * - * This method changes the focus to the named application or window. The window must be attached to the calling thread's message queue. It does not affect whether it is maximized or - * minimized. Focus moves from the activated application window when the user takes action to change the focus (or closes the window). - * - * In determining which application to activate, the specified title is compared to the title string of each running application. If no exact match exists, any application whose title - * string begins with title is activated. If an application still cannot be found, any application whose title string ends with title is activated. If more than one instance of the - * application named by title exists, one instance is arbitrarily activated. - * - * The method might return `false` under the following conditions: - * - * * The window is not brought to the foreground. - * * The window is brought to the foreground but is not given keyboard focus. - * * A Command Prompt window (`cmd.exe`) is brought to the foreground and is given keyboard focus. - */ - AppActivate(App: string | number, Wait?: any): boolean; - - /** - * Creates a shortcut - * @param PathLink Path where the shortcut should be created - * - * The shortcut object exists in memory until you save it to disk with the **Save** method. - */ - CreateShortcut(PathLink: string): WshShortcut | WshURLShortcut; - CurrentDirectory: string; - - /** - * Note that **Environment** doesn't actually return a callable object; the call is only usable in the context of the **Environment** property. The following: - * - * let env = new ActiveXObject('WScript.Shell').Environment; - * WScript.Echo(env('System')); - * - * will return an empty string, unless there is an environment variable named `System` - */ - Environment: WshEnvironment & ((Type: 'System' | 'User' | 'Process' | 'Volatile') => WshEnvironment); - Exec(Command: string): WshExec; - ExpandEnvironmentStrings(Src: string): string; - - /** @param string [Target=''] Name of the computer system where the event should be logged; default is the local computer system */ - LogEvent(Type: EventType, Message: string, Target?: string): boolean; - Popup(Text: string, SecondsToWait?: number, Title?: string, Type?: ButtonType | IconType | PopupType): PopupSelection; - RegDelete(Name: string): void; - - /** - * Returns the value of a key or value-name from the registry - * @param Name Key (ends with a final `\`) or value-name (doesn't end with a final `\`) - * - * Returns one of the following, based on the registry value type: - * - * * **REG_SZ** -- a string - * * **REG_DWORD** -- a number - * * **REG_SBINARY** -- a binary value, as a COM SafeArray containing integers - * * **REG_EXPAND_SZ** -- an expandable string - * * **REG_MULTI_SZ** -- an array of srings, as a COM SafeArray - */ - RegRead(Name: string): string | number | SafeArray | SafeArray; - - /** - * Creates a new key, adds another value-name to an existing key and assigns it a value, or changes the value of an existing value-name - * @param Name Key (ends with a final `\`) or value-name (doesn't end with a final `\`) - * @param Value Will be coerced to `string` or `integer` based on the value-name type: - * `REG_SZ | REG_EXPAND_SZ` will be converted to `string`; - * `REG_DWORD | REG_BINARY` will be converted to `integer` - * @param Type - */ - RegWrite(Name: string, Value: any, Type?: 'REG_SZ' | 'REG_DWORD' | 'REG_BINARY' | 'REG_EXPAND_SZ'): void; - - /** - * Runs a program in a new process. - * @param Command Command-line, including any parameters you want to pass to the executable file. - * @param WindowStyle Appearance of the program window. Not all programs make use of this information. - * @param WaitOnReturn Block script until program finishes executing. - * - * If `false` is passed into **WaitOnReturn**, the **Run** method will return 0 immediately. If `true` is passed in, **Run** will return the program's error code, if any. - * - * Environment variables will be expanded within the command line. - * - * Passing a registered file type will automatically open the program registered to the file type. - * - * Possible values for **WindowStyle**: - * - * * **0** -- Hides the window and activates another window. - * * **1** -- Activates and displays a window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag - * when displaying the window for the first time. - * * **2** -- Activates the window and displays it as a minimized window. - * * **3** -- Activates the window and displays it as a maximized window. - * * **4** -- Displays a window in its most recent size and position. The active window remains active. - * * **5** -- Activates the window and displays it in its current size and position. - * * **6** -- Minimizes the specified window and activates the next top-level window in the Z order. - * * **7** -- Displays the window as a minimized window. The active window remains active. - * * **8** -- Displays the window in its current state. The active window remains active. - * * **9** -- Activates and displays the window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag - * when restoring a minimized window. - * * **10** -- Sets the show-state based on the state of the program that started the application. - */ - Run(Command: string, WindowStyle?: WindowStyle, WaitOnReturn?: boolean): number; - SendKeys(Keys: string, Wait?: boolean): void; - readonly SpecialFolders: WshCollection; - } - - /** Shortcut Object */ - class WshShortcut { - private 'IWshRuntimeLibrary.WshShortcut_typekey': WshShortcut; - private constructor(); - Arguments: string; - Description: string; - readonly FullName: string; - Hotkey: string; - IconLocation: string; - Load(PathLink: string): void; - readonly RelativePath: string; - Save(): void; - TargetPath: string; - - /** - * Possible values: - * - * * **1** -- Activates and displays a window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag - * when displaying the window for the first time. - * * **3** -- Activates the window and displays it as a maximized window. - * * **7** -- Displays the window as a minimized window. The active window remains active. - */ - WindowStyle: ShortcutWindowStyle; - WorkingDirectory: string; - } - - /** URLShortcut Object */ - class WshURLShortcut { - private 'IWshRuntimeLibrary.WshURLShortcut_typekey': WshURLShortcut; - private constructor(); - readonly FullName: string; - Load(PathLink: string): void; - Save(): void; - TargetPath: string; - } -} - -interface ActiveXObject { - set(obj: IWshRuntimeLibrary.WshEnvironment, propertyName: 'Item', parameterTypes: [string], newValue: string): void; - new (progid: K): ActiveXObjectNameMap[K]; -} - -interface ActiveXObjectNameMap { - 'WScript.Network': IWshRuntimeLibrary.WshNetwork; - 'WScript.Shell': IWshRuntimeLibrary.WshShell; -} diff --git a/types/activex-iwshruntimelibrary/package.json b/types/activex-iwshruntimelibrary/package.json deleted file mode 100644 index d9b1031263..0000000000 --- a/types/activex-iwshruntimelibrary/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "private": true, - "dependencies": { - "activex-helpers": "*" - } -} \ No newline at end of file diff --git a/types/activex-iwshruntimelibrary/tsconfig.json b/types/activex-iwshruntimelibrary/tsconfig.json deleted file mode 100644 index 1fa5abc39b..0000000000 --- a/types/activex-iwshruntimelibrary/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es5", - "scripthost" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "activex-iwshruntimelibrary-tests.ts" - ] -} \ No newline at end of file diff --git a/types/activex-iwshruntimelibrary/tslint.json b/types/activex-iwshruntimelibrary/tslint.json deleted file mode 100644 index e60c15844f..0000000000 --- a/types/activex-iwshruntimelibrary/tslint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "dtslint/dt.json" -} \ No newline at end of file diff --git a/types/windows-script-host/windows-script-host-tests.ts b/types/windows-script-host/windows-script-host-tests.ts index d4851f2626..c6b3449482 100644 --- a/types/windows-script-host/windows-script-host-tests.ts +++ b/types/windows-script-host/windows-script-host-tests.ts @@ -28,3 +28,53 @@ WScript.Echo(`${WScript.Arguments.Named.Length} named arguments`); for (const key of collectionToArray(WScript.Arguments.Named)) { WScript.Echo(` ${key}=${WScript.Arguments.Named(key)}`); } + +const wshn = new ActiveXObject('WScript.Network'); + +// https://msdn.microsoft.com/en-us/library/s6wt333f(v=vs.84).aspx +// https://msdn.microsoft.com/en-us/library/wck0hkd7(v=vs.84).aspx +// https://msdn.microsoft.com/en-us/library/tte130y1(v=vs.84).aspx +// https://msdn.microsoft.com/en-us/library/3fxhka75(v=vs.84).aspx +{ + WScript.Echo('Domain = ' + wshn.UserDomain); + WScript.Echo('Computer Name = ' + wshn.ComputerName); + WScript.Echo('User Name = ' + wshn.UserName); +} + +// https://msdn.microsoft.com/en-us/library/zsdh7hkb(v=vs.84).aspx +wshn.AddWindowsPrinterConnection('\\\\printserv\\DefaultPrinter'); + +// https://msdn.microsoft.com/en-us/library/kxsdca3c(v=vs.84).aspx +wshn.AddPrinterConnection("LPT1", "\\\\Server\\Print1"); + +// https://msdn.microsoft.com/en-us/library/t9zt39at(v=vs.84).aspx +// https://msdn.microsoft.com/en-us/library/zhds6k80(v=vs.84).aspx +{ + const drives = wshn.EnumNetworkDrives(); + const printers = wshn.EnumPrinterConnections(); + WScript.Echo("Network drive mappings:"); + for (let i = 0; i < drives.length; i += 2) { + WScript.Echo(`Drive ${drives.Item(i)} = ${drives.Item(i + 1)}`); + } + WScript.Echo(''); + WScript.Echo("Network printer mappings:"); + for (let i = 0; i < printers.length; i += 2) { + WScript.Echo(`Port ${printers.Item(i)} = ${printers.Item(i + 1)}`); + } +} + +// https://msdn.microsoft.com/en-us/library/8kst88h6(v=vs.84).aspx +wshn.MapNetworkDrive('E:', '\\\\Server\\Public'); + +// https://msdn.microsoft.com/en-us/library/d16d7wbf(v=vs.84).aspx +wshn.RemoveNetworkDrive('E:'); + +// https://msdn.microsoft.com/en-us/library/tsbh2yy7(v=vs.84).aspx +wshn.RemovePrinterConnection('\\\\PRN-CORP1\\B41-4523-A', true, true); + +// https://msdn.microsoft.com/en-us/library/2ccwwdct(v=vs.84).aspx +{ + const printerPath = "\\\\research\\library1"; + wshn.AddWindowsPrinterConnection(printerPath); + wshn.SetDefaultPrinter(printerPath); +} From 469a87a3746e38d074f6c2f1f0c6cdc810f7ab2a Mon Sep 17 00:00:00 2001 From: Zev Spitz Date: Fri, 11 May 2018 04:24:18 +0200 Subject: [PATCH 041/575] WScript.Echo optional parameter --- types/windows-script-host/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/windows-script-host/index.d.ts b/types/windows-script-host/index.d.ts index d348f3d20d..50f0c52216 100644 --- a/types/windows-script-host/index.d.ts +++ b/types/windows-script-host/index.d.ts @@ -442,7 +442,7 @@ declare var WScript: { * Outputs text to either a message box (under WScript.exe) or the command console window followed by * a newline (under CScript.exe). */ - Echo(s: any): void; + Echo(s?: any): void; /** * Exposes the write-only error output stream for the current script. From aaddad94417811ca4c79ce59f9e6cf58cc9099bb Mon Sep 17 00:00:00 2001 From: Zev Spitz Date: Fri, 11 May 2018 04:32:25 +0200 Subject: [PATCH 042/575] Deleted package.json --- types/windows-script-host/package.json | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 types/windows-script-host/package.json diff --git a/types/windows-script-host/package.json b/types/windows-script-host/package.json deleted file mode 100644 index 731af0072b..0000000000 --- a/types/windows-script-host/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "private": true, - "dependencies": { - "activex-interop": "*" - } -} \ No newline at end of file From 9fddebe8432d66164d89c22af73f8ec64f05d2f1 Mon Sep 17 00:00:00 2001 From: robmandoe <39183315+robmandoe@users.noreply.github.com> Date: Fri, 11 May 2018 17:17:13 +1000 Subject: [PATCH 043/575] needs... objectCaching?: boolean; ...on IObjectOptions added... /** * When `true`, object is cached on an additional canvas. */ objectCaching?: boolean; to... interface IObjectOptions otherwise our developers need to make this change manually after every 'npm install' in our project --- types/fabric/fabric-impl.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/types/fabric/fabric-impl.d.ts b/types/fabric/fabric-impl.d.ts index e35b0ebe0d..13bde18c3e 100644 --- a/types/fabric/fabric-impl.d.ts +++ b/types/fabric/fabric-impl.d.ts @@ -2098,6 +2098,11 @@ interface IObjectOptions { */ backgroundColor?: string; + /** + * When `true`, object is cached on an additional canvas. + */ + objectCaching?: boolean; + /** * When defined, an object is rendered via stroke and this property specifies its color */ From 1762c042d8ebbef3fd8a351799657d6329f7c3f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hasan=20Tayyar=20BE=C5=9E=C4=B0K?= Date: Fri, 11 May 2018 10:12:12 +0200 Subject: [PATCH 044/575] open() is deprecated in mongoose >= 4.11.0 Breaking change in @Automattic/mongoose https://github.com/Automattic/mongoose/commit/dda165eebdb241397e9990440dc8e9c1f733db76#diff-259dec4414a400a6e895f16ff1d0ca3b --- types/mongoose/index.d.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/types/mongoose/index.d.ts b/types/mongoose/index.d.ts index 481b37c0a3..713448faec 100644 --- a/types/mongoose/index.d.ts +++ b/types/mongoose/index.d.ts @@ -190,6 +190,7 @@ declare module "mongoose" { /** * Opens the connection to MongoDB. + * @deprecated open() is deprecated in mongoose >= 4.11.0 * @param mongodb://uri or the host to which you are connecting * @param database database name * @param port database port @@ -200,6 +201,19 @@ declare module "mongoose" { */ open(connection_string: string, database?: string, port?: number, options?: ConnectionOpenOptions, callback?: (err: any) => void): any; + + /** + * Opens the connection to MongoDB. + * @param mongodb://uri or the host to which you are connecting + * @param database database name + * @param port database port + * @param options Mongoose forces the db option forceServerObjectId false and cannot be overridden. + * Mongoose defaults the server auto_reconnect options to true which can be overridden. + * See the node-mongodb-native driver instance for options that it understands. + * Options passed take precedence over options included in connection strings. + */ + openUri(connection_string: string, database?: string, port?: number, + options?: ConnectionOpenOptions, callback?: (err: any) => void): any; /** Helper for dropDatabase() */ dropDatabase(callback?: (err: any) => void): Promise; From 3a0af70d4b60efa7d4edec670255813347a491cf Mon Sep 17 00:00:00 2001 From: Sinziana Nicolae Date: Fri, 11 May 2018 11:19:13 +0300 Subject: [PATCH 045/575] Add types for phrases DateRangePickerPhrases --- types/react-dates/index.d.ts | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/types/react-dates/index.d.ts b/types/react-dates/index.d.ts index 92fa68e8d7..1ecebfb22c 100644 --- a/types/react-dates/index.d.ts +++ b/types/react-dates/index.d.ts @@ -266,9 +266,34 @@ declare namespace ReactDates { // internationalization props monthFormat?: string, phrases?: { - focusStartDate: string, - clearDates: string, - keyboardNavigationInstructions: string, + calendarLabel?: string, + closeDatePicker?: string, + clearDates?: string, + focusStartDate?: string, + jumpToPrevMonth?: string, + jumpToNextMonth?: string, + keyboardShortcuts?: string, + showKeyboardShortcutsPanel?: string, + hideKeyboardShortcutsPanel?: string, + openThisPanel?: string, + enterKey?: string, + leftArrowRightArrow?: string, + upArrowDownArrow?: string, + pageUpPageDown?: string, + homeEnd?: string, + escape?: string, + questionMark?: string, + selectFocusedDate?: string, + moveFocusByOneDay?: string, + moveFocusByOneWeek?: string, + moveFocusByOneMonth?: string, + moveFocustoStartAndEndOfWeek?: string, + returnFocusToInput?: string, + keyboardNavigationInstructions?: string, + chooseAvailableStartDate?: (date: string) => string, + chooseAvailableEndDate?: (date: string) => string, + dateIsUnavailable?: (date: string) => string, + dateIsSelected?: (date: string) => string, } } From b629667f8e17f6a9342898c71ff211eeec766b52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hasan=20Tayyar=20BE=C5=9E=C4=B0K?= Date: Fri, 11 May 2018 10:59:00 +0200 Subject: [PATCH 046/575] types/mongoose version bump to 5.0.15 --- types/mongoose/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/mongoose/index.d.ts b/types/mongoose/index.d.ts index 713448faec..a28bfc6d84 100644 --- a/types/mongoose/index.d.ts +++ b/types/mongoose/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Mongoose 5.0.14 +// Type definitions for Mongoose 5.0.15 // Project: http://mongoosejs.com/ // Definitions by: horiuchi // sindrenm From 44bfd4f2834db05d88aa05c9fb6712915934656f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hasan=20Tayyar=20BE=C5=9E=C4=B0K?= Date: Fri, 11 May 2018 10:59:17 +0200 Subject: [PATCH 047/575] add test for Connection.openUri --- types/mongoose/mongoose-tests.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/types/mongoose/mongoose-tests.ts b/types/mongoose/mongoose-tests.ts index aaedb577d3..df4762c488 100644 --- a/types/mongoose/mongoose-tests.ts +++ b/types/mongoose/mongoose-tests.ts @@ -129,6 +129,12 @@ conn1.openSet('mongodb://localhost/test', 'db', { replset: null, mongos: true }, function (err) {}).then(cb).catch(cb); +conn1.openUri('mongodb://localhost/test', 'myDb', 27017, { + replset: null, + config: { + autoIndex: false + } +}, function (err) {}).open(''); conn1.close().catch(function (err) {}); conn1.collection('name').$format(999); conn1.model('myModel', new mongoose.Schema({}), 'myCol').find(); From 77b25f26c0448ab1c42d4b0b33a67d209c524502 Mon Sep 17 00:00:00 2001 From: Rodrigo Saboya Date: Fri, 11 May 2018 08:49:53 -0300 Subject: [PATCH 048/575] wreck: Updating type definitions to v14.0.0. --- types/h2o2/tsconfig.json | 3 ++ types/wreck/index.d.ts | 70 +++++++++++++++++++++++++------ types/wreck/v7/index.d.ts | 38 +++++++++++++++++ types/wreck/v7/tsconfig.json | 28 +++++++++++++ types/wreck/v7/tslint.json | 79 +++++++++++++++++++++++++++++++++++ types/wreck/v7/wreck-tests.ts | 38 +++++++++++++++++ types/wreck/wreck-tests.ts | 8 ++-- 7 files changed, 249 insertions(+), 15 deletions(-) create mode 100644 types/wreck/v7/index.d.ts create mode 100644 types/wreck/v7/tsconfig.json create mode 100644 types/wreck/v7/tslint.json create mode 100644 types/wreck/v7/wreck-tests.ts diff --git a/types/h2o2/tsconfig.json b/types/h2o2/tsconfig.json index 767fa4e7b7..870a359f9b 100644 --- a/types/h2o2/tsconfig.json +++ b/types/h2o2/tsconfig.json @@ -25,6 +25,9 @@ ], "inert": [ "inert/v4" + ], + "wreck": [ + "wreck/v7" ] }, "noEmit": true, diff --git a/types/wreck/index.d.ts b/types/wreck/index.d.ts index e695cf00a9..ff10218012 100644 --- a/types/wreck/index.d.ts +++ b/types/wreck/index.d.ts @@ -1,27 +1,70 @@ -// Type definitions for wreck 7.0.0 +// Type definitions for wreck 14.0.0 // Project: https://github.com/hapijs/wreck // Definitions by: Marcin Porębski +// Rodrigo Saboya // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.4 /// -import http = require('http'); -import stream = require('stream'); +import * as Boom from "boom"; +import * as events from "events"; +import * as http from "http"; +import * as stream from "stream"; +import * as Url from "url"; +interface RequestOptions { + baseUrl?: string; + socketPath? : string; + payload?: any; + headers?: { [key: string]: any }; + redirects?: number; + redirect303?: boolean; + beforeRedirect?: (redirectMethod: string, statusCode: number, location: string, resHeaders: { [key: string]: any }, redirectOptions: any, next: () => {}) => void; + redirected?: (statusCode: number, location: string, req: http.ClientRequest) => void; + timeout?: number; + maxBytes?: number; + rejectUnauthorized?: boolean; + downstreamRes?: any; + agent?: WreckObject["agents"] | false; + secureProtocol?: string; + ciphers?: string; + events?: boolean; +} + +interface ReadOptions { + timeout?: number; + json?: true | "strict" | "force"; + gunzip?: boolean | "force"; + maxBytes?: number; +} + +interface RequestResponse { + res: http.IncomingMessage, + payload: any, +} + +declare type RequestCallback = (uri: string, options: RequestOptions & { payload?: any }) => void; +declare type ResponseCallback = (err: Boom | undefined, details: { req: http.ClientRequest, res: http.IncomingMessage | undefined, start: number, url: Url.URL }) => void; + +declare class WreckEventEmitter extends events.EventEmitter { + on(event: "request", listener: RequestCallback): this; + on(event: "response", listener: ResponseCallback): this; +} interface WreckObject { - defaults: (options: any) => WreckObject; + defaults: (options: RequestOptions) => WreckObject; - request: (method: string, uri: string, options: any, callback?: (err: any, response: http.IncomingMessage) => void) => http.ClientRequest; + request: (method: string, uri: string, options: RequestOptions) => Promise & { req: http.ClientRequest }; - read: (response: http.IncomingMessage, options: any, callback: (err: any, payload: any) => void) => void; + read: (response: http.IncomingMessage, options: ReadOptions) => Promise; - get: (uri: string, options: any, callback: (err: any, response: http.IncomingMessage, payload: any) => void) => http.ClientRequest; - post: (uri: string, options: any, callback: (err: any, response: http.IncomingMessage, payload: any) => void) => http.ClientRequest; - patch: (uri: string, options: any, callback: (err: any, response: http.IncomingMessage, payload: any) => void) => http.ClientRequest; - put: (uri: string, options: any, callback: (err: any, response: http.IncomingMessage, payload: any) => void) => http.ClientRequest; - delete: (uri: string, options: any, callback: (err: any, response: http.IncomingMessage, payload: any) => void) => http.ClientRequest; + get: (uri: string, options: RequestOptions & ReadOptions) => Promise; + post: (uri: string, options: RequestOptions & ReadOptions) => Promise; + patch: (uri: string, options: RequestOptions & ReadOptions) => Promise; + put: (uri: string, options: RequestOptions & ReadOptions) => Promise; + delete: (uri: string, options: RequestOptions & ReadOptions) => Promise; toReadableStream: (payload: any, encoding?: string) => stream.Readable; @@ -29,8 +72,11 @@ interface WreckObject { agents: { http: http.Agent, - https: http.Agent + https: http.Agent, + httpsAllowUnauthorized: http.Agent }; + + events?: WreckEventEmitter; } declare var wreck: WreckObject; diff --git a/types/wreck/v7/index.d.ts b/types/wreck/v7/index.d.ts new file mode 100644 index 0000000000..e695cf00a9 --- /dev/null +++ b/types/wreck/v7/index.d.ts @@ -0,0 +1,38 @@ +// Type definitions for wreck 7.0.0 +// Project: https://github.com/hapijs/wreck +// Definitions by: Marcin Porębski +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + + +import http = require('http'); +import stream = require('stream'); + + +interface WreckObject { + defaults: (options: any) => WreckObject; + + request: (method: string, uri: string, options: any, callback?: (err: any, response: http.IncomingMessage) => void) => http.ClientRequest; + + read: (response: http.IncomingMessage, options: any, callback: (err: any, payload: any) => void) => void; + + get: (uri: string, options: any, callback: (err: any, response: http.IncomingMessage, payload: any) => void) => http.ClientRequest; + post: (uri: string, options: any, callback: (err: any, response: http.IncomingMessage, payload: any) => void) => http.ClientRequest; + patch: (uri: string, options: any, callback: (err: any, response: http.IncomingMessage, payload: any) => void) => http.ClientRequest; + put: (uri: string, options: any, callback: (err: any, response: http.IncomingMessage, payload: any) => void) => http.ClientRequest; + delete: (uri: string, options: any, callback: (err: any, response: http.IncomingMessage, payload: any) => void) => http.ClientRequest; + + toReadableStream: (payload: any, encoding?: string) => stream.Readable; + + parseCacheControl: (field: string) => any; + + agents: { + http: http.Agent, + https: http.Agent + }; +} + +declare var wreck: WreckObject; + +export = wreck; diff --git a/types/wreck/v7/tsconfig.json b/types/wreck/v7/tsconfig.json new file mode 100644 index 0000000000..f67dc5c5fa --- /dev/null +++ b/types/wreck/v7/tsconfig.json @@ -0,0 +1,28 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "strictFunctionTypes": true, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "paths": { + "wreck": [ + "wreck/v7" + ] + }, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "wreck-tests.ts" + ] +} \ No newline at end of file diff --git a/types/wreck/v7/tslint.json b/types/wreck/v7/tslint.json new file mode 100644 index 0000000000..a41bf5d19a --- /dev/null +++ b/types/wreck/v7/tslint.json @@ -0,0 +1,79 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "adjacent-overload-signatures": false, + "array-type": false, + "arrow-return-shorthand": false, + "ban-types": false, + "callable-types": false, + "comment-format": false, + "dt-header": false, + "eofline": false, + "export-just-namespace": false, + "import-spacing": false, + "interface-name": false, + "interface-over-type-literal": false, + "jsdoc-format": false, + "max-line-length": false, + "member-access": false, + "new-parens": false, + "no-any-union": false, + "no-boolean-literal-compare": false, + "no-conditional-assignment": false, + "no-consecutive-blank-lines": false, + "no-construct": false, + "no-declare-current-package": false, + "no-duplicate-imports": false, + "no-duplicate-variable": false, + "no-empty-interface": false, + "no-for-in-array": false, + "no-inferrable-types": false, + "no-internal-module": false, + "no-irregular-whitespace": false, + "no-mergeable-namespace": false, + "no-misused-new": false, + "no-namespace": false, + "no-object-literal-type-assertion": false, + "no-padding": false, + "no-redundant-jsdoc": false, + "no-redundant-jsdoc-2": false, + "no-redundant-undefined": false, + "no-reference-import": false, + "no-relative-import-in-test": false, + "no-self-import": false, + "no-single-declare-module": false, + "no-string-throw": false, + "no-unnecessary-callback-wrapper": false, + "no-unnecessary-class": false, + "no-unnecessary-generics": false, + "no-unnecessary-qualifier": false, + "no-unnecessary-type-assertion": false, + "no-useless-files": false, + "no-var-keyword": false, + "no-var-requires": false, + "no-void-expression": false, + "no-trailing-whitespace": false, + "object-literal-key-quotes": false, + "object-literal-shorthand": false, + "one-line": false, + "one-variable-per-declaration": false, + "only-arrow-functions": false, + "prefer-conditional-expression": false, + "prefer-const": false, + "prefer-declare-function": false, + "prefer-for-of": false, + "prefer-method-signature": false, + "prefer-template": false, + "radix": false, + "semicolon": false, + "space-before-function-paren": false, + "space-within-parens": false, + "strict-export-declare-modifiers": false, + "trim-file": false, + "triple-equals": false, + "typedef-whitespace": false, + "unified-signatures": false, + "void-return": false, + "whitespace": false + } +} diff --git a/types/wreck/v7/wreck-tests.ts b/types/wreck/v7/wreck-tests.ts new file mode 100644 index 0000000000..163f65ffa1 --- /dev/null +++ b/types/wreck/v7/wreck-tests.ts @@ -0,0 +1,38 @@ + +import Wreck = require('wreck'); + +Wreck.get('https://google.com/', {}, function (err: any, res: any, payload: any) { + /* do stuff */ +}); + + +var method = 'GET'; // GET, POST, PUT, DELETE +var uri = 'https://google.com/'; +var readableStream = Wreck.toReadableStream('foo=bar'); + +var wreck = Wreck.defaults({ + headers: { 'x-foo-bar': 123 } +}); + +// cascading example -- does not alter `wreck` +var wreckWithTimeout = wreck.defaults({ + timeout: 5 +}); + +// all attributes are optional +var options = { + maxBytes: 1048576, // 1 MB, default: unlimited + rejectUnauthorized: true +}; + +var optionalCallback = function (err: any, res: any) { + + /* handle err if it exists, in which case res will be undefined */ + + // buffer the response stream + Wreck.read(res, null, function (err: any, body: any) { + /* do stuff */ + }); +}; + +var req = wreck.request(method, uri, options, optionalCallback); diff --git a/types/wreck/wreck-tests.ts b/types/wreck/wreck-tests.ts index 163f65ffa1..1b3ff1820d 100644 --- a/types/wreck/wreck-tests.ts +++ b/types/wreck/wreck-tests.ts @@ -1,7 +1,7 @@ import Wreck = require('wreck'); -Wreck.get('https://google.com/', {}, function (err: any, res: any, payload: any) { +Wreck.get('https://google.com/', {}).then((response) => { /* do stuff */ }); @@ -30,9 +30,11 @@ var optionalCallback = function (err: any, res: any) { /* handle err if it exists, in which case res will be undefined */ // buffer the response stream - Wreck.read(res, null, function (err: any, body: any) { + Wreck.read(res, null).then((payload) => { /* do stuff */ }); }; -var req = wreck.request(method, uri, options, optionalCallback); +var req = wreck.request(method, uri, options).then((response) => { + /* do stuff */ +}); From 8ca3d37a5612fa5c577c73fe99e6b20deddc08aa Mon Sep 17 00:00:00 2001 From: Marcin Biernat Date: Sun, 29 Apr 2018 18:48:06 +0200 Subject: [PATCH 049/575] Improve R.evolve typings --- types/ramda/index.d.ts | 30 +++++++++++++++---- types/ramda/ramda-tests.ts | 60 ++++++++++++++++++++++++++++++-------- 2 files changed, 73 insertions(+), 17 deletions(-) diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index 9849ee48b1..e3eda424ec 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -20,6 +20,7 @@ // Keagan McClelland // Tomas Szabo // Bonggyun Lee +// Marcin Biernat // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -82,9 +83,28 @@ declare namespace R { (obj: Dictionary): Dictionary; } - type Evolver = - | ((x: T) => T) - | { [K in keyof T]?: Evolver }; + type Evolve, E extends Evolver> = { + [P in keyof O]: P extends keyof E ? EvolveValue : O[P]; + }; + + type EvolveValue = + E extends (value: V) => any ? ReturnType : + E extends Evolver ? EvolveNestedValue : + never; + + type EvolveNestedValue = + V extends object ? (V extends Evolvable ? Evolve : never) : never; + + interface Evolver { + [key: string]: ((value: any) => any) | Evolver; + } + + // Represents all objects evolvable with Evolver E + type Evolvable = { + [P in keyof E]?: E[P] extends (value: infer V) => any ? V : + E[P] extends Evolver ? Evolvable : + never + }; // @see https://gist.github.com/donnut/fd56232da58d25ceecf1, comment by @albrow interface CurriedTypeGuard2 { @@ -604,8 +624,8 @@ declare namespace R { /** * Creates a new object by evolving a shallow copy of object, according to the transformation functions. */ - evolve(transformations: Evolver, obj: V): V; - evolve(transformations: Evolver): (obj: W) => W; + evolve>(transformations: E, obj: V): Evolve; + evolve(transformations: E): >(obj: V) => Evolve; /* * A function that always returns false. Any passed in parameters are ignored. diff --git a/types/ramda/ramda-tests.ts b/types/ramda/ramda-tests.ts index 8cbbf9ceac..ff19276316 100644 --- a/types/ramda/ramda-tests.ts +++ b/types/ramda/ramda-tests.ts @@ -1307,19 +1307,55 @@ type Pair = KeyValuePair; }; () => { - const a1 = R.evolve({elapsed: R.add(1), remaining: R.add(-1)}, {name: "Tomato", elapsed: 100, remaining: 1400}); - const a2 = R.evolve({elapsed: R.add(1), remaining: R.add(-1)})({name: "Tomato", elapsed: 100, remaining: 1400}); -}; + // No type transformation -() => { - // const tomato = {firstName: 'Tomato ', data: {elapsed: 100, remaining: 1400}, id:123}; - // const transformations = { - // firstName: R.trim, - // lastName: R.trim, // Will not get invoked. - // data: {elapsed: R.add(1), remaining: R.add(-1)} - // }; - // const a = R.evolve(transformations, tomato); // => {firstName: 'Tomato', data: {elapsed: 101, remaining: 1399}, id:123} - // const b = R.evolve(transformations)(tomato); // => {firstName: 'Tomato', data: {elapsed: 101, remaining: 1399}, id:123} + const a1 = R.evolve({ elapsed: R.add(1), remaining: R.add(-1) }, { name: "Tomato", elapsed: 100, remaining: 1400 }); + + const a1Test: { elapsed: number, remaining: number, name: string } = a1; + + const a2 = R.evolve({ elapsed: R.add(1), remaining: R.add(-1) })({ name: "Tomato", elapsed: 100, remaining: 1400 }); + + const a2Test: { elapsed: number, remaining: number, name: string } = a2; + + // Object doesn't have all evolver keys + + const a3 = R.evolve({ age: R.add(1), name: R.trim }, { name: "Potato", elapsed: 100 }); + + const a3Test: { name: string, elapsed: number } = a3; + + // Flat transformation + + const ex0 = R.evolve({ a: parseInt }, { a: '10', b: 1 }); + + const ex0Test: { a: number, b: number } = ex0; + + // Nested transformation: + + const ex1 = R.evolve( + { a: { b: R.toString, d: { e: R.toString } } }, + { a: { b: 1, c: null, d: { e: 2 } } }, + ); + + const ex1Test: { a: { b: string, c: null, d: { e: string } } } = ex1; + + // Mapping a nested object with a single function + + const ex2 = R.evolve( + { a: (obj: { foo: string }) => ({ bar: 1, baz: 2 }) }, + { a: { foo: 'a', skipped: 3 }, b: null }, + ); + + const ex2Test: { a: { bar: number, baz: number }, b: null } = ex2; + + // Nested curried: + + const ex3 = R.evolve( + { a: { b: R.toString, d: { e: R.toString } } }, + )( + { a: { b: 1, c: null, d: { e: 2 } } } + ); + + const ex3Test: { a: { b: string, c: null, d: { e: string } } } = ex3; }; () => { From 40986a91adc214b92ffce92898f7c6489a7ef314 Mon Sep 17 00:00:00 2001 From: Sinziana Nicolae Date: Fri, 11 May 2018 19:28:21 +0300 Subject: [PATCH 050/575] Remove wrong types --- types/react-dates/index.d.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/types/react-dates/index.d.ts b/types/react-dates/index.d.ts index 1ecebfb22c..3d0be63905 100644 --- a/types/react-dates/index.d.ts +++ b/types/react-dates/index.d.ts @@ -267,9 +267,6 @@ declare namespace ReactDates { monthFormat?: string, phrases?: { calendarLabel?: string, - closeDatePicker?: string, - clearDates?: string, - focusStartDate?: string, jumpToPrevMonth?: string, jumpToNextMonth?: string, keyboardShortcuts?: string, @@ -289,9 +286,9 @@ declare namespace ReactDates { moveFocusByOneMonth?: string, moveFocustoStartAndEndOfWeek?: string, returnFocusToInput?: string, - keyboardNavigationInstructions?: string, chooseAvailableStartDate?: (date: string) => string, chooseAvailableEndDate?: (date: string) => string, + chooseAvailableDate?: (date: string) => string, dateIsUnavailable?: (date: string) => string, dateIsSelected?: (date: string) => string, } From 120a90e9670c7197fc0a2e5c83a62898c5c6114c Mon Sep 17 00:00:00 2001 From: Hugues Stefanski Date: Fri, 11 May 2018 20:27:08 +0200 Subject: [PATCH 051/575] d3-color : fix comment indent remove prototypes --- types/d3-color/index.d.ts | 45 +++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/types/d3-color/index.d.ts b/types/d3-color/index.d.ts index 3c11d8f88d..68a92ed321 100644 --- a/types/d3-color/index.d.ts +++ b/types/d3-color/index.d.ts @@ -28,6 +28,11 @@ export interface ColorCommonInstance { brighter(k?: number): this; darker(k?: number): this; rgb(): RGBColor; + /** + * Returns a hexadecimal string representing this color. + * If this color is not displayable, a suitable displayable color is returned instead. For example, RGB channel values greater than 255 are clamped to 255. + */ + hex(): string; } export interface Color { @@ -53,9 +58,9 @@ export interface RGBColor extends Color { */ rgb(): this; /** - * Returns a hexadecimal string representing this color. - * If this color is not displayable, a suitable displayable color is returned instead. For example, RGB channel values greater than 255 are clamped to 255. - */ + * Returns a hexadecimal string representing this color. + * If this color is not displayable, a suitable displayable color is returned instead. For example, RGB channel values greater than 255 are clamped to 255. + */ hex(): string; } @@ -74,10 +79,10 @@ export interface HSLColor extends Color { brighter(k?: number): this; darker(k?: number): this; rgb(): RGBColor; - /** - * Returns a hexadecimal string representing this color. - * If this color is not displayable, a suitable displayable color is returned instead. For example, RGB channel values greater than 255 are clamped to 255. - */ + /** + * Returns a hexadecimal string representing this color. + * If this color is not displayable, a suitable displayable color is returned instead. For example, RGB channel values greater than 255 are clamped to 255. + */ hex(): string; } @@ -96,10 +101,10 @@ export interface LabColor extends Color { brighter(k?: number): this; darker(k?: number): this; rgb(): RGBColor; - /** - * Returns a hexadecimal string representing this color. - * If this color is not displayable, a suitable displayable color is returned instead. For example, RGB channel values greater than 255 are clamped to 255. - */ + /** + * Returns a hexadecimal string representing this color. + * If this color is not displayable, a suitable displayable color is returned instead. For example, RGB channel values greater than 255 are clamped to 255. + */ hex(): string; } @@ -115,7 +120,6 @@ export interface LabColorFactory extends Function { */ export interface GrayColorFactory extends Function { (l: number, opacity?: number): LabColor; - readonly prototype: LabColor; } export interface HCLColor extends Color { @@ -126,10 +130,10 @@ export interface HCLColor extends Color { brighter(k?: number): this; darker(k?: number): this; rgb(): RGBColor; - /** - * Returns a hexadecimal string representing this color. - * If this color is not displayable, a suitable displayable color is returned instead. For example, RGB channel values greater than 255 are clamped to 255. - */ + /** + * Returns a hexadecimal string representing this color. + * If this color is not displayable, a suitable displayable color is returned instead. For example, RGB channel values greater than 255 are clamped to 255. + */ hex(): string; } @@ -144,7 +148,6 @@ export interface LCHColorFactory extends Function { (l: number, c: number, h: number, opacity?: number): HCLColor; (cssColorSpecifier: string): HCLColor; (color: ColorSpaceObject | ColorCommonInstance): HCLColor; - readonly prototype: HCLColor; } export interface CubehelixColor extends Color { @@ -155,10 +158,10 @@ export interface CubehelixColor extends Color { brighter(k?: number): this; darker(k?: number): this; rgb(): RGBColor; - /** - * Returns a hexadecimal string representing this color. - * If this color is not displayable, a suitable displayable color is returned instead. For example, RGB channel values greater than 255 are clamped to 255. - */ + /** + * Returns a hexadecimal string representing this color. + * If this color is not displayable, a suitable displayable color is returned instead. For example, RGB channel values greater than 255 are clamped to 255. + */ hex(): string; } From 1180203388f48d6751800415c883d71da24fb677 Mon Sep 17 00:00:00 2001 From: Hugues Stefanski Date: Fri, 11 May 2018 20:28:31 +0200 Subject: [PATCH 052/575] d3-color : Fix prototype test --- types/d3-color/d3-color-tests.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/types/d3-color/d3-color-tests.ts b/types/d3-color/d3-color-tests.ts index 9be5a3d067..2d324e7886 100644 --- a/types/d3-color/d3-color-tests.ts +++ b/types/d3-color/d3-color-tests.ts @@ -136,12 +136,8 @@ if (color instanceof d3Color.rgb) { cHSL = color; } else if (color instanceof d3Color.lab) { cLab = color; -} else if (color instanceof d3Color.gray) { - cLab = color; } else if (color instanceof d3Color.hcl) { cHcl = color; -} else if (color instanceof d3Color.lch) { - cHcl = color; } else if (color instanceof d3Color.cubehelix) { cCubehelix = color; } else if (color === null) { From 8ae3c459e6d150b1212f475b744c120f293324c5 Mon Sep 17 00:00:00 2001 From: Hugues Stefanski Date: Fri, 11 May 2018 20:42:49 +0200 Subject: [PATCH 053/575] d3-color : fix border effects --- types/d3-color/index.d.ts | 10 ++++++---- types/d3-hsv/index.d.ts | 6 ++++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/types/d3-color/index.d.ts b/types/d3-color/index.d.ts index 68a92ed321..68dcf9e358 100644 --- a/types/d3-color/index.d.ts +++ b/types/d3-color/index.d.ts @@ -57,7 +57,7 @@ export interface RGBColor extends Color { * Returns the RGB equivalent of this color. */ rgb(): this; - /** + /** * Returns a hexadecimal string representing this color. * If this color is not displayable, a suitable displayable color is returned instead. For example, RGB channel values greater than 255 are clamped to 255. */ @@ -118,9 +118,11 @@ export interface LabColorFactory extends Function { /** * Constructs a new Lab color with the specified l value and a = b = 0. */ -export interface GrayColorFactory extends Function { - (l: number, opacity?: number): LabColor; -} +// export interface GrayColorFactory extends Function { +// (l: number, opacity?: number): LabColor; +// } + +export type GrayColorFactory = (l: number, opacity?: number) => LabColor; export interface HCLColor extends Color { h: number; diff --git a/types/d3-hsv/index.d.ts b/types/d3-hsv/index.d.ts index 1728af0874..7452dbcc2b 100644 --- a/types/d3-hsv/index.d.ts +++ b/types/d3-hsv/index.d.ts @@ -68,6 +68,12 @@ export interface HSVColor extends Color { * Returns the RGB equivalent of this color. */ rgb(): RGBColor; + + /** + * Returns a hexadecimal string representing this color. + * If this color is not displayable, a suitable displayable color is returned instead. For example, RGB channel values greater than 255 are clamped to 255. + */ + hex(): string; } export const hsv: HSVColorFactory; From 23ca115b22d0e61c93382cb76facc338a679cc84 Mon Sep 17 00:00:00 2001 From: Collin Kostichuk Date: Thu, 10 May 2018 14:21:45 -0600 Subject: [PATCH 054/575] Updated types for @material group to v0.35.0 --- types/material-components-web/index.d.ts | 15 +- types/material__animation/index.d.ts | 4 +- types/material__auto-init/index.d.ts | 6 +- types/material__base/component.d.ts | 10 +- types/material__base/foundation.d.ts | 4 +- types/material__base/index.d.ts | 6 +- types/material__checkbox/adapter.d.ts | 12 +- types/material__checkbox/constants.d.ts | 8 +- types/material__checkbox/foundation.d.ts | 10 +- types/material__checkbox/index.d.ts | 8 +- types/material__chips/chip-set/adapter.d.ts | 50 ++++++ .../chip-set}/constants.d.ts | 8 +- .../material__chips/chip-set/foundation.d.ts | 44 +++++ types/material__chips/chip-set/index.d.ts | 35 ++++ types/material__chips/chip/adapter.d.ts | 77 +++++++++ types/material__chips/chip/constants.d.ts | 38 +++++ types/material__chips/chip/foundation.d.ts | 32 ++++ types/material__chips/chip/index.d.ts | 39 +++++ types/material__chips/index.d.ts | 24 +++ types/material__chips/tsconfig.json | 32 ++++ types/material__chips/tslint.json | 1 + types/material__dialog/adapter.d.ts | 4 +- types/material__dialog/constants.d.ts | 2 +- types/material__dialog/foundation.d.ts | 8 +- types/material__dialog/index.d.ts | 19 +-- types/material__drawer/index.d.ts | 12 +- .../persistent/constants.d.ts | 10 +- .../persistent/foundation.d.ts | 4 +- types/material__drawer/persistent/index.d.ts | 4 +- types/material__drawer/slidable/index.d.ts | 6 +- .../material__drawer/temporary/constants.d.ts | 10 +- .../temporary/foundation.d.ts | 4 +- types/material__drawer/temporary/index.d.ts | 2 - types/material__drawer/util.d.ts | 4 +- types/material__floating-label/adapter.d.ts | 51 ++++++ types/material__floating-label/constants.d.ts | 23 +++ .../material__floating-label/foundation.d.ts | 40 +++++ types/material__floating-label/index.d.ts | 48 ++++++ types/material__floating-label/tsconfig.json | 27 +++ types/material__floating-label/tslint.json | 1 + types/material__form-field/adapter.d.ts | 8 +- types/material__form-field/constants.d.ts | 2 +- types/material__form-field/foundation.d.ts | 4 +- types/material__form-field/index.d.ts | 6 +- types/material__grid-list/adapter.d.ts | 2 +- types/material__grid-list/foundation.d.ts | 6 +- types/material__grid-list/index.d.ts | 12 +- types/material__icon-toggle/adapter.d.ts | 29 ++-- types/material__icon-toggle/foundation.d.ts | 28 +--- types/material__icon-toggle/index.d.ts | 12 +- types/material__line-ripple/adapter.d.ts | 53 ++++++ types/material__line-ripple/constants.d.ts | 23 +++ types/material__line-ripple/foundation.d.ts | 45 +++++ types/material__line-ripple/index.d.ts | 47 ++++++ types/material__line-ripple/tsconfig.json | 27 +++ types/material__line-ripple/tslint.json | 1 + types/material__linear-progress/adapter.d.ts | 2 +- .../material__linear-progress/foundation.d.ts | 7 +- types/material__linear-progress/index.d.ts | 12 +- .../material__menu/{simple => }/adapter.d.ts | 44 +++-- types/material__menu/constants.d.ts | 77 +++++++++ types/material__menu/foundation.d.ts | 68 ++++++++ types/material__menu/index.d.ts | 47 +++++- types/material__menu/simple/constants.d.ts | 52 ------ types/material__menu/simple/index.d.ts | 42 ----- types/material__menu/tsconfig.json | 11 +- types/material__notched-outline/adapter.d.ts | 57 +++++++ .../material__notched-outline/constants.d.ts | 27 +++ .../material__notched-outline/foundation.d.ts | 38 +++++ types/material__notched-outline/index.d.ts | 41 +++++ types/material__notched-outline/tsconfig.json | 27 +++ types/material__notched-outline/tslint.json | 1 + types/material__radio/adapter.d.ts | 8 +- types/material__radio/foundation.d.ts | 23 ++- types/material__radio/index.d.ts | 10 +- types/material__ripple/adapter.d.ts | 16 +- types/material__ripple/constants.d.ts | 8 +- types/material__ripple/foundation.d.ts | 35 +--- types/material__ripple/index.d.ts | 24 ++- types/material__select/adapter.d.ts | 58 +------ types/material__select/constants.d.ts | 8 +- types/material__select/foundation.d.ts | 21 +-- types/material__select/index.d.ts | 24 +-- types/material__selection-control/index.d.ts | 4 +- types/material__slider/adapter.d.ts | 4 +- types/material__slider/foundation.d.ts | 3 +- types/material__slider/index.d.ts | 30 ++-- types/material__snackbar/adapter.d.ts | 4 +- types/material__snackbar/constants.d.ts | 2 + types/material__snackbar/foundation.d.ts | 20 +-- types/material__snackbar/index.d.ts | 17 +- .../adapter.d.ts | 52 +++--- types/material__tab/constants.d.ts | 27 +++ .../foundation.d.ts | 30 ++-- types/material__tab/index.d.ts | 33 ++++ types/material__tab/tsconfig.json | 27 +++ types/material__tab/tslint.json | 1 + types/material__tabs/index.d.ts | 10 +- .../tab-bar-scroller/adapter.d.ts | 2 +- .../tab-bar-scroller/foundation.d.ts | 2 +- .../tab-bar-scroller/index.d.ts | 17 +- types/material__tabs/tab-bar/adapter.d.ts | 2 +- types/material__tabs/tab-bar/foundation.d.ts | 4 +- types/material__tabs/tab-bar/index.d.ts | 6 +- types/material__tabs/tab/adapter.d.ts | 2 +- types/material__tabs/tab/foundation.d.ts | 4 +- types/material__tabs/tab/index.d.ts | 11 +- types/material__textfield/adapter.d.ts | 156 +++++++++--------- types/material__textfield/constants.d.ts | 19 ++- types/material__textfield/foundation.d.ts | 60 +++---- .../helper-text/adapter.d.ts | 4 +- .../helper-text/foundation.d.ts | 12 +- .../helper-text/index.d.ts | 2 - types/material__textfield/icon/adapter.d.ts | 56 +++++++ .../icon/constants.d.ts} | 8 +- .../material__textfield/icon/foundation.d.ts | 35 ++++ .../{bottom-line => icon}/index.d.ts | 16 +- types/material__textfield/index.d.ts | 56 +++++-- types/material__textfield/tsconfig.json | 8 +- types/material__toolbar/adapter.d.ts | 2 +- types/material__toolbar/constants.d.ts | 1 + types/material__toolbar/foundation.d.ts | 12 +- types/material__toolbar/index.d.ts | 15 +- types/material__toolbar/tsconfig.json | 1 - types/material__top-app-bar/adapter.d.ts | 77 +++++++++ types/material__top-app-bar/constants.d.ts | 38 +++++ .../fixed/foundation.d.ts | 22 +++ .../foundation.d.ts | 25 +-- types/material__top-app-bar/index.d.ts | 38 +++++ .../short/foundation.d.ts | 22 +++ .../standard/foundation.d.ts | 22 +++ types/material__top-app-bar/tsconfig.json | 30 ++++ types/material__top-app-bar/tslint.json | 1 + 133 files changed, 2095 insertions(+), 792 deletions(-) create mode 100644 types/material__chips/chip-set/adapter.d.ts rename types/{material__textfield/bottom-line => material__chips/chip-set}/constants.d.ts (80%) create mode 100644 types/material__chips/chip-set/foundation.d.ts create mode 100644 types/material__chips/chip-set/index.d.ts create mode 100644 types/material__chips/chip/adapter.d.ts create mode 100644 types/material__chips/chip/constants.d.ts create mode 100644 types/material__chips/chip/foundation.d.ts create mode 100644 types/material__chips/chip/index.d.ts create mode 100644 types/material__chips/index.d.ts create mode 100644 types/material__chips/tsconfig.json create mode 100644 types/material__chips/tslint.json create mode 100644 types/material__floating-label/adapter.d.ts create mode 100644 types/material__floating-label/constants.d.ts create mode 100644 types/material__floating-label/foundation.d.ts create mode 100644 types/material__floating-label/index.d.ts create mode 100644 types/material__floating-label/tsconfig.json create mode 100644 types/material__floating-label/tslint.json create mode 100644 types/material__line-ripple/adapter.d.ts create mode 100644 types/material__line-ripple/constants.d.ts create mode 100644 types/material__line-ripple/foundation.d.ts create mode 100644 types/material__line-ripple/index.d.ts create mode 100644 types/material__line-ripple/tsconfig.json create mode 100644 types/material__line-ripple/tslint.json rename types/material__menu/{simple => }/adapter.d.ts (69%) create mode 100644 types/material__menu/constants.d.ts create mode 100644 types/material__menu/foundation.d.ts delete mode 100644 types/material__menu/simple/constants.d.ts delete mode 100644 types/material__menu/simple/index.d.ts create mode 100644 types/material__notched-outline/adapter.d.ts create mode 100644 types/material__notched-outline/constants.d.ts create mode 100644 types/material__notched-outline/foundation.d.ts create mode 100644 types/material__notched-outline/index.d.ts create mode 100644 types/material__notched-outline/tsconfig.json create mode 100644 types/material__notched-outline/tslint.json rename types/{material__textfield/bottom-line => material__tab}/adapter.d.ts (58%) create mode 100644 types/material__tab/constants.d.ts rename types/{material__textfield/bottom-line => material__tab}/foundation.d.ts (64%) create mode 100644 types/material__tab/index.d.ts create mode 100644 types/material__tab/tsconfig.json create mode 100644 types/material__tab/tslint.json create mode 100644 types/material__textfield/icon/adapter.d.ts rename types/{material__toolbar/util.d.ts => material__textfield/icon/constants.d.ts} (77%) create mode 100644 types/material__textfield/icon/foundation.d.ts rename types/material__textfield/{bottom-line => icon}/index.d.ts (58%) create mode 100644 types/material__top-app-bar/adapter.d.ts create mode 100644 types/material__top-app-bar/constants.d.ts create mode 100644 types/material__top-app-bar/fixed/foundation.d.ts rename types/{material__menu/simple => material__top-app-bar}/foundation.d.ts (63%) create mode 100644 types/material__top-app-bar/index.d.ts create mode 100644 types/material__top-app-bar/short/foundation.d.ts create mode 100644 types/material__top-app-bar/standard/foundation.d.ts create mode 100644 types/material__top-app-bar/tsconfig.json create mode 100644 types/material__top-app-bar/tslint.json diff --git a/types/material-components-web/index.d.ts b/types/material-components-web/index.d.ts index c5d1434942..f1f9874f4b 100644 --- a/types/material-components-web/index.d.ts +++ b/types/material-components-web/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Material Components Web 0.26 +// Type definitions for Material Components Web 0.35 // Project: https://material.io/components/ -// Definitions by: Brent Douglas +// Definitions by: Brent Douglas , Collin Kostichuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -23,13 +23,17 @@ import autoInit from 'material__auto-init'; import * as base from 'material__base'; import * as checkbox from 'material__checkbox'; +import * as chips from 'material__chips'; import * as dialog from 'material__dialog'; import * as drawer from 'material__drawer'; +import * as floatingLabel from 'material__floating-label'; import * as formField from 'material__form-field'; import * as gridList from 'material__grid-list'; import * as iconToggle from 'material__icon-toggle'; import * as linearProgress from 'material__linear-progress'; +import * as lineRipple from 'material__line-ripple'; import * as menu from 'material__menu'; +import * as notchedOutline from 'material__notched-outline'; import * as radio from 'material__radio'; import * as ripple from 'material__ripple'; import * as select from 'material__select'; @@ -39,19 +43,23 @@ import * as snackbar from 'material__snackbar'; import * as tabs from 'material__tabs'; import * as textField from 'material__textfield'; import * as toolbar from 'material__toolbar'; - +import * as topAppBar from 'material__top-app-bar'; // Export all components. export { autoInit, base, checkbox, + chips, dialog, drawer, + floatingLabel, formField, gridList, iconToggle, + lineRipple, linearProgress, menu, + notchedOutline, radio, ripple, select, @@ -61,4 +69,5 @@ export { tabs, textField, toolbar, + topAppBar }; diff --git a/types/material__animation/index.d.ts b/types/material__animation/index.d.ts index 8baf562003..2527cf9e71 100644 --- a/types/material__animation/index.d.ts +++ b/types/material__animation/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Material Components Web 0.26 +// Type definitions for Material Components Web 0.35 // Project: https://material.io/components/ -// Definitions by: Brent Douglas +// Definitions by: Brent Douglas , Collin Kostichuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 diff --git a/types/material__auto-init/index.d.ts b/types/material__auto-init/index.d.ts index 026b692b99..2993089fce 100644 --- a/types/material__auto-init/index.d.ts +++ b/types/material__auto-init/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Material Components Web 0.26 +// Type definitions for Material Components Web 0.35 // Project: https://material.io/components/ -// Definitions by: Brent Douglas +// Definitions by: Brent Douglas , Collin Kostichuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -32,6 +32,8 @@ export interface MDCAutoInit { /** * Auto-initializes all mdc components on a page. */ +// tslint:disable-next-line:strict-export-declare-modifiers declare const mdcAutoInit: MDCAutoInit; +// tslint:disable-next-line:strict-export-declare-modifiers export default mdcAutoInit; diff --git a/types/material__base/component.d.ts b/types/material__base/component.d.ts index 0a645b26a4..43c085cdce 100644 --- a/types/material__base/component.d.ts +++ b/types/material__base/component.d.ts @@ -6,7 +6,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -17,7 +17,7 @@ import MDCFoundation from './foundation'; -export class MDCComponent> { +export default class MDCComponent> { static attachTo(root: Element): MDCComponent>; constructor(root: Element, foundation?: F, ...args: any[]); @@ -45,13 +45,13 @@ export class MDCComponent> { * Wrapper method to add an event listener to the component's root element. This is most useful when * listening for custom events. */ - listen(evtType: string, handler: EventListenerOrEventListenerObject): void; + listen(evtType: string, handler: EventListener): void; /** * Wrapper method to remove an event listener to the component's root element. This is most useful when * unlistening for custom events. */ - unlisten(evtType: string, handler: EventListenerOrEventListenerObject): void; + unlisten(evtType: string, handler: EventListener): void; /** * Fires a cross-browser-compatible custom event from the component root of the given type, @@ -59,5 +59,3 @@ export class MDCComponent> { */ emit(evtType: string, evtData: any, shouldBubble?: boolean): void; } - -export default MDCComponent; diff --git a/types/material__base/foundation.d.ts b/types/material__base/foundation.d.ts index 7612d0daea..7bd61ec18e 100644 --- a/types/material__base/foundation.d.ts +++ b/types/material__base/foundation.d.ts @@ -23,7 +23,7 @@ export interface MDCNumbers { [key: string]: number; } -export class MDCFoundation { +export default class MDCFoundation { static readonly cssClasses: MDCStrings; static readonly strings: MDCStrings; @@ -40,5 +40,3 @@ export class MDCFoundation { // Subclasses should override this method to perform de-initialization routines (de-registering events, etc.) destroy(): void; } - -export default MDCFoundation; diff --git a/types/material__base/index.d.ts b/types/material__base/index.d.ts index 0172cb35f6..bc4d2ee1a3 100644 --- a/types/material__base/index.d.ts +++ b/types/material__base/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Material Components Web 0.26 +// Type definitions for Material Components Web 0.35 // Project: https://material.io/components/ -// Definitions by: Brent Douglas +// Definitions by: Brent Douglas , Collin Kostichuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -21,7 +21,7 @@ * limitations under the License. */ -import { MDCNumbers, MDCStrings, MDCFoundation } from './foundation'; +import MDCFoundation, { MDCNumbers, MDCStrings } from './foundation'; import MDCComponent from './component'; export {MDCNumbers, MDCStrings, MDCFoundation, MDCComponent}; diff --git a/types/material__checkbox/adapter.d.ts b/types/material__checkbox/adapter.d.ts index aedeed30f5..a68eefb002 100644 --- a/types/material__checkbox/adapter.d.ts +++ b/types/material__checkbox/adapter.d.ts @@ -6,7 +6,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -29,13 +29,17 @@ import { MDCSelectionControlState } from 'material__selection-control'; * Implement this adapter for your framework of choice to delegate updates to * the component in your framework of choice. See architecture documentation * for more details. - * https://github.com/material-components/material-components-web/blob/master/docs/architecture.md + * https://github.com/material-components/material-components-web/blob/master/docs/code/architecture.md */ -export class MDCCheckboxAdapter { +export default interface MDCCheckboxAdapter { addClass(className: string): void; removeClass(className: string): void; + setNativeControlAttr(attr: string, value: string): void; + + removeNativeControlAttr(attr: string): void; + registerAnimationEndHandler(handler: EventListener): void; deregisterAnimationEndHandler(handler: EventListener): void; @@ -50,5 +54,3 @@ export class MDCCheckboxAdapter { isAttachedToDOM(): boolean; } - -export default MDCCheckboxAdapter; diff --git a/types/material__checkbox/constants.d.ts b/types/material__checkbox/constants.d.ts index ee665f4c05..b522139b55 100644 --- a/types/material__checkbox/constants.d.ts +++ b/types/material__checkbox/constants.d.ts @@ -6,7 +6,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - import { MDCStrings, MDCNumbers } from 'material__base'; +import { MDCStrings, MDCNumbers } from 'material__base'; export interface cssClasses extends MDCStrings { UPGRADED: 'mdc-checkbox--upgraded'; @@ -35,8 +35,10 @@ export interface strings extends MDCStrings { TRANSITION_STATE_CHECKED: 'checked'; TRANSITION_STATE_UNCHECKED: 'unchecked'; TRANSITION_STATE_INDETERMINATE: 'indeterminate'; + ARIA_CHECKED_ATTR: 'aria-checked'; + ARIA_CHECKED_INDETERMINATE_VALUE: 'mixed'; } export interface numbers extends MDCNumbers { - ANIM_END_LATCH_MS: 100; + ANIM_END_LATCH_MS: 250; } diff --git a/types/material__checkbox/foundation.d.ts b/types/material__checkbox/foundation.d.ts index 73216efcd6..cf04fe98f7 100644 --- a/types/material__checkbox/foundation.d.ts +++ b/types/material__checkbox/foundation.d.ts @@ -19,7 +19,7 @@ import MDCFoundation from 'material__base/foundation'; import MDCCheckboxAdapter from './adapter'; import { cssClasses, strings, numbers } from './constants'; -export class MDCCheckboxFoundation extends MDCFoundation { +export default class MDCCheckboxFoundation extends MDCFoundation { static readonly cssClasses: cssClasses; static readonly strings: strings; @@ -30,7 +30,7 @@ export class MDCCheckboxFoundation extends MDCFoundation { isChecked(): boolean; - setChecked(checked: boolean): boolean; + setChecked(checked: boolean): void; isIndeterminate(): boolean; @@ -43,6 +43,8 @@ export class MDCCheckboxFoundation extends MDCFoundation { getValue(): string; setValue(value: string): void; -} -export default MDCCheckboxFoundation; + handleAnimationEnd(): void; + + handleChange(): void; +} diff --git a/types/material__checkbox/index.d.ts b/types/material__checkbox/index.d.ts index 9190c3d5a9..308bc077bb 100644 --- a/types/material__checkbox/index.d.ts +++ b/types/material__checkbox/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Material Components Web 0.26 +// Type definitions for Material Components Web 0.35 // Project: https://material.io/components/ -// Definitions by: Brent Douglas +// Definitions by: Brent Douglas , Collin Kostichuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -32,8 +32,6 @@ export {MDCCheckboxAdapter, MDCCheckboxFoundation}; export class MDCCheckbox extends MDCComponent implements MDCSelectionControl { static attachTo(root: Element): MDCCheckbox; - getDefaultFoundation(): MDCCheckboxFoundation; - readonly ripple: MDCRipple; checked: boolean; @@ -43,6 +41,4 @@ export class MDCCheckbox extends MDCComponent { + static readonly strings: strings; + + static readonly cssClasses: cssClasses; + + static readonly defaultAdapter: MDCChipSetAdapter; + + /** + * Returns a new chip element with the given text, leading icon, and trailing icon, + * added to the root chip set element. + */ + addChip(text: string, leadingIcon?: Element | null, trailingIcon?: Element | null): Element; + + /** + * Selects the given chip. Deselects all other chips if the chip set is of the choice variant. + */ + select(chipFoundation: MDCChipFoundation): void; + + /** + * Deselects the given chip. + */ + deselect(chipFoundation: MDCChipFoundation): void; +} diff --git a/types/material__chips/chip-set/index.d.ts b/types/material__chips/chip-set/index.d.ts new file mode 100644 index 0000000000..a516d3b374 --- /dev/null +++ b/types/material__chips/chip-set/index.d.ts @@ -0,0 +1,35 @@ +/** + * @license + * Copyright 2016 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import MDCComponent from 'material__base/component'; +import MDCChipSetFoundation from './foundation'; +import MDCChipSetAdapter from './adapter'; +import { MDCChip } from '../chip'; + +export { MDCChipSetFoundation, MDCChipSetAdapter }; + +export class MDCChipSet extends MDCComponent { + static attachTo(root: any): MDCChipSet; + + initialize(chipFactory?: (el: Element) => MDCChip): void; + + initialSyncWithDOM(): void; + + /** + * Creates a new chip in the chip set with the given text, leading icon, and trailing icon. + */ + addChip(text: string, leadingIcon?: Element | null, trailingIcon?: Element | null): void; +} diff --git a/types/material__chips/chip/adapter.d.ts b/types/material__chips/chip/adapter.d.ts new file mode 100644 index 0000000000..52ffcef68f --- /dev/null +++ b/types/material__chips/chip/adapter.d.ts @@ -0,0 +1,77 @@ +/** + * @license + * Copyright 2017 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Adapter for MDC Chip. + * + * Defines the shape of the adapter expected by the foundation. Implement this + * adapter to integrate the Chip into your framework. See + * https://github.com/material-components/material-components-web/blob/master/docs/authoring-components.md + * for more information. + */ +export default interface MDCChipAdapter { + addClass(className: string): void; + + removeClass(className: string): void; + + hasClass(className: string): boolean; + + addClassToLeadingIcon(className: string): void; + + removeClassFromLeadingIcon(className: string): void; + /** + * Returns true if target has className, false otherwise. + */ + eventTargetHasClass(target: EventTarget, className: string): boolean; + /** + * Registers an event listener on the root element for a given event. + */ + registerEventHandler(evtType: string, handler: EventListener): void; + /** + * Deregisters an event listener on the root element for a given event. + */ + deregisterEventHandler(evtType: string, handler: EventListener): void; + /** + * Registers an event listener on the trailing icon element for a given event. + */ + registerTrailingIconInteractionHandler(evtType: string, handler: EventListener): void; + /** + * Deregisters an event listener on the trailing icon element for a given event. + */ + deregisterTrailingIconInteractionHandler(evtType: string, handler: EventListener): void; + /** + * Emits a custom "MDCChip:interaction" event denoting the chip has been + * interacted with (typically on click or keydown). + */ + notifyInteraction(): void; + /** + * Emits a custom "MDCChip:trailingIconInteraction" event denoting the trailing icon has been + * interacted with (typically on click or keydown). + */ + notifyTrailingIconInteraction(): void; + /** + * Emits a custom event "MDCChip:removal" denoting the chip will be removed. + */ + notifyRemoval(): void; + /** + * Returns the computed property value of the given style property on the root element. + */ + getComputedStyleValue(propertyName: string): string; + /** + * Sets the property value of the given style property on the root element. + */ + setStyleProperty(propertyName: string, value: string): void; +} diff --git a/types/material__chips/chip/constants.d.ts b/types/material__chips/chip/constants.d.ts new file mode 100644 index 0000000000..79f1891445 --- /dev/null +++ b/types/material__chips/chip/constants.d.ts @@ -0,0 +1,38 @@ +/** + * @license + * Copyright 2016 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { MDCStrings } from 'material__base'; + +export interface strings extends MDCStrings { + ENTRY_ANIMATION_NAME: 'mdc-chip-entry'; + INTERACTION_EVENT: 'MDCChip:interaction'; + TRAILING_ICON_INTERACTION_EVENT: 'MDCChip:trailingIconInteraction'; + REMOVAL_EVENT: 'MDCChip:removal'; + CHECKMARK_SELECTOR: '.mdc-chip__checkmark'; + LEADING_ICON_SELECTOR: '.mdc-chip__icon--leading'; + TRAILING_ICON_SELECTOR: '.mdc-chip__icon--trailing'; +} + +export interface cssClasses extends MDCStrings { + CHECKMARK: 'mdc-chip__checkmark'; + CHIP: 'mdc-chip'; + CHIP_EXIT: 'mdc-chip--exit'; + HIDDEN_LEADING_ICON: 'mdc-chip__icon--leading-hidden'; + LEADING_ICON: 'mdc-chip__icon--leading'; + TRAILING_ICON: 'mdc-chip__icon--trailing'; + SELECTED: 'mdc-chip--selected'; + TEXT: 'mdc-chip__text'; +} diff --git a/types/material__chips/chip/foundation.d.ts b/types/material__chips/chip/foundation.d.ts new file mode 100644 index 0000000000..383cbb9089 --- /dev/null +++ b/types/material__chips/chip/foundation.d.ts @@ -0,0 +1,32 @@ +/** + * @license + * Copyright 2016 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import MDCFoundation from 'material__base/foundation'; +import MDCChipAdapter from './adapter'; +import { cssClasses, strings } from './constants'; + +export default class MDCChipFoundation extends MDCFoundation { + static readonly strings: strings; + + static readonly cssClasses: cssClasses; + + static readonly defaultAdapter: MDCChipAdapter; + + isSelected(): boolean; + + setSelected(selected: boolean): void; +} diff --git a/types/material__chips/chip/index.d.ts b/types/material__chips/chip/index.d.ts new file mode 100644 index 0000000000..a0320e69b3 --- /dev/null +++ b/types/material__chips/chip/index.d.ts @@ -0,0 +1,39 @@ +/** + * @license + * Copyright 2016 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import MDCComponent from 'material__base/component'; +import MDCChipFoundation from './foundation'; +import MDCChipAdapter from './adapter'; +import { MDCRipple } from 'material__ripple'; + +export { MDCChipFoundation, MDCChipAdapter }; + +export class MDCChip extends MDCComponent { + static attachTo(root: Element): MDCChip; + /** + * Returns true if the chip is selected. + */ + isSelected(): boolean; + + /** + * Destroys the chip and removes the root element from the DOM. + */ + remove(): void; + + readonly foundation: MDCChipFoundation; + + readonly ripple: MDCRipple; +} diff --git a/types/material__chips/index.d.ts b/types/material__chips/index.d.ts new file mode 100644 index 0000000000..935d897236 --- /dev/null +++ b/types/material__chips/index.d.ts @@ -0,0 +1,24 @@ +// Type definitions for Material Components Web 0.35 +// Project: https://material.io/components/ +// Definitions by: Brent Douglas , Collin Kostichuk +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +/** + * Copyright 2017 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { MDCChipFoundation, MDCChip, MDCChipAdapter } from './chip'; +import { MDCChipSetFoundation, MDCChipSet, MDCChipSetAdapter } from './chip-set'; +export { MDCChipFoundation, MDCChip, MDCChipAdapter, MDCChipSetFoundation, MDCChipSet, MDCChipSetAdapter }; diff --git a/types/material__chips/tsconfig.json b/types/material__chips/tsconfig.json new file mode 100644 index 0000000000..424cb5a424 --- /dev/null +++ b/types/material__chips/tsconfig.json @@ -0,0 +1,32 @@ +{ + "files": [ + "chip/adapter.d.ts", + "chip/constants.d.ts", + "chip/foundation.d.ts", + "chip/index.d.ts", + "chip-set/adapter.d.ts", + "chip-set/constants.d.ts", + "chip-set/foundation.d.ts", + "chip-set/index.d.ts", + "index.d.ts" + ], + "compilerOptions": { + "module": "commonjs", + "target": "es5", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + } +} \ No newline at end of file diff --git a/types/material__chips/tslint.json b/types/material__chips/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/material__chips/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/material__dialog/adapter.d.ts b/types/material__dialog/adapter.d.ts index fd6bc3cf9f..beaa1a2a3e 100644 --- a/types/material__dialog/adapter.d.ts +++ b/types/material__dialog/adapter.d.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -export interface MSDDialogAdapter { +export default interface MDCDialogAdapter { addClass(className: string): void; removeClass(className: string): void; @@ -50,6 +50,4 @@ export interface MSDDialogAdapter { untrapFocusOnSurface(): void; isDialog(el: Element): boolean; - - layoutFooterRipples(): void; } diff --git a/types/material__dialog/constants.d.ts b/types/material__dialog/constants.d.ts index a45628627c..297876ba7d 100644 --- a/types/material__dialog/constants.d.ts +++ b/types/material__dialog/constants.d.ts @@ -14,7 +14,7 @@ * limitations under the License. */ - import { MDCStrings } from 'material__base'; +import { MDCStrings } from 'material__base'; export interface cssClasses extends MDCStrings { ROOT: 'mdc-dialog'; diff --git a/types/material__dialog/foundation.d.ts b/types/material__dialog/foundation.d.ts index f28c541dd2..e17b8388e5 100644 --- a/types/material__dialog/foundation.d.ts +++ b/types/material__dialog/foundation.d.ts @@ -16,14 +16,14 @@ import { MDCFoundation } from 'material__base'; import { cssClasses, strings } from './constants'; -import { MSDDialogAdapter } from './adapter'; +import MDCDialogAdapter from './adapter'; -export class MDCDialogFoundation extends MDCFoundation { +export default class MDCDialogFoundation extends MDCFoundation { static readonly cssClasses: cssClasses; static readonly strings: strings; - static readonly defaultAdapter: MSDDialogAdapter; + static readonly defaultAdapter: MDCDialogAdapter; open(): void; @@ -35,5 +35,3 @@ export class MDCDialogFoundation extends MDCFoundation { cancel(shouldNotify: boolean): void; } - -export default MDCDialogFoundation; diff --git a/types/material__dialog/index.d.ts b/types/material__dialog/index.d.ts index 7d8ab69e30..491d2ad9fd 100644 --- a/types/material__dialog/index.d.ts +++ b/types/material__dialog/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Material Components Web 0.26 +// Type definitions for Material Components Web 0.35 // Project: https://material.io/components/ -// Definitions by: Brent Douglas +// Definitions by: Brent Douglas , Collin Kostichuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -21,26 +21,17 @@ */ import { MDCComponent } from 'material__base'; -import { MDCRipple } from 'material__ripple'; - import MDCDialogFoundation from './foundation'; -import { MSDDialogAdapter } from './adapter'; +import MDCDialogAdapter from './adapter'; import * as util from './util'; -export {MSDDialogAdapter, MDCDialogFoundation, util}; +export {MDCDialogAdapter, MDCDialogFoundation, util}; -export class MDCDialog extends MDCComponent { +export class MDCDialog extends MDCComponent { static attachTo(root: Element): MDCDialog; readonly open: boolean; - - initialize(): void; - - destroy(): void; - show(): void; close(): void; - - getDefaultFoundation(): MDCDialogFoundation; } diff --git a/types/material__drawer/index.d.ts b/types/material__drawer/index.d.ts index 379ed35599..63cd5d8fda 100644 --- a/types/material__drawer/index.d.ts +++ b/types/material__drawer/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Material Components Web 0.26 +// Type definitions for Material Components Web 0.35 // Project: https://material.io/components/ -// Definitions by: Brent Douglas +// Definitions by: Brent Douglas , Collin Kostichuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -21,7 +21,7 @@ */ import * as util from './util'; -export {MDCSlidableDrawerAdapter} from './slidable'; -export {MDCTemporaryDrawer, MDCTemporaryDrawerFoundation} from './temporary'; -export {MDCPersistentDrawer, MDCPersistentDrawerFoundation} from './persistent'; -export {util}; +export { MDCSlidableDrawerAdapter } from './slidable'; +export { MDCTemporaryDrawer, MDCTemporaryDrawerFoundation } from './temporary'; +export { MDCPersistentDrawer, MDCPersistentDrawerFoundation } from './persistent'; +export { util }; diff --git a/types/material__drawer/persistent/constants.d.ts b/types/material__drawer/persistent/constants.d.ts index 3d5f7c56ba..84dcce7f3f 100644 --- a/types/material__drawer/persistent/constants.d.ts +++ b/types/material__drawer/persistent/constants.d.ts @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -17,13 +17,13 @@ import { MDCStrings } from 'material__base'; export interface cssClasses extends MDCStrings { - ROOT: 'mdc-persistent-drawer'; - OPEN: 'mdc-persistent-drawer--open'; - ANIMATING: 'mdc-persistent-drawer--animating'; + ROOT: 'mdc-drawer--persistent'; + OPEN: 'mdc-drawer--open'; + ANIMATING: 'mdc-drawer--animating'; } export interface strings extends MDCStrings { - DRAWER_SELECTOR: '.mdc-persistent-drawer__drawer'; + DRAWER_SELECTOR: '.mdc-drawer--persistent .mdc-drawer__drawer'; FOCUSABLE_ELEMENTS: 'a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, [tabindex], [contenteditable]'; OPEN_EVENT: 'MDCPersistentDrawer:open'; CLOSE_EVENT: 'MDCPersistentDrawer:close'; diff --git a/types/material__drawer/persistent/foundation.d.ts b/types/material__drawer/persistent/foundation.d.ts index 7d4d53f884..ce596f3c23 100644 --- a/types/material__drawer/persistent/foundation.d.ts +++ b/types/material__drawer/persistent/foundation.d.ts @@ -17,12 +17,10 @@ import { MDCSlidableDrawerAdapter, MDCSlidableDrawerFoundation } from '../slidable'; import { cssClasses, strings } from './constants'; -export class MDCPersistentDrawerFoundation extends MDCSlidableDrawerFoundation { +export default class MDCPersistentDrawerFoundation extends MDCSlidableDrawerFoundation { static readonly cssClasses: cssClasses; static readonly strings: strings; static readonly defaultAdapter: MDCSlidableDrawerAdapter; } - -export default MDCPersistentDrawerFoundation; diff --git a/types/material__drawer/persistent/index.d.ts b/types/material__drawer/persistent/index.d.ts index 1c2286fd01..920258b2aa 100644 --- a/types/material__drawer/persistent/index.d.ts +++ b/types/material__drawer/persistent/index.d.ts @@ -15,7 +15,7 @@ */ import { MDCComponent } from 'material__base'; -import { MDCPersistentDrawerFoundation } from './foundation'; +import MDCPersistentDrawerFoundation from './foundation'; import { MDCSlidableDrawerAdapter } from '../slidable'; import * as util from '../util'; @@ -28,6 +28,4 @@ export class MDCPersistentDrawer extends MDCComponent { + static readonly cssClasses: cssClasses; + + static readonly defaultAdapter: MDCFloatingLabelAdapter; + + /** + * Returns the width of the label element. + */ + getWidth(): number; + + /** + * Styles the label to produce the label shake for errors. + */ + shake(shouldShake: boolean): void; + + /** + * Styles the label to float or dock. + */ + float(shouldFloat: boolean): void; +} diff --git a/types/material__floating-label/index.d.ts b/types/material__floating-label/index.d.ts new file mode 100644 index 0000000000..6b426a75d3 --- /dev/null +++ b/types/material__floating-label/index.d.ts @@ -0,0 +1,48 @@ +// Type definitions for Material Components Web 0.35 +// Project: https://material.io/components/ +// Definitions by: Brent Douglas , Collin Kostichuk +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +/** + * @license + * Copyright 2016 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import MDCComponent from 'material__base/component'; +import MDCFloatingLabelFoundation from './foundation'; +import MDCFloatingLabelAdapter from './adapter'; + +export { MDCFloatingLabelFoundation, MDCFloatingLabelAdapter }; + +export class MDCFloatingLabel extends MDCComponent { + static attachTo(root: Element): MDCFloatingLabel; + + /** + * Styles the label to produce the label shake for errors. + * @param shouldShake styles the label to shake by adding shake class + * if true, otherwise will stop shaking by removing shake class. + */ + shake(shouldShake: boolean): void; + + /** + * Styles label to float/dock. + * @param shouldFloat styles the label to float by adding float class + * if true, otherwise docks the label by removing the float class. + */ + float(shouldFloat: boolean): void; + + getWidth(): number; +} diff --git a/types/material__floating-label/tsconfig.json b/types/material__floating-label/tsconfig.json new file mode 100644 index 0000000000..2af99c6e5e --- /dev/null +++ b/types/material__floating-label/tsconfig.json @@ -0,0 +1,27 @@ +{ + "files": [ + "constants.d.ts", + "adapter.d.ts", + "index.d.ts", + "foundation.d.ts" + ], + "compilerOptions": { + "module": "commonjs", + "target": "es5", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + } +} \ No newline at end of file diff --git a/types/material__floating-label/tslint.json b/types/material__floating-label/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/material__floating-label/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/material__form-field/adapter.d.ts b/types/material__form-field/adapter.d.ts index 7033f363eb..722014eced 100644 --- a/types/material__form-field/adapter.d.ts +++ b/types/material__form-field/adapter.d.ts @@ -26,11 +26,9 @@ * Implement this adapter for your framework of choice to delegate updates to * the component in your framework of choice. See architecture documentation * for more details. - * https://github.com/material-components/material-components-web/blob/master/docs/architecture.md - * - * @record + * https://github.com/material-components/material-components-web/blob/master/docs/code/architecture.md */ -export class MDCFormFieldAdapter { +export default interface MDCFormFieldAdapter { registerInteractionHandler(type: string, handler: EventListener): void; deregisterInteractionHandler(type: string, handler: EventListener): void; @@ -39,5 +37,3 @@ export class MDCFormFieldAdapter { deactivateInputRipple(): void; } - -export default MDCFormFieldAdapter; diff --git a/types/material__form-field/constants.d.ts b/types/material__form-field/constants.d.ts index ba55acabcd..a40f571acc 100644 --- a/types/material__form-field/constants.d.ts +++ b/types/material__form-field/constants.d.ts @@ -18,7 +18,7 @@ import { MDCStrings } from 'material__base'; export interface cssClasses extends MDCStrings { - ROOT: 'mdc-form-field'; + ROOT: 'mdc-form-field'; } export interface strings extends MDCStrings { diff --git a/types/material__form-field/foundation.d.ts b/types/material__form-field/foundation.d.ts index 026beedfc2..aec781d9ab 100644 --- a/types/material__form-field/foundation.d.ts +++ b/types/material__form-field/foundation.d.ts @@ -19,12 +19,10 @@ import MDCFoundation from 'material__base/foundation'; import MDCFormFieldAdapter from './adapter'; import { cssClasses, strings } from './constants'; -export class MDCFormFieldFoundation extends MDCFoundation { +export default class MDCFormFieldFoundation extends MDCFoundation { static readonly cssClasses: cssClasses; static readonly strings: strings; static readonly defaultAdapter: MDCFormFieldAdapter; } - -export default MDCFormFieldFoundation; diff --git a/types/material__form-field/index.d.ts b/types/material__form-field/index.d.ts index 1fcc30b4c4..812df5c0c0 100644 --- a/types/material__form-field/index.d.ts +++ b/types/material__form-field/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Material Components Web 0.26 +// Type definitions for Material Components Web 0.35 // Project: https://material.io/components/ -// Definitions by: Brent Douglas +// Definitions by: Brent Douglas , Collin Kostichuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -32,6 +32,4 @@ export class MDCFormField extends MDCComponent { +export default class MDCGridListFoundation extends MDCFoundation { static readonly strings: strings; static readonly defaultAdapter: MDCGridListAdapter; alignCenter(): void; } - -export default MDCGridListFoundation; diff --git a/types/material__grid-list/index.d.ts b/types/material__grid-list/index.d.ts index 2a1e98d912..87ee0a138e 100644 --- a/types/material__grid-list/index.d.ts +++ b/types/material__grid-list/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Material Components Web 0.26 +// Type definitions for Material Components Web 0.35 // Project: https://material.io/components/ -// Definitions by: Brent Douglas +// Definitions by: Brent Douglas , Collin Kostichuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -21,13 +21,11 @@ */ import { MDCComponent } from 'material__base'; -import { MDCGridListAdapter } from './adapter'; +import MDCGridListAdapter from './adapter'; import MDCGridListFoundation from './foundation'; -export {MDCGridListAdapter, MDCGridListFoundation}; +export { MDCGridListAdapter, MDCGridListFoundation }; export class MDCGridList extends MDCComponent { - static attachTo(root: Element): MDCGridList; - - getDefaultFoundation(): MDCGridListFoundation; + static attachTo(root: Element): MDCGridList; } diff --git a/types/material__icon-toggle/adapter.d.ts b/types/material__icon-toggle/adapter.d.ts index 52481fe732..56ac8a32dc 100644 --- a/types/material__icon-toggle/adapter.d.ts +++ b/types/material__icon-toggle/adapter.d.ts @@ -29,33 +29,30 @@ * Implement this adapter for your framework of choice to delegate updates to * the component in your framework of choice. See architecture documentation * for more details. - * https://github.com/material-components/material-components-web/blob/master/docs/architecture.md - * - * @record + * https://github.com/material-components/material-components-web/blob/master/docs/code/architecture.md */ +export default interface MDCIconToggleAdapter { + addClass(className: string): void; -export class MDCIconToggleAdapter { - addClass(className: string): void; + removeClass(className: string): void; - removeClass(className: string): void; + registerInteractionHandler(type: string, handler: EventListener): void; - registerInteractionHandler(type: string, handler: EventListener): void; + deregisterInteractionHandler(type: string, handler: EventListener): void; - deregisterInteractionHandler(type: string, handler: EventListener): void; + setText(text: string): void; - setText(text: string): void; + getTabIndex(): number; - getTabIndex(): number; + setTabIndex(tabIndex: number): void; - setTabIndex(tabIndex: number): void; + getAttr(name: string): string; - getAttr(name: string): string; + setAttr(name: string, value: string): void; - setAttr(name: string, value: string): void; + rmAttr(name: string): void; - rmAttr(name: string): void; - - notifyChange(evtData: IconToggleEvent): void; + notifyChange(evtData: IconToggleEvent): void; } export interface IconToggleEvent { diff --git a/types/material__icon-toggle/foundation.d.ts b/types/material__icon-toggle/foundation.d.ts index 65d25c1307..cd8910713f 100644 --- a/types/material__icon-toggle/foundation.d.ts +++ b/types/material__icon-toggle/foundation.d.ts @@ -16,10 +16,10 @@ */ import MDCFoundation from 'material__base/foundation'; -import { MDCIconToggleAdapter, IconToggleEvent } from './adapter'; +import MDCIconToggleAdapter from './adapter'; import { cssClasses, strings } from './constants'; -export class MDCIconToggleFoundation extends MDCFoundation { +export default class MDCIconToggleFoundation extends MDCFoundation { static readonly cssClasses: cssClasses; static readonly strings: strings; @@ -38,27 +38,3 @@ export class MDCIconToggleFoundation extends MDCFoundation isKeyboardActivated(): boolean; } - -export interface KeyboardKey { - key: string; - keyCode: number; -} - -export function isSpace(keyboardKey: KeyboardKey): boolean; - -export class IconToggleState { - /** - * The aria-label value of the icon toggle, or undefined if there is no aria-label. - */ - label: string|undefined; - /** - * The text for the icon toggle, or undefined if there is no text. - */ - content: string|undefined; - /** - * The CSS class to add to the icon toggle, or undefined if there is no CSS class. - */ - cssClass: string|undefined; -} - -export default MDCIconToggleFoundation; diff --git a/types/material__icon-toggle/index.d.ts b/types/material__icon-toggle/index.d.ts index bfced0b532..beae5b83db 100644 --- a/types/material__icon-toggle/index.d.ts +++ b/types/material__icon-toggle/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Material Components Web 0.26 +// Type definitions for Material Components Web 0.35 // Project: https://material.io/components/ -// Definitions by: Brent Douglas +// Definitions by: Brent Douglas , Collin Kostichuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -23,18 +23,14 @@ import MDCComponent from 'material__base/component'; import MDCIconToggleFoundation from './foundation'; -import { MDCIconToggleAdapter } from './adapter'; -import { MDCRipple, MDCRippleFoundation } from 'material__ripple'; +import MDCIconToggleAdapter from './adapter'; +import { MDCRipple } from 'material__ripple'; export {MDCIconToggleAdapter, MDCIconToggleFoundation}; export class MDCIconToggle extends MDCComponent { static attachTo(root: Element): MDCIconToggle; - destroy(): void; - - getDefaultFoundation(): MDCIconToggleFoundation; - initialSyncWithDOM(): void; readonly ripple: MDCRipple; diff --git a/types/material__line-ripple/adapter.d.ts b/types/material__line-ripple/adapter.d.ts new file mode 100644 index 0000000000..93865a952a --- /dev/null +++ b/types/material__line-ripple/adapter.d.ts @@ -0,0 +1,53 @@ +/** + * @license + * Copyright 2018 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Adapter for MDC TextField Line Ripple. + * + * Defines the shape of the adapter expected by the foundation. Implement this + * adapter to integrate the line ripple into your framework. See + * https://github.com/material-components/material-components-web/blob/master/docs/authoring-components.md + * for more information. + */ + +export default interface MDCLineRippleAdapter { + /** + * Adds a class to the line ripple element. + */ + addClass(className: string): void; + + /** + * Removes a class from the line ripple element. + */ + removeClass(className: string): void; + + hasClass(className: string): boolean; + + /** + * Sets the style property with propertyName to value on the root element. + */ + setStyle(propertyName: string, value: string): void; + + /** + * Registers an event listener on the line ripple element for a given event. + */ + registerEventHandler(evtType: string, handler: EventListener): void; + + /** + * Deregisters an event listener on the line ripple element for a given event. + */ + deregisterEventHandler(evtType: string, handler: EventListener): void; +} diff --git a/types/material__line-ripple/constants.d.ts b/types/material__line-ripple/constants.d.ts new file mode 100644 index 0000000000..722570a2f5 --- /dev/null +++ b/types/material__line-ripple/constants.d.ts @@ -0,0 +1,23 @@ +/** + * @license + * Copyright 2018 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { MDCStrings } from 'material__base'; + +export interface cssClasses extends MDCStrings { + LINE_RIPPLE_ACTIVE: 'mdc-line-ripple--active'; + LINE_RIPPLE_DEACTIVATING: 'mdc-line-ripple--deactivating'; +} diff --git a/types/material__line-ripple/foundation.d.ts b/types/material__line-ripple/foundation.d.ts new file mode 100644 index 0000000000..2d525b7083 --- /dev/null +++ b/types/material__line-ripple/foundation.d.ts @@ -0,0 +1,45 @@ +/** + * @license + * Copyright 2018 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import MDCFoundation from 'material__base/foundation'; +import { cssClasses } from './constants'; +import MDCLineRippleAdapter from './adapter'; + +export default class MDCLineRippleFoundation extends MDCFoundation { + static readonly cssClasses: cssClasses; + + static readonly defaultAdapter: MDCLineRippleAdapter; + + /** + * Activates the line ripple + */ + activate(): void; + + /** + * Sets the center of the ripple animation to the given X coordinate. + */ + setRippleCenter(xCoordinate: number): void; + + /** + * Deactivates the line ripple + */ + deactivate(): void; + + /** + * Handles a transition end event + */ + handleTransitionEnd(evt: Event): void; +} diff --git a/types/material__line-ripple/index.d.ts b/types/material__line-ripple/index.d.ts new file mode 100644 index 0000000000..f76ed98d10 --- /dev/null +++ b/types/material__line-ripple/index.d.ts @@ -0,0 +1,47 @@ +// Type definitions for Material Components Web 0.35 +// Project: https://material.io/components/ +// Definitions by: Brent Douglas , Collin Kostichuk +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +/** + * @license + * Copyright 2018 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import MDCComponent from 'material__base/component'; +import MDCLineRippleFoundation from './foundation'; +import MDCLineRippleAdapter from './adapter'; + +export { MDCLineRippleFoundation, MDCLineRippleAdapter }; + +export class MDCLineRipple extends MDCComponent { + static attachTo(root: Element): MDCLineRipple; + + /** + * Activates the line ripple + */ + activate(): void; + + /** + * Deactivates the line ripple + */ + deactivate(): void; + + /** + * Sets the transform origin given a user's click location. The `rippleCenter` is the + * x-coordinate of the middle of the ripple. + */ + setRippleCenter(xCoordinate: number): void; +} diff --git a/types/material__line-ripple/tsconfig.json b/types/material__line-ripple/tsconfig.json new file mode 100644 index 0000000000..2af99c6e5e --- /dev/null +++ b/types/material__line-ripple/tsconfig.json @@ -0,0 +1,27 @@ +{ + "files": [ + "constants.d.ts", + "adapter.d.ts", + "index.d.ts", + "foundation.d.ts" + ], + "compilerOptions": { + "module": "commonjs", + "target": "es5", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + } +} \ No newline at end of file diff --git a/types/material__line-ripple/tslint.json b/types/material__line-ripple/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/material__line-ripple/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/material__linear-progress/adapter.d.ts b/types/material__linear-progress/adapter.d.ts index 92afccc19d..a8dd2dc163 100644 --- a/types/material__linear-progress/adapter.d.ts +++ b/types/material__linear-progress/adapter.d.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -export interface MDCLinearProgressAdapter { +export default interface MDCLinearProgressAdapter { addClass(className: string): void; getPrimaryBar(): Element; diff --git a/types/material__linear-progress/foundation.d.ts b/types/material__linear-progress/foundation.d.ts index 4abd553a09..5d67b121c7 100644 --- a/types/material__linear-progress/foundation.d.ts +++ b/types/material__linear-progress/foundation.d.ts @@ -14,12 +14,11 @@ * limitations under the License. */ -import { MDCFoundation } from 'material__base'; -import { transformStyleProperties } from 'material__animation'; -import { MDCLinearProgressAdapter } from './adapter'; +import MDCFoundation from 'material__base/foundation'; +import MDCLinearProgressAdapter from './adapter'; import { cssClasses, strings } from './constants'; -export class MDCLinearProgressFoundation extends MDCFoundation { +export default class MDCLinearProgressFoundation extends MDCFoundation { static readonly cssClasses: cssClasses; static readonly strings: strings; diff --git a/types/material__linear-progress/index.d.ts b/types/material__linear-progress/index.d.ts index 765d8cb368..4161a165f8 100644 --- a/types/material__linear-progress/index.d.ts +++ b/types/material__linear-progress/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Material Components Web 0.26 +// Type definitions for Material Components Web 0.35 // Project: https://material.io/components/ -// Definitions by: Brent Douglas +// Definitions by: Brent Douglas , Collin Kostichuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -21,10 +21,10 @@ */ import { MDCComponent } from 'material__base'; -import { MDCLinearProgressAdapter } from './adapter'; -import { MDCLinearProgressFoundation } from './foundation'; +import MDCLinearProgressAdapter from './adapter'; +import MDCLinearProgressFoundation from './foundation'; -export {MDCLinearProgressAdapter, MDCLinearProgressFoundation}; +export { MDCLinearProgressAdapter, MDCLinearProgressFoundation }; export class MDCLinearProgress extends MDCComponent { static attachTo(root: Element): MDCLinearProgress; @@ -40,6 +40,4 @@ export class MDCLinearProgress extends MDCComponent { + static readonly cssClasses: cssClasses; + + static readonly strings: strings; + + static readonly numbers: numbers; + + static readonly Corner: Corner; + + static readonly defaultAdapter: MDCMenuAdapter; + + /** + * @param corner Default anchor corner alignment of top-left menu corner. + */ + setAnchorCorner(corner: Corner): void; + + /** + * @param margin 4-plet of margins from anchor. + */ + setAnchorMargin(margin: AnchorMargin): void; + + setRememberSelection(rememberSelection: boolean): void; + + setQuickOpen(quickOpen: boolean): void; + + open({focusIndex}?: { + focusIndex?: null; + }): void; + + close(evt?: Event): void; + + isOpen(): boolean; + + getSelectedIndex(): number; + + /** + * @param index Index of the item to set as selected. + */ + setSelectedIndex(index: number): void; +} diff --git a/types/material__menu/index.d.ts b/types/material__menu/index.d.ts index af9360d1a8..3c50c13690 100644 --- a/types/material__menu/index.d.ts +++ b/types/material__menu/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Material Components Web 0.26 +// Type definitions for Material Components Web 0.35 // Project: https://material.io/components/ -// Definitions by: Brent Douglas +// Definitions by: Brent Douglas , Collin Kostichuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -20,7 +20,44 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import MDCComponent from 'material__base/component'; +import MDCMenuFoundation, { AnchorMargin } from './foundation'; +import MDCMenuAdapter from './adapter'; +import { Corner, CornerBit } from './constants'; -import * as util from './util'; -import { MDCSimpleMenu, MDCSimpleMenuAdapter, MDCSimpleMenuFoundation } from './simple/index'; -export { MDCSimpleMenu, MDCSimpleMenuAdapter, MDCSimpleMenuFoundation, util }; +export { MDCMenuFoundation, MDCMenuAdapter, AnchorMargin, Corner, CornerBit }; + +export class MDCMenu extends MDCComponent { + static attachTo(root: Element): MDCMenu; + + open: boolean; + + show(options?: { focusIndex?: number | null; }): void; + + hide(): void; + + /** + * @param corner Default anchor corner alignment of top-left menu corner. + */ + setAnchorCorner(corner: Corner): void; + + setAnchorMargin(margin: AnchorMargin): void; + + /** + * Return the items within the menu. Note that this only contains the set of elements within + * the items container that are proper list items, and not supplemental / presentational DOM + * elements. + */ + readonly items: Element[]; + + /** + * Return the item within the menu that is selected. + */ + getOptionByIndex(index: number): Element | null; + + selectedItemIndex: number; + + rememberSelection: boolean; + + quickOpen: boolean; +} diff --git a/types/material__menu/simple/constants.d.ts b/types/material__menu/simple/constants.d.ts deleted file mode 100644 index 58e2f16614..0000000000 --- a/types/material__menu/simple/constants.d.ts +++ /dev/null @@ -1,52 +0,0 @@ -/** - * @license - * Copyright 2016 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { MDCStrings, MDCNumbers } from 'material__base'; - -export interface cssClasses extends MDCStrings { - ROOT: 'mdc-simple-menu'; - OPEN: 'mdc-simple-menu--open'; - ANIMATING: 'mdc-simple-menu--animating'; - TOP_RIGHT: 'mdc-simple-menu--open-from-top-right'; - BOTTOM_LEFT: 'mdc-simple-menu--open-from-bottom-left'; - BOTTOM_RIGHT: 'mdc-simple-menu--open-from-bottom-right'; -} - -export interface strings extends MDCStrings { - ITEMS_SELECTOR: '.mdc-simple-menu__items'; - SELECTED_EVENT: 'MDCSimpleMenu:selected'; - CANCEL_EVENT: 'MDCSimpleMenu:cancel'; - ARIA_DISABLED_ATTR: 'aria-disabled'; -} - -export interface numbers extends MDCNumbers { - // Amount of time to wait before triggering a selected event on the menu. Note that this time - // will most likely be bumped up once interactive lists are supported to allow for the ripple to - // animate before closing the menu - SELECTED_TRIGGER_DELAY: 50; - // Total duration of the menu animation. - TRANSITION_DURATION_MS: 300; - // The menu starts its open animation with the X axis at this time value (0 - 1). - TRANSITION_SCALE_ADJUSTMENT_X: 0.5; - // The time value the menu waits until the animation starts on the Y axis (0 - 1). - TRANSITION_SCALE_ADJUSTMENT_Y: 0.2; - // The cubic bezier control points for the animation (cubic-bezier(0, 0, 0.2, 1)). - TRANSITION_X1: 0; - TRANSITION_Y1: 0; - TRANSITION_X2: 0.2; - TRANSITION_Y2: 1; -} diff --git a/types/material__menu/simple/index.d.ts b/types/material__menu/simple/index.d.ts deleted file mode 100644 index c2315810ba..0000000000 --- a/types/material__menu/simple/index.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -/** - * @license - * Copyright 2016 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import MDCComponent from 'material__base/component'; -import MDCSimpleMenuFoundation from './foundation'; -import MDCSimpleMenuAdapter from './adapter'; -import { getTransformPropertyName } from '../util'; - -export {MDCSimpleMenuAdapter, MDCSimpleMenuFoundation}; - -export class MDCSimpleMenu extends MDCComponent { - static attachTo(root: Element): MDCSimpleMenu; - - open: boolean; - - show(options?: {focusIndex?: number}): void; - - hide(): void; - - /** - * Return the items within the menu. Note that this only contains the set of elements within - * the items container that are proper list items, and not supplemental / presentational DOM - * elements. - */ - readonly items: Element[]; - - getDefaultFoundation(): MDCSimpleMenuFoundation; -} diff --git a/types/material__menu/tsconfig.json b/types/material__menu/tsconfig.json index 74016e9380..b257a72f11 100644 --- a/types/material__menu/tsconfig.json +++ b/types/material__menu/tsconfig.json @@ -1,11 +1,10 @@ { "files": [ - "simple/constants.d.ts", - "simple/adapter.d.ts", - "simple/index.d.ts", - "simple/foundation.d.ts", - "util.d.ts", - "index.d.ts" + "constants.d.ts", + "adapter.d.ts", + "index.d.ts", + "foundation.d.ts", + "util.d.ts" ], "compilerOptions": { "module": "commonjs", diff --git a/types/material__notched-outline/adapter.d.ts b/types/material__notched-outline/adapter.d.ts new file mode 100644 index 0000000000..8e44143e25 --- /dev/null +++ b/types/material__notched-outline/adapter.d.ts @@ -0,0 +1,57 @@ +/** + * @license + * Copyright 2017 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Adapter for MDC Notched Outline. + * + * Defines the shape of the adapter expected by the foundation. Implement this + * adapter to integrate the Notched Outline into your framework. See + * https://github.com/material-components/material-components-web/blob/master/docs/authoring-components.md + * for more information. + */ + +export default interface MDCNotchedOutlineAdapter { + /** + * Returns the width of the root element. + */ + getWidth(): number; + + /** + * Returns the height of the root element. + */ + getHeight(): number; + + /** + * Adds a class to the root element. + */ + addClass(className: string): void; + + /** + * Removes a class from the root element. + */ + removeClass(className: string): void; + + /** + * Sets the "d" attribute of the outline element's SVG path. + */ + setOutlinePathAttr(value: string): void; + + /** + * Returns the idle outline element's computed style value of the given css property `propertyName`. + * We achieve this via `getComputedStyle(...).getPropertyValue(propertyName)`. + */ + getIdleOutlineStyleValue(propertyName: string): string; +} diff --git a/types/material__notched-outline/constants.d.ts b/types/material__notched-outline/constants.d.ts new file mode 100644 index 0000000000..2a18a77b8b --- /dev/null +++ b/types/material__notched-outline/constants.d.ts @@ -0,0 +1,27 @@ +/** + * @license + * Copyright 2018 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { MDCStrings } from 'material__base'; + +export interface strings extends MDCStrings { + PATH_SELECTOR: '.mdc-notched-outline__path'; + IDLE_OUTLINE_SELECTOR: '.mdc-notched-outline__idle'; +} + +export interface cssClasses extends MDCStrings { + OUTLINE_NOTCHED: 'mdc-notched-outline--notched'; +} diff --git a/types/material__notched-outline/foundation.d.ts b/types/material__notched-outline/foundation.d.ts new file mode 100644 index 0000000000..30234d65f9 --- /dev/null +++ b/types/material__notched-outline/foundation.d.ts @@ -0,0 +1,38 @@ +/** + * @license + * Copyright 2017 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import MDCFoundation from 'material__base/foundation'; +import { cssClasses, strings } from './constants'; +import MDCNotchedOutlineAdapter from './adapter'; + +export default class MDCNotchedOutlineFoundation extends MDCFoundation { + static readonly strings: strings; + + static readonly cssClasses: cssClasses; + + static readonly defaultAdapter: MDCNotchedOutlineAdapter; + + /** + * Adds the outline notched selector and updates the notch width + * calculated based off of notchWidth and isRtl. + */ + notch(notchWidth: number, isRtl?: boolean): void; + + /** + * Removes notched outline selector to close the notch in the outline. + */ + closeNotch(): void; +} diff --git a/types/material__notched-outline/index.d.ts b/types/material__notched-outline/index.d.ts new file mode 100644 index 0000000000..d22a9a6918 --- /dev/null +++ b/types/material__notched-outline/index.d.ts @@ -0,0 +1,41 @@ +// Type definitions for Material Components Web 0.35 +// Project: https://material.io/components/ +// Definitions by: Brent Douglas , Collin Kostichuk +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +/** + * @license + * Copyright 2017 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import MDCComponent from 'material__base/component'; +import MDCNotchedOutlineFoundation from './foundation'; +import MDCNotchedOutlineAdapter from './adapter'; + +export { MDCNotchedOutlineFoundation, MDCNotchedOutlineAdapter }; + +export class MDCNotchedOutline extends MDCComponent { + static attachTo(root: Element): MDCNotchedOutline; + + /** + * Updates outline selectors and SVG path to open notch. + */ + notch(notchWidth: number, isRtl?: boolean): void; + + /** + * Updates the outline selectors to close notch and return it to idle state. + */ + closeNotch(): void; +} diff --git a/types/material__notched-outline/tsconfig.json b/types/material__notched-outline/tsconfig.json new file mode 100644 index 0000000000..2af99c6e5e --- /dev/null +++ b/types/material__notched-outline/tsconfig.json @@ -0,0 +1,27 @@ +{ + "files": [ + "constants.d.ts", + "adapter.d.ts", + "index.d.ts", + "foundation.d.ts" + ], + "compilerOptions": { + "module": "commonjs", + "target": "es5", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + } +} \ No newline at end of file diff --git a/types/material__notched-outline/tslint.json b/types/material__notched-outline/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/material__notched-outline/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/material__radio/adapter.d.ts b/types/material__radio/adapter.d.ts index 91035ea177..1238d2bae4 100644 --- a/types/material__radio/adapter.d.ts +++ b/types/material__radio/adapter.d.ts @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -27,14 +27,12 @@ import { MDCSelectionControlState } from 'material__selection-control'; * Implement this adapter for your framework of choice to delegate updates to * the component in your framework of choice. See architecture documentation * for more details. - * https://github.com/material-components/material-components-web/blob/master/docs/architecture.md + * https://github.com/material-components/material-components-web/blob/master/docs/code/architecture.md */ -export class MDCRadioAdapter { +export default interface MDCRadioAdapter { addClass(className: string): void; removeClass(className: string): void; getNativeControl(): MDCSelectionControlState; } - -export default MDCRadioAdapter; diff --git a/types/material__radio/foundation.d.ts b/types/material__radio/foundation.d.ts index f27bd30f1b..bb0720e831 100644 --- a/types/material__radio/foundation.d.ts +++ b/types/material__radio/foundation.d.ts @@ -15,28 +15,25 @@ */ import MDCFoundation from 'material__base/foundation'; -import { MDCSelectionControlState } from 'material__selection-control'; import MDCRadioAdapter from './adapter'; import { cssClasses, strings } from './constants'; -export class MDCRadioFoundation extends MDCFoundation { - static readonly cssClasses: cssClasses; +export default class MDCRadioFoundation extends MDCFoundation { + static readonly cssClasses: cssClasses; - static readonly strings: strings; + static readonly strings: strings; - static readonly defaultAdapter: MDCRadioAdapter; + static readonly defaultAdapter: MDCRadioAdapter; - isChecked(): boolean; + isChecked(): boolean; - setChecked(checked: boolean): void; + setChecked(checked: boolean): void; - isDisabled(): boolean; + isDisabled(): boolean; - setDisabled(disabled: boolean): void; + setDisabled(disabled: boolean): void; - getValue(): string; + getValue(): string; - setValue(value?: string): void; + setValue(value?: string): void; } - -export default MDCRadioFoundation; diff --git a/types/material__radio/index.d.ts b/types/material__radio/index.d.ts index e9001d9d84..d73206b791 100644 --- a/types/material__radio/index.d.ts +++ b/types/material__radio/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Material Components Web 0.26 +// Type definitions for Material Components Web 0.35 // Project: https://material.io/components/ -// Definitions by: Brent Douglas +// Definitions by: Brent Douglas , Collin Kostichuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -25,7 +25,7 @@ import MDCComponent from 'material__base/component'; import { MDCSelectionControl } from 'material__selection-control'; import MDCRadioAdapter from './adapter'; import MDCRadioFoundation from './foundation'; -import { MDCRipple, MDCRippleFoundation } from 'material__ripple'; +import { MDCRipple } from 'material__ripple'; export {MDCRadioAdapter, MDCRadioFoundation}; @@ -39,8 +39,4 @@ export class MDCRadio extends MDCComponent value: string; readonly ripple: MDCRipple; - - destroy(): void; - - getDefaultFoundation(): MDCRadioFoundation; } diff --git a/types/material__ripple/adapter.d.ts b/types/material__ripple/adapter.d.ts index 0d2d319aab..ff5ab11231 100644 --- a/types/material__ripple/adapter.d.ts +++ b/types/material__ripple/adapter.d.ts @@ -32,11 +32,9 @@ * Implement this adapter for your framework of choice to delegate updates to * the component in your framework of choice. See architecture documentation * for more details. - * https://github.com/material-components/material-components-web/blob/master/docs/architecture.md - * - * @record + * https://github.com/material-components/material-components-web/blob/master/docs/code/architecture.md */ -export default class MDCRippleAdapter { +export default interface MDCRippleAdapter { browserSupportsCssVars(): boolean; isUnbounded(): boolean; @@ -49,17 +47,23 @@ export default class MDCRippleAdapter { removeClass(className: string): void; + containsEventTarget(target: EventTarget): void; + registerInteractionHandler(evtType: string, handler: EventListener): void; deregisterInteractionHandler(evtType: string, handler: EventListener): void; + registerDocumentInteractionHandler(evtType: string, handler: EventListener): void; + + deregisterDocumentInteractionHandler(evtType: string, handler: EventListener): void; + registerResizeHandler(handler: EventListener): void; deregisterResizeHandler(handler: EventListener): void; - updateCssVariable(varName: string, value: number|string): void; + updateCssVariable(varName: string, value: number | string | null): void; computeBoundingRect(): ClientRect; - getWindowPageOffset(): {x: number, y: number}; + getWindowPageOffset(): { x: number; y: number; }; } diff --git a/types/material__ripple/constants.d.ts b/types/material__ripple/constants.d.ts index 285d5f3f2c..b1dd4c12b4 100644 --- a/types/material__ripple/constants.d.ts +++ b/types/material__ripple/constants.d.ts @@ -24,15 +24,14 @@ export interface cssClasses extends MDCStrings { ROOT: 'mdc-ripple-upgraded'; UNBOUNDED: 'mdc-ripple-upgraded--unbounded'; BG_FOCUSED: 'mdc-ripple-upgraded--background-focused'; - BG_ACTIVE_FILL: 'mdc-ripple-upgraded--background-active-fill'; FG_ACTIVATION: 'mdc-ripple-upgraded--foreground-activation'; FG_DEACTIVATION: 'mdc-ripple-upgraded--foreground-deactivation'; } export interface strings extends MDCStrings { - VAR_FG_SIZE: '--mdc-ripple-fg-size'; VAR_LEFT: '--mdc-ripple-left'; VAR_TOP: '--mdc-ripple-top'; + VAR_FG_SIZE: '--mdc-ripple-fg-size'; VAR_FG_SCALE: '--mdc-ripple-fg-scale'; VAR_FG_TRANSLATE_START: '--mdc-ripple-fg-translate-start'; VAR_FG_TRANSLATE_END: '--mdc-ripple-fg-translate-end'; @@ -41,6 +40,7 @@ export interface strings extends MDCStrings { export interface numbers extends MDCNumbers { PADDING: 10; INITIAL_ORIGIN_SCALE: 0.6; - DEACTIVATION_TIMEOUT_MS: 300; - FG_DEACTIVATION_MS: 83; + DEACTIVATION_TIMEOUT_MS: 225; // Corresponds to $mdc-ripple-translate-duration (i.e. activation animation duration) + FG_DEACTIVATION_MS: 150; // Corresponds to $mdc-ripple-fade-out-duration (i.e. deactivation animation duration) + TAP_DELAY_MS: 300; // Delay between touch and simulated mouse events on touch devices } diff --git a/types/material__ripple/foundation.d.ts b/types/material__ripple/foundation.d.ts index b67632e441..fe6d33403a 100644 --- a/types/material__ripple/foundation.d.ts +++ b/types/material__ripple/foundation.d.ts @@ -18,39 +18,6 @@ import MDCFoundation from 'material__base/foundation'; import MDCRippleAdapter from './adapter'; import { cssClasses, strings, numbers } from './constants'; -import { getNormalizedEventCoords } from './util'; - -export interface ActivationStateType { - isActivated: boolean|undefined; - hasDeactivationUXRun: boolean|undefined; - wasActivatedByPointer: boolean|undefined; - wasElementMadeActive: boolean|undefined; - activationStartTime: number|undefined; - activationEvent: Event; - isProgrammatic: boolean|undefined; -} - -export interface ListenerInfoType { - activate: string|undefined; - deactivate: string|undefined; - focus: string|undefined; - blur: string|undefined; -} - -export interface ListenersType { - activate(e: Event): void; - - deactivate(e: Event): void; - - focus(): void; - - blur(): void; -} - -export interface PointType { - x: number; - y: number; -} export default class MDCRippleFoundation extends MDCFoundation { static readonly cssClasses: cssClasses; @@ -66,4 +33,6 @@ export default class MDCRippleFoundation extends MDCFoundation deactivate(event?: Event): void; layout(): void; + + setUnbounded(unbounded: boolean): void; } diff --git a/types/material__ripple/index.d.ts b/types/material__ripple/index.d.ts index 2f8379ac84..aaef1a6aff 100644 --- a/types/material__ripple/index.d.ts +++ b/types/material__ripple/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Material Components Web 0.26 +// Type definitions for Material Components Web 0.35 // Project: https://material.io/components/ -// Definitions by: Brent Douglas +// Definitions by: Brent Douglas , Collin Kostichuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -29,21 +29,19 @@ import * as util from './util'; export {MDCRippleAdapter, MDCRippleFoundation, util}; export class MDCRipple extends MDCComponent { - static attachTo(root: Element, bound?: {isUnbounded: boolean|undefined}): MDCRipple; + static attachTo(root: Element, options?: { isUnbounded?: boolean; }): MDCRipple; - static createAdapter(instance: RippleCapableSurface): MDCRippleAdapter; + static createAdapter(instance: RippleCapableSurface): MDCRippleAdapter; - unbounded: boolean; + unbounded: boolean; - activate(): void; + activate(): void; - deactivate(): void; + deactivate(): void; - layout(): void; + layout(): void; - getDefaultFoundation(): MDCRippleFoundation; - - initialSyncWithDOM(): void; + initialSyncWithDOM(): void; } /** @@ -57,10 +55,10 @@ export class RippleCapableSurface { /** * Whether or not the ripple bleeds out of the bounds of the element. */ - unbounded: boolean|undefined; + unbounded: boolean | undefined; /** * Whether or not the ripple is attached to a disabled component. */ - disabled: boolean|undefined; + disabled: boolean | undefined; } diff --git a/types/material__select/adapter.d.ts b/types/material__select/adapter.d.ts index 2828b77361..b3b425e7a3 100644 --- a/types/material__select/adapter.d.ts +++ b/types/material__select/adapter.d.ts @@ -14,68 +14,28 @@ * limitations under the License. */ -export interface MDCSelectAdapter { +export default interface MDCSelectAdapter { addClass(className: string): void; removeClass(className: string): void; - addBodyClass(className: string): void; + floatLabel(value: boolean): void; - removeBodyClass(className: string): void; + activateBottomLine(): void; - setAttr(attr: string, value: string): void; - - rmAttr(attr: string): void; - - computeBoundingRect(): {left: number, top: number}; + deactivateBottomLine(): void; registerInteractionHandler(type: string, handler: EventListener): void; deregisterInteractionHandler(type: string, handler: EventListener): void; - focus(): void; + getSelectedIndex(): number; - makeTabbable(): void; + setSelectedIndex(index: number): void; - makeUntabbable(): void; + setDisabled(disabled: boolean): void; - getComputedStyleValue(propertyName: string): string; + getValue(): string; - setStyle(propertyName: string, value: string): void; - - create2dRenderingContext(): {font: string, measureText: (val: string) => {width: number}}; - - setMenuElStyle(propertyName: string, value: string): void; - - setMenuElAttr(attr: string, value: string): void; - - rmMenuElAttr(attr: string): void; - - getMenuElOffsetHeight(): number; - - openMenu(focusIndex: number): void; - - isMenuOpen(): boolean; - - setSelectedTextContent(textContent: string): void; - - getNumberOfOptions(): number; - - getTextForOptionAtIndex(index: number): string; - - getValueForOptionAtIndex(index: number): string; - - setAttrForOptionAtIndex(index: number, attr: string, value: string): void; - - rmAttrForOptionAtIndex(index: number, attr: string): void; - - getOffsetTopForOptionAtIndex(index: number): number; - - registerMenuInteractionHandler(type: string, handler: EventListener): void; - - deregisterMenuInteractionHandler(type: string, handler: EventListener): void; - - notifyChange(): void; - - getWindowInnerHeight(): number; + setValue(value: string): void; } diff --git a/types/material__select/constants.d.ts b/types/material__select/constants.d.ts index 1566d71322..f9a93da7b1 100644 --- a/types/material__select/constants.d.ts +++ b/types/material__select/constants.d.ts @@ -17,12 +17,14 @@ import { MDCStrings } from 'material__base'; export interface cssClasses extends MDCStrings { - ROOT: 'mdc-select'; - OPEN: 'mdc-select--open'; + BOX: 'mdc-select--box'; DISABLED: 'mdc-select--disabled'; - SCROLL_LOCK: 'mdc-select-scroll-lock'; + ROOT: 'mdc-select'; } export interface strings extends MDCStrings { CHANGE_EVENT: 'MDCSelect:change'; + LINE_RIPPLE_SELECTOR: '.mdc-line-ripple'; + LABEL_SELECTOR: '.mdc-floating-label'; + NATIVE_CONTROL_SELECTOR: '.mdc-select__native-control'; } diff --git a/types/material__select/foundation.d.ts b/types/material__select/foundation.d.ts index 6f66f79b5f..641c2a301a 100644 --- a/types/material__select/foundation.d.ts +++ b/types/material__select/foundation.d.ts @@ -16,25 +16,18 @@ import { MDCFoundation } from 'material__base'; import { cssClasses, strings } from './constants'; -import { MDCSimpleMenuFoundation } from 'material__menu'; -import { MDCSelectAdapter } from './adapter'; +import MDCSelectAdapter from './adapter'; export default class MDCSelectFoundation extends MDCFoundation { - static readonly cssClasses: cssClasses; + static readonly cssClasses: cssClasses; - static readonly strings: strings; + static readonly strings: strings; - static readonly defaultAdapter: MDCSelectAdapter; + static readonly defaultAdapter: MDCSelectAdapter; - getValue(): string; + setSelectedIndex(index: number): void; - getSelectedIndex(): number; + setValue(value: string): void; - setSelectedIndex(index: number): void; - - isDisabled(): boolean; - - setDisabled(disabled: boolean): void; - - resize(): void; + setDisabled(disabled: boolean): void; } diff --git a/types/material__select/index.d.ts b/types/material__select/index.d.ts index 78746a97d1..a487461ae7 100644 --- a/types/material__select/index.d.ts +++ b/types/material__select/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Material Components Web 0.26 +// Type definitions for Material Components Web 0.35 // Project: https://material.io/components/ -// Definitions by: Brent Douglas +// Definitions by: Brent Douglas , Collin Kostichuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -21,33 +21,23 @@ */ import { MDCComponent } from 'material__base'; -import { MDCSimpleMenu } from 'material__menu'; - -import { MDCSelectAdapter } from './adapter'; import MDCSelectFoundation from './foundation'; +import MDCSelectAdapter from './adapter'; +import { MDCFloatingLabel } from 'material__floating-label'; +import { MDCLineRipple } from 'material__line-ripple'; export {MDCSelectAdapter, MDCSelectFoundation}; export class MDCSelect extends MDCComponent { static attachTo(root: Element): MDCSelect; - readonly value: string; - - readonly options: Element[]; - - readonly selectedOptions: NodeListOf; + value: string; selectedIndex: number; disabled: boolean; - item(index: number): Element|null; - - nameditem(key: string): Element|null; - - initialize(menuFactory?: (el: Element) => MDCSimpleMenu): void; - - getDefaultFoundation(): MDCSelectFoundation; + initialize(labelFactory?: (el: Element) => MDCFloatingLabel, lineRippleFactory?: (el: Element) => MDCLineRipple): void; initialSyncWithDOM(): void; } diff --git a/types/material__selection-control/index.d.ts b/types/material__selection-control/index.d.ts index 9c7f90c3fd..b5ce84d6ce 100644 --- a/types/material__selection-control/index.d.ts +++ b/types/material__selection-control/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Material Components Web 0.26 +// Type definitions for Material Components Web 0.35 // Project: https://material.io/components/ -// Definitions by: Brent Douglas +// Definitions by: Brent Douglas , Collin Kostichuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 diff --git a/types/material__slider/adapter.d.ts b/types/material__slider/adapter.d.ts index 940ae04d76..b558c20799 100644 --- a/types/material__slider/adapter.d.ts +++ b/types/material__slider/adapter.d.ts @@ -14,14 +14,14 @@ * limitations under the License. */ -export interface MDCSliderAdapter { +export default interface MDCSliderAdapter { hasClass(className: string): boolean; addClass(className: string): void; removeClass(className: string): void; - getAttribute(name: string): string|null; + getAttribute(name: string): string | null; setAttribute(name: string, value: string): void; diff --git a/types/material__slider/foundation.d.ts b/types/material__slider/foundation.d.ts index 5da6942f49..97abb60e28 100644 --- a/types/material__slider/foundation.d.ts +++ b/types/material__slider/foundation.d.ts @@ -16,9 +16,8 @@ import { cssClasses, strings, numbers } from './constants'; -import { getCorrectEventName, getCorrectPropertyName } from 'material__animation'; import MDCFoundation from 'material__base/foundation'; -import { MDCSliderAdapter } from './adapter'; +import MDCSliderAdapter from './adapter'; export default class MDCSliderFoundation extends MDCFoundation { static readonly cssClasses: cssClasses; diff --git a/types/material__slider/index.d.ts b/types/material__slider/index.d.ts index 0d0e472775..1a1c02d86a 100644 --- a/types/material__slider/index.d.ts +++ b/types/material__slider/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Material Components Web 0.26 +// Type definitions for Material Components Web 0.35 // Project: https://material.io/components/ -// Definitions by: Brent Douglas +// Definitions by: Brent Douglas , Collin Kostichuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -23,32 +23,30 @@ import MDCComponent from 'material__base/component'; import MDCSliderFoundation from './foundation'; -import { MDCSliderAdapter } from './adapter'; +import MDCSliderAdapter from './adapter'; export {MDCSliderAdapter, MDCSliderFoundation}; export class MDCSlider extends MDCComponent { - static attachTo(root: Element): MDCSlider; + static attachTo(root: Element): MDCSlider; - value: number; + value: number; - min: number; + min: number; - max: number; + max: number; - step: number; + step: number; - disabled: boolean; + disabled: boolean; - initialize(): void; + initialize(): void; - getDefaultFoundation(): MDCSliderFoundation; + initialSyncWithDOM(): void; - initialSyncWithDOM(): void; + layout(): void; - layout(): void; + stepUp(amount?: number): void; - stepUp(amount?: number): void; - - stepDown(amount?: number): void; + stepDown(amount?: number): void; } diff --git a/types/material__snackbar/adapter.d.ts b/types/material__snackbar/adapter.d.ts index 412329bd97..12ac56c6f7 100644 --- a/types/material__snackbar/adapter.d.ts +++ b/types/material__snackbar/adapter.d.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -export interface MDCSnackbarAdapter { +export default interface MDCSnackbarAdapter { addClass(className: string): void; removeClass(className: string): void; setAriaHidden(): void; @@ -35,4 +35,6 @@ export interface MDCSnackbarAdapter { deregisterActionClickHandler(handler: EventListener): void; registerTransitionEndHandler(handler: EventListener): void; deregisterTransitionEndHandler(handler: EventListener): void; + notifyShow(): void; + notifyHide(): void; } diff --git a/types/material__snackbar/constants.d.ts b/types/material__snackbar/constants.d.ts index 7bf6758a0a..7c5cf27999 100644 --- a/types/material__snackbar/constants.d.ts +++ b/types/material__snackbar/constants.d.ts @@ -30,6 +30,8 @@ export interface strings extends MDCStrings { TEXT_SELECTOR: '.mdc-snackbar__text'; ACTION_WRAPPER_SELECTOR: '.mdc-snackbar__action-wrapper'; ACTION_BUTTON_SELECTOR: '.mdc-snackbar__action-button'; + SHOW_EVENT: 'MDCSnackbar:show'; + HIDE_EVENT: 'MDCSnackbar:hide'; } export interface numbers extends MDCNumbers { diff --git a/types/material__snackbar/foundation.d.ts b/types/material__snackbar/foundation.d.ts index 5c85ab5f85..a695a1a33e 100644 --- a/types/material__snackbar/foundation.d.ts +++ b/types/material__snackbar/foundation.d.ts @@ -14,9 +14,9 @@ * limitations under the License. */ -import { MDCFoundation } from 'material__base'; +import MDCFoundation from 'material__base/foundation'; import { cssClasses, strings, numbers } from './constants'; -import { MDCSnackbarAdapter } from './adapter'; +import MDCSnackbarAdapter from './adapter'; export interface MDCSnackbarData { message: string; @@ -27,18 +27,18 @@ export interface MDCSnackbarData { timeout?: number; } -export class MDCSnackbarFoundation extends MDCFoundation { - static readonly cssClasses: cssClasses; +export default class MDCSnackbarFoundation extends MDCFoundation { + static readonly cssClasses: cssClasses; - static readonly strings: strings; + static readonly strings: strings; - static readonly defaultAdapter: MDCSnackbarAdapter; + static readonly defaultAdapter: MDCSnackbarAdapter; - readonly active: boolean; + readonly active: boolean; - dismissesOnAction(): boolean; + dismissesOnAction(): boolean; - setDismissOnAction(dismissOnAction: boolean): void; + setDismissOnAction(dismissOnAction: boolean): void; - show(data: MDCSnackbarData): void; + show(data: MDCSnackbarData): void; } diff --git a/types/material__snackbar/index.d.ts b/types/material__snackbar/index.d.ts index 11ac69f573..da6ecd4ca2 100644 --- a/types/material__snackbar/index.d.ts +++ b/types/material__snackbar/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Material Components Web 0.26 +// Type definitions for Material Components Web 0.35 // Project: https://material.io/components/ -// Definitions by: Brent Douglas +// Definitions by: Brent Douglas , Collin Kostichuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -21,18 +21,15 @@ */ import { MDCComponent } from 'material__base'; -import { MDCSnackbarAdapter } from './adapter'; -import { MDCSnackbarFoundation, MDCSnackbarData } from './foundation'; -import { getCorrectEventName } from 'material__animation'; +import MDCSnackbarAdapter from './adapter'; +import MDCSnackbarFoundation, { MDCSnackbarData } from './foundation'; export {MDCSnackbarAdapter, MDCSnackbarFoundation}; export class MDCSnackbar extends MDCComponent { - static attachTo(root: Element): MDCSnackbar; + static attachTo(root: Element): MDCSnackbar; - show(data: MDCSnackbarData): void; + show(data: MDCSnackbarData): void; - getDefaultFoundation(): MDCSnackbarFoundation; - - dismissesOnAction: boolean; + dismissesOnAction: boolean; } diff --git a/types/material__textfield/bottom-line/adapter.d.ts b/types/material__tab/adapter.d.ts similarity index 58% rename from types/material__textfield/bottom-line/adapter.d.ts rename to types/material__tab/adapter.d.ts index 25b8de0477..90b89dca00 100644 --- a/types/material__textfield/bottom-line/adapter.d.ts +++ b/types/material__tab/adapter.d.ts @@ -1,6 +1,6 @@ /** * @license - * Copyright 2017 Google Inc. All Rights Reserved. + * Copyright 2018 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,47 +14,41 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - /** - * Adapter for MDC TextField Bottom Line. + * Adapter for MDC Tab. * * Defines the shape of the adapter expected by the foundation. Implement this - * adapter to integrate the TextField bottom line into your framework. See + * adapter to integrate the Tab into your framework. See * https://github.com/material-components/material-components-web/blob/master/docs/authoring-components.md - * for more information. - * - * @record */ -export default class MDCTextFieldBottomLineAdapter { +export default interface MDCTabAdapter { /** - * Adds a class to the bottom line element. - */ - addClass(className: string): void; - - /** - * Removes a class from the bottom line element. - */ - removeClass(className: string): void; - - /** - * Sets an attribute with a given value on the bottom line element. - */ - setAttr(attr: string, value: string): void; - - /** - * Registers an event listener on the bottom line element for a given event. + * Registers an event listener on the root element for a given event. */ registerEventHandler(evtType: string, handler: EventListener): void; /** - * Deregisters an event listener on the bottom line element for a given event. + * Deregisters an event listener on the root element for a given event. */ deregisterEventHandler(evtType: string, handler: EventListener): void; /** - * Emits a custom event "MDCTextFieldBottomLine:animation-end" denoting the - * bottom line has finished its animation; either the activate or - * deactivate animation + * Adds the given className to the root element. */ - notifyAnimationEnd(): void; + addClass(className: string): void; + + /** + * Removes the given className from the root element. + */ + removeClass(className: string): void; + + /** + * Returns whether the root element has the given className. + */ + hasClass(className: string): boolean; + + /** + * Sets the given attrName of the root element to the given value. + */ + setAttr(attr: string, value: string): void; } diff --git a/types/material__tab/constants.d.ts b/types/material__tab/constants.d.ts new file mode 100644 index 0000000000..7d4a710a64 --- /dev/null +++ b/types/material__tab/constants.d.ts @@ -0,0 +1,27 @@ +/** + * @license + * Copyright 2018 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { MDCStrings } from 'material__base'; + +export interface cssClasses extends MDCStrings { + ACTIVE: 'mdc-tab--active'; + ANIMATING_ACTIVATE: 'mdc-tab--animating-activate'; + ANIMATING_DEACTIVATE: 'mdc-tab--animating-deactivate'; +} + +export interface strings extends MDCStrings { + ARIA_SELECTED: 'aria-selected'; +} diff --git a/types/material__textfield/bottom-line/foundation.d.ts b/types/material__tab/foundation.d.ts similarity index 64% rename from types/material__textfield/bottom-line/foundation.d.ts rename to types/material__tab/foundation.d.ts index 6945695348..bd438ef48e 100644 --- a/types/material__textfield/bottom-line/foundation.d.ts +++ b/types/material__tab/foundation.d.ts @@ -1,6 +1,6 @@ /** * @license - * Copyright 2017 Google Inc. All Rights Reserved. + * Copyright 2018 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,35 +14,31 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - import MDCFoundation from 'material__base/foundation'; -import MDCTextFieldBottomLineAdapter from './adapter'; import { cssClasses, strings } from './constants'; +import MDCTabAdapter from './adapter'; -export default class MDCTextFieldBottomLineFoundation extends MDCFoundation { +export default class MDCTabFoundation extends MDCFoundation { static readonly cssClasses: cssClasses; static readonly strings: strings; - static readonly defaultAdapter: MDCTextFieldBottomLineAdapter; + static readonly defaultAdapter: MDCTabAdapter; + + handleTransitionEnd(evt: Event): void; /** - * Activates the bottom line + * Returns the Tab's active state + */ + isActive(): boolean; + + /** + * Activates the Tab */ activate(): void; /** - * Sets the transform origin given a user's click location. - */ - setTransformOrigin(evt: Event): void; - - /** - * Deactivates the bottom line + * Deactivates the Tab */ deactivate(): void; - - /** - * Handles a transition end event - */ - handleTransitionEnd(evt: Event): void; } diff --git a/types/material__tab/index.d.ts b/types/material__tab/index.d.ts new file mode 100644 index 0000000000..b2cc71129e --- /dev/null +++ b/types/material__tab/index.d.ts @@ -0,0 +1,33 @@ +// Type definitions for Material Components Web 0.35 +// Project: https://material.io/components/ +// Definitions by: Brent Douglas , Collin Kostichuk +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +/** + * @license + * Copyright 2018 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import MDCComponent from 'material__base/component'; +import MDCTabFoundation from './foundation'; +import MDCTabAdapter from './adapter'; + +export { MDCTabFoundation, MDCTabAdapter }; + +export class MDCTab extends MDCComponent { + static attachTo(root: Element): MDCTab; + + active: boolean; +} diff --git a/types/material__tab/tsconfig.json b/types/material__tab/tsconfig.json new file mode 100644 index 0000000000..2af99c6e5e --- /dev/null +++ b/types/material__tab/tsconfig.json @@ -0,0 +1,27 @@ +{ + "files": [ + "constants.d.ts", + "adapter.d.ts", + "index.d.ts", + "foundation.d.ts" + ], + "compilerOptions": { + "module": "commonjs", + "target": "es5", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + } +} \ No newline at end of file diff --git a/types/material__tab/tslint.json b/types/material__tab/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/material__tab/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/material__tabs/index.d.ts b/types/material__tabs/index.d.ts index b268e55a8d..b5a9d4143e 100644 --- a/types/material__tabs/index.d.ts +++ b/types/material__tabs/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Material Components Web 0.26 +// Type definitions for Material Components Web 0.35 // Project: https://material.io/components/ -// Definitions by: Brent Douglas +// Definitions by: Brent Douglas , Collin Kostichuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -20,6 +20,6 @@ * limitations under the License. */ -export {MDCTabFoundation, MDCTab} from './tab/index'; -export {MDCTabBarAdapter, MDCTabBarFoundation, MDCTabBar} from './tab-bar/index'; -export {MDCTabBarScrollerAdapter, MDCTabBarScrollerFoundation, MDCTabBarScroller} from './tab-bar-scroller/index'; +export { MDCTabFoundation, MDCTab, MDCTabAdapter } from './tab'; +export { MDCTabBarFoundation, MDCTabBar, MDCTabBarAdapter } from './tab-bar'; +export { MDCTabBarScrollerFoundation, MDCTabBarScroller, MDCTabBarScrollerAdapter } from './tab-bar-scroller'; diff --git a/types/material__tabs/tab-bar-scroller/adapter.d.ts b/types/material__tabs/tab-bar-scroller/adapter.d.ts index 8c1286fc74..b46d2d3e5f 100644 --- a/types/material__tabs/tab-bar-scroller/adapter.d.ts +++ b/types/material__tabs/tab-bar-scroller/adapter.d.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -export interface MDCTabBarScrollerAdapter { +export default interface MDCTabBarScrollerAdapter { addClass(className: string): void; removeClass(className: string): void; diff --git a/types/material__tabs/tab-bar-scroller/foundation.d.ts b/types/material__tabs/tab-bar-scroller/foundation.d.ts index ed470c20d2..273a6f048a 100644 --- a/types/material__tabs/tab-bar-scroller/foundation.d.ts +++ b/types/material__tabs/tab-bar-scroller/foundation.d.ts @@ -17,7 +17,7 @@ import MDCFoundation from 'material__base/foundation'; import { cssClasses, strings } from './constants'; -import { MDCTabBarScrollerAdapter } from './adapter'; +import MDCTabBarScrollerAdapter from './adapter'; export default class MDCTabBarScrollerFoundation extends MDCFoundation { static readonly cssClasses: cssClasses; diff --git a/types/material__tabs/tab-bar-scroller/index.d.ts b/types/material__tabs/tab-bar-scroller/index.d.ts index a9d71b305c..984a1fc838 100644 --- a/types/material__tabs/tab-bar-scroller/index.d.ts +++ b/types/material__tabs/tab-bar-scroller/index.d.ts @@ -14,23 +14,20 @@ * limitations under the License. */ -import { getCorrectPropertyName } from 'material__animation'; import MDCComponent from 'material__base/component'; -import { MDCTabBar } from '../tab-bar/index'; +import { MDCTabBar } from '../tab-bar'; import MDCTabBarScrollerFoundation from './foundation'; -import { MDCTabBarScrollerAdapter } from './adapter'; +import MDCTabBarScrollerAdapter from './adapter'; -export {MDCTabBarScrollerAdapter, MDCTabBarScrollerFoundation}; +export { MDCTabBarScrollerAdapter, MDCTabBarScrollerFoundation }; export class MDCTabBarScroller extends MDCComponent { - static attachTo(root: Element): MDCTabBarScroller; + static attachTo(root: Element): MDCTabBarScroller; - readonly tabBar: MDCTabBar; + readonly tabBar: MDCTabBar; - initialize(tabBarFactory?: (el: Element) => MDCTabBar): void; + initialize(tabBarFactory?: (root: Element) => MDCTabBar): void; - getDefaultFoundation(): MDCTabBarScrollerFoundation; - - layout(): void; + layout(): void; } diff --git a/types/material__tabs/tab-bar/adapter.d.ts b/types/material__tabs/tab-bar/adapter.d.ts index 1efa73f52c..0e43efc074 100644 --- a/types/material__tabs/tab-bar/adapter.d.ts +++ b/types/material__tabs/tab-bar/adapter.d.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -export interface MDCTabBarAdapter { +export default interface MDCTabBarAdapter { addClass(className: string): void; removeClass(className: string): void; diff --git a/types/material__tabs/tab-bar/foundation.d.ts b/types/material__tabs/tab-bar/foundation.d.ts index 2e5ccb1de2..84693dc2cd 100644 --- a/types/material__tabs/tab-bar/foundation.d.ts +++ b/types/material__tabs/tab-bar/foundation.d.ts @@ -15,10 +15,8 @@ */ import MDCFoundation from 'material__base/foundation'; -import { getCorrectPropertyName } from 'material__animation'; - import { cssClasses, strings } from './constants'; -import { MDCTabBarAdapter } from './adapter'; +import MDCTabBarAdapter from './adapter'; export default class MDCTabBarFoundation extends MDCFoundation { static readonly cssClasses: cssClasses; diff --git a/types/material__tabs/tab-bar/index.d.ts b/types/material__tabs/tab-bar/index.d.ts index 127a62217f..d50d841105 100644 --- a/types/material__tabs/tab-bar/index.d.ts +++ b/types/material__tabs/tab-bar/index.d.ts @@ -16,9 +16,9 @@ import MDCComponent from 'material__base/component'; -import { MDCTab, MDCTabFoundation } from '../tab/index'; +import { MDCTab } from '../tab'; import MDCTabBarFoundation from './foundation'; -import { MDCTabBarAdapter } from './adapter'; +import MDCTabBarAdapter from './adapter'; export {MDCTabBarAdapter, MDCTabBarFoundation}; @@ -33,7 +33,5 @@ export class MDCTabBar extends MDCComponent MDCTab): void; - getDefaultFoundation(): MDCTabBarFoundation; - layout(): void; } diff --git a/types/material__tabs/tab/adapter.d.ts b/types/material__tabs/tab/adapter.d.ts index bc07aa5aa7..2058c690e4 100644 --- a/types/material__tabs/tab/adapter.d.ts +++ b/types/material__tabs/tab/adapter.d.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -export interface MDCTabAdapter { +export default interface MDCTabAdapter { addClass(className: string): void; removeClass(className: string): void; diff --git a/types/material__tabs/tab/foundation.d.ts b/types/material__tabs/tab/foundation.d.ts index 46e14065c8..04f727fcb2 100644 --- a/types/material__tabs/tab/foundation.d.ts +++ b/types/material__tabs/tab/foundation.d.ts @@ -16,9 +16,9 @@ import MDCFoundation from 'material__base/foundation'; import { cssClasses, strings } from './constants'; -import { MDCTabAdapter } from './adapter'; +import MDCTabAdapter from './adapter'; -export class MDCTabFoundation extends MDCFoundation { +export default class MDCTabFoundation extends MDCFoundation { static readonly cssClasses: cssClasses; static readonly strings: strings; diff --git a/types/material__tabs/tab/index.d.ts b/types/material__tabs/tab/index.d.ts index bf41b77e65..43fc8b4ec6 100644 --- a/types/material__tabs/tab/index.d.ts +++ b/types/material__tabs/tab/index.d.ts @@ -15,11 +15,8 @@ */ import MDCComponent from 'material__base/component'; -import { MDCRipple } from 'material__ripple'; - -import { MDCTabAdapter } from './adapter'; -import { cssClasses } from './constants'; -import { MDCTabFoundation } from './foundation'; +import MDCTabFoundation from './foundation'; +import MDCTabAdapter from './adapter'; export {MDCTabAdapter, MDCTabFoundation}; @@ -34,10 +31,6 @@ export class MDCTab extends MDCComponent { preventDefaultOnClick: boolean; - destroy(): void; - - getDefaultFoundation(): MDCTabFoundation; - initialSyncWithDOM(): void; measureSelf(): void; diff --git a/types/material__textfield/adapter.d.ts b/types/material__textfield/adapter.d.ts index ca13544c26..8a583b20e5 100644 --- a/types/material__textfield/adapter.d.ts +++ b/types/material__textfield/adapter.d.ts @@ -1,6 +1,6 @@ /** * @license - * Copyright 2017 Google Inc. All Rights Reserved. + * Copyright 2018 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,14 +15,22 @@ * limitations under the License. */ -import MDCTextFieldBottomLineFoundation from './bottom-line/foundation'; -import MDCTextFieldHelperTextFoundation from './helper-text/foundation'; +import { MDCTextFieldHelperTextFoundation } from './helper-text'; +import { MDCTextFieldIconFoundation } from './icon'; export interface NativeInputType { value: string; disabled: boolean; badInput: boolean; - checkValidity(): boolean; + validity: { + badInput: boolean; + valid: boolean; + }; +} + +export interface FoundationMapType { + helperText?: MDCTextFieldHelperTextFoundation; + icon?: MDCTextFieldIconFoundation; } /** @@ -32,10 +40,8 @@ export interface NativeInputType { * adapter to integrate the Text Field into your framework. See * https://github.com/material-components/material-components-web/blob/master/docs/authoring-components.md * for more information. - * - * @record */ -export class MDCTextFieldAdapter { +export default interface MDCTextFieldAdapter { /** * Adds a class to the root Element. */ @@ -47,27 +53,9 @@ export class MDCTextFieldAdapter { removeClass(className: string): void; /** - * Adds a class to the label Element. We recommend you add a conditional - * check here, and in removeClassFromLabel for whether or not the label is - * present so that the JS component could be used with text fields that don't - * require a label, such as the full-width text field. + * Returns true if the root element contains the given class name. */ - addClassToLabel(className: string): void; - - /** - * Removes a class from the label Element. - */ - removeClassFromLabel(className: string): void; - - /** - * Sets an attribute on the icon Element. - */ - setIconAttr(name: string, value: string): void; - - /** - * Returns true if classname exists for a given target element. - */ - eventTargetHasClass(target: EventTarget, className: string): boolean; + hasClass(className: string): boolean; /** * Registers an event handler on the root element for a given event. @@ -79,28 +67,6 @@ export class MDCTextFieldAdapter { */ deregisterTextFieldInteractionHandler(type: string, handler: EventListener): void; - /** - * Emits a custom event "MDCTextField:icon" denoting a user has clicked the icon. - */ - notifyIconAction(): void; - - /** - * Adds a class to the helper text element. Note that in our code we check for - * whether or not we have a helper text element and if we don't, we simply - * return. - */ - addClassToHelperText(className: string): void; - - /** - * Removes a class from the helper text element. - */ - removeClassFromHelperText(className: string): void; - - /** - * Returns whether or not the helper text element contains the given class. - */ - helperTextHasClass(className: string): boolean; - /** * Registers an event listener on the native input element for a given event. */ @@ -112,29 +78,14 @@ export class MDCTextFieldAdapter { deregisterInputInteractionHandler(evtType: string, handler: EventListener): void; /** - * Registers an event listener on the bottom line element for a given event. + * Registers a validation attribute change listener on the input element. */ - registerBottomLineEventHandler(evtType: string, handler: EventListener): void; + registerValidationAttributeChangeHandler(handler: EventListener): void; /** - * Deregisters an event listener on the bottom line element for a given event. + * Disconnects a validation attribute observer on the input element. */ - deregisterBottomLineEventHandler(evtType: string, handler: EventListener): void; - - /** - * Sets an attribute with a given value on the helper text element. - */ - setHelperTextAttr(name: string, value: string): void; - - /** - * Removes an attribute from the helper text element. - */ - removeHelperTextAttr(name: string): void; - - /** - * Sets the text content for the help text element - */ - setHelperTextContent(content: string): void; + deregisterValidationAttributeChangeHandler(observer: MutationObserver): void; /** * Returns an object representing the native text input element, with a @@ -145,17 +96,72 @@ export class MDCTextFieldAdapter { * in your implementation it's important to keep this in mind. Also note that * this method can return null, which the foundation will handle gracefully. */ - getNativeInput(): Element|NativeInputType; + getNativeInput(): (Element | (NativeInputType | null)) | null; /** - * Returns the foundation for the bottom line element. Returns undefined if - * there is no bottom line element. + * Returns true if the textfield is focused. + * We achieve this via `document.activeElement === this.root_`. */ - getBottomLineFoundation(): MDCTextFieldBottomLineFoundation; + isFocused(): boolean; /** - * Returns the foundation for the helper text element. Returns undefined if - * there is no helper text element. + * Returns true if the direction of the root element is set to RTL. */ - getHelperTextFoundation(): MDCTextFieldHelperTextFoundation; + isRtl(): boolean; + + /** + * Activates the line ripple. + */ + activateLineRipple(): void; + + /** + * Deactivates the line ripple. + */ + deactivateLineRipple(): void; + + /** + * Sets the transform origin of the line ripple. + */ + setLineRippleTransformOrigin(normalizedX: number): void; + + /** + * Only implement if label exists. + * Shakes label if shouldShake is true. + */ + shakeLabel(shouldShake: boolean): void; + + /** + * Only implement if label exists. + * Floats the label above the input element if shouldFloat is true. + */ + floatLabel(shouldFloat: boolean): void; + + /** + * Returns true if label element exists, false if it doesn't. + */ + hasLabel(): boolean; + + /** + * Only implement if label exists. + * Returns width of label in pixels. + */ + getLabelWidth(): number; + + /** + * Returns true if outline element exists, false if it doesn't. + */ + hasOutline(): boolean; + + /** + * Only implement if outline element exists. + * Updates SVG Path and outline element based on the + * label element width and RTL context. + */ + notchOutline(labelWidth: number, isRtl: boolean | undefined): void; + + /** + * Only implement if outline element exists. + * Closes notch in outline element. + */ + closeOutline(): void; } diff --git a/types/material__textfield/constants.d.ts b/types/material__textfield/constants.d.ts index 7150bb4b14..8877368c48 100644 --- a/types/material__textfield/constants.d.ts +++ b/types/material__textfield/constants.d.ts @@ -15,26 +15,29 @@ * limitations under the License. */ -import { MDCStrings } from 'material__base'; +import { MDCStrings, MDCNumbers } from 'material__base'; export interface strings extends MDCStrings { ARIA_CONTROLS: 'aria-controls'; INPUT_SELECTOR: '.mdc-text-field__input'; - LABEL_SELECTOR: '.mdc-text-field__label'; + LABEL_SELECTOR: '.mdc-floating-label'; ICON_SELECTOR: '.mdc-text-field__icon'; - ICON_EVENT: 'MDCTextField:icon'; - BOTTOM_LINE_SELECTOR: '.mdc-text-field__bottom-line'; + OUTLINE_SELECTOR: '.mdc-notched-outline'; + LINE_RIPPLE_SELECTOR: '.mdc-line-ripple'; } export interface cssClasses extends MDCStrings { ROOT: 'mdc-text-field'; UPGRADED: 'mdc-text-field--upgraded'; DISABLED: 'mdc-text-field--disabled'; + DENSE: 'mdc-text-field--dense'; FOCUSED: 'mdc-text-field--focused'; INVALID: 'mdc-text-field--invalid'; - LABEL_FLOAT_ABOVE: 'mdc-text-field__label--float-above'; - LABEL_SHAKE: 'mdc-text-field__label--shake'; BOX: 'mdc-text-field--box'; - TEXT_FIELD_ICON: 'mdc-text-field__icon'; - TEXTAREA: 'mdc-text-field--textarea'; + OUTLINED: 'mdc-text-field--outlined'; +} + +export interface numbers extends MDCNumbers { + LABEL_SCALE: 0.75; + DENSE_LABEL_SCALE: 0.923; } diff --git a/types/material__textfield/foundation.d.ts b/types/material__textfield/foundation.d.ts index d36d83867e..ffc0436f45 100644 --- a/types/material__textfield/foundation.d.ts +++ b/types/material__textfield/foundation.d.ts @@ -16,29 +16,44 @@ */ import MDCFoundation from 'material__base/foundation'; -import { MDCTextFieldAdapter, NativeInputType } from './adapter'; -import MDCTextFieldBottomLineFoundation from './bottom-line/foundation'; -import { cssClasses, strings } from './constants'; +import { cssClasses, strings, numbers } from './constants'; +import MDCTextFieldAdapter, { FoundationMapType } from './adapter'; export default class MDCTextFieldFoundation extends MDCFoundation { static readonly cssClasses: cssClasses; static readonly strings: strings; + static readonly numbers: numbers; + + readonly shouldShake: boolean; + + readonly shouldFloat: boolean; + static readonly defaultAdapter: MDCTextFieldAdapter; - handleTextFieldInteraction(evt: Event): void; + constructor(adapter: MDCTextFieldAdapter, foundationMap?: FoundationMapType); + /** + * Handles user interactions with the Text Field. + */ + handleTextFieldInteraction(): void; + + /** + * Opens/closes the notched outline. + */ + + notchOutline(openNotch: boolean): void; /** * Activates the text field focus state. */ - activateFocus(): void; + activateFocus(): void; /** - * Sets the bottom line's transform origin, so that the bottom line activate + * Sets the line ripple's transform origin, so that the line ripple activate * animation will animate out from the user's click location. */ - setBottomLineTransformOrigin(evt: Event): void; + setTransformOrigin(evt: Event): void; /** * Activates the Text Field's focus state in cases when the input value @@ -46,34 +61,19 @@ export default class MDCTextFieldFoundation extends MDCFoundation { + static readonly strings: strings; + + static readonly defaultAdapter: MDCTextFieldIconAdapter; + + /** + * Sets the content of the helper text field. + */ + setDisabled(disabled: boolean): void; + + /** + * Handles an interaction event + */ + handleInteraction(evt: Event): void; +} diff --git a/types/material__textfield/bottom-line/index.d.ts b/types/material__textfield/icon/index.d.ts similarity index 58% rename from types/material__textfield/bottom-line/index.d.ts rename to types/material__textfield/icon/index.d.ts index a0ed4ff36d..3e6cfc542b 100644 --- a/types/material__textfield/bottom-line/index.d.ts +++ b/types/material__textfield/icon/index.d.ts @@ -14,18 +14,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - import MDCComponent from 'material__base/component'; +import MDCTextFieldIconFoundation from './foundation'; +import MDCTextFieldIconAdapter from './adapter'; -import MDCTextFieldBottomLineAdapter from './adapter'; -import MDCTextFieldBottomLineFoundation from './foundation'; +export { MDCTextFieldIconFoundation, MDCTextFieldIconAdapter }; -export {MDCTextFieldBottomLineAdapter, MDCTextFieldBottomLineFoundation}; +export class MDCTextFieldIcon extends MDCComponent { + static attachTo(root: Element): MDCTextFieldIcon; -export class MDCTextFieldBottomLine extends MDCComponent { - static attachTo(root: Element): MDCTextFieldBottomLine; - - readonly foundation: MDCTextFieldBottomLineFoundation; - - getDefaultFoundation(): MDCTextFieldBottomLineFoundation; + readonly foundation: MDCTextFieldIconFoundation; } diff --git a/types/material__textfield/index.d.ts b/types/material__textfield/index.d.ts index 85d4c36420..b3e61550c9 100644 --- a/types/material__textfield/index.d.ts +++ b/types/material__textfield/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Material Components Web 0.26 +// Type definitions for Material Components Web 0.35 // Project: https://material.io/components/ -// Definitions by: Brent Douglas +// Definitions by: Brent Douglas , Collin Kostichuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -22,25 +22,29 @@ */ import MDCComponent from 'material__base/component'; -import { MDCRipple } from 'material__ripple'; - -import { cssClasses, strings } from './constants'; -import { MDCTextFieldAdapter } from './adapter'; import MDCTextFieldFoundation from './foundation'; -import { MDCTextFieldBottomLine } from './bottom-line/index'; -import { MDCTextFieldHelperText } from './helper-text/index'; +import MDCTextFieldAdapter, { FoundationMapType } from './adapter'; +import { MDCTextFieldHelperText, MDCTextFieldHelperTextFoundation, MDCTextFieldHelperTextAdapter } from './helper-text'; +import { MDCTextFieldIcon, MDCTextFieldIconFoundation, MDCTextFieldIconAdapter } from './icon'; +import { MDCRipple, MDCRippleFoundation } from 'material__ripple'; +import { MDCLineRipple } from 'material__line-ripple'; +import { MDCFloatingLabel } from 'material__floating-label'; +import { MDCNotchedOutline } from 'material__notched-outline'; -export {MDCTextFieldAdapter, MDCTextFieldFoundation}; +export { MDCTextFieldFoundation, MDCTextFieldAdapter, MDCTextFieldHelperText }; +export { MDCTextFieldHelperTextFoundation, MDCTextFieldHelperTextAdapter, MDCTextFieldIcon }; +export { MDCTextFieldIconFoundation, MDCTextFieldIconAdapter }; export class MDCTextField extends MDCComponent { static attachTo(root: Element): MDCTextField; initialize( - rippleFactory?: (el: Element) => MDCRipple, - bottomLineFactory?: (el: Element) => MDCTextFieldBottomLine - ): void; - - destroy(): void; + rippleFactory?: (el: Element, foundation: MDCRippleFoundation) => MDCRipple, + lineRippleFactory?: (el: Element) => MDCLineRipple, + helperTextFactory?: (el: Element) => MDCTextFieldHelperText, + iconFactory?: (el: Element) => MDCTextFieldIcon, + labelFactory?: (el: Element) => MDCFloatingLabel, + outlineFactory?: (el: Element) => MDCNotchedOutline): void; /** * Initiliazes the Text Field's internal state based on the environment's @@ -48,14 +52,30 @@ export class MDCTextField extends MDCComponent { - static readonly cssClasses: cssClasses; + static readonly cssClasses: cssClasses; - static readonly strings: strings; + static readonly strings: strings; - static readonly numbers: numbers; + static readonly numbers: numbers; - static readonly defaultAdapter: MDCToolbarAdapter; + static readonly defaultAdapter: MDCToolbarAdapter; - updateAdjustElementStyles(): void; + updateAdjustElementStyles(): void; } diff --git a/types/material__toolbar/index.d.ts b/types/material__toolbar/index.d.ts index 1b048c64c9..75bcbcda5f 100644 --- a/types/material__toolbar/index.d.ts +++ b/types/material__toolbar/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Material Components Web 0.26 +// Type definitions for Material Components Web 0.35 // Project: https://material.io/components/ -// Definitions by: Brent Douglas +// Definitions by: Brent Douglas , Collin Kostichuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -23,15 +23,12 @@ import { MDCComponent } from 'material__base'; import MDCToolbarFoundation from './foundation'; -import { MDCToolbarAdapter } from './adapter'; -import * as util from './util'; +import MDCToolbarAdapter from './adapter'; -export {MDCToolbarAdapter, MDCToolbarFoundation, util}; +export {MDCToolbarAdapter, MDCToolbarFoundation}; export class MDCToolbar extends MDCComponent { - static attachTo(root: HTMLElement): MDCToolbar; + static attachTo(root: Element): MDCToolbar; - fixedAdjustElement: HTMLElement; - - getDefaultFoundation(): MDCToolbarFoundation; + fixedAdjustElement: HTMLElement; } diff --git a/types/material__toolbar/tsconfig.json b/types/material__toolbar/tsconfig.json index 826161ca25..2af99c6e5e 100644 --- a/types/material__toolbar/tsconfig.json +++ b/types/material__toolbar/tsconfig.json @@ -2,7 +2,6 @@ "files": [ "constants.d.ts", "adapter.d.ts", - "util.d.ts", "index.d.ts", "foundation.d.ts" ], diff --git a/types/material__top-app-bar/adapter.d.ts b/types/material__top-app-bar/adapter.d.ts new file mode 100644 index 0000000000..72d0f3430f --- /dev/null +++ b/types/material__top-app-bar/adapter.d.ts @@ -0,0 +1,77 @@ +/** + * @license + * Copyright 2018 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Adapter for MDC Top App Bar + * + * Defines the shape of the adapter expected by the foundation. Implement this + * adapter to integrate the Top App Bar into your framework. See + * https://github.com/material-components/material-components-web/blob/master/docs/authoring-components.md + * for more information. + */ +export default interface MDCTopAppBarAdapter { + /** + * Adds a class to the root Element. + */ + addClass(className: string): void; + + /** + * Removes a class from the root Element. + */ + removeClass(className: string): void; + + /** + * Returns true if the root Element contains the given class. + */ + hasClass(className: string): boolean; + + /** + * Sets the specified inline style property on the root Element to the given value. + */ + setStyle(property: string, value: string): void; + + /** + * Gets the height of the top app bar. + */ + getTopAppBarHeight(): number; + + /** + * Registers an event handler on the navigation icon element for a given event. + */ + registerNavigationIconInteractionHandler(type: string, handler: EventListener): void; + + /** + * Deregisters an event handler on the navigation icon element for a given event. + */ + deregisterNavigationIconInteractionHandler(type: string, handler: EventListener): void; + + /** + * Emits an event when the navigation icon is clicked. + */ + notifyNavigationIconClicked(): void; + + registerScrollHandler(handler: EventListener): void; + + deregisterScrollHandler(handler: EventListener): void; + + registerResizeHandler(handler: EventListener): void; + + deregisterResizeHandler(handler: EventListener): void; + + getViewportScrollY(): number; + + getTotalActionItems(): number; +} diff --git a/types/material__top-app-bar/constants.d.ts b/types/material__top-app-bar/constants.d.ts new file mode 100644 index 0000000000..9f16a92a3f --- /dev/null +++ b/types/material__top-app-bar/constants.d.ts @@ -0,0 +1,38 @@ +/** + * @license + * Copyright 2018 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { MDCStrings, MDCNumbers } from 'material__base'; + +export interface cssClasses extends MDCStrings { + FIXED_CLASS: 'mdc-top-app-bar--fixed'; + FIXED_SCROLLED_CLASS: 'mdc-top-app-bar--fixed-scrolled'; + SHORT_CLASS: 'mdc-top-app-bar--short'; + SHORT_HAS_ACTION_ITEM_CLASS: 'mdc-top-app-bar--short-has-action-item'; + SHORT_COLLAPSED_CLASS: 'mdc-top-app-bar--short-collapsed'; +} + +export interface numbers extends MDCNumbers { + DEBOUNCE_THROTTLE_RESIZE_TIME_MS: 100; + MAX_TOP_APP_BAR_HEIGHT: 128; +} + +export interface strings extends MDCStrings { + ACTION_ITEM_SELECTOR: '.mdc-top-app-bar__action-item'; + NAVIGATION_EVENT: 'MDCTopAppBar:nav'; + NAVIGATION_ICON_SELECTOR: '.mdc-top-app-bar__navigation-icon'; + ROOT_SELECTOR: '.mdc-top-app-bar'; + TITLE_SELECTOR: '.mdc-top-app-bar__title'; +} diff --git a/types/material__top-app-bar/fixed/foundation.d.ts b/types/material__top-app-bar/fixed/foundation.d.ts new file mode 100644 index 0000000000..21b5e22092 --- /dev/null +++ b/types/material__top-app-bar/fixed/foundation.d.ts @@ -0,0 +1,22 @@ +/** + * @license + * Copyright 2018 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import MDCTopAppBarFoundation from '../foundation'; +import MDCTopAppBarAdapter from '../adapter'; + +export default class MDCFixedTopAppBarFoundation extends MDCTopAppBarFoundation { +} diff --git a/types/material__menu/simple/foundation.d.ts b/types/material__top-app-bar/foundation.d.ts similarity index 63% rename from types/material__menu/simple/foundation.d.ts rename to types/material__top-app-bar/foundation.d.ts index 78071374b3..d0f6d68484 100644 --- a/types/material__menu/simple/foundation.d.ts +++ b/types/material__top-app-bar/foundation.d.ts @@ -1,6 +1,6 @@ /** * @license - * Copyright 2016 Google Inc. All Rights Reserved. + * Copyright 2018 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,28 +16,15 @@ */ import MDCFoundation from 'material__base/foundation'; -import MDCSimpleMenuAdapter from './adapter'; import { cssClasses, strings, numbers } from './constants'; -import { clamp, bezierProgress } from '../util'; - -export default class MDCSimpleMenuFoundation extends MDCFoundation { - static readonly cssClasses: cssClasses; +import MDCTopAppBarAdapter from './adapter'; +export default class MDCTopAppBarBaseFoundation extends MDCFoundation { static readonly strings: strings; + static readonly cssClasses: cssClasses; + static readonly numbers: numbers; - static readonly defaultAdapter: MDCSimpleMenuAdapter; - - /** - * Open the menu. - */ - open(options?: {focusIndex?: number}): void; - - /** - * Closes the menu. - */ - close(evt?: Event): void; - - isOpen(): boolean; + static readonly defaultAdapter: MDCTopAppBarAdapter; } diff --git a/types/material__top-app-bar/index.d.ts b/types/material__top-app-bar/index.d.ts new file mode 100644 index 0000000000..da37e36f23 --- /dev/null +++ b/types/material__top-app-bar/index.d.ts @@ -0,0 +1,38 @@ +// Type definitions for Material Components Web 0.35 +// Project: https://material.io/components/ +// Definitions by: Brent Douglas , Collin Kostichuk +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +/** + * @license + * Copyright 2018 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import MDCComponent from 'material__base/component'; +import MDCTopAppBarBaseFoundation from './foundation'; +import MDCTopAppBarAdapter from './adapter'; +import MDCFixedTopAppBarFoundation from './fixed/foundation'; +import MDCShortTopAppBarFoundation from './short/foundation'; +import MDCTopAppBarFoundation from './standard/foundation'; +import { MDCRipple } from 'material__ripple'; + +export { MDCTopAppBarBaseFoundation, MDCTopAppBarAdapter, MDCTopAppBarFoundation, MDCFixedTopAppBarFoundation, MDCShortTopAppBarFoundation }; + +export class MDCTopAppBar extends MDCComponent { + initialize(rippleFactory?: (el: Element) => MDCRipple): void; + + static attachTo(root: Element): MDCTopAppBar; +} diff --git a/types/material__top-app-bar/short/foundation.d.ts b/types/material__top-app-bar/short/foundation.d.ts new file mode 100644 index 0000000000..036b65216e --- /dev/null +++ b/types/material__top-app-bar/short/foundation.d.ts @@ -0,0 +1,22 @@ +/** + * @license + * Copyright 2018 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import MDCTopAppBarBaseFoundation from '../foundation'; +import MDCTopAppBarAdapter from '../adapter'; + +export default class MDCShortTopAppBarFoundation extends MDCTopAppBarBaseFoundation { +} diff --git a/types/material__top-app-bar/standard/foundation.d.ts b/types/material__top-app-bar/standard/foundation.d.ts new file mode 100644 index 0000000000..d9d39b4646 --- /dev/null +++ b/types/material__top-app-bar/standard/foundation.d.ts @@ -0,0 +1,22 @@ +/** + * @license + * Copyright 2018 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import MDCTopAppBarBaseFoundation from '../foundation'; +import MDCTopAppBarAdapter from '../adapter'; + +export default class MDCTopAppBarFoundation extends MDCTopAppBarBaseFoundation { +} diff --git a/types/material__top-app-bar/tsconfig.json b/types/material__top-app-bar/tsconfig.json new file mode 100644 index 0000000000..5652908420 --- /dev/null +++ b/types/material__top-app-bar/tsconfig.json @@ -0,0 +1,30 @@ +{ + "files": [ + "fixed/foundation.d.ts", + "short/foundation.d.ts", + "standard/foundation.d.ts", + "constants.d.ts", + "adapter.d.ts", + "index.d.ts", + "foundation.d.ts" + ], + "compilerOptions": { + "module": "commonjs", + "target": "es5", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + } +} \ No newline at end of file diff --git a/types/material__top-app-bar/tslint.json b/types/material__top-app-bar/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/material__top-app-bar/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 14458ce965c6a63d4e8665abbe7259ff118c033d Mon Sep 17 00:00:00 2001 From: Deividi Date: Fri, 11 May 2018 22:09:45 -0300 Subject: [PATCH 055/575] added render function --- types/react-text-mask/index.d.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/types/react-text-mask/index.d.ts b/types/react-text-mask/index.d.ts index 7ed81429e0..6bdaba03bc 100644 --- a/types/react-text-mask/index.d.ts +++ b/types/react-text-mask/index.d.ts @@ -20,6 +20,9 @@ export interface MaskedInputProps extends React.InputHTMLAttributes false | string | { value: string, indexesOfPipedChars: number[] }; showMask?: boolean; + + render: (ref: MaskedInput, props: any) => any; + } export interface conformToMaskResult { From 16f2d8d59bb00b9e8e9368116f4c905441977b92 Mon Sep 17 00:00:00 2001 From: Deividi Date: Fri, 11 May 2018 22:24:05 -0300 Subject: [PATCH 056/575] Update index.d.ts --- types/react-text-mask/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-text-mask/index.d.ts b/types/react-text-mask/index.d.ts index 6bdaba03bc..843441d99a 100644 --- a/types/react-text-mask/index.d.ts +++ b/types/react-text-mask/index.d.ts @@ -21,7 +21,7 @@ export interface MaskedInputProps extends React.InputHTMLAttributes any; + render?: (ref: MaskedInput, props: any) => any; } From d53b06240780bb741a83f11f46b1e60c9ec4d80a Mon Sep 17 00:00:00 2001 From: cavarzan Date: Fri, 11 May 2018 22:39:54 -0300 Subject: [PATCH 057/575] fix lint --- types/react-text-mask/index.d.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/types/react-text-mask/index.d.ts b/types/react-text-mask/index.d.ts index 843441d99a..b2f3147667 100644 --- a/types/react-text-mask/index.d.ts +++ b/types/react-text-mask/index.d.ts @@ -1,10 +1,10 @@ -// Type definitions for react-text-mask 5.1 +// Type definitions for react-text-mask 5.4.1 // Project: https://github.com/text-mask/text-mask -// Definitions by: Guilherme Hübner +// Definitions by: Guilherme Hübner , Deividi Cavarzan // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 -import * as React from "react"; +import * as React from 'react'; export type maskArray = Array; @@ -17,18 +17,17 @@ export interface MaskedInputProps extends React.InputHTMLAttributes false | string | { value: string, indexesOfPipedChars: number[] }; + pipe?: (conformedValue: string, config: any) => false | string | { value: string; indexesOfPipedChars: number[] }; showMask?: boolean; - - render?: (ref: MaskedInput, props: any) => any; + render?: (ref: MaskedInput, props: any) => any; } export interface conformToMaskResult { conformedValue: string; meta: { - someCharsRejected: boolean + someCharsRejected: boolean; }; } From ca07c3bfb46a6b5f2f02f49104f38188c1d6ecc1 Mon Sep 17 00:00:00 2001 From: Deividi Date: Fri, 11 May 2018 22:48:14 -0300 Subject: [PATCH 058/575] Update index.d.ts --- types/react-text-mask/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-text-mask/index.d.ts b/types/react-text-mask/index.d.ts index b2f3147667..d598fcf711 100644 --- a/types/react-text-mask/index.d.ts +++ b/types/react-text-mask/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-text-mask 5.4.1 +// Type definitions for react-text-mask 5.4 // Project: https://github.com/text-mask/text-mask // Definitions by: Guilherme Hübner , Deividi Cavarzan // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 06d81ef2cea31831548ed1e51fb6ba500a463199 Mon Sep 17 00:00:00 2001 From: James Barton Date: Sat, 12 May 2018 00:58:12 -0500 Subject: [PATCH 059/575] Add definitions for vue-markdown --- types/vue-markdown/index.d.ts | 305 +++++++++++++++++++++++ types/vue-markdown/package.json | 6 + types/vue-markdown/tsconfig.json | 24 ++ types/vue-markdown/tslint.json | 1 + types/vue-markdown/vue-markdown-tests.ts | 12 + 5 files changed, 348 insertions(+) create mode 100644 types/vue-markdown/index.d.ts create mode 100644 types/vue-markdown/package.json create mode 100644 types/vue-markdown/tsconfig.json create mode 100644 types/vue-markdown/tslint.json create mode 100644 types/vue-markdown/vue-markdown-tests.ts diff --git a/types/vue-markdown/index.d.ts b/types/vue-markdown/index.d.ts new file mode 100644 index 0000000000..58482a0870 --- /dev/null +++ b/types/vue-markdown/index.d.ts @@ -0,0 +1,305 @@ +// Type definitions for vue-markdown 2.2 +// Project: https://github.com/miaolz123/vue-markdown#readme +// Definitions by: James Barton +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export default vue_markdown; +export const vue_markdown: { + beforeMount: any; + computed: { + tocLastLevelComputed: any; + }; + data: any; + md: { + block: { + State: any; + parse: any; + ruler: { + after: any; + at: any; + before: any; + disable: any; + enable: any; + enableOnly: any; + getRules: any; + push: any; + }; + tokenize: any; + }; + configure: any; + core: { + State: any; + process: any; + ruler: { + after: any; + at: any; + before: any; + disable: any; + enable: any; + enableOnly: any; + getRules: any; + push: any; + }; + }; + disable: any; + enable: any; + helpers: { + parseLinkDestination: any; + parseLinkLabel: any; + parseLinkTitle: any; + }; + inline: { + State: any; + parse: any; + ruler: { + after: any; + at: any; + before: any; + disable: any; + enable: any; + enableOnly: any; + getRules: any; + push: any; + }; + ruler2: { + after: any; + at: any; + before: any; + disable: any; + enable: any; + enableOnly: any; + getRules: any; + push: any; + }; + skipToken: any; + tokenize: any; + }; + linkify: { + add: any; + match: any; + normalize: any; + pretest: any; + re: { + email_fuzzy: RegExp; + host_fuzzy_test: RegExp; + link_fuzzy: RegExp; + link_no_ip_fuzzy: RegExp; + pretest: RegExp; + schema_search: RegExp; + schema_test: RegExp; + src_Any: string; + src_Cc: string; + src_P: string; + src_Z: string; + src_ZCc: string; + src_ZPCc: string; + src_auth: string; + src_domain: string; + src_domain_root: string; + src_email_name: string; + src_host: string; + src_host_port_strict: string; + src_host_strict: string; + src_host_terminator: string; + src_ip4: string; + src_path: string; + src_port: string; + src_tlds: string; + src_xn: string; + tpl_email_fuzzy: string; + tpl_host_fuzzy: string; + tpl_host_fuzzy_strict: string; + tpl_host_fuzzy_test: string; + tpl_host_no_ip_fuzzy: string; + tpl_host_port_fuzzy_strict: string; + tpl_host_port_no_ip_fuzzy_strict: string; + tpl_link_fuzzy: string; + tpl_link_no_ip_fuzzy: string; + }; + set: any; + test: any; + testSchemaAt: any; + tlds: any; + }; + normalizeLink: any; + normalizeLinkText: any; + options: { + breaks: boolean; + highlight: any; + html: boolean; + langPrefix: string; + linkify: boolean; + maxNesting: number; + quotes: string; + typographer: boolean; + xhtmlOut: boolean; + }; + parse: any; + parseInline: any; + render: any; + renderInline: any; + renderer: { + render: any; + renderAttrs: any; + renderInline: any; + renderInlineAsText: any; + renderToken: any; + rules: { + code_block: any; + code_inline: any; + fence: any; + hardbreak: any; + html_block: any; + html_inline: any; + image: any; + softbreak: any; + text: any; + }; + }; + set: any; + use: any; + utils: { + arrayReplaceAt: any; + assign: any; + escapeHtml: any; + escapeRE: any; + fromCodePoint: any; + has: any; + isMdAsciiPunct: any; + isPunctChar: any; + isSpace: any; + isString: any; + isValidEntityCode: any; + isWhiteSpace: any; + lib: { + mdurl: { + decode: any; + encode: any; + format: any; + parse: any; + }; + ucmicro: { + Any: RegExp; + Cc: RegExp; + Cf: RegExp; + P: RegExp; + Z: RegExp; + }; + }; + normalizeReference: any; + unescapeAll: any; + unescapeMd: any; + }; + validateLink: any; + }; + props: { + anchorAttributes: { + default: any; + type: any; + }; + breaks: { + default: boolean; + type: any; + }; + emoji: { + default: boolean; + type: any; + }; + highlight: { + default: boolean; + type: any; + }; + html: { + default: boolean; + type: any; + }; + langPrefix: { + default: string; + type: any; + }; + linkify: { + default: boolean; + type: any; + }; + postrender: { + default: any; + type: any; + }; + prerender: { + default: any; + type: any; + }; + quotes: { + default: string; + type: any; + }; + show: { + default: boolean; + type: any; + }; + source: { + default: string; + type: any; + }; + tableClass: { + default: string; + type: any; + }; + taskLists: { + default: boolean; + type: any; + }; + toc: { + default: boolean; + type: any; + }; + tocAnchorClass: { + default: string; + type: any; + }; + tocAnchorLink: { + default: boolean; + type: any; + }; + tocAnchorLinkClass: { + default: string; + type: any; + }; + tocAnchorLinkSpace: { + default: boolean; + type: any; + }; + tocAnchorLinkSymbol: { + default: string; + type: any; + }; + tocClass: { + default: string; + type: any; + }; + tocFirstLevel: { + default: number; + type: any; + }; + tocId: { + type: any; + }; + tocLastLevel: { + type: any; + }; + typographer: { + default: boolean; + type: any; + }; + watches: { + default: any; + type: any; + }; + xhtmlOut: { + default: boolean; + type: any; + }; + }; + render: any; + template: string; +}; diff --git a/types/vue-markdown/package.json b/types/vue-markdown/package.json new file mode 100644 index 0000000000..20f817a6b3 --- /dev/null +++ b/types/vue-markdown/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "vue": "^2.5.16" + } +} diff --git a/types/vue-markdown/tsconfig.json b/types/vue-markdown/tsconfig.json new file mode 100644 index 0000000000..9b7defa032 --- /dev/null +++ b/types/vue-markdown/tsconfig.json @@ -0,0 +1,24 @@ +{ + "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", + "vue-markdown-tests.ts" + ] +} diff --git a/types/vue-markdown/tslint.json b/types/vue-markdown/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/vue-markdown/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/vue-markdown/vue-markdown-tests.ts b/types/vue-markdown/vue-markdown-tests.ts new file mode 100644 index 0000000000..369e4c614c --- /dev/null +++ b/types/vue-markdown/vue-markdown-tests.ts @@ -0,0 +1,12 @@ +import Vue from 'vue'; +import VueMarkdown from 'vue-markdown'; + +new Vue({ + el: '#app', + components: { + VueMarkdown + }, + template: ` + # Test + ` +}); From 58dd75a89dd90dda5eca93c80bc47485da8eff05 Mon Sep 17 00:00:00 2001 From: Guy Lichtman Date: Sat, 12 May 2018 12:49:35 +0300 Subject: [PATCH 060/575] Add definitions for tar-stream --- types/tar-stream/index.d.ts | 42 ++++++++++++++++++++++++++ types/tar-stream/tar-stream-tests.ts | 44 ++++++++++++++++++++++++++++ types/tar-stream/tsconfig.json | 23 +++++++++++++++ types/tar-stream/tslint.json | 1 + 4 files changed, 110 insertions(+) create mode 100644 types/tar-stream/index.d.ts create mode 100644 types/tar-stream/tar-stream-tests.ts create mode 100644 types/tar-stream/tsconfig.json create mode 100644 types/tar-stream/tslint.json diff --git a/types/tar-stream/index.d.ts b/types/tar-stream/index.d.ts new file mode 100644 index 0000000000..21643fa906 --- /dev/null +++ b/types/tar-stream/index.d.ts @@ -0,0 +1,42 @@ +// Type definitions for tar-stream 1.6 +// Project: https://github.com/mafintosh/tar-stream +// Definitions by: Guy Lichtman +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +/// + +import stream = require('stream'); + +export type Callback = (err?: Error | null) => any; + +// see https://github.com/mafintosh/tar-stream/blob/master/headers.js +export interface Headers { + name: string; + mode?: number; + uid?: number; + gid?: number; + size?: number; + mtime?: Date; + linkname?: string | null; + type?: 'file' | 'link' | 'symlink' | 'character-device' | 'block-device' | 'directory' | 'fifo' | + 'contiguous-file' | 'pax-header' | 'pax-global-header' | 'gnu-long-link-path' | 'gnu-long-path' | null; + uname?: string; + gname?: string; + devmajor?: number; + devminor?: number; +} + +export interface Pack extends stream.Readable { + entry(headers: Headers, buffer?: string | Buffer | Callback, callback?: Callback): stream.Writable; + finalize(): void; +} + +export interface Extract extends stream.Writable { + on(event: string, listener: (...args: any[]) => void): this; + on(event: "entry", listener: (headers: Headers, stream: stream.PassThrough, next: () => void ) => void): this; +} + +export function extract(opts?: stream.WritableOptions): stream.Writable; + +export function pack(opts?: stream.ReadableOptions): Pack; diff --git a/types/tar-stream/tar-stream-tests.ts b/types/tar-stream/tar-stream-tests.ts new file mode 100644 index 0000000000..537c08bc0d --- /dev/null +++ b/types/tar-stream/tar-stream-tests.ts @@ -0,0 +1,44 @@ +import tar = require('tar-stream'); + +const pack = tar.pack(); + +// add a file called my-test.txt with the content "Hello World!" +pack.entry({ name: 'my-test1.txt' }, 'Hello World!'); + +// add a file called my-stream-test.txt from a stream +const entry = pack.entry({ name: 'my-test2.txt', size: 11 }, (err) => { + // the stream was added + // no more entries + pack.finalize(); +}); + +entry.write('hello'); +entry.write(' '); +entry.write('world'); +entry.end(); + +const extract = tar.extract(); + +const entries: any = {}; + +extract.on('entry', (header, stream, next) => { + // header is the tar header + // stream is the content body (might be an empty stream) + // call next when you are done with this entry + entries[header.name] = true; + stream.on('end', () => { + next(); + }); + + stream.resume(); // just auto drain the stream +}); + +extract.on('finish', () => { + // all entries read + console.assert(entries['my-test1.txt'], "missing entry"); + console.assert(entries['my-test2.txt'], "missing entry"); + console.log("Found all entries in extract"); +}); + +// pipe the pack stream +pack.pipe(extract); diff --git a/types/tar-stream/tsconfig.json b/types/tar-stream/tsconfig.json new file mode 100644 index 0000000000..efc9382e30 --- /dev/null +++ b/types/tar-stream/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", + "tar-stream-tests.ts" + ] +} diff --git a/types/tar-stream/tslint.json b/types/tar-stream/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/tar-stream/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From b1e3ed6ea9331001663434a9d1214299cf1e8015 Mon Sep 17 00:00:00 2001 From: Arnav Gupta Date: Sat, 12 May 2018 15:22:49 +0530 Subject: [PATCH 061/575] add types for discourse-sso Signed-off-by: Arnav Gupta --- types/discourse-sso/discourse-sso-tests.ts | 16 ++++++++++++ types/discourse-sso/index.d.ts | 30 ++++++++++++++++++++++ types/discourse-sso/tsconfig.json | 22 ++++++++++++++++ types/discourse-sso/tslint.json | 1 + 4 files changed, 69 insertions(+) create mode 100644 types/discourse-sso/discourse-sso-tests.ts create mode 100644 types/discourse-sso/index.d.ts create mode 100644 types/discourse-sso/tsconfig.json create mode 100644 types/discourse-sso/tslint.json diff --git a/types/discourse-sso/discourse-sso-tests.ts b/types/discourse-sso/discourse-sso-tests.ts new file mode 100644 index 0000000000..fe61efe08a --- /dev/null +++ b/types/discourse-sso/discourse-sso-tests.ts @@ -0,0 +1,16 @@ +import * as discourseSSO from 'discourse-sso' +const sso = new discourseSSO('sso secret string') + +if (sso.validate('payload', 'sig')) { + const nonce = sso.getNonce('payload') + + const userParams: discourseSSO.UserParams = { + nonce, + external_id: '1', + email: 'omg@mail.com', + username: 'myuser', + name: 'This Guy' + } + + const loginString: string = sso.buildLoginString(userParams) +} \ No newline at end of file diff --git a/types/discourse-sso/index.d.ts b/types/discourse-sso/index.d.ts new file mode 100644 index 0000000000..90c652948d --- /dev/null +++ b/types/discourse-sso/index.d.ts @@ -0,0 +1,30 @@ +// Type definitions for discourse-sso 1.0 +// Project: https://github.com/ArmedGuy/discourse_sso_node +// Definitions by: Arnav Gupta +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + + + + +declare class DiscourseSSO { + constructor(ssoSecret: string) + validate(payload: string, sig: string): boolean + getNonce(payload: string): string + buildLoginString(params: DiscourseSSO.UserParams): string +} +declare namespace DiscourseSSO { + + export interface UserParams { + nonce: string, + external_id: string, + email: string, + admin?: boolean, + moderator?: boolean, + username?: string, + name?: string, + avatar_url?: string, + add_groups?: string[], + remove_groups?: string[] + } +} +export = DiscourseSSO \ No newline at end of file diff --git a/types/discourse-sso/tsconfig.json b/types/discourse-sso/tsconfig.json new file mode 100644 index 0000000000..c80e56868b --- /dev/null +++ b/types/discourse-sso/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "discourse-sso-tests.ts" + ] +} diff --git a/types/discourse-sso/tslint.json b/types/discourse-sso/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/discourse-sso/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 5d278b1acf938421de2f68f02080af9429573e00 Mon Sep 17 00:00:00 2001 From: Guy Lichtman Date: Sat, 12 May 2018 13:02:04 +0300 Subject: [PATCH 062/575] fix lint warning --- types/tar-stream/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/tar-stream/index.d.ts b/types/tar-stream/index.d.ts index 21643fa906..d6afd0af7a 100644 --- a/types/tar-stream/index.d.ts +++ b/types/tar-stream/index.d.ts @@ -34,7 +34,7 @@ export interface Pack extends stream.Readable { export interface Extract extends stream.Writable { on(event: string, listener: (...args: any[]) => void): this; - on(event: "entry", listener: (headers: Headers, stream: stream.PassThrough, next: () => void ) => void): this; + on(event: "entry", listener: (headers: Headers, stream: stream.PassThrough, next: () => void) => void): this; } export function extract(opts?: stream.WritableOptions): stream.Writable; From bd9997047cccf10d7d275321e8847d462599af4d Mon Sep 17 00:00:00 2001 From: Arnav Gupta Date: Sat, 12 May 2018 15:53:39 +0530 Subject: [PATCH 063/575] Add strictFunctionTypes Signed-off-by: Arnav Gupta --- types/discourse-sso/tsconfig.json | 1 + 1 file changed, 1 insertion(+) diff --git a/types/discourse-sso/tsconfig.json b/types/discourse-sso/tsconfig.json index c80e56868b..a0f1edbad5 100644 --- a/types/discourse-sso/tsconfig.json +++ b/types/discourse-sso/tsconfig.json @@ -7,6 +7,7 @@ "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, + "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ "../" From 2be4ed83e95c648aa9dc0593e3e465074eef899a Mon Sep 17 00:00:00 2001 From: Arnav Gupta Date: Sat, 12 May 2018 16:03:57 +0530 Subject: [PATCH 064/575] tslint fixes Signed-off-by: Arnav Gupta --- types/discourse-sso/discourse-sso-tests.ts | 10 +++---- types/discourse-sso/index.d.ts | 35 ++++++++++------------ 2 files changed, 21 insertions(+), 24 deletions(-) diff --git a/types/discourse-sso/discourse-sso-tests.ts b/types/discourse-sso/discourse-sso-tests.ts index fe61efe08a..6ec2d967fc 100644 --- a/types/discourse-sso/discourse-sso-tests.ts +++ b/types/discourse-sso/discourse-sso-tests.ts @@ -1,8 +1,8 @@ -import * as discourseSSO from 'discourse-sso' -const sso = new discourseSSO('sso secret string') +import * as discourseSSO from 'discourse-sso'; +const sso = new discourseSSO('sso secret string'); if (sso.validate('payload', 'sig')) { - const nonce = sso.getNonce('payload') + const nonce = sso.getNonce('payload'); const userParams: discourseSSO.UserParams = { nonce, @@ -12,5 +12,5 @@ if (sso.validate('payload', 'sig')) { name: 'This Guy' } - const loginString: string = sso.buildLoginString(userParams) -} \ No newline at end of file + const loginString: string = sso.buildLoginString(userParams); +} diff --git a/types/discourse-sso/index.d.ts b/types/discourse-sso/index.d.ts index 90c652948d..322d2d609f 100644 --- a/types/discourse-sso/index.d.ts +++ b/types/discourse-sso/index.d.ts @@ -3,28 +3,25 @@ // Definitions by: Arnav Gupta // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - - declare class DiscourseSSO { - constructor(ssoSecret: string) - validate(payload: string, sig: string): boolean - getNonce(payload: string): string - buildLoginString(params: DiscourseSSO.UserParams): string + constructor(ssoSecret: string); + validate(payload: string, sig: string): boolean; + getNonce(payload: string): string; + buildLoginString(params: DiscourseSSO.UserParams): string; } + declare namespace DiscourseSSO { - export interface UserParams { - nonce: string, - external_id: string, - email: string, - admin?: boolean, - moderator?: boolean, - username?: string, - name?: string, - avatar_url?: string, - add_groups?: string[], - remove_groups?: string[] + nonce: string; + external_id: string; + email: string; + admin?: boolean; + moderator?: boolean; + username?: string; + name?: string; + avatar_url?: string; + add_groups?: string[]; + remove_groups?: string[]; } } -export = DiscourseSSO \ No newline at end of file +export = DiscourseSSO; \ No newline at end of file From bce8cdb6d36d24983dac1b482bdebba9be390d34 Mon Sep 17 00:00:00 2001 From: Arnav Gupta Date: Sat, 12 May 2018 16:16:43 +0530 Subject: [PATCH 065/575] more lint fixes Signed-off-by: Arnav Gupta --- types/discourse-sso/discourse-sso-tests.ts | 2 +- types/discourse-sso/index.d.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/types/discourse-sso/discourse-sso-tests.ts b/types/discourse-sso/discourse-sso-tests.ts index 6ec2d967fc..efe7eba95b 100644 --- a/types/discourse-sso/discourse-sso-tests.ts +++ b/types/discourse-sso/discourse-sso-tests.ts @@ -10,7 +10,7 @@ if (sso.validate('payload', 'sig')) { email: 'omg@mail.com', username: 'myuser', name: 'This Guy' - } + }; const loginString: string = sso.buildLoginString(userParams); } diff --git a/types/discourse-sso/index.d.ts b/types/discourse-sso/index.d.ts index 322d2d609f..b8030e0735 100644 --- a/types/discourse-sso/index.d.ts +++ b/types/discourse-sso/index.d.ts @@ -11,7 +11,7 @@ declare class DiscourseSSO { } declare namespace DiscourseSSO { - export interface UserParams { + interface UserParams { nonce: string; external_id: string; email: string; @@ -24,4 +24,4 @@ declare namespace DiscourseSSO { remove_groups?: string[]; } } -export = DiscourseSSO; \ No newline at end of file +export = DiscourseSSO; From 207c35ed90020228f7eae20e6c511274a4afdf8f Mon Sep 17 00:00:00 2001 From: AJ Richardson Date: Sat, 12 May 2018 08:36:50 -0400 Subject: [PATCH 066/575] Remove trivial files from tsconfig.json to avoid memory errors in tests --- types/lodash/common/array.d.ts | 32 +- types/lodash/lodash-tests.ts | 8 +- types/lodash/tsconfig.json | 686 +-------------------------------- types/lowdb/_lodash.d.ts | 4 +- 4 files changed, 23 insertions(+), 707 deletions(-) diff --git a/types/lodash/common/array.d.ts b/types/lodash/common/array.d.ts index 5591bce088..6d4aff3056 100644 --- a/types/lodash/common/array.d.ts +++ b/types/lodash/common/array.d.ts @@ -929,28 +929,28 @@ declare module "../index" { // flattenDepth interface LoDashStatic { - /** - * Recursively flatten array up to depth times. - * - * @param array The array to recursively flatten. - * @param number The maximum recursion depth. - * @return Returns the new flattened array. - */ - flattenDepth(array: ListOfRecursiveArraysOrValues | null | undefined, depth?: number): T[]; + /** + * Recursively flatten array up to depth times. + * + * @param array The array to recursively flatten. + * @param number The maximum recursion depth. + * @return Returns the new flattened array. + */ + flattenDepth(array: ListOfRecursiveArraysOrValues | null | undefined, depth?: number): T[]; } interface LoDashImplicitWrapper { - /** - * @see _.flattenDeep - */ - flattenDepth(this: LoDashImplicitWrapper | null | undefined>, depth?: number): LoDashImplicitWrapper; + /** + * @see _.flattenDeep + */ + flattenDepth(this: LoDashImplicitWrapper | null | undefined>, depth?: number): LoDashImplicitWrapper; } interface LoDashExplicitWrapper { - /** - * @see _.flattenDeep - */ - flattenDepth(this: LoDashExplicitWrapper | null | undefined>, depth?: number): LoDashExplicitWrapper; + /** + * @see _.flattenDeep + */ + flattenDepth(this: LoDashExplicitWrapper | null | undefined>, depth?: number): LoDashExplicitWrapper; } // fromPairs diff --git a/types/lodash/lodash-tests.ts b/types/lodash/lodash-tests.ts index 6f4fae8529..52514f16f1 100644 --- a/types/lodash/lodash-tests.ts +++ b/types/lodash/lodash-tests.ts @@ -5793,19 +5793,19 @@ fp.now(); // $ExpectType number _.omit(dictionary, "a"); // $ExpectType Dictionary _.omit(numericDictionary, "a"); // $ExpectType NumericDictionary - _(obj).omit("a"); // ExpectType LoDashImplicitWrapper> // NOTE: ExpectType disabled because it fails in TS2.4 + _(obj).omit("a"); // ExpectType LoDashImplicitWrapper> // NOTE: ExpectType disabled because it fails in TS2.4 _(obj).omit(["b", 1], 0, "a"); // $ExpectType LoDashImplicitWrapper> _(dictionary).omit("a"); // $ExpectType LoDashImplicitWrapper> _(numericDictionary).omit("a"); // $ExpectType LoDashImplicitWrapper> - _.chain(obj).omit("a"); // ExpectType LoDashExplicitWrapper> // NOTE: ExpectType disabled because it fails in TS2.4 + _.chain(obj).omit("a"); // ExpectType LoDashExplicitWrapper> // NOTE: ExpectType disabled because it fails in TS2.4 _.chain(obj).omit(["b", 1], 0, "a"); // $ExpectType LoDashExplicitWrapper> _.chain(dictionary).omit("a"); // $ExpectType LoDashExplicitWrapper> _.chain(numericDictionary).omit("a"); // $ExpectType LoDashExplicitWrapper> fp.omit("a", obj); // ExpectType Pick // NOTE: ExpectType disabled because it fails in TS2.4 - fp.omit("a")(obj); // ExpectType Pick // NOTE: ExpectType disabled because it fails in TS2.3 - fp.omit(["a", "b"])(obj); // ExpectType Pick // NOTE: ExpectType disabled because it fails in TS2.3 + fp.omit("a")(obj); // ExpectType Pick // NOTE: ExpectType disabled because it fails in TS2.3 + fp.omit(["a", "b"])(obj); // ExpectType Pick // NOTE: ExpectType disabled because it fails in TS2.3 } // _.omitBy diff --git a/types/lodash/tsconfig.json b/types/lodash/tsconfig.json index 60a2e8323c..5a160103d4 100644 --- a/types/lodash/tsconfig.json +++ b/types/lodash/tsconfig.json @@ -20,305 +20,7 @@ "files": [ "index.d.ts", "lodash-tests.ts", - "add.d.ts", - "after.d.ts", - "ary.d.ts", - "assign.d.ts", - "assignIn.d.ts", - "assignInWith.d.ts", - "assignWith.d.ts", - "at.d.ts", - "attempt.d.ts", - "before.d.ts", - "bind.d.ts", - "bindAll.d.ts", - "bindKey.d.ts", - "camelCase.d.ts", - "capitalize.d.ts", - "castArray.d.ts", - "ceil.d.ts", - "chain.d.ts", - "chunk.d.ts", - "clamp.d.ts", - "clone.d.ts", - "cloneDeep.d.ts", - "cloneDeepWith.d.ts", - "cloneWith.d.ts", - "compact.d.ts", - "concat.d.ts", - "cond.d.ts", - "conformsTo.d.ts", - "constant.d.ts", - "countBy.d.ts", - "create.d.ts", - "curry.d.ts", - "curryRight.d.ts", - "debounce.d.ts", - "deburr.d.ts", - "defaults.d.ts", - "defaultsDeep.d.ts", - "defaultTo.d.ts", - "defer.d.ts", - "delay.d.ts", - "difference.d.ts", - "differenceBy.d.ts", - "differenceWith.d.ts", - "divide.d.ts", - "drop.d.ts", - "dropRight.d.ts", - "dropRightWhile.d.ts", - "dropWhile.d.ts", - "each.d.ts", - "eachRight.d.ts", - "endsWith.d.ts", - "entries.d.ts", - "entriesIn.d.ts", - "eq.d.ts", - "escape.d.ts", - "escapeRegExp.d.ts", - "every.d.ts", - "extend.d.ts", - "extendWith.d.ts", - "fill.d.ts", - "filter.d.ts", - "find.d.ts", - "findIndex.d.ts", - "findKey.d.ts", - "findLast.d.ts", - "findLastIndex.d.ts", - "findLastKey.d.ts", - "first.d.ts", - "flatMap.d.ts", - "flatMapDeep.d.ts", - "flatMapDepth.d.ts", - "flatten.d.ts", - "flattenDeep.d.ts", - "flattenDepth.d.ts", - "flip.d.ts", - "floor.d.ts", - "flow.d.ts", - "flowRight.d.ts", - "forEach.d.ts", - "forEachRight.d.ts", - "forIn.d.ts", - "forInRight.d.ts", - "forOwn.d.ts", - "forOwnRight.d.ts", "fp.d.ts", - "fromPairs.d.ts", - "functions.d.ts", - "functionsIn.d.ts", - "get.d.ts", - "groupBy.d.ts", - "gt.d.ts", - "gte.d.ts", - "has.d.ts", - "hasIn.d.ts", - "head.d.ts", - "identity.d.ts", - "includes.d.ts", - "indexOf.d.ts", - "initial.d.ts", - "inRange.d.ts", - "intersection.d.ts", - "intersectionBy.d.ts", - "intersectionWith.d.ts", - "invert.d.ts", - "invertBy.d.ts", - "invoke.d.ts", - "invokeMap.d.ts", - "isArguments.d.ts", - "isArray.d.ts", - "isArrayBuffer.d.ts", - "isArrayLike.d.ts", - "isArrayLikeObject.d.ts", - "isBoolean.d.ts", - "isBuffer.d.ts", - "isDate.d.ts", - "isElement.d.ts", - "isEmpty.d.ts", - "isEqual.d.ts", - "isEqualWith.d.ts", - "isError.d.ts", - "isFinite.d.ts", - "isFunction.d.ts", - "isInteger.d.ts", - "isLength.d.ts", - "isMap.d.ts", - "isMatch.d.ts", - "isMatchWith.d.ts", - "isNaN.d.ts", - "isNative.d.ts", - "isNil.d.ts", - "isNull.d.ts", - "isNumber.d.ts", - "isObject.d.ts", - "isObjectLike.d.ts", - "isPlainObject.d.ts", - "isRegExp.d.ts", - "isSafeInteger.d.ts", - "isSet.d.ts", - "isString.d.ts", - "isSymbol.d.ts", - "isTypedArray.d.ts", - "isUndefined.d.ts", - "isWeakMap.d.ts", - "isWeakSet.d.ts", - "iteratee.d.ts", - "join.d.ts", - "kebabCase.d.ts", - "keyBy.d.ts", - "keys.d.ts", - "keysIn.d.ts", - "last.d.ts", - "lastIndexOf.d.ts", - "lowerCase.d.ts", - "lowerFirst.d.ts", - "lt.d.ts", - "lte.d.ts", - "map.d.ts", - "mapKeys.d.ts", - "mapValues.d.ts", - "matches.d.ts", - "matchesProperty.d.ts", - "max.d.ts", - "maxBy.d.ts", - "mean.d.ts", - "meanBy.d.ts", - "memoize.d.ts", - "merge.d.ts", - "mergeWith.d.ts", - "method.d.ts", - "methodOf.d.ts", - "min.d.ts", - "minBy.d.ts", - "mixin.d.ts", - "negate.d.ts", - "noConflict.d.ts", - "noop.d.ts", - "now.d.ts", - "nth.d.ts", - "nthArg.d.ts", - "omit.d.ts", - "omitBy.d.ts", - "once.d.ts", - "orderBy.d.ts", - "over.d.ts", - "overArgs.d.ts", - "overEvery.d.ts", - "overSome.d.ts", - "pad.d.ts", - "padEnd.d.ts", - "padStart.d.ts", - "parseInt.d.ts", - "partial.d.ts", - "partialRight.d.ts", - "partition.d.ts", - "pick.d.ts", - "pickBy.d.ts", - "property.d.ts", - "propertyOf.d.ts", - "pull.d.ts", - "pullAll.d.ts", - "pullAllBy.d.ts", - "pullAllWith.d.ts", - "pullAt.d.ts", - "random.d.ts", - "range.d.ts", - "rangeRight.d.ts", - "rearg.d.ts", - "reduce.d.ts", - "reduceRight.d.ts", - "reject.d.ts", - "remove.d.ts", - "repeat.d.ts", - "replace.d.ts", - "rest.d.ts", - "result.d.ts", - "reverse.d.ts", - "round.d.ts", - "runInContext.d.ts", - "sample.d.ts", - "sampleSize.d.ts", - "set.d.ts", - "setWith.d.ts", - "shuffle.d.ts", - "size.d.ts", - "slice.d.ts", - "snakeCase.d.ts", - "some.d.ts", - "sortBy.d.ts", - "sortedIndex.d.ts", - "sortedIndexBy.d.ts", - "sortedIndexOf.d.ts", - "sortedLastIndex.d.ts", - "sortedLastIndexBy.d.ts", - "sortedLastIndexOf.d.ts", - "sortedUniq.d.ts", - "sortedUniqBy.d.ts", - "split.d.ts", - "spread.d.ts", - "startCase.d.ts", - "startsWith.d.ts", - "subtract.d.ts", - "sum.d.ts", - "sumBy.d.ts", - "tail.d.ts", - "take.d.ts", - "takeRight.d.ts", - "takeRightWhile.d.ts", - "takeWhile.d.ts", - "tap.d.ts", - "template.d.ts", - "throttle.d.ts", - "thru.d.ts", - "times.d.ts", - "toArray.d.ts", - "toFinite.d.ts", - "toInteger.d.ts", - "toLength.d.ts", - "toLower.d.ts", - "toNumber.d.ts", - "toPairs.d.ts", - "toPairsIn.d.ts", - "toPath.d.ts", - "toPlainObject.d.ts", - "toSafeInteger.d.ts", - "toString.d.ts", - "toUpper.d.ts", - "transform.d.ts", - "trim.d.ts", - "trimEnd.d.ts", - "trimStart.d.ts", - "truncate.d.ts", - "unary.d.ts", - "unescape.d.ts", - "union.d.ts", - "unionBy.d.ts", - "unionWith.d.ts", - "uniq.d.ts", - "uniqBy.d.ts", - "uniqueId.d.ts", - "uniqWith.d.ts", - "unset.d.ts", - "unzip.d.ts", - "unzipWith.d.ts", - "update.d.ts", - "updateWith.d.ts", - "upperCase.d.ts", - "upperFirst.d.ts", - "values.d.ts", - "valuesIn.d.ts", - "without.d.ts", - "words.d.ts", - "wrap.d.ts", - "xor.d.ts", - "xorBy.d.ts", - "xorWith.d.ts", - "zip.d.ts", - "zipObject.d.ts", - "zipObjectDeep.d.ts", - "zipWith.d.ts", "common/array.d.ts", "common/collection.d.ts", "common/common.d.ts", @@ -330,392 +32,6 @@ "common/object.d.ts", "common/seq.d.ts", "common/string.d.ts", - "common/util.d.ts", - "fp/convert.d.ts", - "fp/add.d.ts", - "fp/after.d.ts", - "fp/all.d.ts", - "fp/allPass.d.ts", - "fp/always.d.ts", - "fp/any.d.ts", - "fp/anyPass.d.ts", - "fp/apply.d.ts", - "fp/ary.d.ts", - "fp/assign.d.ts", - "fp/assignAll.d.ts", - "fp/assignAllWith.d.ts", - "fp/assignIn.d.ts", - "fp/assignInAll.d.ts", - "fp/assignInAllWith.d.ts", - "fp/assignInWith.d.ts", - "fp/assignWith.d.ts", - "fp/assoc.d.ts", - "fp/assocPath.d.ts", - "fp/at.d.ts", - "fp/attempt.d.ts", - "fp/before.d.ts", - "fp/bind.d.ts", - "fp/bindAll.d.ts", - "fp/bindKey.d.ts", - "fp/camelCase.d.ts", - "fp/capitalize.d.ts", - "fp/castArray.d.ts", - "fp/ceil.d.ts", - "fp/chunk.d.ts", - "fp/clamp.d.ts", - "fp/clone.d.ts", - "fp/cloneDeep.d.ts", - "fp/cloneDeepWith.d.ts", - "fp/cloneWith.d.ts", - "fp/compact.d.ts", - "fp/complement.d.ts", - "fp/compose.d.ts", - "fp/concat.d.ts", - "fp/cond.d.ts", - "fp/conforms.d.ts", - "fp/conformsTo.d.ts", - "fp/constant.d.ts", - "fp/contains.d.ts", - "fp/countBy.d.ts", - "fp/create.d.ts", - "fp/curry.d.ts", - "fp/curryN.d.ts", - "fp/curryRight.d.ts", - "fp/curryRightN.d.ts", - "fp/debounce.d.ts", - "fp/deburr.d.ts", - "fp/defaults.d.ts", - "fp/defaultsAll.d.ts", - "fp/defaultsDeep.d.ts", - "fp/defaultsDeepAll.d.ts", - "fp/defaultTo.d.ts", - "fp/defer.d.ts", - "fp/delay.d.ts", - "fp/difference.d.ts", - "fp/differenceBy.d.ts", - "fp/differenceWith.d.ts", - "fp/dissoc.d.ts", - "fp/dissocPath.d.ts", - "fp/divide.d.ts", - "fp/drop.d.ts", - "fp/dropLast.d.ts", - "fp/dropLastWhile.d.ts", - "fp/dropRight.d.ts", - "fp/dropRightWhile.d.ts", - "fp/dropWhile.d.ts", - "fp/each.d.ts", - "fp/eachRight.d.ts", - "fp/endsWith.d.ts", - "fp/entries.d.ts", - "fp/entriesIn.d.ts", - "fp/eq.d.ts", - "fp/equals.d.ts", - "fp/escape.d.ts", - "fp/escapeRegExp.d.ts", - "fp/every.d.ts", - "fp/extend.d.ts", - "fp/extendAll.d.ts", - "fp/extendAllWith.d.ts", - "fp/extendWith.d.ts", - "fp/F.d.ts", - "fp/fill.d.ts", - "fp/filter.d.ts", - "fp/find.d.ts", - "fp/findFrom.d.ts", - "fp/findIndex.d.ts", - "fp/findIndexFrom.d.ts", - "fp/findKey.d.ts", - "fp/findLast.d.ts", - "fp/findLastFrom.d.ts", - "fp/findLastIndex.d.ts", - "fp/findLastIndexFrom.d.ts", - "fp/findLastKey.d.ts", - "fp/first.d.ts", - "fp/flatMap.d.ts", - "fp/flatMapDeep.d.ts", - "fp/flatMapDepth.d.ts", - "fp/flatten.d.ts", - "fp/flattenDeep.d.ts", - "fp/flattenDepth.d.ts", - "fp/flip.d.ts", - "fp/floor.d.ts", - "fp/flow.d.ts", - "fp/flowRight.d.ts", - "fp/forEach.d.ts", - "fp/forEachRight.d.ts", - "fp/forIn.d.ts", - "fp/forInRight.d.ts", - "fp/forOwn.d.ts", - "fp/forOwnRight.d.ts", - "fp/fromPairs.d.ts", - "fp/functions.d.ts", - "fp/functionsIn.d.ts", - "fp/get.d.ts", - "fp/getOr.d.ts", - "fp/groupBy.d.ts", - "fp/gt.d.ts", - "fp/gte.d.ts", - "fp/has.d.ts", - "fp/hasIn.d.ts", - "fp/head.d.ts", - "fp/identical.d.ts", - "fp/identity.d.ts", - "fp/includes.d.ts", - "fp/includesFrom.d.ts", - "fp/indexBy.d.ts", - "fp/indexOf.d.ts", - "fp/indexOfFrom.d.ts", - "fp/init.d.ts", - "fp/initial.d.ts", - "fp/inRange.d.ts", - "fp/intersection.d.ts", - "fp/intersectionBy.d.ts", - "fp/intersectionWith.d.ts", - "fp/invert.d.ts", - "fp/invertBy.d.ts", - "fp/invertObj.d.ts", - "fp/invoke.d.ts", - "fp/invokeArgs.d.ts", - "fp/invokeArgsMap.d.ts", - "fp/invokeMap.d.ts", - "fp/isArguments.d.ts", - "fp/isArray.d.ts", - "fp/isArrayBuffer.d.ts", - "fp/isArrayLike.d.ts", - "fp/isArrayLikeObject.d.ts", - "fp/isBoolean.d.ts", - "fp/isBuffer.d.ts", - "fp/isDate.d.ts", - "fp/isElement.d.ts", - "fp/isEmpty.d.ts", - "fp/isEqual.d.ts", - "fp/isEqualWith.d.ts", - "fp/isError.d.ts", - "fp/isFinite.d.ts", - "fp/isFunction.d.ts", - "fp/isInteger.d.ts", - "fp/isLength.d.ts", - "fp/isMap.d.ts", - "fp/isMatch.d.ts", - "fp/isMatchWith.d.ts", - "fp/isNaN.d.ts", - "fp/isNative.d.ts", - "fp/isNil.d.ts", - "fp/isNull.d.ts", - "fp/isNumber.d.ts", - "fp/isObject.d.ts", - "fp/isObjectLike.d.ts", - "fp/isPlainObject.d.ts", - "fp/isRegExp.d.ts", - "fp/isSafeInteger.d.ts", - "fp/isSet.d.ts", - "fp/isString.d.ts", - "fp/isSymbol.d.ts", - "fp/isTypedArray.d.ts", - "fp/isUndefined.d.ts", - "fp/isWeakMap.d.ts", - "fp/isWeakSet.d.ts", - "fp/iteratee.d.ts", - "fp/join.d.ts", - "fp/juxt.d.ts", - "fp/kebabCase.d.ts", - "fp/keyBy.d.ts", - "fp/keys.d.ts", - "fp/keysIn.d.ts", - "fp/last.d.ts", - "fp/lastIndexOf.d.ts", - "fp/lastIndexOfFrom.d.ts", - "fp/lowerCase.d.ts", - "fp/lowerFirst.d.ts", - "fp/lt.d.ts", - "fp/lte.d.ts", - "fp/map.d.ts", - "fp/mapKeys.d.ts", - "fp/mapValues.d.ts", - "fp/matches.d.ts", - "fp/matchesProperty.d.ts", - "fp/max.d.ts", - "fp/maxBy.d.ts", - "fp/mean.d.ts", - "fp/meanBy.d.ts", - "fp/memoize.d.ts", - "fp/merge.d.ts", - "fp/mergeAll.d.ts", - "fp/mergeAllWith.d.ts", - "fp/mergeWith.d.ts", - "fp/method.d.ts", - "fp/methodOf.d.ts", - "fp/min.d.ts", - "fp/minBy.d.ts", - "fp/multiply.d.ts", - "fp/nAry.d.ts", - "fp/negate.d.ts", - "fp/noConflict.d.ts", - "fp/noop.d.ts", - "fp/now.d.ts", - "fp/nth.d.ts", - "fp/nthArg.d.ts", - "fp/omit.d.ts", - "fp/omitAll.d.ts", - "fp/omitBy.d.ts", - "fp/once.d.ts", - "fp/orderBy.d.ts", - "fp/over.d.ts", - "fp/overArgs.d.ts", - "fp/overEvery.d.ts", - "fp/overSome.d.ts", - "fp/pad.d.ts", - "fp/padChars.d.ts", - "fp/padCharsEnd.d.ts", - "fp/padCharsStart.d.ts", - "fp/padEnd.d.ts", - "fp/padStart.d.ts", - "fp/parseInt.d.ts", - "fp/partial.d.ts", - "fp/partialRight.d.ts", - "fp/partition.d.ts", - "fp/path.d.ts", - "fp/pathEq.d.ts", - "fp/pathOr.d.ts", - "fp/paths.d.ts", - "fp/pick.d.ts", - "fp/pickAll.d.ts", - "fp/pickBy.d.ts", - "fp/pipe.d.ts", - "fp/pluck.d.ts", - "fp/prop.d.ts", - "fp/propEq.d.ts", - "fp/property.d.ts", - "fp/propertyOf.d.ts", - "fp/propOr.d.ts", - "fp/props.d.ts", - "fp/pull.d.ts", - "fp/pullAll.d.ts", - "fp/pullAllBy.d.ts", - "fp/pullAllWith.d.ts", - "fp/pullAt.d.ts", - "fp/random.d.ts", - "fp/range.d.ts", - "fp/rangeRight.d.ts", - "fp/rangeStep.d.ts", - "fp/rangeStepRight.d.ts", - "fp/rearg.d.ts", - "fp/reduce.d.ts", - "fp/reduceRight.d.ts", - "fp/reject.d.ts", - "fp/remove.d.ts", - "fp/repeat.d.ts", - "fp/replace.d.ts", - "fp/rest.d.ts", - "fp/restFrom.d.ts", - "fp/result.d.ts", - "fp/reverse.d.ts", - "fp/round.d.ts", - "fp/runInContext.d.ts", - "fp/sample.d.ts", - "fp/sampleSize.d.ts", - "fp/set.d.ts", - "fp/setWith.d.ts", - "fp/shuffle.d.ts", - "fp/size.d.ts", - "fp/slice.d.ts", - "fp/snakeCase.d.ts", - "fp/some.d.ts", - "fp/sortBy.d.ts", - "fp/sortedIndex.d.ts", - "fp/sortedIndexBy.d.ts", - "fp/sortedIndexOf.d.ts", - "fp/sortedLastIndex.d.ts", - "fp/sortedLastIndexBy.d.ts", - "fp/sortedLastIndexOf.d.ts", - "fp/sortedUniq.d.ts", - "fp/sortedUniqBy.d.ts", - "fp/split.d.ts", - "fp/spread.d.ts", - "fp/spreadFrom.d.ts", - "fp/startCase.d.ts", - "fp/startsWith.d.ts", - "fp/stubArray.d.ts", - "fp/stubFalse.d.ts", - "fp/stubObject.d.ts", - "fp/stubString.d.ts", - "fp/stubTrue.d.ts", - "fp/subtract.d.ts", - "fp/sum.d.ts", - "fp/sumBy.d.ts", - "fp/symmetricDifference.d.ts", - "fp/symmetricDifferenceBy.d.ts", - "fp/symmetricDifferenceWith.d.ts", - "fp/T.d.ts", - "fp/tail.d.ts", - "fp/take.d.ts", - "fp/takeLast.d.ts", - "fp/takeLastWhile.d.ts", - "fp/takeRight.d.ts", - "fp/takeRightWhile.d.ts", - "fp/takeWhile.d.ts", - "fp/tap.d.ts", - "fp/template.d.ts", - "fp/throttle.d.ts", - "fp/thru.d.ts", - "fp/times.d.ts", - "fp/toArray.d.ts", - "fp/toFinite.d.ts", - "fp/toInteger.d.ts", - "fp/toLength.d.ts", - "fp/toLower.d.ts", - "fp/toNumber.d.ts", - "fp/toPairs.d.ts", - "fp/toPairsIn.d.ts", - "fp/toPath.d.ts", - "fp/toPlainObject.d.ts", - "fp/toSafeInteger.d.ts", - "fp/toString.d.ts", - "fp/toUpper.d.ts", - "fp/transform.d.ts", - "fp/trim.d.ts", - "fp/trimChars.d.ts", - "fp/trimCharsEnd.d.ts", - "fp/trimCharsStart.d.ts", - "fp/trimEnd.d.ts", - "fp/trimStart.d.ts", - "fp/truncate.d.ts", - "fp/unapply.d.ts", - "fp/unary.d.ts", - "fp/unescape.d.ts", - "fp/union.d.ts", - "fp/unionBy.d.ts", - "fp/unionWith.d.ts", - "fp/uniq.d.ts", - "fp/uniqBy.d.ts", - "fp/uniqueId.d.ts", - "fp/uniqWith.d.ts", - "fp/unnest.d.ts", - "fp/unset.d.ts", - "fp/unzip.d.ts", - "fp/unzipWith.d.ts", - "fp/update.d.ts", - "fp/updateWith.d.ts", - "fp/upperCase.d.ts", - "fp/upperFirst.d.ts", - "fp/useWith.d.ts", - "fp/values.d.ts", - "fp/valuesIn.d.ts", - "fp/where.d.ts", - "fp/whereEq.d.ts", - "fp/without.d.ts", - "fp/words.d.ts", - "fp/wrap.d.ts", - "fp/xor.d.ts", - "fp/xorBy.d.ts", - "fp/xorWith.d.ts", - "fp/zip.d.ts", - "fp/zipAll.d.ts", - "fp/zipObj.d.ts", - "fp/zipObject.d.ts", - "fp/zipObjectDeep.d.ts", - "fp/zipWith.d.ts", - "fp/__.d.ts", - "fp/placeholder.d.ts" + "common/util.d.ts" ] } \ No newline at end of file diff --git a/types/lowdb/_lodash.d.ts b/types/lowdb/_lodash.d.ts index 982826fe5b..a7d2c424f0 100644 --- a/types/lowdb/_lodash.d.ts +++ b/types/lowdb/_lodash.d.ts @@ -127,7 +127,7 @@ declare module "./index" { first(this: LoDashExplicitSyncWrapper<_.List | null | undefined>): LoDashExplicitSyncWrapper; flatten(this: LoDashExplicitSyncWrapper<_.List<_.Many> | null | undefined>): LoDashExplicitSyncWrapper; flattenDeep(this: LoDashExplicitSyncWrapper<_.ListOfRecursiveArraysOrValues | null | undefined>): LoDashExplicitSyncWrapper; - flattenDepth(this: LoDashExplicitSyncWrapper<_.ListOfRecursiveArraysOrValues | null | undefined>, depth?: number): LoDashExplicitSyncWrapper; + flattenDepth(this: LoDashExplicitSyncWrapper<_.ListOfRecursiveArraysOrValues | null | undefined>, depth?: number): LoDashExplicitSyncWrapper; fromPairs( this: LoDashExplicitSyncWrapper<_.List<[_.PropertyName, T]> | null | undefined> ): LoDashExplicitSyncWrapper<_.Dictionary>; @@ -1695,7 +1695,7 @@ declare module "./index" { first(this: LoDashExplicitAsyncWrapper<_.List | null | undefined>): LoDashExplicitAsyncWrapper; flatten(this: LoDashExplicitAsyncWrapper<_.List<_.Many> | null | undefined>): LoDashExplicitAsyncWrapper; flattenDeep(this: LoDashExplicitAsyncWrapper<_.ListOfRecursiveArraysOrValues | null | undefined>): LoDashExplicitAsyncWrapper; - flattenDepth(this: LoDashExplicitAsyncWrapper<_.ListOfRecursiveArraysOrValues | null | undefined>, depth?: number): LoDashExplicitAsyncWrapper; + flattenDepth(this: LoDashExplicitAsyncWrapper<_.ListOfRecursiveArraysOrValues | null | undefined>, depth?: number): LoDashExplicitAsyncWrapper; fromPairs( this: LoDashExplicitAsyncWrapper<_.List<[_.PropertyName, T]> | null | undefined> ): LoDashExplicitAsyncWrapper<_.Dictionary>; From 79b40511a06e9e4079808147630cdb2bca3ebc33 Mon Sep 17 00:00:00 2001 From: AJ Richardson Date: Sat, 12 May 2018 10:13:44 -0400 Subject: [PATCH 067/575] Trim down tests to avoid memory error --- types/lodash/lodash-tests.ts | 810 ++++++++++++----------------------- types/lodash/tsconfig.json | 686 ++++++++++++++++++++++++++++- 2 files changed, 956 insertions(+), 540 deletions(-) diff --git a/types/lodash/lodash-tests.ts b/types/lodash/lodash-tests.ts index 52514f16f1..88a5a88bfc 100644 --- a/types/lodash/lodash-tests.ts +++ b/types/lodash/lodash-tests.ts @@ -9,6 +9,20 @@ interface AbcObject { c: boolean; } +const abcObject: AbcObject = anything; +const array: AbcObject[] | null | undefined = anything; +const list: _.List | null | undefined = anything; +const dictionary: _.Dictionary | null | undefined = anything; +const numericDictionary: _.NumericDictionary | null | undefined = anything; +const arrayParam: AbcObject[] = []; +const listParam: _.List = []; +const comparator = (a: AbcObject, b: AbcObject) => true; +const listIterator = (value: AbcObject, index: number, collection: _.List) => true; +const dictionaryIterator = (value: AbcObject, key: string, collection: _.Dictionary) => true; +const numericDictionaryIterator = (value: AbcObject, key: string, collection: _.NumericDictionary) => true; +const valueIterator = (value: AbcObject) => true; +const stringIterator = (value: string) => ""; + // Wrapped array shortcut methods _([1, 2, 3, 4]).pop(); // $ExpectType number | undefined _([1, 2, 3, 4]).push(5, 6, 7); // $ExpectType LoDashImplicitWrapper @@ -32,8 +46,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - _.chunk(list); // $ExpectType AbcObject[][] _.chunk(list, 42); // $ExpectType AbcObject[][] @@ -60,10 +72,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const arrayParam: AbcObject[] = []; - const listParam: _.List = []; - _.difference(list); // $ExpectType AbcObject[] _.difference(list, listParam); // $ExpectType AbcObject[] _.difference(list, listParam, arrayParam, listParam); // $ExpectType AbcObject[] @@ -82,19 +90,14 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const arrayParam: AbcObject[] = []; - const listParam: _.List = []; - const iteratee = (value: AbcObject) => 1; - _.differenceBy(list); // $ExpectType AbcObject[] _.differenceBy(list, listParam); // $ExpectType AbcObject[] _.differenceBy(list, arrayParam, listParam, arrayParam, listParam, arrayParam, listParam); // $ExpectType AbcObject[] - _.differenceBy(list, listParam, iteratee); // $ExpectType AbcObject[] - _.differenceBy(list, listParam, arrayParam, listParam, arrayParam, listParam, iteratee); // $ExpectType AbcObject[] + _.differenceBy(list, listParam, valueIterator); // $ExpectType AbcObject[] + _.differenceBy(list, listParam, arrayParam, listParam, arrayParam, listParam, valueIterator); // $ExpectType AbcObject[] // $ExpectType AbcObject[] - _.differenceBy(list, arrayParam, listParam, arrayParam, listParam, arrayParam, listParam, iteratee); + _.differenceBy(list, arrayParam, listParam, arrayParam, listParam, arrayParam, listParam, valueIterator); _.differenceBy(list, listParam, "a"); // $ExpectType AbcObject[] _.differenceBy(list, listParam, arrayParam, listParam, arrayParam, listParam, "a"); // $ExpectType AbcObject[] @@ -109,10 +112,10 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper _(list).differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, listParam); // $ExpectType LoDashImplicitWrapper - _(list).differenceBy(listParam, iteratee); // $ExpectType LoDashImplicitWrapper - _(list).differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, iteratee); // $ExpectType LoDashImplicitWrapper + _(list).differenceBy(listParam, valueIterator); // $ExpectType LoDashImplicitWrapper + _(list).differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, valueIterator); // $ExpectType LoDashImplicitWrapper // $ExpectType LoDashImplicitWrapper - _(list).differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, listParam, iteratee); + _(list).differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, listParam, valueIterator); _(list).differenceBy(listParam, "a"); // $ExpectType LoDashImplicitWrapper _(list).differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, "a"); // $ExpectType LoDashImplicitWrapper @@ -127,10 +130,10 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper _.chain(list).differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam); // $ExpectType LoDashExplicitWrapper - _.chain(list).differenceBy(arrayParam, iteratee); // $ExpectType LoDashExplicitWrapper - _.chain(list).differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, iteratee); // $ExpectType LoDashExplicitWrapper + _.chain(list).differenceBy(arrayParam, valueIterator); // $ExpectType LoDashExplicitWrapper + _.chain(list).differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, valueIterator); // $ExpectType LoDashExplicitWrapper // $ExpectType LoDashExplicitWrapper - _.chain(list).differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam, iteratee); + _.chain(list).differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam, valueIterator); _.chain(list).differenceBy(arrayParam, "a"); // $ExpectType LoDashExplicitWrapper _.chain(list).differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, "a"); // $ExpectType LoDashExplicitWrapper @@ -142,8 +145,8 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper _.chain(list).differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam, {a: 1}); - fp.differenceBy(iteratee, list, arrayParam); // $ExpectType AbcObject[] - fp.differenceBy(iteratee)(list)(listParam); // $ExpectType AbcObject[] + fp.differenceBy(valueIterator, list, arrayParam); // $ExpectType AbcObject[] + fp.differenceBy(valueIterator)(list)(listParam); // $ExpectType AbcObject[] fp.differenceBy("a", list, arrayParam); // $ExpectType AbcObject[] fp.differenceBy({a: 1}, list, arrayParam); // $ExpectType AbcObject[] @@ -188,21 +191,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper { - value; // $ExpectType T1 | T2 | T3 - return 0; - }); - // $ExpectType T1[] - _.differenceBy([t1], [t2], [t3], [t4], (value) => { - value; // $ExpectType T1 | T2 | T3 | T4 - return 0; - }); - // $ExpectType T1[] - _.differenceBy([t1], [t2], [t3], [t4], [""], (value) => { - value; // $ExpectType string | T1 | T2 | T3 | T4 - return 0; - }); - // $ExpectType T1[] _.differenceBy([t1], [t2], [t3], [t4], [""], [42], (value) => { value; // $ExpectType string | number | T1 | T2 | T3 | T4 return 0; @@ -226,21 +214,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper - _([t1]).differenceBy([t2], [t3], (value) => { - value; // $ExpectType T1 | T2 | T3 - return 0; - }); - // $ExpectType LoDashImplicitWrapper - _([t1]).differenceBy([t2], [t3], [t4], (value) => { - value; // $ExpectType T1 | T2 | T3 | T4 - return 0; - }); - // $ExpectType LoDashImplicitWrapper - _([t1]).differenceBy([t2], [t3], [t4], [""], (value) => { - value; // $ExpectType string | T1 | T2 | T3 | T4 - return 0; - }); - // $ExpectType LoDashImplicitWrapper _([t1]).differenceBy([t2], [t3], [t4], [""], [42], (value) => { value; // $ExpectType string | number | T1 | T2 | T3 | T4 return 0; @@ -264,21 +237,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper - _.chain([t1]).differenceBy([t2], [t3], (value) => { - value; // $ExpectType T1 | T2 | T3 - return 0; - }); - // $ExpectType LoDashExplicitWrapper - _.chain([t1]).differenceBy([t2], [t3], [t4], (value) => { - value; // $ExpectType T1 | T2 | T3 | T4 - return 0; - }); - // $ExpectType LoDashExplicitWrapper - _.chain([t1]).differenceBy([t2], [t3], [t4], [""], (value) => { - value; // $ExpectType string | T1 | T2 | T3 | T4 - return 0; - }); - // $ExpectType LoDashExplicitWrapper _.chain([t1]).differenceBy([t2], [t3], [t4], [""], [42], (value) => { value; // $ExpectType string | number | T1 | T2 | T3 | T4 return 0; @@ -292,24 +250,13 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = [] as any; - const arrayParam: AbcObject[] = []; - const listParam: _.List = []; - const comparator = (a: AbcObject, b: AbcObject) => true; - _.differenceWith(list); // $ExpectType AbcObject[] - _.differenceWith(list, arrayParam); // $ExpectType AbcObject[] - _.differenceWith(list, listParam, arrayParam, listParam, arrayParam, listParam, arrayParam); // $ExpectType AbcObject[] _.differenceWith(list, arrayParam, comparator); // $ExpectType AbcObject[] _.differenceWith(list, listParam, arrayParam, listParam, arrayParam, listParam, arrayParam, comparator); // $ExpectType AbcObject[] - _(list).differenceWith(arrayParam); // $ExpectType LoDashImplicitWrapper - _(list).differenceWith(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam); // $ExpectType LoDashImplicitWrapper _(list).differenceWith(arrayParam, comparator); // $ExpectType LoDashImplicitWrapper _(list).differenceWith(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam, comparator); // $ExpectType LoDashImplicitWrapper - _.chain(list).differenceWith(arrayParam); // $ExpectType LoDashExplicitWrapper - _.chain(list).differenceWith(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam); // $ExpectType LoDashExplicitWrapper _.chain(list).differenceWith(arrayParam, comparator); // $ExpectType LoDashExplicitWrapper _.chain(list).differenceWith(listParam, arrayParam, listParam, arrayParam, listParam, arrayParam, comparator); // $ExpectType LoDashExplicitWrapper @@ -359,8 +306,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - _.drop(list); // $ExpectType AbcObject[] _.drop(list, 42); // $ExpectType AbcObject[] _(list).drop(42); // $ExpectType LoDashImplicitWrapper @@ -381,145 +326,132 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const predicateFn = (value: AbcObject, index: number, collection: _.List) => true; - const predicateFn2 = (value: AbcObject) => true; - _.dropWhile(list); // $ExpectType AbcObject[] - _.dropWhile(list, predicateFn); // $ExpectType AbcObject[] + _.dropWhile(list, listIterator); // $ExpectType AbcObject[] _.dropWhile(list, ""); // $ExpectType AbcObject[] _.dropWhile(list, {a: 42}); // $ExpectType AbcObject[] _(list).dropWhile(); // $ExpectType LoDashImplicitWrapper - _(list).dropWhile(predicateFn); // $ExpectType LoDashImplicitWrapper + _(list).dropWhile(listIterator); // $ExpectType LoDashImplicitWrapper _(list).dropWhile(""); // $ExpectType LoDashImplicitWrapper _(list).dropWhile({a: 42}); // $ExpectType LoDashImplicitWrapper _.chain(list).dropWhile(); // $ExpectType LoDashExplicitWrapper - _.chain(list).dropWhile(predicateFn); // $ExpectType LoDashExplicitWrapper + _.chain(list).dropWhile(listIterator); // $ExpectType LoDashExplicitWrapper _.chain(list).dropWhile(""); // $ExpectType LoDashExplicitWrapper _.chain(list).dropWhile({a: 42}); // $ExpectType LoDashExplicitWrapper - fp.dropWhile(predicateFn2, list); // $ExpectType AbcObject[] - fp.dropWhile(predicateFn2)(list); // $ExpectType AbcObject[] + fp.dropWhile(valueIterator, list); // $ExpectType AbcObject[] + fp.dropWhile(valueIterator)(list); // $ExpectType AbcObject[] fp.dropWhile("", list); // $ExpectType AbcObject[] fp.dropWhile({ a: 42 }, list); // $ExpectType AbcObject[] _.dropRightWhile(list); // $ExpectType AbcObject[] - _.dropRightWhile(list, predicateFn); // $ExpectType AbcObject[] + _.dropRightWhile(list, listIterator); // $ExpectType AbcObject[] _.dropRightWhile(list, ""); // $ExpectType AbcObject[] _.dropRightWhile(list, {a: 42}); // $ExpectType AbcObject[] _(list).dropRightWhile(); // $ExpectType LoDashImplicitWrapper - _(list).dropRightWhile(predicateFn); // $ExpectType LoDashImplicitWrapper + _(list).dropRightWhile(listIterator); // $ExpectType LoDashImplicitWrapper _(list).dropRightWhile(""); // $ExpectType LoDashImplicitWrapper _(list).dropRightWhile({a: 42}); // $ExpectType LoDashImplicitWrapper _.chain(list).dropRightWhile(); // $ExpectType LoDashExplicitWrapper - _.chain(list).dropRightWhile(predicateFn); // $ExpectType LoDashExplicitWrapper + _.chain(list).dropRightWhile(listIterator); // $ExpectType LoDashExplicitWrapper _.chain(list).dropRightWhile(""); // $ExpectType LoDashExplicitWrapper _.chain(list).dropRightWhile({a: 42}); // $ExpectType LoDashExplicitWrapper - fp.dropRightWhile(predicateFn2, list); // $ExpectType AbcObject[] - fp.dropRightWhile(predicateFn2)(list); // $ExpectType AbcObject[] + fp.dropRightWhile(valueIterator, list); // $ExpectType AbcObject[] + fp.dropRightWhile(valueIterator)(list); // $ExpectType AbcObject[] fp.dropRightWhile("", list); // $ExpectType AbcObject[] fp.dropRightWhile({ a: 42 }, list); // $ExpectType AbcObject[] } // _.fill { - const array: number[] | null | undefined = anything; - const list: _.List | null | undefined = anything; + _.fill(array, abcObject); // $ExpectType AbcObject[] + _.fill(array, abcObject, 0); // $ExpectType AbcObject[] + _.fill(array, abcObject, 0, 10); // $ExpectType AbcObject[] - _.fill(array, 42); // $ExpectType number[] - _.fill(array, 42, 0); // $ExpectType number[] - _.fill(array, 42, 0, 10); // $ExpectType number[] + _.fill(list, abcObject); // $ExpectType ArrayLike + _.fill(list, abcObject, 0); // $ExpectType ArrayLike + _.fill(list, abcObject, 0, 10); // $ExpectType ArrayLike - _.fill(list, 42); // $ExpectType ArrayLike - _.fill(list, 42, 0); // $ExpectType ArrayLike - _.fill(list, 42, 0, 10); // $ExpectType ArrayLike + _(list).fill(abcObject); // $ExpectType LoDashImplicitWrapper> + _(list).fill(abcObject, 0); // $ExpectType LoDashImplicitWrapper> + _(list).fill(abcObject, 0, 10); // $ExpectType LoDashImplicitWrapper> - _(list).fill(42); // $ExpectType LoDashImplicitWrapper> - _(list).fill(42, 0); // $ExpectType LoDashImplicitWrapper> - _(list).fill(42, 0, 10); // $ExpectType LoDashImplicitWrapper> + _.chain(list).fill(abcObject); // $ExpectType LoDashExplicitWrapper> + _.chain(list).fill(abcObject, 0); // $ExpectType LoDashExplicitWrapper> + _.chain(list).fill(abcObject, 0, 10); // $ExpectType LoDashExplicitWrapper> - _.chain(list).fill(42); // $ExpectType LoDashExplicitWrapper> - _.chain(list).fill(42, 0); // $ExpectType LoDashExplicitWrapper> - _.chain(list).fill(42, 0, 10); // $ExpectType LoDashExplicitWrapper> - - fp.fill(0, 10, 42, array); // $ExpectType number[] - fp.fill(0)(10)(42)(array); // $ExpectType number[] - fp.fill(0, 10, 42, list); // $ExpectType ArrayLike + fp.fill(0, 10, abcObject, array); // $ExpectType AbcObject[] + fp.fill(0)(10)(abcObject)(array); // $ExpectType AbcObject[] + fp.fill(0, 10, abcObject, list); // $ExpectType ArrayLike } // _.findIndex // _.findLastIndex { - const list: _.List | null | undefined = anything; - const predicateFn = (value: AbcObject, index: number, collection: _.List) => true; - const predicateFn2 = (value: AbcObject) => true; - _.findIndex(list); // $ExpectType number - _.findIndex(list, predicateFn); // $ExpectType number + _.findIndex(list, listIterator); // $ExpectType number _.findIndex(list, ""); // $ExpectType number _.findIndex(list, {a: 42}); // $ExpectType number - _.findIndex(list, predicateFn, 1); // $ExpectType number + _.findIndex(list, listIterator, 1); // $ExpectType number _(list).findIndex(); // $ExpectType number - _(list).findIndex(predicateFn); // $ExpectType number + _(list).findIndex(listIterator); // $ExpectType number _(list).findIndex(""); // $ExpectType number _(list).findIndex<{a: number}>({a: 42}); // $ExpectType number - _(list).findIndex(predicateFn, 1); // $ExpectType number + _(list).findIndex(listIterator, 1); // $ExpectType number _.chain(list).findIndex(); // $ExpectType LoDashExplicitWrapper - _.chain(list).findIndex(predicateFn); // $ExpectType LoDashExplicitWrapper + _.chain(list).findIndex(listIterator); // $ExpectType LoDashExplicitWrapper _.chain(list).findIndex(""); // $ExpectType LoDashExplicitWrapper _.chain(list).findIndex<{a: number}>({a: 42}); // $ExpectType LoDashExplicitWrapper - _.chain(list).findIndex(predicateFn, 1); // $ExpectType LoDashExplicitWrapper + _.chain(list).findIndex(listIterator, 1); // $ExpectType LoDashExplicitWrapper - fp.findIndex(predicateFn2, list); // $ExpectType number - fp.findIndex(predicateFn2)(list); // $ExpectType number + fp.findIndex(valueIterator, list); // $ExpectType number + fp.findIndex(valueIterator)(list); // $ExpectType number fp.findIndex("", list); // $ExpectType number fp.findIndex({ a: 42 }, list); // $ExpectType number - fp.findIndexFrom(predicateFn2, 1, list); // $ExpectType number - fp.findIndexFrom(predicateFn2)(1)(list); // $ExpectType number + fp.findIndexFrom(valueIterator, 1, list); // $ExpectType number + fp.findIndexFrom(valueIterator)(1)(list); // $ExpectType number fp.findIndexFrom("", 1, list); // $ExpectType number fp.findIndexFrom({ a: 42 }, 1, list); // $ExpectType number _.findLastIndex(list); // $ExpectType number - _.findLastIndex(list, predicateFn); // $ExpectType number + _.findLastIndex(list, listIterator); // $ExpectType number _.findLastIndex(list, ""); // $ExpectType number _.findLastIndex(list, {a: 42}); // $ExpectType number - _.findLastIndex(list, predicateFn, 1); // $ExpectType number + _.findLastIndex(list, listIterator, 1); // $ExpectType number _(list).findLastIndex(); // $ExpectType number - _(list).findLastIndex(predicateFn); // $ExpectType number + _(list).findLastIndex(listIterator); // $ExpectType number _(list).findLastIndex(""); // $ExpectType number _(list).findLastIndex<{a: number}>({a: 42}); // $ExpectType number - _(list).findLastIndex(predicateFn, 1); // $ExpectType number + _(list).findLastIndex(listIterator, 1); // $ExpectType number _.chain(list).findLastIndex(); // $ExpectType LoDashExplicitWrapper - _.chain(list).findLastIndex(predicateFn); // $ExpectType LoDashExplicitWrapper + _.chain(list).findLastIndex(listIterator); // $ExpectType LoDashExplicitWrapper _.chain(list).findLastIndex(""); // $ExpectType LoDashExplicitWrapper _.chain(list).findLastIndex<{a: number}>({a: 42}); // $ExpectType LoDashExplicitWrapper - _.chain(list).findLastIndex(predicateFn, 1); // $ExpectType LoDashExplicitWrapper + _.chain(list).findLastIndex(listIterator, 1); // $ExpectType LoDashExplicitWrapper - fp.findLastIndex(predicateFn2, list); // $ExpectType number - fp.findLastIndex(predicateFn2)(list); // $ExpectType number + fp.findLastIndex(valueIterator, list); // $ExpectType number + fp.findLastIndex(valueIterator)(list); // $ExpectType number fp.findLastIndex("", list); // $ExpectType number fp.findLastIndex({ a: 42 }, list); // $ExpectType number - fp.findLastIndexFrom(predicateFn2, 1, list); // $ExpectType number - fp.findLastIndexFrom(predicateFn2)(1)(list); // $ExpectType number + fp.findLastIndexFrom(valueIterator, 1, list); // $ExpectType number + fp.findLastIndexFrom(valueIterator)(1)(list); // $ExpectType number fp.findLastIndexFrom("", 1, list); // $ExpectType number fp.findLastIndexFrom({ a: 42 }, 1, list); // $ExpectType number } // _.first { - const list: _.List | null | undefined = anything; - _.first("abc"); // $ExpectType string | undefined _.first(list); // $ExpectType AbcObject | undefined @@ -590,8 +522,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - _.head("abc"); // $ExpectType string | undefined _.head(list); // $ExpectType AbcObject | undefined @@ -610,46 +540,41 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const value: AbcObject = { a: 1, b: "", c: true }; + _.indexOf(list, abcObject); // $ExpectType number + _.indexOf(list, abcObject, 42); // $ExpectType number + _(list).indexOf(abcObject); // $ExpectType number + _(list).indexOf(abcObject, 42); // $ExpectType number + _.chain(list).indexOf(abcObject); // $ExpectType LoDashExplicitWrapper + _.chain(list).indexOf(abcObject, 42); // $ExpectType LoDashExplicitWrapper + fp.indexOf(abcObject, list); // $ExpectType number + fp.indexOf(abcObject)(list); // $ExpectType number + fp.indexOfFrom(abcObject)(42)(list); // $ExpectType number - _.indexOf(list, value); // $ExpectType number - _.indexOf(list, value, 42); // $ExpectType number - _(list).indexOf(value); // $ExpectType number - _(list).indexOf(value, 42); // $ExpectType number - _.chain(list).indexOf(value); // $ExpectType LoDashExplicitWrapper - _.chain(list).indexOf(value, 42); // $ExpectType LoDashExplicitWrapper - fp.indexOf(value, list); // $ExpectType number - fp.indexOf(value)(list); // $ExpectType number - fp.indexOfFrom(value)(42)(list); // $ExpectType number + _.lastIndexOf(list, abcObject); // $ExpectType number + _.lastIndexOf(list, abcObject, 42); // $ExpectType number + _(list).lastIndexOf(abcObject); // $ExpectType number + _(list).lastIndexOf(abcObject, 42); // $ExpectType number + _.chain(list).lastIndexOf(abcObject); // $ExpectType LoDashExplicitWrapper + _.chain(list).lastIndexOf(abcObject, 42); // $ExpectType LoDashExplicitWrapper + fp.lastIndexOf(abcObject, list); // $ExpectType number + fp.lastIndexOf(abcObject)(list); // $ExpectType number + fp.lastIndexOfFrom(abcObject)(42)(list); // $ExpectType number - _.lastIndexOf(list, value); // $ExpectType number - _.lastIndexOf(list, value, 42); // $ExpectType number - _(list).lastIndexOf(value); // $ExpectType number - _(list).lastIndexOf(value, 42); // $ExpectType number - _.chain(list).lastIndexOf(value); // $ExpectType LoDashExplicitWrapper - _.chain(list).lastIndexOf(value, 42); // $ExpectType LoDashExplicitWrapper - fp.lastIndexOf(value, list); // $ExpectType number - fp.lastIndexOf(value)(list); // $ExpectType number - fp.lastIndexOfFrom(value)(42)(list); // $ExpectType number + _.sortedIndexOf(list, abcObject); // $ExpectType number + _(list).sortedIndexOf(abcObject); // $ExpectType number + _.chain(list).indexOf(abcObject); // $ExpectType LoDashExplicitWrapper + fp.sortedIndexOf(abcObject, list); // $ExpectType number + fp.sortedIndexOf(abcObject)(list); // $ExpectType number - _.sortedIndexOf(list, value); // $ExpectType number - _(list).sortedIndexOf(value); // $ExpectType number - _.chain(list).indexOf(value); // $ExpectType LoDashExplicitWrapper - fp.sortedIndexOf(value, list); // $ExpectType number - fp.sortedIndexOf(value)(list); // $ExpectType number - - _.sortedLastIndexOf(list, value); // $ExpectType number - _(list).sortedLastIndexOf(value); // $ExpectType number - _.chain(list).sortedLastIndexOf(value); // $ExpectType LoDashExplicitWrapper - fp.sortedLastIndexOf(value, list); // $ExpectType number - fp.sortedLastIndexOf(value)(list); // $ExpectType number + _.sortedLastIndexOf(list, abcObject); // $ExpectType number + _(list).sortedLastIndexOf(abcObject); // $ExpectType number + _.chain(list).sortedLastIndexOf(abcObject); // $ExpectType LoDashExplicitWrapper + fp.sortedLastIndexOf(abcObject, list); // $ExpectType number + fp.sortedLastIndexOf(abcObject)(list); // $ExpectType number } // _.initial { - const list: _.List | null | undefined = anything; - _.initial(list); // $ExpectType AbcObject[] _(list).initial(); // $ExpectType LoDashImplicitWrapper _.chain(list).initial(); // $ExpectType LoDashExplicitWrapper @@ -840,8 +765,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - _.last("abc"); // $ExpectType string | undefined _.last(list); // $ExpectType AbcObject | undefined @@ -857,8 +780,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - _.nth(list, 42); // $ExpectType AbcObject | undefined _(list).nth(42); // $ExpectType AbcObject | undefined _.chain(list).nth(42); // $ExpectType LoDashExplicitWrapper @@ -871,32 +792,30 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper = []; - const value: AbcObject = { a: 1, b: "", c: true }; _.pull(array); // $ExpectType AbcObject[] - _.pull(array, value); // $ExpectType AbcObject[] - _.pull(array, value, value, value); // $ExpectType AbcObject[] + _.pull(array, abcObject); // $ExpectType AbcObject[] + _.pull(array, abcObject, abcObject, abcObject); // $ExpectType AbcObject[] _.pull(list); // $ExpectType ArrayLike - _.pull(list, value); // $ExpectType ArrayLike - _.pull(list, value, value, value); // $ExpectType ArrayLike + _.pull(list, abcObject); // $ExpectType ArrayLike + _.pull(list, abcObject, abcObject, abcObject); // $ExpectType ArrayLike _(array).pull(); // $ExpectType LoDashImplicitWrapper - _(array).pull(value); // $ExpectType LoDashImplicitWrapper - _(array).pull(value, value, value); // $ExpectType LoDashImplicitWrapper + _(array).pull(abcObject); // $ExpectType LoDashImplicitWrapper + _(array).pull(abcObject, abcObject, abcObject); // $ExpectType LoDashImplicitWrapper _(list).pull(); // $ExpectType LoDashImplicitWrapper> - _(list).pull(value); // $ExpectType LoDashImplicitWrapper> - _(list).pull(value, value, value); // $ExpectType LoDashImplicitWrapper> + _(list).pull(abcObject); // $ExpectType LoDashImplicitWrapper> + _(list).pull(abcObject, abcObject, abcObject); // $ExpectType LoDashImplicitWrapper> _.chain(array).pull(); // $ExpectType LoDashExplicitWrapper - _.chain(array).pull(value); // $ExpectType LoDashExplicitWrapper - _.chain(array).pull(value, value, value); // $ExpectType LoDashExplicitWrapper + _.chain(array).pull(abcObject); // $ExpectType LoDashExplicitWrapper + _.chain(array).pull(abcObject, abcObject, abcObject); // $ExpectType LoDashExplicitWrapper _.chain(list).pull(); // $ExpectType LoDashExplicitWrapper> - _.chain(list).pull(value); // $ExpectType LoDashExplicitWrapper> - _.chain(list).pull(value, value, value); // $ExpectType LoDashExplicitWrapper> + _.chain(list).pull(abcObject); // $ExpectType LoDashExplicitWrapper> + _.chain(list).pull(abcObject, abcObject, abcObject); // $ExpectType LoDashExplicitWrapper> - fp.pull(value, array); // $ExpectType AbcObject[] - fp.pull(value, list); // $ExpectType ArrayLike - fp.pull(value)(list); // $ExpectType ArrayLike + fp.pull(abcObject, array); // $ExpectType AbcObject[] + fp.pull(abcObject)(list); // $ExpectType ArrayLike } // _.pullAt @@ -1137,34 +1056,30 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper = []; - const predicateFn = (value: AbcObject, index: number, collection: _.List) => true; _.remove(list); // $ExpectType AbcObject[] - _.remove(list, predicateFn); // $ExpectType AbcObject[] + _.remove(list, listIterator); // $ExpectType AbcObject[] _.remove(list, ""); // $ExpectType AbcObject[] _.remove(list, { a: 42 }); // $ExpectType AbcObject[] _(list).remove(); // $ExpectType LoDashImplicitWrapper - _(list).remove(predicateFn); // $ExpectType LoDashImplicitWrapper + _(list).remove(listIterator); // $ExpectType LoDashImplicitWrapper _(list).remove(""); // $ExpectType LoDashImplicitWrapper _(list).remove({ a: 42 }); // $ExpectType LoDashImplicitWrapper _.chain(list).remove(); // $ExpectType LoDashExplicitWrapper - _.chain(list).remove(predicateFn); // $ExpectType LoDashExplicitWrapper + _.chain(list).remove(listIterator); // $ExpectType LoDashExplicitWrapper _.chain(list).remove(""); // $ExpectType LoDashExplicitWrapper _.chain(list).remove({ a: 42 }); // $ExpectType LoDashExplicitWrapper - const predicateFn2 = (value: AbcObject) => true; - fp.remove(predicateFn2, list); // $ExpectType AbcObject[] - fp.remove(predicateFn2)(list); // $ExpectType AbcObject[] + fp.remove(valueIterator, list); // $ExpectType AbcObject[] + fp.remove(valueIterator)(list); // $ExpectType AbcObject[] fp.remove("", list); // $ExpectType AbcObject[] fp.remove({ a: 42 }, list); // $ExpectType AbcObject[] } // _.tail { - const list: _.List | null | undefined = anything; - _.tail(list); // $ExpectType AbcObject[] _(list).tail(); // $ExpectType LoDashImplicitWrapper _.chain(list).tail(); // $ExpectType LoDashExplicitWrapper @@ -1173,8 +1088,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const value: AbcObject = { a: 1, b: "", c: true }; - const listIterator = (value: AbcObject) => 0; + _.sortedIndexBy(list, abcObject, valueIterator); // $ExpectType number + _.sortedIndexBy(list, abcObject, ""); // $ExpectType number + _.sortedIndexBy(list, abcObject, { a: 42 }); // $ExpectType number + _(list).sortedIndexBy(abcObject, valueIterator); // $ExpectType number + _(list).sortedIndexBy(abcObject, ""); // $ExpectType number + _(list).sortedIndexBy(abcObject, { a: 42 }); // $ExpectType number + _.chain(list).sortedIndexBy(abcObject, valueIterator); // $ExpectType LoDashExplicitWrapper + _.chain(list).sortedIndexBy(abcObject, ""); // $ExpectType LoDashExplicitWrapper + _.chain(list).sortedIndexBy(abcObject, { a: 42 }); // $ExpectType LoDashExplicitWrapper + fp.sortedIndexBy(valueIterator, abcObject, list); // $ExpectType number + fp.sortedIndexBy(valueIterator)(abcObject)(list); // $ExpectType number + fp.sortedIndexBy("a", abcObject, list); // $ExpectType number + fp.sortedIndexBy({ a: 42 }, abcObject, list); // $ExpectType number - _.sortedIndexBy(list, value, listIterator); // $ExpectType number - _.sortedIndexBy(list, value, ""); // $ExpectType number - _.sortedIndexBy(list, value, { a: 42 }); // $ExpectType number - _(list).sortedIndexBy(value, listIterator); // $ExpectType number - _(list).sortedIndexBy(value, ""); // $ExpectType number - _(list).sortedIndexBy(value, { a: 42 }); // $ExpectType number - _.chain(list).sortedIndexBy(value, listIterator); // $ExpectType LoDashExplicitWrapper - _.chain(list).sortedIndexBy(value, ""); // $ExpectType LoDashExplicitWrapper - _.chain(list).sortedIndexBy(value, { a: 42 }); // $ExpectType LoDashExplicitWrapper - fp.sortedIndexBy(listIterator, value, list); // $ExpectType number - fp.sortedIndexBy(listIterator)(value)(list); // $ExpectType number - fp.sortedIndexBy("a", value, list); // $ExpectType number - fp.sortedIndexBy({ a: 42 }, value, list); // $ExpectType number - - _.sortedLastIndexBy(list, value, listIterator); // $ExpectType number - _.sortedLastIndexBy(list, value, ""); // $ExpectType number - _.sortedLastIndexBy(list, value, { a: 42 }); // $ExpectType number - _(list).sortedLastIndexBy(value, listIterator); // $ExpectType number - _(list).sortedLastIndexBy(value, ""); // $ExpectType number - _(list).sortedLastIndexBy(value, { a: 42 }); // $ExpectType number - _.chain(list).sortedLastIndexBy(value, listIterator); // $ExpectType LoDashExplicitWrapper - _.chain(list).sortedLastIndexBy(value, ""); // $ExpectType LoDashExplicitWrapper - _.chain(list).sortedLastIndexBy(value, { a: 42 }); // $ExpectType LoDashExplicitWrapper - fp.sortedLastIndexBy(listIterator, value, list); // $ExpectType number - fp.sortedLastIndexBy(listIterator)(value)(list); // $ExpectType number - fp.sortedLastIndexBy("a", value, list); // $ExpectType number - fp.sortedLastIndexBy({ a: 42 }, value, list); // $ExpectType number + _.sortedLastIndexBy(list, abcObject, valueIterator); // $ExpectType number + _.sortedLastIndexBy(list, abcObject, ""); // $ExpectType number + _.sortedLastIndexBy(list, abcObject, { a: 42 }); // $ExpectType number + _(list).sortedLastIndexBy(abcObject, valueIterator); // $ExpectType number + _(list).sortedLastIndexBy(abcObject, ""); // $ExpectType number + _(list).sortedLastIndexBy(abcObject, { a: 42 }); // $ExpectType number + _.chain(list).sortedLastIndexBy(abcObject, valueIterator); // $ExpectType LoDashExplicitWrapper + _.chain(list).sortedLastIndexBy(abcObject, ""); // $ExpectType LoDashExplicitWrapper + _.chain(list).sortedLastIndexBy(abcObject, { a: 42 }); // $ExpectType LoDashExplicitWrapper + fp.sortedLastIndexBy(valueIterator, abcObject, list); // $ExpectType number + fp.sortedLastIndexBy(valueIterator)(abcObject)(list); // $ExpectType number + fp.sortedLastIndexBy("a", abcObject, list); // $ExpectType number + fp.sortedLastIndexBy({ a: 42 }, abcObject, list); // $ExpectType number } // _.sortedIndex // _.sortedLastIndex { - const list: _.List | null | undefined = anything; - const value: AbcObject = { a: 1, b: "", c: true }; + _.sortedIndex(list, abcObject); // $ExpectType number + _(list).sortedIndex(abcObject); // $ExpectType number + _.chain(list).sortedIndex(abcObject); // $ExpectType LoDashExplicitWrapper + fp.sortedIndex(abcObject, list); // $ExpectType number + fp.sortedIndex(abcObject)(list); // $ExpectType number - _.sortedIndex(list, value); // $ExpectType number - _(list).sortedIndex(value); // $ExpectType number - _.chain(list).sortedIndex(value); // $ExpectType LoDashExplicitWrapper - fp.sortedIndex(value, list); // $ExpectType number - fp.sortedIndex(value)(list); // $ExpectType number - - _.sortedLastIndex(list, value); // $ExpectType number - _(list).sortedLastIndex(value); // $ExpectType number - _.chain(list).sortedLastIndex(value); // $ExpectType LoDashExplicitWrapper - fp.sortedLastIndex(value, list); // $ExpectType number - fp.sortedLastIndex(value)(list); // $ExpectType number + _.sortedLastIndex(list, abcObject); // $ExpectType number + _(list).sortedLastIndex(abcObject); // $ExpectType number + _.chain(list).sortedLastIndex(abcObject); // $ExpectType LoDashExplicitWrapper + fp.sortedLastIndex(abcObject, list); // $ExpectType number + fp.sortedLastIndex(abcObject)(list); // $ExpectType number } // _.take // _.takeRight { - const list: _.List | null | undefined = anything; - _.take(list); // $ExpectType AbcObject[] _.take(list, 42); // $ExpectType AbcObject[] _(list).take(); // $ExpectType LoDashImplicitWrapper @@ -1269,55 +1173,49 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const predicateFn = (value: AbcObject, index: number, collection: _.List) => true; - const predicateFn2 = (value: AbcObject) => true; - _.takeWhile(list); // $ExpectType AbcObject[] - _.takeWhile(list, predicateFn); // $ExpectType AbcObject[] + _.takeWhile(list, listIterator); // $ExpectType AbcObject[] _.takeWhile(list, ""); // $ExpectType AbcObject[] _.takeWhile(list, { a: 42 }); // $ExpectType AbcObject[] _(list).takeWhile(); // $ExpectType LoDashImplicitWrapper - _(list).takeWhile(predicateFn); // $ExpectType LoDashImplicitWrapper + _(list).takeWhile(listIterator); // $ExpectType LoDashImplicitWrapper _(list).takeWhile(""); // $ExpectType LoDashImplicitWrapper _(list).takeWhile({ a: 42 }); // $ExpectType LoDashImplicitWrapper _.chain(list).takeWhile(); // $ExpectType LoDashExplicitWrapper - _.chain(list).takeWhile(predicateFn); // $ExpectType LoDashExplicitWrapper + _.chain(list).takeWhile(listIterator); // $ExpectType LoDashExplicitWrapper _.chain(list).takeWhile(""); // $ExpectType LoDashExplicitWrapper _.chain(list).takeWhile({ a: 42 }); // $ExpectType LoDashExplicitWrapper - fp.takeWhile(predicateFn2, list); // $ExpectType AbcObject[] - fp.takeWhile(predicateFn2)(list); // $ExpectType AbcObject[] + fp.takeWhile(valueIterator, list); // $ExpectType AbcObject[] + fp.takeWhile(valueIterator)(list); // $ExpectType AbcObject[] fp.takeWhile("a", list); // $ExpectType AbcObject[] fp.takeWhile({ a: 42 }, list); // $ExpectType AbcObject[] _.takeRightWhile(list); // $ExpectType AbcObject[] - _.takeRightWhile(list, predicateFn); // $ExpectType AbcObject[] + _.takeRightWhile(list, listIterator); // $ExpectType AbcObject[] _.takeRightWhile(list, ""); // $ExpectType AbcObject[] _.takeRightWhile(list, { a: 42 }); // $ExpectType AbcObject[] _(list).takeRightWhile(); // $ExpectType LoDashImplicitWrapper - _(list).takeRightWhile(predicateFn); // $ExpectType LoDashImplicitWrapper + _(list).takeRightWhile(listIterator); // $ExpectType LoDashImplicitWrapper _(list).takeRightWhile(""); // $ExpectType LoDashImplicitWrapper _(list).takeRightWhile({ a: 42 }); // $ExpectType LoDashImplicitWrapper _.chain(list).takeRightWhile(); // $ExpectType LoDashExplicitWrapper - _.chain(list).takeRightWhile(predicateFn); // $ExpectType LoDashExplicitWrapper + _.chain(list).takeRightWhile(listIterator); // $ExpectType LoDashExplicitWrapper _.chain(list).takeRightWhile(""); // $ExpectType LoDashExplicitWrapper _.chain(list).takeRightWhile({ a: 42 }); // $ExpectType LoDashExplicitWrapper - fp.takeRightWhile(predicateFn2, list); // $ExpectType AbcObject[] - fp.takeRightWhile(predicateFn2)(list); // $ExpectType AbcObject[] + fp.takeRightWhile(valueIterator, list); // $ExpectType AbcObject[] + fp.takeRightWhile(valueIterator)(list); // $ExpectType AbcObject[] fp.takeRightWhile("a", list); // $ExpectType AbcObject[] fp.takeRightWhile({ a: 42 }, list); // $ExpectType AbcObject[] } // _.union { - const list: _.List | null | undefined = anything; - _.union(list); // $ExpectType AbcObject[] _.union(list, list); // $ExpectType AbcObject[] _.union(list, list, list); // $ExpectType AbcObject[] @@ -1336,13 +1234,9 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const iteratee = (value: AbcObject) => 1; - _.unionBy(list, list); // $ExpectType AbcObject[] - _.unionBy(list, list, list, list, list, list); // $ExpectType AbcObject[] - _.unionBy(list, list, iteratee); // $ExpectType AbcObject[] - _.unionBy(list, list, list, list, list, list, iteratee); // $ExpectType AbcObject[] + _.unionBy(list, list, valueIterator); // $ExpectType AbcObject[] + _.unionBy(list, list, list, list, list, list, valueIterator); // $ExpectType AbcObject[] _.unionBy(list, list, "a"); // $ExpectType AbcObject[] // param needed for TS 2.3 _.unionBy(list, list, list, list, list, list, "a"); // $ExpectType AbcObject[] @@ -1350,9 +1244,8 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper - _(list).unionBy(list, list, list, list, list); // $ExpectType LoDashImplicitWrapper - _(list).unionBy(list, iteratee); // $ExpectType LoDashImplicitWrapper - _(list).unionBy(list, list, list, list, list, iteratee); // $ExpectType LoDashImplicitWrapper + _(list).unionBy(list, valueIterator); // $ExpectType LoDashImplicitWrapper + _(list).unionBy(list, list, list, list, list, valueIterator); // $ExpectType LoDashImplicitWrapper _(list).unionBy(list, "a"); // $ExpectType LoDashImplicitWrapper // param needed for TS 2.3 _(list).unionBy(list, list, list, list, list, "a"); // $ExpectType LoDashImplicitWrapper @@ -1360,17 +1253,16 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper _.chain(list).unionBy(list); // $ExpectType LoDashExplicitWrapper - _.chain(list).unionBy(list, list, list, list, list); // $ExpectType LoDashExplicitWrapper - _.chain(list).unionBy(list, iteratee); // $ExpectType LoDashExplicitWrapper - _.chain(list).unionBy(list, list, list, list, list, iteratee); // $ExpectType LoDashExplicitWrapper + _.chain(list).unionBy(list, valueIterator); // $ExpectType LoDashExplicitWrapper + _.chain(list).unionBy(list, list, list, list, list, valueIterator); // $ExpectType LoDashExplicitWrapper _.chain(list).unionBy(list, "a"); // $ExpectType LoDashExplicitWrapper // param needed for TS 2.3 _.chain(list).unionBy(list, list, list, list, list, "a"); // $ExpectType LoDashExplicitWrapper _.chain(list).unionBy(list, {a: 1}); // $ExpectType LoDashExplicitWrapper _.chain(list).unionBy(list, list, list, list, list, {a: 1}); // $ExpectType LoDashExplicitWrapper - fp.unionBy(iteratee, list, list); // $ExpectType AbcObject[] - fp.unionBy(iteratee)(list)(list); // $ExpectType AbcObject[] + fp.unionBy(valueIterator, list, list); // $ExpectType AbcObject[] + fp.unionBy(valueIterator)(list)(list); // $ExpectType AbcObject[] fp.unionBy("a", list, list); // $ExpectType AbcObject[] fp.unionBy({ a: 1 }, list, list); // $ExpectType AbcObject[] } @@ -1378,8 +1270,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - _.uniq("abc"); // $ExpectType string[] _.uniq(list); // $ExpectType AbcObject[] _(list).uniq(); // $ExpectType LoDashImplicitWrapper @@ -1398,10 +1288,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const stringIterator = (value: string) => ""; - const valueIterator = (value: AbcObject) => 0; - _.uniqBy("abc", stringIterator); // $ExpectType string[] _.uniqBy(list, valueIterator); // $ExpectType AbcObject[] _.uniqBy(list, "a"); // $ExpectType AbcObject[] @@ -1495,8 +1381,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - _.xor(list); // $ExpectType AbcObject[] _.xor(list, list); // $ExpectType AbcObject[] _.xor(list, list, list); // $ExpectType AbcObject[] @@ -1515,13 +1399,9 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const iteratee = (value: AbcObject) => 1; - _.xorBy(list, list); // $ExpectType AbcObject[] - _.xorBy(list, list, list, list, list, list); // $ExpectType AbcObject[] - _.xorBy(list, list, iteratee); // $ExpectType AbcObject[] - _.xorBy(list, list, list, list, list, list, iteratee); // $ExpectType AbcObject[] + _.xorBy(list, list, valueIterator); // $ExpectType AbcObject[] + _.xorBy(list, list, list, list, list, list, valueIterator); // $ExpectType AbcObject[] _.xorBy(list, list, "a"); // $ExpectType AbcObject[] // param needed for TS 2.3 _.xorBy(list, list, list, list, list, list, "a"); // $ExpectType AbcObject[] @@ -1529,9 +1409,8 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper - _(list).xorBy(list, list, list, list, list); // $ExpectType LoDashImplicitWrapper - _(list).xorBy(list, iteratee); // $ExpectType LoDashImplicitWrapper - _(list).xorBy(list, list, list, list, list, iteratee); // $ExpectType LoDashImplicitWrapper + _(list).xorBy(list, valueIterator); // $ExpectType LoDashImplicitWrapper + _(list).xorBy(list, list, list, list, list, valueIterator); // $ExpectType LoDashImplicitWrapper _(list).xorBy(list, "a"); // $ExpectType LoDashImplicitWrapper // param needed for TS 2.3 _(list).xorBy(list, list, list, list, list, "a"); // $ExpectType LoDashImplicitWrapper @@ -1539,25 +1418,22 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper _.chain(list).xorBy(list); // $ExpectType LoDashExplicitWrapper - _.chain(list).xorBy(list, list, list, list, list); // $ExpectType LoDashExplicitWrapper - _.chain(list).xorBy(list, iteratee); // $ExpectType LoDashExplicitWrapper - _.chain(list).xorBy(list, list, list, list, list, iteratee); // $ExpectType LoDashExplicitWrapper + _.chain(list).xorBy(list, valueIterator); // $ExpectType LoDashExplicitWrapper + _.chain(list).xorBy(list, list, list, list, list, valueIterator); // $ExpectType LoDashExplicitWrapper _.chain(list).xorBy(list, "a"); // $ExpectType LoDashExplicitWrapper // param needed for TS 2.3 _.chain(list).xorBy(list, list, list, list, list, "a"); // $ExpectType LoDashExplicitWrapper _.chain(list).xorBy(list, {a: 1}); // $ExpectType LoDashExplicitWrapper _.chain(list).xorBy(list, list, list, list, list, {a: 1}); // $ExpectType LoDashExplicitWrapper - fp.xorBy(iteratee, list, list); // $ExpectType AbcObject[] - fp.xorBy(iteratee)(list)(list); // $ExpectType AbcObject[] + fp.xorBy(valueIterator, list, list); // $ExpectType AbcObject[] + fp.xorBy(valueIterator)(list)(list); // $ExpectType AbcObject[] fp.xorBy("a", list, list); // $ExpectType AbcObject[] fp.xorBy({ a: 1 }, list, list); // $ExpectType AbcObject[] } // _.zip { - const list: _.List | null | undefined = anything; - _.zip(list); // $ExpectType (AbcObject | undefined)[][] _.zip(list, list); // $ExpectType (AbcObject | undefined)[][] _.zip(list, list, list, list, list, list); // $ExpectType (AbcObject | undefined)[][] @@ -1691,9 +1567,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const dictionary: _.Dictionary | null | undefined = anything; - const numericDictionary: _.NumericDictionary | null | undefined = anything; const abcObject: AbcObject | null | undefined = anything; _.at(list, 0, "1", [2], ["3"], [4, "5"]); // $ExpectType AbcObject[] @@ -1719,13 +1592,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const dictionary: _.Dictionary | null | undefined = anything; - const numericDictionary: _.NumericDictionary | null | undefined = anything; - - const stringIterator = (value: string) => 1; - const valueIterator = (value: AbcObject) => 1; - _.countBy(""); // $ExpectType Dictionary _.countBy("", stringIterator); // $ExpectType Dictionary @@ -1793,15 +1659,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const dictionary: _.Dictionary | null | undefined = anything; - const numericDictionary: _.NumericDictionary | null | undefined = anything; - - const listIterator = (value: AbcObject, index: number, collection: _.List) => true; - const dictionaryIterator = (value: AbcObject, key: string, collection: _.Dictionary) => true; - const numericDictionaryIterator = (value: AbcObject, key: string, collection: _.NumericDictionary) => true; - const valueIterator = (value: AbcObject) => true; - _.every(list); // $ExpectType boolean _.every(list, listIterator); // $ExpectType boolean _.every(list, "a"); // $ExpectType boolean @@ -1874,13 +1731,7 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const dictionary: _.Dictionary | null | undefined = anything; - const stringIterator = (char: string, index: number, string: string) => true; - const listIterator = (value: AbcObject, index: number, collection: _.List) => true; - const dictionaryIterator = (value: AbcObject, key: string, collection: _.Dictionary) => true; - const valueIterator = (value: AbcObject) => true; _.filter("", stringIterator); // $ExpectType string[] _.filter(list, listIterator); // $ExpectType AbcObject[] @@ -1942,13 +1793,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const dictionary: _.Dictionary | null | undefined = anything; - - const listIterator = (value: AbcObject, index: number, collection: _.List) => true; - const dictionaryIterator = (value: AbcObject, key: string, collection: _.Dictionary) => true; - const valueIterator = (value: AbcObject) => true; - _.find(list); // $ExpectType AbcObject | undefined _.find(list, listIterator); // $ExpectType AbcObject | undefined _.find(list, listIterator, 1); // $ExpectType AbcObject | undefined @@ -2138,7 +1982,7 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; const objList: _.List<{a: number}|Array<{a: number}>> | null | undefined = anything; @@ -2206,22 +2050,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const objList: _.List<{a: number}|Array<{a: number}>> | null | undefined = anything; - const numDictionary: _.Dictionary | null | undefined = anything; - const objDictionary: _.Dictionary<{a: number}|Array<{a: number}>> | null | undefined = anything; - const numNumericDictionary: _.NumericDictionary | null | undefined = anything; - const objNumericDictionary: _.NumericDictionary<{a: number}|Array<{a: number}>> | null | undefined = anything; - - const stringIterator = (value: string, index: number, collection: _.List): _.ListOfRecursiveArraysOrValues | string => ""; - const listIterator = (value: number | number[], index: number, collection: _.List): _.ListOfRecursiveArraysOrValues | number => 1; - const dictionaryIterator = (value: number | number[], key: string, collection: _.Dictionary): _.ListOfRecursiveArraysOrValues | number => 1; - const numericDictionaryIterator = (value: number | number[], key: string, collection: _.NumericDictionary): _.ListOfRecursiveArraysOrValues | number => 1; - const valueIterator = (value: number | number[]): _.ListOfRecursiveArraysOrValues | number => 1; _.flatMapDepth("abc"); // $ExpectType string[] _.flatMapDepth("abc", stringIterator); // $ExpectType string[] @@ -2289,7 +2117,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; const nilDictionary: _.Dictionary | null | undefined = anything; const nilNumericDictionary: _.NumericDictionary | null | undefined = anything; - const abcObject: AbcObject = anything; const nilAbcObject: AbcObject | null | undefined = anything; // $ExpectType string @@ -2516,16 +2343,14 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper }); - const stringIterator2 = (char: string) => 1; - const listIterator2 = (value: AbcObject) => 1; - fp.forEach(stringIterator2, ""); // $ExpectType string - fp.forEach(listIterator2, array); // $ExpectType AbcObject[] - fp.forEach(listIterator2)(array); // $ExpectType AbcObject[] - fp.forEach(listIterator2, list); // $ExpectType ArrayLike - fp.forEach(listIterator2, dictionary); // $ExpectType Dictionary - fp.forEach(listIterator2, nilArray); // $ExpectType AbcObject[] | null | undefined - fp.forEach(listIterator2, nilList); // $ExpectType ArrayLike | null | undefined - fp.forEach(listIterator2, nilDictionary); // $ExpectType Dictionary | null | undefined + fp.forEach(stringIterator, ""); // $ExpectType string + fp.forEach(valueIterator, array); // $ExpectType AbcObject[] + fp.forEach(valueIterator)(array); // $ExpectType AbcObject[] + fp.forEach(valueIterator, list); // $ExpectType ArrayLike + fp.forEach(valueIterator, dictionary); // $ExpectType Dictionary + fp.forEach(valueIterator, nilArray); // $ExpectType AbcObject[] | null | undefined + fp.forEach(valueIterator, nilList); // $ExpectType ArrayLike | null | undefined + fp.forEach(valueIterator, nilDictionary); // $ExpectType Dictionary | null | undefined // $ExpectType AbcObject[] _.forEachRight(array, (value, index, collection) => { @@ -2563,8 +2388,8 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper }); - fp.forEachRight(listIterator2, array); // $ExpectType AbcObject[] - fp.forEachRight(listIterator2)(array); // $ExpectType AbcObject[] + fp.forEachRight(valueIterator, array); // $ExpectType AbcObject[] + fp.forEachRight(valueIterator)(array); // $ExpectType AbcObject[] // $ExpectType AbcObject[] _.each(array, (value, index, collection) => { @@ -2602,8 +2427,8 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper }); - fp.each(listIterator2, array); // $ExpectType AbcObject[] - fp.each(listIterator2)(array); // $ExpectType AbcObject[] + fp.each(valueIterator, array); // $ExpectType AbcObject[] + fp.each(valueIterator)(array); // $ExpectType AbcObject[] // $ExpectType AbcObject[] _.eachRight(array, (value, index, collection) => { @@ -2641,18 +2466,12 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper }); - fp.eachRight(listIterator2, array); // $ExpectType AbcObject[] - fp.eachRight(listIterator2)(array); // $ExpectType AbcObject[] + fp.eachRight(valueIterator, array); // $ExpectType AbcObject[] + fp.eachRight(valueIterator)(array); // $ExpectType AbcObject[] } // _.groupBy { - const list: _.List | null | undefined = [] as any; - const dictionary: _.Dictionary | null | undefined = anything; - - const stringIterator = (char: string) => 0; - const valueIterator = (value: AbcObject) => 0; - _.groupBy(""); // $ExpectType Dictionary _.groupBy("", stringIterator); // $ExpectType Dictionary _.groupBy(list); // $ExpectType Dictionary @@ -2699,42 +2518,33 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const dictionary: _.Dictionary | null | undefined = anything; - const target: AbcObject = { a: 42, b: "", c: true }; + _.includes(list, abcObject); // $ExpectType boolean + _.includes(list, abcObject, 42); // $ExpectType boolean + _.includes(dictionary, abcObject); // $ExpectType boolean + _.includes(dictionary, abcObject, 42); // $ExpectType boolean - _.includes(list, target); // $ExpectType boolean - _.includes(list, target, 42); // $ExpectType boolean - _.includes(dictionary, target); // $ExpectType boolean - _.includes(dictionary, target, 42); // $ExpectType boolean + _(list).includes(abcObject); // $ExpectType boolean + _(list).includes(abcObject, 42); // $ExpectType boolean + _(dictionary).includes(abcObject); // $ExpectType boolean + _(dictionary).includes(abcObject, 42); // $ExpectType boolean - _(list).includes(target); // $ExpectType boolean - _(list).includes(target, 42); // $ExpectType boolean - _(dictionary).includes(target); // $ExpectType boolean - _(dictionary).includes(target, 42); // $ExpectType boolean + _.chain(list).includes(abcObject); // $ExpectType LoDashExplicitWrapper + _.chain(list).includes(abcObject, 42); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).includes(abcObject); // $ExpectType LoDashExplicitWrapper + _.chain(dictionary).includes(abcObject, 42); // $ExpectType LoDashExplicitWrapper - _.chain(list).includes(target); // $ExpectType LoDashExplicitWrapper - _.chain(list).includes(target, 42); // $ExpectType LoDashExplicitWrapper - _.chain(dictionary).includes(target); // $ExpectType LoDashExplicitWrapper - _.chain(dictionary).includes(target, 42); // $ExpectType LoDashExplicitWrapper + fp.includes(abcObject, list); // $ExpectType boolean + fp.includes(abcObject)(list); // $ExpectType boolean + fp.includes(abcObject, dictionary); // $ExpectType boolean - fp.includes(target, list); // $ExpectType boolean - fp.includes(target)(list); // $ExpectType boolean - fp.includes(target, dictionary); // $ExpectType boolean - - fp.includesFrom(target, 42, list); // $ExpectType boolean - fp.includesFrom(target)(42)(list); // $ExpectType boolean - fp.includesFrom(target, 42, dictionary); // $ExpectType boolean + fp.includesFrom(abcObject, 42, list); // $ExpectType boolean + fp.includesFrom(abcObject)(42)(list); // $ExpectType boolean + fp.includesFrom(abcObject, 42, dictionary); // $ExpectType boolean } // _.keyBy { - const list: _.List | null | undefined = anything; - const dictionary: _.Dictionary | null | undefined = anything; - const numericDictionary: _.NumericDictionary | null | undefined = anything; - - const stringIterator = (value: string) => "a"; - const valueIterator = (value: AbcObject) => 1; + const valueIterator = (value: AbcObject) => ""; _.keyBy("abcd"); // $ExpectType Dictionary _.keyBy("abcd", stringIterator); // $ExpectType Dictionary @@ -2878,11 +2688,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const dictionary: _.Dictionary | null | undefined = anything; - const numericDictionary: _.NumericDictionary | null | undefined = anything; - const abcObject: AbcObject = anything; - _.map(list); // $ExpectType AbcObject[] // $ExpectType number[] _.map(list, (value, index, collection) => { @@ -2995,8 +2800,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - // $ExpectType [any[], any[]] _.partition(anything, (value) => { value; // $ExpectType any @@ -3110,13 +2913,7 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const dictionary: _.Dictionary | null | undefined = anything; - const stringIterator = (char: string, index: number, string: string) => true; - const listIterator = (value: AbcObject, index: number, collection: _.List) => true; - const dictionaryIterator = (value: AbcObject, key: string, collection: _.Dictionary) => true; - const valueIterator = (value: AbcObject) => true; _.reject("", stringIterator); // $ExpectType string[] _.reject(list, listIterator); // $ExpectType AbcObject[] @@ -3207,9 +3004,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const dictionary: _.Dictionary | null | undefined = anything; - _.shuffle("abc"); // $ExpectType string[] _.shuffle(list); // $ExpectType AbcObject[] _.shuffle(dictionary); // $ExpectType AbcObject[] @@ -3226,9 +3020,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const dictionary: _.Dictionary | null | undefined = anything; - _.size(list); // $ExpectType number _.size(dictionary); // $ExpectType number _.size(""); // $ExpectType number @@ -3245,15 +3036,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const dictionary: _.Dictionary | null | undefined = anything; - const numericDictionary: _.NumericDictionary | null | undefined = anything; - - const listIterator = (value: AbcObject, index: number, collection: _.List) => true; - const dictionaryIterator = (value: AbcObject, key: string, collection: _.Dictionary) => true; - const numericDictionaryIterator = (value: AbcObject, key: string, collection: _.NumericDictionary) => true; - const valueIterator = (value: AbcObject) => true; - _.some(list); // $ExpectType boolean _.some(list, listIterator); // $ExpectType boolean _.some(list, "a"); // $ExpectType boolean @@ -3326,13 +3108,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const dictionary: _.Dictionary | null | undefined = anything; - - const listIterator = (value: AbcObject, index: number, collection: _.List) => 0; - const dictionaryIterator = (value: AbcObject, key: string, collection: _.Dictionary) => 0; - const valueIterator = (value: AbcObject) => 0; - _.sortBy(list); // $ExpectType AbcObject[] _.sortBy(list, listIterator); // $ExpectType AbcObject[] _.sortBy(list, listIterator, listIterator); // $ExpectType AbcObject[] @@ -3380,10 +3155,6 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper | null | undefined = anything; - const numericDictionary: _.NumericDictionary | null | undefined = anything; - const dictionary: _.Dictionary | null | undefined = anything; - _.orderBy("acbd", (value) => 1); // $ExpectType string[] _.orderBy("acbd", (value) => 1, true); // $ExpectType string[] _.orderBy("acbd", [(value) => 1, (value) => 2], [true, false]); // $ExpectType string[] @@ -4882,8 +4653,6 @@ fp.now(); // $ExpectType number { const list: ArrayLike = anything; - const valueIterator = (value: AbcObject) => 0; - _.maxBy(list, valueIterator); // $ExpectType AbcObject | undefined _.maxBy(list, "a"); // $ExpectType AbcObject | undefined _.maxBy(list, { a: 42 }); // $ExpectType AbcObject | undefined @@ -4976,7 +4745,6 @@ fp.now(); // $ExpectType number // _.sumBy { - const list: ArrayLike | null | undefined = anything; const listIterator = (value: AbcObject) => 0; _.sumBy(list, listIterator); // $ExpectType number @@ -5235,7 +5003,6 @@ fp.now(); // $ExpectType number { const dictionary: _.Dictionary = anything; const numericDictionary: _.NumericDictionary = anything; - const abcObject: AbcObject = anything; _.entries(dictionary); // $ExpectType [string, number][] _.entries(numericDictionary); // $ExpectType [string, number][] @@ -5362,17 +5129,15 @@ fp.now(); // $ExpectType number // _.functions // _.functionsIn { - const object: AbcObject = anything; + _.functions(abcObject); // $ExpectType string[] + _(abcObject).functions(); // $ExpectType LoDashImplicitWrapper + _.chain(abcObject).functions(); // $ExpectType LoDashExplicitWrapper + fp.functions(abcObject); // $ExpectType string[] - _.functions(object); // $ExpectType string[] - _(object).functions(); // $ExpectType LoDashImplicitWrapper - _.chain(object).functions(); // $ExpectType LoDashExplicitWrapper - fp.functions(object); // $ExpectType string[] - - _.functionsIn(object); // $ExpectType string[] - _(object).functionsIn(); // $ExpectType LoDashImplicitWrapper - _.chain(object).functionsIn(); // $ExpectType LoDashExplicitWrapper - fp.functionsIn(object); // $ExpectType string[] + _.functionsIn(abcObject); // $ExpectType string[] + _(abcObject).functionsIn(); // $ExpectType LoDashImplicitWrapper + _.chain(abcObject).functionsIn(); // $ExpectType LoDashExplicitWrapper + fp.functionsIn(abcObject); // $ExpectType string[] } // _.get @@ -5419,33 +5184,31 @@ fp.now(); // $ExpectType number // _.has // _.hasIn { - const object: AbcObject = anything; + _.has(abcObject, ""); // $ExpectType boolean + _.has(abcObject, 42); // $ExpectType boolean + _.has(abcObject, ["", 42]); // $ExpectType boolean + _(abcObject).has(""); // $ExpectType boolean + _(abcObject).has(42); // $ExpectType boolean + _(abcObject).has(["", 42]); // $ExpectType boolean + _.chain(abcObject).has(""); // $ExpectType LoDashExplicitWrapper + _.chain(abcObject).has(42); // $ExpectType LoDashExplicitWrapper + _.chain(abcObject).has(["", 42]); // $ExpectType LoDashExplicitWrapper + fp.has("a", abcObject); // $ExpectType boolean + fp.has("a")(abcObject); // $ExpectType boolean + fp.has(["a", 42])(abcObject); // $ExpectType boolean - _.has(object, ""); // $ExpectType boolean - _.has(object, 42); // $ExpectType boolean - _.has(object, ["", 42]); // $ExpectType boolean - _(object).has(""); // $ExpectType boolean - _(object).has(42); // $ExpectType boolean - _(object).has(["", 42]); // $ExpectType boolean - _.chain(object).has(""); // $ExpectType LoDashExplicitWrapper - _.chain(object).has(42); // $ExpectType LoDashExplicitWrapper - _.chain(object).has(["", 42]); // $ExpectType LoDashExplicitWrapper - fp.has("a", object); // $ExpectType boolean - fp.has("a")(object); // $ExpectType boolean - fp.has(["a", 42])(object); // $ExpectType boolean - - _.hasIn(object, ""); // $ExpectType boolean - _.hasIn(object, 42); // $ExpectType boolean - _.hasIn(object, ["", 42]); // $ExpectType boolean - _(object).hasIn(""); // $ExpectType boolean - _(object).hasIn(42); // $ExpectType boolean - _(object).hasIn(["", 42]); // $ExpectType boolean - _.chain(object).hasIn(""); // $ExpectType LoDashExplicitWrapper - _.chain(object).hasIn(42); // $ExpectType LoDashExplicitWrapper - _.chain(object).hasIn(["", 42]); // $ExpectType LoDashExplicitWrapper - fp.hasIn("a", object); // $ExpectType boolean - fp.hasIn("a")(object); // $ExpectType boolean - fp.hasIn(["a", 42])(object); // $ExpectType boolean + _.hasIn(abcObject, ""); // $ExpectType boolean + _.hasIn(abcObject, 42); // $ExpectType boolean + _.hasIn(abcObject, ["", 42]); // $ExpectType boolean + _(abcObject).hasIn(""); // $ExpectType boolean + _(abcObject).hasIn(42); // $ExpectType boolean + _(abcObject).hasIn(["", 42]); // $ExpectType boolean + _.chain(abcObject).hasIn(""); // $ExpectType LoDashExplicitWrapper + _.chain(abcObject).hasIn(42); // $ExpectType LoDashExplicitWrapper + _.chain(abcObject).hasIn(["", 42]); // $ExpectType LoDashExplicitWrapper + fp.hasIn("a", abcObject); // $ExpectType boolean + fp.hasIn("a")(abcObject); // $ExpectType boolean + fp.hasIn(["a", 42])(abcObject); // $ExpectType boolean } // _.invert @@ -5462,7 +5225,6 @@ fp.now(); // $ExpectType number const dictionary: _.Dictionary<{ a: number }> = {}; const numericDictionary: _.NumericDictionary<{ a: number }> = {}; - const stringIterator = (value: string) => 1; const valueIterator = (value: {a: number }) => 1; _.invertBy("foo"); // $ExpectType Dictionary @@ -5523,14 +5285,6 @@ fp.now(); // $ExpectType number // _.mapKeys { - const list: _.List| null | undefined = [] as any; - const dictionary: _.Dictionary | null | undefined = anything; - const numericDictionary: _.NumericDictionary | null | undefined = anything; - const abcObject: AbcObject = anything; - - const listIterator = (value: AbcObject, index: number, collection: _.List) => ""; - const dictionaryIterator = (value: AbcObject, key: string, collection: _.Dictionary) => ""; - const numericDictionaryIterator = (value: AbcObject, key: string, collection: _.NumericDictionary) => ""; const abcObjectIterator = (value: AbcObject[keyof AbcObject], key: string, collection: AbcObject) => ""; _.mapKeys(list); // $ExpectType Dictionary @@ -5605,9 +5359,6 @@ fp.now(); // $ExpectType number // _.mapValues { - const dictionary: _.Dictionary | null | undefined = anything; - const numericDictionary: _.NumericDictionary | null | undefined = anything; - const abcObject: AbcObject = anything; const abcObjectOrNull: AbcObject | null = anything; const key: string = anything; @@ -5774,10 +5525,9 @@ fp.now(); // $ExpectType number _.chain(abcObject).mapValues(); // $ExpectType LoDashExplicitWrapper _.chain(abcObjectOrNull).mapValues(); // $ExpectType LoDashExplicitWrapper> - const valueIterator = (value: AbcObject) => ""; - fp.mapValues(valueIterator)(dictionary); // $ExpectType Dictionary + fp.mapValues(valueIterator)(dictionary); // $ExpectType Dictionary fp.mapValues("a", dictionary); // $ExpectType Dictionary - fp.mapValues(valueIterator)(numericDictionary); // $ExpectType Dictionary + fp.mapValues(valueIterator)(numericDictionary); // $ExpectType Dictionary fp.mapValues({ a: 42 })(numericDictionary); // $ExpectType Dictionary fp.mapValues(value => "", abcObjectOrNull); // $ExpectType { a: string; b: string; c: string; } } @@ -5953,7 +5703,6 @@ fp.now(); // $ExpectType number { const dictionary: _.Dictionary = {}; const numericDictionary: _.NumericDictionary = {}; - const abcObject: AbcObject = anything; _.toPairs(dictionary); // $ExpectType [string, number][] _.toPairs(numericDictionary); // $ExpectType [string, number][] @@ -6108,8 +5857,6 @@ fp.now(); // $ExpectType number { const dict: _.Dictionary = {}; const numDict: _.NumericDictionary = {}; - const list: _.List | null | undefined = anything; - const object: AbcObject = anything; _.values(123); // $ExpectType any[] _.values(true); // $ExpectType any[] @@ -6119,7 +5866,7 @@ fp.now(); // $ExpectType number _.values(dict); // $ExpectType AbcObject[] _.values(numDict); // $ExpectType AbcObject[] _.values(list); // $ExpectType AbcObject[] - _.values(object); // $ExpectType (string | number | boolean)[] + _.values(abcObject); // $ExpectType (string | number | boolean)[] _(true).values(); // $ExpectType LoDashImplicitWrapper _("hi").values(); // $ExpectType LoDashImplicitWrapper @@ -6135,13 +5882,13 @@ fp.now(); // $ExpectType number fp.values(dict); // $ExpectType AbcObject[] fp.values(numDict); // $ExpectType AbcObject[] fp.values(list); // $ExpectType AbcObject[] - fp.values(object); // $ExpectType (string | number | boolean)[] + fp.values(abcObject); // $ExpectType (string | number | boolean)[] _.valuesIn([true, false]); // $ExpectType boolean[] _.valuesIn(dict); // $ExpectType AbcObject[] _.valuesIn(numDict); // $ExpectType AbcObject[] _.valuesIn(list); // $ExpectType AbcObject[] - _.valuesIn(object); // $ExpectType (string | number | boolean)[] + _.valuesIn(abcObject); // $ExpectType (string | number | boolean)[] _(dict).valuesIn(); // $ExpectType LoDashImplicitWrapper _.chain(dict).valuesIn(); // $ExpectType LoDashExplicitWrapper @@ -6149,7 +5896,7 @@ fp.now(); // $ExpectType number fp.valuesIn(dict); // $ExpectType AbcObject[] fp.valuesIn(numDict); // $ExpectType AbcObject[] fp.valuesIn(list); // $ExpectType AbcObject[] - fp.valuesIn(object); // $ExpectType (string | number | boolean)[] + fp.valuesIn(abcObject); // $ExpectType (string | number | boolean)[] } /******* @@ -6163,16 +5910,7 @@ fp.now(); // $ExpectType number _(true); // $ExpectType LoDashImplicitWrapper _([""]); // $ExpectType LoDashImplicitWrapper _({ a: "" }); // $ExpectType LoDashImplicitWrapper<{ a: string; }> - - { - const a: AbcObject[] = []; - _(a); // $ExpectType LoDashImplicitWrapper - } - - { - const a: AbcObject[] | null | undefined = anything; - _(a); // $ExpectType LoDashImplicitWrapper - } + _(array); // $ExpectType LoDashImplicitWrapper } // _.chain @@ -6319,7 +6057,6 @@ fp.now(); // $ExpectType number _.chain(numberROA).concat(numberROA); // $ExpectType LoDashExplicitWrapper _.chain(numberROA).concat(numberROA, numberROA); // $ExpectType LoDashExplicitWrapper - const abcObject: AbcObject = { a: 1, b: 'foo', c: true }; const objectROA: AbcObject[] = [{ a: 1, b: 'foo', c: true }]; // TODO: Should be ReadonlyArray, but see comment on type Many _.concat(abcObject, abcObject); // $ExpectType AbcObject[] @@ -6889,28 +6626,25 @@ fp.now(); // $ExpectType number // _.matches { - const source: AbcObject = { a: 1, b: "", c: true }; + _.matches(abcObject); // $ExpectType (value: any) => boolean + _.matches(abcObject); // $ExpectType (value: AbcObject) => boolean + _(abcObject).matches(); // $ExpectType LoDashImplicitWrapper<(value: AbcObject) => boolean> + _.chain(abcObject).matches(); // $ExpectType LoDashExplicitWrapper<(value: AbcObject) => boolean> - _.matches(source); // $ExpectType (value: any) => boolean - _.matches(source); // $ExpectType (value: AbcObject) => boolean - _(source).matches(); // $ExpectType LoDashImplicitWrapper<(value: AbcObject) => boolean> - _.chain(source).matches(); // $ExpectType LoDashExplicitWrapper<(value: AbcObject) => boolean> - - fp.matches(source, {}); // $ExpectType boolean - fp.matches(source)({}); // $ExpectType boolean + fp.matches(abcObject, {}); // $ExpectType boolean + fp.matches(abcObject)({}); // $ExpectType boolean } // _.matchesProperty { const path: string | string[] = anything; - const source: AbcObject = { a: 1, b: "", c: true }; - _.matchesProperty(path, source); // $ExpectType (value: any) => boolean - _.matchesProperty(path, source); // $ExpectType (value: AbcObject) => boolean - _(path).matchesProperty(source); // $ExpectType LoDashImplicitWrapper<(value: any) => boolean> - _(path).matchesProperty(source); - _.chain(path).matchesProperty(source); // $ExpectType LoDashExplicitWrapper<(value: any) => boolean> - fp.matchesProperty(path, source); // $ExpectType (value: any) => boolean + _.matchesProperty(path, abcObject); // $ExpectType (value: any) => boolean + _.matchesProperty(path, abcObject); // $ExpectType (value: AbcObject) => boolean + _(path).matchesProperty(abcObject); // $ExpectType LoDashImplicitWrapper<(value: any) => boolean> + _(path).matchesProperty(abcObject); + _.chain(path).matchesProperty(abcObject); // $ExpectType LoDashExplicitWrapper<(value: any) => boolean> + fp.matchesProperty(path, abcObject); // $ExpectType (value: any) => boolean } // _.method @@ -6937,15 +6671,13 @@ fp.now(); // $ExpectType number // _.methodOf { - const object: AbcObject = anything; - - _.methodOf(object) as (path: _.Many<_.PropertyName>) => any; - _.methodOf(object, anything, anything, anything) as (path: _.Many<_.PropertyName>) => any; - _(object).methodOf() as _.LoDashImplicitWrapper<(path: _.Many<_.PropertyName>) => any>; - _(object).methodOf(anything, anything, anything) as _.LoDashImplicitWrapper<(path: _.Many<_.PropertyName>) => any>; - _.chain(object).methodOf() as _.LoDashExplicitWrapper<(path: _.Many<_.PropertyName>) => any>; - _.chain(object).methodOf(anything, anything, anything) as _.LoDashExplicitWrapper<(path: _.Many<_.PropertyName>) => any>; - fp.methodOf(object) as (path: _.Many<_.PropertyName>) => any; + _.methodOf(abcObject) as (path: _.Many<_.PropertyName>) => any; + _.methodOf(abcObject, anything, anything, anything) as (path: _.Many<_.PropertyName>) => any; + _(abcObject).methodOf() as _.LoDashImplicitWrapper<(path: _.Many<_.PropertyName>) => any>; + _(abcObject).methodOf(anything, anything, anything) as _.LoDashImplicitWrapper<(path: _.Many<_.PropertyName>) => any>; + _.chain(abcObject).methodOf() as _.LoDashExplicitWrapper<(path: _.Many<_.PropertyName>) => any>; + _.chain(abcObject).methodOf(anything, anything, anything) as _.LoDashExplicitWrapper<(path: _.Many<_.PropertyName>) => any>; + fp.methodOf(abcObject) as (path: _.Many<_.PropertyName>) => any; } // _.mixin diff --git a/types/lodash/tsconfig.json b/types/lodash/tsconfig.json index 5a160103d4..60a2e8323c 100644 --- a/types/lodash/tsconfig.json +++ b/types/lodash/tsconfig.json @@ -20,7 +20,305 @@ "files": [ "index.d.ts", "lodash-tests.ts", + "add.d.ts", + "after.d.ts", + "ary.d.ts", + "assign.d.ts", + "assignIn.d.ts", + "assignInWith.d.ts", + "assignWith.d.ts", + "at.d.ts", + "attempt.d.ts", + "before.d.ts", + "bind.d.ts", + "bindAll.d.ts", + "bindKey.d.ts", + "camelCase.d.ts", + "capitalize.d.ts", + "castArray.d.ts", + "ceil.d.ts", + "chain.d.ts", + "chunk.d.ts", + "clamp.d.ts", + "clone.d.ts", + "cloneDeep.d.ts", + "cloneDeepWith.d.ts", + "cloneWith.d.ts", + "compact.d.ts", + "concat.d.ts", + "cond.d.ts", + "conformsTo.d.ts", + "constant.d.ts", + "countBy.d.ts", + "create.d.ts", + "curry.d.ts", + "curryRight.d.ts", + "debounce.d.ts", + "deburr.d.ts", + "defaults.d.ts", + "defaultsDeep.d.ts", + "defaultTo.d.ts", + "defer.d.ts", + "delay.d.ts", + "difference.d.ts", + "differenceBy.d.ts", + "differenceWith.d.ts", + "divide.d.ts", + "drop.d.ts", + "dropRight.d.ts", + "dropRightWhile.d.ts", + "dropWhile.d.ts", + "each.d.ts", + "eachRight.d.ts", + "endsWith.d.ts", + "entries.d.ts", + "entriesIn.d.ts", + "eq.d.ts", + "escape.d.ts", + "escapeRegExp.d.ts", + "every.d.ts", + "extend.d.ts", + "extendWith.d.ts", + "fill.d.ts", + "filter.d.ts", + "find.d.ts", + "findIndex.d.ts", + "findKey.d.ts", + "findLast.d.ts", + "findLastIndex.d.ts", + "findLastKey.d.ts", + "first.d.ts", + "flatMap.d.ts", + "flatMapDeep.d.ts", + "flatMapDepth.d.ts", + "flatten.d.ts", + "flattenDeep.d.ts", + "flattenDepth.d.ts", + "flip.d.ts", + "floor.d.ts", + "flow.d.ts", + "flowRight.d.ts", + "forEach.d.ts", + "forEachRight.d.ts", + "forIn.d.ts", + "forInRight.d.ts", + "forOwn.d.ts", + "forOwnRight.d.ts", "fp.d.ts", + "fromPairs.d.ts", + "functions.d.ts", + "functionsIn.d.ts", + "get.d.ts", + "groupBy.d.ts", + "gt.d.ts", + "gte.d.ts", + "has.d.ts", + "hasIn.d.ts", + "head.d.ts", + "identity.d.ts", + "includes.d.ts", + "indexOf.d.ts", + "initial.d.ts", + "inRange.d.ts", + "intersection.d.ts", + "intersectionBy.d.ts", + "intersectionWith.d.ts", + "invert.d.ts", + "invertBy.d.ts", + "invoke.d.ts", + "invokeMap.d.ts", + "isArguments.d.ts", + "isArray.d.ts", + "isArrayBuffer.d.ts", + "isArrayLike.d.ts", + "isArrayLikeObject.d.ts", + "isBoolean.d.ts", + "isBuffer.d.ts", + "isDate.d.ts", + "isElement.d.ts", + "isEmpty.d.ts", + "isEqual.d.ts", + "isEqualWith.d.ts", + "isError.d.ts", + "isFinite.d.ts", + "isFunction.d.ts", + "isInteger.d.ts", + "isLength.d.ts", + "isMap.d.ts", + "isMatch.d.ts", + "isMatchWith.d.ts", + "isNaN.d.ts", + "isNative.d.ts", + "isNil.d.ts", + "isNull.d.ts", + "isNumber.d.ts", + "isObject.d.ts", + "isObjectLike.d.ts", + "isPlainObject.d.ts", + "isRegExp.d.ts", + "isSafeInteger.d.ts", + "isSet.d.ts", + "isString.d.ts", + "isSymbol.d.ts", + "isTypedArray.d.ts", + "isUndefined.d.ts", + "isWeakMap.d.ts", + "isWeakSet.d.ts", + "iteratee.d.ts", + "join.d.ts", + "kebabCase.d.ts", + "keyBy.d.ts", + "keys.d.ts", + "keysIn.d.ts", + "last.d.ts", + "lastIndexOf.d.ts", + "lowerCase.d.ts", + "lowerFirst.d.ts", + "lt.d.ts", + "lte.d.ts", + "map.d.ts", + "mapKeys.d.ts", + "mapValues.d.ts", + "matches.d.ts", + "matchesProperty.d.ts", + "max.d.ts", + "maxBy.d.ts", + "mean.d.ts", + "meanBy.d.ts", + "memoize.d.ts", + "merge.d.ts", + "mergeWith.d.ts", + "method.d.ts", + "methodOf.d.ts", + "min.d.ts", + "minBy.d.ts", + "mixin.d.ts", + "negate.d.ts", + "noConflict.d.ts", + "noop.d.ts", + "now.d.ts", + "nth.d.ts", + "nthArg.d.ts", + "omit.d.ts", + "omitBy.d.ts", + "once.d.ts", + "orderBy.d.ts", + "over.d.ts", + "overArgs.d.ts", + "overEvery.d.ts", + "overSome.d.ts", + "pad.d.ts", + "padEnd.d.ts", + "padStart.d.ts", + "parseInt.d.ts", + "partial.d.ts", + "partialRight.d.ts", + "partition.d.ts", + "pick.d.ts", + "pickBy.d.ts", + "property.d.ts", + "propertyOf.d.ts", + "pull.d.ts", + "pullAll.d.ts", + "pullAllBy.d.ts", + "pullAllWith.d.ts", + "pullAt.d.ts", + "random.d.ts", + "range.d.ts", + "rangeRight.d.ts", + "rearg.d.ts", + "reduce.d.ts", + "reduceRight.d.ts", + "reject.d.ts", + "remove.d.ts", + "repeat.d.ts", + "replace.d.ts", + "rest.d.ts", + "result.d.ts", + "reverse.d.ts", + "round.d.ts", + "runInContext.d.ts", + "sample.d.ts", + "sampleSize.d.ts", + "set.d.ts", + "setWith.d.ts", + "shuffle.d.ts", + "size.d.ts", + "slice.d.ts", + "snakeCase.d.ts", + "some.d.ts", + "sortBy.d.ts", + "sortedIndex.d.ts", + "sortedIndexBy.d.ts", + "sortedIndexOf.d.ts", + "sortedLastIndex.d.ts", + "sortedLastIndexBy.d.ts", + "sortedLastIndexOf.d.ts", + "sortedUniq.d.ts", + "sortedUniqBy.d.ts", + "split.d.ts", + "spread.d.ts", + "startCase.d.ts", + "startsWith.d.ts", + "subtract.d.ts", + "sum.d.ts", + "sumBy.d.ts", + "tail.d.ts", + "take.d.ts", + "takeRight.d.ts", + "takeRightWhile.d.ts", + "takeWhile.d.ts", + "tap.d.ts", + "template.d.ts", + "throttle.d.ts", + "thru.d.ts", + "times.d.ts", + "toArray.d.ts", + "toFinite.d.ts", + "toInteger.d.ts", + "toLength.d.ts", + "toLower.d.ts", + "toNumber.d.ts", + "toPairs.d.ts", + "toPairsIn.d.ts", + "toPath.d.ts", + "toPlainObject.d.ts", + "toSafeInteger.d.ts", + "toString.d.ts", + "toUpper.d.ts", + "transform.d.ts", + "trim.d.ts", + "trimEnd.d.ts", + "trimStart.d.ts", + "truncate.d.ts", + "unary.d.ts", + "unescape.d.ts", + "union.d.ts", + "unionBy.d.ts", + "unionWith.d.ts", + "uniq.d.ts", + "uniqBy.d.ts", + "uniqueId.d.ts", + "uniqWith.d.ts", + "unset.d.ts", + "unzip.d.ts", + "unzipWith.d.ts", + "update.d.ts", + "updateWith.d.ts", + "upperCase.d.ts", + "upperFirst.d.ts", + "values.d.ts", + "valuesIn.d.ts", + "without.d.ts", + "words.d.ts", + "wrap.d.ts", + "xor.d.ts", + "xorBy.d.ts", + "xorWith.d.ts", + "zip.d.ts", + "zipObject.d.ts", + "zipObjectDeep.d.ts", + "zipWith.d.ts", "common/array.d.ts", "common/collection.d.ts", "common/common.d.ts", @@ -32,6 +330,392 @@ "common/object.d.ts", "common/seq.d.ts", "common/string.d.ts", - "common/util.d.ts" + "common/util.d.ts", + "fp/convert.d.ts", + "fp/add.d.ts", + "fp/after.d.ts", + "fp/all.d.ts", + "fp/allPass.d.ts", + "fp/always.d.ts", + "fp/any.d.ts", + "fp/anyPass.d.ts", + "fp/apply.d.ts", + "fp/ary.d.ts", + "fp/assign.d.ts", + "fp/assignAll.d.ts", + "fp/assignAllWith.d.ts", + "fp/assignIn.d.ts", + "fp/assignInAll.d.ts", + "fp/assignInAllWith.d.ts", + "fp/assignInWith.d.ts", + "fp/assignWith.d.ts", + "fp/assoc.d.ts", + "fp/assocPath.d.ts", + "fp/at.d.ts", + "fp/attempt.d.ts", + "fp/before.d.ts", + "fp/bind.d.ts", + "fp/bindAll.d.ts", + "fp/bindKey.d.ts", + "fp/camelCase.d.ts", + "fp/capitalize.d.ts", + "fp/castArray.d.ts", + "fp/ceil.d.ts", + "fp/chunk.d.ts", + "fp/clamp.d.ts", + "fp/clone.d.ts", + "fp/cloneDeep.d.ts", + "fp/cloneDeepWith.d.ts", + "fp/cloneWith.d.ts", + "fp/compact.d.ts", + "fp/complement.d.ts", + "fp/compose.d.ts", + "fp/concat.d.ts", + "fp/cond.d.ts", + "fp/conforms.d.ts", + "fp/conformsTo.d.ts", + "fp/constant.d.ts", + "fp/contains.d.ts", + "fp/countBy.d.ts", + "fp/create.d.ts", + "fp/curry.d.ts", + "fp/curryN.d.ts", + "fp/curryRight.d.ts", + "fp/curryRightN.d.ts", + "fp/debounce.d.ts", + "fp/deburr.d.ts", + "fp/defaults.d.ts", + "fp/defaultsAll.d.ts", + "fp/defaultsDeep.d.ts", + "fp/defaultsDeepAll.d.ts", + "fp/defaultTo.d.ts", + "fp/defer.d.ts", + "fp/delay.d.ts", + "fp/difference.d.ts", + "fp/differenceBy.d.ts", + "fp/differenceWith.d.ts", + "fp/dissoc.d.ts", + "fp/dissocPath.d.ts", + "fp/divide.d.ts", + "fp/drop.d.ts", + "fp/dropLast.d.ts", + "fp/dropLastWhile.d.ts", + "fp/dropRight.d.ts", + "fp/dropRightWhile.d.ts", + "fp/dropWhile.d.ts", + "fp/each.d.ts", + "fp/eachRight.d.ts", + "fp/endsWith.d.ts", + "fp/entries.d.ts", + "fp/entriesIn.d.ts", + "fp/eq.d.ts", + "fp/equals.d.ts", + "fp/escape.d.ts", + "fp/escapeRegExp.d.ts", + "fp/every.d.ts", + "fp/extend.d.ts", + "fp/extendAll.d.ts", + "fp/extendAllWith.d.ts", + "fp/extendWith.d.ts", + "fp/F.d.ts", + "fp/fill.d.ts", + "fp/filter.d.ts", + "fp/find.d.ts", + "fp/findFrom.d.ts", + "fp/findIndex.d.ts", + "fp/findIndexFrom.d.ts", + "fp/findKey.d.ts", + "fp/findLast.d.ts", + "fp/findLastFrom.d.ts", + "fp/findLastIndex.d.ts", + "fp/findLastIndexFrom.d.ts", + "fp/findLastKey.d.ts", + "fp/first.d.ts", + "fp/flatMap.d.ts", + "fp/flatMapDeep.d.ts", + "fp/flatMapDepth.d.ts", + "fp/flatten.d.ts", + "fp/flattenDeep.d.ts", + "fp/flattenDepth.d.ts", + "fp/flip.d.ts", + "fp/floor.d.ts", + "fp/flow.d.ts", + "fp/flowRight.d.ts", + "fp/forEach.d.ts", + "fp/forEachRight.d.ts", + "fp/forIn.d.ts", + "fp/forInRight.d.ts", + "fp/forOwn.d.ts", + "fp/forOwnRight.d.ts", + "fp/fromPairs.d.ts", + "fp/functions.d.ts", + "fp/functionsIn.d.ts", + "fp/get.d.ts", + "fp/getOr.d.ts", + "fp/groupBy.d.ts", + "fp/gt.d.ts", + "fp/gte.d.ts", + "fp/has.d.ts", + "fp/hasIn.d.ts", + "fp/head.d.ts", + "fp/identical.d.ts", + "fp/identity.d.ts", + "fp/includes.d.ts", + "fp/includesFrom.d.ts", + "fp/indexBy.d.ts", + "fp/indexOf.d.ts", + "fp/indexOfFrom.d.ts", + "fp/init.d.ts", + "fp/initial.d.ts", + "fp/inRange.d.ts", + "fp/intersection.d.ts", + "fp/intersectionBy.d.ts", + "fp/intersectionWith.d.ts", + "fp/invert.d.ts", + "fp/invertBy.d.ts", + "fp/invertObj.d.ts", + "fp/invoke.d.ts", + "fp/invokeArgs.d.ts", + "fp/invokeArgsMap.d.ts", + "fp/invokeMap.d.ts", + "fp/isArguments.d.ts", + "fp/isArray.d.ts", + "fp/isArrayBuffer.d.ts", + "fp/isArrayLike.d.ts", + "fp/isArrayLikeObject.d.ts", + "fp/isBoolean.d.ts", + "fp/isBuffer.d.ts", + "fp/isDate.d.ts", + "fp/isElement.d.ts", + "fp/isEmpty.d.ts", + "fp/isEqual.d.ts", + "fp/isEqualWith.d.ts", + "fp/isError.d.ts", + "fp/isFinite.d.ts", + "fp/isFunction.d.ts", + "fp/isInteger.d.ts", + "fp/isLength.d.ts", + "fp/isMap.d.ts", + "fp/isMatch.d.ts", + "fp/isMatchWith.d.ts", + "fp/isNaN.d.ts", + "fp/isNative.d.ts", + "fp/isNil.d.ts", + "fp/isNull.d.ts", + "fp/isNumber.d.ts", + "fp/isObject.d.ts", + "fp/isObjectLike.d.ts", + "fp/isPlainObject.d.ts", + "fp/isRegExp.d.ts", + "fp/isSafeInteger.d.ts", + "fp/isSet.d.ts", + "fp/isString.d.ts", + "fp/isSymbol.d.ts", + "fp/isTypedArray.d.ts", + "fp/isUndefined.d.ts", + "fp/isWeakMap.d.ts", + "fp/isWeakSet.d.ts", + "fp/iteratee.d.ts", + "fp/join.d.ts", + "fp/juxt.d.ts", + "fp/kebabCase.d.ts", + "fp/keyBy.d.ts", + "fp/keys.d.ts", + "fp/keysIn.d.ts", + "fp/last.d.ts", + "fp/lastIndexOf.d.ts", + "fp/lastIndexOfFrom.d.ts", + "fp/lowerCase.d.ts", + "fp/lowerFirst.d.ts", + "fp/lt.d.ts", + "fp/lte.d.ts", + "fp/map.d.ts", + "fp/mapKeys.d.ts", + "fp/mapValues.d.ts", + "fp/matches.d.ts", + "fp/matchesProperty.d.ts", + "fp/max.d.ts", + "fp/maxBy.d.ts", + "fp/mean.d.ts", + "fp/meanBy.d.ts", + "fp/memoize.d.ts", + "fp/merge.d.ts", + "fp/mergeAll.d.ts", + "fp/mergeAllWith.d.ts", + "fp/mergeWith.d.ts", + "fp/method.d.ts", + "fp/methodOf.d.ts", + "fp/min.d.ts", + "fp/minBy.d.ts", + "fp/multiply.d.ts", + "fp/nAry.d.ts", + "fp/negate.d.ts", + "fp/noConflict.d.ts", + "fp/noop.d.ts", + "fp/now.d.ts", + "fp/nth.d.ts", + "fp/nthArg.d.ts", + "fp/omit.d.ts", + "fp/omitAll.d.ts", + "fp/omitBy.d.ts", + "fp/once.d.ts", + "fp/orderBy.d.ts", + "fp/over.d.ts", + "fp/overArgs.d.ts", + "fp/overEvery.d.ts", + "fp/overSome.d.ts", + "fp/pad.d.ts", + "fp/padChars.d.ts", + "fp/padCharsEnd.d.ts", + "fp/padCharsStart.d.ts", + "fp/padEnd.d.ts", + "fp/padStart.d.ts", + "fp/parseInt.d.ts", + "fp/partial.d.ts", + "fp/partialRight.d.ts", + "fp/partition.d.ts", + "fp/path.d.ts", + "fp/pathEq.d.ts", + "fp/pathOr.d.ts", + "fp/paths.d.ts", + "fp/pick.d.ts", + "fp/pickAll.d.ts", + "fp/pickBy.d.ts", + "fp/pipe.d.ts", + "fp/pluck.d.ts", + "fp/prop.d.ts", + "fp/propEq.d.ts", + "fp/property.d.ts", + "fp/propertyOf.d.ts", + "fp/propOr.d.ts", + "fp/props.d.ts", + "fp/pull.d.ts", + "fp/pullAll.d.ts", + "fp/pullAllBy.d.ts", + "fp/pullAllWith.d.ts", + "fp/pullAt.d.ts", + "fp/random.d.ts", + "fp/range.d.ts", + "fp/rangeRight.d.ts", + "fp/rangeStep.d.ts", + "fp/rangeStepRight.d.ts", + "fp/rearg.d.ts", + "fp/reduce.d.ts", + "fp/reduceRight.d.ts", + "fp/reject.d.ts", + "fp/remove.d.ts", + "fp/repeat.d.ts", + "fp/replace.d.ts", + "fp/rest.d.ts", + "fp/restFrom.d.ts", + "fp/result.d.ts", + "fp/reverse.d.ts", + "fp/round.d.ts", + "fp/runInContext.d.ts", + "fp/sample.d.ts", + "fp/sampleSize.d.ts", + "fp/set.d.ts", + "fp/setWith.d.ts", + "fp/shuffle.d.ts", + "fp/size.d.ts", + "fp/slice.d.ts", + "fp/snakeCase.d.ts", + "fp/some.d.ts", + "fp/sortBy.d.ts", + "fp/sortedIndex.d.ts", + "fp/sortedIndexBy.d.ts", + "fp/sortedIndexOf.d.ts", + "fp/sortedLastIndex.d.ts", + "fp/sortedLastIndexBy.d.ts", + "fp/sortedLastIndexOf.d.ts", + "fp/sortedUniq.d.ts", + "fp/sortedUniqBy.d.ts", + "fp/split.d.ts", + "fp/spread.d.ts", + "fp/spreadFrom.d.ts", + "fp/startCase.d.ts", + "fp/startsWith.d.ts", + "fp/stubArray.d.ts", + "fp/stubFalse.d.ts", + "fp/stubObject.d.ts", + "fp/stubString.d.ts", + "fp/stubTrue.d.ts", + "fp/subtract.d.ts", + "fp/sum.d.ts", + "fp/sumBy.d.ts", + "fp/symmetricDifference.d.ts", + "fp/symmetricDifferenceBy.d.ts", + "fp/symmetricDifferenceWith.d.ts", + "fp/T.d.ts", + "fp/tail.d.ts", + "fp/take.d.ts", + "fp/takeLast.d.ts", + "fp/takeLastWhile.d.ts", + "fp/takeRight.d.ts", + "fp/takeRightWhile.d.ts", + "fp/takeWhile.d.ts", + "fp/tap.d.ts", + "fp/template.d.ts", + "fp/throttle.d.ts", + "fp/thru.d.ts", + "fp/times.d.ts", + "fp/toArray.d.ts", + "fp/toFinite.d.ts", + "fp/toInteger.d.ts", + "fp/toLength.d.ts", + "fp/toLower.d.ts", + "fp/toNumber.d.ts", + "fp/toPairs.d.ts", + "fp/toPairsIn.d.ts", + "fp/toPath.d.ts", + "fp/toPlainObject.d.ts", + "fp/toSafeInteger.d.ts", + "fp/toString.d.ts", + "fp/toUpper.d.ts", + "fp/transform.d.ts", + "fp/trim.d.ts", + "fp/trimChars.d.ts", + "fp/trimCharsEnd.d.ts", + "fp/trimCharsStart.d.ts", + "fp/trimEnd.d.ts", + "fp/trimStart.d.ts", + "fp/truncate.d.ts", + "fp/unapply.d.ts", + "fp/unary.d.ts", + "fp/unescape.d.ts", + "fp/union.d.ts", + "fp/unionBy.d.ts", + "fp/unionWith.d.ts", + "fp/uniq.d.ts", + "fp/uniqBy.d.ts", + "fp/uniqueId.d.ts", + "fp/uniqWith.d.ts", + "fp/unnest.d.ts", + "fp/unset.d.ts", + "fp/unzip.d.ts", + "fp/unzipWith.d.ts", + "fp/update.d.ts", + "fp/updateWith.d.ts", + "fp/upperCase.d.ts", + "fp/upperFirst.d.ts", + "fp/useWith.d.ts", + "fp/values.d.ts", + "fp/valuesIn.d.ts", + "fp/where.d.ts", + "fp/whereEq.d.ts", + "fp/without.d.ts", + "fp/words.d.ts", + "fp/wrap.d.ts", + "fp/xor.d.ts", + "fp/xorBy.d.ts", + "fp/xorWith.d.ts", + "fp/zip.d.ts", + "fp/zipAll.d.ts", + "fp/zipObj.d.ts", + "fp/zipObject.d.ts", + "fp/zipObjectDeep.d.ts", + "fp/zipWith.d.ts", + "fp/__.d.ts", + "fp/placeholder.d.ts" ] } \ No newline at end of file From cef224b43ff060c8f5192aae022079c1a0841f66 Mon Sep 17 00:00:00 2001 From: Eugene Arshinov Date: Sat, 12 May 2018 18:55:15 +0300 Subject: [PATCH 068/575] Fix return type of `CKEDITOR.dom.element.getBogus` Dcoumentation link: https://docs.ckeditor.com/ckeditor4/latest/api/CKEDITOR_dom_element.html#method-getBogus --- types/ckeditor/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/ckeditor/index.d.ts b/types/ckeditor/index.d.ts index 3370479bff..ccc58b7f71 100644 --- a/types/ckeditor/index.d.ts +++ b/types/ckeditor/index.d.ts @@ -224,7 +224,7 @@ declare namespace CKEDITOR { focusPrevious(ignoreChildren?: boolean, indexToUse?: number): void; forEach(callback: (node: node) => void, type?: number, skipRoot?: boolean): void; getAttribute(name: string): string; - getBogus(): Object; + getBogus(): node|false; getChild(indices: number): node; getChild(indices: number[]): node; getChildCount(): number; From 96f741e68e340519255615c75b208f4a201fb729 Mon Sep 17 00:00:00 2001 From: Bruno Lemos Date: Sat, 12 May 2018 16:25:32 -0300 Subject: [PATCH 069/575] [react-native] Add missing fields on ViewStyle --- types/react-native/index.d.ts | 62 +++++++++++++---------------------- 1 file changed, 23 insertions(+), 39 deletions(-) diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index 756ef2b340..47b256089b 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -542,7 +542,7 @@ type FlexAlignType = "flex-start" | "flex-end" | "center" | "stretch" | "baselin * Flex Prop Types * @see https://facebook.github.io/react-native/docs/flexbox.html#proptypes * @see https://facebook.github.io/react-native/docs/layout-props.html - * @see LayoutPropTypes.js + * @see https://github.com/facebook/react-native/blob/master/Libraries/StyleSheet/LayoutPropTypes.js */ export interface FlexStyle { alignContent?: "flex-start" | "flex-end" | "center" | "stretch" | "space-between" | "space-around"; @@ -608,7 +608,7 @@ export interface FlexStyle { /** * Layout Prop Types * @see https://facebook.github.io/react-native/docs/layout-props.html - * @see LayoutPropTypes.js + * @see https://github.com/facebook/react-native/blob/master/Libraries/StyleSheet/LayoutPropTypes.js */ export interface LayoutProps extends FlexStyle {} @@ -1578,32 +1578,43 @@ export interface GestureResponderHandlers { } // @see https://facebook.github.io/react-native/docs/view.html#style -export interface ViewStyle extends FlexStyle, TransformsStyle { +export interface ViewStyle extends FlexStyle, ShadowStyleIOS, TransformsStyle { backfaceVisibility?: "visible" | "hidden"; backgroundColor?: string; borderBottomColor?: string; + borderBottomEndRadius?: number; borderBottomLeftRadius?: number; borderBottomRightRadius?: number; + borderBottomStartRadius?: number; borderBottomWidth?: number; borderColor?: string; + borderEndColor?: string; borderLeftColor?: string; + borderLeftWidth?: number; borderRadius?: number; borderRightColor?: string; borderRightWidth?: number; + borderStartColor?: string; borderStyle?: "solid" | "dotted" | "dashed"; borderTopColor?: string; + borderTopEndRadius?: number; borderTopLeftRadius?: number; borderTopRightRadius?: number; + borderTopStartRadius?: number; borderTopWidth?: number; - display?: "none" | "flex"; + borderWidth?: number; opacity?: number; overflow?: "visible" | "hidden"; - shadowColor?: string; - shadowOffset?: { width: number; height: number }; - shadowOpacity?: number; - shadowRadius?: number; - elevation?: number; testID?: string; + /** + * Sets the elevation of a view, using Android's underlying + * [elevation API](https://developer.android.com/training/material/shadows-clipping.html#Elevation). + * This adds a drop shadow to the item and affects z-order for overlapping views. + * Only supported on Android 5.0+, has no effect on earlier versions. + * + * @platform android + */ + elevation?: number; } export interface ViewPropsIOS { @@ -3230,8 +3241,9 @@ export interface ShadowStyleIOS { /** * Image style * @see https://facebook.github.io/react-native/docs/image.html#style + * @see https://github.com/facebook/react-native/blob/master/Libraries/Image/ImageStylePropTypes.js */ -export interface ImageStyle extends FlexStyle, TransformsStyle, ShadowStyleIOS { +export interface ImageStyle extends FlexStyle, ShadowStyleIOS, TransformsStyle { resizeMode?: ImageResizeMode; backfaceVisibility?: "visible" | "hidden"; borderBottomLeftRadius?: number; @@ -5462,34 +5474,6 @@ export interface InteractionManagerStatic extends EventEmitterListener { setDeadline(deadline: number): void; } -export interface ScrollViewStyle extends FlexStyle, TransformsStyle { - backfaceVisibility?: "visible" | "hidden"; - backgroundColor?: string; - borderColor?: string; - borderTopColor?: string; - borderRightColor?: string; - borderBottomColor?: string; - borderLeftColor?: string; - borderRadius?: number; - borderTopLeftRadius?: number; - borderTopRightRadius?: number; - borderBottomLeftRadius?: number; - borderBottomRightRadius?: number; - borderStyle?: "solid" | "dotted" | "dashed"; - borderWidth?: number; - borderTopWidth?: number; - borderRightWidth?: number; - borderBottomWidth?: number; - borderLeftWidth?: number; - opacity?: number; - overflow?: "visible" | "hidden"; - shadowColor?: string; - shadowOffset?: { width: number; height: number }; - shadowOpacity?: number; - shadowRadius?: number; - elevation?: number; -} - export interface ScrollResponderEvent extends NativeSyntheticEvent {} interface ScrollResponderMixin extends SubscribableMixin { @@ -6058,7 +6042,7 @@ export interface ScrollViewProps /** * Style */ - style?: StyleProp; + style?: StyleProp; /** * A RefreshControl component, used to provide pull-to-refresh From 8cc6c8d931150740b3b8c0a1f446ad03f506521f Mon Sep 17 00:00:00 2001 From: Bruno Lemos Date: Sat, 12 May 2018 16:36:41 -0300 Subject: [PATCH 070/575] [react-native] Make ViewProps extends ViewStyle https://github.com/facebook/react-native/blob/master/Libraries/Components/View/ViewStylePropTypes.js --- types/react-native/index.d.ts | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index 47b256089b..61f15c086c 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -604,14 +604,6 @@ export interface FlexStyle { direction?: "inherit" | "ltr" | "rtl"; } - -/** - * Layout Prop Types - * @see https://facebook.github.io/react-native/docs/layout-props.html - * @see https://github.com/facebook/react-native/blob/master/Libraries/StyleSheet/LayoutPropTypes.js - */ -export interface LayoutProps extends FlexStyle {} - /** * @see ShadowPropTypesIOS.js */ @@ -1577,7 +1569,10 @@ export interface GestureResponderHandlers { onMoveShouldSetResponderCapture?: (event: GestureResponderEvent) => boolean; } -// @see https://facebook.github.io/react-native/docs/view.html#style +/** + * @see https://facebook.github.io/react-native/docs/view.html#style + * @see https://github.com/facebook/react-native/blob/master/Libraries/Components/View/ViewStylePropTypes.js + */ export interface ViewStyle extends FlexStyle, ShadowStyleIOS, TransformsStyle { backfaceVisibility?: "visible" | "hidden"; backgroundColor?: string; @@ -1684,6 +1679,7 @@ export interface ViewPropsAndroid { renderToHardwareTextureAndroid?: boolean; } + type Falsy = undefined | null | false; interface RecursiveArray extends Array> {} /** Keep a brand of 'T' so that calls to `StyleSheet.flatten` can take `RegisteredStyle` and return `T`. */ @@ -1783,7 +1779,7 @@ type AccessibilityTraits = * @see https://facebook.github.io/react-native/docs/view.html#props */ export interface ViewProps - extends ViewPropsAndroid, ViewPropsIOS, GestureResponderHandlers, Touchable, AccessibilityProps, LayoutProps { + extends ViewPropsAndroid, ViewPropsIOS, GestureResponderHandlers, Touchable, AccessibilityProps, ViewStyle { /** * This defines how far a touch event can start away from the view. * Typical interface guidelines recommend touch targets that are at least @@ -3390,7 +3386,7 @@ export type ImageSourcePropType = ImageURISource | ImageURISource[] | ImageRequi /** * @see https://facebook.github.io/react-native/docs/image.html */ -export interface ImageProps extends ImagePropsIOS, ImagePropsAndroid, AccessibilityProps, LayoutProps { +export interface ImageProps extends ImagePropsIOS, ImagePropsAndroid, AccessibilityProps, ViewStyle { /** * onLayout function * From 27646c6d509b78b2813dd631d20ab48afebe46ff Mon Sep 17 00:00:00 2001 From: Bruno Lemos Date: Sat, 12 May 2018 17:20:09 -0300 Subject: [PATCH 071/575] [react-native] Remove references of ScrollViewStyle --- types/react-native-snap-carousel/index.d.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/types/react-native-snap-carousel/index.d.ts b/types/react-native-snap-carousel/index.d.ts index 4b54a480f6..5b5406f6fa 100644 --- a/types/react-native-snap-carousel/index.d.ts +++ b/types/react-native-snap-carousel/index.d.ts @@ -14,7 +14,6 @@ import { NativeScrollEvent, StyleProp, ScrollViewProps, - ScrollViewStyle, ViewStyle, ImageProps, FlatListProps @@ -180,11 +179,11 @@ export interface CarouselProps extends React.Props { /** * Optional styles for Scrollview's global wrapper */ - containerCustomStyle?: StyleProp; + containerCustomStyle?: StyleProp; /** * Optional styles for Scrollview's items container */ - contentContainerCustomStyle?: StyleProp; + contentContainerCustomStyle?: StyleProp; /** * Value of the opacity effect applied to inactive slides */ From 3d7e710e5f770db12ceadd1b2ca8f43956f0b4c8 Mon Sep 17 00:00:00 2001 From: Bruno Lemos Date: Sat, 12 May 2018 17:37:19 -0300 Subject: [PATCH 072/575] [react-native] Make View overflow support scroll value --- types/react-native/index.d.ts | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index 61f15c086c..63f3157dfc 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -1599,7 +1599,6 @@ export interface ViewStyle extends FlexStyle, ShadowStyleIOS, TransformsStyle { borderTopWidth?: number; borderWidth?: number; opacity?: number; - overflow?: "visible" | "hidden"; testID?: string; /** * Sets the elevation of a view, using Android's underlying @@ -3386,7 +3385,7 @@ export type ImageSourcePropType = ImageURISource | ImageURISource[] | ImageRequi /** * @see https://facebook.github.io/react-native/docs/image.html */ -export interface ImageProps extends ImagePropsIOS, ImagePropsAndroid, AccessibilityProps, ViewStyle { +export interface ImagePropsBase extends ImagePropsIOS, ImagePropsAndroid, AccessibilityProps, ViewStyle { /** * onLayout function * @@ -3491,16 +3490,18 @@ export interface ImageProps extends ImagePropsIOS, ImagePropsAndroid, Accessibil */ loadingIndicatorSource?: ImageURISource; + /** + * A unique identifier for this element to be used in UI Automation testing scripts. + */ + testID?: string; +} + +export interface ImageProps extends ImagePropsBase { /** * * Style */ style?: StyleProp; - - /** - * A unique identifier for this element to be used in UI Automation testing scripts. - */ - testID?: string; } declare class ImageComponent extends React.Component {} @@ -3513,7 +3514,7 @@ export class Image extends ImageBase { queryCache?(urls: string[]): Promise>; } -export interface ImageBackgroundProps extends ImageProps { +export interface ImageBackgroundProps extends ImagePropsBase { style?: StyleProp; imageStyle?: StyleProp; } From a72c9959063eb9c62d39d99cb8e81809f7d046ed Mon Sep 17 00:00:00 2001 From: Vincent Langlet Date: Sun, 13 May 2018 01:05:59 +0200 Subject: [PATCH 073/575] Add GlobalFetch / RequestInfo definitions --- types/react-native/globals.d.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/types/react-native/globals.d.ts b/types/react-native/globals.d.ts index 92ae988ecb..2110ab7278 100644 --- a/types/react-native/globals.d.ts +++ b/types/react-native/globals.d.ts @@ -25,7 +25,11 @@ declare function fetchBundle(bundleId: number, callback: (error?: Error | null) // Fetch API // -declare function fetch(input: Request | string, init?: RequestInit): Promise; +declare interface GlobalFetch { + fetch(input: RequestInfo, init?: RequestInit): Promise; +} + +declare function fetch(input: RequestInfo, init?: RequestInit): Promise; interface Blob {} @@ -85,6 +89,8 @@ declare var Request: { new(input: Request | string, init?: RequestInit): Request; }; +declare type RequestInfo = Request | string; + declare interface ResponseInit { headers?: HeadersInit_; status?: number; From a11ee4ecf413c54cf7250d5ddab07e8bf10095c1 Mon Sep 17 00:00:00 2001 From: Seth Kingsley Date: Sun, 13 May 2018 01:18:33 -0700 Subject: [PATCH 074/575] Update some three.js types --- types/three/index.d.ts | 1 + types/three/three-core.d.ts | 44 +++++++++++++++++++------------- types/three/three-tgaloader.d.ts | 11 ++++++++ 3 files changed, 38 insertions(+), 18 deletions(-) create mode 100644 types/three/three-tgaloader.d.ts diff --git a/types/three/index.d.ts b/types/three/index.d.ts index 50450fd793..2c8d006589 100644 --- a/types/three/index.d.ts +++ b/types/three/index.d.ts @@ -28,6 +28,7 @@ export * from "./three-renderpass"; export * from "./three-shaderpass"; export * from "./three-smaapass"; export * from "./three-filmpass"; +export * from "./three-tgaloader"; export * from "./three-trackballcontrols"; export * from "./three-transformcontrols"; export * from "./three-vrcontrols"; diff --git a/types/three/three-core.d.ts b/types/three/three-core.d.ts index 2487b117b1..c9b67f5c36 100644 --- a/types/three/three-core.d.ts +++ b/types/three/three-core.d.ts @@ -1015,8 +1015,8 @@ export class DirectGeometry extends EventDispatcher { uvs2: Vector2[]; groups: {start: number, materialIndex: number}[]; morphTargets: MorphTarget[]; - skinWeights: number[]; - skinIndices: number[]; + skinWeights: Vector4[]; + skinIndices: Vector4[]; boundingBox: Box3; boundingSphere: Sphere; verticesNeedUpdate: boolean; @@ -1270,12 +1270,12 @@ export class Geometry extends EventDispatcher { /** * Array of skinning weights, matching number and order of vertices. */ - skinWeights: number[]; + skinWeights: Vector4[]; /** * Array of skinning indices, matching number and order of vertices. */ - skinIndices: number[]; + skinIndices: Vector4[]; /** * @@ -2151,7 +2151,7 @@ export class FileLoader { responseType: string; withCredentials: string; - load(url: string, onLoad?: (responseText: string) => void, onProgress?: (request: ProgressEvent) => void, onError?:(event: ErrorEvent) => void): any; + load(url: string, onLoad?: (response: string | ArrayBuffer) => void, onProgress?: (request: ProgressEvent) => void, onError?:(event: ErrorEvent) => void): any; setMimeType(mimeType: MimeType): FileLoader; setPath(path: string) : FileLoader; setResponseType(responseType: string) : FileLoader; @@ -2209,7 +2209,7 @@ export class JSONLoader extends Loader { export class LoadingManager { constructor(onLoad?: () => void, onProgress?: (url: string, loaded: number, total: number) => void, onError?: () => void); - onStart: () => void; + onStart: (url: string, loaded: number, total: number) => void; /** * Will be called when load starts. @@ -2227,7 +2227,9 @@ export class LoadingManager { * Will be called when each element in the scene completes loading. * The default is a function with empty body. */ - onError: () => void; + onError: (url: string) => void; + + setURLModifier(callback : (url: string) => string): void; itemStart(url: string): void; itemEnd(url: string): void; @@ -2350,6 +2352,11 @@ export namespace Cache { export function clear(): void; } +export class LoaderUtils { + static decodeText(array: Uint8Array): string; + static extractUrlBase(url: string): string; +} + // Materials ////////////////////////////////////////////////////////////////////////////////// export let MaterialIdCount: number; @@ -2900,24 +2907,24 @@ export class MeshPhongMaterial extends Material { color: Color; specular: Color; shininess: number; - map: Texture; + map?: Texture; lightMap: Texture; lightMapIntensity: number; - aoMap: Texture; + aoMap?: Texture; aoMapIntensity: number; emissive: Color; emissiveIntensity: number; emissiveMap: Texture; - bumpMap: Texture; + bumpMap?: Texture; bumpScale: number; - normalMap: Texture; + normalMap?: Texture; normalScale: Vector2; displacementMap: Texture; displacementScale: number; displacementBias: number; - specularMap: Texture; - alphaMap: Texture; - envMap: Texture; + specularMap?: Texture; + alphaMap?: Texture; + envMap?: Texture; combine: Combine; reflectivity: number; refractionRatio: number; @@ -5020,9 +5027,7 @@ export class QuaternionLinearInterpolant extends Interpolant { // Objects ////////////////////////////////////////////////////////////////////////////////// export class Bone extends Object3D { - constructor(skin: SkinnedMesh); - - skin: SkinnedMesh; + constructor(); } export class Group extends Object3D { @@ -6132,6 +6137,9 @@ export class WebGLState { }; init(): void; + texImage2D(target: number, level: number, internalformat: number, + width: number, height: number, border: number, format: number, + type: number, pixels?: ArrayBufferView | null): void; initAttributes(): void; enableAttribute(attribute: string): void; enableAttributeAndDivisor(attribute: string, meshPerAttribute: any, extension: any): void; @@ -6139,7 +6147,7 @@ export class WebGLState { enable(id: string): void; disable(id: string): void; getCompressedTextureFormats(): any[]; - setBlending(blending: number, blendEquation: number, blendSrc: number, blendDst: number, blendEquationAlpha: number, blendSrcAlpha: number, blendDstAlpha: number): void; + setBlending(blending: number, blendEquation?: number, blendSrc?: number, blendDst?: number, blendEquationAlpha?: number, blendSrcAlpha?: number, blendDstAlpha?: number, premultiplyAlpha?: boolean): void; setColorWrite(colorWrite: number): void; setDepthTest(depthTest: number): void; setDepthWrite(depthWrite: number): void; diff --git a/types/three/three-tgaloader.d.ts b/types/three/three-tgaloader.d.ts new file mode 100644 index 0000000000..cf25bad8dd --- /dev/null +++ b/types/three/three-tgaloader.d.ts @@ -0,0 +1,11 @@ +// https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/TGALoader.js + +import { LoadingManager, Texture } from "./three-core"; + +export class TGALoader { + constructor(manager?: LoadingManager); + + manager: LoadingManager; + + load(url: string, onLoad?: (texture: Texture) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): Texture; +} From 72ade1444e92dfca78d412c4465d171e214e449b Mon Sep 17 00:00:00 2001 From: Hugues Stefanski Date: Sun, 13 May 2018 12:14:28 +0200 Subject: [PATCH 075/575] d3-color : moved hex at Color interface level --- types/d3-color/index.d.ts | 35 ++++++++--------------------------- 1 file changed, 8 insertions(+), 27 deletions(-) diff --git a/types/d3-color/index.d.ts b/types/d3-color/index.d.ts index 68dcf9e358..a616543bfe 100644 --- a/types/d3-color/index.d.ts +++ b/types/d3-color/index.d.ts @@ -38,6 +38,11 @@ export interface ColorCommonInstance { export interface Color { displayable(): boolean; // Note: While this method is used in prototyping for colors of specific colorspaces, it should not be called directly, as 'this.rgb' would not be implemented on Color toString(): string; // Note: While this method is used in prototyping for colors of specific colorspaces, it should not be called directly, as 'this.rgb' would not be implemented on Color + /** + * Returns a hexadecimal string representing this color. + * If this color is not displayable, a suitable displayable color is returned instead. For example, RGB channel values greater than 255 are clamped to 255. + */ + hex(): string; } export interface ColorFactory extends Function { @@ -57,11 +62,6 @@ export interface RGBColor extends Color { * Returns the RGB equivalent of this color. */ rgb(): this; - /** - * Returns a hexadecimal string representing this color. - * If this color is not displayable, a suitable displayable color is returned instead. For example, RGB channel values greater than 255 are clamped to 255. - */ - hex(): string; } export interface RGBColorFactory extends Function { @@ -79,11 +79,6 @@ export interface HSLColor extends Color { brighter(k?: number): this; darker(k?: number): this; rgb(): RGBColor; - /** - * Returns a hexadecimal string representing this color. - * If this color is not displayable, a suitable displayable color is returned instead. For example, RGB channel values greater than 255 are clamped to 255. - */ - hex(): string; } export interface HSLColorFactory extends Function { @@ -101,11 +96,6 @@ export interface LabColor extends Color { brighter(k?: number): this; darker(k?: number): this; rgb(): RGBColor; - /** - * Returns a hexadecimal string representing this color. - * If this color is not displayable, a suitable displayable color is returned instead. For example, RGB channel values greater than 255 are clamped to 255. - */ - hex(): string; } export interface LabColorFactory extends Function { @@ -118,12 +108,13 @@ export interface LabColorFactory extends Function { /** * Constructs a new Lab color with the specified l value and a = b = 0. */ +export type GrayColorFactory = (l: number, opacity?: number) => LabColor; + +// Using the interface creates an error // export interface GrayColorFactory extends Function { // (l: number, opacity?: number): LabColor; // } -export type GrayColorFactory = (l: number, opacity?: number) => LabColor; - export interface HCLColor extends Color { h: number; c: number; @@ -132,11 +123,6 @@ export interface HCLColor extends Color { brighter(k?: number): this; darker(k?: number): this; rgb(): RGBColor; - /** - * Returns a hexadecimal string representing this color. - * If this color is not displayable, a suitable displayable color is returned instead. For example, RGB channel values greater than 255 are clamped to 255. - */ - hex(): string; } export interface HCLColorFactory extends Function { @@ -160,11 +146,6 @@ export interface CubehelixColor extends Color { brighter(k?: number): this; darker(k?: number): this; rgb(): RGBColor; - /** - * Returns a hexadecimal string representing this color. - * If this color is not displayable, a suitable displayable color is returned instead. For example, RGB channel values greater than 255 are clamped to 255. - */ - hex(): string; } export interface CubehelixColorFactory extends Function { From a1fca63f40c5c99b317c7600d4c45bcaf8cacd23 Mon Sep 17 00:00:00 2001 From: Karol Majewski Date: Sun, 13 May 2018 12:21:06 +0200 Subject: [PATCH 076/575] Create definitions for memoize-one --- types/memoize-one/index.d.ts | 12 ++++++++++ types/memoize-one/memoize-one-tests.ts | 33 ++++++++++++++++++++++++++ types/memoize-one/tsconfig.json | 23 ++++++++++++++++++ types/memoize-one/tslint.json | 1 + 4 files changed, 69 insertions(+) create mode 100644 types/memoize-one/index.d.ts create mode 100644 types/memoize-one/memoize-one-tests.ts create mode 100644 types/memoize-one/tsconfig.json create mode 100644 types/memoize-one/tslint.json diff --git a/types/memoize-one/index.d.ts b/types/memoize-one/index.d.ts new file mode 100644 index 0000000000..caac3a4429 --- /dev/null +++ b/types/memoize-one/index.d.ts @@ -0,0 +1,12 @@ +// Type definitions for memoize-one 3.1 +// Project: https://github.com/alexreardon/memoize-one#readme +// Definitions by: Karol Majewski +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = memoizeOne; + +declare function memoizeOne any>(resultFn: T, isEqual?: memoizeOne.EqualityFn): T; + +declare namespace memoizeOne { + type EqualityFn = (a: any, b: any) => boolean; +} diff --git a/types/memoize-one/memoize-one-tests.ts b/types/memoize-one/memoize-one-tests.ts new file mode 100644 index 0000000000..7ab20ac891 --- /dev/null +++ b/types/memoize-one/memoize-one-tests.ts @@ -0,0 +1,33 @@ +import memoizeOne = require('memoize-one'); + +declare function add(a: number, b: number): number ; +declare function lousyEqualityFn(a: any, b: any): boolean; +declare function strictEqualityFn(a: T, b: T): boolean; + +/** + * Accepts a second argument. + */ +memoizeOne(add); // $ExpectType (a: number, b: number) => number +memoizeOne(add, lousyEqualityFn); // $ExpectType (a: number, b: number) => number +memoizeOne(add, strictEqualityFn); // $ExpectType (a: number, b: number) => number + +/** + * The second argument can be, but doesn't have to be stritly typed. + */ +memoizeOne(add, (a, b) => a === b); // $ExpectType (a: number, b: number) => number +memoizeOne(add, (a: string, b: string) => a === b); // $ExpectType (a: number, b: number) => number + +/** + * Function passed as the second argument accepts exactly two arguments. + */ +memoizeOne(add, (a: number, b: number, c: number) => a === b || c); // $ExpectError + +/** + * Function passed as the second argument returns a boolean. + */ +memoizeOne(add, (a: string, b: string) => 0); // $ExpectError + +/** + * The `EqualityFn` type is publicly accessible. + */ +const simpleIsEqual: memoizeOne.EqualityFn = (x: number, y: number): boolean => (x === y); diff --git a/types/memoize-one/tsconfig.json b/types/memoize-one/tsconfig.json new file mode 100644 index 0000000000..af1c249358 --- /dev/null +++ b/types/memoize-one/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", + "memoize-one-tests.ts" + ] +} diff --git a/types/memoize-one/tslint.json b/types/memoize-one/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/memoize-one/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 4354ee8e6d45e737a92a7ad7358c7ec143920489 Mon Sep 17 00:00:00 2001 From: bglee Date: Sun, 13 May 2018 23:59:37 +0900 Subject: [PATCH 077/575] fix bind definition & test code --- types/ramda/index.d.ts | 2 +- types/ramda/ramda-tests.ts | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index 9849ee48b1..65e291c27e 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -293,7 +293,7 @@ declare namespace R { * Creates a function that is bound to a context. Note: R.bind does not provide the additional argument-binding * capabilities of Function.prototype.bind. */ - bind(thisObj: T, fn: (...args: any[]) => any): (...args: any[]) => any; + bind(fn: (...args: any[]) => any, thisObj: T): (...args: any[]) => any; /** * A function wrapping calls to the two functions in an && operation, returning the result of the first function diff --git a/types/ramda/ramda-tests.ts b/types/ramda/ramda-tests.ts index 8cbbf9ceac..e7aacb34c2 100644 --- a/types/ramda/ramda-tests.ts +++ b/types/ramda/ramda-tests.ts @@ -2417,3 +2417,7 @@ class Why { R.intersection([1, 2, 3], [2, 3, 3, 4]); // => [2, 3] R.intersection([1, 2, 3])([2, 3, 3, 4]); // => [2, 3] }; + +() => { + R.bind(console.log, console); +}; From 38f44407b141d05a8f533cc152836db3e874bdfb Mon Sep 17 00:00:00 2001 From: Zev Spitz Date: Sun, 13 May 2018 17:28:16 +0200 Subject: [PATCH 078/575] Switch dependency on lib.scripthost.d.ts to activex-interop --- types/activex-access/index.d.ts | 2 +- types/activex-access/tsconfig.json | 3 +-- types/activex-adodb/activex-adodb-tests.ts | 7 +++++-- types/activex-adodb/index.d.ts | 3 ++- types/activex-adodb/tsconfig.json | 3 +-- types/activex-adox/activex-adox-tests.ts | 2 ++ types/activex-adox/index.d.ts | 5 +---- types/activex-adox/tsconfig.json | 5 +++-- types/activex-dao/activex-dao-tests.ts | 2 ++ types/activex-dao/index.d.ts | 6 ++---- types/activex-dao/tsconfig.json | 3 +-- types/activex-diskquota/index.d.ts | 7 ++----- types/activex-diskquota/tsconfig.json | 3 +-- types/activex-excel/activex-excel-tests.ts | 5 +++-- types/activex-excel/index.d.ts | 1 - types/activex-excel/tsconfig.json | 3 +-- types/activex-faxcomexlib/activex-faxcomexlib-tests.ts | 7 ++++--- types/activex-faxcomexlib/index.d.ts | 1 - types/activex-faxcomexlib/tsconfig.json | 3 +-- types/activex-infopath/index.d.ts | 1 - types/activex-infopath/tsconfig.json | 3 +-- types/activex-libreoffice/activex-libreoffice-tests.ts | 2 ++ types/activex-libreoffice/index.d.ts | 5 ++--- types/activex-libreoffice/tsconfig.json | 3 +-- types/activex-msforms/index.d.ts | 1 - types/activex-msforms/tsconfig.json | 3 +-- types/activex-mshtml/activex-mshtml-tests.ts | 2 ++ types/activex-mshtml/index.d.ts | 1 - types/activex-mshtml/tsconfig.json | 3 +-- types/activex-msxml2/activex-msxml2-tests.ts | 2 ++ types/activex-msxml2/index.d.ts | 3 ++- types/activex-msxml2/tsconfig.json | 3 +-- types/activex-office/activex-office-tests.ts | 1 + types/activex-office/tsconfig.json | 3 +-- types/activex-outlook/index.d.ts | 2 +- types/activex-outlook/tsconfig.json | 3 +-- types/activex-powerpoint/activex-powerpoint-tests.ts | 6 +++--- types/activex-powerpoint/index.d.ts | 1 - types/activex-powerpoint/tsconfig.json | 3 +-- types/activex-scripting/activex-scripting-tests.ts | 2 ++ types/activex-scripting/index.d.ts | 3 ++- types/activex-scripting/tsconfig.json | 3 +-- types/activex-shdocvw/index.d.ts | 7 ++----- types/activex-shdocvw/tsconfig.json | 3 +-- types/activex-shell/activex-shell-tests.ts | 2 +- types/activex-shell/index.d.ts | 1 - types/activex-shell/tsconfig.json | 3 +-- types/activex-stdole/index.d.ts | 3 ++- types/activex-stdole/tsconfig.json | 3 +-- types/activex-vbide/activex-vbide-tests.ts | 1 + types/activex-vbide/tsconfig.json | 3 +-- types/activex-wia/activex-wia-tests.ts | 2 ++ types/activex-wia/index.d.ts | 3 ++- types/activex-wia/tsconfig.json | 3 +-- types/activex-word/activex-word-tests.ts | 6 ++++-- types/activex-word/index.d.ts | 2 +- types/activex-word/tsconfig.json | 5 +---- 57 files changed, 82 insertions(+), 95 deletions(-) diff --git a/types/activex-access/index.d.ts b/types/activex-access/index.d.ts index 2529538cad..4c531ea3ce 100644 --- a/types/activex-access/index.d.ts +++ b/types/activex-access/index.d.ts @@ -4,6 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 +/// /// /// /// @@ -8882,7 +8883,6 @@ interface ActiveXObject { Access.OptionButton | Access.OptionGroup | Access.Page | Access.SubForm | Access.TabControl | Access.TextBox | Access.ToggleButton | Access.WebBrowserControl, propertyName: 'accName' | 'accValue', parameterTypes: [any], newValue: string): void; set(obj: Access._ControlInReportEvents | Access.ComboBox | Access.Control | Access.ListBox, propertyName: 'Selected', parameterTypes: [number], newValue: number): void; - new(progid: K): ActiveXObjectNameMap[K]; } interface ActiveXObjectNameMap { diff --git a/types/activex-access/tsconfig.json b/types/activex-access/tsconfig.json index a376fcb722..867c1e2970 100644 --- a/types/activex-access/tsconfig.json +++ b/types/activex-access/tsconfig.json @@ -2,8 +2,7 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es5", - "scripthost" + "es5" ], "noImplicitAny": true, "noImplicitThis": true, diff --git a/types/activex-adodb/activex-adodb-tests.ts b/types/activex-adodb/activex-adodb-tests.ts index 347e1d9c9f..eecc7e9bdc 100644 --- a/types/activex-adodb/activex-adodb-tests.ts +++ b/types/activex-adodb/activex-adodb-tests.ts @@ -1,5 +1,8 @@ // Note -- running these tests under cscript requires some ES5 polyfills +/// +/// + const collectionToArray = (col: { Item(key: any): T }): T[] => { const results: T[] = []; const enumerator = new Enumerator(col); @@ -12,9 +15,9 @@ const collectionToArray = (col: { Item(key: any): T }): T[] => { }; const toSafeArray = (...items: T[]): SafeArray => { - const dict = new ActiveXObject('Scripting.Dictionary'); + const dict: Scripting.Dictionary = new ActiveXObject('Scripting.Dictionary'); items.forEach((x, index) => dict.Add(index, x)); - return dict.Items() as SafeArray; + return dict.Items(); }; const toConnectionString = (o: { [index: string]: any }) => { diff --git a/types/activex-adodb/index.d.ts b/types/activex-adodb/index.d.ts index 1879891b2d..580042cfa6 100644 --- a/types/activex-adodb/index.d.ts +++ b/types/activex-adodb/index.d.ts @@ -4,6 +4,8 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 +/// + declare namespace ADODB { const enum ADCPROP_ASYNCTHREADPRIORITY_ENUM { adPriorityAboveNormal = 4, @@ -1094,7 +1096,6 @@ declare namespace ADODB { } interface ActiveXObject { - new(progid: K): ActiveXObjectNameMap[K]; on(obj: ADODB.Connection, event: 'BeginTransComplete', argNames: ['TransactionLevel', 'pError', 'adStatus', 'pConnection'], handler: (this: ADODB.Connection, parameter: {readonly TransactionLevel: number, readonly pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, readonly pConnection: ADODB.Connection}) => void): void; on(obj: ADODB.Connection, event: 'CommitTransComplete' | 'ConnectComplete' | 'InfoMessage' | 'RollbackTransComplete', argNames: ['pError', 'adStatus', 'pConnection'], handler: (this: ADODB.Connection, parameter: {readonly pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, readonly pConnection: ADODB.Connection}) => void): void; on(obj: ADODB.Connection, event: 'Disconnect', argNames: ['adStatus', 'pConnection'], handler: (this: ADODB.Connection, parameter: {adStatus: ADODB.EventStatusEnum, readonly pConnection: ADODB.Connection}) => void): void; diff --git a/types/activex-adodb/tsconfig.json b/types/activex-adodb/tsconfig.json index 5cb32f94c9..abf5b79a00 100644 --- a/types/activex-adodb/tsconfig.json +++ b/types/activex-adodb/tsconfig.json @@ -2,8 +2,7 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es5", - "scripthost" + "es5" ], "noImplicitAny": true, "noImplicitThis": true, diff --git a/types/activex-adox/activex-adox-tests.ts b/types/activex-adox/activex-adox-tests.ts index 1b6ec21d1f..df5c75ef12 100644 --- a/types/activex-adox/activex-adox-tests.ts +++ b/types/activex-adox/activex-adox-tests.ts @@ -1,3 +1,5 @@ +/// + const collectionToArray = (col: { Item(key: any): T }): T[] => { const results: T[] = []; const enumerator = new Enumerator(col); diff --git a/types/activex-adox/index.d.ts b/types/activex-adox/index.d.ts index 8960dd0a31..fd502684e4 100644 --- a/types/activex-adox/index.d.ts +++ b/types/activex-adox/index.d.ts @@ -4,6 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 +/// /// declare namespace ADOX { @@ -320,10 +321,6 @@ declare namespace ADOX { } } -interface ActiveXObject { - new(progid: K): ActiveXObjectNameMap[K]; -} - interface ActiveXObjectNameMap { 'ADOX.Catalog': ADOX.Catalog; 'ADOX.Column': ADOX.Column; diff --git a/types/activex-adox/tsconfig.json b/types/activex-adox/tsconfig.json index 7aaa955db5..30b6288e6a 100644 --- a/types/activex-adox/tsconfig.json +++ b/types/activex-adox/tsconfig.json @@ -1,8 +1,9 @@ - { "compilerOptions": { "module": "commonjs", - "lib": ["es5", "scripthost"], + "lib": [ + "es5" + ], "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, diff --git a/types/activex-dao/activex-dao-tests.ts b/types/activex-dao/activex-dao-tests.ts index 7e8c2bef22..6eea19f8e6 100644 --- a/types/activex-dao/activex-dao-tests.ts +++ b/types/activex-dao/activex-dao-tests.ts @@ -1,3 +1,5 @@ +/// + const collectionToArray = (col: { Item(key: any): T }): T[] => { const results: T[] = []; const enumerator = new Enumerator(col); diff --git a/types/activex-dao/index.d.ts b/types/activex-dao/index.d.ts index a2a159e324..0a13747514 100644 --- a/types/activex-dao/index.d.ts +++ b/types/activex-dao/index.d.ts @@ -4,6 +4,8 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 +/// + declare namespace DAO { const enum _DAOSuppHelp { KeepLocal = 0, @@ -883,10 +885,6 @@ declare namespace DAO { } } -interface ActiveXObject { - new(progid: K): ActiveXObjectNameMap[K]; -} - interface ActiveXObjectNameMap { 'DAO.DBEngine': DAO.DBEngine; 'DAO.Field': DAO.Field; diff --git a/types/activex-dao/tsconfig.json b/types/activex-dao/tsconfig.json index 2ddea247b9..e9d00e61e1 100644 --- a/types/activex-dao/tsconfig.json +++ b/types/activex-dao/tsconfig.json @@ -2,8 +2,7 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es5", - "scripthost" + "es5" ], "noImplicitAny": true, "noImplicitThis": true, diff --git a/types/activex-diskquota/index.d.ts b/types/activex-diskquota/index.d.ts index d27863de3c..da7457e066 100644 --- a/types/activex-diskquota/index.d.ts +++ b/types/activex-diskquota/index.d.ts @@ -4,6 +4,8 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.5 +/// + declare namespace DiskQuotaTypeLibrary { // tslint:disable-next-line no-const-enum const enum AccountStatusConstants { @@ -136,7 +138,6 @@ interface ActiveXObject { on( obj: DiskQuotaTypeLibrary.DiskQuotaControl, event: 'OnUserNameChanged', argNames: ['pUser'], handler: ( this: DiskQuotaTypeLibrary.DiskQuotaControl, parameter: {readonly pUser: DiskQuotaTypeLibrary.DIDiskQuotaUser}) => void): void; - new(progid: K): ActiveXObjectNameMap[K]; } interface ActiveXObjectNameMap { @@ -146,7 +147,3 @@ interface ActiveXObjectNameMap { interface EnumeratorConstructor { new(col: DiskQuotaTypeLibrary.DiskQuotaControl): Enumerator; } - -interface SafeArray { - _brand: SafeArray; -} diff --git a/types/activex-diskquota/tsconfig.json b/types/activex-diskquota/tsconfig.json index 597d998a96..ce9b55800d 100644 --- a/types/activex-diskquota/tsconfig.json +++ b/types/activex-diskquota/tsconfig.json @@ -2,8 +2,7 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es5", - "scripthost" + "es5" ], "noImplicitAny": true, "noImplicitThis": true, diff --git a/types/activex-excel/activex-excel-tests.ts b/types/activex-excel/activex-excel-tests.ts index 4e577300e5..78291d57b5 100644 --- a/types/activex-excel/activex-excel-tests.ts +++ b/types/activex-excel/activex-excel-tests.ts @@ -1,11 +1,12 @@ +/// /// /// // some helpers const toSafeArray = (...items: T[]): SafeArray => { - const dict = new ActiveXObject('Scripting.Dictionary'); + const dict: Scripting.Dictionary = new ActiveXObject('Scripting.Dictionary'); items.forEach((x, index) => dict.Add(index, x)); - return dict.Items() as SafeArray; + return dict.Items(); }; const inCollection = (collection: { Item(index: any): T }, index: string | number): T | undefined => { let item: T | undefined; diff --git a/types/activex-excel/index.d.ts b/types/activex-excel/index.d.ts index cdf2a79551..c55bfe1c42 100644 --- a/types/activex-excel/index.d.ts +++ b/types/activex-excel/index.d.ts @@ -9723,7 +9723,6 @@ interface ActiveXObject { set(obj: Excel.Workbook, propertyName: 'Colors', parameterTypes: [any], newValue: any): void; set(obj: Excel.Range, propertyName: 'Value', parameterTypes: [Excel.XlRangeValueDataType], newValue: any): void; set(obj: Excel.Range, propertyName: 'Value', newValue: any): void; // because Value is defined on the type as a method, not a property - new (progid: K): ActiveXObjectNameMap[K]; } interface ActiveXObjectNameMap { diff --git a/types/activex-excel/tsconfig.json b/types/activex-excel/tsconfig.json index 244ab1d0ef..0b346a4a25 100644 --- a/types/activex-excel/tsconfig.json +++ b/types/activex-excel/tsconfig.json @@ -2,8 +2,7 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es5", - "scripthost" + "es5" ], "noImplicitAny": true, "noImplicitThis": true, diff --git a/types/activex-faxcomexlib/activex-faxcomexlib-tests.ts b/types/activex-faxcomexlib/activex-faxcomexlib-tests.ts index ef3e403998..478e816eb7 100644 --- a/types/activex-faxcomexlib/activex-faxcomexlib-tests.ts +++ b/types/activex-faxcomexlib/activex-faxcomexlib-tests.ts @@ -1,4 +1,5 @@ -/// +/// +/// const collectionToArray = (col: { Item(index: any): T } | SafeArray) => { const results: T[] = []; @@ -12,9 +13,9 @@ const collectionToArray = (col: { Item(index: any): T } | SafeArray) => { }; const toSafeArray = (...items: T[]): SafeArray => { - const dict = new ActiveXObject('Scripting.Dictionary'); + const dict: Scripting.Dictionary = new ActiveXObject('Scripting.Dictionary'); items.forEach((x, index) => dict.Add(index, x)); - return dict.Items() as SafeArray; + return dict.Items(); }; const VB = { diff --git a/types/activex-faxcomexlib/index.d.ts b/types/activex-faxcomexlib/index.d.ts index d4078061f7..ffd2412ef3 100644 --- a/types/activex-faxcomexlib/index.d.ts +++ b/types/activex-faxcomexlib/index.d.ts @@ -2011,7 +2011,6 @@ interface ActiveXObject { this: FAXCOMEXLib.FaxServer, parameter: {readonly riid: stdole.GUID, ppvObj: undefined}) => void): void; on(obj: FAXCOMEXLib.FaxAccount, event: 'AddRef' | 'Release', handler: (this: FAXCOMEXLib.FaxAccount, parameter: {}) => void): void; on(obj: FAXCOMEXLib.FaxServer, event: 'AddRef' | 'Release', handler: (this: FAXCOMEXLib.FaxServer, parameter: {}) => void): void; - new(progid: K): ActiveXObjectNameMap[K]; } interface ActiveXObjectNameMap { diff --git a/types/activex-faxcomexlib/tsconfig.json b/types/activex-faxcomexlib/tsconfig.json index 6509ab4701..8443d46f26 100644 --- a/types/activex-faxcomexlib/tsconfig.json +++ b/types/activex-faxcomexlib/tsconfig.json @@ -2,8 +2,7 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es5", - "scripthost" + "es5" ], "noImplicitAny": true, "noImplicitThis": true, diff --git a/types/activex-infopath/index.d.ts b/types/activex-infopath/index.d.ts index c00c67e197..9cace4ec2e 100644 --- a/types/activex-infopath/index.d.ts +++ b/types/activex-infopath/index.d.ts @@ -1168,7 +1168,6 @@ interface ActiveXObject { on(obj: InfoPath.Button, event: 'AddRef' | 'Release', handler: (this: InfoPath.Button, parameter: {}) => void): void; on(obj: InfoPath.DataDOM, event: 'AddRef' | 'Release', handler: (this: InfoPath.DataDOM, parameter: {}) => void): void; on(obj: InfoPath.XDocument, event: 'AddRef' | 'Release', handler: (this: InfoPath.XDocument, parameter: {}) => void): void; - new(progid: K): ActiveXObjectNameMap[K]; } interface ActiveXObjectNameMap { diff --git a/types/activex-infopath/tsconfig.json b/types/activex-infopath/tsconfig.json index 6feef8496c..db2712e264 100644 --- a/types/activex-infopath/tsconfig.json +++ b/types/activex-infopath/tsconfig.json @@ -2,8 +2,7 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es5", - "scripthost" + "es5" ], "noImplicitAny": true, "noImplicitThis": true, diff --git a/types/activex-libreoffice/activex-libreoffice-tests.ts b/types/activex-libreoffice/activex-libreoffice-tests.ts index bafe014f59..87cf55eb8c 100644 --- a/types/activex-libreoffice/activex-libreoffice-tests.ts +++ b/types/activex-libreoffice/activex-libreoffice-tests.ts @@ -1,3 +1,5 @@ +/// + (() => { // https://wiki.openoffice.org/wiki/Documentation/DevGuide/ProUNO/Bridge/Automation_Bridge diff --git a/types/activex-libreoffice/index.d.ts b/types/activex-libreoffice/index.d.ts index 1698317e8f..3459215083 100644 --- a/types/activex-libreoffice/index.d.ts +++ b/types/activex-libreoffice/index.d.ts @@ -4,6 +4,8 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 +/// + declare class type { private typekey: type; } @@ -12,9 +14,6 @@ declare class sequence { private typekey: sequence; } -// tslint:disable-next-line no-empty-interface -interface SafeArray {} - declare namespace com.sun.star { namespace accessibility { /** diff --git a/types/activex-libreoffice/tsconfig.json b/types/activex-libreoffice/tsconfig.json index 712ea46ca1..b6e9a7be63 100644 --- a/types/activex-libreoffice/tsconfig.json +++ b/types/activex-libreoffice/tsconfig.json @@ -2,8 +2,7 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es5", - "scripthost" + "es5" ], "noImplicitAny": true, "noImplicitThis": true, diff --git a/types/activex-msforms/index.d.ts b/types/activex-msforms/index.d.ts index c896cc4bf5..a9b5e8f8ac 100644 --- a/types/activex-msforms/index.d.ts +++ b/types/activex-msforms/index.d.ts @@ -1564,7 +1564,6 @@ interface ActiveXObject { set(obj: MSForms.ComboBox | MSForms.ListBox, propertyName: 'Column' | 'List', parameterTypes: [number, number] | [number], newValue: any): void; set(obj: MSForms.ComboBox | MSForms.ListBox, propertyName: 'Column' | 'List', parameterTypes: number[], newValue: SafeArray): void; set(obj: MSForms.ListBox, propertyName: 'Selected', parameterTypes: [any], newValue: boolean): void; - new(progid: K): ActiveXObjectNameMap[K]; } interface ActiveXObjectNameMap { diff --git a/types/activex-msforms/tsconfig.json b/types/activex-msforms/tsconfig.json index 38f907552d..074a493c66 100644 --- a/types/activex-msforms/tsconfig.json +++ b/types/activex-msforms/tsconfig.json @@ -2,8 +2,7 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es5", - "scripthost" + "es5" ], "noImplicitAny": true, "noImplicitThis": true, diff --git a/types/activex-mshtml/activex-mshtml-tests.ts b/types/activex-mshtml/activex-mshtml-tests.ts index 324d3d09e2..bdf7f3dec3 100644 --- a/types/activex-mshtml/activex-mshtml-tests.ts +++ b/types/activex-mshtml/activex-mshtml-tests.ts @@ -1,3 +1,5 @@ +/// + let htmlfile = new ActiveXObject('htmlfile'); let htmldoc = htmlfile.createDocumentFromUrl('https://msdn.microsoft.com/en-us/library/aa741317(v=vs.85).aspx', 'null'); let length = htmldoc.all.length; diff --git a/types/activex-mshtml/index.d.ts b/types/activex-mshtml/index.d.ts index 94466927d7..b2f8a92883 100644 --- a/types/activex-mshtml/index.d.ts +++ b/types/activex-mshtml/index.d.ts @@ -35570,7 +35570,6 @@ interface ActiveXObject { on(obj: MSHTML.SVGTSpanElement, event: 'onactivate' | 'onafterupdate' | 'onbeforeactivate' | 'onbeforecopy' | 'onbeforecut' | 'onbeforedeactivate' | 'onbeforeeditfocus' | 'onbeforepaste' | 'onbeforeupdate' | 'onblur' | 'oncellchange' | 'onclick' | 'oncontextmenu' | 'oncontrolselect' | 'oncopy' | 'oncut' | 'ondataavailable' | 'ondatasetchanged' | 'ondatasetcomplete' | 'ondblclick' | 'ondeactivate' | 'ondrag' | 'ondragend' | 'ondragenter' | 'ondragleave' | 'ondragover' | 'ondragstart' | 'ondrop' | 'onerrorupdate' | 'onfilterchange' | 'onfocus' | 'onfocusin' | 'onfocusout' | 'onhelp' | 'onkeydown' | 'onkeypress' | 'onkeyup' | 'onlayoutcomplete' | 'onlosecapture' | 'onmousedown' | 'onmouseenter' | 'onmouseleave' | 'onmousemove' | 'onmouseout' | 'onmouseover' | 'onmouseup' | 'onmousewheel' | 'onmove' | 'onmoveend' | 'onmovestart' | 'onpage' | 'onpaste' | 'onpropertychange' | 'onreadystatechange' | 'onresize' | 'onresizeend' | 'onresizestart' | 'onrowenter' | 'onrowexit' | 'onrowsdelete' | 'onrowsinserted' | 'onscroll' | 'onselectstart', handler: (this: MSHTML.SVGTSpanElement, parameter: {}) => void): void; on(obj: MSHTML.SVGUseElement, event: 'onactivate' | 'onafterupdate' | 'onbeforeactivate' | 'onbeforecopy' | 'onbeforecut' | 'onbeforedeactivate' | 'onbeforeeditfocus' | 'onbeforepaste' | 'onbeforeupdate' | 'onblur' | 'oncellchange' | 'onclick' | 'oncontextmenu' | 'oncontrolselect' | 'oncopy' | 'oncut' | 'ondataavailable' | 'ondatasetchanged' | 'ondatasetcomplete' | 'ondblclick' | 'ondeactivate' | 'ondrag' | 'ondragend' | 'ondragenter' | 'ondragleave' | 'ondragover' | 'ondragstart' | 'ondrop' | 'onerrorupdate' | 'onfilterchange' | 'onfocus' | 'onfocusin' | 'onfocusout' | 'onhelp' | 'onkeydown' | 'onkeypress' | 'onkeyup' | 'onlayoutcomplete' | 'onlosecapture' | 'onmousedown' | 'onmouseenter' | 'onmouseleave' | 'onmousemove' | 'onmouseout' | 'onmouseover' | 'onmouseup' | 'onmousewheel' | 'onmove' | 'onmoveend' | 'onmovestart' | 'onpage' | 'onpaste' | 'onpropertychange' | 'onreadystatechange' | 'onresize' | 'onresizeend' | 'onresizestart' | 'onrowenter' | 'onrowexit' | 'onrowsdelete' | 'onrowsinserted' | 'onscroll' | 'onselectstart', handler: (this: MSHTML.SVGUseElement, parameter: {}) => void): void; on(obj: MSHTML.SVGViewElement, event: 'onactivate' | 'onafterupdate' | 'onbeforeactivate' | 'onbeforecopy' | 'onbeforecut' | 'onbeforedeactivate' | 'onbeforeeditfocus' | 'onbeforepaste' | 'onbeforeupdate' | 'onblur' | 'oncellchange' | 'onclick' | 'oncontextmenu' | 'oncontrolselect' | 'oncopy' | 'oncut' | 'ondataavailable' | 'ondatasetchanged' | 'ondatasetcomplete' | 'ondblclick' | 'ondeactivate' | 'ondrag' | 'ondragend' | 'ondragenter' | 'ondragleave' | 'ondragover' | 'ondragstart' | 'ondrop' | 'onerrorupdate' | 'onfilterchange' | 'onfocus' | 'onfocusin' | 'onfocusout' | 'onhelp' | 'onkeydown' | 'onkeypress' | 'onkeyup' | 'onlayoutcomplete' | 'onlosecapture' | 'onmousedown' | 'onmouseenter' | 'onmouseleave' | 'onmousemove' | 'onmouseout' | 'onmouseover' | 'onmouseup' | 'onmousewheel' | 'onmove' | 'onmoveend' | 'onmovestart' | 'onpage' | 'onpaste' | 'onpropertychange' | 'onreadystatechange' | 'onresize' | 'onresizeend' | 'onresizestart' | 'onrowenter' | 'onrowexit' | 'onrowsdelete' | 'onrowsinserted' | 'onscroll' | 'onselectstart', handler: (this: MSHTML.SVGViewElement, parameter: {}) => void): void; - new(progid: K): ActiveXObjectNameMap[K]; } interface ActiveXObjectNameMap { diff --git a/types/activex-mshtml/tsconfig.json b/types/activex-mshtml/tsconfig.json index deba2b6ba3..1ef33423ee 100644 --- a/types/activex-mshtml/tsconfig.json +++ b/types/activex-mshtml/tsconfig.json @@ -2,8 +2,7 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es5", - "scripthost" + "es5" ], "noImplicitAny": true, "noImplicitThis": true, diff --git a/types/activex-msxml2/activex-msxml2-tests.ts b/types/activex-msxml2/activex-msxml2-tests.ts index 470f35d785..01ef12802e 100644 --- a/types/activex-msxml2/activex-msxml2-tests.ts +++ b/types/activex-msxml2/activex-msxml2-tests.ts @@ -1,3 +1,5 @@ +/// + // https://msdn.microsoft.com/en-us/library/ms764708(v=vs.85).aspx { const dom = new ActiveXObject('Msxml2.DOMDocument.6.0'); diff --git a/types/activex-msxml2/index.d.ts b/types/activex-msxml2/index.d.ts index 6f43ba02c5..5353864443 100644 --- a/types/activex-msxml2/index.d.ts +++ b/types/activex-msxml2/index.d.ts @@ -4,6 +4,8 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 +/// + declare namespace MSXML2 { /** Schema Object Model Content Types */ const enum _SCHEMACONTENTTYPE { @@ -2775,7 +2777,6 @@ declare namespace MSXML2 { interface ActiveXObject { on(obj: MSXML2.DOMDocument60, event: 'ondataavailable' | 'onreadystatechange', handler: (this: MSXML2.DOMDocument60, parameter: {}) => void): void; on(obj: MSXML2.FreeThreadedDOMDocument60, event: 'ondataavailable' | 'onreadystatechange', handler: (this: MSXML2.FreeThreadedDOMDocument60, parameter: {}) => void): void; - new(progid: K): ActiveXObjectNameMap[K]; } interface ActiveXObjectNameMap { diff --git a/types/activex-msxml2/tsconfig.json b/types/activex-msxml2/tsconfig.json index 49c53f71ca..fe55b33d3c 100644 --- a/types/activex-msxml2/tsconfig.json +++ b/types/activex-msxml2/tsconfig.json @@ -2,8 +2,7 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es5", - "scripthost" + "es5" ], "noImplicitAny": true, "noImplicitThis": true, diff --git a/types/activex-office/activex-office-tests.ts b/types/activex-office/activex-office-tests.ts index 7aab0b4521..4dd24fd547 100644 --- a/types/activex-office/activex-office-tests.ts +++ b/types/activex-office/activex-office-tests.ts @@ -1,3 +1,4 @@ +/// /// const collectionToArray = (col: { Item(key: any): T }): T[] => { diff --git a/types/activex-office/tsconfig.json b/types/activex-office/tsconfig.json index 729657e813..6ded50cfda 100644 --- a/types/activex-office/tsconfig.json +++ b/types/activex-office/tsconfig.json @@ -2,8 +2,7 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es5", - "scripthost" + "es5" ], "noImplicitAny": true, "noImplicitThis": true, diff --git a/types/activex-outlook/index.d.ts b/types/activex-outlook/index.d.ts index 37628722b5..2b316d80bd 100644 --- a/types/activex-outlook/index.d.ts +++ b/types/activex-outlook/index.d.ts @@ -4,6 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 +/// /// /// @@ -5855,7 +5856,6 @@ interface ActiveXObject { on(obj: Outlook.TaskRequestDeclineItem, event: 'AfterWrite' | 'BeforeRead' | 'Read' | 'Unload', handler: (this: Outlook.TaskRequestDeclineItem, parameter: {}) => void): void; on(obj: Outlook.TaskRequestItem, event: 'AfterWrite' | 'BeforeRead' | 'Read' | 'Unload', handler: (this: Outlook.TaskRequestItem, parameter: {}) => void): void; on(obj: Outlook.TaskRequestUpdateItem, event: 'AfterWrite' | 'BeforeRead' | 'Read' | 'Unload', handler: (this: Outlook.TaskRequestUpdateItem, parameter: {}) => void): void; - new(progid: K): ActiveXObjectNameMap[K]; } interface ActiveXObjectNameMap { diff --git a/types/activex-outlook/tsconfig.json b/types/activex-outlook/tsconfig.json index 1a9fddc714..1a7c466608 100644 --- a/types/activex-outlook/tsconfig.json +++ b/types/activex-outlook/tsconfig.json @@ -2,8 +2,7 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es5", - "scripthost" + "es5" ], "noImplicitAny": true, "noImplicitThis": true, diff --git a/types/activex-powerpoint/activex-powerpoint-tests.ts b/types/activex-powerpoint/activex-powerpoint-tests.ts index 3f2bedf8cd..eb5a2e4c05 100644 --- a/types/activex-powerpoint/activex-powerpoint-tests.ts +++ b/types/activex-powerpoint/activex-powerpoint-tests.ts @@ -1,5 +1,5 @@ // tslint:disable-next-line no-unnecessary-generics -const collectionToArray = (col: any): T[] => { +const collectionToArray = (col: {Item(index: any): T}): T[] => { const results: T[] = []; const enumerator = new Enumerator(col); enumerator.moveFirst(); @@ -13,8 +13,8 @@ const collectionToArray = (col: any): T[] => { const app = new ActiveXObject('PowerPoint.Application'); (() => { // delete empty textboxes in PowerPoint - collectionToArray(app.ActivePresentation.Slides).forEach(slide => { - collectionToArray(slide.Shapes).filter(shape => + collectionToArray(app.ActivePresentation.Slides).forEach(slide => { + collectionToArray(slide.Shapes).filter(shape => shape.Type === Office.MsoShapeType.msoTextBox && shape.TextFrame.TextRange.Text.trim() === '' ).forEach(shape => shape.Delete()); diff --git a/types/activex-powerpoint/index.d.ts b/types/activex-powerpoint/index.d.ts index ee59fd0be4..34e722a8a0 100644 --- a/types/activex-powerpoint/index.d.ts +++ b/types/activex-powerpoint/index.d.ts @@ -5374,7 +5374,6 @@ interface ActiveXObject { this: PowerPoint.Application, parameter: {readonly Sel: PowerPoint.Selection, Cancel: boolean}) => void): void; on(obj: PowerPoint.Application, event: 'WindowSelectionChange', argNames: ['Sel'], handler: (this: PowerPoint.Application, parameter: {readonly Sel: PowerPoint.Selection}) => void): void; on(obj: PowerPoint.OLEControl, event: 'GotFocus' | 'LostFocus', handler: (this: PowerPoint.OLEControl, parameter: {}) => void): void; - new(progid: K): ActiveXObjectNameMap[K]; } interface ActiveXObjectNameMap { diff --git a/types/activex-powerpoint/tsconfig.json b/types/activex-powerpoint/tsconfig.json index 8a0392da3f..25bcee9fa3 100644 --- a/types/activex-powerpoint/tsconfig.json +++ b/types/activex-powerpoint/tsconfig.json @@ -2,8 +2,7 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es5", - "scripthost" + "es5" ], "noImplicitAny": true, "noImplicitThis": true, diff --git a/types/activex-scripting/activex-scripting-tests.ts b/types/activex-scripting/activex-scripting-tests.ts index 313e480cb5..f3ee3218ca 100644 --- a/types/activex-scripting/activex-scripting-tests.ts +++ b/types/activex-scripting/activex-scripting-tests.ts @@ -1,3 +1,5 @@ +/// + // Note -- running these tests under cscript requires some ES5 polyfills const collectionToArray = (col: { Item(key: any): T }): T[] => { diff --git a/types/activex-scripting/index.d.ts b/types/activex-scripting/index.d.ts index 42e4f0c9e0..e0f8ba306d 100644 --- a/types/activex-scripting/index.d.ts +++ b/types/activex-scripting/index.d.ts @@ -4,6 +4,8 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 +/// + declare namespace Scripting { // tslint:disable-next-line:no-const-enum const enum CompareMethod { @@ -489,7 +491,6 @@ declare namespace Scripting { } interface ActiveXObject { - new (progid: K): ActiveXObjectNameMap[K]; set(obj: Scripting.Dictionary, propertyName: 'Item', parameterTypes: [any], newValue: any): void; } diff --git a/types/activex-scripting/tsconfig.json b/types/activex-scripting/tsconfig.json index e2008551fd..11cfcc44a4 100644 --- a/types/activex-scripting/tsconfig.json +++ b/types/activex-scripting/tsconfig.json @@ -2,8 +2,7 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es5", - "scripthost" + "es5" ], "noImplicitAny": true, "noImplicitThis": true, diff --git a/types/activex-shdocvw/index.d.ts b/types/activex-shdocvw/index.d.ts index 86568f6c5d..f450ea6112 100644 --- a/types/activex-shdocvw/index.d.ts +++ b/types/activex-shdocvw/index.d.ts @@ -4,6 +4,8 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 +/// + declare namespace SHDocVw { // tslint:disable-next-line no-const-enum const enum BrowserBarConstants { @@ -1562,7 +1564,6 @@ interface ActiveXObject { on(obj: SHDocVw.ShellNameSpace, event: 'DoubleClick' | 'Initialized' | 'SelectionChange', handler: (this: SHDocVw.ShellNameSpace, parameter: {}) => void): void; on(obj: SHDocVw.WebBrowser, event: 'DownloadBegin' | 'DownloadComplete' | 'OnQuit', handler: (this: SHDocVw.WebBrowser, parameter: {}) => void): void; on(obj: SHDocVw.WebBrowser_V1, event: 'DownloadBegin' | 'DownloadComplete' | 'WindowActivate' | 'WindowMove' | 'WindowResize', handler: (this: SHDocVw.WebBrowser_V1, parameter: {}) => void): void; - new (progid: K): ActiveXObjectNameMap[K]; } interface ActiveXObjectNameMap { @@ -1571,7 +1572,3 @@ interface ActiveXObjectNameMap { 'Shell.UIHelper': SHDocVw.ShellUIHelper; 'ShellNameSpace.ShellNameSpace': SHDocVw.ShellNameSpace; } - -interface EnumeratorConstructor { - new(col: SHDocVw.ShellWindows): Enumerator; -} diff --git a/types/activex-shdocvw/tsconfig.json b/types/activex-shdocvw/tsconfig.json index 1907cb1ef6..2a388d4c7d 100644 --- a/types/activex-shdocvw/tsconfig.json +++ b/types/activex-shdocvw/tsconfig.json @@ -2,8 +2,7 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es5", - "scripthost" + "es5" ], "noImplicitAny": true, "noImplicitThis": true, diff --git a/types/activex-shell/activex-shell-tests.ts b/types/activex-shell/activex-shell-tests.ts index f236f6e592..b9fd3b18fd 100644 --- a/types/activex-shell/activex-shell-tests.ts +++ b/types/activex-shell/activex-shell-tests.ts @@ -1,4 +1,4 @@ -/// +/// const shell = new ActiveXObject('Shell.Application'); diff --git a/types/activex-shell/index.d.ts b/types/activex-shell/index.d.ts index cb59a11c5e..f12d135979 100644 --- a/types/activex-shell/index.d.ts +++ b/types/activex-shell/index.d.ts @@ -1001,7 +1001,6 @@ interface ActiveXObject { on( obj: Shell32.ShellFolderViewOC, event: 'BeginDrag' | 'DefaultVerbInvoked' | 'EnumDone' | 'SelectionChanged' | 'VerbInvoked', handler: (this: Shell32.ShellFolderViewOC, parameter: {}) => void): void; - new (progid: K): ActiveXObjectNameMap[K]; } interface ActiveXObjectNameMap { diff --git a/types/activex-shell/tsconfig.json b/types/activex-shell/tsconfig.json index f4b549f649..364b5716de 100644 --- a/types/activex-shell/tsconfig.json +++ b/types/activex-shell/tsconfig.json @@ -2,8 +2,7 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es5", - "scripthost" + "es5" ], "noImplicitAny": true, "noImplicitThis": true, diff --git a/types/activex-stdole/index.d.ts b/types/activex-stdole/index.d.ts index e738e4f03d..34b12e4219 100644 --- a/types/activex-stdole/index.d.ts +++ b/types/activex-stdole/index.d.ts @@ -4,6 +4,8 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 +/// + declare namespace stdole { type IPictureDisp = StdPicture; @@ -79,7 +81,6 @@ declare namespace stdole { interface ActiveXObject { on(obj: stdole.StdFont, event: 'FontChanged', argNames: ['PropertyName'], handler: (this: stdole.StdFont, parameter: {readonly PropertyName: string}) => void): void; - new(progid: K): ActiveXObjectNameMap[K]; } interface ActiveXObjectNameMap { diff --git a/types/activex-stdole/tsconfig.json b/types/activex-stdole/tsconfig.json index cbe3ce7aae..24ea6a5417 100644 --- a/types/activex-stdole/tsconfig.json +++ b/types/activex-stdole/tsconfig.json @@ -2,8 +2,7 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es5", - "scripthost" + "es5" ], "noImplicitAny": true, "noImplicitThis": true, diff --git a/types/activex-vbide/activex-vbide-tests.ts b/types/activex-vbide/activex-vbide-tests.ts index 02209ec9bd..5780d36b1a 100644 --- a/types/activex-vbide/activex-vbide-tests.ts +++ b/types/activex-vbide/activex-vbide-tests.ts @@ -1,3 +1,4 @@ +/// /// const collectionToArray = (col: { Item(key: any): T }): T[] => { diff --git a/types/activex-vbide/tsconfig.json b/types/activex-vbide/tsconfig.json index 6fb205a3c4..5d27488056 100644 --- a/types/activex-vbide/tsconfig.json +++ b/types/activex-vbide/tsconfig.json @@ -2,8 +2,7 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es5", - "scripthost" + "es5" ], "noImplicitAny": true, "noImplicitThis": true, diff --git a/types/activex-wia/activex-wia-tests.ts b/types/activex-wia/activex-wia-tests.ts index 8fc7dcfd2e..25d025cc90 100644 --- a/types/activex-wia/activex-wia-tests.ts +++ b/types/activex-wia/activex-wia-tests.ts @@ -1,3 +1,5 @@ +/// + // Note -- running these tests under cscript requires some ES5 polyfills const collectionToArray = (col: { Item(key: any): T }): T[] => { diff --git a/types/activex-wia/index.d.ts b/types/activex-wia/index.d.ts index 18e474e09c..5a06471ff8 100644 --- a/types/activex-wia/index.d.ts +++ b/types/activex-wia/index.d.ts @@ -4,6 +4,8 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 +/// + declare namespace WIA { /** String versions of globally unique identifiers (GUIDs) that identify common Device and Item commands. */ const enum CommandID { @@ -791,7 +793,6 @@ declare namespace WIA { } interface ActiveXObject { - new(progid: K): ActiveXObjectNameMap[K]; on(obj: WIA.DeviceManager, event: 'OnEvent', argNames: ['EventID', 'DeviceID', 'ItemID'], handler: ( this: WIA.DeviceManager, parameter: { readonly EventID: string, readonly DeviceID: string, readonly ItemID: string }) => void): void; set(obj: WIA.Vector, propertyName: 'Item', parameterTypes: [number], newValue: TItem): void; diff --git a/types/activex-wia/tsconfig.json b/types/activex-wia/tsconfig.json index e77b3d1b66..48ed56e82e 100644 --- a/types/activex-wia/tsconfig.json +++ b/types/activex-wia/tsconfig.json @@ -2,8 +2,7 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es5", - "scripthost" + "es5" ], "noImplicitAny": true, "noImplicitThis": true, diff --git a/types/activex-word/activex-word-tests.ts b/types/activex-word/activex-word-tests.ts index 4a0000e6fa..2b44a5ba22 100644 --- a/types/activex-word/activex-word-tests.ts +++ b/types/activex-word/activex-word-tests.ts @@ -1,5 +1,7 @@ +/// + // tslint:disable-next-line no-unnecessary-generics -const collectionToArray = (col: any): T[] => { +const collectionToArray = (col: {Item(index: any): T}): T[] => { const results: T[] = []; const enumerator = new Enumerator(col); enumerator.moveFirst(); @@ -233,7 +235,7 @@ const activeDoc = app.ActiveDocument; // looping through a collection -- https://msdn.microsoft.com/en-us/vba/word-vba/articles/looping-through-a-collection (() => { - collectionToArray(app.Documents) + collectionToArray(app.Documents) .forEach(openDocument => WScript.Echo(openDocument.Name)); const strMarks = collectionToArray(activeDoc.Bookmarks) diff --git a/types/activex-word/index.d.ts b/types/activex-word/index.d.ts index 879af9021d..f6f559ae16 100644 --- a/types/activex-word/index.d.ts +++ b/types/activex-word/index.d.ts @@ -4,6 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 +/// /// /// /// @@ -12496,7 +12497,6 @@ interface ActiveXObject { set(obj: Word.Document, propertyName: 'ActiveWritingStyle', parameterTypes: [any], newValue: string): void; set(obj: Word.Document, propertyName: 'Compatibility', parameterTypes: [Word.WdCompatibility], newValue: boolean): void; set(obj: Word.System, propertyName: 'PrivateProfileString', parameterTypes: [string, string, string], newValue: string): void; - new(progid: K): ActiveXObjectNameMap[K]; } interface ActiveXObjectNameMap { diff --git a/types/activex-word/tsconfig.json b/types/activex-word/tsconfig.json index c62626ca52..c5316c83c4 100644 --- a/types/activex-word/tsconfig.json +++ b/types/activex-word/tsconfig.json @@ -1,10 +1,7 @@ { "compilerOptions": { "module": "commonjs", - "lib": [ - "es5", - "scripthost" - ], + "lib": ["es5"], "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, From b03e1bbecb1dceb757b45da340f4348e2477698c Mon Sep 17 00:00:00 2001 From: Zev Spitz Date: Sun, 13 May 2018 17:39:41 +0200 Subject: [PATCH 079/575] Split types that are usable out of WScript to activex-iwshruntimelibrary --- .../activex-iwshruntimelibrary-tests.ts | 62 +++ types/activex-iwshruntimelibrary/index.d.ts | 437 +++++++++++++++ .../activex-iwshruntimelibrary/tsconfig.json | 21 + types/activex-iwshruntimelibrary/tslint.json | 6 + types/windows-script-host/index.d.ts | 497 ++---------------- .../windows-script-host-tests.ts | 50 -- 6 files changed, 559 insertions(+), 514 deletions(-) create mode 100644 types/activex-iwshruntimelibrary/activex-iwshruntimelibrary-tests.ts create mode 100644 types/activex-iwshruntimelibrary/index.d.ts create mode 100644 types/activex-iwshruntimelibrary/tsconfig.json create mode 100644 types/activex-iwshruntimelibrary/tslint.json diff --git a/types/activex-iwshruntimelibrary/activex-iwshruntimelibrary-tests.ts b/types/activex-iwshruntimelibrary/activex-iwshruntimelibrary-tests.ts new file mode 100644 index 0000000000..67efbd3eca --- /dev/null +++ b/types/activex-iwshruntimelibrary/activex-iwshruntimelibrary-tests.ts @@ -0,0 +1,62 @@ +/// + +const collectionToArray = (col: { Item(key: any): T }): T[] => { + const results: T[] = []; + const enumerator = new Enumerator(col); + enumerator.moveFirst(); + while (!enumerator.atEnd()) { + results.push(enumerator.item()); + enumerator.moveNext(); + } + return results; +}; + +const wshn = new ActiveXObject('WScript.Network'); + +// https://msdn.microsoft.com/en-us/library/s6wt333f(v=vs.84).aspx +// https://msdn.microsoft.com/en-us/library/wck0hkd7(v=vs.84).aspx +// https://msdn.microsoft.com/en-us/library/tte130y1(v=vs.84).aspx +// https://msdn.microsoft.com/en-us/library/3fxhka75(v=vs.84).aspx +{ + WScript.Echo('Domain = ' + wshn.UserDomain); + WScript.Echo('Computer Name = ' + wshn.ComputerName); + WScript.Echo('User Name = ' + wshn.UserName); +} + +// https://msdn.microsoft.com/en-us/library/zsdh7hkb(v=vs.84).aspx +wshn.AddWindowsPrinterConnection('\\\\printserv\\DefaultPrinter'); + +// https://msdn.microsoft.com/en-us/library/kxsdca3c(v=vs.84).aspx +wshn.AddPrinterConnection("LPT1", "\\\\Server\\Print1"); + +// https://msdn.microsoft.com/en-us/library/t9zt39at(v=vs.84).aspx +// https://msdn.microsoft.com/en-us/library/zhds6k80(v=vs.84).aspx +{ + const drives = wshn.EnumNetworkDrives(); + const printers = wshn.EnumPrinterConnections(); + WScript.Echo("Network drive mappings:"); + for (let i = 0; i < drives.length; i += 2) { + WScript.Echo(`Drive ${drives.Item(i)} = ${drives.Item(i + 1)}`); + } + WScript.Echo(''); + WScript.Echo("Network printer mappings:"); + for (let i = 0; i < printers.length; i += 2) { + WScript.Echo(`Port ${printers.Item(i)} = ${printers.Item(i + 1)}`); + } +} + +// https://msdn.microsoft.com/en-us/library/8kst88h6(v=vs.84).aspx +wshn.MapNetworkDrive('E:', '\\\\Server\\Public'); + +// https://msdn.microsoft.com/en-us/library/d16d7wbf(v=vs.84).aspx +wshn.RemoveNetworkDrive('E:'); + +// https://msdn.microsoft.com/en-us/library/tsbh2yy7(v=vs.84).aspx +wshn.RemovePrinterConnection('\\\\PRN-CORP1\\B41-4523-A', true, true); + +// https://msdn.microsoft.com/en-us/library/2ccwwdct(v=vs.84).aspx +{ + const printerPath = "\\\\research\\library1"; + wshn.AddWindowsPrinterConnection(printerPath); + wshn.SetDefaultPrinter(printerPath); +} diff --git a/types/activex-iwshruntimelibrary/index.d.ts b/types/activex-iwshruntimelibrary/index.d.ts new file mode 100644 index 0000000000..1f89c2b84a --- /dev/null +++ b/types/activex-iwshruntimelibrary/index.d.ts @@ -0,0 +1,437 @@ +// Type definitions for Windows Script Host Runtime Object Model 0.0 +// Project: https://msdn.microsoft.com/en-us/library/9bbdkx3k.aspx +// Definitions by: Zev Spitz +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +/// + +declare namespace IWshRuntimeLibrary { + type WindowStyle = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10; + type ShortcutWindowStyle = 1 | 3 | 7; + + const enum ButtonType { + OK, + OKCancel, + AbortRetryIgnore, + YesNoCancel, + YesNo, + RetryCancel, + CancelTryagainContinue + } + + const enum EventType { + AuditFailure = 5, + AuditSuccess = 4, + Error = 1, + Information = 3, + Success = 0, + Warning = 2 + } + + const enum IconType { + Stop = 16, + QuestionMark = 32, + ExclamationMakr = 48, + InformationMark = 64, + } + + const enum PopupType { + SecondButtonDefault = 256, + ThirdButtonDefault = 512, + Modal = 4096, + RightJustified = 524288, + RTL = 1048576, + } + + const enum PopupSelection { + NoButton = -1, + OK = 1, + Cancel = 2, + Abort = 3, + Retry = 4, + Ignore = 5, + Yes = 6, + No = 7, + TryAgain = 10, + Continue = 11, + } + + const enum WshExecStatus { + WshFailed = 2, + WshFinished = 1, + WshRunning = 0, + } + + const enum WshWindowStyle { + WshHide = 0, + WshMaximizedFocus = 3, + WshMinimizedFocus = 2, + WshMinimizedNoFocus = 6, + WshNormalFocus = 1, + WshNormalNoFocus = 4, + } + + class TextStreamBase { + /** + * The column number of the current character position in an input stream. + */ + Column: number; + + /** + * The current line number in an input stream. + */ + Line: number; + + /** + * Closes a text stream. + * It is not necessary to close standard streams; they close automatically when the process ends. If + * you close a standard stream, be aware that any other pointers to that standard stream become invalid. + */ + Close(): void; + } + + class TextStreamWriter extends TextStreamBase { + private 'IWshRuntimeLibrary.TextStreamWriter_typekey': TextStreamWriter; + private constructor(); + + /** + * Sends a string to an output stream. + */ + Write(s: string): void; + + /** + * Sends a specified number of blank lines (newline characters) to an output stream. + */ + WriteBlankLines(intLines: number): void; + + /** + * Sends a string followed by a newline character to an output stream. + */ + WriteLine(s: string): void; + } + + class TextStreamReader extends TextStreamBase { + private 'IWshRuntimeLibrary.TextStreamReader_typekey': TextStreamReader; + private constructor(); + + /** + * Returns a specified number of characters from an input stream, starting at the current pointer position. + * Does not return until the ENTER key is pressed. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + */ + Read(characters: number): string; + + /** + * Returns all characters from an input stream. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + */ + ReadAll(): string; + + /** + * Returns an entire line from an input stream. + * Although this method extracts the newline character, it does not add it to the returned string. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + */ + ReadLine(): string; + + /** + * Skips a specified number of characters when reading from an input text stream. + * Can only be used on a stream in reading mode; causes an error in writing or appending mode. + * @param characters Positive number of characters to skip forward. (Backward skipping is not supported.) + */ + Skip(characters: number): void; + + /** + * Skips the next line when reading from an input text stream. + * Can only be used on a stream in reading mode, not writing or appending mode. + */ + SkipLine(): void; + + /** + * Indicates whether the stream pointer position is at the end of a line. + */ + AtEndOfLine: boolean; + + /** + * Indicates whether the stream pointer position is at the end of a stream. + */ + AtEndOfStream: boolean; + } + + /** Generic Collection Object */ + interface WshCollection { + Count(): number; + Item(Index: any): any; + readonly length: number; + (Index: any): any; + } + + /** Environment Variables Collection Object */ + interface WshEnvironment { + Count(): number; + Item(Name: string): string; + readonly Length: number; + Remove(Name: string): void; + (Name: string): string; + } + + /** WSHExec object */ + class WshExec { + private 'IWshRuntimeLibrary.WshExec_typekey': WshExec; + private constructor(); + readonly ExitCode: number; + readonly ProcessID: number; + readonly Status: WshExecStatus; + readonly StdErr: TextStreamWriter; + readonly StdIn: TextStreamReader; + readonly StdOut: TextStreamWriter; + Terminate(): void; + } + + /** Network Object */ + class WshNetwork { + private 'IWshRuntimeLibrary.WshNetwork_typekey': WshNetwork; + private constructor(); + + /** + * Adds a remote MS-DOS-based printer connection to your computer system. + * @param LocalName Local name to assign to the connected printer. + * @param RemoteName Name of the remote printer. + * @param UpdateProfile [false] Whether the printer mapping is stored in the current user's profile. + * + * If you are mapping a remote printer using the profile of someone other than current user, you can specify _UserName_ and _Password_. + */ + AddPrinterConnection(LocalName: string, RemoteName: string, UpdateProfile?: boolean, UserName?: string, Password?: string): void; + + /** + * @param string Path to printer connection + * @param string [DriverName=''] + * @param string [Port='LPT1'] + * + * Unlike the **AddPrinterConnection** method, this method allows you to create a printer connection without directing it to a specific port, such as LPT1. + */ + AddWindowsPrinterConnection(PrinterName: string, DriverName?: string, Port?: string): void; + readonly ComputerName: string; + EnumNetworkDrives(): WshCollection; + EnumPrinterConnections(): WshCollection; + + /** + * Adds a remote MS-DOS-based printer connection to your computer system. + * @param LocalName Name by which the mapped drive will be known locally + * @param RemoteName Share's UNC name (\\xxx\yyy) + * @param UpdateProfile [false] Whether the printer mapping is stored in the current user's profile. + * + * If you are mapping a network drive using the profile of someone other than current user, you can specify _UserName_ and _Password_. + */ + MapNetworkDrive(LocalName: string, RemoteName: string, UpdateProfile?: boolean, UserName?: string, Password?: string): void; + readonly Organization: string; + + /** + * Removes a shared network drive from your computer system + * @param Name Name of the mapped drive you want to remove. This will be the drive letter if the drive has a mapping between a local name (drive letter) and a remote name (UNC name); + * it will be the UNC path if there is no such mapping + * @param Force [false] Remove the connections even if the resource is in use + * @param UpdateProfile [false] Remove the mapping from the user's profile + */ + RemoveNetworkDrive(Name: string, Force?: boolean, UpdateProfile?: boolean): void; + + /** + * Removes a shared network printer connection from your computer system + * @param Name Name that identifies the printer. Can be a UNC name (in the form `\\xxx\yyy`) or a local name (such as `LPT1`) + * @param Force [false] Remove printer connection even if a user is still connected + * @param UpdateProfile [false] Remove the printer connection from the user's profile + * + * The **RemovePrinterConnection** method removes both Windows and MS-DOS based printer connections. If the printer was connected using the method **AddPrinterConnection**, + * _Name_ must be the printer's local name. If the printer was connected using the **AddWindowsPrinterConnection** method or was added manually (using the Add Printer wizard), + * then _Name_ must be the printer's UNC name. + */ + RemovePrinterConnection(Name: string, Force?: true, UpdateProfile?: true): void; + SetDefaultPrinter(Name: string): void; + readonly Site: string; + readonly UserDomain: string; + readonly UserName: string; + readonly UserProfile: string; + } + + /** Shell Object */ + class WshShell { + private 'IWshRuntimeLibrary.WshShell_typekey': WshShell; + private constructor(); + + /** + * Activates an application window + * @param App Title of application as it appears in the title bar, or the process ID + * @param Wait + * + * This method changes the focus to the named application or window. The window must be attached to the calling thread's message queue. It does not affect whether it is maximized or + * minimized. Focus moves from the activated application window when the user takes action to change the focus (or closes the window). + * + * In determining which application to activate, the specified title is compared to the title string of each running application. If no exact match exists, any application whose title + * string begins with title is activated. If an application still cannot be found, any application whose title string ends with title is activated. If more than one instance of the + * application named by title exists, one instance is arbitrarily activated. + * + * The method might return `false` under the following conditions: + * + * * The window is not brought to the foreground. + * * The window is brought to the foreground but is not given keyboard focus. + * * A Command Prompt window (`cmd.exe`) is brought to the foreground and is given keyboard focus. + */ + AppActivate(App: string | number, Wait?: any): boolean; + + /** + * Creates a shortcut + * @param PathLink Path where the shortcut should be created + * + * The shortcut object exists in memory until you save it to disk with the **Save** method. + */ + CreateShortcut(PathLink: string): WshShortcut | WshURLShortcut; + CurrentDirectory: string; + + /** + * Note that **Environment** doesn't actually return a callable object; the call is only usable in the context of the **Environment** property. The following: + * + * let env = new ActiveXObject('WScript.Shell').Environment; + * WScript.Echo(env('System')); + * + * will return an empty string, unless there is an environment variable named `System` + */ + Environment: WshEnvironment & ((Type: 'System' | 'User' | 'Process' | 'Volatile') => WshEnvironment); + Exec(Command: string): WshExec; + ExpandEnvironmentStrings(Src: string): string; + + /** @param string [Target=''] Name of the computer system where the event should be logged; default is the local computer system */ + LogEvent(Type: EventType, Message: string, Target?: string): boolean; + Popup(Text: string, SecondsToWait?: number, Title?: string, Type?: ButtonType | IconType | PopupType): PopupSelection; + RegDelete(Name: string): void; + + /** + * Returns the value of a key or value-name from the registry + * @param Name Key (ends with a final `\`) or value-name (doesn't end with a final `\`) + * + * Returns one of the following, based on the registry value type: + * + * * **REG_SZ** -- a string + * * **REG_DWORD** -- a number + * * **REG_SBINARY** -- a binary value, as a COM SafeArray containing integers + * * **REG_EXPAND_SZ** -- an expandable string + * * **REG_MULTI_SZ** -- an array of srings, as a COM SafeArray + */ + RegRead(Name: string): string | number | SafeArray | SafeArray; + + /** + * Creates a new key, adds another value-name to an existing key and assigns it a value, or changes the value of an existing value-name + * @param Name Key (ends with a final `\`) or value-name (doesn't end with a final `\`) + * @param Value Will be coerced to `string` or `integer` based on the value-name type: + * `REG_SZ | REG_EXPAND_SZ` will be converted to `string`; + * `REG_DWORD | REG_BINARY` will be converted to `integer` + * @param Type + */ + RegWrite(Name: string, Value: any, Type?: 'REG_SZ' | 'REG_DWORD' | 'REG_BINARY' | 'REG_EXPAND_SZ'): void; + + /** + * Runs a program in a new process. + * @param Command Command-line, including any parameters you want to pass to the executable file. + * @param WindowStyle Appearance of the program window. Not all programs make use of this information. + * @param WaitOnReturn Block script until program finishes executing. + * + * If `false` is passed into **WaitOnReturn**, the **Run** method will return 0 immediately. If `true` is passed in, **Run** will return the program's error code, if any. + * + * Environment variables will be expanded within the command line. + * + * Passing a registered file type will automatically open the program registered to the file type. + * + * Possible values for **WindowStyle**: + * + * * **0** -- Hides the window and activates another window. + * * **1** -- Activates and displays a window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag + * when displaying the window for the first time. + * * **2** -- Activates the window and displays it as a minimized window. + * * **3** -- Activates the window and displays it as a maximized window. + * * **4** -- Displays a window in its most recent size and position. The active window remains active. + * * **5** -- Activates the window and displays it in its current size and position. + * * **6** -- Minimizes the specified window and activates the next top-level window in the Z order. + * * **7** -- Displays the window as a minimized window. The active window remains active. + * * **8** -- Displays the window in its current state. The active window remains active. + * * **9** -- Activates and displays the window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag + * when restoring a minimized window. + * * **10** -- Sets the show-state based on the state of the program that started the application. + */ + Run(Command: string, WindowStyle?: WindowStyle, WaitOnReturn?: boolean): number; + SendKeys(Keys: string, Wait?: boolean): void; + readonly SpecialFolders: WshCollection; + } + + /** Shortcut Object */ + class WshShortcut { + private 'IWshRuntimeLibrary.WshShortcut_typekey': WshShortcut; + private constructor(); + Arguments: string; + Description: string; + readonly FullName: string; + Hotkey: string; + IconLocation: string; + Load(PathLink: string): void; + readonly RelativePath: string; + Save(): void; + TargetPath: string; + + /** + * Possible values: + * + * * **1** -- Activates and displays a window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag + * when displaying the window for the first time. + * * **3** -- Activates the window and displays it as a maximized window. + * * **7** -- Displays the window as a minimized window. The active window remains active. + */ + WindowStyle: ShortcutWindowStyle; + WorkingDirectory: string; + } + + /** URLShortcut Object */ + class WshURLShortcut { + private 'IWshRuntimeLibrary.WshURLShortcut_typekey': WshURLShortcut; + private constructor(); + readonly FullName: string; + Load(PathLink: string): void; + Save(): void; + TargetPath: string; + } +} +declare namespace WSHControllerLibrary { + class WSHController { + private 'WSHControllerLibrary.WSHController_typekey': WSHController; + private constructor(); + CreateScript(Command: string, Server?: any): any; + } +} + +declare namespace ScriptSigner { + class Signer { + private 'ScriptSigner.Signer_typekey': Signer; + private constructor(); + + /** @param Store [Store='my'] */ + Sign(FileExtension: string, Text: string, Certificate: string, Store?: string): string; + + /** @param Store [Store='my'] */ + SignFile(FileName: string, Certificate: string, Store?: string): void; + + /** @param ShowUI [ShowUI=false] */ + Verify(FileExtension: string, Text: string, ShowUI?: boolean): boolean; + + /** @param ShowUI [ShowUI=false] */ + VerifyFile(FileName: string, ShowUI?: boolean): boolean; + } +} + +interface ActiveXObjectNameMap { + 'WSHController': WSHControllerLibrary.WSHController; + 'Scripting.Signer': ScriptSigner.Signer; + 'WScript.Network': IWshRuntimeLibrary.WshNetwork; + 'WScript.Shell': IWshRuntimeLibrary.WshShell; +} + +interface ActiveXObject { + set(obj: IWshRuntimeLibrary.WshEnvironment, propertyName: 'Item', parameterTypes: [string], newValue: string): void; +} diff --git a/types/activex-iwshruntimelibrary/tsconfig.json b/types/activex-iwshruntimelibrary/tsconfig.json new file mode 100644 index 0000000000..20c2a630c3 --- /dev/null +++ b/types/activex-iwshruntimelibrary/tsconfig.json @@ -0,0 +1,21 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es5" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ "../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "activex-iwshruntimelibrary-tests.ts" + ] +} \ No newline at end of file diff --git a/types/activex-iwshruntimelibrary/tslint.json b/types/activex-iwshruntimelibrary/tslint.json new file mode 100644 index 0000000000..ed91c31f9c --- /dev/null +++ b/types/activex-iwshruntimelibrary/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "no-const-enum": false + } +} \ No newline at end of file diff --git a/types/windows-script-host/index.d.ts b/types/windows-script-host/index.d.ts index 50f0c52216..47f11e4d39 100644 --- a/types/windows-script-host/index.d.ts +++ b/types/windows-script-host/index.d.ts @@ -4,437 +4,44 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 -/// +/// -declare namespace IWshRuntimeLibrary { - type WindowStyle = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10; - type ShortcutWindowStyle = 1 | 3 | 7; - - const enum ButtonType { - OK, - OKCancel, - AbortRetryIgnore, - YesNoCancel, - YesNo, - RetryCancel, - CancelTryagainContinue - } - - const enum EventType { - AuditFailure = 5, - AuditSuccess = 4, - Error = 1, - Information = 3, - Success = 0, - Warning = 2 - } - - const enum IconType { - Stop = 16, - QuestionMark = 32, - ExclamationMakr = 48, - InformationMark = 64, - } - - const enum PopupType { - SecondButtonDefault = 256, - ThirdButtonDefault = 512, - Modal = 4096, - RightJustified = 524288, - RTL = 1048576, - } - - const enum PopupSelection { - NoButton = -1, - OK = 1, - Cancel = 2, - Abort = 3, - Retry = 4, - Ignore = 5, - Yes = 6, - No = 7, - TryAgain = 10, - Continue = 11, - } - - const enum WshExecStatus { - WshFailed = 2, - WshFinished = 1, - WshRunning = 0, - } - - const enum WshWindowStyle { - WshHide = 0, - WshMaximizedFocus = 3, - WshMinimizedFocus = 2, - WshMinimizedNoFocus = 6, - WshNormalFocus = 1, - WshNormalNoFocus = 4, - } - - class TextStreamBase { - /** - * The column number of the current character position in an input stream. - */ - Column: number; - - /** - * The current line number in an input stream. - */ - Line: number; - - /** - * Closes a text stream. - * It is not necessary to close standard streams; they close automatically when the process ends. If - * you close a standard stream, be aware that any other pointers to that standard stream become invalid. - */ - Close(): void; - } - - class TextStreamWriter extends TextStreamBase { - private 'IWshRuntimeLibrary.TextStreamWriter_typekey': TextStreamWriter; - private constructor(); - - /** - * Sends a string to an output stream. - */ - Write(s: string): void; - - /** - * Sends a specified number of blank lines (newline characters) to an output stream. - */ - WriteBlankLines(intLines: number): void; - - /** - * Sends a string followed by a newline character to an output stream. - */ - WriteLine(s: string): void; - } - - class TextStreamReader extends TextStreamBase { - private 'IWshRuntimeLibrary.TextStreamReader_typekey': TextStreamReader; - private constructor(); - - /** - * Returns a specified number of characters from an input stream, starting at the current pointer position. - * Does not return until the ENTER key is pressed. - * Can only be used on a stream in reading mode; causes an error in writing or appending mode. - */ - Read(characters: number): string; - - /** - * Returns all characters from an input stream. - * Can only be used on a stream in reading mode; causes an error in writing or appending mode. - */ - ReadAll(): string; - - /** - * Returns an entire line from an input stream. - * Although this method extracts the newline character, it does not add it to the returned string. - * Can only be used on a stream in reading mode; causes an error in writing or appending mode. - */ - ReadLine(): string; - - /** - * Skips a specified number of characters when reading from an input text stream. - * Can only be used on a stream in reading mode; causes an error in writing or appending mode. - * @param characters Positive number of characters to skip forward. (Backward skipping is not supported.) - */ - Skip(characters: number): void; - - /** - * Skips the next line when reading from an input text stream. - * Can only be used on a stream in reading mode, not writing or appending mode. - */ - SkipLine(): void; - - /** - * Indicates whether the stream pointer position is at the end of a line. - */ - AtEndOfLine: boolean; - - /** - * Indicates whether the stream pointer position is at the end of a stream. - */ - AtEndOfStream: boolean; - } - - /** Provides access to the entire collection of command-line parameters, in the order in which they were originally entered. */ - interface WshArguments { - Count(): number; - Item(index: number): string; - Length: number; - Named: WshNamed; - - /** - * When you run the **ShowUsage** method, a help screen (referred to as the usage) appears and displays details about the script's command line options. - * This information comes from the runtime section of the `*.WSF` file. Everything written between the `` and `` tags is pieced together - * to produce what is called a "usage statement." The usage statement tells the user how to use the script. - */ - ShowUsage(): void; - Unnamed: WshUnnamed; - (index: number): string; - } - - /** Generic Collection Object */ - interface WshCollection { - Count(): number; - Item(Index: any): any; - readonly length: number; - (Index: any): any; - } - - /** Environment Variables Collection Object */ - interface WshEnvironment { - Count(): number; - Item(Name: string): string; - readonly Length: number; - Remove(Name: string): void; - (Name: string): string; - } - - /** WSHExec object */ - class WshExec { - private 'IWshRuntimeLibrary.WshExec_typekey': WshExec; - private constructor(); - readonly ExitCode: number; - readonly ProcessID: number; - readonly Status: WshExecStatus; - readonly StdErr: TextStreamWriter; - readonly StdIn: TextStreamReader; - readonly StdOut: TextStreamWriter; - Terminate(): void; - } +/** Provides access to the entire collection of command-line parameters, in the order in which they were originally entered. */ +interface WshArguments { + Count(): number; + Item(index: number): string; + Length: number; + Named: WshNamed; /** - * Provides access to the named command-line arguments - * - * Note that enumerating over this object returns the **names** of the arguments, not the values + * When you run the **ShowUsage** method, a help screen (referred to as the usage) appears and displays details about the script's command line options. + * This information comes from the runtime section of the `*.WSF` file. Everything written between the `` and `` tags is pieced together + * to produce what is called a "usage statement." The usage statement tells the user how to use the script. */ - interface WshNamed { - Count(): number; - Exists(Key: string): boolean; - Item(name: string): string; - Length: number; - (name: string): string; - } + ShowUsage(): void; + Unnamed: WshUnnamed; + (index: number): string; +} - /** Network Object */ - class WshNetwork { - private 'IWshRuntimeLibrary.WshNetwork_typekey': WshNetwork; - private constructor(); +/** + * Provides access to the named command-line arguments + * + * Note that enumerating over this object returns the **names** of the arguments, not the values + */ +interface WshNamed { + Count(): number; + Exists(Key: string): boolean; + Item(name: string): string; + Length: number; + (name: string): string; +} - /** - * Adds a remote MS-DOS-based printer connection to your computer system. - * @param LocalName Local name to assign to the connected printer. - * @param RemoteName Name of the remote printer. - * @param UpdateProfile [false] Whether the printer mapping is stored in the current user's profile. - * - * If you are mapping a remote printer using the profile of someone other than current user, you can specify _UserName_ and _Password_. - */ - AddPrinterConnection(LocalName: string, RemoteName: string, UpdateProfile?: boolean, UserName?: string, Password?: string): void; - - /** - * @param string Path to printer connection - * @param string [DriverName=''] - * @param string [Port='LPT1'] - * - * Unlike the **AddPrinterConnection** method, this method allows you to create a printer connection without directing it to a specific port, such as LPT1. - */ - AddWindowsPrinterConnection(PrinterName: string, DriverName?: string, Port?: string): void; - readonly ComputerName: string; - EnumNetworkDrives(): WshCollection; - EnumPrinterConnections(): WshCollection; - - /** - * Adds a remote MS-DOS-based printer connection to your computer system. - * @param LocalName Name by which the mapped drive will be known locally - * @param RemoteName Share's UNC name (\\xxx\yyy) - * @param UpdateProfile [false] Whether the printer mapping is stored in the current user's profile. - * - * If you are mapping a network drive using the profile of someone other than current user, you can specify _UserName_ and _Password_. - */ - MapNetworkDrive(LocalName: string, RemoteName: string, UpdateProfile?: boolean, UserName?: string, Password?: string): void; - readonly Organization: string; - - /** - * Removes a shared network drive from your computer system - * @param Name Name of the mapped drive you want to remove. This will be the drive letter if the drive has a mapping between a local name (drive letter) and a remote name (UNC name); - * it will be the UNC path if there is no such mapping - * @param Force [false] Remove the connections even if the resource is in use - * @param UpdateProfile [false] Remove the mapping from the user's profile - */ - RemoveNetworkDrive(Name: string, Force?: boolean, UpdateProfile?: boolean): void; - - /** - * Removes a shared network printer connection from your computer system - * @param Name Name that identifies the printer. Can be a UNC name (in the form `\\xxx\yyy`) or a local name (such as `LPT1`) - * @param Force [false] Remove printer connection even if a user is still connected - * @param UpdateProfile [false] Remove the printer connection from the user's profile - * - * The **RemovePrinterConnection** method removes both Windows and MS-DOS based printer connections. If the printer was connected using the method **AddPrinterConnection**, - * _Name_ must be the printer's local name. If the printer was connected using the **AddWindowsPrinterConnection** method or was added manually (using the Add Printer wizard), - * then _Name_ must be the printer's UNC name. - */ - RemovePrinterConnection(Name: string, Force?: true, UpdateProfile?: true): void; - SetDefaultPrinter(Name: string): void; - readonly Site: string; - readonly UserDomain: string; - readonly UserName: string; - readonly UserProfile: string; - } - - /** Shell Object */ - class WshShell { - private 'IWshRuntimeLibrary.WshShell_typekey': WshShell; - private constructor(); - - /** - * Activates an application window - * @param App Title of application as it appears in the title bar, or the process ID - * @param Wait - * - * This method changes the focus to the named application or window. The window must be attached to the calling thread's message queue. It does not affect whether it is maximized or - * minimized. Focus moves from the activated application window when the user takes action to change the focus (or closes the window). - * - * In determining which application to activate, the specified title is compared to the title string of each running application. If no exact match exists, any application whose title - * string begins with title is activated. If an application still cannot be found, any application whose title string ends with title is activated. If more than one instance of the - * application named by title exists, one instance is arbitrarily activated. - * - * The method might return `false` under the following conditions: - * - * * The window is not brought to the foreground. - * * The window is brought to the foreground but is not given keyboard focus. - * * A Command Prompt window (`cmd.exe`) is brought to the foreground and is given keyboard focus. - */ - AppActivate(App: string | number, Wait?: any): boolean; - - /** - * Creates a shortcut - * @param PathLink Path where the shortcut should be created - * - * The shortcut object exists in memory until you save it to disk with the **Save** method. - */ - CreateShortcut(PathLink: string): WshShortcut | WshURLShortcut; - CurrentDirectory: string; - - /** - * Note that **Environment** doesn't actually return a callable object; the call is only usable in the context of the **Environment** property. The following: - * - * let env = new ActiveXObject('WScript.Shell').Environment; - * WScript.Echo(env('System')); - * - * will return an empty string, unless there is an environment variable named `System` - */ - Environment: WshEnvironment & ((Type: 'System' | 'User' | 'Process' | 'Volatile') => WshEnvironment); - Exec(Command: string): WshExec; - ExpandEnvironmentStrings(Src: string): string; - - /** @param string [Target=''] Name of the computer system where the event should be logged; default is the local computer system */ - LogEvent(Type: EventType, Message: string, Target?: string): boolean; - Popup(Text: string, SecondsToWait?: number, Title?: string, Type?: ButtonType | IconType | PopupType): PopupSelection; - RegDelete(Name: string): void; - - /** - * Returns the value of a key or value-name from the registry - * @param Name Key (ends with a final `\`) or value-name (doesn't end with a final `\`) - * - * Returns one of the following, based on the registry value type: - * - * * **REG_SZ** -- a string - * * **REG_DWORD** -- a number - * * **REG_SBINARY** -- a binary value, as a COM SafeArray containing integers - * * **REG_EXPAND_SZ** -- an expandable string - * * **REG_MULTI_SZ** -- an array of srings, as a COM SafeArray - */ - RegRead(Name: string): string | number | SafeArray | SafeArray; - - /** - * Creates a new key, adds another value-name to an existing key and assigns it a value, or changes the value of an existing value-name - * @param Name Key (ends with a final `\`) or value-name (doesn't end with a final `\`) - * @param Value Will be coerced to `string` or `integer` based on the value-name type: - * `REG_SZ | REG_EXPAND_SZ` will be converted to `string`; - * `REG_DWORD | REG_BINARY` will be converted to `integer` - * @param Type - */ - RegWrite(Name: string, Value: any, Type?: 'REG_SZ' | 'REG_DWORD' | 'REG_BINARY' | 'REG_EXPAND_SZ'): void; - - /** - * Runs a program in a new process. - * @param Command Command-line, including any parameters you want to pass to the executable file. - * @param WindowStyle Appearance of the program window. Not all programs make use of this information. - * @param WaitOnReturn Block script until program finishes executing. - * - * If `false` is passed into **WaitOnReturn**, the **Run** method will return 0 immediately. If `true` is passed in, **Run** will return the program's error code, if any. - * - * Environment variables will be expanded within the command line. - * - * Passing a registered file type will automatically open the program registered to the file type. - * - * Possible values for **WindowStyle**: - * - * * **0** -- Hides the window and activates another window. - * * **1** -- Activates and displays a window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag - * when displaying the window for the first time. - * * **2** -- Activates the window and displays it as a minimized window. - * * **3** -- Activates the window and displays it as a maximized window. - * * **4** -- Displays a window in its most recent size and position. The active window remains active. - * * **5** -- Activates the window and displays it in its current size and position. - * * **6** -- Minimizes the specified window and activates the next top-level window in the Z order. - * * **7** -- Displays the window as a minimized window. The active window remains active. - * * **8** -- Displays the window in its current state. The active window remains active. - * * **9** -- Activates and displays the window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag - * when restoring a minimized window. - * * **10** -- Sets the show-state based on the state of the program that started the application. - */ - Run(Command: string, WindowStyle?: WindowStyle, WaitOnReturn?: boolean): number; - SendKeys(Keys: string, Wait?: boolean): void; - readonly SpecialFolders: WshCollection; - } - - /** Shortcut Object */ - class WshShortcut { - private 'IWshRuntimeLibrary.WshShortcut_typekey': WshShortcut; - private constructor(); - Arguments: string; - Description: string; - readonly FullName: string; - Hotkey: string; - IconLocation: string; - Load(PathLink: string): void; - readonly RelativePath: string; - Save(): void; - TargetPath: string; - - /** - * Possible values: - * - * * **1** -- Activates and displays a window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag - * when displaying the window for the first time. - * * **3** -- Activates the window and displays it as a maximized window. - * * **7** -- Displays the window as a minimized window. The active window remains active. - */ - WindowStyle: ShortcutWindowStyle; - WorkingDirectory: string; - } - - /** Provides access to the unnamed command-line arguments */ - interface WshUnnamed { - Count(): number; - Item(index: number): string; - Length: number; - (index: number): string; - } - - /** URLShortcut Object */ - class WshURLShortcut { - private 'IWshRuntimeLibrary.WshURLShortcut_typekey': WshURLShortcut; - private constructor(); - readonly FullName: string; - Load(PathLink: string): void; - Save(): void; - TargetPath: string; - } +/** Provides access to the unnamed command-line arguments */ +interface WshUnnamed { + Count(): number; + Item(index: number): string; + Length: number; + (index: number): string; } declare var WScript: { @@ -455,7 +62,7 @@ declare var WScript: { * Can be accessed only while using CScript.exe. */ StdOut: IWshRuntimeLibrary.TextStreamWriter; - Arguments: IWshRuntimeLibrary.WshArguments; + Arguments: WshArguments; /** * The full path of the currently running script. @@ -546,41 +153,3 @@ declare var WScript: { * WSH is an alias for WScript under Windows Script Host */ declare var WSH: typeof WScript; - -declare namespace WSHControllerLibrary { - class WSHController { - private 'WSHControllerLibrary.WSHController_typekey': WSHController; - private constructor(); - CreateScript(Command: string, Server?: any): any; - } -} - -declare namespace ScriptSigner { - class Signer { - private 'ScriptSigner.Signer_typekey': Signer; - private constructor(); - - /** @param Store [Store='my'] */ - Sign(FileExtension: string, Text: string, Certificate: string, Store?: string): string; - - /** @param Store [Store='my'] */ - SignFile(FileName: string, Certificate: string, Store?: string): void; - - /** @param ShowUI [ShowUI=false] */ - Verify(FileExtension: string, Text: string, ShowUI?: boolean): boolean; - - /** @param ShowUI [ShowUI=false] */ - VerifyFile(FileName: string, ShowUI?: boolean): boolean; - } -} - -interface ActiveXObjectNameMap { - 'WSHController': WSHControllerLibrary.WSHController; - 'Scripting.Signer': ScriptSigner.Signer; - 'WScript.Network': IWshRuntimeLibrary.WshNetwork; - 'WScript.Shell': IWshRuntimeLibrary.WshShell; -} - -interface ActiveXObject { - set(obj: IWshRuntimeLibrary.WshEnvironment, propertyName: 'Item', parameterTypes: [string], newValue: string): void; -} diff --git a/types/windows-script-host/windows-script-host-tests.ts b/types/windows-script-host/windows-script-host-tests.ts index c6b3449482..d4851f2626 100644 --- a/types/windows-script-host/windows-script-host-tests.ts +++ b/types/windows-script-host/windows-script-host-tests.ts @@ -28,53 +28,3 @@ WScript.Echo(`${WScript.Arguments.Named.Length} named arguments`); for (const key of collectionToArray(WScript.Arguments.Named)) { WScript.Echo(` ${key}=${WScript.Arguments.Named(key)}`); } - -const wshn = new ActiveXObject('WScript.Network'); - -// https://msdn.microsoft.com/en-us/library/s6wt333f(v=vs.84).aspx -// https://msdn.microsoft.com/en-us/library/wck0hkd7(v=vs.84).aspx -// https://msdn.microsoft.com/en-us/library/tte130y1(v=vs.84).aspx -// https://msdn.microsoft.com/en-us/library/3fxhka75(v=vs.84).aspx -{ - WScript.Echo('Domain = ' + wshn.UserDomain); - WScript.Echo('Computer Name = ' + wshn.ComputerName); - WScript.Echo('User Name = ' + wshn.UserName); -} - -// https://msdn.microsoft.com/en-us/library/zsdh7hkb(v=vs.84).aspx -wshn.AddWindowsPrinterConnection('\\\\printserv\\DefaultPrinter'); - -// https://msdn.microsoft.com/en-us/library/kxsdca3c(v=vs.84).aspx -wshn.AddPrinterConnection("LPT1", "\\\\Server\\Print1"); - -// https://msdn.microsoft.com/en-us/library/t9zt39at(v=vs.84).aspx -// https://msdn.microsoft.com/en-us/library/zhds6k80(v=vs.84).aspx -{ - const drives = wshn.EnumNetworkDrives(); - const printers = wshn.EnumPrinterConnections(); - WScript.Echo("Network drive mappings:"); - for (let i = 0; i < drives.length; i += 2) { - WScript.Echo(`Drive ${drives.Item(i)} = ${drives.Item(i + 1)}`); - } - WScript.Echo(''); - WScript.Echo("Network printer mappings:"); - for (let i = 0; i < printers.length; i += 2) { - WScript.Echo(`Port ${printers.Item(i)} = ${printers.Item(i + 1)}`); - } -} - -// https://msdn.microsoft.com/en-us/library/8kst88h6(v=vs.84).aspx -wshn.MapNetworkDrive('E:', '\\\\Server\\Public'); - -// https://msdn.microsoft.com/en-us/library/d16d7wbf(v=vs.84).aspx -wshn.RemoveNetworkDrive('E:'); - -// https://msdn.microsoft.com/en-us/library/tsbh2yy7(v=vs.84).aspx -wshn.RemovePrinterConnection('\\\\PRN-CORP1\\B41-4523-A', true, true); - -// https://msdn.microsoft.com/en-us/library/2ccwwdct(v=vs.84).aspx -{ - const printerPath = "\\\\research\\library1"; - wshn.AddWindowsPrinterConnection(printerPath); - wshn.SetDefaultPrinter(printerPath); -} From 57164febb2b91d52ae6a43ad6a0e829d88c5008f Mon Sep 17 00:00:00 2001 From: Zev Spitz Date: Sun, 13 May 2018 18:23:19 +0200 Subject: [PATCH 080/575] Cleanup --- .../activex-iwshruntimelibrary/tsconfig.json | 23 +++ types/windows-script-host/index.d.ts | 4 +- types/windows-script-host/index.d.ts~HEAD | 155 ------------------ .../windows-script-host-tests.ts~HEAD | 30 ---- 4 files changed, 25 insertions(+), 187 deletions(-) create mode 100644 types/activex-iwshruntimelibrary/tsconfig.json delete mode 100644 types/windows-script-host/index.d.ts~HEAD delete mode 100644 types/windows-script-host/windows-script-host-tests.ts~HEAD diff --git a/types/activex-iwshruntimelibrary/tsconfig.json b/types/activex-iwshruntimelibrary/tsconfig.json new file mode 100644 index 0000000000..885ca81980 --- /dev/null +++ b/types/activex-iwshruntimelibrary/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es5" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "activex-iwshruntimelibrary-tests.ts" + ] +} diff --git a/types/windows-script-host/index.d.ts b/types/windows-script-host/index.d.ts index 5627917e8c..47f11e4d39 100644 --- a/types/windows-script-host/index.d.ts +++ b/types/windows-script-host/index.d.ts @@ -4,7 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 -/// +/// /** Provides access to the entire collection of command-line parameters, in the order in which they were originally entered. */ interface WshArguments { @@ -62,7 +62,7 @@ declare var WScript: { * Can be accessed only while using CScript.exe. */ StdOut: IWshRuntimeLibrary.TextStreamWriter; - Arguments: IWshRuntimeLibrary.WshArguments; + Arguments: WshArguments; /** * The full path of the currently running script. diff --git a/types/windows-script-host/index.d.ts~HEAD b/types/windows-script-host/index.d.ts~HEAD deleted file mode 100644 index 47f11e4d39..0000000000 --- a/types/windows-script-host/index.d.ts~HEAD +++ /dev/null @@ -1,155 +0,0 @@ -// Type definitions for Windows Script Host 5.8 -// Project: https://msdn.microsoft.com/en-us/library/9bbdkx3k.aspx -// Definitions by: Zev Spitz -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -/// - -/** Provides access to the entire collection of command-line parameters, in the order in which they were originally entered. */ -interface WshArguments { - Count(): number; - Item(index: number): string; - Length: number; - Named: WshNamed; - - /** - * When you run the **ShowUsage** method, a help screen (referred to as the usage) appears and displays details about the script's command line options. - * This information comes from the runtime section of the `*.WSF` file. Everything written between the `` and `` tags is pieced together - * to produce what is called a "usage statement." The usage statement tells the user how to use the script. - */ - ShowUsage(): void; - Unnamed: WshUnnamed; - (index: number): string; -} - -/** - * Provides access to the named command-line arguments - * - * Note that enumerating over this object returns the **names** of the arguments, not the values - */ -interface WshNamed { - Count(): number; - Exists(Key: string): boolean; - Item(name: string): string; - Length: number; - (name: string): string; -} - -/** Provides access to the unnamed command-line arguments */ -interface WshUnnamed { - Count(): number; - Item(index: number): string; - Length: number; - (index: number): string; -} - -declare var WScript: { - /** - * Outputs text to either a message box (under WScript.exe) or the command console window followed by - * a newline (under CScript.exe). - */ - Echo(s?: any): void; - - /** - * Exposes the write-only error output stream for the current script. - * Can be accessed only while using CScript.exe. - */ - StdErr: IWshRuntimeLibrary.TextStreamWriter; - - /** - * Exposes the write-only output stream for the current script. - * Can be accessed only while using CScript.exe. - */ - StdOut: IWshRuntimeLibrary.TextStreamWriter; - Arguments: WshArguments; - - /** - * The full path of the currently running script. - */ - ScriptFullName: string; - - /** - * Forces the script to stop immediately, with an optional exit code. - */ - Quit(exitCode?: number): number; - - /** - * The Windows Script Host build version number. - */ - BuildVersion: number; - - /** - * Fully qualified path of the host executable. - */ - FullName: string; - - /** - * Gets/sets the script mode - interactive(true) or batch(false). - */ - Interactive: boolean; - - /** - * The name of the host executable (WScript.exe or CScript.exe). - */ - Name: string; - - /** - * Path of the directory containing the host executable. - */ - Path: string; - - /** - * The filename of the currently running script. - */ - ScriptName: string; - - /** - * Exposes the read-only input stream for the current script. - * Can be accessed only while using CScript.exe. - */ - StdIn: IWshRuntimeLibrary.TextStreamReader; - - /** - * Windows Script Host version - */ - Version: string; - - /** - * Connects a COM object's event sources to functions named with a given prefix, in the form prefix_event. - */ - ConnectObject(objEventSource: any, strPrefix: string): void; - - /** - * Creates a COM object. - * @param strProgiID - * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events. - */ - CreateObject(strProgID: K, strPrefix?: string): ActiveXObjectNameMap[K]; - - /** - * Disconnects a COM object from its event sources. - */ - DisconnectObject(obj: any): void; - - /** - * Retrieves an existing object with the specified ProgID from memory, or creates a new one from a file. - * @param strPathname Fully qualified path to the file containing the object persisted to disk. - * For objects in memory, pass a zero-length string. - * @param strProgID - * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events. - */ - GetObject(strPathname: string, strProgID: K, strPrefix?: string): ActiveXObjectNameMap[K]; - GetObject(strPathname: string, strProgID?: string, strPrefix?: string): any; - - /** - * Suspends script execution for a specified length of time, then continues execution. - * @param intTime Interval (in milliseconds) to suspend script execution. - */ - Sleep(intTime: number): void; -}; - -/** - * WSH is an alias for WScript under Windows Script Host - */ -declare var WSH: typeof WScript; diff --git a/types/windows-script-host/windows-script-host-tests.ts~HEAD b/types/windows-script-host/windows-script-host-tests.ts~HEAD deleted file mode 100644 index d4851f2626..0000000000 --- a/types/windows-script-host/windows-script-host-tests.ts~HEAD +++ /dev/null @@ -1,30 +0,0 @@ -const collectionToArray = (col: { Item(key: any): T }): T[] => { - const results: T[] = []; - const enumerator = new Enumerator(col); - enumerator.moveFirst(); - while (!enumerator.atEnd()) { - results.push(enumerator.item()); - enumerator.moveNext(); - } - return results; -}; - -// Show all of the arguments. -WScript.Echo(`${WScript.Arguments.Length} arguments`); - -for (const arg of collectionToArray(WScript.Arguments)) { - WScript.Echo(` ${arg}`); -} - -// Show the unnamed arguments. -WScript.Echo(`${WScript.Arguments.Unnamed.Length} unnamed arguments`); - -for (const unnamed of collectionToArray(WScript.Arguments.Unnamed)) { - WScript.Echo(` ${unnamed}`); -} - -// Show the named arguments. -WScript.Echo(`${WScript.Arguments.Named.Length} named arguments`); -for (const key of collectionToArray(WScript.Arguments.Named)) { - WScript.Echo(` ${key}=${WScript.Arguments.Named(key)}`); -} From 0f8551f40f4053501f287e1f4bd1d5d713e48d45 Mon Sep 17 00:00:00 2001 From: Zev Spitz Date: Sun, 13 May 2018 18:32:38 +0200 Subject: [PATCH 081/575] Remove unneeded scripthost dependencies --- types/firebird/tsconfig.json | 3 +-- types/mfiles/tsconfig.json | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/types/firebird/tsconfig.json b/types/firebird/tsconfig.json index e5e2d1b6ac..ad3f26314d 100644 --- a/types/firebird/tsconfig.json +++ b/types/firebird/tsconfig.json @@ -2,8 +2,7 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6", - "scripthost" + "es6" ], "noImplicitAny": true, "noImplicitThis": true, diff --git a/types/mfiles/tsconfig.json b/types/mfiles/tsconfig.json index 295542875a..0b95d12fb9 100644 --- a/types/mfiles/tsconfig.json +++ b/types/mfiles/tsconfig.json @@ -2,8 +2,7 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es5", - "scripthost" + "es5" ], "noImplicitAny": true, "noImplicitThis": true, From 7c4f5bedba21a7c97649aa0eee38b00c06ba8260 Mon Sep 17 00:00:00 2001 From: "a.kalin" Date: Sun, 13 May 2018 20:27:51 +0300 Subject: [PATCH 082/575] @type/chrome discard method & properties --- types/chrome/index.d.ts | 48 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 2 deletions(-) diff --git a/types/chrome/index.d.ts b/types/chrome/index.d.ts index d2b92e4b22..3553daada1 100644 --- a/types/chrome/index.d.ts +++ b/types/chrome/index.d.ts @@ -5989,6 +5989,16 @@ declare namespace chrome.tabs { * @since Chrome 45. */ audible?: boolean; + /** + * Whether the tab is discarded. A discarded tab is one whose content has been unloaded from memory, but is still visible in the tab strip. Its content gets reloaded the next time it's activated. + * @since Chrome 54. + */ + discarded: boolean; + /** + * Whether the tab can be discarded automatically by the browser when resources are low. + * @since Chrome 54. + */ + autoDiscardable: boolean; /** * Optional. * Current tab muted state and the reason for the last state change. @@ -6153,6 +6163,11 @@ declare namespace chrome.tabs { * @since Chrome 45. */ muted?: boolean; + /** + * Optional. Whether the tab should be discarded automatically by the browser when resources are low. + * @since Chrome 54. + */ + autoDiscardable?: boolean; } export interface CaptureVisibleTabOptions { @@ -6200,7 +6215,7 @@ declare namespace chrome.tabs { * Optional. Whether the tabs have completed loading. * One of: "loading", or "complete" */ - status?: string; + status?: 'loading' | 'complete'; /** * Optional. Whether the tabs are in the last focused window. * @since Chrome 19. @@ -6212,7 +6227,7 @@ declare namespace chrome.tabs { * Optional. The type of window the tabs are in. * One of: "normal", "popup", "panel", "app", or "devtools" */ - windowType?: string; + windowType?: 'normal' | 'popup' | 'panel' | 'app' | 'devtools'; /** Optional. Whether the tabs are active in their windows. */ active?: boolean; /** @@ -6231,6 +6246,18 @@ declare namespace chrome.tabs { currentWindow?: boolean; /** Optional. Whether the tabs are highlighted. */ highlighted?: boolean; + /** + * Optional. + * Whether the tabs are discarded. A discarded tab is one whose content has been unloaded from memory, but is still visible in the tab strip. Its content gets reloaded the next time it's activated. + * @since Chrome 54. + */ + discarded?: boolean; + /** + * Optional. + * Whether the tabs can be discarded automatically by the browser when resources are low. + * @since Chrome 54. + */ + autoDiscardable?: boolean; /** Optional. Whether the tabs are pinned. */ pinned?: boolean; /** @@ -6280,6 +6307,16 @@ declare namespace chrome.tabs { * @since Chrome 45. */ audible?: boolean; + /** + * The tab's new discarded state. + * @since Chrome 54. + */ + discarded?: boolean; + /** + * The tab's new auto-discardable + * @since Chrome 54. + */ + autoDiscardable?: boolean; /** * The tab's new muted state and the reason for the change. * @since Chrome 46. Warning: this is the current Beta channel. @@ -6604,6 +6641,13 @@ declare namespace chrome.tabs { * Paramater zoomSettings: The tab's current zoom settings. */ export function getZoomSettings(tabId: number, callback: (zoomSettings: ZoomSettings) => void): void; + /** + * Discards a tab from memory. Discarded tabs are still visible on the tab strip and are reloaded when activated. + * @since Chrome 54. + * @param tabId Optional. The ID of the tab to be discarded. If specified, the tab will be discarded unless it's active or already discarded. If omitted, the browser will discard the least important tab. This can fail if no discardable tabs exist. + * @param callback Called after the operation is completed. + */ + export function discard(tabId: number, callback: (tab: Tab) => void): void; /** * Fired when the highlighted or selected tabs in a window changes. From e51b5c893c4eed575ca897be2366bfbe9742f3af Mon Sep 17 00:00:00 2001 From: Seth Kingsley Date: Sun, 13 May 2018 15:49:42 -0700 Subject: [PATCH 083/575] PATCH 1 Update version number and CC myself --- types/three/index.d.ts | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/types/three/index.d.ts b/types/three/index.d.ts index 2c8d006589..1361128b20 100644 --- a/types/three/index.d.ts +++ b/types/three/index.d.ts @@ -1,6 +1,22 @@ -// Type definitions for three.js 0.91 +// Type definitions for three.js 0.92 // Project: https://threejs.org -// Definitions by: Kon , Satoru Kimura , Florent Poujol , SereznoKot , HouChunlei , Ivo , David Asmuth , Brandon Roberge, Qinsi ZHU , Toshiya Nakakura , Poul Kjeldager Sørensen , Stefan Profanter , Edmund Fokschaner , Roelof Jooste , Daniel Hritzkiv , Apurva Ojas +// Definitions by: Kon , +// Satoru Kimura , +// Florent Poujol , +// SereznoKot , +// HouChunlei , +// Ivo , +// David Asmuth , +// Brandon Roberge, +// Qinsi ZHU , +// Toshiya Nakakura , +// Poul Kjeldager Sørensen , +// Stefan Profanter , +// Edmund Fokschaner , +// Roelof Jooste , +// Daniel Hritzkiv , +// Apurva Ojas , +// Seth Kingsley // Definitions: https://github.com//DefinitelyTyped export * from "./three-core"; From 4c25d57e2f63b31991a2832b990bb0feddf8bce7 Mon Sep 17 00:00:00 2001 From: "FUJI Goro (gfx)" Date: Mon, 14 May 2018 11:52:54 +0900 Subject: [PATCH 084/575] the original classname() accepts boolean, as well as falsy values --- types/classnames/classnames-tests.ts | 3 +++ types/classnames/index.d.ts | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/types/classnames/classnames-tests.ts b/types/classnames/classnames-tests.ts index b2b8c9eba4..55b801eb40 100644 --- a/types/classnames/classnames-tests.ts +++ b/types/classnames/classnames-tests.ts @@ -38,3 +38,6 @@ const className = cx('foo', ['bar'], { baz: true }); // => "abc def xyz" // falsey values are just ignored cx(null, 'bar', undefined, 0, 1, { baz: null }, ''); // => 'bar 1' + +// true is just ignored +cx(true || "foo"); diff --git a/types/classnames/index.d.ts b/types/classnames/index.d.ts index ce2abb5ee3..40e3ce835c 100644 --- a/types/classnames/index.d.ts +++ b/types/classnames/index.d.ts @@ -9,7 +9,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 -type ClassValue = string | number | ClassDictionary | ClassArray | undefined | null | false; +type ClassValue = string | number | ClassDictionary | ClassArray | undefined | null | boolean; interface ClassDictionary { [id: string]: boolean | undefined | null; From b92f5af5a1eeb100d1adf1bb2b0bd95bf689811b Mon Sep 17 00:00:00 2001 From: kento1218 Date: Mon, 14 May 2018 12:32:41 +0900 Subject: [PATCH 085/575] fix(bitcoinjs-lib): script templates * encodeStack should return Buffer[] * Signatures are assumed as Buffer, not ECSignature --- types/bitcoinjs-lib/bitcoinjs-lib-tests.ts | 19 +++++++++++++++++ types/bitcoinjs-lib/index.d.ts | 24 +++++++++++----------- 2 files changed, 31 insertions(+), 12 deletions(-) diff --git a/types/bitcoinjs-lib/bitcoinjs-lib-tests.ts b/types/bitcoinjs-lib/bitcoinjs-lib-tests.ts index 669c00d77a..9576ba7289 100644 --- a/types/bitcoinjs-lib/bitcoinjs-lib-tests.ts +++ b/types/bitcoinjs-lib/bitcoinjs-lib-tests.ts @@ -41,3 +41,22 @@ bitcoin.address.toBase58Check(rsBase58Check.hash, rsBase58Check.version); bitcoin.address.toBech32(rsBech32.data, rsBech32.version, rsBech32.prefix); bitcoin.address.toOutputScript(address); bitcoin.address.toOutputScript(address, network); + +const redeemScript = bitcoin.script.multisig.output.encode( + 2, + [ + new Buffer('12345678901234567890123456789012'), + new Buffer('12345678901234567890123456789012'), + new Buffer('12345678901234567890123456789012'), + ] +); +bitcoin.script.scriptHash.input.encode( + bitcoin.script.multisig.input.encodeStack( + [ + new Buffer('12345678901234567890123456789012'), + new Buffer('12345678901234567890123456789012'), + ], + redeemScript, + ), + redeemScript, +); diff --git a/types/bitcoinjs-lib/index.d.ts b/types/bitcoinjs-lib/index.d.ts index 920df43d6e..a05c3532b6 100644 --- a/types/bitcoinjs-lib/index.d.ts +++ b/types/bitcoinjs-lib/index.d.ts @@ -467,8 +467,8 @@ export namespace script { check(script: Buffer, allowIncomplete: boolean): boolean; decode(buffer: Buffer): Array; decodeStack(stack: Buffer[], allowIncomplete: boolean): Array; - encode(signatures: ECSignature[], scriptPubKey: Buffer): Buffer; - encodeStack(signatures: ECSignature[], scriptPubKey: Buffer): ECSignature[]; + encode(signatures: Buffer[], scriptPubKey: Buffer): Buffer; + encodeStack(signatures: Buffer[], scriptPubKey: Buffer): Buffer[]; }; output: { check(script: Buffer, allowIncomplete: boolean): boolean; @@ -482,8 +482,8 @@ export namespace script { check(script: Buffer): boolean; decode(buffer: Buffer): Array; decodeStack(stack: Buffer[]): Array; - encode(signature: ECSignature): Buffer; - encodeStack(signature: ECSignature): ECSignature[]; + encode(signature: Buffer): Buffer; + encodeStack(signature: Buffer): Buffer[]; }; output: { @@ -496,10 +496,10 @@ export namespace script { const pubKeyHash: { input: { check(script: Buffer): boolean; - decode(buffer: Buffer): { signature: ECSignature; pubKey: Buffer }; - decodeStack(stack: Buffer[]): { signature: ECSignature; pubKey: Buffer }; - encode(signature: ECSignature, pubKey: Buffer): Buffer; - encodeStack(signature: ECSignature, pubKey: Buffer): [ECSignature, Buffer]; + decode(buffer: Buffer): { signature: Buffer; pubKey: Buffer }; + decodeStack(stack: Buffer[]): { signature: Buffer; pubKey: Buffer }; + encode(signature: Buffer, pubKey: Buffer): Buffer; + encodeStack(signature: Buffer, pubKey: Buffer): [Buffer, Buffer]; }; output: { @@ -515,7 +515,7 @@ export namespace script { decode(buffer: Buffer): { redeemScriptStack: Buffer[]; redeemScript: Buffer }; decodeStack(stack: Buffer[]): { redeemScriptStack: Buffer[]; redeemScript: Buffer }; encode(redeemScriptSig: Array, redeemScript: Buffer): Buffer; - encodeStack(redeemScriptStack: Buffer[], redeemScript: Buffer): Buffer; + encodeStack(redeemScriptStack: Buffer[], redeemScript: Buffer): Buffer[]; }; output: { @@ -536,8 +536,8 @@ export namespace script { const witnessPubKeyHash: { input: { check(script: Buffer): boolean; - decodeStack(stack: Buffer[]): { signature: ECSignature; pubKey: Buffer }; - encodeStack(signature: ECSignature, pubKey: Buffer): [ECSignature, Buffer]; + decodeStack(stack: Buffer[]): { signature: Buffer; pubKey: Buffer }; + encodeStack(signature: Buffer, pubKey: Buffer): [Buffer, Buffer]; }; output: { @@ -551,7 +551,7 @@ export namespace script { input: { check(script: Buffer, allowIncomplete: boolean): boolean; decodeStack(stack: Buffer[]): { redeemScriptStack: Buffer[]; redeemScript: Buffer }; - encodeStack(redeemScriptStack: Buffer[], redeemScript: Buffer): Buffer; + encodeStack(redeemScriptStack: Buffer[], redeemScript: Buffer): Buffer[]; }; output: { From 0ecc4bfaf6674f48ec495b630ea4d8d115eabcf8 Mon Sep 17 00:00:00 2001 From: kento1218 Date: Mon, 14 May 2018 15:30:33 +0900 Subject: [PATCH 086/575] fix(bitcoinjs-lib): bump. add author --- types/bitcoinjs-lib/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/bitcoinjs-lib/index.d.ts b/types/bitcoinjs-lib/index.d.ts index a05c3532b6..4efca7bd94 100644 --- a/types/bitcoinjs-lib/index.d.ts +++ b/types/bitcoinjs-lib/index.d.ts @@ -1,10 +1,11 @@ -// Type definitions for bitcoinjs-lib 3.3 +// Type definitions for bitcoinjs-lib 3.4 // Project: https://github.com/bitcoinjs/bitcoinjs-lib // Definitions by: Mohamed Hegazy // Daniel // Ron Buckton // Satana Charuwichitratana // Youssef GHOUBACH +// Kento // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // Declaration file initially generated by dts-gen for bitcoinjs-lib 3.0.3 // based on the flow version found at https://github.com/flowtype/flow-typed/blob/master/definitions/npm/bitcoinjs-lib_v2.x.x/flow_v0.17.x-/bitcoinjs-lib_v2.x.x.js From 27763ecbb2e5883cc047d48b157cb5ee73b566a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Sopy=C5=82o?= Date: Mon, 14 May 2018 10:50:50 +0200 Subject: [PATCH 087/575] [@types/socket.io] fix: socket.use (#24574) --- types/socket.io/index.d.ts | 22 ++++++++++++++++++++++ types/socket.io/socket.io-tests.ts | 9 +++++++++ 2 files changed, 31 insertions(+) diff --git a/types/socket.io/index.d.ts b/types/socket.io/index.d.ts index d63effe544..6f7c0ef321 100644 --- a/types/socket.io/index.d.ts +++ b/types/socket.io/index.d.ts @@ -474,6 +474,21 @@ declare namespace SocketIO { compress( compress: boolean ): Namespace; } + interface Packet extends Array { + /** + * Event name + */ + [0]: string; + /** + * Packet data + */ + [1]: any; + /** + * Ack function + */ + [2]: (...args: any[]) => void; + } + /** * The socket, which handles our connection for a namespace. NOTE: while * we technically extend NodeJS.EventEmitter, we're not putting it here @@ -612,6 +627,13 @@ declare namespace SocketIO { */ in( room: string ): Socket; + /** + * Registers a middleware, which is a function that gets executed for every incoming Packet and receives as parameter the packet and a function to optionally defer execution to the next registered middleware. + * + * Errors passed to middleware callbacks are sent as special error packets to clients. + */ + use( fn: ( packet: Packet, next: (err?: any) => void ) => void ): Socket; + /** * Sends a 'message' event * @see emit( event, ...args ) diff --git a/types/socket.io/socket.io-tests.ts b/types/socket.io/socket.io-tests.ts index 7bfddb1271..60f0d70551 100644 --- a/types/socket.io/socket.io-tests.ts +++ b/types/socket.io/socket.io-tests.ts @@ -180,3 +180,12 @@ function testVolatileServerMessages() { var io = socketIO.listen(80); io.volatile.emit('volatile', 'Lost data'); } + +function testSocketUse() { + var io = socketIO.listen(80); + io.on('connection', (socket) => { + socket.use((packet, next) => { + console.log(packet); + }); + }); +} \ No newline at end of file From 3fbd854b913a1c7ccfde5956eee3cb2a4962846b Mon Sep 17 00:00:00 2001 From: bladegun Date: Mon, 14 May 2018 17:21:40 +0800 Subject: [PATCH 088/575] Added exports of ol.proj object --- types/ol/ol-tests.ts | 2 ++ types/ol/proj/index.d.ts | 3 +++ types/ol/tsconfig.json | 1 + 3 files changed, 6 insertions(+) create mode 100644 types/ol/proj/index.d.ts diff --git a/types/ol/ol-tests.ts b/types/ol/ol-tests.ts index 13a36df6f3..fbfed7e90f 100644 --- a/types/ol/ol-tests.ts +++ b/types/ol/ol-tests.ts @@ -148,6 +148,8 @@ import LayerVectorTile from 'ol/layer/vectortile'; import PointerPointerEvent from 'ol/pointer/pointerevent'; +import Proj from 'ol/proj'; + import ProjProjection from 'ol/proj/projection'; import Rendercanvas from 'ol/render/canvas'; diff --git a/types/ol/proj/index.d.ts b/types/ol/proj/index.d.ts new file mode 100644 index 0000000000..dc8d1a7f95 --- /dev/null +++ b/types/ol/proj/index.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.proj; diff --git a/types/ol/tsconfig.json b/types/ol/tsconfig.json index 6402adb0f7..79e135476e 100644 --- a/types/ol/tsconfig.json +++ b/types/ol/tsconfig.json @@ -95,6 +95,7 @@ "layer/vector.d.ts", "layer/vectortile.d.ts", "pointer/pointerevent.d.ts", + "proj/index.d.ts", "proj/projection.d.ts", "render/canvas.d.ts", "render/event.d.ts", From d976f29dbd1675d5080f40204bc9494aad908d86 Mon Sep 17 00:00:00 2001 From: Vladimir Date: Mon, 14 May 2018 16:42:34 +0600 Subject: [PATCH 089/575] Add exports namespace with all declared types --- types/react-input-mask/index.d.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/types/react-input-mask/index.d.ts b/types/react-input-mask/index.d.ts index 8716cda0e6..e8fadc2739 100644 --- a/types/react-input-mask/index.d.ts +++ b/types/react-input-mask/index.d.ts @@ -6,8 +6,11 @@ import * as React from "react"; -declare namespace reactInputMask { - interface ReactInputMaskProps extends React.InputHTMLAttributes { +export = ReactInputMask; +export as namespace ReactInputMask; + +declare namespace ReactInputMask { + interface Props extends React.InputHTMLAttributes { /** * Mask string. Format characters are: * * `9`: `0-9` @@ -41,8 +44,7 @@ declare namespace reactInputMask { */ inputRef?: React.Ref; } - class ReactInputMask extends React.Component { - } } -declare var ReactInputMask: typeof reactInputMask.ReactInputMask; -export default ReactInputMask; + +declare class ReactInputMask extends React.Component { +} From 57ccc9996a9405589d5db3e22d93bb06f789ee57 Mon Sep 17 00:00:00 2001 From: Vladimir Date: Mon, 14 May 2018 17:15:11 +0600 Subject: [PATCH 090/575] Add default export --- types/react-input-mask/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-input-mask/index.d.ts b/types/react-input-mask/index.d.ts index e8fadc2739..5bacb3561a 100644 --- a/types/react-input-mask/index.d.ts +++ b/types/react-input-mask/index.d.ts @@ -6,7 +6,7 @@ import * as React from "react"; -export = ReactInputMask; +export default ReactInputMask; export as namespace ReactInputMask; declare namespace ReactInputMask { From a745364a494192e2c6d89ba3cd0b837e41e1fea4 Mon Sep 17 00:00:00 2001 From: Vince Maiuri Date: Mon, 14 May 2018 07:57:12 -0500 Subject: [PATCH 091/575] Added remaining propTypes for sortable-list --- types/react-native-sortable-list/index.d.ts | 67 +++++++++++++++++++-- 1 file changed, 63 insertions(+), 4 deletions(-) mode change 100644 => 100755 types/react-native-sortable-list/index.d.ts diff --git a/types/react-native-sortable-list/index.d.ts b/types/react-native-sortable-list/index.d.ts old mode 100644 new mode 100755 index 9b8e547b85..354176860f --- a/types/react-native-sortable-list/index.d.ts +++ b/types/react-native-sortable-list/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for react-native-sortable-list // Project: https://github.com/gitim/react-native-sortable-list -// Definitions by: Michael Sivolobov +// Definitions by: Michael Sivolobov ,Vince Maiuri // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -51,6 +51,27 @@ interface SortableListProps { */ contentContainerStyle?: ViewStyle + /** + * these styles will be applied to the inner scroll view content container, excluding the header and footer + */ + innerContainerStyle?: ViewStyle + + /** + * when true, the SortableList's children are arranged horizontally in a row instead of vertically in a column. + * The default value is false. + */ + horizontal?: boolean + + /** + * when false, the vertical scroll indicator will not be visible. The default value is true. + */ + showsVerticalScrollIndicator?: boolean + + /** + * when false, the horizontal scroll indicator will not be visible. The default value is true. + */ + showsHorizontalScrollIndicator?: boolean + /** * when false, rows are not sortable. The default value is true. */ @@ -62,11 +83,44 @@ interface SortableListProps { scrollEnabled?: boolean /** - * Takes a row key, row index, data entry from the data source and its statuses disabled, - * active and should return a renderable component to be rendered as the row. + * whether you intend to use the toggleRowActive method to activate a row or use the out of box solution. + */ + manuallyActivateRows?: boolean + + /** + * determines the height for vertical list and the width for horizontal list of the area at the begining and + * the end of the list that will trigger autoscrolling. Defaults to 60. + */ + autoscrollAreaSize?: number + + /** + * determines time delay in ms before pressed row becomes active. Defaults to 200 ms. + */ + rowActivationTime?: number + + /** + * A RefreshControl that works the same way as a ScrollView's refreshControl. + */ + refreshControl?: JSX.Element + + /** + * Takes a row key, row index, data entry from the data source and its statuses disabled, active and should + * return a renderable component to be rendered as the row. The child component will receive a method called + * toggleRowActive (only if manuallyActivateRows={true}) to manually activate the row. Useful if you have + * multiple touch responders in your view. */ renderRow: (props: RowProps) => JSX.Element + /** + * Renders returned component at the top of the list. + */ + renderHeader?: () => JSX.Element + + /** + * Renders returned component at the bottom of the list. + */ + renderFooter?: () => JSX.Element + /** * Called when rows were reordered, takes an array of rows keys of the next rows order. */ @@ -81,6 +135,11 @@ interface SortableListProps { * Called when the active row was released. */ onReleaseRow?: (key: DataKey) => void + + /** + * Called when a row was pressed. + */ + onPressRow?: (key: DataKey) => void } interface SortableListStatic extends React.ClassicComponentClass {} @@ -88,4 +147,4 @@ interface SortableListStatic extends React.ClassicComponentClass Date: Mon, 14 May 2018 08:25:25 -0500 Subject: [PATCH 092/575] test updates --- types/react-native-sortable-list/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/react-native-sortable-list/index.d.ts b/types/react-native-sortable-list/index.d.ts index 354176860f..d5466c8f68 100755 --- a/types/react-native-sortable-list/index.d.ts +++ b/types/react-native-sortable-list/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for react-native-sortable-list +// Type definitions for react-native-sortable-list 0.0.22 // Project: https://github.com/gitim/react-native-sortable-list -// Definitions by: Michael Sivolobov ,Vince Maiuri +// Definitions by: Michael Sivolobov , Vince Maiuri // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 From 0c236faad38151973ac0829a142e3dc4d3abb83f Mon Sep 17 00:00:00 2001 From: Paul Huynh Date: Tue, 15 May 2018 00:43:50 +1000 Subject: [PATCH 093/575] Update shelljs typings for v0.8 --- types/shelljs/index.d.ts | 82 +++++++++++++++++++++++++++++----- types/shelljs/shelljs-tests.ts | 15 +++++++ 2 files changed, 87 insertions(+), 10 deletions(-) diff --git a/types/shelljs/index.d.ts b/types/shelljs/index.d.ts index 601668f65f..1f1eb5c375 100644 --- a/types/shelljs/index.d.ts +++ b/types/shelljs/index.d.ts @@ -1,8 +1,9 @@ -// Type definitions for ShellJS 0.7 +// Type definitions for ShellJS 0.8 // Project: http://shelljs.org // Definitions by: Niklas Mollenhauer // Vojtech Jasny // George Kalpakas +// Paul Huynh // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -11,10 +12,10 @@ import child = require("child_process"); import glob = require("glob"); /** - * Changes to directory dir for the duration of the script + * Changes to directory dir for the duration of the script. Changes to home directory if no argument is supplied. * @param dir Directory to change in. */ -export function cd(dir: string): void; +export function cd(dir?: string): void; /** * Returns the current directory. @@ -31,7 +32,7 @@ export function ls(...paths: Array): ShellArray; /** * Returns array of files in the given path, or in current directory if no path provided. - * @param options Available options: -R (recursive), -A (all files, include files beginning with ., except for . and ..) + * @param options Available options: -R: recursive -A: all files (include files beginning with ., except for . and ..) -L: follow symlinks -d: list directories themselves, not their contents -l: list objects representing each file, each with fields containing ls -l output fields. See fs.Stats for more info * @param ...paths Paths to search. * @return An array of files in the given path(s). */ @@ -53,7 +54,7 @@ export function cp(source: string | string[], dest: string): void; /** * Copies files. The wildcard * is accepted. - * @param options Available options: -f (force), -r, -R (recursive) + * @param options Available options: -f: force (default behavior) -n: no-clobber -u: only copy if source is newer than dest -r, -R: recursive -L: follow symlinks -P: don't follow symlinks * @param source The source. * @param dest The destination. */ @@ -79,6 +80,14 @@ export function rm(options: string, ...files: Array): void; */ export function mv(source: string | string[], dest: string): void; +/** + * Moves files. The wildcard * is accepted. + * @param options Available options: -f: force (default behavior) -n: no-clobber + * @param source The source. + * @param dest The destination. + */ +export function mv(options: string, source: string | string[], dest: string): void; + /** * Creates directories. * @param ...dir Directories to create. @@ -138,7 +147,7 @@ export function grep(regex_filter: string | RegExp, ...files: Array any; export interface ExecOptions extends child.ExecOptions { + /** Do not echo program output to console (default: false). */ silent?: boolean; + /** Asynchronous execution. If a callback is provided, it will be set to true, regardless of the passed value (default: false). */ async?: boolean; + /** Character encoding to use. Affects the values returned to stdout and stderr, and what is written to stdout and stderr when not in silent mode (default: 'utf8'). */ + encoding?: string; } export interface ExecOutputReturnValue { @@ -440,6 +461,47 @@ export function touch(files: string[]): void; export function touch(options: TouchOptionsLiteral, ...files: Array): void; export function touch(options: TouchOptionsArray, ...files: Array): void; +export interface HeadOptions { + /** Show the first lines of the files. */ + '-n': number; +} + +/** Read the start of a file. */ +export function head(...files: Array): ShellString; +/** Read the start of a file. */ +export function head(options: HeadOptions, ...files: Array): ShellString; + +/** + * Return the contents of the files, sorted line-by-line. Sorting multiple files mixes their content (just as unix sort does). + */ +export function sort(...files: Array): ShellString; + +/** + * Return the contents of the files, sorted line-by-line. Sorting multiple files mixes their content (just as unix sort does). + * @param options Available options: -r: Reverse the results -n: Compare according to numerical value + */ +export function sort(options: string, ...files: Array): ShellString; + +export interface TailOptions { + /** Show the last lines of files. */ + '-n': number; +} + +/** Read the end of a file. */ +export function tail(...files: Array): ShellString; +/** Read the end of a file. */ +export function tail(options: TailOptions, ...files: Array): ShellString; + +/** + * Filter adjacent matching lines from input. + */ +export function uniq(input: string, output?: string): ShellString; +/** + * Filter adjacent matching lines from input. + * @param options Available options: -i: Ignore case while comparing -c: Prefix lines by the number of occurrences -d: Only print duplicate lines, one for each group of identical lines + */ +export function uniq(options: string, input: string, output?: string): ShellString; + /** * Sets global configuration variables * @param options Available options: `+/-e`: exit upon error (`config.fatal`), `+/-v`: verbose: show all commands (`config.verbose`), `+/-f`: disable filename expansion (globbing) diff --git a/types/shelljs/shelljs-tests.ts b/types/shelljs/shelljs-tests.ts index da3175f5c6..37dccddff6 100644 --- a/types/shelljs/shelljs-tests.ts +++ b/types/shelljs/shelljs-tests.ts @@ -135,6 +135,21 @@ shell.touch({ '-r': '/some/file.txt' }, '/Users/brandom/test1'); shell.touch({ '-r': '/some/file.txt' }, '/Users/brandom/test1', '/Users/brandom/test2'); shell.touch({ '-r': '/oome/file.txt' }, ['/Users/brandom/test1', '/Users/brandom/test2']); +shell.head({'-n': 1}, 'file*.txt'); +shell.head('file1', 'file2'); +shell.head(['file1', 'file2']); // same as above + +shell.sort('foo.txt', 'bar.txt'); +shell.sort('-r', 'foo.txt'); + +shell.tail({'-n': 1}, 'file*.txt'); +shell.tail('file1', 'file2'); +shell.tail(['file1', 'file2']); // same as above + +shell.uniq('foo.txt'); +shell.uniq('-i', 'foo.txt'); +shell.uniq('-cd', 'foo.txt', 'bar.txt'); + const tmp = shell.tempdir(); // "/tmp" for most *nix platforms const errorlol = shell.error(); From 09c94e3e87efc06f5c8b95ff1761298408edb4d5 Mon Sep 17 00:00:00 2001 From: denis Date: Mon, 14 May 2018 00:29:46 +0200 Subject: [PATCH 094/575] Spelling correction --- types/d3-brush/index.d.ts | 6 +- types/d3-chord/d3-chord-tests.ts | 2 +- types/d3-chord/index.d.ts | 6 +- types/d3-collection/index.d.ts | 14 ++-- types/d3-drag/d3-drag-tests.ts | 4 +- types/d3-drag/index.d.ts | 2 +- types/d3-dsv/d3-dsv-tests.ts | 2 +- types/d3-dsv/index.d.ts | 12 +-- types/d3-dsv/v0/index.d.ts | 2 +- types/d3-fetch/index.d.ts | 12 +-- types/d3-force/index.d.ts | 6 +- types/d3-geo/d3-geo-tests.ts | 16 ++-- types/d3-geo/index.d.ts | 15 ++-- types/d3-hierarchy/d3-hierarchy-tests.ts | 4 +- types/d3-hierarchy/index.d.ts | 2 +- types/d3-hsv/d3-hsv-tests.ts | 4 +- types/d3-interpolate/d3-interpolate-tests.ts | 4 +- types/d3-path/index.d.ts | 2 +- types/d3-queue/d3-queue-tests.ts | 4 +- types/d3-queue/index.d.ts | 4 +- types/d3-random/index.d.ts | 2 +- types/d3-sankey/index.d.ts | 4 +- types/d3-scale/index.d.ts | 84 ++++++++++---------- types/d3-scale/v1/index.d.ts | 84 ++++++++++---------- types/d3-selection/d3-selection-tests.ts | 30 +++---- types/d3-selection/index.d.ts | 4 +- types/d3-shape/index.d.ts | 24 +++--- types/d3-time/index.d.ts | 36 ++++----- types/d3-transition/d3-transition-tests.ts | 16 ++-- types/d3-zoom/d3-zoom-tests.ts | 28 +++---- types/d3-zoom/index.d.ts | 4 +- types/d3/d3-tests.ts | 2 +- 32 files changed, 223 insertions(+), 218 deletions(-) diff --git a/types/d3-brush/index.d.ts b/types/d3-brush/index.d.ts index 644e6c06f7..e3d11d8f11 100644 --- a/types/d3-brush/index.d.ts +++ b/types/d3-brush/index.d.ts @@ -195,21 +195,21 @@ export interface BrushBehavior { * Create a new two-dimensional brush. * * The generic "Datum" refers to the type of the data of the selected svg:g element to - * which the returned BrushBEhavoir will be applied. + * which the returned BrushBehavior will be applied. */ export function brush(): BrushBehavior; /** * Creates a new one-dimensional brush along the x-dimension. * * The generic "Datum" refers to the type of the data of the selected svg:g element to - * which the returned BrushBEhavoir will be applied. + * which the returned BrushBehavior will be applied. */ export function brushX(): BrushBehavior; /** * Creates a new one-dimensional brush along the y-dimension. * * The generic "Datum" refers to the type of the data of the selected svg:g element to - * which the returned BrushBEhavoir will be applied. + * which the returned BrushBehavior will be applied. */ export function brushY(): BrushBehavior; diff --git a/types/d3-chord/d3-chord-tests.ts b/types/d3-chord/d3-chord-tests.ts index b66f39787a..284e307024 100644 --- a/types/d3-chord/d3-chord-tests.ts +++ b/types/d3-chord/d3-chord-tests.ts @@ -180,7 +180,7 @@ canvasRibbon(ribbon); // render ribbon for first chord // The below fails explicitly, as standard ChordSubgroup objects for source and target are missing "radius" property assumed in default // radius accessor. Given the internals of d3 this would lead to a "NaN" radius. So using static typing to raise this to -// awareness seems appropriate. The alternative, is to create RibbonGenerator using the generics to explictly set the types and +// awareness seems appropriate. The alternative, is to create RibbonGenerator using the generics to explicitly set the types and // then set the radius. Or, one could map a radius property into the Chords returned by the ChordLayout. // canvasRibbon(chords[0]); // fails, see above diff --git a/types/d3-chord/index.d.ts b/types/d3-chord/index.d.ts index b4865c962c..176cfe7af8 100644 --- a/types/d3-chord/index.d.ts +++ b/types/d3-chord/index.d.ts @@ -44,7 +44,7 @@ export interface ChordSubgroup { */ export interface Chord { /** - * Chord subgroup constituting the sodurce of Chord + * Chord subgroup constituting the source of Chord */ source: ChordSubgroup; /** @@ -122,7 +122,7 @@ export interface ChordLayout { * * The default is zero. * - * @param angle Pad angle between adjecent groups in radians. + * @param angle Pad angle between adjacent groups in radians. */ padAngle(angle: number): this; @@ -233,7 +233,7 @@ export interface Ribbon { /** * - * A ribbon generator to suport rendering of chords in a chord diagram. + * A ribbon generator to support rendering of chords in a chord diagram. * * The first generic corresponds to the type of the "this" context within which the ribbon generator and its accessor functions will be invoked. * diff --git a/types/d3-collection/index.d.ts b/types/d3-collection/index.d.ts index 5e7973e03b..89ac8d6153 100644 --- a/types/d3-collection/index.d.ts +++ b/types/d3-collection/index.d.ts @@ -7,7 +7,7 @@ // Last module patch version validated against: 1.0.4 /** - * Reference type things that can be coerced to string implicitely + * Reference type things that can be coerced to string implicitly */ export interface Stringifiable { toString(): string; @@ -64,7 +64,7 @@ export function entries(obj: object): Array<{ key: string, value: any }>; // --------------------------------------------------------------------- /** - * A datastructure similar to ES6 Maps, but with a few differences: + * A data structure similar to ES6 Maps, but with a few differences: * - Keys are coerced to strings. * - map.each, not map.forEach. (Also, no thisArg.) * - map.remove, not map.delete. @@ -194,7 +194,7 @@ export function map(obj: object): Map; // --------------------------------------------------------------------- /** - * A datastructure similar to ES6 Sets, but with a few differences: + * A data structure similar to ES6 Sets, but with a few differences: * * - Values are coerced to strings. * - set.each, not set.forEach. (Also, no thisArg.) @@ -282,11 +282,11 @@ export function set(array: T[], key: (value: T, index: number, array: T[]) => // --------------------------------------------------------------------- /** - * A more formal defintion of the nested array returned by Nest.entries(...). This data structure is intended as a reference only. + * A more formal definition of the nested array returned by Nest.entries(...). This data structure is intended as a reference only. * * As the union types cannot be ex ante simplified without knowledge * of the nesting level (number of key(...) operations) and whether the data were rolled-up, this data structure becomes cumbersome - * to use in practice. This is particularly true for discrimiation of array element types. + * to use in practice. This is particularly true for discrimination of array element types. * The use of the rollup function, or lack thereof, also determines whether NestedArray has the 'values' property * with an array of type Datum at leaf level, or has a rolled-up 'value' property. */ @@ -294,7 +294,7 @@ export function set(array: T[], key: (value: T, index: number, array: T[]) => export interface NestedArray extends Array<{ key: string, values: NestedArray | Datum[] | undefined, value: RollupType | undefined }> { } /** - * A more formal defintion of the nested array returned by Nest.map(...). This data structure is intended as a reference only. + * A more formal definition of the nested array returned by Nest.map(...). This data structure is intended as a reference only. * * As the union types cannot be ex ante simplified without knowledge * of the nesting level (number of key(...) operations) and whether the data were rolled-up, this data structure becomes cumbersome @@ -304,7 +304,7 @@ export interface NestedArray extends Array<{ key: string, val export interface NestedMap extends Map | Datum[] | RollupType> { } /** - * A more formal defintion of the nested array returned by Nest.object(...). This data structure is intended as a reference only. + * A more formal definition of the nested array returned by Nest.object(...). This data structure is intended as a reference only. * * As the union types cannot be ex ante simplified without knowledge * of the nesting level (number of key(...) operations) and whether the data were rolled-up, this data structure becomes cumbersome diff --git a/types/d3-drag/d3-drag-tests.ts b/types/d3-drag/d3-drag-tests.ts index 3bc7e6f851..9a8012606b 100644 --- a/types/d3-drag/d3-drag-tests.ts +++ b/types/d3-drag/d3-drag-tests.ts @@ -9,7 +9,7 @@ import * as d3Drag from 'd3-drag'; import { event, select, Selection } from 'd3-selection'; -// NB: Consider alternative approachto getting live event-binding +// NB: Consider alternative approach to getting live event-binding // when using webpack as suggested by @ocombe in response to // event binding question https://github.com/d3/d3-zoom/issues/32#issuecomment-229889310 // d3.getEvent = () => require("d3-selection").event; @@ -234,7 +234,7 @@ const sourceEvent: any = e.sourceEvent; // As always, the below tests are for signature only, no functional purpose // remove event listeners for a given event type -e = e.on('start.tmp', null); // chainability test through reassigment +e = e.on('start.tmp', null); // chainability test through reassignment e = e.on('drag', dragged); // e = e.on('drag', wrongDragHandler1); // fails, wrong datum type in handler diff --git a/types/d3-drag/index.d.ts b/types/d3-drag/index.d.ts index b930081d15..9aa1ccf8d2 100644 --- a/types/d3-drag/index.d.ts +++ b/types/d3-drag/index.d.ts @@ -199,7 +199,7 @@ export interface DragBehavior; * @param csvString A string, which must be in the comma-separated values format. * @param row A row conversion function which is invoked for each row, being passed an object representing the current row (d), * the index (i) starting at zero for the first non-header row, and the array of column names. If the returned value is null or undefined, - * the row is skipped and will be ommitted from the array returned by dsv.parse; otherwise, the returned value defines the corresponding row object. + * the row is skipped and will be omitted from the array returned by dsv.parse; otherwise, the returned value defines the corresponding row object. * In effect, row is similar to applying a map and filter operator to the returned rows. */ export function csvParse( @@ -102,7 +102,7 @@ export function csvParseRows(csvString: string): string[][]; * @param csvString A string, which must be in the comma-separated values format. * @param row A row conversion function which is invoked for each row, being passed an array representing the current row (d), the index (i) * starting at zero for the first row, and the array of column names. If the returned value is null or undefined, - * the row is skipped and will be ommitted from the array returned by dsv.parse; otherwise, the returned value defines the corresponding row object. + * the row is skipped and will be omitted from the array returned by dsv.parse; otherwise, the returned value defines the corresponding row object. * In effect, row is similar to applying a map and filter operator to the returned rows. */ export function csvParseRows( @@ -177,7 +177,7 @@ export function tsvParse(tsvString: string): DSVParsedArray; * @param tsvString A string, which must be in the tab-separated values format. * @param row A row conversion function which is invoked for each row, being passed an object representing the current row (d), * the index (i) starting at zero for the first non-header row, and the array of column names. If the returned value is null or undefined, - * the row is skipped and will be ommitted from the array returned by dsv.parse; otherwise, the returned value defines the corresponding row object. + * the row is skipped and will be omitted from the array returned by dsv.parse; otherwise, the returned value defines the corresponding row object. * In effect, row is similar to applying a map and filter operator to the returned rows. */ export function tsvParse( @@ -212,7 +212,7 @@ export function tsvParseRows(tsvString: string): string[][]; * @param tsvString A string, which must be in the tab-separated values format. * @param row A row conversion function which is invoked for each row, being passed an array representing the current row (d), the index (i) * starting at zero for the first row, and the array of column names. If the returned value is null or undefined, - * the row is skipped and will be ommitted from the array returned by dsv.parse; otherwise, the returned value defines the corresponding row object. + * the row is skipped and will be omitted from the array returned by dsv.parse; otherwise, the returned value defines the corresponding row object. * In effect, row is similar to applying a map and filter operator to the returned rows. */ export function tsvParseRows( @@ -285,7 +285,7 @@ export interface DSV { * @param dsvString A string, which must be in the delimiter-separated values format with the appropriate delimiter. * @param row A row conversion function which is invoked for each row, being passed an object representing the current row (d), * the index (i) starting at zero for the first non-header row, and the array of column names. If the returned value is null or undefined, - * the row is skipped and will be ommitted from the array returned by dsv.parse; otherwise, the returned value defines the corresponding row object. + * the row is skipped and will be omitted from the array returned by dsv.parse; otherwise, the returned value defines the corresponding row object. * In effect, row is similar to applying a map and filter operator to the returned rows. */ parse( @@ -314,7 +314,7 @@ export interface DSV { * @param dsvString A string, which must be in the delimiter-separated values format with the appropriate delimiter. * @param row A row conversion function which is invoked for each row, being passed an array representing the current row (d), the index (i) * starting at zero for the first row, and the array of column names. If the returned value is null or undefined, - * the row is skipped and will be ommitted from the array returned by dsv.parse; otherwise, the returned value defines the corresponding row object. + * the row is skipped and will be omitted from the array returned by dsv.parse; otherwise, the returned value defines the corresponding row object. * In effect, row is similar to applying a map and filter operator to the returned rows. */ parseRows( diff --git a/types/d3-dsv/v0/index.d.ts b/types/d3-dsv/v0/index.d.ts index 18701f64ea..94ddbef579 100644 --- a/types/d3-dsv/v0/index.d.ts +++ b/types/d3-dsv/v0/index.d.ts @@ -5,7 +5,7 @@ /** A parser and formatter for DSV (CSV and TSV) files. Extracted from D3. */ declare function loader( - /** the symbol used to seperate cells in the row. */ + /** the symbol used to separate cells in the row. */ delimiter: string, /** example: "text/plain" */ encoding?: string): D3Dsv; diff --git a/types/d3-fetch/index.d.ts b/types/d3-fetch/index.d.ts index 6e31d70a76..25343d1bf5 100644 --- a/types/d3-fetch/index.d.ts +++ b/types/d3-fetch/index.d.ts @@ -52,7 +52,7 @@ export function csv( * @param url A valid URL string. * @param row A row conversion function which is invoked for each row, being passed an object representing the current row (d), * the index (i) starting at zero for the first non-header row, and the array of column names. If the returned value is null or undefined, - * the row is skipped and will be ommitted from the array returned by dsv.csvParse; otherwise, the returned value defines the corresponding row object. + * the row is skipped and will be omitted from the array returned by dsv.csvParse; otherwise, the returned value defines the corresponding row object. * In effect, row is similar to applying a map and filter operator to the returned rows. */ export function csv( @@ -74,7 +74,7 @@ export function csv( * @param init An request initialization object. * @param row A row conversion function which is invoked for each row, being passed an object representing the current row (d), * the index (i) starting at zero for the first non-header row, and the array of column names. If the returned value is null or undefined, - * the row is skipped and will be ommitted from the array returned by dsv.csvParse; otherwise, the returned value defines the corresponding row object. + * the row is skipped and will be omitted from the array returned by dsv.csvParse; otherwise, the returned value defines the corresponding row object. * In effect, row is similar to applying a map and filter operator to the returned rows. */ export function csv( @@ -112,7 +112,7 @@ export function dsv( * @param url A valid URL string. * @param row A row conversion function which is invoked for each row, being passed an object representing the current row (d), * the index (i) starting at zero for the first non-header row, and the array of column names. If the returned value is null or undefined, - * the row is skipped and will be ommitted from the array returned by dsv.parse; otherwise, the returned value defines the corresponding row object. + * the row is skipped and will be omitted from the array returned by dsv.parse; otherwise, the returned value defines the corresponding row object. * In effect, row is similar to applying a map and filter operator to the returned rows. */ export function dsv( @@ -136,7 +136,7 @@ export function dsv( * @param init An request initialization object. * @param row A row conversion function which is invoked for each row, being passed an object representing the current row (d), * the index (i) starting at zero for the first non-header row, and the array of column names. If the returned value is null or undefined, - * the row is skipped and will be ommitted from the array returned by dsv.parse; otherwise, the returned value defines the corresponding row object. + * the row is skipped and will be omitted from the array returned by dsv.parse; otherwise, the returned value defines the corresponding row object. * In effect, row is similar to applying a map and filter operator to the returned rows. */ export function dsv( @@ -224,7 +224,7 @@ export function tsv( * @param url A valid URL string. * @param row A row conversion function which is invoked for each row, being passed an object representing the current row (d), * the index (i) starting at zero for the first non-header row, and the array of column names. If the returned value is null or undefined, - * the row is skipped and will be ommitted from the array returned by dsv.tsvParse; otherwise, the returned value defines the corresponding row object. + * the row is skipped and will be omitted from the array returned by dsv.tsvParse; otherwise, the returned value defines the corresponding row object. * In effect, row is similar to applying a map and filter operator to the returned rows. */ export function tsv( @@ -246,7 +246,7 @@ export function tsv( * @param init An request initialization object. * @param row A row conversion function which is invoked for each row, being passed an object representing the current row (d), * the index (i) starting at zero for the first non-header row, and the array of column names. If the returned value is null or undefined, - * the row is skipped and will be ommitted from the array returned by dsv.tsvParse; otherwise, the returned value defines the corresponding row object. + * the row is skipped and will be omitted from the array returned by dsv.tsvParse; otherwise, the returned value defines the corresponding row object. * In effect, row is similar to applying a map and filter operator to the returned rows. */ export function tsv( diff --git a/types/d3-force/index.d.ts b/types/d3-force/index.d.ts index 1736a1ac78..35f4d06657 100644 --- a/types/d3-force/index.d.ts +++ b/types/d3-force/index.d.ts @@ -55,7 +55,7 @@ export interface SimulationNodeDatum { /** * The base data structure for the datum of a Simulation Link, as used by ForceLink. * The optional properties contained in this data structure are internally assigned - * by when initializating with ForceLink.links(...) + * by when initializing with ForceLink.links(...) * * * IMPORTANT: The source and target properties may be internally mutated in type during the @@ -634,7 +634,7 @@ export interface ForceLink number; /** - * Set the strenght accessor to use the specified constant number for all links, + * Set the strength accessor to use the specified constant number for all links, * re-evaluates the strength accessor for each link, and returns this force. * * The constant is internally wrapped into a strength accessor function. @@ -647,7 +647,7 @@ export interface ForceLink(); -// geoPathConicProjection = geoPathSVG.projection(); // fails without casting to GeoConicProjection, or alternatively custom typeguard +// geoPathConicProjection = geoPathSVG.projection(); // fails without casting to GeoConicProjection, or alternatively custom type guard // geoPathConicProjection = geoPathSVG.projection(); // fails as SampleProperties does not extend minimal interface // context(...) ------------------------------------------------------ @@ -719,11 +719,11 @@ const context: d3Geo.GeoContext = { const transformFunction: { stream(s: d3Geo.GeoStream): {} } = d3Geo.geoTransform({}); -interface CustomTranformProto extends d3Geo.GeoTransformPrototype { +interface CustomTransformProto extends d3Geo.GeoTransformPrototype { a: number; } -let customTransformProto: CustomTranformProto; +let customTransformProto: CustomTransformProto; customTransformProto = { point(x, y) { @@ -732,11 +732,11 @@ customTransformProto = { a: 10 }; -const t: { stream(s: d3Geo.GeoStream): CustomTranformProto & d3Geo.GeoStream } = d3Geo.geoTransform(customTransformProto); +const t: { stream(s: d3Geo.GeoStream): CustomTransformProto & d3Geo.GeoStream } = d3Geo.geoTransform(customTransformProto); // geoIdentity() ======================================================== -let identityTransform: d3Geo.GeoIdentityTranform; +let identityTransform: d3Geo.GeoIdentityTransform; identityTransform = d3Geo.geoIdentity(); diff --git a/types/d3-geo/index.d.ts b/types/d3-geo/index.d.ts index a41f67618a..d1e45090c0 100644 --- a/types/d3-geo/index.d.ts +++ b/types/d3-geo/index.d.ts @@ -976,7 +976,7 @@ export interface GeoConicProjection extends GeoProjection { export interface GeoContext { /** * Adds an arc to the path with center point (x, y) and radius r starting at startAngle and ending at endAngle. - * The arc is drawn in clockwise directio by default. + * The arc is drawn in clockwise direction by default. * * @param x x-coordinate of arc center point. * @param y y-coordinate of arc center point. @@ -1046,7 +1046,7 @@ export interface GeoPath(methods: T): { str // geoIdentity() ================================================================= +/** + * @deprecated Misspelled name. Use GeoIdentityTransform. + */ +export type GeoIdentityTranform = GeoIdentityTransform; + /** * Geo Identity Transform */ -export interface GeoIdentityTranform extends GeoStreamWrapper { +export interface GeoIdentityTransform extends GeoStreamWrapper { /** * Returns the current viewport clip extent which defaults to null. */ @@ -1667,7 +1672,7 @@ export interface GeoIdentityTranform extends GeoStreamWrapper { /** * Returns the identity transform which can be used to scale, translate and clip planar geometry. */ -export function geoIdentity(): GeoIdentityTranform; +export function geoIdentity(): GeoIdentityTransform; // ---------------------------------------------------------------------- // Clipping Functions diff --git a/types/d3-hierarchy/d3-hierarchy-tests.ts b/types/d3-hierarchy/d3-hierarchy-tests.ts index 4e35f02ff9..65b1f5c392 100644 --- a/types/d3-hierarchy/d3-hierarchy-tests.ts +++ b/types/d3-hierarchy/d3-hierarchy-tests.ts @@ -568,7 +568,7 @@ hierarchyRectangularNode = rectangularNodeDescendants[rectangularNodeDescendants const treemapPath: Array> = treemapRootNode.path(hierarchyRectangularNode); -// links() and HierarchyRectangulerLink<...> ------------------------------------------ +// links() and HierarchyRectangularLink<...> ------------------------------------------ let rectangularLinks: Array>; @@ -747,7 +747,7 @@ hierarchyCircularNode = circularNodeDescendants[circularNodeDescendants.length - const packPath: Array> = packRootNode.path(hierarchyCircularNode); -// links() and HierarchyRectangulerLink<...> ------------------------------------------ +// links() and HierarchyRectangularLink<...> ------------------------------------------ let circularLinks: Array>; diff --git a/types/d3-hierarchy/index.d.ts b/types/d3-hierarchy/index.d.ts index a72dfa0aba..440a779217 100644 --- a/types/d3-hierarchy/index.d.ts +++ b/types/d3-hierarchy/index.d.ts @@ -50,7 +50,7 @@ export function hierarchy(data: Datum, children?: (d: Datum) => (Datum[] // Stratify // ----------------------------------------------------------------------- -// TODO: Review the comment in the API documentation related to 'reserved properties': id, parentId, children. If this is refering to the element on node, it should be 'parent'? +// TODO: Review the comment in the API documentation related to 'reserved properties': id, parentId, children. If this is referring to the element on node, it should be 'parent'? export interface StratifyOperator { (data: Datum[]): HierarchyNode; diff --git a/types/d3-hsv/d3-hsv-tests.ts b/types/d3-hsv/d3-hsv-tests.ts index 7aa6fb7817..780f584c7c 100644 --- a/types/d3-hsv/d3-hsv-tests.ts +++ b/types/d3-hsv/d3-hsv-tests.ts @@ -51,7 +51,7 @@ cString = cHSV.toString(); console.log('Channels = (h : %d, s: %d, v: %d)', cHSV.h, cHSV.s, cHSV.v); console.log('Opacity = %d', cHSV.opacity); -// Interpolater +// Interpolator iString = interpolateHsv('seagreen', 'steelblue'); iString = interpolateHsv(rgb('seagreen'), hcl('steelblue')); @@ -61,7 +61,7 @@ iString = interpolateHsvLong('seagreen', 'steelblue'); iString = interpolateHsvLong(rgb('seagreen'), hcl('steelblue')); iString = interpolateHsvLong(rgb('seagreen'), hsv('steelblue')); -// Prototype, instanceof and typeguard +// Prototype, instanceof and type guard declare let color: RGBColor | HSVColor | null; diff --git a/types/d3-interpolate/d3-interpolate-tests.ts b/types/d3-interpolate/d3-interpolate-tests.ts index 6baaf06092..e88ad79cfe 100644 --- a/types/d3-interpolate/d3-interpolate-tests.ts +++ b/types/d3-interpolate/d3-interpolate-tests.ts @@ -123,7 +123,7 @@ arrNum = iArrayNum(0.5); iArrayStr = d3Interpolate.interpolateArray(['1', '2'], ['4', '8']); // explicit typing arrStr = iArrayStr(0.5); -iArrayStr = d3Interpolate.interpolateArray([1, 2], ['4', '8']); // infered typing +iArrayStr = d3Interpolate.interpolateArray([1, 2], ['4', '8']); // inferred typing arrStr = iArrayStr(0.5); // two element array with first element date and second element string @@ -156,7 +156,7 @@ console.log('Recommended transition duration = %d', iZoom.duration); // test quantize(interpolator, n) signature ------------------------------------------------ -arrNum = d3Interpolate.quantize(d3Interpolate.interpolateRound(-1, 2), 4); // infered template parameter type +arrNum = d3Interpolate.quantize(d3Interpolate.interpolateRound(-1, 2), 4); // inferred template parameter type arrStr = d3Interpolate.quantize(d3Interpolate.interpolateString('-1', '2'), 4); // explicit template parameter typing // arrStr = d3Interpolate.quantize(d3Interpolate.interpolateRound(-1, 2), 4); // test fails, due to explicit typing v argument type mismatch diff --git a/types/d3-path/index.d.ts b/types/d3-path/index.d.ts index 7c0f662018..4c1f124962 100644 --- a/types/d3-path/index.d.ts +++ b/types/d3-path/index.d.ts @@ -95,7 +95,7 @@ export interface Path { rect(x: number, y: number, w: number, h: number): void; /** - * Returns the string representation of this path according to SVG’s path data specficiation. + * Returns the string representation of this path according to SVG’s path data specification. */ toString(): string; } diff --git a/types/d3-queue/d3-queue-tests.ts b/types/d3-queue/d3-queue-tests.ts index f387ea990a..08c195d9bd 100644 --- a/types/d3-queue/d3-queue-tests.ts +++ b/types/d3-queue/d3-queue-tests.ts @@ -38,7 +38,7 @@ qNoResult = qNoResult.defer(delayedHello, 'Alice', 250); qNoResult.defer(delayedHello, 'Bob', 500); -// Task with Reuslts ------------------------------------------------- +// Task with Results ------------------------------------------------- function getFileStats(path: string, callback: (error: any | null, stats?: any) => void) { // magically get file stats and behave like fs.stat when invoking the callback @@ -57,7 +57,7 @@ qNoResult = qNoResult.await((error) => { console.log('Goodbye!'); }); -// Task with Reuslts ------------------------------------------------- +// Task with Results ------------------------------------------------- // await qWithResults diff --git a/types/d3-queue/index.d.ts b/types/d3-queue/index.d.ts index d672849622..5ad38d8d74 100644 --- a/types/d3-queue/index.d.ts +++ b/types/d3-queue/index.d.ts @@ -29,7 +29,7 @@ export interface Queue { /** * Sets the callback to be invoked when all deferred tasks have finished (individual result arguments). * - * @param callback Callback function to be executed, when error occured or all deferred tasks + * @param callback Callback function to be executed, when error occurred or all deferred tasks * have completed. The first argument to the callback is the first error that occurred, or null if no error occurred. * If an error occurred, there are no additional arguments to the callback. Otherwise, * the callback is passed each result as an additional argument. @@ -38,7 +38,7 @@ export interface Queue { /** * Sets the callback to be invoked when all deferred tasks have finished (results array). * - * @param callback Callback function to be executed, when error occured or all deferred tasks + * @param callback Callback function to be executed, when error occurred or all deferred tasks * have completed. The first argument to the callback is the first error that occurred, * or null if no error occurred. If an error occurred, there are no additional arguments to the callback. * Otherwise, the callback is also passed an array of results as the second argument. diff --git a/types/d3-random/index.d.ts b/types/d3-random/index.d.ts index 41b6034215..c6335a694b 100644 --- a/types/d3-random/index.d.ts +++ b/types/d3-random/index.d.ts @@ -57,7 +57,7 @@ export const randomNormal: RandomNormal; */ export interface RandomLogNormal extends RandomNumberGenerationSource { /** - * Returns a function for generating random numbers with a log-normal distribution. The expected value of the random variable’s natural logrithm is mu, + * Returns a function for generating random numbers with a log-normal distribution. The expected value of the random variable’s natural logarithm is mu, * with the given standard deviation sigma. If mu is not specified, it defaults to 0; if sigma is not specified, it defaults to 1. * * @param mu Expected value, defaults to 0. diff --git a/types/d3-sankey/index.d.ts b/types/d3-sankey/index.d.ts index 237eb60f15..c619b5c8c3 100644 --- a/types/d3-sankey/index.d.ts +++ b/types/d3-sankey/index.d.ts @@ -333,7 +333,7 @@ export interface SankeyLayout { @@ -180,7 +180,7 @@ export interface ScaleContinuousNumeric { * * The second generic corresponds to the data type of the output elements generated by the scale. * - * If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and + * If range element and output element type differ, the interpolator factory used with the scale must match this behavior and * convert the interpolated range element to a corresponding output element. */ export interface ScaleLinear extends ScaleContinuousNumeric { @@ -197,9 +197,9 @@ export interface ScaleLinear extends ScaleContinuousNumeric): this; /** @@ -210,11 +210,11 @@ export interface ScaleLinear extends ScaleContinuousNumeric(interpolate: InterpolatorFactory): ScaleLinear; } @@ -228,9 +228,9 @@ export function scaleLinear(): ScaleLinear; /** * Constructs a new continuous linear scale with the unit domain [0, 1], the default interpolator and clamping disabled. * - * The generic correponds to the data type of the range and output elements to be used. + * The generic corresponds to the data type of the range and output elements to be used. * - * As range type and output type are the same, the interpolator factory used with the scale must match this behaviour. + * As range type and output type are the same, the interpolator factory used with the scale must match this behavior. * The range must be set in accordance with the range element type. * * The interpolator factory may be set using the interpolate(...) method of the scale. @@ -242,7 +242,7 @@ export function scaleLinear(): ScaleLinear; * The first generic corresponds to the data type of the range elements. * The second generic corresponds to the data type of the output elements generated by the scale. * - * If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and + * If range element and output element type differ, the interpolator factory used with the scale must match this behavior and * convert the interpolated range element to a corresponding output element. * * The range must be set in accordance with the range element type. @@ -271,7 +271,7 @@ export function scaleLinear(): ScaleLinear; * * The second generic corresponds to the data type of the output elements generated by the scale. * - * If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and + * If range element and output element type differ, the interpolator factory used with the scale must match this behavior and * convert the interpolated range element to a corresponding output element. */ export interface ScalePower extends ScaleContinuousNumeric { @@ -288,9 +288,9 @@ export interface ScalePower extends ScaleContinuousNumeric): this; /** @@ -301,11 +301,11 @@ export interface ScalePower extends ScaleContinuousNumeric(interpolate: InterpolatorFactory): ScalePower; @@ -332,9 +332,9 @@ export function scalePow(): ScalePower; * Constructs a new continuous power scale with the unit domain [0, 1], the exponent 1, the default interpolator and clamping disabled. * (Note that this is effectively a linear scale until you set a different exponent.) * - * The generic correponds to the data type of the range and output elements to be used. + * The generic corresponds to the data type of the range and output elements to be used. * - * As range type and output type are the same, the interpolator factory used with the scale must match this behaviour. + * As range type and output type are the same, the interpolator factory used with the scale must match this behavior. * * The range must be set in accordance with the range element type. * @@ -348,7 +348,7 @@ export function scalePow(): ScalePower; * The first generic corresponds to the data type of the range elements. * The second generic corresponds to the data type of the output elements generated by the scale. * - * If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and + * If range element and output element type differ, the interpolator factory used with the scale must match this behavior and * convert the interpolated range element to a corresponding output element. * * The range must be set in accordance with the range element type. @@ -368,9 +368,9 @@ export function scaleSqrt(): ScalePower; * Constructs a new continuous power scale with the unit domain [0, 1], the exponent 0.5, the default interpolator and clamping disabled. * This is a convenience method equivalent to d3.scalePow().exponent(0.5). * - * The generic correponds to the data type of the range and output elements to be used. + * The generic corresponds to the data type of the range and output elements to be used. * - * As range type and output type are the same, the interpolator factory used with the scale must match this behaviour. + * As range type and output type are the same, the interpolator factory used with the scale must match this behavior. * * The range must be set in accordance with the range element type. * @@ -384,7 +384,7 @@ export function scaleSqrt(): ScalePower; * The first generic corresponds to the data type of the range elements. * The second generic corresponds to the data type of the output elements generated by the scale. * - * If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and + * If range element and output element type differ, the interpolator factory used with the scale must match this behavior and * convert the interpolated range element to a corresponding output element. * * The range must be set in accordance with the range element type. @@ -417,7 +417,7 @@ export function scaleSqrt(): ScalePower; * * The second generic corresponds to the data type of the output elements generated by the scale. * - * If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and + * If range element and output element type differ, the interpolator factory used with the scale must match this behavior and * convert the interpolated range element to a corresponding output element. */ export interface ScaleLogarithmic extends ScaleContinuousNumeric { @@ -456,9 +456,9 @@ export interface ScaleLogarithmic extends ScaleContinuousNumeric< * If the scale is used to set an attribute or style, this is typically acceptable (and desirable for performance); * however, if you need to store the scale’s return value, you must specify your own interpolator or make a copy as appropriate. * - * As part of the interpolation process the interpotaled value from the range may be converted to a corresponding output value. + * As part of the interpolation process the interpolated value from the range may be converted to a corresponding output value. * - * @param interpolate An interpolation factory. The generics for Range and Output of the scale must correpond to the interpolation factory applied to the scale. + * @param interpolate An interpolation factory. The generics for Range and Output of the scale must correspond to the interpolation factory applied to the scale. */ interpolate(interpolate: InterpolatorFactory): this; /** @@ -469,11 +469,11 @@ export interface ScaleLogarithmic extends ScaleContinuousNumeric< * If the scale is used to set an attribute or style, this is typically acceptable (and desirable for performance); * however, if you need to store the scale’s return value, you must specify your own interpolator or make a copy as appropriate. * - * As part of the interpolation process the interpotaled value from the range may be converted to a corresponding output value. + * As part of the interpolation process the interpolated value from the range may be converted to a corresponding output value. * * The generic "NewOutput" can be used to change the scale to have a different output element type corresponding to the new interpolation factory. * - * @param interpolate An interpolation factory. The generics for Range and Output of the scale must correpond to the interpolation factory applied to the scale. + * @param interpolate An interpolation factory. The generics for Range and Output of the scale must correspond to the interpolation factory applied to the scale. */ interpolate(interpolate: InterpolatorFactory): ScaleLogarithmic; @@ -537,9 +537,9 @@ export function scaleLog(): ScaleLogarithmic; /** * Constructs a new continuous logarithmic scale with the domain [1, 10], the base 10, the default interpolator and clamping disabled. * - * The generic correponds to the data type of the range and output elements to be used. + * The generic corresponds to the data type of the range and output elements to be used. * - * As range type and output type are the same, the interpolator factory used with the scale must match this behaviour. + * As range type and output type are the same, the interpolator factory used with the scale must match this behavior. * * The range must be set in accordance with the range element type. * @@ -552,7 +552,7 @@ export function scaleLog(): ScaleLogarithmic; * The first generic corresponds to the data type of the range elements. * The second generic corresponds to the data type of the output elements generated by the scale. * - * If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and + * If range element and output element type differ, the interpolator factory used with the scale must match this behavior and * convert the interpolated range element to a corresponding output element. * * The range must be set in accordance with the range element type. @@ -696,7 +696,7 @@ export function scaleIdentity(): ScaleIdentity; * * The second generic corresponds to the data type of the output elements generated by the scale. * - * If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and + * If range element and output element type differ, the interpolator factory used with the scale must match this behavior and * convert the interpolated range element to a corresponding output element. */ export interface ScaleTime { @@ -798,9 +798,9 @@ export interface ScaleTime { * If the scale is used to set an attribute or style, this is typically acceptable (and desirable for performance); * however, if you need to store the scale’s return value, you must specify your own interpolator or make a copy as appropriate. * - * As part of the interpolation process the interpotaled value from the range may be converted to a corresponding output value. + * As part of the interpolation process the interpolated value from the range may be converted to a corresponding output value. * - * @param interpolate An interpolation factory. The generics for Range and Output of the scale must correpond to the interpolation factory applied to the scale. + * @param interpolate An interpolation factory. The generics for Range and Output of the scale must correspond to the interpolation factory applied to the scale. */ interpolate(interpolate: InterpolatorFactory): this; /** @@ -811,11 +811,11 @@ export interface ScaleTime { * If the scale is used to set an attribute or style, this is typically acceptable (and desirable for performance); * however, if you need to store the scale’s return value, you must specify your own interpolator or make a copy as appropriate. * - * As part of the interpolation process the interpotaled value from the range may be converted to a corresponding output value. + * As part of the interpolation process the interpolated value from the range may be converted to a corresponding output value. * * The generic "NewOutput" can be used to change the scale to have a different output element type corresponding to the new interpolation factory. * - * @param interpolate An interpolation factory. The generics for Range and Output of the scale must correpond to the interpolation factory applied to the scale. + * @param interpolate An interpolation factory. The generics for Range and Output of the scale must correspond to the interpolation factory applied to the scale. */ interpolate(interpolate: InterpolatorFactory): ScaleTime; @@ -942,9 +942,9 @@ export function scaleTime(): ScaleTime; /** * Constructs a new time scale using local time with the domain [2000-01-01, 2000-01-02], the default interpolator and clamping disabled. * - * The generic correponds to the data type of the range and output elements to be used. + * The generic corresponds to the data type of the range and output elements to be used. * - * As range type and output type are the same, the interpolator factory used with the scale must match this behaviour. + * As range type and output type are the same, the interpolator factory used with the scale must match this behavior. * * The range must be set in accordance with the range element type. * @@ -957,7 +957,7 @@ export function scaleTime(): ScaleTime; * The first generic corresponds to the data type of the range elements. * The second generic corresponds to the data type of the output elements generated by the scale. * - * If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and + * If range element and output element type differ, the interpolator factory used with the scale must match this behavior and * convert the interpolated range element to a corresponding output element. * * The range must be set in accordance with the range element type. @@ -975,9 +975,9 @@ export function scaleUtc(): ScaleTime; /** * Constructs a new time scale using Coordinated Universal Time (UTC) with the domain [2000-01-01, 2000-01-02], the default interpolator and clamping disabled. * - * The generic correponds to the data type of the range and output elements to be used. + * The generic corresponds to the data type of the range and output elements to be used. * - * As range type and output type are the same, the interpolator factory used with the scale must match this behaviour. + * As range type and output type are the same, the interpolator factory used with the scale must match this behavior. * * The range must be set in accordance with the range element type. * @@ -990,7 +990,7 @@ export function scaleUtc(): ScaleTime; * The first generic corresponds to the data type of the range elements. * The second generic corresponds to the data type of the output elements generated by the scale. * - * If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and + * If range element and output element type differ, the interpolator factory used with the scale must match this behavior and * convert the interpolated range element to a corresponding output element. * * The range must be set in accordance with the range element type. @@ -1202,7 +1202,7 @@ export function scaleQuantize(): ScaleQuantize; * The number of values in (the cardinality of) the output range determines the number of quantiles that will be computed from the domain. * To compute the quantiles, the domain is sorted, and treated as a population of discrete values; see d3-array’s quantile. * - * The generic correponds to the data type of range elements. + * The generic corresponds to the data type of range elements. */ export interface ScaleQuantile { /** @@ -1272,7 +1272,7 @@ export function scaleQuantile(): ScaleQuantile; * Constructs a new quantile scale with an empty domain and an empty range. * The quantile scale is invalid until both a domain and range are specified. * - * The generic correponds to the data type of range elements. + * The generic corresponds to the data type of range elements. */ export function scaleQuantile(): ScaleQuantile; @@ -1613,7 +1613,7 @@ export function scaleBand(): ScaleBand; /** * Constructs a new band scale with the empty domain, the unit range [0, 1], no padding, no rounding and center alignment. * - * The generic correponds to the data type of domain elements. + * The generic corresponds to the data type of domain elements. */ export function scaleBand(): ScaleBand; diff --git a/types/d3-scale/v1/index.d.ts b/types/d3-scale/v1/index.d.ts index a9843d9547..46fe6c2a12 100644 --- a/types/d3-scale/v1/index.d.ts +++ b/types/d3-scale/v1/index.d.ts @@ -14,7 +14,7 @@ import { CountableTimeInterval, TimeInterval } from 'd3-time'; /** * An Interpolator factory returns an interpolator function. * - * The first generic correponds to the data type of the interpolation boundaries. + * The first generic corresponds to the data type of the interpolation boundaries. * The second generic corresponds to the data type of the return type of the interpolator. */ export interface InterpolatorFactory { @@ -180,7 +180,7 @@ export interface ScaleContinuousNumeric { * * The second generic corresponds to the data type of the output elements generated by the scale. * - * If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and + * If range element and output element type differ, the interpolator factory used with the scale must match this behavior and * convert the interpolated range element to a corresponding output element. */ export interface ScaleLinear extends ScaleContinuousNumeric { @@ -197,9 +197,9 @@ export interface ScaleLinear extends ScaleContinuousNumeric): this; /** @@ -210,11 +210,11 @@ export interface ScaleLinear extends ScaleContinuousNumeric(interpolate: InterpolatorFactory): ScaleLinear; } @@ -228,9 +228,9 @@ export function scaleLinear(): ScaleLinear; /** * Constructs a new continuous linear scale with the unit domain [0, 1], the default interpolator and clamping disabled. * - * The generic correponds to the data type of the range and output elements to be used. + * The generic corresponds to the data type of the range and output elements to be used. * - * As range type and output type are the same, the interpolator factory used with the scale must match this behaviour. + * As range type and output type are the same, the interpolator factory used with the scale must match this behavior. * The range must be set in accordance with the range element type. * * The interpolator factory may be set using the interpolate(...) method of the scale. @@ -242,7 +242,7 @@ export function scaleLinear(): ScaleLinear; * The first generic corresponds to the data type of the range elements. * The second generic corresponds to the data type of the output elements generated by the scale. * - * If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and + * If range element and output element type differ, the interpolator factory used with the scale must match this behavior and * convert the interpolated range element to a corresponding output element. * * The range must be set in accordance with the range element type. @@ -271,7 +271,7 @@ export function scaleLinear(): ScaleLinear; * * The second generic corresponds to the data type of the output elements generated by the scale. * - * If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and + * If range element and output element type differ, the interpolator factory used with the scale must match this behavior and * convert the interpolated range element to a corresponding output element. */ export interface ScalePower extends ScaleContinuousNumeric { @@ -288,9 +288,9 @@ export interface ScalePower extends ScaleContinuousNumeric): this; /** @@ -301,11 +301,11 @@ export interface ScalePower extends ScaleContinuousNumeric(interpolate: InterpolatorFactory): ScalePower; @@ -332,9 +332,9 @@ export function scalePow(): ScalePower; * Constructs a new continuous power scale with the unit domain [0, 1], the exponent 1, the default interpolator and clamping disabled. * (Note that this is effectively a linear scale until you set a different exponent.) * - * The generic correponds to the data type of the range and output elements to be used. + * The generic corresponds to the data type of the range and output elements to be used. * - * As range type and output type are the same, the interpolator factory used with the scale must match this behaviour. + * As range type and output type are the same, the interpolator factory used with the scale must match this behavior. * * The range must be set in accordance with the range element type. * @@ -348,7 +348,7 @@ export function scalePow(): ScalePower; * The first generic corresponds to the data type of the range elements. * The second generic corresponds to the data type of the output elements generated by the scale. * - * If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and + * If range element and output element type differ, the interpolator factory used with the scale must match this behavior and * convert the interpolated range element to a corresponding output element. * * The range must be set in accordance with the range element type. @@ -368,9 +368,9 @@ export function scaleSqrt(): ScalePower; * Constructs a new continuous power scale with the unit domain [0, 1], the exponent 0.5, the default interpolator and clamping disabled. * This is a convenience method equivalent to d3.scalePow().exponent(0.5). * - * The generic correponds to the data type of the range and output elements to be used. + * The generic corresponds to the data type of the range and output elements to be used. * - * As range type and output type are the same, the interpolator factory used with the scale must match this behaviour. + * As range type and output type are the same, the interpolator factory used with the scale must match this behavior. * * The range must be set in accordance with the range element type. * @@ -384,7 +384,7 @@ export function scaleSqrt(): ScalePower; * The first generic corresponds to the data type of the range elements. * The second generic corresponds to the data type of the output elements generated by the scale. * - * If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and + * If range element and output element type differ, the interpolator factory used with the scale must match this behavior and * convert the interpolated range element to a corresponding output element. * * The range must be set in accordance with the range element type. @@ -417,7 +417,7 @@ export function scaleSqrt(): ScalePower; * * The second generic corresponds to the data type of the output elements generated by the scale. * - * If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and + * If range element and output element type differ, the interpolator factory used with the scale must match this behavior and * convert the interpolated range element to a corresponding output element. */ export interface ScaleLogarithmic extends ScaleContinuousNumeric { @@ -456,9 +456,9 @@ export interface ScaleLogarithmic extends ScaleContinuousNumeric< * If the scale is used to set an attribute or style, this is typically acceptable (and desirable for performance); * however, if you need to store the scale’s return value, you must specify your own interpolator or make a copy as appropriate. * - * As part of the interpolation process the interpotaled value from the range may be converted to a corresponding output value. + * As part of the interpolation process the interpolated value from the range may be converted to a corresponding output value. * - * @param interpolate An interpolation factory. The generics for Range and Output of the scale must correpond to the interpolation factory applied to the scale. + * @param interpolate An interpolation factory. The generics for Range and Output of the scale must correspond to the interpolation factory applied to the scale. */ interpolate(interpolate: InterpolatorFactory): this; /** @@ -469,11 +469,11 @@ export interface ScaleLogarithmic extends ScaleContinuousNumeric< * If the scale is used to set an attribute or style, this is typically acceptable (and desirable for performance); * however, if you need to store the scale’s return value, you must specify your own interpolator or make a copy as appropriate. * - * As part of the interpolation process the interpotaled value from the range may be converted to a corresponding output value. + * As part of the interpolation process the interpolated value from the range may be converted to a corresponding output value. * * The generic "NewOutput" can be used to change the scale to have a different output element type corresponding to the new interpolation factory. * - * @param interpolate An interpolation factory. The generics for Range and Output of the scale must correpond to the interpolation factory applied to the scale. + * @param interpolate An interpolation factory. The generics for Range and Output of the scale must correspond to the interpolation factory applied to the scale. */ interpolate(interpolate: InterpolatorFactory): ScaleLogarithmic; @@ -537,9 +537,9 @@ export function scaleLog(): ScaleLogarithmic; /** * Constructs a new continuous logarithmic scale with the domain [1, 10], the base 10, the default interpolator and clamping disabled. * - * The generic correponds to the data type of the range and output elements to be used. + * The generic corresponds to the data type of the range and output elements to be used. * - * As range type and output type are the same, the interpolator factory used with the scale must match this behaviour. + * As range type and output type are the same, the interpolator factory used with the scale must match this behavior. * * The range must be set in accordance with the range element type. * @@ -552,7 +552,7 @@ export function scaleLog(): ScaleLogarithmic; * The first generic corresponds to the data type of the range elements. * The second generic corresponds to the data type of the output elements generated by the scale. * - * If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and + * If range element and output element type differ, the interpolator factory used with the scale must match this behavior and * convert the interpolated range element to a corresponding output element. * * The range must be set in accordance with the range element type. @@ -696,7 +696,7 @@ export function scaleIdentity(): ScaleIdentity; * * The second generic corresponds to the data type of the output elements generated by the scale. * - * If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and + * If range element and output element type differ, the interpolator factory used with the scale must match this behavior and * convert the interpolated range element to a corresponding output element. */ export interface ScaleTime { @@ -798,9 +798,9 @@ export interface ScaleTime { * If the scale is used to set an attribute or style, this is typically acceptable (and desirable for performance); * however, if you need to store the scale’s return value, you must specify your own interpolator or make a copy as appropriate. * - * As part of the interpolation process the interpotaled value from the range may be converted to a corresponding output value. + * As part of the interpolation process the interpolated value from the range may be converted to a corresponding output value. * - * @param interpolate An interpolation factory. The generics for Range and Output of the scale must correpond to the interpolation factory applied to the scale. + * @param interpolate An interpolation factory. The generics for Range and Output of the scale must correspond to the interpolation factory applied to the scale. */ interpolate(interpolate: InterpolatorFactory): this; /** @@ -811,11 +811,11 @@ export interface ScaleTime { * If the scale is used to set an attribute or style, this is typically acceptable (and desirable for performance); * however, if you need to store the scale’s return value, you must specify your own interpolator or make a copy as appropriate. * - * As part of the interpolation process the interpotaled value from the range may be converted to a corresponding output value. + * As part of the interpolation process the interpolated value from the range may be converted to a corresponding output value. * * The generic "NewOutput" can be used to change the scale to have a different output element type corresponding to the new interpolation factory. * - * @param interpolate An interpolation factory. The generics for Range and Output of the scale must correpond to the interpolation factory applied to the scale. + * @param interpolate An interpolation factory. The generics for Range and Output of the scale must correspond to the interpolation factory applied to the scale. */ interpolate(interpolate: InterpolatorFactory): ScaleTime; @@ -942,9 +942,9 @@ export function scaleTime(): ScaleTime; /** * Constructs a new time scale using local time with the domain [2000-01-01, 2000-01-02], the default interpolator and clamping disabled. * - * The generic correponds to the data type of the range and output elements to be used. + * The generic corresponds to the data type of the range and output elements to be used. * - * As range type and output type are the same, the interpolator factory used with the scale must match this behaviour. + * As range type and output type are the same, the interpolator factory used with the scale must match this behavior. * * The range must be set in accordance with the range element type. * @@ -957,7 +957,7 @@ export function scaleTime(): ScaleTime; * The first generic corresponds to the data type of the range elements. * The second generic corresponds to the data type of the output elements generated by the scale. * - * If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and + * If range element and output element type differ, the interpolator factory used with the scale must match this behavior and * convert the interpolated range element to a corresponding output element. * * The range must be set in accordance with the range element type. @@ -975,9 +975,9 @@ export function scaleUtc(): ScaleTime; /** * Constructs a new time scale using Coordinated Universal Time (UTC) with the domain [2000-01-01, 2000-01-02], the default interpolator and clamping disabled. * - * The generic correponds to the data type of the range and output elements to be used. + * The generic corresponds to the data type of the range and output elements to be used. * - * As range type and output type are the same, the interpolator factory used with the scale must match this behaviour. + * As range type and output type are the same, the interpolator factory used with the scale must match this behavior. * * The range must be set in accordance with the range element type. * @@ -990,7 +990,7 @@ export function scaleUtc(): ScaleTime; * The first generic corresponds to the data type of the range elements. * The second generic corresponds to the data type of the output elements generated by the scale. * - * If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and + * If range element and output element type differ, the interpolator factory used with the scale must match this behavior and * convert the interpolated range element to a corresponding output element. * * The range must be set in accordance with the range element type. @@ -1267,7 +1267,7 @@ export function scaleQuantize(): ScaleQuantize; * The number of values in (the cardinality of) the output range determines the number of quantiles that will be computed from the domain. * To compute the quantiles, the domain is sorted, and treated as a population of discrete values; see d3-array’s quantile. * - * The generic correponds to the data type of range elements. + * The generic corresponds to the data type of range elements. */ export interface ScaleQuantile { /** @@ -1337,7 +1337,7 @@ export function scaleQuantile(): ScaleQuantile; * Constructs a new quantile scale with an empty domain and an empty range. * The quantile scale is invalid until both a domain and range are specified. * - * The generic correponds to the data type of range elements. + * The generic corresponds to the data type of range elements. */ export function scaleQuantile(): ScaleQuantile; @@ -1678,7 +1678,7 @@ export function scaleBand(): ScaleBand; /** * Constructs a new band scale with the empty domain, the unit range [0, 1], no padding, no rounding and center alignment. * - * The generic correponds to the data type of domain elements. + * The generic corresponds to the data type of domain elements. */ export function scaleBand(): ScaleBand; diff --git a/types/d3-selection/d3-selection-tests.ts b/types/d3-selection/d3-selection-tests.ts index e4f50c89e4..54ddb5ea11 100644 --- a/types/d3-selection/d3-selection-tests.ts +++ b/types/d3-selection/d3-selection-tests.ts @@ -162,8 +162,8 @@ const svgEl: d3Selection.Selection = let firstG: d3Selection.Selection = svgEl.select('g'); // let firstG_2: d3Selection.Selection = svgEl.select('g'); // fails, parent element of selection does not change with .select(...) -// firstG = svgEl.select('g'); // fails, element type defaults to 'BaseType', but SVGGElement expexted on left-hand side -// firstG = svgEl.select('svg'); // fails, element type of SVGSVGElement provided, but SVGGElement expexted on left-hand side (silly test to begin with) +// firstG = svgEl.select('g'); // fails, element type defaults to 'BaseType', but SVGGElement expected on left-hand side +// firstG = svgEl.select('svg'); // fails, element type of SVGSVGElement provided, but SVGGElement expected on left-hand side (silly test to begin with) // test, when it is not certain, whether an element of the type to be selected exists let maybeG: d3Selection.Selection; @@ -173,7 +173,7 @@ maybeG = svgEl.select('g'); // Using select(...) sub-selection with a selector function argument. function svgGroupSelector(this: SVGSVGElement, d: SVGDatum, i: number, groups: SVGSVGElement[] | ArrayLike): SVGGElement { - return this.querySelector('g')!; // this-type compatible with group element-type to which the selector function will be appplied + return this.querySelector('g')!; // this-type compatible with group element-type to which the selector function will be applied } firstG = svgEl.select(svgGroupSelector); @@ -224,7 +224,7 @@ let gElementsOldData: d3Selection.Selection): NodeListOf { - return this.querySelectorAll('g'); // this-type compatible with group element-type to which the selector function will be appplied + return this.querySelectorAll('g'); // this-type compatible with group element-type to which the selector function will be applied } gElementsOldData = svgEl.selectAll(svgGroupSelectorAll); @@ -302,11 +302,11 @@ gElementsOldData = svgEl.selectAll(d3Selection.selecto // Scenario 1: Filter retaining the element type of the select group (i.e. no type narrowing during filtering) -let filterdGElements: d3Selection.Selection; +let filteredGElements: d3Selection.Selection; -filterdGElements = gElementsOldData.filter('.top-level'); +filteredGElements = gElementsOldData.filter('.top-level'); -filterdGElements = gElementsOldData.filter(function(d, i, g) { +filteredGElements = gElementsOldData.filter(function(d, i, g) { const that: SVGGElement = this; // const that2: HTMLElement = this; // fails, type mismatch const datum: CircleDatum = d; @@ -322,23 +322,23 @@ filterdGElements = gElementsOldData.filter(function(d, i, g) { // Scenario 2: Filtering narrows the type of selected elements in a known way // assume the class ".any-svg-type" can only be assigned to SVGElements in the DOM -let filterdGElements2: d3Selection.Selection; +let filteredGElements2: d3Selection.Selection; -filterdGElements2 = d3Selection.selectAll('.any-svg-type').filter('g'); -// filterdGElements2 = d3Selection.selectAll('.any-type').filter('g'); // fails without using narrowing generic on filter method +filteredGElements2 = d3Selection.selectAll('.any-svg-type').filter('g'); +// filteredGElements2 = d3Selection.selectAll('.any-type').filter('g'); // fails without using narrowing generic on filter method -filterdGElements2 = d3Selection.selectAll('.any-svg-type').filter(function() { +filteredGElements2 = d3Selection.selectAll('.any-svg-type').filter(function() { const that: SVGElement = this; return that.tagName === 'g' || that.tagName === 'G'; }); -// filterdGElements2 = d3Selection.selectAll('.any-svg-type').filter(function(){ +// filteredGElements2 = d3Selection.selectAll('.any-svg-type').filter(function(){ // const that: SVGElement = this; // return that.tagName === 'g'|| that.tagName === 'G'; // }); // fails without using narrowing generic on filter method // matcher() ----------------------------------------------------------------------------- -filterdGElements = gElementsOldData.filter(d3Selection.matcher('.top-level')); +filteredGElements = gElementsOldData.filter(d3Selection.matcher('.top-level')); // --------------------------------------------------------------------------------------- // Tests of Modification @@ -644,7 +644,7 @@ let circles2: d3Selection.Selection = (this: T, datum: Datum, /** * TransitionLike is a helper interface to represent a quasi-Transition, without specifying the full Transition interface in this file. - * For example, whereever d3-zoom allows a Transition to be passed in as an argument, it internally immediately invokes its `selection()` + * For example, wherever d3-zoom allows a Transition to be passed in as an argument, it internally immediately invokes its `selection()` * method to retrieve the underlying Selection object before proceeding. * d3-brush uses a subset of Transition methods internally. * The use of this interface instead of the full imported Transition interface is [referred] to achieve @@ -480,7 +480,7 @@ export interface Selection(type: string): Selection; /** - * Appends a new element of the type provided by the element creator functionas the last child of each selected element, + * Appends a new element of the type provided by the element creator function as the last child of each selected element, * or before the next following sibling in the update selection if this is an enter selection. * The latter behavior for enter selections allows you to insert elements into the DOM in an order consistent with the new bound data; * however, note that selection.order may still be required if updating elements change order diff --git a/types/d3-shape/index.d.ts b/types/d3-shape/index.d.ts index 5408508683..47e5c10feb 100644 --- a/types/d3-shape/index.d.ts +++ b/types/d3-shape/index.d.ts @@ -32,7 +32,7 @@ export interface DefaultArcObject { */ endAngle: number; /** - * Optional. Pad angle of arcin radians. + * Optional. Pad angle of arc in radians. */ padAngle?: number; } @@ -741,7 +741,7 @@ export interface Line { /** * Returns the current curve factory, which defaults to curveLinear. * - * The generic allows to cast the curve factory to a specifc type, if known. + * The generic allows to cast the curve factory to a specific type, if known. */ curve(): C; /** @@ -916,7 +916,7 @@ export interface LineRadial { /** * Returns the current curve factory, which defaults to curveLinear. * - * The generic allows to cast the curve factory to a specifc type, if known. + * The generic allows to cast the curve factory to a specific type, if known. */ curve(): C; /** @@ -1213,7 +1213,7 @@ export interface Area { /** * Returns the current curve factory, which defaults to curveLinear. * - * The generic allows to cast the curve factory to a specifc type, if known. + * The generic allows to cast the curve factory to a specific type, if known. */ curve(): C; /** @@ -1518,7 +1518,7 @@ export interface AreaRadial { /** * Returns the current curve factory, which defaults to curveLinear. * - * The generic allows to cast the curve factory to a specifc type, if known. + * The generic allows to cast the curve factory to a specific type, if known. */ curve(): C; /** @@ -2280,7 +2280,7 @@ export interface SymbolType { * use a transform (see: SVG, Canvas) to move the arc to a different position. * * The first generic corresponds to the "this" context within which the symbol generator is invoked. - * The second generic corrsponds to the data type of the datum underlying the symbol. + * The second generic corresponds to the data type of the datum underlying the symbol. */ export interface Symbol { /** @@ -2382,7 +2382,7 @@ export function symbol(): Symbol; // tslint:disable-line ban-types /** * Constructs a new symbol generator with the default settings. * - * The generic corrsponds to the data type of the datum underlying the symbol. + * The generic corresponds to the data type of the datum underlying the symbol. */ export function symbol(): Symbol; // tslint:disable-line ban-types @@ -2390,7 +2390,7 @@ export function symbol(): Symbol; // tslint:disable-line ban- * Constructs a new symbol generator with the default settings. * * The first generic corresponds to the "this" context within which the symbol generator is invoked. - * The second generic corrsponds to the data type of the datum underlying the symbol. + * The second generic corresponds to the data type of the datum underlying the symbol. */ export function symbol(): Symbol; // tslint:disable-line ban-types @@ -2460,11 +2460,11 @@ export function pointRadial(angle: number, radius: number): [number, number]; */ export interface SeriesPoint extends Array { /** - * Correponds to y0, the lower value (baseline). + * Corresponds to y0, the lower value (baseline). */ 0: number; /** - * Correponds to y1, the upper value (topline). + * Corresponds to y1, the upper value (topline). */ 1: number; /** @@ -2565,7 +2565,7 @@ export interface Stack { value(value: (d: Datum, key: Key, j: number, data: Datum[]) => number): this; /** - * Returns the current order acccesor, which defaults to stackOrderNone; this uses the order given by the key accessor. + * Returns the current order accessor, which defaults to stackOrderNone; this uses the order given by the key accessor. */ order(): (series: Series) => number[]; /** @@ -2596,7 +2596,7 @@ export interface Stack { order(order: (series: Series) => number[]): this; /** - * Returns the current offset acccesor, which defaults to stackOffsetNone; this uses a zero baseline. + * Returns the current offset accessor, which defaults to stackOffsetNone; this uses a zero baseline. */ offset(): (series: Series, order: number[]) => void; /** diff --git a/types/d3-time/index.d.ts b/types/d3-time/index.d.ts index 3d88edbf27..b8aa2f12aa 100644 --- a/types/d3-time/index.d.ts +++ b/types/d3-time/index.d.ts @@ -22,7 +22,7 @@ export interface TimeInterval { * This function is idempotent: if the specified date is already floored to the current interval, * a new date with an identical time is returned. * Furthermore, the returned date is the minimum expressible value of the associated interval, - * such that interval.floor(interval.floor(date) - 1) returns the preceeding interval boundary date. + * such that interval.floor(interval.floor(date) - 1) returns the preceding interval boundary date. * * Note that the == and === operators do not compare by value with Date objects, * and thus you cannot use them to tell whether the specified date has already been floored. @@ -42,7 +42,7 @@ export interface TimeInterval { * This method is idempotent: if the specified date is already floored to the current interval, * a new date with an identical time is returned. * Furthermore, the returned date is the minimum expressible value of the associated interval, - * such that interval.floor(interval.floor(date) - 1) returns the preceeding interval boundary date. + * such that interval.floor(interval.floor(date) - 1) returns the preceding interval boundary date. * * Note that the == and === operators do not compare by value with Date objects, * and thus you cannot use them to tell whether the specified date has already been floored. @@ -165,7 +165,7 @@ export interface CountableTimeInterval extends TimeInterval { /** * Constructs a new custom interval given the specified floor and offset functions. * - * The returned custom interval is not countable, i.e. does not exposee the methods "count(..)" and "every(...)". + * The returned custom interval is not countable, i.e. does not expose the methods "count(..)" and "every(...)". * * @param floor A floor function which takes a single date as an argument and rounds it down to the nearest interval boundary. * @param offset An offset function which takes a date and an integer step as arguments and advances @@ -447,12 +447,12 @@ export function timeYears(start: Date, stop: Date, step?: number): Date[]; // utc Universal Coordinated Time ---------------------------------------------------------- /** - * Milliseconds Interval in Univarsal Coordinated Time (UTC); the shortest available time unit. + * Milliseconds Interval in Universal Coordinated Time (UTC); the shortest available time unit. */ export const utcMillisecond: CountableTimeInterval; /** - * This is a convenience alias for utcMilliesecond.range(...). + * This is a convenience alias for utcMillisecond.range(...). * * @param start A start date object for the range. * @param stop A stop date object for the range. @@ -461,7 +461,7 @@ export const utcMillisecond: CountableTimeInterval; export function utcMilliseconds(start: Date, stop: Date, step?: number): Date[]; /** - * Seconds Interval in Univarsal Coordinated Time (UTC); seconds (e.g., 01:23:45.0000 AM); 1,000 milliseconds. + * Seconds Interval in Universal Coordinated Time (UTC); seconds (e.g., 01:23:45.0000 AM); 1,000 milliseconds. */ export const utcSecond: CountableTimeInterval; @@ -475,7 +475,7 @@ export const utcSecond: CountableTimeInterval; export function utcSeconds(start: Date, stop: Date, step?: number): Date[]; /** - * Minutes Interval in Univarsal Coordinated Time (UTC); minutes (e.g., 01:02:00 AM); 60 seconds. + * Minutes Interval in Universal Coordinated Time (UTC); minutes (e.g., 01:02:00 AM); 60 seconds. * Note that ECMAScript ignores leap seconds. */ export const utcMinute: CountableTimeInterval; @@ -490,7 +490,7 @@ export const utcMinute: CountableTimeInterval; export function utcMinutes(start: Date, stop: Date, step?: number): Date[]; /** - * Hours Interval in Univarsal Coordinated Time (UTC); Hours (e.g., 01:00 AM); 60 minutes. + * Hours Interval in Universal Coordinated Time (UTC); Hours (e.g., 01:00 AM); 60 minutes. */ export const utcHour: CountableTimeInterval; @@ -504,7 +504,7 @@ export const utcHour: CountableTimeInterval; export function utcHours(start: Date, stop: Date, step?: number): Date[]; /** - * Days Interval in Univarsal Coordinated Time (UTC); days (e.g., February 7, 2012 at 12:00 AM); 24 hours. + * Days Interval in Universal Coordinated Time (UTC); days (e.g., February 7, 2012 at 12:00 AM); 24 hours. */ export const utcDay: CountableTimeInterval; @@ -533,7 +533,7 @@ export const utcWeek: CountableTimeInterval; export function utcWeeks(start: Date, stop: Date, step?: number): Date[]; /** - * Week Interval for Sunday-based weeks in Univarsal Coordinated Time (UTC) (e.g., February 5, 2012 at 12:00 AM). + * Week Interval for Sunday-based weeks in Universal Coordinated Time (UTC) (e.g., February 5, 2012 at 12:00 AM). * 7 days and 168 hours. */ export const utcSunday: CountableTimeInterval; @@ -548,7 +548,7 @@ export const utcSunday: CountableTimeInterval; export function utcSundays(start: Date, stop: Date, step?: number): Date[]; /** - * Week Interval for Monday-based weeks in Univarsal Coordinated Time (UTC) (e.g., February 6, 2012 at 12:00 AM). + * Week Interval for Monday-based weeks in Universal Coordinated Time (UTC) (e.g., February 6, 2012 at 12:00 AM). * 7 days and 168 hours. */ export const utcMonday: CountableTimeInterval; @@ -563,7 +563,7 @@ export const utcMonday: CountableTimeInterval; export function utcMondays(start: Date, stop: Date, step?: number): Date[]; /** - * Week Interval for Tuesday-based weeks in Univarsal Coordinated Time (UTC) (e.g., February 7, 2012 at 12:00 AM). + * Week Interval for Tuesday-based weeks in Universal Coordinated Time (UTC) (e.g., February 7, 2012 at 12:00 AM). * 7 days and 168 hours. */ export const utcTuesday: CountableTimeInterval; @@ -578,7 +578,7 @@ export const utcTuesday: CountableTimeInterval; export function utcTuesdays(start: Date, stop: Date, step?: number): Date[]; /** - * Week Interval for Wednesday-based weeks in Univarsal Coordinated Time (UTC) (e.g., February 8, 2012 at 12:00 AM). + * Week Interval for Wednesday-based weeks in Universal Coordinated Time (UTC) (e.g., February 8, 2012 at 12:00 AM). * 7 days and 168 hours. */ export const utcWednesday: CountableTimeInterval; @@ -593,7 +593,7 @@ export const utcWednesday: CountableTimeInterval; export function utcWednesdays(start: Date, stop: Date, step?: number): Date[]; /** - * Week Interval for Thursday-based weeks in Univarsal Coordinated Time (UTC) (e.g., February 9, 2012 at 12:00 AM). + * Week Interval for Thursday-based weeks in Universal Coordinated Time (UTC) (e.g., February 9, 2012 at 12:00 AM). * 7 days and 168 hours. */ export const utcThursday: CountableTimeInterval; @@ -608,7 +608,7 @@ export const utcThursday: CountableTimeInterval; export function utcThursdays(start: Date, stop: Date, step?: number): Date[]; /** - * Week Interval for Friday-based weeks in Univarsal Coordinated Time (UTC) (e.g., February 10, 2012 at 12:00 AM). + * Week Interval for Friday-based weeks in Universal Coordinated Time (UTC) (e.g., February 10, 2012 at 12:00 AM). * 7 days and 168 hours. */ export const utcFriday: CountableTimeInterval; @@ -623,7 +623,7 @@ export const utcFriday: CountableTimeInterval; export function utcFridays(start: Date, stop: Date, step?: number): Date[]; /** - * Week Interval for Saturday-based weeks in Univarsal Coordinated Time (UTC) (e.g., February 11, 2012 at 12:00 AM). + * Week Interval for Saturday-based weeks in Universal Coordinated Time (UTC) (e.g., February 11, 2012 at 12:00 AM). * 7 days and 168 hours. */ export const utcSaturday: CountableTimeInterval; @@ -638,7 +638,7 @@ export const utcSaturday: CountableTimeInterval; export function utcSaturdays(start: Date, stop: Date, step?: number): Date[]; /** - * Month Interval in Univarsal Coordinated Time (UTC); months (e.g., February 1, 2012 at 12:00 AM); ranges from 28 to 31 days. + * Month Interval in Universal Coordinated Time (UTC); months (e.g., February 1, 2012 at 12:00 AM); ranges from 28 to 31 days. */ export const utcMonth: CountableTimeInterval; @@ -652,7 +652,7 @@ export const utcMonth: CountableTimeInterval; export function utcMonths(start: Date, stop: Date, step?: number): Date[]; /** - * Year Interval in Univarsal Coordinated Time (UTC); years (e.g., January 1, 2012 at 12:00 AM); ranges from 365 to 366 days. + * Year Interval in Universal Coordinated Time (UTC); years (e.g., January 1, 2012 at 12:00 AM); ranges from 365 to 366 days. */ export const utcYear: CountableTimeInterval; diff --git a/types/d3-transition/d3-transition-tests.ts b/types/d3-transition/d3-transition-tests.ts index ba0ae99750..9ee4a8e43d 100644 --- a/types/d3-transition/d3-transition-tests.ts +++ b/types/d3-transition/d3-transition-tests.ts @@ -142,13 +142,13 @@ let newEnterTransition: d3Transition.Transition; -let differentDatumTypeTransition: d3Transition.Transition; +let differentDatumTypeTransition: d3Transition.Transition; // Comparable use cases arise e.g. when using an existing transition to generate a new transition // on a different selection to synchronize them (see e.g. Mike Bostock's Brush & Zoom II Example https://bl.ocks.org/mbostock/f48fcdb929a620ed97877e4678ab15e6) differentElementTypeTransition = select('body').selectAll('svg').transition(); newEnterTransition = enterCircles.transition(differentElementTypeTransition); -differentDatumTypeTransition = select('svg').selectAll('circle').transition(); +differentDatumTypeTransition = select('svg').selectAll('circle').transition(); newEnterTransition = enterCircles.transition(differentDatumTypeTransition); // -------------------------------------------------------------------------- @@ -234,18 +234,18 @@ exitTransition = exitTransition.filter(function(d, i, g) { const index: number = i; const group: SVGCircleElement[] | ArrayLike = g; // console.log(this.x) // fails, x property not defined on SVGCircleElement - return this.r.baseVal.value < i * d.r; // this-type SVGCircleElement, datum tpye CircleDatum + return this.r.baseVal.value < i * d.r; // this-type SVGCircleElement, datum type CircleDatum }); // Scenario 2: Filtering narrows the type of selected elements in a known way // assume the class ".any-svg-type" can only be assigned to SVGElements in the DOM -let filterdGElements2: d3Transition.Transition; +let filteredGElements2: d3Transition.Transition; -filterdGElements2 = selectAll('.any-svg-type').transition().filter('g'); -// filterdGElements2 = selectAll('.any-type').transition().filter('g'); // fails without using narrowing generic on filter method +filteredGElements2 = selectAll('.any-svg-type').transition().filter('g'); +// filteredGElements2 = selectAll('.any-type').transition().filter('g'); // fails without using narrowing generic on filter method -filterdGElements2 = selectAll('.any-svg-type').transition().filter(function(d, i, g) { +filteredGElements2 = selectAll('.any-svg-type').transition().filter(function(d, i, g) { const that: SVGElement = this; // const that2: HTMLElement = this; // fails, type mismatch const datum: CircleDatum = d; @@ -253,7 +253,7 @@ filterdGElements2 = selectAll('.any-svg-type').transition().fil const group: SVGElement[] | ArrayLike = g; return that.tagName === 'g' || that.tagName === 'G'; }); -// filterdGElements2 = selectAll('.any-svg-type').transition().filter(function(){ +// filteredGElements2 = selectAll('.any-svg-type').transition().filter(function(){ // const that: SVGElement = this; // return that.tagName === 'g'|| that.tagName === 'G'; // }); // fails without using narrowing generic on filter method diff --git a/types/d3-zoom/d3-zoom-tests.ts b/types/d3-zoom/d3-zoom-tests.ts index 669b4af8ff..8051898b8b 100644 --- a/types/d3-zoom/d3-zoom-tests.ts +++ b/types/d3-zoom/d3-zoom-tests.ts @@ -84,7 +84,7 @@ interface GroupDatum { } // -------------------------------------------------------------------------- -// Test Define ZoomBehaviour +// Test Define ZoomBehavior // -------------------------------------------------------------------------- // Canvas Example ----------------------------------------------------------- @@ -235,7 +235,7 @@ const duration: number = svgZoom.duration(); // interpolate() -------------------------------------------------------------- -// chainable setter accepts interpoateZoom, interpolate and interpolateArray +// chainable setter accepts interpolateZoom, interpolate and interpolateArray svgZoom = svgZoom.interpolate(interpolateZoom); svgZoom = svgZoom.interpolate(interpolate); svgZoom = svgZoom.interpolate(interpolateArray); @@ -269,7 +269,7 @@ if (zoomHandler) { svgZoom.on('zoom', zoomHandler); } // -------------------------------------------------------------------------- -// Test Attach ZoomBehaviour +// Test Attach ZoomBehavior // -------------------------------------------------------------------------- // Canvas Example ----------------------------------------------------------- @@ -290,14 +290,14 @@ const svgOverlay: Selection = svg.ap const svgOverlayTransition = svgOverlay.transition(); // -------------------------------------------------------------------------- -// Test Use ZoomBehaviour +// Test Use ZoomBehavior // -------------------------------------------------------------------------- // transform() ------------------------------------------------------------------------------------- // use on selection svgZoom.transform(svgOverlay, d3Zoom.zoomIdentity); -// svgZoom.transform(groupsSelection, d3Zoom.zoomIdentity); // fails, as groupSelection mismachtes DOM Element type and datum type +// svgZoom.transform(groupsSelection, d3Zoom.zoomIdentity); // fails, as groupSelection mismatches DOM Element type and datum type svgZoom.transform(svgOverlay, function(datum, index, groups) { const that: SVGRectElement = this; @@ -310,7 +310,7 @@ svgZoom.transform(svgOverlay, function(datum, index, groups) { }); // use on transition svgOverlayTransition.call(svgZoom.transform, d3Zoom.zoomIdentity); -// svgZoom.transform(groupsTransition, d3Zoom.zoomIdentity); // fails, as groupTransition mismachtes DOM Element type and datum type +// svgZoom.transform(groupsTransition, d3Zoom.zoomIdentity); // fails, as groupTransition mismatches DOM Element type and datum type svgZoom.transform(svgOverlayTransition, d3Zoom.zoomIdentity); svgZoom.transform(svgOverlayTransition, function(datum, index, groups) { @@ -327,7 +327,7 @@ svgZoom.transform(svgOverlayTransition, function(datum, index, groups) { // use on selection svgZoom.translateBy(svgOverlay, 20, 50); -// svgZoom.translateBy(groupsSelection, 20, 50); // fails, as groupSelection mismachtes DOM Element type and datum type +// svgZoom.translateBy(groupsSelection, 20, 50); // fails, as groupSelection mismatches DOM Element type and datum type svgZoom.translateBy( svgOverlay, @@ -376,7 +376,7 @@ svgZoom.translateBy( // use on transition svgZoom.translateBy(svgOverlayTransition, 20, 50); -// svgZoom.translateBy(groupsTransition, 20, 50); // fails, as groupTransition mismachtes DOM Element type and datum type +// svgZoom.translateBy(groupsTransition, 20, 50); // fails, as groupTransition mismatches DOM Element type and datum type svgZoom.translateBy( svgOverlayTransition, @@ -427,7 +427,7 @@ svgZoom.translateBy( // use on selection svgZoom.translateTo(svgOverlay, 20, 50); -// svgZoom.translateTo(groupsSelection, 20, 50); // fails, as groupSelection mismachtes DOM Element type and datum type +// svgZoom.translateTo(groupsSelection, 20, 50); // fails, as groupSelection mismatches DOM Element type and datum type svgZoom.translateTo( svgOverlay, @@ -476,7 +476,7 @@ svgZoom.translateTo( // use on transition svgZoom.translateTo(svgOverlayTransition, 20, 50); -// svgZoom.translateTo(groupsTransition, 20, 50); // fails, as groupTransition mismachtes DOM Element type and datum type +// svgZoom.translateTo(groupsTransition, 20, 50); // fails, as groupTransition mismatches DOM Element type and datum type svgZoom.translateTo( svgOverlayTransition, @@ -527,7 +527,7 @@ svgZoom.translateTo( // use on selection svgZoom.scaleBy(svgOverlay, 3); -// svgZoom.scaleBy(groupsSelection, 3); // fails, as groupSelection mismachtes DOM Element type and datum type +// svgZoom.scaleBy(groupsSelection, 3); // fails, as groupSelection mismatches DOM Element type and datum type svgZoom.scaleBy(svgOverlay, function(datum, index, groups) { const that: SVGRectElement = this; @@ -540,7 +540,7 @@ svgZoom.scaleBy(svgOverlay, function(datum, index, groups) { }); // use on transition svgZoom.scaleBy(svgOverlayTransition, 3); -// svgZoom.scaleBy(groupsTransition, 3); // fails, as groupTransition mismachtes DOM Element type and datum type +// svgZoom.scaleBy(groupsTransition, 3); // fails, as groupTransition mismatches DOM Element type and datum type svgZoom.scaleBy(svgOverlayTransition, function(datum, index, groups) { const that: SVGRectElement = this; @@ -556,7 +556,7 @@ svgZoom.scaleBy(svgOverlayTransition, function(datum, index, groups) { // use on selection svgZoom.scaleTo(svgOverlay, 3); -// svgZoom.scaleBy(groupsSelection, 3); // fails, as groupSelection mismachtes DOM Element type and datum type +// svgZoom.scaleBy(groupsSelection, 3); // fails, as groupSelection mismatches DOM Element type and datum type svgZoom.scaleTo(svgOverlay, function(datum, index, groups) { const that: SVGRectElement = this; @@ -569,7 +569,7 @@ svgZoom.scaleTo(svgOverlay, function(datum, index, groups) { }); // use on transition svgZoom.scaleTo(svgOverlayTransition, 3); -// svgZoom.scaleBy(groupsTransition, 3); // fails, as groupTransition mismachtes DOM Element type and datum type +// svgZoom.scaleBy(groupsTransition, 3); // fails, as groupTransition mismatches DOM Element type and datum type svgZoom.scaleTo(svgOverlayTransition, function(datum, index, groups) { const that: SVGRectElement = this; diff --git a/types/d3-zoom/index.d.ts b/types/d3-zoom/index.d.ts index cf9b1ac89d..5ba719d227 100644 --- a/types/d3-zoom/index.d.ts +++ b/types/d3-zoom/index.d.ts @@ -693,7 +693,7 @@ export interface ZoomBehavior ((t: number) => ZoomView)): this; @@ -921,7 +921,7 @@ export interface ZoomTransform { * * For details see {@link https://github.com/d3/d3-zoom#zoom-transforms} * - * @param node An element for which to retrieve its current zoomt transform. + * @param node An element for which to retrieve its current zoom transform. */ export function zoomTransform(node: ZoomedElementBaseType): ZoomTransform; diff --git a/types/d3/d3-tests.ts b/types/d3/d3-tests.ts index 3942256a76..706c096968 100644 --- a/types/d3/d3-tests.ts +++ b/types/d3/d3-tests.ts @@ -2,6 +2,6 @@ import * as d3 from 'd3'; const version: string = d3.version; -// NOTE: Tests for all re-exports of consituent D3 modules are omitted as excessive. +// NOTE: Tests for all re-exports of constituent D3 modules are omitted as excessive. // The standard bundle definition is a straightforward pass-through with the exception of the // above tested "version" property. From 68c1ff3dc1a81123a248a51af9385ba29842c695 Mon Sep 17 00:00:00 2001 From: snaumets Date: Mon, 14 May 2018 11:53:53 -0700 Subject: [PATCH 095/575] Fill in missing before* type definitions. Fill in beforeAddClass, beforeRemoveClass, and beforeSetClass type definitions that are missing. Reference to angular-1.5 externs: https://github.com/google/closure-compiler/blob/master/contrib/externs/angular-1.5.js#L220 Reference to ngAnimate/animateJs.js: https://github.com/angular/angular.js/blob/master/src/ngAnimate/animateJs.js#L232 --- types/angular-animate/index.d.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/types/angular-animate/index.d.ts b/types/angular-animate/index.d.ts index 6a51b368c8..f05ea66058 100644 --- a/types/angular-animate/index.d.ts +++ b/types/angular-animate/index.d.ts @@ -20,8 +20,11 @@ declare module 'angular' { interface IAnimateCallbackObject { eventFn?: (element: JQuery, doneFunction: Function, options: IAnimationOptions) => any; + beforeSetClass?: (element: JQuery, addedClasses: string, removedClasses: string, doneFunction: Function, options: IAnimationOptions) => any; setClass?: (element: JQuery, addedClasses: string, removedClasses: string, doneFunction: Function, options: IAnimationOptions) => any; + beforeAddClass?: (element: JQuery, addedClasses: string, doneFunction: Function, options: IAnimationOptions) => any; addClass?: (element: JQuery, addedClasses: string, doneFunction: Function, options: IAnimationOptions) => any; + beforeRemoveClass?: (element: JQuery, removedClasses: string, doneFunction: Function, options: IAnimationOptions) => any; removeClass?: (element: JQuery, removedClasses: string, doneFunction: Function, options: IAnimationOptions) => any; enter?: (element: JQuery, doneFunction: Function, options: IAnimationOptions) => any; leave?: (element: JQuery, doneFunction: Function, options: IAnimationOptions) => any; From 2771408ff61c0c41808de2f1b671b3d615027374 Mon Sep 17 00:00:00 2001 From: Andy Chou Date: Mon, 14 May 2018 11:56:39 -0700 Subject: [PATCH 096/575] memory-fs: Make options optional for createReadStream, createWriteStream --- types/memory-fs/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/memory-fs/index.d.ts b/types/memory-fs/index.d.ts index 9578bb3548..23b3f0aef9 100644 --- a/types/memory-fs/index.d.ts +++ b/types/memory-fs/index.d.ts @@ -43,13 +43,13 @@ declare class MemoryFileSystem { writeFileSync(_path: string, content: string | Buffer, encoding?: string): void; createReadStream( - path: string, options: { + path: string, options?: { start: number; end: number; } ): any; - createWriteStream(path: string, options: any): any; + createWriteStream(path: string, options?: any): any; exists(path: string, callback: (isExist: boolean) => any): any; From c613604da564f02652fe511147c405af67d88696 Mon Sep 17 00:00:00 2001 From: Andy Chou Date: Mon, 14 May 2018 11:58:48 -0700 Subject: [PATCH 097/575] memory-fs: create test for optional options --- types/memory-fs/test/index.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/types/memory-fs/test/index.ts b/types/memory-fs/test/index.ts index 07abb3e3fe..16d477baf2 100644 --- a/types/memory-fs/test/index.ts +++ b/types/memory-fs/test/index.ts @@ -15,3 +15,7 @@ fs.writeFile('hello', 'hahahahah', 'utf-8', function (err) { console.log(err.message); } }); + +fs.createReadStream('hello'); + +fs.createWriteStream('hello'); \ No newline at end of file From 2f1d5dc21fa486a29f141df9ca24721356c77047 Mon Sep 17 00:00:00 2001 From: Muhammad Fawwaz Orabi Date: Mon, 14 May 2018 23:00:21 +0300 Subject: [PATCH 098/575] Add types for p-memoize --- types/p-memoize/index.d.ts | 43 ++++++++++++++++++++++++++++++ types/p-memoize/p-memoize-tests.ts | 0 types/p-memoize/tsconfig.json | 22 +++++++++++++++ types/p-memoize/tslint.json | 1 + 4 files changed, 66 insertions(+) create mode 100644 types/p-memoize/index.d.ts create mode 100644 types/p-memoize/p-memoize-tests.ts create mode 100644 types/p-memoize/tsconfig.json create mode 100644 types/p-memoize/tslint.json diff --git a/types/p-memoize/index.d.ts b/types/p-memoize/index.d.ts new file mode 100644 index 0000000000..a7bb1b129d --- /dev/null +++ b/types/p-memoize/index.d.ts @@ -0,0 +1,43 @@ +// Type definitions for p-memoize 1.0 +// Project: https://github.com/sindresorhus/p-memoize#readme +// Definitions by: forabi +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +interface MemOptions { + /** + * Milliseconds until the cache expires. + * @default Infinity + */ + maxAge?: number; + + /** + * Determines the cache key for storing the result based on the + * function arguments. By default, if there's only one argument and + * it's a primitive, it's used directly as a key, otherwise it's all + * the function arguments JSON stringified as an array. + * + * You could for example change it to only cache on the first argument + * `x => JSON.stringify(x)`. + */ + cacheKey?: (...args: any[]) => string; + + /** + * Use a different cache storage. + * Must implement the following methods: + * `.has(key)`, `.get(key)`, `.set(key, value)`, `.delete(key)`, and optionally `.clear()` + * You could for example use a `WeakMap` instead or `quick-lru` for a LRU cache. + * + * @default new Map() + */ + cache?: Map | WeakMap; + + /** Cache rejected promises. */ + cachePromiseRejection?: boolean; +} + +interface PMemoize { + any>(f: T, memoizeOptions?: MemOptions): T; +} + +declare const pMemoize: PMemoize; + +export = pMemoize; diff --git a/types/p-memoize/p-memoize-tests.ts b/types/p-memoize/p-memoize-tests.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/types/p-memoize/tsconfig.json b/types/p-memoize/tsconfig.json new file mode 100644 index 0000000000..de251f82a2 --- /dev/null +++ b/types/p-memoize/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "p-memoize-tests.ts" + ] +} diff --git a/types/p-memoize/tslint.json b/types/p-memoize/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/p-memoize/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From d403c1c1d9bcdcf15c4ebfd0c85dbddb798a8c02 Mon Sep 17 00:00:00 2001 From: Atrahasis Date: Mon, 14 May 2018 22:03:58 +0200 Subject: [PATCH 099/575] Add WebGLInfo --- types/three/three-core.d.ts | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/types/three/three-core.d.ts b/types/three/three-core.d.ts index 351084f0d1..189584bbf7 100644 --- a/types/three/three-core.d.ts +++ b/types/three/three-core.d.ts @@ -5405,21 +5405,7 @@ export class WebGLRenderer implements Renderer { */ maxMorphNormals: number; - /** - * An object with a series of statistical information about the graphics board memory and the rendering process. Useful for debugging or just for the sake of curiosity. The object contains the following fields: - */ - info: { - memory: { - geometries: number; - textures: number; - }; - render: { - calls: number; - faces: number; - points: number; - }; - programs: number; - }; + info: WebGLInfo; shadowMap: WebGLShadowMap; @@ -6065,6 +6051,26 @@ export class WebGLLights { get(light: any): any; } +/** + * An object with a series of statistical information about the graphics board memory and the rendering process. + */ +export class WebGLInfo { + autoReset: boolean; + memory: { + geometries: number; + textures: number; + }; + programs: number | null; + render: { + calls: number; + lines: number; + points: number; + triangles: number; + }; + reset(): void; + update(): void; +} + export class WebGLIndexedBufferRenderer { constructor(gl: WebGLRenderingContext, properties: any, info: any); From 7640f36d26142183ef124f3edd3505303829fb63 Mon Sep 17 00:00:00 2001 From: Muhammad Fawwaz Orabi Date: Mon, 14 May 2018 23:14:07 +0300 Subject: [PATCH 100/575] Fix issues --- types/p-memoize/index.d.ts | 21 +++++++++++++++++---- types/p-memoize/p-memoize-tests.ts | 13 +++++++++++++ types/p-memoize/tsconfig.json | 16 +++++----------- 3 files changed, 35 insertions(+), 15 deletions(-) diff --git a/types/p-memoize/index.d.ts b/types/p-memoize/index.d.ts index a7bb1b129d..0b997b4b19 100644 --- a/types/p-memoize/index.d.ts +++ b/types/p-memoize/index.d.ts @@ -2,6 +2,8 @@ // Project: https://github.com/sindresorhus/p-memoize#readme // Definitions by: forabi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + interface MemOptions { /** * Milliseconds until the cache expires. @@ -28,16 +30,27 @@ interface MemOptions { * * @default new Map() */ - cache?: Map | WeakMap; + cache?: pMemoize.Cache; /** Cache rejected promises. */ cachePromiseRejection?: boolean; } -interface PMemoize { - any>(f: T, memoizeOptions?: MemOptions): T; -} +type PMemoize = any>( + f: T, + memoizeOptions?: MemOptions +) => T; declare const pMemoize: PMemoize; +declare namespace pMemoize { + interface Cache { + get(key: K): V; + set(key: K, value: V): void; + has(key: K): boolean; + delete(key: K): void; + clear?(): void; + } +} + export = pMemoize; diff --git a/types/p-memoize/p-memoize-tests.ts b/types/p-memoize/p-memoize-tests.ts index e69de29bb2..8626482dab 100644 --- a/types/p-memoize/p-memoize-tests.ts +++ b/types/p-memoize/p-memoize-tests.ts @@ -0,0 +1,13 @@ +import pMemoize = require('p-memoize'); +import { Cache } from 'p-memoize'; + +const a = pMemoize(async () => Promise.resolve('Hello world!')); + +const b = pMemoize(async () => Promise.resolve(1), { + maxAge: 1000, + cache: new Map() +}); + +a(); + +b(); diff --git a/types/p-memoize/tsconfig.json b/types/p-memoize/tsconfig.json index de251f82a2..0605de1be9 100644 --- a/types/p-memoize/tsconfig.json +++ b/types/p-memoize/tsconfig.json @@ -1,22 +1,16 @@ { "compilerOptions": { "module": "commonjs", - "lib": [ - "es6" - ], + "lib": ["es6"], "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, "baseUrl": "../", - "typeRoots": [ - "../" - ], + "typeRoots": ["../"], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": true + "forceConsistentCasingInFileNames": true, + "strictFunctionTypes": true }, - "files": [ - "index.d.ts", - "p-memoize-tests.ts" - ] + "files": ["index.d.ts", "p-memoize-tests.ts"] } From beb66996a4d85cf146e835d2afce19bc28518488 Mon Sep 17 00:00:00 2001 From: Jason Unger Date: Mon, 14 May 2018 17:41:17 -0400 Subject: [PATCH 101/575] Create definitions for react-radio-group --- types/react-radio-group/index.d.ts | 22 ++++++++++++++++ .../react-radio-group-tests.tsx | 24 ++++++++++++++++++ types/react-radio-group/tsconfig.json | 25 +++++++++++++++++++ types/react-radio-group/tslint.json | 1 + 4 files changed, 72 insertions(+) create mode 100644 types/react-radio-group/index.d.ts create mode 100644 types/react-radio-group/react-radio-group-tests.tsx create mode 100644 types/react-radio-group/tsconfig.json create mode 100644 types/react-radio-group/tslint.json diff --git a/types/react-radio-group/index.d.ts b/types/react-radio-group/index.d.ts new file mode 100644 index 0000000000..9628561b61 --- /dev/null +++ b/types/react-radio-group/index.d.ts @@ -0,0 +1,22 @@ +// Type definitions for react-radio-group 3.0 +// Project: https://github.com/chenglou/react-radio-group +// Definitions by: Jason Unger +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import * as React from 'react'; + +export type Value = React.InputHTMLAttributes['value']; + +export type RadioProps = React.InputHTMLAttributes; + +export const Radio: React.ComponentClass; + +export interface RadioGroupProps { + name?: string; + selectedValue?: Value; + onChange?: (value: Value) => void; + Component?: string | React.ReactElement>; +} + +export const RadioGroup: React.ComponentClass; diff --git a/types/react-radio-group/react-radio-group-tests.tsx b/types/react-radio-group/react-radio-group-tests.tsx new file mode 100644 index 0000000000..65cd53fab3 --- /dev/null +++ b/types/react-radio-group/react-radio-group-tests.tsx @@ -0,0 +1,24 @@ +import * as React from 'react'; +import { Radio, RadioGroup, RadioGroupProps, Value } from "react-radio-group"; + +class ReactRadioGroup extends React.Component { + constructor(props: RadioGroupProps) { + super(props); + } + + handleChange(value: Value) { + console.log(value); + } + + render() { + return ( +
+ + + + + +
+ ); + } +} diff --git a/types/react-radio-group/tsconfig.json b/types/react-radio-group/tsconfig.json new file mode 100644 index 0000000000..615f55eee3 --- /dev/null +++ b/types/react-radio-group/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react" + }, + "files": [ + "index.d.ts", + "react-radio-group-tests.tsx" + ] +} diff --git a/types/react-radio-group/tslint.json b/types/react-radio-group/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-radio-group/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From bcdd5baf8bcecc5e2775fd638e423faf876eaaf5 Mon Sep 17 00:00:00 2001 From: Jason Unger Date: Mon, 14 May 2018 18:04:34 -0400 Subject: [PATCH 102/575] Use namespaces --- types/react-radio-group/index.d.ts | 24 ++++++++++--------- .../react-radio-group-tests.tsx | 10 +++----- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/types/react-radio-group/index.d.ts b/types/react-radio-group/index.d.ts index 9628561b61..3dfa872527 100644 --- a/types/react-radio-group/index.d.ts +++ b/types/react-radio-group/index.d.ts @@ -6,17 +6,19 @@ import * as React from 'react'; -export type Value = React.InputHTMLAttributes['value']; +type Value = React.InputHTMLAttributes['value']; -export type RadioProps = React.InputHTMLAttributes; - -export const Radio: React.ComponentClass; - -export interface RadioGroupProps { - name?: string; - selectedValue?: Value; - onChange?: (value: Value) => void; - Component?: string | React.ReactElement>; +export namespace Radio { + export type RadioProps = React.InputHTMLAttributes; } +export const Radio: React.ComponentClass; -export const RadioGroup: React.ComponentClass; +export namespace RadioGroup { + export interface RadioGroupProps { + name?: string; + selectedValue?: Value; + onChange?: (value: Value) => void; + Component?: string | React.ReactElement>; + } +} +export const RadioGroup: React.ComponentClass; diff --git a/types/react-radio-group/react-radio-group-tests.tsx b/types/react-radio-group/react-radio-group-tests.tsx index 65cd53fab3..76e093059b 100644 --- a/types/react-radio-group/react-radio-group-tests.tsx +++ b/types/react-radio-group/react-radio-group-tests.tsx @@ -1,12 +1,8 @@ import * as React from 'react'; -import { Radio, RadioGroup, RadioGroupProps, Value } from "react-radio-group"; +import { Radio, RadioGroup } from "react-radio-group"; -class ReactRadioGroup extends React.Component { - constructor(props: RadioGroupProps) { - super(props); - } - - handleChange(value: Value) { +class ReactRadioGroup extends React.Component { + handleChange: RadioGroup.RadioGroupProps['onChange'] = value => { console.log(value); } From 8b7bccf8a1145f2628e6fb4f0d8db1f0478868e4 Mon Sep 17 00:00:00 2001 From: Vincent Langlet Date: Tue, 15 May 2018 00:00:05 +0200 Subject: [PATCH 103/575] Add tests --- types/react-native/test/globals.tsx | 3 +++ types/react-native/tsconfig.json | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 types/react-native/test/globals.tsx diff --git a/types/react-native/test/globals.tsx b/types/react-native/test/globals.tsx new file mode 100644 index 0000000000..a6488cef82 --- /dev/null +++ b/types/react-native/test/globals.tsx @@ -0,0 +1,3 @@ +const fetchCopy: GlobalFetch['fetch'] = fetch; + +const requestInfoAsString: RequestInfo = 'request'; diff --git a/types/react-native/tsconfig.json b/types/react-native/tsconfig.json index 16c6bf9275..c577fb0d8b 100644 --- a/types/react-native/tsconfig.json +++ b/types/react-native/tsconfig.json @@ -20,9 +20,10 @@ "files": [ "index.d.ts", "test/index.tsx", + "test/globals.tsx", "test/animated.tsx", "test/init-example.tsx", "test/ART.tsx", "test/legacy-properties.tsx" ] -} \ No newline at end of file +} From 7a2fa0a98e77583e9dde205a0c8c07f68e3f79ba Mon Sep 17 00:00:00 2001 From: Carson Howard Date: Mon, 14 May 2018 15:11:22 -0700 Subject: [PATCH 104/575] Update Rebass to have a provider and fix Tooltip --- types/rebass/index.d.ts | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/types/rebass/index.d.ts b/types/rebass/index.d.ts index f50691e116..1f02aa2a92 100644 --- a/types/rebass/index.d.ts +++ b/types/rebass/index.d.ts @@ -505,7 +505,38 @@ type ToolbarClass = React.StatelessComponent export declare const Toolbar: ToolbarClass; export interface TooltipProps extends BaseProps { - title?: string; + text?: string; } type TooltipClass = React.StatelessComponent export declare const Tooltip: TooltipClass; + +export interface FontWeights { + normal?: number; + bold?: number; +} + +export interface Fonts { + [0]?: string; + sans?: string; + mono?: string; +} + +export interface Colors {} + +export interface Theme { + breakpoints?: string[]; + space?: number[]; + fontSizes?: number[]; + fontWeights?: FontWeights; + fonts?: Fonts; + shadows?: string[]; + radii?: number[]; + colors?: Colors; +} + +export interface ProviderProps { + theme: Theme; +} + +type ProviderClass = React.StatelessComponent; +export const Provider: ProviderClass; \ No newline at end of file From 1990eb58c073aea51545c7209b2826f6e5397327 Mon Sep 17 00:00:00 2001 From: Carson Howard Date: Mon, 14 May 2018 15:16:07 -0700 Subject: [PATCH 105/575] Update Rebass to use fontSize on BaseProps --- types/rebass/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/rebass/index.d.ts b/types/rebass/index.d.ts index 1f02aa2a92..0cd6c151df 100644 --- a/types/rebass/index.d.ts +++ b/types/rebass/index.d.ts @@ -11,6 +11,7 @@ import * as React from "react"; export interface BaseProps extends React.Props { tagName?: string; className?: string; + fontSize?: number | number[]; baseStyle?: Object; style?: Object; m?: number; From 7ebd1ec80e3ad0e92ff2a6b8b73909645c646157 Mon Sep 17 00:00:00 2001 From: Luis Stanley Jovel Date: Mon, 14 May 2018 16:17:53 -0600 Subject: [PATCH 106/575] Add missing property boolean `selfHandleResponse` Add missing boolean property `selfHandleResponse` to ServerOptions interface --- types/http-proxy/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/http-proxy/index.d.ts b/types/http-proxy/index.d.ts index fb7eb26abc..2560b0a38d 100644 --- a/types/http-proxy/index.d.ts +++ b/types/http-proxy/index.d.ts @@ -207,6 +207,8 @@ declare namespace Server { headers?: {[header: string]: string}; /** Timeout (in milliseconds) when proxy receives no response from target. Default: 120000 (2 minutes) */ proxyTimeout?: number; + /** If set to true, none of the webOutgoing passes are called and it's your responsibility to appropriately return the response by listening and acting on the proxyRes event */ + selfHandleResponse?: boolean; } } From 9ad6d029145bd16d582e017a5a5a70d9c90b4c42 Mon Sep 17 00:00:00 2001 From: Steve Hetzel Date: Mon, 14 May 2018 16:18:09 -0600 Subject: [PATCH 107/575] Adds 'success' and 'errors' properties to BatchResultInfo. Changes 'concurrencyMode' property to be optional since 'Parallel' is the default. Adds 'body' property to RequestInfo. Adds the ExecuteAnonymousResult interface. Changes Job.prototype.list() to return a BatchInfo[]. Adds tests. --- types/jsforce/batch.d.ts | 6 ++++-- types/jsforce/bulk.d.ts | 2 +- types/jsforce/connection.d.ts | 15 +++++++++++++-- types/jsforce/job.d.ts | 2 +- types/jsforce/jsforce-tests.ts | 27 ++++++++++++++++++++++++++- 5 files changed, 45 insertions(+), 7 deletions(-) diff --git a/types/jsforce/batch.d.ts b/types/jsforce/batch.d.ts index 94a24fa2cd..3314dcd33d 100644 --- a/types/jsforce/batch.d.ts +++ b/types/jsforce/batch.d.ts @@ -12,8 +12,10 @@ export interface BatchInfo { export interface BatchResultInfo { id: string; - batchId: string; - jobId: string; + batchId?: string; + jobId?: string; + success?: boolean; + errors?: string[]; } export class Batch extends Writable { diff --git a/types/jsforce/bulk.d.ts b/types/jsforce/bulk.d.ts index 51708f59f1..0356f1b9c6 100644 --- a/types/jsforce/bulk.d.ts +++ b/types/jsforce/bulk.d.ts @@ -8,7 +8,7 @@ import { Batch, BatchResultInfo } from './batch'; export interface BulkOptions { extIdField: string; - concurrencyMode: 'Serial' | 'Parallel'; + concurrencyMode?: 'Serial' | 'Parallel'; } type BulkLoadOperation = diff --git a/types/jsforce/connection.d.ts b/types/jsforce/connection.d.ts index 2283320912..27d79fdd5b 100644 --- a/types/jsforce/connection.d.ts +++ b/types/jsforce/connection.d.ts @@ -22,9 +22,10 @@ export interface PartialOAuth2Options { } export interface RequestInfo { + body?: string; + headers?: object; method?: string; url?: string; - headers?: object; } export interface ConnectionOptions extends PartialOAuth2Options { @@ -58,6 +59,16 @@ export abstract class RestApi { del(path: string, options: object, callback: () => object): Promise; } +export interface ExecuteAnonymousResult { + compiled: boolean; + compileProblem: string; + success: boolean; + line: number; + column: number; + exceptionMessage: string; + exceptionStackTrace: string; +} + export type ConnectionEvent = "refresh"; /** @@ -135,5 +146,5 @@ export class Tooling extends BaseConnection { _logger: any; // Specific to tooling - executeAnonymous(body: string, callback?: (err: Error, res: any) => void): Promise; + executeAnonymous(body: string, callback?: (err: Error, res: any) => void): Promise; } diff --git a/types/jsforce/job.d.ts b/types/jsforce/job.d.ts index bdad4bf564..519b8b6c10 100644 --- a/types/jsforce/job.d.ts +++ b/types/jsforce/job.d.ts @@ -19,6 +19,6 @@ export class Job extends EventEmitter { close(callback?: (err: Error, jobInfo: JobInfo) => void): Promise; createBatch(): Batch; info(callback?: (err: Error, jobInfo: JobInfo) => void): Promise; - list(callback?: (err: Error, jobInfo: BatchInfo) => void): Promise; + list(callback?: (err: Error, jobInfo: BatchInfo) => void): Promise; open(callback?: (err: Error, jobInfo: JobInfo) => void): Promise; } diff --git a/types/jsforce/jsforce-tests.ts b/types/jsforce/jsforce-tests.ts index 156b0d292b..0aa98d62d1 100644 --- a/types/jsforce/jsforce-tests.ts +++ b/types/jsforce/jsforce-tests.ts @@ -22,6 +22,14 @@ const salesforceConnection: sf.Connection = new sf.Connection({ salesforceConnection.sobject("Dummy").select(["thing", "other"]); +const requestInfo: sf.RequestInfo = { + body: '', + headers: {}, + method: '', + url: '' +}; +salesforceConnection.request(requestInfo); + // note the following should never compile: // salesforceConnection.sobject("Dummy").select(["lol"]); @@ -123,6 +131,17 @@ async function testAnalytics(conn: sf.Connection): Promise { }); } +async function testExecuteAnonymous(conn: sf.Connection): Promise { + const res: sf.ExecuteAnonymousResult = await salesforceConnection.tooling.executeAnonymous(''); + console.log('ExecuteAnonymousResult column: ' + res.column); + console.log('ExecuteAnonymousResult compiled: ' + res.compiled); + console.log('ExecuteAnonymousResult compileProblem: ' + res.compileProblem); + console.log('ExecuteAnonymousResult exceptionMessage: ' + res.exceptionMessage); + console.log('ExecuteAnonymousResult exceptionStackTrace: ' + res.exceptionStackTrace); + console.log('ExecuteAnonymousResult line: ' + res.line); + console.log('ExecuteAnonymousResult success: ' + res.success); +} + async function testMetadata(conn: sf.Connection): Promise { const md: sf.Metadata = conn.metadata; const m: sf.DescribeMetadataResult = await md.describe('34.0'); @@ -281,6 +300,7 @@ async function testChatter(conn: sf.Connection): Promise { await testAnalytics(salesforceConnection); await testChatter(salesforceConnection); await testMetadata(salesforceConnection); + await testExecuteAnonymous(salesforceConnection); })(); const oauth2 = new sf.OAuth2({ @@ -302,7 +322,7 @@ batch.on("queue", (batchInfo) => { // fired when batch request is queued in serv }); job.batch("batchId"); batch.poll(1000, 20000); -batch.on("response", (rets) => { +batch.on("response", (rets: sf.BatchResultInfo[]) => { for (let i = 0; i < rets.length; i++) { if (rets[i].success) { console.log(`# ${(i + 1)} loaded successfully, id = ${rets[i].id}`); @@ -312,6 +332,11 @@ batch.on("response", (rets) => { } }); +(async () => { + const batchInfos: sf.BatchInfo[] = await job.list(); + console.log('batchInfos:', batchInfos); +}); + salesforceConnection.streaming.topic("InvoiceStatementUpdates").subscribe((message) => { console.log('Event Type : ' + message.event.type); console.log('Event Created : ' + message.event.createdDate); From e79a26e4b5324b44a621ec15803732b24ed100f2 Mon Sep 17 00:00:00 2001 From: Carson Howard Date: Mon, 14 May 2018 15:33:45 -0700 Subject: [PATCH 108/575] Update tests and fix minor prop issue --- types/rebass/index.d.ts | 3 ++- types/rebass/rebass-tests.tsx | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/types/rebass/index.d.ts b/types/rebass/index.d.ts index 0cd6c151df..b69c6f7839 100644 --- a/types/rebass/index.d.ts +++ b/types/rebass/index.d.ts @@ -507,6 +507,7 @@ export declare const Toolbar: ToolbarClass; export interface TooltipProps extends BaseProps { text?: string; + title?: string; } type TooltipClass = React.StatelessComponent export declare const Tooltip: TooltipClass; @@ -536,7 +537,7 @@ export interface Theme { } export interface ProviderProps { - theme: Theme; + theme?: Theme; } type ProviderClass = React.StatelessComponent; diff --git a/types/rebass/rebass-tests.tsx b/types/rebass/rebass-tests.tsx index 430e277541..814c11a523 100644 --- a/types/rebass/rebass-tests.tsx +++ b/types/rebass/rebass-tests.tsx @@ -42,6 +42,7 @@ import { , PanelHeader , Pre , Progress + , Provider , Radio , Rating , Section @@ -156,6 +157,12 @@ class RebassTest extends React.Component { Generic box for containing things + + This is a large font + + + A set of fonts! + @@ -618,6 +625,9 @@ class RebassTest extends React.Component { Tooltip + + + ; } } From 91b98bfe0fc41aebcbef88cfb57a70684e1a6212 Mon Sep 17 00:00:00 2001 From: Carson Howard Date: Mon, 14 May 2018 15:37:09 -0700 Subject: [PATCH 109/575] Remove untyped color on theme --- types/rebass/index.d.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/types/rebass/index.d.ts b/types/rebass/index.d.ts index b69c6f7839..e91be9e3a0 100644 --- a/types/rebass/index.d.ts +++ b/types/rebass/index.d.ts @@ -523,8 +523,6 @@ export interface Fonts { mono?: string; } -export interface Colors {} - export interface Theme { breakpoints?: string[]; space?: number[]; @@ -533,7 +531,6 @@ export interface Theme { fonts?: Fonts; shadows?: string[]; radii?: number[]; - colors?: Colors; } export interface ProviderProps { From 927c2f961145a183dfb48e578b462ed5002f86be Mon Sep 17 00:00:00 2001 From: Carson Howard Date: Mon, 14 May 2018 15:49:07 -0700 Subject: [PATCH 110/575] Bump version --- types/rebass/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/rebass/index.d.ts b/types/rebass/index.d.ts index e91be9e3a0..0c55b12240 100644 --- a/types/rebass/index.d.ts +++ b/types/rebass/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Rebass 0.2.5 +// Type definitions for Rebass 0.2.6 // Project: https://github.com/jxnblk/rebass // Definitions by: rhysd // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From a351eaac271acd7f4f797d462a4555f4e780c28b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Machist=C3=A9=20Quintana?= Date: Mon, 14 May 2018 17:49:54 -0700 Subject: [PATCH 111/575] Add support for chunks filter function in SplitChunksPlugin --- types/webpack/index.d.ts | 4 ++-- types/webpack/webpack-tests.ts | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/types/webpack/index.d.ts b/types/webpack/index.d.ts index 5be4abdcbd..4dcd7ce89e 100644 --- a/types/webpack/index.d.ts +++ b/types/webpack/index.d.ts @@ -560,7 +560,7 @@ declare namespace webpack { /** Assign modules to a cache group */ test?: ((...args: any[]) => boolean) | string | RegExp; /** Select chunks for determining cache group content (defaults to \"initial\", \"initial\" and \"all\" requires adding these chunks to the HTML) */ - chunks?: "initial" | "async" | "all"; + chunks?: "initial" | "async" | "all" | ((chunk: any, index?: number, chunks?: any[]) => boolean); /** Ignore minimum size, minimum chunks and maximum requests and always create chunks for this cache group */ enforce?: boolean; /** Priority of this cache group */ @@ -580,7 +580,7 @@ declare namespace webpack { } interface SplitChunksOptions { /** Select chunks for determining shared modules (defaults to \"async\", \"initial\" and \"all\" requires adding these chunks to the HTML) */ - chunks?: "initial" | "async" | "all"; + chunks?: "initial" | "async" | "all" | ((chunk: any, index?: number, chunks?: any[]) => boolean); /** Minimal size for the created chunk */ minSize?: number; /** Minimum number of times a module has to be duplicated until it's considered for splitting */ diff --git a/types/webpack/webpack-tests.ts b/types/webpack/webpack-tests.ts index b42d836c0c..d617c45a17 100644 --- a/types/webpack/webpack-tests.ts +++ b/types/webpack/webpack-tests.ts @@ -607,6 +607,27 @@ configuration = { }, }; +configuration = { + mode: "production", + optimization: { + splitChunks: { + cacheGroups: { + common: { + name: 'common', + chunks(chunk: { name: string }) { + const allowedChunks = [ + 'renderer', + 'component-window', + ]; + return allowedChunks.indexOf(chunk.name) >= 0; + }, + minChunks: 2 + } + } + } + }, +}; + plugin = new webpack.SplitChunksPlugin({ chunks: "async", minChunks: 2 }); class SingleEntryDependency extends webpack.compilation.Dependency {} From 815129e0bb65899edc696a619554700dbbcc990e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Machist=C3=A9=20Quintana?= Date: Mon, 14 May 2018 18:03:37 -0700 Subject: [PATCH 112/575] Use a less strict function type for chunks --- types/webpack/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/webpack/index.d.ts b/types/webpack/index.d.ts index 4dcd7ce89e..fb8469dfa5 100644 --- a/types/webpack/index.d.ts +++ b/types/webpack/index.d.ts @@ -560,7 +560,7 @@ declare namespace webpack { /** Assign modules to a cache group */ test?: ((...args: any[]) => boolean) | string | RegExp; /** Select chunks for determining cache group content (defaults to \"initial\", \"initial\" and \"all\" requires adding these chunks to the HTML) */ - chunks?: "initial" | "async" | "all" | ((chunk: any, index?: number, chunks?: any[]) => boolean); + chunks?: "initial" | "async" | "all" | ((chunk: any) => boolean); /** Ignore minimum size, minimum chunks and maximum requests and always create chunks for this cache group */ enforce?: boolean; /** Priority of this cache group */ @@ -580,7 +580,7 @@ declare namespace webpack { } interface SplitChunksOptions { /** Select chunks for determining shared modules (defaults to \"async\", \"initial\" and \"all\" requires adding these chunks to the HTML) */ - chunks?: "initial" | "async" | "all" | ((chunk: any, index?: number, chunks?: any[]) => boolean); + chunks?: "initial" | "async" | "all" | ((chunk: any) => boolean); /** Minimal size for the created chunk */ minSize?: number; /** Minimum number of times a module has to be duplicated until it's considered for splitting */ From 93f601347bd21596702c3f03a2a00ad78fa3d068 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Mon, 14 May 2018 18:35:26 -0700 Subject: [PATCH 113/575] Move 'fs/promises' to fs.promises --- types/node/index.d.ts | 871 +++++++++++++++++++++--------------------- 1 file changed, 435 insertions(+), 436 deletions(-) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 4e03c3f78b..360030d9f2 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Node.js 10.0.x +// Type definitions for Node.js 10.1.x // Project: http://nodejs.org/ // Definitions by: Microsoft TypeScript // DefinitelyTyped @@ -4663,125 +4663,431 @@ declare module "fs" { * @param flags An optional integer that specifies the behavior of the copy operation. The only supported flag is fs.constants.COPYFILE_EXCL, which causes the copy operation to fail if dest already exists. */ export function copyFileSync(src: PathLike, dest: PathLike, flags?: number): void; -} -declare module "fs/promises" { - import { PathLike, Stats } from "fs"; - interface FileHandle { + export namespace promises { + interface FileHandle { + /** + * Gets the file descriptor for this file handle. + */ + readonly fd: number; + + /** + * Asynchronously append data to a file, creating the file if it does not exist. The underlying file will _not_ be closed automatically. + * The `FileHandle` must have been opened for appending. + * @param data The data to write. If something other than a `Buffer` or `Uint8Array` is provided, the value is coerced to a string. + * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag. + * If `encoding` is not supplied, the default of `'utf8'` is used. + * If `mode` is not supplied, the default of `0o666` is used. + * If `mode` is a string, it is parsed as an octal integer. + * If `flag` is not supplied, the default of `'a'` is used. + */ + appendFile(data: any, options?: { encoding?: string | null, mode?: string | number, flag?: string | number } | string | null): Promise; + + /** + * Asynchronous fchown(2) - Change ownership of a file. + */ + chown(uid: number, gid: number): Promise; + + /** + * Asynchronous fchmod(2) - Change permissions of a file. + * @param mode A file mode. If a string is passed, it is parsed as an octal integer. + */ + chmod(mode: string | number): Promise; + + /** + * Asynchronous fdatasync(2) - synchronize a file's in-core state with storage device. + */ + datasync(): Promise; + + /** + * Asynchronous fsync(2) - synchronize a file's in-core state with the underlying storage device. + */ + sync(): Promise; + + /** + * Asynchronously reads data from the file. + * The `FileHandle` must have been opened for reading. + * @param buffer The buffer that the data will be written to. + * @param offset The offset in the buffer at which to start writing. + * @param length The number of bytes to read. + * @param position The offset from the beginning of the file from which data should be read. If `null`, data will be read from the current position. + */ + read(buffer: TBuffer, offset?: number | null, length?: number | null, position?: number | null): Promise<{ bytesRead: number, buffer: TBuffer }>; + + /** + * Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically. + * The `FileHandle` must have been opened for reading. + * @param options An object that may contain an optional flag. + * If a flag is not provided, it defaults to `'r'`. + */ + readFile(options?: { encoding?: null, flag?: string | number } | null): Promise; + + /** + * Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically. + * The `FileHandle` must have been opened for reading. + * @param options An object that may contain an optional flag. + * If a flag is not provided, it defaults to `'r'`. + */ + readFile(options: { encoding: BufferEncoding, flag?: string | number } | BufferEncoding): Promise; + + /** + * Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically. + * The `FileHandle` must have been opened for reading. + * @param options An object that may contain an optional flag. + * If a flag is not provided, it defaults to `'r'`. + */ + readFile(options?: { encoding?: string | null, flag?: string | number } | string | null): Promise; + + /** + * Asynchronous fstat(2) - Get file status. + */ + stat(): Promise; + + /** + * Asynchronous ftruncate(2) - Truncate a file to a specified length. + * @param len If not specified, defaults to `0`. + */ + truncate(len?: number): Promise; + + /** + * Asynchronously change file timestamps of the file. + * @param atime The last access time. If a string is provided, it will be coerced to number. + * @param mtime The last modified time. If a string is provided, it will be coerced to number. + */ + utimes(atime: string | number | Date, mtime: string | number | Date): Promise; + + /** + * Asynchronously writes `buffer` to the file. + * The `FileHandle` must have been opened for writing. + * @param buffer The buffer that the data will be written to. + * @param offset The part of the buffer to be written. If not supplied, defaults to `0`. + * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`. + * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. + */ + write(buffer: TBuffer, offset?: number | null, length?: number | null, position?: number | null): Promise<{ bytesWritten: number, buffer: TBuffer }>; + + /** + * Asynchronously writes `string` to the file. + * The `FileHandle` must have been opened for writing. + * It is unsafe to call `write()` multiple times on the same file without waiting for the `Promise` to be resolved (or rejected). For this scenario, `fs.createWriteStream` is strongly recommended. + * @param string A string to write. If something other than a string is supplied it will be coerced to a string. + * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. + * @param encoding The expected string encoding. + */ + write(data: any, position?: number | null, encoding?: string | null): Promise<{ bytesWritten: number, buffer: string }>; + + /** + * Asynchronously writes data to a file, replacing the file if it already exists. The underlying file will _not_ be closed automatically. + * The `FileHandle` must have been opened for writing. + * It is unsafe to call `writeFile()` multiple times on the same file without waiting for the `Promise` to be resolved (or rejected). + * @param data The data to write. If something other than a `Buffer` or `Uint8Array` is provided, the value is coerced to a string. + * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag. + * If `encoding` is not supplied, the default of `'utf8'` is used. + * If `mode` is not supplied, the default of `0o666` is used. + * If `mode` is a string, it is parsed as an octal integer. + * If `flag` is not supplied, the default of `'w'` is used. + */ + writeFile(data: any, options?: { encoding?: string | null, mode?: string | number, flag?: string | number } | string | null): Promise; + + /** + * Asynchronous close(2) - close a `FileHandle`. + */ + close(): Promise; + } + /** - * Gets the file descriptor for this file handle. + * Asynchronously tests a user's permissions for the file specified by path. + * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol. + * URL support is _experimental_. */ - readonly fd: number; + function access(path: PathLike, mode?: number): Promise; /** - * Asynchronously append data to a file, creating the file if it does not exist. The underlying file will _not_ be closed automatically. - * The `FileHandle` must have been opened for appending. - * @param data The data to write. If something other than a `Buffer` or `Uint8Array` is provided, the value is coerced to a string. - * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag. - * If `encoding` is not supplied, the default of `'utf8'` is used. - * If `mode` is not supplied, the default of `0o666` is used. - * If `mode` is a string, it is parsed as an octal integer. - * If `flag` is not supplied, the default of `'a'` is used. + * Asynchronously copies `src` to `dest`. By default, `dest` is overwritten if it already exists. + * Node.js makes no guarantees about the atomicity of the copy operation. + * If an error occurs after the destination file has been opened for writing, Node.js will attempt + * to remove the destination. + * @param src A path to the source file. + * @param dest A path to the destination file. + * @param flags An optional integer that specifies the behavior of the copy operation. The only + * supported flag is `fs.constants.COPYFILE_EXCL`, which causes the copy operation to fail if + * `dest` already exists. */ - appendFile(data: any, options?: { encoding?: string | null, mode?: string | number, flag?: string | number } | string | null): Promise; + function copyFile(src: PathLike, dest: PathLike, flags?: number): Promise; /** - * Asynchronous fchown(2) - Change ownership of a file. + * Asynchronous open(2) - open and possibly create a file. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param mode A file mode. If a string is passed, it is parsed as an octal integer. If not + * supplied, defaults to `0o666`. */ - chown(uid: number, gid: number): Promise; + function open(path: PathLike, flags: string | number, mode?: string | number): Promise; /** - * Asynchronous fchmod(2) - Change permissions of a file. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. - */ - chmod(mode: string | number): Promise; - - /** - * Asynchronous fdatasync(2) - synchronize a file's in-core state with storage device. - */ - datasync(): Promise; - - /** - * Asynchronous fsync(2) - synchronize a file's in-core state with the underlying storage device. - */ - sync(): Promise; - - /** - * Asynchronously reads data from the file. - * The `FileHandle` must have been opened for reading. + * Asynchronously reads data from the file referenced by the supplied `FileHandle`. + * @param handle A `FileHandle`. * @param buffer The buffer that the data will be written to. * @param offset The offset in the buffer at which to start writing. * @param length The number of bytes to read. - * @param position The offset from the beginning of the file from which data should be read. If `null`, data will be read from the current position. + * @param position The offset from the beginning of the file from which data should be read. If + * `null`, data will be read from the current position. */ - read(buffer: TBuffer, offset?: number | null, length?: number | null, position?: number | null): Promise<{ bytesRead: number, buffer: TBuffer }>; + function read(handle: FileHandle, buffer: TBuffer, offset?: number | null, length?: number | null, position?: number | null): Promise<{ bytesRead: number, buffer: TBuffer }>; /** - * Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically. - * The `FileHandle` must have been opened for reading. - * @param options An object that may contain an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - readFile(options?: { encoding?: null, flag?: string | number } | null): Promise; - - /** - * Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically. - * The `FileHandle` must have been opened for reading. - * @param options An object that may contain an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - readFile(options: { encoding: BufferEncoding, flag?: string | number } | BufferEncoding): Promise; - - /** - * Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically. - * The `FileHandle` must have been opened for reading. - * @param options An object that may contain an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - readFile(options?: { encoding?: string | null, flag?: string | number } | string | null): Promise; - - /** - * Asynchronous fstat(2) - Get file status. - */ - stat(): Promise; - - /** - * Asynchronous ftruncate(2) - Truncate a file to a specified length. - * @param len If not specified, defaults to `0`. - */ - truncate(len?: number): Promise; - - /** - * Asynchronously change file timestamps of the file. - * @param atime The last access time. If a string is provided, it will be coerced to number. - * @param mtime The last modified time. If a string is provided, it will be coerced to number. - */ - utimes(atime: string | number | Date, mtime: string | number | Date): Promise; - - /** - * Asynchronously writes `buffer` to the file. - * The `FileHandle` must have been opened for writing. + * Asynchronously writes `buffer` to the file referenced by the supplied `FileHandle`. + * It is unsafe to call `fsPromises.write()` multiple times on the same file without waiting for the `Promise` to be resolved (or rejected). For this scenario, `fs.createWriteStream` is strongly recommended. + * @param handle A `FileHandle`. * @param buffer The buffer that the data will be written to. * @param offset The part of the buffer to be written. If not supplied, defaults to `0`. * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`. * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. */ - write(buffer: TBuffer, offset?: number | null, length?: number | null, position?: number | null): Promise<{ bytesWritten: number, buffer: TBuffer }>; + function write(handle: FileHandle, buffer: TBuffer, offset?: number | null, length?: number | null, position?: number | null): Promise<{ bytesWritten: number, buffer: TBuffer }>; /** - * Asynchronously writes `string` to the file. - * The `FileHandle` must have been opened for writing. - * It is unsafe to call `write()` multiple times on the same file without waiting for the `Promise` to be resolved (or rejected). For this scenario, `fs.createWriteStream` is strongly recommended. + * Asynchronously writes `string` to the file referenced by the supplied `FileHandle`. + * It is unsafe to call `fsPromises.write()` multiple times on the same file without waiting for the `Promise` to be resolved (or rejected). For this scenario, `fs.createWriteStream` is strongly recommended. + * @param handle A `FileHandle`. * @param string A string to write. If something other than a string is supplied it will be coerced to a string. * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. * @param encoding The expected string encoding. */ - write(data: any, position?: number | null, encoding?: string | null): Promise<{ bytesWritten: number, buffer: string }>; + function write(handle: FileHandle, string: any, position?: number | null, encoding?: string | null): Promise<{ bytesWritten: number, buffer: string }>; /** - * Asynchronously writes data to a file, replacing the file if it already exists. The underlying file will _not_ be closed automatically. - * The `FileHandle` must have been opened for writing. - * It is unsafe to call `writeFile()` multiple times on the same file without waiting for the `Promise` to be resolved (or rejected). + * Asynchronous rename(2) - Change the name or location of a file or directory. + * @param oldPath A path to a file. If a URL is provided, it must use the `file:` protocol. + * URL support is _experimental_. + * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol. + * URL support is _experimental_. + */ + function rename(oldPath: PathLike, newPath: PathLike): Promise; + + /** + * Asynchronous truncate(2) - Truncate a file to a specified length. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param len If not specified, defaults to `0`. + */ + function truncate(path: PathLike, len?: number): Promise; + + /** + * Asynchronous ftruncate(2) - Truncate a file to a specified length. + * @param handle A `FileHandle`. + * @param len If not specified, defaults to `0`. + */ + function ftruncate(handle: FileHandle, len?: number): Promise; + + /** + * Asynchronous rmdir(2) - delete a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + */ + function rmdir(path: PathLike): Promise; + + /** + * Asynchronous fdatasync(2) - synchronize a file's in-core state with storage device. + * @param handle A `FileHandle`. + */ + function fdatasync(handle: FileHandle): Promise; + + /** + * Asynchronous fsync(2) - synchronize a file's in-core state with the underlying storage device. + * @param handle A `FileHandle`. + */ + function fsync(handle: FileHandle): Promise; + + /** + * Asynchronous mkdir(2) - create a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param mode A file mode. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. + */ + function mkdir(path: PathLike, mode?: string | number): Promise; + + /** + * Asynchronous readdir(3) - read a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function readdir(path: PathLike, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): Promise; + + /** + * Asynchronous readdir(3) - read a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function readdir(path: PathLike, options: { encoding: "buffer" } | "buffer"): Promise; + + /** + * Asynchronous readdir(3) - read a directory. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function readdir(path: PathLike, options?: { encoding?: string | null } | string | null): Promise; + + /** + * Asynchronous readlink(2) - read value of a symbolic link. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function readlink(path: PathLike, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): Promise; + + /** + * Asynchronous readlink(2) - read value of a symbolic link. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function readlink(path: PathLike, options: { encoding: "buffer" } | "buffer"): Promise; + + /** + * Asynchronous readlink(2) - read value of a symbolic link. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function readlink(path: PathLike, options?: { encoding?: string | null } | string | null): Promise; + + /** + * Asynchronous symlink(2) - Create a new symbolic link to an existing file. + * @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol. + * @param path A path to the new symlink. If a URL is provided, it must use the `file:` protocol. + * @param type May be set to `'dir'`, `'file'`, or `'junction'` (default is `'file'`) and is only available on Windows (ignored on other platforms). + * When using `'junction'`, the `target` argument will automatically be normalized to an absolute path. + */ + function symlink(target: PathLike, path: PathLike, type?: string | null): Promise; + + /** + * Asynchronous fstat(2) - Get file status. + * @param handle A `FileHandle`. + */ + function fstat(handle: FileHandle): Promise; + + /** + * Asynchronous lstat(2) - Get file status. Does not dereference symbolic links. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + */ + function lstat(path: PathLike): Promise; + + /** + * Asynchronous stat(2) - Get file status. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + */ + function stat(path: PathLike): Promise; + + /** + * Asynchronous link(2) - Create a new link (also known as a hard link) to an existing file. + * @param existingPath A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol. + */ + function link(existingPath: PathLike, newPath: PathLike): Promise; + + /** + * Asynchronous unlink(2) - delete a name and possibly the file it refers to. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + */ + function unlink(path: PathLike): Promise; + + /** + * Asynchronous fchmod(2) - Change permissions of a file. + * @param handle A `FileHandle`. + * @param mode A file mode. If a string is passed, it is parsed as an octal integer. + */ + function fchmod(handle: FileHandle, mode: string | number): Promise; + + /** + * Asynchronous chmod(2) - Change permissions of a file. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param mode A file mode. If a string is passed, it is parsed as an octal integer. + */ + function chmod(path: PathLike, mode: string | number): Promise; + + /** + * Asynchronous lchmod(2) - Change permissions of a file. Does not dereference symbolic links. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param mode A file mode. If a string is passed, it is parsed as an octal integer. + */ + function lchmod(path: PathLike, mode: string | number): Promise; + + /** + * Asynchronous lchown(2) - Change ownership of a file. Does not dereference symbolic links. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + */ + function lchown(path: PathLike, uid: number, gid: number): Promise; + + /** + * Asynchronous fchown(2) - Change ownership of a file. + * @param handle A `FileHandle`. + */ + function fchown(handle: FileHandle, uid: number, gid: number): Promise; + + /** + * Asynchronous chown(2) - Change ownership of a file. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + */ + function chown(path: PathLike, uid: number, gid: number): Promise; + + /** + * Asynchronously change file timestamps of the file referenced by the supplied path. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param atime The last access time. If a string is provided, it will be coerced to number. + * @param mtime The last modified time. If a string is provided, it will be coerced to number. + */ + function utimes(path: PathLike, atime: string | number | Date, mtime: string | number | Date): Promise; + + /** + * Asynchronously change file timestamps of the file referenced by the supplied `FileHandle`. + * @param handle A `FileHandle`. + * @param atime The last access time. If a string is provided, it will be coerced to number. + * @param mtime The last modified time. If a string is provided, it will be coerced to number. + */ + function futimes(handle: FileHandle, atime: string | number | Date, mtime: string | number | Date): Promise; + + /** + * Asynchronous realpath(3) - return the canonicalized absolute pathname. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function realpath(path: PathLike, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): Promise; + + /** + * Asynchronous realpath(3) - return the canonicalized absolute pathname. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function realpath(path: PathLike, options: { encoding: "buffer" } | "buffer"): Promise; + + /** + * Asynchronous realpath(3) - return the canonicalized absolute pathname. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function realpath(path: PathLike, options?: { encoding?: string | null } | string | null): Promise; + + /** + * Asynchronously creates a unique temporary directory. + * Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function mkdtemp(prefix: string, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): Promise; + + /** + * Asynchronously creates a unique temporary directory. + * Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function mkdtemp(prefix: string, options: { encoding: "buffer" } | "buffer"): Promise; + + /** + * Asynchronously creates a unique temporary directory. + * Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + function mkdtemp(prefix: string, options?: { encoding?: string | null } | string | null): Promise; + + /** + * Asynchronously writes data to a file, replacing the file if it already exists. + * It is unsafe to call `fsPromises.writeFile()` multiple times on the same file without waiting for the `Promise` to be resolved (or rejected). + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * URL support is _experimental_. + * If a `FileHandle` is provided, the underlying file will _not_ be closed automatically. * @param data The data to write. If something other than a `Buffer` or `Uint8Array` is provided, the value is coerced to a string. * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag. * If `encoding` is not supplied, the default of `'utf8'` is used. @@ -4789,356 +5095,49 @@ declare module "fs/promises" { * If `mode` is a string, it is parsed as an octal integer. * If `flag` is not supplied, the default of `'w'` is used. */ - writeFile(data: any, options?: { encoding?: string | null, mode?: string | number, flag?: string | number } | string | null): Promise; + function writeFile(path: PathLike | FileHandle, data: any, options?: { encoding?: string | null, mode?: string | number, flag?: string | number } | string | null): Promise; /** - * Asynchronous close(2) - close a `FileHandle`. + * Asynchronously append data to a file, creating the file if it does not exist. + * @param file A path to a file. If a URL is provided, it must use the `file:` protocol. + * URL support is _experimental_. + * If a `FileHandle` is provided, the underlying file will _not_ be closed automatically. + * @param data The data to write. If something other than a `Buffer` or `Uint8Array` is provided, the value is coerced to a string. + * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag. + * If `encoding` is not supplied, the default of `'utf8'` is used. + * If `mode` is not supplied, the default of `0o666` is used. + * If `mode` is a string, it is parsed as an octal integer. + * If `flag` is not supplied, the default of `'a'` is used. */ - close(): Promise; + function appendFile(path: PathLike | FileHandle, data: any, options?: { encoding?: string | null, mode?: string | number, flag?: string | number } | string | null): Promise; + + /** + * Asynchronously reads the entire contents of a file. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * If a `FileHandle` is provided, the underlying file will _not_ be closed automatically. + * @param options An object that may contain an optional flag. + * If a flag is not provided, it defaults to `'r'`. + */ + function readFile(path: PathLike | FileHandle, options?: { encoding?: null, flag?: string | number } | null): Promise; + + /** + * Asynchronously reads the entire contents of a file. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * If a `FileHandle` is provided, the underlying file will _not_ be closed automatically. + * @param options An object that may contain an optional flag. + * If a flag is not provided, it defaults to `'r'`. + */ + function readFile(path: PathLike | FileHandle, options: { encoding: BufferEncoding, flag?: string | number } | BufferEncoding): Promise; + + /** + * Asynchronously reads the entire contents of a file. + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. + * If a `FileHandle` is provided, the underlying file will _not_ be closed automatically. + * @param options An object that may contain an optional flag. + * If a flag is not provided, it defaults to `'r'`. + */ + function readFile(path: PathLike | FileHandle, options?: { encoding?: string | null, flag?: string | number } | string | null): Promise; } - - /** - * Asynchronously tests a user's permissions for the file specified by path. - * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - function access(path: PathLike, mode?: number): Promise; - - /** - * Asynchronously copies `src` to `dest`. By default, `dest` is overwritten if it already exists. - * Node.js makes no guarantees about the atomicity of the copy operation. - * If an error occurs after the destination file has been opened for writing, Node.js will attempt - * to remove the destination. - * @param src A path to the source file. - * @param dest A path to the destination file. - * @param flags An optional integer that specifies the behavior of the copy operation. The only - * supported flag is `fs.constants.COPYFILE_EXCL`, which causes the copy operation to fail if - * `dest` already exists. - */ - function copyFile(src: PathLike, dest: PathLike, flags?: number): Promise; - - /** - * Asynchronous open(2) - open and possibly create a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. If not - * supplied, defaults to `0o666`. - */ - function open(path: PathLike, flags: string | number, mode?: string | number): Promise; - - /** - * Asynchronously reads data from the file referenced by the supplied `FileHandle`. - * @param handle A `FileHandle`. - * @param buffer The buffer that the data will be written to. - * @param offset The offset in the buffer at which to start writing. - * @param length The number of bytes to read. - * @param position The offset from the beginning of the file from which data should be read. If - * `null`, data will be read from the current position. - */ - function read(handle: FileHandle, buffer: TBuffer, offset?: number | null, length?: number | null, position?: number | null): Promise<{ bytesRead: number, buffer: TBuffer }>; - - /** - * Asynchronously writes `buffer` to the file referenced by the supplied `FileHandle`. - * It is unsafe to call `fsPromises.write()` multiple times on the same file without waiting for the `Promise` to be resolved (or rejected). For this scenario, `fs.createWriteStream` is strongly recommended. - * @param handle A `FileHandle`. - * @param buffer The buffer that the data will be written to. - * @param offset The part of the buffer to be written. If not supplied, defaults to `0`. - * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`. - * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. - */ - function write(handle: FileHandle, buffer: TBuffer, offset?: number | null, length?: number | null, position?: number | null): Promise<{ bytesWritten: number, buffer: TBuffer }>; - - /** - * Asynchronously writes `string` to the file referenced by the supplied `FileHandle`. - * It is unsafe to call `fsPromises.write()` multiple times on the same file without waiting for the `Promise` to be resolved (or rejected). For this scenario, `fs.createWriteStream` is strongly recommended. - * @param handle A `FileHandle`. - * @param string A string to write. If something other than a string is supplied it will be coerced to a string. - * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. - * @param encoding The expected string encoding. - */ - function write(handle: FileHandle, string: any, position?: number | null, encoding?: string | null): Promise<{ bytesWritten: number, buffer: string }>; - - /** - * Asynchronous rename(2) - Change the name or location of a file or directory. - * @param oldPath A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - function rename(oldPath: PathLike, newPath: PathLike): Promise; - - /** - * Asynchronous truncate(2) - Truncate a file to a specified length. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param len If not specified, defaults to `0`. - */ - function truncate(path: PathLike, len?: number): Promise; - - /** - * Asynchronous ftruncate(2) - Truncate a file to a specified length. - * @param handle A `FileHandle`. - * @param len If not specified, defaults to `0`. - */ - function ftruncate(handle: FileHandle, len?: number): Promise; - - /** - * Asynchronous rmdir(2) - delete a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function rmdir(path: PathLike): Promise; - - /** - * Asynchronous fdatasync(2) - synchronize a file's in-core state with storage device. - * @param handle A `FileHandle`. - */ - function fdatasync(handle: FileHandle): Promise; - - /** - * Asynchronous fsync(2) - synchronize a file's in-core state with the underlying storage device. - * @param handle A `FileHandle`. - */ - function fsync(handle: FileHandle): Promise; - - /** - * Asynchronous mkdir(2) - create a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. - */ - function mkdir(path: PathLike, mode?: string | number): Promise; - - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function readdir(path: PathLike, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): Promise; - - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function readdir(path: PathLike, options: { encoding: "buffer" } | "buffer"): Promise; - - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function readdir(path: PathLike, options?: { encoding?: string | null } | string | null): Promise; - - /** - * Asynchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function readlink(path: PathLike, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): Promise; - - /** - * Asynchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function readlink(path: PathLike, options: { encoding: "buffer" } | "buffer"): Promise; - - /** - * Asynchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function readlink(path: PathLike, options?: { encoding?: string | null } | string | null): Promise; - - /** - * Asynchronous symlink(2) - Create a new symbolic link to an existing file. - * @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol. - * @param path A path to the new symlink. If a URL is provided, it must use the `file:` protocol. - * @param type May be set to `'dir'`, `'file'`, or `'junction'` (default is `'file'`) and is only available on Windows (ignored on other platforms). - * When using `'junction'`, the `target` argument will automatically be normalized to an absolute path. - */ - function symlink(target: PathLike, path: PathLike, type?: string | null): Promise; - - /** - * Asynchronous fstat(2) - Get file status. - * @param handle A `FileHandle`. - */ - function fstat(handle: FileHandle): Promise; - - /** - * Asynchronous lstat(2) - Get file status. Does not dereference symbolic links. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function lstat(path: PathLike): Promise; - - /** - * Asynchronous stat(2) - Get file status. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function stat(path: PathLike): Promise; - - /** - * Asynchronous link(2) - Create a new link (also known as a hard link) to an existing file. - * @param existingPath A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function link(existingPath: PathLike, newPath: PathLike): Promise; - - /** - * Asynchronous unlink(2) - delete a name and possibly the file it refers to. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function unlink(path: PathLike): Promise; - - /** - * Asynchronous fchmod(2) - Change permissions of a file. - * @param handle A `FileHandle`. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. - */ - function fchmod(handle: FileHandle, mode: string | number): Promise; - - /** - * Asynchronous chmod(2) - Change permissions of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. - */ - function chmod(path: PathLike, mode: string | number): Promise; - - /** - * Asynchronous lchmod(2) - Change permissions of a file. Does not dereference symbolic links. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. - */ - function lchmod(path: PathLike, mode: string | number): Promise; - - /** - * Asynchronous lchown(2) - Change ownership of a file. Does not dereference symbolic links. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function lchown(path: PathLike, uid: number, gid: number): Promise; - - /** - * Asynchronous fchown(2) - Change ownership of a file. - * @param handle A `FileHandle`. - */ - function fchown(handle: FileHandle, uid: number, gid: number): Promise; - - /** - * Asynchronous chown(2) - Change ownership of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function chown(path: PathLike, uid: number, gid: number): Promise; - - /** - * Asynchronously change file timestamps of the file referenced by the supplied path. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param atime The last access time. If a string is provided, it will be coerced to number. - * @param mtime The last modified time. If a string is provided, it will be coerced to number. - */ - function utimes(path: PathLike, atime: string | number | Date, mtime: string | number | Date): Promise; - - /** - * Asynchronously change file timestamps of the file referenced by the supplied `FileHandle`. - * @param handle A `FileHandle`. - * @param atime The last access time. If a string is provided, it will be coerced to number. - * @param mtime The last modified time. If a string is provided, it will be coerced to number. - */ - function futimes(handle: FileHandle, atime: string | number | Date, mtime: string | number | Date): Promise; - - /** - * Asynchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function realpath(path: PathLike, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): Promise; - - /** - * Asynchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function realpath(path: PathLike, options: { encoding: "buffer" } | "buffer"): Promise; - - /** - * Asynchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function realpath(path: PathLike, options?: { encoding?: string | null } | string | null): Promise; - - /** - * Asynchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function mkdtemp(prefix: string, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): Promise; - - /** - * Asynchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function mkdtemp(prefix: string, options: { encoding: "buffer" } | "buffer"): Promise; - - /** - * Asynchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function mkdtemp(prefix: string, options?: { encoding?: string | null } | string | null): Promise; - - /** - * Asynchronously writes data to a file, replacing the file if it already exists. - * It is unsafe to call `fsPromises.writeFile()` multiple times on the same file without waiting for the `Promise` to be resolved (or rejected). - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a `FileHandle` is provided, the underlying file will _not_ be closed automatically. - * @param data The data to write. If something other than a `Buffer` or `Uint8Array` is provided, the value is coerced to a string. - * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag. - * If `encoding` is not supplied, the default of `'utf8'` is used. - * If `mode` is not supplied, the default of `0o666` is used. - * If `mode` is a string, it is parsed as an octal integer. - * If `flag` is not supplied, the default of `'w'` is used. - */ - function writeFile(path: PathLike | FileHandle, data: any, options?: { encoding?: string | null, mode?: string | number, flag?: string | number } | string | null): Promise; - - /** - * Asynchronously append data to a file, creating the file if it does not exist. - * @param file A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a `FileHandle` is provided, the underlying file will _not_ be closed automatically. - * @param data The data to write. If something other than a `Buffer` or `Uint8Array` is provided, the value is coerced to a string. - * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag. - * If `encoding` is not supplied, the default of `'utf8'` is used. - * If `mode` is not supplied, the default of `0o666` is used. - * If `mode` is a string, it is parsed as an octal integer. - * If `flag` is not supplied, the default of `'a'` is used. - */ - function appendFile(path: PathLike | FileHandle, data: any, options?: { encoding?: string | null, mode?: string | number, flag?: string | number } | string | null): Promise; - - /** - * Asynchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * If a `FileHandle` is provided, the underlying file will _not_ be closed automatically. - * @param options An object that may contain an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - function readFile(path: PathLike | FileHandle, options?: { encoding?: null, flag?: string | number } | null): Promise; - - /** - * Asynchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * If a `FileHandle` is provided, the underlying file will _not_ be closed automatically. - * @param options An object that may contain an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - function readFile(path: PathLike | FileHandle, options: { encoding: BufferEncoding, flag?: string | number } | BufferEncoding): Promise; - - /** - * Asynchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * If a `FileHandle` is provided, the underlying file will _not_ be closed automatically. - * @param options An object that may contain an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - function readFile(path: PathLike | FileHandle, options?: { encoding?: string | null, flag?: string | number } | string | null): Promise; } declare module "path" { From 2d241ad3e1bbcdd96892f4029db730134ba0d67b Mon Sep 17 00:00:00 2001 From: Vladimir Date: Tue, 15 May 2018 08:20:24 +0600 Subject: [PATCH 114/575] Remove export namespace --- types/react-input-mask/index.d.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/types/react-input-mask/index.d.ts b/types/react-input-mask/index.d.ts index 5bacb3561a..13140b1cad 100644 --- a/types/react-input-mask/index.d.ts +++ b/types/react-input-mask/index.d.ts @@ -6,9 +6,6 @@ import * as React from "react"; -export default ReactInputMask; -export as namespace ReactInputMask; - declare namespace ReactInputMask { interface Props extends React.InputHTMLAttributes { /** @@ -48,3 +45,5 @@ declare namespace ReactInputMask { declare class ReactInputMask extends React.Component { } + +export default ReactInputMask; From ba1803634534f5d741a08bb944048fd1326d499a Mon Sep 17 00:00:00 2001 From: Seth Kingsley Date: Mon, 14 May 2018 21:45:15 -0700 Subject: [PATCH 115/575] PATCH 2 --- types/three/three-core.d.ts | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/types/three/three-core.d.ts b/types/three/three-core.d.ts index c9b67f5c36..70e550e5f8 100644 --- a/types/three/three-core.d.ts +++ b/types/three/three-core.d.ts @@ -218,6 +218,9 @@ export function warn(message?: any, ...optionalParams: any[]): void; export function error(message?: any, ...optionalParams: any[]): void; export function log(message?: any, ...optionalParams: any[]): void; +// typed array parameters +type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array; + // Animation //////////////////////////////////////////////////////////////////////////////////////// export class AnimationAction { @@ -2209,7 +2212,7 @@ export class JSONLoader extends Loader { export class LoadingManager { constructor(onLoad?: () => void, onProgress?: (url: string, loaded: number, total: number) => void, onError?: () => void); - onStart: (url: string, loaded: number, total: number) => void; + onStart?: (url: string, loaded: number, total: number) => void; /** * Will be called when load starts. @@ -2229,7 +2232,7 @@ export class LoadingManager { */ onError: (url: string) => void; - setURLModifier(callback : (url: string) => string): void; + setURLModifier(callback?: (url: string) => string): void; itemStart(url: string): void; itemEnd(url: string): void; @@ -2353,7 +2356,7 @@ export namespace Cache { } export class LoaderUtils { - static decodeText(array: Uint8Array): string; + static decodeText(array: TypedArray): string; static extractUrlBase(url: string): string; } @@ -2907,24 +2910,24 @@ export class MeshPhongMaterial extends Material { color: Color; specular: Color; shininess: number; - map?: Texture; - lightMap: Texture; + map: Texture | null; + lightMap: Texture | null; lightMapIntensity: number; - aoMap?: Texture; + aoMap: Texture | null; aoMapIntensity: number; emissive: Color; emissiveIntensity: number; - emissiveMap: Texture; - bumpMap?: Texture; + emissiveMap: Texture | null; + bumpMap: Texture | null; bumpScale: number; - normalMap?: Texture; + normalMap: Texture | null; normalScale: Vector2; - displacementMap: Texture; + displacementMap: Texture | null; displacementScale: number; displacementBias: number; - specularMap?: Texture; - alphaMap?: Texture; - envMap?: Texture; + specularMap: Texture | null; + alphaMap: Texture | null; + envMap: Texture | null; combine: Combine; reflectivity: number; refractionRatio: number; @@ -6137,9 +6140,6 @@ export class WebGLState { }; init(): void; - texImage2D(target: number, level: number, internalformat: number, - width: number, height: number, border: number, format: number, - type: number, pixels?: ArrayBufferView | null): void; initAttributes(): void; enableAttribute(attribute: string): void; enableAttributeAndDivisor(attribute: string, meshPerAttribute: any, extension: any): void; @@ -6164,7 +6164,9 @@ export class WebGLState { getScissorTest(): boolean; activeTexture(webglSlot: any): void; bindTexture(webglType: any, webglTexture: any): void; + // Same interface as https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/compressedTexImage2D compressedTexImage2D(): void; + // Same interface as https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/texImage2D texImage2D(): void; clearColor(r: number, g: number, b: number, a: number): void; clearDepth(depth: number): void; @@ -6417,7 +6419,7 @@ export class CompressedTexture extends Texture { export class DataTexture extends Texture { constructor( - data: ArrayBuffer | Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, + data: ArrayBuffer | TypedArray, width: number, height: number, format?: PixelFormat, From 9833c73b93c3d62bc2eaa1f61bf4afbc52baad30 Mon Sep 17 00:00:00 2001 From: Sam Gronblom Date: Tue, 15 May 2018 14:57:22 +0900 Subject: [PATCH 116/575] Fix indentation of oauth2Model --- types/oauth2-server/oauth2-server-tests.ts | 62 +++++++++++----------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/types/oauth2-server/oauth2-server-tests.ts b/types/oauth2-server/oauth2-server-tests.ts index faf9976873..9873eb6e9a 100644 --- a/types/oauth2-server/oauth2-server-tests.ts +++ b/types/oauth2-server/oauth2-server-tests.ts @@ -2,37 +2,37 @@ import express = require("express"); import OAuth2Server = require("oauth2-server"); const oauth2Model: OAuth2Server.AuthorizationCodeModel = { - getClient: async (clientId: string, clientSecret: string): Promise => { - return undefined; - }, - saveToken: async (token: OAuth2Server.Token, client: OAuth2Server.Client, user: OAuth2Server.User): Promise => { - return token; - }, - getAccessToken: async (accessToken: string): Promise => { - return { - accessToken, - client: {id: "testClient", grants: ["access_token"]}, - user: {id: "testUser"} - }; - }, - verifyScope: async (token: OAuth2Server.Token, scope: string): Promise => { - return true; - }, - getAuthorizationCode: async (authorizationCode: string): Promise => { - return { - authorizationCode, - expiresAt: new Date(), - redirectUri: "www.test.com", - client: {id: "testClient", grants: ["access_token"]}, - user: {id: "testUser"} - }; - }, - saveAuthorizationCode: async (code: OAuth2Server.AuthorizationCode, client: OAuth2Server.Client, user: OAuth2Server.User): Promise => { - return code; - }, - revokeAuthorizationCode: async (code: OAuth2Server.AuthorizationCode): Promise => { - return true; - } + getClient: async (clientId: string, clientSecret: string): Promise => { + return undefined; + }, + saveToken: async (token: OAuth2Server.Token, client: OAuth2Server.Client, user: OAuth2Server.User): Promise => { + return token; + }, + getAccessToken: async (accessToken: string): Promise => { + return { + accessToken, + client: { id: "testClient", grants: ["access_token"] }, + user: { id: "testUser" } + }; + }, + verifyScope: async (token: OAuth2Server.Token, scope: string): Promise => { + return true; + }, + getAuthorizationCode: async (authorizationCode: string): Promise => { + return { + authorizationCode, + expiresAt: new Date(), + redirectUri: "www.test.com", + client: { id: "testClient", grants: ["access_token"] }, + user: { id: "testUser" } + }; + }, + saveAuthorizationCode: async (code: OAuth2Server.AuthorizationCode, client: OAuth2Server.Client, user: OAuth2Server.User): Promise => { + return code; + }, + revokeAuthorizationCode: async (code: OAuth2Server.AuthorizationCode): Promise => { + return true; + } }; const oauth2Server = new OAuth2Server({ From 1b754d2d763150c2aecdec073398e23a7361d9c0 Mon Sep 17 00:00:00 2001 From: Joscha Feth Date: Tue, 15 May 2018 16:19:30 +1000 Subject: [PATCH 117/575] add: dependency-tree --- .../dependency-tree/dependency-tree-tests.ts | 18 ++++++++++++ types/dependency-tree/index.d.ts | 29 +++++++++++++++++++ types/dependency-tree/tsconfig.json | 22 ++++++++++++++ types/dependency-tree/tslint.json | 1 + 4 files changed, 70 insertions(+) create mode 100644 types/dependency-tree/dependency-tree-tests.ts create mode 100644 types/dependency-tree/index.d.ts create mode 100644 types/dependency-tree/tsconfig.json create mode 100644 types/dependency-tree/tslint.json diff --git a/types/dependency-tree/dependency-tree-tests.ts b/types/dependency-tree/dependency-tree-tests.ts new file mode 100644 index 0000000000..67f8c3bb82 --- /dev/null +++ b/types/dependency-tree/dependency-tree-tests.ts @@ -0,0 +1,18 @@ +import dependencyTree = require('dependency-tree'); + +const tree = dependencyTree({ + filename: 'path/to/a/file', + directory: 'path/to/all/files', + requireConfig: 'path/to/requirejs/config', + webpackConfig: 'path/to/webpack/config', + nodeModulesConfig: { + entry: 'module' + }, + filter: path => path.indexOf('node_modules') === -1, + nonExistent: [] +}); + +const list = dependencyTree.toList({ + filename: 'path/to/a/file', + directory: 'path/to/all/files' +}); diff --git a/types/dependency-tree/index.d.ts b/types/dependency-tree/index.d.ts new file mode 100644 index 0000000000..be0a69676c --- /dev/null +++ b/types/dependency-tree/index.d.ts @@ -0,0 +1,29 @@ +// Type definitions for dependency-tree 6.1 +// Project: https://github.com/mrjoelkemp/node-dependency-tree +// Definitions by: Joscha Feth +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare namespace dependencyTree { + interface DependencyObj { + [k: string]: DependencyObj; + } + + interface Options { + filename: string; + directory?: string; + requireConfig?: string; + webpackConfig?: string; + nodeModulesConfig?: any; + detective?: any; + visited?: DependencyObj; + filter?(path: string): boolean; + nonExistent?: string[]; + isListForm?: boolean; + } + + function toList(options: Options): string[]; +} + +declare function dependencyTree(options: dependencyTree.Options): dependencyTree.DependencyObj; + +export = dependencyTree; diff --git a/types/dependency-tree/tsconfig.json b/types/dependency-tree/tsconfig.json new file mode 100644 index 0000000000..412f8bf359 --- /dev/null +++ b/types/dependency-tree/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "dependency-tree-tests.ts" + ] +} diff --git a/types/dependency-tree/tslint.json b/types/dependency-tree/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/dependency-tree/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 60418667c1832f4ca0f13ea4bf8bfba25745a107 Mon Sep 17 00:00:00 2001 From: Diluka Date: Tue, 15 May 2018 15:16:12 +0800 Subject: [PATCH 118/575] add sequelize instance method `random` api doc see http://docs.sequelizejs.com/class/lib/sequelize.js~Sequelize.html#instance-method-random --- types/sequelize/index.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/types/sequelize/index.d.ts b/types/sequelize/index.d.ts index 4adf48948d..cc4bef61ba 100644 --- a/types/sequelize/index.d.ts +++ b/types/sequelize/index.d.ts @@ -6172,6 +6172,10 @@ declare namespace sequelize { */ databaseVersion(): Promise; + /** + * Get the fn for random based on the dialect + */ + random(): fn; } // From 5705586c05cb5fc1d41f132dc7f92561651d550d Mon Sep 17 00:00:00 2001 From: Joscha Feth Date: Tue, 15 May 2018 17:30:02 +1000 Subject: [PATCH 119/575] Update tsconfig.json --- types/dependency-tree/tsconfig.json | 1 + 1 file changed, 1 insertion(+) diff --git a/types/dependency-tree/tsconfig.json b/types/dependency-tree/tsconfig.json index 412f8bf359..5431546e97 100644 --- a/types/dependency-tree/tsconfig.json +++ b/types/dependency-tree/tsconfig.json @@ -7,6 +7,7 @@ "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, + "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ "../" From f3eb7df93f86be3652cc69aaa04460e5e023fad4 Mon Sep 17 00:00:00 2001 From: Oliver Joseph Ash Date: Tue, 15 May 2018 08:32:09 +0100 Subject: [PATCH 120/575] Node: remove myself as author In addition to https://github.com/DefinitelyTyped/DefinitelyTyped/pull/25610 --- .github/CODEOWNERS | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index f9324d1bdd..9084f165aa 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -2645,8 +2645,8 @@ /types/node/v4/ @eps1lon /types/node/v6/ @WilcoBakker @inlined @eps1lon @Alorel /types/node/v7/ @parambirs @tellnes @WilcoBakker @eps1lon -/types/node/v8/ @parambirs @tellnes @WilcoBakker @octo-sniffle @smac89 @Flarna @mwiktorczyk @wwwy3y3 @DeividasBakanas @kjin @alvis @OliverJAsh @eps1lon @Hannes-Magnusson-CK @jkomyno @hoo29 @n-e -/types/node/ @parambirs @tellnes @WilcoBakker @octo-sniffle @smac89 @Flarna @mwiktorczyk @wwwy3y3 @DeividasBakanas @kjin @alvis @OliverJAsh @eps1lon @Hannes-Magnusson-CK @jkomyno @ajafff @hoo29 @n-e +/types/node/v8/ @parambirs @tellnes @WilcoBakker @octo-sniffle @smac89 @Flarna @mwiktorczyk @wwwy3y3 @DeividasBakanas @kjin @alvis @eps1lon @Hannes-Magnusson-CK @jkomyno @hoo29 @n-e +/types/node/ @parambirs @tellnes @WilcoBakker @octo-sniffle @smac89 @Flarna @mwiktorczyk @wwwy3y3 @DeividasBakanas @kjin @alvis @eps1lon @Hannes-Magnusson-CK @jkomyno @ajafff @hoo29 @n-e /types/node-7z/ @erkie /types/node-array-ext/ @Beng89 /types/node-cache/ @chrootsu @dthunell @useltmann From 08bce4cb0618c59843a2149a00b7fbd7436228c1 Mon Sep 17 00:00:00 2001 From: Henrik Raitasola Date: Tue, 15 May 2018 11:08:24 +0300 Subject: [PATCH 121/575] Add missing backPress navigator event --- types/react-native-navigation/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-native-navigation/index.d.ts b/types/react-native-navigation/index.d.ts index 86b94bff44..c380b4ae7e 100644 --- a/types/react-native-navigation/index.d.ts +++ b/types/react-native-navigation/index.d.ts @@ -118,7 +118,7 @@ export interface LightBox { } export interface NavigatorEvent { - id: 'willAppear' | 'didAppear' | 'willDisappear' | 'didDisappear' | 'willCommitPreview'; + id: 'willAppear' | 'didAppear' | 'willDisappear' | 'didDisappear' | 'willCommitPreview' | 'backPress'; } export class Navigator { From 8bd493155842e447bf3be1640b419cd752a84587 Mon Sep 17 00:00:00 2001 From: Henrik Raitasola Date: Tue, 15 May 2018 11:16:15 +0300 Subject: [PATCH 122/575] Add one missing function and one missing class --- types/react-native-navigation/index.d.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/types/react-native-navigation/index.d.ts b/types/react-native-navigation/index.d.ts index c380b4ae7e..c1d096fe5f 100644 --- a/types/react-native-navigation/index.d.ts +++ b/types/react-native-navigation/index.d.ts @@ -18,6 +18,7 @@ export namespace Navigation { function handleDeepLink(params?: { link: string; payload?: string; }): void; function registerScreen(screenId: string, generator: () => React.ComponentType): void; function getCurrentlyVisibleScreenId(): Promise; + function isAppLaunched(): Promise; } export interface TabBasedApp { @@ -155,6 +156,11 @@ export class ScreenVisibilityListener { unregister(): void; } +export class NativeEventsReceiver { + constructor(); + appLaunched(callback: () => void): void; +} + export interface ScreenVisibilityListenerParams { willAppear?: (params: ListenerParams) => void; didAppear?: (params: ListenerParams) => void; From 9c7095b7b499f9b37fbf504502a5b66948a19017 Mon Sep 17 00:00:00 2001 From: Henrik Raitasola Date: Tue, 15 May 2018 11:21:34 +0300 Subject: [PATCH 123/575] Add tests --- .../react-native-navigation-tests.tsx | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/types/react-native-navigation/react-native-navigation-tests.tsx b/types/react-native-navigation/react-native-navigation-tests.tsx index 004673e10a..6adc4f5111 100644 --- a/types/react-native-navigation/react-native-navigation-tests.tsx +++ b/types/react-native-navigation/react-native-navigation-tests.tsx @@ -1,6 +1,13 @@ import * as React from 'react'; import { Text, View } from 'react-native'; -import { Navigation, NavigationComponentProps, NavigatorStyle, NavigatorButtons, NavigatorEvent } from 'react-native-navigation'; +import { + Navigation, + NavigationComponentProps, + NavigatorStyle, + NavigatorButtons, + NavigatorEvent, + NativeEventsReceiver, +} from 'react-native-navigation'; type Props = NavigationComponentProps & { height: number }; @@ -67,6 +74,17 @@ Navigation.registerComponent('example.Screen1', () => Screen1); Navigation.registerComponent('example.Screen2', () => Screen2); Navigation.registerComponent('example.Drawer', () => Drawer); +Navigation.isAppLaunched().then(appLaunched => { + if (appLaunched) { + startApp(); // App is launched -> show UI + } + new NativeEventsReceiver().appLaunched(startApp); // App hasn't been launched yet -> show the UI only when needed. +}); + +function startApp() { + // do something here +} + Navigation.startTabBasedApp({ tabs: [ { From d443147e896c0569cf6acb7f296ebca1a2cba1fb Mon Sep 17 00:00:00 2001 From: Henrik Raitasola Date: Tue, 15 May 2018 11:25:11 +0300 Subject: [PATCH 124/575] Remove trailing whitespace --- types/react-native-navigation/react-native-navigation-tests.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-native-navigation/react-native-navigation-tests.tsx b/types/react-native-navigation/react-native-navigation-tests.tsx index 6adc4f5111..e2ecc8bccb 100644 --- a/types/react-native-navigation/react-native-navigation-tests.tsx +++ b/types/react-native-navigation/react-native-navigation-tests.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; import { Text, View } from 'react-native'; -import { +import { Navigation, NavigationComponentProps, NavigatorStyle, From 138ea7344c0b98594b8bd4273263bb1ab687e9fc Mon Sep 17 00:00:00 2001 From: VincentBel Date: Tue, 15 May 2018 16:47:53 +0800 Subject: [PATCH 125/575] [react-loadable]: update types for v5.4 --- types/react-loadable/index.d.ts | 3 ++- types/react-loadable/test/index.tsx | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/types/react-loadable/index.d.ts b/types/react-loadable/index.d.ts index beeb569d4c..b673d9b480 100644 --- a/types/react-loadable/index.d.ts +++ b/types/react-loadable/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-loadable 5.3 +// Type definitions for react-loadable 5.4 // Project: https://github.com/thejameskyle/react-loadable#readme // Definitions by: Diogo Franco // Oden S. @@ -16,6 +16,7 @@ declare namespace LoadableExport { pastDelay: boolean; timedOut: boolean; error: any; + retry: () => void; } type Options = OptionsWithoutRender | OptionsWithRender; diff --git a/types/react-loadable/test/index.tsx b/types/react-loadable/test/index.tsx index 5045fdf125..474ab4868e 100644 --- a/types/react-loadable/test/index.tsx +++ b/types/react-loadable/test/index.tsx @@ -9,6 +9,7 @@ class LoadingComponent extends React.Component { {this.props.isLoading} {this.props.pastDelay} {this.props.timedOut} + ); } From aa9228e78554c6878bd33debc0582ac44f7fab9c Mon Sep 17 00:00:00 2001 From: Gerhard Stoebich Date: Tue, 15 May 2018 10:48:54 +0200 Subject: [PATCH 126/575] [node] Add http/2 pseudo headers to IncomingHttpHeaders --- types/node/index.d.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 4e03c3f78b..ec7f6b0a76 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -6836,8 +6836,16 @@ declare module "http2" { import * as tls from "tls"; import * as url from "url"; - import { IncomingHttpHeaders, OutgoingHttpHeaders } from "http"; - export { IncomingHttpHeaders, OutgoingHttpHeaders } from "http"; + import { IncomingHttpHeaders as Http1IncomingHttpHeaders, OutgoingHttpHeaders } from "http"; + export { OutgoingHttpHeaders } from "http"; + + export interface IncomingHttpHeaders extends Http1IncomingHttpHeaders { + ':path'?: string; + ':method'?: string; + ':status'?: string; + ':authority'?: string; + ':scheme'?: string; + } // Http2Stream From 664c4ce051200f6c11cebd0e078b677da430786d Mon Sep 17 00:00:00 2001 From: Sam Gronblom Date: Tue, 15 May 2018 14:57:43 +0900 Subject: [PATCH 127/575] Fix type for generateAuthorizationCode - Current docs: https://oauth2-server.readthedocs.io/en/latest/model/spec.html#generateauthorizationcode-client-user-scope-callback - Current implementation: https://github.com/oauthjs/node-oauth2-server/blob/5f48a5ce060e22ae8032ea78a781518d5a7cd411/lib/handlers/authorize-handler.js#L138 --- types/oauth2-server/index.d.ts | 2 +- types/oauth2-server/oauth2-server-tests.ts | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/types/oauth2-server/index.d.ts b/types/oauth2-server/index.d.ts index 06b6fbadb0..8f6da041fd 100644 --- a/types/oauth2-server/index.d.ts +++ b/types/oauth2-server/index.d.ts @@ -239,7 +239,7 @@ declare namespace OAuth2Server { * Invoked to generate a new authorization code. * */ - generateAuthorizationCode?(callback?: Callback): Promise; + generateAuthorizationCode?(client: Client, user: User, scope: string, callback?: Callback): Promise; /** * Invoked to retrieve an existing authorization code previously saved through Model#saveAuthorizationCode(). diff --git a/types/oauth2-server/oauth2-server-tests.ts b/types/oauth2-server/oauth2-server-tests.ts index 9873eb6e9a..fe5b22e85e 100644 --- a/types/oauth2-server/oauth2-server-tests.ts +++ b/types/oauth2-server/oauth2-server-tests.ts @@ -2,6 +2,13 @@ import express = require("express"); import OAuth2Server = require("oauth2-server"); const oauth2Model: OAuth2Server.AuthorizationCodeModel = { + generateAuthorizationCode: async (client, user, scope) => { + return JSON.stringify({ + client, + user, + scope, + }); + }, getClient: async (clientId: string, clientSecret: string): Promise => { return undefined; }, From 809121fb605e626eefb851b36699bd24e777cd2b Mon Sep 17 00:00:00 2001 From: Adrien Coffre Date: Tue, 15 May 2018 11:46:19 +0200 Subject: [PATCH 128/575] Fix. --- types/three/three-core.d.ts | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/types/three/three-core.d.ts b/types/three/three-core.d.ts index 189584bbf7..82be388122 100644 --- a/types/three/three-core.d.ts +++ b/types/three/three-core.d.ts @@ -6054,21 +6054,21 @@ export class WebGLLights { /** * An object with a series of statistical information about the graphics board memory and the rendering process. */ -export class WebGLInfo { - autoReset: boolean; +export class WebGLInfo { + autoReset: boolean; memory: { - geometries: number; - textures: number; - }; - programs: number | null; - render: { - calls: number; - lines: number; - points: number; - triangles: number; - }; - reset(): void; - update(): void; + geometries: number; + textures: number; + }; + programs: number | null; + render: { + calls: number; + frame: number; + lines: number; + points: number; + triangles: number; + }; + reset(): void; } export class WebGLIndexedBufferRenderer { From 928f885297a84f32a90164ced4b48c71923624ee Mon Sep 17 00:00:00 2001 From: Adrien Coffre Date: Tue, 15 May 2018 11:55:59 +0200 Subject: [PATCH 129/575] Update programs too. --- types/three/three-core.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/three/three-core.d.ts b/types/three/three-core.d.ts index 82be388122..059e4cbe89 100644 --- a/types/three/three-core.d.ts +++ b/types/three/three-core.d.ts @@ -6060,7 +6060,7 @@ export class WebGLInfo { geometries: number; textures: number; }; - programs: number | null; + programs: WebGLProgram[] | null; render: { calls: number; frame: number; @@ -6114,7 +6114,7 @@ export class WebGLProgram { export class WebGLPrograms { constructor(renderer: WebGLRenderer, capabilities: any); - programs: any[]; + programs: WebGLProgram[]; getParameters(material: ShaderMaterial, lights: any, fog: any, nClipPlanes: number, object: any): any; getProgramCode(material: ShaderMaterial, parameters: any): string; From 0f644a7cbe037901eb47e4aa0f9542f38a650308 Mon Sep 17 00:00:00 2001 From: Arylo Date: Tue, 15 May 2018 18:15:11 +0800 Subject: [PATCH 130/575] Add type definition for cli-table --- types/cli-table/cli-table-tests.ts | 50 ++++++++++++++++++++++++++++++ types/cli-table/index.d.ts | 45 +++++++++++++++++++++++++++ types/cli-table/tsconfig.json | 23 ++++++++++++++ types/cli-table/tslint.json | 1 + 4 files changed, 119 insertions(+) create mode 100644 types/cli-table/cli-table-tests.ts create mode 100644 types/cli-table/index.d.ts create mode 100644 types/cli-table/tsconfig.json create mode 100644 types/cli-table/tslint.json diff --git a/types/cli-table/cli-table-tests.ts b/types/cli-table/cli-table-tests.ts new file mode 100644 index 0000000000..30d160f699 --- /dev/null +++ b/types/cli-table/cli-table-tests.ts @@ -0,0 +1,50 @@ +import Table = require('cli-table'); + +/** + * Example. + */ + +/* col widths */ +const table = new Table({ + head: ['Rel', 'Change', 'By', 'When'], + colWidths: [6, 21, 25, 17] +}); + +table.push( + ['v0.1', 'Testing something cool', 'rauchg@gmail.com', '7 minutes ago'], + ['v0.1', 'Testing something cool', 'rauchg@gmail.com', '8 minutes ago'] +); + +table.toString(); + +/* compact */ +const table1 = new Table({ + head: ['Rel', 'Change', 'By', 'When'], + colWidths: [6, 21, 25, 17], + style : {compact : true, 'padding-left' : 1} +}); + +table1.push( + ['v0.1', 'Testing something cool', 'rauchg@gmail.com', '7 minutes ago'], + ['v0.1', 'Testing something cool', 'rauchg@gmail.com', '8 minutes ago'], + [], + ['v0.1', 'Testing something cool', 'rauchg@gmail.com', '8 minutes ago'] +); + +/* headless */ +const headless_table = new Table(); +headless_table.push( + ['v0.1', 'Testing something cool', 'rauchg@gmail.com', '7 minutes ago'] +); +/* vertical */ +const vertical_table = new Table(); +vertical_table.push( + { "Some Key": "Some Value"}, + { "Another much longer key": "And its corresponding longer value"} +); +/* cross */ +const cross_table = new Table({ head: ["", "Header #1", "Header #2"] }); +cross_table.push( + { "Header #3": ["Value 1", "Value 2"] }, + { "Header #4": ["Value 3", "Value 4"] } +); diff --git a/types/cli-table/index.d.ts b/types/cli-table/index.d.ts new file mode 100644 index 0000000000..a39ac2d914 --- /dev/null +++ b/types/cli-table/index.d.ts @@ -0,0 +1,45 @@ +// Type definitions for cli-table 0.3 +// Project: https://github.com/Automattic/cli-table +// Definitions by: AryloYeung +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +interface TableOptions { + chars: Partial>; + truncate: string; + colors: boolean; + colWidths: number[]; + colAligns: Array<"left" | "middle" | "right">; + style: Partial<{ + 'padding-left': number; + 'padding-right': number; + head: string[]; + border: string[]; + compact: boolean; + }>; + head: string[]; +} + +declare class Table extends Array { + constructor(options?: Partial); + toString(): string; + static version: string; +} + +export = Table; diff --git a/types/cli-table/tsconfig.json b/types/cli-table/tsconfig.json new file mode 100644 index 0000000000..50afa32769 --- /dev/null +++ b/types/cli-table/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", + "cli-table-tests.ts" + ] +} diff --git a/types/cli-table/tslint.json b/types/cli-table/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/cli-table/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From d1023531fa92cd749c3613ebd97ccab7aae06f67 Mon Sep 17 00:00:00 2001 From: Holger Jeromin Date: Tue, 15 May 2018 12:32:27 +0200 Subject: [PATCH 131/575] jquery: Add overload for on() handler --- 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 8422f3ec5c..d6f09cb54d 100644 --- a/types/jquery/index.d.ts +++ b/types/jquery/index.d.ts @@ -4553,7 +4553,7 @@ interface JQuery extends Iterable * @since 1.7 */ on(events: string, - handler: JQuery.EventHandler | JQuery.EventHandlerBase> | false): this; + handler: JQuery.EventHandler | JQuery.EventHandlerBase> | ((event: JQueryEventObject) => void) | false): this; /** * Attach an event handler function for one or more events to the selected elements. * From afbcc5cfe0082bc9f64c9ed6f985a9358cd6f4b3 Mon Sep 17 00:00:00 2001 From: Holger Jeromin Date: Tue, 15 May 2018 14:20:56 +0200 Subject: [PATCH 132/575] adding test --- types/jquery/jquery-tests.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/types/jquery/jquery-tests.ts b/types/jquery/jquery-tests.ts index 5d6aaf0680..7375c5e814 100644 --- a/types/jquery/jquery-tests.ts +++ b/types/jquery/jquery-tests.ts @@ -3701,6 +3701,14 @@ function JQuery() { event; }); + // $ExpectType JQuery + $('table').on('myEvent', function(event: JQueryEventObject) { + // $ExpectType HTMLElement + this; + // $ExpectType JQueryEventObject + event; + }); + // $ExpectType JQuery $('table').on('myEvent', function(this: I1, event) { // $ExpectType I1 From 4c7fe8b432677a5ff5614b0bbc54b4db23e442cf Mon Sep 17 00:00:00 2001 From: Vincent Fabioux Date: Tue, 15 May 2018 14:36:46 +0200 Subject: [PATCH 133/575] [rc-tree] Add icon and other missing fields to props --- types/rc-tree/index.d.ts | 57 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/types/rc-tree/index.d.ts b/types/rc-tree/index.d.ts index aac9e1ea9f..e8cdb487e6 100644 --- a/types/rc-tree/index.d.ts +++ b/types/rc-tree/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for rc-tree 1.10 +// Type definitions for rc-tree 1.11 // Project: https://github.com/react-component/tree // Definitions by: John Reilly , Methuselah96 // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -41,6 +41,10 @@ export interface TreeNodeProps { * whether it is a leaf node */ isLeaf?: boolean; + /** + * customize icon. When you pass component, whose render will receive full TreeNode props as component props + */ + icon?: JSX.Element | ((props: InternalTreeNodeProps) => JSX.Element); } export class TreeNode extends Component { } @@ -76,6 +80,16 @@ export interface OnDragEnterData { expandedKeys: string[]; } +export interface OnDragOverData { + event: Event; + node: InternalTreeNode; +} + +export interface OnDragLeaveData { + event: Event; + node: InternalTreeNode; +} + export interface OnDropData { event: Event; node: InternalTreeNode; @@ -83,6 +97,11 @@ export interface OnDropData { dragNodesKeys: string[]; } +export interface OnDragEndData { + event: Event; + node: InternalTreeNode; +} + export interface TreeProps { /** * additional css class of root dom node @@ -92,6 +111,10 @@ export interface TreeProps { * prefix class */ prefixCls?: string; + /** + * whether disabled the tree + */ + disabled?: boolean; /** * whether show line */ @@ -124,6 +147,10 @@ export interface TreeProps { * control expanding of specific treeNodes */ expandedKeys?: string[]; + /** + * auto expand parent treeNodes when init + */ + defaultExpandParent?: boolean; /** * whether auto expand parent treeNodes */ @@ -146,6 +173,10 @@ export interface TreeProps { * default selected treeNodes */ defaultSelectedKeys?: string[]; + /** + * customize icon. When you pass component, whose render will receive full TreeNode props as component props + */ + icon?: JSX.Element | ((props: InternalTreeNodeProps) => JSX.Element); /** * Controlled selected treeNodes(After setting, defaultSelectedKeys will not work) */ @@ -170,6 +201,18 @@ export interface TreeProps { * load data asynchronously */ loadData?(node: InternalTreeNode): Promise; + /** + * select current treeNode and show customized contextmenu + */ + onRightClick?: (node: InternalTreeNode) => void; + /** + * call when mouse enter a treeNode + */ + onMouseEnter?: (node: InternalTreeNode) => void; + /** + * call when mouse leave a treeNode + */ + onMouseLeave?: (node: InternalTreeNode) => void; /** * whether can drag treeNode. */ @@ -182,10 +225,22 @@ export interface TreeProps { * event on drag enter */ onDragEnter?: (props: OnDragEnterData) => void; + /** + * it execs when fire the tree's dragover event + */ + onDragOver?: (props: OnDragOverData) => void; + /** + * it execs when fire the tree's dragleave event + */ + onDragLeave?: (props: OnDragLeaveData) => void; /** * event on drag drop */ onDrop?: (props: OnDropData) => void; + /** + * it execs when fire the tree's dragend event + */ + onDragEnd?: (props: OnDragEndData) => void; } export default class Tree extends Component { } From c0c5afcf499dd1be30aed75e7e90f02c5fd6c903 Mon Sep 17 00:00:00 2001 From: Holger Jeromin Date: Tue, 15 May 2018 14:39:13 +0200 Subject: [PATCH 134/575] fixing tests --- types/jquery/index.d.ts | 12 +++++++++++- types/jquery/jquery-tests.ts | 24 ++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/types/jquery/index.d.ts b/types/jquery/index.d.ts index d6f09cb54d..9f955ef9d2 100644 --- a/types/jquery/index.d.ts +++ b/types/jquery/index.d.ts @@ -4553,7 +4553,17 @@ interface JQuery extends Iterable * @since 1.7 */ on(events: string, - handler: JQuery.EventHandler | JQuery.EventHandlerBase> | ((event: JQueryEventObject) => void) | false): this; + handler: JQuery.EventHandler | JQuery.EventHandlerBase> | false): this; + /** + * Attach an event handler function for one or more events to the selected elements. + * + * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". + * @param handler A function to execute when the event is triggered. + * @see {@link https://api.jquery.com/on/} + * @since 1.7 + */ + on(events: string, + handler: ((event: JQueryEventObject) => void)): this; /** * Attach an event handler function for one or more events to the selected elements. * diff --git a/types/jquery/jquery-tests.ts b/types/jquery/jquery-tests.ts index 7375c5e814..5beb6c1a6e 100644 --- a/types/jquery/jquery-tests.ts +++ b/types/jquery/jquery-tests.ts @@ -3709,6 +3709,30 @@ function JQuery() { event; }); + // $ExpectType JQuery + $('table').on('myEvent', function(event: JQueryInputEventObject) { + // $ExpectType HTMLElement + this; + // $ExpectType JQueryInputEventObject + event; + }); + + // $ExpectType JQuery + $('table').on('myEvent', function(event: JQueryMouseEventObject) { + // $ExpectType HTMLElement + this; + // $ExpectType JQueryMouseEventObject + event; + }); + + // $ExpectType JQuery + $('table').on('myEvent', function(event: JQueryKeyEventObject) { + // $ExpectType HTMLElement + this; + // $ExpectType JQueryKeyEventObject + event; + }); + // $ExpectType JQuery $('table').on('myEvent', function(this: I1, event) { // $ExpectType I1 From 68b3a85dfeb9e25cd7208658418c3b90561c2f27 Mon Sep 17 00:00:00 2001 From: Holger Jeromin Date: Tue, 15 May 2018 14:48:40 +0200 Subject: [PATCH 135/575] fixing trailing whitespace --- types/jquery/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/jquery/index.d.ts b/types/jquery/index.d.ts index 9f955ef9d2..981993e2d7 100644 --- a/types/jquery/index.d.ts +++ b/types/jquery/index.d.ts @@ -4558,12 +4558,12 @@ interface JQuery extends Iterable * Attach an event handler function for one or more events to the selected elements. * * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". - * @param handler A function to execute when the event is triggered. + * @param handler A function to execute when the event is triggered. * @see {@link https://api.jquery.com/on/} * @since 1.7 */ on(events: string, - handler: ((event: JQueryEventObject) => void)): this; + handler: ((event: JQueryEventObject) => void)): this; /** * Attach an event handler function for one or more events to the selected elements. * From b4fed84066e23a469b91ef66ad0d7dc5ba44cb21 Mon Sep 17 00:00:00 2001 From: Holger Jeromin Date: Tue, 15 May 2018 15:34:55 +0200 Subject: [PATCH 136/575] add DocumentFragement to allowed jQuery objects --- types/jquery/index.d.ts | 2 +- types/jquery/jquery-tests.ts | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/types/jquery/index.d.ts b/types/jquery/index.d.ts index 8422f3ec5c..634771e4e7 100644 --- a/types/jquery/index.d.ts +++ b/types/jquery/index.d.ts @@ -5565,7 +5565,7 @@ interface Iterable { } declare namespace JQuery { type TypeOrArray = T | T[]; - type Node = Element | Text | Comment; + type Node = Element | Text | Comment | DocumentFragment; /** * A string is designated htmlString in jQuery documentation when it is used to represent one or more diff --git a/types/jquery/jquery-tests.ts b/types/jquery/jquery-tests.ts index 5d6aaf0680..0e68fcee2c 100644 --- a/types/jquery/jquery-tests.ts +++ b/types/jquery/jquery-tests.ts @@ -5153,7 +5153,7 @@ function JQuery() { function manipulation() { function after() { // $ExpectType JQuery - $('p').after('

', new Element(), new Text(), $('p').contents(), [new Element(), new Text(), $('p').contents()]); + $('p').after('

', new Element(), new Text(), $('p').contents(), [new Element(), new Text(), $('p').contents()], document.createDocumentFragment()); // $ExpectType JQuery $('p').after(function(index, html) { @@ -5218,7 +5218,7 @@ function JQuery() { function append() { // $ExpectType JQuery - $('p').append('

', new Element(), new Text(), $('p').contents(), [new Element(), new Text(), $('p').contents()]); + $('p').append('

', new Element(), new Text(), $('p').contents(), [new Element(), new Text(), $('p').contents()], document.createDocumentFragment()); // $ExpectType JQuery $('p').append(function(index, html) { @@ -5286,7 +5286,7 @@ function JQuery() { function before() { // $ExpectType JQuery - $('p').before('

', new Element(), new Text(), $('p').contents(), [new Element(), new Text(), $('p').contents()]); + $('p').before('

', new Element(), new Text(), $('p').contents(), [new Element(), new Text(), $('p').contents()], document.createDocumentFragment()); // $ExpectType JQuery $('p').before(function(index, html) { @@ -5351,7 +5351,7 @@ function JQuery() { function prepend() { // $ExpectType JQuery - $('p').prepend('

', new Element(), new Text(), $('p').contents(), [new Element(), new Text()], [new Element(), $('p').contents()]); + $('p').prepend('

', new Element(), new Text(), $('p').contents(), [new Element(), new Text()], [new Element(), $('p').contents()], document.createDocumentFragment()); // $ExpectType JQuery $('p').prepend(function(index, html) { From d7407e11715519331531b202f25599c114a8c8f7 Mon Sep 17 00:00:00 2001 From: Jason Unger Date: Tue, 15 May 2018 09:50:10 -0400 Subject: [PATCH 137/575] Clean up type declarations --- types/react-radio-group/index.d.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/types/react-radio-group/index.d.ts b/types/react-radio-group/index.d.ts index 3dfa872527..5c3e6092ab 100644 --- a/types/react-radio-group/index.d.ts +++ b/types/react-radio-group/index.d.ts @@ -2,22 +2,20 @@ // Project: https://github.com/chenglou/react-radio-group // Definitions by: Jason Unger // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; -type Value = React.InputHTMLAttributes['value']; - export namespace Radio { - export type RadioProps = React.InputHTMLAttributes; + type RadioProps = React.InputHTMLAttributes; } export const Radio: React.ComponentClass; export namespace RadioGroup { - export interface RadioGroupProps { + interface RadioGroupProps { name?: string; - selectedValue?: Value; - onChange?: (value: Value) => void; + selectedValue?: React.InputHTMLAttributes['value']; + onChange?: (value: React.InputHTMLAttributes['value']) => void; Component?: string | React.ReactElement>; } } From 63211a477b67d9ffbcf62613dc2ab7a41e14130a Mon Sep 17 00:00:00 2001 From: Jason Unger Date: Tue, 15 May 2018 09:51:32 -0400 Subject: [PATCH 138/575] Update test to set state on change --- types/react-radio-group/react-radio-group-tests.tsx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/types/react-radio-group/react-radio-group-tests.tsx b/types/react-radio-group/react-radio-group-tests.tsx index 76e093059b..d34d7d05ff 100644 --- a/types/react-radio-group/react-radio-group-tests.tsx +++ b/types/react-radio-group/react-radio-group-tests.tsx @@ -1,15 +1,20 @@ import * as React from 'react'; import { Radio, RadioGroup } from "react-radio-group"; -class ReactRadioGroup extends React.Component { - handleChange: RadioGroup.RadioGroupProps['onChange'] = value => { - console.log(value); +class ReactRadioGroup extends React.Component['value'] }> { + state = { + selectedValue: 2, + }; + + handleChange: RadioGroup.RadioGroupProps['onChange'] = selectedValue => { + console.log(selectedValue); + this.setState({ selectedValue }); } render() { return (
- + From c20e3f91b0c2d161b0a0a0a553ae301785aadef8 Mon Sep 17 00:00:00 2001 From: Vincent Langlet Date: Tue, 15 May 2018 15:57:16 +0200 Subject: [PATCH 139/575] Improve tests --- types/react-native/test/globals.tsx | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/types/react-native/test/globals.tsx b/types/react-native/test/globals.tsx index a6488cef82..b5eae800b1 100644 --- a/types/react-native/test/globals.tsx +++ b/types/react-native/test/globals.tsx @@ -1,3 +1,26 @@ const fetchCopy: GlobalFetch['fetch'] = fetch; -const requestInfoAsString: RequestInfo = 'request'; +const myHeaders = new Headers(); +myHeaders.append('Content-Type', 'image/jpeg'); + +const myInit: RequestInit = { + method: 'GET', + headers: myHeaders, + mode: 'cors', +}; + +const myRequest = new Request('flowers.jpg'); + +fetch(myRequest, myInit).then((response) => { + console.log(response.type); + console.log(response.url); + console.log(response.status); + console.log(response.ok); + console.log(response.statusText); + console.log(response.headers); + + return response.blob(); +}).then((blob) => { + const init = { status: 200, statusText: 'SuperSmashingGreat!' } + const myResponse = new Response(blob, init); +}) From d96a4c4398dfdb0b2bc359b5bef609905de4f14a Mon Sep 17 00:00:00 2001 From: Andy Date: Tue, 15 May 2018 07:47:34 -0700 Subject: [PATCH 140/575] globalize: convert to module (#25618) --- .../globalize-compiler-tests.ts | 2 +- types/globalize-compiler/index.d.ts | 4 +- types/globalize/index.d.ts | 672 +++++++++--------- 3 files changed, 340 insertions(+), 338 deletions(-) diff --git a/types/globalize-compiler/globalize-compiler-tests.ts b/types/globalize-compiler/globalize-compiler-tests.ts index 648ed40032..ae1f93cad2 100644 --- a/types/globalize-compiler/globalize-compiler-tests.ts +++ b/types/globalize-compiler/globalize-compiler-tests.ts @@ -1,6 +1,6 @@ import * as ESTree from "estree"; +import globalize = require("globalize"); import * as globalizeCompiler from "globalize-compiler"; -const globalize: GlobalizeStatic = null; let extractsArray: globalizeCompiler.FormatterOrParserFunction[]; diff --git a/types/globalize-compiler/index.d.ts b/types/globalize-compiler/index.d.ts index 6f3874636a..382aa52efb 100644 --- a/types/globalize-compiler/index.d.ts +++ b/types/globalize-compiler/index.d.ts @@ -3,8 +3,8 @@ // Definitions by: Ian Clanton-Thuon // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// import * as ESTree from "estree"; +import globalize = require("globalize"); interface CompileTemplateOptions { /** @@ -35,7 +35,7 @@ interface ExtractFunction { * * @returns an Array with the formatters and parsers created using the passed Globalize. */ - (globalize: GlobalizeStatic): FormatterOrParserFunction[]; + (globalize: Globalize.Static): FormatterOrParserFunction[]; } interface CompileExtractsAttributes extends CompileOptions { diff --git a/types/globalize/index.d.ts b/types/globalize/index.d.ts index 6ec31883aa..0e6b8537fd 100644 --- a/types/globalize/index.d.ts +++ b/types/globalize/index.d.ts @@ -2,342 +2,344 @@ // Project: https://github.com/jquery/globalize // Definitions by: Grégoire Castre , Aram Taieb // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// Note: You'll need the cldr.js definition file to use the globalize (https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/cldr.js) -/// +import * as Cldr from "cldrjs"; -interface DateFormatterOptions { - /** - * String value indicating a skeleton (see description above), eg. { skeleton: "GyMMMd" }. - * Skeleton provides a more flexible formatting mechanism than the predefined list full, long, medium, or short represented by date, time, or datetime. - * Instead, they are an open-ended list of patterns containing only date field information, and in a canonical order. - */ - skeleton?: string; - /** - * One of the following String values: full, long, medium, or short, eg. { date: "full" }. - */ - date?: "full" | "long" | "medium" | "short"; - /** - * One of the following String values: full, long, medium, or short, eg. { time: "full" }. - */ - time?: "full" | "long" | "medium" | "short"; - /** - * One of the following String values: full, long, medium, or short, eg. { datetime: "full" } - */ - datetime?: "full" | "long" | "medium" | "short"; - /** - * String value indicating a machine raw pattern (anything in the "Sym." column) eg. { raw: "dd/mm" }. - * Note this is NOT recommended for i18n in general. Use skeleton instead. - */ - raw?: string; +declare var globalize: globalize.Static; +export as namespace Globalize; +export = globalize; - /** - * String based on the time zone names of the IANA time zone database, - * such as "Asia/Shanghai", "Asia/Kolkata", "America/New_York". - */ - timeZone?: string; +declare namespace globalize { + interface DateFormatterOptions { + /** + * String value indicating a skeleton (see description above), eg. { skeleton: "GyMMMd" }. + * Skeleton provides a more flexible formatting mechanism than the predefined list full, long, medium, or short represented by date, time, or datetime. + * Instead, they are an open-ended list of patterns containing only date field information, and in a canonical order. + */ + skeleton?: string; + /** + * One of the following String values: full, long, medium, or short, eg. { date: "full" }. + */ + date?: "full" | "long" | "medium" | "short"; + /** + * One of the following String values: full, long, medium, or short, eg. { time: "full" }. + */ + time?: "full" | "long" | "medium" | "short"; + /** + * One of the following String values: full, long, medium, or short, eg. { datetime: "full" } + */ + datetime?: "full" | "long" | "medium" | "short"; + /** + * String value indicating a machine raw pattern (anything in the "Sym." column) eg. { raw: "dd/mm" }. + * Note this is NOT recommended for i18n in general. Use skeleton instead. + */ + raw?: string; + + /** + * String based on the time zone names of the IANA time zone database, + * such as "Asia/Shanghai", "Asia/Kolkata", "America/New_York". + */ + timeZone?: string; + } + + interface CommonNumberFormatterOptions { + /** + * Non-negative integer Number value indicating the minimum integer digits to be used. Numbers will be padded with leading zeroes if necessary. + */ + minimumIntegerDigits?: number; + /** + * Non-negative integer Number values indicating the minimum and maximum fraction digits to be used. + * Numbers will be rounded or padded with trailing zeroes if necessary. + * Either one or both of these properties must be present. + * If they are, they will override minimum and maximum fraction digits derived from the CLDR patterns. + */ + minimumFractionDigits?: number; + /** + * Non-negative integer Number values indicating the minimum and maximum fraction digits to be used. + * Numbers will be rounded or padded with trailing zeroes if necessary. + * Either one or both of these properties must be present. + * If they are, they will override minimum and maximum fraction digits derived from the CLDR patterns. + */ + maximumFractionDigits?: number; + /** + * Positive integer Number values indicating the minimum and maximum fraction digits to be shown. + * Either none or both of these properties are present + * If they are, they override minimum and maximum integer and fraction digits. + * The formatter uses however many integer and fraction digits are required to display the specified number of significant digits. + */ + minimumSignificantDigits?: number; + /** + * Positive integer Number values indicating the minimum and maximum fraction digits to be shown. + * Either none or both of these properties are present. + * If they are, they override minimum and maximum integer and fraction digits. + * The formatter uses however many integer and fraction digits are required to display the specified number of significant digits. + */ + maximumSignificantDigits?: number; + /** + * String with rounding method ceil, floor, round (default), or truncate. + */ + round?: "ceil" | "floor" | "round" | "truncate"; + /** + * Boolean (default is true) value indicating whether a grouping separator should be used. + */ + useGrouping?: boolean; + } + + interface NumberFormatterOptions extends CommonNumberFormatterOptions { + /** + * decimal (default), or percent + */ + style?: "decimal" | "percent"; + } + + interface CurrencyFormatterOptions extends CommonNumberFormatterOptions { + /** + * symbol (default), accounting, code or name. + */ + style?: "symbol" | "accounting" | "code" | "name"; + } + + interface NumberParserOptions { + /** + * decimal (default), or percent. + */ + style?: "decimal" | "percent"; + } + + interface PluralGeneratorOptions { + /** + * cardinal (default), or ordinal. + */ + type?: "cardinal" | "ordinal"; + } + + interface RelativeTimeFormatterOptions { + /** + * eg. "short" or "narrow". Or falsy for default long form + */ + form?: "short" | "narrow"; + } + + interface UnitFormatterOptions { + /** + * form: [String] eg. "long", "short" or "narrow". + */ + form?: "long" | "short" | "narrow"; + + /** + * numberFormatter: [Function] a number formatter function. Defaults to Globalize .numberFormatter() for the current locale using the default options. + */ + numberFormatter?: NumberFormatterOptions; + } + + interface Static { + cldr: Cldr.CldrStatic; + + /** + * Globalize.loadTimeZone ( ianaTzData, ... ) + * This method allows you to load IANA time zone data to enable options.timeZone feature on date formatters and parsers. + * @param {Object} ianaTzData A JSON object with zdumped IANA timezone data. Get the data via https://github.com/rxaviers/iana-tz-data + */ + loadTimeZone(ianaTzData: Object): void; + + /** + * Globalize.load( json, ... ) + * @param {Object} [JSON] + * Load resolved or unresolved cldr data. + * Somewhat equivalent to previous Globalize.addCultureInfo(...). + */ + load(json: Object): void; + + /** + * Globalize.locale() + * Return the default Cldr instance. + */ + locale(): Cldr.CldrStatic; + + /** + * Globalize.locale( [locale] ) + * @param {string} locale + * Set default Cldr instance + * Return the default Cldr instance. + */ + + locale(locale: string): Cldr.CldrStatic; + /** + * Globalize.locale( cldr ) + * @param {Cldr} cldr [Cldr instance] + * Set default Cldr instance + * Return the default Cldr instance. + */ + locale(cldr: Cldr.CldrStatic): Cldr.CldrStatic; + + /** + * .dateFormatter( options ) + * @param {DateFormatterOptions} options see date/expand_pattern for more info. + * @returns {Function} Return a function that formats a date according to the given `options` and the default/instance locale. + */ + dateFormatter(options?: DateFormatterOptions): (value: Date) => string; + + //Return a function that parses a string representing a date into a JavaScript Date object according to the given options. The default parsing assumes numeric year, month, and day (i.e., { skeleton: "yMd" }). + dateParser(options?: DateFormatterOptions): (value: string) => Date; + + //Alias for .dateFormatter( [options] )( value ). + formatDate(value: Date, options?: DateFormatterOptions): string; + /** + * Alias for .dateParser( [options] )( value ). + * @param {string} value The object whose module id you wish to determine. + * @param {DateFormatterOptions} options The object whose module id you wish to determine. + * @returns {Date} Return the value as a Date. + */ + parseDate(value: string, options?: DateFormatterOptions): Date; + + /** + * Load messages data. + * @param {Object} json JSON object of messages data. Keys can use any character, except /, { and }. Values (i.e., the message content itself) can contain any character. + * @returns {void} + */ + loadMessages(json: Object): void; + /** + * Return a function that formats a message (using ICU message format pattern) given its path and a set of variables into a user-readable string. It supports pluralization and gender inflections. + * @param path String or Array containing the path of the message content, eg. "greetings/bye", or [ "greetings", "bye" ]. + * @returns {Function} Return A function that formats a message (using ICU message format pattern) given its path and a set of variables into a user-readable string. It supports pluralization and gender inflections. + */ + messageFormatter(path: string | string[]): (variables?: string | string[] | Object) => string; + + /** + * Formats a message (using ICU message format pattern) given its path and a set of variables into a user-readable string + * @param path String or Array containing the path of the message content, eg. "greetings/bye", or [ "greetings", "bye" ]. + * @param variables Variables can be Objects, where each property can be referenced by name inside a message; or Arrays, where each entry of the Array can be used inside a message, using numeric indices. When passing one or more arguments of other types, they're converted to an Array and used as such. + * @returns {string} Return a user-readable string. + */ + formatMessage(path: string | string[], variables?: string | string[] | Object): string + + /** + * Return a function that formats a number according to the given options or locale's defaults. + * @param {NumberFormatterOptions} options A JSON object including none or any of the following options. + * style Optional String decimal (default), or percent. + * minimumIntegerDigits Optional Non-negative integer Number value indicating the minimum integer digits to be used. Numbers will be padded with leading zeroes if necessary. + * minimumFractionDigits and maximumFractionDigits Optional Non-negative integer Number values indicating the minimum and maximum fraction digits to be used. Numbers will be rounded or padded with trailing zeroes if necessary. Either one or both of these properties must be present. If they are, they will override minimum and maximum fraction digits derived from the CLDR patterns. + * minimumSignificantDigits and maximumSignificantDigits Optional Positive integer Number values indicating the minimum and maximum fraction digits to be shown. Either none or both of these properties are present. If they are, they override minimum and maximum integer and fraction digits. The formatter uses however many integer and fraction digits are required to display the specified number of significant digits. + * round Optional String with rounding method ceil, floor, round (default), or truncate. + * useGrouping Optional Boolean (default is true) value indicating whether a grouping separator should be used. + * @returns {Function} Return a function that formats a number according to the given options. + */ + numberFormatter(options?: NumberFormatterOptions): (value: number) => string; + + /** + * Return a function that parses a string representing a number according to the given options or locale's defaults. + * @param {NumberParserOptions} options A JSON object including none or any of the following options. + * style Optional String decimal (default), or percent. + * @returns {Function} Return a function that parses a String representing a number according to the given options. If value is invalid, NaN is returned. + */ + numberParser(options?: NumberParserOptions): (value: string) => number + + /** + * Return a number formatted according to the given options or locale's defaults. + * @param {number} value The number to format + * @param {NumberFormatterOptions} options A JSON object including none or any of the following options. + * style Optional String decimal (default), or percent. + * minimumIntegerDigits Optional Non-negative integer Number value indicating the minimum integer digits to be used. Numbers will be padded with leading zeroes if necessary. + * minimumFractionDigits and maximumFractionDigits Optional Non-negative integer Number values indicating the minimum and maximum fraction digits to be used. Numbers will be rounded or padded with trailing zeroes if necessary. Either one or both of these properties must be present. If they are, they will override minimum and maximum fraction digits derived from the CLDR patterns. + * minimumSignificantDigits and maximumSignificantDigits Optional Positive integer Number values indicating the minimum and maximum fraction digits to be shown. Either none or both of these properties are present. If they are, they override minimum and maximum integer and fraction digits. The formatter uses however many integer and fraction digits are required to display the specified number of significant digits. + * round Optional String with rounding method ceil, floor, round (default), or truncate. + * useGrouping Optional Boolean (default is true) value indicating whether a grouping separator should be used. + * @returns {string} Return the number formatted + */ + formatNumber(value: number, options?: NumberFormatterOptions): string; + + /** + * A function that parses a string representing a number according to the given options or locale's defaults. + * @param {string} value The number as string to parse + * @param {NumberParserOptions} options A JSON object including none or any of the following options. + * style Optional String decimal (default), or percent. + * @returns {number} Return a number according to the given options. If value is invalid, NaN is returned. + */ + parseNumber(value: string, options?: NumberParserOptions): number; + + /** + * Return a function that formats a currency according to the given options or locale's defaults. + * The returned function is invoked with one argument: the Number value to be formatted. + * @param {string} currency 3-letter currency code as defined by ISO 4217, eg. USD. + * @param {CurrencyFormatterOptions} options A JSON object including none or any of the following options. + * @returns {Function} Return a function that formats a currency + */ + currencyFormatter(currency: string, options?: CurrencyFormatterOptions): (value: number) => string; + + /** + * Return a currency formatted according to the given options or locale's defaults. + * @param {number} value The value to format. + * @param {string} currency 3-letter currency code as defined by ISO 4217, eg. USD. + * @param {CurrencyFormatterOptions} options A JSON object including none or any of the following options. + * @returns {string} Return a string formatted in the currency according to the value and the options + */ + formatCurrency(value: number, currency: string, options?: CurrencyFormatterOptions): string; + + /** + * Return a function that returns the value's corresponding plural group: zero, one, two, few, many, or other. + * The returned function is invoked with one argument: the Number value for which to return the plural group. + * @param {PluralGeneratorOptions} options A JSON object including none or any of the following options. + * type Optional String cardinal (default), or ordinal. + * @returns {Function} Return a function that returns the value's corresponding plural group: zero, one, two, few, many, or other. + */ + pluralGenerator(options?: PluralGeneratorOptions): (value: number) => string; + + /** + * Returns the value's corresponding plural group: zero, one, two, few, many, or other. + * @param {number} value A Number for which to return the plural group. + * @param {PluralGeneratorOptions} options A JSON object including none or any of the following options. + * type Optional String cardinal (default), or ordinal. + * @returns {string} Returns the value's corresponding plural group: zero, one, two, few, many, or other. + */ + plural(value: number, options?: PluralGeneratorOptions): string; + + /** + * Returns a function that formats a relative time according to the given unit, options, and the default/instance locale. + * The returned function is invoked with one argument: the number value to be formatted. + * @param unit String value indicating the unit to be formatted. eg. "day", "week", "month", etc. + * @param options form: [String] eg. "short" or "narrow". Or falsy for default long form. + * @returns {Function} Returns a function that formats a relative time according to the given unit. + */ + relativeTimeFormatter(unit: string, options?: RelativeTimeFormatterOptions): (value: number) => string; + + /** + * Return a relative time according to the given unit + * @param {number} value The number to be formatted. + * @param {string} unit String value indicating the unit to be formatted. eg. "day", "week", "month", etc. + * @param options form: [String] eg. "short" or "narrow". Or falsy for default long form. + * @returns {string} Return a relative time according to the given unit. + */ + formatRelativeTime(value: number, unit: string, options?: RelativeTimeFormatterOptions): string; + + /** + * Returns a function that formats a unit according to the given unit, options, and the default/instance locale. + * The returned function is invoked with one argument: the number value to be formatted. + * @param unit String value indicating the unit to be formatted. eg. "day", "week", "month", etc. Could also be a compound unit, eg. "mile-per-hour" or "mile/hour" + * @param options form: [String] eg. "long", "short" or "narrow". + * @returns {Function} Returns a function that formats a unit according to the given unit, options, and the default/instance locale. + */ + unitFormatter(unit: string, options?: UnitFormatterOptions): (value: number) => string; + + /** + * Alias for .unitFormatter( unit, options )( value ). + * @param {number} value The number to be formatted. + * @param {string} unit String value indicating the unit to be formatted. eg. "day", "week", "month", etc. Could also be a compound unit, eg. "mile-per-hour" or "mile/hour" + * @param {UnitFormatterOptions} options form: [String] eg. "long", "short" or "narrow". + * @returns {string} Returns the unit formatted. + */ + formatUnit(value: number, unit: string, options?: UnitFormatterOptions): string + + /** + * Create a Globalize instance. + * @param {string} Locale string of the instance. + * @returns {Globalize} A Globalize instance + */ + new (locale: string): Static; + /** + * Create a Globalize instance. + * @param cldr Cldr instance of the instance. + * @returns {Globalize} A Globalize instance + */ + new (cldr: Cldr.CldrStatic): Static; + } } - -interface CommonNumberFormatterOptions { - /** - * Non-negative integer Number value indicating the minimum integer digits to be used. Numbers will be padded with leading zeroes if necessary. - */ - minimumIntegerDigits?: number; - /** - * Non-negative integer Number values indicating the minimum and maximum fraction digits to be used. - * Numbers will be rounded or padded with trailing zeroes if necessary. - * Either one or both of these properties must be present. - * If they are, they will override minimum and maximum fraction digits derived from the CLDR patterns. - */ - minimumFractionDigits?: number; - /** - * Non-negative integer Number values indicating the minimum and maximum fraction digits to be used. - * Numbers will be rounded or padded with trailing zeroes if necessary. - * Either one or both of these properties must be present. - * If they are, they will override minimum and maximum fraction digits derived from the CLDR patterns. - */ - maximumFractionDigits?: number; - /** - * Positive integer Number values indicating the minimum and maximum fraction digits to be shown. - * Either none or both of these properties are present - * If they are, they override minimum and maximum integer and fraction digits. - * The formatter uses however many integer and fraction digits are required to display the specified number of significant digits. - */ - minimumSignificantDigits?: number; - /** - * Positive integer Number values indicating the minimum and maximum fraction digits to be shown. - * Either none or both of these properties are present. - * If they are, they override minimum and maximum integer and fraction digits. - * The formatter uses however many integer and fraction digits are required to display the specified number of significant digits. - */ - maximumSignificantDigits?: number; - /** - * String with rounding method ceil, floor, round (default), or truncate. - */ - round?: "ceil" | "floor" | "round" | "truncate"; - /** - * Boolean (default is true) value indicating whether a grouping separator should be used. - */ - useGrouping?: boolean; -} - -interface NumberFormatterOptions extends CommonNumberFormatterOptions { - /** - * decimal (default), or percent - */ - style?: "decimal" | "percent"; -} - -interface CurrencyFormatterOptions extends CommonNumberFormatterOptions { - /** - * symbol (default), accounting, code or name. - */ - style?: "symbol" | "accounting" | "code" | "name"; -} - -interface NumberParserOptions { - /** - * decimal (default), or percent. - */ - style?: "decimal" | "percent"; -} - -interface PluralGeneratorOptions { - /** - * cardinal (default), or ordinal. - */ - type?: "cardinal" | "ordinal"; -} - -interface RelativeTimeFormatterOptions { - /** - * eg. "short" or "narrow". Or falsy for default long form - */ - form?: "short" | "narrow"; -} - -interface UnitFormatterOptions { - /** - * form: [String] eg. "long", "short" or "narrow". - */ - form?: "long" | "short" | "narrow"; - - /** - * numberFormatter: [Function] a number formatter function. Defaults to Globalize .numberFormatter() for the current locale using the default options. - */ - numberFormatter?: NumberFormatterOptions; -} - -interface GlobalizeStatic { - - cldr: Cldr.CldrStatic; - - /** - * Globalize.loadTimeZone ( ianaTzData, ... ) - * This method allows you to load IANA time zone data to enable options.timeZone feature on date formatters and parsers. - * @param {Object} ianaTzData A JSON object with zdumped IANA timezone data. Get the data via https://github.com/rxaviers/iana-tz-data - */ - loadTimeZone(ianaTzData: Object): void; - - /** - * Globalize.load( json, ... ) - * @param {Object} [JSON] - * Load resolved or unresolved cldr data. - * Somewhat equivalent to previous Globalize.addCultureInfo(...). - */ - load(json: Object): void; - - /** - * Globalize.locale() - * Return the default Cldr instance. - */ - locale(): Cldr.CldrStatic; - - /** - * Globalize.locale( [locale] ) - * @param {string} locale - * Set default Cldr instance - * Return the default Cldr instance. - */ - - locale(locale: string): Cldr.CldrStatic; - /** - * Globalize.locale( cldr ) - * @param {Cldr} cldr [Cldr instance] - * Set default Cldr instance - * Return the default Cldr instance. - */ - locale(cldr: Cldr.CldrStatic): Cldr.CldrStatic; - - /** - * .dateFormatter( options ) - * @param {DateFormatterOptions} options see date/expand_pattern for more info. - * @returns {Function} Return a function that formats a date according to the given `options` and the default/instance locale. - */ - dateFormatter(options?: DateFormatterOptions): (value: Date) => string; - - //Return a function that parses a string representing a date into a JavaScript Date object according to the given options. The default parsing assumes numeric year, month, and day (i.e., { skeleton: "yMd" }). - dateParser(options?: DateFormatterOptions): (value: string) => Date; - - //Alias for .dateFormatter( [options] )( value ). - formatDate(value: Date, options?: DateFormatterOptions): string; - /** - * Alias for .dateParser( [options] )( value ). - * @param {string} value The object whose module id you wish to determine. - * @param {DateFormatterOptions} options The object whose module id you wish to determine. - * @returns {Date} Return the value as a Date. - */ - parseDate(value: string, options?: DateFormatterOptions): Date; - - /** - * Load messages data. - * @param {Object} json JSON object of messages data. Keys can use any character, except /, { and }. Values (i.e., the message content itself) can contain any character. - * @returns {void} - */ - loadMessages(json: Object): void; - /** - * Return a function that formats a message (using ICU message format pattern) given its path and a set of variables into a user-readable string. It supports pluralization and gender inflections. - * @param path String or Array containing the path of the message content, eg. "greetings/bye", or [ "greetings", "bye" ]. - * @returns {Function} Return A function that formats a message (using ICU message format pattern) given its path and a set of variables into a user-readable string. It supports pluralization and gender inflections. - */ - messageFormatter(path: string | string[]): (variables?: string | string[] | Object) => string; - - /** - * Formats a message (using ICU message format pattern) given its path and a set of variables into a user-readable string - * @param path String or Array containing the path of the message content, eg. "greetings/bye", or [ "greetings", "bye" ]. - * @param variables Variables can be Objects, where each property can be referenced by name inside a message; or Arrays, where each entry of the Array can be used inside a message, using numeric indices. When passing one or more arguments of other types, they're converted to an Array and used as such. - * @returns {string} Return a user-readable string. - */ - formatMessage(path: string | string[], variables?: string | string[] | Object): string - - /** - * Return a function that formats a number according to the given options or locale's defaults. - * @param {NumberFormatterOptions} options A JSON object including none or any of the following options. - * style Optional String decimal (default), or percent. - * minimumIntegerDigits Optional Non-negative integer Number value indicating the minimum integer digits to be used. Numbers will be padded with leading zeroes if necessary. - * minimumFractionDigits and maximumFractionDigits Optional Non-negative integer Number values indicating the minimum and maximum fraction digits to be used. Numbers will be rounded or padded with trailing zeroes if necessary. Either one or both of these properties must be present. If they are, they will override minimum and maximum fraction digits derived from the CLDR patterns. - * minimumSignificantDigits and maximumSignificantDigits Optional Positive integer Number values indicating the minimum and maximum fraction digits to be shown. Either none or both of these properties are present. If they are, they override minimum and maximum integer and fraction digits. The formatter uses however many integer and fraction digits are required to display the specified number of significant digits. - * round Optional String with rounding method ceil, floor, round (default), or truncate. - * useGrouping Optional Boolean (default is true) value indicating whether a grouping separator should be used. - * @returns {Function} Return a function that formats a number according to the given options. - */ - numberFormatter(options?: NumberFormatterOptions): (value: number) => string; - - /** - * Return a function that parses a string representing a number according to the given options or locale's defaults. - * @param {NumberParserOptions} options A JSON object including none or any of the following options. - * style Optional String decimal (default), or percent. - * @returns {Function} Return a function that parses a String representing a number according to the given options. If value is invalid, NaN is returned. - */ - numberParser(options?: NumberParserOptions): (value: string) => number - - /** - * Return a number formatted according to the given options or locale's defaults. - * @param {number} value The number to format - * @param {NumberFormatterOptions} options A JSON object including none or any of the following options. - * style Optional String decimal (default), or percent. - * minimumIntegerDigits Optional Non-negative integer Number value indicating the minimum integer digits to be used. Numbers will be padded with leading zeroes if necessary. - * minimumFractionDigits and maximumFractionDigits Optional Non-negative integer Number values indicating the minimum and maximum fraction digits to be used. Numbers will be rounded or padded with trailing zeroes if necessary. Either one or both of these properties must be present. If they are, they will override minimum and maximum fraction digits derived from the CLDR patterns. - * minimumSignificantDigits and maximumSignificantDigits Optional Positive integer Number values indicating the minimum and maximum fraction digits to be shown. Either none or both of these properties are present. If they are, they override minimum and maximum integer and fraction digits. The formatter uses however many integer and fraction digits are required to display the specified number of significant digits. - * round Optional String with rounding method ceil, floor, round (default), or truncate. - * useGrouping Optional Boolean (default is true) value indicating whether a grouping separator should be used. - * @returns {string} Return the number formatted - */ - formatNumber(value: number, options?: NumberFormatterOptions): string; - - /** - * A function that parses a string representing a number according to the given options or locale's defaults. - * @param {string} value The number as string to parse - * @param {NumberParserOptions} options A JSON object including none or any of the following options. - * style Optional String decimal (default), or percent. - * @returns {number} Return a number according to the given options. If value is invalid, NaN is returned. - */ - parseNumber(value: string, options?: NumberParserOptions): number; - - /** - * Return a function that formats a currency according to the given options or locale's defaults. - * The returned function is invoked with one argument: the Number value to be formatted. - * @param {string} currency 3-letter currency code as defined by ISO 4217, eg. USD. - * @param {CurrencyFormatterOptions} options A JSON object including none or any of the following options. - * @returns {Function} Return a function that formats a currency - */ - currencyFormatter(currency: string, options?: CurrencyFormatterOptions): (value: number) => string; - - /** - * Return a currency formatted according to the given options or locale's defaults. - * @param {number} value The value to format. - * @param {string} currency 3-letter currency code as defined by ISO 4217, eg. USD. - * @param {CurrencyFormatterOptions} options A JSON object including none or any of the following options. - * @returns {string} Return a string formatted in the currency according to the value and the options - */ - formatCurrency(value: number, currency: string, options?: CurrencyFormatterOptions): string; - - /** - * Return a function that returns the value's corresponding plural group: zero, one, two, few, many, or other. - * The returned function is invoked with one argument: the Number value for which to return the plural group. - * @param {PluralGeneratorOptions} options A JSON object including none or any of the following options. - * type Optional String cardinal (default), or ordinal. - * @returns {Function} Return a function that returns the value's corresponding plural group: zero, one, two, few, many, or other. - */ - pluralGenerator(options?: PluralGeneratorOptions): (value: number) => string; - - /** - * Returns the value's corresponding plural group: zero, one, two, few, many, or other. - * @param {number} value A Number for which to return the plural group. - * @param {PluralGeneratorOptions} options A JSON object including none or any of the following options. - * type Optional String cardinal (default), or ordinal. - * @returns {string} Returns the value's corresponding plural group: zero, one, two, few, many, or other. - */ - plural(value: number, options?: PluralGeneratorOptions): string; - - /** - * Returns a function that formats a relative time according to the given unit, options, and the default/instance locale. - * The returned function is invoked with one argument: the number value to be formatted. - * @param unit String value indicating the unit to be formatted. eg. "day", "week", "month", etc. - * @param options form: [String] eg. "short" or "narrow". Or falsy for default long form. - * @returns {Function} Returns a function that formats a relative time according to the given unit. - */ - relativeTimeFormatter(unit: string, options?: RelativeTimeFormatterOptions): (value: number) => string; - - /** - * Return a relative time according to the given unit - * @param {number} value The number to be formatted. - * @param {string} unit String value indicating the unit to be formatted. eg. "day", "week", "month", etc. - * @param options form: [String] eg. "short" or "narrow". Or falsy for default long form. - * @returns {string} Return a relative time according to the given unit. - */ - formatRelativeTime(value: number, unit: string, options?: RelativeTimeFormatterOptions): string; - - /** - * Returns a function that formats a unit according to the given unit, options, and the default/instance locale. - * The returned function is invoked with one argument: the number value to be formatted. - * @param unit String value indicating the unit to be formatted. eg. "day", "week", "month", etc. Could also be a compound unit, eg. "mile-per-hour" or "mile/hour" - * @param options form: [String] eg. "long", "short" or "narrow". - * @returns {Function} Returns a function that formats a unit according to the given unit, options, and the default/instance locale. - */ - unitFormatter(unit: string, options?: UnitFormatterOptions): (value: number) => string; - - /** - * Alias for .unitFormatter( unit, options )( value ). - * @param {number} value The number to be formatted. - * @param {string} unit String value indicating the unit to be formatted. eg. "day", "week", "month", etc. Could also be a compound unit, eg. "mile-per-hour" or "mile/hour" - * @param {UnitFormatterOptions} options form: [String] eg. "long", "short" or "narrow". - * @returns {string} Returns the unit formatted. - */ - formatUnit(value: number, unit: string, options?: UnitFormatterOptions): string - - /** - * Create a Globalize instance. - * @param {string} Locale string of the instance. - * @returns {Globalize} A Globalize instance - */ - new (locale: string): GlobalizeStatic; - /** - * Create a Globalize instance. - * @param cldr Cldr instance of the instance. - * @returns {Globalize} A Globalize instance - */ - new (cldr: Cldr.CldrStatic): GlobalizeStatic; -} - -declare var Globalize: GlobalizeStatic; From 57bf34b2305e4a345aad418dc0485f7f0601bdc3 Mon Sep 17 00:00:00 2001 From: Damian Bushong Date: Tue, 15 May 2018 09:48:56 -0500 Subject: [PATCH 141/575] Remove User "id" property from oauth2-server typings. This is no longer required as of v2. --- types/oauth2-server/index.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/types/oauth2-server/index.d.ts b/types/oauth2-server/index.d.ts index 06b6fbadb0..a4725538fd 100644 --- a/types/oauth2-server/index.d.ts +++ b/types/oauth2-server/index.d.ts @@ -327,7 +327,6 @@ declare namespace OAuth2Server { * A user object is completely transparent to oauth2-server and is simply used as input to model functions. */ interface User { - id: string; [key: string]: any; } From 2cdf91a8b37ab09161a74e98ca7fffd7d7b7daf8 Mon Sep 17 00:00:00 2001 From: Alan Plum Date: Tue, 15 May 2018 17:15:27 +0200 Subject: [PATCH 142/575] Add typings for rmfr --- types/rmfr/index.d.ts | 17 +++++++++++++++++ types/rmfr/rmfr-tests.ts | 39 +++++++++++++++++++++++++++++++++++++++ types/rmfr/tsconfig.json | 16 ++++++++++++++++ types/rmfr/tslint.json | 1 + 4 files changed, 73 insertions(+) create mode 100644 types/rmfr/index.d.ts create mode 100644 types/rmfr/rmfr-tests.ts create mode 100644 types/rmfr/tsconfig.json create mode 100644 types/rmfr/tslint.json diff --git a/types/rmfr/index.d.ts b/types/rmfr/index.d.ts new file mode 100644 index 0000000000..fc7c608e81 --- /dev/null +++ b/types/rmfr/index.d.ts @@ -0,0 +1,17 @@ +// Type definitions for rmfr 2.0 +// Project: https://github.com/shinnn/rmfr#readme +// Definitions by: Alan Plum +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.4 + +import rimraf = require("rimraf"); + +declare namespace rmfr { + type Options = rimraf.Options & { + glob?: rimraf.Options["glob"] | true; + disableGlob?: never; + }; +} +declare function rmfr(path: string, options?: rmfr.Options): Promise; + +export = rmfr; diff --git a/types/rmfr/rmfr-tests.ts b/types/rmfr/rmfr-tests.ts new file mode 100644 index 0000000000..efec2dd480 --- /dev/null +++ b/types/rmfr/rmfr-tests.ts @@ -0,0 +1,39 @@ +import rmfr = require("rmfr"); + +(async () => { + // happy + await rmfr("tmp_file"); + await rmfr("tmp_d*", {}); + await rmfr("../{tmp_d*,test.js}", { + glob: { + cwd: "node_modules", + ignore: "some_filename" + } + }); + await rmfr("test.js", { + glob: { + cwd: "this/directory/does/not/exist" + } + }); + + // $ExpectError + await rmfr(".gitignore", { unlink: (path, cb) => cb(new Error()) }); + // $ExpectError + await rmfr(); + // $ExpectError + await rmfr("<", { o: "O" }, "/"); + // $ExpectError + await rmfr(["1"], { glob: true }); + // $ExpectError + await rmfr("foo", 1); + // $ExpectError + await rmfr("foo", { chmod: new Set(["a"]) }); + // $ExpectError + await rmfr("foo", { + maxBusyTries: "foo", + emfileWait: "bar", + glob: "baz" + }); + // $ExpectError + await rmfr("foo", { disableGlob: true }); +})(); diff --git a/types/rmfr/tsconfig.json b/types/rmfr/tsconfig.json new file mode 100644 index 0000000000..cbe39dd006 --- /dev/null +++ b/types/rmfr/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "rmfr-tests.ts"] +} diff --git a/types/rmfr/tslint.json b/types/rmfr/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/rmfr/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From ae28bf8943f51911068626b8657d00db1479632f Mon Sep 17 00:00:00 2001 From: Alan Plum Date: Tue, 15 May 2018 17:38:46 +0200 Subject: [PATCH 143/575] Add mkdirp-promise typings --- types/mkdirp-promise/index.d.ts | 13 +++++++++++++ types/mkdirp-promise/mkdirp-promise-tests.ts | 6 ++++++ types/mkdirp-promise/tsconfig.json | 16 ++++++++++++++++ types/mkdirp-promise/tslint.json | 1 + 4 files changed, 36 insertions(+) create mode 100644 types/mkdirp-promise/index.d.ts create mode 100644 types/mkdirp-promise/mkdirp-promise-tests.ts create mode 100644 types/mkdirp-promise/tsconfig.json create mode 100644 types/mkdirp-promise/tslint.json diff --git a/types/mkdirp-promise/index.d.ts b/types/mkdirp-promise/index.d.ts new file mode 100644 index 0000000000..a4f389bca3 --- /dev/null +++ b/types/mkdirp-promise/index.d.ts @@ -0,0 +1,13 @@ +// Type definitions for mkdirp-promise 5.0 +// Project: https://github.com/ahmadnassri/mkdirp-promise +// Definitions by: Alan Plum +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +import mkdirp = require("mkdirp"); + +declare function mkdirpPromise( + path: string, + opts?: mkdirp.Mode | mkdirp.Options +): Promise; +export = mkdirpPromise; diff --git a/types/mkdirp-promise/mkdirp-promise-tests.ts b/types/mkdirp-promise/mkdirp-promise-tests.ts new file mode 100644 index 0000000000..28efeb0766 --- /dev/null +++ b/types/mkdirp-promise/mkdirp-promise-tests.ts @@ -0,0 +1,6 @@ +import mkdirpPromise = require("mkdirp-promise"); + +(async () => { + const path = await mkdirpPromise("hello"); + if (path) await mkdirpPromise(path, { mode: 123 }); +})(); diff --git a/types/mkdirp-promise/tsconfig.json b/types/mkdirp-promise/tsconfig.json new file mode 100644 index 0000000000..fd526f1aee --- /dev/null +++ b/types/mkdirp-promise/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "mkdirp-promise-tests.ts"] +} diff --git a/types/mkdirp-promise/tslint.json b/types/mkdirp-promise/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/mkdirp-promise/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From e818117186fa2d8b307be639575aeac7d586f9b1 Mon Sep 17 00:00:00 2001 From: Nick Holloway Date: Fri, 11 May 2018 17:54:20 +0100 Subject: [PATCH 144/575] Add definition for AWS Lambda Code Pipeline event --- types/aws-lambda/aws-lambda-tests.ts | 52 ++++++++++++++++++++++++++++ types/aws-lambda/index.d.ts | 48 +++++++++++++++++++++++++ 2 files changed, 100 insertions(+) diff --git a/types/aws-lambda/aws-lambda-tests.ts b/types/aws-lambda/aws-lambda-tests.ts index 9f9d7438e3..05b9033da7 100644 --- a/types/aws-lambda/aws-lambda-tests.ts +++ b/types/aws-lambda/aws-lambda-tests.ts @@ -525,6 +525,56 @@ function customAuthorizerCallback(cb: AWSLambda.CustomAuthorizerCallback) { cb(null, authResponse); } +/* CodePipeline events https://docs.aws.amazon.com/codepipeline/latest/userguide/actions-invoke-lambda-function.html#actions-invoke-lambda-function-json-event-example */ +const CodePipelineEvent: AWSLambda.CodePipelineEvent = { + "CodePipeline.job": { + id: "11111111-abcd-1111-abcd-111111abcdef", + accountId: "111111111111", + data: { + actionConfiguration: { + configuration: { + FunctionName: "MyLambdaFunctionForAWSCodePipeline", + UserParameters: "some-input-such-as-a-URL" + } + }, + inputArtifacts: [ + { + location: { + s3Location: { + bucketName: "the name of the bucket configured as the pipeline artifact store in Amazon S3, for example codepipeline-us-east-2-1234567890", + objectKey: "the name of the application, for example CodePipelineDemoApplication.zip" + }, + type: "S3" + }, + revision: null, + name: "ArtifactName" + } + ], + outputArtifacts: [], + artifactCredentials: { + secretAccessKey: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", + sessionToken: `MIICiTCCAfICCQD6m7oRw0uXOjANBgkqhkiG9w + 0BAQUFADCBiDELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAldBMRAwDgYDVQQHEwdTZ + WF0dGxlMQ8wDQYDVQQKEwZBbWF6b24xFDASBgNVBAsTC0lBTSBDb25zb2xlMRIw + EAYDVQQDEwlUZXN0Q2lsYWMxHzAdBgkqhkiG9w0BCQEWEG5vb25lQGFtYXpvbi5 + jb20wHhcNMTEwNDI1MjA0NTIxWhcNMTIwNDI0MjA0NTIxWjCBiDELMAkGA1UEBh + MCVVMxCzAJBgNVBAgTAldBMRAwDgYDVQQHEwdTZWF0dGxlMQ8wDQYDVQQKEwZBb + WF6b24xFDASBgNVBAsTC0lBTSBDb25zb2xlMRIwEAYDVQQDEwlUZXN0Q2lsYWMx + HzAdBgkqhkiG9w0BCQEWEG5vb25lQGFtYXpvbi5jb20wgZ8wDQYJKoZIhvcNAQE + BBQADgY0AMIGJAoGBAMaK0dn+a4GmWIWJ21uUSfwfEvySWtC2XADZ4nB+BLYgVI + k60CpiwsZ3G93vUEIO3IyNoH/f0wYK8m9TrDHudUZg3qX4waLG5M43q7Wgc/MbQ + ITxOUSQv7c7ugFFDzQGBzZswY6786m86gpEIbb3OhjZnzcvQAaRHhdlQWIMm2nr + AgMBAAEwDQYJKoZIhvcNAQEFBQADgYEAtCu4nUhVVxYUntneD9+h8Mg9q6q+auN + KyExzyLwaxlAoo7TJHidbtS4J5iNmZgXL0FkbFFBjvSfpJIlJ00zbhNYS5f6Guo + EDmFJl0ZxBHjJnyp378OD8uTs7fLvjx79LjSTbNYiytVbZPQUQ5Yaxu2jXnimvw + 3rrszlaEXAMPLE=`, + accessKeyId: "AKIAIOSFODNN7EXAMPLE" + }, + continuationToken: "A continuation token if continuing job" + } + } +}; + /* CloudFront events, see http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-event-structure.html */ const CloudFrontRequestEvent: AWSLambda.CloudFrontRequestEvent = { Records: [ @@ -750,6 +800,8 @@ let apiGtwProxyHandler: AWSLambda.APIGatewayProxyHandler = (event: AWSLambda.API let proxyHandler: AWSLambda.ProxyHandler = (event: AWSLambda.APIGatewayEvent, context: AWSLambda.Context, cb: AWSLambda.ProxyCallback) => { }; apiGtwProxyHandler = proxyHandler; +let codePipelineHandler: AWSLambda.CodePipelineHandler = (event: AWSLambda.CodePipelineEvent, context: AWSLambda.Context, cb: AWSLambda.Callback) => {}; + let cloudFrontRequestHandler: AWSLambda.CloudFrontRequestHandler = (event: AWSLambda.CloudFrontRequestEvent, context: AWSLambda.Context, cb: AWSLambda.CloudFrontRequestCallback) => { cb(); cb(null); diff --git a/types/aws-lambda/index.d.ts b/types/aws-lambda/index.d.ts index 7795c4cdfe..e8e305fd0a 100644 --- a/types/aws-lambda/index.d.ts +++ b/types/aws-lambda/index.d.ts @@ -501,6 +501,52 @@ export interface AuthResponseContext { [name: string]: any; } +/** + * CodePipeline events + * https://docs.aws.amazon.com/codepipeline/latest/userguide/actions-invoke-lambda-function.html + */ +export interface S3ArtifactLocation { + bucketName: string; + objectKey: string; +} +export interface S3ArtifactStore { + type: 'S3'; + s3Location: S3ArtifactLocation; +} + +export type ArtifactLocation = S3ArtifactStore; + +export interface Artifact { + name: string; + revision: string | null; + location: ArtifactLocation; +} + +export interface Credentials { + accessKeyId: string; + secretAccessKey: string; + sessionToken?: string; +} + +export interface CodePipelineEvent { + "CodePipeline.job": { + id: string; + accountId: string; + data: { + actionConfiguration: { + configuration: { + FunctionName: string; + UserParameters: string; + } + }; + inputArtifacts: Artifact[]; + outputArtifacts: Artifact[]; + artifactCredentials: Credentials; + continuationToken?: string; + }; + }; +} + /** * CloudFront events * http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-event-structure.html @@ -653,6 +699,8 @@ export type ProxyCallback = APIGatewayProxyCallback; // Old name // TODO: IoT +export type CodePipelineHandler = Handler; + export type CloudFrontRequestHandler = Handler; export type CloudFrontRequestCallback = Callback; From cab2b0c00635c52125f3ba7a7bbdf4b0f8362cfe Mon Sep 17 00:00:00 2001 From: yperess Date: Tue, 15 May 2018 12:16:24 -0400 Subject: [PATCH 145/575] Fix return type for RedisOptions.reconnectOnError As seen in the source https://github.com/luin/ioredis/blob/cf18554c142f461b3ad7ff716df596d7d1615828/lib/redis/parser.js#L50 the return values for the `reconnectOnError` functions should include `1` and `2`. --- types/ioredis/index.d.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/types/ioredis/index.d.ts b/types/ioredis/index.d.ts index bc3d656985..84ca51982a 100644 --- a/types/ioredis/index.d.ts +++ b/types/ioredis/index.d.ts @@ -798,7 +798,11 @@ declare namespace IORedis { * Fixed in: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/15858 */ retryStrategy?(times: number): number | false; - reconnectOnError?(error: Error): boolean; + /** + * 1/true means reconnect, 2 means reconnect and resend failed command. Returning false will ignore + * the error and do nothing. + */ + reconnectOnError?(error: Error): boolean | 1 | 2; /** * By default, if there is no active connection to the Redis server, commands are added to a queue * and are executed once the connection is "ready" (when enableReadyCheck is true, "ready" means From ab7ede4820deeb1a74f71ca41f0833b2626b0e4c Mon Sep 17 00:00:00 2001 From: Simon Schick Date: Tue, 15 May 2018 12:16:26 -0700 Subject: [PATCH 146/575] fix(vision): fix incorrect interface extension --- types/vision/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/vision/index.d.ts b/types/vision/index.d.ts index 757d2a5383..1c4e2ddc33 100644 --- a/types/vision/index.d.ts +++ b/types/vision/index.d.ts @@ -242,7 +242,7 @@ declare module 'hapi' { } declare module 'hapi' { - interface RouteOptions { + interface HandlerDecorations { /** * The view handler can be used with routes registered in the same realm as the view manager. * The handler takes an options parameter that can be either a string or an object. From 9ea396d9d6dc3984da3c12cf6446063b0169f46f Mon Sep 17 00:00:00 2001 From: Tommy Nguyen Date: Tue, 15 May 2018 20:38:24 +0200 Subject: [PATCH 147/575] [react-native] Add declarations for MessageQueue and BatchedBridge. --- types/react-native/BatchedBridge.d.ts | 23 +++++++++++++++++++++++ types/react-native/index.d.ts | 1 + 2 files changed, 24 insertions(+) create mode 100644 types/react-native/BatchedBridge.d.ts diff --git a/types/react-native/BatchedBridge.d.ts b/types/react-native/BatchedBridge.d.ts new file mode 100644 index 0000000000..0f1b02a0f4 --- /dev/null +++ b/types/react-native/BatchedBridge.d.ts @@ -0,0 +1,23 @@ +interface SpyData { + type: number; + module?: string; + method: string | number; + args: any[]; +} + +declare class MessageQueue { + static spy(spyOrToggle: boolean | ((data: SpyData) => void)): void; + + getCallableModule(name: string): Object; + registerCallableModule(name: string, module: Object): void; + registerLazyCallableModule(name: string, factory: () => Object): void; +} + +declare module "react-native/Libraries/BatchedBridge/BatchedBridge" { + const BatchedBridge: MessageQueue; + export default BatchedBridge; +} + +declare module "react-native/Libraries/BatchedBridge/MessageQueue" { + export default MessageQueue; +} diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index 0ad2e8279f..d8a2a9327a 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -27,6 +27,7 @@ /// /// +/// import * as React from 'react'; From 6744394a0aa73230d72b0f72620e2d11952c14f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Machist=C3=A9=20Quintana?= Date: Tue, 15 May 2018 14:04:28 -0700 Subject: [PATCH 148/575] Bump webpack typings to v4.4.x --- types/webpack/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/webpack/index.d.ts b/types/webpack/index.d.ts index fb8469dfa5..89b12ef1dd 100644 --- a/types/webpack/index.d.ts +++ b/types/webpack/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for webpack 4.1 +// Type definitions for webpack 4.4 // Project: https://github.com/webpack/webpack // Definitions by: Qubo // Benjamin Lim From 3ef1d0d822b95e8eb4ab5be16d8afb62095bdc9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Machist=C3=A9=20Quintana?= Date: Tue, 15 May 2018 14:42:52 -0700 Subject: [PATCH 149/575] Use the actual compilation.Chunk type instead of any --- types/webpack/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/webpack/index.d.ts b/types/webpack/index.d.ts index 89b12ef1dd..b49c235d30 100644 --- a/types/webpack/index.d.ts +++ b/types/webpack/index.d.ts @@ -560,7 +560,7 @@ declare namespace webpack { /** Assign modules to a cache group */ test?: ((...args: any[]) => boolean) | string | RegExp; /** Select chunks for determining cache group content (defaults to \"initial\", \"initial\" and \"all\" requires adding these chunks to the HTML) */ - chunks?: "initial" | "async" | "all" | ((chunk: any) => boolean); + chunks?: "initial" | "async" | "all" | ((chunk: compilation.Chunk) => boolean); /** Ignore minimum size, minimum chunks and maximum requests and always create chunks for this cache group */ enforce?: boolean; /** Priority of this cache group */ @@ -580,7 +580,7 @@ declare namespace webpack { } interface SplitChunksOptions { /** Select chunks for determining shared modules (defaults to \"async\", \"initial\" and \"all\" requires adding these chunks to the HTML) */ - chunks?: "initial" | "async" | "all" | ((chunk: any) => boolean); + chunks?: "initial" | "async" | "all" | ((chunk: compilation.Chunk) => boolean); /** Minimal size for the created chunk */ minSize?: number; /** Minimum number of times a module has to be duplicated until it's considered for splitting */ From c1c69f49136c0b172e85babee8fff3b6a60b58f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Machist=C3=A9=20Quintana?= Date: Tue, 15 May 2018 14:44:42 -0700 Subject: [PATCH 150/575] Update chunks function test to use updated type --- types/webpack/webpack-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/webpack/webpack-tests.ts b/types/webpack/webpack-tests.ts index d617c45a17..3f99d4704f 100644 --- a/types/webpack/webpack-tests.ts +++ b/types/webpack/webpack-tests.ts @@ -614,7 +614,7 @@ configuration = { cacheGroups: { common: { name: 'common', - chunks(chunk: { name: string }) { + chunks(chunk: webpack.compilation.Chunk) { const allowedChunks = [ 'renderer', 'component-window', From 2050335081cbeb7d449332405e160807c4330dce Mon Sep 17 00:00:00 2001 From: Lauren Budorick Date: Tue, 15 May 2018 17:00:09 -0700 Subject: [PATCH 151/575] Update mapbox-gl definitions --- types/mapbox-gl/index.d.ts | 147 +++++++++++++++++++++++++++++++------ 1 file changed, 123 insertions(+), 24 deletions(-) diff --git a/types/mapbox-gl/index.d.ts b/types/mapbox-gl/index.d.ts index ece34d0938..16f886c4a1 100644 --- a/types/mapbox-gl/index.d.ts +++ b/types/mapbox-gl/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Mapbox GL JS v0.44.1 +// Type definitions for Mapbox GL JS v0.45.0 // Project: https://github.com/mapbox/mapbox-gl-js // Definitions by: Dominik Bruderer , Patrick Reames // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -18,6 +18,7 @@ declare namespace mapboxgl { type LngLatBoundsLike = number[][] | LngLatLike[] | LngLatBounds; type PointLike = number[] | Point; type Expression = any[]; + type Anchor = 'center' | 'left' | 'right' | 'top' | 'bottom' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'; /** * Map @@ -33,8 +34,6 @@ declare namespace mapboxgl { removeControl(control: IControl): this; - getClasses(): string[]; - resize(): this; getBounds(): mapboxgl.LngLatBounds; @@ -53,6 +52,12 @@ declare namespace mapboxgl { unproject(point: PointLike): mapboxgl.LngLat; + isMoving(): boolean; + + isZooming(): boolean; + + isRotating(): boolean; + queryRenderedFeatures(pointOrBox?: PointLike | PointLike[], parameters?: { layers?: string[], filter?: any[] }): GeoJSON.Feature[]; querySourceFeatures(sourceID: string, parameters?: { sourceLayer?: string, filter?: any[] }): GeoJSON.Feature[]; @@ -199,9 +204,6 @@ declare namespace mapboxgl { /** initial map center */ center?: LngLatLike; - /** Style class names with which to initialize the map */ - classes?: string[]; - /** ID of the container element */ container?: string | Element; @@ -218,7 +220,7 @@ declare namespace mapboxgl { hash?: boolean; /** If true, map creation will fail if the implementation determines that the performance of the created WebGL context would be dramatically lower than expected. */ - failIfMayorPerformanceCaveat?: boolean; + failIfMajorPerformanceCaveat?: boolean; /** If false, no mouse, touch, or keyboard listeners are attached to the map, so it will not respond to input */ interactive?: boolean; @@ -420,6 +422,8 @@ declare namespace mapboxgl { */ export class ScaleControl extends Control { constructor(options?: { maxWidth?: number, unit?: string }) + + setUnit(unit: 'imperial' | 'metric' | 'nautical'): void; } /** @@ -457,7 +461,7 @@ declare namespace mapboxgl { closeOnClick?: boolean; - anchor?: 'top' | 'bottom' | 'left' | 'right' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'; + anchor?: Anchor; offset?: number | PointLike | { [key: string]: PointLike; }; } @@ -486,8 +490,11 @@ declare namespace mapboxgl { export interface Light { 'anchor'?: 'map' | 'viewport'; 'position'?: number[]; + 'position-transition'?: Transition; 'color'?: string; + 'color-transition'?: Transition; 'intensity'?: number; + 'intensity-transition'?: Transition; } export interface Source { @@ -526,6 +533,8 @@ declare namespace mapboxgl { clusterRadius?: number; clusterMaxZoom?: number; + + lineMetrics?: boolean; } /** @@ -578,7 +587,7 @@ declare namespace mapboxgl { coordinates: number[][]; - canvas: string; + canvas: string | HTMLCanvasElement; getCanvas(): HTMLCanvasElement; @@ -590,7 +599,7 @@ declare namespace mapboxgl { animate?: boolean; - canvas: string; + canvas: string | HTMLCanvasElement; } interface VectorSource extends Source { @@ -738,8 +747,13 @@ declare namespace mapboxgl { static convert(a: PointLike): Point; } + /** + * Marker + */ export class Marker { - constructor(element?: HTMLElement, options?: { offset?: PointLike }); + constructor(options?: mapboxgl.MarkerOptions); + + constructor(element?: HTMLElement, options?: mapboxgl.MarkerOptions); addTo(map: Map): this; @@ -760,6 +774,16 @@ declare namespace mapboxgl { togglePopup(): this; } + export interface MarkerOptions { + element?: HTMLElement; + + offset?: PointLike; + + anchor?: Anchor; + + color?: string + } + /** * Evented */ @@ -773,10 +797,6 @@ declare namespace mapboxgl { off(type?: string | any, layer?: string, listener?: Function): this; once(type: string, listener: Function): this; - - fire(type: string, data?: mapboxgl.EventData | Object): this; - - listens(type: string): boolean; } /** @@ -803,16 +823,20 @@ declare namespace mapboxgl { originalEvent: MouseEvent; point: mapboxgl.Point; lngLat: mapboxgl.LngLat; + preventDefault(): void; + defaultPrevented: boolean; } export class MapTouchEvent { type: string; - target: Map; + map: Map; originalEvent: TouchEvent; point: mapboxgl.Point; lngLat: mapboxgl.LngLat; points: Point[]; lngLats: LngLat[]; + preventDefault(): void; + defaultPrevented: boolean; } export class MapBoxZoomEvent { @@ -825,9 +849,19 @@ declare namespace mapboxgl { dataType: 'source' | 'style' | 'tile'; isSourceLoaded?: boolean; source?: mapboxgl.Source; + sourceDataType?: string; + tile?: any; coord?: any; } + export class MapWheelEvent { + type: string; + map: Map; + originalEvent: MouseEvent; + preventDefault(): void; + defaultPrevented: boolean; + } + /** * AnimationOptions */ @@ -921,11 +955,12 @@ declare namespace mapboxgl { drag?: { data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent }; dragend?: { data: mapboxgl.MapMouseEvent | mapboxgl.MapTouchEvent }; pitch?: { data: mapboxgl.EventData }; + wheel?: { data: mapboxgl.MapWheelEvent }; } export interface Layer { id: string; - type?: 'fill' | 'line' | 'symbol' | 'circle' | 'fill-extrusion' | 'raster' | 'background' | 'heatmap'; + type?: 'fill' | 'line' | 'symbol' | 'circle' | 'fill-extrusion' | 'raster' | 'background' | 'heatmap' | 'hillshade'; metadata?: any; ref?: string; @@ -940,8 +975,8 @@ declare namespace mapboxgl { interactive?: boolean; filter?: any[]; - layout?: BackgroundLayout | FillLayout | FillExtrusionLayout | LineLayout | SymbolLayout | RasterLayout | CircleLayout | HeatmapLayout; - paint?: BackgroundPaint | FillPaint | FillExtrusionPaint | LinePaint | SymbolPaint | RasterPaint | CirclePaint | HeatmapPaint; + layout?: BackgroundLayout | FillLayout | FillExtrusionLayout | LineLayout | SymbolLayout | RasterLayout | CircleLayout | HeatmapLayout | HillshadeLayout; + paint?: BackgroundPaint | FillPaint | FillExtrusionPaint | LinePaint | SymbolPaint | RasterPaint | CirclePaint | HeatmapPaint | HillshadePaint; } export interface StyleFunction { @@ -959,8 +994,11 @@ declare namespace mapboxgl { export interface BackgroundPaint { 'background-color'?: string | Expression; + 'background-color-transition'?: Transition; 'background-pattern'?: string; + 'background-pattern-transition'?: Transition; 'background-opacity'?: number | Expression; + 'background-opacity-transition'?: Transition; } export interface FillLayout { @@ -970,11 +1008,16 @@ declare namespace mapboxgl { export interface FillPaint { 'fill-antialias'?: boolean; 'fill-opacity'?: number | StyleFunction | Expression; + 'fill-opacity-transition'?: Transition; 'fill-color'?: string | StyleFunction | Expression; + 'fill-color-transition'?: Transition; 'fill-outline-color'?: string | StyleFunction | Expression; + 'fill-outline-color-transition'?: Transition; 'fill-translate'?: number[] | Expression; + 'fill-translate-transition'?: Transition; 'fill-translate-anchor'?: 'map' | 'viewport'; 'fill-pattern'?: string; + 'fill-pattern-transition'?: Transition; } export interface FillExtrusionLayout { @@ -983,12 +1026,18 @@ declare namespace mapboxgl { export interface FillExtrusionPaint { 'fill-extrusion-opacity'?: number | Expression; + 'fill-extrusion-opacity-transition'?: Transition; 'fill-extrusion-color'?: string | StyleFunction | Expression; + 'fill-extrusion-color-transition'?: Transition; 'fill-extrusion-translate'?: number[] | Expression; + 'fill-extrusion-translate-transition'?: Transition; 'fill-extrusion-translate-anchor'?: 'map' | 'viewport'; 'fill-extrusion-pattern'?: string; + 'fill-extrusion-pattern-transition'?: Transition; 'fill-extrusion-height'?: number | StyleFunction | Expression; + 'fill-extrusion-height-transition'?: Transition; 'fill-extrusion-base'?: number | StyleFunction | Expression; + 'fill-extrusion-base-transition'?: Transition; } export interface LineLayout { @@ -1002,16 +1051,25 @@ declare namespace mapboxgl { export interface LinePaint { 'line-opacity'?: number | StyleFunction | Expression; + 'line-opacity-transition'?: Transition; 'line-color'?: string | StyleFunction | Expression; + 'line-color-transition'?: Transition; 'line-translate'?: number[] | Expression; + 'line-translate-transition'?: Transition; 'line-translate-anchor'?: 'map' | 'viewport'; 'line-width'?: number | StyleFunction | Expression; + 'line-width-transition'?: Transition; 'line-gap-width'?: number | StyleFunction | Expression; + 'line-gap-width-transition'?: Transition; 'line-offset'?: number | StyleFunction | Expression; + 'line-offset-transition'?: Transition; 'line-blur'?: number | StyleFunction | Expression; + 'line-blur-transition'?: Transition; 'line-dasharray'?: number[]; 'line-dasharray-transition'?: Transition; 'line-pattern'?: string; + 'line-pattern-transition'?: Transition; + 'line-gradient'?: Expression; } export interface SymbolLayout { @@ -1024,7 +1082,6 @@ declare namespace mapboxgl { 'icon-ignore-placement'?: boolean; 'icon-optional'?: boolean; 'icon-rotation-alignment'?: 'map' | 'viewport' | 'auto'; - 'icon-pitch-alignment'?: 'map' | 'viewport' | 'auto'; 'icon-size'?: number | StyleFunction | Expression; 'icon-text-fit'?: 'none' | 'both' | 'width' | 'height'; 'icon-text-fit-padding'?: number[] | Expression; @@ -1033,6 +1090,8 @@ declare namespace mapboxgl { 'icon-padding'?: number | Expression; 'icon-keep-upright'?: boolean; 'icon-offset'?: number[] | StyleFunction | Expression; + 'icon-anchor'?: Anchor; + 'icon-pitch-alignment'?: 'map' | 'viewport' | 'auto'; 'text-pitch-alignment'?: 'map' | 'viewport' | 'auto'; 'text-rotation-alignment'?: 'map' | 'viewport' | 'auto'; 'text-field'?: string | StyleFunction; @@ -1042,7 +1101,7 @@ declare namespace mapboxgl { 'text-line-height'?: number | Expression; 'text-letter-spacing'?: number | Expression; 'text-justify'?: 'left' | 'center' | 'right'; - 'text-anchor'?: 'center' | 'left' | 'right' | 'top' | 'bottom' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'; + 'text-anchor'?: Anchor; 'text-max-angle'?: number | Expression; 'text-rotate'?: number | StyleFunction | Expression; 'text-padding'?: number | Expression; @@ -1052,23 +1111,34 @@ declare namespace mapboxgl { 'text-allow-overlap'?: boolean; 'text-ignore-placement'?: boolean; 'text-optional'?: boolean; - } export interface SymbolPaint { 'icon-opacity'?: number | StyleFunction | Expression; + 'icon-opacity-transition'?: Transition; 'icon-color'?: string | StyleFunction | Expression; + 'icon-color-transition'?: Transition; 'icon-halo-color'?: string | StyleFunction | Expression; + 'icon-halo-color-transition'?: Transition; 'icon-halo-width'?: number | StyleFunction | Expression; + 'icon-halo-width-transition'?: Transition; 'icon-halo-blur'?: number | StyleFunction | Expression; + 'icon-halo-blur-transition'?: Transition; 'icon-translate'?: number[] | Expression; + 'icon-translate-transition'?: Transition; 'icon-translate-anchor'?: 'map' | 'viewport'; 'text-opacity'?: number | StyleFunction | Expression; + 'text-opacity-transition'?: Transition; 'text-color'?: string | StyleFunction | Expression; + 'text-color-transition'?: Transition; 'text-halo-color'?: string | StyleFunction | Expression; + 'text-halo-color-transition'?: Transition; 'text-halo-width'?: number | StyleFunction | Expression; + 'text-halo-width-transition'?: Transition; 'text-halo-blur'?: number | StyleFunction | Expression; + 'text-halo-blur-transition'?: Transition; 'text-translate'?: number[] | Expression; + 'text-translate-transition'?: Transition; 'text-translate-anchor'?: 'map' | 'viewport'; } @@ -1078,11 +1148,17 @@ declare namespace mapboxgl { export interface RasterPaint { 'raster-opacity'?: number | Expression; + 'raster-opacity-transition'?: Transition; 'raster-hue-rotate'?: number | Expression; + 'raster-hue-rotate-transition'?: Transition; 'raster-brightness-min'?: number | Expression; + 'raster-brightness-min-transition'?: Transition; 'raster-brightness-max'?: number | Expression; + 'raster-brightness-max-transition'?: Transition; 'raster-saturation'?: number | Expression; + 'raster-saturation-transition'?: Transition; 'raster-contrast'?: number | Expression; + 'raster-contrast-transition'?: Transition; 'raster-fade-duration'?: number | Expression; } @@ -1094,16 +1170,22 @@ declare namespace mapboxgl { 'circle-radius'?: number | StyleFunction | Expression; 'circle-radius-transition'?: Transition; 'circle-color'?: string | StyleFunction | Expression; + 'circle-color-transition'?: Transition; 'circle-blur'?: number | StyleFunction | Expression; + 'circle-blur-transition'?: Transition; 'circle-opacity'?: number | StyleFunction | Expression; 'circle-opacity-transition'?: Transition; 'circle-translate'?: number[] | Expression; + 'circle-translate-transition'?: Transition; 'circle-translate-anchor'?: 'map' | 'viewport'; 'circle-pitch-scale'?: 'map' | 'viewport'; 'circle-pitch-alignment'?: 'map' | 'viewport'; 'circle-stroke-width'?: number | StyleFunction | Expression; + 'circle-stroke-width-transition'?: Transition; 'circle-stroke-color'?: string | StyleFunction | Expression; + 'circle-stroke-color-transition'?: Transition; 'circle-stroke-opacity'?: number | StyleFunction | Expression; + 'circle-stroke-opacity-transition'?: Transition; } export interface HeatmapLayout { @@ -1112,14 +1194,31 @@ declare namespace mapboxgl { export interface HeatmapPaint { 'heatmap-radius'?: number | Expression; - 'heatmap-transition'?: Transition; + 'heatmap-radius-transition'?: Transition; 'heatmap-weight'?: number | StyleFunction | Expression; 'heatmap-intensity'?: number | Expression; + 'heatmap-intensity-transition'?: Transition; 'heatmap-color'?: string | Expression; - 'heatmap-color-transition'?: Transition; 'heatmap-opacity'?: number | Expression; 'heatmap-opacity-transition'?: Transition; } + + export interface HillshadeLayout { + visibility?: 'visible' | 'none'; + } + + export interface HillshadePaint { + 'hillshade-illumination-direction'?: number | Expression; + 'hillshade-illumination-anchor'?: 'map' | 'viewport'; + 'hillshade-exaggeration'?: number | Expression; + 'hillshade-exaggeration-transition'?: Transition; + 'hillshade-shadow-color'?: string | Expression; + 'hillshade-shadow-color-transition'?: Transition; + 'hillshade-highlight-color'?: string | Expression; + 'hillshade-highlight-color-transition'?: Transition; + 'hillshade-accent-color'?: string | Expression; + 'hillshade-accent-color-transition'?: Transition; + } } declare module 'mapbox-gl' { From c2cd90a611ffc174be0c29c17d0388d054a8bbc7 Mon Sep 17 00:00:00 2001 From: spacejack Date: Tue, 15 May 2018 23:54:12 -0400 Subject: [PATCH 152/575] Add types for tail module --- types/tail/index.d.ts | 40 ++++++++++++++++++++++++++++++++++++++++ types/tail/test.ts | 26 ++++++++++++++++++++++++++ types/tail/tsconfig.json | 19 +++++++++++++++++++ types/tail/tslint.json | 3 +++ 4 files changed, 88 insertions(+) create mode 100644 types/tail/index.d.ts create mode 100644 types/tail/test.ts create mode 100644 types/tail/tsconfig.json create mode 100644 types/tail/tslint.json diff --git a/types/tail/index.d.ts b/types/tail/index.d.ts new file mode 100644 index 0000000000..00f80ab079 --- /dev/null +++ b/types/tail/index.d.ts @@ -0,0 +1,40 @@ +// Type definitions for tail 1.2 +// Project: https://github.com/lucagrulla/node-tail +// Definitions by: Mike Linkovich +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +declare namespace Tail { + interface TailOptions { + separator?: string | RegExp; + fromBeginning?: boolean; + fsWatchOptions?: Record; + follow?: boolean; + logger?: any; + encoding?: string; + useWatchFile?: boolean; + } + + interface Tail { + /** Callback to listen for newlines appended to file */ + on(eventType: 'line', cb: (data: any) => void): void; + /** Error callback */ + on(eventType: 'error', cb: (error: any) => void): void; + /** Stop watching file */ + unwatch(): void; + /** Start watching file if previously stopped */ + watch(): void; + } + + interface TailConstructor { + /** Creates a new Tail object that starts watching the specified file immediately. */ + new(filename: string, options?: TailOptions): Tail; + } + + interface Static { + Tail: TailConstructor; + } +} + +declare const Tail: Tail.Static; +export = Tail; diff --git a/types/tail/test.ts b/types/tail/test.ts new file mode 100644 index 0000000000..aa212a5b78 --- /dev/null +++ b/types/tail/test.ts @@ -0,0 +1,26 @@ +import { Tail } from 'tail'; + +const tail = new Tail("test.txt"); + +tail.on("line", data => { + console.log(data); +}); + +tail.on("error", error => { + console.log('ERROR: ', error); +}); + +tail.unwatch(); + +tail.watch(); + +// With options object +const tail2 = new Tail("test2.txt", { + separator: /[\r]{0,1}\n/, + fromBeginning: false, + fsWatchOptions: {}, + follow: true, + logger: console, + useWatchFile: false, + encoding: 'utf-8' +}); diff --git a/types/tail/tsconfig.json b/types/tail/tsconfig.json new file mode 100644 index 0000000000..20be91772d --- /dev/null +++ b/types/tail/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es2015", "dom"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "forceConsistentCasingInFileNames": true, + "noEmit": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [] + }, + "files": [ + "index.d.ts", + "test.ts" + ] +} diff --git a/types/tail/tslint.json b/types/tail/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/tail/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} From 9c7bda7995664b7f697fe637001ea54055765ee0 Mon Sep 17 00:00:00 2001 From: spacejack Date: Wed, 16 May 2018 00:08:20 -0400 Subject: [PATCH 153/575] Rename test file --- types/tail/{test.ts => tail-tests.ts} | 0 types/tail/tsconfig.json | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename types/tail/{test.ts => tail-tests.ts} (100%) diff --git a/types/tail/test.ts b/types/tail/tail-tests.ts similarity index 100% rename from types/tail/test.ts rename to types/tail/tail-tests.ts diff --git a/types/tail/tsconfig.json b/types/tail/tsconfig.json index 20be91772d..fbc4b5e0ff 100644 --- a/types/tail/tsconfig.json +++ b/types/tail/tsconfig.json @@ -14,6 +14,6 @@ }, "files": [ "index.d.ts", - "test.ts" + "tail-tests.ts" ] } From d12e4ba256dd80911ea21a63b828e48da16cd083 Mon Sep 17 00:00:00 2001 From: Bruno Lemos Date: Wed, 16 May 2018 01:30:49 -0300 Subject: [PATCH 154/575] [react-native] Image props should extend ImageStyle intead of ViewStyle --- types/react-native/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index 63f3157dfc..5fbc785e5a 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -3385,7 +3385,7 @@ export type ImageSourcePropType = ImageURISource | ImageURISource[] | ImageRequi /** * @see https://facebook.github.io/react-native/docs/image.html */ -export interface ImagePropsBase extends ImagePropsIOS, ImagePropsAndroid, AccessibilityProps, ViewStyle { +export interface ImagePropsBase extends ImagePropsIOS, ImagePropsAndroid, AccessibilityProps, ImageStyle { /** * onLayout function * From ad76e164ab712acc5ac5c5ba5cca197d02b60cfc Mon Sep 17 00:00:00 2001 From: knegusen Date: Wed, 16 May 2018 08:48:24 +0200 Subject: [PATCH 155/575] Added type definitions for react-collapsible --- types/react-collapsible/index.d.ts | 35 +++++++++++++++++++ .../react-collapsible-tests.tsx | 17 +++++++++ types/react-collapsible/tsconfig.json | 24 +++++++++++++ types/react-collapsible/tslint.json | 1 + 4 files changed, 77 insertions(+) create mode 100644 types/react-collapsible/index.d.ts create mode 100644 types/react-collapsible/react-collapsible-tests.tsx create mode 100644 types/react-collapsible/tsconfig.json create mode 100644 types/react-collapsible/tslint.json diff --git a/types/react-collapsible/index.d.ts b/types/react-collapsible/index.d.ts new file mode 100644 index 0000000000..f52e953684 --- /dev/null +++ b/types/react-collapsible/index.d.ts @@ -0,0 +1,35 @@ +// Type definitions for react-collapsible 2.2 +// Project: https://github.com/glennflanagan/react-collapsible#readme +// Definitions by: knegusen +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export interface CollapsibleProp { + children?: string | React.ReactNode; + transitionTime?: number; + transitionCloseTime?: number; + triggerTagName?: string; + easing?: string; + open?: boolean; + classParentString?: string; + openedClassName?: string; + triggerStyle?: object; + triggerClassName?: string; + triggerOpenedClassName?: string; + contentOuterClassName?: string; + contentInnerClassName?: string; + accordionPosition?: string | number; + handleTriggerClick?: (accordionPosition?: string | number) => void; + onOpen?: () => void; + onClose?: () => void; + onOpening?: () => void; + onClosing?: () => void; + trigger?: string | React.ReactNode; + triggerWhenOpen?: string | React.ReactNode; + triggerDisabled?: boolean; + lazyRender?: boolean; + overflowWhenOpen?: 'hidden' | 'visible' | 'auto' | 'scroll' | 'inherit' | 'initial' | 'unset'; + triggerSibling?: React.ReactNode | string | (() => void); + tabIndex?: number; +} + +export default class Collapsible extends React.Component {} diff --git a/types/react-collapsible/react-collapsible-tests.tsx b/types/react-collapsible/react-collapsible-tests.tsx new file mode 100644 index 0000000000..69050d6b8c --- /dev/null +++ b/types/react-collapsible/react-collapsible-tests.tsx @@ -0,0 +1,17 @@ +import Collapsible from "react-collapsible"; +import * as React from "react"; + +const Component = ( +
+ +

+ This is the collapsible content. It can be any element or React + component you like. +

+

+ It can even be another Collapsible component. Check out the next + section! +

+
+
+); diff --git a/types/react-collapsible/tsconfig.json b/types/react-collapsible/tsconfig.json new file mode 100644 index 0000000000..a75a29a44a --- /dev/null +++ b/types/react-collapsible/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "jsx": "react", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "react-collapsible-tests.tsx" + ] +} diff --git a/types/react-collapsible/tslint.json b/types/react-collapsible/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-collapsible/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From a4bb93652611df2859712cefc36b92ff75aa9226 Mon Sep 17 00:00:00 2001 From: knegusen Date: Wed, 16 May 2018 08:55:50 +0200 Subject: [PATCH 156/575] Specify version of typescript in declaration file --- types/react-collapsible/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/react-collapsible/index.d.ts b/types/react-collapsible/index.d.ts index f52e953684..ad56aba34e 100644 --- a/types/react-collapsible/index.d.ts +++ b/types/react-collapsible/index.d.ts @@ -2,7 +2,9 @@ // Project: https://github.com/glennflanagan/react-collapsible#readme // Definitions by: knegusen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 +import * as React from "react"; export interface CollapsibleProp { children?: string | React.ReactNode; transitionTime?: number; From ddac6e2625089bdb1e40091ea21097a9d08390b0 Mon Sep 17 00:00:00 2001 From: Bruno Lemos Date: Wed, 16 May 2018 03:35:00 -0300 Subject: [PATCH 157/575] [react-native] Add tests for ImageStyle and ViewStyle as props --- types/react-native/test/index.tsx | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/types/react-native/test/index.tsx b/types/react-native/test/index.tsx index 0bd0309963..f51c041b8c 100644 --- a/types/react-native/test/index.tsx +++ b/types/react-native/test/index.tsx @@ -22,6 +22,7 @@ import { DataSourceAssetCallback, DeviceEventEmitterStatic, Dimensions, + Image, ImageStyle, InteractionManager, ListView, @@ -462,4 +463,24 @@ class StatusBarTest extends React.Component { } } +class StylePropsTest extends React.PureComponent { + render() { + const uri = 'https://seeklogo.com/images/T/typescript-logo-B29A3F462D-seeklogo.com.png' + + return ( + + + + ); + } +} + const listViewDataSourceTest = new ListView.DataSource({rowHasChanged: () => true}) From cf5dd197b379cd6cdf3072c6d724e22372ef87f3 Mon Sep 17 00:00:00 2001 From: Bruno Lemos Date: Wed, 16 May 2018 03:45:45 -0300 Subject: [PATCH 158/575] [react-native] [Image] Disable broken props: width, height and tintColor --- types/react-native/index.d.ts | 8 ++++++++ types/react-native/test/index.tsx | 7 ++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index 5fbc785e5a..bb4c163ac5 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -3494,6 +3494,14 @@ export interface ImagePropsBase extends ImagePropsIOS, ImagePropsAndroid, Access * A unique identifier for this element to be used in UI Automation testing scripts. */ testID?: string; + + /** + * Currently broken + * @see https://github.com/facebook/react-native/pull/19281 + */ + width?: never, + height?: never, + tintColor?: never, } export interface ImageProps extends ImagePropsBase { diff --git a/types/react-native/test/index.tsx b/types/react-native/test/index.tsx index f51c041b8c..b3487057ed 100644 --- a/types/react-native/test/index.tsx +++ b/types/react-native/test/index.tsx @@ -471,12 +471,13 @@ class StylePropsTest extends React.PureComponent { ); From abe1825055ff967255fa698b97a2fcac81b6c9b6 Mon Sep 17 00:00:00 2001 From: Edward Sammut Alessi Date: Wed, 16 May 2018 10:52:50 +0200 Subject: [PATCH 159/575] Typings for react-native-multi-slider --- types/react-native-multi-slider/index.d.ts | 145 ++++++++++++++++++ .../react-native-multi-slider-tests.tsx | 68 ++++++++ types/react-native-multi-slider/tsconfig.json | 24 +++ types/react-native-multi-slider/tslint.json | 1 + 4 files changed, 238 insertions(+) create mode 100644 types/react-native-multi-slider/index.d.ts create mode 100644 types/react-native-multi-slider/react-native-multi-slider-tests.tsx create mode 100644 types/react-native-multi-slider/tsconfig.json create mode 100644 types/react-native-multi-slider/tslint.json diff --git a/types/react-native-multi-slider/index.d.ts b/types/react-native-multi-slider/index.d.ts new file mode 100644 index 0000000000..9e1a94c2f0 --- /dev/null +++ b/types/react-native-multi-slider/index.d.ts @@ -0,0 +1,145 @@ +// Type definitions for react-native-multi-slider 0.3 +// Project: https://github.com/JackDanielsAndCode/react-native-multi-slider#readme +// Definitions by: Edward Sammut Alessi +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import * as React from "react"; +import { ViewStyle } from "react-native"; + +export interface MarkerProps { + pressed?: number; + markerStyle?: ViewStyle; + pressedMarkerStyle?: ViewStyle; + value?: number; +} + +export interface MutliSliderProps { + /** + * An array containing one or two values (determines one or two markers respectively) that are the initial marker values. + * Note these must be possible values from your set up. + * + * Default [0] + */ + values?: number[]; + + /** + * Function to be called at beginning of press + */ + onValuesChangeStart?: () => void; + + /** + * Function called after every change in value, with current values passed in as an array. + */ + onValuesChange?: (change: number[]) => void; + + /** + * Function called on end of press with final values passed in as an array + */ + onValuesChangeFinish?: (change: number[]) => void; + + /** + * Width of track + * + * Default 280 + */ + sliderLength?: number; + + /** + * TODO + */ + sliderOrientation?: "horizontal" | "vertical"; + + /** + * Area to be touched, should enclose the whole marker. + * Will be automatically centered and contain the marker. + * Slip displacement If finger leaves the marker measures distance before responder cuts out and changes are no + * longer registered, if not given marker will be active until pressed released. + */ + touchDimensions?: { + height: number; + width: number; + borderRadius: number; + slipDisplacement: number; + }; + + customMarker?: React.ComponentType; + + /** + * Slider min value corresponding to far left + * + * Default 0 + */ + min?: number; + + /** + * Slider max value corresponding to far right + * + * Default 10 + */ + max?: number; + + /** + * The step size between values. Make sure min max range is divisible by this to get expected results + * + * Default 1 + */ + step?: number; + + /** + * Array of values corresponding to the slider's position (left to right on slider index 0 to end respectively). + * Values of any type can be inserted and the slider will simply give them back in the callbacks + */ + optionsArray?: number[]; + + /** + * Style of sliders container, note be careful in applying styles that may affect the children's (i.e. the slider's) positioning + * + * Default { height: 30 } + */ + containerStyle?: ViewStyle; + + /** + * Customise the track + * + * Default { borderRadius: 7, height: 3.5 } + */ + trackStyle?: ViewStyle; + + /** + * Style for the track up to a single marker or between double markers + * + * Default { backgroundColor: 'blue' } + */ + selectedStyle?: ViewStyle; + + /** + * Style for remaining track + * + * Default { backgroundColor: 'grey' } + */ + unselectedStyle?: ViewStyle; + + /** + * Customise the marker's style + * + * Default { + * height:30, + * width: 30, + * borderRadius: 15, + * backgroundColor:'#E8E8E8', + * borderWidth: 0.5, + * borderColor: 'grey', + * } + */ + markerStyle?: ViewStyle; + + /** + * Style to be given to marker when pressed + * + * Default { backgroundColor:'#D3D3D3' } + */ + pressedMarkerStyle?: ViewStyle; +} + +export default class MultiSlider extends React.Component {} diff --git a/types/react-native-multi-slider/react-native-multi-slider-tests.tsx b/types/react-native-multi-slider/react-native-multi-slider-tests.tsx new file mode 100644 index 0000000000..1bb7a3ad4f --- /dev/null +++ b/types/react-native-multi-slider/react-native-multi-slider-tests.tsx @@ -0,0 +1,68 @@ +import * as React from "react"; +import { View } from "react-native"; +import MultiSlider from "react-native-multi-slider"; + +class SliderTest extends React.Component { + getInitialState() { + return { + sliderOneChanging: false, + sliderOneValue: [ 5 ], + }; + } + + SliderOneValuesChangeStart() { + return true; + } + + SliderOneValuesChange(values: number[]) { + return values[0]; + } + + SliderOneValuesChangeFinish() { + return false; + } + + /** + * Examples as from https://github.com/JackDanielsAndCode/react-native-multi-slider/blob/master/index.ios.js + */ + render() { + return ( + + + + + + } + sliderLength={280} + /> + + ); + } +} diff --git a/types/react-native-multi-slider/tsconfig.json b/types/react-native-multi-slider/tsconfig.json new file mode 100644 index 0000000000..c67d12e21d --- /dev/null +++ b/types/react-native-multi-slider/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "jsx": "react-native", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "react-native-multi-slider-tests.tsx" + ] +} diff --git a/types/react-native-multi-slider/tslint.json b/types/react-native-multi-slider/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-native-multi-slider/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 5de0032929854a282ded0a04930fd1e2fb62a636 Mon Sep 17 00:00:00 2001 From: Edward Sammut Alessi Date: Wed, 16 May 2018 11:04:10 +0200 Subject: [PATCH 160/575] Typings for extract-files --- types/extract-files/extract-files-tests.ts | 9 +++++++++ types/extract-files/index.d.ts | 20 +++++++++++++++++++ types/extract-files/tsconfig.json | 23 ++++++++++++++++++++++ types/extract-files/tslint.json | 1 + 4 files changed, 53 insertions(+) create mode 100644 types/extract-files/extract-files-tests.ts create mode 100644 types/extract-files/index.d.ts create mode 100644 types/extract-files/tsconfig.json create mode 100644 types/extract-files/tslint.json diff --git a/types/extract-files/extract-files-tests.ts b/types/extract-files/extract-files-tests.ts new file mode 100644 index 0000000000..862f29d5f3 --- /dev/null +++ b/types/extract-files/extract-files-tests.ts @@ -0,0 +1,9 @@ +import { ReactNativeFile, ReactNativeFileOptions } from "extract-files"; + +const options: ReactNativeFileOptions = { + name: "", + type: "", + uri: "", +}; + +new ReactNativeFile(options); diff --git a/types/extract-files/index.d.ts b/types/extract-files/index.d.ts new file mode 100644 index 0000000000..1cbbc215c3 --- /dev/null +++ b/types/extract-files/index.d.ts @@ -0,0 +1,20 @@ +// Type definitions for extract-files 3.1 +// Project: https://github.com/jaydenseric/extract-files#readme +// Definitions by: My Self +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export interface ReactNativeFileOptions { + uri: string; + type: string; + name: string; +} + +export class ReactNativeFile { + uri: string; + type: string; + name: string; + + constructor(options: ReactNativeFileOptions); + + static list(files: ReactNativeFileOptions[]): ReactNativeFile[]; +} diff --git a/types/extract-files/tsconfig.json b/types/extract-files/tsconfig.json new file mode 100644 index 0000000000..6c462da54e --- /dev/null +++ b/types/extract-files/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", + "extract-files-tests.ts" + ] +} diff --git a/types/extract-files/tslint.json b/types/extract-files/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/extract-files/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 29586ecded460a01998370259c02e499fb4b8a2d Mon Sep 17 00:00:00 2001 From: Edward Sammut Alessi Date: Wed, 16 May 2018 11:05:52 +0200 Subject: [PATCH 161/575] Update index.d.ts Fix TS version due to react's higher TS version --- types/react-native-multi-slider/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-native-multi-slider/index.d.ts b/types/react-native-multi-slider/index.d.ts index 9e1a94c2f0..2b6ed2ac2a 100644 --- a/types/react-native-multi-slider/index.d.ts +++ b/types/react-native-multi-slider/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/JackDanielsAndCode/react-native-multi-slider#readme // Definitions by: Edward Sammut Alessi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from "react"; import { ViewStyle } from "react-native"; From ddc97f58b3421d065ca415c6c29b80c959935b5f Mon Sep 17 00:00:00 2001 From: Edward Sammut Alessi Date: Wed, 16 May 2018 11:15:44 +0200 Subject: [PATCH 162/575] Update index.d.ts Update maintainer name --- types/extract-files/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/extract-files/index.d.ts b/types/extract-files/index.d.ts index 1cbbc215c3..412dc09a98 100644 --- a/types/extract-files/index.d.ts +++ b/types/extract-files/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for extract-files 3.1 // Project: https://github.com/jaydenseric/extract-files#readme -// Definitions by: My Self +// Definitions by: Edward Sammut Alessi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export interface ReactNativeFileOptions { From 7007542e784f343a1d9e9a16ef7991a27f656bd6 Mon Sep 17 00:00:00 2001 From: Holger Jeromin Date: Wed, 16 May 2018 11:29:25 +0200 Subject: [PATCH 163/575] adding JQueryEventObject to all on handlers and fix tests --- types/jquery/index.d.ts | 44 ++++++++++++++++++++++++++++++++++-- types/jquery/jquery-tests.ts | 32 ++++++++++++++++++++++++++ 2 files changed, 74 insertions(+), 2 deletions(-) diff --git a/types/jquery/index.d.ts b/types/jquery/index.d.ts index 981993e2d7..9aa6be68a2 100644 --- a/types/jquery/index.d.ts +++ b/types/jquery/index.d.ts @@ -4517,6 +4517,21 @@ interface JQuery extends Iterable selector: JQuery.Selector | null, data: TData, handler: JQuery.EventHandler | JQuery.EventHandlerBase>): this; + /** + * Attach an event handler function for one or more events to the selected elements. + * + * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the + * selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. + * @see {@link https://api.jquery.com/on/} + * @since 1.7 + */ + on(events: string, + selector: JQuery.Selector | null, + data: TData, + handler: ((event: JQueryEventObject) => void)): this; // tslint:disable-line:unified-signatures /** * Attach an event handler function for one or more events to the selected elements. * @@ -4532,6 +4547,19 @@ interface JQuery extends Iterable selector: JQuery.Selector, handler: JQuery.EventHandler | JQuery.EventHandlerBase> | false): this; /** + * Attach an event handler function for one or more events to the selected elements. + * + * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the + * selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param handler A function to execute when the event is triggered. + * @see {@link https://api.jquery.com/on/} + * @since 1.7 + */ + on(events: string, + selector: JQuery.Selector, + handler: ((event: JQueryEventObject) => void)): this; // tslint:disable-line:unified-signatures + /** * Attach an event handler function for one or more events to the selected elements. * * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". @@ -4543,7 +4571,19 @@ interface JQuery extends Iterable on(events: string, data: TData, handler: JQuery.EventHandler | JQuery.EventHandlerBase>): this; - /** + /** + * Attach an event handler function for one or more events to the selected elements. + * + * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. + * @see {@link https://api.jquery.com/on/} + * @since 1.7 + */ + on(events: string, + data: TData, + handler: ((event: JQueryEventObject) => void)): this; // tslint:disable-line:unified-signatures +/** * Attach an event handler function for one or more events to the selected elements. * * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". @@ -4563,7 +4603,7 @@ interface JQuery extends Iterable * @since 1.7 */ on(events: string, - handler: ((event: JQueryEventObject) => void)): this; + handler: ((event: JQueryEventObject) => void)): this; // tslint:disable-line:unified-signatures /** * Attach an event handler function for one or more events to the selected elements. * diff --git a/types/jquery/jquery-tests.ts b/types/jquery/jquery-tests.ts index 5beb6c1a6e..0cceb359b5 100644 --- a/types/jquery/jquery-tests.ts +++ b/types/jquery/jquery-tests.ts @@ -3634,6 +3634,14 @@ function JQuery() { event; }); + // $ExpectType JQuery + $('table').on('myEvent', 'td', 'myData', function(event: JQueryEventObject) { + // $ExpectType HTMLElement + this; + // $ExpectType JQueryEventObject + event; + }); + // $ExpectType JQuery $('table').on('myEvent', 'td', 'myData', function(this: I1, event) { // $ExpectType I1 @@ -3650,6 +3658,14 @@ function JQuery() { event; }); + // $ExpectType JQuery + $('table').on('myEvent', null, 'myData', function(event: JQueryEventObject) { + // $ExpectType HTMLElement + this; + // $ExpectType JQueryEventObject + event; + }); + // $ExpectType JQuery $('table').on('myEvent', null, 'myData', function(this: I1, event) { // $ExpectType I1 @@ -3666,6 +3682,14 @@ function JQuery() { event; }); + // $ExpectType JQuery + $('table').on('myEvent', 'td', function(event: JQueryEventObject) { + // $ExpectType HTMLElement + this; + // $ExpectType JQueryEventObject + event; + }); + // $ExpectType JQuery $('table').on('myEvent', 'td', function(this: I1, event) { // $ExpectType I1 @@ -3685,6 +3709,14 @@ function JQuery() { event; }); + // $ExpectType JQuery + $('table').on('myEvent', 3, function(event: JQueryEventObject) { + // $ExpectType HTMLElement + this; + // $ExpectType JQueryEventObject + event; + }); + // $ExpectType JQuery $('table').on('myEvent', 3, function(this: I1, event) { // $ExpectType I1 From 18f8612b62a88530c33d8444d9249c83f885867f Mon Sep 17 00:00:00 2001 From: Edward Sammut Alessi Date: Wed, 16 May 2018 11:36:12 +0200 Subject: [PATCH 164/575] Update index.d.ts Fix typo --- types/react-native-multi-slider/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/react-native-multi-slider/index.d.ts b/types/react-native-multi-slider/index.d.ts index 2b6ed2ac2a..a3a5f39c63 100644 --- a/types/react-native-multi-slider/index.d.ts +++ b/types/react-native-multi-slider/index.d.ts @@ -14,7 +14,7 @@ export interface MarkerProps { value?: number; } -export interface MutliSliderProps { +export interface MultiSliderProps { /** * An array containing one or two values (determines one or two markers respectively) that are the initial marker values. * Note these must be possible values from your set up. @@ -142,4 +142,4 @@ export interface MutliSliderProps { pressedMarkerStyle?: ViewStyle; } -export default class MultiSlider extends React.Component {} +export default class MultiSlider extends React.Component {} From cda7bba75c60c9d7e6473db4981aa8b79eada7c4 Mon Sep 17 00:00:00 2001 From: Holger Jeromin Date: Wed, 16 May 2018 11:47:48 +0200 Subject: [PATCH 165/575] asterisks fix --- types/jquery/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/jquery/index.d.ts b/types/jquery/index.d.ts index 9aa6be68a2..be4b2f2346 100644 --- a/types/jquery/index.d.ts +++ b/types/jquery/index.d.ts @@ -4559,7 +4559,7 @@ interface JQuery extends Iterable on(events: string, selector: JQuery.Selector, handler: ((event: JQueryEventObject) => void)): this; // tslint:disable-line:unified-signatures - /** + /** * Attach an event handler function for one or more events to the selected elements. * * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". @@ -4571,7 +4571,7 @@ interface JQuery extends Iterable on(events: string, data: TData, handler: JQuery.EventHandler | JQuery.EventHandlerBase>): this; - /** + /** * Attach an event handler function for one or more events to the selected elements. * * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". @@ -4583,7 +4583,7 @@ interface JQuery extends Iterable on(events: string, data: TData, handler: ((event: JQueryEventObject) => void)): this; // tslint:disable-line:unified-signatures -/** + /** * Attach an event handler function for one or more events to the selected elements. * * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". From 63fb6fdcb46cfb53490240a3f5d84f4091f62630 Mon Sep 17 00:00:00 2001 From: Tommy Nguyen Date: Wed, 16 May 2018 13:21:57 +0200 Subject: [PATCH 166/575] fixup! [react-native] Add declarations for MessageQueue and BatchedBridge. --- types/react-native/BatchedBridge.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/react-native/BatchedBridge.d.ts b/types/react-native/BatchedBridge.d.ts index 0f1b02a0f4..dd63f73087 100644 --- a/types/react-native/BatchedBridge.d.ts +++ b/types/react-native/BatchedBridge.d.ts @@ -15,9 +15,9 @@ declare class MessageQueue { declare module "react-native/Libraries/BatchedBridge/BatchedBridge" { const BatchedBridge: MessageQueue; - export default BatchedBridge; + export = BatchedBridge; } declare module "react-native/Libraries/BatchedBridge/MessageQueue" { - export default MessageQueue; + export = MessageQueue; } From 18d941bfe0513cf8750fc4ba39feda337bb186a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wang=20D=C3=A0p=C3=A9ng?= Date: Wed, 16 May 2018 19:24:05 +0800 Subject: [PATCH 167/575] Update http-assert assert definition `assert` should support `assert(value, 500, { toast: 'custom error message' })` --- types/http-assert/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/http-assert/index.d.ts b/types/http-assert/index.d.ts index aac93be123..37609bffda 100644 --- a/types/http-assert/index.d.ts +++ b/types/http-assert/index.d.ts @@ -10,6 +10,7 @@ * @param opts custom properties to attach to the error object */ declare function assert(value: any, status?: number, msg?: string, opts?: {}): void; +declare function assert(value: any, status?: number, opts?: {}): void; declare namespace assert { /** From 5f5b3f1cb0d1fa587c097eeee106983f807972d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wang=20D=C3=A0p=C3=A9ng?= Date: Wed, 16 May 2018 19:30:06 +0800 Subject: [PATCH 168/575] Update http-assert version --- types/http-assert/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/http-assert/index.d.ts b/types/http-assert/index.d.ts index 37609bffda..e48d69fa59 100644 --- a/types/http-assert/index.d.ts +++ b/types/http-assert/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for http-assert 1.2 +// Type definitions for http-assert 1.3 // Project: https://github.com/jshttp/http-assert // Definitions by: jKey Lu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 41b4cf88d9a7e1d38d1ac8a5512071810090680b Mon Sep 17 00:00:00 2001 From: Vincent Fabioux Date: Wed, 16 May 2018 13:43:46 +0200 Subject: [PATCH 169/575] [rc-tree] Fix incorrect right click, mouse enter and mouse leave props type. --- types/rc-tree/index.d.ts | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/types/rc-tree/index.d.ts b/types/rc-tree/index.d.ts index e8cdb487e6..1ec7cc1e26 100644 --- a/types/rc-tree/index.d.ts +++ b/types/rc-tree/index.d.ts @@ -69,6 +69,21 @@ export interface SelectData { event: "select"; } +export interface OnRightClickData { + event: Event; + node: InternalTreeNode; +} + +export interface OnMouseEnterData { + event: Event; + node: InternalTreeNode; +} + +export interface OnMouseLeaveData { + event: Event; + node: InternalTreeNode; +} + export interface OnDragStartData { event: Event; node: InternalTreeNode; @@ -204,15 +219,15 @@ export interface TreeProps { /** * select current treeNode and show customized contextmenu */ - onRightClick?: (node: InternalTreeNode) => void; + onRightClick?: (props: OnRightClickData) => void; /** * call when mouse enter a treeNode */ - onMouseEnter?: (node: InternalTreeNode) => void; + onMouseEnter?: (props: OnMouseEnterData) => void; /** * call when mouse leave a treeNode */ - onMouseLeave?: (node: InternalTreeNode) => void; + onMouseLeave?: (props: OnMouseLeaveData) => void; /** * whether can drag treeNode. */ From b31d9543ea371e290f6e771fec4dd5cca9250abd Mon Sep 17 00:00:00 2001 From: "rheese.burgess" Date: Wed, 16 May 2018 12:57:33 +0100 Subject: [PATCH 170/575] [matter.js] Added damping to constraints --- types/matter-js/index.d.ts | 28 +++++++++++++++++++++++++++- types/matter-js/matter-js-tests.ts | 3 ++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/types/matter-js/index.d.ts b/types/matter-js/index.d.ts index ffca8627d0..4275785191 100644 --- a/types/matter-js/index.d.ts +++ b/types/matter-js/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Matter.js - 0.10.0 +// Type definitions for Matter.js - 0.10.1 // Project: https://github.com/liabru/matter-js // Definitions by: Ivane Gegia , // David Asmuth , @@ -1629,6 +1629,19 @@ declare namespace Matter { */ stiffness?: number; + /** + * A `Number` that specifies the damping of the constraint, + * i.e. the amount of resistance applied to each body based on their velocities to limit the amount of oscillation. + * Damping will only be apparent when the constraint also has a very low `stiffness`. + * A value of `0.1` means the constraint will apply heavy damping, resulting in little to no oscillation. + * A value of `0` means the constraint will apply no damping. + * + * @property damping + * @type number + * @default 0 + */ + damping?: number; + /** * A `String` denoting the type of object. * @@ -1772,6 +1785,19 @@ declare namespace Matter { */ stiffness: number; + /** + * A `Number` that specifies the damping of the constraint, + * i.e. the amount of resistance applied to each body based on their velocities to limit the amount of oscillation. + * Damping will only be apparent when the constraint also has a very low `stiffness`. + * A value of `0.1` means the constraint will apply heavy damping, resulting in little to no oscillation. + * A value of `0` means the constraint will apply no damping. + * + * @property damping + * @type number + * @default 0 + */ + damping: number; + /** * A `String` denoting the type of object. * diff --git a/types/matter-js/matter-js-tests.ts b/types/matter-js/matter-js-tests.ts index 3c34f91ecc..d5dca7e50b 100644 --- a/types/matter-js/matter-js-tests.ts +++ b/types/matter-js/matter-js-tests.ts @@ -42,7 +42,8 @@ World.add(engine.world, stack); var constraint1 = Constraint.create({ bodyA: box1, bodyB: box2, - stiffness: 0.02 + stiffness: 0.02, + damping: 0.01 }); //Query From 4461c0f21189a7677c450fd45d7642b01d722f25 Mon Sep 17 00:00:00 2001 From: islishude Date: Wed, 16 May 2018 20:12:20 +0800 Subject: [PATCH 171/575] feat(bitcoinjs-lib): add bech32 field to Network interface --- types/bitcoinjs-lib/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/bitcoinjs-lib/index.d.ts b/types/bitcoinjs-lib/index.d.ts index 1e8255e7ef..f099f77ecb 100644 --- a/types/bitcoinjs-lib/index.d.ts +++ b/types/bitcoinjs-lib/index.d.ts @@ -27,6 +27,7 @@ export interface In { } export interface Network { + bech32?: string, bip32: { public: number; private: number; From 7da1141f4ea59a19e51327d55e78620cbcfceae6 Mon Sep 17 00:00:00 2001 From: Oliver Joseph Ash Date: Wed, 16 May 2018 13:13:56 +0100 Subject: [PATCH 172/575] Node: add `undefined` to `ParsedUrlQuery` index signature --- types/node/index.d.ts | 2 +- types/node/v8/index.d.ts | 2 +- types/node/v9/index.d.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index b26ea63807..d964a41c43 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -991,7 +991,7 @@ declare module "querystring" { decodeURIComponent?: Function; } - interface ParsedUrlQuery { [key: string]: string | string[]; } + interface ParsedUrlQuery { [key: string]: string | string[] | undefined; } export function stringify(obj: T, sep?: string, eq?: string, options?: StringifyOptions): string; export function parse(str: string, sep?: string, eq?: string, options?: ParseOptions): ParsedUrlQuery; diff --git a/types/node/v8/index.d.ts b/types/node/v8/index.d.ts index 32530306c2..27014e0cb0 100644 --- a/types/node/v8/index.d.ts +++ b/types/node/v8/index.d.ts @@ -895,7 +895,7 @@ declare module "querystring" { decodeURIComponent?: Function; } - interface ParsedUrlQuery { [key: string]: string | string[]; } + interface ParsedUrlQuery { [key: string]: string | string[] | undefined; } export function stringify(obj: T, sep?: string, eq?: string, options?: StringifyOptions): string; export function parse(str: string, sep?: string, eq?: string, options?: ParseOptions): ParsedUrlQuery; diff --git a/types/node/v9/index.d.ts b/types/node/v9/index.d.ts index e7112daa25..014fd9bac1 100644 --- a/types/node/v9/index.d.ts +++ b/types/node/v9/index.d.ts @@ -982,7 +982,7 @@ declare module "querystring" { decodeURIComponent?: Function; } - interface ParsedUrlQuery { [key: string]: string | string[]; } + interface ParsedUrlQuery { [key: string]: string | string[] | undefined; } export function stringify(obj: T, sep?: string, eq?: string, options?: StringifyOptions): string; export function parse(str: string, sep?: string, eq?: string, options?: ParseOptions): ParsedUrlQuery; From 47fab38e3261c07e8ed7867e215a7a8c8d0dd3f3 Mon Sep 17 00:00:00 2001 From: islishude Date: Wed, 16 May 2018 20:25:36 +0800 Subject: [PATCH 173/575] fix: fix typo --- types/bitcoinjs-lib/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/bitcoinjs-lib/index.d.ts b/types/bitcoinjs-lib/index.d.ts index f099f77ecb..a1870263e0 100644 --- a/types/bitcoinjs-lib/index.d.ts +++ b/types/bitcoinjs-lib/index.d.ts @@ -27,7 +27,7 @@ export interface In { } export interface Network { - bech32?: string, + bech32?: string; bip32: { public: number; private: number; From f7c46ccc76f00e236043fcb5dd8344448d7896cf Mon Sep 17 00:00:00 2001 From: Niklas Lindgren Date: Wed, 16 May 2018 15:33:16 +0100 Subject: [PATCH 174/575] style: prettier format --- types/node-fetch/index.d.ts | 180 ++++++++++++++++++++++-------------- 1 file changed, 110 insertions(+), 70 deletions(-) diff --git a/types/node-fetch/index.d.ts b/types/node-fetch/index.d.ts index 874e216e89..02f1c8500e 100644 --- a/types/node-fetch/index.d.ts +++ b/types/node-fetch/index.d.ts @@ -1,6 +1,7 @@ -// Type definitions for node-fetch v1.6 +// Type definitions for node-fetch v2.1.2 // Project: https://github.com/bitinn/node-fetch // Definitions by: Torsten Werner +// Niklas Lindgren // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -8,103 +9,142 @@ import { Agent } from "http"; export class Request extends Body { - constructor(input: string | Request, init?: RequestInit); - method: string; - url: string; - headers: Headers; - context: RequestContext; - referrer: string; - redirect: RequestRedirect; + constructor(input: string | Request, init?: RequestInit); + method: string; + url: string; + headers: Headers; + context: RequestContext; + referrer: string; + redirect: RequestRedirect; - //node-fetch extensions to the whatwg/fetch spec - compress: boolean; - agent?: Agent; - counter: number; - follow: number; - hostname: string; - protocol: string; - port?: number; - timeout: number; - size: number; + //node-fetch extensions to the whatwg/fetch spec + compress: boolean; + agent?: Agent; + counter: number; + follow: number; + hostname: string; + protocol: string; + port?: number; + timeout: number; + size: number; } interface RequestInit { - //whatwg/fetch standard options - method?: string; - headers?: HeaderInit | { [index: string]: string }; - body?: BodyInit; - redirect?: RequestRedirect; + //whatwg/fetch standard options + method?: string; + headers?: HeaderInit | { [index: string]: string }; + body?: BodyInit; + redirect?: RequestRedirect; - //node-fetch extensions - timeout?: number; //=0 req/res timeout in ms, it resets on redirect. 0 to disable (OS limit applies) - compress?: boolean; //=true support gzip/deflate content encoding. false to disable - size?: number; //=0 maximum response body size in bytes. 0 to disable - agent?: Agent; //=null http.Agent instance, allows custom proxy, certificate etc. - follow?: number; //=20 maximum redirect count. 0 to not follow redirect + //node-fetch extensions + timeout?: number; //=0 req/res timeout in ms, it resets on redirect. 0 to disable (OS limit applies) + compress?: boolean; //=true support gzip/deflate content encoding. false to disable + size?: number; //=0 maximum response body size in bytes. 0 to disable + agent?: Agent; //=null http.Agent instance, allows custom proxy, certificate etc. + follow?: number; //=20 maximum redirect count. 0 to not follow redirect - //node-fetch does not support mode, cache or credentials options + //node-fetch does not support mode, cache or credentials options } type RequestContext = - "audio" | "beacon" | "cspreport" | "download" | "embed" | - "eventsource" | "favicon" | "fetch" | "font" | "form" | "frame" | - "hyperlink" | "iframe" | "image" | "imageset" | "import" | - "internal" | "location" | "manifest" | "object" | "ping" | "plugin" | - "prefetch" | "script" | "serviceworker" | "sharedworker" | - "subresource" | "style" | "track" | "video" | "worker" | - "xmlhttprequest" | "xslt"; + | "audio" + | "beacon" + | "cspreport" + | "download" + | "embed" + | "eventsource" + | "favicon" + | "fetch" + | "font" + | "form" + | "frame" + | "hyperlink" + | "iframe" + | "image" + | "imageset" + | "import" + | "internal" + | "location" + | "manifest" + | "object" + | "ping" + | "plugin" + | "prefetch" + | "script" + | "serviceworker" + | "sharedworker" + | "subresource" + | "style" + | "track" + | "video" + | "worker" + | "xmlhttprequest" + | "xslt"; type RequestMode = "same-origin" | "no-cors" | "cors"; type RequestRedirect = "follow" | "error" | "manual"; type RequestCredentials = "omit" | "same-origin" | "include"; type RequestCache = - "default" | "no-store" | "reload" | "no-cache" | - "force-cache" | "only-if-cached"; + | "default" + | "no-store" + | "reload" + | "no-cache" + | "force-cache" + | "only-if-cached"; export class Headers { - append(name: string, value: string): void; - delete(name: string): void; - get(name: string): string | null; - getAll(name: string): Array; - has(name: string): boolean; - set(name: string, value: string): void; - forEach(callback: (value: string, name: string) => void): void; + append(name: string, value: string): void; + delete(name: string): void; + get(name: string): string | null; + getAll(name: string): Array; + has(name: string): boolean; + set(name: string, value: string): void; + forEach(callback: (value: string, name: string) => void): void; } export class Body { - bodyUsed: boolean; - body: NodeJS.ReadableStream; - json(): Promise; - json(): Promise; - text(): Promise; - buffer(): Promise; - arrayBuffer(): Promise; + bodyUsed: boolean; + body: NodeJS.ReadableStream; + json(): Promise; + json(): Promise; + text(): Promise; + buffer(): Promise; + arrayBuffer(): Promise; } export class Response extends Body { - constructor(body?: BodyInit, init?: ResponseInit); - static error(): Response; - static redirect(url: string, status: number): Response; - type: ResponseType; - url: string; - status: number; - ok: boolean; - size: number; - statusText: string; - timeout: number; - headers: Headers; - clone(): Response; + constructor(body?: BodyInit, init?: ResponseInit); + static error(): Response; + static redirect(url: string, status: number): Response; + type: ResponseType; + url: string; + status: number; + ok: boolean; + size: number; + statusText: string; + timeout: number; + headers: Headers; + clone(): Response; } -type ResponseType = "basic" | "cors" | "default" | "error" | "opaque" | "opaqueredirect"; +type ResponseType = + | "basic" + | "cors" + | "default" + | "error" + | "opaque" + | "opaqueredirect"; interface ResponseInit { - status: number; - statusText?: string; - headers?: HeaderInit; + status: number; + statusText?: string; + headers?: HeaderInit; } type HeaderInit = Headers | Array; type BodyInit = ArrayBuffer | ArrayBufferView | string | NodeJS.ReadableStream; type RequestInfo = Request | string; -export default function fetch(url: string | Request, init?: RequestInit): Promise; +export default function fetch( + url: string | Request, + init?: RequestInit +): Promise; From eba02ef3a0e4a407d3e5402ad6824d0ad26ddaf4 Mon Sep 17 00:00:00 2001 From: Niklas Lindgren Date: Wed, 16 May 2018 15:34:07 +0100 Subject: [PATCH 175/575] feat: add missing methods on Headers --- types/node-fetch/index.d.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/types/node-fetch/index.d.ts b/types/node-fetch/index.d.ts index 02f1c8500e..d6e76a3bad 100644 --- a/types/node-fetch/index.d.ts +++ b/types/node-fetch/index.d.ts @@ -91,7 +91,8 @@ type RequestCache = | "force-cache" | "only-if-cached"; -export class Headers { +export class Headers implements Iterable<[string, string]> { + constructor(init?: Headers | { [k: string]: string }); append(name: string, value: string): void; delete(name: string): void; get(name: string): string | null; @@ -99,6 +100,11 @@ export class Headers { has(name: string): boolean; set(name: string, value: string): void; forEach(callback: (value: string, name: string) => void): void; + keys(): Iterator; + entries(): Iterator<[string, string]>; + values(): Iterator<[string]>; + raw(): { [k: string]: string }; + [Symbol.iterator](): Iterator<[string, string]>; } export class Body { From 2cbe57ed327e4ff0e531250e3375c3ade02e9209 Mon Sep 17 00:00:00 2001 From: Niklas Lindgren Date: Wed, 16 May 2018 16:08:45 +0100 Subject: [PATCH 176/575] feat: add Blob definition --- types/node-fetch/index.d.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/types/node-fetch/index.d.ts b/types/node-fetch/index.d.ts index d6e76a3bad..a173d08aaa 100644 --- a/types/node-fetch/index.d.ts +++ b/types/node-fetch/index.d.ts @@ -107,6 +107,12 @@ export class Headers implements Iterable<[string, string]> { [Symbol.iterator](): Iterator<[string, string]>; } +export class Blob { + type: string; + size: number; + slice(start?: number, end?: number): Blob; +} + export class Body { bodyUsed: boolean; body: NodeJS.ReadableStream; From 505f5955af254d1d1c3beea163c4a6021cf4716a Mon Sep 17 00:00:00 2001 From: Niklas Lindgren Date: Wed, 16 May 2018 15:48:30 +0100 Subject: [PATCH 177/575] feat: add FetchError defintion --- types/node-fetch/index.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/types/node-fetch/index.d.ts b/types/node-fetch/index.d.ts index a173d08aaa..98ccbde8fe 100644 --- a/types/node-fetch/index.d.ts +++ b/types/node-fetch/index.d.ts @@ -123,6 +123,11 @@ export class Body { arrayBuffer(): Promise; } +export class FetchError extends Error { + name: "FetchError"; + constructor(message: string, type: string, systemError: string); +} + export class Response extends Body { constructor(body?: BodyInit, init?: ResponseInit); static error(): Response; From 7074864dbdcbd644e065fa793a7cd6a1bbb16c92 Mon Sep 17 00:00:00 2001 From: Niklas Lindgren Date: Wed, 16 May 2018 15:51:20 +0100 Subject: [PATCH 178/575] feat: amend Request definition --- types/node-fetch/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/node-fetch/index.d.ts b/types/node-fetch/index.d.ts index 98ccbde8fe..5c9c8c3741 100644 --- a/types/node-fetch/index.d.ts +++ b/types/node-fetch/index.d.ts @@ -9,13 +9,14 @@ import { Agent } from "http"; export class Request extends Body { - constructor(input: string | Request, init?: RequestInit); + constructor(input: string | { href: string } | Request, init?: RequestInit); method: string; url: string; headers: Headers; context: RequestContext; referrer: string; redirect: RequestRedirect; + clone(): Request; //node-fetch extensions to the whatwg/fetch spec compress: boolean; From b635ffe8a70097f8b8bcd669959fcfb520148d7c Mon Sep 17 00:00:00 2001 From: Niklas Lindgren Date: Wed, 16 May 2018 16:12:58 +0100 Subject: [PATCH 179/575] feat: amend Body definition --- types/node-fetch/index.d.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/types/node-fetch/index.d.ts b/types/node-fetch/index.d.ts index 5c9c8c3741..dc11802c76 100644 --- a/types/node-fetch/index.d.ts +++ b/types/node-fetch/index.d.ts @@ -115,11 +115,14 @@ export class Blob { } export class Body { + constructor(body?: any, opts?: { size?: number; timeout?: number }); + blob(): Promise; bodyUsed: boolean; body: NodeJS.ReadableStream; json(): Promise; json(): Promise; text(): Promise; + textConverted(): Promise; buffer(): Promise; arrayBuffer(): Promise; } From 91c0804fdeef02a4591d8fed3a27d79997e54a96 Mon Sep 17 00:00:00 2001 From: Rene Kiupel Date: Wed, 16 May 2018 17:15:10 +0200 Subject: [PATCH 180/575] added 2 missing defs (domain+request) --- types/amazon-product-api/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/amazon-product-api/index.d.ts b/types/amazon-product-api/index.d.ts index 34bafd04f4..f266001632 100644 --- a/types/amazon-product-api/index.d.ts +++ b/types/amazon-product-api/index.d.ts @@ -33,6 +33,8 @@ interface IItemLookupOptions { searchIndex?: string; truncateReviewsAt?: number; variationPage?: string; + domain?: string; + request?: Function; } interface IBrowseNodeLookupOptions { From 61b2726389e292245ec5c9f20c6da403898fd378 Mon Sep 17 00:00:00 2001 From: Niklas Lindgren Date: Wed, 16 May 2018 16:15:28 +0100 Subject: [PATCH 181/575] style: sort methods and union members in alphabetical order --- types/node-fetch/index.d.ts | 81 +++++++++++++++++++------------------ 1 file changed, 42 insertions(+), 39 deletions(-) diff --git a/types/node-fetch/index.d.ts b/types/node-fetch/index.d.ts index dc11802c76..57c752d55e 100644 --- a/types/node-fetch/index.d.ts +++ b/types/node-fetch/index.d.ts @@ -10,39 +10,39 @@ import { Agent } from "http"; export class Request extends Body { constructor(input: string | { href: string } | Request, init?: RequestInit); - method: string; - url: string; - headers: Headers; - context: RequestContext; - referrer: string; - redirect: RequestRedirect; clone(): Request; + context: RequestContext; + headers: Headers; + method: string; + redirect: RequestRedirect; + referrer: string; + url: string; //node-fetch extensions to the whatwg/fetch spec - compress: boolean; agent?: Agent; + compress: boolean; counter: number; follow: number; hostname: string; - protocol: string; port?: number; - timeout: number; + protocol: string; size: number; + timeout: number; } interface RequestInit { //whatwg/fetch standard options - method?: string; - headers?: HeaderInit | { [index: string]: string }; body?: BodyInit; + headers?: HeaderInit | { [index: string]: string }; + method?: string; redirect?: RequestRedirect; //node-fetch extensions - timeout?: number; //=0 req/res timeout in ms, it resets on redirect. 0 to disable (OS limit applies) - compress?: boolean; //=true support gzip/deflate content encoding. false to disable - size?: number; //=0 maximum response body size in bytes. 0 to disable agent?: Agent; //=null http.Agent instance, allows custom proxy, certificate etc. + compress?: boolean; //=true support gzip/deflate content encoding. false to disable follow?: number; //=20 maximum redirect count. 0 to not follow redirect + size?: number; //=0 maximum response body size in bytes. 0 to disable + timeout?: number; //=0 req/res timeout in ms, it resets on redirect. 0 to disable (OS limit applies) //node-fetch does not support mode, cache or credentials options } @@ -74,37 +74,40 @@ type RequestContext = | "script" | "serviceworker" | "sharedworker" - | "subresource" | "style" + | "subresource" | "track" | "video" | "worker" | "xmlhttprequest" | "xslt"; -type RequestMode = "same-origin" | "no-cors" | "cors"; -type RequestRedirect = "follow" | "error" | "manual"; -type RequestCredentials = "omit" | "same-origin" | "include"; +type RequestMode = "cors" | "no-cors" | "same-origin"; +type RequestRedirect = "error" | "follow" | "manual"; +type RequestCredentials = "omit" | "include" | "same-origin"; + type RequestCache = | "default" - | "no-store" - | "reload" - | "no-cache" | "force-cache" - | "only-if-cached"; + | "no-cache" + | "no-store" + | "only-if-cached" + | "reload"; export class Headers implements Iterable<[string, string]> { constructor(init?: Headers | { [k: string]: string }); + forEach(callback: (value: string, name: string) => void): void; append(name: string, value: string): void; delete(name: string): void; get(name: string): string | null; getAll(name: string): Array; has(name: string): boolean; - set(name: string, value: string): void; - forEach(callback: (value: string, name: string) => void): void; - keys(): Iterator; - entries(): Iterator<[string, string]>; - values(): Iterator<[string]>; raw(): { [k: string]: string }; + set(name: string, value: string): void; + + // Iterator methods + entries(): Iterator<[string, string]>; + keys(): Iterator; + values(): Iterator<[string]>; [Symbol.iterator](): Iterator<[string, string]>; } @@ -116,15 +119,15 @@ export class Blob { export class Body { constructor(body?: any, opts?: { size?: number; timeout?: number }); + arrayBuffer(): Promise; blob(): Promise; - bodyUsed: boolean; body: NodeJS.ReadableStream; + bodyUsed: boolean; + buffer(): Promise; json(): Promise; json(): Promise; text(): Promise; textConverted(): Promise; - buffer(): Promise; - arrayBuffer(): Promise; } export class FetchError extends Error { @@ -136,15 +139,15 @@ export class Response extends Body { constructor(body?: BodyInit, init?: ResponseInit); static error(): Response; static redirect(url: string, status: number): Response; - type: ResponseType; - url: string; - status: number; + clone(): Response; + headers: Headers; ok: boolean; size: number; + status: number; statusText: string; timeout: number; - headers: Headers; - clone(): Response; + type: ResponseType; + url: string; } type ResponseType = @@ -156,14 +159,14 @@ type ResponseType = | "opaqueredirect"; interface ResponseInit { + headers?: HeaderInit; status: number; statusText?: string; - headers?: HeaderInit; } -type HeaderInit = Headers | Array; -type BodyInit = ArrayBuffer | ArrayBufferView | string | NodeJS.ReadableStream; -type RequestInfo = Request | string; +type HeaderInit = Array | Headers; +type BodyInit = ArrayBuffer | ArrayBufferView | NodeJS.ReadableStream | string; +type RequestInfo = string | Request; export default function fetch( url: string | Request, From 956fe591b8c118cbfd4c0303df7fd29c08939481 Mon Sep 17 00:00:00 2001 From: Niklas Lindgren Date: Wed, 16 May 2018 16:26:19 +0100 Subject: [PATCH 182/575] style: drop leading pipe in union for compat with TS2.0 --- types/node-fetch/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/node-fetch/index.d.ts b/types/node-fetch/index.d.ts index 57c752d55e..47638e382f 100644 --- a/types/node-fetch/index.d.ts +++ b/types/node-fetch/index.d.ts @@ -48,7 +48,7 @@ interface RequestInit { } type RequestContext = - | "audio" + "audio" | "beacon" | "cspreport" | "download" @@ -86,7 +86,7 @@ type RequestRedirect = "error" | "follow" | "manual"; type RequestCredentials = "omit" | "include" | "same-origin"; type RequestCache = - | "default" + "default" | "force-cache" | "no-cache" | "no-store" @@ -151,7 +151,7 @@ export class Response extends Body { } type ResponseType = - | "basic" + "basic" | "cors" | "default" | "error" From 9abbb97f487ab233cbce02f82616fe58c5931a1a Mon Sep 17 00:00:00 2001 From: Thomas Gossmann Date: Wed, 16 May 2018 17:30:14 +0200 Subject: [PATCH 183/575] Make third argument of addObserver and removeObserver optional --- types/ember/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/ember/index.d.ts b/types/ember/index.d.ts index a35ed40dec..0d3c957a5b 100755 --- a/types/ember/index.d.ts +++ b/types/ember/index.d.ts @@ -1683,7 +1683,7 @@ declare module 'ember' { addObserver( key: keyof this, target: Target, - method: ObserverMethod + method?: ObserverMethod ): void; /** * Remove an observer you have previously registered on this object. Pass @@ -1693,7 +1693,7 @@ declare module 'ember' { removeObserver( key: keyof this, target: Target, - method: ObserverMethod + method?: ObserverMethod ): any; /** * Retrieves the value of a property, or a default value in the case that the From c7139f6cd62a3d316d9845cdeb98a870a2bafd76 Mon Sep 17 00:00:00 2001 From: Alec Zopf Date: Wed, 16 May 2018 15:48:29 -0400 Subject: [PATCH 184/575] add handling for superagent pfx with passphrase --- types/superagent/index.d.ts | 3 ++- types/superagent/superagent-tests.ts | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/types/superagent/index.d.ts b/types/superagent/index.d.ts index 6520b4eb66..8f457c804c 100644 --- a/types/superagent/index.d.ts +++ b/types/superagent/index.d.ts @@ -4,6 +4,7 @@ // Michael Ledin // Pap Lőrinc // Shrey Jain +// Alec Zopf // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -131,7 +132,7 @@ declare namespace request { on(name: string, handler: (event: any) => void): this; parse(parser: Parser): this; part(): this; - pfx(cert: Buffer | string): this; + pfx(cert: Buffer | string | { pfx: Buffer, passphrase: string }): this; pipe(stream: NodeJS.WritableStream, options?: object): stream.Writable; query(val: object | string): this; redirects(n: number): this; diff --git a/types/superagent/superagent-tests.ts b/types/superagent/superagent-tests.ts index 351e78b156..66046759f1 100644 --- a/types/superagent/superagent-tests.ts +++ b/types/superagent/superagent-tests.ts @@ -373,6 +373,16 @@ request .pfx(pfx) .end(callback); +// pfx with passphrase, from: https://github.com/visionmedia/superagent/pull/1230/commits/96af65ffc6256df633f893095d1dc828694bbfbc +const passpfx = fs.readFileSync('passcert.pfx'); +request + .post('/secure') + .pfx({ + pfx: passpfx, + passphrase: 'test' + }) + .end(callback); + // ok, from: https://github.com/visionmedia/superagent/commit/34533bbc29833889090847c45a82b0ea81b2f06d request .get('/404') From ebb93d17ef6d9050deb943acf4ec7657db12734a Mon Sep 17 00:00:00 2001 From: Thomas Gossmann Date: Wed, 16 May 2018 22:35:16 +0200 Subject: [PATCH 185/575] tests for addObserver and removeObserver with optional 3rd parameter --- types/ember/test/observable.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/types/ember/test/observable.ts b/types/ember/test/observable.ts index cf871807b2..3585535dec 100755 --- a/types/ember/test/observable.ts +++ b/types/ember/test/observable.ts @@ -14,6 +14,11 @@ class MyComponent extends Ember.Component { this.removeObserver('foo', this, this.fooDidChange); Ember.removeObserver(this, 'foo', this, 'fooDidChange'); Ember.removeObserver(this, 'foo', this, this.fooDidChange); + const lambda = () => { + this.fooDidChange(this, 'foo'); + }; + this.addObserver('foo', lambda); + this.removeObserver('foo', lambda); } fooDidChange(sender: MyComponent, key: 'foo') { From 51dfb8cc7a7b63c6f7f4af73a67e40af748dee9b Mon Sep 17 00:00:00 2001 From: Sagie Maoz Date: Wed, 16 May 2018 18:32:16 -0400 Subject: [PATCH 186/575] add types for @mapbox/geojson-area --- types/mapbox__geojson-area/index.d.ts | 12 ++++++++++ .../mapbox__geojson-area-tests.ts | 21 +++++++++++++++++ types/mapbox__geojson-area/tsconfig.json | 23 +++++++++++++++++++ types/mapbox__geojson-area/tslint.json | 1 + 4 files changed, 57 insertions(+) create mode 100644 types/mapbox__geojson-area/index.d.ts create mode 100644 types/mapbox__geojson-area/mapbox__geojson-area-tests.ts create mode 100644 types/mapbox__geojson-area/tsconfig.json create mode 100644 types/mapbox__geojson-area/tslint.json diff --git a/types/mapbox__geojson-area/index.d.ts b/types/mapbox__geojson-area/index.d.ts new file mode 100644 index 0000000000..5c622342d8 --- /dev/null +++ b/types/mapbox__geojson-area/index.d.ts @@ -0,0 +1,12 @@ +// Type definitions for @mapbox/geojson-area 0.2 +// Project: https://github.com/mapbox/geojson-area#readme +// Definitions by: Sagie Maoz +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +// tslint:disable-next-line no-single-declare-module +declare module "@mapbox/geojson-area" { + import { Geometry } from 'geojson'; + + function geometry(geo: Geometry): number; +} diff --git a/types/mapbox__geojson-area/mapbox__geojson-area-tests.ts b/types/mapbox__geojson-area/mapbox__geojson-area-tests.ts new file mode 100644 index 0000000000..b7d0803372 --- /dev/null +++ b/types/mapbox__geojson-area/mapbox__geojson-area-tests.ts @@ -0,0 +1,21 @@ +import { geometry } from '@mapbox/geojson-area'; + +// Using a polygon argument +// $ExpectType number +geometry({ + type: "Polygon", + coordinates: [ + [ + [170.0, 45.0], [180.0, 45.0] + ], [ + [-180.0, 45.0], [-170.0, 45.0] + ] + ] +}); + +// Using a point argument +// $ExpectType number +geometry({ + type: "Point", + coordinates: [12, 23] +}); diff --git a/types/mapbox__geojson-area/tsconfig.json b/types/mapbox__geojson-area/tsconfig.json new file mode 100644 index 0000000000..0009348b22 --- /dev/null +++ b/types/mapbox__geojson-area/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "mapbox__geojson-area-tests.ts" + ] +} diff --git a/types/mapbox__geojson-area/tslint.json b/types/mapbox__geojson-area/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/mapbox__geojson-area/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 605ede46f71db9222d1d16f055479471ea2624fb Mon Sep 17 00:00:00 2001 From: Aaron Schiff Date: Wed, 16 May 2018 22:19:10 -0500 Subject: [PATCH 187/575] xmldoc: Corrected, expanded, and refined typings --- types/xmldoc/index.d.ts | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/types/xmldoc/index.d.ts b/types/xmldoc/index.d.ts index d4e9f92ec6..87d3403ebb 100644 --- a/types/xmldoc/index.d.ts +++ b/types/xmldoc/index.d.ts @@ -6,31 +6,35 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped): // TypeScript Version: 2.1 export class XmlDocument extends XmlElement { - constructor(xmlString: string); + constructor(xml: string); doctype: string; } -export class XmlElement { - constructor(tag: XmlElement); +export type XmlNode = XmlElement | XmlTextNode | XmlCDataNode | XmlCommentNode; +export class XmlElement { + constructor(tag: XmlTag); + + type: 'element'; name: string; attr: XmlAttributes; val: string; - children: XmlElement[]; - firstChild: XmlElement; - lastChild: XmlElement; + children: XmlNode[]; + firstChild: XmlNode | null; + lastChild: XmlNode | null; line: number; column: number; position: number; startTagPosition: number; - eachChild(func: (child: XmlElement, index?: number, array?: XmlElement[]) => void): void; - childNamed(name: string): XmlElement; + eachChild(iterator: (child: XmlElement, index: number, array: XmlNode[]) => void): void; + eachChild(iterator: (this: T, child: XmlElement, index: number, array: XmlNode[]) => void, context: T): void; + childNamed(name: string): XmlElement | undefined; childrenNamed(name: string): XmlElement[]; - childWithAttribute(name: string, value?: string): XmlElement; - descendantWithPath(path: string): XmlElement; - valueWithPath(path: string): string; + childWithAttribute(name: string, value?: string | null): XmlElement | undefined; + descendantWithPath(path: string): XmlElement | undefined; + valueWithPath(path: string): string | undefined; toString(opts?: XmlOptions): string; toStringWithIndent(indent: string, opts?: XmlOptions): string; } @@ -38,6 +42,9 @@ export class XmlElement { export class XmlTextNode { constructor(text: string); + type: 'text'; + text: string; + toString(opts?: XmlOptions): string; toStringWithIndent(indent: string, opts?: XmlOptions): string; } @@ -45,6 +52,9 @@ export class XmlTextNode { export class XmlCDataNode { constructor(cdata: string); + type: 'cdata'; + cdata: string; + toString(opts?: XmlOptions): string; toStringWithIndent(indent: string, opts?: XmlOptions): string; } @@ -52,6 +62,9 @@ export class XmlCDataNode { export class XmlCommentNode { constructor(comment: string); + type: 'comment'; + comment: string; + toString(opts?: XmlOptions): string; toStringWithIndent(indent: string, opts?: XmlOptions): string; } From d4284a1d4489781c9f157f49f1d802bad68ce959 Mon Sep 17 00:00:00 2001 From: Christian Rackerseder Date: Wed, 16 May 2018 14:45:12 +0200 Subject: [PATCH 188/575] [pino] Fixed typings --- types/pino/index.d.ts | 7 ++++++- types/pino/pino-tests.ts | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/types/pino/index.d.ts b/types/pino/index.d.ts index 02b66cc745..0f98e0a622 100644 --- a/types/pino/index.d.ts +++ b/types/pino/index.d.ts @@ -1,7 +1,8 @@ -// Type definitions for pino 4.7 +// Type definitions for pino 4.16 // Project: https://github.com/pinojs/pino.git // Definitions by: Peter Snider // BendingBender +// Christian Rackerseder // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -192,6 +193,10 @@ declare namespace P { trace?: WriteFn; } & { [logLevel: string]: WriteFn }); }; + /** + * key-value object added as child logger to each log line. If set to null the base child logger is not added + */ + base?: { [key: string]: any } | null; } interface PrettyOptions { diff --git a/types/pino/pino-tests.ts b/types/pino/pino-tests.ts index cc7704be77..6d226a1d92 100644 --- a/types/pino/pino-tests.ts +++ b/types/pino/pino-tests.ts @@ -49,6 +49,9 @@ pino({ } }); +pino({ base: null }); +pino({ base: { foo: 'bar' } }); + if ('pino' in log) console.log(`pino version: ${log.pino}`); log.child({a: 'property'}).info('hello child!'); From c91d807e1c23ca4a96d8b04bb2c8754966b04339 Mon Sep 17 00:00:00 2001 From: "J.C" Date: Thu, 17 May 2018 13:34:54 +0800 Subject: [PATCH 189/575] fixed typing error & argument type error. --- types/three/three-core.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/types/three/three-core.d.ts b/types/three/three-core.d.ts index a7f7950a48..a188fa796a 100644 --- a/types/three/three-core.d.ts +++ b/types/three/three-core.d.ts @@ -6244,8 +6244,8 @@ export class WebGLDepthBuffer { constructor(gl: any, state: any); setTest(depthTest: boolean): void; - sertMask(depthMask: number): void; - setFunc(depthFunc: Function): void; + setMask(depthMask: number): void; + setFunc(depthFunc: number): void; setLocked(lock: boolean): void; setClear(depth: any): void; reset(): void; @@ -6255,8 +6255,8 @@ export class WebGLStencilBuffer { constructor(gl: any, state: any); setTest(stencilTest: boolean): void; - sertMask(stencilMask: number): void; - setFunc(stencilFunc: Function, stencilRef: any, stencilMask: number): void; + setMask(stencilMask: number): void; + setFunc(stencilFunc: number, stencilRef: any, stencilMask: number): void; setOp(stencilFail: any, stencilZFail: any, stencilZPass: any): void; setLocked(lock: boolean): void; setClear(stencil: any): void; From 4b546c57128554c31db3b7729c6d538871fee6b3 Mon Sep 17 00:00:00 2001 From: "J.C" Date: Thu, 17 May 2018 13:42:50 +0800 Subject: [PATCH 190/575] update tweenjs to latest 1.0.2 --- types/tweenjs/index.d.ts | 189 +++++++++++++++++++++++---------------- 1 file changed, 113 insertions(+), 76 deletions(-) diff --git a/types/tweenjs/index.d.ts b/types/tweenjs/index.d.ts index bcc3c87778..a9232b2f61 100644 --- a/types/tweenjs/index.d.ts +++ b/types/tweenjs/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for TweenJS 0.6.0 +// Type definitions for TweenJS 1.0.2 // Project: http://www.createjs.com/#!/TweenJS -// Definitions by: Pedro Ferreira , Chris Smith +// Definitions by: Pedro Ferreira , Chris Smith , J.C // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /* @@ -15,15 +15,6 @@ /// declare namespace createjs { - export class CSSPlugin { - constructor(); - - // properties - static cssSuffixMap: Object; - - // methods - static install(): void; - } export class Ease { // methods @@ -68,94 +59,140 @@ declare namespace createjs { static sineOut: (amount: number) => number; } - export class MotionGuidePlugin { - constructor(); + export type TweenProps = { + useTicks?:boolean, + ignoreGlobalPause?:boolean, + loop?:number, + reversed?:boolean, + bounce?:boolean, + timeScale?:number, + pluginData?:any, + paused?:boolean, + position?:number, + onChange?:(e:Event) => void, + onComplete?:(e:Event) => void, + override?:boolean; + } + export type TimelineProps = { + useTicks?:boolean, + ignoreGlobalPause?:boolean, + loop?:number, + reversed?:boolean, + bounce?:boolean, + timeScale?:number, + paused?:boolean, + position?:number, + onChange?:(e:Event) => void, + onComplete?:(e:Event) => void + } + + export class TweenStep { + constructor(prev:TweenStep, t:number, d:number, props:TweenProps, ease:Function, passive:boolean); + + next:TweenStep; + prev:TweenStep; + t:number; + d:number; + props:TweenProps; + ease:Function; + passive:boolean; + index:number; + } + + export class TweenAction { + constructor(prev:TweenAction, t:number, scope:any, funct:Function, params:any[]); + + next:TweenAction; + prev:TweenAction; + t:number; + d:number; + scope:any; + funct:Function; + params:any[]; + } + + export class MotionGuidePlugin { + + //properties + static priority:number; + static ID:string; + //methods static install(): Object; + static init(tween:Tween, prop:string, value:any):void; + static step(tween:Tween, step:TweenStep, props:TweenProps):void; + static change(tween:Tween, step:TweenStep, prop:string, value:any, ratio:number, end:boolean):void; + static debug(guideData:any, ctx:any, higlight:number[]):void; } - /* - NOTE: It is commented out because it conflicts with SamplePlugin Class of PreloadJS. - this class is mainly for documentation purposes. - http://www.createjs.com/Docs/TweenJS/classes/SamplePlugin.html - */ - /* - export class SamplePlugin { - constructor(); + export class Timeline extends AbstractTween { + constructor(props?:TimelineProps); // properties - static priority: any; + tweens:Tween[]; - //methods - static init(tween: Tween, prop: string, value: any): any; - static step(tween: Tween, prop: string, startValue: any, injectProps: Object, endValue: any): void; - static install(): void; - static tween(tween: Tween, prop: string, value: any, startValues: Object, endValues: Object, ratio: number, wait: boolean, end: boolean): any; + // method + addTween(tween:Tween):Tween; + removeTween(tween:Tween):boolean; + updateDuration():void; } - */ - export class Timeline extends EventDispatcher { - constructor (tweens: Tween[], labels: Object, props: Object); + export class AbstractTween extends EventDispatcher { + constructor(props?:TweenProps); // properties - duration: number; - ignoreGlobalPause: boolean; - loop: boolean; - position: Object; + ignoreGlobalPause:boolean; + loop:number; + useTicks:boolean; + reversed:boolean; + bounce:boolean; + timeScale:number; + duration:number; + position:number; + rawPosition:number; + + paused:boolean; + readonly currentLabel:string; // methods - addLabel(label: string, position: number): void; - addTween(...tween: Tween[]): void; - getCurrentLabel(): string; - getLabels(): Object[]; - gotoAndPlay(positionOrLabel: string | number): void; - gotoAndStop(positionOrLabel: string | number): void; - removeTween(...tween: Tween[]): void; - resolve(positionOrLabel: string | number): number; - setLabels(o: Object): void; - setPaused(value: boolean): void; - setPosition(value: number, actionsMode?: number): boolean; - tick(delta: number): void; - updateDuration(): void; + advance(delta:number, ignoreActions?:boolean):void; + setPosition(rawPosition:number, ignoreActions?:boolean, jump?:boolean, callback?:(tween:AbstractTween) => void):void; + calculatePosition(rawPosition:number):void; + getLabels():string[]; + setLabels(labels:{ [labelName:string] : number }[]):void; + addLabel(label:string, position:number):void; + gotoAndPlay(positionOrLabel:string | number):void; + gotoAndStop(positionOrLabel:string | number):void; + resolve(positionOrLabel:string | number):number; + toString():string; } + export class Tween extends AbstractTween { + constructor(target: any, props?: TweenProps); - export class Tween extends EventDispatcher { - constructor(target: Object, props?: Object, pluginData?: Object); + static IGNORE:any; // properties - duration: number; - static IGNORE: Object; - ignoreGlobalPause: boolean; - static LOOP: number; - loop: boolean; - static NONE: number; - onChange: Function; // deprecated + target: any; + pluginData: any; passive: boolean; - pluginData: Object; - position: number; - static REVERSE: number; - target: Object; // methods - call(callback: (tweenObject: Tween) => any, params?: any[], scope?: Object): Tween; // when 'params' isn't given, the callback receives a tweenObject - call(callback: (...params: any[]) => any, params?: any[], scope?: Object): Tween; // otherwise, it receives the params only - static get(target: Object, props?: Object, pluginData?: Object, override?: boolean): Tween; - static hasActiveTweens(target?: Object): boolean; - static installPlugin(plugin: Object, properties: any[]): void; - pause(tween: Tween): Tween; - play(tween: Tween): Tween; - static removeAllTweens(): void; - static removeTweens(target: Object): void; - set(props: Object, target?: Object): Tween; - setPaused(value: boolean): Tween; - setPosition(value: number, actionsMode: number): boolean; - static tick(delta: number, paused: boolean): void; - tick(delta: number): void; - to(props: Object, duration?: number, ease?: (t: number) => number): Tween; - wait(duration: number, passive?: boolean): Tween; + static get(target:any, props?:TweenProps):Tween; + static tick(delta:number, paused:boolean):void; + static handleEvent(e:Event):void; + static removeTweens(target:any):void; + static removeAllTweens():void; + static hasActiveTweens(target:any):boolean; + wait(duration:number, passive?:boolean):Tween; + to(props:any, duration?:number, ease?:Function):Tween; + label(name:string):Tween; + call(callback:(...params:any[]) => void, params?:any[], scope?:any):Tween; + set(props:any, target?:any):Tween; + play(tween?:Tween):Tween; + pause(tween?:Tween):Tween; } export class TweenJS { From 1b2f3e2ba1dfac8dfe8ea5d34918e0960c653bf7 Mon Sep 17 00:00:00 2001 From: Ionut Botizan Date: Thu, 17 May 2018 09:24:41 +0300 Subject: [PATCH 191/575] [node] Add debugPort to the Process interface https://nodejs.org/api/process.html#process_process_debugport --- types/node/index.d.ts | 1 + types/node/v0/index.d.ts | 1 + types/node/v4/index.d.ts | 1 + types/node/v6/index.d.ts | 1 + types/node/v7/index.d.ts | 1 + types/node/v8/index.d.ts | 1 + types/node/v9/index.d.ts | 1 + 7 files changed, 7 insertions(+) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index b26ea63807..2eba98fffe 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -713,6 +713,7 @@ declare namespace NodeJS { abort(): void; chdir(directory: string): void; cwd(): string; + debugPort: number; emitWarning(warning: string | Error, name?: string, ctor?: Function): void; env: ProcessEnv; exit(code?: number): never; diff --git a/types/node/v0/index.d.ts b/types/node/v0/index.d.ts index 37f92cbc50..b88dd54a0c 100644 --- a/types/node/v0/index.d.ts +++ b/types/node/v0/index.d.ts @@ -242,6 +242,7 @@ declare namespace NodeJS { abort(): void; chdir(directory: string): void; cwd(): string; + debugPort: number; env: any; exit(code?: number): void; getgid(): number; diff --git a/types/node/v4/index.d.ts b/types/node/v4/index.d.ts index db5518575d..dab3b0c5d9 100644 --- a/types/node/v4/index.d.ts +++ b/types/node/v4/index.d.ts @@ -417,6 +417,7 @@ declare namespace NodeJS { abort(): void; chdir(directory: string): void; cwd(): string; + debugPort: number; env: any; exit(code?: number): void; exitCode: number; diff --git a/types/node/v6/index.d.ts b/types/node/v6/index.d.ts index 9d2ea9ea00..056021841c 100644 --- a/types/node/v6/index.d.ts +++ b/types/node/v6/index.d.ts @@ -480,6 +480,7 @@ declare namespace NodeJS { abort(): void; chdir(directory: string): void; cwd(): string; + debugPort: number; emitWarning(warning: string | Error, name?: string, ctor?: Function): void; env: any; exit(code?: number): void; diff --git a/types/node/v7/index.d.ts b/types/node/v7/index.d.ts index 58497e23d6..055933977d 100644 --- a/types/node/v7/index.d.ts +++ b/types/node/v7/index.d.ts @@ -477,6 +477,7 @@ declare namespace NodeJS { abort(): void; chdir(directory: string): void; cwd(): string; + debugPort: number; emitWarning(warning: string | Error, name?: string, ctor?: Function): void; env: any; exit(code?: number): never; diff --git a/types/node/v8/index.d.ts b/types/node/v8/index.d.ts index 32530306c2..daaf68e5a8 100644 --- a/types/node/v8/index.d.ts +++ b/types/node/v8/index.d.ts @@ -561,6 +561,7 @@ declare namespace NodeJS { abort(): void; chdir(directory: string): void; cwd(): string; + debugPort: number; emitWarning(warning: string | Error, name?: string, ctor?: Function): void; env: ProcessEnv; exit(code?: number): never; diff --git a/types/node/v9/index.d.ts b/types/node/v9/index.d.ts index e7112daa25..b59d5143c9 100644 --- a/types/node/v9/index.d.ts +++ b/types/node/v9/index.d.ts @@ -704,6 +704,7 @@ declare namespace NodeJS { abort(): void; chdir(directory: string): void; cwd(): string; + debugPort: number; emitWarning(warning: string | Error, name?: string, ctor?: Function): void; env: ProcessEnv; exit(code?: number): never; From 7c8a56047d0698e6e8b626f2cd4674755a20ab57 Mon Sep 17 00:00:00 2001 From: Anastasiia Antonova Date: Thu, 17 May 2018 13:49:32 +0700 Subject: [PATCH 192/575] package.json reformat: 4 spaces indentation according to the .editorconfig --- package.json | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/package.json b/package.json index 37d1f4d48b..c5b1b03057 100644 --- a/package.json +++ b/package.json @@ -1,27 +1,27 @@ { - "private": true, - "name": "definitely-typed", - "version": "0.0.2", - "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped", - "repository": { - "type": "git", - "url": "git+https://github.com/DefinitelyTyped/DefinitelyTyped.git" - }, - "license": "MIT", - "bugs": { - "url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues" - }, - "engines": { - "node": ">=7.8.0" - }, - "scripts": { - "compile-scripts": "tsc -p scripts", - "not-needed": "node scripts/not-needed.js", - "test": "node node_modules/types-publisher/bin/tester/test.js --run-from-definitely-typed", - "lint": "dtslint types" - }, - "devDependencies": { - "dtslint": "github:Microsoft/dtslint#production", - "types-publisher": "Microsoft/types-publisher#production" - } + "private": true, + "name": "definitely-typed", + "version": "0.0.2", + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped", + "repository": { + "type": "git", + "url": "git+https://github.com/DefinitelyTyped/DefinitelyTyped.git" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues" + }, + "engines": { + "node": ">=7.8.0" + }, + "scripts": { + "compile-scripts": "tsc -p scripts", + "not-needed": "node scripts/not-needed.js", + "test": "node node_modules/types-publisher/bin/tester/test.js --run-from-definitely-typed", + "lint": "dtslint types" + }, + "devDependencies": { + "dtslint": "github:Microsoft/dtslint#production", + "types-publisher": "Microsoft/types-publisher#production" + } } From 1405d1c6197e1cc8ee178b6f19b79903cd7ff9fe Mon Sep 17 00:00:00 2001 From: Evghenii Vasilovici Date: Thu, 17 May 2018 10:26:56 +0200 Subject: [PATCH 193/575] Change result type of `columns()` and `tables()` callback definition of `Database`. Add `ODBCResult.fetchSync()` definition --- types/ibm_db/index.d.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/types/ibm_db/index.d.ts b/types/ibm_db/index.d.ts index de54b9ca26..24699c195e 100644 --- a/types/ibm_db/index.d.ts +++ b/types/ibm_db/index.d.ts @@ -104,9 +104,9 @@ export class Database implements Options { rollbackTransactionSync(): Database; - columns(catalog: string | null, schema: string | null, table: string | null, column: string | null, cb: (error: Error, res: ODBCResult) => void): void; + columns(catalog: string | null, schema: string | null, table: string | null, column: string | null, cb: (error: Error, res: any[]) => void): void; - tables(catalog: string | null, schema: string | null, table: string | null, type: string | null, cb: (error: Error, res: ODBCResult) => void): void; + tables(catalog: string | null, schema: string | null, table: string | null, type: string | null, cb: (error: Error, res: any[]) => void): void; describe(obj: DescribeObject, cb: (error: Error, res: any[]) => void): void; @@ -187,6 +187,7 @@ export class ODBCStatement { export class ODBCResult { fetchMode: number; + fetchSync(): any[]; fetchAllSync(): any[]; moreResultsSync(): any[]; closeSync(): void; From ff0c5eb0c03b26f5928cef50132c50d92339c051 Mon Sep 17 00:00:00 2001 From: Nick Holloway Date: Thu, 17 May 2018 09:35:00 +0100 Subject: [PATCH 194/575] Add encryption key to Code Pipeline event --- types/aws-lambda/aws-lambda-tests.ts | 2 ++ types/aws-lambda/index.d.ts | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/types/aws-lambda/aws-lambda-tests.ts b/types/aws-lambda/aws-lambda-tests.ts index 05b9033da7..8a3909329f 100644 --- a/types/aws-lambda/aws-lambda-tests.ts +++ b/types/aws-lambda/aws-lambda-tests.ts @@ -575,6 +575,8 @@ const CodePipelineEvent: AWSLambda.CodePipelineEvent = { } }; +CodePipelineEvent["CodePipeline.job"].data.encryptionKey = { type: 'KMS', id: 'key' }; + /* CloudFront events, see http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-event-structure.html */ const CloudFrontRequestEvent: AWSLambda.CloudFrontRequestEvent = { Records: [ diff --git a/types/aws-lambda/index.d.ts b/types/aws-lambda/index.d.ts index e8e305fd0a..e61d2bac72 100644 --- a/types/aws-lambda/index.d.ts +++ b/types/aws-lambda/index.d.ts @@ -528,6 +528,11 @@ export interface Credentials { sessionToken?: string; } +export interface EncryptionKey { + type: string; + id: string; +} + export interface CodePipelineEvent { "CodePipeline.job": { id: string; @@ -542,6 +547,7 @@ export interface CodePipelineEvent { inputArtifacts: Artifact[]; outputArtifacts: Artifact[]; artifactCredentials: Credentials; + encryptionKey?: EncryptionKey & {type: 'KMS'}; continuationToken?: string; }; }; From fcd0b6a6b626752b3c99fe467398d419d72cae23 Mon Sep 17 00:00:00 2001 From: Nick Burrell Date: Thu, 17 May 2018 10:51:48 +0100 Subject: [PATCH 195/575] Added StyleFunction to SymbolLayout - icon-allow-overlap --- types/mapbox-gl/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/mapbox-gl/index.d.ts b/types/mapbox-gl/index.d.ts index ece34d0938..d8362a14d8 100644 --- a/types/mapbox-gl/index.d.ts +++ b/types/mapbox-gl/index.d.ts @@ -1020,7 +1020,7 @@ declare namespace mapboxgl { 'symbol-placement'?: 'point' | 'line'; 'symbol-spacing'?: number | Expression; 'symbol-avoid-edges'?: boolean; - 'icon-allow-overlap'?: boolean; + 'icon-allow-overlap'?: boolean | StyleFunction; 'icon-ignore-placement'?: boolean; 'icon-optional'?: boolean; 'icon-rotation-alignment'?: 'map' | 'viewport' | 'auto'; From 63337ec9f8696a07ab2fa080925bebad7779e709 Mon Sep 17 00:00:00 2001 From: Anastasiia Antonova Date: Thu, 17 May 2018 17:06:30 +0700 Subject: [PATCH 196/575] "chartist" files reformat: 4 spaces indentation according to the .editorconfig --- types/chartist/chartist-tests.ts | 527 +++++------ types/chartist/index.d.ts | 1398 +++++++++++++++--------------- 2 files changed, 972 insertions(+), 953 deletions(-) diff --git a/types/chartist/chartist-tests.ts b/types/chartist/chartist-tests.ts index 13a7c7dd1c..281eb4987d 100644 --- a/types/chartist/chartist-tests.ts +++ b/types/chartist/chartist-tests.ts @@ -1,429 +1,432 @@ import Chartist = require("chartist"); + Chartist.escapingMap = { - '&': '&', - '<': '<', - '>': '>', - '"': '"', - '\'': ''', + '&': '&', + '<': '<', + '>': '>', + '"': '"', + '\'': ''', }; Chartist.precision = 8; new Chartist.Line('.ct-chart', { - labels: ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'], - series: [ - [12, 9, 7, 8, 5], - [2, 1, 3.5, 7, 3], - [1, 3, 4, 5, 6] - ] + labels: ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'], + series: [ + [12, 9, 7, 8, 5], + [2, 1, 3.5, 7, 3], + [1, 3, 4, 5, 6] + ] }, { fullWidth: true, chartPadding: { - right: 40 + right: 40 } - }); +}); var lineChart = new Chartist.Line('.ct-chart', { - labels: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16], - series: [ - [5, 5, 10, 8, 7, 5, 4, null, null, null, 10, 10, 7, 8, 6, 9], - [10, 15, null, 12, null, 10, 12, 15, null, null, 12, null, 14, null, null, null], - [null, null, null, null, 3, 4, 1, 3, 4, 6, 7, 9, 5, null, null, null] - ] + labels: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16], + series: [ + [5, 5, 10, 8, 7, 5, 4, null, null, null, 10, 10, 7, 8, 6, 9], + [10, 15, null, 12, null, 10, 12, 15, null, null, 12, null, 14, null, null, null], + [null, null, null, null, 3, 4, 1, 3, 4, 6, 7, 9, 5, null, null, null] + ] }, { fullWidth: true, chartPadding: { - right: 10 + right: 10 }, low: 0 - }); +}); new Chartist.Line('.ct-chart', { - labels: ['1', '2', '3', '4', '5', '6'], - series: [ - { - name: 'Fibonacci sequence', - data: [1, 2, 3, 5, 8, 13] - }, - { - name: 'Golden section', - data: [1, 1.618, 2.618, 4.236, 6.854, 11.09] - } - ] + labels: ['1', '2', '3', '4', '5', '6'], + series: [ + { + name: 'Fibonacci sequence', + data: [1, 2, 3, 5, 8, 13] + }, + { + name: 'Golden section', + data: [1, 1.618, 2.618, 4.236, 6.854, 11.09] + } + ] }); var data = { - series: [5, 3, 4] + series: [5, 3, 4] }; -var sum = (a: number, b: number) => { return a + b }; +var sum = (a: number, b: number) => { + return a + b +}; new Chartist.Pie('.ct-chart', data, { - labelInterpolationFnc: (value: number) => { - return Math.round(value / data.series.reduce(sum) * 100) + '%'; - } + labelInterpolationFnc: (value: number) => { + return Math.round(value / data.series.reduce(sum) * 100) + '%'; + } }); new Chartist.Pie('.ct-chart', { - series: [20, 10, 30, 40] + series: [20, 10, 30, 40] }, { donut: true, donutWidth: 60, startAngle: 270, total: 200, showLabel: false - }); +}); // Animation Donut example var chart = new Chartist.Pie('.ct-chart', { - series: [10, 20, 50, 20, 5, 50, 15], - labels: [1, 2, 3, 4, 5, 6, 7] + series: [10, 20, 50, 20, 5, 50, 15], + labels: [1, 2, 3, 4, 5, 6, 7] }, { donut: true, showLabel: false - }); +}); chart.on('draw', (data: any) => { - if (data.type === 'slice') { - // Get the total path length in order to use for dash array animation - var pathLength = data.element._node.getTotalLength(); + if (data.type === 'slice') { + // Get the total path length in order to use for dash array animation + var pathLength = data.element._node.getTotalLength(); - // Set a dasharray that matches the path length as prerequisite to animate dashoffset - data.element.attr({ - 'stroke-dasharray': pathLength + 'px ' + pathLength + 'px' - }); + // Set a dasharray that matches the path length as prerequisite to animate dashoffset + data.element.attr({ + 'stroke-dasharray': pathLength + 'px ' + pathLength + 'px' + }); - // Create animation definition while also assigning an ID to the animation for later sync usage - var animationDefinition: Chartist.IChartistAnimations = { - 'stroke-dashoffset': { - id: 'anim' + data.index, - dur: 1000, - from: -pathLength + 'px', - to: '0px', - easing: Chartist.Svg.Easing.easeOutQuint, - // We need to use `fill: 'freeze'` otherwise our animation will fall back to initial (not visible) - fill: 'freeze' - } - }; + // Create animation definition while also assigning an ID to the animation for later sync usage + var animationDefinition: Chartist.IChartistAnimations = { + 'stroke-dashoffset': { + id: 'anim' + data.index, + dur: 1000, + from: -pathLength + 'px', + to: '0px', + easing: Chartist.Svg.Easing.easeOutQuint, + // We need to use `fill: 'freeze'` otherwise our animation will fall back to initial (not visible) + fill: 'freeze' + } + }; - // If this was not the first slice, we need to time the animation so that it uses the end sync event of the previous animation - if (data.index !== 0) { - animationDefinition['stroke-dashoffset'].begin = 'anim' + (data.index - 1) + '.end'; + // If this was not the first slice, we need to time the animation so that it uses the end sync event of the previous animation + if (data.index !== 0) { + animationDefinition['stroke-dashoffset'].begin = 'anim' + (data.index - 1) + '.end'; + } + + // We need to set an initial value before the animation starts as we are not in guided mode which would do that for us + data.element.attr({ + 'stroke-dashoffset': -pathLength + 'px' + }); + + // We can't use guided mode as the animations need to rely on setting begin manually + // See http://gionkunz.github.io/chartist-js/api-documentation.html#chartistsvg-function-animate + data.element.animate(animationDefinition, false); } - - // We need to set an initial value before the animation starts as we are not in guided mode which would do that for us - data.element.attr({ - 'stroke-dashoffset': -pathLength + 'px' - }); - - // We can't use guided mode as the animations need to rely on setting begin manually - // See http://gionkunz.github.io/chartist-js/api-documentation.html#chartistsvg-function-animate - data.element.animate(animationDefinition, false); - } }); new Chartist.Bar('.ct-chart', { - labels: ['XS', 'S', 'M', 'L', 'XL', 'XXL', 'XXXL'], - series: [20, 60, 120, 200, 180, 20, 10] + labels: ['XS', 'S', 'M', 'L', 'XL', 'XXL', 'XXXL'], + series: [20, 60, 120, 200, 180, 20, 10] }, { distributeSeries: true - }); +}); new Chartist.Bar('.ct-chart', { - labels: ['Quarter 1', 'Quarter 2', 'Quarter 3', 'Quarter 4'], - series: [ - [5, 4, 3, 7], - [3, 2, 9, 5], - [1, 5, 8, 4], - [2, 3, 4, 6], - [4, 1, 2, 1] - ] + labels: ['Quarter 1', 'Quarter 2', 'Quarter 3', 'Quarter 4'], + series: [ + [5, 4, 3, 7], + [3, 2, 9, 5], + [1, 5, 8, 4], + [2, 3, 4, 6], + [4, 1, 2, 1] + ] }, { // Default mobile configuration stackBars: true, axisX: { - labelInterpolationFnc: (value: string) => { - return value.split(/\s+/).map((word: string) => { - return word[0]; - }).join(''); - } + labelInterpolationFnc: (value: string) => { + return value.split(/\s+/).map((word: string) => { + return word[0]; + }).join(''); + } }, axisY: { - offset: 20 + offset: 20 } - }, [ +}, [ // Options override for media > 400px ['screen and (min-width: 400px)', { - reverseData: true, - horizontalBars: true, - axisX: { - labelInterpolationFnc: Chartist.noop - }, - axisY: { - offset: 60 - } + reverseData: true, + horizontalBars: true, + axisX: { + labelInterpolationFnc: Chartist.noop + }, + axisY: { + offset: 60 + } }], // Options override for media > 800px ['screen and (min-width: 800px)', { - stackBars: false, - seriesBarDistance: 10 + stackBars: false, + seriesBarDistance: 10 }], // Options override for media > 1000px ['screen and (min-width: 1000px)', { - reverseData: false, - horizontalBars: false, - seriesBarDistance: 15 + reverseData: false, + horizontalBars: false, + seriesBarDistance: 15 }] - ]); +]); new Chartist.Pie('.ct-chart', { - series: [{ - value: 20, - name: 'Series 1', - className: 'my-custom-class-one', - meta: 'Meta One' - }, { - value: 10, - name: 'Series 2', - className: 'my-custom-class-two', - meta: 'Meta Two' + series: [{ + value: 20, + name: 'Series 1', + className: 'my-custom-class-one', + meta: 'Meta One' }, { - value: 70, - name: 'Series 3', - className: 'my-custom-class-three', - meta: 'Meta Three' + value: 10, + name: 'Series 2', + className: 'my-custom-class-two', + meta: 'Meta Two' + }, { + value: 70, + name: 'Series 3', + className: 'my-custom-class-three', + meta: 'Meta Three' }] }); new Chartist.Bar('.bar-chart', { - labels: ['foo', 'bar', 'foobar'], - series: [ - { - data: [1], - className: 'graph-foo', - }, - { - data: [10], - className: 'graph-foo', - }, - { - data: [12], - className: 'graph-foo', - }] -  }, { + labels: ['foo', 'bar', 'foobar'], + series: [ + { + data: [1], + className: 'graph-foo', + }, + { + data: [10], + className: 'graph-foo', + }, + { + data: [12], + className: 'graph-foo', + }] +}, { seriesBarDistance: 30, reverseData: true, horizontalBars: true, height: '115px', axisY: { - offset: 70, - showGrid: false, + offset: 70, + showGrid: false, }, axisX: { - scaleMinSpace: 200 + scaleMinSpace: 200 } - }); +}); new Chartist.Line('.ct-chart', { - labels: [1, 2, 3, 4, 5, 6, 7, 8], - series: [ - [5, 9, 7, 8, 5, 3, 5, 4] - ] + labels: [1, 2, 3, 4, 5, 6, 7, 8], + series: [ + [5, 9, 7, 8, 5, 3, 5, 4] + ] }, { ticks: [0, 4], low: 0, showArea: true, axisY: { - showLabel: true, - showGrid: false, - ticks: [1, 4], - type: Chartist.FixedScaleAxis + showLabel: true, + showGrid: false, + ticks: [1, 4], + type: Chartist.FixedScaleAxis } - }); +}); new Chartist.Line('.ct-chart', { - labels: [1, 2, 3, 4, 5, 6, 7, 8], - series: [ - [5, 9, 7, 8, 5, 3, 5, 4] - ] + labels: [1, 2, 3, 4, 5, 6, 7, 8], + series: [ + [5, 9, 7, 8, 5, 3, 5, 4] + ] }, { ticks: [0, 4], low: 0, showArea: true, axisX: { - showGrid: false + showGrid: false }, axisY: { - showLabel: true, - showGrid: false, - ticks: [1, 4], - type: Chartist.FixedScaleAxis + showLabel: true, + showGrid: false, + ticks: [1, 4], + type: Chartist.FixedScaleAxis } - }); +}); var chart2 = new Chartist.Line('.ct-chart', { - labels: [1, 2, 3, 4, 5], - series: [ - [12, 9, 7, 8, 5] - ] + labels: [1, 2, 3, 4, 5], + series: [ + [12, 9, 7, 8, 5] + ] }); // Listening for draw events that get emitted by the Chartist chart chart2.on('draw', (data: any) => { - // If the draw event was triggered from drawing a point on the line chart - if (data.type === 'point') { - // We are creating a new path SVG element that draws a triangle around the point coordinates - var triangle = new Chartist.Svg('path', { - d: ['M', - data.x, - data.y - 15, - 'L', - data.x - 15, - data.y + 8, - 'L', - data.x + 15, - data.y + 8, - 'z'].join(' '), - style: 'fill-opacity: 1' - }, 'ct-area'); + // If the draw event was triggered from drawing a point on the line chart + if (data.type === 'point') { + // We are creating a new path SVG element that draws a triangle around the point coordinates + var triangle = new Chartist.Svg('path', { + d: ['M', + data.x, + data.y - 15, + 'L', + data.x - 15, + data.y + 8, + 'L', + data.x + 15, + data.y + 8, + 'z'].join(' '), + style: 'fill-opacity: 1' + }, 'ct-area'); - // With data.element we get the Chartist SVG wrapper and we can replace the original point drawn by Chartist with our newly created triangle - data.element.replace(triangle); - } + // With data.element we get the Chartist SVG wrapper and we can replace the original point drawn by Chartist with our newly created triangle + data.element.replace(triangle); + } }); // Create a simple bi-polar bar chart var biPolarChart = new Chartist.Bar('.ct-chart', { - labels: ['W1', 'W2', 'W3', 'W4', 'W5', 'W6', 'W7', 'W8', 'W9', 'W10'], - series: [ - [1, 2, 4, 8, 6, -2, -1, -4, -6, -2] - ] + labels: ['W1', 'W2', 'W3', 'W4', 'W5', 'W6', 'W7', 'W8', 'W9', 'W10'], + series: [ + [1, 2, 4, 8, 6, -2, -1, -4, -6, -2] + ] }, { high: 10, low: -10, axisX: { - labelInterpolationFnc: (value: any, index: number) => { - return index % 2 === 0 ? value : null; - } + labelInterpolationFnc: (value: any, index: number) => { + return index % 2 === 0 ? value : null; + } } - }); +}); // Listen for draw events on the bar chart biPolarChart.on('draw', (data: any) => { - // If this draw event is of type bar we can use the data to create additional content - if (data.type === 'bar') { - // We use the group element of the current series to append a simple circle with the bar peek coordinates and a circle radius that is depending on the value - data.group.append(new Chartist.Svg('circle', { - cx: data.x2, - cy: data.y2, - r: Math.abs(Chartist.getMultiValue(data.value)) * 2 + 5 - }, 'ct-slice-pie')); - } + // If this draw event is of type bar we can use the data to create additional content + if (data.type === 'bar') { + // We use the group element of the current series to append a simple circle with the bar peek coordinates and a circle radius that is depending on the value + data.group.append(new Chartist.Svg('circle', { + cx: data.x2, + cy: data.y2, + r: Math.abs(Chartist.getMultiValue(data.value)) * 2 + 5 + }, 'ct-slice-pie')); + } }); new Chartist.Bar('.ct-chart', { - labels: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'], - series: [ - [5, 4, 3, 7, 5, 10, 3], - [3, 2, 9, 5, 4, 6, 4] - ] + labels: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'], + series: [ + [5, 4, 3, 7, 5, 10, 3], + [3, 2, 9, 5, 4, 6, 4] + ] }, { axisX: { - // On the x-axis start means top and end means bottom - position: 'start' + // On the x-axis start means top and end means bottom + position: 'start' }, axisY: { - // On the y-axis start means left and end means right - position: 'end' + // On the y-axis start means left and end means right + position: 'end' } - }); +}); new Chartist.Line('.ct-chart', { - labels: [1, 2, 3, 4, 5], - series: [[1, 2, 8, 1, 7]] + labels: [1, 2, 3, 4, 5], + series: [[1, 2, 8, 1, 7]] }, { lineSmooth: Chartist.Interpolation.none({ - fillHoles: false + fillHoles: false }) - }); +}); new Chartist.Line('.ct-chart', { - labels: [1, 2, 3, 4, 5], - series: [[1, 2, 8, 1, 7]] + labels: [1, 2, 3, 4, 5], + series: [[1, 2, 8, 1, 7]] }, { lineSmooth: Chartist.Interpolation.simple({ - divisor: 2, - fillHoles: false + divisor: 2, + fillHoles: false }) - }); +}); new Chartist.Line('.ct-chart', { - labels: [1, 2, 3, 4, 5], - series: [[1, 2, 8, 1, 7]] + labels: [1, 2, 3, 4, 5], + series: [[1, 2, 8, 1, 7]] }, { lineSmooth: Chartist.Interpolation.cardinal({ - tension: 1, - fillHoles: false + tension: 1, + fillHoles: false }) - }); +}); new Chartist.Line('.ct-chart', { - labels: [1, 2, 3, 4, 5], - series: [[1, 2, 8, 1, 7]] + labels: [1, 2, 3, 4, 5], + series: [[1, 2, 8, 1, 7]] }, { lineSmooth: Chartist.Interpolation.step({ - postpone: true, - fillHoles: false + postpone: true, + fillHoles: false }) - }); +}); var overlappingBarsData: Chartist.IChartistData = { - labels: ['Jan', 'Feb', 'Mar', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], - series: [ - [5, 4, 3, 7, 5, 10, 3, 4, 8, 10, 6, 8], - [3, 2, 9, 5, 4, 6, 4, 6, 7, 8, 7, 4] - ] + labels: ['Jan', 'Feb', 'Mar', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], + series: [ + [5, 4, 3, 7, 5, 10, 3, 4, 8, 10, 6, 8], + [3, 2, 9, 5, 4, 6, 4, 6, 7, 8, 7, 4] + ] }; var overlappingBarsOptions: Chartist.IBarChartOptions = { - seriesBarDistance: 10 + seriesBarDistance: 10 }; var overlappingBarsResponsiveOptions: Array> = [ - ['screen and (max-width: 640px)', { - seriesBarDistance: 5, - axisX: { - labelInterpolationFnc: (value: any) => { - return value[0]; - } - } - }] + ['screen and (max-width: 640px)', { + seriesBarDistance: 5, + axisX: { + labelInterpolationFnc: (value: any) => { + return value[0]; + } + } + }] ]; new Chartist.Bar('.ct-chart', overlappingBarsData, overlappingBarsOptions, overlappingBarsResponsiveOptions); new Chartist.Candle('.ct-chart', { - labels: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'], - series: [ - [5, 4, 3, 7], - [3, 2, 9, 5], - [5, 4, 3, 7], - [3, 2, 9, 5], - [5, 4, 3, 7], - [3, 2, 9, 5], - [3, 2, 9, 5] - ] + labels: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'], + series: [ + [5, 4, 3, 7], + [3, 2, 9, 5], + [5, 4, 3, 7], + [3, 2, 9, 5], + [5, 4, 3, 7], + [3, 2, 9, 5], + [3, 2, 9, 5] + ] }, { - axisX: { - labelOffset: { - x: -10, - y: 0 + axisX: { + labelOffset: { + x: -10, + y: 0 + } + }, + axisY: { + showGrid: false, + labelInterpolationFnc: function (value: any) { + return value + 12000; + } } - }, - axisY: { - showGrid: false, - labelInterpolationFnc: function (value: any) { - return value + 12000; - } - } }); diff --git a/types/chartist/index.d.ts b/types/chartist/index.d.ts index 93918a5eeb..4f8826de9c 100644 --- a/types/chartist/index.d.ts +++ b/types/chartist/index.d.ts @@ -5,699 +5,715 @@ declare namespace Chartist { - interface ChartistStatic { - - /** - * Precision level used internally in Chartist for rounding. If you require more decimal places you can increase this number. - */ - precision: number; - - /** - * A map with characters to escape for strings to be safely used as attribute values. - */ - escapingMap: IChartistEscapeMap; - - Pie: IChartistPieChart; - Bar: IChartistBarChart; - Line: IChartistLineChart; - Candle: IChartistCandleChart; - - FixedScaleAxis: IFixedScaleAxisStatic; - AutoScaleAxis: IAutoScaleAxisStatic; - StepAxis: IStepAxisStatic; - - Svg: ChartistSvgStatic; - Interpolation: ChartistInterpolationStatic; - - noop: Function; - - alphaNumerate(n: number): string; - extend(target: Object, ...sources: Object[]): Object; - - replaceAll(str: string, subStr: string, newSubStr: string): string; - ensureUnit(value: number, unit: string): string; - quantity(input: string | number): Object; - - query(query: Node | string): Node; - times(length: number): Array; - sum(previous: number, current: number): number; - mapMultiply(factor: number): (num: number) => number; - mapAdd(addend: number): (num: number) => number; - serialMap(arr: Array, cb: Function): Array; - roundWithPrecision(value: number, digits?: number): number; - - getMultiValue(value: any, dimension?: any): number; // this method is not documented, but it is used in the examples - - serialize(data: Object | string | number): string; - deserialize(data: string): Object | string | number; - - createSvg(container: Node, width: string, height: string, className: string): Object; // TODO: Figure out if this is returning a ChartistSVGWrapper or an actual SVGElement - - plugins: any; - } - - interface IChartistEscapeMap { - [Key: string]: string; - } - - interface IResponsiveOptionTuple extends Array { - 0: string; - 1: T; - } - - // these have no other purpose than to help define the types that can be placed on - // a line chart axisX - // in the actual chartist library these are classes that project their options onto - // the parent class - interface IFixedScaleAxisStatic { } - interface IAutoScaleAxisStatic { } - interface IStepAxisStatic { } - - // data formats are not well documented on all the ways they can be passed to the constructors - // this definition gives some intellisense, but does not protect the user from misuse - // TODO: come in and tidy this up and make it fit better - interface IChartistData { - labels?: Array | Array | Array; - series: Array | Array> | Array | Array>; - } - - interface IChartistSeriesData { - name?: string; - value?: number; - data?: Array; - className?: string; - meta?: string; // I assume this could probably be a number as well? - } - - interface IChartistBase { - container: any; - data: IChartistData; - defaultOptions: T; - options: T; - responsiveOptions: Array>; - - // this most likely doesn't need to be exposed to the user - eventEmitter: any; - - supportsForeignObject: boolean; - supportsAnimations: boolean; - resizeListener: any; - - plugins?: Array; // all of these plugins seem to be functions with options, but keeping type any for now - - update(data: Object, options?: T, override?: boolean): void; - detach(): void; - - /** - * Use this function to register event handlers. The handler callbacks are synchronous and will run in the main thread rather than the event loop. - * - * @method on - * @param event {string} Name of the event. Check the examples for supported events. - * @param handler {Function} The handler function that will be called when an event with the given name was emitted. This function will receive a data argument which contains event data. See the example for more details. - */ - on(event: string, handler: Function): IChartistBase; - - /** - * Use this function to un-register event handlers. If the handler function parameter is omitted all handlers for the given event will be un-registered. - * - * @method off - * @param event {string} Name of the event for which a handler should be removed - * @param handler {Function} The handler function that that was previously used to register a new event handler. This handler will be removed from the event handler list. If this parameter is omitted then all event handlers for the given event are removed from the list. - */ - off(event: string, handler?: Function): IChartistBase; - } - - interface IChartistPieChart extends IChartistBase { - new (target: any, data: IChartistData, options?: IPieChartOptions, responsiveOptions?: Array>): IChartistPieChart; - } - - interface IChartistLineChart extends IChartistBase { - new (target: any, data: IChartistData, options?: ILineChartOptions, responsiveOptions?: Array>): IChartistLineChart; - } - - interface IChartistBarChart extends IChartistBase { - new (target: any, data: IChartistData, options?: IBarChartOptions, responsiveOptions?: Array>): IChartistBarChart; - } - - interface IChartistCandleChart extends IChartistBase { - new (target: any, data: IChartistData, options?: ICandleChartOptions, responsiveOptions?: Array>): IChartistCandleChart; - } - - interface IChartOptions { - /** - * If true the whole data is reversed including labels, the series order as well as the whole series data arrays. - */ - reverseData?: boolean; - - plugins?: Array; - } - - interface IPieChartOptions extends IChartOptions { - /** - * Specify a fixed width for the chart as a string (i.e. '100px' or '50%') - */ - width?: number | string; - - /** - * Specify a fixed height for the chart as a string (i.e. '100px' or '50%') - */ - height?: number | string; - - /** - * Padding of the chart drawing area to the container element and labels as a number or padding object {top: 5, right: 5, bottom: 5, left: 5} - */ - chartPadding?: IChartPadding | number; - - /** - * Override the class names that are used to generate the SVG structure of the chart - */ - classNames?: IPieChartClasses; - - /** - * The start angle of the pie chart in degrees where 0 points north. A higher value offsets the start angle clockwise. - */ - startAngle?: number; - - /** - * An optional total you can specify. By specifying a total value, the sum of the values in the series must be this total in order to draw a full pie. You can use this parameter to draw only parts of a pie or gauge charts. - */ - total?: number; - - /** - * If specified the donut CSS classes will be used and strokes will be drawn instead of pie slices. - */ - donut?: boolean; - - /** - * If specified the donut segments will be drawn as shapes instead of strokes. - */ - donutSolid?: boolean; - - /** - * Specify the donut stroke width, currently done in javascript for convenience. May move to CSS styles in the future. - * This option can be set as number or string to specify a relative width (i.e. 100 or '30%'). - */ - donutWidth?: number | string; - - /** - * Specify if a label should be shown or not - */ - showLabel?: boolean; - - /** - * Label position offset from the standard position which is half distance of the radius. This value can be either positive or negative. Positive values will position the label away from the center. - */ - labelOffset?: number; - - /** - * This option can be set to 'inside', 'outside' or 'center'. Positioned with 'inside' the labels will be placed on half the distance of the radius to the border of the Pie by respecting the 'labelOffset'. The 'outside' option will place the labels at the border of the pie and 'center' will place the labels in the absolute center point of the chart. The 'center' option only makes sense in conjunction with the 'labelOffset' option. - */ - labelPosition?: string; - - /** - * An interpolation function for the label value - */ - labelInterpolationFnc?: Function; - - /** - * Label direction can be 'neutral', 'explode' or 'implode'. Default is 'neutral'. The labels anchor will be positioned based on those settings as well as the fact if the labels are on the right or left side of the center of the chart. Usually explode is useful when labels are positioned far away from the center. - */ - labelDirection?: string; - - /** - * If true the whole data is reversed including labels, the series order as well as the whole series data arrays. - */ - reverseData?: boolean; - - /** - * If true empty values will be ignored to avoid drawing unncessary slices and labels - */ - ignoreEmptyValues?: boolean; - } - - interface IChartPadding { - top?: number; - right?: number; - bottom?: number; - left?: number; - } - - interface IPieChartClasses { - chartPie?: string; - chartDonut?: string; - series?: string; - slicePie?: string; - sliceDonut?: string; - label?: string; - } - - interface IBarChartOptions extends IChartOptions { - axisX?: IBarChartAxis; - axisY?: IBarChartAxis; - width?: number | string; - height?: number | string; - high?: number; - low?: number; - ticks?: Array; - onlyInteger?: boolean; - chartPadding?: IChartPadding; - seriesBarDistance?: number; - - /** - * If set to true this property will cause the series bars to be stacked and form a total for each series point. This will also influence the y-axis and the overall bounds of the chart. In stacked mode the seriesBarDistance property will have no effect. - */ - stackBars?: boolean; - - horizontalBars?: boolean; - distributeSeries?: boolean; - } - - interface IBarChartAxis { - offset?: number; - position?: string; - labelOffset?: { - x?: number; - y?: number; - }; - showLabel?: boolean; - showGrid?: boolean; - labelInterpolationFnc?: Function; - scaleMinSpace?: number; - onlyInteger?: boolean; - } - - interface IBarChartClasses { - chart?: string; - horizontalBars?: string; - label?: string; - labelGroup?: string; - series?: string; - bar?: string; - grid?: string; - gridGroup?: string; - vertical?: string; - horizontal?: string; - start?: string; - end?: string; - } - - interface ILineChartOptions extends IChartOptions { - axisX?: IChartistStepAxis | IChartistFixedScaleAxis | IChartistAutoScaleAxis; - axisY?: IChartistStepAxis | IChartistFixedScaleAxis | IChartistAutoScaleAxis; - width?: number | string; - height?: number | string; - showLine?: boolean; - showPoint?: boolean; - showArea?: boolean; - areaBase?: number; - lineSmooth?: Function | boolean; - low?: number; - high?: number; - ticks?: Array; - chartPadding?: IChartPadding; - fullWidth?: boolean; - classNames?: ILineChartClasses; - } - - interface ILineChartAxis { - offset?: number; - position?: string; - labelOffset?: { - x?: number; - y?: number; - }; - showLabel?: boolean; - showGrid?: boolean; - labelInterpolationFnc?: Function; - } - - interface IChartistStepAxis extends ILineChartAxis { - type?: IStepAxisStatic; - ticks?: Array | Array; - stretch?: boolean; - } - - interface IChartistFixedScaleAxis extends ILineChartAxis { - type?: IFixedScaleAxisStatic; - high?: number; - low?: number; - divisor?: number; - ticks?: Array | Array; - } - - interface IChartistAutoScaleAxis extends ILineChartAxis { - high?: number; - low?: number; - scaleMinSpace?: number; - onlyInteger?: boolean; - referenceValue?: number; - type?: IAutoScaleAxisStatic; - } - - interface ILineChartClasses { - /** - * Default is 'ct-chart-line' - */ - chart?: string; - label?: string; - labelGroup?: string; - series?: string; - line?: string; - point?: string; - area?: string; - grid?: string; - gridGroup?: string; - gridBackground?: string; - vertical?: string; - horizontal?: string; - start?: string; - end?: string; - } - - interface ICandleChartOptions extends IChartOptions { - - /** - * Options for X-Axis - */ - axisX?: ICandleChartAxis; - - /** - * Options for Y-Axis - */ - axisY?: ICandleChartAxis; - - /** - * Specify a fixed width for the chart as a string (i.e. '100px' or '50%') - */ - width?: number | string; - - /** - * Specify a fixed height for the chart as a string (i.e. '100px' or '50%') - */ - height?: number | string; - - /** - * Overriding the natural high of the chart allows you to zoom in or limit the charts highest displayed value - */ - hight?: number | string; - - /** - * Overriding the natural low of the chart allows you to zoom in or limit the charts lowest displayed value - */ - low?: number | string; - - /** - * Width of candle body in pixel (IMO is 2 px best minimum value) - */ - candleWidth?: number | string; - - /** - * Width of candle wick in pixel (IMO is 1 px best minimum value) - */ - candleWickWidth?: number | string; - - /** - * Use calculated x-axis step length, depending on the number of quotes to display, as candle width. Otherwise the candleWidth is being used. - */ - useStepLengthAsCandleWidth?: boolean | string; - - /** - * Use 1/3 of candle body width as width for the candle wick, otherwise the candleWickWidth is being used. - */ - useOneThirdAsCandleWickWidth?: boolean | string; - - /** - * Padding of the chart drawing area to the container element and labels as a number or padding object {top: 5, right: 5, bottom: 5, left: 5} - */ - chartPadding?: IChartPadding | number; - - /** - * When set to true, the last grid line on the x-axis is not drawn and the chart elements will expand to the full available width of the chart. For the last label to be drawncorrectly you might need to add chart padding or offset the last label with a draw event handler. - */ - fullWidth?: boolean | string; - - /** - * Override the class names that get used to generate the SVG structure of the chart - */ - classNames?: ICandleChartClasses; - } - - interface ICandleChartAxis { - /** - * The offset of the chart drawing area to the border of the container - */ - offset?: number; - /** - * Position where labels are placed. Can be set to `start` or `end` where `start` is equivalent to left or top on vertical axis and `end` is equivalent to right or bottom on horizontal axis. - */ - position?: string; - /** - * Allows you to correct label positioning on this axis by positive or negative x and y offset. - */ - labelOffset?: { - x?: number; - y?: number; - }; - /** - * If labels should be shown or not - */ - showLabel?: boolean; - /** - * If the axis grid should be drawn or not - */ - showGrid?: boolean; - /** - * Interpolation function that allows you to intercept the value from the axis label - */ - labelInterpolationFnc?: Function; - /** - * Set the axis type to be used to project values on this axis. If not defined, Chartist.StepAxis will be used for the X-Axis, where the ticks option will be set to the labels in the data and the stretch option will be set to the global fullWidth option. This type can be changed to any axis constructor available (e.g. Chartist.FixedScaleAxis), where all axis options should be present here. - */ - type?: any; - } - - interface ICandleChartClasses { - chart?: string; - label?: string; - labelGroup?: string; - series?: string; - candlePositive?: string; - candleNegative?: string, - grid?: string, - gridGroup?: string, - gridBackground?: string, - vertical?: string, - horizontal?: string, - start?: string, - end?: string, - } - - - interface ChartistSvgStatic { - new (name: HTMLElement | string, attributes: Object, className?: string, parent?: Object, insertFirst?: boolean): IChartistSvg; - - Easing: ChartistEasingStatic; - - /** - * This method checks for support of a given SVG feature like Extensibility, SVG-animation or the like. Check http://www.w3.org/TR/SVG11/feature for a detailed list. - */ - isSupported(feature: string): boolean; - } - - interface IChartistSvg { - - /** - * Set attributes on the current SVG element of the wrapper you're currently working on. - */ - attr(attributes: Object | string, ns: string): Object | string; - - /** - * Create a new SVG element whose wrapper object will be selected for further operations. This way you can also create nested groups easily. - */ - elem(name: string, attributes?: Object, className?: string, insertFirst?: boolean): IChartistSvg; - - /** - * Returns the parent Chartist.SVG wrapper object - */ - parent(): IChartistSvg; - - /** - * This method returns a Chartist.Svg wrapper around the root SVG element of the current tree. - */ - root(): IChartistSvg; - - /** - * Find the first child SVG element of the current element that matches a CSS selector. The returned object is a Chartist.Svg wrapper. - */ - querySelector(selector: string): IChartistSvg; - - /** - * Find the all child SVG elements of the current element that match a CSS selector. The returned object is a Chartist.Svg.List wrapper. - */ - querySelectorAll(selector: string): any; // this returns an svg wrapper list in the docs, need to see if that's just an array or a special list - - /** - * This method creates a foreignObject (see https://developer.mozilla.org/en-US/docs/Web/SVG/Element/foreignObject) that allows to embed HTML content into a SVG graphic. With the help of foreignObjects you can enable the usage of regular HTML elements inside of SVG where they are subject for SVG positioning and transformation but the Browser will use the HTML rendering capabilities for the containing DOM. - */ - foreignObject(content: any, attributes?: Object, className?: string, insertFirst?: boolean): IChartistSvg; - - /** - * This method adds a new text element to the current Chartist.Svg wrapper. - */ - text(t: string): IChartistSvg; - - /** - * This method will clear all child nodes of the current wrapper object. - */ - empty(): IChartistSvg; - - /** - * This method will cause the current wrapper to remove itself from its parent wrapper. Use this method if you'd like to get rid of an element in a given DOM structure. - */ - remove(): IChartistSvg; - - /** - * This method will replace the element with a new element that can be created outside of the current DOM. - */ - replace(): IChartistSvg; - - /** - * This method will append an element to the current element as a child. - */ - append(element: IChartistSvg, insertFirst?: boolean): IChartistSvg; - - /** - * Returns an array of class names that are attached to the current wrapper element. This method can not be chained further. - */ - classes(): Array; - - /** - * Adds one or a space separated list of classes to the current element and ensures the classes are only existing once. - * - * @method addClass - * @param names {string} A white space separated list of class names - */ - addClass(names: string): IChartistSvg; - - /** - * Removes one or a space separated list of classes from the current element. - * - * @method removeClass - * @param names {string} A white space separated list of class names - */ - removeClass(names: string): IChartistSvg; - - /** - * Removes all classes from the current element. - */ - removeAllClasses(): IChartistSvg; - - /** - * Get element height with fallback to svg BoundingBox or parent container dimensions - */ - height(): number; - - /** - * The animate function lets you animate the current element with SMIL animations. You can add animations for multiple attributes at the same time by using an animation definition object. This object should contain SMIL animation attributes. - */ - animate(animations: IChartistAnimations, guided: boolean, eventEmitter: Object): IChartistSvg; - - /** - * "Safe" way to get property value from svg BoundingBox. This is a workaround. Firefox throws an NS_ERROR_FAILURE error if getBBox() is called on an invisible node. - * THIS IS A WORKAROUND - */ - getBBoxProperty(node: SVGElement, prop: string): string; // TODO: find a good example of this and add it to the tests, it might belong to static - } - - interface IChartistAnimations { - [Key: string]: IChartistAnimationOptions; - } - - interface IChartistAnimationOptions { - id?: string; - dur: string | number; - from: string | number; - to: string | number; - easing?: IChartistEasingDefinition | string; - fill?: string; - begin?: string; - } - - interface IChartistEasingDefinition { - 0: number; - 1: number; - 2: number; - 3: number; - } - - interface ChartistEasingStatic { - easeInSine: IChartistEasingDefinition; - easeOutSine: IChartistEasingDefinition; - easeInOutSine: IChartistEasingDefinition; - easeInQuad: IChartistEasingDefinition; - easeOutQuad: IChartistEasingDefinition; - easeInOutQuad: IChartistEasingDefinition; - easeInCubic: IChartistEasingDefinition; - easeOutCubic: IChartistEasingDefinition; - easeInOutCubic: IChartistEasingDefinition; - easeInQuart: IChartistEasingDefinition; - easeOutQuart: IChartistEasingDefinition; - easeInOutQuart: IChartistEasingDefinition; - easeInQuint: IChartistEasingDefinition; - easeOutQuint: IChartistEasingDefinition; - easeInOutQuint: IChartistEasingDefinition; - easeInExpo: IChartistEasingDefinition; - easeOutExpo: IChartistEasingDefinition; - easeInOutExpo: IChartistEasingDefinition; - easeInCirc: IChartistEasingDefinition; - easeOutCirc: IChartistEasingDefinition; - easeInOutCirc: IChartistEasingDefinition; - easeInBack: IChartistEasingDefinition; - easeOutBack: IChartistEasingDefinition; - easeInOutBack: IChartistEasingDefinition; - } - - interface ChartistInterpolationStatic { - - /** - * This interpolation function does not smooth the path and the result is only containing lines and no curves. - */ - none(options?: IChartistInterpolationOptions): Function; - - /** - * Simple smoothing creates horizontal handles that are positioned with a fraction of the length between two data points. You can use the divisor option to specify the amount of smoothing. - */ - simple(options?: IChartistSimpleInterpolationOptions): Function; - - /** - * Cardinal / Catmull-Rome spline interpolation is the default smoothing function in Chartist. It produces nice results where the splines will always meet the points. It produces some artifacts though when data values are increased or decreased rapidly. The line may not follow a very accurate path and if the line should be accurate this smoothing function does not produce the best results. - */ - cardinal(options?: IChartistCardinalInterpolationOptions): Function; - - /** - * Step interpolation will cause the line chart to move in steps rather than diagonal or smoothed lines. This interpolation will create additional points that will also be drawn when the showPoint option is enabled. - */ - step(options?: IChartistStepInterpolationOptions): Function; - } - - interface IChartistInterpolationOptions { - fillHoles?: boolean; - } - - interface IChartistSimpleInterpolationOptions extends IChartistInterpolationOptions { - divisor?: number; - } - - interface IChartistCardinalInterpolationOptions extends IChartistInterpolationOptions { - tension?: number; - } - - interface IChartistStepInterpolationOptions extends IChartistInterpolationOptions { - postpone?: boolean; - } + interface ChartistStatic { + + /** + * Precision level used internally in Chartist for rounding. If you require more decimal places you can increase this number. + */ + precision: number; + + /** + * A map with characters to escape for strings to be safely used as attribute values. + */ + escapingMap: IChartistEscapeMap; + + Pie: IChartistPieChart; + Bar: IChartistBarChart; + Line: IChartistLineChart; + Candle: IChartistCandleChart; + + FixedScaleAxis: IFixedScaleAxisStatic; + AutoScaleAxis: IAutoScaleAxisStatic; + StepAxis: IStepAxisStatic; + + Svg: ChartistSvgStatic; + Interpolation: ChartistInterpolationStatic; + + noop: Function; + + alphaNumerate(n: number): string; + + extend(target: Object, ...sources: Object[]): Object; + + replaceAll(str: string, subStr: string, newSubStr: string): string; + + ensureUnit(value: number, unit: string): string; + + quantity(input: string | number): Object; + + query(query: Node | string): Node; + + times(length: number): Array; + + sum(previous: number, current: number): number; + + mapMultiply(factor: number): (num: number) => number; + + mapAdd(addend: number): (num: number) => number; + + serialMap(arr: Array, cb: Function): Array; + + roundWithPrecision(value: number, digits?: number): number; + + getMultiValue(value: any, dimension?: any): number; // this method is not documented, but it is used in the examples + + serialize(data: Object | string | number): string; + + deserialize(data: string): Object | string | number; + + createSvg(container: Node, width: string, height: string, className: string): Object; // TODO: Figure out if this is returning a ChartistSVGWrapper or an actual SVGElement + + plugins: any; + } + + interface IChartistEscapeMap { + [Key: string]: string; + } + + interface IResponsiveOptionTuple extends Array { + 0: string; + 1: T; + } + + // these have no other purpose than to help define the types that can be placed on + // a line chart axisX + // in the actual chartist library these are classes that project their options onto + // the parent class + interface IFixedScaleAxisStatic { + } + + interface IAutoScaleAxisStatic { + } + + interface IStepAxisStatic { + } + + // data formats are not well documented on all the ways they can be passed to the constructors + // this definition gives some intellisense, but does not protect the user from misuse + // TODO: come in and tidy this up and make it fit better + interface IChartistData { + labels?: Array | Array | Array; + series: Array | Array> | Array | Array>; + } + + interface IChartistSeriesData { + name?: string; + value?: number; + data?: Array; + className?: string; + meta?: string; // I assume this could probably be a number as well? + } + + interface IChartistBase { + container: any; + data: IChartistData; + defaultOptions: T; + options: T; + responsiveOptions: Array>; + + // this most likely doesn't need to be exposed to the user + eventEmitter: any; + + supportsForeignObject: boolean; + supportsAnimations: boolean; + resizeListener: any; + + plugins?: Array; // all of these plugins seem to be functions with options, but keeping type any for now + + update(data: Object, options?: T, override?: boolean): void; + + detach(): void; + + /** + * Use this function to register event handlers. The handler callbacks are synchronous and will run in the main thread rather than the event loop. + * + * @method on + * @param event {string} Name of the event. Check the examples for supported events. + * @param handler {Function} The handler function that will be called when an event with the given name was emitted. This function will receive a data argument which contains event data. See the example for more details. + */ + on(event: string, handler: Function): IChartistBase; + + /** + * Use this function to un-register event handlers. If the handler function parameter is omitted all handlers for the given event will be un-registered. + * + * @method off + * @param event {string} Name of the event for which a handler should be removed + * @param handler {Function} The handler function that that was previously used to register a new event handler. This handler will be removed from the event handler list. If this parameter is omitted then all event handlers for the given event are removed from the list. + */ + off(event: string, handler?: Function): IChartistBase; + } + + interface IChartistPieChart extends IChartistBase { + new (target: any, data: IChartistData, options?: IPieChartOptions, responsiveOptions?: Array>): IChartistPieChart; + } + + interface IChartistLineChart extends IChartistBase { + new (target: any, data: IChartistData, options?: ILineChartOptions, responsiveOptions?: Array>): IChartistLineChart; + } + + interface IChartistBarChart extends IChartistBase { + new (target: any, data: IChartistData, options?: IBarChartOptions, responsiveOptions?: Array>): IChartistBarChart; + } + + interface IChartistCandleChart extends IChartistBase { + new (target: any, data: IChartistData, options?: ICandleChartOptions, responsiveOptions?: Array>): IChartistCandleChart; + } + + interface IChartOptions { + /** + * If true the whole data is reversed including labels, the series order as well as the whole series data arrays. + */ + reverseData?: boolean; + + plugins?: Array; + } + + interface IPieChartOptions extends IChartOptions { + /** + * Specify a fixed width for the chart as a string (i.e. '100px' or '50%') + */ + width?: number | string; + + /** + * Specify a fixed height for the chart as a string (i.e. '100px' or '50%') + */ + height?: number | string; + + /** + * Padding of the chart drawing area to the container element and labels as a number or padding object {top: 5, right: 5, bottom: 5, left: 5} + */ + chartPadding?: IChartPadding | number; + + /** + * Override the class names that are used to generate the SVG structure of the chart + */ + classNames?: IPieChartClasses; + + /** + * The start angle of the pie chart in degrees where 0 points north. A higher value offsets the start angle clockwise. + */ + startAngle?: number; + + /** + * An optional total you can specify. By specifying a total value, the sum of the values in the series must be this total in order to draw a full pie. You can use this parameter to draw only parts of a pie or gauge charts. + */ + total?: number; + + /** + * If specified the donut CSS classes will be used and strokes will be drawn instead of pie slices. + */ + donut?: boolean; + + /** + * If specified the donut segments will be drawn as shapes instead of strokes. + */ + donutSolid?: boolean; + + /** + * Specify the donut stroke width, currently done in javascript for convenience. May move to CSS styles in the future. + * This option can be set as number or string to specify a relative width (i.e. 100 or '30%'). + */ + donutWidth?: number | string; + + /** + * Specify if a label should be shown or not + */ + showLabel?: boolean; + + /** + * Label position offset from the standard position which is half distance of the radius. This value can be either positive or negative. Positive values will position the label away from the center. + */ + labelOffset?: number; + + /** + * This option can be set to 'inside', 'outside' or 'center'. Positioned with 'inside' the labels will be placed on half the distance of the radius to the border of the Pie by respecting the 'labelOffset'. The 'outside' option will place the labels at the border of the pie and 'center' will place the labels in the absolute center point of the chart. The 'center' option only makes sense in conjunction with the 'labelOffset' option. + */ + labelPosition?: string; + + /** + * An interpolation function for the label value + */ + labelInterpolationFnc?: Function; + + /** + * Label direction can be 'neutral', 'explode' or 'implode'. Default is 'neutral'. The labels anchor will be positioned based on those settings as well as the fact if the labels are on the right or left side of the center of the chart. Usually explode is useful when labels are positioned far away from the center. + */ + labelDirection?: string; + + /** + * If true the whole data is reversed including labels, the series order as well as the whole series data arrays. + */ + reverseData?: boolean; + + /** + * If true empty values will be ignored to avoid drawing unncessary slices and labels + */ + ignoreEmptyValues?: boolean; + } + + interface IChartPadding { + top?: number; + right?: number; + bottom?: number; + left?: number; + } + + interface IPieChartClasses { + chartPie?: string; + chartDonut?: string; + series?: string; + slicePie?: string; + sliceDonut?: string; + label?: string; + } + + interface IBarChartOptions extends IChartOptions { + axisX?: IBarChartAxis; + axisY?: IBarChartAxis; + width?: number | string; + height?: number | string; + high?: number; + low?: number; + ticks?: Array; + onlyInteger?: boolean; + chartPadding?: IChartPadding; + seriesBarDistance?: number; + + /** + * If set to true this property will cause the series bars to be stacked and form a total for each series point. This will also influence the y-axis and the overall bounds of the chart. In stacked mode the seriesBarDistance property will have no effect. + */ + stackBars?: boolean; + + horizontalBars?: boolean; + distributeSeries?: boolean; + } + + interface IBarChartAxis { + offset?: number; + position?: string; + labelOffset?: { + x?: number; + y?: number; + }; + showLabel?: boolean; + showGrid?: boolean; + labelInterpolationFnc?: Function; + scaleMinSpace?: number; + onlyInteger?: boolean; + } + + interface IBarChartClasses { + chart?: string; + horizontalBars?: string; + label?: string; + labelGroup?: string; + series?: string; + bar?: string; + grid?: string; + gridGroup?: string; + vertical?: string; + horizontal?: string; + start?: string; + end?: string; + } + + interface ILineChartOptions extends IChartOptions { + axisX?: IChartistStepAxis | IChartistFixedScaleAxis | IChartistAutoScaleAxis; + axisY?: IChartistStepAxis | IChartistFixedScaleAxis | IChartistAutoScaleAxis; + width?: number | string; + height?: number | string; + showLine?: boolean; + showPoint?: boolean; + showArea?: boolean; + areaBase?: number; + lineSmooth?: Function | boolean; + low?: number; + high?: number; + ticks?: Array; + chartPadding?: IChartPadding; + fullWidth?: boolean; + classNames?: ILineChartClasses; + } + + interface ILineChartAxis { + offset?: number; + position?: string; + labelOffset?: { + x?: number; + y?: number; + }; + showLabel?: boolean; + showGrid?: boolean; + labelInterpolationFnc?: Function; + } + + interface IChartistStepAxis extends ILineChartAxis { + type?: IStepAxisStatic; + ticks?: Array | Array; + stretch?: boolean; + } + + interface IChartistFixedScaleAxis extends ILineChartAxis { + type?: IFixedScaleAxisStatic; + high?: number; + low?: number; + divisor?: number; + ticks?: Array | Array; + } + + interface IChartistAutoScaleAxis extends ILineChartAxis { + high?: number; + low?: number; + scaleMinSpace?: number; + onlyInteger?: boolean; + referenceValue?: number; + type?: IAutoScaleAxisStatic; + } + + interface ILineChartClasses { + /** + * Default is 'ct-chart-line' + */ + chart?: string; + label?: string; + labelGroup?: string; + series?: string; + line?: string; + point?: string; + area?: string; + grid?: string; + gridGroup?: string; + gridBackground?: string; + vertical?: string; + horizontal?: string; + start?: string; + end?: string; + } + + interface ICandleChartOptions extends IChartOptions { + + /** + * Options for X-Axis + */ + axisX?: ICandleChartAxis; + + /** + * Options for Y-Axis + */ + axisY?: ICandleChartAxis; + + /** + * Specify a fixed width for the chart as a string (i.e. '100px' or '50%') + */ + width?: number | string; + + /** + * Specify a fixed height for the chart as a string (i.e. '100px' or '50%') + */ + height?: number | string; + + /** + * Overriding the natural high of the chart allows you to zoom in or limit the charts highest displayed value + */ + hight?: number | string; + + /** + * Overriding the natural low of the chart allows you to zoom in or limit the charts lowest displayed value + */ + low?: number | string; + + /** + * Width of candle body in pixel (IMO is 2 px best minimum value) + */ + candleWidth?: number | string; + + /** + * Width of candle wick in pixel (IMO is 1 px best minimum value) + */ + candleWickWidth?: number | string; + + /** + * Use calculated x-axis step length, depending on the number of quotes to display, as candle width. Otherwise the candleWidth is being used. + */ + useStepLengthAsCandleWidth?: boolean | string; + + /** + * Use 1/3 of candle body width as width for the candle wick, otherwise the candleWickWidth is being used. + */ + useOneThirdAsCandleWickWidth?: boolean | string; + + /** + * Padding of the chart drawing area to the container element and labels as a number or padding object {top: 5, right: 5, bottom: 5, left: 5} + */ + chartPadding?: IChartPadding | number; + + /** + * When set to true, the last grid line on the x-axis is not drawn and the chart elements will expand to the full available width of the chart. For the last label to be drawncorrectly you might need to add chart padding or offset the last label with a draw event handler. + */ + fullWidth?: boolean | string; + + /** + * Override the class names that get used to generate the SVG structure of the chart + */ + classNames?: ICandleChartClasses; + } + + interface ICandleChartAxis { + /** + * The offset of the chart drawing area to the border of the container + */ + offset?: number; + /** + * Position where labels are placed. Can be set to `start` or `end` where `start` is equivalent to left or top on vertical axis and `end` is equivalent to right or bottom on horizontal axis. + */ + position?: string; + /** + * Allows you to correct label positioning on this axis by positive or negative x and y offset. + */ + labelOffset?: { + x?: number; + y?: number; + }; + /** + * If labels should be shown or not + */ + showLabel?: boolean; + /** + * If the axis grid should be drawn or not + */ + showGrid?: boolean; + /** + * Interpolation function that allows you to intercept the value from the axis label + */ + labelInterpolationFnc?: Function; + /** + * Set the axis type to be used to project values on this axis. If not defined, Chartist.StepAxis will be used for the X-Axis, where the ticks option will be set to the labels in the data and the stretch option will be set to the global fullWidth option. This type can be changed to any axis constructor available (e.g. Chartist.FixedScaleAxis), where all axis options should be present here. + */ + type?: any; + } + + interface ICandleChartClasses { + chart?: string; + label?: string; + labelGroup?: string; + series?: string; + candlePositive?: string; + candleNegative?: string, + grid?: string, + gridGroup?: string, + gridBackground?: string, + vertical?: string, + horizontal?: string, + start?: string, + end?: string, + } + + + interface ChartistSvgStatic { + new (name: HTMLElement | string, attributes: Object, className?: string, parent?: Object, insertFirst?: boolean): IChartistSvg; + + Easing: ChartistEasingStatic; + + /** + * This method checks for support of a given SVG feature like Extensibility, SVG-animation or the like. Check http://www.w3.org/TR/SVG11/feature for a detailed list. + */ + isSupported(feature: string): boolean; + } + + interface IChartistSvg { + + /** + * Set attributes on the current SVG element of the wrapper you're currently working on. + */ + attr(attributes: Object | string, ns: string): Object | string; + + /** + * Create a new SVG element whose wrapper object will be selected for further operations. This way you can also create nested groups easily. + */ + elem(name: string, attributes?: Object, className?: string, insertFirst?: boolean): IChartistSvg; + + /** + * Returns the parent Chartist.SVG wrapper object + */ + parent(): IChartistSvg; + + /** + * This method returns a Chartist.Svg wrapper around the root SVG element of the current tree. + */ + root(): IChartistSvg; + + /** + * Find the first child SVG element of the current element that matches a CSS selector. The returned object is a Chartist.Svg wrapper. + */ + querySelector(selector: string): IChartistSvg; + + /** + * Find the all child SVG elements of the current element that match a CSS selector. The returned object is a Chartist.Svg.List wrapper. + */ + querySelectorAll(selector: string): any; // this returns an svg wrapper list in the docs, need to see if that's just an array or a special list + + /** + * This method creates a foreignObject (see https://developer.mozilla.org/en-US/docs/Web/SVG/Element/foreignObject) that allows to embed HTML content into a SVG graphic. With the help of foreignObjects you can enable the usage of regular HTML elements inside of SVG where they are subject for SVG positioning and transformation but the Browser will use the HTML rendering capabilities for the containing DOM. + */ + foreignObject(content: any, attributes?: Object, className?: string, insertFirst?: boolean): IChartistSvg; + + /** + * This method adds a new text element to the current Chartist.Svg wrapper. + */ + text(t: string): IChartistSvg; + + /** + * This method will clear all child nodes of the current wrapper object. + */ + empty(): IChartistSvg; + + /** + * This method will cause the current wrapper to remove itself from its parent wrapper. Use this method if you'd like to get rid of an element in a given DOM structure. + */ + remove(): IChartistSvg; + + /** + * This method will replace the element with a new element that can be created outside of the current DOM. + */ + replace(): IChartistSvg; + + /** + * This method will append an element to the current element as a child. + */ + append(element: IChartistSvg, insertFirst?: boolean): IChartistSvg; + + /** + * Returns an array of class names that are attached to the current wrapper element. This method can not be chained further. + */ + classes(): Array; + + /** + * Adds one or a space separated list of classes to the current element and ensures the classes are only existing once. + * + * @method addClass + * @param names {string} A white space separated list of class names + */ + addClass(names: string): IChartistSvg; + + /** + * Removes one or a space separated list of classes from the current element. + * + * @method removeClass + * @param names {string} A white space separated list of class names + */ + removeClass(names: string): IChartistSvg; + + /** + * Removes all classes from the current element. + */ + removeAllClasses(): IChartistSvg; + + /** + * Get element height with fallback to svg BoundingBox or parent container dimensions + */ + height(): number; + + /** + * The animate function lets you animate the current element with SMIL animations. You can add animations for multiple attributes at the same time by using an animation definition object. This object should contain SMIL animation attributes. + */ + animate(animations: IChartistAnimations, guided: boolean, eventEmitter: Object): IChartistSvg; + + /** + * "Safe" way to get property value from svg BoundingBox. This is a workaround. Firefox throws an NS_ERROR_FAILURE error if getBBox() is called on an invisible node. + * THIS IS A WORKAROUND + */ + getBBoxProperty(node: SVGElement, prop: string): string; // TODO: find a good example of this and add it to the tests, it might belong to static + } + + interface IChartistAnimations { + [Key: string]: IChartistAnimationOptions; + } + + interface IChartistAnimationOptions { + id?: string; + dur: string | number; + from: string | number; + to: string | number; + easing?: IChartistEasingDefinition | string; + fill?: string; + begin?: string; + } + + interface IChartistEasingDefinition { + 0: number; + 1: number; + 2: number; + 3: number; + } + + interface ChartistEasingStatic { + easeInSine: IChartistEasingDefinition; + easeOutSine: IChartistEasingDefinition; + easeInOutSine: IChartistEasingDefinition; + easeInQuad: IChartistEasingDefinition; + easeOutQuad: IChartistEasingDefinition; + easeInOutQuad: IChartistEasingDefinition; + easeInCubic: IChartistEasingDefinition; + easeOutCubic: IChartistEasingDefinition; + easeInOutCubic: IChartistEasingDefinition; + easeInQuart: IChartistEasingDefinition; + easeOutQuart: IChartistEasingDefinition; + easeInOutQuart: IChartistEasingDefinition; + easeInQuint: IChartistEasingDefinition; + easeOutQuint: IChartistEasingDefinition; + easeInOutQuint: IChartistEasingDefinition; + easeInExpo: IChartistEasingDefinition; + easeOutExpo: IChartistEasingDefinition; + easeInOutExpo: IChartistEasingDefinition; + easeInCirc: IChartistEasingDefinition; + easeOutCirc: IChartistEasingDefinition; + easeInOutCirc: IChartistEasingDefinition; + easeInBack: IChartistEasingDefinition; + easeOutBack: IChartistEasingDefinition; + easeInOutBack: IChartistEasingDefinition; + } + + interface ChartistInterpolationStatic { + + /** + * This interpolation function does not smooth the path and the result is only containing lines and no curves. + */ + none(options?: IChartistInterpolationOptions): Function; + + /** + * Simple smoothing creates horizontal handles that are positioned with a fraction of the length between two data points. You can use the divisor option to specify the amount of smoothing. + */ + simple(options?: IChartistSimpleInterpolationOptions): Function; + + /** + * Cardinal / Catmull-Rome spline interpolation is the default smoothing function in Chartist. It produces nice results where the splines will always meet the points. It produces some artifacts though when data values are increased or decreased rapidly. The line may not follow a very accurate path and if the line should be accurate this smoothing function does not produce the best results. + */ + cardinal(options?: IChartistCardinalInterpolationOptions): Function; + + /** + * Step interpolation will cause the line chart to move in steps rather than diagonal or smoothed lines. This interpolation will create additional points that will also be drawn when the showPoint option is enabled. + */ + step(options?: IChartistStepInterpolationOptions): Function; + } + + interface IChartistInterpolationOptions { + fillHoles?: boolean; + } + + interface IChartistSimpleInterpolationOptions extends IChartistInterpolationOptions { + divisor?: number; + } + + interface IChartistCardinalInterpolationOptions extends IChartistInterpolationOptions { + tension?: number; + } + + interface IChartistStepInterpolationOptions extends IChartistInterpolationOptions { + postpone?: boolean; + } } declare var Chartist: Chartist.ChartistStatic; export = Chartist; -export as namespace Chartist; \ No newline at end of file +export as namespace Chartist; From d09abea64fdcca8bbeb22ce7cc4a7819fdaac80b Mon Sep 17 00:00:00 2001 From: Anastasiia Antonova Date: Thu, 17 May 2018 17:14:25 +0700 Subject: [PATCH 197/575] "chartist": added "series" to the ILineChartOptions, see https://gionkunz.github.io/chartist-js/examples.html#example-line-series-override --- types/chartist/chartist-tests.ts | 53 ++++++++++++++++++++++++++++++++ types/chartist/index.d.ts | 9 ++++++ 2 files changed, 62 insertions(+) diff --git a/types/chartist/chartist-tests.ts b/types/chartist/chartist-tests.ts index 281eb4987d..53ba63497c 100644 --- a/types/chartist/chartist-tests.ts +++ b/types/chartist/chartist-tests.ts @@ -53,6 +53,59 @@ new Chartist.Line('.ct-chart', { ] }); + +// This example was taken here: https://gionkunz.github.io/chartist-js/examples.html#example-line-series-override +new Chartist.Line('.ct-chart', { + labels: ['1', '2', '3', '4', '5', '6', '7', '8'], + // Naming the series with the series object array notation + series: [{ + name: 'series-1', + data: [5, 2, -4, 2, 0, -2, 5, -3] + }, { + name: 'series-2', + data: [4, 3, 5, 3, 1, 3, 6, 4] + }, { + name: 'series-3', + data: [2, 4, 3, 1, 4, 5, 3, 2] + }] +}, { + fullWidth: true, + // Within the series options you can use the series names + // to specify configuration that will only be used for the + // specific series. + series: { + 'series-1': { + lineSmooth: Chartist.Interpolation.step() + }, + 'series-2': { + lineSmooth: Chartist.Interpolation.simple(), + showArea: true + }, + 'series-3': { + showPoint: false + } + } +}, [ + // You can even use responsive configuration overrides to + // customize your series configuration even further! + ['screen and (max-width: 320px)', { + series: { + 'series-1': { + lineSmooth: Chartist.Interpolation.none() + }, + 'series-2': { + lineSmooth: Chartist.Interpolation.none(), + showArea: false + }, + 'series-3': { + lineSmooth: Chartist.Interpolation.none(), + showPoint: true + } + } + }] +]); + + var data = { series: [5, 3, 4] }; diff --git a/types/chartist/index.d.ts b/types/chartist/index.d.ts index 4f8826de9c..b82f0c9c96 100644 --- a/types/chartist/index.d.ts +++ b/types/chartist/index.d.ts @@ -333,6 +333,15 @@ declare namespace Chartist { chartPadding?: IChartPadding; fullWidth?: boolean; classNames?: ILineChartClasses; + series?: { + [key: string]: { + lineSmooth?: Function | boolean; + showLine?: boolean; + showPoint?: boolean; + showArea?: boolean; + areaBase?: number; + } + } } interface ILineChartAxis { From 99d2325dd74f2a3df3474f768f1efedc64e4603d Mon Sep 17 00:00:00 2001 From: Anastasiia Antonova Date: Thu, 17 May 2018 17:17:43 +0700 Subject: [PATCH 198/575] "chartist": modified definitions - added a new account there --- types/chartist/index.d.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/types/chartist/index.d.ts b/types/chartist/index.d.ts index b82f0c9c96..302d3ff157 100644 --- a/types/chartist/index.d.ts +++ b/types/chartist/index.d.ts @@ -1,6 +1,9 @@ // Type definitions for Chartist v0.9.81 // Project: https://github.com/gionkunz/chartist-js -// Definitions by: Matt Gibbs , Simon Pfeifer , Cassey Lottman +// Definitions by: Matt Gibbs , +// Simon Pfeifer , +// Cassey Lottman , +// Anastasiia Antonova , // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace Chartist { From db5c8936d538293dffe34592aa84f813d0ec520d Mon Sep 17 00:00:00 2001 From: Mathias Paumgarten Date: Thu, 17 May 2018 12:18:01 +0200 Subject: [PATCH 199/575] adds missing setPixels() method --- types/gl-texture2d/gl-texture2d-tests.ts | 13 +++++++++++-- types/gl-texture2d/index.d.ts | 1 + 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/types/gl-texture2d/gl-texture2d-tests.ts b/types/gl-texture2d/gl-texture2d-tests.ts index f51046f420..d3e07e4c77 100644 --- a/types/gl-texture2d/gl-texture2d-tests.ts +++ b/types/gl-texture2d/gl-texture2d-tests.ts @@ -54,11 +54,20 @@ texture2d(gl, ndarray([1, 2, 3])); const texture = texture2d(gl, canvas); -texture.bind(); -texture.bind(1); texture.dispose(); texture.generateMipmap(); +texture.bind(); +texture.bind(1); + +texture.setPixels(canvas); +texture.setPixels(video); +texture.setPixels(image); +texture.setPixels(imageData); +texture.setPixels(ndarray([1, 2, 3])); +texture.setPixels(canvas, [1,1]); +texture.setPixels(canvas, [1,1], 0); + texture.magFilter = 1; texture.minFilter = 1; texture.mipSamples = 1; diff --git a/types/gl-texture2d/index.d.ts b/types/gl-texture2d/index.d.ts index 2b44b9985a..df52259e44 100644 --- a/types/gl-texture2d/index.d.ts +++ b/types/gl-texture2d/index.d.ts @@ -29,6 +29,7 @@ declare class Texture { bind(id?: number): number; dispose(): void; generateMipmap(): void; + setPixels( data: InputType | RawObject | ndarray, offset?: [number, number], mipLevel?: GLenum): void; } declare function texture2d(gl: WebGLRenderingContext, array: ndarray): Texture; From fc556f6a5043a1b0c85f16db916921e32a1b1b46 Mon Sep 17 00:00:00 2001 From: Mathias Paumgarten Date: Thu, 17 May 2018 12:27:50 +0200 Subject: [PATCH 200/575] fixes lint issues --- types/gl-texture2d/gl-texture2d-tests.ts | 4 ++-- types/gl-texture2d/index.d.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/types/gl-texture2d/gl-texture2d-tests.ts b/types/gl-texture2d/gl-texture2d-tests.ts index d3e07e4c77..2f19753538 100644 --- a/types/gl-texture2d/gl-texture2d-tests.ts +++ b/types/gl-texture2d/gl-texture2d-tests.ts @@ -65,8 +65,8 @@ texture.setPixels(video); texture.setPixels(image); texture.setPixels(imageData); texture.setPixels(ndarray([1, 2, 3])); -texture.setPixels(canvas, [1,1]); -texture.setPixels(canvas, [1,1], 0); +texture.setPixels(canvas, [1, 1]); +texture.setPixels(canvas, [1, 1], 0); texture.magFilter = 1; texture.minFilter = 1; diff --git a/types/gl-texture2d/index.d.ts b/types/gl-texture2d/index.d.ts index df52259e44..4d979d99f9 100644 --- a/types/gl-texture2d/index.d.ts +++ b/types/gl-texture2d/index.d.ts @@ -29,7 +29,7 @@ declare class Texture { bind(id?: number): number; dispose(): void; generateMipmap(): void; - setPixels( data: InputType | RawObject | ndarray, offset?: [number, number], mipLevel?: GLenum): void; + setPixels(data: InputType | RawObject | ndarray, offset?: [number, number], mipLevel?: GLenum): void; } declare function texture2d(gl: WebGLRenderingContext, array: ndarray): Texture; From 74f058695cae01aadf7e08f5e40f76f868dc5880 Mon Sep 17 00:00:00 2001 From: Anastasiia Antonova Date: Thu, 17 May 2018 17:37:01 +0700 Subject: [PATCH 201/575] "chartist": changed definition formatting (due to the parse fail) --- types/chartist/index.d.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/types/chartist/index.d.ts b/types/chartist/index.d.ts index 302d3ff157..58db5e64ff 100644 --- a/types/chartist/index.d.ts +++ b/types/chartist/index.d.ts @@ -1,9 +1,6 @@ // Type definitions for Chartist v0.9.81 // Project: https://github.com/gionkunz/chartist-js -// Definitions by: Matt Gibbs , -// Simon Pfeifer , -// Cassey Lottman , -// Anastasiia Antonova , +// Definitions by: Matt Gibbs , Simon Pfeifer , Cassey Lottman , Anastasiia Antonova // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace Chartist { From 869ce88a827d7982673173a418cd2d2a2c10627b Mon Sep 17 00:00:00 2001 From: Maciej Blim Date: Thu, 17 May 2018 12:57:57 +0200 Subject: [PATCH 202/575] add missing types for `reduceWhile` --- types/ramda/index.d.ts | 12 ++++++++++++ types/ramda/ramda-tests.ts | 24 ++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index 9849ee48b1..8e033d3c15 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -20,6 +20,7 @@ // Keagan McClelland // Tomas Szabo // Bonggyun Lee +// Maciek Blim // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -1588,6 +1589,17 @@ declare namespace R { reduceRight(fn: (elem: T, acc: TResult) => TResult): (acc: TResult, list: ReadonlyArray) => TResult; reduceRight(fn: (elem: T, acc: TResult) => TResult, acc: TResult): (list: ReadonlyArray) => TResult; + /** + * Like reduce, reduceWhile returns a single item by iterating through the list, successively + * calling the iterator function. reduceWhile also takes a predicate that is evaluated before + * each step. If the predicate returns false, it "short-circuits" the iteration and returns + * the current value of the accumulator. + */ + reduceWhile(predicate: (acc: TResult, elem: T) => boolean, fn: (acc: TResult, elem: T) => TResult, acc: TResult, list: ReadonlyArray): TResult; + reduceWhile(predicate: (acc: TResult, elem: T) => boolean, fn: (acc: TResult, elem: T) => TResult, acc: TResult): (list: ReadonlyArray) => TResult; + reduceWhile(predicate: (acc: TResult, elem: T) => boolean, fn: (acc: TResult, elem: T) => TResult): CurriedFunction2, TResult>; + reduceWhile(predicate: (acc: TResult, elem: T) => boolean): CurriedFunction3<(acc: TResult, elem: T) => TResult, TResult, ReadonlyArray, TResult>; + /** * Similar to `filter`, except that it keeps only values for which the given predicate * function returns falsy. diff --git a/types/ramda/ramda-tests.ts b/types/ramda/ramda-tests.ts index 8cbbf9ceac..b91ee8a9d1 100644 --- a/types/ramda/ramda-tests.ts +++ b/types/ramda/ramda-tests.ts @@ -1000,6 +1000,30 @@ type Pair = KeyValuePair; R.reduceRight(flattenPairs)([], pairs); // => [ 'c', 3, 'b', 2, 'a', 1 ] }; +() => { + const isOdd = (acc: number, x: number) => x % 2 === 1; + + const xs: number[] = [1, 3, 5, 60, 777, 800]; + R.reduceWhile(isOdd, R.add, 0, xs); // => 9 + R.reduceWhile(isOdd)(R.add, 0, xs); // => 9 + R.reduceWhile(isOdd)(R.add, 0)(xs); // => 9 + R.reduceWhile(isOdd)(R.add)(0, xs); // => 9 + R.reduceWhile(isOdd)(R.add)(0)(xs); // => 9 + R.reduceWhile(isOdd, R.add)(0, xs); // => 9 + R.reduceWhile(isOdd, R.add)(0)(xs); // => 9 + R.reduceWhile(isOdd, R.add, 0)(xs); // => 9 + + const ys: number[] = []; + R.reduceWhile(isOdd, R.add, 111, ys); // => 111 + R.reduceWhile(isOdd)(R.add, 111, ys); // => 111 + R.reduceWhile(isOdd)(R.add, 111)(ys); // => 111 + R.reduceWhile(isOdd)(R.add)(111, ys); // => 111 + R.reduceWhile(isOdd)(R.add)(111)(ys); // => 111 + R.reduceWhile(isOdd, R.add)(111, ys); // => 111 + R.reduceWhile(isOdd, R.add)(111)(ys); // => 111 + R.reduceWhile(isOdd, R.add, 111)(ys); // => 111 +}; + () => { function isOdd(n: number) { return n % 2 === 1; From 5fdf29acf42f24def4fd092807b1767e09b7f054 Mon Sep 17 00:00:00 2001 From: ratkus91 Date: Thu, 17 May 2018 14:23:13 +0300 Subject: [PATCH 203/575] Fixed Typings Make it a module and keep a global namespace called XDate --- types/xdate/index.d.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/types/xdate/index.d.ts b/types/xdate/index.d.ts index 6445691ff4..6d15878eb3 100644 --- a/types/xdate/index.d.ts +++ b/types/xdate/index.d.ts @@ -373,3 +373,6 @@ declare class XDate { public static UTC(year : number, month : number, day : number , hours? : number , minutes? : number , seconds?:number,ms?:number): number; } + +export = XDate; +export as namespace XDate; From ef1a48d2b220485a52437d332f82e6784befae85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Magrin?= Date: Thu, 17 May 2018 14:36:47 +0200 Subject: [PATCH 204/575] Try to update type definition to new version of react-navigation 2.0.1 --- types/react-navigation/index.d.ts | 477 +++++++++++++++++++----------- 1 file changed, 303 insertions(+), 174 deletions(-) diff --git a/types/react-navigation/index.d.ts b/types/react-navigation/index.d.ts index 1233ca39e3..641dd8463f 100644 --- a/types/react-navigation/index.d.ts +++ b/types/react-navigation/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-navigation 1.5 +// Type definitions for react-navigation 2.0.1 // Project: https://github.com/react-navigation/react-navigation // Definitions by: Huhuanming // mhcgrq @@ -16,11 +16,12 @@ // Armando Assuncao // Ciaran Liedeman // Edward Sammut Alessi +// Jeremy Magrin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 /** - * Reference: https://github.com/react-navigation/react-navigation/tree/3f3ef6485c8932f49fddc3dd2c508629110bf2b6 + * Reference: https://github.com/react-navigation/react-navigation/tree/a37473c5e4833f48796ee6c7c9cb4a8ac49d9c06 * * NOTE: Please update the commit/link above when updating to a new Flow * react-navigation/flow/react-navigation.js reference, so we can conveniently just look at diffs on @@ -43,15 +44,21 @@ export type AnimatedValue = any; export type HeaderMode = 'float' | 'screen' | 'none'; +export interface HeaderForceInset { + horizontal?: string; + vertical?: string, + left?: string, + right?: string, + top?: string, + bottom?: string, +} + export interface HeaderProps extends NavigationSceneRendererProps { mode: HeaderMode; - router: NavigationRouter< - NavigationState, - NavigationStackScreenOptions - >; - getScreenDetails: (navigationScene: NavigationScene) => NavigationScreenDetails< - NavigationStackScreenOptions - >; + router: NavigationRouter; + getScreenDetails: ( + navigationScene: NavigationScene + ) => NavigationScreenDetails; style: StyleProp; } @@ -76,7 +83,9 @@ export interface NavigationState { routes: any[]; } -export type NavigationRoute = NavigationLeafRoute | NavigationStateRoute; +export type NavigationRoute = + | NavigationLeafRoute + | NavigationStateRoute; export interface NavigationLeafRoute { /** @@ -100,7 +109,9 @@ export interface NavigationLeafRoute { params?: Params; } -export type NavigationStateRoute = NavigationLeafRoute & NavigationState; +export type NavigationStateRoute< + NavigationLeafRouteParams + > = NavigationLeafRoute & NavigationState; export type NavigationScreenOptionsGetter = ( navigation: NavigationScreenProp>, @@ -113,7 +124,10 @@ export interface NavigationRouter { * an optional previous state. When the action is considered handled but the * state is unchanged, the output state is null. */ - getStateForAction: (action: NavigationAction, lastState?: State) => (State | null); + getStateForAction: ( + action: NavigationAction, + lastState?: State + ) => State | null; /** * Maps a URI-like string to an action. This can be mapped to a state @@ -122,14 +136,14 @@ export interface NavigationRouter { getActionForPathAndParams: ( path: string, params?: NavigationParams - ) => (NavigationAction | null); + ) => NavigationAction | null; getPathAndParamsForState: ( state: State ) => { - path: string, - params?: NavigationParams, - }; + path: string; + params?: NavigationParams; + }; getComponentForRouteName: (routeName: string) => NavigationComponent; @@ -147,11 +161,8 @@ export interface NavigationRouter { } export type NavigationScreenOption = - T - | (( - navigation: NavigationScreenProp, - config: T - ) => T); + | T + | ((navigation: NavigationScreenProp, config: T) => T); export interface NavigationScreenDetails { options: T; @@ -159,7 +170,9 @@ export interface NavigationScreenDetails { navigation: NavigationScreenProp; } -export type NavigationScreenOptions = NavigationStackScreenOptions & NavigationTabScreenOptions & NavigationDrawerScreenOptions; +export type NavigationScreenOptions = NavigationStackScreenOptions & + NavigationTabScreenOptions & + NavigationDrawerScreenOptions; export interface NavigationScreenConfigProps { navigation: NavigationScreenProp; @@ -167,30 +180,34 @@ export interface NavigationScreenConfigProps { } export type NavigationScreenConfig = - Options - | ((navigationOptionsContainer: NavigationScreenConfigProps & { - navigationOptions: NavigationScreenProp, - }) => Options); + | Options + | (( + navigationOptionsContainer: NavigationScreenConfigProps & { + navigationOptions: NavigationScreenProp; + } + ) => Options); export type NavigationComponent = - NavigationScreenComponent - | NavigationNavigator; + | NavigationScreenComponent + | NavigationNavigator + | any; export type NavigationScreenComponent< - Params = NavigationParams, - Options = {}, - Props = {} -> = React.ComponentType & Props> & -{ navigationOptions?: NavigationScreenConfig }; + Params = NavigationParams, + Options = {}, + Props = {} + > = React.ComponentType & Props> & { + navigationOptions?: NavigationScreenConfig; + }; export type NavigationNavigator< - State = NavigationState, - Options = {}, - Props = {} -> = React.ComponentType & Props> & { - router: NavigationRouter, - navigationOptions?: NavigationScreenConfig, -}; + State = NavigationState, + Options = {}, + Props = {} + > = React.ComponentType & Props> & { + router: NavigationRouter; + navigationOptions?: NavigationScreenConfig; + }; export interface NavigationParams { [key: string]: any; @@ -206,7 +223,8 @@ export interface NavigationNavigateActionPayload { key?: string; } -export interface NavigationNavigateAction extends NavigationNavigateActionPayload { +export interface NavigationNavigateAction + extends NavigationNavigateActionPayload { type: 'Navigation/NAVIGATE'; } @@ -226,7 +244,8 @@ export interface NavigationSetParamsActionPayload { params?: NavigationParams; } -export interface NavigationSetParamsAction extends NavigationSetParamsActionPayload { +export interface NavigationSetParamsAction + extends NavigationSetParamsActionPayload { type: 'Navigation/SET_PARAMS'; } @@ -271,40 +290,69 @@ export interface NavigationPopToTopActionPayload { immediate?: boolean; } -export interface NavigationPopToTopAction extends NavigationPopToTopActionPayload { +export interface NavigationPopToTopAction + extends NavigationPopToTopActionPayload { type: 'Navigation/POP_TO_TOP'; } export interface NavigationStackViewConfig { mode?: 'card' | 'modal'; headerMode?: HeaderMode; + headerTransitionPreset?: 'fade-in-place' | 'uikit'; cardStyle?: StyleProp; transitionConfig?: ( transitionProps: NavigationTransitionProps, prevTransitionProps: NavigationTransitionProps, - isModal: boolean, + isModal: boolean ) => TransitionConfig; - onTransitionStart?: (transitionProps: NavigationTransitionProps, prevTransitionProps?: NavigationTransitionProps) => Promise | void; - onTransitionEnd?: (transitionProps: NavigationTransitionProps, prevTransitionProps?: NavigationTransitionProps) => void; + onTransitionStart?: ( + transitionProps: NavigationTransitionProps, + prevTransitionProps?: NavigationTransitionProps + ) => Promise | void; + onTransitionEnd?: ( + transitionProps: NavigationTransitionProps, + prevTransitionProps?: NavigationTransitionProps + ) => void; +} + +/** + * Switch Navigator + */ + +export interface NavigationSwitchRouterConfig { + initialRouteName?: string; + initialRouteParams?: NavigationParams; + paths?: NavigationPathsConfig; + navigationOptions?: NavigationScreenConfig; + order?: string[]; + backBehavior?: 'none' | 'initialRoute'; // defaults to `'none'` + resetOnBlur?: boolean; // defaults to `true` } export interface NavigationStackScreenOptions { title?: string; - header?: (React.ReactElement | ((headerProps: HeaderProps) => React.ReactElement)) | null; + header?: + | ( + | React.ReactElement + | ((headerProps: HeaderProps) => React.ReactElement)) + | null; headerTransparent?: boolean; headerTitle?: string | React.ReactElement; headerTitleStyle?: StyleProp; headerTintColor?: string; headerLeft?: React.ReactElement; headerBackTitle?: string | null; + headerBackImage?: React.ReactElement; headerTruncatedBackTitle?: string; headerBackTitleStyle?: StyleProp; headerPressColorAndroid?: string; headerRight?: React.ReactElement; headerStyle?: StyleProp; + headerForceInset?: HeaderForceInset; headerBackground?: React.ReactNode | React.ReactType; gesturesEnabled?: boolean; gestureResponseDistance?: { vertical?: number; horizontal?: number }; + gestureDirection?: 'default' | 'inverted'; } export interface NavigationStackRouterConfig { @@ -317,7 +365,7 @@ export interface NavigationStackRouterConfig { } export type NavigationStackAction = - NavigationInitAction + | NavigationInitAction | NavigationNavigateAction | NavigationBackAction | NavigationSetParamsAction @@ -326,25 +374,30 @@ export type NavigationStackAction = | NavigationPopToTopAction; export type NavigationTabAction = - NavigationInitAction + | NavigationInitAction | NavigationNavigateAction | NavigationBackAction; export type NavigationAction = - NavigationInitAction + | NavigationInitAction | NavigationStackAction | NavigationTabAction; -export type NavigationRouteConfig = NavigationComponent | ({ - navigationOptions?: NavigationScreenConfig, - path?: string, -} & NavigationScreenRouteConfig); +export type NavigationRouteConfig = + | NavigationComponent + | ({ + navigationOptions?: NavigationScreenConfig; + path?: string; + } & NavigationScreenRouteConfig); -export type NavigationScreenRouteConfig = NavigationComponent | { - screen: NavigationComponent, -} | { - getScreen: () => NavigationComponent, -}; +export type NavigationScreenRouteConfig = + | NavigationComponent + | { + screen: NavigationComponent; + } + | { + getScreen: () => NavigationComponent; + }; export interface NavigationPathsConfig { [routeName: string]: string; @@ -360,45 +413,48 @@ export interface NavigationTabRouterConfig { backBehavior?: 'none' | 'initialRoute'; // defaults `initialRoute` } export interface TabScene { - route: NavigationRoute; - focused: boolean; - index: number; - tintColor?: string; + route: NavigationRoute; + focused: boolean; + index: number; + tintColor?: string; } export interface NavigationTabScreenOptions { title?: string; tabBarIcon?: - React.ReactElement - | ((options: { tintColor: (string | null), focused: boolean }) => (React.ReactElement< - any - > | null)); + | React.ReactElement + | (( + options: { tintColor: string | null; focused: boolean } + ) => React.ReactElement | null); tabBarLabel?: - string - | React.ReactElement - | ((options: { tintColor: (string | null), focused: boolean }) => (React.ReactElement< - any - > | string | null)); + | string + | React.ReactElement + | (( + options: { tintColor: string | null; focused: boolean } + ) => React.ReactElement | string | null); tabBarVisible?: boolean; - tabBarTestIDProps?: { testID?: string, accessibilityLabel?: string }; - tabBarOnPress?: (options: { - scene: TabScene, - jumpToIndex: (index: number) => void - }) => void; + tabBarTestIDProps?: { testID?: string; accessibilityLabel?: string }; + tabBarOnPress?: ( + options: { + scene: TabScene; + jumpToIndex: (index: number) => void; + } + ) => void; } export interface NavigationDrawerScreenOptions { title?: string; drawerIcon?: - React.ReactElement - | ((options: { tintColor: (string | null), focused: boolean }) => (React.ReactElement< - any - > | null)); + | React.ReactElement + | (( + options: { tintColor: string | null; focused: boolean } + ) => React.ReactElement | null); drawerLabel?: - string - | React.ReactElement - | ((options: { tintColor: (string | null), focused: boolean }) => (React.ReactElement< - any - > | null)); + | string + | React.ReactElement + | (( + options: { tintColor: string | null; focused: boolean } + ) => React.ReactElement | null); + drawerLockMode?: 'unlocked' | 'locked-closed' | 'locked-open'; } export interface NavigationRouteConfigMap { @@ -413,22 +469,20 @@ export interface NavigationProp { } export type EventType = -| 'willFocus' -| 'didFocus' -| 'willBlur' -| 'didBlur' -| 'action'; + | 'willFocus' + | 'didFocus' + | 'willBlur' + | 'didBlur' + | 'action'; export interface NavigationEventPayload { type: EventType; action: NavigationAction; state: NavigationState; - lastState: NavigationState; + lastState: NavigationState | null | undefined; } -export type NavigationEventCallback = ( - payload: NavigationEventPayload -) => void; +export type NavigationEventCallback = (payload: NavigationEventPayload) => void; export interface NavigationEventSubscription { remove: () => void; @@ -438,8 +492,14 @@ export interface NavigationScreenProp { state: S; dispatch: NavigationDispatch; goBack: (routeKey?: string | null) => boolean; + dismiss: () => boolean; navigate(options: { - routeName: string; + routeName: string | { + routeName: string; + params?: NavigationParams; + action?: NavigationNavigateAction; + key?: string; + }; params?: NavigationParams; action?: NavigationAction; key?: string; @@ -447,7 +507,7 @@ export interface NavigationScreenProp { navigate( routeNameOrOptions: string, params?: NavigationParams, - action?: NavigationAction, + action?: NavigationAction ): boolean; getParam: (param: T, fallback?: P[T]) => P[T]; setParams: (newParams: P) => boolean; @@ -467,6 +527,7 @@ export interface NavigationScreenProp { ) => boolean; pop: (n?: number, params?: { immediate?: boolean }) => boolean; popToTop: (params?: { immediate?: boolean }) => boolean; + isFocused: () => boolean; } export interface NavigationNavigatorProps { @@ -558,7 +619,7 @@ export type NavigationAnimationSetter = ( lastState: NavigationState ) => void; -export type NavigationSceneRenderer = () => (React.ReactElement | null); +export type NavigationSceneRenderer = () => React.ReactElement | null; export type NavigationStyleInterpolator = ( props: NavigationSceneRendererProps @@ -567,50 +628,49 @@ export type NavigationStyleInterpolator = ( export interface LayoutEvent { nativeEvent: { layout: { - x: number, - y: number, - width: number, - height: number, - }, + x: number; + y: number; + width: number; + height: number; + }; }; } export type NavigatorType = -| 'react-navigation/STACK' -| 'react-navigation/TABS' -| 'react-navigation/DRAWER'; + | 'react-navigation/STACK' + | 'react-navigation/TABS' + | 'react-navigation/DRAWER'; -export function addNavigationHelpers( - navigation: { - state: S; - dispatch: (action: NavigationAction) => any; - addListener?: ( - eventName: string, - callback: NavigationEventCallback - ) => NavigationEventSubscription; - } -): NavigationScreenProp; - -export interface NavigationContainerProps { +export interface NavigationContainerProps { uriPrefix?: string | RegExp; onNavigationStateChange?: ( prevNavigationState: NavigationState, nextNavigationState: NavigationState, - action: NavigationAction, - ) => void; + action: NavigationAction + ) => void | null | undefined; + navigation?: NavigationScreenProp; + persistenceKey?: string | null | undefined; + renderLoadingExperimental?: React.ComponentType<{}>, + screenProps?: any; + navigationOptions?: O; style?: StyleProp; } -export interface NavigationContainerComponent extends React.Component< +export interface NavigationContainerComponent + extends React.Component< NavigationContainerProps & NavigationNavigatorProps > { dispatch: NavigationDispatch; } -export interface NavigationContainer extends React.ComponentClass< +export interface NavigationContainer + extends React.ComponentClass< NavigationContainerProps & NavigationNavigatorProps > { - new(props: NavigationContainerProps & NavigationNavigatorProps, context?: any): NavigationContainerComponent; + new( + props: NavigationContainerProps & NavigationNavigatorProps, + context?: any + ): NavigationContainerComponent; router: NavigationRouter; screenProps: { [key: string]: any }; @@ -618,29 +678,43 @@ export interface NavigationContainer extends React.ComponentClass< state: { nav: NavigationState | null }; } -export interface StackNavigatorConfig extends NavigationStackViewConfig, NavigationStackRouterConfig { +export interface StackNavigatorConfig + extends NavigationStackViewConfig, + NavigationStackRouterConfig { containerOptions?: any; } // Return createNavigationContainer export function StackNavigator( routeConfigMap: NavigationRouteConfigMap, - stackConfig?: StackNavigatorConfig, + stackConfig?: StackNavigatorConfig +): NavigationContainer; + +export function createStackNavigator( + routeConfigMap: NavigationRouteConfigMap, + stackConfig?: StackNavigatorConfig ): NavigationContainer; export interface SwitchNavigatorConfig { initialRouteName: string; resetOnBlur?: boolean; paths?: NavigationPathsConfig; - backBehavior?: 'none' | 'initialRoute'; + backBehavior?: 'none' | 'intialRoute'; } // Return createNavigationContainer +export type _SwitchNavigatorConfig = NavigationSwitchRouterConfig; + export function SwitchNavigator( routeConfigMap: NavigationRouteConfigMap, switchConfig?: SwitchNavigatorConfig ): NavigationContainer; +export function createSwitchNavigator( + routeConfigMap: NavigationRouteConfigMap, + switchConfig?: SwitchNavigatorConfig +): NavigationContainer; + // DrawerItems export const DrawerItems: React.ReactType; @@ -655,21 +729,28 @@ export interface DrawerViewConfig { contentOptions?: any; style?: StyleProp; } -export interface DrawerNavigatorConfig extends NavigationTabRouterConfig, DrawerViewConfig { +export interface DrawerNavigatorConfig + extends NavigationTabRouterConfig, + DrawerViewConfig { containerConfig?: any; contentOptions?: { - activeTintColor?: string, - activeBackgroundColor?: string, - inactiveTintColor?: string, - inactiveBackgroundColor?: string, - style?: StyleProp, - labelStyle?: StyleProp, + activeTintColor?: string; + activeBackgroundColor?: string; + inactiveTintColor?: string; + inactiveBackgroundColor?: string; + style?: StyleProp; + labelStyle?: StyleProp; }; } export function DrawerNavigator( routeConfigMap: NavigationRouteConfigMap, - drawerConfig?: DrawerNavigatorConfig, + drawerConfig?: DrawerNavigatorConfig +): NavigationContainer; + +export function createDrawerNavigator( + routeConfigMap: NavigationRouteConfigMap, + drawerConfig?: DrawerNavigatorConfig ): NavigationContainer; /** @@ -681,23 +762,23 @@ export interface TabViewConfig { tabBarComponent?: React.ReactType; tabBarPosition?: 'top' | 'bottom'; tabBarOptions?: { - activeTintColor?: string, - allowFontScaling?: boolean, - activeBackgroundColor?: string, - inactiveTintColor?: string, - inactiveBackgroundColor?: string, - showLabel?: boolean, - style?: StyleProp, - labelStyle?: StyleProp, - iconStyle?: StyleProp, + activeTintColor?: string; + allowFontScaling?: boolean; + activeBackgroundColor?: string; + inactiveTintColor?: string; + inactiveBackgroundColor?: string; + showLabel?: boolean; + style?: StyleProp; + labelStyle?: StyleProp; + iconStyle?: StyleProp; // Top - showIcon?: boolean, - upperCaseLabel?: boolean, - pressColor?: string, - pressOpacity?: number, - scrollEnabled?: boolean, - tabStyle?: StyleProp, - indicatorStyle?: StyleProp, + showIcon?: boolean; + upperCaseLabel?: boolean; + pressColor?: string; + pressOpacity?: number; + scrollEnabled?: boolean; + tabStyle?: StyleProp; + indicatorStyle?: StyleProp; }; swipeEnabled?: boolean; animationEnabled?: boolean; @@ -705,16 +786,33 @@ export interface TabViewConfig { } // From navigators/TabNavigator.js -export interface TabNavigatorConfig extends NavigationTabRouterConfig, TabViewConfig { +export interface TabNavigatorConfig + extends NavigationTabRouterConfig, + TabViewConfig { lazy?: boolean; removeClippedSubviews?: boolean; - initialLayout?: { height: number, width: number }; + initialLayout?: { height: number; width: number }; } // From navigators/TabNavigator.js export function TabNavigator( routeConfigMap: NavigationRouteConfigMap, - drawConfig?: TabNavigatorConfig, + drawConfig?: TabNavigatorConfig +): NavigationContainer; + +export function createTabNavigator( + routeConfigMap: NavigationRouteConfigMap, + drawConfig?: TabNavigatorConfig +): NavigationContainer; + +export function createBottomTabNavigator( + routeConfigMap: NavigationRouteConfigMap, + drawConfig?: TabNavigatorConfig +): NavigationContainer; + +export function createMaterialTopNavigator( + routeConfigMap: NavigationRouteConfigMap, + drawConfig?: TabNavigatorConfig ): NavigationContainer; export interface TabBarTopProps { @@ -729,15 +827,17 @@ export interface TabBarTopProps { tabBarPosition: string; navigation: NavigationScreenProp; jumpToIndex: (index: number) => void; - getLabel: (scene: TabScene) => (React.ReactNode | string); + getLabel: (scene: TabScene) => React.ReactNode | string; getOnPress: ( previousScene: NavigationRoute, scene: TabScene - ) => (args: { - previousScene: NavigationRoute, - scene: TabScene, - jumpToIndex: (index: number) => void, - }) => void; + ) => ( + args: { + previousScene: NavigationRoute; + scene: TabScene; + jumpToIndex: (index: number) => void; + } + ) => void; renderIcon: (scene: TabScene) => React.ReactElement; labelStyle?: TextStyle; iconStyle?: ViewStyle; @@ -754,15 +854,17 @@ export interface TabBarBottomProps { position: AnimatedValue; navigation: NavigationScreenProp; jumpToIndex: (index: number) => void; - getLabel: (scene: TabScene) => (React.ReactNode | string); + getLabel: (scene: TabScene) => React.ReactNode | string; getOnPress: ( previousScene: NavigationRoute, scene: TabScene - ) => (args: { - previousScene: NavigationRoute, - scene: TabScene, - jumpToIndex: (index: number) => void, - }) => void; + ) => ( + args: { + previousScene: NavigationRoute; + scene: TabScene; + jumpToIndex: (index: number) => void; + } + ) => void; getTestIDProps: (scene: TabScene) => (scene: TabScene) => any; renderIcon: (scene: TabScene) => React.ReactNode; style?: ViewStyle; @@ -789,12 +891,18 @@ export namespace NavigationActions { const POP_TO_TOP: 'Navigation/POP_TO_TOP'; function init(options?: NavigationInitActionPayload): NavigationInitAction; - function navigate(options: NavigationNavigateActionPayload): NavigationNavigateAction; + function navigate( + options: NavigationNavigateActionPayload + ): NavigationNavigateAction; function reset(options: NavigationResetActionPayload): NavigationResetAction; function back(options?: NavigationBackActionPayload): NavigationBackAction; - function setParams(options: NavigationSetParamsActionPayload): NavigationSetParamsAction; + function setParams( + options: NavigationSetParamsActionPayload + ): NavigationSetParamsAction; function pop(options: NavigationPopActionPayload): NavigationPopAction; - function popToTop(options: NavigationPopToTopActionPayload): NavigationPopToTopAction; + function popToTop( + options: NavigationPopToTopActionPayload + ): NavigationPopToTopAction; } /** @@ -807,8 +915,14 @@ export interface TransitionerProps { prevTransitionProps?: NavigationTransitionProps ) => NavigationTransitionSpec; navigation: NavigationScreenProp; - onTransitionStart?: (transitionProps: NavigationTransitionProps, prevTransitionProps?: NavigationTransitionProps) => Promise | void; - onTransitionEnd?: (transitionProps: NavigationTransitionProps, prevTransitionProps?: NavigationTransitionProps) => void; + onTransitionStart?: ( + transitionProps: NavigationTransitionProps, + prevTransitionProps?: NavigationTransitionProps + ) => Promise | void; + onTransitionEnd?: ( + transitionProps: NavigationTransitionProps, + prevTransitionProps?: NavigationTransitionProps + ) => void; render: ( transitionProps: NavigationTransitionProps, prevTransitionProps?: NavigationTransitionProps @@ -826,7 +940,7 @@ export interface TransitionerState { export class Transitioner extends React.Component< TransitionerProps, TransitionerState -> { } + > { } /** * Tab Router @@ -853,12 +967,23 @@ export function StackRouter( * * @see https://github.com/react-navigation/react-navigation/blob/master/src/navigators/createNavigator.js */ +export interface NavigationDescriptor { + key: string; + state: NavigationLeafRoute | NavigationStateRoute; + navigation: NavigationScreenProp; + getComponent: () => React.ComponentType<{}>; +} + +export type NavigationView = React.ComponentType<{ + descriptors: { [key: string]: NavigationDescriptor }; +} & NavigationInjectedProps>; + export function createNavigator( + view: NavigationView, router: NavigationRouter, - routeConfigs?: NavigationRouteConfigMap, navigatorConfig?: {} | null, navigatorType?: NavigatorType -): (NavigationView: React.ComponentClass) => NavigationNavigator; +): any; /** * Create an HOC that injects the navigation and manages the navigation state @@ -879,7 +1004,10 @@ export function createNavigationContainer( * BEGIN CUSTOM CONVENIENCE INTERFACES */ -export interface NavigationScreenProps { +export interface NavigationScreenProps< + Params = NavigationParams, + Options = any + > { navigation: NavigationScreenProp, Params>; screenProps?: { [key: string]: any }; navigationOptions?: NavigationScreenConfig; @@ -936,6 +1064,7 @@ export interface SafeAreaViewProps extends ViewProps { horizontal?: SafeAreaViewForceInsetValue; vertical?: SafeAreaViewForceInsetValue; }; + children?: React.ReactNode; } export const SafeAreaView: React.ComponentClass; From fbafc684a423aead9d9d127807a242454695630c Mon Sep 17 00:00:00 2001 From: Milena Chikova Date: Thu, 17 May 2018 15:58:25 +0300 Subject: [PATCH 205/575] feat: upgrade Kendo UI definitions to 2018.2.516 --- types/kendo-ui/index.d.ts | 366 ++++++++++++++++++++++++++++++++++---- 1 file changed, 335 insertions(+), 31 deletions(-) diff --git a/types/kendo-ui/index.d.ts b/types/kendo-ui/index.d.ts index b854d92b29..e734f52cfa 100644 --- a/types/kendo-ui/index.d.ts +++ b/types/kendo-ui/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Kendo UI Professional v2018.1.117 +// Type definitions for Kendo UI Professional v2018.2.516 // Project: http://www.telerik.com/kendo-ui // Definitions by: Telerik // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -815,9 +815,9 @@ declare namespace kendo.data { } interface PivotDataSourceOptions extends DataSourceOptions { - columns?: PivotDataSourceAxisOptions[]; - measures?: PivotDataSourceMeasureOptions[]; - rows?: PivotDataSourceAxisOptions[]; + columns?: string[]|PivotDataSourceAxisOptions[]; + measures?: string[]|PivotDataSourceMeasureOptions; + rows?: string[]|PivotDataSourceAxisOptions[]; transport?: PivotTransport; schema?: PivotSchema; } @@ -1242,7 +1242,8 @@ declare namespace kendo.data { batch?: boolean; data?: any; filter?: any; - group?: DataSourceGroupItem[]; + group?: DataSourceGroupItem | DataSourceGroupItem[]; + inPlaceSort?: boolean; offlineStorage?: any; page?: number; pageSize?: number; @@ -1462,6 +1463,12 @@ declare namespace kendo.ui { } } +declare namespace kendo.ui.editor { + class Toolbar extends kendo.ui.Widget{ + window: kendo.ui.Window; + } +} + declare namespace kendo.mobile { function init(selector: string): void; function init(element: JQuery): void; @@ -1791,7 +1798,7 @@ declare namespace kendo.ui { } interface ButtonGroupSelectEvent extends ButtonGroupEvent { - index?: number; + indices?: any; } @@ -1869,6 +1876,107 @@ declare namespace kendo.ui { } + class Chat extends kendo.ui.Widget { + + static fn: Chat; + + options: ChatOptions; + + + element: JQuery; + wrapper: JQuery; + + static extend(proto: Object): Chat; + + constructor(element: Element, options?: ChatOptions); + + + getUser(): any; + postMessage(message: string): void; + renderAttachments(options: any, sender: any): void; + renderMessage(message: any, sender: any): void; + renderSuggestedActions(suggestedActions: any): void; + + } + + interface ChatMessages { + placeholder?: string; + } + + interface ChatUser { + iconUrl?: string; + name?: string; + } + + interface ChatRenderAttachmentsOptionsAttachments { + content?: any; + contentType?: string; + } + + interface ChatRenderAttachmentsOptions { + attachments?: ChatRenderAttachmentsOptionsAttachments; + attachmentLayout?: string; + } + + interface ChatRenderAttachmentsSender { + id?: any; + name?: string; + iconUrl?: string; + } + + interface ChatRenderMessageMessage { + type?: string; + text?: string; + } + + interface ChatRenderMessageSender { + id?: any; + name?: string; + iconUrl?: string; + } + + interface ChatRenderSuggestedActionsSuggestedActions { + title?: string; + value?: string; + } + + interface ChatOptions { + name?: string; + messages?: ChatMessages; + user?: ChatUser; + actionClick?(e: ChatActionClickEvent): void; + post?(e: ChatPostEvent): void; + sendMessage?(e: ChatSendMessageEvent): void; + typingEnd?(e: ChatTypingEndEvent): void; + typingStart?(e: ChatTypingStartEvent): void; + } + interface ChatEvent { + sender: Chat; + preventDefault: Function; + isDefaultPrevented(): boolean; + } + + interface ChatActionClickEvent extends ChatEvent { + text?: string; + } + + interface ChatPostEvent extends ChatEvent { + text?: string; + timestamp?: Date; + from?: any; + } + + interface ChatSendMessageEvent extends ChatEvent { + text?: string; + } + + interface ChatTypingEndEvent extends ChatEvent { + } + + interface ChatTypingStartEvent extends ChatEvent { + } + + class ColorPalette extends kendo.ui.Widget { static fn: ColorPalette; @@ -2751,6 +2859,140 @@ declare namespace kendo.ui { } + class DropDownTree extends kendo.ui.Widget { + + static fn: DropDownTree; + + options: DropDownTreeOptions; + + dataSource: kendo.data.DataSource; + tagList: JQuery; + tree: JQuery; + treeview: kendo.ui.TreeView; + + element: JQuery; + wrapper: JQuery; + + static extend(proto: Object): DropDownTree; + + constructor(element: Element, options?: DropDownTreeOptions); + + + close(): void; + destroy(): void; + enable(enable: boolean): void; + focus(): void; + items(): any; + open(): void; + readonly(readonly: boolean): void; + refresh(): void; + search(word: string): void; + setDataSource(dataSource: kendo.data.HierarchicalDataSource): void; + toggle(toggle?: boolean): void; + value(): any; + value(value: any): void; + value(value: string): void; + + } + + interface DropDownTreeAnimationClose { + effects?: string; + duration?: number; + } + + interface DropDownTreeAnimationOpen { + effects?: string; + duration?: number; + } + + interface DropDownTreeAnimation { + close?: DropDownTreeAnimationClose; + open?: DropDownTreeAnimationOpen; + } + + interface DropDownTreeCheckboxes { + checkChildren?: boolean; + name?: string; + template?: string|Function; + } + + interface DropDownTreeMessages { + clear?: string; + deleteTag?: string; + singleTag?: string; + } + + interface DropDownTreePopup { + appendTo?: string; + origin?: string; + position?: string; + } + + interface DropDownTreeOptions { + name?: string; + animation?: boolean | DropDownTreeAnimation; + autoBind?: boolean; + autoClose?: boolean; + autoWidth?: boolean; + checkAll?: boolean; + checkAllTemplate?: string|Function; + checkboxes?: boolean | DropDownTreeCheckboxes; + clearButton?: boolean; + dataImageUrlField?: string; + dataSource?: any|any|kendo.data.HierarchicalDataSource; + dataSpriteCssClassField?: string; + dataTextField?: string|any; + dataUrlField?: string; + dataValueField?: string|any; + delay?: number; + enable?: boolean; + enforceMinLength?: boolean; + filter?: string; + footerTemplate?: string|Function; + height?: string|number; + ignoreCase?: boolean; + loadOnDemand?: boolean; + messages?: DropDownTreeMessages; + minLength?: number; + noDataTemplate?: string|Function; + placeholder?: string; + popup?: DropDownTreePopup; + headerTemplate?: string|Function; + valueTemplate?: string|Function; + tagMode?: string; + template?: string|Function; + text?: string; + value?: string|any; + valuePrimitive?: boolean; + change?(e: DropDownTreeChangeEvent): void; + close?(e: DropDownTreeCloseEvent): void; + dataBound?(e: DropDownTreeDataBoundEvent): void; + filtering?(e: DropDownTreeFilteringEvent): void; + open?(e: DropDownTreeOpenEvent): void; + } + interface DropDownTreeEvent { + sender: DropDownTree; + preventDefault: Function; + isDefaultPrevented(): boolean; + } + + interface DropDownTreeChangeEvent extends DropDownTreeEvent { + } + + interface DropDownTreeCloseEvent extends DropDownTreeEvent { + } + + interface DropDownTreeDataBoundEvent extends DropDownTreeEvent { + } + + interface DropDownTreeFilteringEvent extends DropDownTreeEvent { + filter?: any; + } + + interface DropDownTreeOpenEvent extends DropDownTreeEvent { + } + + class Editor extends kendo.ui.Widget { static fn: Editor; @@ -2758,6 +3000,7 @@ declare namespace kendo.ui { options: EditorOptions; body: Element; + toolbar: kendo.ui.editor.Toolbar; element: JQuery; wrapper: JQuery; @@ -3246,6 +3489,8 @@ declare namespace kendo.ui { contains?: string; doesnotcontain?: string; endswith?: string; + isnullorempty?: string; + isnotnullorempty?: string; } interface FilterMenuOperators { @@ -3755,9 +4000,9 @@ declare namespace kendo.ui { } interface GridColumnCommandItemIconClass { + cancel?: string; edit?: string; update?: string; - cancel?: string; } interface GridColumnCommandItemText { @@ -3767,12 +4012,13 @@ declare namespace kendo.ui { } interface GridColumnCommandItem { - visible?: Function; - name?: string; - text?: string | GridColumnCommandItemText; className?: string; click?: Function; iconClass?: string | GridColumnCommandItemIconClass; + name?: string; + template?: string; + text?: string | GridColumnCommandItemText; + visible?: Function; } interface GridColumnFilterableCell { @@ -3802,6 +4048,7 @@ declare namespace kendo.ui { } interface GridColumnSortable { + allowUnsort?: boolean; compare?: Function; initialDirection?: string; } @@ -3810,7 +4057,7 @@ declare namespace kendo.ui { aggregates?: any; attributes?: any; columns?: any; - command?: string|(string|GridColumnCommandItem)[]; + command?: string | string[] | GridColumnCommandItem | GridColumnCommandItem[]; editable?: Function; encoded?: boolean; field?: string; @@ -4064,7 +4311,7 @@ declare namespace kendo.ui { scrollable?: boolean | GridScrollable; selectable?: boolean|string; sortable?: boolean | GridSortable; - toolbar?: GridToolbarItem[] | any; + toolbar?: GridToolbarItem[]; beforeEdit?(e: GridBeforeEditEvent): void; cancel?(e: GridCancelEvent): void; cellClose?(e: GridCellCloseEvent): void; @@ -4531,20 +4778,22 @@ declare namespace kendo.ui { constructor(element: Element, options?: MediaPlayerOptions); - fullScreen(): void; + fullScreen(): boolean; fullScreen(value: boolean): void; - volume(): void; + media(): any; + media(value: any): void; + volume(): number; volume(value: number): void; - mute(value: boolean): void; - isEnded(): void; - isPaused(): void; - isPlaying(): void; + mute(value: boolean): boolean; + isEnded(): boolean; + isPaused(): boolean; + isPlaying(): boolean; pause(): void; play(): void; - seek(milliseconds: number): void; + seek(milliseconds: number): number; stop(): void; - titlebar(): void; - toolbar(): void; + titlebar(): JQuery; + toolbar(): kendo.ui.ToolBar; } @@ -7405,14 +7654,53 @@ declare namespace kendo.ui { isFalse?: string; isTrue?: string; or?: string; - selectValue?: string; - cancel?: string; - operator?: string; + } + + interface TreeListFilterableOperatorsDate { + eq?: string; + neq?: string; + isnull?: string; + isnotnull?: string; + gte?: string; + gt?: string; + lte?: string; + lt?: string; + } + + interface TreeListFilterableOperatorsNumber { + eq?: string; + neq?: string; + isnull?: string; + isnotnull?: string; + gte?: string; + gt?: string; + lte?: string; + lt?: string; + } + + interface TreeListFilterableOperatorsString { + eq?: string; + neq?: string; + isnull?: string; + isnotnull?: string; + isempty?: string; + isnotempty?: string; + startswith?: string; + contains?: string; + doesnotcontain?: string; + endswith?: string; + } + + interface TreeListFilterableOperators { + string?: TreeListFilterableOperatorsString; + number?: TreeListFilterableOperatorsNumber; + date?: TreeListFilterableOperatorsDate; } interface TreeListFilterable { extra?: boolean; messages?: TreeListFilterableMessages; + operators?: TreeListFilterableOperators; } interface TreeListMessagesCommands { @@ -7465,6 +7753,7 @@ declare namespace kendo.ui { interface TreeListToolbarItem { click?: Function; + imageClass?: string; name?: string; text?: string; } @@ -7656,6 +7945,7 @@ declare namespace kendo.ui { enable(nodes: JQuery, enable?: boolean): void; enable(nodes: Element, enable?: boolean): void; enable(nodes: string, enable?: boolean): void; + enable(nodes: boolean, enable?: boolean): void; expand(nodes: JQuery): void; expand(nodes: Element): void; expand(nodes: string): void; @@ -7663,7 +7953,7 @@ declare namespace kendo.ui { expandTo(targetNode: kendo.data.Node): void; expandTo(targetNode: any): void; findByText(text: string): JQuery; - findByUid(text: string): JQuery; + findByUid(uid: string): JQuery; focus(): void; insertAfter(nodeData: any, referenceNode: JQuery): JQuery; insertBefore(nodeData: any, referenceNode: JQuery): JQuery; @@ -9310,7 +9600,7 @@ declare namespace kendo.dataviz.ui { findSeriesByName(name: string): kendo.dataviz.ChartSeries; getAxis(name: string): kendo.dataviz.ChartAxis; hideTooltip(): void; - plotArea(): void; + plotArea(): kendo.dataviz.ChartPlotArea; redraw(): void; refresh(): void; resize(force?: boolean): void; @@ -10199,7 +10489,7 @@ declare namespace kendo.dataviz.ui { interface ChartSeriesItemLine { color?: string; opacity?: number; - width?: string; + width?: number; style?: string; } @@ -10337,7 +10627,7 @@ declare namespace kendo.dataviz.ui { } interface ChartSeriesItemTargetLine { - width?: any|Function; + width?: number|Function; } interface ChartSeriesItemTarget { @@ -11631,6 +11921,7 @@ declare namespace kendo.dataviz.ui { panes?: ChartPane[]; pannable?: boolean | ChartPannable; pdf?: ChartPdf; + persistSeriesVisibility?: boolean; plotArea?: ChartPlotArea; renderAs?: string; series?: ChartSeriesItem[]; @@ -13148,6 +13439,8 @@ declare namespace kendo.dataviz.ui { tooltip?: MapLayerTooltip; maxSize?: number; minSize?: number; + maxZoom?: number; + minZoom?: number; opacity?: number; subdomains?: any; symbol?: string|Function; @@ -15334,10 +15627,10 @@ declare namespace kendo.dataviz.ui { autoBind?: boolean; dateField?: string; pane?: StockChartNavigatorPane; - visible?: boolean; series?: StockChartNavigatorSeriesItem[]; select?: StockChartNavigatorSelect; hint?: StockChartNavigatorHint; + visible?: boolean; } interface StockChartPaneBorder { @@ -15964,6 +16257,7 @@ declare namespace kendo.dataviz.ui { legend?: StockChartLegend; panes?: StockChartPane[]; pdf?: StockChartPdf; + persistSeriesVisibility?: boolean; plotArea?: StockChartPlotArea; renderAs?: string; series?: StockChartSeriesItem[]; @@ -17557,13 +17851,14 @@ declare namespace kendo { function bind(element: JQuery, viewModel: kendo.data.ObservableObject, namespace?: any): void; function bind(element: Element, viewModel: any, namespace?: any): void; function bind(element: Element, viewModel: kendo.data.ObservableObject, namespace?: any): void; - function observableHierarchy(array: any): void; function confirm(text: string): JQueryPromise; function culture(culture: string): void; function destroy(element: string): void; function destroy(element: JQuery): void; function destroy(element: Element): void; + function guid(): string; function htmlEncode(value: string): string; + function observableHierarchy(array: any): void; function parseDate(value: string, formats?: string, culture?: string): Date; function parseDate(value: string, formats?: any, culture?: string): Date; function parseFloat(value: string, culture?: string): number; @@ -17752,6 +18047,7 @@ declare namespace kendo.spreadsheet { columnWidth(index: number, width?: number): void; batch(callback: Function, changeEventArgs: any): void; deleteColumn(index: number): void; + deleteRow(index: number): void; fromJSON(data: any): void; frozenColumns(): number; frozenColumns(count?: number): void; @@ -18894,7 +19190,6 @@ declare namespace kendo.ooxml { cells?: WorkbookSheetRowCell[]; index?: number; height?: number; - type?: "header" | "footer" | "groupHeader" | "groupFooter" | "data"; } interface WorkbookSheet { @@ -18903,6 +19198,7 @@ declare namespace kendo.ooxml { frozenColumns?: number; frozenRows?: number; filter?: WorkbookSheetFilter; + mergedCells?: any; name?: string; rows?: WorkbookSheetRow[]; showGridLines?: boolean; @@ -20042,6 +20338,10 @@ interface JQuery { kendoChart(options: kendo.dataviz.ui.ChartOptions): JQuery; data(key: "kendoChart"): kendo.dataviz.ui.Chart; + kendoChat(): JQuery; + kendoChat(options: kendo.ui.ChatOptions): JQuery; + data(key: "kendoChat"): kendo.ui.Chat; + kendoColorPalette(): JQuery; kendoColorPalette(options: kendo.ui.ColorPaletteOptions): JQuery; data(key: "kendoColorPalette"): kendo.ui.ColorPalette; @@ -20086,6 +20386,10 @@ interface JQuery { kendoDropDownList(options: kendo.ui.DropDownListOptions): JQuery; data(key: "kendoDropDownList"): kendo.ui.DropDownList; + kendoDropDownTree(): JQuery; + kendoDropDownTree(options: kendo.ui.DropDownTreeOptions): JQuery; + data(key: "kendoDropDownTree"): kendo.ui.DropDownTree; + kendoEditor(): JQuery; kendoEditor(options: kendo.ui.EditorOptions): JQuery; data(key: "kendoEditor"): kendo.ui.Editor; From 6ca98463e74cd086e82936d2786558d4e8c87132 Mon Sep 17 00:00:00 2001 From: Deyan Kamburov Date: Thu, 17 May 2018 16:53:19 +0300 Subject: [PATCH 206/575] Apply several fixes to ignite-ui typings --- types/ignite-ui/index.d.ts | 1101 +++++++++++++++++++++++++++++++++++- 1 file changed, 1084 insertions(+), 17 deletions(-) diff --git a/types/ignite-ui/index.d.ts b/types/ignite-ui/index.d.ts index a57a3606fe..58e4ec6446 100644 --- a/types/ignite-ui/index.d.ts +++ b/types/ignite-ui/index.d.ts @@ -21789,11 +21789,11 @@ interface SelectionChangingEventUIParam { items?: any; } -interface SelectionChangedEvent { - (event: Event, ui: SelectionChangedEventUIParam): void; +interface IgComboSelectionChangedEvent { + (event: Event, ui: IgComboSelectionChangedEventUIParam): void; } -interface SelectionChangedEventUIParam { +interface IgComboSelectionChangedEventUIParam { /** * Used to obtain reference to igCombo. */ @@ -22347,7 +22347,7 @@ interface IgCombo { * Use ui.items to obtain reference to array of new selected items. That can be null. * Use ui.oldItems to obtain reference to array of old selected items. That can be null. */ - selectionChanged?: SelectionChangedEvent; + selectionChanged?: IgComboSelectionChangedEvent; /** * Option for igCombo @@ -23867,7 +23867,7 @@ interface JQuery { * Use ui.items to obtain reference to array of new selected items. That can be null. * Use ui.oldItems to obtain reference to array of old selected items. That can be null. */ - igCombo(optionLiteral: 'option', optionName: "selectionChanged"): SelectionChangedEvent; + igCombo(optionLiteral: 'option', optionName: "selectionChanged"): IgComboSelectionChangedEvent; /** * Event which is raised after selection change. @@ -23879,7 +23879,7 @@ interface JQuery { * * @optionValue Define event handler function. */ - igCombo(optionLiteral: 'option', optionName: "selectionChanged", optionValue: SelectionChangedEvent): void; + igCombo(optionLiteral: 'option', optionName: "selectionChanged", optionValue: IgComboSelectionChangedEvent): void; igCombo(options: IgCombo): JQuery; igCombo(optionLiteral: 'option', optionName: string): any; igCombo(optionLiteral: 'option', options: IgCombo): JQuery; @@ -25206,6 +25206,979 @@ interface JQuery { igDialog(optionLiteral: 'option', optionName: string, optionValue: any): JQuery; igDialog(methodName: string, ...methodParams: any[]): any; } +interface IgDoughnutChartSeries { + /** + * Gets or sets the current series type. + * + * Valid values: + * "flat" Series has flat 1-dimensional data. + */ + type?: string; + + /** + * Whether the series should render a tooltip. + */ + showTooltip?: boolean; + + /** + * The name of template or the template itself that chart tooltip will use to render. + */ + tooltipTemplate?: string; + + /** + * Gets or sets the data source for the chart. + */ + itemsSource?: any; + + /** + * Gets or Sets the property name that contains the values. + */ + valueMemberPath?: string; + + /** + * Gets or sets the property name that contains the labels. + */ + labelMemberPath?: string; + + /** + * Gets or sets the property name that contains the legend labels. + */ + legendLabelMemberPath?: string; + + /** + * Gets or sets the position of chart labels. + * + * Valid values: + * "none" No labels will be displayed. + * "center" Labels will be displayed in the center. + * "insideEnd" Labels will be displayed inside and by the edge of the container. + * "outsideEnd" Labels will be displayed outside the container. + * "bestFit" Labels will automatically decide their location. + */ + labelsPosition?: string; + + /** + * Gets or sets whether the leader lines are visible. + * + * Valid values: + * "visible" Display the element. + * "collapsed" Do not display the element. + */ + leaderLineVisibility?: string; + + /** + * Gets or sets the style for the leader lines. + */ + leaderLineStyle?: any; + + /** + * Gets or sets what type of leader lines will be used for the outside end labels. + * + * Valid values: + * "straight" A straight line is drawn between the slice and its label. + * "arc" A curved line is drawn between the slice and its label. The line follows makes a natural turn from the slice to the label. + * "spline" A curved line is drawn between the slice and its label. The line starts radially from the slice and then turns to the label. + */ + leaderLineType?: string; + + /** + * Gets or sets the margin between a label and its leader line. The default is 6 pixels. + */ + leaderLineMargin?: number; + + /** + * Gets or sets the threshold value that determines if slices are grouped into the Others slice. + */ + othersCategoryThreshold?: number; + + /** + * Gets or sets whether to use numeric or percent-based threshold value. + * + * Valid values: + * "number" Data value is compared directly to the value of OthersCategoryThreshold. + * "percent" Data value is compared to OthersCategoryThreshold as a percentage of the total. + */ + othersCategoryType?: string; + + /** + * Gets or sets the label of the Others slice. + */ + othersCategoryText?: string; + + /** + * Gets or sets the legend used for the current chart. + */ + legend?: any; + + /** + * Sets or gets a function which takes an object that produces a formatted label for displaying in the chart. + */ + formatLabel?: any; + + /** + * Sets or gets a function which takes an object that produces a formatted label for displaying in the chart's legend. + */ + formatLegendLabel?: any; + + /** + * Gets or sets the pixel amount by which the labels are offset from the edge of the slices. + */ + labelExtent?: number; + + /** + * Gets or sets the starting angle of the chart. + * The default zero value is equivalent to 3 o'clock. + */ + startAngle?: number; + + /** + * Gets or sets the style used when a slice is selected. + */ + selectedStyle?: any; + + /** + * Gets or sets the palette of brushes to use for coloring the slices. + * The value provided should be an array of css color strings or JavaScript objects defining gradients. Optionally the first element can be a string reading "RGB" or "HSV" to specify the interpolation mode of the collection. + */ + brushes?: any; + + /** + * Gets or sets the palette of brushes to use for outlines on the slices. + * The value provided should be an array of css color strings or JavaScript objects defining gradients. Optionally the first element can be a string reading "RGB" or "HSV" to specify the interpolation mode of the collection. + */ + outlines?: any; + + /** + * Gets or sets whether all surface interactions with the plot area should be disabled. + */ + isSurfaceInteractionDisabled?: boolean; + + /** + * Gets or sets the scaling factor of the chart's radius. Value between 0 and 1. + */ + radiusFactor?: number; + + /** + * Option for IgDoughnutChartSeries + */ + [optionName: string]: any; +} + +interface HoleDimensionsChangedEvent { + (event: Event, ui: HoleDimensionsChangedEventUIParam): void; +} + +interface HoleDimensionsChangedEventUIParam {} + +interface IgDoughnutChart { + /** + * The width of the chart. It can be set as a number in pixels, string (px) or percentage (%). + */ + width?: string|number; + + /** + * The height of the chart. It can be set as a number in pixels, string (px) or percentage (%). + */ + height?: string|number; + + /** + * An array of series objects. + */ + series?: IgDoughnutChartSeries[]; + + /** + * Gets or sets whether the slices can be selected. + */ + allowSliceSelection?: boolean; + + /** + * Gets or sets whether all surface interactions with the plot area should be disabled. + */ + isSurfaceInteractionDisabled?: boolean; + + /** + * Gets or sets whether the slices can be exploded. + */ + allowSliceExplosion?: boolean; + + /** + * Gets or sets the inner extent of the doughnut chart. It is percent from the outer ring's radius. + */ + innerExtent?: number; + + /** + * Gets or sets the style used when a slice is selected. + */ + selectedStyle?: any; + + /** + * Gets or sets the scaling value used to affect the pixel density of the control. + * A higher scaling ratio will produce crisper visuals at the expense of memory. Lower values will cause the control + * to appear blurry. + */ + pixelScalingRatio?: number; + + /** + * Gets sets template for tooltip associated with chart item. + * Example: "Value: $(ValueMemberPathInDataSource)" + */ + tooltipTemplate?: string; + + /** + * Gets sets maximum number of displayed records in chart. + */ + maxRecCount?: number; + + /** + * Gets sets a valid data source. + * That can be instance of array or primitives, array of objects, instance of $.ig.DataSource, or any other data accepted by $.ig.DataSource. + * Note: if it is set to string and "dataSourceType" option is not set, then $.ig.JSONPDataSource is used. + */ + dataSource?: any; + + /** + * Gets sets data source type (such as "json", "xml", etc). Please refer to the documentation of $.ig.DataSource and its type property + */ + dataSourceType?: string; + + /** + * Gets sets url which is used for sending JSON on request for remote data. + */ + dataSourceUrl?: string; + + /** + * See $.ig.DataSource. property in the response specifying the total number of records on the server. + */ + responseTotalRecCountKey?: string; + + /** + * See $.ig.DataSource. This is basically the property in the responses where data records are held, if the response is wrapped. + */ + responseDataKey?: string; + + /** + * Event fired when the mouse has hovered on a series and the tooltip is about to show + * Function takes arguments evt and ui. + * Use ui.element to get reference to tooltip DOM element. + * Use ui.item to get reference to current series item object. + * Use ui.chart to get reference to chart object. + * Use ui.series to get reference to current series object. + * Use ui.actualItemBrush to get item brush. + * Use ui.actualSeriesBrush to get series brush. + */ + tooltipShowing?: TooltipShowingEvent; + + /** + * Event fired after a tooltip is shown + * Function takes arguments evt and ui. + * Use ui.element to get reference to tooltip DOM element. + * Use ui.item to get reference to current series item object. + * Use ui.chart to get reference to chart object. + * Use ui.series to get reference to current series object. + * Use ui.actualItemBrush to get item brush. + * Use ui.actualSeriesBrush to get series brush. + */ + tooltipShown?: TooltipShownEvent; + + /** + * Event fired when the mouse has left a series and the tooltip is about to hide + * Function takes arguments evt and ui. + * Use ui.element to get reference to tooltip DOM element. + * Use ui.item to get reference to current series item object. + * Use ui.chart to get reference to chart object. + * Use ui.series to get reference to current series object. + * Use ui.actualItemBrush to get item brush. + * Use ui.actualSeriesBrush to get series brush. + */ + tooltipHiding?: TooltipHidingEvent; + + /** + * Event fired after a tooltip is hidden + * Function takes arguments evt and ui. + * Use ui.element to get reference to tooltip DOM element. + * Use ui.item to get reference to current series item object. + * Use ui.chart to get reference to chart object. + * Use ui.series to get reference to current series object. + * Use ui.actualItemBrush to get item brush. + * Use ui.actualSeriesBrush to get series brush. + */ + tooltipHidden?: TooltipHiddenEvent; + + /** + * Event fired when the control is displayed on a non HTML5 compliant browser + */ + browserNotSupported?: BrowserNotSupportedEvent; + + /** + * Raised when the slice is clicked. + */ + sliceClick?: SliceClickEvent; + + /** + * Raised when the dimensions (center point or radius) of the doughnut hole change. + */ + holeDimensionsChanged?: HoleDimensionsChangedEvent; + + /** + * Event which is raised before data binding. + * Return false in order to cancel data binding. + * Function takes first argument null and second argument ui. + * Use ui.owner to obtain reference to chart widget. + * Use ui.dataSource to obtain reference to instance of $.ig.DataSource. + */ + dataBinding?: DataBindingEvent; + + /** + * Event which is raised after data binding. + * Function takes first argument null and second argument ui. + * Use ui.owner to obtain reference to chart widget. + * Use ui.data to obtain reference to array actual data which is displayed by chart. + * Use ui.dataSource to obtain reference to instance of $.ig.DataSource. + */ + dataBound?: DataBoundEvent; + + /** + * Event which is raised before tooltip is updated. + * Return false in order to cancel updating and hide tooltip. + * Function takes first argument null and second argument ui. + * Use ui.owner to obtain reference to chart widget. + * Use ui.text to obtain html of tooltip. Value of that member can be modified. If modified value is null or empty string, then current content of tooltip keeps old value. + * Use ui.item to obtain reference to item. Value of that member can be modified or replaced by custom item. + * Use ui.x to obtain left position of tooltip in pixels relative to widget. Value of that member can be modified. + * Use ui.y to obtain top position of tooltip in pixels relative to widget. Value of that member can be modified. + * Use ui.element to obtain reference to jquery object which represents tooltip. Value of that member can be replaced by custom element. + */ + updateTooltip?: UpdateTooltipEvent; + + /** + * Event which is raised before tooltip is hidden. + * Return false in order to cancel hiding and keep tooltip visible. + * Function takes first argument null and second argument ui. + * Use ui.owner to obtain reference to chart widget. + * Use ui.item to obtain reference to item. + * Use ui.element to obtain reference to jquery object which represents tooltip or value of ui.element from last updateTooltip event. Value of that member can be replaced by custom element. + */ + hideTooltip?: HideTooltipEvent; + + /** + * Option for igDoughnutChart + */ + [optionName: string]: any; +} +interface IgDoughnutChartMethods { + /** + * Adds a new series to the doughnut chart. + * + * @param seriesObj The series object to be added. + */ + addSeries(seriesObj: Object): void; + + /** + * Removes the specified series from the doughnut chart. + * + * @param seriesObj The series object identifying the series to be removed. + */ + removeSeries(seriesObj: Object): void; + + /** + * Updates the series with the specified name with the specified new property values. + * + * @param value The series object identifying the series to be updated. + */ + updateSeries(value: Object): void; + + /** + * Returns the center of the doughnut chart. + */ + getCenterCoordinates(): Object; + + /** + * Returns the radius of the chart's hole. + */ + getHoleRadius(): number; + + /** + * Returns information about how the doughnut chart is rendered. + */ + exportVisualData(): Object; + + /** + * Causes all of the series that have pending changes e.g. by changed property values to be rendered immediately. + */ + flush(): void; + + /** + * Destroys the widget. + */ + destroy(): void; + + /** + * Returns data source of the series. + * + * @param series Optional. The series name. If not provided an array of series data sources is returned. + */ + getData(series: string): Object; + + /** + * Find index of item within actual data used by chart. + * + * @param item The reference to item. + */ + findIndexOfItem(item: Object): number; + + /** + * Get item within actual data used by chart. That is similar to this.getData()[ index ]. + * + * @param index Index of data item. + */ + getDataItem(index: Object): Object; + + /** + * Adds a new item to the data source and notifies the chart. + * + * @param item The item that we want to add to the data source. + */ + addItem(item: Object): Object; + + /** + * Inserts a new item to the data source and notifies the chart. + * + * @param item the new item that we want to insert in the data source. + * @param index The index in the data source where the new item will be inserted. + */ + insertItem(item: Object, index: number): Object; + + /** + * Deletes an item from the data source and notifies the chart. + * + * @param index The index in the data source from where the item will be been removed. + */ + removeItem(index: number): Object; + + /** + * Updates an item in the data source and notifies the chart. + * + * @param index The index of the item in the data source that we want to change. + * @param item The new item object that will be set in the data source. + */ + setItem(index: number, item: Object): Object; + + /** + * Notifies the chart that an item has been set in an associated data source. + * + * @param dataSource The data source in which the change happened. + * @param index The index in the items source that has been changed. + * @param newItem the new item that has been set in the collection. + * @param oldItem the old item that has been overwritten in the collection. + */ + notifySetItem(dataSource: Object, index: number, newItem: Object, oldItem: Object): Object; + + /** + * Notifies the chart that the items have been cleared from an associated data source. + * It's not necessary to notify more than one target of a change if they share the same items source. + * + * @param dataSource The data source in which the change happened. + */ + notifyClearItems(dataSource: Object): Object; + + /** + * Notifies the target axis or series that an item has been inserted at the specified index in its data source. + * It's not necessary to notify more than one target of a change if they share the same items source. + * + * @param dataSource The data source in which the change happened. + * @param index The index in the items source where the new item has been inserted. + * @param newItem the new item that has been set in the collection. + */ + notifyInsertItem(dataSource: Object, index: number, newItem: Object): Object; + + /** + * Notifies the target axis or series that an item has been removed from the specified index in its data source. + * It's not necessary to notify more than one target of a change if they share the same items source. + * + * @param dataSource The data source in which the change happened. + * @param index The index in the items source from where the old item has been removed. + * @param oldItem the old item that has been removed from the collection. + */ + notifyRemoveItem(dataSource: Object, index: number, oldItem: Object): Object; + + /** + * Get reference to chart object. + */ + chart(): Object; + + /** + * Binds data to the chart + */ + dataBind(): void; +} +interface JQuery { + data(propertyName: "igDoughnutChart"): IgDoughnutChartMethods; +} + +interface JQuery { + igDoughnutChart(methodName: "addSeries", seriesObj: Object): void; + igDoughnutChart(methodName: "removeSeries", seriesObj: Object): void; + igDoughnutChart(methodName: "updateSeries", value: Object): void; + igDoughnutChart(methodName: "getCenterCoordinates"): Object; + igDoughnutChart(methodName: "getHoleRadius"): number; + igDoughnutChart(methodName: "exportVisualData"): Object; + igDoughnutChart(methodName: "flush"): void; + igDoughnutChart(methodName: "destroy"): void; + igDoughnutChart(methodName: "getData", series: string): Object; + igDoughnutChart(methodName: "findIndexOfItem", item: Object): number; + igDoughnutChart(methodName: "getDataItem", index: Object): Object; + igDoughnutChart(methodName: "addItem", item: Object): Object; + igDoughnutChart(methodName: "insertItem", item: Object, index: number): Object; + igDoughnutChart(methodName: "removeItem", index: number): Object; + igDoughnutChart(methodName: "setItem", index: number, item: Object): Object; + igDoughnutChart(methodName: "notifySetItem", dataSource: Object, index: number, newItem: Object, oldItem: Object): Object; + igDoughnutChart(methodName: "notifyClearItems", dataSource: Object): Object; + igDoughnutChart(methodName: "notifyInsertItem", dataSource: Object, index: number, newItem: Object): Object; + igDoughnutChart(methodName: "notifyRemoveItem", dataSource: Object, index: number, oldItem: Object): Object; + igDoughnutChart(methodName: "chart"): Object; + igDoughnutChart(methodName: "dataBind"): void; + + /** + * The width of the chart. It can be set as a number in pixels, string (px) or percentage (%). + */ + + igDoughnutChart(optionLiteral: 'option', optionName: "width"): string|number; + + /** + * The width of the chart. It can be set as a number in pixels, string (px) or percentage (%). + * + * @optionValue New value to be set. + */ + + igDoughnutChart(optionLiteral: 'option', optionName: "width", optionValue: string|number): void; + + /** + * The height of the chart. It can be set as a number in pixels, string (px) or percentage (%). + */ + + igDoughnutChart(optionLiteral: 'option', optionName: "height"): string|number; + + /** + * The height of the chart. It can be set as a number in pixels, string (px) or percentage (%). + * + * @optionValue New value to be set. + */ + + igDoughnutChart(optionLiteral: 'option', optionName: "height", optionValue: string|number): void; + + /** + * An array of series objects. + */ + igDoughnutChart(optionLiteral: 'option', optionName: "series"): IgDoughnutChartSeries[]; + + /** + * An array of series objects. + * + * @optionValue New value to be set. + */ + igDoughnutChart(optionLiteral: 'option', optionName: "series", optionValue: IgDoughnutChartSeries[]): void; + + /** + * Gets whether the slices can be selected. + */ + igDoughnutChart(optionLiteral: 'option', optionName: "allowSliceSelection"): boolean; + + /** + * Sets whether the slices can be selected. + * + * @optionValue New value to be set. + */ + igDoughnutChart(optionLiteral: 'option', optionName: "allowSliceSelection", optionValue: boolean): void; + + /** + * Gets whether all surface interactions with the plot area should be disabled. + */ + igDoughnutChart(optionLiteral: 'option', optionName: "isSurfaceInteractionDisabled"): boolean; + + /** + * Sets whether all surface interactions with the plot area should be disabled. + * + * @optionValue New value to be set. + */ + igDoughnutChart(optionLiteral: 'option', optionName: "isSurfaceInteractionDisabled", optionValue: boolean): void; + + /** + * Gets whether the slices can be exploded. + */ + igDoughnutChart(optionLiteral: 'option', optionName: "allowSliceExplosion"): boolean; + + /** + * Sets whether the slices can be exploded. + * + * @optionValue New value to be set. + */ + igDoughnutChart(optionLiteral: 'option', optionName: "allowSliceExplosion", optionValue: boolean): void; + + /** + * Gets the inner extent of the doughnut chart. It is percent from the outer ring's radius. + */ + igDoughnutChart(optionLiteral: 'option', optionName: "innerExtent"): number; + + /** + * Sets the inner extent of the doughnut chart. It is percent from the outer ring's radius. + * + * @optionValue New value to be set. + */ + igDoughnutChart(optionLiteral: 'option', optionName: "innerExtent", optionValue: number): void; + + /** + * Gets the style used when a slice is selected. + */ + igDoughnutChart(optionLiteral: 'option', optionName: "selectedStyle"): any; + + /** + * Sets the style used when a slice is selected. + * + * @optionValue New value to be set. + */ + igDoughnutChart(optionLiteral: 'option', optionName: "selectedStyle", optionValue: any): void; + + /** + * Gets the scaling value used to affect the pixel density of the control. + * A higher scaling ratio will produce crisper visuals at the expense of memory. Lower values will cause the control + * to appear blurry. + */ + igDoughnutChart(optionLiteral: 'option', optionName: "pixelScalingRatio"): number; + + /** + * Sets the scaling value used to affect the pixel density of the control. + * A higher scaling ratio will produce crisper visuals at the expense of memory. Lower values will cause the control + * to appear blurry. + * + * @optionValue New value to be set. + */ + igDoughnutChart(optionLiteral: 'option', optionName: "pixelScalingRatio", optionValue: number): void; + + /** + * Gets template for tooltip associated with chart item. + * Example: "Value: $(ValueMemberPathInDataSource)" + */ + igDoughnutChart(optionLiteral: 'option', optionName: "tooltipTemplate"): string; + + /** + * Sets template for tooltip associated with chart item. + * Example: "Value: $(ValueMemberPathInDataSource)" + * + * @optionValue New value to be set. + */ + igDoughnutChart(optionLiteral: 'option', optionName: "tooltipTemplate", optionValue: string): void; + + /** + * Gets maximum number of displayed records in chart. + */ + igDoughnutChart(optionLiteral: 'option', optionName: "maxRecCount"): number; + + /** + * Sets maximum number of displayed records in chart. + * + * @optionValue New value to be set. + */ + igDoughnutChart(optionLiteral: 'option', optionName: "maxRecCount", optionValue: number): void; + + /** + * Gets a valid data source. + * That can be instance of array or primitives, array of objects, instance of $.ig.DataSource, or any other data accepted by $.ig.DataSource. + * Note: if it is set to string and "dataSourceType" option is not set, then $.ig.JSONPDataSource is used. + */ + igDoughnutChart(optionLiteral: 'option', optionName: "dataSource"): any; + + /** + * Sets a valid data source. + * That can be instance of array or primitives, array of objects, instance of $.ig.DataSource, or any other data accepted by $.ig.DataSource. + * Note: if it is set to string and "dataSourceType" option is not set, then $.ig.JSONPDataSource is used. + * + * @optionValue New value to be set. + */ + igDoughnutChart(optionLiteral: 'option', optionName: "dataSource", optionValue: any): void; + + /** + * Gets data source type (such as "json", "xml", etc). Please refer to the documentation of $.ig.DataSource and its type property + */ + igDoughnutChart(optionLiteral: 'option', optionName: "dataSourceType"): string; + + /** + * Sets data source type (such as "json", "xml", etc). Please refer to the documentation of $.ig.DataSource and its type property + * + * @optionValue New value to be set. + */ + igDoughnutChart(optionLiteral: 'option', optionName: "dataSourceType", optionValue: string): void; + + /** + * Gets url which is used for sending JSON on request for remote data. + */ + igDoughnutChart(optionLiteral: 'option', optionName: "dataSourceUrl"): string; + + /** + * Sets url which is used for sending JSON on request for remote data. + * + * @optionValue New value to be set. + */ + igDoughnutChart(optionLiteral: 'option', optionName: "dataSourceUrl", optionValue: string): void; + + /** + * See $.ig.DataSource. property in the response specifying the total number of records on the server. + */ + igDoughnutChart(optionLiteral: 'option', optionName: "responseTotalRecCountKey"): string; + + /** + * See $.ig.DataSource. property in the response specifying the total number of records on the server. + * + * @optionValue New value to be set. + */ + igDoughnutChart(optionLiteral: 'option', optionName: "responseTotalRecCountKey", optionValue: string): void; + + /** + * See $.ig.DataSource. This is basically the property in the responses where data records are held, if the response is wrapped. + */ + igDoughnutChart(optionLiteral: 'option', optionName: "responseDataKey"): string; + + /** + * See $.ig.DataSource. This is basically the property in the responses where data records are held, if the response is wrapped. + * + * @optionValue New value to be set. + */ + igDoughnutChart(optionLiteral: 'option', optionName: "responseDataKey", optionValue: string): void; + + /** + * Event fired when the mouse has hovered on a series and the tooltip is about to show + * Function takes arguments evt and ui. + * Use ui.element to get reference to tooltip DOM element. + * Use ui.item to get reference to current series item object. + * Use ui.chart to get reference to chart object. + * Use ui.series to get reference to current series object. + * Use ui.actualItemBrush to get item brush. + * Use ui.actualSeriesBrush to get series brush. + */ + igDoughnutChart(optionLiteral: 'option', optionName: "tooltipShowing"): TooltipShowingEvent; + + /** + * Event fired when the mouse has hovered on a series and the tooltip is about to show + * Function takes arguments evt and ui. + * Use ui.element to get reference to tooltip DOM element. + * Use ui.item to get reference to current series item object. + * Use ui.chart to get reference to chart object. + * Use ui.series to get reference to current series object. + * Use ui.actualItemBrush to get item brush. + * Use ui.actualSeriesBrush to get series brush. + * + * @optionValue Define event handler function. + */ + igDoughnutChart(optionLiteral: 'option', optionName: "tooltipShowing", optionValue: TooltipShowingEvent): void; + + /** + * Event fired after a tooltip is shown + * Function takes arguments evt and ui. + * Use ui.element to get reference to tooltip DOM element. + * Use ui.item to get reference to current series item object. + * Use ui.chart to get reference to chart object. + * Use ui.series to get reference to current series object. + * Use ui.actualItemBrush to get item brush. + * Use ui.actualSeriesBrush to get series brush. + */ + igDoughnutChart(optionLiteral: 'option', optionName: "tooltipShown"): TooltipShownEvent; + + /** + * Event fired after a tooltip is shown + * Function takes arguments evt and ui. + * Use ui.element to get reference to tooltip DOM element. + * Use ui.item to get reference to current series item object. + * Use ui.chart to get reference to chart object. + * Use ui.series to get reference to current series object. + * Use ui.actualItemBrush to get item brush. + * Use ui.actualSeriesBrush to get series brush. + * + * @optionValue Define event handler function. + */ + igDoughnutChart(optionLiteral: 'option', optionName: "tooltipShown", optionValue: TooltipShownEvent): void; + + /** + * Event fired when the mouse has left a series and the tooltip is about to hide + * Function takes arguments evt and ui. + * Use ui.element to get reference to tooltip DOM element. + * Use ui.item to get reference to current series item object. + * Use ui.chart to get reference to chart object. + * Use ui.series to get reference to current series object. + * Use ui.actualItemBrush to get item brush. + * Use ui.actualSeriesBrush to get series brush. + */ + igDoughnutChart(optionLiteral: 'option', optionName: "tooltipHiding"): TooltipHidingEvent; + + /** + * Event fired when the mouse has left a series and the tooltip is about to hide + * Function takes arguments evt and ui. + * Use ui.element to get reference to tooltip DOM element. + * Use ui.item to get reference to current series item object. + * Use ui.chart to get reference to chart object. + * Use ui.series to get reference to current series object. + * Use ui.actualItemBrush to get item brush. + * Use ui.actualSeriesBrush to get series brush. + * + * @optionValue Define event handler function. + */ + igDoughnutChart(optionLiteral: 'option', optionName: "tooltipHiding", optionValue: TooltipHidingEvent): void; + + /** + * Event fired after a tooltip is hidden + * Function takes arguments evt and ui. + * Use ui.element to get reference to tooltip DOM element. + * Use ui.item to get reference to current series item object. + * Use ui.chart to get reference to chart object. + * Use ui.series to get reference to current series object. + * Use ui.actualItemBrush to get item brush. + * Use ui.actualSeriesBrush to get series brush. + */ + igDoughnutChart(optionLiteral: 'option', optionName: "tooltipHidden"): TooltipHiddenEvent; + + /** + * Event fired after a tooltip is hidden + * Function takes arguments evt and ui. + * Use ui.element to get reference to tooltip DOM element. + * Use ui.item to get reference to current series item object. + * Use ui.chart to get reference to chart object. + * Use ui.series to get reference to current series object. + * Use ui.actualItemBrush to get item brush. + * Use ui.actualSeriesBrush to get series brush. + * + * @optionValue Define event handler function. + */ + igDoughnutChart(optionLiteral: 'option', optionName: "tooltipHidden", optionValue: TooltipHiddenEvent): void; + + /** + * Event fired when the control is displayed on a non HTML5 compliant browser + */ + igDoughnutChart(optionLiteral: 'option', optionName: "browserNotSupported"): BrowserNotSupportedEvent; + + /** + * Event fired when the control is displayed on a non HTML5 compliant browser + * + * @optionValue Define event handler function. + */ + igDoughnutChart(optionLiteral: 'option', optionName: "browserNotSupported", optionValue: BrowserNotSupportedEvent): void; + + /** + * Raised when the slice is clicked. + */ + igDoughnutChart(optionLiteral: 'option', optionName: "sliceClick"): SliceClickEvent; + + /** + * Raised when the slice is clicked. + * + * @optionValue New value to be set. + */ + igDoughnutChart(optionLiteral: 'option', optionName: "sliceClick", optionValue: SliceClickEvent): void; + + /** + * Raised when the dimensions (center point or radius) of the doughnut hole change. + */ + igDoughnutChart(optionLiteral: 'option', optionName: "holeDimensionsChanged"): HoleDimensionsChangedEvent; + + /** + * Raised when the dimensions (center point or radius) of the doughnut hole change. + * + * @optionValue New value to be set. + */ + igDoughnutChart(optionLiteral: 'option', optionName: "holeDimensionsChanged", optionValue: HoleDimensionsChangedEvent): void; + + /** + * Event which is raised before data binding. + * Return false in order to cancel data binding. + * Function takes first argument null and second argument ui. + * Use ui.owner to obtain reference to chart widget. + * Use ui.dataSource to obtain reference to instance of $.ig.DataSource. + */ + igDoughnutChart(optionLiteral: 'option', optionName: "dataBinding"): DataBindingEvent; + + /** + * Event which is raised before data binding. + * Return false in order to cancel data binding. + * Function takes first argument null and second argument ui. + * Use ui.owner to obtain reference to chart widget. + * Use ui.dataSource to obtain reference to instance of $.ig.DataSource. + * + * @optionValue Define event handler function. + */ + igDoughnutChart(optionLiteral: 'option', optionName: "dataBinding", optionValue: DataBindingEvent): void; + + /** + * Event which is raised after data binding. + * Function takes first argument null and second argument ui. + * Use ui.owner to obtain reference to chart widget. + * Use ui.data to obtain reference to array actual data which is displayed by chart. + * Use ui.dataSource to obtain reference to instance of $.ig.DataSource. + */ + igDoughnutChart(optionLiteral: 'option', optionName: "dataBound"): DataBoundEvent; + + /** + * Event which is raised after data binding. + * Function takes first argument null and second argument ui. + * Use ui.owner to obtain reference to chart widget. + * Use ui.data to obtain reference to array actual data which is displayed by chart. + * Use ui.dataSource to obtain reference to instance of $.ig.DataSource. + * + * @optionValue Define event handler function. + */ + igDoughnutChart(optionLiteral: 'option', optionName: "dataBound", optionValue: DataBoundEvent): void; + + /** + * Event which is raised before tooltip is updated. + * Return false in order to cancel updating and hide tooltip. + * Function takes first argument null and second argument ui. + * Use ui.owner to obtain reference to chart widget. + * Use ui.text to obtain html of tooltip. Value of that member can be modified. If modified value is null or empty string, then current content of tooltip keeps old value. + * Use ui.item to obtain reference to item. Value of that member can be modified or replaced by custom item. + * Use ui.x to obtain left position of tooltip in pixels relative to widget. Value of that member can be modified. + * Use ui.y to obtain top position of tooltip in pixels relative to widget. Value of that member can be modified. + * Use ui.element to obtain reference to jquery object which represents tooltip. Value of that member can be replaced by custom element. + */ + igDoughnutChart(optionLiteral: 'option', optionName: "updateTooltip"): UpdateTooltipEvent; + + /** + * Event which is raised before tooltip is updated. + * Return false in order to cancel updating and hide tooltip. + * Function takes first argument null and second argument ui. + * Use ui.owner to obtain reference to chart widget. + * Use ui.text to obtain html of tooltip. Value of that member can be modified. If modified value is null or empty string, then current content of tooltip keeps old value. + * Use ui.item to obtain reference to item. Value of that member can be modified or replaced by custom item. + * Use ui.x to obtain left position of tooltip in pixels relative to widget. Value of that member can be modified. + * Use ui.y to obtain top position of tooltip in pixels relative to widget. Value of that member can be modified. + * Use ui.element to obtain reference to jquery object which represents tooltip. Value of that member can be replaced by custom element. + * + * @optionValue Define event handler function. + */ + igDoughnutChart(optionLiteral: 'option', optionName: "updateTooltip", optionValue: UpdateTooltipEvent): void; + + /** + * Event which is raised before tooltip is hidden. + * Return false in order to cancel hiding and keep tooltip visible. + * Function takes first argument null and second argument ui. + * Use ui.owner to obtain reference to chart widget. + * Use ui.item to obtain reference to item. + * Use ui.element to obtain reference to jquery object which represents tooltip or value of ui.element from last updateTooltip event. Value of that member can be replaced by custom element. + */ + igDoughnutChart(optionLiteral: 'option', optionName: "hideTooltip"): HideTooltipEvent; + + /** + * Event which is raised before tooltip is hidden. + * Return false in order to cancel hiding and keep tooltip visible. + * Function takes first argument null and second argument ui. + * Use ui.owner to obtain reference to chart widget. + * Use ui.item to obtain reference to item. + * Use ui.element to obtain reference to jquery object which represents tooltip or value of ui.element from last updateTooltip event. Value of that member can be replaced by custom element. + * + * @optionValue Define event handler function. + */ + igDoughnutChart(optionLiteral: 'option', optionName: "hideTooltip", optionValue: HideTooltipEvent): void; + igDoughnutChart(options: IgDoughnutChart): JQuery; + igDoughnutChart(optionLiteral: 'option', optionName: string): any; + igDoughnutChart(optionLiteral: 'option', options: IgDoughnutChart): JQuery; + igDoughnutChart(optionLiteral: 'option', optionName: string, optionValue: any): JQuery; + igDoughnutChart(methodName: string, ...methodParams: any[]): any; +} interface RenderingEvent { (event: Event, ui: RenderingEventUIParam): void; } @@ -26669,6 +27642,9 @@ interface IgNumericEditor { */ toUpper?: any; + /** + * + */ textMode?: any; /** @@ -27248,6 +28224,9 @@ interface IgCurrencyEditor { */ toUpper?: any; + /** + * + */ textMode?: any; /** @@ -27730,6 +28709,9 @@ interface IgPercentEditor { */ toUpper?: any; + /** + * + */ textMode?: any; /** @@ -28128,6 +29110,9 @@ interface IgMaskEditor { */ dropDownOnReadOnly?: boolean; + /** + * + */ textMode?: any; /** @@ -28663,6 +29648,9 @@ interface IgDateEditor { */ dropDownOrientation?: string; + /** + * + */ textMode?: any; /** @@ -29225,6 +30213,9 @@ interface IgDatePicker { */ dropDownOrientation?: string; + /** + * + */ textMode?: any; /** @@ -30059,6 +31050,9 @@ interface IgTimePicker { */ excludeKeys?: string; + /** + * + */ textMode?: any; /** @@ -32002,8 +32996,12 @@ interface JQuery { */ igNumericEditor(optionLiteral: 'option', optionName: "toUpper", optionValue: any): void; + /** + */ igNumericEditor(optionLiteral: 'option', optionName: "textMode"): any; + /** + */ igNumericEditor(optionLiteral: 'option', optionName: "textMode", optionValue: any): void; /** @@ -32939,8 +33937,12 @@ interface JQuery { */ igCurrencyEditor(optionLiteral: 'option', optionName: "toUpper", optionValue: any): void; + /** + */ igCurrencyEditor(optionLiteral: 'option', optionName: "textMode"): any; + /** + */ igCurrencyEditor(optionLiteral: 'option', optionName: "textMode", optionValue: any): void; /** @@ -33815,8 +34817,12 @@ interface JQuery { */ igPercentEditor(optionLiteral: 'option', optionName: "toUpper", optionValue: any): void; + /** + */ igPercentEditor(optionLiteral: 'option', optionName: "textMode"): any; + /** + */ igPercentEditor(optionLiteral: 'option', optionName: "textMode", optionValue: any): void; /** @@ -34522,8 +35528,12 @@ interface JQuery { */ igMaskEditor(optionLiteral: 'option', optionName: "dropDownOnReadOnly", optionValue: boolean): void; + /** + */ igMaskEditor(optionLiteral: 'option', optionName: "textMode"): any; + /** + */ igMaskEditor(optionLiteral: 'option', optionName: "textMode", optionValue: any): void; /** @@ -35522,8 +36532,12 @@ interface JQuery { */ igDateEditor(optionLiteral: 'option', optionName: "dropDownOrientation", optionValue: string): void; + /** + */ igDateEditor(optionLiteral: 'option', optionName: "textMode"): any; + /** + */ igDateEditor(optionLiteral: 'option', optionName: "textMode", optionValue: any): void; /** @@ -36538,8 +37552,12 @@ interface JQuery { */ igDatePicker(optionLiteral: 'option', optionName: "dropDownOrientation", optionValue: string): void; + /** + */ igDatePicker(optionLiteral: 'option', optionName: "textMode"): any; + /** + */ igDatePicker(optionLiteral: 'option', optionName: "textMode", optionValue: any): void; /** @@ -37968,8 +38986,12 @@ interface JQuery { */ igTimePicker(optionLiteral: 'option', optionName: "excludeKeys", optionValue: string): void; + /** + */ igTimePicker(optionLiteral: 'option', optionName: "textMode"): any; + /** + */ igTimePicker(optionLiteral: 'option', optionName: "textMode", optionValue: any): void; /** @@ -89671,6 +90693,22 @@ interface HyperlinkExecutingEventUIParam { hyperlink?: any; } +interface IgSpreadsheetSelectionChangedEvent { + (event: Event, ui: IgSpreadsheetSelectionChangedEventUIParam): void; +} + +interface IgSpreadsheetSelectionChangedEventUIParam { + /** + * Gets a reference to the spreadsheet widget. + */ + owner?: any; + + /** + * Get the [pane](ig.spreadsheet.SpreadsheetPane) for which the selection has changed. + */ + pane?: any; +} + interface UserPromptDisplayingEvent { (event: Event, ui: UserPromptDisplayingEventUIParam): void; } @@ -89970,7 +91008,7 @@ interface IgSpreadsheet { /** * Invoked when the selection for a ig.spreadsheet.SpreadsheetPane of the Spreadsheet is changed. */ - selectionChanged?: SelectionChangedEvent; + selectionChanged?: IgSpreadsheetSelectionChangedEvent; /** * Invoked when the user will be prompted with a message regarding an operation that is being performed. @@ -90657,14 +91695,14 @@ interface JQuery { /** * Invoked when the selection for a ig.spreadsheet.SpreadsheetPane of the Spreadsheet is changed. */ - igSpreadsheet(optionLiteral: 'option', optionName: "selectionChanged"): SelectionChangedEvent; + igSpreadsheet(optionLiteral: 'option', optionName: "selectionChanged"): IgSpreadsheetSelectionChangedEvent; /** * Invoked when the selection for a ig.spreadsheet.SpreadsheetPane of the Spreadsheet is changed. * * @optionValue New value to be set. */ - igSpreadsheet(optionLiteral: 'option', optionName: "selectionChanged", optionValue: SelectionChangedEvent): void; + igSpreadsheet(optionLiteral: 'option', optionName: "selectionChanged", optionValue: IgSpreadsheetSelectionChangedEvent): void; /** * Invoked when the user will be prompted with a message regarding an operation that is being performed. @@ -93097,6 +94135,27 @@ interface IgTreeDragAndDropSettings { [optionName: string]: any; } +interface IgTreeSelectionChangedEvent { + (event: Event, ui: IgTreeSelectionChangedEventUIParam): void; +} + +interface IgTreeSelectionChangedEventUIParam { + /** + * Gets a reference to the tree. + */ + owner?: any; + + /** + * Gets a reference to currently selected nodes. + */ + selectedNodes?: any[]; + + /** + * Gets a reference to the newly added nodes to the selection. + */ + newNodes?: any[]; +} + interface NodeCheckstateChangingEvent { (event: Event, ui: NodeCheckstateChangingEventUIParam): void; } @@ -93674,7 +94733,7 @@ interface IgTree { /** * Fired after a new node is selected. */ - selectionChanged?: SelectionChangedEvent; + selectionChanged?: IgTreeSelectionChangedEvent; /** * Fired before the checkbox state of a node is changed. @@ -94578,14 +95637,14 @@ interface JQuery { /** * Fired after a new node is selected. */ - igTree(optionLiteral: 'option', optionName: "selectionChanged"): SelectionChangedEvent; + igTree(optionLiteral: 'option', optionName: "selectionChanged"): IgTreeSelectionChangedEvent; /** * Fired after a new node is selected. * * @optionValue New value to be set. */ - igTree(optionLiteral: 'option', optionName: "selectionChanged", optionValue: SelectionChangedEvent): void; + igTree(optionLiteral: 'option', optionName: "selectionChanged", optionValue: IgTreeSelectionChangedEvent): void; /** * Fired before the checkbox state of a node is changed. @@ -112280,7 +113339,7 @@ interface JQuery { igZoomSlider(methodName: string, ...methodParams: any[]): any; } -interface IgLoader { +interface IgLoaderSettings { scriptPath: string; cssPath: string; resources?: string; @@ -112293,12 +113352,20 @@ interface IgLoader { preinit?: Function; } +interface IgLoader { + settings?: IgLoaderSettings; + load(resources: string, callback?: Function, preinit?: Function): IgLoader; + preinit(callback: Function): IgLoader; +} + interface IgniteUIStatic { + regional?: any; + util?: any; tmpl(template: string, data: any, ...args: any[]): string; - loader(options: IgLoader): void; - loader(callback: Function): void; - loader(resources: string, callback: Function): void; - loader(): any; + loader(options: IgLoaderSettings): IgLoader; + loader(callback: Function): IgLoader; + loader(resources: string, callback: Function): IgLoader; + loader(): IgLoader; OlapUtilities: any; } From 38af94810c50c0132150f1ed2a97769e1d7e0db9 Mon Sep 17 00:00:00 2001 From: Deyan Kamburov Date: Thu, 17 May 2018 17:01:33 +0300 Subject: [PATCH 207/575] Remove empty jsdocs --- types/ignite-ui/index.d.ts | 49 -------------------------------------- 1 file changed, 49 deletions(-) diff --git a/types/ignite-ui/index.d.ts b/types/ignite-ui/index.d.ts index 58e4ec6446..1fa6cf1168 100644 --- a/types/ignite-ui/index.d.ts +++ b/types/ignite-ui/index.d.ts @@ -27642,9 +27642,6 @@ interface IgNumericEditor { */ toUpper?: any; - /** - * - */ textMode?: any; /** @@ -28224,9 +28221,6 @@ interface IgCurrencyEditor { */ toUpper?: any; - /** - * - */ textMode?: any; /** @@ -28709,9 +28703,6 @@ interface IgPercentEditor { */ toUpper?: any; - /** - * - */ textMode?: any; /** @@ -29110,9 +29101,6 @@ interface IgMaskEditor { */ dropDownOnReadOnly?: boolean; - /** - * - */ textMode?: any; /** @@ -29648,9 +29636,6 @@ interface IgDateEditor { */ dropDownOrientation?: string; - /** - * - */ textMode?: any; /** @@ -30213,9 +30198,6 @@ interface IgDatePicker { */ dropDownOrientation?: string; - /** - * - */ textMode?: any; /** @@ -31050,9 +31032,6 @@ interface IgTimePicker { */ excludeKeys?: string; - /** - * - */ textMode?: any; /** @@ -32996,12 +32975,8 @@ interface JQuery { */ igNumericEditor(optionLiteral: 'option', optionName: "toUpper", optionValue: any): void; - /** - */ igNumericEditor(optionLiteral: 'option', optionName: "textMode"): any; - /** - */ igNumericEditor(optionLiteral: 'option', optionName: "textMode", optionValue: any): void; /** @@ -33937,12 +33912,8 @@ interface JQuery { */ igCurrencyEditor(optionLiteral: 'option', optionName: "toUpper", optionValue: any): void; - /** - */ igCurrencyEditor(optionLiteral: 'option', optionName: "textMode"): any; - /** - */ igCurrencyEditor(optionLiteral: 'option', optionName: "textMode", optionValue: any): void; /** @@ -34817,12 +34788,8 @@ interface JQuery { */ igPercentEditor(optionLiteral: 'option', optionName: "toUpper", optionValue: any): void; - /** - */ igPercentEditor(optionLiteral: 'option', optionName: "textMode"): any; - /** - */ igPercentEditor(optionLiteral: 'option', optionName: "textMode", optionValue: any): void; /** @@ -35528,12 +35495,8 @@ interface JQuery { */ igMaskEditor(optionLiteral: 'option', optionName: "dropDownOnReadOnly", optionValue: boolean): void; - /** - */ igMaskEditor(optionLiteral: 'option', optionName: "textMode"): any; - /** - */ igMaskEditor(optionLiteral: 'option', optionName: "textMode", optionValue: any): void; /** @@ -36532,12 +36495,8 @@ interface JQuery { */ igDateEditor(optionLiteral: 'option', optionName: "dropDownOrientation", optionValue: string): void; - /** - */ igDateEditor(optionLiteral: 'option', optionName: "textMode"): any; - /** - */ igDateEditor(optionLiteral: 'option', optionName: "textMode", optionValue: any): void; /** @@ -37552,12 +37511,8 @@ interface JQuery { */ igDatePicker(optionLiteral: 'option', optionName: "dropDownOrientation", optionValue: string): void; - /** - */ igDatePicker(optionLiteral: 'option', optionName: "textMode"): any; - /** - */ igDatePicker(optionLiteral: 'option', optionName: "textMode", optionValue: any): void; /** @@ -38986,12 +38941,8 @@ interface JQuery { */ igTimePicker(optionLiteral: 'option', optionName: "excludeKeys", optionValue: string): void; - /** - */ igTimePicker(optionLiteral: 'option', optionName: "textMode"): any; - /** - */ igTimePicker(optionLiteral: 'option', optionName: "textMode", optionValue: any): void; /** From 5289ad7cc4947ae43846a89ea5aaa14036fe5d25 Mon Sep 17 00:00:00 2001 From: Alec Zopf Date: Thu, 17 May 2018 10:28:42 -0400 Subject: [PATCH 208/575] incrementing version number in header --- types/superagent/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/superagent/index.d.ts b/types/superagent/index.d.ts index 8f457c804c..dc161d0fea 100644 --- a/types/superagent/index.d.ts +++ b/types/superagent/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for SuperAgent 3.5 +// Type definitions for SuperAgent 3.8.3 // Project: https://github.com/visionmedia/superagent // Definitions by: Nico Zelaya // Michael Ledin From 4ec5c6f66454bc2d344d18eb1296d1fc784b1100 Mon Sep 17 00:00:00 2001 From: Alec Zopf Date: Thu, 17 May 2018 10:48:00 -0400 Subject: [PATCH 209/575] removing patch version --- types/superagent/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/superagent/index.d.ts b/types/superagent/index.d.ts index dc161d0fea..7daf5f47dc 100644 --- a/types/superagent/index.d.ts +++ b/types/superagent/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for SuperAgent 3.8.3 +// Type definitions for SuperAgent 3.8 // Project: https://github.com/visionmedia/superagent // Definitions by: Nico Zelaya // Michael Ledin From 502c045aef9f93c846a198e59efc8c55386f8d15 Mon Sep 17 00:00:00 2001 From: Thomas Gossmann Date: Thu, 17 May 2018 17:37:42 +0200 Subject: [PATCH 210/575] Overloading add/removeObserver and add/removeListener --- types/ember/index.d.ts | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/types/ember/index.d.ts b/types/ember/index.d.ts index 0d3c957a5b..fbd356f3c1 100755 --- a/types/ember/index.d.ts +++ b/types/ember/index.d.ts @@ -1683,7 +1683,11 @@ declare module 'ember' { addObserver( key: keyof this, target: Target, - method?: ObserverMethod + method: ObserverMethod + ): void; + addObserver( + key: keyof this, + method: ObserverMethod ): void; /** * Remove an observer you have previously registered on this object. Pass @@ -1693,7 +1697,11 @@ declare module 'ember' { removeObserver( key: keyof this, target: Target, - method?: ObserverMethod + method: ObserverMethod + ): any; + removeObserver( + key: keyof this, + method: ObserverMethod ): any; /** * Retrieves the value of a property, or a default value in the case that the @@ -3010,6 +3018,12 @@ declare module 'ember' { method: ObserverMethod, once?: boolean ): void; + function addListener( + obj: Context, + key: keyof Context, + method: ObserverMethod, + once?: boolean + ): void; /** * Remove an event listener */ @@ -3019,6 +3033,11 @@ declare module 'ember' { target: Target, method: ObserverMethod ): any; + function removeListener( + obj: Context, + key: keyof Context, + method: ObserverMethod + ): any; /** * Send an event. The execution of suspended listeners * is skipped, and once listeners are removed. A listener without @@ -3112,6 +3131,11 @@ declare module 'ember' { target: Target, method: ObserverMethod ): void; + function addObserver( + obj: Context, + key: keyof Context, + method: ObserverMethod + ): void; /** * Remove an observer you have previously registered on this object. Pass * the same key, target, and method you passed to `addObserver()` and your @@ -3123,6 +3147,11 @@ declare module 'ember' { target: Target, method: ObserverMethod ): any; + function removeObserver( + obj: Context, + key: keyof Context, + method: ObserverMethod + ): any; /** * Gets the value of a property on an object. If the property is computed, * the function will be invoked. If the property is not defined but the From 318e099c2e169f92f09464927e384070f1faa0c8 Mon Sep 17 00:00:00 2001 From: Benjamin Dobson Date: Thu, 17 May 2018 17:01:06 +0100 Subject: [PATCH 211/575] @types/jwplayer updated to work with JWP 8.2.2 --- types/jwplayer/index.d.ts | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/types/jwplayer/index.d.ts b/types/jwplayer/index.d.ts index aee22c16f1..15991c7f9c 100644 --- a/types/jwplayer/index.d.ts +++ b/types/jwplayer/index.d.ts @@ -89,6 +89,12 @@ interface AdImpressionParam extends CallbackParam { wrapper: any[]; } +interface AdScheduleParam extends CallbackParam { + tag: string; + client: string; + adbreaks: Array; +} + interface AdStartedParam extends CallbackParam { creativetype: string; tag: string; @@ -287,8 +293,12 @@ interface JWPlayer { on(event: 'adRequest', callback: EventCallback): void; once(event: 'adRequest', callback: EventCallback): void; off(event: 'adRequest'): void; - trigger(event: 'adRequest', args: AdRequestParam): void; - on(event: 'adStarted', callback: EventCallback): void; + trigger(event: 'adRequest', args: AdScheduleParam): void; + on(event: 'adSchedule', callback: EventCallback): void; + once(event: 'adSchedule', callback: EventCallback): void; + off(event: 'adSchedule'): void; + trigger(event: 'adSchedule', args: AdRequestParam): void; + on(event: 'adStarted', callback: EventCallback): void; once(event: 'adStarted', callback: EventCallback): void; off(event: 'adStarted'): void; trigger(event: 'adStarted', args: AdStartedParam): void; @@ -424,7 +434,11 @@ interface JWPlayer { once(event: 'seek', callback: EventCallback): void; off(event: 'seek'): void; trigger(event: 'seek', args: SeekParam): void; - on(event: 'setupError', callback: EventCallback): void; + on(event: 'seeked', callback: () => void): void; + once(event: 'seeked', callback: () => void): void; + off(event: 'seeked'): void; + trigger(event: 'seeked'): void + on(event: 'setupError', callback: EventCallback): void; once(event: 'setupError', callback: EventCallback): void; off(event: 'setupError'): void; trigger(event: 'setupError', args: ErrorParam): void; From 38289b5abfe1bb2b1c1c140082721f621b12dfca Mon Sep 17 00:00:00 2001 From: Thomas Gossmann Date: Thu, 17 May 2018 18:06:54 +0200 Subject: [PATCH 212/575] no unnecessary generics --- types/ember/index.d.ts | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/types/ember/index.d.ts b/types/ember/index.d.ts index fbd356f3c1..196820d531 100755 --- a/types/ember/index.d.ts +++ b/types/ember/index.d.ts @@ -1685,9 +1685,9 @@ declare module 'ember' { target: Target, method: ObserverMethod ): void; - addObserver( + addObserver( key: keyof this, - method: ObserverMethod + method: ObserverMethod ): void; /** * Remove an observer you have previously registered on this object. Pass @@ -1699,9 +1699,9 @@ declare module 'ember' { target: Target, method: ObserverMethod ): any; - removeObserver( + removeObserver( key: keyof this, - method: ObserverMethod + method: ObserverMethod ): any; /** * Retrieves the value of a property, or a default value in the case that the @@ -3018,10 +3018,10 @@ declare module 'ember' { method: ObserverMethod, once?: boolean ): void; - function addListener( + function addListener( obj: Context, key: keyof Context, - method: ObserverMethod, + method: ObserverMethod, once?: boolean ): void; /** @@ -3033,10 +3033,10 @@ declare module 'ember' { target: Target, method: ObserverMethod ): any; - function removeListener( + function removeListener( obj: Context, key: keyof Context, - method: ObserverMethod + method: ObserverMethod ): any; /** * Send an event. The execution of suspended listeners @@ -3131,10 +3131,10 @@ declare module 'ember' { target: Target, method: ObserverMethod ): void; - function addObserver( + function addObserver( obj: Context, key: keyof Context, - method: ObserverMethod + method: ObserverMethod ): void; /** * Remove an observer you have previously registered on this object. Pass @@ -3147,10 +3147,10 @@ declare module 'ember' { target: Target, method: ObserverMethod ): any; - function removeObserver( + function removeObserver( obj: Context, key: keyof Context, - method: ObserverMethod + method: ObserverMethod ): any; /** * Gets the value of a property on an object. If the property is computed, From ee939689676ed95a1cdf5bae1926a85ce1f76269 Mon Sep 17 00:00:00 2001 From: Benjamin Dobson Date: Thu, 17 May 2018 17:17:46 +0100 Subject: [PATCH 213/575] Fixed type mismatch between adRequest and adSchedule --- types/jwplayer/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/jwplayer/index.d.ts b/types/jwplayer/index.d.ts index 15991c7f9c..e01620bff5 100644 --- a/types/jwplayer/index.d.ts +++ b/types/jwplayer/index.d.ts @@ -293,11 +293,11 @@ interface JWPlayer { on(event: 'adRequest', callback: EventCallback): void; once(event: 'adRequest', callback: EventCallback): void; off(event: 'adRequest'): void; - trigger(event: 'adRequest', args: AdScheduleParam): void; + trigger(event: 'adRequest', args: AdRequestParam): void; on(event: 'adSchedule', callback: EventCallback): void; once(event: 'adSchedule', callback: EventCallback): void; off(event: 'adSchedule'): void; - trigger(event: 'adSchedule', args: AdRequestParam): void; + trigger(event: 'adSchedule', args: AdScheduleParam): void; on(event: 'adStarted', callback: EventCallback): void; once(event: 'adStarted', callback: EventCallback): void; off(event: 'adStarted'): void; From fa80fda5078f458234b08d3467f5b772cfdee5fc Mon Sep 17 00:00:00 2001 From: Benjamin Dobson Date: Thu, 17 May 2018 17:20:24 +0100 Subject: [PATCH 214/575] Array style fix --- types/jwplayer/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/jwplayer/index.d.ts b/types/jwplayer/index.d.ts index e01620bff5..b2f9879d59 100644 --- a/types/jwplayer/index.d.ts +++ b/types/jwplayer/index.d.ts @@ -92,7 +92,7 @@ interface AdImpressionParam extends CallbackParam { interface AdScheduleParam extends CallbackParam { tag: string; client: string; - adbreaks: Array; + adbreaks: object[]; } interface AdStartedParam extends CallbackParam { From 5f0eecaffcc19723315a967b6c4fdde5a830fb5e Mon Sep 17 00:00:00 2001 From: Benjamin Dobson Date: Thu, 17 May 2018 17:26:31 +0100 Subject: [PATCH 215/575] object -> any in AdScheduleParam --- types/jwplayer/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/jwplayer/index.d.ts b/types/jwplayer/index.d.ts index b2f9879d59..4ab24f88cf 100644 --- a/types/jwplayer/index.d.ts +++ b/types/jwplayer/index.d.ts @@ -92,7 +92,7 @@ interface AdImpressionParam extends CallbackParam { interface AdScheduleParam extends CallbackParam { tag: string; client: string; - adbreaks: object[]; + adbreaks: any[]; } interface AdStartedParam extends CallbackParam { From 629d40c1c2548a56b19c67a36d913b5c62b06bad Mon Sep 17 00:00:00 2001 From: Benjamin Dobson Date: Thu, 17 May 2018 17:30:12 +0100 Subject: [PATCH 216/575] Updated version number in header --- types/jwplayer/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/jwplayer/index.d.ts b/types/jwplayer/index.d.ts index 4ab24f88cf..3c54446a6b 100644 --- a/types/jwplayer/index.d.ts +++ b/types/jwplayer/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for JW Player V8.0 +// Type definitions for JW Player V8.2 // Project: https://github.com/jwplayer/jwplayer/ // Definitions by: Martin Duparc // Tomer Kruvi From 1d1c5f8a6304219c715a696cc77609f9652588ab Mon Sep 17 00:00:00 2001 From: Benjamin Dobson Date: Thu, 17 May 2018 17:35:02 +0100 Subject: [PATCH 217/575] Revert "object -> any in AdScheduleParam" This reverts commit 5f0eecaffcc19723315a967b6c4fdde5a830fb5e. --- types/jwplayer/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/jwplayer/index.d.ts b/types/jwplayer/index.d.ts index 3c54446a6b..9479ea5fa1 100644 --- a/types/jwplayer/index.d.ts +++ b/types/jwplayer/index.d.ts @@ -92,7 +92,7 @@ interface AdImpressionParam extends CallbackParam { interface AdScheduleParam extends CallbackParam { tag: string; client: string; - adbreaks: any[]; + adbreaks: object[]; } interface AdStartedParam extends CallbackParam { From 62901eb27cfe85f4879b3c04a90fb030430855b5 Mon Sep 17 00:00:00 2001 From: Benjamin Dobson Date: Thu, 17 May 2018 17:44:26 +0100 Subject: [PATCH 218/575] Add my name and minimum typescript version --- types/jwplayer/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/jwplayer/index.d.ts b/types/jwplayer/index.d.ts index 9479ea5fa1..6481b59faf 100644 --- a/types/jwplayer/index.d.ts +++ b/types/jwplayer/index.d.ts @@ -4,7 +4,9 @@ // Tomer Kruvi // Philipp Gürtler // Daniel McGraw +// Benjamin Dobson // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 // JW Player is the leading HTML5 & Flash video player, optimized for mobile and the desktop. Easy enough for beginners, advanced enough for pros. From 9f18f414ecb2666e0e810da8e6f6220c3d09aedc Mon Sep 17 00:00:00 2001 From: forest yox Date: Thu, 17 May 2018 13:52:26 -0400 Subject: [PATCH 219/575] added acoords --- types/fabric/fabric-impl.d.ts | 5 +++++ types/fabric/test/index.ts | 1 + 2 files changed, 6 insertions(+) diff --git a/types/fabric/fabric-impl.d.ts b/types/fabric/fabric-impl.d.ts index e35b0ebe0d..580b132e60 100644 --- a/types/fabric/fabric-impl.d.ts +++ b/types/fabric/fabric-impl.d.ts @@ -2249,6 +2249,11 @@ interface IObjectOptions { * Not used by fabric, just for convenience */ data?: any; + + /** + * Describes the object's corner position in canvas object absolute properties. + */ + aCoords?: {bl: Point, br: Point, tl: Point, tr: Point}; } export interface Object extends IObservable, IObjectOptions, IObjectAnimation { } export class Object { diff --git a/types/fabric/test/index.ts b/types/fabric/test/index.ts index 1060525a00..e6b72b4281 100644 --- a/types/fabric/test/index.ts +++ b/types/fabric/test/index.ts @@ -1,3 +1,4 @@ + function sample1() { const canvas = new fabric.Canvas('c', { hoverCursor: 'pointer', From e41d767e634d8b915f5d460aea27e2e3741a7815 Mon Sep 17 00:00:00 2001 From: Thomas Gossmann Date: Thu, 17 May 2018 20:01:51 +0200 Subject: [PATCH 220/575] addListener with 3 or 5 parameters --- types/ember/index.d.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/types/ember/index.d.ts b/types/ember/index.d.ts index 196820d531..a1cfc84334 100755 --- a/types/ember/index.d.ts +++ b/types/ember/index.d.ts @@ -3021,8 +3021,7 @@ declare module 'ember' { function addListener( obj: Context, key: keyof Context, - method: ObserverMethod, - once?: boolean + method: ObserverMethod ): void; /** * Remove an event listener From 14d56932beb9f6a93275321b85e48177de4b93d1 Mon Sep 17 00:00:00 2001 From: Thomas Gossmann Date: Thu, 17 May 2018 20:02:36 +0200 Subject: [PATCH 221/575] Add tests for Ember.addObserver and Ember.removeObserver --- types/ember/test/observable.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/ember/test/observable.ts b/types/ember/test/observable.ts index 3585535dec..a642da271f 100755 --- a/types/ember/test/observable.ts +++ b/types/ember/test/observable.ts @@ -19,6 +19,8 @@ class MyComponent extends Ember.Component { }; this.addObserver('foo', lambda); this.removeObserver('foo', lambda); + Ember.addObserver(this, 'foo', lambda); + Ember.removeObserver(this, 'foo', lambda); } fooDidChange(sender: MyComponent, key: 'foo') { From 80ad40ad7817831d5daaa54edac229a666278990 Mon Sep 17 00:00:00 2001 From: forest yox Date: Thu, 17 May 2018 14:34:29 -0400 Subject: [PATCH 222/575] fixed inadvertant whitespace --- types/fabric/test/index.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/types/fabric/test/index.ts b/types/fabric/test/index.ts index e6b72b4281..1060525a00 100644 --- a/types/fabric/test/index.ts +++ b/types/fabric/test/index.ts @@ -1,4 +1,3 @@ - function sample1() { const canvas = new fabric.Canvas('c', { hoverCursor: 'pointer', From 7ccb318b17d8c96bb27e4abd0b859ff609f3f551 Mon Sep 17 00:00:00 2001 From: Alex Jerabek Date: Thu, 17 May 2018 13:42:36 -0700 Subject: [PATCH 223/575] TestErrorChange --- types/office-js/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/office-js/index.d.ts b/types/office-js/index.d.ts index d0eaf593c5..cee60e05fc 100644 --- a/types/office-js/index.d.ts +++ b/types/office-js/index.d.ts @@ -148,6 +148,8 @@ declare namespace Office { } /** * Provides specific information about an error that occurred during an asynchronous data operation. + * + * Remarks: The Error object is accessed from the AsyncResult object that is returned in the function passed as the callback argument of an asynchronous data operation, such as the setSelectedDataAsync method of the Document object. */ export interface Error { /** From 96a4cebfb03d9e561eface2717ba591a0c3f0572 Mon Sep 17 00:00:00 2001 From: Simon Epskamp Date: Thu, 17 May 2018 23:04:27 +0200 Subject: [PATCH 224/575] react-transition-group: allow component={null} on TransitionGroup --- types/react-transition-group/TransitionGroup.d.ts | 2 +- types/react-transition-group/index.d.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/types/react-transition-group/TransitionGroup.d.ts b/types/react-transition-group/TransitionGroup.d.ts index 13e8daf228..913c034729 100644 --- a/types/react-transition-group/TransitionGroup.d.ts +++ b/types/react-transition-group/TransitionGroup.d.ts @@ -3,7 +3,7 @@ import { TransitionActions, TransitionProps } from "./Transition"; declare namespace TransitionGroup { interface IntrinsicTransitionGroupProps extends TransitionActions { - component?: T; + component?: T|null; } interface ComponentTransitionGroupProps extends TransitionActions { diff --git a/types/react-transition-group/index.d.ts b/types/react-transition-group/index.d.ts index 6a90201af5..dbe906f679 100644 --- a/types/react-transition-group/index.d.ts +++ b/types/react-transition-group/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for react-transition-group 2.0 // Project: https://github.com/reactjs/react-transition-group // Definitions by: Karol Janyst +// Epskampie // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 From d3285aecfbf49636899b85b69ef63d715db926c5 Mon Sep 17 00:00:00 2001 From: Jack Walters Date: Thu, 17 May 2018 14:43:30 -0700 Subject: [PATCH 225/575] Added in missing horizontalFill and verticalFill --- types/recharts/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/recharts/index.d.ts b/types/recharts/index.d.ts index b274430529..ecdcd1f420 100644 --- a/types/recharts/index.d.ts +++ b/types/recharts/index.d.ts @@ -284,6 +284,8 @@ export interface CartesianGridProps extends Partial { offset?: object; chartWidth?: number; chartHeight?: number; + horizontalFill?: string[]; + verticalFill?: string[]; } export class CartesianGrid extends React.Component { } From 6a825c9425430a2c80c92c132ad4edb354b17940 Mon Sep 17 00:00:00 2001 From: Alex Jerabek Date: Thu, 17 May 2018 15:20:53 -0700 Subject: [PATCH 226/575] first pass porting old docs text --- types/office-js/index.d.ts | 230 ++++++++++++++++++++++++++++++------- 1 file changed, 188 insertions(+), 42 deletions(-) diff --git a/types/office-js/index.d.ts b/types/office-js/index.d.ts index cee60e05fc..0ff10134b5 100644 --- a/types/office-js/index.d.ts +++ b/types/office-js/index.d.ts @@ -20,6 +20,9 @@ declare namespace Office { } export var Promise: PromiseConstructor; + /** + * Gets the Context object that represents the runtime environment of the add-in and provides access to the top-level objects of the API. + */ export var context: Context; /** * This method is called after the Office API was loaded. @@ -149,7 +152,9 @@ declare namespace Office { /** * Provides specific information about an error that occurred during an asynchronous data operation. * - * Remarks: The Error object is accessed from the AsyncResult object that is returned in the function passed as the callback argument of an asynchronous data operation, such as the setSelectedDataAsync method of the Document object. + * @remarks + * The Error object is accessed from the AsyncResult object that is returned in the function passed as the callback argument of an asynchronous data operation, such as the setSelectedDataAsync method of the Document object. + * Hosts: Access, Excel, Outlook, PowerPoint, Project, Word */ export interface Error { /** @@ -165,6 +170,9 @@ declare namespace Office { */ name: string; } + /** + * Provides objects and methods that you can use to create and manipulate UI components, such as dialog boxes, in your Office Add-ins. + */ export interface UI { /** * Displays a dialog to show or collect information from the user or to facilitate Web navigation. @@ -190,24 +198,18 @@ declare namespace Office { * @param callback Optional. Accepts a callback method to handle the dialog creation attempt. */ displayDialogAsync(startAddress: string, options: DialogOptions, callback: (result: AsyncResult) => void): void; - /** - * Synchronously delivers a message from the dialog to its parent add-in. + * Delivers a message from the dialog box to its parent/opener page. The page calling this API must be on the same domain as the parent. * @param messageObject Accepts a message from the dialog to deliver to the add-in. */ messageParent(messageObject: any): void; /** * Closes the UI container where the JavaScript is executing. - * - * Supported hosts: Outlook - Minimum requirement set: Mailbox 1.5 - * * The behavior of this method is specified by the following: - * - * Called from a UI-less command button: No effect. Any dialog opened by displayDialogAsync will remain open. - * - * Called from a taskpane: The taskpane will close. Any dialog opened by displayDialogAsync will also close. If the taskpane supports pinning and was pinned by the user, it will be un-pinned. - * - * Called from a module extension: No effect. + * - Called from a UI-less command button: No effect. Any dialog opened by displayDialogAsync will remain open. + * - Called from a taskpane: The taskpane will close. Any dialog opened by displayDialogAsync will also close. If the taskpane supports pinning and was pinned by the user, it will be un-pinned. + * - Called from a module extension: No effect. + * Hosts: Outlook - Minimum requirement set: Mailbox 1.5 */ closeContainer(): void; } @@ -826,18 +828,55 @@ declare namespace Office { */ type: EventType; } + /** + * Represents the document file associated with an Office Add-in. + * + * @remarks + * Access the File object with the AsyncResult.value property in the callback function passed to the Document.getFileAsync method. + * Hosts: PowerPoint, Word + */ export interface File { + /** + * Gets the document file size in bytes. + * @remarks + * Hosts: PowerPoint, Word + */ size: number; + /** + * Gets the number of slices into which the file is divided. + * @remarks + * Hosts: PowerPoint, Word + */ sliceCount: number; /** - * Closes the File. - * @param callback The optional callback method + * Closes the document file. + * No more than two documents are allowed to be in memory; otherwise the Document.getFileAsync operation will fail. Use the File.closeAsync method to close the file when you are finished working with it. + * Hosts: PowerPoint, Word + * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. Optional. + * @remarks + * When the function you passed to the callback parameter executes, it receives an AsyncResult object that you can access from the callback function's only parameter. + * In the callback function passed to the closeAsync method, you can use the properties of the AsyncResult object to return the following information. + * Property - Use to... + * AsyncResult.value - Always returns undefined because there is no object or data to retrieve. + * AsyncResult.status - Determine the success or failure of the operation. + * AsyncResult.error - Access an Error object that provides error information if the operation failed. + * AsyncResult.asyncContext - Access your user-defined object or value, if you passed one as the asyncContext parameter. */ closeAsync(callback?: (result: AsyncResult) => void): void; /** - * Gets the specified slice. - * @param sliceIndex The index of the slice to be retrieved - * @param callback The optional callback method + * Returns the specified slice. + * @remarks + * Hosts: PowerPoint, Word + * @param sliceIndex Specifies the zero-based index of the slice to be retrieved. Required. + * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. Optional. + * @remarks + * When the function you passed to the callback parameter executes, it receives an AsyncResult object that you can access from the callback function's only parameter. + * In the callback function passed to the getSliceAsync method, you can use the properties of the AsyncResult object to return the following information. + * Property - Use to... + * AsyncResult.value - Access the Slice object. + * AsyncResult.status - Determine the success or failure of the operation. + * AsyncResult.error - Access an Error object that provides error information if the operation failed. + * AsyncResult.asyncContext - Access your user-defined object or value, if you passed one as the asyncContext parameter. */ getSliceAsync(sliceIndex: number, callback?: (result: AsyncResult) => void): void; } @@ -851,58 +890,143 @@ declare namespace Office { columnCount: number; rowCount: number; } + /** + * Represents custom settings for a task pane or content add-in that are stored in the host document as name/value pairs. + * + * @remarks + * The settings created by using the methods of the Settings object are saved per add-in and per document. That is, they are available only to the add-in that created them, and only from the document in which they are saved. + * The name of a setting is a string, while the value can be a string, number, boolean, null, object, or array. + * The Settings object is automatically loaded as part of the Document object, and is available by calling the settings property of that object when the add-in is activated. The developer is responsible for calling the saveAsync method after adding or deleting settings to save the settings in the document. + * Hosts: Access, Excel, PowerPoint, Word + */ export interface Settings { /** - * Adds an event handler for the object using the specified event type. - * @param eventType The event type. For settings can be 'settingsChanged' - * @param handler The name of the handler - * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * Adds an event handler for the settingsChanged event. + * @remarks + * You can add multiple event handlers for the specified eventType as long as the name of each event handler function is unique. + * Important: Your add-in's code can register a handler for the settingsChanged event when the add-in is running with any Excel client, but the event will fire only when the add-in is loaded with a spreadsheet that is opened in Excel Online, and more than one user is editing the spreadsheet (co-authoring). Therefore, effectively the settingsChanged event is supported only in Excel Online in co-authoring scenarios. + * Hosts: Excel + * @param eventType Specifies the type of event to add. Required. + * @param handler The event handler function to add. Required. + * @param options Specifies any of the following optional parameters. + * @param asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @remarks + * When the function you passed to the callback parameter executes, it receives an AsyncResult object that you can access from the callback function's only parameter. + * In the callback function passed to the addHandlerAsync method, you can use the properties of the AsyncResult object to return the following information. + * Property - Use to... + * AsyncResult.value - Always returns undefined because there is no data or object to retrieve when adding an event handler. + * AsyncResult.status - Determine the success or failure of the operation. + * AsyncResult.error - Access an Error object that provides error information if the operation failed. + * AsyncResult.asyncContext - Access your user-defined object or value, if you passed one as the asyncContext parameter. */ addHandlerAsync(eventType: EventType, handler: any, options?: any, callback?: (result: AsyncResult) => void): void; /** - * Retrieves the setting with the specified name. - * @param settingName The name of the setting + * Retrieves the specified setting. + * @remarks + * Hosts: Access, Excel, PowerPoint, Word + * @param settingName The case-sensitive name of the setting to retrieve. + * @returns An object that has property names mapped to JSON serialized values. */ get(name: string): any; /** - * Gets the latest version of the settings object. - * @param callback The optional callback method + * Reads all settings persisted in the document and refreshes the content or task pane add-in's copy of those settings held in memory. + * @remarks + * This method is useful in Word and PowerPoint coauthoring scenarios when multiple instances of the same add-in are working against the same document. Because each add-in is working against an in-memory copy of the settings loaded from the document at the time the user opened it, the settings values used by each user can get out of sync. This can happen whenever an instance of the add-in calls the Settings.saveAsync method to persist all of that user's settings to the document. Calling the refreshAsync method from the event handler for the settingsChanged event of the add-in will refresh the settings values for all users. + * The refreshAsync method can be called from add-ins created for Excel, but since it doesn't support coauthoring there is no reason to do so. + * Hosts: Access, Excel, PowerPoint, Word + * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @remarks + * When the function you passed to the callback parameter executes, it receives an AsyncResult object that you can access from the callback function's only parameter. + * In the callback function passed to the refreshAsync method, you can use the properties of the AsyncResult object to return the following information. + * Property - Use to... + * AsyncResult.value - Access a Settings object with the refreshed values. + * AsyncResult.status - Determine the success or failure of the operation. + * AsyncResult.error - Access an Error object that provides error information if the operation failed. + * AsyncResult.asyncContext - Access your user-defined object or value, if you passed one as the asyncContext parameter. */ refreshAsync(callback?: (result: AsyncResult) => void): void; /** - * Removes the setting with the specified name. - * @param settingName The name of the setting + * Removes the specified setting. + * @remarks + * null is a valid value for a setting. Therefore, assigning null to the setting will not remove it from the settings property bag. + * Important: Be aware that the Settings.remove method affects only the in-memory copy of the settings property bag. To persist the removal of the specified setting in the document, at some point after calling the Settings.remove method and before the add-in is closed, you must call the Settings.saveAsync method. + * Hosts: Access, Excel, PowerPoint, Word + * @param settingName The case-sensitive name of the setting to remove. */ remove(name: string): void; /** - * Removes an event handler for the specified event type. - * @param eventType The event type. For settings can be 'settingsChanged' - * @param options Syntax example: {handler:eventHandler} - * handler: Indicates a specific handler to be removed, if not specified all handlers are removed - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * Removes an event handler for the settingsChanged event. + * @remarks + * If the optional handler parameter is omitted when calling the removeHandlerAsync method, all event handlers for the specified eventType will be removed. + * Hosts: Access, Excel, PowerPoint + * @param eventType Specifies the type of event to remove. Required. + * @param options Specifies any of the following optional parameters. + * @param handler: Specifies the name of the handler to remove. + * @param asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @remarks + * When the function you passed to the callback parameter executes, it receives an AsyncResult object that you can access from the callback function's only parameter. + * In the callback function passed to the removeHandlerAsync method, you can use the properties of the AsyncResult object to return the following information. */ removeHandlerAsync(eventType: EventType, options?: any, callback?: (result: AsyncResult) => void): void; /** - * Saves all settings. + * Persists the in-memory copy of the settings property bag in the document. + * @remarks + * Any settings previously saved by an add-in are loaded when it is initialized, so during the lifetime of the session you can just use the set and get methods to work with the in-memory copy of the settings property bag. When you want to persist the settings so that they are available the next time the add-in is used, use the saveAsync method. + * Note: The saveAsync method persists the in-memory settings property bag into the document file; however, the changes to the document file itself are saved only when the user (or AutoRecover setting) saves the document to the file system. + * The refreshAsync method is only useful in coauthoring scenarios (which are only supported in Word) when other instances of the same add-in might change the settings and those changes should be made available to all instances. + * Hosts: Access, Excel, PowerPoint, Word * @param options Syntax example: {overwriteIfStale:false} - * overwriteIfStale: Indicates whether the setting will be replaced if stale. - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * @param overwriteIfStale: Indicates whether the setting will be replaced if stale. + * @param asyncContext: Object keeping state for the callback + * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. Optional. + * @remarks + * When the function you passed to the callback parameter executes, it receives an AsyncResult object that you can access from the callback function's only parameter. + * In the callback function passed to the saveAsync method, you can use the properties of the AsyncResult object to return the following information. + * Property - Use to... + * AsyncResult.value - Always returns undefined because there is no object or data to retrieve. + * AsyncResult.status - Determine the success or failure of the operation. + * AsyncResult.error - Access an Error object that provides error information if the operation failed. + * AsyncResult.asyncContext - Access your user-defined object or value, if you passed one as the asyncContext parameter. */ saveAsync(callback?: (result: AsyncResult) => void): void; /** - * Sets a value for the setting with the specified name. - * @param settingName The name of the setting - * @param value The value for the setting + * Sets or creates the specified setting. + * @remarks + * The set method creates a new setting of the specified name if it does not already exist, or sets an existing setting of the specified name in the in-memory copy of the settings property bag. After you call the Settings.saveAsync method, the value is stored in the document as the serialized JSON representation of its data type. A maximum of 2MB is available for the settings of each add-in. + * Important: Be aware that the Settings.set method affects only the in-memory copy of the settings property bag. To make sure that additions or changes to settings will be available to your add-in the next time the document is opened, at some point after calling the Settings.set method and before the add-in is closed, you must call the Settings.saveAsync method to persist settings in the document. + * Hosts: Access, Excel, PowerPoint, Word + * @param settingName The case-sensitive name of the setting to set or create. + * @param value Specifies the value to be stored. */ set(name: string, value: any): void; } + /** + * Represents a slice of a document file. + * @remarks + * The Slice object is accessed with the File.getSliceAsync method. + * Hosts: PowerPoint, Word + */ export interface Slice { + /** + * Gets the raw data of the file slice in Office.FileType.Text ("text") or Office.FileType.Compressed ("compressed") format as specified by the fileType parameter of the call to the Document.getFileAsync method. + * @remarks + * Files in the "compressed" format will return a byte array that can be transformed to a base64-encoded string if required. + * Hosts: PowerPoint, Word + */ data: any; + /** + * Gets the zero-based index of the file slice. + * @remarks + * Hosts: PowerPoint, Word + */ index: number; + /** + * Gets the size of the slice in bytes. + * @remarks + * Hosts: PowerPoint, Word + */ size: number; } export interface TableBinding extends Binding { @@ -968,10 +1092,32 @@ declare namespace Office { */ setTableOptionsAsync(tableOptions: any, options?: any, callback?: (result: AsyncResult) => void): void; } + /** + * Represents the data in a table or a TableBinding. + * @remarks + * Hosts: Excel, Word + */ export class TableData { constructor(rows: any[][], headers: any[]); constructor(); + /** + * Gets or sets the headers of the table. + * @remarks + * To specify headers, you must specify an array of arrays that corresponds to the structure of the table. For example, to specify headers for a two-column table you would set the header property to [['header1', 'header2']]. + * If you specify null for the headers property (or leaving the property empty when you construct a TableData object), the following results occur when your code executes: + * - If you insert a new table, the default column headers for the table are created. + * - If you overwrite or update an existing table, the existing headers are not altered. + * Hosts: Excel, Word + */ headers: any[]; + /** + * Gets or sets the rows in the table. Returns an array of arrays that contains the data in the table. Returns an empty array ``, if there are no rows. + * To specify rows, you must specify an array of arrays that corresponds to the structure of the table. For example, to specify two rows of string values in a two-column table you would set the rows property to [['a', 'b'], ['c', 'd']]. + * If you specify null for the rows property (or leave the property empty when you construct a TableData object), the following results occur when your code executes: + * - If you insert a new table, a blank row will be inserted. + * - If you overwrite or update an existing table, the existing rows are not altered. + * Hosts: Excel, Word + */ rows: any[][]; } export enum Table { From e22bae51fddb5fb774bb319947b27512af75f715 Mon Sep 17 00:00:00 2001 From: Tom Crockett Date: Thu, 17 May 2018 15:25:40 -0700 Subject: [PATCH 227/575] [react-tooltip] Add dataTip argument to getContent callback --- types/react-tooltip/index.d.ts | 2 +- types/react-tooltip/react-tooltip-tests.tsx | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/types/react-tooltip/index.d.ts b/types/react-tooltip/index.d.ts index e9690b8f5c..044e737402 100644 --- a/types/react-tooltip/index.d.ts +++ b/types/react-tooltip/index.d.ts @@ -39,7 +39,7 @@ declare namespace ReactTooltip { type ElementEvents = (keyof HTMLElementEventMap) | string; type WindowEvents = (keyof WindowEventMap) | string; - type GetContentCallback = () => React.ReactNode; + type GetContentCallback = (dataTip: string) => React.ReactNode; type GetContent = GetContentCallback | [GetContentCallback, number]; type Place = "top" | "right" | "bottom" | "left"; diff --git a/types/react-tooltip/react-tooltip-tests.tsx b/types/react-tooltip/react-tooltip-tests.tsx index 97b7a085ea..313804c901 100644 --- a/types/react-tooltip/react-tooltip-tests.tsx +++ b/types/react-tooltip/react-tooltip-tests.tsx @@ -8,7 +8,7 @@ export class ReactTooltipTest extends React.PureComponent { } render() { - const getContent: ReactTooltip.GetContent = [() => Math.floor(Math.random() * 100), 30]; + const getContent: ReactTooltip.GetContent = [dataTip => Math.floor(Math.random() * 100), 30]; return
d(`・∀・)b @@ -53,8 +53,8 @@ export class ReactTooltipTest extends React.PureComponent { =( •̀д•́) - =( •̀д•́) - new Date().toISOString(), 1000]} /> + =( •̀д•́) + new Date(dateString).toISOString(), 1000]} /> d(`・∀・)b Date: Thu, 17 May 2018 16:39:11 -0700 Subject: [PATCH 228/575] Added new SparkPost Sending Domain Status/Verify Attributes --- types/sparkpost/index.d.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/types/sparkpost/index.d.ts b/types/sparkpost/index.d.ts index b6914240b2..661d8b74c5 100644 --- a/types/sparkpost/index.d.ts +++ b/types/sparkpost/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for sparkpost 2.1 // Project: https://github.com/SparkPost/node-sparkpost -// Definitions by: Joshua DeVinney , Bond +// Definitions by: Joshua DeVinney , Bond , Victor // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -1139,6 +1139,10 @@ declare namespace SparkPost { abuse_at_status: "valid" | "invalid" | "unverified" | "pending"; /** Verification status of postmaster@ mailbox */ postmaster_at_status: "valid" | "invalid" | "unverified" | "pending"; + /** Verification status of CNAME configuration */ + cname_status: "valid" | "invalid" | "unverified" | "pending"; + /** Verification status of MX configuration */ + mx_status: "valid" | "invalid" | "unverified" | "pending"; } interface VerifyOptions { @@ -1173,6 +1177,10 @@ declare namespace SparkPost { * */ abuse_at_token?: string; + /** + * Request verification of CNAME record + */ + cname_verify?: boolean; } interface VerifyResults extends Status { From 3fb449e39a30595871cff946f4e369ca002444e4 Mon Sep 17 00:00:00 2001 From: Fahmi Akbar Wildana Date: Fri, 18 May 2018 09:22:00 +0700 Subject: [PATCH 229/575] [@types/mathjs] update Unit Base on current docs http://mathjs.org/docs/datatypes/units.html#api --- types/mathjs/index.d.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/types/mathjs/index.d.ts b/types/mathjs/index.d.ts index a02729b635..f0694feb99 100644 --- a/types/mathjs/index.d.ts +++ b/types/mathjs/index.d.ts @@ -1307,9 +1307,26 @@ declare namespace math { // tslint:disable-line strict-export-declare-modifiers phi: number; } + interface MathJSON { + mathjs?: string; + value: number; + unit: string; + fixPrefix?: boolean; + } + interface Unit { to(unit: string): Unit; toNumber(unit: string): number; + clone(): Unit; + equalBase(unit: Unit): boolean; + equals(unit: Unit): boolean; + format(options: FormatOptions): string; + fromJSON(json: MathJSON): Unit; + toJSON(): MathJSON; + splitUnit(parts: string[]): Unit[]; + toNumeric(unit: string): number | Fraction | BigNumber; + toSI(): Unit; + toString(): string; } interface CreateUnitOptions { From 5f58da50b39a59509b4d87515f8000048c0a40e6 Mon Sep 17 00:00:00 2001 From: Fahmi Akbar Wildana Date: Fri, 18 May 2018 09:34:13 +0700 Subject: [PATCH 230/575] [avoid common mistake] change to ReadonlyArray --- types/mathjs/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/mathjs/index.d.ts b/types/mathjs/index.d.ts index f0694feb99..7141fa077c 100644 --- a/types/mathjs/index.d.ts +++ b/types/mathjs/index.d.ts @@ -1323,7 +1323,7 @@ declare namespace math { // tslint:disable-line strict-export-declare-modifiers format(options: FormatOptions): string; fromJSON(json: MathJSON): Unit; toJSON(): MathJSON; - splitUnit(parts: string[]): Unit[]; + splitUnit(parts: ReadonlyArray): Unit[]; toNumeric(unit: string): number | Fraction | BigNumber; toSI(): Unit; toString(): string; From 023a89ede6e2f1c642ed0384a9a6d148d67e9bb2 Mon Sep 17 00:00:00 2001 From: Fahmi Akbar Wildana Date: Fri, 18 May 2018 09:41:12 +0700 Subject: [PATCH 231/575] increase version number --- types/mathjs/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/mathjs/index.d.ts b/types/mathjs/index.d.ts index 7141fa077c..cdecc3e1b4 100644 --- a/types/mathjs/index.d.ts +++ b/types/mathjs/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for mathjs 3.20 +// Type definitions for mathjs 3.21 // Project: http://mathjs.org/ // Definitions by: Ilya Shestakov , // Andy Patterson From 48a6cc8ee5435658a5fe13b99c6d8787018f7045 Mon Sep 17 00:00:00 2001 From: Martijn Date: Fri, 18 May 2018 14:48:47 +0800 Subject: [PATCH 232/575] Add useMaster to FindOptions --- types/sequelize/index.d.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/types/sequelize/index.d.ts b/types/sequelize/index.d.ts index cc4bef61ba..203e069b16 100644 --- a/types/sequelize/index.d.ts +++ b/types/sequelize/index.d.ts @@ -3366,6 +3366,13 @@ declare namespace sequelize { * Throw EmptyResultError if a record is not found */ rejectOnEmpty?: boolean; + + /** + * Force the query to use the write pool + * + * Defaults to false + */ + useMaster?: boolean; } type AnyFindOptions = FindOptions; From 4ef613d9f91dc57cee0af83dd367cba1df5413cf Mon Sep 17 00:00:00 2001 From: Haroen Viaene Date: Fri, 18 May 2018 14:02:25 +0200 Subject: [PATCH 233/575] fix(algoliasearch): camel case [placeholders](https://www.algolia.com/doc/api-reference/api-parameters/placeholders/) [camelCaseAttributes](https://www.algolia.com/doc/api-reference/api-parameters/camelCaseAttributes/) --- types/algoliasearch/algoliasearch-tests.ts | 3 ++- types/algoliasearch/index.d.ts | 12 ++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/types/algoliasearch/algoliasearch-tests.ts b/types/algoliasearch/algoliasearch-tests.ts index 96270b31eb..87fdb95a01 100644 --- a/types/algoliasearch/algoliasearch-tests.ts +++ b/types/algoliasearch/algoliasearch-tests.ts @@ -94,7 +94,8 @@ let _algoliaIndexSettings: IndexSettings = { allowCompressionOfIntegerArray: false, altCorrections: [{}], minProximity: 0, - placeholders: '', + placeholders: { '': [''] }, + camelCaseAttributes: [''], }; let _algoliaQueryParameters: QueryParameters = { diff --git a/types/algoliasearch/index.d.ts b/types/algoliasearch/index.d.ts index ba46f37ce6..9315a7f6b9 100644 --- a/types/algoliasearch/index.d.ts +++ b/types/algoliasearch/index.d.ts @@ -1759,10 +1759,18 @@ declare namespace algoliasearch { minProximity?: number; /** * This is an advanced use-case to define a token substitutable by a list of words without having the original token searchable - * default: '' + * default: {} * https://github.com/algolia/algoliasearch-client-js#placeholders */ - placeholders?: any; + placeholders?: { + [name: string]: string[], + }; + /** + * List of attributes on which to do a decomposition of camel case words. + * + https://www.algolia.com/doc/api-reference/api-parameters/camelCaseAttributes/ + */ + camelCaseAttributes?: string[]; } interface Response { From 26255b4c7dd19d2df3540c646be8b3c92bb60564 Mon Sep 17 00:00:00 2001 From: Andrea Ascari Date: Fri, 18 May 2018 16:02:42 +0200 Subject: [PATCH 234/575] Added missing optional refreshToken in PasswordRealmResponse, closes #25823. --- types/react-native-auth0/index.d.ts | 1 + .../react-native-auth0-tests.ts | 19 +++++++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/types/react-native-auth0/index.d.ts b/types/react-native-auth0/index.d.ts index 153bfd65d9..1291baeafd 100644 --- a/types/react-native-auth0/index.d.ts +++ b/types/react-native-auth0/index.d.ts @@ -54,6 +54,7 @@ export interface PasswordRealmResponse { idToken: string; scope: string; tokenType: "Bearer"; + refreshToken?: string; } export interface RefreshTokenParams { diff --git a/types/react-native-auth0/react-native-auth0-tests.ts b/types/react-native-auth0/react-native-auth0-tests.ts index 3f659cbdee..08f8b0bc59 100644 --- a/types/react-native-auth0/react-native-auth0-tests.ts +++ b/types/react-native-auth0/react-native-auth0-tests.ts @@ -30,12 +30,19 @@ auth0.auth.logoutUrl({ returnTo: "http://localhost:3000" }); -auth0.auth.passwordRealm({ - username: "me@example.com", - password: "password", - realm: "realm", - audience: "user-info" -}); +auth0.auth + .passwordRealm({ + username: "me@example.com", + password: "password", + realm: "realm", + audience: "user-info" + }) + .then(res => { + if (res.refreshToken) { + return res.refreshToken; + } + return res.accessToken; + }); auth0.auth.refreshToken({ refreshToken: "refresh-token", From 57cb3558e2bedbdd1f0e0030ec33f860795d9755 Mon Sep 17 00:00:00 2001 From: waterfoul Date: Fri, 18 May 2018 08:56:09 -0500 Subject: [PATCH 235/575] Fixed the typings for inferred types with functional components --- types/react-redux/index.d.ts | 13 ++++--- types/react-redux/react-redux-tests.tsx | 51 +++++++++++++++++-------- 2 files changed, 43 insertions(+), 21 deletions(-) diff --git a/types/react-redux/index.d.ts b/types/react-redux/index.d.ts index 0519a43bb5..a7f3dea705 100644 --- a/types/react-redux/index.d.ts +++ b/types/react-redux/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-redux 6.0.0 +// Type definitions for react-redux 6.0.1 // Project: https://github.com/rackt/react-redux // Definitions by: Qubo , // Thomas Hasner , @@ -54,7 +54,7 @@ interface AdvancedComponentDecorator { * - it is present in both DecorationTargetProps and InjectedProps * - DecorationTargetProps[P] extends InjectedProps[P] * ie: decorated component can accept more types than decorator is injecting - * + * * For decoration, inject props or ownProps are all optionnaly * required by the decorated (right hand side) component. * But any property required by the decorated component must extend the injected property @@ -70,9 +70,12 @@ type Shared< // Will not pass through the injected props if they are passed in during // render. Also adds new prop requirements from TNeedsProps. export interface InferableComponentEnhancerWithProps { -

>( - component: Component

- ): ComponentClass> & TNeedsProps> & {WrappedComponent: Component

} + ( + component: StatelessComponent + ): ComponentClass & {WrappedComponent: StatelessComponent} +

>( + component: Component

+ ): ComponentClass> & TNeedsProps> & {WrappedComponent: Component

} } // Injects props and removes them from the prop requirements. diff --git a/types/react-redux/react-redux-tests.tsx b/types/react-redux/react-redux-tests.tsx index ebc174dd1c..16fb7f0306 100644 --- a/types/react-redux/react-redux-tests.tsx +++ b/types/react-redux/react-redux-tests.tsx @@ -813,23 +813,42 @@ namespace TestControlledComponentWithoutDispatchProp { } namespace TestDispatchToPropsAsObject { - const onClick: ActionCreator<{}> = () => ({}); - const mapStateToProps = (state: any) => { - return { - title: state.app.title as string, - }; - }; - const dispatchToProps = { - onClick, - }; + const onClick: ActionCreator<{}> = () => ({}); + const mapStateToProps = (state: any) => { + return { + title: state.app.title as string, + }; + }; + const dispatchToProps = { + onClick, + }; - type Props = { title: string; } & typeof dispatchToProps; - const HeaderComponent: React.StatelessComponent = (props) => { - return

{props.title}

; - } + type Props = { title: string; } & typeof dispatchToProps; + const HeaderComponent: React.StatelessComponent = (props) => { + return

{props.title}

; + } - const Header = connect(mapStateToProps, dispatchToProps)(HeaderComponent); -
+ const Header = connect(mapStateToProps, dispatchToProps)(HeaderComponent); +
+} + +namespace TestInferredFunctionalComponent { + + const Header = connect( + ( + { app: { title }}: { app: { title: string }}, + { extraText }: { extraText: string } + ) => ({ + title, + extraText + }), + (dispatch) => ({ + onClick: () => dispatch({ type: 'test' }) + }) + )(({ title, extraText, onClick }) => { + return

{title} {extraText}

; + }); +
} namespace TestWrappedComponent { @@ -933,7 +952,7 @@ namespace TestWithoutTOwnPropsDecoratedInference { // This should compile React.createElement(ConnectedWithOwnPropsClass, { own: 'string', forwarded: 'string' }); React.createElement(ConnectedWithOwnPropsClass, { own: 'string', forwarded: 'string' }); - + // This should not compile, it is missing ForwardedProps React.createElement(ConnectedWithOwnPropsClass, { own: 'string' }); // $ExpectError React.createElement(ConnectedWithOwnPropsStateless, { own: 'string' }); // $ExpectError From 3a0062e9fdf7003372e2fe63e9163b71285fe869 Mon Sep 17 00:00:00 2001 From: Jason Unger Date: Fri, 18 May 2018 10:26:01 -0400 Subject: [PATCH 236/575] Updates to react-radio-group types - Allow `value` of Radio component to be any - Add most HTMLProps to RadioGroup component - Fix typing for `Component` prop on RadioGroup to be a string or React component --- types/react-radio-group/index.d.ts | 18 ++++--- .../react-radio-group-tests.tsx | 49 ++++++++++++++++--- 2 files changed, 54 insertions(+), 13 deletions(-) diff --git a/types/react-radio-group/index.d.ts b/types/react-radio-group/index.d.ts index 5c3e6092ab..561599ed0a 100644 --- a/types/react-radio-group/index.d.ts +++ b/types/react-radio-group/index.d.ts @@ -6,17 +6,21 @@ import * as React from 'react'; +// Omit taken from https://github.com/Microsoft/TypeScript/issues/12215#issuecomment-311923766 +export type Omit = Pick; + export namespace Radio { - type RadioProps = React.InputHTMLAttributes; + type RadioProps = Omit, 'value' | 'name' | 'role' | 'type' | 'aria-checked'> & { + value: any; + }; } export const Radio: React.ComponentClass; export namespace RadioGroup { - interface RadioGroupProps { - name?: string; - selectedValue?: React.InputHTMLAttributes['value']; - onChange?: (value: React.InputHTMLAttributes['value']) => void; - Component?: string | React.ReactElement>; - } + type RadioGroupProps = Omit, 'onChange'> & { + selectedValue?: any; + onChange?: (value: any) => void; + Component?: React.ReactType, 'onChange' | 'role'>>; + }; } export const RadioGroup: React.ComponentClass; diff --git a/types/react-radio-group/react-radio-group-tests.tsx b/types/react-radio-group/react-radio-group-tests.tsx index d34d7d05ff..d99b8aeed2 100644 --- a/types/react-radio-group/react-radio-group-tests.tsx +++ b/types/react-radio-group/react-radio-group-tests.tsx @@ -1,24 +1,61 @@ import * as React from 'react'; import { Radio, RadioGroup } from "react-radio-group"; -class ReactRadioGroup extends React.Component['value'] }> { +const DefaultComponent: React.SFC> = ({ children, ...rest }) => { + return ( +
+ {children} +
+ ); +}; + +interface ReactRadioGroupState { + selectedValueA: any; + selectedValueB: any; +} + +class ReactRadioGroup extends React.Component { state = { - selectedValue: 2, + selectedValueA: 2, + selectedValueB: true, }; - handleChange: RadioGroup.RadioGroupProps['onChange'] = selectedValue => { - console.log(selectedValue); - this.setState({ selectedValue }); + handleChange = (key: keyof ReactRadioGroupState) => (value: any) => { + console.log(key, value); + this.setState(state => { + return { + ...state, + [key]: value, + }; + }); } render() { return (
- + + + + + + +
); } From f65854486264a626b71000e8159e121a96f787e6 Mon Sep 17 00:00:00 2001 From: Chris Santero Date: Fri, 18 May 2018 11:54:26 -0400 Subject: [PATCH 237/575] [qunit] Add QUnit.equiv --- types/qunit/index.d.ts | 8 ++++++++ types/qunit/qunit-tests.ts | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/types/qunit/index.d.ts b/types/qunit/index.d.ts index a0276a3488..2b7eb586ff 100644 --- a/types/qunit/index.d.ts +++ b/types/qunit/index.d.ts @@ -595,6 +595,14 @@ interface QUnit { */ todo(name: string, callback?: (assert: Assert) => void): void; + /** + * Compares two values. Returns true if they are equivalent. + * + * @param a The first value + * @param b The second value + */ + equiv(a: T, b: T): boolean; + /** * Are the test running from the server or not. */ diff --git a/types/qunit/qunit-tests.ts b/types/qunit/qunit-tests.ts index 25ffc9fbf1..e726113604 100644 --- a/types/qunit/qunit-tests.ts +++ b/types/qunit/qunit-tests.ts @@ -556,3 +556,9 @@ QUnit.test( "test with beforeEach and afterEach", function( assert ) { QUnit.todo( "a todo test", function( assert ) { assert.equal( 0, 1, "0 does not equal 1, so this todo should pass" ); }); + +let equivResult: boolean; +equivResult = QUnit.equiv({}, {}); +equivResult = QUnit.equiv(1, 2); +equivResult = QUnit.equiv('foo', 'bar'); +equivResult = QUnit.equiv(['foo'], ['bar']); From b1f8a39a7f789b12ff54ee5ca008f95262c14d13 Mon Sep 17 00:00:00 2001 From: Jack Walters Date: Fri, 18 May 2018 11:05:14 -0700 Subject: [PATCH 238/575] Update recharts-tests.tsx --- types/recharts/recharts-tests.tsx | 49 ++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/types/recharts/recharts-tests.tsx b/types/recharts/recharts-tests.tsx index 39bcf69c89..6b82b5f137 100644 --- a/types/recharts/recharts-tests.tsx +++ b/types/recharts/recharts-tests.tsx @@ -88,6 +88,7 @@ class Component extends React.Component<{}, ComponentState> { }; return (
+
verticalFill sample
@@ -96,7 +97,53 @@ class Component extends React.Component<{}, ComponentState> { - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From cc5f1242dc1c78b93f1a4d5fa2f5e2c1204b8662 Mon Sep 17 00:00:00 2001 From: Jack Walters Date: Fri, 18 May 2018 11:06:06 -0700 Subject: [PATCH 239/575] Update recharts-tests.tsx --- types/recharts/recharts-tests.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/types/recharts/recharts-tests.tsx b/types/recharts/recharts-tests.tsx index 6b82b5f137..7eed634119 100644 --- a/types/recharts/recharts-tests.tsx +++ b/types/recharts/recharts-tests.tsx @@ -88,7 +88,6 @@ class Component extends React.Component<{}, ComponentState> { }; return (
-
verticalFill sample
From 82dfbee722cea537d5ee9f95d57590dac96f03d5 Mon Sep 17 00:00:00 2001 From: Drew Diamantoukos Date: Fri, 18 May 2018 14:35:36 -0400 Subject: [PATCH 240/575] Added missing hoverinfo type permutations --- types/plotly.js/index.d.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/types/plotly.js/index.d.ts b/types/plotly.js/index.d.ts index ac35dc064b..4089505394 100644 --- a/types/plotly.js/index.d.ts +++ b/types/plotly.js/index.d.ts @@ -386,7 +386,16 @@ export interface ScatterData { 'marker.colorbar': {}; // TODO mode: 'lines' | 'markers' | 'text' | 'lines+markers' | 'text+markers' | 'text+lines' | 'text+lines+markers' | 'none'; hoveron: 'points' | 'fills'; - hoverinfo: 'text'; + hoverinfo: 'all' | 'none' | 'skip' | + 'x' | 'x+text' | 'x+name' | + 'x+y' | 'x+y+text' | 'x+y+name' | + 'x+y+z' | 'x+y+z+text' | 'x+y+z+name' | + 'y+x' | 'y+x+text' | 'y+x+name' | + 'y+z' | 'y+z+text' | 'y+z+name' | + 'y+x+z' | 'y+x+z+text' | 'y+x+z+name' | + 'z+x' | 'z+x+text' | 'z+x+name' | + 'z+y+x' | 'z+y+x+text' | 'z+y+x+name' | + 'z+x+y' | 'z+x+y+text' | 'z+x+y+name'; fill: 'none' | 'tozeroy' | 'tozerox' | 'tonexty' | 'tonextx' | 'toself' | 'tonext'; fillcolor: string; legendgroup: string; @@ -394,6 +403,12 @@ export interface ScatterData { connectgaps: boolean; } +/* +Any combination of "x", "y", "z", "text", "name" joined with a "+" OR "all" or "none" or "skip". +examples: "x", "y", "x+y", "x+y+z", "all" +default: "all" +*/ + export interface ScatterMarker { symbol: string | string[]; // Drawing.symbolList color: Color | number[]; From bb30c9d9e4cdf8ebb54090b22bd061fc0ac82294 Mon Sep 17 00:00:00 2001 From: Drew Diamantoukos Date: Fri, 18 May 2018 14:38:10 -0400 Subject: [PATCH 241/575] Upped plotly.js type 1.36 -> 1.37 --- types/plotly.js/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/plotly.js/index.d.ts b/types/plotly.js/index.d.ts index 4089505394..48b97bab8b 100644 --- a/types/plotly.js/index.d.ts +++ b/types/plotly.js/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for plotly.js 1.36 +// Type definitions for plotly.js 1.37 // Project: https://plot.ly/javascript/ // Definitions by: Chris Gervang // Martin Duparc From 5bc9242a2116253c71c5871c130a655291298f95 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Fri, 18 May 2018 15:21:04 -0400 Subject: [PATCH 242/575] Allow passing a boolean to the sort field of Options Options.sort can be `false` to disallow sorting (see: https://github.com/LeaVerou/awesomplete/pull/17043) --- types/awesomplete/index.d.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/types/awesomplete/index.d.ts b/types/awesomplete/index.d.ts index e73b7cf2f3..9f5060de03 100644 --- a/types/awesomplete/index.d.ts +++ b/types/awesomplete/index.d.ts @@ -42,7 +42,8 @@ declare class Awesomplete { } declare namespace Awesomplete { - type Suggestion = string | {label: string | any, value: string | any} | [string, string]; + type Suggestion = string | { label: string | any, value: string | any } | [string, string]; + type SortFunction = (left: number | any[], right: number | any[]) => number; interface Options { list?: string | string[] | Element | Array<{ label: string, value: any }> | Array<[string, string]>; @@ -51,7 +52,7 @@ declare namespace Awesomplete { autoFirst?: boolean; data?(item: Suggestion, input: string): string; filter?(text: string, input: string): boolean; - sort?(left: number | any[], right: number | any[]): number; + sort?: boolean | SortFunction; item?(text: string, input: string): HTMLElement; replace?(text: string): void; } From be78af0d6cac15f583ca21e89a79f4708cd91911 Mon Sep 17 00:00:00 2001 From: Hugues Stefanski Date: Fri, 18 May 2018 21:30:03 +0200 Subject: [PATCH 243/575] d3-color : adress last comments --- types/d3-color/index.d.ts | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/types/d3-color/index.d.ts b/types/d3-color/index.d.ts index a616543bfe..931ac29b96 100644 --- a/types/d3-color/index.d.ts +++ b/types/d3-color/index.d.ts @@ -108,12 +108,9 @@ export interface LabColorFactory extends Function { /** * Constructs a new Lab color with the specified l value and a = b = 0. */ -export type GrayColorFactory = (l: number, opacity?: number) => LabColor; - -// Using the interface creates an error -// export interface GrayColorFactory extends Function { -// (l: number, opacity?: number): LabColor; -// } +export interface GrayColorFactory { + (l: number, opacity?: number): LabColor; +} export interface HCLColor extends Color { h: number; @@ -132,7 +129,7 @@ export interface HCLColorFactory extends Function { readonly prototype: HCLColor; } -export interface LCHColorFactory extends Function { +export interface LCHColorFactory { (l: number, c: number, h: number, opacity?: number): HCLColor; (cssColorSpecifier: string): HCLColor; (color: ColorSpaceObject | ColorCommonInstance): HCLColor; From 1606c6c190ffb54ab983021ae260165dbbb83714 Mon Sep 17 00:00:00 2001 From: Hugues Stefanski Date: Fri, 18 May 2018 21:46:44 +0200 Subject: [PATCH 244/575] d3-color : use type instead of interface --- types/d3-color/index.d.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/types/d3-color/index.d.ts b/types/d3-color/index.d.ts index 931ac29b96..56812a6bdb 100644 --- a/types/d3-color/index.d.ts +++ b/types/d3-color/index.d.ts @@ -32,7 +32,7 @@ export interface ColorCommonInstance { * Returns a hexadecimal string representing this color. * If this color is not displayable, a suitable displayable color is returned instead. For example, RGB channel values greater than 255 are clamped to 255. */ - hex(): string; + hex(): string; } export interface Color { @@ -108,9 +108,7 @@ export interface LabColorFactory extends Function { /** * Constructs a new Lab color with the specified l value and a = b = 0. */ -export interface GrayColorFactory { - (l: number, opacity?: number): LabColor; -} +export type GrayColorFactory = (l: number, opacity?: number) => LabColor; export interface HCLColor extends Color { h: number; From 842e9d0a6a010803c25cfac6b9af273f5653d842 Mon Sep 17 00:00:00 2001 From: Alex Jerabek Date: Fri, 18 May 2018 13:30:45 -0700 Subject: [PATCH 245/575] Adding Office.js Shared API enum descriptions --- types/office-js/index.d.ts | 1921 ++++++++++++++++++++++++++++++++++-- 1 file changed, 1826 insertions(+), 95 deletions(-) diff --git a/types/office-js/index.d.ts b/types/office-js/index.d.ts index 0ff10134b5..599ad89993 100644 --- a/types/office-js/index.d.ts +++ b/types/office-js/index.d.ts @@ -31,90 +31,115 @@ declare namespace Office { export function initialize(reason: InitializationReason): void; /** * Ensures that the Office JavaScript APIs are ready to be called by the add-in. If the framework hasn't initialized yet, the callback or promise will wait until the Office host is ready to accept API calls. - * Note that though this API is intended to be used inside an Office add-in, it can also be used outside the add-in. In that case, once Office.js determines that it is running outside of an Office host application, it will call the callback and resolve the promise with "null" for both the host and platform. + * Note that though this API is intended to be used inside an Office add-in, it can also be used outside the add-in. In that case, once Office.js determines that it is running outside of an Office host application, it will call the callback and resolve the promise with "null" for both the host and platform. * @param callback - An optional callback method, that will receive the host and platform info. Alternatively, rather than use a callback, an add-in may simply wait for the Promise returned by the function to resolve. * @returns A Promise that contains the host and platform info, once initialization is completed. */ export function onReady(callback?: (info: { host: HostType, platform: PlatformType }) => any): Promise<{ host: HostType, platform: PlatformType }>; /** * Indicates if the large namespace for objects will be used or not. - * @param useShortNamespace Indicates if 'true' that the short namespace will be used + * @param useShortNamespace Indicates if 'true' that the short namespace will be used */ export function useShortNamespace(useShortNamespace: boolean): void; // Enumerations + /** + * Specifies the result of an asynchronous call. + * @remarks + * Returned by the status property of the AsyncResult object. + * + * Hosts: Access, Excel, Outlook, PowerPoint, Project, Word + */ export enum AsyncResultStatus { /** - * Operation succeeded + * The call succeeded. */ Succeeded, /** - * Operation failed, check error object + * The call failed, check the error object. */ Failed } + /** + * Specifies whether the add-in was just inserted or was already contained in the document. + * + * @remarks + * Hosts: Excel, Project, Word + */ export enum InitializationReason { /** - * Indicates the app was just inserted in the document + * The add-in was just inserted into the document. */ Inserted, /** - * Indicates if the extension already existed in the document + * The add-in is already part of the document that was opened. */ DocumentOpened } + /** + * Specifies the host Office application in which the add-in is running. + * + * @remarks + * Hosts: Excel, Word, PowerPoint, Outlook, OneNote, Project, Access + */ export enum HostType { /** - * Host is Word + * The Office host is Microsoft Word. */ Word, /** - * Host is Excel + * The Office host is Microsoft Excel. */ Excel, /** - * Host is PowerPoint + * The Office host is Microsoft PowerPoint. */ PowerPoint, /** - * Host is Outlook + * The Office host is Microsoft Outlook. */ Outlook, /** - * Host is OneNote + * The Office host is Microsoft OneNote. */ OneNote, /** - * Host is Project + * The Office host is Microsoft Project. */ Project, /** - * Host is Access + * The Office host is Microsoft Access. */ Access } + /** + * Specifies the OS or other platform on which the Office host application is running. + * + * @remarks + * Hosts: Excel, Word, PowerPoint, Outlook, OneNote, Project, Access + */ export enum PlatformType { /** - * Platform is PC + * The platform is PC (Windows). */ PC, /** - * Platform is Web + * The platform is Office Online. */ OfficeOnline, /** - * Platform is Mac + * The platform is Mac. */ Mac, /** - * Platform is iOS + * The platform an iOS device. */ iOS, /** - * Platform is Android + * The platform is an Android device. */ Android, /** - * Platform is Winrt + * The platform is WinRT. */ Universal } @@ -154,6 +179,7 @@ declare namespace Office { * * @remarks * The Error object is accessed from the AsyncResult object that is returned in the function passed as the callback argument of an asynchronous data operation, such as the setSelectedDataAsync method of the Document object. + * * Hosts: Access, Excel, Outlook, PowerPoint, Project, Word */ export interface Error { @@ -176,26 +202,26 @@ declare namespace Office { export interface UI { /** * Displays a dialog to show or collect information from the user or to facilitate Web navigation. - * @param startAddress Accepts the initial HTTPS Url that opens in the dialog. + * @param startAddress - Accepts the initial HTTPS URL that opens in the dialog. */ displayDialogAsync(startAddress: string): void; /** * Displays a dialog to show or collect information from the user or to facilitate Web navigation. - * @param startAddress Accepts the initial HTTPS Url that opens in the dialog. - * @param options Optional. Accepts a DialogOptions object to define dialog behaviors. + * @param startAddress - Accepts the initial HTTPS URL that opens in the dialog. + * @param options - Optional. Accepts a DialogOptions object to define dialog behaviors. */ displayDialogAsync(startAddress: string, options: DialogOptions): void; /** * Displays a dialog to show or collect information from the user or to facilitate Web navigation. - * @param startAddress Accepts the initial HTTPS Url that opens in the dialog. - * @param callback Optional. Accepts a callback method to handle the dialog creation attempt. + * @param startAddress - Accepts the initial HTTPS URL that opens in the dialog. + * @param callback - Optional. Accepts a callback method to handle the dialog creation attempt. */ displayDialogAsync(startAddress: string, callback: (result: AsyncResult) => void): void; /** * Displays a dialog to show or collect information from the user or to facilitate Web navigation. - * @param startAddress Accepts the initial HTTPS Url that opens in the dialog. - * @param options Optional. Accepts a DialogOptions object to define dialog behaviors. - * @param callback Optional. Accepts a callback method to handle the dialog creation attempt. + * @param startAddress - Accepts the initial HTTPS URL that opens in the dialog. + * @param options - Optional. Accepts a DialogOptions object to define dialog behaviors. + * @param callback - Optional. Accepts a callback method to handle the dialog creation attempt. */ displayDialogAsync(startAddress: string, options: DialogOptions, callback: (result: AsyncResult) => void): void; /** @@ -205,10 +231,15 @@ declare namespace Office { messageParent(messageObject: any): void; /** * Closes the UI container where the JavaScript is executing. + * * The behavior of this method is specified by the following: + * * - Called from a UI-less command button: No effect. Any dialog opened by displayDialogAsync will remain open. + * * - Called from a taskpane: The taskpane will close. Any dialog opened by displayDialogAsync will also close. If the taskpane supports pinning and was pinned by the user, it will be un-pinned. + * * - Called from a module extension: No effect. + * * Hosts: Outlook - Minimum requirement set: Mailbox 1.5 */ closeContainer(): void; @@ -230,13 +261,13 @@ declare namespace Office { export interface Auth { /** * Obtains an access token from AAD V 2.0 endpoint to grant the Office host application access to the add-in's web application. - * @param callback Optional. Accepts a callback method to handle the token acquisition attempt. If AsyncResult.status is "succeeded", then AsyncResult.value is the raw AAD v. 2.0-formatted access token. + * @param callback - Optional. Accepts a callback method to handle the token acquisition attempt. If AsyncResult.status is "succeeded", then AsyncResult.value is the raw AAD v. 2.0-formatted access token. */ getAccessTokenAsync(callback: (result: AsyncResult) => void): void; /** * Obtains an access token from AAD V 2.0 endpoint to grant the Office host application access to the add-in's web application. - * @param options Optional. Accepts an AuthOptions object to define sign-on behaviors. - * @param callback Optional. Accepts a callback method to handle the token acquisition attempt. If AsyncResult.status is "succeeded", then AsyncResult.value is the raw AAD v. 2.0-formatted access token. + * @param options - Optional. Accepts an AuthOptions object to define sign-on behaviors. + * @param callback - Optional. Accepts a callback method to handle the token acquisition attempt. If AsyncResult.status is "succeeded", then AsyncResult.value is the raw AAD v. 2.0-formatted access token. */ getAccessTokenAsync(options: AuthOptions, callback: (result: AsyncResult) => void): void; @@ -289,75 +320,126 @@ declare namespace Office { */ export function select(expression: string, callback?: (result: AsyncResult) => void): Binding; // Enumerations + /** + * Specifies the state of the active view of the document, for example, whether the user can edit the document. + * @remarks + * Hosts: PowerPoint + */ export enum ActiveView { + /** + * The active view of the host application only lets the user read the content in the document. + */ Read, + /** + * The active view of the host application lets the user edit the content in the document. + */ Edit } + /** + * Specifies the type of the binding object that should be returned. + * @remarks + * Hosts: Access, Excel, Word + */ export enum BindingType { /** - * Text based Binding + * Plain text. Data is returned as a run of characters. */ Text, /** - * Matrix based Binding + * Tabular data without a header row. Data is returned as an array of arrays, for example in this form: [[row1column1, row1column2],[row2column1, row2column2]] */ Matrix, /** - * Table based Binding + * Tabular data with a header row. Data is returned as a TableData object. */ Table } + /** + * Specifies how to coerce data returned or set by the invoked method. + * + * @remarks + * PowerPoint supports only Office.CoercionType.Text, Office.CoercionType.Image, and Office.CoercionType.SlideRange. Project supports only Office.CoercionType.Text. + * + * Hosts: Access, Excel, Outlook, PowerPoint, Project, Word + */ export enum CoercionType { /** - * Coerce as Text + * Return or set data as text (string).Data is returned or set as a one-dimensional run of characters. */ Text, /** - * Coerce as Matrix + * Return or set data as tabular data with no headers. Data is returned or set as an array of arrays containing one-dimensional runs of characters. For example, three rows of string values in two columns would be: [["R1C1", "R1C2"], ["R2C1", "R2C2"], ["R3C1", "R3C2"]]. + * @remarks + * Only applies to data in Excel and Word. */ Matrix, /** - * Coerce as Table + * Return or set data as tabular data with optional headers. Data is returned or set as an array of arrays with optional headers. + * @remarks + * Only applies to data in Access, Excel and Word. */ Table, /** - * Coerce as HTML + * Return or set data as HTML. + * @remarks + * Only applies to data in add-ins for Word and Outlook add-ins for Outlook (compose mode). */ Html, /** - * Coerce as Office Open XML + * Return or set data as Office Open XML. + * @remarks + * Only applies to data in Word. */ Ooxml, /** - * Coerce as JSON object containing an array of the ids, titles, and indexes of the selected slides. + * Return a JSON object that contains an array of the ids, titles, and indexes of the selected slides.For example, {"slides":[{"id":257,"title":"Slide 2","index":2},{"id":256,"title":"Slide 1","index":1}]} for a selection of two slides. + * @remarks + * Only applies to data in PowerPoint when calling the Document.getSelectedData method to get the current slide or selected range of slides. */ SlideRange, /** - * Coerce as Image + * Data is returned or set as an image stream. + * @remarks + * Only applies to data in Excel, Word and PowerPoint. */ Image } + /** + * Specifies whether the document in the associated application is read-only or read-write. + * @remarks + * Returned by the mode property of the Document object. + * + * Hosts: Excel, PowerPoint, Project, Word + */ export enum DocumentMode { /** - * Document in Read Only Mode + * The document is read-only. */ ReadOnly, /** - * Document in Read/Write Mode + * The document can be read and written to. */ ReadWrite } + /** + * Specifies the kind of event that was raised. Returned by the type property of an EventNameEventArgs object. + * + * @remarks + * Add-ins for Project support the Office.EventType.ResourceSelectionChanged, Office.EventType.TaskSelectionChanged, and Office.EventType.ViewSelectionChanged event types. + * + * Hosts: Access, Excel, PowerPoint, Project, Word + */ export enum EventType { /** - * Occurs when the user changes the current view of the document. + * A Document.ActiveViewChanged event was raised. */ ActiveViewChanged, /** - * Triggers when a binding level data change happens + * A Binding.BindingDataChanged event was raised. */ BindingDataChanged, /** - * Triggers when a binding level selection happens + * A Binding.BindingSelectionChanged event was raised. */ BindingSelectionChanged, /** @@ -373,7 +455,7 @@ declare namespace Office { */ DocumentSelectionChanged, /** - * Triggers when the active item changes + * A Document.SelectionChanged event was raised. */ ItemChanged, /** @@ -389,7 +471,7 @@ declare namespace Office { */ NodeReplaced, /** - * Triggers when settings change in a co-Auth session. + * A Settings.settingsChanged event was raised. */ SettingsChanged, /** @@ -397,7 +479,7 @@ declare namespace Office { */ TaskSelectionChanged, /** - * Triggers when a Resource selection happens in Project. + * Triggers when a Resource selection happens in Project. */ ResourceSelectionChanged, /** @@ -405,30 +487,48 @@ declare namespace Office { */ ViewSelectionChanged } + /** + * Specifies the format in which to return the document. + * + * @remarks + * Hosts: PowerPoint, Word + */ export enum FileType { /** - * Returns the file as plain text + * Returns only the text of the document as a string. (Word only) */ Text, /** - * Returns the file as a byte array + * Returns the entire document (.pptx or .docx) in Office Open XML (OOXML) format as a byte array. */ Compressed, /** - * Returns the file in PDF format as a byte array + * Returns the entire document in PDF format as a byte array. */ Pdf } + /** + * Specifies whether filtering from the host application is applied when the data is retrieved. + * + * @remarks + * Hosts: Excel, Project, Word + */ export enum FilterType { /** - * Returns all items + * Return all data (not filtered by the host application). */ All, /** - * Returns only visible items + * Return only the visible data (as filtered by the host application). */ OnlyVisible } + /** + * Specifies the type of place or object to navigate to. + * + * @remarks + * Hosts: Excel, PowerPoint, Word + */ export enum GoToType { /** * Goes to a binding object using the specified binding id. @@ -444,7 +544,7 @@ declare namespace Office { */ Slide, /** - * Goes to the specified index by slide number or enum Office.Index + * Goes to the specified index by slide number or Office.Index */ Index } @@ -454,18 +554,38 @@ declare namespace Office { Next, Previous } + /** + * Specifies whether to select (highlight) the location to navigate to (when using the Document.goToByIdAsync method). + * + * @remarks + * Hosts: Excel, PowerPoint, Word + */ export enum SelectionMode { Default, + /** + * The location will be selected (highlighted). + */ Selected, + /** + * The cursor is moved the beginning of the location. + */ None } + /** + * Specifies whether values, such as numbers and dates, returned by the invoked method are returned with their formatting applied. + * + * @remarks + * For example, if the valueFormat parameter is specified as "formatted", a number formatted as currency, or a date formatted as mm/dd/yy in the host application will have its formatting preserved. If the valueFormat parameter is specified as "unformatted", a date will be returned in its underlying sequential serial number form. + * + * Hosts: Excel, Project, Word + */ export enum ValueFormat { /** - * Returns items without format + * Return unformatted data. */ Unformatted, /** - * Returns items with format + * Return formatted data. */ Formatted } @@ -833,6 +953,7 @@ declare namespace Office { * * @remarks * Access the File object with the AsyncResult.value property in the callback function passed to the Document.getFileAsync method. + * * Hosts: PowerPoint, Word */ export interface File { @@ -844,23 +965,26 @@ declare namespace Office { size: number; /** * Gets the number of slices into which the file is divided. - * @remarks + * @remarks * Hosts: PowerPoint, Word */ sliceCount: number; /** * Closes the document file. + * @remarks * No more than two documents are allowed to be in memory; otherwise the Document.getFileAsync operation will fail. Use the File.closeAsync method to close the file when you are finished working with it. + * * Hosts: PowerPoint, Word * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. Optional. * @remarks * When the function you passed to the callback parameter executes, it receives an AsyncResult object that you can access from the callback function's only parameter. * In the callback function passed to the closeAsync method, you can use the properties of the AsyncResult object to return the following information. - * Property - Use to... - * AsyncResult.value - Always returns undefined because there is no object or data to retrieve. - * AsyncResult.status - Determine the success or failure of the operation. - * AsyncResult.error - Access an Error object that provides error information if the operation failed. - * AsyncResult.asyncContext - Access your user-defined object or value, if you passed one as the asyncContext parameter. + * |Property |Use to...| + * |---------|---------| + * |AsyncResult.value|Always returns undefined because there is no object or data to retrieve.| + * |AsyncResult.status|Determine the success or failure of the operation.| + * |AsyncResult.error|Access an Error object that provides error information if the operation failed.| + * |AsyncResult.asyncContext|Access your user-defined object or value, if you passed one as the asyncContext parameter.| */ closeAsync(callback?: (result: AsyncResult) => void): void; /** @@ -872,11 +996,12 @@ declare namespace Office { * @remarks * When the function you passed to the callback parameter executes, it receives an AsyncResult object that you can access from the callback function's only parameter. * In the callback function passed to the getSliceAsync method, you can use the properties of the AsyncResult object to return the following information. - * Property - Use to... - * AsyncResult.value - Access the Slice object. - * AsyncResult.status - Determine the success or failure of the operation. - * AsyncResult.error - Access an Error object that provides error information if the operation failed. - * AsyncResult.asyncContext - Access your user-defined object or value, if you passed one as the asyncContext parameter. + * |Property |Use to...| + * |---------|---------| + * |AsyncResult.value|Access the Slice object.| + * |AsyncResult.status|Determine the success or failure of the operation.| + * |AsyncResult.error|Access an Error object that provides error information if the operation failed.| + * |AsyncResult.asyncContext|Access your user-defined object or value, if you passed one as the asyncContext parameter.| */ getSliceAsync(sliceIndex: number, callback?: (result: AsyncResult) => void): void; } @@ -895,8 +1020,11 @@ declare namespace Office { * * @remarks * The settings created by using the methods of the Settings object are saved per add-in and per document. That is, they are available only to the add-in that created them, and only from the document in which they are saved. + * * The name of a setting is a string, while the value can be a string, number, boolean, null, object, or array. + * * The Settings object is automatically loaded as part of the Document object, and is available by calling the settings property of that object when the add-in is activated. The developer is responsible for calling the saveAsync method after adding or deleting settings to save the settings in the document. + * * Hosts: Access, Excel, PowerPoint, Word */ export interface Settings { @@ -904,21 +1032,25 @@ declare namespace Office { * Adds an event handler for the settingsChanged event. * @remarks * You can add multiple event handlers for the specified eventType as long as the name of each event handler function is unique. - * Important: Your add-in's code can register a handler for the settingsChanged event when the add-in is running with any Excel client, but the event will fire only when the add-in is loaded with a spreadsheet that is opened in Excel Online, and more than one user is editing the spreadsheet (co-authoring). Therefore, effectively the settingsChanged event is supported only in Excel Online in co-authoring scenarios. + * + * > [!IMPORTANT] + * > Your add-in's code can register a handler for the settingsChanged event when the add-in is running with any Excel client, but the event will fire only when the add-in is loaded with a spreadsheet that is opened in Excel Online, and more than one user is editing the spreadsheet (co-authoring). Therefore, effectively the settingsChanged event is supported only in Excel Online in co-authoring scenarios. + * * Hosts: Excel * @param eventType Specifies the type of event to add. Required. * @param handler The event handler function to add. Required. * @param options Specifies any of the following optional parameters. - * @param asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. * @remarks * When the function you passed to the callback parameter executes, it receives an AsyncResult object that you can access from the callback function's only parameter. * In the callback function passed to the addHandlerAsync method, you can use the properties of the AsyncResult object to return the following information. - * Property - Use to... - * AsyncResult.value - Always returns undefined because there is no data or object to retrieve when adding an event handler. - * AsyncResult.status - Determine the success or failure of the operation. - * AsyncResult.error - Access an Error object that provides error information if the operation failed. - * AsyncResult.asyncContext - Access your user-defined object or value, if you passed one as the asyncContext parameter. + * |Property |Use to...| + * |---------|---------| + * |AsyncResult.value|Always returns undefined because there is no data or object to retrieve when adding an event handler.| + * |AsyncResult.status|Determine the success or failure of the operation.| + * |AsyncResult.error|Access an Error object that provides error information if the operation failed.| + * |AsyncResult.asyncContext|Access your user-defined object or value, if you passed one as the asyncContext parameter.| */ addHandlerAsync(eventType: EventType, handler: any, options?: any, callback?: (result: AsyncResult) => void): void; /** @@ -934,23 +1066,27 @@ declare namespace Office { * @remarks * This method is useful in Word and PowerPoint coauthoring scenarios when multiple instances of the same add-in are working against the same document. Because each add-in is working against an in-memory copy of the settings loaded from the document at the time the user opened it, the settings values used by each user can get out of sync. This can happen whenever an instance of the add-in calls the Settings.saveAsync method to persist all of that user's settings to the document. Calling the refreshAsync method from the event handler for the settingsChanged event of the add-in will refresh the settings values for all users. * The refreshAsync method can be called from add-ins created for Excel, but since it doesn't support coauthoring there is no reason to do so. + * * Hosts: Access, Excel, PowerPoint, Word * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. * @remarks * When the function you passed to the callback parameter executes, it receives an AsyncResult object that you can access from the callback function's only parameter. * In the callback function passed to the refreshAsync method, you can use the properties of the AsyncResult object to return the following information. - * Property - Use to... - * AsyncResult.value - Access a Settings object with the refreshed values. - * AsyncResult.status - Determine the success or failure of the operation. - * AsyncResult.error - Access an Error object that provides error information if the operation failed. - * AsyncResult.asyncContext - Access your user-defined object or value, if you passed one as the asyncContext parameter. + * |Property |Use to...| + * |---------|---------| + * |AsyncResult.value|Access a Settings object with the refreshed values.| + * |AsyncResult.status|Determine the success or failure of the operation.| + * |AsyncResult.error|Access an Error object that provides error information if the operation failed.| + * |AsyncResult.asyncContext|Access your user-defined object or value, if you passed one as the asyncContext parameter.| */ refreshAsync(callback?: (result: AsyncResult) => void): void; /** * Removes the specified setting. * @remarks * null is a valid value for a setting. Therefore, assigning null to the setting will not remove it from the settings property bag. - * Important: Be aware that the Settings.remove method affects only the in-memory copy of the settings property bag. To persist the removal of the specified setting in the document, at some point after calling the Settings.remove method and before the add-in is closed, you must call the Settings.saveAsync method. + * + * > [!IMPORTANT] + * > Be aware that the Settings.remove method affects only the in-memory copy of the settings property bag. To persist the removal of the specified setting in the document, at some point after calling the Settings.remove method and before the add-in is closed, you must call the Settings.saveAsync method. * Hosts: Access, Excel, PowerPoint, Word * @param settingName The case-sensitive name of the setting to remove. */ @@ -959,11 +1095,12 @@ declare namespace Office { * Removes an event handler for the settingsChanged event. * @remarks * If the optional handler parameter is omitted when calling the removeHandlerAsync method, all event handlers for the specified eventType will be removed. + * * Hosts: Access, Excel, PowerPoint * @param eventType Specifies the type of event to remove. Required. * @param options Specifies any of the following optional parameters. - * @param handler: Specifies the name of the handler to remove. - * @param asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param handler Specifies the name of the handler to remove. + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. * @remarks * When the function you passed to the callback parameter executes, it receives an AsyncResult object that you can access from the callback function's only parameter. @@ -974,28 +1111,35 @@ declare namespace Office { * Persists the in-memory copy of the settings property bag in the document. * @remarks * Any settings previously saved by an add-in are loaded when it is initialized, so during the lifetime of the session you can just use the set and get methods to work with the in-memory copy of the settings property bag. When you want to persist the settings so that they are available the next time the add-in is used, use the saveAsync method. - * Note: The saveAsync method persists the in-memory settings property bag into the document file; however, the changes to the document file itself are saved only when the user (or AutoRecover setting) saves the document to the file system. - * The refreshAsync method is only useful in coauthoring scenarios (which are only supported in Word) when other instances of the same add-in might change the settings and those changes should be made available to all instances. + * + * > [!NOTE] + * > The saveAsync method persists the in-memory settings property bag into the document file; however, the changes to the document file itself are saved only when the user (or AutoRecover setting) saves the document to the file system. + * > The refreshAsync method is only useful in coauthoring scenarios (which are only supported in Word) when other instances of the same add-in might change the settings and those changes should be made available to all instances. + * * Hosts: Access, Excel, PowerPoint, Word * @param options Syntax example: {overwriteIfStale:false} - * @param overwriteIfStale: Indicates whether the setting will be replaced if stale. - * @param asyncContext: Object keeping state for the callback + * @param overwriteIfStale Indicates whether the setting will be replaced if stale. + * asyncContext: Object keeping state for the callback * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. Optional. * @remarks * When the function you passed to the callback parameter executes, it receives an AsyncResult object that you can access from the callback function's only parameter. * In the callback function passed to the saveAsync method, you can use the properties of the AsyncResult object to return the following information. - * Property - Use to... - * AsyncResult.value - Always returns undefined because there is no object or data to retrieve. - * AsyncResult.status - Determine the success or failure of the operation. - * AsyncResult.error - Access an Error object that provides error information if the operation failed. - * AsyncResult.asyncContext - Access your user-defined object or value, if you passed one as the asyncContext parameter. + * |Property |Use to...| + * |---------|---------| + * |AsyncResult.value|Always returns undefined because there is no object or data to retrieve.| + * |AsyncResult.status|Determine the success or failure of the operation.| + * |AsyncResult.error|Access an Error object that provides error information if the operation failed.| + * |AsyncResult.asyncContext|Access your user-defined object or value, if you passed one as the asyncContext parameter.| */ saveAsync(callback?: (result: AsyncResult) => void): void; /** * Sets or creates the specified setting. * @remarks * The set method creates a new setting of the specified name if it does not already exist, or sets an existing setting of the specified name in the in-memory copy of the settings property bag. After you call the Settings.saveAsync method, the value is stored in the document as the serialized JSON representation of its data type. A maximum of 2MB is available for the settings of each add-in. - * Important: Be aware that the Settings.set method affects only the in-memory copy of the settings property bag. To make sure that additions or changes to settings will be available to your add-in the next time the document is opened, at some point after calling the Settings.set method and before the add-in is closed, you must call the Settings.saveAsync method to persist settings in the document. + * + * > [!IMPORTANT] + * > Be aware that the Settings.set method affects only the in-memory copy of the settings property bag. To make sure that additions or changes to settings will be available to your add-in the next time the document is opened, at some point after calling the Settings.set method and before the add-in is closed, you must call the Settings.saveAsync method to persist settings in the document. + * * Hosts: Access, Excel, PowerPoint, Word * @param settingName The case-sensitive name of the setting to set or create. * @param value Specifies the value to be stored. @@ -1006,6 +1150,7 @@ declare namespace Office { * Represents a slice of a document file. * @remarks * The Slice object is accessed with the File.getSliceAsync method. + * * Hosts: PowerPoint, Word */ export interface Slice { @@ -1013,6 +1158,7 @@ declare namespace Office { * Gets the raw data of the file slice in Office.FileType.Text ("text") or Office.FileType.Compressed ("compressed") format as specified by the fileType parameter of the call to the Document.getFileAsync method. * @remarks * Files in the "compressed" format will return a byte array that can be transformed to a base64-encoded string if required. + * * Hosts: PowerPoint, Word */ data: any; @@ -1035,7 +1181,7 @@ declare namespace Office { rowCount: number; /** * Adds the specified columns to the table - * @param tableData A TableData object with the headers and rows + * @param tableData A TableData object with the headers and rows * @param options Syntax example: {asyncContext:context} * asyncContext: Object keeping state for the callback * @param callback The optional callback method @@ -1043,7 +1189,7 @@ declare namespace Office { addColumnsAsync(tableData: TableData | any[][], options?: any, callback?: (result: AsyncResult) => void): void; /** * Adds the specified rows to the table - * @param rows A 2D array with the rows to add + * @param rows A 2D array with the rows to add * @param options Syntax example: {asyncContext:context} * asyncContext: Object keeping state for the callback * @param callback The optional callback method @@ -1104,546 +1250,2131 @@ declare namespace Office { * Gets or sets the headers of the table. * @remarks * To specify headers, you must specify an array of arrays that corresponds to the structure of the table. For example, to specify headers for a two-column table you would set the header property to [['header1', 'header2']]. + * * If you specify null for the headers property (or leaving the property empty when you construct a TableData object), the following results occur when your code executes: + * * - If you insert a new table, the default column headers for the table are created. + * * - If you overwrite or update an existing table, the existing headers are not altered. + * * Hosts: Excel, Word */ headers: any[]; /** * Gets or sets the rows in the table. Returns an array of arrays that contains the data in the table. Returns an empty array ``, if there are no rows. + * @remarks * To specify rows, you must specify an array of arrays that corresponds to the structure of the table. For example, to specify two rows of string values in a two-column table you would set the rows property to [['a', 'b'], ['c', 'd']]. + * * If you specify null for the rows property (or leave the property empty when you construct a TableData object), the following results occur when your code executes: + * * - If you insert a new table, a blank row will be inserted. + * * - If you overwrite or update an existing table, the existing rows are not altered. + * * Hosts: Excel, Word */ rows: any[][]; } + /** + * Specifies enumerated values for the cells: property in the cellFormat parameter of [table formatting methods](https://dev.office.com/reference/docs/excel/format-tables-in-add-ins-for-excel.htm). + * + * @remarks + * Hosts: Excel + */ export enum Table { + /** + * The entire table, including column headers, data, and totals (if any). + */ All, + /** + * Only the data (no headers and totals). + */ Data, + /** + * Only the header row. + */ Headers } export interface TextBinding extends Binding { } + /** + * Specifies the project fields that are available as a parameter for the getProjectFieldAsync method. + * + * @remarks + * A ProjectProjectFields constant can be used as a parameter of the getProjectFieldAsync method. + * + * Hosts: Project + */ export enum ProjectProjectFields { + /** + * The number of digits after the decimal for the currency. + */ CurrencyDigits, + /** + * The currency symbol. + */ CurrencySymbol, + /** + * The placement of the currency symbol: Not specified = -1; Before the value with no space ($0) = 0; After the value with no space (0$) = 1; Before the value with a space ($ 0) = 2; After the value with a space (0 $) = 3. + */ CurrencySymbolPosition, DurationUnits, + /** + * The GUID of the project. + */ GUID, + /** + * The project finish date. + */ Finish, + /** + * The project start date. + */ Start, + /** + * Specifies whether the project is read-only. + */ ReadOnly, + /** + * The project version. + */ VERSION, + /** + * The work units of the project, such as days or hours. + */ WorkUnits, + /** + * The Project Web App URL, for projects that are stored in Project Server. + */ ProjectServerUrl, + /** + * The SharePoint URL, for projects that are synchronized with a SharePoint list. + */ WSSUrl, + /** + * The name of the SharePoint list, for projects that are synchronized with a tasks list. + */ WSSList } + /** + * Specifies the resource fields that are available as a parameter for the getResourceFieldAsync method. + * + * @remarks + * A ProjectResourceFields constant can be used as a parameter of the getResourceFieldAsync method. + * + * For more information about working with fields in Project, see [Available fields](https://support.office.com/article/Available-fields-reference-615a4563-1cc3-40f4-b66f-1b17e793a460) reference. In Project Help, search for Available fields. + */ export enum ProjectResourceFields { + /** + * The accrual method that defines how a task accrues the cost of the resource: Accrues when the task starts = 1, accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. + */ Accrual, + /** + * The calculated actual cost of the resource for assignments in the project. + */ ActualCost, + /** + * The actual overtime cost for a resource. + */ ActualOvertimeCost, + /** + * The actual overtime work for a resource, in minutes. + */ ActualOvertimeWork, + /** + * The actual overtime work for the resource that has been protected (made read-only). + */ ActualOvertimeWorkProtected, + /** + * The actual work that the resource has done on assignments in the project. + */ ActualWork, + /** + * The actual work for the resource that has been protected (made read-only). + */ ActualWorkProtected, + /** + * The name of the base calendar for the resource. + */ BaseCalendar, + /** + * The budget cost for the baseline resource. + */ Baseline10BudgetCost, + /** + * The budget work for the baseline resource, in hours. + */ Baseline10BudgetWork, + /** + * The cost for the baseline resource. + */ Baseline10Cost, + /** + * The work for the baseline resource, in minutes. + */ Baseline10Work, + /** + * The budget cost for the baseline resource. + */ Baseline1BudgetCost, + /** + * The budget work for the baseline resource, in hours. + */ Baseline1BudgetWork, + /** + * The cost for the baseline resource. + */ Baseline1Cost, + /** + * The work for the baseline resource, in minutes. + */ Baseline1Work, + /** + * The budget cost for the baseline resource. + */ Baseline2BudgetCost, + /** + * The budget work for the baseline resource, in hours. + */ Baseline2BudgetWork, + /** + * The cost for the baseline resource. + */ Baseline2Cost, + /** + * The work for the baseline resource, in minutes. + */ Baseline2Work, + /** + * The budget cost for the baseline resource. + */ Baseline3BudgetCost, + /** + * The budget work for the baseline resource, in hours. + */ Baseline3BudgetWork, + /** + * The cost for the baseline resource. + */ Baseline3Cost, + /** + * The work for the baseline resource, in minutes. + */ Baseline3Work, + /** + * The budget cost for the baseline resource. + */ Baseline4BudgetCost, + /** + * The budget work for the baseline resource, in hours. + */ Baseline4BudgetWork, + /** + * The cost for the baseline resource. + */ Baseline4Cost, + /** + * The work for the baseline resource, in minutes. + */ Baseline4Work, + /** + * The budget cost for the baseline resource. + */ Baseline5BudgetCost, + /** + * The budget work for the baseline resource, in hours. + */ Baseline5BudgetWork, + /** + * The cost for the baseline resource. + */ Baseline5Cost, + /** + * The work for the baseline resource, in minutes. + */ Baseline5Work, + /** + * The budget cost for the baseline resource. + */ Baseline6BudgetCost, + /** + * The budget work for the baseline resource, in hours. + */ Baseline6BudgetWork, + /** + * The cost for the baseline resource. + */ Baseline6Cost, + /** + * The work for the baseline resource, in minutes. + */ Baseline6Work, + /** + * The budget cost for the baseline resource. + */ Baseline7BudgetCost, + /** + * The budget work for the baseline resource, in hours. + */ Baseline7BudgetWork, + /** + * The cost for the baseline resource. + */ Baseline7Cost, + /** + * The work for the baseline resource, in minutes. + */ Baseline7Work, + /** + * The budget cost for the baseline resource. + */ Baseline8BudgetCost, + /** + * The budget work for the baseline resource, in hours. + */ Baseline8BudgetWork, + /** + * The cost for the baseline resource. + */ Baseline8Cost, + /** + * The work for the baseline resource, in minutes. + */ Baseline8Work, + /** + * The budget cost for the baseline resource. + */ Baseline9BudgetCost, + /** + * The budget work for the baseline resource, in hours. + */ Baseline9BudgetWork, + /** + * The cost for the baseline resource. + */ Baseline9Cost, + /** + * The work for the baseline resource, in minutes. + */ Baseline9Work, + /** + * The budget cost for the baseline resource. + */ BaselineBudgetCost, + /** + * The budget work for the baseline resource, in hours. + */ BaselineBudgetWork, + /** + * The baseline cost for the resource for assignments in the project. + */ BaselineCost, + /** + * The baseline work for the resource for assignments in the project, in minutes. + */ BaselineWork, + /** + * The budget cost for the resource. + */ BudgetCost, + /** + * The budget work for the resource. + */ BudgetWork, + /** + * The GUID of the resource calendar. + */ ResourceCalendarGUID, + /** + * The code value of the resource. + */ Code, + /** + * A cost field for the resource. + */ Cost1, + /** + * A cost field for the resource. + */ Cost10, + /** + * A cost field for the resource. + */ Cost2, + /** + * A cost field for the resource. + */ Cost3, + /** + * A cost field for the resource. + */ Cost4, + /** + * A cost field for the resource. + */ Cost5, + /** + * A cost field for the resource. + */ Cost6, + /** + * A cost field for the resource. + */ Cost7, + /** + * A cost field for the resource. + */ Cost8, + /** + * A cost field for the resource. + */ Cost9, + /** + * The date the resource was created. + */ ResourceCreationDate, + /** + * A date field for the resource. + */ Date1, + /** + * A date field for the resource. + */ Date10, + /** + * A date field for the resource. + */ Date2, + /** + * A date field for the resource. + */ Date3, + /** + * A date field for the resource. + */ Date4, + /** + * A date field for the resource. + */ Date5, + /** + * A date field for the resource. + */ Date6, + /** + * A date field for the resource. + */ Date7, + /** + * A date field for the resource. + */ Date8, + /** + * A date field for the resource. + */ Date9, + /** + * A duration field for the resource. + */ Duration1, + /** + * A duration field for the resource. + */ Duration10, + /** + * A duration field for the resource. + */ Duration2, + /** + * A duration field for the resource. + */ Duration3, + /** + * A duration field for the resource. + */ Duration4, + /** + * A duration field for the resource. + */ Duration5, + /** + * A duration field for the resource. + */ Duration6, + /** + * A duration field for the resource. + */ Duration7, + /** + * A duration field for the resource. + */ Duration8, + /** + * A duration field for the resource. + */ Duration9, + /** + * The email address of the resource. + */ Email, + /** + * The end date of the resource availability. + */ End, + /** + * A finish field for the task. + */ Finish1, + /** + * A finish field for the task. + */ Finish10, + /** + * A finish field for the task. + */ Finish2, + /** + * A finish field for the task. + */ Finish3, + /** + * A finish field for the task. + */ Finish4, + /** + * A finish field for the task. + */ Finish5, + /** + * A finish field for the task. + */ Finish6, + /** + * A finish field for the task. + */ Finish7, + /** + * A finish field for the task. + */ Finish8, + /** + * A finish field for the task. + */ Finish9, + /** + * A Boolean flag field for the resource. + */ Flag10, + /** + * A Boolean flag field for the resource. + */ Flag1, + /** + * A Boolean flag field for the resource. + */ Flag11, + /** + * A Boolean flag field for the resource. + */ Flag12, + /** + * A Boolean flag field for the resource. + */ Flag13, + /** + * A Boolean flag field for the resource. + */ Flag14, + /** + * A Boolean flag field for the resource. + */ Flag15, + /** + * A Boolean flag field for the resource. + */ Flag16, + /** + * A Boolean flag field for the resource. + */ Flag17, + /** + * A Boolean flag field for the resource. + */ Flag18, + /** + * A Boolean flag field for the resource. + */ Flag19, + /** + * A Boolean flag field for the resource. + */ Flag2, + /** + * A Boolean flag field for the resource. + */ Flag20, + /** + * A Boolean flag field for the resource. + */ Flag3, + /** + * A Boolean flag field for the resource. + */ Flag4, + /** + * A Boolean flag field for the resource. + */ Flag5, + /** + * A Boolean flag field for the resource. + */ Flag6, + /** + * A Boolean flag field for the resource. + */ Flag7, + /** + * A Boolean flag field for the resource. + */ Flag8, + /** + * A Boolean flag field for the resource. + */ Flag9, + /** + * The group the resource belongs to. + */ Group, + /** + * The percentage of work units that the resource has assigned in the project. If the resource is working full-time on the project, Units = 100. + */ Units, + /** + * The name of the resource. + */ Name, + /** + * The text value of the notes regarding the resource. + */ Notes, + /** + * A number field for the resource. + */ Number1, + /** + * A number field for the resource. + */ Number10, + /** + * A number field for the resource. + */ Number11, + /** + * A number field for the resource. + */ Number12, + /** + * A number field for the resource. + */ Number13, + /** + * A number field for the resource. + */ Number14, + /** + * A number field for the resource. + */ Number15, + /** + * A number field for the resource. + */ Number16, + /** + * A number field for the resource. + */ Number17, + /** + * A number field for the resource. + */ Number18, + /** + * A number field for the resource. + */ Number19, + /** + * A number field for the resource. + */ Number2, + /** + * A number field for the resource. + */ Number20, + /** + * A number field for the resource. + */ Number3, + /** + * A number field for the resource. + */ Number4, + /** + * A number field for the resource. + */ Number5, + /** + * A number field for the resource. + */ Number6, + /** + * A number field for the resource. + */ Number7, + /** + * A number field for the resource. + */ Number8, + /** + * A number field for the resource. + */ Number9, + /** + * The overtime cost for a resource. + */ OvertimeCost, + /** + * The overtime rate for a resource. + */ OvertimeRate, + /** + * The overtime work for a resource. + */ OvertimeWork, + /** + * The percentage of work complete for a resource. + */ PercentWorkComplete, + /** + * The cost per use of the resource. + */ CostPerUse, + /** + * Indicates whether the resource is a generic resource (identified by skill rather than by name). + */ Generic, + /** + * Indicates whether the resource is overallocated. + */ OverAllocated, + /** + * The amount of regular work for the resource. + */ RegularWork, + /** + * The remaining cost for the resource. + */ RemainingCost, + /** + * The remaining overtime cost for the resource. + */ RemainingOvertimeCost, + /** + * The remaining overtime work for the resource, in minutes. + */ RemainingOvertimeWork, + /** + * The remaining work for the resource, in minutes. + */ RemainingWork, + /** + * The ID of the resource. + */ ResourceGUID, + /** + * The total cost of the resource. + */ Cost, + /** + * The total work for the resource, in minutes. + */ Work, + /** + * The start date for the resource. + */ Start, + /** + * A start field for the resource. + */ Start1, + /** + * A start field for the resource. + */ Start10, + /** + * A start field for the resource. + */ Start2, + /** + * A start field for the resource. + */ Start3, + /** + * A start field for the resource. + */ Start4, + /** + * A start field for the resource. + */ Start5, + /** + * A start field for the resource. + */ Start6, + /** + * A start field for the resource. + */ Start7, + /** + * A start field for the resource. + */ Start8, + /** + * A start field for the resource. + */ Start9, + /** + * The standard rate of pay for the resource, in cost per hour. + */ StandardRate, + /** + * A text field for the resource. + */ Text1, + /** + * A text field for the resource. + */ Text10, + /** + * A text field for the resource. + */ Text11, + /** + * A text field for the resource. + */ Text12, + /** + * A text field for the resource. + */ Text13, + /** + * A text field for the resource. + */ Text14, + /** + * A text field for the resource. + */ Text15, + /** + * A text field for the resource. + */ Text16, + /** + * A text field for the resource. + */ Text17, + /** + * A text field for the resource. + */ Text18, + /** + * A text field for the resource. + */ Text19, + /** + * A text field for the resource. + */ Text2, + /** + * A text field for the resource. + */ Text20, + /** + * A text field for the resource. + */ Text21, + /** + * A text field for the resource. + */ Text22, + /** + * A text field for the resource. + */ Text23, + /** + * A text field for the resource. + */ Text24, + /** + * A text field for the resource. + */ Text25, + /** + * A text field for the resource. + */ Text26, + /** + * A text field for the resource. + */ Text27, + /** + * A text field for the resource. + */ Text28, + /** + * A text field for the resource. + */ Text29, + /** + * A text field for the resource. + */ Text3, + /** + * A text field for the resource. + */ Text30, + /** + * A text field for the resource. + */ Text4, + /** + * A text field for the resource. + */ Text5, + /** + * A text field for the resource. + */ Text6, + /** + * A text field for the resource. + */ Text7, + /** + * A text field for the resource. + */ Text8, + /** + * A text field for the resource. + */ Text9 } + /** + * Specifies the task fields that are available as a parameter for the getTaskFieldAsync method. + * + * @remarks + * A ProjectTaskFields constant can be used as a parameter of the getTaskFieldAsync method. + * + * For more information about working with fields in Project, see the [Available fields](https://support.office.com/article/Available-fields-reference-615a4563-1cc3-40f4-b66f-1b17e793a460) reference. In Project Help, search for Available fields. + * + * Hosts: Project + */ export enum ProjectTaskFields { + /** + * The current actual cost for the task. + */ ActualCost, + /** + * The actual duration of the task, in minutes. + */ ActualDuration, + /** + * The actual finish date of the task. + */ ActualFinish, + /** + * The actual overtime cost for the task. + */ ActualOvertimeCost, + /** + * The actual overtime work for the task, in minutes. + */ ActualOvertimeWork, + /** + * The actual start date of the task. + */ ActualStart, + /** + * The actual work for the task, in minutes. + */ ActualWork, + /** + * A text field for the task. + */ Text1, + /** + * A text field for the task. + */ Text10, + /** + * A finish field for the task. + */ Finish10, + /** + * A start field for the task. + */ Start10, + /** + * A text field for the task. + */ Text11, + /** + * A text field for the task. + */ Text12, + /** + * A text field for the task. + */ Text13, + /** + * A text field for the task. + */ Text14, + /** + * A text field for the task. + */ Text15, + /** + * A text field for the task. + */ Text16, + /** + * A text field for the task. + */ Text17, + /** + * A text field for the task. + */ Text18, + /** + * A text field for the task. + */ Text19, + /** + * A finish field for the task. + */ Finish1, + /** + * A start field for the task. + */ Start1, + /** + * A text field for the task. + */ Text2, + /** + * A text field for the task. + */ Text20, + /** + * A text field for the task. + */ Text21, + /** + * A text field for the task. + */ Text22, + /** + * A text field for the task. + */ Text23, + /** + * A text field for the task. + */ Text24, + /** + * A text field for the task. + */ Text25, + /** + * A text field for the task. + */ Text26, + /** + * A text field for the task. + */ Text27, + /** + * A text field for the task. + */ Text28, + /** + * A text field for the task. + */ Text29, + /** + * A finish field for the task. + */ Finish2, + /** + * A start field for the task. + */ Start2, + /** + * A text field for the task. + */ Text3, + /** + * A text field for the task. + */ Text30, + /** + * A finish field for the task. + */ Finish3, + /** + * A start field for the task. + */ Start3, + /** + * A text field for the task. + */ Text4, + /** + * A finish field for the task. + */ Finish4, + /** + * A start field for the task. + */ Start4, + /** + * A text field for the task. + */ Text5, + /** + * A finish field for the task. + */ Finish5, + /** + * A start field for the task. + */ Start5, + /** + * A text field for the task. + */ Text6, + /** + * A finish field for the task. + */ Finish6, + /** + * A start field for the task. + */ Start6, + /** + * A text field for the task. + */ Text7, + /** + * A finish field for the task. + */ Finish7, + /** + * A start field for the task. + */ Start7, + /** + * A text field for the task. + */ Text8, + /** + * A finish field for the task. + */ Finish8, + /** + * A start field for the task. + */ Start8, + /** + * A text field for the task. + */ Text9, + /** + * A finish field for the task. + */ Finish9, + /** + * A start field for the task. + */ Start9, + /** + * The budget cost for the baseline task. + */ Baseline10BudgetCost, + /** + * The budget work for the baseline task, in hours. + */ Baseline10BudgetWork, + /** + * The cost for the baseline task. + */ Baseline10Cost, + /** + * The duration for the baseline task, in minutes. + */ Baseline10Duration, + /** + * The finish date for the baseline task. + */ Baseline10Finish, + /** + * The fixed cost of any non-resource expense for the baseline task. + */ Baseline10FixedCost, + /** + * The accrual method that defines how the baseline task accrues fixed costs: Accrues when the task starts = 1, accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. + */ Baseline10FixedCostAccrual, + /** + * The start date for the baseline task. + */ Baseline10Start, + /** + * The total person-hours scheduled for the baseline task, in minutes. + */ Baseline10Work, + /** + * The budget cost for the baseline task. + */ Baseline1BudgetCost, + /** + * The budget work for the baseline task, in hours. + */ Baseline1BudgetWork, + /** + * The cost for the baseline task. + */ Baseline1Cost, + /** + * The duration for the baseline task, in minutes. + */ Baseline1Duration, + /** + * The finish date for the baseline task. + */ Baseline1Finish, + /** + * The fixed cost of any non-resource expense for the baseline task. + */ Baseline1FixedCost, + /** + * The accrual method that defines how the baseline task accrues fixed costs: Accrues when the task starts = 1, accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. + */ Baseline1FixedCostAccrual, + /** + * The start date for the baseline task. + */ Baseline1Start, + /** + * The total person-hours scheduled for the baseline task, in minutes. + */ Baseline1Work, + /** + * The budget cost for the baseline task. + */ Baseline2BudgetCost, + /** + * The budget work for the baseline task, in hours. + */ Baseline2BudgetWork, + /** + * The cost for the baseline task. + */ Baseline2Cost, + /** + * The duration for the baseline task, in minutes. + */ Baseline2Duration, + /** + * The finish date for the baseline task. + */ Baseline2Finish, + /** + * The fixed cost of any non-resource expense for the baseline task. + */ Baseline2FixedCost, + /** + * The accrual method that defines how the baseline task accrues fixed costs: Accrues when the task starts = 1, accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. + */ Baseline2FixedCostAccrual, + /** + * The start date for the baseline task. + */ Baseline2Start, + /** + * The total person-hours scheduled for the baseline task, in minutes. + */ Baseline2Work, + /** + * The budget cost for the baseline task. + */ Baseline3BudgetCost, + /** + * The budget work for the baseline task, in hours. + */ Baseline3BudgetWork, + /** + * The cost for the baseline task. + */ Baseline3Cost, + /** + * The duration for the baseline task, in minutes. + */ Baseline3Duration, + /** + * The finish date for the baseline task. + */ Baseline3Finish, + /** + * The fixed cost of any non-resource expense for the baseline task. + */ Baseline3FixedCost, + /** + * The accrual method that defines how the baseline task accrues fixed costs: Accrues when the task starts = 1, accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. + */ Baseline3FixedCostAccrual, + /** + * The start date for the baseline task. + */ Basline3Start, + /** + * The total person-hours scheduled for the baseline task, in minutes. + */ Baseline3Work, + /** + * The budget cost for the baseline task. + */ Baseline4BudgetCost, + /** + * The budget work for the baseline task, in hours. + */ Baseline4BudgetWork, + /** + * The cost for the baseline task. + */ Baseline4Cost, + /** + * The duration for the baseline task, in minutes. + */ Baseline4Duration, + /** + * The finish date for the baseline task. + */ Baseline4Finish, + /** + * The fixed cost of any non-resource expense for the baseline task. + */ Baseline4FixedCost, + /** + * The accrual method that defines how the baseline task accrues fixed costs: Accrues when the task starts = 1, accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. + */ Baseline4FixedCostAccrual, + /** + * The start date for the baseline task. + */ Baseline4Start, + /** + * The total person-hours scheduled for the baseline task, in minutes. + */ Baseline4Work, + /** + * The budget cost for the baseline task. + */ Baseline5BudgetCost, + /** + * The budget work for the baseline task, in hours. + */ Baseline5BudgetWork, + /** + * The cost for the baseline task. + */ Baseline5Cost, + /** + * The duration for the baseline task, in minutes. + */ Baseline5Duration, + /** + * The finish date for the baseline task. + */ Baseline5Finish, + /** + * The fixed cost of any non-resource expense for the baseline task. + */ Baseline5FixedCost, + /** + * The accrual method that defines how the baseline task accrues fixed costs: Accrues when the task starts = 1, accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. + */ Baseline5FixedCostAccrual, + /** + * The start date for the baseline task. + */ Baseline5Start, + /** + * The total person-hours scheduled for the baseline task, in minutes. + */ Baseline5Work, + /** + * The budget cost for the baseline task. + */ Baseline6BudgetCost, + /** + * The budget work for the baseline task, in hours. + */ Baseline6BudgetWork, + /** + * The cost for the baseline task. + */ Baseline6Cost, + /** + * The duration for the baseline task, in minutes. + */ Baseline6Duration, + /** + * The finish date for the baseline task. + */ Baseline6Finish, + /** + * The fixed cost of any non-resource expense for the baseline task. + */ Baseline6FixedCost, + /** + * The accrual method that defines how the baseline task accrues fixed costs: Accrues when the task starts = 1, accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. + */ Baseline6FixedCostAccrual, + /** + * The start date for the baseline task. + */ Baseline6Start, + /** + * The total person-hours scheduled for the baseline task, in minutes. + */ Baseline6Work, + /** + * The budget cost for the baseline task. + */ Baseline7BudgetCost, + /** + * The budget work for the baseline task, in hours. + */ Baseline7BudgetWork, + /** + * The cost for the baseline task. + */ Baseline7Cost, + /** + * The duration for the baseline task, in minutes. + */ Baseline7Duration, + /** + * The finish date for the baseline task. + */ Baseline7Finish, + /** + * The fixed cost of any non-resource expense for the baseline task. + */ Baseline7FixedCost, + /** + * The accrual method that defines how the baseline task accrues fixed costs: Accrues when the task starts = 1, accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. + */ Baseline7FixedCostAccrual, + /** + * The start date for the baseline task. + */ Baseline7Start, + /** + * The total person-hours scheduled for the baseline task, in minutes. + */ Baseline7Work, + /** + * The budget cost for the baseline task. + */ Baseline8BudgetCost, + /** + * The budget work for the baseline task, in hours. + */ Baseline8BudgetWork, + /** + * The cost for the baseline task. + */ Baseline8Cost, + /** + * The duration for the baseline task, in minutes. + */ Baseline8Duration, + /** + * The finish date for the baseline task. + */ Baseline8Finish, + /** + * The fixed cost of any non-resource expense for the baseline task. + */ Baseline8FixedCost, + /** + * The accrual method that defines how the baseline task accrues fixed costs: Accrues when the task starts = 1, accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. + */ Baseline8FixedCostAccrual, + /** + * The start date for the baseline task. + */ Baseline8Start, + /** + * The total person-hours scheduled for the baseline task, in minutes. + */ Baseline8Work, + /** + * The budget cost for the baseline task. + */ Baseline9BudgetCost, + /** + * The budget work for the baseline task, in hours. + */ Baseline9BudgetWork, + /** + * The cost for the baseline task. + */ Baseline9Cost, + /** + * The duration for the baseline task, in minutes. + */ Baseline9Duration, + /** + * The finish date for the baseline task. + */ Baseline9Finish, + /** + * The fixed cost of any non-resource expense for the baseline task. + */ Baseline9FixedCost, + /** + * The accrual method that defines how the baseline task accrues fixed costs: Accrues when the task starts = 1, accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. + */ Baseline9FixedCostAccrual, + /** + * The start date for the baseline task. + */ Baseline9Start, + /** + * The total person-hours scheduled for the baseline task, in minutes. + */ Baseline9Work, + /** + * The budget cost for the baseline task. + */ BaselineBudgetCost, + /** + * The budget work for the baseline task, in hours. + */ BaselineBudgetWork, + /** + * The cost for the baseline task. + */ BaselineCost, + /** + * The duration for the baseline task, in minutes. + */ BaselineDuration, + /** + * The finish date for the baseline task. + */ BaselineFinish, + /** + * The fixed cost of any non-resource expense for the baseline task. + */ BaselineFixedCost, + /** + * The accrual method that defines how the baseline task accrues fixed costs: Accrues when the task starts = 1, accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. + */ BaselineFixedCostAccrual, + /** + * The start date for the baseline task. + */ BaselineStart, + /** + * The total person-hours scheduled for the baseline task, in minutes. + */ BaselineWork, + /** + * The budget cost for the task. + */ BudgetCost, BudgetFixedCost, - BudgetFixedWork, + BudgetFixedWork, + /** + * The budget work for the task, in hours. + */ BudgetWork, + /** + * The GUID of the task calendar. + */ TaskCalendarGUID, + /** + * A constraint date for the task. + */ ConstraintDate, + /** + * A constraint type for the task: As Soon As Possible = 0, As Late As Possible = 1, Must Start On = 2, Must Finish On = 3, Start No Earlier Than = 4, Start No Later Than = 5, Finish No Earlier Than = 6, Finish No Later Than = 7. + */ ConstraintType, + /** + * A cost field of the task. + */ Cost1, + /** + * A cost field of the task. + */ Cost10, + /** + * A cost field of the task. + */ Cost2, + /** + * A cost field of the task. + */ Cost3, + /** + * A cost field of the task. + */ Cost4, + /** + * A cost field of the task. + */ Cost5, + /** + * A cost field of the task. + */ Cost6, + /** + * A cost field of the task. + */ Cost7, + /** + * A cost field of the task. + */ Cost8, + /** + * A cost field of the task. + */ Cost9, + /** + * A date field of the task. + */ Date1, + /** + * A date field of the task. + */ Date10, + /** + * A date field of the task. + */ Date2, + /** + * A date field of the task. + */ Date3, + /** + * A date field of the task. + */ Date4, + /** + * A date field of the task. + */ Date5, + /** + * A date field of the task. + */ Date6, + /** + * A date field of the task. + */ Date7, + /** + * A date field of the task. + */ Date8, + /** + * A date field of the task. + */ Date9, + /** + * The deadline for a task. + */ Deadline, + /** + * A duration field of the task. + */ Duration1, + /** + * A duration field of the task. + */ Duration10, + /** + * A duration field of the task. + */ Duration2, + /** + * A duration field of the task. + */ Duration3, + /** + * A duration field of the task. + */ Duration4, + /** + * A duration field of the task. + */ Duration5, + /** + * A duration field of the task. + */ Duration6, + /** + * A duration field of the task. + */ Duration7, + /** + * A duration field of the task. + */ Duration8, + /** + * A duration field of the task. + */ Duration9, + /** + * A duration field of the task. + */ Duration, + /** + * The method for calculating earned value for the task. + */ EarnedValueMethod, + /** + * The duration between the Early Finish and Late Finish dates for the task, in minutes. + */ FinishSlack, + /** + * The fixed cost for the task. + */ FixedCost, + /** + * The accrual method that defines how the baseline task accrues fixed costs: Accrues when the task starts = 1, accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. + */ FixedCostAccrual, + /** + * A Boolean flag field for the task. + */ Flag10, + /** + * A Boolean flag field for the task. + */ Flag1, + /** + * A Boolean flag field for the task. + */ Flag11, + /** + * A Boolean flag field for the task. + */ Flag12, + /** + * A Boolean flag field for the task. + */ Flag13, + /** + * A Boolean flag field for the task. + */ Flag14, + /** + * A Boolean flag field for the task. + */ Flag15, + /** + * A Boolean flag field for the task. + */ Flag16, + /** + * A Boolean flag field for the task. + */ Flag17, + /** + * A Boolean flag field for the task. + */ Flag18, + /** + * A Boolean flag field for the task. + */ Flag19, + /** + * A Boolean flag field for the task. + */ Flag2, + /** + * A Boolean flag field for the task. + */ Flag20, + /** + * A Boolean flag field for the task. + */ Flag3, + /** + * A Boolean flag field for the task. + */ Flag4, + /** + * A Boolean flag field for the task. + */ Flag5, + /** + * A Boolean flag field for the task. + */ Flag6, + /** + * A Boolean flag field for the task. + */ Flag7, + /** + * A Boolean flag field for the task. + */ Flag8, + /** + * A Boolean flag field for the task. + */ Flag9, + /** + * The amount of time that the task can be delayed without delaying its successor tasks. + */ FreeSlack, + /** + * Indicates whether the task has rollup subtasks. + */ HasRollupSubTasks, + /** + * The index of the selected task. After the project summary task, the index of the first task in a project is 1. + */ ID, + /** + * The name of the task. + */ Name, + /** + * The text value of the notes regarding the task. + */ Notes, + /** + * A number field for the task. + */ Number1, + /** + * A number field for the task. + */ Number10, + /** + * A number field for the task. + */ Number11, + /** + * A number field for the task. + */ Number12, + /** + * A number field for the task. + */ Number13, + /** + * A number field for the task. + */ Number14, + /** + * A number field for the task. + */ Number15, + /** + * A number field for the task. + */ Number16, + /** + * A number field for the task. + */ Number17, + /** + * A number field for the task. + */ Number18, + /** + * A number field for the task. + */ Number19, + /** + * A number field for the task. + */ Number2, + /** + * A number field for the task. + */ Number20, + /** + * A number field for the task. + */ Number3, + /** + * A number field for the task. + */ Number4, + /** + * A number field for the task. + */ Number5, + /** + * A number field for the task. + */ Number6, + /** + * A number field for the task. + */ Number7, + /** + * A number field for the task. + */ Number8, + /** + * A number field for the task. + */ Number9, + /** + * The scheduled (as opposed to actual) duration of the task. + */ ScheduledDuration, + /** + * The scheduled (as opposed to actual) finish date of the task. + */ ScheduledFinish, + /** + * The scheduled (as opposed to actual) start date of the task. + */ ScheduledStart, + /** + * The level of the task in the outline hierarchy. + */ OutlineLevel, + /** + * The overtime cost for the task. + */ OvertimeCost, + /** + * The overtime work for the task. + */ OvertimeWork, + /** + * The percent complete status of the task. + */ PercentComplete, + /** + * The percentage of work completed for the task. + */ PercentWorkComplete, + /** + * The IDs of the task's predecessors. + */ Predecessors, + /** + * The finish date of a task before leveling occurred. + */ PreleveledFinish, + /** + * The start date of a task before leveling occurred. + */ PreleveledStart, + /** + * The priority of the task, with values from 0 (low) to 1000 (high). The default priority value is 500. + */ Priority, + /** + * Indicates whether the task is active. + */ Active, + /** + * Indicates whether the task is on the critical path. + */ Critical, + /** + * Indicates whether the task is a milestone. + */ Milestone, + /** + * Indicates whether any assignments for a task are overallocated. + */ Overallocated, + /** + * Indicates whether subtask information is rolled up to the summary task bar. + */ IsRollup, + /** + * Indicates whether the task is a summary task. + */ Summary, + /** + * The amount of regular work for the task. + */ RegularWork, + /** + * The remaining cost for the task. + */ RemainingCost, + /** + * The remaining duration for the task, in minutes. + */ RemainingDuration, + /** + * The remaining overtime cost for the task. + */ RemainingOvertimeCost, + /** + * The remaining work for the task, in minutes. + */ RemainingWork, + /** + * The names of the resources assigned to a task. + */ ResourceNames, + /** + * The total cost of the task. + */ Cost, + /** + * The finish date of the task. + */ Finish, + /** + * The start date of the task. + */ Start, + /** + * The total person-hours scheduled for the task, in minutes. + */ Work, + /** + * The duration between the Early Start and Late Start dates for the task. + */ StartSlack, + /** + * The status of the task: Complete = 0, on schedule = 1, late = 2, future task = 3, status not available = 4. + */ Status, + /** + * The IDs of the task's successors. + */ Successors, + /** + * The enterprise resource responsible for accepting or rejecting assignment progress updates for the task. + */ StatusManager, + /** + * The total slack time for the task, in minutes. + */ TotalSlack, + /** + * The GUID of the task. + */ TaskGUID, + /** + * The way the task is calculated: Fixed units = 0, fixed duration = 1, fixed work = 2. + */ Type, + /** + * The work breakdown structure code of the task. + */ WBS, + /** + * The work breakdown structure codes of the task predecessors, separated by the list separator. + */ WBSPREDECESSORS, + /** + * The work breakdown structure codes of the task successors, separated by the list separator. + */ WBSSUCCESSORS, + /** + * The ID of the task in a SharePoint list, for a project that is synchronized with a SharePoint tasks list. + */ WSSID } + /** + * Specifies the types of views that the getSelectedViewAsync method can recognize. + * + * @remarks + * The getSelectedViewAsync method returns the ProjectViewTypes constant value and name that corresponds to the active view. + * + * Hosts: Project + */ export enum ProjectViewTypes { + /** + * The Gantt chart view. + */ Gantt, + /** + * The Network Diagram view. + */ NetworkDiagram, + /** + * The Task Diagram view. + */ TaskDiagram, + /** + * The Task form view. + */ TaskForm, + /** + * The Task Sheet view. + */ TaskSheet, + /** + * The Resource Form view. + */ ResourceForm, + /** + * The Resource Sheet view. + */ ResourceSheet, + /** + * The Resource Graph view. + */ ResourceGraph, + /** + * The Team Planner view. + */ TeamPlanner, + /** + * The Task Details view. + */ TaskDetails, + /** + * The Task Name Form view. + */ TaskNameForm, + /** + * The Resource Names view. + */ ResourceNames, + /** + * The Calendar view. + */ Calendar, + /** + * The Task Usage view. + */ TaskUsage, + /** + * The Resource Usage view. + */ ResourceUsage, + /** + * The Timeline view. + */ Timeline } // Objects From 53a14e969e2489a736b455ccb8da00bdce27b8b9 Mon Sep 17 00:00:00 2001 From: Yukine Date: Fri, 18 May 2018 22:33:05 +0200 Subject: [PATCH 246/575] update snekfetch typings to 4.0.0 release --- types/snekfetch/index.d.ts | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/types/snekfetch/index.d.ts b/types/snekfetch/index.d.ts index ac77f8a572..643c376c5a 100644 --- a/types/snekfetch/index.d.ts +++ b/types/snekfetch/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for snekfetch 3.6 +// Type definitions for snekfetch 4.0 // Project: https://github.com/GusCaplan/snekfetch // Definitions by: Iker Pérez Brunelli // Shayne Hartford @@ -8,19 +8,23 @@ /// -import { ClientRequest } from 'http'; +import { ClientRequest, Agent } from 'http'; import { Readable } from 'stream'; declare namespace Snekfetch { interface SnekfetchOptions { headers?: { [key: string]: any }; - data?: any; + data?: object | string | Buffer; + agent?: Agent | boolean; + qs?: object; + query?: object | string; + redirect?: boolean; } - interface Result { + interface SnekfetchResponse { request: ClientRequest; - body: Buffer; - text: string; + body: string | object | Buffer; + raw: Buffer; ok: boolean; headers: { [key: string]: any }; status: number; @@ -37,7 +41,6 @@ declare namespace Snekfetch { | 'HEAD' | 'LINK' | 'LOCK' - | 'M-SEARCH' | 'MERGE' | 'MKACTIVITY' | 'MKCALENDAR' @@ -54,13 +57,13 @@ declare namespace Snekfetch { | 'REBIND' | 'REPORT' | 'SEARCH' + | 'SOURCE' | 'SUBSCRIBE' | 'TRACE' | 'UNBIND' | 'UNLINK' | 'UNLOCK' - | 'UNSUBSCRIBE' - | 'BREW'; + | 'UNSUBSCRIBE'; } declare class Snekfetch extends Readable { @@ -69,7 +72,7 @@ declare class Snekfetch extends Readable { data: any; request: ClientRequest; - readonly response: Snekfetch.Result | null; + readonly response: Snekfetch.SnekfetchResponse | null; constructor(method: Snekfetch.methods, url: string, opts?: Snekfetch.SnekfetchOptions); @@ -83,7 +86,6 @@ declare class Snekfetch extends Readable { static head(url: string, opts?: Snekfetch.SnekfetchOptions): Snekfetch; static link(url: string, opts?: Snekfetch.SnekfetchOptions): Snekfetch; static lock(url: string, opts?: Snekfetch.SnekfetchOptions): Snekfetch; - static msearch(url: string, opts?: Snekfetch.SnekfetchOptions): Snekfetch; static merge(url: string, opts?: Snekfetch.SnekfetchOptions): Snekfetch; static mkactivity(url: string, opts?: Snekfetch.SnekfetchOptions): Snekfetch; static mkcalendar(url: string, opts?: Snekfetch.SnekfetchOptions): Snekfetch; @@ -100,13 +102,13 @@ declare class Snekfetch extends Readable { static rebind(url: string, opts?: Snekfetch.SnekfetchOptions): Snekfetch; static report(url: string, opts?: Snekfetch.SnekfetchOptions): Snekfetch; static search(url: string, opts?: Snekfetch.SnekfetchOptions): Snekfetch; + static source(url: string, opts?: Snekfetch.SnekfetchOptions): Snekfetch; static subscribe(url: string, opts?: Snekfetch.SnekfetchOptions): Snekfetch; static trace(url: string, opts?: Snekfetch.SnekfetchOptions): Snekfetch; static unbind(url: string, opts?: Snekfetch.SnekfetchOptions): Snekfetch; static unlink(url: string, opts?: Snekfetch.SnekfetchOptions): Snekfetch; static unlock(url: string, opts?: Snekfetch.SnekfetchOptions): Snekfetch; static unsubscribe(url: string, opts?: Snekfetch.SnekfetchOptions): Snekfetch; - static brew(url: string, opts?: Snekfetch.SnekfetchOptions): Snekfetch; query(name: string | { [key: string]: string | string[] }, value?: string): Snekfetch; @@ -116,13 +118,13 @@ declare class Snekfetch extends Readable { send(data?: string|Buffer|object): Snekfetch; - then(): Promise; - then(resolver: (res: Snekfetch.Result) => T, rejector?: (err: Error) => any): Promise; + then(): Promise; + then(resolver: (res: Snekfetch.SnekfetchResponse) => T, rejector?: (err: Error) => any): Promise; - catch(rejector: (err: Error) => any): Promise; + catch(rejector: (err: Error) => any): Promise; - end(): Promise; - end(cb: (err: Error | null, res: Snekfetch.Result | Error | null) => T): Promise; + end(): Promise; + end(cb: (err: Error | null, res: Snekfetch.SnekfetchResponse | Error | null) => T): Promise; } export = Snekfetch; From c755eb27cffb448bbdf2ce6737d32bb4b04fdf4a Mon Sep 17 00:00:00 2001 From: Ricky Kirkham Date: Fri, 18 May 2018 14:16:29 -0700 Subject: [PATCH 247/575] Mainly the bindings APIs --- types/office-js/index.d.ts | 263 ++++++++++++++++++++++++++++++++----- 1 file changed, 230 insertions(+), 33 deletions(-) diff --git a/types/office-js/index.d.ts b/types/office-js/index.d.ts index cee60e05fc..2aa0de0bb1 100644 --- a/types/office-js/index.d.ts +++ b/types/office-js/index.d.ts @@ -116,10 +116,53 @@ declare namespace Office { Universal } // Objects - export interface AsyncResult { + /** + * An object which encapsulates the result of an asynchronous request, including status and error information if the request failed. + * + * **Hosts**: Access, Excel, Outlook, PowerPoint, Project, Word + * + * **Last changed in**: 1.1 + * + * @remarks + * When the function you pass to the `callback` parameter of an "Async" method executes, it receives an AsyncResult object that you can access from the `callback` function's only parameter. + */ + export interface AsyncResult { + /** + * Gets the user-defined item passed to the optional `asyncContext` parameter of the invoked method in the same state as it was passed in. This the user-defined item (which can be of any JavaScript type: String, Number, Boolean, Object, Array, Null, or Undefined) passed to the optional `asyncContext` parameter of the invoked method. Returns Undefined, if you didn't pass anything to the asyncContext parameter. + * + * **Hosts**: Access, Excel, Outlook, PowerPoint, Project, Word + * + * **Last changed in**: 1.1 + */ asyncContext: any; + /** + * Gets the [AsyncResultStatus](office.asyncresultstatus.md) of the asynchronous operation. + * + * **Hosts**: Access, Excel, Outlook, PowerPoint, Project, Word + * + * **Last changed in**: 1.1 + */ status: AsyncResultStatus; + /** + * Gets an [Error](office.error.md) object that provides a description of the error, if any error occurred. + * + * **Hosts**: Access, Excel, Outlook, PowerPoint, Project, Word + * + * **Last changed in**: 1.1 + */ error: Error; + /** + * Gets the payload or content of this asynchronous operation, if any. + * + * Note: What the value property returns for a particular "Async" method varies depending on the purpose and context of that method. To determine what is returned by the value property for an "Async" method, refer to the "Callback value" section of the method's topic. For a complete listing of the "Async" methods, see the Remarks section of the AsyncResult object topic. + * + * **Hosts**: Access, Excel, Outlook, PowerPoint, Project, Word + * + * **Last changed in**: 1.1 + * + * @remarks + * You access the AsyncResult object in the function passed as the argument to the callback parameter of an "Async" method, such as the `getSelectedDataAsync` and `setSelectedDataAsync` methods of the Document object. + */ value: any; } export interface Context { @@ -351,11 +394,27 @@ declare namespace Office { */ ActiveViewChanged, /** - * Triggers when a binding level data change happens + * Occurs when data within the binding is changed. + * + * Hosts: Access, Excel, Word + * + * Last changed in: 1.1 + * + * @remarks + * To add an event handler for the BindingDataChanged event of a binding, use the addHandlerAsync method of the Binding object. The event handler receives an argument of type BindingDataChangedEventArgs. */ BindingDataChanged, /** - * Triggers when a binding level selection happens + * Occurs when the selection is changed within the binding. + * + * Hosts: Access, Excel, Word + * + * Available in Requirement set: BindingEvents + * + * Last changed in: 1.1 + * + * @remarks + * To add an event handler for the BindingSelectionChanged event of a binding, use the addHandlerAsync method of the Binding object. The event handler receives an argument of type BindingSelectionChangedEventArgs. */ BindingSelectionChanged, /** @@ -468,53 +527,150 @@ declare namespace Office { Formatted } // Objects + /** + * Represents a binding to a section of the document. + * + * **Hosts**: Access, Excel, Word + * + * **Available in Requirement sets**: MatrixBinding, TableBinding, TextBinding + * + * **Last changed in**: 1.1 + * + * @remarks + * The Binding object exposes the functionality possessed by all bindings regardless of type. + * + * The Binding object is never called directly. It is the abstract parent class of the objects that represent each type of binding: MatrixBinding, TableBinding, or TextBinding. All three of these objects inherit the getDataAsync and setDataAsync methods from the Binding object that enable to you interact with the data in the binding. They also inherit the id and type properties for querying those property values. Additionally, the MatrixBinding and TableBinding objects expose additional methods for matrix- and table-specific features, such as counting the number of rows and columns. + */ export interface Binding { + /** + * Get the Document object associated with the binding. + * + * **Hosts**: Access, Excel, Word + * + * **Last changed in**: 1.1 + */ document: Document; /** - * Id of the Binding + * A string that uniquely identifies this binding among the bindings in the same Document object. + * + * Hosts: Access, Excel, Word + * + * Last changed in: 1.1 */ id: string; + /** + * Gets the type of the binding. + * + * **Hosts**: Access, Excel, Word + + * **Last changed in**: 1.1 + */ type: BindingType; /** - * Adds an event handler to the object using the specified event type. - * @param eventType The event type. For binding it can be 'bindingDataChanged' and 'bindingSelectionChanged' - * @param handler The name of the handler - * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * Adds an event handler to the object for the specified event type. + * + * @remarks + * You can add multiple event handlers for the specified eventType as long as the name of each event handler function is unique. + * + * @param eventType The event type. For example, for bindings, it can be **Office.EventType.BindingSelectionChanged**, **Office.EventType.BindingDataChanged**, or the corresponding text values of these enumerations. + * @param handler The event handler function to add. + * @param options { asyncContext: context } Where context is an object of any type that keeps state for the callback. + * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ addHandlerAsync(eventType: EventType, handler: any, options?: any, callback?: (result: AsyncResult) => void): void; /** - * Returns the current selection. - * @param options Syntax example: {coercionType: 'matrix,'valueFormat: 'formatted', filterType:'all'} - * coercionType: The expected shape of the selection. If not specified returns the bindingType shape. Use Office.CoercionType or text value. - * valueFormat: Get data with or without format. Use Office.ValueFormat or text value. - * startRow: Used in partial get for table/matrix. Indicates the start row. - * startColumn: Used in partial get for table/matrix. Indicates the start column. - * rowCount: Used in partial get for table/matrix. Indicates the number of rows from the start row. - * columnCount: Used in partial get for table/matrix. Indicates the number of columns from the start column. - * filterType: Get the visible or all the data. Useful when filtering data. Use Office.FilterType or text value. + * Returns the data contained within the binding. + * + * Hosts: Access, Excel, Word + * + * Available in Requirement sets: MatrixBindings, TableBindings, TextBindings + * + * Last changed in: 1.1 + * + * @remarks + * When called from a MatrixBinding or TableBinding, the getDataAsync method will return a subset of the bound values if the optional startRow, startColumn, rowCount, and columnCount parameters are specified (and they specify a contiguous and valid range). + * + * @param options An object with any of the following (example: {coercionType: 'matrix, 'valueFormat: 'formatted', filterType:'all'}): + * + * coercionType: The expected shape of the selection. Use Office.CoercionType or text value. Default: The original, uncoerced type of the binding. + * + * valueFormat: Specifies whether values, such as numbers and dates, are returned with their formatting applied. Use Office.ValueFormat or text value. Default: Unformatted data. + * + * startRow: For table or matrix bindings, specifies the zero-based starting row for a subset of the data in the binding. Default is first row. + * + * startColumn: For table or matrix bindings, specifies the zero-based starting column for a subset of the data in the binding. Default is first column. + * + * rowCount: For table or matrix bindings, specifies the number of rows offset from the startRow. Default is all subsequent rows. + * + * columnCount: For table or matrix bindings, specifies the number of columns offset from the startColumn. Default is all subsequent columns. + * + * filterType: Specify whether to get only the visible (filtered in) data or all the data (default is all). Useful when filtering data. Use Office.FilterType or text value. + * * asyncContext: Object keeping state for the callback + * + * rows: Only for table bindings in content add-ins for Access. Specifies the pre-defined string "thisRow" to get data in the currently selected row. + * @param callback The optional callback method */ getDataAsync(options?: any, callback?: (result: AsyncResult) => void): void; /** - * Removes an event handler from the object using the specified event type. + * Removes the specified handler from the binding for the specified event type. + * + * **Hosts**: Access, Excel, Word + * + * **Available in Requirement set**: BindingEvents + * + * **Last changed in**: 1.1 + * * @param eventType The event type. For binding can be 'bindingDataChanged' and 'bindingSelectionChanged' - * @param options Syntax example: {handler:eventHandler} - * handler: Indicates a specific handler to be removed, if not specified all handlers are removed - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * @param options An object with any of the following: + * + * handler: The handler to be removed, if not specified all handlers are removed. + * + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * + * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ removeHandlerAsync(eventType: EventType, options?: any, callback?: (result: AsyncResult) => void): void; /** - * Writes the specified data into the current selection. - * @param data The data to be set. Either a string or value, 2d array or TableData object - * @param options Syntax example: {coercionType:Office.CoercionType.Matrix} or {coercionType: 'matrix'} + * Writes data to the bound section of the document represented by the specified binding object. + * + * **Hosts**: Access, Excel, Word + * + * **Available in Requirement sets**: MatrixBindings, TableBindings, TextBindings + * + * **Last changed in**: 1.1 + * + * @param data The data to be set in the current selection. Possible data types by host: + * + * string: Excel, Excel Online, Word, and Word Online only + * + * array of arrays: Excel and Word only + * + * [TableData](office.tabledata.md): Access, Excel, and Word only + * + * HTML: Word and Word Online only + * + * Office Open XML: Word only + * + * @param options Any of the following: + * + * cellFormat: For an inserted table, a list of key-value pairs that specify a range of columns, rows, or cells and the cell formatting to apply to that range. + * * coercionType: Explicitly sets the shape of the data object. Use Office.CoercionType or text value. If not supplied is inferred from the data type. - * startRow: Used in partial set for table/matrix. Indicates the start row. - * startColumn: Used in partial set for table/matrix. Indicates the start column. - * asyncContext: Object keeping state for the callback + * + * columns: Only for table bindings in content add-ins for Access. Array of strings. Specifies the column names. + * + * rows: Only for table bindings in content add-ins for Access. **Office.TableRange.ThisRow** Specifies the pre-defined string "thisRow" to set data in the currently selected row. + * + * startRow: Specifies the zero-based starting row for a subset of the data in the binding. Only for table or matrix bindings. If omitted, data is set starting in the first row. + * + * startColumn: Specifies the zero-based starting column for a subset of the data. Only for table or matrix bindings. If omitted, data is set starting in the first column. + * + * tableOptions: For an inserted table, a list of key-value pairs that specify table formatting options, such as header row, total row, and banded rows. + * + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * * @param callback The optional callback method */ setDataAsync(data: TableData | any, options?: any, callback?: (result: AsyncResult) => void): void; @@ -847,8 +1003,38 @@ declare namespace Office { */ url: string } + /** + * Represents a binding in two dimensions of rows and columns. + * + * **Hosts**: Excel, Word + * + * **Available in Requirement set**: MatrixBindings + * + * **Last changed in**: 1.1 + * + * @remarks + * The MatrixBinding object inherits the id property, type property, getDataAsync method, and setDataAsync method from the Binding object. + */ export interface MatrixBinding extends Binding { + /** + * Gets the number of columns in the matrix data structure, as an integer value. + * + * **Hosts**: Access, Excel, PowerPoint, Project, Word + * + * Available in Requirement set: MatrixBindings + * + * **Last changed in**: 1.1 + */ columnCount: number; + /** + * Gets the number of rows in the matrix data structure, as an integer value. + * + * **Hosts**: Access, Excel, PowerPoint, Project, Word + * + * Available in Requirement set: MatrixBindings + * + * **Last changed in**: 1.1 + */ rowCount: number; } export interface Settings { @@ -3083,22 +3269,33 @@ declare namespace Excel { /** * * Gets the Binding object that represents the binding that raised the SelectionChanged event. + * + * **Hosts:** Access, Excel, Word * * [Api set: ExcelApi 1.2] */ binding: Excel.Binding; /** * - * Gets the number of columns selected. + * Gets the number of columns selected. The number of columns selected. If a single cell is selected returns 1. * * [Api set: ExcelApi 1.2] + * + * @remarks + * If the user makes a non-contiguous selection, the count for the last contiguous selection within the binding is returned. + * + * For Word, this property will work only for bindings of BindingType "table". If the binding is of type "matrix", null is returned. Also, the call will fail if the table contains merged cells, because the structure of the table must be uniform for this property to work correctly. */ columnCount: number; /** - * - * Gets the number of rows selected. + * Gets the number of columns selected. The number of columns selected. If a single cell is selected returns 1. * * [Api set: ExcelApi 1.2] + * + * @remarks + * If the user makes a non-contiguous selection, the count for the last contiguous selection within the binding is returned. + * + * For Word, this property will work only for bindings of BindingType "table". If the binding is of type "matrix", null is returned. Also, the call will fail if the table contains merged cells, because the structure of the table must be uniform for this property to work correctly. */ rowCount: number; /** From 88dcf587649c88e8734b33ce16e528fd5a9cd288 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Fri, 18 May 2018 14:16:57 -0700 Subject: [PATCH 248/575] Remove dependency on types not in ES5 --- types/node/index.d.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 9a9fc544e2..cdf49f39e1 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -6205,25 +6205,25 @@ declare module "util" { export function isInt8Array(object: any): object is Int8Array; export function isInt16Array(object: any): object is Int16Array; export function isInt32Array(object: any): object is Int32Array; - export function isMap(object: any): object is Map; + export function isMap(object: any): boolean; export function isMapIterator(object: any): boolean; export function isNativeError(object: any): object is Error; export function isNumberObject(object: any): object is Number; - export function isPromise(object: any): object is Promise; + export function isPromise(object: any): boolean; export function isProxy(object: any): boolean; export function isRegExp(object: any): object is RegExp; - export function isSet(object: any): object is Set; + export function isSet(object: any): boolean; export function isSetIterator(object: any): boolean; export function isSharedArrayBuffer(object: any): boolean; - export function isStringObject(object: any): object is String; - export function isSymbolObject(object: any): object is Symbol; + export function isStringObject(object: any): boolean; + export function isSymbolObject(object: any): boolean; export function isTypedArray(object: any): object is Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array | Int8Array | Int16Array | Int32Array | Float32Array | Float64Array; export function isUint8Array(object: any): object is Uint8Array; export function isUint8ClampedArray(object: any): object is Uint8ClampedArray; export function isUint16Array(object: any): object is Uint16Array; export function isUint32Array(object: any): object is Uint32Array; - export function isWeakMap(object: any): object is WeakMap; - export function isWeakSet(object: any): object is WeakSet; + export function isWeakMap(object: any): boolean; + export function isWeakSet(object: any): boolean; export function isWebAssemblyCompiledModule(object: any): boolean; } From 83fb93d4f8e9667531e6c4ab5f20317ecf7482bc Mon Sep 17 00:00:00 2001 From: krasevych Date: Sat, 19 May 2018 00:17:43 +0300 Subject: [PATCH 249/575] Add def for setAssetPrefix there is Dynamic assetPrefix: https://github.com/zeit/next.js#dynamic-assetprefix example: https://github.com/zeit/next.js/blob/373661aafae5707efb4e6645544d047b2fd0b04f/test/integration/custom-server/server.js --- types/next/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/next/index.d.ts b/types/next/index.d.ts index 036e9f58ce..34bdba9047 100644 --- a/types/next/index.d.ts +++ b/types/next/index.d.ts @@ -36,6 +36,7 @@ declare namespace next { } interface Server { + setAssetPrefix: (cdnUrl: string) => void; handleRequest( req: http.IncomingMessage, res: http.ServerResponse, From 1def6a9af5379a95ea7c32e0e24a41b4fc6e8052 Mon Sep 17 00:00:00 2001 From: Charles Salmon Date: Sat, 19 May 2018 12:26:35 +1200 Subject: [PATCH 250/575] Add definitions for `react-youtube-embed`. --- types/react-youtube-embed/index.d.ts | 16 ++++++++++++++++ .../react-youtube-embed-tests.tsx | 4 ++++ types/react-youtube-embed/tsconfig.json | 16 ++++++++++++++++ types/react-youtube-embed/tslint.json | 1 + 4 files changed, 37 insertions(+) create mode 100644 types/react-youtube-embed/index.d.ts create mode 100644 types/react-youtube-embed/react-youtube-embed-tests.tsx create mode 100644 types/react-youtube-embed/tsconfig.json create mode 100644 types/react-youtube-embed/tslint.json diff --git a/types/react-youtube-embed/index.d.ts b/types/react-youtube-embed/index.d.ts new file mode 100644 index 0000000000..28088b4de3 --- /dev/null +++ b/types/react-youtube-embed/index.d.ts @@ -0,0 +1,16 @@ +// Type definitions for react-youtube-embed 1.0 +// Project: https://github.com/escaladesports/react-youtube-embed#readme +// Definitions by: Charles Salmon +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import * as React from "react"; + +export interface YouTubeEmbedProps { + id: string; + aspectRatio?: string; + prependSrc?: string; + appendSrc?: string; + width?: number; +} + +export default class YouTubeEmbed extends React.Component {} diff --git a/types/react-youtube-embed/react-youtube-embed-tests.tsx b/types/react-youtube-embed/react-youtube-embed-tests.tsx new file mode 100644 index 0000000000..f520c4646b --- /dev/null +++ b/types/react-youtube-embed/react-youtube-embed-tests.tsx @@ -0,0 +1,4 @@ +import * as React from "react"; +import YouTubeEmbed from "react-youtube-embed"; + +const YouTubeEmbedExample = () => ; diff --git a/types/react-youtube-embed/tsconfig.json b/types/react-youtube-embed/tsconfig.json new file mode 100644 index 0000000000..0daaa332ed --- /dev/null +++ b/types/react-youtube-embed/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "jsx": "react", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "react-youtube-embed-tests.tsx"] +} diff --git a/types/react-youtube-embed/tslint.json b/types/react-youtube-embed/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-youtube-embed/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From d56f5132940af577e615e68ce5e510526c8ee871 Mon Sep 17 00:00:00 2001 From: Charles Salmon Date: Sat, 19 May 2018 12:41:29 +1200 Subject: [PATCH 251/575] Add TS version and set `strictFunctionTypes` on `react-youtube-embed`. --- types/react-youtube-embed/index.d.ts | 1 + types/react-youtube-embed/tsconfig.json | 1 + 2 files changed, 2 insertions(+) diff --git a/types/react-youtube-embed/index.d.ts b/types/react-youtube-embed/index.d.ts index 28088b4de3..9fcb2f81cb 100644 --- a/types/react-youtube-embed/index.d.ts +++ b/types/react-youtube-embed/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/escaladesports/react-youtube-embed#readme // Definitions by: Charles Salmon // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 import * as React from "react"; diff --git a/types/react-youtube-embed/tsconfig.json b/types/react-youtube-embed/tsconfig.json index 0daaa332ed..eb57aecf6c 100644 --- a/types/react-youtube-embed/tsconfig.json +++ b/types/react-youtube-embed/tsconfig.json @@ -5,6 +5,7 @@ "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, + "strictFunctionTypes": true, "baseUrl": "../", "jsx": "react", "typeRoots": ["../"], From 0496d0f94f491809a07b4f0a4cf88fdeb8f91b48 Mon Sep 17 00:00:00 2001 From: Ozum Date: Sat, 19 May 2018 12:26:06 +0300 Subject: [PATCH 252/575] create schwifty definitions --- types/schwifty/index.d.1.ts | 83 ++++++++++++++++++++++++++++++++ types/schwifty/index.d.ts | 70 +++++++++++++++++++++++++++ types/schwifty/package.json | 6 +++ types/schwifty/schwifty-tests.ts | 38 +++++++++++++++ types/schwifty/test/dog.ts | 14 ++++++ types/schwifty/test/plugin.ts | 18 +++++++ types/schwifty/tsconfig.json | 17 +++++++ types/schwifty/tslint.json | 1 + 8 files changed, 247 insertions(+) create mode 100644 types/schwifty/index.d.1.ts create mode 100644 types/schwifty/index.d.ts create mode 100644 types/schwifty/package.json create mode 100644 types/schwifty/schwifty-tests.ts create mode 100644 types/schwifty/test/dog.ts create mode 100644 types/schwifty/test/plugin.ts create mode 100644 types/schwifty/tsconfig.json create mode 100644 types/schwifty/tslint.json diff --git a/types/schwifty/index.d.1.ts b/types/schwifty/index.d.1.ts new file mode 100644 index 0000000000..0580e5e1fb --- /dev/null +++ b/types/schwifty/index.d.1.ts @@ -0,0 +1,83 @@ +// Type definitions for schwifty 4.0. +// Project: https://github.com/hapipal/schwifty +// Definitions by: ozum +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.4 + +// HELP WANTED: If possible, find a better way to define Server.models, Request.models and ResponseToolkit.models +// They are dynamic types extended from SchwiftyModel. + +import * as Objection from "objection"; +import * as Joi from "joi"; +import { + Server, + Request, + ResponseToolkit, + Plugin, + ServerRegisterPluginObject +} from "hapi"; +import * as Knex from "knex"; + +type Model = typeof SchwiftyModel | typeof Objection.Model; + +declare class SchwiftyModel extends Objection.Model { + static getJoiSchema(patch?: boolean): Joi.Schema; + joiSchema: Joi.Schema; +} + +interface RegistrationOptions { + knex?: Knex | Knex.Config; + models?: Array | string; + migrationsDir?: string; + teardownOnStop?: boolean; + migrateOnStart?: boolean | "latest" | "rollback"; +} + +interface SchwiftyExtras { + assertCompatible: ( + ModelA: typeof SchwiftyModel, + ModelB: typeof SchwiftyModel, + message?: string + ) => void | Error; + Model: typeof SchwiftyModel; +} + +declare const Schwifty: Plugin & SchwiftyExtras; + +export const plugin: Plugin; + +//export = Schwifty; + +/* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Hapi Decorations + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + */ + +/** + * Merge decorations into hapi objects. + */ +declare module "hapi" { + interface Server { + schwifty: ( + config: + | Model + | Array + | { + knex: Knex | Knex.Config; + models: Array; + migrationsDir: string; + } + ) => void; + knex: () => Knex; + models: (all?: boolean) => { [key: string]: typeof SchwiftyModel }; + } + + interface Request { + knex: () => Knex; + models: (all?: boolean) => { [key: string]: typeof SchwiftyModel }; + } + + interface ResponseToolkit { + knex: () => Knex; + models: (all?: boolean) => { [key: string]: typeof SchwiftyModel }; + } +} diff --git a/types/schwifty/index.d.ts b/types/schwifty/index.d.ts new file mode 100644 index 0000000000..e95de1af55 --- /dev/null +++ b/types/schwifty/index.d.ts @@ -0,0 +1,70 @@ +// Type definitions for schwifty 4.0 +// Project: https://github.com/hapipal/schwifty +// Definitions by: ozum +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.4 + +// HELP NEEDED: If possible, find a better way to define Server.models, Request.models and ResponseToolkit.models +// They are dynamic types extended from SchwiftyModel. + +import * as Objection from "objection"; +import * as Joi from "joi"; +import { Server, Request, ResponseToolkit, Plugin } from "hapi"; +import * as Knex from "knex"; + +export type ModelClass = typeof Model | typeof Objection.Model; + +export class Model extends Objection.Model { + static getJoiSchema(patch?: boolean): Joi.Schema; + joiSchema: Joi.Schema; +} + +export interface RegistrationOptions { + knex?: Knex | Knex.Config; + models?: ModelClass[] | string; + migrationsDir?: string; + teardownOnStop?: boolean; + migrateOnStart?: boolean | "latest" | "rollback"; +} + +export function assertCompatible( + ModelA: typeof Model, + ModelB: typeof Model, + message?: string +): void | Error; + +export const plugin: Plugin; + +/* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Hapi Decorations + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + */ + +/** + * Merge decorations into hapi objects. + */ +declare module "hapi" { + interface Server { + schwifty: ( + config: + | ModelClass + | ModelClass[] + | { + knex: Knex | Knex.Config; + models: ModelClass[]; + migrationsDir: string; + } + ) => void; + knex: () => Knex; + models: (all?: boolean) => { [key: string]: typeof Model }; + } + + interface Request { + knex: () => Knex; + models: (all?: boolean) => { [key: string]: typeof Model }; + } + + interface ResponseToolkit { + knex: () => Knex; + models: (all?: boolean) => { [key: string]: typeof Model }; + } +} diff --git a/types/schwifty/package.json b/types/schwifty/package.json new file mode 100644 index 0000000000..37b2fc1558 --- /dev/null +++ b/types/schwifty/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "objection": "^1.1.8" + } +} diff --git a/types/schwifty/schwifty-tests.ts b/types/schwifty/schwifty-tests.ts new file mode 100644 index 0000000000..afdcda5441 --- /dev/null +++ b/types/schwifty/schwifty-tests.ts @@ -0,0 +1,38 @@ +import * as Hapi from "hapi"; +import * as Joi from "joi"; +import * as Schwifty from "schwifty"; +import DogClass from "./test/dog"; + +(async () => { + const server = new Hapi.Server({ port: 3000 }); + + await server.register(Schwifty); + await server.register({ + plugin: Schwifty.plugin, + options: { + knex: { + client: "sqlite3", + useNullAsDefault: true, + connection: { + filename: ":memory:" + } + } + } + }); + + Schwifty.assertCompatible(DogClass, DogClass); + // Register a model with schwifty... + + server.schwifty(DogClass); + + await server.initialize(); + const Dog: typeof DogClass = server.models().Dog; + + await Dog.query().insert({ name: "Guinness" }); + + // ... then start the server! + + await server.start(); + + console.log(`Now, go find some dogs at ${server.info.uri}!`); +})(); diff --git a/types/schwifty/test/dog.ts b/types/schwifty/test/dog.ts new file mode 100644 index 0000000000..33fe2402e3 --- /dev/null +++ b/types/schwifty/test/dog.ts @@ -0,0 +1,14 @@ +import * as Joi from "joi"; +import * as Schwifty from "schwifty"; + +export default class Dog extends Schwifty.Model { + static tableName = "Dog"; + + joiSchema: Joi.Schema = Joi.object({ + id: Joi.number(), + name: Joi.string() + }); + + id?: number; + name?: string; +} diff --git a/types/schwifty/test/plugin.ts b/types/schwifty/test/plugin.ts new file mode 100644 index 0000000000..0b3e9b189b --- /dev/null +++ b/types/schwifty/test/plugin.ts @@ -0,0 +1,18 @@ +import * as Hapi from "hapi"; +import * as Schwifty from "schwifty"; +import DogModel from "./dog"; + +exports.plugin = { + register: async ( + server: Hapi.Server, + options: { Model: Schwifty.Model } + ) => { + await server.register(Schwifty); + + if (options.Model) { + Schwifty.assertCompatible(options.Model, DogModel); + } + + server.schwifty(options.Model || DogModel); + } +}; diff --git a/types/schwifty/tsconfig.json b/types/schwifty/tsconfig.json new file mode 100644 index 0000000000..ff73409893 --- /dev/null +++ b/types/schwifty/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "target": "es6", + "strictFunctionTypes": true + }, + "files": ["index.d.ts", "schwifty-tests.ts"] +} diff --git a/types/schwifty/tslint.json b/types/schwifty/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/schwifty/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 48fc5d3017122927680094e06d6b1e5041f1fb9f Mon Sep 17 00:00:00 2001 From: Ozum Date: Sat, 19 May 2018 12:52:04 +0300 Subject: [PATCH 253/575] delete package.json --- types/schwifty/index.d.1.ts | 83 -------------------------------- types/schwifty/package.json | 6 --- types/schwifty/schwifty-tests.ts | 8 +-- types/schwifty/test/plugin.ts | 2 +- types/schwifty/tsconfig.json | 7 ++- 5 files changed, 11 insertions(+), 95 deletions(-) delete mode 100644 types/schwifty/index.d.1.ts delete mode 100644 types/schwifty/package.json diff --git a/types/schwifty/index.d.1.ts b/types/schwifty/index.d.1.ts deleted file mode 100644 index 0580e5e1fb..0000000000 --- a/types/schwifty/index.d.1.ts +++ /dev/null @@ -1,83 +0,0 @@ -// Type definitions for schwifty 4.0. -// Project: https://github.com/hapipal/schwifty -// Definitions by: ozum -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 - -// HELP WANTED: If possible, find a better way to define Server.models, Request.models and ResponseToolkit.models -// They are dynamic types extended from SchwiftyModel. - -import * as Objection from "objection"; -import * as Joi from "joi"; -import { - Server, - Request, - ResponseToolkit, - Plugin, - ServerRegisterPluginObject -} from "hapi"; -import * as Knex from "knex"; - -type Model = typeof SchwiftyModel | typeof Objection.Model; - -declare class SchwiftyModel extends Objection.Model { - static getJoiSchema(patch?: boolean): Joi.Schema; - joiSchema: Joi.Schema; -} - -interface RegistrationOptions { - knex?: Knex | Knex.Config; - models?: Array | string; - migrationsDir?: string; - teardownOnStop?: boolean; - migrateOnStart?: boolean | "latest" | "rollback"; -} - -interface SchwiftyExtras { - assertCompatible: ( - ModelA: typeof SchwiftyModel, - ModelB: typeof SchwiftyModel, - message?: string - ) => void | Error; - Model: typeof SchwiftyModel; -} - -declare const Schwifty: Plugin & SchwiftyExtras; - -export const plugin: Plugin; - -//export = Schwifty; - -/* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + Hapi Decorations + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + */ - -/** - * Merge decorations into hapi objects. - */ -declare module "hapi" { - interface Server { - schwifty: ( - config: - | Model - | Array - | { - knex: Knex | Knex.Config; - models: Array; - migrationsDir: string; - } - ) => void; - knex: () => Knex; - models: (all?: boolean) => { [key: string]: typeof SchwiftyModel }; - } - - interface Request { - knex: () => Knex; - models: (all?: boolean) => { [key: string]: typeof SchwiftyModel }; - } - - interface ResponseToolkit { - knex: () => Knex; - models: (all?: boolean) => { [key: string]: typeof SchwiftyModel }; - } -} diff --git a/types/schwifty/package.json b/types/schwifty/package.json deleted file mode 100644 index 37b2fc1558..0000000000 --- a/types/schwifty/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "private": true, - "dependencies": { - "objection": "^1.1.8" - } -} diff --git a/types/schwifty/schwifty-tests.ts b/types/schwifty/schwifty-tests.ts index afdcda5441..39d06c6f09 100644 --- a/types/schwifty/schwifty-tests.ts +++ b/types/schwifty/schwifty-tests.ts @@ -1,7 +1,7 @@ import * as Hapi from "hapi"; import * as Joi from "joi"; import * as Schwifty from "schwifty"; -import DogClass from "./test/dog"; +import DogModel from "./test/dog"; (async () => { const server = new Hapi.Server({ port: 3000 }); @@ -20,13 +20,13 @@ import DogClass from "./test/dog"; } }); - Schwifty.assertCompatible(DogClass, DogClass); + Schwifty.assertCompatible(DogModel, DogModel); // Register a model with schwifty... - server.schwifty(DogClass); + server.schwifty(DogModel); await server.initialize(); - const Dog: typeof DogClass = server.models().Dog; + const Dog: typeof DogModel = server.models().Dog; await Dog.query().insert({ name: "Guinness" }); diff --git a/types/schwifty/test/plugin.ts b/types/schwifty/test/plugin.ts index 0b3e9b189b..e2523f7161 100644 --- a/types/schwifty/test/plugin.ts +++ b/types/schwifty/test/plugin.ts @@ -5,7 +5,7 @@ import DogModel from "./dog"; exports.plugin = { register: async ( server: Hapi.Server, - options: { Model: Schwifty.Model } + options: { Model: typeof Schwifty.Model } ) => { await server.register(Schwifty); diff --git a/types/schwifty/tsconfig.json b/types/schwifty/tsconfig.json index ff73409893..d7117c5fd2 100644 --- a/types/schwifty/tsconfig.json +++ b/types/schwifty/tsconfig.json @@ -13,5 +13,10 @@ "target": "es6", "strictFunctionTypes": true }, - "files": ["index.d.ts", "schwifty-tests.ts"] + "files": [ + "index.d.ts", + "schwifty-tests.ts", + "test/dog.ts", + "test/plugin.ts" + ] } From 8dbab0928bf397905711bba79473622af9822ab2 Mon Sep 17 00:00:00 2001 From: Vincent Langlet Date: Sat, 19 May 2018 14:22:25 +0200 Subject: [PATCH 254/575] Remove layoutProps --- types/react-native/legacy-properties.d.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/types/react-native/legacy-properties.d.ts b/types/react-native/legacy-properties.d.ts index eae30f65c7..ab87361485 100644 --- a/types/react-native/legacy-properties.d.ts +++ b/types/react-native/legacy-properties.d.ts @@ -1,5 +1,4 @@ import { - LayoutProps, TextProps, TextPropsIOS, TextPropsAndroid, @@ -77,9 +76,6 @@ declare module "react-native" { * The following lines ensure compatibility with *Properties and should be removed in the future */ - /** @deprecated Use LayoutProps */ - export type LayoutProperties = LayoutProps; - /** @deprecated Use TextProps */ export type TextProperties = TextProps; From ee04278cb856cc5ca1f906ff6f0713d6bf24b838 Mon Sep 17 00:00:00 2001 From: Dmitrii Sorin Date: Sun, 20 May 2018 10:22:33 +1000 Subject: [PATCH 255/575] Add multiple forgotten mocha API methods --- types/mocha/index.d.ts | 293 ++++++++++++++++++++++++++++++------- types/mocha/mocha-tests.ts | 34 +++-- 2 files changed, 259 insertions(+), 68 deletions(-) diff --git a/types/mocha/index.d.ts b/types/mocha/index.d.ts index 0e066791eb..2dd6bb2c21 100644 --- a/types/mocha/index.d.ts +++ b/types/mocha/index.d.ts @@ -5,10 +5,28 @@ // jt000 // Vadim Macagon // Andrew Bradley +// Dmitrii Sorin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 -interface MochaSetupOptions { +/** + * Mocha is using node.js EventEmitter for its internal classes + * But when it's executed in the browser environment it bundles a 3rd party EventEmitter in its code + * Also node.js EventEmitter brings its globals which cannot be used in the browser environment. + * So it's unsafe to reference node EventEmitter here, that's why we have a generic interface for EventEmitter. + * + * @see https://github.com/DefinitelyTyped/DefinitelyTyped/pull/25117#issuecomment-383404187 + */ +declare class GenericEventEmitter { + addListener(event: string, listener: (...args: any[]) => void): GenericEventEmitter; + on(event: string, listener: (...args: any[]) => void): GenericEventEmitter; + once(event: string, listener: (...args: any[]) => void): GenericEventEmitter; + removeListener(event: string, listener: (...args: any[]) => void): GenericEventEmitter; + removeAllListeners(event?: string): GenericEventEmitter; + emit(event: string, ...args: any[]): boolean; + } + + interface MochaSetupOptions { // milliseconds to wait before considering a test slow slow?: number; @@ -35,61 +53,67 @@ interface MochaSetupOptions { // require modules before running tests require?: string[]; -} -declare const mocha: Mocha; -declare const describe: Mocha.IContextDefinition; -declare const xdescribe: Mocha.IContextDefinition; -// alias for `describe` -declare const context: Mocha.IContextDefinition; -// alias for `describe` -declare const suite: Mocha.IContextDefinition; -declare const it: Mocha.ITestDefinition; -declare const xit: Mocha.ITestDefinition; -// alias for `it` -declare const test: Mocha.ITestDefinition; -declare const specify: Mocha.ITestDefinition; + asyncOnly?: boolean; + delay?: boolean; + files?: string[]; + forbidOnly?: boolean; + forbidPending?: boolean; + fullStackTrace?: boolean; + hasOnly?: boolean; + } -// Used with the --delay flag; see https://mochajs.org/#hooks -declare function run(): void; + declare const mocha: Mocha; + declare const describe: Mocha.IContextDefinition; + declare const xdescribe: Mocha.IContextDefinition; + // alias for `describe` + declare const context: Mocha.IContextDefinition; + // alias for `describe` + declare const suite: Mocha.IContextDefinition; + declare const it: Mocha.ITestDefinition; + declare const xit: Mocha.ITestDefinition; + // alias for `it` + declare const test: Mocha.ITestDefinition; + declare const specify: Mocha.ITestDefinition; -type MochaDone = (error?: any) => void; + // Used with the --delay flag; see https://mochajs.org/#hooks + declare function run(): void; -declare function setup(callback: (this: Mocha.IBeforeAndAfterContext, done: MochaDone) => PromiseLike | void): void; -declare function teardown(callback: (this: Mocha.IBeforeAndAfterContext, done: MochaDone) => PromiseLike | void): void; -declare function suiteSetup(callback: (this: Mocha.IHookCallbackContext, done: MochaDone) => PromiseLike | void): void; -declare function suiteTeardown(callback: (this: Mocha.IHookCallbackContext, done: MochaDone) => PromiseLike | void): void; -declare function before(callback: (this: Mocha.IHookCallbackContext, done: MochaDone) => PromiseLike | void): void; -declare function before(description: string, callback: (this: Mocha.IHookCallbackContext, done: MochaDone) => PromiseLike | void): void; -declare function after(callback: (this: Mocha.IHookCallbackContext, done: MochaDone) => PromiseLike | void): void; -declare function after(description: string, callback: (this: Mocha.IHookCallbackContext, done: MochaDone) => PromiseLike | void): void; -declare function beforeEach(callback: (this: Mocha.IBeforeAndAfterContext, done: MochaDone) => PromiseLike | void): void; -declare function beforeEach(description: string, callback: (this: Mocha.IBeforeAndAfterContext, done: MochaDone) => PromiseLike | void): void; -declare function afterEach(callback: (this: Mocha.IBeforeAndAfterContext, done: MochaDone) => PromiseLike | void): void; -declare function afterEach(description: string, callback: (this: Mocha.IBeforeAndAfterContext, done: MochaDone) => PromiseLike | void): void; + type MochaDone = (error?: any) => void; -interface ReporterConstructor { + declare function setup(callback: (this: Mocha.IBeforeAndAfterContext, done: MochaDone) => PromiseLike | void): void; + declare function teardown(callback: (this: Mocha.IBeforeAndAfterContext, done: MochaDone) => PromiseLike | void): void; + declare function suiteSetup(callback: (this: Mocha.IHookCallbackContext, done: MochaDone) => PromiseLike | void): void; + declare function suiteTeardown(callback: (this: Mocha.IHookCallbackContext, done: MochaDone) => PromiseLike | void): void; + declare function before(callback: (this: Mocha.IHookCallbackContext, done: MochaDone) => PromiseLike | void): void; + declare function before(description: string, callback: (this: Mocha.IHookCallbackContext, done: MochaDone) => PromiseLike | void): void; + declare function after(callback: (this: Mocha.IHookCallbackContext, done: MochaDone) => PromiseLike | void): void; + declare function after(description: string, callback: (this: Mocha.IHookCallbackContext, done: MochaDone) => PromiseLike | void): void; + declare function beforeEach(callback: (this: Mocha.IBeforeAndAfterContext, done: MochaDone) => PromiseLike | void): void; + declare function beforeEach(description: string, callback: (this: Mocha.IBeforeAndAfterContext, done: MochaDone) => PromiseLike | void): void; + declare function afterEach(callback: (this: Mocha.IBeforeAndAfterContext, done: MochaDone) => PromiseLike | void): void; + declare function afterEach(description: string, callback: (this: Mocha.IBeforeAndAfterContext, done: MochaDone) => PromiseLike | void): void; + + interface ReporterConstructor { new(runner: Mocha.IRunner, options: any): any; -} + } -declare class Mocha { + declare class Mocha { currentTest: Mocha.ITestDefinition; suite: Mocha.ISuite; + files: string[]; + options: MochaSetupOptions; - constructor(options?: { - grep?: RegExp; - ui?: string; - reporter?: string | ReporterConstructor; - timeout?: number; - reporterOptions?: any; - slow?: number; - bail?: boolean; - }); + constructor(options?: MochaSetupOptions); + asyncOnly(): Mocha; + asyncOnly(value: boolean): Mocha; + delay(): Mocha; + forbidOnly(): Mocha; + forbidPending(): Mocha; + fullTrace(): Mocha; /** Setup mocha with the given interface. */ setup(interface: Mocha.Interface): Mocha; - /** Setup mocha with the given options. */ - setup(options: MochaSetupOptions): Mocha; bail(value?: boolean): Mocha; addFile(file: string): Mocha; /** Sets reporter by name, defaults to "spec". */ @@ -117,15 +141,22 @@ declare class Mocha { timeout(value: number): Mocha; slow(value: number): Mocha; enableTimeouts(value: boolean): Mocha; - asyncOnly(value: boolean): Mocha; noHighlighting(value: boolean): Mocha; /** Runs tests and invokes `onComplete()` when finished. */ run(onComplete?: (failures: number) => void): Mocha.IRunner; loadFiles(cb?: () => any): void; -} -// merge the Mocha class declaration with a module -declare namespace Mocha { + // internals exposed via exports.* + Runnable: Mocha.Runnable; + Context: Mocha.Context; + Runner: Mocha.Runner; + Suite: Mocha.Suite; + Hook: Mocha.Hook; + Test: Mocha.Test; + } + + // merge the Mocha class declaration with a module + declare namespace Mocha { /** Third-party declarations that want to add new interfaces can contribute names here */ interface InterfaceContributions { bdd: any; @@ -136,6 +167,22 @@ declare namespace Mocha { type Interface = keyof InterfaceContributions; + interface IContext { + _runnable?: IRunnable; + test?: IRunnable; + + runnable(): IRunnable | undefined; + runnable(runnable: IRunnable): IContext; + timeout(): number; + timeout(timeout: number): IContext; + enableTimeouts(enableTimeouts: boolean): IContext; + slow(slow: number): IContext; + skip(): IContext; + retries(): number; + retries(retries: number): IContext; + inspect(): string; + } + interface ISuiteCallbackContext { timeout(ms: number | string): this; retries(n: number): this; @@ -157,7 +204,7 @@ declare namespace Mocha { } /** Partial interface for Mocha's `Runnable` class. */ - interface IRunnable { + interface IRunnable extends GenericEventEmitter { title: string; fn: Function; async: boolean; @@ -169,22 +216,49 @@ declare namespace Mocha { /** Partial interface for Mocha's `Suite` class. */ interface ISuite { + ctx: IContext; parent: ISuite; + root: boolean; title: string; suites: ISuite[]; + tests: ITest[]; + _beforeEach: IHook[]; + _beforeAll: IHook[]; + _afterEach: IHook[]; + _afterAll: IHook[]; + + bail(): boolean; + bail(bail: boolean): ISuite; fullTitle(): string; + retries(): number; + retries(retries: number): ISuite; + slow(): number; + slow(slow: number): ISuite; + timeout(): number; + timeout(timeout: number): ISuite; } /** Partial interface for Mocha's `Test` class. */ interface ITest extends IRunnable { + body?: string; + file?: string; parent: ISuite; pending: boolean; state: 'failed' | 'passed' | undefined; + type: 'test'; fullTitle(): string; } + interface IHook extends IRunnable { + ctx?: IContext; + parent?: ISuite; + type: 'hook'; + + error(err: Error): void; + } + interface IBeforeAndAfterContext extends IHookCallbackContext { currentTest: ITest; } @@ -201,12 +275,19 @@ declare namespace Mocha { } /** Partial interface for Mocha's `Runner` class. */ - interface IRunner { + interface IRunner extends GenericEventEmitter { + asyncOnly?: boolean; stats?: IStats; started: boolean; suite: ISuite; total: number; failures: number; + forbidOnly?: boolean; + forbidPending?: boolean; + fullStackTrace?: boolean; + hasOnly?: boolean; + ignoreLeaks?: boolean; + grep: (re: string, invert: boolean) => this; grepTotal: (suite: ISuite) => number; globals: (arr: ReadonlyArray) => this | string[]; @@ -231,6 +312,7 @@ declare namespace Mocha { namespace reporters { class Base { + runner: IRunner; stats: IStats; constructor(runner: IRunner); @@ -326,8 +408,115 @@ declare namespace Mocha { function afterEach(callback: (this: IBeforeAndAfterContext, done: MochaDone) => PromiseLike | void): void; /** Only available when invoked via the mocha CLI */ function afterEach(description: string, callback: (this: IBeforeAndAfterContext, done: MochaDone) => PromiseLike | void): void; -} -declare module "mocha" { + class Runnable extends GenericEventEmitter { + new(title: string, fn: () => any): IRunnable; + } + + class Context implements IContext { + constructor(); + + _runnable?: IRunnable; + test?: IRunnable; + + runnable(): IRunnable | undefined; + runnable(runnable: IRunnable): IContext; + timeout(): number; + timeout(timeout: number): IContext; + enableTimeouts(enableTimeouts: boolean): IContext; + slow(slow: number): IContext; + skip(): IContext; + retries(): number; + retries(retries: number): IContext; + inspect(): string; + } + + class Runner extends GenericEventEmitter implements IRunner { + constructor(suite: ISuite, delay: boolean); + + asyncOnly?: boolean; + stats?: IStats; + started: boolean; + suite: ISuite; + total: number; + failures: number; + forbidOnly?: boolean; + forbidPending?: boolean; + fullStackTrace?: boolean; + hasOnly?: boolean; + ignoreLeaks?: boolean; + + grep: (re: string, invert: boolean) => this; + grepTotal: (suite: ISuite) => number; + globals: (arr: ReadonlyArray) => this | string[]; + abort: () => this; + run: (fn?: (failures: number) => void) => this; + } + + class Suite extends GenericEventEmitter implements ISuite { + constructor(title: string, parentContext: IContext); + + ctx: IContext; + parent: ISuite; + root: boolean; + title: string; + suites: ISuite[]; + tests: ITest[]; + + _beforeEach: IHook[]; + _beforeAll: IHook[]; + _afterEach: IHook[]; + _afterAll: IHook[]; + + bail(): boolean; + bail(bail: boolean): ISuite; + fullTitle(): string; + retries(): number; + retries(retries: number): ISuite; + slow(): number; + slow(slow: number): ISuite; + timeout(): number; + timeout(timeout: number): ISuite; + } + + class Hook extends Runnable implements IHook { + constructor(title: string, fn: () => any); + + async: boolean; + ctx?: IContext; + duration?: number; + fn: Function; + parent?: ISuite; + sync: boolean; + timedOut: boolean; + timeout(n: number | string): this; + title: string; + type: 'hook'; + + error(err: Error): void; + } + + class Test extends Runnable implements ITest { + constructor(title: string, fn: () => any); + + async: boolean; + body?: string; + duration?: number; + file?: string; + fn: Function; + parent: ISuite; + pending: boolean; + state: 'failed' | 'passed' | undefined; + sync: boolean; + timedOut: boolean; + timeout(n: number | string): this; + title: string; + type: 'test'; + + fullTitle(): string; + } + } + + declare module "mocha" { export = Mocha; -} + } diff --git a/types/mocha/mocha-tests.ts b/types/mocha/mocha-tests.ts index f2fa323f19..ec9b238d80 100644 --- a/types/mocha/mocha-tests.ts +++ b/types/mocha/mocha-tests.ts @@ -7,9 +7,12 @@ import { describe as importedDescribe, it as importedIt, xdescribe as importedXdescribe, - xit as importedXit + xit as importedXit, } from 'mocha'; +// tslint:disable-next-line +import * as Mocha from 'mocha'; + // Warning!! // Don't refer node.d.ts!! // See #22510. @@ -454,55 +457,55 @@ function test_reporter_function() { } function test_setup_slow_option() { - mocha.setup({ slow: 25 }); + new Mocha({ slow: 25 }); } function test_setup_timeout_option() { - mocha.setup({ timeout: 25 }); + new Mocha({ timeout: 25 }); } function test_setup_globals_option() { - mocha.setup({ globals: ['mocha'] }); + new Mocha({ globals: ['mocha'] }); } function test_setup_ui_option() { - mocha.setup({ ui: 'bdd' }); + new Mocha({ ui: 'bdd' }); } function test_setup_reporter_string_option() { - mocha.setup({ reporter: 'html' }); + new Mocha({ reporter: 'html' }); } function test_setup_require_stringArray_option() { - mocha.setup({ require: ['ts-node/register'] }); + new Mocha({ require: ['ts-node/register'] }); } function test_setup_reporter_function_option() { - mocha.setup({ reporter: class { } }); + new Mocha({ reporter: class { } }); } function test_setup_bail_option() { - mocha.setup({ bail: false }); + new Mocha({ bail: false }); } function test_setup_ignore_leaks_option() { - mocha.setup({ ignoreLeaks: false }); + new Mocha({ ignoreLeaks: false }); } function test_setup_grep_string_option() { - mocha.setup({ grep: "describe" }); + new Mocha({ grep: "describe" }); } function test_setup_grep_regex_option() { - mocha.setup({ grep: new RegExp('describe') }); + new Mocha({ grep: new RegExp('describe') }); } function test_setup_grep_regex_literal_option() { - mocha.setup({ grep: /(expect|should)/i }); + new Mocha({ grep: /(expect|should)/i }); } function test_setup_all_options() { - mocha.setup({ + new Mocha({ slow: 25, timeout: 25, ui: 'bdd', @@ -524,8 +527,7 @@ function test_growl() { } function test_chaining() { - mocha - .setup({ slow: 25 }) + new Mocha({ slow: 25 }) .growl() .reporter('html') .reporter(class { }); From 176ec5a72986c115775193316378d3ea692b0b6c Mon Sep 17 00:00:00 2001 From: Thomas Wanzek Date: Sat, 19 May 2018 23:51:18 -0400 Subject: [PATCH 256/575] doc(d3-color): complete JSDoc comments --- types/d3-color/index.d.ts | 412 +++++++++++++++++++++++++++++++++++++- 1 file changed, 409 insertions(+), 3 deletions(-) diff --git a/types/d3-color/index.d.ts b/types/d3-color/index.d.ts index 56812a6bdb..05cd974c1f 100644 --- a/types/d3-color/index.d.ts +++ b/types/d3-color/index.d.ts @@ -23,20 +23,60 @@ export type ColorSpaceObject = RGBColor | HSLColor | LabColor | HCLColor | Cubeh * e.g. in d3-hsv). This interface */ export interface ColorCommonInstance { + /** + * Returns true if and only if the color is displayable on standard hardware. + * For example, this returns false for an RGB color if any channel value is less than zero or greater than 255, or if the opacity is not in the range [0, 1]. + */ displayable(): boolean; + /** + * Returns a string representing this color according to the CSS Object Model specification, + * such as rgb(247, 234, 186) or rgba(247, 234, 186, 0.2). + * If this color is not displayable, a suitable displayable color is returned instead. + * For example, RGB channel values greater than 255 are clamped to 255. + */ toString(): string; + /** + * Returns a brighter copy of this color. If k is specified, it controls how much brighter the returned color should be. + * If k is not specified, it defaults to 1. The behavior of this method is dependent on the implementing color space. + * + * @param k A color space dependent number to determine, how much brighter the returned color should be. + */ brighter(k?: number): this; + /** + * Returns a darker copy of this color. If k is specified, it controls how much darker the returned color should be. + * If k is not specified, it defaults to 1. The behavior of this method is dependent on the implementing color space. + * + * @param k A color space dependent number to determine, how much darker the returned color should be. + */ darker(k?: number): this; + /** + * Returns the RGB equivalent of this color. For RGB colors, that’s "this". + */ rgb(): RGBColor; /** * Returns a hexadecimal string representing this color. - * If this color is not displayable, a suitable displayable color is returned instead. For example, RGB channel values greater than 255 are clamped to 255. + * If this color is not displayable, a suitable displayable color is returned instead. + * For example, RGB channel values greater than 255 are clamped to 255. */ hex(): string; } +/** + * A Color object which serves as a base class for + * colorspace-specific sub-class implementations. + */ export interface Color { + /** + * Returns true if and only if the color is displayable on standard hardware. + * For example, this returns false for an RGB color if any channel value is less than zero or greater than 255, or if the opacity is not in the range [0, 1]. + */ displayable(): boolean; // Note: While this method is used in prototyping for colors of specific colorspaces, it should not be called directly, as 'this.rgb' would not be implemented on Color + /** + * Returns a string representing this color according to the CSS Object Model specification, + * such as rgb(247, 234, 186) or rgba(247, 234, 186, 0.2). + * If this color is not displayable, a suitable displayable color is returned instead. + * For example, RGB channel values greater than 255 are clamped to 255. + */ toString(): string; // Note: While this method is used in prototyping for colors of specific colorspaces, it should not be called directly, as 'this.rgb' would not be implemented on Color /** * Returns a hexadecimal string representing this color. @@ -45,18 +85,62 @@ export interface Color { hex(): string; } +/** + * A Color factory object, which may also be used with instanceof to test if an object is a color instance. + */ export interface ColorFactory extends Function { + /** + * Parses the specified CSS Color Module Level 3 specifier string, returning an RGB or HSL color. + * If the specifier was not valid, null is returned. + * + * @param cssColorSpecifier A CSS Color Module Level 3 specifier string. + */ (cssColorSpecifier: string): RGBColor | HSLColor | null; + /** + * Converts the provided color instance and returns an RGB or HSL color. + * + * @param color A permissible color space instance. + */ (color: ColorSpaceObject | ColorCommonInstance): RGBColor | HSLColor; + /** + * Prototype of the factory, which can be used for instanceof testing + */ readonly prototype: Color; } +/** + * An RGB color object. + */ export interface RGBColor extends Color { + /** + * Value of red channel + */ r: number; + /** + * Value of green channel + */ g: number; + /** + * Value of blue channel + */ b: number; + /** + * Opacity value + */ opacity: number; + /** + * Returns a brighter copy of this color. If k is specified, it controls how much brighter the returned color should be. + * If k is not specified, it defaults to 1. + * + * @param k A color space dependent number to determine, how much brighter the returned color should be. + */ brighter(k?: number): this; + /** + * Returns a darker copy of this color. If k is specified, it controls how much darker the returned color should be. + * If k is not specified, it defaults to 1. + * + * @param k A color space dependent number to determine, how much darker the returned color should be. + */ darker(k?: number): this; /** * Returns the RGB equivalent of this color. @@ -64,89 +148,382 @@ export interface RGBColor extends Color { rgb(): this; } +/** + * An RGB color factory object, which may also be used with instanceof to test if an object + * is an RGB color instance. + */ export interface RGBColorFactory extends Function { + /** + * Constructs a new RGB color based on the specified channel values and opacity. + * + * @param r Red channel value. + * @param g Green channel value. + * @param b Blue channel value. + * @param opacity Optional opacity value, defaults to 1. + */ (r: number, g: number, b: number, opacity?: number): RGBColor; + /** + * Parses the specified CSS Color Module Level 3 specifier string, returning an RGB color. + * If the specifier was not valid, null is returned. + * + * @param cssColorSpecifier A CSS Color Module Level 3 specifier string. + */ (cssColorSpecifier: string): RGBColor; + /** + * Converts the provided color instance and returns an RGB color. The color instance is converted to the RGB color space using color.rgb. + * Note that unlike color.rgb this method always returns a new instance, even if color is already an RGB color. + * + * @param color A permissible color space instance. + */ (color: ColorSpaceObject | ColorCommonInstance): RGBColor; + /** + * Prototype of the factory, which can be used for instanceof testing + */ readonly prototype: RGBColor; } +/** + * An HSL color object. + */ export interface HSLColor extends Color { + /** + * Hue channel value. + */ h: number; + /** + * Saturation channel value. + */ s: number; + /** + * Lightness channel value. + */ l: number; + /** + * Opacity value. + */ opacity: number; + /** + * Returns a brighter copy of this color. If k is specified, it controls how much brighter the returned color should be. + * If k is not specified, it defaults to 1. + * + * @param k A color space dependent number to determine, how much brighter the returned color should be. + */ brighter(k?: number): this; + /** + * Returns a darker copy of this color. If k is specified, it controls how much darker the returned color should be. + * If k is not specified, it defaults to 1. + * + * @param k A color space dependent number to determine, how much darker the returned color should be. + */ darker(k?: number): this; + /** + * Returns the RGB color equivalent of this color. + */ rgb(): RGBColor; } +/** + * An HSL color factory object, which may also be used with instanceof to test if an object + * is an HSL color instance. + */ export interface HSLColorFactory extends Function { + /** + * Constructs a new HSL color based on the specified channel values and opacity. + * + * @param h Hue channel value. + * @param s Saturation channel value. + * @param l Lightness channel value. + * @param opacity Optional opacity value, defaults to 1. + */ (h: number, s: number, l: number, opacity?: number): HSLColor; + /** + * Parses the specified CSS Color Module Level 3 specifier string, returning an HSL color. + * If the specifier was not valid, null is returned. + * + * @param cssColorSpecifier A CSS Color Module Level 3 specifier string. + */ (cssColorSpecifier: string): HSLColor; + /** + * Converts the provided color instance and returns an HSL color. + * The color instance is converted to the RGB color space using color.rgb and then converted to HSL. + * (Colors already in the HSL color space skip the conversion to RGB.) + * + * @param color A permissible color space instance. + */ (color: ColorSpaceObject | ColorCommonInstance): HSLColor; + /** + * Prototype of the factory, which can be used for instanceof testing + */ readonly prototype: HSLColor; } +/** + * A Lab (CIELAB) color object. + */ export interface LabColor extends Color { + /** + * Lightness typically in the range [0, 100]. + */ l: number; + /** + * Position between red/magenta and green typically in [-160, +160]. + */ a: number; + /** + * Position between yellow and blue typically in [-160, +160]. + */ b: number; + /** + * Opacity value + */ opacity: number; + /** + * Returns a brighter copy of this color. If k is specified, it controls how much brighter the returned color should be. + * If k is not specified, it defaults to 1. + * + * @param k A color space dependent number to determine, how much brighter the returned color should be. + */ brighter(k?: number): this; + /** + * Returns a darker copy of this color. If k is specified, it controls how much darker the returned color should be. + * If k is not specified, it defaults to 1. + * + * @param k A color space dependent number to determine, how much darker the returned color should be. + */ darker(k?: number): this; + /** + * Returns the RGB color equivalent of this color. + */ rgb(): RGBColor; } +/** + * A Lab (CIELAB) color factory object, which may also be used with instanceof to test if an object + * is a Lab color instance. + */ export interface LabColorFactory extends Function { + /** + * Constructs a new Lab color based on the specified channel values and opacity. + * + * @param l Lightness typically in the range [0, 100]. + * @param a Position between red/magenta and green typically in [-160, +160]. + * @param b Position between yellow and blue typically in [-160, +160]. + * @param opacity Optional opacity value, defaults to 1. + */ (l: number, a: number, b: number, opacity?: number): LabColor; + /** + * Parses the specified CSS Color Module Level 3 specifier string, returning a Lab color. + * If the specifier was not valid, null is returned. + * + * @param cssColorSpecifier A CSS Color Module Level 3 specifier string. + */ (cssColorSpecifier: string): LabColor; + /** + * Converts the provided color instance and returns a Lab color. + * The color instance is converted to the RGB color space using color.rgb and then converted to Lab. + * (Colors already in the Lab color space skip the conversion to RGB, + * and colors in the HCL color space are converted directly to Lab.) + * + * @param color A permissible color space instance. + */ (color: ColorSpaceObject | ColorCommonInstance): LabColor; + /** + * Prototype of the factory, which can be used for instanceof testing + */ readonly prototype: LabColor; } /** - * Constructs a new Lab color with the specified l value and a = b = 0. + * A gray color factory for Lab (CIELAB) colors. */ -export type GrayColorFactory = (l: number, opacity?: number) => LabColor; +export type GrayColorFactory = + /** + * Constructs a new Lab color with the specified l value and a = b = 0. + * + * @param l Lightness typically in the range [0, 100]. + * @param opacity Optional opacity value, defaults to 1. + */ + (l: number, opacity?: number) => LabColor; +/** + * An HCL (CIELCH) color object. + */ export interface HCLColor extends Color { + /** + * Hue channel value typically in [0, 360). + */ h: number; + /** + * Chroma channel value typically in [0, 230]. + */ c: number; + /** + * Luminance channel value typically in the range [0, 100]. + */ l: number; + /** + * Opacity value + */ opacity: number; + /** + * Returns a brighter copy of this color. If k is specified, it controls how much brighter the returned color should be. + * If k is not specified, it defaults to 1. + * + * @param k A color space dependent number to determine, how much brighter the returned color should be. + */ brighter(k?: number): this; + /** + * Returns a darker copy of this color. If k is specified, it controls how much darker the returned color should be. + * If k is not specified, it defaults to 1. + * + * @param k A color space dependent number to determine, how much darker the returned color should be. + */ darker(k?: number): this; + /** + * Returns the RGB color equivalent of this color. + */ rgb(): RGBColor; } +/** + * An HCL (CIELCH) color factory object, which may also be used with instanceof to test if an object + * is an HCL color instance. + */ export interface HCLColorFactory extends Function { + /** + * Constructs a new HCL color based on the specified channel values and opacity. + * + * @param h Hue channel value typically in [0, 360). + * @param c Chroma channel value typically in [0, 230]. + * @param l Luminance channel value typically in the range [0, 100]. + * @param opacity Optional opacity value, defaults to 1. + */ (h: number, l: number, c: number, opacity?: number): HCLColor; + /** + * Parses the specified CSS Color Module Level 3 specifier string, returning an HCL color. + * If the specifier was not valid, null is returned. + * + * @param cssColorSpecifier A CSS Color Module Level 3 specifier string. + */ (cssColorSpecifier: string): HCLColor; + /** + * Converts the provided color instance and returns an HCL color. + * The color instance is converted to the RGB color space using color.rgb and then converted to HCL. + * (Colors already in the HCL color space skip the conversion to RGB, + * and colors in the Lab color space are converted directly to HCL.) + * + * @param color A permissible color space instance. + */ (color: ColorSpaceObject | ColorCommonInstance): HCLColor; + /** + * Prototype of the factory, which can be used for instanceof testing + */ readonly prototype: HCLColor; } +/** + * An LCH (CIELCH) color factory function to create an HCL color object. + */ export interface LCHColorFactory { + /** + * Constructs a new HCL color based on the specified channel values and opacity. + * + * @param l Luminance channel value typically in the range [0, 100]. + * @param c Chroma channel value typically in [0, 230]. + * @param h Hue channel value typically in [0, 360). + * @param opacity Optional opacity value, defaults to 1. + */ (l: number, c: number, h: number, opacity?: number): HCLColor; + /** + * Parses the specified CSS Color Module Level 3 specifier string, returning an HCL color. + * If the specifier was not valid, null is returned. + * + * @param cssColorSpecifier A CSS color Module Level 3 specifier string. + */ (cssColorSpecifier: string): HCLColor; + /** + * Converts the provided color instance and returns an HCL color. + * The color instance is converted to the RGB color space using color.rgb and then converted to HCL. + * (Colors already in the HCL color space skip the conversion to RGB, + * and colors in the Lab color space are converted directly to HCL.) + * + * @param color A permissible color space instance. + */ (color: ColorSpaceObject | ColorCommonInstance): HCLColor; } +/** + * Dave Green’s Cubehelix color object. + */ export interface CubehelixColor extends Color { + /** + * Hue channel value. + */ h: number; + /** + * Saturation channel value. + */ s: number; + /** + * Lightness channel value. + */ l: number; + /** + * Opacity value. + */ opacity: number; + /** + * Returns a brighter copy of this color. If k is specified, it controls how much brighter the returned color should be. + * If k is not specified, it defaults to 1. + * + * @param k A color space dependent number to determine, how much brighter the returned color should be. + */ brighter(k?: number): this; + /** + * Returns a darker copy of this color. If k is specified, it controls how much darker the returned color should be. + * If k is not specified, it defaults to 1. + * + * @param k A color space dependent number to determine, how much darker the returned color should be. + */ darker(k?: number): this; + /** + * Returns the RGB color equivalent of this color. + */ rgb(): RGBColor; } +/** + * A color factory object for Dave Green's Cubehelix colors, which may also be used with instanceof to test if an object + * is a Cubehelix color instance. + */ export interface CubehelixColorFactory extends Function { + /** + * Constructs a new Cubehelix color based on the specified channel values and opacity. + * + * @param h Hue channel value. + * @param s Saturation channel value. + * @param l Lightness channel value. + * @param opacity Optional opacity value, defaults to 1. + */ (h: number, s: number, l: number, opacity?: number): CubehelixColor; + /** + * Parses the specified CSS Color Module Level 3 specifier string, returning an Cubehelix color. + * If the specifier was not valid, null is returned. + * + * @param cssColorSpecifier A CSS Color Module Level 3 specifier string. + */ (cssColorSpecifier: string): CubehelixColor; + /** + * Converts the provided color instance and returns a Cubehelix color. + * The color instance is specified, it is converted to the RGB color space using color.rgb and then converted to Cubehelix. + * (Colors already in the Cubehelix color space skip the conversion to RGB.) + * + * @param color A permissible color space instance. + */ (color: ColorSpaceObject | ColorCommonInstance): CubehelixColor; + /** + * Prototype of the factory, which can be used for instanceof testing + */ readonly prototype: CubehelixColor; } @@ -154,18 +531,47 @@ export interface CubehelixColorFactory extends Function { // Color object factories // -------------------------------------------------------------------------- +/** + * A Color factory object, which may also be used with instanceof to test if an object is a color instance. + */ export const color: ColorFactory; +/** + * An RGB color factory object, which may also be used with instanceof to test if an object + * is an RGB color instance. + */ export const rgb: RGBColorFactory; +/** + * An HSL color factory object, which may also be used with instanceof to test if an object + * is an HSL color instance. + */ export const hsl: HSLColorFactory; +/** + * A Lab (CIELAB) color factory object, which may also be used with instanceof to test if an object + * is a Lab color instance. + */ export const lab: LabColorFactory; +/** + * A gray color factory for Lab (CIELAB) colors. + */ export const gray: GrayColorFactory; +/** + * An HCL (CIELCH) color factory object, which may also be used with instanceof to test if an object + * is an HCL color instance. + */ export const hcl: HCLColorFactory; +/** + * An LCH (CIELCH) color factory function to create an HCL color object. + */ export const lch: LCHColorFactory; +/** + * A color factory object for Dave Green's Cubehelix colors, which may also be used with instanceof to test if an object + * is a Cubehelix color instance. + */ export const cubehelix: CubehelixColorFactory; From 21696eb97be89c931508dd055edb8cc20c971a78 Mon Sep 17 00:00:00 2001 From: denis Date: Sun, 20 May 2018 09:05:44 +0200 Subject: [PATCH 257/575] Universal Coordinated Time -> Coordinated Universal Time --- types/d3-time/index.d.ts | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/types/d3-time/index.d.ts b/types/d3-time/index.d.ts index b8aa2f12aa..270d64d33c 100644 --- a/types/d3-time/index.d.ts +++ b/types/d3-time/index.d.ts @@ -444,10 +444,10 @@ export const timeYear: CountableTimeInterval; */ export function timeYears(start: Date, stop: Date, step?: number): Date[]; -// utc Universal Coordinated Time ---------------------------------------------------------- +// utc Coordinated Universal Time ---------------------------------------------------------- /** - * Milliseconds Interval in Universal Coordinated Time (UTC); the shortest available time unit. + * Milliseconds Interval in Coordinated Universal Time (UTC); the shortest available time unit. */ export const utcMillisecond: CountableTimeInterval; @@ -461,7 +461,7 @@ export const utcMillisecond: CountableTimeInterval; export function utcMilliseconds(start: Date, stop: Date, step?: number): Date[]; /** - * Seconds Interval in Universal Coordinated Time (UTC); seconds (e.g., 01:23:45.0000 AM); 1,000 milliseconds. + * Seconds Interval in Coordinated Universal Time (UTC); seconds (e.g., 01:23:45.0000 AM); 1,000 milliseconds. */ export const utcSecond: CountableTimeInterval; @@ -475,7 +475,7 @@ export const utcSecond: CountableTimeInterval; export function utcSeconds(start: Date, stop: Date, step?: number): Date[]; /** - * Minutes Interval in Universal Coordinated Time (UTC); minutes (e.g., 01:02:00 AM); 60 seconds. + * Minutes Interval in Coordinated Universal Time (UTC); minutes (e.g., 01:02:00 AM); 60 seconds. * Note that ECMAScript ignores leap seconds. */ export const utcMinute: CountableTimeInterval; @@ -490,7 +490,7 @@ export const utcMinute: CountableTimeInterval; export function utcMinutes(start: Date, stop: Date, step?: number): Date[]; /** - * Hours Interval in Universal Coordinated Time (UTC); Hours (e.g., 01:00 AM); 60 minutes. + * Hours Interval in Coordinated Universal Time (UTC); Hours (e.g., 01:00 AM); 60 minutes. */ export const utcHour: CountableTimeInterval; @@ -504,7 +504,7 @@ export const utcHour: CountableTimeInterval; export function utcHours(start: Date, stop: Date, step?: number): Date[]; /** - * Days Interval in Universal Coordinated Time (UTC); days (e.g., February 7, 2012 at 12:00 AM); 24 hours. + * Days Interval in Coordinated Universal Time (UTC); days (e.g., February 7, 2012 at 12:00 AM); 24 hours. */ export const utcDay: CountableTimeInterval; @@ -533,7 +533,7 @@ export const utcWeek: CountableTimeInterval; export function utcWeeks(start: Date, stop: Date, step?: number): Date[]; /** - * Week Interval for Sunday-based weeks in Universal Coordinated Time (UTC) (e.g., February 5, 2012 at 12:00 AM). + * Week Interval for Sunday-based weeks in Coordinated Universal Time (UTC) (e.g., February 5, 2012 at 12:00 AM). * 7 days and 168 hours. */ export const utcSunday: CountableTimeInterval; @@ -548,7 +548,7 @@ export const utcSunday: CountableTimeInterval; export function utcSundays(start: Date, stop: Date, step?: number): Date[]; /** - * Week Interval for Monday-based weeks in Universal Coordinated Time (UTC) (e.g., February 6, 2012 at 12:00 AM). + * Week Interval for Monday-based weeks in Coordinated Universal Time (UTC) (e.g., February 6, 2012 at 12:00 AM). * 7 days and 168 hours. */ export const utcMonday: CountableTimeInterval; @@ -563,7 +563,7 @@ export const utcMonday: CountableTimeInterval; export function utcMondays(start: Date, stop: Date, step?: number): Date[]; /** - * Week Interval for Tuesday-based weeks in Universal Coordinated Time (UTC) (e.g., February 7, 2012 at 12:00 AM). + * Week Interval for Tuesday-based weeks in Coordinated Universal Time (UTC) (e.g., February 7, 2012 at 12:00 AM). * 7 days and 168 hours. */ export const utcTuesday: CountableTimeInterval; @@ -578,7 +578,7 @@ export const utcTuesday: CountableTimeInterval; export function utcTuesdays(start: Date, stop: Date, step?: number): Date[]; /** - * Week Interval for Wednesday-based weeks in Universal Coordinated Time (UTC) (e.g., February 8, 2012 at 12:00 AM). + * Week Interval for Wednesday-based weeks in Coordinated Universal Time (UTC) (e.g., February 8, 2012 at 12:00 AM). * 7 days and 168 hours. */ export const utcWednesday: CountableTimeInterval; @@ -593,7 +593,7 @@ export const utcWednesday: CountableTimeInterval; export function utcWednesdays(start: Date, stop: Date, step?: number): Date[]; /** - * Week Interval for Thursday-based weeks in Universal Coordinated Time (UTC) (e.g., February 9, 2012 at 12:00 AM). + * Week Interval for Thursday-based weeks in Coordinated Universal Time (UTC) (e.g., February 9, 2012 at 12:00 AM). * 7 days and 168 hours. */ export const utcThursday: CountableTimeInterval; @@ -608,7 +608,7 @@ export const utcThursday: CountableTimeInterval; export function utcThursdays(start: Date, stop: Date, step?: number): Date[]; /** - * Week Interval for Friday-based weeks in Universal Coordinated Time (UTC) (e.g., February 10, 2012 at 12:00 AM). + * Week Interval for Friday-based weeks in Coordinated Universal Time (UTC) (e.g., February 10, 2012 at 12:00 AM). * 7 days and 168 hours. */ export const utcFriday: CountableTimeInterval; @@ -623,7 +623,7 @@ export const utcFriday: CountableTimeInterval; export function utcFridays(start: Date, stop: Date, step?: number): Date[]; /** - * Week Interval for Saturday-based weeks in Universal Coordinated Time (UTC) (e.g., February 11, 2012 at 12:00 AM). + * Week Interval for Saturday-based weeks in Coordinated Universal Time (UTC) (e.g., February 11, 2012 at 12:00 AM). * 7 days and 168 hours. */ export const utcSaturday: CountableTimeInterval; @@ -638,7 +638,7 @@ export const utcSaturday: CountableTimeInterval; export function utcSaturdays(start: Date, stop: Date, step?: number): Date[]; /** - * Month Interval in Universal Coordinated Time (UTC); months (e.g., February 1, 2012 at 12:00 AM); ranges from 28 to 31 days. + * Month Interval in Coordinated Universal Time (UTC); months (e.g., February 1, 2012 at 12:00 AM); ranges from 28 to 31 days. */ export const utcMonth: CountableTimeInterval; @@ -652,7 +652,7 @@ export const utcMonth: CountableTimeInterval; export function utcMonths(start: Date, stop: Date, step?: number): Date[]; /** - * Year Interval in Universal Coordinated Time (UTC); years (e.g., January 1, 2012 at 12:00 AM); ranges from 365 to 366 days. + * Year Interval in Coordinated Universal Time (UTC); years (e.g., January 1, 2012 at 12:00 AM); ranges from 365 to 366 days. */ export const utcYear: CountableTimeInterval; From 3c05f46d3010db8f0cee41b33a4712f6382f65e5 Mon Sep 17 00:00:00 2001 From: Alessio Paccoia Date: Sun, 20 May 2018 13:00:58 +0200 Subject: [PATCH 258/575] Add ps-tree types --- types/ps-tree/index.d.ts | 21 +++++++++++++++++++++ types/ps-tree/ps-tree-tests.ts | 8 ++++++++ types/ps-tree/tsconfig.json | 22 ++++++++++++++++++++++ types/ps-tree/tslint.json | 1 + 4 files changed, 52 insertions(+) create mode 100644 types/ps-tree/index.d.ts create mode 100644 types/ps-tree/ps-tree-tests.ts create mode 100644 types/ps-tree/tsconfig.json create mode 100644 types/ps-tree/tslint.json diff --git a/types/ps-tree/index.d.ts b/types/ps-tree/index.d.ts new file mode 100644 index 0000000000..7dad700315 --- /dev/null +++ b/types/ps-tree/index.d.ts @@ -0,0 +1,21 @@ +// Type definitions for ps-tree 1.1 +// Project: http://github.com/indexzero/ps-tree +// Definitions by: Alessio Paccoia +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare namespace ps_tree { + interface PS { + COMMAND: string; + PPID: string; + PID: string; + STAT: string; + } + + const prototype: { + }; +} + +declare function ps_tree(pid: number, callback: (error: Error, children: ReadonlyArray) => void): void; + +export as namespace ps_tree; +export = ps_tree; diff --git a/types/ps-tree/ps-tree-tests.ts b/types/ps-tree/ps-tree-tests.ts new file mode 100644 index 0000000000..308900e6e2 --- /dev/null +++ b/types/ps-tree/ps-tree-tests.ts @@ -0,0 +1,8 @@ +import * as ps_tree from "ps-tree"; + +ps_tree(1, (error: Error, children: ps_tree.PS[]) => { + children[0].COMMAND; // $ExpectType string + children[0].PID; // $ExpectType string + children[0].PPID; // $ExpectType string + children[0].STAT; // $ExpectType string +}); // $ExpectType void diff --git a/types/ps-tree/tsconfig.json b/types/ps-tree/tsconfig.json new file mode 100644 index 0000000000..b8a7b33b11 --- /dev/null +++ b/types/ps-tree/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "ps-tree-tests.ts" + ] +} diff --git a/types/ps-tree/tslint.json b/types/ps-tree/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/ps-tree/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From e943205cf93f0a7a77616215223c79872298cd7f Mon Sep 17 00:00:00 2001 From: Christian Rackerseder Date: Sun, 20 May 2018 13:16:02 +0200 Subject: [PATCH 259/575] Add definitons for loadjs --- types/loadjs/index.d.ts | 38 +++++++++++++++++++++++++++ types/loadjs/test/loadjs-tests.ts | 23 ++++++++++++++++ types/loadjs/test/loadjs-umd-tests.ts | 17 ++++++++++++ types/loadjs/tsconfig.json | 24 +++++++++++++++++ types/loadjs/tslint.json | 1 + 5 files changed, 103 insertions(+) create mode 100644 types/loadjs/index.d.ts create mode 100644 types/loadjs/test/loadjs-tests.ts create mode 100644 types/loadjs/test/loadjs-umd-tests.ts create mode 100644 types/loadjs/tsconfig.json create mode 100644 types/loadjs/tslint.json diff --git a/types/loadjs/index.d.ts b/types/loadjs/index.d.ts new file mode 100644 index 0000000000..c8e3fc0d80 --- /dev/null +++ b/types/loadjs/index.d.ts @@ -0,0 +1,38 @@ +// Type definitions for loadjs 3.5 +// Project: https://github.com/muicss/loadjs +// Definitions by: Christian Rackerseder +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export as namespace loadjs; + +export = loadjs; + +declare function loadjs(file: string, loaded: loadjs.LoadedFn): void; +declare function loadjs(files: string[], loaded: loadjs.LoadedFn): void; +declare function loadjs(files: string[], bundleId: string): void; +declare function loadjs(files: string[], bundleId: string, loaded: loadjs.LoadedFn): void; +declare function loadjs(files: string[], bundleId: string, options: loadjs.LoadOptions): void; + +declare namespace loadjs { + export type LoadedFn = () => void; + + export interface LoadOptions { + before?(path: string, scriptEl: string): void; + success?(): void; + error?(depsNotFound: string): void; + async?: boolean; + numRetries?: number; + } + + export interface ReadyOptions { + success?(): void; + error?(depsNotFound: string): void; + } + + export function ready(bundleId: string, callback: LoadedFn): void; + export function ready(bundleIds: string[], callback: LoadedFn): void; + export function ready(bundleId: string, options: ReadyOptions): void; + export function isDefined(bundleId: string): boolean; + export function done(bundleId: string): void; + export function reset(): void; +} diff --git a/types/loadjs/test/loadjs-tests.ts b/types/loadjs/test/loadjs-tests.ts new file mode 100644 index 0000000000..0168130361 --- /dev/null +++ b/types/loadjs/test/loadjs-tests.ts @@ -0,0 +1,23 @@ +import * as importedLoadJs from 'loadjs'; + +const loadOptions: importedLoadJs.LoadOptions = { + before: (path, scriptEl) => {}, + success: () => {}, + error: (pathsNotFound) => {}, + async: true, + numRetries: 3 +}; + +const readyOptions: importedLoadJs.ReadyOptions = { + success: () => {}, + error: (depsNotFound) => {}, +}; + +importedLoadJs('/path/to/foo.js', () => {}); +importedLoadJs(['/path/to/foo.js', '/path/to/bar.js'], () => {}); +importedLoadJs(['/path/to/foo.js', '/path/to/bar.js'], 'foobar'); +importedLoadJs.ready('foobar', () => {}); +importedLoadJs.ready(['foo', 'bar'], () => {}); +importedLoadJs.isDefined('foobar'); +importedLoadJs(['/path/to/foo.js', '/path/to/bar.js'], 'foobar', loadOptions); +importedLoadJs.ready('foobar', readyOptions); diff --git a/types/loadjs/test/loadjs-umd-tests.ts b/types/loadjs/test/loadjs-umd-tests.ts new file mode 100644 index 0000000000..1a35f04c43 --- /dev/null +++ b/types/loadjs/test/loadjs-umd-tests.ts @@ -0,0 +1,17 @@ +loadjs('/path/to/foo.js', () => {}); +loadjs(['/path/to/foo.js', '/path/to/bar.js'], () => {}); +loadjs(['/path/to/foo.js', '/path/to/bar.js'], 'foobar'); +loadjs.ready('foobar', () => {}); +loadjs.ready(['foo', 'bar'], () => {}); +loadjs.isDefined('foobar'); +loadjs(['/path/to/foo.js', '/path/to/bar.js'], 'foobar', { + before: (path, scriptEl) => {}, + success: () => {}, + error: (pathsNotFound) => {}, + async: true, + numRetries: 3 +}); +loadjs.ready('foobar', { + success: () => {}, + error: (depsNotFound) => {}, +}); diff --git a/types/loadjs/tsconfig.json b/types/loadjs/tsconfig.json new file mode 100644 index 0000000000..b60931cce6 --- /dev/null +++ b/types/loadjs/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 + }, + "files": [ + "index.d.ts", + "test/loadjs-tests.ts", + "test/loadjs-umd-tests.ts" + ] +} diff --git a/types/loadjs/tslint.json b/types/loadjs/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/loadjs/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From bf9421504a3f2c2c6cc51e67dbd0c612d2a8384a Mon Sep 17 00:00:00 2001 From: Alessio Paccoia Date: Sun, 20 May 2018 13:19:42 +0200 Subject: [PATCH 260/575] Fix tests and tsc --- types/ps-tree/index.d.ts | 2 +- types/ps-tree/ps-tree-tests.ts | 5 +++-- types/ps-tree/tsconfig.json | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/types/ps-tree/index.d.ts b/types/ps-tree/index.d.ts index 7dad700315..a915c9f547 100644 --- a/types/ps-tree/index.d.ts +++ b/types/ps-tree/index.d.ts @@ -10,7 +10,7 @@ declare namespace ps_tree { PID: string; STAT: string; } - + const prototype: { }; } diff --git a/types/ps-tree/ps-tree-tests.ts b/types/ps-tree/ps-tree-tests.ts index 308900e6e2..9af8b9f53c 100644 --- a/types/ps-tree/ps-tree-tests.ts +++ b/types/ps-tree/ps-tree-tests.ts @@ -1,8 +1,9 @@ import * as ps_tree from "ps-tree"; -ps_tree(1, (error: Error, children: ps_tree.PS[]) => { +ps_tree(1, () => {}); // $ExpectType void +ps_tree(1, (error: Error, children: ReadonlyArray) => { children[0].COMMAND; // $ExpectType string children[0].PID; // $ExpectType string children[0].PPID; // $ExpectType string children[0].STAT; // $ExpectType string -}); // $ExpectType void +}); diff --git a/types/ps-tree/tsconfig.json b/types/ps-tree/tsconfig.json index b8a7b33b11..4f3bd8dcfc 100644 --- a/types/ps-tree/tsconfig.json +++ b/types/ps-tree/tsconfig.json @@ -6,6 +6,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, + "strictFunctionTypes": true, "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ From eb594099352ddf5e8ba34a7765dfe4d4773c40a7 Mon Sep 17 00:00:00 2001 From: Ford Hurley Date: Sun, 20 May 2018 09:50:27 -0400 Subject: [PATCH 261/575] THREE.BufferGeometry.setFromPoints accepts Vector2s as well The documentation shows examples of this, e.g.: https://threejs.org/docs/#api/extras/curves/EllipseCurve The source code shows how it handles an array of either type: https://github.com/mrdoob/three.js/blob/2f2e5f731/src/core/BufferGeometry.js#L352 --- types/three/three-core.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/three/three-core.d.ts b/types/three/three-core.d.ts index a7f7950a48..216ceb18a7 100644 --- a/types/three/three-core.d.ts +++ b/types/three/three-core.d.ts @@ -873,7 +873,7 @@ export class BufferGeometry extends EventDispatcher { center(): BufferGeometry; setFromObject(object: Object3D): BufferGeometry; - setFromPoints(points: Vector3[]): BufferGeometry; + setFromPoints(points: Vector3[]|Vector2[]): BufferGeometry; updateFromObject(object: Object3D): void; fromGeometry(geometry: Geometry, settings?: any): BufferGeometry; From 7ebaf74cde2ff2dc199ff8923676e55bf7b21fe8 Mon Sep 17 00:00:00 2001 From: Christian Rackerseder Date: Sun, 20 May 2018 17:00:56 +0200 Subject: [PATCH 262/575] Fix linting errors --- types/loadjs/index.d.ts | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/types/loadjs/index.d.ts b/types/loadjs/index.d.ts index c8e3fc0d80..e68875e53a 100644 --- a/types/loadjs/index.d.ts +++ b/types/loadjs/index.d.ts @@ -2,21 +2,19 @@ // Project: https://github.com/muicss/loadjs // Definitions by: Christian Rackerseder // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 export as namespace loadjs; export = loadjs; -declare function loadjs(file: string, loaded: loadjs.LoadedFn): void; -declare function loadjs(files: string[], loaded: loadjs.LoadedFn): void; -declare function loadjs(files: string[], bundleId: string): void; -declare function loadjs(files: string[], bundleId: string, loaded: loadjs.LoadedFn): void; -declare function loadjs(files: string[], bundleId: string, options: loadjs.LoadOptions): void; +declare function loadjs(files: string | string[], bundleIdOrLoaded: string | loadjs.LoadedFn): void; +declare function loadjs(files: string[], bundleId: string, optionsOrCallback: loadjs.LoadOptions | loadjs.LoadedFn): void; declare namespace loadjs { - export type LoadedFn = () => void; + type LoadedFn = () => void; - export interface LoadOptions { + interface LoadOptions { before?(path: string, scriptEl: string): void; success?(): void; error?(depsNotFound: string): void; @@ -24,15 +22,13 @@ declare namespace loadjs { numRetries?: number; } - export interface ReadyOptions { + interface ReadyOptions { success?(): void; error?(depsNotFound: string): void; } - export function ready(bundleId: string, callback: LoadedFn): void; - export function ready(bundleIds: string[], callback: LoadedFn): void; - export function ready(bundleId: string, options: ReadyOptions): void; - export function isDefined(bundleId: string): boolean; - export function done(bundleId: string): void; - export function reset(): void; + function ready(bundleIds: string | string[], optionsOrCallback: ReadyOptions | LoadedFn): void; + function isDefined(bundleId: string): boolean; + function done(bundleId: string): void; + function reset(): void; } From b0ebc93ab3e4ad62c0a535a1c16383b9b73761a0 Mon Sep 17 00:00:00 2001 From: GlenCFL Date: Sun, 20 May 2018 11:07:44 -0400 Subject: [PATCH 263/575] [atom] support version 1.27 --- types/atom/atom-tests.ts | 68 +++++++++++++++++-- types/atom/index.d.ts | 142 ++++++++++++++++++++++----------------- 2 files changed, 143 insertions(+), 67 deletions(-) diff --git a/types/atom/atom-tests.ts b/types/atom/atom-tests.ts index 57420d5059..d6de0ef802 100644 --- a/types/atom/atom-tests.ts +++ b/types/atom/atom-tests.ts @@ -1327,6 +1327,8 @@ function testMarkerLayer() { markers = markerLayer.findMarkers({ containsRange: [[0, 0], pos] }); markers = markerLayer.findMarkers({ containsRange: [[0, 0], [0, 0]] }); + str = markerLayer.getRole(); + // Marker creation marker = markerLayer.markRange(range); marker = markerLayer.markRange([pos, pos]); @@ -1950,32 +1952,54 @@ function testSelection() { selection.insertText("Replacement", { autoDecreaseIndent: true }); selection.insertText("Replacement", { normalizeLineEndings: true }); selection.insertText("Replacement", { undo: "skip" }); + selection.insertText("Replacement", { bypassReadOnly: true }); selection.insertText("Replacement", { select: true, autoIndent: true, autoIndentNewline: true, autoDecreaseIndent: true, normalizeLineEndings: true, - undo: "skip", preserveTrailingLineIndentation: false }); + undo: "skip", preserveTrailingLineIndentation: false, bypassReadOnly: false }); selection.backspace(); + selection.backspace({ bypassReadOnly: true }); selection.deleteToPreviousWordBoundary(); + selection.deleteToPreviousWordBoundary({ bypassReadOnly: false }); selection.deleteToNextWordBoundary(); + selection.deleteToNextWordBoundary({ bypassReadOnly: true }); selection.deleteToBeginningOfWord(); + selection.deleteToBeginningOfWord({ bypassReadOnly: false }); selection.deleteToBeginningOfLine(); + selection.deleteToBeginningOfLine({ bypassReadOnly: true }); selection.delete(); + selection.delete({ bypassReadOnly: false }); selection.deleteToEndOfLine(); + selection.deleteToEndOfLine({ bypassReadOnly: true }); selection.deleteToEndOfWord(); + selection.deleteToEndOfWord({ bypassReadOnly: false }); selection.deleteToBeginningOfSubword(); + selection.deleteToBeginningOfSubword({ bypassReadOnly: true }); selection.deleteToEndOfSubword(); + selection.deleteToEndOfSubword({ bypassReadOnly: false }); selection.deleteSelectedText(); + selection.deleteSelectedText({ bypassReadOnly: true }); selection.deleteLine(); + selection.deleteLine({ bypassReadOnly: false }); selection.joinLines(); + selection.joinLines({ bypassReadOnly: true }); selection.outdentSelectedRows(); + selection.outdentSelectedRows({ bypassReadOnly: false }); selection.autoIndentSelectedRows(); + selection.autoIndentSelectedRows({ bypassReadOnly: true }); selection.toggleLineComments(); + selection.toggleLineComments({ bypassReadOnly: false }); selection.cutToEndOfLine(); + selection.cutToEndOfLine(true); + selection.cutToEndOfLine(undefined, { bypassReadOnly: true }); selection.cutToEndOfBufferLine(); + selection.cutToEndOfBufferLine(true); + selection.cutToEndOfBufferLine(false, { bypassReadOnly: false }); selection.cut(); selection.cut(true); selection.cut(true, true); + selection.cut(undefined, undefined, { bypassReadOnly: true }); selection.copy(); selection.copy(true); @@ -1983,6 +2007,7 @@ function testSelection() { selection.fold(); selection.indentSelectedRows(); + selection.indentSelectedRows({ bypassReadOnly: false }); // Managing multiple selections selection.addSelectionBelow(); @@ -2143,6 +2168,8 @@ function testTextBuffer() { num = nextRow; } + bool = buffer.hasAstral(); + // Mutating Text range = buffer.setText("Test"); buffer.setTextViaDiff("Test"); @@ -2232,9 +2259,13 @@ function testTextBuffer() { // History bool = buffer.undo(); + bool = buffer.undo({ selectionsMarkerLayer: markerLayer }); bool = buffer.redo(); + bool = buffer.redo({ selectionsMarkerLayer: markerLayer }); - num = buffer.transact(500, (): number => 42); + num = buffer.transact(500, (): number => 42); + num = buffer.transact({ groupingInterval: 500, selectionsMarkerLayer: markerLayer }, + (): number => 42); buffer.clearUndoStack(); num = buffer.createCheckpoint(); @@ -2434,6 +2465,8 @@ function testTextEditor() { // Mutating Text editor.setText("Test"); + editor.setText("Test", {}); + editor.setText("Text", { bypassReadOnly: true }); range = editor.setTextInBufferRange(range, "Test"); range = editor.setTextInBufferRange([pos, pos], "Test"); @@ -2443,7 +2476,7 @@ function testTextEditor() { range = editor.setTextInBufferRange(range, "Test", {}); range = editor.setTextInBufferRange([pos, pos], "Test", { normalizeLineEndings: true }); range = editor.setTextInBufferRange(range, "Test", { normalizeLineEndings: true, - undo: "skip" }); + undo: "skip", bypassReadOnly: false }); editor.insertText("Test"); editor.insertText("Test", {}); @@ -2455,27 +2488,45 @@ function testTextEditor() { editor.insertText("Test", { undo: "skip" }); editor.insertText("Text", { autoDecreaseIndent: false, autoIndent: false, autoIndentNewline: false, normalizeLineEndings: false, select: false, - undo: "skip", preserveTrailingLineIndentation: true }); + undo: "skip", preserveTrailingLineIndentation: true, bypassReadOnly: true }); editor.insertNewline(); + editor.insertNewline({ bypassReadOnly: false }); editor.delete(); + editor.delete({ bypassReadOnly: true }); editor.backspace(); + editor.backspace({ bypassReadOnly: false }); editor.mutateSelectedText((selection, index) => { selection.clear(); }); editor.transpose(); + editor.transpose({ bypassReadOnly: true }); editor.upperCase(); + editor.upperCase({ bypassReadOnly: false }); editor.lowerCase(); + editor.lowerCase({ bypassReadOnly: true }); editor.toggleLineCommentsInSelection(); + editor.toggleLineCommentsInSelection({ bypassReadOnly: false }); editor.insertNewlineBelow(); + editor.insertNewlineBelow({ bypassReadOnly: true }); editor.insertNewlineAbove(); + editor.insertNewlineAbove({ bypassReadOnly: false }); editor.deleteToBeginningOfWord(); + editor.deleteToBeginningOfWord({ bypassReadOnly: true }); editor.deleteToPreviousWordBoundary(); + editor.deleteToPreviousWordBoundary({ bypassReadOnly: false }); editor.deleteToNextWordBoundary(); + editor.deleteToNextWordBoundary({ bypassReadOnly: true }); editor.deleteToBeginningOfSubword(); + editor.deleteToBeginningOfSubword({ bypassReadOnly: false }); editor.deleteToEndOfSubword(); + editor.deleteToEndOfSubword({ bypassReadOnly: true }); editor.deleteToBeginningOfLine(); + editor.deleteToBeginningOfLine({ bypassReadOnly: false }); editor.deleteToEndOfLine(); + editor.deleteToEndOfLine({ bypassReadOnly: true }); editor.deleteToEndOfWord(); + editor.deleteToEndOfWord({ bypassReadOnly: false }); editor.deleteLine(); + editor.deleteLine({ bypassReadOnly: true }); // History editor.undo(); @@ -2923,9 +2974,12 @@ function testTextEditor() { editor.setIndentationForBufferRow(42, 42, { preserveLeadingWhitespace: true }); editor.indentSelectedRows(); + editor.indentSelectedRows({ bypassReadOnly: false }); editor.outdentSelectedRows(); + editor.outdentSelectedRows({ bypassReadOnly: true }); num = editor.indentLevelForLine("Test"); editor.autoIndentSelectedRows(); + editor.autoIndentSelectedRows({ bypassReadOnly: false }); // Grammars grammar = editor.getGrammar(); @@ -2942,6 +2996,7 @@ function testTextEditor() { // Clipboard Operations editor.copySelectedText(); editor.cutSelectedText(); + editor.cutSelectedText({ bypassReadOnly: true }); editor.pasteText(); editor.pasteText({}); @@ -2951,11 +3006,14 @@ function testTextEditor() { editor.pasteText({ normalizeLineEndings: true }); editor.pasteText({ select: true }); editor.pasteText({ undo: "skip" }); + editor.pasteText({ bypassReadOnly: false }); editor.pasteText({ autoIndentNewline: true, autoIndent: true, autoDecreaseIndent: true, - normalizeLineEndings: true, select: true, undo: "skip" }); + normalizeLineEndings: true, select: true, undo: "skip", bypassReadOnly: true }); editor.cutToEndOfLine(); + editor.cutToEndOfLine({ bypassReadOnly: false }); editor.cutToEndOfBufferLine(); + editor.cutToEndOfBufferLine({ bypassReadOnly: true }); // Folds editor.foldCurrentRow(); diff --git a/types/atom/index.d.ts b/types/atom/index.d.ts index 3cee95ace5..77b79fbed2 100644 --- a/types/atom/index.d.ts +++ b/types/atom/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Atom 1.26 +// Type definitions for Atom 1.27 // Project: https://github.com/atom/atom // Definitions by: GlenCFL // smhxx @@ -7,7 +7,7 @@ // TypeScript Version: 2.3 // NOTE: only those classes exported within this file should be retain that status below. -// https://github.com/atom/atom/blob/v1.26.0/exports/atom.js +// https://github.com/atom/atom/blob/v1.27.0/exports/atom.js /// @@ -1004,6 +1004,9 @@ export interface MarkerLayer { /** Find markers in the layer conforming to the given parameters. */ findMarkers(params: FindMarkerOptions): Marker[]; + /** Get the role of the marker layer e.g. "atom.selection". */ + getRole(): string; + // Marker Creation /** Create a marker with the given range. */ markRange(range: RangeCompatible, options?: { reversed?: boolean, invalidate?: @@ -1525,29 +1528,29 @@ export class TextEditor { // Mutating Text /** Replaces the entire contents of the buffer with the given string. */ - setText(text: string): void; + setText(text: string, options?: ReadonlyEditOptions): void; /** Set the text in the given Range in buffer coordinates. */ setTextInBufferRange(range: RangeCompatible, text: string, options?: - TextEditOptions): Range; + TextEditOptions & ReadonlyEditOptions): Range; /* For each selection, replace the selected text with the given text. */ - insertText(text: string, options?: TextInsertionOptions): Range|false; + insertText(text: string, options?: TextInsertionOptions & ReadonlyEditOptions): Range|false; /** For each selection, replace the selected text with a newline. */ - insertNewline(): void; + insertNewline(options?: ReadonlyEditOptions): void; /** * For each selection, if the selection is empty, delete the character following * the cursor. Otherwise delete the selected text. */ - delete(): void; + delete(options?: ReadonlyEditOptions): void; /** * For each selection, if the selection is empty, delete the character preceding * the cursor. Otherwise delete the selected text. */ - backspace(): void; + backspace(options?: ReadonlyEditOptions): void; /** * Mutate the text of all the selections in a single transaction. @@ -1561,89 +1564,89 @@ export class TextEditor { * If the selection is empty, the characters preceding and following the cursor * are swapped. Otherwise, the selected characters are reversed. */ - transpose(): void; + transpose(options?: ReadonlyEditOptions): void; /** * Convert the selected text to upper case. * For each selection, if the selection is empty, converts the containing word * to upper case. Otherwise convert the selected text to upper case. */ - upperCase(): void; + upperCase(options?: ReadonlyEditOptions): void; /** * Convert the selected text to lower case. * For each selection, if the selection is empty, converts the containing word * to upper case. Otherwise convert the selected text to upper case. */ - lowerCase(): void; + lowerCase(options?: ReadonlyEditOptions): void; /** * Toggle line comments for rows intersecting selections. * If the current grammar doesn't support comments, does nothing. */ - toggleLineCommentsInSelection(): void; + toggleLineCommentsInSelection(options?: ReadonlyEditOptions): void; /** For each cursor, insert a newline at beginning the following line. */ - insertNewlineBelow(): void; + insertNewlineBelow(options?: ReadonlyEditOptions): void; /** For each cursor, insert a newline at the end of the preceding line. */ - insertNewlineAbove(): void; + insertNewlineAbove(options?: ReadonlyEditOptions): void; /** * For each selection, if the selection is empty, delete all characters of the * containing word that precede the cursor. Otherwise delete the selected text. */ - deleteToBeginningOfWord(): void; + deleteToBeginningOfWord(options?: ReadonlyEditOptions): void; /** * Similar to ::deleteToBeginningOfWord, but deletes only back to the previous * word boundary. */ - deleteToPreviousWordBoundary(): void; + deleteToPreviousWordBoundary(options?: ReadonlyEditOptions): void; /** Similar to ::deleteToEndOfWord, but deletes only up to the next word boundary. */ - deleteToNextWordBoundary(): void; + deleteToNextWordBoundary(options?: ReadonlyEditOptions): void; /** * For each selection, if the selection is empty, delete all characters of the * containing subword following the cursor. Otherwise delete the selected text. */ - deleteToBeginningOfSubword(): void; + deleteToBeginningOfSubword(options?: ReadonlyEditOptions): void; /** * For each selection, if the selection is empty, delete all characters of the * containing subword following the cursor. Otherwise delete the selected text. */ - deleteToEndOfSubword(): void; + deleteToEndOfSubword(options?: ReadonlyEditOptions): void; /** * For each selection, if the selection is empty, delete all characters of the * containing line that precede the cursor. Otherwise delete the selected text. */ - deleteToBeginningOfLine(): void; + deleteToBeginningOfLine(options?: ReadonlyEditOptions): void; /** * For each selection, if the selection is not empty, deletes the selection * otherwise, deletes all characters of the containing line following the cursor. * If the cursor is already at the end of the line, deletes the following newline. */ - deleteToEndOfLine(): void; + deleteToEndOfLine(options?: ReadonlyEditOptions): void; /** * For each selection, if the selection is empty, delete all characters of the * containing word following the cursor. Otherwise delete the selected text. */ - deleteToEndOfWord(): void; + deleteToEndOfWord(options?: ReadonlyEditOptions): void; /** Delete all lines intersecting selections. */ - deleteLine(): void; + deleteLine(options?: ReadonlyEditOptions): void; // History /** Undo the last change. */ - undo(): void; + undo(options?: ReadonlyEditOptions): void; /** Redo the last change. */ - redo(): void; + redo(options?: ReadonlyEditOptions): void; /** * Batch multiple operations as a single undo/redo step. @@ -2284,10 +2287,10 @@ export class TextEditor { { preserveLeadingWhitespace?: boolean }): void; /** Indent rows intersecting selections by one level. */ - indentSelectedRows(): void; + indentSelectedRows(options?: ReadonlyEditOptions): void; /** Outdent rows intersecting selections by one level. */ - outdentSelectedRows(): void; + outdentSelectedRows(options?: ReadonlyEditOptions): void; /** * Get the indentation level of the given line of text. @@ -2298,7 +2301,7 @@ export class TextEditor { indentLevelForLine(line: string): number; /** Indent rows intersecting selections based on the grammar's suggested indent level. */ - autoIndentSelectedRows(): void; + autoIndentSelectedRows(options?: ReadonlyEditOptions): void; // Grammars /** Get the current Grammar of this editor. */ @@ -2328,7 +2331,7 @@ export class TextEditor { copySelectedText(): void; /** For each selection, cut the selected text. */ - cutSelectedText(): void; + cutSelectedText(options?: ReadonlyEditOptions): void; /** * For each selection, replace the selected text with the contents of the clipboard. @@ -2336,19 +2339,19 @@ export class TextEditor { * each selection will be replaced with the content of the corresponding clipboard * selection text. */ - pasteText(options?: TextInsertionOptions): void; + pasteText(options?: TextInsertionOptions & ReadonlyEditOptions): void; /** * For each selection, if the selection is empty, cut all characters of the * containing screen line following the cursor. Otherwise cut the selected text. */ - cutToEndOfLine(): void; + cutToEndOfLine(options?: ReadonlyEditOptions): void; /** * For each selection, if the selection is empty, cut all characters of the * containing buffer line following the cursor. Otherwise cut the selected text. */ - cutToEndOfBufferLine(): void; + cutToEndOfBufferLine(options?: ReadonlyEditOptions): void; // Folds /** @@ -3322,7 +3325,7 @@ export class Directory { /** Returns a boolean, always false. */ isFile(): this is File; - /** Returns a roolean, always true. */ + /** Returns a boolean, always true. */ isDirectory(): this is Directory; /** Returns a boolean indicating whether or not this is a symbolic link. */ @@ -4716,107 +4719,107 @@ export interface Selection { // Modifying the selected text /** Replaces text at the current selection. */ - insertText(text: string, options?: TextInsertionOptions): void; + insertText(text: string, options?: TextInsertionOptions & ReadonlyEditOptions): void; /** * Removes the first character before the selection if the selection is empty * otherwise it deletes the selection. */ - backspace(): void; + backspace(options?: ReadonlyEditOptions): void; /** * Removes the selection or, if nothing is selected, then all characters from * the start of the selection back to the previous word boundary. */ - deleteToPreviousWordBoundary(): void; + deleteToPreviousWordBoundary(options?: ReadonlyEditOptions): void; /** * Removes the selection or, if nothing is selected, then all characters from * the start of the selection up to the next word boundary. */ - deleteToNextWordBoundary(): void; + deleteToNextWordBoundary(options?: ReadonlyEditOptions): void; /** * Removes from the start of the selection to the beginning of the current * word if the selection is empty otherwise it deletes the selection. */ - deleteToBeginningOfWord(): void; + deleteToBeginningOfWord(options?: ReadonlyEditOptions): void; /** * Removes from the beginning of the line which the selection begins on all * the way through to the end of the selection. */ - deleteToBeginningOfLine(): void; + deleteToBeginningOfLine(options?: ReadonlyEditOptions): void; /** * Removes the selection or the next character after the start of the selection * if the selection is empty. */ - delete(): void; + delete(options?: ReadonlyEditOptions): void; /** * If the selection is empty, removes all text from the cursor to the end of * the line. If the cursor is already at the end of the line, it removes the following * newline. If the selection isn't empty, only deletes the contents of the selection. */ - deleteToEndOfLine(): void; + deleteToEndOfLine(options?: ReadonlyEditOptions): void; /** * Removes the selection or all characters from the start of the selection to * the end of the current word if nothing is selected. */ - deleteToEndOfWord(): void; + deleteToEndOfWord(options?: ReadonlyEditOptions): void; /** * Removes the selection or all characters from the start of the selection to * the end of the current word if nothing is selected. */ - deleteToBeginningOfSubword(): void; + deleteToBeginningOfSubword(options?: ReadonlyEditOptions): void; /** * Removes the selection or all characters from the start of the selection to * the end of the current word if nothing is selected. */ - deleteToEndOfSubword(): void; + deleteToEndOfSubword(options?: ReadonlyEditOptions): void; /** Removes only the selected text. */ - deleteSelectedText(): void; + deleteSelectedText(options?: ReadonlyEditOptions): void; /** * Removes the line at the beginning of the selection if the selection is empty * unless the selection spans multiple lines in which case all lines are removed. */ - deleteLine(): void; + deleteLine(options?: ReadonlyEditOptions): void; /** * Joins the current line with the one below it. Lines will be separated by a single space. * If there selection spans more than one line, all the lines are joined together. */ - joinLines(): void; + joinLines(options?: ReadonlyEditOptions): void; /** Removes one level of indent from the currently selected rows. */ - outdentSelectedRows(): void; + outdentSelectedRows(options?: ReadonlyEditOptions): void; /** * Sets the indentation level of all selected rows to values suggested by the * relevant grammars. */ - autoIndentSelectedRows(): void; + autoIndentSelectedRows(options?: ReadonlyEditOptions): void; /** * Wraps the selected lines in comments if they aren't currently part of a comment. * Removes the comment if they are currently wrapped in a comment. */ - toggleLineComments(): void; + toggleLineComments(options?: ReadonlyEditOptions): void; /** Cuts the selection until the end of the screen line. */ - cutToEndOfLine(): void; + cutToEndOfLine(maintainClipboard?: boolean, options?: ReadonlyEditOptions): void; /** Cuts the selection until the end of the buffer line. */ - cutToEndOfBufferLine(): void; + cutToEndOfBufferLine(maintainClipboard?: boolean, options?: ReadonlyEditOptions): void; /** Copies the selection to the clipboard and then deletes it. */ - cut(maintainClipboard?: boolean, fullLine?: boolean): void; + cut(maintainClipboard?: boolean, fullLine?: boolean, options?: ReadonlyEditOptions): void; /** Copies the current selection to the clipboard. */ copy(maintainClipboard?: boolean, fullLine?: boolean): void; @@ -4825,7 +4828,7 @@ export interface Selection { fold(): void; /** If the selection spans multiple rows, indent all of them. */ - indentSelectedRows(): void; + indentSelectedRows(options?: ReadonlyEditOptions): void; // Managing multiple selections /** Moves the selection down one row. */ @@ -5134,6 +5137,12 @@ export class TextBuffer { */ nextNonBlankRow(startRow: number): number|null; + /** + * Return true if the buffer contains any astral-plane Unicode characters that + * are encoded as surrogate pairs. + */ + hasAstral(): boolean; + // Mutating Text /** Replace the entire contents of the buffer with the given text. */ setText(text: string): Range; @@ -5172,7 +5181,7 @@ export class TextBuffer { // Markers /** Create a layer to contain a set of related markers. */ - addMarkerLayer(options?: { maintainHistory?: boolean, persistent?: boolean }): + addMarkerLayer(options?: { maintainHistory?: boolean, persistent?: boolean, role?: string }): MarkerLayer; /** @@ -5210,16 +5219,18 @@ export class TextBuffer { * Undo the last operation. If a transaction is in progress, aborts it. * @return A boolean of whether or not a change was made. */ - undo(): boolean; + undo(options?: { selectionsMarkerLayer?: MarkerLayer }): boolean; /** * Redo the last operation. * @return A boolean of whether or not a change was made. */ - redo(): boolean; + redo(options?: { selectionsMarkerLayer?: MarkerLayer }): boolean; /** Batch multiple operations as a single undo/redo step. */ - transact(groupingInterval: number, fn: () => T): T; + transact(optionsOrInterval: number | { groupingInterval?: number, + selectionsMarkerLayer?: MarkerLayer }, fn: () => T): T; + /** Batch multiple operations as a single undo/redo step. */ transact(fn: () => T): T; /** @@ -5237,20 +5248,22 @@ export class TextBuffer { * `::revertToCheckpoint` and `::groupChangesSinceCheckpoint`. * @return A checkpoint ID value. */ - createCheckpoint(): number; + createCheckpoint(options?: { selectionsMarkerLayer?: MarkerLayer }): number; /** * Revert the buffer to the state it was in when the given checkpoint was created. * @return A boolean indicating whether the operation succeeded. */ - revertToCheckpoint(checkpoint: number): boolean; + revertToCheckpoint(checkpoint: number, options?: { selectionsMarkerLayer: MarkerLayer }): + boolean; /** * Group all changes since the given checkpoint into a single transaction for * purposes of undo/redo. * @return A boolean indicating whether the operation succeeded. */ - groupChangesSinceCheckpoint(checkpoint: number): boolean; + groupChangesSinceCheckpoint(checkpoint: number, options?: + { selectionsMarkerLayer: MarkerLayer }): boolean; /** * Group the last two text changes for purposes of undo/redo. @@ -5828,7 +5841,7 @@ export interface TextEditorObservedEvent { // information under certain contexts. // NOTE: the config schema with these defaults can be found here: -// https://github.com/atom/atom/blob/v1.26.0/src/config-schema.js +// https://github.com/atom/atom/blob/v1.27.0/src/config-schema.js /** * Allows you to strongly type Atom configuration variables. Additional key:value * pairings merged into this interface will result in configuration values under @@ -6413,6 +6426,11 @@ export interface ProcessOptions extends NodeProcessOptions { autoStart?: boolean; } +export interface ReadonlyEditOptions { + /** Whether the readonly protections on the text editor should be ignored. */ + bypassReadOnly?: boolean; +} + export interface ScanContextOptions { /** The number of lines before the matched line to include in the results object. */ leadingContextLineCount?: number; From 18b3cf6e7412f754bf9f43c4d44e149c74f50c6b Mon Sep 17 00:00:00 2001 From: AndersonFriaca Date: Sun, 20 May 2018 15:51:51 -0400 Subject: [PATCH 264/575] Types for JQuery Slugify --- types/jquery-slugify/index.d.ts | 33 ++++++++++++++++++++ types/jquery-slugify/jquery-slugify-tests.ts | 7 +++++ types/jquery-slugify/tsconfig.json | 25 +++++++++++++++ types/jquery-slugify/tslint.json | 1 + 4 files changed, 66 insertions(+) create mode 100644 types/jquery-slugify/index.d.ts create mode 100644 types/jquery-slugify/jquery-slugify-tests.ts create mode 100644 types/jquery-slugify/tsconfig.json create mode 100644 types/jquery-slugify/tslint.json diff --git a/types/jquery-slugify/index.d.ts b/types/jquery-slugify/index.d.ts new file mode 100644 index 0000000000..2bb0da56e1 --- /dev/null +++ b/types/jquery-slugify/index.d.ts @@ -0,0 +1,33 @@ +// Type definitions for jquery-slugify 1.2 +// Project: https://github.com/madflow/jquery-slugify +// Definitions by: Anderson Friaça +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +/// + +export type Options = Partial<{ + preSlug: ((source: string) => string); + postSlug: ((source: string) => string); + slugFunc: ((input: string, options: Options) => string); + separator: string; + lang: string | boolean; + symbols: boolean; + maintainCase: boolean; + titleCase: string[] | boolean; + truncate: number; + uric: boolean; + uricNoSlash: boolean; + mark: boolean; + custom: string[]; +}>; + +declare global { + interface JQuery { + slugify(source: string, options?: Options): JQuery; + } + + interface JQueryStatic { + slugify(source: string, options?: Options): string; + } +} diff --git a/types/jquery-slugify/jquery-slugify-tests.ts b/types/jquery-slugify/jquery-slugify-tests.ts new file mode 100644 index 0000000000..af19a4b635 --- /dev/null +++ b/types/jquery-slugify/jquery-slugify-tests.ts @@ -0,0 +1,7 @@ +$.slugify("jquery slugify"); + +$('#slug-target').slugify('#slug-source'); + +$("#slug-target").slugify("#slug-source", { + separator: '_' +}); diff --git a/types/jquery-slugify/tsconfig.json b/types/jquery-slugify/tsconfig.json new file mode 100644 index 0000000000..1b5b101efc --- /dev/null +++ b/types/jquery-slugify/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "esModuleInterop": true + }, + "files": [ + "index.d.ts", + "jquery-slugify-tests.ts" + ] +} \ No newline at end of file diff --git a/types/jquery-slugify/tslint.json b/types/jquery-slugify/tslint.json new file mode 100644 index 0000000000..d04fe2e1fa --- /dev/null +++ b/types/jquery-slugify/tslint.json @@ -0,0 +1 @@ +{"extends": "dtslint/dt.json"} \ No newline at end of file From 8f6bd06104b6512e9820145454ed241ea56ea664 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tarnay=20K=C3=A1lm=C3=A1n?= Date: Sun, 20 May 2018 21:54:47 +0200 Subject: [PATCH 265/575] [react-aria-menubutton] onSelection is optional since 5.1.1 no other api changes since 5.0 according to the project's change log --- types/react-aria-menubutton/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/react-aria-menubutton/index.d.ts b/types/react-aria-menubutton/index.d.ts index 52a77e7435..6866719f3c 100644 --- a/types/react-aria-menubutton/index.d.ts +++ b/types/react-aria-menubutton/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-aria-menubutton 5.0 +// Type definitions for react-aria-menubutton 5.1.1 // Project: https://github.com/davidtheclark/react-aria-menubutton // Definitions by: Muhammad Fawwaz Orabi // Chris Rohlfs @@ -19,7 +19,7 @@ export interface WrapperProps * It will be passed the value of the selected `MenuItem` and * the React `SyntheticEvent`. */ - onSelection(value: any, event: React.SyntheticEvent): any; + onSelection?(value: any, event: React.SyntheticEvent): any; /** * A callback to run when the menu is opened or closed. From eb62b43bcfe2a1ec98c99dc2224d7fe23f3c7e5d Mon Sep 17 00:00:00 2001 From: Karim Alibhai Date: Sun, 20 May 2018 16:07:19 -0400 Subject: [PATCH 266/575] Fix: loopback async function types --- types/loopback/index.d.ts | 653 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 620 insertions(+), 33 deletions(-) diff --git a/types/loopback/index.d.ts b/types/loopback/index.d.ts index 087ce2aadd..05a3730d79 100644 --- a/types/loopback/index.d.ts +++ b/types/loopback/index.d.ts @@ -18,6 +18,13 @@ import { NextFunction, RequestHandler } from "express"; declare function l(): l.LoopBackApplication; declare namespace l { + /** + * General type for a callback to an async function. + */ + type CallbackWithoutResult = (err: Error | null) => any + type CallbackWithResult = (err: Error | null, result: T) => any + type CallbackWithMultipleResults = (err: Error | null, arg0: T, arg1: G) => any + /** * The `App` object represents a Loopback application * The App object extends [Express](expressjs.com/api.html#express) and @@ -1183,7 +1190,16 @@ declare namespace l { * @param {any} options An optional options object to pass to underlying data-access calls. * @param {() => void} callback Callback function */ - static bulkUpdate(updates: any[], options: any, callback?: () => void): Promise | void; + static bulkUpdate(updates: any[], options: any, callback: CallbackWithoutResult): void; + + /** + * Apply an update list + * **Note: this is not atomic* + * @param {Array} updates An updates list, usually from [createUpdates()](#persistedmodel-createupdates). + * @param {any} options An optional options object to pass to underlying data-access calls. + * @param {() => void} callback Callback function + */ + static bulkUpdate(updates: any[], options: any): Promise; /** * Get the changes to a model since the specified checkpoint. Provide a filter object @@ -1194,13 +1210,29 @@ declare namespace l { * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). * @param {Array} changes An Array of [Change](#change) objects */ - static changes(since: number, filter: any, callback?: (err: Error, changes: any[]) => void): Promise | void; + static changes(since: number, filter: any, callback: CallbackWithResult): void; + + /** + * Get the changes to a model since the specified checkpoint. Provide a filter object + * to reduce the number of results returned. + * @param {number} since Return only changes since this checkpoint. + * @param {any} filter Include only changes that match this filter, the same as for [#persistedmodel-find](find()). + * @callback {() => void} callback Callback function called with `(err, changes)` arguments. + * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). + * @param {Array} changes An Array of [Change](#change) objects + */ + static changes(since: number, filter: any): Promise; /** * Create a checkpoint * @param {() => void} callback */ - static checkpoint(callback?: () => void): Promise | void; + static checkpoint(callback?: () => void): void; + + /** + * Create a checkpoint + */ + static checkpoint(): Promise; /** * Return the number of records that match the optional "where" filter. @@ -1214,7 +1246,21 @@ declare namespace l { * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). * @param {number} count number of instances updated */ - static count(where?: any, callback?: (err: Error, count: number) => void): Promise | void; + static count(where: any, callback: CallbackWithResult): void; + + /** + * Return the number of records that match the optional "where" filter. + * @param {any} [where] Optional where filter, like + * ``` + * { key: val, key2: {gt: 'val2'}, ...} + * ``` + *
See + * [Where filter](docs.strongloop.com/display/LB/Where+filter#Wherefilter-Whereclauseforothermethods). + * @callback {() => void} callback Callback function called with `(err, count)` arguments. Required. + * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). + * @param {number} count number of instances updated + */ + static count(where?: any): Promise; /** * Create new instance of Model, and save to database @@ -1223,14 +1269,28 @@ declare namespace l { * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). * @param {any} models Model instances or null */ - static create(data?: any|any[], callback?: (err: Error, models: T|T[]) => void): Promise | void; + static create(data: any | any[], callback: CallbackWithResult): void; + + /** + * Create new instance of Model, and save to database + * @param {any}|[{any}] data Optional data argument. Can be either a single model instance or an Array of instances + * @returns {T | T[]} Model instances or null + */ + static create(data?: any|any[]): Promise; /** * Create a change stream. See here for more info http://loopback.io/doc/en/lb2/Realtime-server-sent-events.html * @param {any} options Only changes to models matching this where filter will be included in the ChangeStream. * @param {() => void} callback */ - static createChangeStream(options: {where: any}, callback?: (err: Error, changes: any) => void): Promise | void; + static createChangeStream(options: {where: any}, callback: CallbackWithResult): void; + + /** + * Create a change stream. See here for more info http://loopback.io/doc/en/lb2/Realtime-server-sent-events.html + * @param {any} options Only changes to models matching this where filter will be included in the ChangeStream. + * @returns {any} changes + */ + static createChangeStream(options: {where: any}): Promise; /** * Create an update list (for `Model.bulkUpdate()`) from a delta list @@ -1238,7 +1298,14 @@ declare namespace l { * @param {Array} deltas * @param {() => void} callback */ - static createUpdates(deltas: any[], callback?: () => void): Promise | void; + static createUpdates(deltas: any[], callback: CallbackWithoutResult): void; + + /** + * Create an update list (for `Model.bulkUpdate()`) from a delta list + * (result of `Change.diff()`) + * @param {Array} deltas + */ + static createUpdates(deltas: any[]): Promise; /** * Get the current checkpoint ID @@ -1246,7 +1313,13 @@ declare namespace l { * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). * @param {number} currentCheckpointId Current checkpoint ID */ - static currentCheckpoint(callback?: (err: Error, currentCheckpointId: number) => void): Promise | void; + static currentCheckpoint(callback: CallbackWithResult): void; + + /** + * Get the current checkpoint ID + * @returns {Promise} resolves to currentCheckpointId + */ + static currentCheckpoint(): Promise; /** * Destroy all model instances that match the optional `where` specification @@ -1262,7 +1335,20 @@ declare namespace l { * @param {any} info Additional information about the command outcome. * @param {number} info.count number of instances (rows, documents) destroyed */ - static destroyAll(where?: any, callback?: (err: Error, info: any, infoCount: number) => void): Promise<{ info: any, infoCount: number}> | void; + static destroyAll(where: any, callback: CallbackWithMultipleResults): void; + + /** + * Destroy all model instances that match the optional `where` specification + * @param {any} [where] Optional where filter, like: + * ``` + * {key: val, key2: {gt: 'val2'}, ...} + * ``` + *
See + * [Where filter](docs.strongloop.com/display/LB/Where+filter#Wherefilter-Whereclauseforothermethods) + * + * @returns {Promise<{ count: number }>} number of instances (rows, documents) destroyed + */ + static destroyAll(where?: any): Promise<{ info: any, infoCount: number}>; /** * Destroy model instance with the specified ID. @@ -1270,7 +1356,13 @@ declare namespace l { * @callback {() => void} callback Callback function called with `(err)` arguments. Required. * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object) */ - static destroyById(id: any, callback?: (err: Error) => void): Promise | void; + static destroyById(id: any, callback: CallbackWithoutResult): void; + + /** + * Destroy model instance with the specified ID. + * @param {*} id The ID value of model instance to delete. + */ + static destroyById(id: any): Promise; /** * Get a set of deltas and conflicts since the given checkpoint @@ -1281,7 +1373,15 @@ declare namespace l { * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). * @param {any} result any with `deltas` and `conflicts` properties; see [Change.diff()](#change-diff) for details */ - static diff(since: number, remoteChanges: any[], callback?: (err: Error, result: any) => void): Promise | void; + static diff(since: number, remoteChanges: any[], callback: CallbackWithResult): void; + + /** + * Get a set of deltas and conflicts since the given checkpoint + * See [Change.diff()](#change-diff) for details + * @param {number} since Find deltas since this checkpoint. + * @param {Array} remoteChanges An Array of change objects. + */ + static diff(since: number, remoteChanges: any[]): Promise; /** * Enable the tracking of changes made to the model. Usually for replication. @@ -1295,7 +1395,24 @@ declare namespace l { * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). * @param {boolean} exists True if the instance with the specified ID exists; false otherwise */ - static exists(id: any, callback?: (err: Error, exists: boolean) => void): Promise | void; + static exists(id: any, callback: CallbackWithResult): void; + + /** + * Check whether a model instance exists in database + * @param {id} id Identifier of object (primary key value) + */ + static exists(id: any): Promise; + + /** + * Find all model instances that match `filter` specification. + * See [Querying models](docs.strongloop.com/display/LB/Querying+models) + * @callback {() => void} callback Callback function called with `(err, returned-instances)` arguments. Required. + * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). + * @param {Array} models Model instances matching the filter, or null if none found + */ + static find( + callback: CallbackWithResult + ): void; /** * Find all model instances that match `filter` specification. @@ -1322,8 +1439,60 @@ declare namespace l { * @param {Array} models Model instances matching the filter, or null if none found */ static find( - filter?: {fields?: string|any|any[]; include?: string|any|any[]; limit?: number; order?: string; skip?: number; where?: any; }, - callback?: (err: Error, models: any[]) => void): Promise | void; + filter: { + fields?: string|any|any[]; + include?: string|any|any[]; + limit?: number; + order?: string; + skip?: number; + where?: any; + }, + callback: CallbackWithResult + ): void; + + /** + * Find all model instances that match `filter` specification. + * See [Querying models](docs.strongloop.com/display/LB/Querying+models) + * @options {any} [filter] Optional Filter JSON object; see below. + * @property {string|any|Array} fields Identify fields to include in return result. + *
See [Fields filter](docs.strongloop.com/display/LB/Fields+filter). + * @property {string|any|Array} include See PersistedModel.include documentation. + *
See [Include filter](docs.strongloop.com/display/LB/Include+filter). + * @property {number} limit Maximum number of instances to return. + *
See [Limit filter](docs.strongloop.com/display/LB/Limit+filter). + * @property {string} order Sort order: either "ASC" for ascending or "DESC" for descending. + *
See [Order filter](docs.strongloop.com/display/LB/Order+filter). + * @property {number} skip number of results to skip. + *
See [Skip filter](docs.strongloop.com/display/LB/Skip+filter). + * @property {any} where Where clause, like + * ``` + * { where: { key: val, key2: {gt: 'val2'}, ...} } + * ``` + *
See + * [Where filter](docs.strongloop.com/display/LB/Where+filter#Wherefilter-Whereclauseforqueries) + */ + static find( + filter?: { + fields?: string|any|any[]; + include?: string|any|any[]; + limit?: number; + order?: string; + skip?: number; + where?: any; + } + ): Promise; + + /** + * Find object by ID with an optional filter for include/fields + * @param {*} id Primary key value + * @callback {() => void} callback Callback function called with `(err, instance)` arguments. Required. + * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). + * @param {any} instance Model instance matching the specified ID or null if no instance matches + */ + static findById( + id: any, + callback: CallbackWithResult + ): void; /** * Find object by ID with an optional filter for include/fields @@ -1337,7 +1506,43 @@ declare namespace l { * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). * @param {any} instance Model instance matching the specified ID or null if no instance matches */ - static findById(id: any, filter?: {fields?: string|any|any[]; include?: string|any|any[]; }, callback?: (err: Error, instance: T) => void): Promise | void; + static findById( + id: any, + filter: { + fields?: string|any|any[]; + include?: string|any|any[]; + }, + callback: CallbackWithResult + ): void; + + /** + * Find object by ID with an optional filter for include/fields + * @param {*} id Primary key value + * @options {any} [filter] Optional Filter JSON object; see below. + * @property {string|any|Array} fields Identify fields to include in return result. + *
See [Fields filter](docs.strongloop.com/display/LB/Fields+filter). + * @property {string|any|Array} include See PersistedModel.include documentation. + *
See [Include filter](docs.strongloop.com/display/LB/Include+filter). + */ + static findById( + id: any, + filter?: { + fields?: string|any|any[]; + include?: string|any|any[]; + }, + ): Promise; + + /** + * Find one model instance that matches `filter` specification. + * Same as `find`, but limited to one result; + * Returns object, not collection + * @callback {() => void} callback Callback function called with `(err, returned-instance)` arguments. Required. + * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). + * @param {Array} model First model instance that matches the filter or null if none found + */ + static findOne( + callback: CallbackWithResult + ): void; /** * Find one model instance that matches `filter` specification. @@ -1363,14 +1568,63 @@ declare namespace l { * @param {Array} model First model instance that matches the filter or null if none found */ static findOne( - filter?: { + filter: { fields?: string|any|any[]; include?: string|any|any[]; order?: string; skip?: number; where?: any; }, - callback?: (err: Error, instance: T) => void): Promise | void; + callback: CallbackWithResult + ): void; + + /** + * Find one model instance that matches `filter` specification. + * Same as `find`, but limited to one result; + * Returns object, not collection + * @options {any} [filter] Optional Filter JSON object; see below. + * @property {string|any|Array} fields Identify fields to include in return result. + *
See [Fields filter](docs.strongloop.com/display/LB/Fields+filter). + * @property {string|any|Array} include See PersistedModel.include documentation. + *
See [Include filter](docs.strongloop.com/display/LB/Include+filter). + * @property {string} order Sort order: either "ASC" for ascending or "DESC" for descending. + *
See [Order filter](docs.strongloop.com/display/LB/Order+filter). + * @property {number} skip number of results to skip. + *
See [Skip filter](docs.strongloop.com/display/LB/Skip+filter). + * @property {any} where Where clause, like + * ``` + * {where: { key: val, key2: {gt: 'val2'}, ...} } + * ``` + *
See + * [Where filter](docs.strongloop.com/display/LB/Where+filter#Wherefilter-Whereclauseforqueries) + */ + static findOne( + filter?: { + fields?: string|any|any[]; + include?: string|any|any[]; + order?: string; + skip?: number; + where?: any; + } + ): Promise; + + /** + * Finds one record matching the optional filter object. If not found, creates + * the object using the data provided as second argument. In this sense it is + * the same as `find`, but limited to one object. Returns an object, not + * collection. If you don't provide the filter object argument, it tries to + * locate an existing object that matches the `data` argument + * + * @param {any} data Data to insert if object matching the `where` filter is not found. + * @callback {() => void} callback Callback function called with `cb(err, instance, created)` arguments. Required. + * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). + * @param {any} instance Model instance matching the `where` filter, if found. + * @param {boolean} created True if the instance matching the `where` filter was created + */ + static findOrCreate( + data: any, + callback: CallbackWithMultipleResults + ): void; /** * Finds one record matching the optional filter object. If not found, creates @@ -1404,7 +1658,7 @@ declare namespace l { */ static findOrCreate( data: any, - filter?: { + filter: { fields?: string | any | any[]; include?: string | any | any[]; limit?: number; @@ -1412,7 +1666,46 @@ declare namespace l { skip?: number; where?: any; }, - callback?: (err: Error, instance: any, created: boolean) => void): Promise<{instance: T, created: boolean}> | void; + callback: CallbackWithMultipleResults + ): void; + + /** + * Finds one record matching the optional filter object. If not found, creates + * the object using the data provided as second argument. In this sense it is + * the same as `find`, but limited to one object. Returns an object, not + * collection. If you don't provide the filter object argument, it tries to + * locate an existing object that matches the `data` argument + * + * @options {any} [filter] Optional Filter object; see below. + * @property {string|any|Array} fields Identify fields to include in return result. + *
See [Fields filter](docs.strongloop.com/display/LB/Fields+filter). + * @property {string|any|Array} include See PersistedModel.include documentation. + *
See [Include filter](docs.strongloop.com/display/LB/Include+filter). + * @property {number} limit Maximum number of instances to return. + *
See [Limit filter](docs.strongloop.com/display/LB/Limit+filter). + * @property {string} order Sort order: either "ASC" for ascending or "DESC" for descending. + *
See [Order filter](docs.strongloop.com/display/LB/Order+filter). + * @property {number} skip number of results to skip. + *
See [Skip filter](docs.strongloop.com/display/LB/Skip+filter). + * @property {any} where Where clause, like + * ``` + * {where: {key: val, key2: {gt: val2}, ...}} + * ``` + *
See + * [Where filter](docs.strongloop.com/display/LB/Where+filter#Wherefilter-Whereclauseforqueries). + * @param {any} data Data to insert if object matching the `where` filter is not found. + */ + static findOrCreate( + data: any, + filter?: { + fields?: string | any | any[]; + include?: string | any | any[]; + limit?: number; + order?: string; + skip?: number; + where?: any; + } + ): Promise<{instance: T, created: boolean}>; /** * Get the `Change` model. @@ -1432,7 +1725,12 @@ declare namespace l { * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). * @param {string} sourceId Source identifier for the model or dataSource */ - static getSourceId(callback?: (err: Error, sourceId: string) => void): Promise | void; + static getSourceId(callback: CallbackWithResult): void; + + /** + * Get the source identifier for this model or dataSource + */ + static getSourceId(): Promise; /** * Handle a change error. Override this method in a subclassing model to customize @@ -1447,7 +1745,29 @@ declare namespace l { * @callback {() => void} callback * @param {Error} er */ - static rectifyChange(id: any, callback?: (err: Error) => void): Promise | void; + static rectifyChange(id: any, callback: CallbackWithoutResult): void; + + /** + * Specify that a change to the model with the given ID has occurred + * @param {*} id The ID of the model that has changed. + */ + static rectifyChange(id: any): Promise; + + /** + * Replace attributes for a model instance whose id is the first input + * argument and persist it into the datasource. + * Performs validation before replacing + * @param {*} id The ID value of model instance to replace. + * @param {any} data Data to replace. + * @callback {() => void} callback Callback function called with `(err, instance)` arguments. + * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). + * @param {any} instance Replaced instance + */ + static replaceById( + id: any, + data: any, + callback: CallbackWithResult + ): void; /** * Replace attributes for a model instance whose id is the first input @@ -1461,7 +1781,45 @@ declare namespace l { * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). * @param {any} instance Replaced instance */ - static replaceById(id: any, data: any, options?: {validate: boolean; }, callback?: (err: Error, instance: T) => void): Promise | void; + static replaceById( + id: any, + data: any, + options: { + validate: boolean; + }, + callback: CallbackWithResult + ): void; + + /** + * Replace attributes for a model instance whose id is the first input + * argument and persist it into the datasource. + * Performs validation before replacing + * @param {*} id The ID value of model instance to replace. + * @param {any} data Data to replace. + * @options {any} [options] Options for replace + * @property {boolean} validate Perform validation before saving. Default is true. + */ + static replaceById( + id: any, + data: any, + options?: { + validate: boolean; + } + ): Promise; + + /** + * Replace or insert a model instance; replace existing record if one is found, + * such that parameter `data.id` matches `id` of model instance; otherwise, + * insert a new record. + * @param {any} data The model instance data. + * @callback {() => void} callback Callback function called with `cb(err, obj)` signature. + * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). + * @param {any} model Replaced model instance. + */ + static replaceOrCreate( + data: any, + callback: CallbackWithResult + ): void; /** * Replace or insert a model instance; replace existing record if one is found, @@ -1474,7 +1832,28 @@ declare namespace l { * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). * @param {any} model Replaced model instance. */ - static replaceOrCreate(data: any, options?: {validate: boolean; }, callback?: (err: Error, instance: T) => void): Promise | void; + static replaceOrCreate( + data: any, + options: { + validate: boolean; + }, + callback: CallbackWithResult + ): void; + + /** + * Replace or insert a model instance; replace existing record if one is found, + * such that parameter `data.id` matches `id` of model instance; otherwise, + * insert a new record. + * @param {any} data The model instance data. + * @options {any} [options] Options for replaceOrCreate + * @property {boolean} validate Perform validation before saving. Default is true. + */ + static replaceOrCreate( + data: any, + options?: { + validate: boolean; + } + ): Promise; /** * Replicate changes since the given checkpoint to the given target model @@ -1485,7 +1864,7 @@ declare namespace l { * @callback {() => void} [callback] Callback function called with `(err, conflicts)` arguments. * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). * @param {Conflict[]} conflicts A list of changes that could not be replicated due to conflicts. - * @param {any] checkpoints The new checkpoints to use as the "since" + * @param {any} checkpoints The new checkpoints to use as the "since" * argument for the next replication */ static replicate( @@ -1496,6 +1875,18 @@ declare namespace l { callback?: (err: Error, conflicts: Conflict[], param: any) => void ): Promise<{conflicts: Conflict[], params: any}> | void; + /** + * Update multiple instances that match the where clause. + * @callback {() => void} callback Callback function called with `(err, info)` arguments. Required. + * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). + * @param {any} info Additional information about the command outcome. + * @param {number} info.count number of instances (rows, documents) updated. + * + */ + static updateAll( + callback: CallbackWithMultipleResults + ): void; + /** * Update multiple instances that match the where clause. * @@ -1521,7 +1912,65 @@ declare namespace l { * @param {number} info.count number of instances (rows, documents) updated. * */ - static updateAll(where?: any, data?: any, callback?: (err: Error, info: any, infoCount: number) => void): Promise | void; + static updateAll( + whereOrData: any, + callback: CallbackWithMultipleResults + ): void; + + /** + * Update multiple instances that match the where clause. + * + * Example: + * + * ```js + * Employee.updateAll({managerId: 'x001'}, {managerId: 'x002'}, function(err, info) { + * ... + * }); + * ``` + * + * @param {any} [where] Optional `where` filter, like + * ``` + * { key: val, key2: {gt: 'val2'}, ...} + * ``` + *
see + * [Where filter](docs.strongloop.com/display/LB/Where+filter#Wherefilter-Whereclauseforothermethods). + * @param {any} data any containing data to replace matching instances, if any. + * + * @callback {() => void} callback Callback function called with `(err, info)` arguments. Required. + * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). + * @param {any} info Additional information about the command outcome. + * @param {number} info.count number of instances (rows, documents) updated. + * + */ + static updateAll( + where: any, + data: any, + callback: CallbackWithMultipleResults + ): void; + + /** + * Update multiple instances that match the where clause. + * + * Example: + * + * ```js + * Employee.updateAll({managerId: 'x001'}, {managerId: 'x002'}, function(err, info) { + * ... + * }); + * ``` + * + * @param {any} [where] Optional `where` filter, like + * ``` + * { key: val, key2: {gt: 'val2'}, ...} + * ``` + *
see + * [Where filter](docs.strongloop.com/display/LB/Where+filter#Wherefilter-Whereclauseforothermethods). + * @param {any} data any containing data to replace matching instances, if any. + */ + static updateAll( + where?: any, + data?: any + ): Promise; /** * Update or insert a model instance @@ -1530,7 +1979,21 @@ declare namespace l { * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). * @param {any} model Updated model instance */ - static upsert(data: any, callback?: (err: Error, instance: T) => void): Promise | void; + static upsert( + data: any, + callback: CallbackWithResult + ): void; + + /** + * Update or insert a model instance + * @param {any} data The model instance data to insert. + * @callback {() => void} callback Callback function called with `cb(err, obj)` signature. + * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). + * @param {any} model Updated model instance + */ + static upsert( + data: any + ): Promise; /** * Update or insert a model instance based on the search criteria. @@ -1548,14 +2011,40 @@ declare namespace l { * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). * @param {any} model Updated model instance */ - static upsertWithWhere(data: any, callback?: (err: Error, instance: T) => void): Promise | void; + static upsertWithWhere( + data: any, + callback: CallbackWithResult + ): void; + + /** + * Update or insert a model instance based on the search criteria. + * If there is a single instance retrieved, update the retrieved model. + * Creates a new model if no model instances were found. + * Returns an error if multiple instances are found. + * * @param {any} [where] `where` filter, like + * ``` + * { key: val, key2: {gt: 'val2'}, ...} + * ``` + *
see + * [Where filter](docs.strongloop.com/display/LB/Where+filter#Wherefilter-Whereclauseforothermethods). + * @param {any} data The model instance data to insert. + */ + static upsertWithWhere( + data: any + ): Promise; /** * Deletes the model from persistence. * Triggers `destroy` hook (async) before and after destroying object. * @param {() => void} callback Callback function */ - destroy(callback?: () => void): Promise | void; + destroy(callback: CallbackWithoutResult): void; + + /** + * Deletes the model from persistence. + * Triggers `destroy` hook (async) before and after destroying object. + */ + destroy(): Promise; /** * Get the `id` value for the `PersistedModel` @@ -1581,7 +2070,25 @@ declare namespace l { * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). * @param {any} instance Model instance */ - reload(callback: (err: Error, instance: T) => void): Promise | void; + reload(callback: CallbackWithResult): void; + + /** + * Reload object from persistence. Requires `id` member of `object` to be able to call `find`. + */ + reload(): Promise; + + /** + * Replace attributes for a model instance and persist it into the datasource. + * Performs validation before replacing + * @param {any} data Data to replace. + * @callback {() => void} callback Callback function called with `(err, instance)` arguments. + * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). + * @param {any} instance Replaced instance + */ + replaceAttributes( + data: any, + callback: CallbackWithResult + ): void; /** * Replace attributes for a model instance and persist it into the datasource. @@ -1593,7 +2100,38 @@ declare namespace l { * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). * @param {any} instance Replaced instance */ - replaceAttributes(data: any, options?: {validate: boolean}, callback?: (err: Error, instance: T) => void): Promise | void; + replaceAttributes( + data: any, + options: { + validate: boolean + }, + callback: CallbackWithResult + ): void; + + /** + * Replace attributes for a model instance and persist it into the datasource. + * Performs validation before replacing + * @param {any} data Data to replace. + * @options {any} [options] Options for replace + * @property {boolean} validate Perform validation before saving. Default is true. + */ + replaceAttributes( + data: any, + options?: { + validate: boolean + } + ): Promise; + + /** + * Save model instance. If the instance doesn't have an ID, then calls [create](#persistedmodelcreatedata-cb) instead. + * Triggers: validate, save, update, or create. + * @callback {() => void} callback Optional callback function called with `(err, obj)` arguments. + * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). + * @param {any} instance Model instance saved or created + */ + save( + callback: CallbackWithResult + ): void; /** * Save model instance. If the instance doesn't have an ID, then calls [create](#persistedmodelcreatedata-cb) instead. @@ -1606,7 +2144,28 @@ declare namespace l { * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). * @param {any} instance Model instance saved or created */ - save(options?: {validate: boolean; throws: boolean}, callback?: (err: Error, instance: T) => void): Promise | void; + save( + options: { + validate: boolean; + throws: boolean + }, + callback: CallbackWithResult + ): void; + + /** + * Save model instance. If the instance doesn't have an ID, then calls [create](#persistedmodelcreatedata-cb) instead. + * Triggers: validate, save, update, or create. + * @options {any} [options] See below. + * @property {boolean} validate Perform validation before saving. Default is true. + * @property {boolean} throws If true, throw a validation error; WARNING: This can crash Node. + * If false, report the error via callback. Default is false. + */ + save( + options?: { + validate: boolean; + throws: boolean + } + ): Promise; /** * Set the correct `id` property for the `PersistedModel`. Uses the `setId` method if the model is attached to @@ -1625,7 +2184,22 @@ declare namespace l { * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). * @param {any} instance Updated instance */ - updateAttribute(name: string, value: any, callback?: (err: Error, instance: T) => void): Promise | void; + updateAttribute( + name: string, + value: any, + callback: CallbackWithResult + ): void; + + /** + * Update a single attribute. + * Equivalent to `updateAttributes({name: 'value'}, cb) + * @param {string} name Name of property. + * @param {any} value Value of property. + */ + updateAttribute( + name: string, + value: any + ): Promise; /** * Update set of attributes. Performs validation before updating @@ -1635,7 +2209,19 @@ declare namespace l { * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). * @param {any} instance Updated instance */ - updateAttributes(data: any, callback?: (err: Error, instance: T) => void): Promise | void; + updateAttributes( + data: any, + callback: CallbackWithResult + ): void; + + /** + * Update set of attributes. Performs validation before updating + * Triggers: `validation`, `save` and `update` hooks + * @param {any} data Data to update. + */ + updateAttributes( + data: any + ): Promise; // **NOTE** Deprecate for v3.x // /** @@ -1688,6 +2274,7 @@ declare namespace l { // */ // createany(options: any, optionsWhere: any, callback: (err: Error, changes: any) => void): void; } + // END OF PERSISTED MODEL /** * Serve the LoopBack favicon. From 7e99b9efc855d9b3051581f7f74affe04bdce2c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tarnay=20K=C3=A1lm=C3=A1n?= Date: Sun, 20 May 2018 22:10:13 +0200 Subject: [PATCH 267/575] [react-aria-menubutton] drop patch version to make CI happy --- types/react-aria-menubutton/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-aria-menubutton/index.d.ts b/types/react-aria-menubutton/index.d.ts index 6866719f3c..f7a4ef7de0 100644 --- a/types/react-aria-menubutton/index.d.ts +++ b/types/react-aria-menubutton/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-aria-menubutton 5.1.1 +// Type definitions for react-aria-menubutton 5.1 // Project: https://github.com/davidtheclark/react-aria-menubutton // Definitions by: Muhammad Fawwaz Orabi // Chris Rohlfs From 156c92a61094798a99289ce9aa1eacc18aabb6b5 Mon Sep 17 00:00:00 2001 From: Ricky Kirkham Date: Sun, 20 May 2018 13:12:58 -0700 Subject: [PATCH 268/575] adding missing documentation for many APIs --- types/office-js/index.d.ts | 3321 ++++++++++++++++++++++++++++++++---- 1 file changed, 2982 insertions(+), 339 deletions(-) diff --git a/types/office-js/index.d.ts b/types/office-js/index.d.ts index 2aa0de0bb1..58c574e126 100644 --- a/types/office-js/index.d.ts +++ b/types/office-js/index.d.ts @@ -15,11 +15,20 @@ Copyright (c) Microsoft Corporation //////////////////////////////////////////////////////////////// declare namespace Office { + /** + * Provides a container for APIs that are still in Preview, not released for use in production add-ins. + */ export var Preview: { + /** + * Initializes the use of custom JavaScript functions in Excel. + */ startCustomFunctions(): Promise; } export var Promise: PromiseConstructor; + /** + * Gets the Context object that represents the runtime environment of the add-in and provides access to the top-level objects of the API. + */ export var context: Context; /** * This method is called after the Office API was loaded. @@ -28,163 +37,232 @@ declare namespace Office { export function initialize(reason: InitializationReason): void; /** * Ensures that the Office JavaScript APIs are ready to be called by the add-in. If the framework hasn't initialized yet, the callback or promise will wait until the Office host is ready to accept API calls. - * Note that though this API is intended to be used inside an Office add-in, it can also be used outside the add-in. In that case, once Office.js determines that it is running outside of an Office host application, it will call the callback and resolve the promise with "null" for both the host and platform. + * Note that though this API is intended to be used inside an Office add-in, it can also be used outside the add-in. In that case, once Office.js determines that it is running outside of an Office host application, it will call the callback and resolve the promise with "null" for both the host and platform. * @param callback - An optional callback method, that will receive the host and platform info. Alternatively, rather than use a callback, an add-in may simply wait for the Promise returned by the function to resolve. * @returns A Promise that contains the host and platform info, once initialization is completed. */ export function onReady(callback?: (info: { host: HostType, platform: PlatformType }) => any): Promise<{ host: HostType, platform: PlatformType }>; /** * Indicates if the large namespace for objects will be used or not. - * @param useShortNamespace Indicates if 'true' that the short namespace will be used + * @param useShortNamespace Indicates if 'true' that the short namespace will be used */ export function useShortNamespace(useShortNamespace: boolean): void; // Enumerations + /** + * Specifies the result of an asynchronous call. + * @remarks + * Returned by the status property of the AsyncResult object. + * + * Hosts: Access, Excel, Outlook, PowerPoint, Project, Word + */ export enum AsyncResultStatus { /** - * Operation succeeded + * The call succeeded. */ Succeeded, /** - * Operation failed, check error object + * The call failed, check the error object. */ Failed } + /** + * Specifies whether the add-in was just inserted or was already contained in the document. + * + * @remarks + * Hosts: Excel, Project, Word + */ export enum InitializationReason { /** - * Indicates the app was just inserted in the document + * The add-in was just inserted into the document. */ Inserted, /** - * Indicates if the extension already existed in the document + * The add-in is already part of the document that was opened. */ DocumentOpened } + /** + * Specifies the host Office application in which the add-in is running. + * + * @remarks + * Hosts: Excel, Word, PowerPoint, Outlook, OneNote, Project, Access + */ export enum HostType { /** - * Host is Word + * The Office host is Microsoft Word. */ Word, /** - * Host is Excel + * The Office host is Microsoft Excel. */ Excel, /** - * Host is PowerPoint + * The Office host is Microsoft PowerPoint. */ PowerPoint, /** - * Host is Outlook + * The Office host is Microsoft Outlook. */ Outlook, /** - * Host is OneNote + * The Office host is Microsoft OneNote. */ OneNote, /** - * Host is Project + * The Office host is Microsoft Project. */ Project, /** - * Host is Access + * The Office host is Microsoft Access. */ Access } + /** + * Specifies the OS or other platform on which the Office host application is running. + * + * @remarks + * Hosts: Excel, Word, PowerPoint, Outlook, OneNote, Project, Access + */ export enum PlatformType { /** - * Platform is PC + * The platform is PC (Windows). */ PC, /** - * Platform is Web + * The platform is Office Online. */ OfficeOnline, /** - * Platform is Mac + * The platform is Mac. */ Mac, /** - * Platform is iOS + * The platform an iOS device. */ iOS, /** - * Platform is Android + * The platform is an Android device. */ Android, /** - * Platform is Winrt + * The platform is WinRT. */ Universal } // Objects /** * An object which encapsulates the result of an asynchronous request, including status and error information if the request failed. - * - * **Hosts**: Access, Excel, Outlook, PowerPoint, Project, Word - * - * **Last changed in**: 1.1 - * + * * @remarks + * Hosts: Access, Excel, Outlook, PowerPoint, Project, Word + * + * Last changed in: 1.1 + * * When the function you pass to the `callback` parameter of an "Async" method executes, it receives an AsyncResult object that you can access from the `callback` function's only parameter. */ export interface AsyncResult { /** * Gets the user-defined item passed to the optional `asyncContext` parameter of the invoked method in the same state as it was passed in. This the user-defined item (which can be of any JavaScript type: String, Number, Boolean, Object, Array, Null, or Undefined) passed to the optional `asyncContext` parameter of the invoked method. Returns Undefined, if you didn't pass anything to the asyncContext parameter. + * + * @remarks + * Hosts: Access, Excel, Outlook, PowerPoint, Project, Word * - * **Hosts**: Access, Excel, Outlook, PowerPoint, Project, Word - * - * **Last changed in**: 1.1 + * Last changed in: 1.1 */ asyncContext: any; /** * Gets the [AsyncResultStatus](office.asyncresultstatus.md) of the asynchronous operation. * - * **Hosts**: Access, Excel, Outlook, PowerPoint, Project, Word + * @remarks + * Hosts: Access, Excel, Outlook, PowerPoint, Project, Word * - * **Last changed in**: 1.1 + * Last changed in: 1.1 */ status: AsyncResultStatus; /** * Gets an [Error](office.error.md) object that provides a description of the error, if any error occurred. * - * **Hosts**: Access, Excel, Outlook, PowerPoint, Project, Word + * @remarks + * Hosts: Access, Excel, Outlook, PowerPoint, Project, Word * - * **Last changed in**: 1.1 + * Last changed in: 1.1 */ error: Error; /** * Gets the payload or content of this asynchronous operation, if any. + + * @remarks + * You access the AsyncResult object in the function passed as the argument to the callback parameter of an "Async" method, such as the `getSelectedDataAsync` and `setSelectedDataAsync` methods of the Document object. * * Note: What the value property returns for a particular "Async" method varies depending on the purpose and context of that method. To determine what is returned by the value property for an "Async" method, refer to the "Callback value" section of the method's topic. For a complete listing of the "Async" methods, see the Remarks section of the AsyncResult object topic. * - * **Hosts**: Access, Excel, Outlook, PowerPoint, Project, Word + * Hosts: Access, Excel, Outlook, PowerPoint, Project, Word * - * **Last changed in**: 1.1 - * - * @remarks - * You access the AsyncResult object in the function passed as the argument to the callback parameter of an "Async" method, such as the `getSelectedDataAsync` and `setSelectedDataAsync` methods of the Document object. + * Last changed in: 1.1 */ value: any; } + /** + * Represents the runtime environment of the add-in and provides access to key objects of the API. + * + * @remarks + * Hosts: Access, Excel, Outlook, PowerPoint, Project, Word + * + * Last changed in: 1.1 + */ export interface Context { + /** + * Provides information and access to the signed-in user. + */ auth: Auth; + /** + * Gets the locale (language) specified by the user for editing the document or item. + */ contentLanguage: string; + /** + * Gets the locale (language) specified by the user for the UI of the Office host application. + */ displayLanguage: string; + /** + * + */ license: string; + /** + * Provides access to the properties for Office theme colors. + */ officeTheme: OfficeTheme; + /** + * Provides access to the properties for Office theme colors. + */ touchEnabled: boolean; + /** + * Provides objects and methods that you can use to create and manipulate UI components, such as dialog boxes. + */ ui: UI; + /** + * Contains the host in which the add-in (web application) is running in. Possible values are: Word, Excel, PowerPoint + */ host: HostType; + /** + * Provides the platform on which the add-in is running. Possible values are: PC, OfficeOnline, Mac, iOS, Android, Universal + */ platform: PlatformType; + /** + * + */ diagnostics: { host: HostType; platform: PlatformType; version: string; }; + /** + * Provides a method for determining what requirement sets are supported on the current host and platform. + */ requirements: { /** * Check if the specified requirement set is supported by the host Office application. - * @param name - Set name. e.g.: "MatrixBindings". - * @param minVersion - The minimum required version. + * @param name - Set name; e.g., "MatrixBindings". + * @param minVersion - The minimum required version; e.g., "1.4". */ isSetSupported(name: string, minVersion?: number): boolean; } @@ -192,7 +270,10 @@ declare namespace Office { /** * Provides specific information about an error that occurred during an asynchronous data operation. * - * Remarks: The Error object is accessed from the AsyncResult object that is returned in the function passed as the callback argument of an asynchronous data operation, such as the setSelectedDataAsync method of the Document object. + * @remarks + * The Error object is accessed from the AsyncResult object that is returned in the function passed as the callback argument of an asynchronous data operation, such as the setSelectedDataAsync method of the Document object. + * + * Hosts: Access, Excel, Outlook, PowerPoint, Project, Word */ export interface Error { /** @@ -208,49 +289,74 @@ declare namespace Office { */ name: string; } + /** + * Provides objects and methods that you can use to create and manipulate UI components, such as dialog boxes, in your Office Add-ins. + */ export interface UI { /** - * Displays a dialog to show or collect information from the user or to facilitate Web navigation. - * @param startAddress Accepts the initial HTTPS Url that opens in the dialog. + * Displays a dialog to show or collect information from the user or to facilitate Web navigation. + * + * @remarks + * Hosts: Word, Excel, Outlook, PowerPoint + * + * Requirement sets: DialogApi, Mailbox 1.4 + * + * Last changed in: DialogApi 1.1, Mailbox 1.4 + * + * The initial page must be on the same domain as the parent page (the startAddress parameter). After the initial page loads, you can go to other domains. + * + * Any page calling office.context.ui.messageParent must also be on the same domain as the parent page. + * + * The following design considerations apply to dialog boxes: + * + * - An Office Add-in can have only one dialog box open at any time. + * + * - Every dialog box can be moved and resized by the user. + * + * - Every dialog box is centered on the screen when opened. + * + * - Dialog boxes appear on top of the host application and in the order in which they were created. + * + * Use a dialog box to: + * + * - Display authentication pages to collect user credentials. + * + * - Display an error/progress/input screen from a ShowTaspane or ExecuteAction command. + * + * - Temporarily increase the surface area that a user has available to complete a task. + * + * Do not use a dialog box to interact with a document. Use a task pane instead. + * + * @param startAddress - Accepts the initial HTTPS URL that opens in the dialog. + * @param options - Optional. An object that has any of the following properties: + * + * displayInIframe: Determines whether the dialog box should be displayed within an IFrame. This setting is only applicable in Office Online clients, and is ignored by other platforms. If false (default), the dialog will be displayed as a new browser window (pop-up). Recommended for authentication pages that cannot be displayed in an IFrame. If true, the dialog will be displayed as a floating overlay with an IFrame. This is best for user experience and performance. + * + * height: Defines the height of the dialog box as a percentage of the current display. The default value is 80%. The minimum resolution is 150 pixels. + * + * width: Defines the width of the dialog box as a percentage of the current display. The default value is 80%. The minimum resolution is 250 pixels. + * + * @param callback - Optional. Accepts a callback method to handle the dialog creation attempt. If successful, the AsyncResult.value is a DialogHandler object. */ - displayDialogAsync(startAddress: string): void; + displayDialogAsync(startAddress: string, options?: DialogOptions, callback?: (result: AsyncResult) => void): void; /** - * Displays a dialog to show or collect information from the user or to facilitate Web navigation. - * @param startAddress Accepts the initial HTTPS Url that opens in the dialog. - * @param options Optional. Accepts a DialogOptions object to define dialog behaviors. - */ - displayDialogAsync(startAddress: string, options: DialogOptions): void; - /** - * Displays a dialog to show or collect information from the user or to facilitate Web navigation. - * @param startAddress Accepts the initial HTTPS Url that opens in the dialog. - * @param callback Optional. Accepts a callback method to handle the dialog creation attempt. - */ - displayDialogAsync(startAddress: string, callback: (result: AsyncResult) => void): void; - /** - * Displays a dialog to show or collect information from the user or to facilitate Web navigation. - * @param startAddress Accepts the initial HTTPS Url that opens in the dialog. - * @param options Optional. Accepts a DialogOptions object to define dialog behaviors. - * @param callback Optional. Accepts a callback method to handle the dialog creation attempt. - */ - displayDialogAsync(startAddress: string, options: DialogOptions, callback: (result: AsyncResult) => void): void; - - /** - * Synchronously delivers a message from the dialog to its parent add-in. + * Delivers a message from the dialog box to its parent/opener page. The page calling this API must be on the same domain as the parent. * @param messageObject Accepts a message from the dialog to deliver to the add-in. */ messageParent(messageObject: any): void; /** * Closes the UI container where the JavaScript is executing. - * - * Supported hosts: Outlook - Minimum requirement set: Mailbox 1.5 - * + * + * @remarks * The behavior of this method is specified by the following: - * - * Called from a UI-less command button: No effect. Any dialog opened by displayDialogAsync will remain open. - * - * Called from a taskpane: The taskpane will close. Any dialog opened by displayDialogAsync will also close. If the taskpane supports pinning and was pinned by the user, it will be un-pinned. - * - * Called from a module extension: No effect. + * + * - Called from a UI-less command button: No effect. Any dialog opened by displayDialogAsync will remain open. + * + * - Called from a taskpane: The taskpane will close. Any dialog opened by displayDialogAsync will also close. If the taskpane supports pinning and was pinned by the user, it will be un-pinned. + * + * - Called from a module extension: No effect. + * + * Hosts: Excel, Word, PowerPoint, Outlook (Minimum requirement set: Mailbox 1.5) */ closeContainer(): void; } @@ -271,15 +377,20 @@ declare namespace Office { export interface Auth { /** * Obtains an access token from AAD V 2.0 endpoint to grant the Office host application access to the add-in's web application. - * @param callback Optional. Accepts a callback method to handle the token acquisition attempt. If AsyncResult.status is "succeeded", then AsyncResult.value is the raw AAD v. 2.0-formatted access token. + * + * @remarks + * Hosts: Excel, OneNote, Outlook, PowerPoint, Word + * + * Requirement sets: IdentityAPI + * + * Last changed in: 1.1 + * + * This API requires a single sign-on configuration that bridges the add-in to an Azure application. Office users sign-in with Organizational Accounts and Microsoft Accounts. Microsoft Azure returns tokens intended for both user account types to access resources in the Microsoft Graph. + * + * @param options - Optional. Accepts an AuthOptions object to define sign-on behaviors. + * @param callback - Optional. Accepts a callback method to handle the token acquisition attempt. If AsyncResult.status is "succeeded", then AsyncResult.value is the raw AAD v. 2.0-formatted access token. */ - getAccessTokenAsync(callback: (result: AsyncResult) => void): void; - /** - * Obtains an access token from AAD V 2.0 endpoint to grant the Office host application access to the add-in's web application. - * @param options Optional. Accepts an AuthOptions object to define sign-on behaviors. - * @param callback Optional. Accepts a callback method to handle the token acquisition attempt. If AsyncResult.status is "succeeded", then AsyncResult.value is the raw AAD v. 2.0-formatted access token. - */ - getAccessTokenAsync(options: AuthOptions, callback: (result: AsyncResult) => void): void; + getAccessTokenAsync(options?: AuthOptions, callback?: (result: AsyncResult) => void): void; } export interface AuthOptions { @@ -330,90 +441,141 @@ declare namespace Office { */ export function select(expression: string, callback?: (result: AsyncResult) => void): Binding; // Enumerations + /** + * Specifies the state of the active view of the document, for example, whether the user can edit the document. + * @remarks + * Hosts: PowerPoint + */ export enum ActiveView { + /** + * The active view of the host application only lets the user read the content in the document. + */ Read, + /** + * The active view of the host application lets the user edit the content in the document. + */ Edit } + /** + * Specifies the type of the binding object that should be returned. + * @remarks + * Hosts: Access, Excel, Word + */ export enum BindingType { /** - * Text based Binding + * Plain text. Data is returned as a run of characters. */ Text, /** - * Matrix based Binding + * Tabular data without a header row. Data is returned as an array of arrays, for example in this form: [[row1column1, row1column2],[row2column1, row2column2]] */ Matrix, /** - * Table based Binding + * Tabular data with a header row. Data is returned as a TableData object. */ Table } + /** + * Specifies how to coerce data returned or set by the invoked method. + * + * @remarks + * PowerPoint supports only Office.CoercionType.Text, Office.CoercionType.Image, and Office.CoercionType.SlideRange. Project supports only Office.CoercionType.Text. + * + * Hosts: Access, Excel, Outlook, PowerPoint, Project, Word + */ export enum CoercionType { /** - * Coerce as Text + * Return or set data as text (string).Data is returned or set as a one-dimensional run of characters. */ Text, /** - * Coerce as Matrix + * Return or set data as tabular data with no headers. Data is returned or set as an array of arrays containing one-dimensional runs of characters. For example, three rows of string values in two columns would be: [["R1C1", "R1C2"], ["R2C1", "R2C2"], ["R3C1", "R3C2"]]. + * @remarks + * Only applies to data in Excel and Word. */ Matrix, /** - * Coerce as Table + * Return or set data as tabular data with optional headers. Data is returned or set as an array of arrays with optional headers. + * @remarks + * Only applies to data in Access, Excel and Word. */ Table, /** - * Coerce as HTML + * Return or set data as HTML. + * @remarks + * Only applies to data in add-ins for Word and Outlook add-ins for Outlook (compose mode). */ Html, /** - * Coerce as Office Open XML + * Return or set data as Office Open XML. + * @remarks + * Only applies to data in Word. */ Ooxml, /** - * Coerce as JSON object containing an array of the ids, titles, and indexes of the selected slides. + * Return a JSON object that contains an array of the ids, titles, and indexes of the selected slides.For example, {"slides":[{"id":257,"title":"Slide 2","index":2},{"id":256,"title":"Slide 1","index":1}]} for a selection of two slides. + * @remarks + * Only applies to data in PowerPoint when calling the Document.getSelectedData method to get the current slide or selected range of slides. */ SlideRange, /** - * Coerce as Image + * Data is returned or set as an image stream. + * @remarks + * Only applies to data in Excel, Word and PowerPoint. */ Image } + /** + * Specifies whether the document in the associated application is read-only or read-write. + * @remarks + * Returned by the mode property of the Document object. + * + * Hosts: Excel, PowerPoint, Project, Word + */ export enum DocumentMode { /** - * Document in Read Only Mode + * The document is read-only. */ ReadOnly, /** - * Document in Read/Write Mode + * The document can be read and written to. */ ReadWrite } + /** + * Specifies the kind of event that was raised. Returned by the type property of an EventNameEventArgs object. + * + * @remarks + * Add-ins for Project support the Office.EventType.ResourceSelectionChanged, Office.EventType.TaskSelectionChanged, and Office.EventType.ViewSelectionChanged event types. + * + * Hosts: Access, Excel, PowerPoint, Project, Word + */ export enum EventType { /** - * Occurs when the user changes the current view of the document. + * A Document.ActiveViewChanged event was raised. */ ActiveViewChanged, /** * Occurs when data within the binding is changed. * + * @remarks * Hosts: Access, Excel, Word * * Last changed in: 1.1 * - * @remarks * To add an event handler for the BindingDataChanged event of a binding, use the addHandlerAsync method of the Binding object. The event handler receives an argument of type BindingDataChangedEventArgs. */ BindingDataChanged, /** * Occurs when the selection is changed within the binding. * + * @remarks * Hosts: Access, Excel, Word * * Available in Requirement set: BindingEvents * * Last changed in: 1.1 * - * @remarks * To add an event handler for the BindingSelectionChanged event of a binding, use the addHandlerAsync method of the Binding object. The event handler receives an argument of type BindingSelectionChangedEventArgs. */ BindingSelectionChanged, @@ -430,7 +592,7 @@ declare namespace Office { */ DocumentSelectionChanged, /** - * Triggers when the active item changes + * A Document.SelectionChanged event was raised. */ ItemChanged, /** @@ -446,7 +608,7 @@ declare namespace Office { */ NodeReplaced, /** - * Triggers when settings change in a co-Auth session. + * A Settings.settingsChanged event was raised. */ SettingsChanged, /** @@ -454,7 +616,7 @@ declare namespace Office { */ TaskSelectionChanged, /** - * Triggers when a Resource selection happens in Project. + * Triggers when a Resource selection happens in Project. */ ResourceSelectionChanged, /** @@ -462,30 +624,48 @@ declare namespace Office { */ ViewSelectionChanged } + /** + * Specifies the format in which to return the document. + * + * @remarks + * Hosts: PowerPoint, Word + */ export enum FileType { /** - * Returns the file as plain text + * Returns only the text of the document as a string. (Word only) */ Text, /** - * Returns the file as a byte array + * Returns the entire document (.pptx or .docx or .xslx) in Office Open XML (OOXML) format as a byte array. */ Compressed, /** - * Returns the file in PDF format as a byte array + * Returns the entire document in PDF format as a byte array. */ Pdf } + /** + * Specifies whether filtering from the host application is applied when the data is retrieved. + * + * @remarks + * Hosts: Excel, Project, Word + */ export enum FilterType { /** - * Returns all items + * Return all data (not filtered by the host application). */ All, /** - * Returns only visible items + * Return only the visible data (as filtered by the host application). */ OnlyVisible } + /** + * Specifies the type of place or object to navigate to. + * + * @remarks + * Hosts: Excel, PowerPoint, Word + */ export enum GoToType { /** * Goes to a binding object using the specified binding id. @@ -501,7 +681,7 @@ declare namespace Office { */ Slide, /** - * Goes to the specified index by slide number or enum Office.Index + * Goes to the specified index by slide number or Office.Index */ Index } @@ -511,18 +691,38 @@ declare namespace Office { Next, Previous } + /** + * Specifies whether to select (highlight) the location to navigate to (when using the Document.goToByIdAsync method). + * + * @remarks + * Hosts: Excel, PowerPoint, Word + */ export enum SelectionMode { Default, + /** + * The location will be selected (highlighted). + */ Selected, + /** + * The cursor is moved the beginning of the location. + */ None } + /** + * Specifies whether values, such as numbers and dates, returned by the invoked method are returned with their formatting applied. + * + * @remarks + * For example, if the valueFormat parameter is specified as "formatted", a number formatted as currency, or a date formatted as mm/dd/yy in the host application will have its formatting preserved. If the valueFormat parameter is specified as "unformatted", a date will be returned in its underlying sequential serial number form. + * + * Hosts: Excel, Project, Word + */ export enum ValueFormat { /** - * Returns items without format + * Return unformatted data. */ Unformatted, /** - * Returns items with format + * Return formatted data. */ Formatted } @@ -530,13 +730,13 @@ declare namespace Office { /** * Represents a binding to a section of the document. * - * **Hosts**: Access, Excel, Word - * - * **Available in Requirement sets**: MatrixBinding, TableBinding, TextBinding - * - * **Last changed in**: 1.1 - * * @remarks + * Hosts: Access, Excel, Word + * + * Available in Requirement sets: MatrixBinding, TableBinding, TextBinding + * + * Last changed in: 1.1 + * * The Binding object exposes the functionality possessed by all bindings regardless of type. * * The Binding object is never called directly. It is the abstract parent class of the objects that represent each type of binding: MatrixBinding, TableBinding, or TextBinding. All three of these objects inherit the getDataAsync and setDataAsync methods from the Binding object that enable to you interact with the data in the binding. They also inherit the id and type properties for querying those property values. Additionally, the MatrixBinding and TableBinding objects expose additional methods for matrix- and table-specific features, such as counting the number of rows and columns. @@ -545,14 +745,16 @@ declare namespace Office { /** * Get the Document object associated with the binding. * - * **Hosts**: Access, Excel, Word + *@remarks + * Hosts: Access, Excel, Word * - * **Last changed in**: 1.1 + * Last changed in: 1.1 */ document: Document; /** * A string that uniquely identifies this binding among the bindings in the same Document object. * + *@remarks * Hosts: Access, Excel, Word * * Last changed in: 1.1 @@ -561,9 +763,10 @@ declare namespace Office { /** * Gets the type of the binding. * - * **Hosts**: Access, Excel, Word - - * **Last changed in**: 1.1 + *@remarks + * Hosts: Access, Excel, Word + * + * Last changed in: 1.1 */ type: BindingType; /** @@ -581,13 +784,13 @@ declare namespace Office { /** * Returns the data contained within the binding. * + *@remarks * Hosts: Access, Excel, Word * * Available in Requirement sets: MatrixBindings, TableBindings, TextBindings * * Last changed in: 1.1 * - * @remarks * When called from a MatrixBinding or TableBinding, the getDataAsync method will return a subset of the bound values if the optional startRow, startColumn, rowCount, and columnCount parameters are specified (and they specify a contiguous and valid range). * * @param options An object with any of the following (example: {coercionType: 'matrix, 'valueFormat: 'formatted', filterType:'all'}): @@ -609,18 +812,19 @@ declare namespace Office { * asyncContext: Object keeping state for the callback * * rows: Only for table bindings in content add-ins for Access. Specifies the pre-defined string "thisRow" to get data in the currently selected row. - + * * @param callback The optional callback method */ getDataAsync(options?: any, callback?: (result: AsyncResult) => void): void; /** * Removes the specified handler from the binding for the specified event type. * - * **Hosts**: Access, Excel, Word + *@remarks + * Hosts: Access, Excel, Word * - * **Available in Requirement set**: BindingEvents + * Available in Requirement set: BindingEvents * - * **Last changed in**: 1.1 + * Last changed in: 1.1 * * @param eventType The event type. For binding can be 'bindingDataChanged' and 'bindingSelectionChanged' * @param options An object with any of the following: @@ -635,11 +839,12 @@ declare namespace Office { /** * Writes data to the bound section of the document represented by the specified binding object. * - * **Hosts**: Access, Excel, Word + *@remarks + * Hosts: Access, Excel, Word * - * **Available in Requirement sets**: MatrixBindings, TableBindings, TextBindings + * Available in Requirement sets: MatrixBindings, TableBindings, TextBindings * - * **Last changed in**: 1.1 + * Last changed in: 1.1 * * @param data The data to be set in the current selection. Possible data types by host: * @@ -675,297 +880,827 @@ declare namespace Office { */ setDataAsync(data: TableData | any, options?: any, callback?: (result: AsyncResult) => void): void; } + /** + * Represents the bindings the add-in has within the document. + * + *@remarks + * Hosts: + * + * Last changed in: 1.1 + */ export interface Bindings { + /** + * Gets a Document object that represents the document associated with this set of bindings. + * + *remarks + * Hosts: Access, Excel, Word + * + * Last changed in: 1.1 + */ document: Document; /** - * Creates a binding against a named object in the document + * Creates a binding against a named object in the document. + * + *@remarks + * Hosts: Access, Excel, Word + * + * Available in Requirement set: MatrixBindings, TableBindings, TextBindings + * + * For Excel, the itemName parameter can refer to a named range or a table. + * + * By default, adding a table in Excel assigns the name "Table1" for the first table you add, "Table2" for the second table you add, and so on. To assign a meaningful name for a table in the Excel UI, use the Table Name property on the Table Tools | Design tab of the ribbon. + * + * Note: In Excel, when specifying a table as a named item, you must fully qualify the name to include the worksheet name in the name of the table in this format: "Sheet1!Table1" + * + * For Word, the itemName parameter refers to the Title property of a Rich Text content control. (You can't bind to content controls other than the Rich Text content control.) + * + * By default, a content control has no Title value assigned. To assign a meaningful name in the Word UI, after inserting a Rich Text content control from the Controls group on the Developer tab of the ribbon, use the Properties command in the Controls group to display the Content Control Properties dialog box. Then set the Title property of the content control to the name you want to reference from your code. + * + * Note: In Word, if there are multiple Rich Text content controls with the same Title property value (name), and you try to bind to one these content controls with this method (by specifying its name as the itemName parameter), the operation will fail. + * * @param itemName Name of the bindable object in the document. For Example 'MyExpenses' table in Excel." - * @param bindingType The Office BindingType for the data - * @param options Syntax example: {id: "BindingID"} - * id: Name of the binding, autogenerated if not supplied. - * asyncContext: Object keeping state for the callback - * columns: The string[] of the columns involved in the binding - * @param callback The optional callback method + * @param bindingType The Office BindingType for the data. The method returns null if the selected object cannot be coerced into the specified type. + * @param options An object like {id: "BindingID"} that has any of the following properties: + * + * id: Unique name of the binding. Autogenerated if not supplied. + * + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * + * columns: The string[] of the columns involved in the binding. + * + * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ addFromNamedItemAsync(itemName: string, bindingType: BindingType, options?: any, callback?: (result: AsyncResult) => void): void; /** * Create a binding by prompting the user to make a selection on the document. - * @param bindingType The Office BindingType for the data - * @param options addFromPromptAsyncOptions- e.g. {promptText: "Please select data", id: "mySales"} - * promptText: Greet your users with a friendly word. - * asyncContext: Object keeping state for the callback - * id: Identifier. - * sampleData: A TableData that gives sample table in the Dialog.TableData.Headers is [][] of string. - * @param callback The optional callback method + * + *@remarks + * Hosts: Access, Excel + * + * Available in Requirement set: Not in a set + * + * Last changed in: 1.1 + * + * Adds a binding object of the specified type to the Bindings collection, which will be identified with the supplied id. The method fails if the specified selection cannot be bound. + * + * @param bindingType Specifies the type of the binding object to create. Required. Returns null if the selected object cannot be coerced into the specified type. + * @param options An object like {promptText: "Please select data", id: "mySales"} with any of the following properties: + * + * promptText: Specifies the string to display in the prompt UI that tells the user what to select. Limited to 200 characters. If no promptText argument is passed, "Please make a selection" is displayed. + * + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * + * id: Specifies the unique name to be used to identify the new binding object.If no argument is passed for the id parameter, the Binding.id is autogenerated. + * + * sampleData: Specifies a table of sample data displayed in the prompt UI as an example of the kinds of fields (columns) that can be bound by your add-in. The headers provided in the TableData object specify the labels used in the field selection UI. Optional. Note: This parameter is used only in add-ins for Access. It is ignored if provided when calling the method in an add-in for Excel. + * + * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ addFromPromptAsync(bindingType: BindingType, options?: any, callback?: (result: AsyncResult) => void): void; /** - * Create a binding based on what the user's current selection. - * @param bindingType The Office BindingType for the data - * @param options addFromSelectionAsyncOptions- e.g. {id: "BindingID"} - * id: Identifier. - * asyncContext: Object keeping state for the callback + * Create a binding based on the user's current selection. + * + *@remarks + * Hosts: Access, Excel, Word + * + * Available in Requirement set: MatrixBindings, TableBindings, TextBindings + * + * Last changed in: 1.1 + * + * Adds the specified type of binding object to the Bindings collection, which will be identified with the supplied id. + * + * Note In Excel, if you call the addFromSelectionAsync method passing in the Binding.id of an existing binding, the Binding.type of that binding is used, and its type cannot be changed by specifying a different value for the bindingType parameter.If you need to use an existing id and change the bindingType, call the Bindings.releaseByIdAsync method first to release the binding, and then call the addFromSelectionAsync method to reestablish the binding with a new type. + * + * @param bindingType Specifies the type of the binding object to create. Required. Returns null if the selected object cannot be coerced into the specified type. + * @param options An object like {id: "BindingID"} with any of the following properties: + * + * id: Specifies the unique name to be used to identify the new binding object.If no argument is passed for the id parameter, the Binding.id is autogenerated. + * + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * * columns: The string[] of the columns involved in the binding + * * sampleData: A TableData that gives sample table in the Dialog.TableData.Headers is [][] of string. - * @param callback The optional callback method + * + * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ addFromSelectionAsync(bindingType: BindingType, options?: any, callback?: (result: AsyncResult) => void): void; /** - * Gets an array with all the binding objects in the document. - * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * Gets all bindings that were previously created. + * + *@remarks + * Hosts: Access, Excel, Word + * + * Available in Requirement set: MatrixBindings, TableBindings, TextBindings + * + * Last changed in: 1.1 + * + * @param options An object like {asyncContext:context} where `context` is a user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ getAllAsync(options?: any, callback?: (result: AsyncResult) => void): void; /** * Retrieves a binding based on its Name - * @param id The binding id - * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method - */ + * + *@remarks + * Hosts: Access, Excel, Word + * + * Available in Requirement set: CustomXmlParts, MatrixBindings, TableBindings, TextBindings + * + * Last changed in: 1.1 + * + * Fails if the specified id does not exist. + * + * @param id Specifies the unique name of the binding object. Required. + * @param options An object like {asyncContext:context} where `context` is a user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + */ getByIdAsync(id: string, options?: any, callback?: (result: AsyncResult) => void): void; /** * Removes the binding from the document - * @param id The binding id - * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * + *@remarks + * Hosts: Access, Excel, Word + * + * Available in Requirement set: MatrixBindings, TableBindings, TextBindings + * + * Last changed in: 1.1 + * + * Fails if the specified id does not exist. + * + * @param id Specifies the unique name to be used to identify the binding object. Required. + * @param options An object like {asyncContext:context} where `context` is a user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ releaseByIdAsync(id: string, options?: any, callback?: (result: AsyncResult) => void): void; } + /** + * Represents the runtime environment of the add-in and provides access to key objects of the API. + * + *@remarks + * Hosts: Access, Excel, Outlook, PowerPoint, Project, Word + * + * Last changed in: 1.1 + */ export interface Context { + /** + * Gets an object that represents the document the content or task pane add-in is interacting with. + */ document: Document; } + /** + * Represents an XML node in a tree in a document. + * + *@remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + * + * Last changed in: 1.1 + */ export interface CustomXmlNode { + /** + * Gets the base name of the node without the namespace prefix, if one exists. + * + *@remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + * + * Last changed in: 1.1 + */ baseName: string; + /** + * Retrieves the string GUID of the CustomXMLPart. + * + *@remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + * + * Last changed in: 1.1 + */ namespaceUri: string; + /** + * Gets the type of the CustomXMLNode. + * + *@remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + * + * Last changed in: 1.1 + */ nodeType: string; /** - * Gets the nodes associated with the xPath expression. - * @param xPath The xPath expression - * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * Gets the nodes associated with the XPath expression. + * + *@remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + * + * Last changed in: 1.1 + * + * @param xPath The XPath expression that specifies the nodes to get. Required. + * @param options An object like {asyncContext:context} where `context` is a user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ getNodesAsync(xPath: string, options?: any, callback?: (result: AsyncResult) => void): void; /** * Gets the node value. - * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * + *@remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + * + * Last changed in: 1.1 + * + * @param options An object like {asyncContext:context} where `context` is a user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ getNodeValueAsync(options?: any, callback?: (result: AsyncResult) => void): void; /** - * Asynchronously gets the text of an XML node in a custom XML part. - * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * Gets the text of an XML node in a custom XML part. + * + *@remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + * + * Last changed in: 1.2 + * + * @param options An object like {asyncContext:context} where `context` is a user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ getTextAsync(options?: any, callback?: (result: AsyncResult) => void): void; /** * Gets the node's XML. - * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * + *@remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + * + * Last changed in: 1.1 + * + * @param options An object like {asyncContext:context} where `context` is a user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ getXmlAsync(options?: any, callback?: (result: AsyncResult) => void): void; /** * Sets the node value. + * + *@remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + * + * Last changed in: 1.1 + * * @param value The value to be set on the node - * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * @param options An object like {asyncContext:context} where `context` is a user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ setNodeValueAsync(value: string, options?: any, callback?: (result: AsyncResult) => void): void; /** * Asynchronously sets the text of an XML node in a custom XML part. + * + *@remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + * + * Last changed in: 1.2 + * * @param text Required. The text value of the XML node. - * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method - */ + * @param options An object like {asyncContext:context} where `context` is a user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + */ setTextAsync(text: string, options?: any, callback?: (result: AsyncResult) => void): void; /** * Sets the node XML. + * + *@remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + * + * Last changed in: 1.1 + * * @param xml The XML to be set on the node - * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method - */ + * @param options An object like {asyncContext:context} where `context` is a user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + */ setXmlAsync(xml: string, options?: any, callback?: (result: AsyncResult) => void): void; } + /** + * Represents a single CustomXMLPart in a CustomXMLParts collection. + * + *@remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + * + * Last changed in: 1.1 + */ export interface CustomXmlPart { + /** + * True, if the custom XML part is built in; otherwise false. + * + *@remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + * + * Last changed in: 1.1 * + */ builtIn: boolean; + /** + * Gets the GUID of the CustomXMLPart. + * + *@remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + * + * Last changed in: 1.1 * + */ id: string; + /** + * Gets the set of namespace prefix mappings (CustomXMLPrefixMappings) used against the current CustomXMLPart. + * + *@remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + * + * Last changed in: 1.1 * + */ namespaceManager: CustomXmlPrefixMappings; /** * Adds an event handler to the object using the specified event type. - * @param eventType The event type. For CustomXmlPartNode it can be 'nodeDeleted', 'nodeInserted' or 'nodeReplaced' - * @param handler The name of the handler - * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * + *@remarks + * Hosts: Word + * + * Last changed in: 1.1 + * + * You can add multiple event handlers for the specified eventType as long as the name of each event handler function is unique. + * + * @param eventType Specifies the type of event to add. Required. For a CustomXmlPart object event, the eventType parameter can be specified as Office.EventType.DataNodeDeleted, Office.EventType.DataNodeInserted, Office.EventType.DataNodeReplaced, or the corresponding text values of these enumerations. + * @param handler The event handler function to add, whose only parameter is of type NodeDeletedEventArgs, NodeInsertedEventArgs, or NodeReplaceEventArgs. Required. + * @param options An object like {asyncContext:context} where `context` is a user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ - addHandlerAsync(eventType: EventType, handler?: (result: any) => void, options?: any, callback?: (result: AsyncResult) => void): void; + addHandlerAsync(eventType: EventType, handler: (result: any) => void, options?: any, callback?: (result: AsyncResult) => void): void; /** * Deletes the Custom XML Part. - * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * + *@remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + * + * Last changed in: 1.1 + * + * @param options An object like {asyncContext:context} where `context` is a user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ deleteAsync(options?: any, callback?: (result: AsyncResult) => void): void; /** - * Gets the nodes associated with the xPath expression. - * @param xPath The xPath expression - * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method - */ + * Asynchronously gets any CustomXmlNodes in this custom XML part which match the specified XPath. + * + *@remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + * + * Last changed in: 1.1 + * + * @param xPath An XPath expression that specifies the nodes you want returned. Required. + * @param options An object like {asyncContext:context} where `context` is a user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + */ getNodesAsync(xPath: string, options?: any, callback?: (result: AsyncResult) => void): void; /** - * Gets the XML for the Custom XML Part. - * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method - */ + * Asynchronously gets the XML inside this custom XML part. + * + *@remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + * + * Last changed in: 1.1 + * + * @param options An object like {asyncContext:context} where `context` is a user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + */ getXmlAsync(options?: any, callback?: (result: AsyncResult) => void): void; /** - * Removes an event handler from the object using the specified event type. - * @param eventType The event type. For CustomXmlPartNode it can be 'nodeDeleted', 'nodeInserted' or 'nodeReplaced' - * @param options Syntax example: {handler:eventHandler} - * handler: Indicates a specific handler to be removed, if not specified all handlers are removed - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * Removes an event handler for the specified event type. + * + *@remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + * + * Last changed in: 1.1 + * + * @param eventType Specifies the type of event to remove. Required.For a CustomXmlPart object event, the eventType parameter can be specified as Office.EventType.DataNodeDeleted, Office.EventType.DataNodeInserted, Office.EventType.DataNodeReplaced, or the corresponding text values of these enumerations. + * @param handler The event handler function to remove. If not specified, all event handlers for the specified eventType will be removed. + * @param options An object like {asyncContext:context} where `context` is a user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ - removeHandlerAsync(eventType: EventType, options?: any, callback?: (result: AsyncResult) => void): void; + removeHandlerAsync(eventType: EventType, handler?: (result: any) => void, options?: any, callback?: (result: AsyncResult) => void): void; } + /** + * Represents a collection of CustomXmlPart objects. + * + *@remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + * + * Last changed in: 1.1 + */ export interface CustomXmlParts { /** * Asynchronously adds a new custom XML part to a file. + * + *@remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + * + * Last changed in: 1.1 + * * @param xml The XML to add to the newly created custom XML part. - * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback + * @param options An object like {asyncContext:context} where `context` is a user-defined item of any type that is returned in the AsyncResult object without being altered. * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ addAsync(xml: string, options?: any, callback?: (result: AsyncResult) => void): void; /** * Asynchronously gets the specified custom XML part by its id. - * @param id The id of the custom XML part. - * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback + * + *@remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + * + * Last changed in: 1.1 + * + * @param id The GUID of the custom XML part, including opening and closing braces. + * @param options An object like {asyncContext:context} where `context` is a user-defined item of any type that is returned in the AsyncResult object without being altered. * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ getByIdAsync(id: string, options?: any, callback?: (result: AsyncResult) => void): void; /** * Asynchronously gets the specified custom XML part(s) by its namespace. - * @param ns The namespace to search. - * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback + * + *@remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + * + * Last changed in: 1.1 + * + * @param ns The namespace URI. + * @param options An object like {asyncContext:context} where `context` is a user-defined item of any type that is returned in the AsyncResult object without being altered. * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. - */ + */ getByNamespaceAsync(ns: string, options?: any, callback?: (result: AsyncResult) => void): void; } + /** + * Represents a collection of CustomXmlPart objects. + * + *@remarks + * Hosts: Word + * + * Last changed in: 1.1 + */ export interface CustomXmlPrefixMappings { /** - * Adds a namespace. - * @param prefix The namespace prefix - * @param ns The namespace URI - * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * Asynchronously adds a prefix to namespace mapping to use when querying an item. + * + *@remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + * + * Last changed in: 1.1 + * + * If no namespace is assigned to the requested prefix, the method returns an empty string (""). + * + * @param prefix Specifies the prefix to add to the prefix mapping list. Required. + * @param ns Specifies the namespace URI to assign to the newly added prefix. Required. + * @param options An object like {asyncContext:context} where `context` is a user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ addNamespaceAsync(prefix: string, ns: string, options?: any, callback?: (result: AsyncResult) => void): void; /** - * Gets a namespace with the specified prefix - * @param prefix The namespace prefix - * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * Asynchronously gets the namespace mapped to the specified prefix. + * + *@remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + * + * Last changed in: 1.1 + * + * If the prefix already exists in the namespace manager, this method will overwrite the mapping of that prefix except when the prefix is one added or used by the data store internally, in which case it will return an error. + * + * @param prefix TSpecifies the prefix to get the namespace for. Required. + * @param options An object like {asyncContext:context} where `context` is a user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ getNamespaceAsync(prefix: string, options?: any, callback?: (result: AsyncResult) => void): void; /** - * Gets a prefix for the specified URI - * @param ns The namespace URI - * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method - */ + * Asynchronously gets the prefix for the specified namespace. + * + *@remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + * + * Last changed in: 1.1 + * + * If no prefix is assigned to the requested namespace, the method returns an empty string (""). If there are multiple prefixes specified in the namespace manager, the method returns the first prefix that matches the supplied namespace. + * + * @param ns Specifies the namespace to get the prefix for. Required. + * @param options An object like {asyncContext:context} where `context` is a user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + */ getPrefixAsync(ns: string, options?: any, callback?: (result: AsyncResult) => void): void; } + /** + * An abstract class that represents the document the add-in is interacting with. + * + *@remarks + * Hosts: Access, Excel, PowerPoint, Project, Word + * + * Last changed in: 1.1 + */ export interface Document { + /** + * Gets an object that provides access to the bindings defined in the document. + * + *@remarks + * Hosts: Access, Excel, Word + * + * Last changed in: 1.1 + * + * You don't instantiate the Document object directly in your script. To call members of the Document object to interact with the current document or worksheet, use Office.context.document in your script. + */ bindings: Bindings; + /** + * Gets an object that represents the custom XML parts in the document. + * + *@remarks + * Hosts: Word + * + * Last changed in: 1.1 + */ customXmlParts: CustomXmlParts; + /** + * Gets the mode the document is in. + * + *@remarks + * Hosts: Word + * + * Last changed in: 1.1 + */ mode: DocumentMode; + /** + * Gets an object that represents the saved custom settings of the content or task pane add-in for the current document. + * + *@remarks + * Hosts: Word + * + * Last changed in: 1.1 + */ settings: Settings; + /** + * Gets the URL of the document that the host application currently has open. Returns null if the URL is unavailable. + * + *@remarks + * Hosts: Word + * + * Last changed in: 1.1 + */ url: string; /** - * Adds an event handler for the specified event type. - * @param eventType The event type. For document can be 'DocumentSelectionChanged' - * @param handler The name of the handler - * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * Adds an event handler for a Document object event. + * + *@remarks + * Hosts: Excel, PowerPoint, Project, Word + * + * Available in Requirement set: DocumentEvents + * + * Last changed in: 1.1 + * + * You can add multiple event handlers for the specified eventType as long as the name of each event handler function is unique. + * + * @param eventType For a Document object event, the eventType parameter can be specified as Office.EventType.Document.SelectionChanged or Office.EventType.Document.ActiveViewChanged, or the corresponding text value of this enumeration. + * @param handler The event handler function to add, whose only parameter is of type DocumentSelectionChangedEventArgs. Required. + * @param options An object like {asyncContext:context} where `context` is a user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ addHandlerAsync(eventType: EventType, handler: any, options?: any, callback?: (result: AsyncResult) => void): void; /** - * Returns the current view of the presentation. - * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method - */ + * Returns the state of the current view of the presentation (edit or read). + * + *@remarks + * Hosts: Excel, PowerPoint, Word + * + * Available in Requirement set: ActiveView + * + * Last changed in: 1.1 + * + * Can trigger an event when the view changes. + * + * @param options An object like {asyncContext:context} where `context` is a user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + */ getActiveViewAsync(options?: any, callback?: (result: AsyncResult) => void): void; /** - * Gets the entire file in slices of up to 4MB. + * Returns the entire document file in slices of up to 4194304 bytes (4 MB). For add-ins for iOS, file slice is supported up to 65536 (64 KB). Note that specifying file slice size of above permitted limit will result in an "Internal Error" failure. + * + *@remarks + * Hosts: Excel, PowerPoint, Word + * + * Available in Requirement set: File + * + * Last changed in: 1.1 + * + * For add-ins running in Office host applications other than Office for iOS, the getFileAsync method supports getting files in slices of up to 4194304 bytes (4 MB). For add-ins running in Office for iOS apps, the getFileAsync method supports getting files in slices of up to 65536 (64 KB). + * + * The fileType parameter can be specified by using the FileType enumeration or text values. But the possible values vary with the host: + * + * Excel Online, Win32, Mac, and iOS: Office.FileType.Compressed + * + * PowerPoint on Windows desktop, Mac, and iPad, and PowerPoint Online: Office.FileType.Compressed, Office.FileType.Pdf + * + * Word on Windows desktop, Word on Mac, and Word Online: Office.FileType.Compressed, Office.FileType.Pdf, Office.FileType.Text + * + * Word on iPad: Office.FileType.Compressed, Office.FileType.Text + * * @param fileType The format in which the file will be returned - * @param options Syntax example: {sliceSize:1024} + * @param options An object like {sliceSize:1024} that has any of the following properties: + * * sliceSize: Specifies the desired slice size (in bytes) up to 4MB. If not specified a default slice size of 4MB will be used. + * + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * * @param callback The optional callback method */ getFileAsync(fileType: FileType, options?: any, callback?: (result: AsyncResult) => void): void; /** * Gets file properties of the current document. - * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method - */ + * + *@remarks + * Hosts: Excel, PowerPoint, Word + * + * Available in Requirement set: not in a set + * + * Last changed in: 1.1 + * + * You get the file's URL with the url property ( asyncResult.value.url). + * + * @param options An object like {asyncContext:context} where `context` is a user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + */ getFilePropertiesAsync(options?: any, callback?: (result: AsyncResult) => void): void; /** - * Returns the current selection. - * @param coercionType The expected shape of the selection. - * @param options Syntax example: {valueFormat: 'formatted', filterType:'all'} + * Reads the data contained in the current selection in the document. + * + *@remarks + * Hosts: Access, Excel, PowerPoint, Project, Word + * + * Available in Requirement set: Selection + * + * Last changed in: 1.1 + * + * The possible values for the coercionType parameter vary by the host: + * + * Excel, Excel Online, PowerPoint, PowerPoint Online, Word, and Word Online only: Office.CoercionType.Text (string) + * + * Excel, Word, and Word Online only: Office.CoercionType.Matrix (array of arrays) + * + * Access, Excel, Word, and Word Online only: Office.CoercionType.Table (TableData object) + * + * Word only: Office.CoercionType.Html + * + * Word and Word Online only: Office.CoercionType.Ooxml (Office Open XML) + * + * PowerPoint and PowerPoint Online only: Office.CoercionType.SlideRange + * + * @param coercionType The type of data structure to return. + * @param options An object like {valueFormat: 'formatted', filterType:'all'} that has any of the following properties: + * * valueFormat: Get data with or without format. Use Office.ValueFormat or text value. - * filterType: Get the visible or all the data. Useful when filtering data. Use Office.FilterType or text value. - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * + * filterType: Get the visible or all the data. Useful when filtering data. Use Office.FilterType or text value. This parameter is ignored in Word documents. + * + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * + * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ getSelectedDataAsync(coercionType: CoercionType, options?: any, callback?: (result: AsyncResult) => void): void; /** * Goes to the specified object or location in the document. + * + *@remarks + * Hosts: Excel, PowerPoint, Word + * + * Available in Requirement set: not in a set + * + * Last changed in: 1.1 + * + * PowerPoint doesn't support the goToByIdAsync method in Master Views. + * + * The behavior caused by the selectionMode option varies by host: + * + * In Excel: Office.SelectionMode.Selected selects all content in the binding, or named item. Office.SelectionMode.None for text bindings, selects the cell; for matrix bindings, table bindings, and named items, selects the first data cell (not first cell in header row for tables). + * + * In PowerPoint: Office.SelectionMode.Selected selects the slide title or first textbox on the slide. Office.SelectionMode.None Doesn't select anything. + * + * In Word: Office.SelectionMode.Selected selects all content in the binding. Office.SelectionMode.None for text bindings, moves the cursor to the beginning of the text; for matrix bindings and table bindings, selects the first data cell (not first cell in header row for tables). + * * @param id The identifier of the object or location to go to. * @param goToType The type of the location to go to. - * @param options Syntax example: {asyncContext:context} - * selectionMode: Use Office.SelectionMode or text value. - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * @param options An object like {asyncContext:context} with any of the following values: + * + * selectionMode: Specifies whether the location specified by the id parameter is selected (highlighted). Use Office.SelectionMode or text value. See Remarks for more. + * + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * + * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ goToByIdAsync(id: string | number, goToType: GoToType, options?: any, callback?: (result: AsyncResult) => void): void; /** * Removes an event handler for the specified event type. - * @param eventType The event type. For document can be 'DocumentSelectionChanged' - * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * handler: The name of the handler. If not specified all handlers are removed - * @param callback The optional callback method + * + *@remarks + * Hosts: Excel, PowerPoint, Project, Word + * + * Available in Requirement set: DocumentEvents + * + * Last changed in: 1.1 + * @param eventType The event type. For document can be 'Document.SelectionChanged' or 'Document.ActiveViewChanged'. + * @param options An object like Syntax example: {asyncContext:context} that has any of the following properties: + * + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * + * handler: The name of the handler. If not specified all handlers are removed. + * + * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ removeHandlerAsync(eventType: EventType, options?: any, callback?: (result: AsyncResult) => void): void; /** * Writes the specified data into the current selection. - * @param data The data to be set. Either a string or value, 2d array or TableData object - * @param options Syntax example: {coercionType:Office.CoercionType.Matrix} or {coercionType: 'matrix'} + * + *@remarks + * Hosts: Access, Excel, PowerPoint, Project, Word, Word Online + * + * Available in Requirement set: Selection + * + * Last changed in: 1.1 + * + * The possible CoercionTypes that can be used for the data parameter, or for the coercionType option, vary by host: + * + * Office.CoercionType.Text: Excel, Word, PowerPoint + * + * Office.CoercionType.Matrix: Excel, Word + * + * Office.CoercionType.Table: Access, Excel, Word + * + * Office.CoercionType.Html: Word + * + * Office.CoercionType.Ooxml: Word + * + * Office.CoercionType.Image: Excel, Word, PowerPoint + * + * @param data The data to be set. Either a string or CoercionType value, 2d array or TableData object. + * @param options An object like {coercionType:Office.CoercionType.Matrix} with any of the following properties: + * * coercionType: Explicitly sets the shape of the data object. Use Office.CoercionType or text value. If not supplied is inferred from the data type. - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * + * tableOptions: For an inserted table, a list of key-value pairs that specify table formatting options, such as header row, total row, and banded rows + * + * cellFormat: For an inserted table, a list of key-value pairs that specify a range of columns, rows, or cells and the cell formatting to apply to that range + * + * imageLeft: (number) This option is applicable for inserting images. Indicates the insert location in relation to the left side of the slide for PowerPoint, and its relation to the currently selected cell in Excel. This value is ignored for Word. This value is in points. + * + * imageTop: (number) This option is applicable for inserting images. Indicates the insert location in relation to the top of the slide for PowerPoint, and its relation to the currently selected cell in Excel. This value is ignored for Word. This value is in points. + * + * imageWidth: (number) This option is applicable for inserting images. Indicates the image width. If this option is provided without the imageHeight, the image will scale to match the value of the image width. If both image width and image height are provided, the image will be resized accordingly. If neither the image height or width is provided, the default image size and aspect ratio will be used. This value is in points. + * + * imageHeight: (number) This option is applicable for inserting images. Indicates the image height. If this option is provided without the imageWidth, the image will scale to match the value of the image height. If both image width and image height are provided, the image will be resized accordingly. If neither the image height or width is provided, the default image size and aspect ratio will be used. This value is in points. + * + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ setSelectedDataAsync(data: string | TableData | any[][], options?: any, callback?: (result: AsyncResult) => void): void; } @@ -982,18 +1717,60 @@ declare namespace Office { */ type: EventType; } + /** + * Represents the document file associated with an Office Add-in. + * + * @remarks + * Access the File object with the AsyncResult.value property in the callback function passed to the Document.getFileAsync method. + * + * Hosts: PowerPoint, Word + */ export interface File { + /** + * Gets the document file size in bytes. + * @remarks + * Hosts: PowerPoint, Word + */ size: number; + /** + * Gets the number of slices into which the file is divided. + * @remarks + * Hosts: PowerPoint, Word + */ sliceCount: number; /** - * Closes the File. - * @param callback The optional callback method + * Closes the document file. + * @remarks + * No more than two documents are allowed to be in memory; otherwise the Document.getFileAsync operation will fail. Use the File.closeAsync method to close the file when you are finished working with it. + * + * Hosts: PowerPoint, Word + * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. Optional. + * @remarks + * When the function you passed to the callback parameter executes, it receives an AsyncResult object that you can access from the callback function's only parameter. + * In the callback function passed to the closeAsync method, you can use the properties of the AsyncResult object to return the following information. + * |Property |Use to...| + * |---------|---------| + * |AsyncResult.value|Always returns undefined because there is no object or data to retrieve.| + * |AsyncResult.status|Determine the success or failure of the operation.| + * |AsyncResult.error|Access an Error object that provides error information if the operation failed.| + * |AsyncResult.asyncContext|Access your user-defined object or value, if you passed one as the asyncContext parameter.| */ closeAsync(callback?: (result: AsyncResult) => void): void; /** - * Gets the specified slice. - * @param sliceIndex The index of the slice to be retrieved - * @param callback The optional callback method + * Returns the specified slice. + * @remarks + * Hosts: PowerPoint, Word + * @param sliceIndex Specifies the zero-based index of the slice to be retrieved. Required. + * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. Optional. + * @remarks + * When the function you passed to the callback parameter executes, it receives an AsyncResult object that you can access from the callback function's only parameter. + * In the callback function passed to the getSliceAsync method, you can use the properties of the AsyncResult object to return the following information. + * |Property |Use to...| + * |---------|---------| + * |AsyncResult.value|Access the Slice object.| + * |AsyncResult.status|Determine the success or failure of the operation.| + * |AsyncResult.error|Access an Error object that provides error information if the operation failed.| + * |AsyncResult.asyncContext|Access your user-defined object or value, if you passed one as the asyncContext parameter.| */ getSliceAsync(sliceIndex: number, callback?: (result: AsyncResult) => void): void; } @@ -1006,684 +1783,2538 @@ declare namespace Office { /** * Represents a binding in two dimensions of rows and columns. * - * **Hosts**: Excel, Word + *@remarks + * Hosts: Excel, Word * - * **Available in Requirement set**: MatrixBindings + * Available in Requirement set: MatrixBindings * - * **Last changed in**: 1.1 + * Last changed in: 1.1 * - * @remarks * The MatrixBinding object inherits the id property, type property, getDataAsync method, and setDataAsync method from the Binding object. */ export interface MatrixBinding extends Binding { /** * Gets the number of columns in the matrix data structure, as an integer value. * - * **Hosts**: Access, Excel, PowerPoint, Project, Word + *@remarks + * Hosts: Access, Excel, PowerPoint, Project, Word * * Available in Requirement set: MatrixBindings * - * **Last changed in**: 1.1 + * Last changed in: 1.1 */ columnCount: number; /** * Gets the number of rows in the matrix data structure, as an integer value. * - * **Hosts**: Access, Excel, PowerPoint, Project, Word + *@remarks + * Hosts: Access, Excel, PowerPoint, Project, Word * * Available in Requirement set: MatrixBindings * - * **Last changed in**: 1.1 + * Last changed in: 1.1 */ rowCount: number; } + /** + * Represents custom settings for a task pane or content add-in that are stored in the host document as name/value pairs. + * + * @remarks + * The settings created by using the methods of the Settings object are saved per add-in and per document. That is, they are available only to the add-in that created them, and only from the document in which they are saved. + * + * The name of a setting is a string, while the value can be a string, number, boolean, null, object, or array. + * + * The Settings object is automatically loaded as part of the Document object, and is available by calling the settings property of that object when the add-in is activated. The developer is responsible for calling the saveAsync method after adding or deleting settings to save the settings in the document. + * + * Hosts: Access, Excel, PowerPoint, Word + */ export interface Settings { /** - * Adds an event handler for the object using the specified event type. - * @param eventType The event type. For settings can be 'settingsChanged' - * @param handler The name of the handler - * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * Adds an event handler for the settingsChanged event. + * @remarks + * You can add multiple event handlers for the specified eventType as long as the name of each event handler function is unique. + * + * > [!IMPORTANT] + * > Your add-in's code can register a handler for the settingsChanged event when the add-in is running with any Excel client, but the event will fire only when the add-in is loaded with a spreadsheet that is opened in Excel Online, and more than one user is editing the spreadsheet (co-authoring). Therefore, effectively the settingsChanged event is supported only in Excel Online in co-authoring scenarios. + * + * Hosts: Excel + * @param eventType Specifies the type of event to add. Required. + * @param handler The event handler function to add. Required. + * @param options Specifies any of the following optional parameters. + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @remarks + * When the function you passed to the callback parameter executes, it receives an AsyncResult object that you can access from the callback function's only parameter. + * In the callback function passed to the addHandlerAsync method, you can use the properties of the AsyncResult object to return the following information. + * |Property |Use to...| + * |---------|---------| + * |AsyncResult.value|Always returns undefined because there is no data or object to retrieve when adding an event handler.| + * |AsyncResult.status|Determine the success or failure of the operation.| + * |AsyncResult.error|Access an Error object that provides error information if the operation failed.| + * |AsyncResult.asyncContext|Access your user-defined object or value, if you passed one as the asyncContext parameter.| */ addHandlerAsync(eventType: EventType, handler: any, options?: any, callback?: (result: AsyncResult) => void): void; /** - * Retrieves the setting with the specified name. - * @param settingName The name of the setting + * Retrieves the specified setting. + * @remarks + * Hosts: Access, Excel, PowerPoint, Word + * @param settingName The case-sensitive name of the setting to retrieve. + * @returns An object that has property names mapped to JSON serialized values. */ get(name: string): any; /** - * Gets the latest version of the settings object. - * @param callback The optional callback method + * Reads all settings persisted in the document and refreshes the content or task pane add-in's copy of those settings held in memory. + * @remarks + * This method is useful in Word and PowerPoint coauthoring scenarios when multiple instances of the same add-in are working against the same document. Because each add-in is working against an in-memory copy of the settings loaded from the document at the time the user opened it, the settings values used by each user can get out of sync. This can happen whenever an instance of the add-in calls the Settings.saveAsync method to persist all of that user's settings to the document. Calling the refreshAsync method from the event handler for the settingsChanged event of the add-in will refresh the settings values for all users. + * The refreshAsync method can be called from add-ins created for Excel, but since it doesn't support coauthoring there is no reason to do so. + * + * Hosts: Access, Excel, PowerPoint, Word + * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @remarks + * When the function you passed to the callback parameter executes, it receives an AsyncResult object that you can access from the callback function's only parameter. + * In the callback function passed to the refreshAsync method, you can use the properties of the AsyncResult object to return the following information. + * |Property |Use to...| + * |---------|---------| + * |AsyncResult.value|Access a Settings object with the refreshed values.| + * |AsyncResult.status|Determine the success or failure of the operation.| + * |AsyncResult.error|Access an Error object that provides error information if the operation failed.| + * |AsyncResult.asyncContext|Access your user-defined object or value, if you passed one as the asyncContext parameter.| */ refreshAsync(callback?: (result: AsyncResult) => void): void; /** - * Removes the setting with the specified name. - * @param settingName The name of the setting + * Removes the specified setting. + * @remarks + * null is a valid value for a setting. Therefore, assigning null to the setting will not remove it from the settings property bag. + * + * > [!IMPORTANT] + * > Be aware that the Settings.remove method affects only the in-memory copy of the settings property bag. To persist the removal of the specified setting in the document, at some point after calling the Settings.remove method and before the add-in is closed, you must call the Settings.saveAsync method. + * Hosts: Access, Excel, PowerPoint, Word + * @param settingName The case-sensitive name of the setting to remove. */ remove(name: string): void; /** - * Removes an event handler for the specified event type. - * @param eventType The event type. For settings can be 'settingsChanged' - * @param options Syntax example: {handler:eventHandler} - * handler: Indicates a specific handler to be removed, if not specified all handlers are removed - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * Removes an event handler for the settingsChanged event. + * @remarks + * If the optional handler parameter is omitted when calling the removeHandlerAsync method, all event handlers for the specified eventType will be removed. + * + * Hosts: Access, Excel, PowerPoint + * @param eventType Specifies the type of event to remove. Required. + * @param options Specifies any of the following optional parameters. + * @param handler Specifies the name of the handler to remove. + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @remarks + * When the function you passed to the callback parameter executes, it receives an AsyncResult object that you can access from the callback function's only parameter. + * In the callback function passed to the removeHandlerAsync method, you can use the properties of the AsyncResult object to return the following information. */ removeHandlerAsync(eventType: EventType, options?: any, callback?: (result: AsyncResult) => void): void; /** - * Saves all settings. + * Persists the in-memory copy of the settings property bag in the document. + * @remarks + * Any settings previously saved by an add-in are loaded when it is initialized, so during the lifetime of the session you can just use the set and get methods to work with the in-memory copy of the settings property bag. When you want to persist the settings so that they are available the next time the add-in is used, use the saveAsync method. + * + * > [!NOTE] + * > The saveAsync method persists the in-memory settings property bag into the document file; however, the changes to the document file itself are saved only when the user (or AutoRecover setting) saves the document to the file system. + * > The refreshAsync method is only useful in coauthoring scenarios (which are only supported in Word) when other instances of the same add-in might change the settings and those changes should be made available to all instances. + * + * Hosts: Access, Excel, PowerPoint, Word * @param options Syntax example: {overwriteIfStale:false} - * overwriteIfStale: Indicates whether the setting will be replaced if stale. - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * @param overwriteIfStale Indicates whether the setting will be replaced if stale. + * asyncContext: Object keeping state for the callback + * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. Optional. + * @remarks + * When the function you passed to the callback parameter executes, it receives an AsyncResult object that you can access from the callback function's only parameter. + * In the callback function passed to the saveAsync method, you can use the properties of the AsyncResult object to return the following information. + * |Property |Use to...| + * |---------|---------| + * |AsyncResult.value|Always returns undefined because there is no object or data to retrieve.| + * |AsyncResult.status|Determine the success or failure of the operation.| + * |AsyncResult.error|Access an Error object that provides error information if the operation failed.| + * |AsyncResult.asyncContext|Access your user-defined object or value, if you passed one as the asyncContext parameter.| */ saveAsync(callback?: (result: AsyncResult) => void): void; /** - * Sets a value for the setting with the specified name. - * @param settingName The name of the setting - * @param value The value for the setting + * Sets or creates the specified setting. + * @remarks + * The set method creates a new setting of the specified name if it does not already exist, or sets an existing setting of the specified name in the in-memory copy of the settings property bag. After you call the Settings.saveAsync method, the value is stored in the document as the serialized JSON representation of its data type. A maximum of 2MB is available for the settings of each add-in. + * + * > [!IMPORTANT] + * > Be aware that the Settings.set method affects only the in-memory copy of the settings property bag. To make sure that additions or changes to settings will be available to your add-in the next time the document is opened, at some point after calling the Settings.set method and before the add-in is closed, you must call the Settings.saveAsync method to persist settings in the document. + * + * Hosts: Access, Excel, PowerPoint, Word + * @param settingName The case-sensitive name of the setting to set or create. + * @param value Specifies the value to be stored. */ set(name: string, value: any): void; } + /** + * Represents a slice of a document file. + * @remarks + * The Slice object is accessed with the File.getSliceAsync method. + * + * Hosts: PowerPoint, Word + */ export interface Slice { + /** + * Gets the raw data of the file slice in Office.FileType.Text ("text") or Office.FileType.Compressed ("compressed") format as specified by the fileType parameter of the call to the Document.getFileAsync method. + * @remarks + * Files in the "compressed" format will return a byte array that can be transformed to a base64-encoded string if required. + * + * Hosts: PowerPoint, Word + */ data: any; + /** + * Gets the zero-based index of the file slice. + * @remarks + * Hosts: PowerPoint, Word + */ index: number; + /** + * Gets the size of the slice in bytes. + * @remarks + * Hosts: PowerPoint, Word + */ size: number; } + /** + * Represents a binding in two dimensions of rows and columns, optionally with headers. + * + *@remarks + * Hosts: Access, Excel, PowerPoint, Project, Word + * + * Available in Requirement set: TableBindings + * + * Last changed in: 1.1 + * + * The TableBinding object inherits the id property, type property, getDataAsync method, and setDataAsync method from the Binding object. + * + * For Excel, note that after you establish a table binding in Excel, each new row a user adds to the table is automatically included in the binding and rowCount increases. + */ export interface TableBinding extends Binding { + /** + * Gets the number of columns in the TableBinding, as an integer value. + * + *@remarks + * Hosts: Access, Excel,Word + * + * Available in Requirement set: TableBindings + * + * Last changed in: 1.1 + */ columnCount: number; + /** + * True, if the table has headers; otherwise false. + * + *@remarks + * Hosts: Access, Excel, PowerPoint, Project, Word + * + * Available in Requirement set: TableBindings + * + * Last changed in: 1.1 + */ hasHeaders: boolean; + /** + * Gets the number of rows in the TableBinding, as an integer value. + * + *@remarks + * Hosts: Access, Excel,Word + * + * Available in Requirement set: TableBindings + * + * Last changed in: 1.1 + * + * When you insert an empty table by selecting a single row in Excel 2013 and Excel Online (using Table on the Insert tab), both Office host applications create a single row of headers followed by a single blank row. However, if your add-in's script creates a binding for this newly inserted table (for example, by using the addFromSelectionAsync method), and then checks the value of the rowCount property, the value returned will differ depending whether the spreadsheet is open in Excel 2013 or Excel Online. + + * - In Excel on the desktop, rowCount will return 0 (the blank row following the headers is not counted). + * + * - In Excel Online, rowCount will return 1 (the blank row following the headers is counted). + * + * You can work around this difference in your script by checking if rowCount == 1, and if so, then checking if the row contains all empty strings. + * + * In content add-ins for Access, for performance reasons the rowCount property always returns -1. + */ rowCount: number; /** - * Adds the specified columns to the table - * @param tableData A TableData object with the headers and rows - * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * Adds the specified data to the table as additional columns. + * + *@remarks + * Hosts: Excel, Word + * + * Available in Requirement set: TableBindings + * + * Last changed in: 1.0 + * + * To add one or more columns specifying the values of the data and headers, pass a TableData object as the data parameter. To add one or more columns specifying only the data, pass an array of arrays ("matrix") as the data parameter. + * + * The success or failure of an addColumnsAsync operation is atomic. That is, the entire add columns operation must succeed, or it will be completely rolled back (and the AsyncResult.status property returned to the callback will report failure): + * + * - Each row in the array you pass as the data argument must have the same number of rows as the table being updated. If not, the entire operation will fail. + * + * - Each row and cell in the array must successfully add that row or cell to the table in the newly added column(s). If any row or cell fails to be set for any reason, the entire operation will fail. + * + * - If you pass a TableData object as the data argument, the number of header rows must match that of the table being updated. + * + * Additional remark for Excel Online: The total number of cells in the TableData object passed to the data parameter can't exceed 20,000 in a single call to this method. + * + * @param tableData An array of arrays ("matrix") or a TableData object that contains one or more columns of data to add to the table. Required. + * @param options The object like {asyncContext:context}, where context is a user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ addColumnsAsync(tableData: TableData | any[][], options?: any, callback?: (result: AsyncResult) => void): void; /** - * Adds the specified rows to the table - * @param rows A 2D array with the rows to add - * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * Adds the specified data to the table as additional rows. + * + *@remarks + * Hosts: Access, Excel, Word + * + * Available in Requirement set: TableBindings + * + * Last changed in: 1.1 + * + * To add one or more columns specifying the values of the data and headers, pass a TableData object as the data parameter. To add one or more columns specifying only the data, pass an array of arrays ("matrix") as the data parameter. + * + * The success or failure of an addRowsAsync operation is atomic. That is, the entire add columns operation must succeed, or it will be completely rolled back (and the AsyncResult.status property returned to the callback will report failure): + * + * - Each row in the array you pass as the data argument must have the same number of columns as the table being updated. If not, the entire operation will fail. + * + * - Each column and cell in the array must successfully add that column or cell to the table in the newly added rows(s). If any column or cell fails to be set for any reason, the entire operation will fail. + * + * - If you pass a TableData object as the data argument, the number of header rows must match that of the table being updated. + * + * Additional remark for Excel Online: The total number of cells in the TableData object passed to the data parameter can't exceed 20,000 in a single call to this method. + * + * @param rows An array of arrays ("matrix") or a TableData object that contains one or more rows of data to add to the table. Required. + * @param options The object like {asyncContext:context}, where context is a user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ addRowsAsync(rows: TableData | any[][], options?: any, callback?: (result: AsyncResult) => void): void; /** - * Clears the table - * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * Deletes all non-header rows and their values in the table, shifting appropriately for the host application. + * + *@remarks + * Hosts: Access, Excel, Word + * + * Available in Requirement set: TableBindings + * + * Last changed in: 1.1 + * + * In Excel, if the table has no header row, this method will delete the table itself. + * + * @param options The object like {asyncContext:context}, where context is a user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ deleteAllDataValuesAsync(options?: any, callback?: (result: AsyncResult) => void): void; /** * Clears formatting on the bound table. - * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * + *@remarks + * Hosts: Excel + * + * Available in Requirement set: Not in a set + * + * Last changed in: 1.1 + * + * See [Format tables in add-ins for Excel](https://docs.microsoft.com/en-us/office/dev/add-ins/excel/excel-add-ins-tables#format-a-table) for more information. + * + * @param options The object like {asyncContext:context}, where context is a user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ clearFormatsAsync(options?: any, callback?: (result: AsyncResult) => void): void; /** * Gets the formatting on specified items in the table. * @param cellReference An object literal containing name-value pairs that specify the range of cells to get formatting from. * @param formats An array specifying the format properties to get. - * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * @param options The object {asyncContext:context}, where context is a user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ getFormatsAsync(cellReference?: any, formats?: any[], options?: any, callback?: (result: AsyncResult) => void): void; /** * Sets formatting on specified items and data in the table. + * + *@remarks + * Hosts: Excel + * + * Available in Requirement set: Not in a set + * + * Last changed in: 1.1 + * * @param formatsInfo Array elements are themselves three-element arrays:[target, type, formats] + * * target: The identifier of the item to format. String. + * * type: The kind of item to format. String. + * * formats: An object literal containing a list of property name-value pairs that define the formatting to apply. - * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * + * @param options The object {asyncContext:context}, where context is a user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ setFormatsAsync(formatsInfo?: any[], options?: any, callback?: (result: AsyncResult) => void): void; /** * Updates table formatting options on the bound table. + * + *@remarks + * Hosts: Excel + * + * Available in Requirement set: Not in a set + * + * Last changed in: 1.1 + * * @param tableOptions An object literal containing a list of property name-value pairs that define the table options to apply. - * @param options Syntax example: {asyncContext:context} - * asyncContext: Object keeping state for the callback - * @param callback The optional callback method + * @param options The object {asyncContext:context}, where context is a user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ setTableOptionsAsync(tableOptions: any, options?: any, callback?: (result: AsyncResult) => void): void; } + /** + * Represents the data in a table or a TableBinding. + * @remarks + * Hosts: Excel, Word + */ export class TableData { constructor(rows: any[][], headers: any[]); constructor(); + /** + * Gets or sets the headers of the table. + * @remarks + * To specify headers, you must specify an array of arrays that corresponds to the structure of the table. For example, to specify headers for a two-column table you would set the header property to [['header1', 'header2']]. + * + * If you specify null for the headers property (or leaving the property empty when you construct a TableData object), the following results occur when your code executes: + * + * - If you insert a new table, the default column headers for the table are created. + * + * - If you overwrite or update an existing table, the existing headers are not altered. + * + * Hosts: Excel, Word + */ headers: any[]; + /** + * Gets or sets the rows in the table. Returns an array of arrays that contains the data in the table. Returns an empty array ``, if there are no rows. + * @remarks + * To specify rows, you must specify an array of arrays that corresponds to the structure of the table. For example, to specify two rows of string values in a two-column table you would set the rows property to [['a', 'b'], ['c', 'd']]. + * + * If you specify null for the rows property (or leave the property empty when you construct a TableData object), the following results occur when your code executes: + * + * - If you insert a new table, a blank row will be inserted. + * + * - If you overwrite or update an existing table, the existing rows are not altered. + * + * Hosts: Excel, Word + */ rows: any[][]; } + /** + * Specifies enumerated values for the cells: property in the cellFormat parameter of [table formatting methods](https://dev.office.com/reference/docs/excel/format-tables-in-add-ins-for-excel.htm). + * + * @remarks + * Hosts: Excel + */ export enum Table { + /** + * The entire table, including column headers, data, and totals (if any). + */ All, + /** + * Only the data (no headers and totals). + */ Data, + /** + * Only the header row. + */ Headers } + /** + * Represents a bound text selection in the document. + * + *@remarks + * Hosts: Access, Excel, PowerPoint, Project, Word + * + * Available in Requirement set: TextBindings + * + * Last changed in: 1.1 + * + * The TextBinding object inherits the id property, type property, getDataAsync method, and setDataAsync method from the Binding object. It does not implement any additional properties or methods of its own. + */ export interface TextBinding extends Binding { } + /** + * Specifies the project fields that are available as a parameter for the getProjectFieldAsync method. + * + * @remarks + * A ProjectProjectFields constant can be used as a parameter of the getProjectFieldAsync method. + * + * Hosts: Project + */ export enum ProjectProjectFields { + /** + * The number of digits after the decimal for the currency. + */ CurrencyDigits, + /** + * The currency symbol. + */ CurrencySymbol, + /** + * The placement of the currency symbol: Not specified = -1; Before the value with no space ($0) = 0; After the value with no space (0$) = 1; Before the value with a space ($ 0) = 2; After the value with a space (0 $) = 3. + */ CurrencySymbolPosition, DurationUnits, + /** + * The GUID of the project. + */ GUID, + /** + * The project finish date. + */ Finish, + /** + * The project start date. + */ Start, + /** + * Specifies whether the project is read-only. + */ ReadOnly, + /** + * The project version. + */ VERSION, + /** + * The work units of the project, such as days or hours. + */ WorkUnits, + /** + * The Project Web App URL, for projects that are stored in Project Server. + */ ProjectServerUrl, + /** + * The SharePoint URL, for projects that are synchronized with a SharePoint list. + */ WSSUrl, + /** + * The name of the SharePoint list, for projects that are synchronized with a tasks list. + */ WSSList } + /** + * Specifies the resource fields that are available as a parameter for the getResourceFieldAsync method. + * + * @remarks + * A ProjectResourceFields constant can be used as a parameter of the getResourceFieldAsync method. + * + * For more information about working with fields in Project, see [Available fields](https://support.office.com/article/Available-fields-reference-615a4563-1cc3-40f4-b66f-1b17e793a460) reference. In Project Help, search for Available fields. + */ export enum ProjectResourceFields { + /** + * The accrual method that defines how a task accrues the cost of the resource: Accrues when the task starts = 1, accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. + */ Accrual, + /** + * The calculated actual cost of the resource for assignments in the project. + */ ActualCost, + /** + * The actual overtime cost for a resource. + */ ActualOvertimeCost, + /** + * The actual overtime work for a resource, in minutes. + */ ActualOvertimeWork, + /** + * The actual overtime work for the resource that has been protected (made read-only). + */ ActualOvertimeWorkProtected, + /** + * The actual work that the resource has done on assignments in the project. + */ ActualWork, + /** + * The actual work for the resource that has been protected (made read-only). + */ ActualWorkProtected, + /** + * The name of the base calendar for the resource. + */ BaseCalendar, + /** + * The budget cost for the baseline resource. + */ Baseline10BudgetCost, + /** + * The budget work for the baseline resource, in hours. + */ Baseline10BudgetWork, + /** + * The cost for the baseline resource. + */ Baseline10Cost, + /** + * The work for the baseline resource, in minutes. + */ Baseline10Work, + /** + * The budget cost for the baseline resource. + */ Baseline1BudgetCost, + /** + * The budget work for the baseline resource, in hours. + */ Baseline1BudgetWork, + /** + * The cost for the baseline resource. + */ Baseline1Cost, + /** + * The work for the baseline resource, in minutes. + */ Baseline1Work, + /** + * The budget cost for the baseline resource. + */ Baseline2BudgetCost, + /** + * The budget work for the baseline resource, in hours. + */ Baseline2BudgetWork, + /** + * The cost for the baseline resource. + */ Baseline2Cost, + /** + * The work for the baseline resource, in minutes. + */ Baseline2Work, + /** + * The budget cost for the baseline resource. + */ Baseline3BudgetCost, + /** + * The budget work for the baseline resource, in hours. + */ Baseline3BudgetWork, + /** + * The cost for the baseline resource. + */ Baseline3Cost, + /** + * The work for the baseline resource, in minutes. + */ Baseline3Work, + /** + * The budget cost for the baseline resource. + */ Baseline4BudgetCost, + /** + * The budget work for the baseline resource, in hours. + */ Baseline4BudgetWork, + /** + * The cost for the baseline resource. + */ Baseline4Cost, + /** + * The work for the baseline resource, in minutes. + */ Baseline4Work, + /** + * The budget cost for the baseline resource. + */ Baseline5BudgetCost, + /** + * The budget work for the baseline resource, in hours. + */ Baseline5BudgetWork, + /** + * The cost for the baseline resource. + */ Baseline5Cost, + /** + * The work for the baseline resource, in minutes. + */ Baseline5Work, + /** + * The budget cost for the baseline resource. + */ Baseline6BudgetCost, + /** + * The budget work for the baseline resource, in hours. + */ Baseline6BudgetWork, + /** + * The cost for the baseline resource. + */ Baseline6Cost, + /** + * The work for the baseline resource, in minutes. + */ Baseline6Work, + /** + * The budget cost for the baseline resource. + */ Baseline7BudgetCost, + /** + * The budget work for the baseline resource, in hours. + */ Baseline7BudgetWork, + /** + * The cost for the baseline resource. + */ Baseline7Cost, + /** + * The work for the baseline resource, in minutes. + */ Baseline7Work, + /** + * The budget cost for the baseline resource. + */ Baseline8BudgetCost, + /** + * The budget work for the baseline resource, in hours. + */ Baseline8BudgetWork, + /** + * The cost for the baseline resource. + */ Baseline8Cost, + /** + * The work for the baseline resource, in minutes. + */ Baseline8Work, + /** + * The budget cost for the baseline resource. + */ Baseline9BudgetCost, + /** + * The budget work for the baseline resource, in hours. + */ Baseline9BudgetWork, + /** + * The cost for the baseline resource. + */ Baseline9Cost, + /** + * The work for the baseline resource, in minutes. + */ Baseline9Work, + /** + * The budget cost for the baseline resource. + */ BaselineBudgetCost, + /** + * The budget work for the baseline resource, in hours. + */ BaselineBudgetWork, + /** + * The baseline cost for the resource for assignments in the project. + */ BaselineCost, + /** + * The baseline work for the resource for assignments in the project, in minutes. + */ BaselineWork, + /** + * The budget cost for the resource. + */ BudgetCost, + /** + * The budget work for the resource. + */ BudgetWork, + /** + * The GUID of the resource calendar. + */ ResourceCalendarGUID, + /** + * The code value of the resource. + */ Code, + /** + * A cost field for the resource. + */ Cost1, + /** + * A cost field for the resource. + */ Cost10, + /** + * A cost field for the resource. + */ Cost2, + /** + * A cost field for the resource. + */ Cost3, + /** + * A cost field for the resource. + */ Cost4, + /** + * A cost field for the resource. + */ Cost5, + /** + * A cost field for the resource. + */ Cost6, + /** + * A cost field for the resource. + */ Cost7, + /** + * A cost field for the resource. + */ Cost8, + /** + * A cost field for the resource. + */ Cost9, + /** + * The date the resource was created. + */ ResourceCreationDate, + /** + * A date field for the resource. + */ Date1, + /** + * A date field for the resource. + */ Date10, + /** + * A date field for the resource. + */ Date2, + /** + * A date field for the resource. + */ Date3, + /** + * A date field for the resource. + */ Date4, + /** + * A date field for the resource. + */ Date5, + /** + * A date field for the resource. + */ Date6, + /** + * A date field for the resource. + */ Date7, + /** + * A date field for the resource. + */ Date8, + /** + * A date field for the resource. + */ Date9, + /** + * A duration field for the resource. + */ Duration1, + /** + * A duration field for the resource. + */ Duration10, + /** + * A duration field for the resource. + */ Duration2, + /** + * A duration field for the resource. + */ Duration3, + /** + * A duration field for the resource. + */ Duration4, + /** + * A duration field for the resource. + */ Duration5, + /** + * A duration field for the resource. + */ Duration6, + /** + * A duration field for the resource. + */ Duration7, + /** + * A duration field for the resource. + */ Duration8, + /** + * A duration field for the resource. + */ Duration9, + /** + * The email address of the resource. + */ Email, + /** + * The end date of the resource availability. + */ End, + /** + * A finish field for the task. + */ Finish1, + /** + * A finish field for the task. + */ Finish10, + /** + * A finish field for the task. + */ Finish2, + /** + * A finish field for the task. + */ Finish3, + /** + * A finish field for the task. + */ Finish4, + /** + * A finish field for the task. + */ Finish5, + /** + * A finish field for the task. + */ Finish6, + /** + * A finish field for the task. + */ Finish7, + /** + * A finish field for the task. + */ Finish8, + /** + * A finish field for the task. + */ Finish9, + /** + * A Boolean flag field for the resource. + */ Flag10, + /** + * A Boolean flag field for the resource. + */ Flag1, + /** + * A Boolean flag field for the resource. + */ Flag11, + /** + * A Boolean flag field for the resource. + */ Flag12, + /** + * A Boolean flag field for the resource. + */ Flag13, + /** + * A Boolean flag field for the resource. + */ Flag14, + /** + * A Boolean flag field for the resource. + */ Flag15, + /** + * A Boolean flag field for the resource. + */ Flag16, + /** + * A Boolean flag field for the resource. + */ Flag17, + /** + * A Boolean flag field for the resource. + */ Flag18, + /** + * A Boolean flag field for the resource. + */ Flag19, + /** + * A Boolean flag field for the resource. + */ Flag2, + /** + * A Boolean flag field for the resource. + */ Flag20, + /** + * A Boolean flag field for the resource. + */ Flag3, + /** + * A Boolean flag field for the resource. + */ Flag4, + /** + * A Boolean flag field for the resource. + */ Flag5, + /** + * A Boolean flag field for the resource. + */ Flag6, + /** + * A Boolean flag field for the resource. + */ Flag7, + /** + * A Boolean flag field for the resource. + */ Flag8, + /** + * A Boolean flag field for the resource. + */ Flag9, + /** + * The group the resource belongs to. + */ Group, + /** + * The percentage of work units that the resource has assigned in the project. If the resource is working full-time on the project, Units = 100. + */ Units, + /** + * The name of the resource. + */ Name, + /** + * The text value of the notes regarding the resource. + */ Notes, + /** + * A number field for the resource. + */ Number1, + /** + * A number field for the resource. + */ Number10, + /** + * A number field for the resource. + */ Number11, + /** + * A number field for the resource. + */ Number12, + /** + * A number field for the resource. + */ Number13, + /** + * A number field for the resource. + */ Number14, + /** + * A number field for the resource. + */ Number15, + /** + * A number field for the resource. + */ Number16, + /** + * A number field for the resource. + */ Number17, + /** + * A number field for the resource. + */ Number18, + /** + * A number field for the resource. + */ Number19, + /** + * A number field for the resource. + */ Number2, + /** + * A number field for the resource. + */ Number20, + /** + * A number field for the resource. + */ Number3, + /** + * A number field for the resource. + */ Number4, + /** + * A number field for the resource. + */ Number5, + /** + * A number field for the resource. + */ Number6, + /** + * A number field for the resource. + */ Number7, + /** + * A number field for the resource. + */ Number8, + /** + * A number field for the resource. + */ Number9, + /** + * The overtime cost for a resource. + */ OvertimeCost, + /** + * The overtime rate for a resource. + */ OvertimeRate, + /** + * The overtime work for a resource. + */ OvertimeWork, + /** + * The percentage of work complete for a resource. + */ PercentWorkComplete, + /** + * The cost per use of the resource. + */ CostPerUse, + /** + * Indicates whether the resource is a generic resource (identified by skill rather than by name). + */ Generic, + /** + * Indicates whether the resource is overallocated. + */ OverAllocated, + /** + * The amount of regular work for the resource. + */ RegularWork, + /** + * The remaining cost for the resource. + */ RemainingCost, + /** + * The remaining overtime cost for the resource. + */ RemainingOvertimeCost, + /** + * The remaining overtime work for the resource, in minutes. + */ RemainingOvertimeWork, + /** + * The remaining work for the resource, in minutes. + */ RemainingWork, + /** + * The ID of the resource. + */ ResourceGUID, + /** + * The total cost of the resource. + */ Cost, + /** + * The total work for the resource, in minutes. + */ Work, + /** + * The start date for the resource. + */ Start, + /** + * A start field for the resource. + */ Start1, + /** + * A start field for the resource. + */ Start10, + /** + * A start field for the resource. + */ Start2, + /** + * A start field for the resource. + */ Start3, + /** + * A start field for the resource. + */ Start4, + /** + * A start field for the resource. + */ Start5, + /** + * A start field for the resource. + */ Start6, + /** + * A start field for the resource. + */ Start7, + /** + * A start field for the resource. + */ Start8, + /** + * A start field for the resource. + */ Start9, + /** + * The standard rate of pay for the resource, in cost per hour. + */ StandardRate, + /** + * A text field for the resource. + */ Text1, + /** + * A text field for the resource. + */ Text10, + /** + * A text field for the resource. + */ Text11, + /** + * A text field for the resource. + */ Text12, + /** + * A text field for the resource. + */ Text13, + /** + * A text field for the resource. + */ Text14, + /** + * A text field for the resource. + */ Text15, + /** + * A text field for the resource. + */ Text16, + /** + * A text field for the resource. + */ Text17, + /** + * A text field for the resource. + */ Text18, + /** + * A text field for the resource. + */ Text19, + /** + * A text field for the resource. + */ Text2, + /** + * A text field for the resource. + */ Text20, + /** + * A text field for the resource. + */ Text21, + /** + * A text field for the resource. + */ Text22, + /** + * A text field for the resource. + */ Text23, + /** + * A text field for the resource. + */ Text24, + /** + * A text field for the resource. + */ Text25, + /** + * A text field for the resource. + */ Text26, + /** + * A text field for the resource. + */ Text27, + /** + * A text field for the resource. + */ Text28, + /** + * A text field for the resource. + */ Text29, + /** + * A text field for the resource. + */ Text3, + /** + * A text field for the resource. + */ Text30, + /** + * A text field for the resource. + */ Text4, + /** + * A text field for the resource. + */ Text5, + /** + * A text field for the resource. + */ Text6, + /** + * A text field for the resource. + */ Text7, + /** + * A text field for the resource. + */ Text8, + /** + * A text field for the resource. + */ Text9 } + /** + * Specifies the task fields that are available as a parameter for the getTaskFieldAsync method. + * + * @remarks + * A ProjectTaskFields constant can be used as a parameter of the getTaskFieldAsync method. + * + * For more information about working with fields in Project, see the [Available fields](https://support.office.com/article/Available-fields-reference-615a4563-1cc3-40f4-b66f-1b17e793a460) reference. In Project Help, search for Available fields. + * + * Hosts: Project + */ export enum ProjectTaskFields { + /** + * The current actual cost for the task. + */ ActualCost, + /** + * The actual duration of the task, in minutes. + */ ActualDuration, + /** + * The actual finish date of the task. + */ ActualFinish, + /** + * The actual overtime cost for the task. + */ ActualOvertimeCost, + /** + * The actual overtime work for the task, in minutes. + */ ActualOvertimeWork, + /** + * The actual start date of the task. + */ ActualStart, + /** + * The actual work for the task, in minutes. + */ ActualWork, + /** + * A text field for the task. + */ Text1, + /** + * A text field for the task. + */ Text10, + /** + * A finish field for the task. + */ Finish10, + /** + * A start field for the task. + */ Start10, + /** + * A text field for the task. + */ Text11, + /** + * A text field for the task. + */ Text12, + /** + * A text field for the task. + */ Text13, + /** + * A text field for the task. + */ Text14, + /** + * A text field for the task. + */ Text15, + /** + * A text field for the task. + */ Text16, + /** + * A text field for the task. + */ Text17, + /** + * A text field for the task. + */ Text18, + /** + * A text field for the task. + */ Text19, + /** + * A finish field for the task. + */ Finish1, + /** + * A start field for the task. + */ Start1, + /** + * A text field for the task. + */ Text2, + /** + * A text field for the task. + */ Text20, + /** + * A text field for the task. + */ Text21, + /** + * A text field for the task. + */ Text22, + /** + * A text field for the task. + */ Text23, + /** + * A text field for the task. + */ Text24, + /** + * A text field for the task. + */ Text25, + /** + * A text field for the task. + */ Text26, + /** + * A text field for the task. + */ Text27, + /** + * A text field for the task. + */ Text28, + /** + * A text field for the task. + */ Text29, + /** + * A finish field for the task. + */ Finish2, + /** + * A start field for the task. + */ Start2, + /** + * A text field for the task. + */ Text3, + /** + * A text field for the task. + */ Text30, + /** + * A finish field for the task. + */ Finish3, + /** + * A start field for the task. + */ Start3, + /** + * A text field for the task. + */ Text4, + /** + * A finish field for the task. + */ Finish4, + /** + * A start field for the task. + */ Start4, + /** + * A text field for the task. + */ Text5, + /** + * A finish field for the task. + */ Finish5, + /** + * A start field for the task. + */ Start5, + /** + * A text field for the task. + */ Text6, + /** + * A finish field for the task. + */ Finish6, + /** + * A start field for the task. + */ Start6, + /** + * A text field for the task. + */ Text7, + /** + * A finish field for the task. + */ Finish7, + /** + * A start field for the task. + */ Start7, + /** + * A text field for the task. + */ Text8, + /** + * A finish field for the task. + */ Finish8, + /** + * A start field for the task. + */ Start8, + /** + * A text field for the task. + */ Text9, + /** + * A finish field for the task. + */ Finish9, + /** + * A start field for the task. + */ Start9, + /** + * The budget cost for the baseline task. + */ Baseline10BudgetCost, + /** + * The budget work for the baseline task, in hours. + */ Baseline10BudgetWork, + /** + * The cost for the baseline task. + */ Baseline10Cost, + /** + * The duration for the baseline task, in minutes. + */ Baseline10Duration, + /** + * The finish date for the baseline task. + */ Baseline10Finish, + /** + * The fixed cost of any non-resource expense for the baseline task. + */ Baseline10FixedCost, + /** + * The accrual method that defines how the baseline task accrues fixed costs: Accrues when the task starts = 1, accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. + */ Baseline10FixedCostAccrual, + /** + * The start date for the baseline task. + */ Baseline10Start, + /** + * The total person-hours scheduled for the baseline task, in minutes. + */ Baseline10Work, + /** + * The budget cost for the baseline task. + */ Baseline1BudgetCost, + /** + * The budget work for the baseline task, in hours. + */ Baseline1BudgetWork, + /** + * The cost for the baseline task. + */ Baseline1Cost, + /** + * The duration for the baseline task, in minutes. + */ Baseline1Duration, + /** + * The finish date for the baseline task. + */ Baseline1Finish, + /** + * The fixed cost of any non-resource expense for the baseline task. + */ Baseline1FixedCost, + /** + * The accrual method that defines how the baseline task accrues fixed costs: Accrues when the task starts = 1, accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. + */ Baseline1FixedCostAccrual, + /** + * The start date for the baseline task. + */ Baseline1Start, + /** + * The total person-hours scheduled for the baseline task, in minutes. + */ Baseline1Work, + /** + * The budget cost for the baseline task. + */ Baseline2BudgetCost, + /** + * The budget work for the baseline task, in hours. + */ Baseline2BudgetWork, + /** + * The cost for the baseline task. + */ Baseline2Cost, + /** + * The duration for the baseline task, in minutes. + */ Baseline2Duration, + /** + * The finish date for the baseline task. + */ Baseline2Finish, + /** + * The fixed cost of any non-resource expense for the baseline task. + */ Baseline2FixedCost, + /** + * The accrual method that defines how the baseline task accrues fixed costs: Accrues when the task starts = 1, accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. + */ Baseline2FixedCostAccrual, + /** + * The start date for the baseline task. + */ Baseline2Start, + /** + * The total person-hours scheduled for the baseline task, in minutes. + */ Baseline2Work, + /** + * The budget cost for the baseline task. + */ Baseline3BudgetCost, + /** + * The budget work for the baseline task, in hours. + */ Baseline3BudgetWork, + /** + * The cost for the baseline task. + */ Baseline3Cost, + /** + * The duration for the baseline task, in minutes. + */ Baseline3Duration, + /** + * The finish date for the baseline task. + */ Baseline3Finish, + /** + * The fixed cost of any non-resource expense for the baseline task. + */ Baseline3FixedCost, + /** + * The accrual method that defines how the baseline task accrues fixed costs: Accrues when the task starts = 1, accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. + */ Baseline3FixedCostAccrual, + /** + * The start date for the baseline task. + */ Basline3Start, + /** + * The total person-hours scheduled for the baseline task, in minutes. + */ Baseline3Work, + /** + * The budget cost for the baseline task. + */ Baseline4BudgetCost, + /** + * The budget work for the baseline task, in hours. + */ Baseline4BudgetWork, + /** + * The cost for the baseline task. + */ Baseline4Cost, + /** + * The duration for the baseline task, in minutes. + */ Baseline4Duration, + /** + * The finish date for the baseline task. + */ Baseline4Finish, + /** + * The fixed cost of any non-resource expense for the baseline task. + */ Baseline4FixedCost, + /** + * The accrual method that defines how the baseline task accrues fixed costs: Accrues when the task starts = 1, accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. + */ Baseline4FixedCostAccrual, + /** + * The start date for the baseline task. + */ Baseline4Start, + /** + * The total person-hours scheduled for the baseline task, in minutes. + */ Baseline4Work, + /** + * The budget cost for the baseline task. + */ Baseline5BudgetCost, + /** + * The budget work for the baseline task, in hours. + */ Baseline5BudgetWork, + /** + * The cost for the baseline task. + */ Baseline5Cost, + /** + * The duration for the baseline task, in minutes. + */ Baseline5Duration, + /** + * The finish date for the baseline task. + */ Baseline5Finish, + /** + * The fixed cost of any non-resource expense for the baseline task. + */ Baseline5FixedCost, + /** + * The accrual method that defines how the baseline task accrues fixed costs: Accrues when the task starts = 1, accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. + */ Baseline5FixedCostAccrual, + /** + * The start date for the baseline task. + */ Baseline5Start, + /** + * The total person-hours scheduled for the baseline task, in minutes. + */ Baseline5Work, + /** + * The budget cost for the baseline task. + */ Baseline6BudgetCost, + /** + * The budget work for the baseline task, in hours. + */ Baseline6BudgetWork, + /** + * The cost for the baseline task. + */ Baseline6Cost, + /** + * The duration for the baseline task, in minutes. + */ Baseline6Duration, + /** + * The finish date for the baseline task. + */ Baseline6Finish, + /** + * The fixed cost of any non-resource expense for the baseline task. + */ Baseline6FixedCost, + /** + * The accrual method that defines how the baseline task accrues fixed costs: Accrues when the task starts = 1, accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. + */ Baseline6FixedCostAccrual, + /** + * The start date for the baseline task. + */ Baseline6Start, + /** + * The total person-hours scheduled for the baseline task, in minutes. + */ Baseline6Work, + /** + * The budget cost for the baseline task. + */ Baseline7BudgetCost, + /** + * The budget work for the baseline task, in hours. + */ Baseline7BudgetWork, + /** + * The cost for the baseline task. + */ Baseline7Cost, + /** + * The duration for the baseline task, in minutes. + */ Baseline7Duration, + /** + * The finish date for the baseline task. + */ Baseline7Finish, + /** + * The fixed cost of any non-resource expense for the baseline task. + */ Baseline7FixedCost, + /** + * The accrual method that defines how the baseline task accrues fixed costs: Accrues when the task starts = 1, accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. + */ Baseline7FixedCostAccrual, + /** + * The start date for the baseline task. + */ Baseline7Start, + /** + * The total person-hours scheduled for the baseline task, in minutes. + */ Baseline7Work, + /** + * The budget cost for the baseline task. + */ Baseline8BudgetCost, + /** + * The budget work for the baseline task, in hours. + */ Baseline8BudgetWork, + /** + * The cost for the baseline task. + */ Baseline8Cost, + /** + * The duration for the baseline task, in minutes. + */ Baseline8Duration, + /** + * The finish date for the baseline task. + */ Baseline8Finish, + /** + * The fixed cost of any non-resource expense for the baseline task. + */ Baseline8FixedCost, + /** + * The accrual method that defines how the baseline task accrues fixed costs: Accrues when the task starts = 1, accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. + */ Baseline8FixedCostAccrual, + /** + * The start date for the baseline task. + */ Baseline8Start, + /** + * The total person-hours scheduled for the baseline task, in minutes. + */ Baseline8Work, + /** + * The budget cost for the baseline task. + */ Baseline9BudgetCost, + /** + * The budget work for the baseline task, in hours. + */ Baseline9BudgetWork, + /** + * The cost for the baseline task. + */ Baseline9Cost, + /** + * The duration for the baseline task, in minutes. + */ Baseline9Duration, + /** + * The finish date for the baseline task. + */ Baseline9Finish, + /** + * The fixed cost of any non-resource expense for the baseline task. + */ Baseline9FixedCost, + /** + * The accrual method that defines how the baseline task accrues fixed costs: Accrues when the task starts = 1, accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. + */ Baseline9FixedCostAccrual, + /** + * The start date for the baseline task. + */ Baseline9Start, + /** + * The total person-hours scheduled for the baseline task, in minutes. + */ Baseline9Work, + /** + * The budget cost for the baseline task. + */ BaselineBudgetCost, + /** + * The budget work for the baseline task, in hours. + */ BaselineBudgetWork, + /** + * The cost for the baseline task. + */ BaselineCost, + /** + * The duration for the baseline task, in minutes. + */ BaselineDuration, + /** + * The finish date for the baseline task. + */ BaselineFinish, + /** + * The fixed cost of any non-resource expense for the baseline task. + */ BaselineFixedCost, + /** + * The accrual method that defines how the baseline task accrues fixed costs: Accrues when the task starts = 1, accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. + */ BaselineFixedCostAccrual, + /** + * The start date for the baseline task. + */ BaselineStart, + /** + * The total person-hours scheduled for the baseline task, in minutes. + */ BaselineWork, + /** + * The budget cost for the task. + */ BudgetCost, BudgetFixedCost, - BudgetFixedWork, + BudgetFixedWork, + /** + * The budget work for the task, in hours. + */ BudgetWork, + /** + * The GUID of the task calendar. + */ TaskCalendarGUID, + /** + * A constraint date for the task. + */ ConstraintDate, + /** + * A constraint type for the task: As Soon As Possible = 0, As Late As Possible = 1, Must Start On = 2, Must Finish On = 3, Start No Earlier Than = 4, Start No Later Than = 5, Finish No Earlier Than = 6, Finish No Later Than = 7. + */ ConstraintType, + /** + * A cost field of the task. + */ Cost1, + /** + * A cost field of the task. + */ Cost10, + /** + * A cost field of the task. + */ Cost2, + /** + * A cost field of the task. + */ Cost3, + /** + * A cost field of the task. + */ Cost4, + /** + * A cost field of the task. + */ Cost5, + /** + * A cost field of the task. + */ Cost6, + /** + * A cost field of the task. + */ Cost7, + /** + * A cost field of the task. + */ Cost8, + /** + * A cost field of the task. + */ Cost9, + /** + * A date field of the task. + */ Date1, + /** + * A date field of the task. + */ Date10, + /** + * A date field of the task. + */ Date2, + /** + * A date field of the task. + */ Date3, + /** + * A date field of the task. + */ Date4, + /** + * A date field of the task. + */ Date5, + /** + * A date field of the task. + */ Date6, + /** + * A date field of the task. + */ Date7, + /** + * A date field of the task. + */ Date8, + /** + * A date field of the task. + */ Date9, + /** + * The deadline for a task. + */ Deadline, + /** + * A duration field of the task. + */ Duration1, + /** + * A duration field of the task. + */ Duration10, + /** + * A duration field of the task. + */ Duration2, + /** + * A duration field of the task. + */ Duration3, + /** + * A duration field of the task. + */ Duration4, + /** + * A duration field of the task. + */ Duration5, + /** + * A duration field of the task. + */ Duration6, + /** + * A duration field of the task. + */ Duration7, + /** + * A duration field of the task. + */ Duration8, + /** + * A duration field of the task. + */ Duration9, + /** + * A duration field of the task. + */ Duration, + /** + * The method for calculating earned value for the task. + */ EarnedValueMethod, + /** + * The duration between the Early Finish and Late Finish dates for the task, in minutes. + */ FinishSlack, + /** + * The fixed cost for the task. + */ FixedCost, + /** + * The accrual method that defines how the baseline task accrues fixed costs: Accrues when the task starts = 1, accrues when the task ends = 2, accrues as the task progresses (prorated) = 3. + */ FixedCostAccrual, + /** + * A Boolean flag field for the task. + */ Flag10, + /** + * A Boolean flag field for the task. + */ Flag1, + /** + * A Boolean flag field for the task. + */ Flag11, + /** + * A Boolean flag field for the task. + */ Flag12, + /** + * A Boolean flag field for the task. + */ Flag13, + /** + * A Boolean flag field for the task. + */ Flag14, + /** + * A Boolean flag field for the task. + */ Flag15, + /** + * A Boolean flag field for the task. + */ Flag16, + /** + * A Boolean flag field for the task. + */ Flag17, + /** + * A Boolean flag field for the task. + */ Flag18, + /** + * A Boolean flag field for the task. + */ Flag19, + /** + * A Boolean flag field for the task. + */ Flag2, + /** + * A Boolean flag field for the task. + */ Flag20, + /** + * A Boolean flag field for the task. + */ Flag3, + /** + * A Boolean flag field for the task. + */ Flag4, + /** + * A Boolean flag field for the task. + */ Flag5, + /** + * A Boolean flag field for the task. + */ Flag6, + /** + * A Boolean flag field for the task. + */ Flag7, + /** + * A Boolean flag field for the task. + */ Flag8, + /** + * A Boolean flag field for the task. + */ Flag9, + /** + * The amount of time that the task can be delayed without delaying its successor tasks. + */ FreeSlack, + /** + * Indicates whether the task has rollup subtasks. + */ HasRollupSubTasks, + /** + * The index of the selected task. After the project summary task, the index of the first task in a project is 1. + */ ID, + /** + * The name of the task. + */ Name, + /** + * The text value of the notes regarding the task. + */ Notes, + /** + * A number field for the task. + */ Number1, + /** + * A number field for the task. + */ Number10, + /** + * A number field for the task. + */ Number11, + /** + * A number field for the task. + */ Number12, + /** + * A number field for the task. + */ Number13, + /** + * A number field for the task. + */ Number14, + /** + * A number field for the task. + */ Number15, + /** + * A number field for the task. + */ Number16, + /** + * A number field for the task. + */ Number17, + /** + * A number field for the task. + */ Number18, + /** + * A number field for the task. + */ Number19, + /** + * A number field for the task. + */ Number2, + /** + * A number field for the task. + */ Number20, + /** + * A number field for the task. + */ Number3, + /** + * A number field for the task. + */ Number4, + /** + * A number field for the task. + */ Number5, + /** + * A number field for the task. + */ Number6, + /** + * A number field for the task. + */ Number7, + /** + * A number field for the task. + */ Number8, + /** + * A number field for the task. + */ Number9, + /** + * The scheduled (as opposed to actual) duration of the task. + */ ScheduledDuration, + /** + * The scheduled (as opposed to actual) finish date of the task. + */ ScheduledFinish, + /** + * The scheduled (as opposed to actual) start date of the task. + */ ScheduledStart, + /** + * The level of the task in the outline hierarchy. + */ OutlineLevel, + /** + * The overtime cost for the task. + */ OvertimeCost, + /** + * The overtime work for the task. + */ OvertimeWork, + /** + * The percent complete status of the task. + */ PercentComplete, + /** + * The percentage of work completed for the task. + */ PercentWorkComplete, + /** + * The IDs of the task's predecessors. + */ Predecessors, + /** + * The finish date of a task before leveling occurred. + */ PreleveledFinish, + /** + * The start date of a task before leveling occurred. + */ PreleveledStart, + /** + * The priority of the task, with values from 0 (low) to 1000 (high). The default priority value is 500. + */ Priority, + /** + * Indicates whether the task is active. + */ Active, + /** + * Indicates whether the task is on the critical path. + */ Critical, + /** + * Indicates whether the task is a milestone. + */ Milestone, + /** + * Indicates whether any assignments for a task are overallocated. + */ Overallocated, + /** + * Indicates whether subtask information is rolled up to the summary task bar. + */ IsRollup, + /** + * Indicates whether the task is a summary task. + */ Summary, + /** + * The amount of regular work for the task. + */ RegularWork, + /** + * The remaining cost for the task. + */ RemainingCost, + /** + * The remaining duration for the task, in minutes. + */ RemainingDuration, + /** + * The remaining overtime cost for the task. + */ RemainingOvertimeCost, + /** + * The remaining work for the task, in minutes. + */ RemainingWork, + /** + * The names of the resources assigned to a task. + */ ResourceNames, + /** + * The total cost of the task. + */ Cost, + /** + * The finish date of the task. + */ Finish, + /** + * The start date of the task. + */ Start, + /** + * The total person-hours scheduled for the task, in minutes. + */ Work, + /** + * The duration between the Early Start and Late Start dates for the task. + */ StartSlack, + /** + * The status of the task: Complete = 0, on schedule = 1, late = 2, future task = 3, status not available = 4. + */ Status, + /** + * The IDs of the task's successors. + */ Successors, + /** + * The enterprise resource responsible for accepting or rejecting assignment progress updates for the task. + */ StatusManager, + /** + * The total slack time for the task, in minutes. + */ TotalSlack, + /** + * The GUID of the task. + */ TaskGUID, + /** + * The way the task is calculated: Fixed units = 0, fixed duration = 1, fixed work = 2. + */ Type, + /** + * The work breakdown structure code of the task. + */ WBS, + /** + * The work breakdown structure codes of the task predecessors, separated by the list separator. + */ WBSPREDECESSORS, + /** + * The work breakdown structure codes of the task successors, separated by the list separator. + */ WBSSUCCESSORS, + /** + * The ID of the task in a SharePoint list, for a project that is synchronized with a SharePoint tasks list. + */ WSSID } + /** + * Specifies the types of views that the getSelectedViewAsync method can recognize. + * + * @remarks + * The getSelectedViewAsync method returns the ProjectViewTypes constant value and name that corresponds to the active view. + * + * Hosts: Project + */ export enum ProjectViewTypes { + /** + * The Gantt chart view. + */ Gantt, + /** + * The Network Diagram view. + */ NetworkDiagram, + /** + * The Task Diagram view. + */ TaskDiagram, + /** + * The Task form view. + */ TaskForm, + /** + * The Task Sheet view. + */ TaskSheet, + /** + * The Resource Form view. + */ ResourceForm, + /** + * The Resource Sheet view. + */ ResourceSheet, + /** + * The Resource Graph view. + */ ResourceGraph, + /** + * The Team Planner view. + */ TeamPlanner, + /** + * The Task Details view. + */ TaskDetails, + /** + * The Task Name Form view. + */ TaskNameForm, + /** + * The Resource Names view. + */ ResourceNames, + /** + * The Calendar view. + */ Calendar, + /** + * The Task Usage view. + */ TaskUsage, + /** + * The Resource Usage view. + */ ResourceUsage, + /** + * The Timeline view. + */ Timeline } // Objects @@ -2036,8 +4667,19 @@ declare namespace Office { phoneNumbers: Array; urls: Array; } + /** + * Represents the runtime environment of the add-in and provides access to key objects of the API. + * + *@remarks + * Hosts: Access, Excel, Outlook, PowerPoint, Project, Word + * + * Last changed in: 1.1 + */ export interface Context { mailbox: Mailbox; + /** + * Gets an object that represents the saved custom settings of the add-in. + */ roamingSettings: RoamingSettings; } export interface CustomProperties { @@ -3270,6 +5912,7 @@ declare namespace Excel { * * Gets the Binding object that represents the binding that raised the SelectionChanged event. * + *@remarks * **Hosts:** Access, Excel, Word * * [Api set: ExcelApi 1.2] @@ -44629,4 +47272,4 @@ declare namespace Visio { //////////////////////////////////////////////////////////////// //////////////////////// End Visio APIs //////////////////////// -//////////////////////////////////////////////////////////////// \ No newline at end of file +////////////////////////////////////////////////////////////////Contains the host in which the add-in (web application) is running in. Possible values are: Word, Excel, PowerPoint \ No newline at end of file From bf05c947a54306f299b7954bc0733325bbb78878 Mon Sep 17 00:00:00 2001 From: Karim Alibhai Date: Sun, 20 May 2018 16:18:05 -0400 Subject: [PATCH 269/575] Fix: test issues --- types/loopback/index.d.ts | 27 ++++++++++++++++++--------- types/loopback/loopback-tests.ts | 2 +- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/types/loopback/index.d.ts b/types/loopback/index.d.ts index 05a3730d79..aa9bfb2b8b 100644 --- a/types/loopback/index.d.ts +++ b/types/loopback/index.d.ts @@ -21,9 +21,9 @@ declare namespace l { /** * General type for a callback to an async function. */ - type CallbackWithoutResult = (err: Error | null) => any - type CallbackWithResult = (err: Error | null, result: T) => any - type CallbackWithMultipleResults = (err: Error | null, arg0: T, arg1: G) => any + type CallbackWithoutResult = (err: Error | null) => any; + type CallbackWithResult = (err: Error | null, result: T) => any; + type CallbackWithMultipleResults = (err: Error | null, arg0: T, arg1: G) => any; /** * The `App` object represents a Loopback application @@ -1210,7 +1210,7 @@ declare namespace l { * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). * @param {Array} changes An Array of [Change](#change) objects */ - static changes(since: number, filter: any, callback: CallbackWithResult): void; + static changes(since: number, filter: any, callback: CallbackWithResult): void; /** * Get the changes to a model since the specified checkpoint. Provide a filter object @@ -1283,14 +1283,23 @@ declare namespace l { * @param {any} options Only changes to models matching this where filter will be included in the ChangeStream. * @param {() => void} callback */ - static createChangeStream(options: {where: any}, callback: CallbackWithResult): void; + static createChangeStream( + options: { + where: any; + }, + callback: CallbackWithResult + ): void; /** * Create a change stream. See here for more info http://loopback.io/doc/en/lb2/Realtime-server-sent-events.html * @param {any} options Only changes to models matching this where filter will be included in the ChangeStream. * @returns {any} changes */ - static createChangeStream(options: {where: any}): Promise; + static createChangeStream( + options: { + where: any; + } + ): Promise; /** * Create an update list (for `Model.bulkUpdate()`) from a delta list @@ -1314,7 +1323,7 @@ declare namespace l { * @param {number} currentCheckpointId Current checkpoint ID */ static currentCheckpoint(callback: CallbackWithResult): void; - + /** * Get the current checkpoint ID * @returns {Promise} resolves to currentCheckpointId @@ -1449,7 +1458,7 @@ declare namespace l { }, callback: CallbackWithResult ): void; - + /** * Find all model instances that match `filter` specification. * See [Querying models](docs.strongloop.com/display/LB/Querying+models) @@ -1514,7 +1523,7 @@ declare namespace l { }, callback: CallbackWithResult ): void; - + /** * Find object by ID with an optional filter for include/fields * @param {*} id Primary key value diff --git a/types/loopback/loopback-tests.ts b/types/loopback/loopback-tests.ts index 359e6977b6..cb015fc0bd 100644 --- a/types/loopback/loopback-tests.ts +++ b/types/loopback/loopback-tests.ts @@ -36,7 +36,7 @@ class Server { console.dir(data.name); } - model.findOne({}, (err: Error, instance: TestModel) => { + model.findOne({}, (err: Error | null, instance: TestModel) => { if (err) { console.dir(err); } From 56cf16cff3a35fd3473ef98c449f10302fda1dad Mon Sep 17 00:00:00 2001 From: Karim Alibhai Date: Sun, 20 May 2018 16:19:36 -0400 Subject: [PATCH 270/575] Add: self to definitions by --- types/loopback/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/loopback/index.d.ts b/types/loopback/index.d.ts index aa9bfb2b8b..c743db10ce 100644 --- a/types/loopback/index.d.ts +++ b/types/loopback/index.d.ts @@ -4,6 +4,7 @@ // Tim Schumacher // Sequoia McDowell // Mike Crowe +// Karim Alibhai // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 From 0275ec9ca05da1fbe34e4d1356ab0517271226a2 Mon Sep 17 00:00:00 2001 From: Ricky Kirkham Date: Sun, 20 May 2018 13:24:50 -0700 Subject: [PATCH 271/575] typo and fixing DialogOptions info --- types/office-js/index.d.ts | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/types/office-js/index.d.ts b/types/office-js/index.d.ts index 58c574e126..6ec8e726e1 100644 --- a/types/office-js/index.d.ts +++ b/types/office-js/index.d.ts @@ -328,14 +328,7 @@ declare namespace Office { * Do not use a dialog box to interact with a document. Use a task pane instead. * * @param startAddress - Accepts the initial HTTPS URL that opens in the dialog. - * @param options - Optional. An object that has any of the following properties: - * - * displayInIframe: Determines whether the dialog box should be displayed within an IFrame. This setting is only applicable in Office Online clients, and is ignored by other platforms. If false (default), the dialog will be displayed as a new browser window (pop-up). Recommended for authentication pages that cannot be displayed in an IFrame. If true, the dialog will be displayed as a floating overlay with an IFrame. This is best for user experience and performance. - * - * height: Defines the height of the dialog box as a percentage of the current display. The default value is 80%. The minimum resolution is 150 pixels. - * - * width: Defines the width of the dialog box as a percentage of the current display. The default value is 80%. The minimum resolution is 250 pixels. - * + * @param options - Optional. Accepts a DialogOptions object to define dialog display. * @param callback - Optional. Accepts a callback method to handle the dialog creation attempt. If successful, the AsyncResult.value is a DialogHandler object. */ displayDialogAsync(startAddress: string, options?: DialogOptions, callback?: (result: AsyncResult) => void): void; @@ -362,15 +355,15 @@ declare namespace Office { } export interface DialogOptions { /** - * Optional. Defines the width of the dialog as a percentage of the current display. Defaults to 99%. 250px minimum. + * Defines the width of the dialog as a percentage of the current display. Defaults to 80%. 250px minimum. */ height?: number, /** - * Optional. Defines the height of the dialog as a percentage of the current display. Defaults to 99%. 150px minimum. + * Defines the height of the dialog as a percentage of the current display. Defaults to 80%. 150px minimum. */ width?: number, /** - * Optional. Determines whether the dialog box should be displayed within an IFrame. This setting is only applicable in Office Online clients, and is ignored on other platforms. + * Determines whether the dialog box should be displayed within an IFrame. This setting is only applicable in Office Online clients, and is ignored by other platforms. If false (default), the dialog will be displayed as a new browser window (pop-up). Recommended for authentication pages that cannot be displayed in an IFrame. If true, the dialog will be displayed as a floating overlay with an IFrame. This is best for user experience and performance. */ displayInIframe?: boolean } @@ -5913,7 +5906,7 @@ declare namespace Excel { * Gets the Binding object that represents the binding that raised the SelectionChanged event. * *@remarks - * **Hosts:** Access, Excel, Word + * Hosts: Access, Excel, Word * * [Api set: ExcelApi 1.2] */ From 9e60c2922736a66b3b1eb0c683a0117fc9ef473e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Johansen=20Amundrud?= Date: Sun, 20 May 2018 23:18:50 +0200 Subject: [PATCH 272/575] Update types --- types/facebook-instant-games/index.d.ts | 105 ++++++++++++------------ 1 file changed, 54 insertions(+), 51 deletions(-) diff --git a/types/facebook-instant-games/index.d.ts b/types/facebook-instant-games/index.d.ts index 1e8a8d76fd..5e5589a150 100644 --- a/types/facebook-instant-games/index.d.ts +++ b/types/facebook-instant-games/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for facebook-instant-games 6.1 // Project: https://developers.facebook.com/docs/games/instant-games -// Definitions by: Menushka Weeratunga +// Definitions by: Menushka Weeratunga , Øyvind Johansen Amundrud // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace FBInstant { @@ -8,23 +8,23 @@ declare namespace FBInstant { let context: Context; let payments: Payments; - function getLocale(): string; - function getPlatform(): string; + function getLocale(): string | null; + function getPlatform(): Platform; function getSDKVersion(): string; - function initializeAsync(): Promise; - function setLoadingProgress(progress: number): void; + function initializeAsync(): Promise; + function setLoadingProgress(percentage: number): void; function getSupportedAPIs(): string[]; function getEntryPointData(): any; function getEntryPointAsync(): Promise; function setSessionData(sessionData: any): void; - function startGameAsync(): Promise; + function startGameAsync(): Promise; function shareAsync(payload: SharePayload): Promise; - function updateAsync(payload: UpdatePayload | LeaderboardUpdatePayload): Promise; - function switchGameAsync(appID: string, data?: string): Promise; + function updateAsync(payload: CustomUpdatePayload | LeaderboardUpdatePayload): Promise; + function switchGameAsync(appID: string, data?: any): Promise; function canCreateShortcutAsync(): Promise; function createShortcutAsync(): Promise; function quit(): void; - function logEvent(eventName: string, valueToSum?: number, parameter?: any): APIError; + function logEvent(eventName: string, valueToSum?: number, parameter?: { [key: string]: string; }): APIError | null; function onPause(func: () => void): void; function getInterstitialAdAsync(placementID: string): Promise; function getRewardedVideoAsync(placementID: string): Promise; @@ -33,13 +33,13 @@ declare namespace FBInstant { function getLeaderboardAsync(name: string): Promise; interface Player { - getID(): string; - getSignedPlayerInfoAsync(requestPayload: string): Promise; + getID(): string | null; + getSignedPlayerInfoAsync(requestPayload?: string): Promise; canSubscribeBotAsync(): Promise; subscribeBotAsync(): Promise; - getName(): string; - getPhoto(): string; - getDataAsync(keys?: string[]): Promise; + getName(): string | null; + getPhoto(): string | null; + getDataAsync(keys: string[]): Promise; setDataAsync(data: DataObject): Promise; flushDataAsync(): Promise; getStatsAsync(keys?: string[]): Promise; @@ -49,9 +49,9 @@ declare namespace FBInstant { } interface Context { - getID(): string; + getID(): string | null; getType(): Type; - isSizeBetween(minSize: number, maxSize: number): ContextSizeResponse; + isSizeBetween(minSize?: number, maxSize?: number): ContextSizeResponse | null; switchAsync(id: string): Promise; chooseAsync(options: ContextOptions): Promise; createAsync(playerID: string): Promise; @@ -60,10 +60,10 @@ declare namespace FBInstant { interface Leaderboard { getName(): string; - getContextID(): string; + getContextID(): string | null; getEntryCountAsync(): Promise; setScoreAsync(score: number, extraData: string): Promise; - getPlayerEntryAsync(): Promise; + getPlayerEntryAsync(): Promise; getEntriesAsync(count: number, offset: number): Promise; } @@ -72,20 +72,20 @@ declare namespace FBInstant { getFormattedScore(): string; getTimestamp(): number; getRank(): number; - getExtraData(): string; + getExtraData(): string | null; getPlayer(): LeaderboardPlayer; } interface LeaderboardPlayer { getName(): string; - getPhoto(): string; - getID(): string; + getPhoto(): string | null; + getID(): string | null; } interface ConnectedPlayer { getID(): string; - getName(): string; - getPhoto(): string; + getName(): string | null; + getPhoto(): string | null; } interface SignedPlayerInfo { @@ -95,8 +95,8 @@ declare namespace FBInstant { interface ContextPlayer { getID(): string; - getName(): string; - getPhoto(): string; + getName(): string | null; + getPhoto(): string | null; } interface AdInstance { @@ -106,6 +106,7 @@ declare namespace FBInstant { } interface Payments { + getCatalogAsync(): Promise; purchaseAsync(purchaseConfig: PurchaseConfig): Promise; getPurchasesAsync(): Promise; consumePurchaseAsync(purchaseToken: string): Promise; @@ -143,9 +144,9 @@ declare namespace FBInstant { } interface SharePayload { - intent?: Intent; - image?: string; - text?: string; + intent: Intent; + image: string; + text: string; data?: any; } @@ -159,12 +160,12 @@ declare namespace FBInstant { developerPayload?: string; } - interface UpdatePayload { - action?: UpdateAction; - template?: string; + interface CustomUpdatePayload { + action: UpdateAction; + template: string; cta?: (string | LocalizableContent); - image?: string; - text?: (string | LocalizableContent); + image: string; + text: (string | LocalizableContent); data?: any; strategy?: string; notification?: string; @@ -181,13 +182,15 @@ declare namespace FBInstant { localizations: LocalizationsDict; } - interface DataObject { [ key: string ]: string | number; } + interface DataObject { [ key: string ]: any; } interface StatsObject { [ key: string ]: number; } interface IncrementObject { [ key: string ]: number; } - type LocalizationsDict = any; + interface LocalizationsDict { + [x: string]: string; + } type SignedPurchaseRequest = string; @@ -202,20 +205,20 @@ declare namespace FBInstant { type Intent = "INVITE" | "REQUEST" | "CHALLENGE" | "SHARE"; type ErrorCodeType = "ADS_FREQUENT_LOAD" | - "ADS_NO_FILL" | - "ADS_NOT_LOADED" | - "ADS_TOO_MANY_INSTANCES" | - "ANALYTICS_POST_EXCEPTION" | - "CLIENT_REQUIRES_UPDATE" | - "CLIENT_UNSUPPORTED_OPERATION" | - "INVALID_OPERATION" | - "INVALID_PARAM" | - "LEADERBOARD_NOT_FOUND" | - "LEADERBOARD_WRONG_CONTEXT" | - "NETWORK_FAILURE" | - "PENDING_REQUEST" | - "RATE_LIMITED" | - "SAME_CONTEXT" | - "UNKNOWN" | - "USER_INPUT"; + "ADS_NO_FILL" | + "ADS_NOT_LOADED" | + "ADS_TOO_MANY_INSTANCES" | + "ANALYTICS_POST_EXCEPTION" | + "CLIENT_REQUIRES_UPDATE" | + "CLIENT_UNSUPPORTED_OPERATION" | + "INVALID_OPERATION" | + "INVALID_PARAM" | + "LEADERBOARD_NOT_FOUND" | + "LEADERBOARD_WRONG_CONTEXT" | + "NETWORK_FAILURE" | + "PENDING_REQUEST" | + "RATE_LIMITED" | + "SAME_CONTEXT" | + "UNKNOWN" | + "USER_INPUT"; } From 230927f9c22b65c11966e5807810b03c563fc127 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Johansen=20Amundrud?= Date: Sun, 20 May 2018 23:22:33 +0200 Subject: [PATCH 273/575] Update API to 6.2 --- types/facebook-instant-games/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/facebook-instant-games/index.d.ts b/types/facebook-instant-games/index.d.ts index 5e5589a150..f213fa9c12 100644 --- a/types/facebook-instant-games/index.d.ts +++ b/types/facebook-instant-games/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for facebook-instant-games 6.1 +// Type definitions for facebook-instant-games 6.2 // Project: https://developers.facebook.com/docs/games/instant-games // Definitions by: Menushka Weeratunga , Øyvind Johansen Amundrud // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -65,6 +65,7 @@ declare namespace FBInstant { setScoreAsync(score: number, extraData: string): Promise; getPlayerEntryAsync(): Promise; getEntriesAsync(count: number, offset: number): Promise; + getConnectedPlayerEntriesAsync(count: number, offset: number): Promise; } interface LeaderboardEntry { From 92eb9e143f3c26ff47142aecf8108958732cccda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Johansen=20Amundrud?= Date: Sun, 20 May 2018 23:30:23 +0200 Subject: [PATCH 274/575] Add documentation --- types/facebook-instant-games/index.d.ts | 873 ++++++++++++++++++++++++ 1 file changed, 873 insertions(+) diff --git a/types/facebook-instant-games/index.d.ts b/types/facebook-instant-games/index.d.ts index f213fa9c12..74c93c6c96 100644 --- a/types/facebook-instant-games/index.d.ts +++ b/types/facebook-instant-games/index.d.ts @@ -3,183 +3,1037 @@ // Definitions by: Menushka Weeratunga , Øyvind Johansen Amundrud // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +/** + * Top level namespace for the Instant Games SDK. + */ declare namespace FBInstant { + /** + * Contains functions and properties related to the current player. + */ let player: Player; + + /** + * Contains functions and properties related to the current game context. + */ let context: Context; + + /** + * Contains functions and properties related to payments and purchases of game products. + */ let payments: Payments; + /** + * The current locale. Use this to determine what language the current game should be localized with. + * The value will not be accurate until FBInstant.startGameAsync() resolves. + * + * @returns The current locale. + */ function getLocale(): string | null; + + /** + * The platform on which the game is currently running. The value will always be null until FBInstant.initializeAsync() resolves. + */ function getPlatform(): Platform; + + /** + * The string representation of this SDK version. + * + * @returns The SDK version. + */ function getSDKVersion(): string; + + /** + * Initializes the SDK library. This should be called before any other SDK functions. + * + * @returns A promise that resolves when the SDK is ready to use. + * @throws INVALID_OPERATION + */ function initializeAsync(): Promise; + + /** + * Report the game's initial loading progress. + * + * @param percentage A number between 0 and 100. + */ function setLoadingProgress(percentage: number): void; + + /** + * Provides a list of API functions that are supported by the client. + * + * @returns List of API functions that the client explicitly supports. + */ function getSupportedAPIs(): string[]; + + /** + * Returns any data object associated with the entry point that the game was launched from. + * + * The contents of the object are developer-defined, and can occur from entry points on different platforms. + * This will return null for older mobile clients, as well as when there is no data associated with the particular entry point. + * + * @returns Data associated with the current entry point. + */ function getEntryPointData(): any; + + /** + * Returns the entry point that the game was launched from. + * This function should be called after FBInstant.startGameAsync() resolves. + * + * @returns The name of the entry point from which the user started the game. + */ function getEntryPointAsync(): Promise; + + /** + * Sets the data associated with the individual gameplay session for the current context. + * + * This function should be called whenever the game would like to update the current session data. + * This session data may be used to populate a variety of payloads, such as game play webhooks. + * + * @param sessionData An arbitrary data object, which must be less than or equal to 1000 characters when stringified. + */ function setSessionData(sessionData: any): void; + + /** + * This indicates that the game has finished initial loading and is ready to start. + * Context information will be up-to-date when the returned promise resolves. + * + * @returns A promise that resolves when the game should start. + * @throws INVALID_PARAM + * @throws CLIENT_UNSUPPORTED_OPERATION + */ function startGameAsync(): Promise; + + /** + * This invokes a dialog to let the user share specified content, either as a message in Messenger or as a post on the user's timeline. + * A blob of data can be attached to the share which every game session launched from the share will be able to access from FBInstant.getEntryPointData(). + * This data must be less than or equal to 1000 characters when stringified. The user may choose to cancel the share action and close the dialog, and the + * returned promise will resolve when the dialog is closed regardless if the user actually shared the content or not. + * + * @param payload Specify what to share. See example for details. + * @returns A promise that resolves when the share is completed or cancelled. + * @throws INVALID_PARAM + * @throws NETWORK_FAILURE + * @throws PENDING_REQUEST + * @throws CLIENT_UNSUPPORTED_OPERATION + * @throws INVALID_OPERATION + */ function shareAsync(payload: SharePayload): Promise; + + /** + * Informs Facebook of an update that occurred in the game. This will temporarily yield control to Facebook and Facebook will decide what to do based on what the update is. + * The returned promise will resolve/reject when Facebook returns control to the game. + * + * @param payload A payload that describes the update. + * @returns A promise that resolves when Facebook gives control back to the game. + * @throws INVALID_PARAM + * @throws PENDING_REQUEST + * @throws INVALID_OPERATION + */ function updateAsync(payload: CustomUpdatePayload | LeaderboardUpdatePayload): Promise; + + /** + * Request that the client switch to a different Instant Game. The API will reject if the switch fails - else, the client will load the new game. + * + * @param appID The Application ID of the Instant Game to switch to. The application must be an Instant Game, and must belong to the same business as the current game. + * To associate different games with the same business, you can use Business Manager: https://developers.facebook.com/docs/apps/business-manager#update-business. + * @param data An optional data payload. This will be set as the entrypoint data for the game being switched to. Must be less than or equal to 1000 characters when stringified. + * @throws USER_INPUT + * @throws INVALID_PARAM + * @throws PENDING_REQUEST + * @throws CLIENT_REQUIRES_UPDATE + */ function switchGameAsync(appID: string, data?: any): Promise; + + /** + * Returns whether or not the user is eligible to have shortcut creation requested. + * + * Will return false if createShortcutAsync was already called this session or the user is ineligible for shortcut creation. + * + * @returns Promise that resolves with true if the game can request the player create a shortcut to the game, and false otherwise + * @throws PENDING_REQUEST + * @throws CLIENT_REQUIRES_UPDATE + * @throws INVALID_OPERATION + */ function canCreateShortcutAsync(): Promise; + + /** + * Prompts the user to create a shortcut to the game if they are eligible to Can only be called once per session. (see canCreateShortcutAsync) + * @throws USER_INPUT + * @throws PENDING_REQUEST + * @throws CLIENT_REQUIRES_UPDATE + * @throws INVALID_OPERATION + */ function createShortcutAsync(): Promise; + + /** + * Quits the game. + */ function quit(): void; + + /** + * Log an app event with FB Analytics. See https://developers.facebook.com/docs/javascript/reference/v2.8#app_events for more details about FB Analytics. + * + * @param eventName Name of the event. Must be 2 to 40 characters, and can only contain '_', '-', ' ', and alphanumeric characters. + * @param valueToSum An optional numeric value that FB Analytics can calculate a sum with. + * @param parameter An optional object that can contain up to 25 key-value pairs to be logged with the event. Keys must be 2 to 40 characters, + * and can only contain '_', '-', ' ', and alphanumeric characters. Values must be less than 100 characters in length. + * @returns The error if the event failed to log; otherwise returns null. + */ function logEvent(eventName: string, valueToSum?: number, parameter?: { [key: string]: string; }): APIError | null; + + /** + * Set a callback to be fired when a pause event is triggered. + * @param func A function to call when a pause event occurs. + */ function onPause(func: () => void): void; + + /** + * Attempt to create an instance of interstitial ad. This instance can then be preloaded and presented. + * @param placementID The placement ID that's been setup in your Audience Network settings. + * @returns A promise that resolves with a AdInstance, or rejects with a APIError if it couldn't be created. + * @throws ADS_TOO_MANY_INSTANCES + * @throws CLIENT_UNSUPPORTED_OPERATION + */ function getInterstitialAdAsync(placementID: string): Promise; + + /** + * Attempt to create an instance of rewarded video. This instance can then be preloaded and presented. + * @param placementID The placement ID that's been setup in your Audience Network settings. + * @returns A promise that resolves with a AdInstance, or rejects with a APIError if it couldn't be created. + * @throws ADS_TOO_MANY_INSTANCES + * @throws CLIENT_UNSUPPORTED_OPERATION + */ function getRewardedVideoAsync(placementID: string): Promise; + + /** + * Attempts to match the current player with other users looking for people to play with. If successful, a new Messenger group + * thread will be created containing the matched players and the player will be context switched to that thread. + * The default minimum and maximum number of players in one matched thread are 2 and 20 respectively, depending on how many players + * are trying to get matched around the same time. The values can be changed in fbapp-config.json. See the + * [Bundle Config documentation]https://developers.facebook.com/docs/games/instant-games/bundle-config for documentation about fbapp-config.json. + * + * @param matchTag Optional extra information about the player used to group them with similar players. Players will only be grouped with other players with exactly the same tag. + * The tag must only include letters, numbers, and underscores and be 100 characters or less in length. + * @param switchContextWhenMatched Optional extra parameter that specifies whether the player should be immediately switched to the new context when a match is found. + * By default this will be false which will mean the player needs explicitly press play after being matched to switch to the new context. + * @returns A promise that resolves when the player has been added to a group thread and switched into the thread's context. + * @throws INVALID_PARAM + * @throws NETWORK_FAILURE + * @throws USER_INPUT + * @throws PENDING_REQUEST + * @throws CLIENT_UNSUPPORTED_OPERATION + * @throws INVALID_OPERATION + */ function matchPlayerAsync(matchTag?: string, switchContextWhenMatched?: boolean): Promise; + + /** + * Checks if the current player is eligible for the matchPlayerAsync API. + * @returns A promise that resolves with true if the player is eligible to match with other players and false otherwise. + * @throws NETWORK_FAILURE + * @throws CLIENT_UNSUPPORTED_OPERATION + */ function checkCanPlayerMatchAsync(): Promise; + + /** + * Fetch a specific leaderboard belonging to this Instant Game. + * + * @param name The name of the leaderboard. Each leaderboard for an Instant Game must have its own distinct name. + * @returns A promise that resolves with the matching leaderboard, rejecting if one is not found. + * @throws LEADERBOARD_NOT_FOUND + * @throws NETWORK_FAILURE + * @throws CLIENT_UNSUPPORTED_OPERATION + * @throws INVALID_OPERATION + * @throws INVALID_PARAM + */ function getLeaderboardAsync(name: string): Promise; interface Player { + /** + * A unique identifier for the player. A Facebook user's player ID will remain constant, + * and is scoped to a specific game. This means that different games will have different + * player IDs for the same user. This function should not be called until FBInstant.initializeAsync() + * has resolved. + * + * @returns A unique identifier for the player. + */ getID(): string | null; + + /** + * Fetch the player's unique identifier along with a signature that verifies that the identifier indeed + * comes from Facebook without being tampered with. This function should not be called until + * FBInstant.initializeAsync() has resolved. + * + * @param requestPayload A developer-specified payload to include in the signed response. + * @returns A promise that resolves with a SignedPlayerInfo object. + * @throws INVALID_PARAM + * @throws NETWORK_FAILURE + * @throws CLIENT_UNSUPPORTED_OPERATION + */ getSignedPlayerInfoAsync(requestPayload?: string): Promise; + + /** + * Returns a promise that resolves with whether the player can subscribe to the game bot or not. + * Developer can only call subscribeBotAsync() after checking canSubscribeBotAsync(), and the player will + * only be able to see this bot subscription dialog once for a specific game. + * + * @returns Whether a player can subscribe to the game bot or not. + */ canSubscribeBotAsync(): Promise; + + /** + * Request that the player subscribe the bot associated to the game. The API will reject if the subscription + * fails - else, the player will subscribe the game bot. + * + * @returns A promise that resolves if player successfully subscribed to the game bot, or rejects if request failed or player chose to not subscribe. + * @throws INVALID_PARAM + * @throws PENDING_REQUEST + * @throws CLIENT_REQUIRES_UPDATE + */ subscribeBotAsync(): Promise; + + /** + * The player's localized display name. This function should not be called until FBInstant.startGameAsync() has resolved. + * + * @returns The player's localized display name. + */ getName(): string | null; + + /** + * A url to the player's public profile photo. The photo will always be a square, and with dimensions of at least 200x200. + * When rendering it in the game, the exact dimensions should never be assumed to be constant. It's recommended to always + * scale the image to a desired size before rendering. The value will always be null until FBInstant.startGameAsync() resolves. + * + * WARNING: Due to CORS, using these photos in the game canvas can cause it to be tainted, which will prevent the canvas data from being extracted. + * To prevent this, set the cross-origin attribute of the images you use to 'anonymous'. + * + * @returns Url to the player's public profile photo. + */ getPhoto(): string | null; + + /** + * Retrieve data from the designated cloud storage of the current player. + * + * @param keys An array of unique keys to retrieve data for. + * @returns A promise that resolves with an object which contains the current key-value pairs for each key specified in the input array, if they exist. + * @throws INVALID_PARAM + * @throws NETWORK_FAILURE + * @throws CLIENT_UNSUPPORTED_OPERATION + */ getDataAsync(keys: string[]): Promise; + + /** + * Set data to be saved to the designated cloud storage of the current player. The game can store up to 1MB of data for each unique player. + * + * @param data An object containing a set of key-value pairs that should be persisted to cloud storage. The object must contain only serializable + * values - any non-serializable values will cause the entire modification to be rejected. + * @returns A promise that resolves when the input values are set. NOTE: The promise resolving does not necessarily mean that the input has already been persisted. + * Rather, it means that the data was valid and has been scheduled to be saved. It also guarantees that all values that were set are now available in player.getDataAsync. + * @throws INVALID_PARAM + * @throws NETWORK_FAILURE + * @throws PENDING_REQUEST + * @throws CLIENT_UNSUPPORTED_OPERATION + */ setDataAsync(data: DataObject): Promise; + + /** + * Immediately flushes any changes to the player data to the designated cloud storage. This function is expensive, and should primarily be + * used for critical changes where persistence needs to be immediate and known by the game. Non-critical changes should rely on the platform + * to persist them in the background. NOTE: Calls to player.setDataAsync will be rejected while this function's result is pending. + * + * @returns A promise that resolves when changes have been persisted successfully, and rejects if the save fails. + * @throws INVALID_PARAM + * @throws NETWORK_FAILURE + * @throws PENDING_REQUEST + * @throws CLIENT_UNSUPPORTED_OPERATION + */ flushDataAsync(): Promise; + + /** + * Retrieve stats from the designated cloud storage of the current player. + * + * @param keys An optional array of unique keys to retrieve stats for. If the function is called without it, it will fetch all stats. + * @returns A promise that resolves with an object which contains the current key-value pairs for each key specified in the input array, if they exist. + * @throws INVALID_PARAM + * @throws NETWORK_FAILURE + * @throws CLIENT_UNSUPPORTED_OPERATION + */ getStatsAsync(keys?: string[]): Promise; + + /** + * Set stats to be saved to the designated cloud storage of the current player. + * + * @param stats An object containing a set of key-value pairs that should be persisted to cloud storage as stats, which can be surfaced or used in a + * variety of ways to benefit player engagement.The object must contain only numerical values - any non-numerical values will cause the entire modification to be rejected. + * @returns A promise that resolves when the input values are set. NOTE: The promise resolving does not necessarily mean that the input has already been persisted. + * Rather, it means that the data was validated and has been scheduled to be saved. It also guarantees that all values that were set are now available in player.getStatsAsync. + * @throws INVALID_PARAM + * @throws NETWORK_FAILURE + * @throws PENDING_REQUEST + * @throws CLIENT_UNSUPPORTED_OPERATION + */ setStatsAsync(stats: StatsObject): Promise; + + /** + * Increment stats saved in the designated cloud storage of the current player. + * + * @param increments An object containing a set of key-value pairs indicating how much to increment each stat in cloud storage. + * The object must contain only numerical values - any non-numerical values will cause the entire modification to be rejected. + * @returns A promise that resolves with an object which contains the updated key-value pairs for each key specified in the input dictionary. + * NOTE: The promise resolving does not necessarily mean that the changes have already been persisted. Rather, it means that the increments were + * valid and have been scheduled to be performed. It also guarantees that all values that were incremented are now available in player.getStatsAsync. + * @throws INVALID_PARAM + * @throws NETWORK_FAILURE + * @throws PENDING_REQUEST + * @throws CLIENT_UNSUPPORTED_OPERATION + */ incrementStatsAsync(increments: IncrementObject): Promise; + + /** + * Fetches an array of ConnectedPlayer objects containing information about players that are connected to the current player. + * @returns A promise that resolves with a list of connected player objects. NOTE: This promise will not resolve until FBInstant.startGameAsync() has resolved. + * @throws NETWORK_FAILURE + * @throws CLIENT_UNSUPPORTED_OPERATION + */ getConnectedPlayersAsync(): Promise; } interface Context { + /** + * A unique identifier for the current game context. This represents a specific context that the game is being played in + * (for example, a particular messenger conversation or facebook post). The identifier will be null if game is being played in + * a solo context. This function should not be called until FBInstant.startGameAsync has resolved. + * + * @returns A unique identifier for the current game context. + */ getID(): string | null; + + /** + * The type of the current game context. POST - A facebook post. THREAD - A messenger thread. + * GROUP - A facebook group. SOLO - Default context, where the player is the only participant. + * This function should not be called until FBInstant.startGameAsync has resolved. + * + * @returns Type of the current game context + */ getType(): Type; + + /** + * This function determines whether the number of participants in the current game context is between a given minimum and maximum, inclusive. + * If one of the bounds is null only the other bound will be checked against. It will always return the original result for the first call made in + * a context in a given game play session. Subsequent calls, regardless of arguments, will return the answer to the original query until a context + * change occurs and the query result is reset. This function should not be called until FBInstant.startGameAsync has resolved. + * This will be null if one or both of the supplied arguments are not valid, if we do not have a size available for the current context, + * or if the API is called before startGameAsync() resolves. + * + * @param minSize The minimum bound of the context size query. + * @param maxSize The maximum bound of the context size query. + * @returns ContextSizeResponse + */ isSizeBetween(minSize?: number, maxSize?: number): ContextSizeResponse | null; + + /** + * Request a switch into a specific context. If the player does not have permission to enter that context, + * or if the player does not provide permission for the game to enter that context, + * this will reject. Otherwise, the promise will resolve when the game has switched into the specified context. + * + * @param id ID of the desired context. + * @returns A promise that resolves when the game has switched into the specified context, or rejects otherwise. + * @throws INVALID_PARAM + * @throws SAME_CONTEXT + * @throws NETWORK_FAILURE + * @throws USER_INPUT + * @throws PENDING_REQUEST + * @throws CLIENT_UNSUPPORTED_OPERATION + */ switchAsync(id: string): Promise; + + /** + * Opens a context selection dialog for the player. If the player selects an available context, the client will attempt to switch into that context, + * and resolve if successful. Otherwise, if the player exits the menu or the client fails to switch into the new context, this function will reject. + * + * @param options An object specifying conditions on the contexts that should be offered. + * @returns A promise that resolves when the game has switched into the context chosen by the user. Otherwise, the promise will reject (if the user cancels out of the dialog, for example). + * @throws INVALID_PARAM + * @throws SAME_CONTEXT + * @throws NETWORK_FAILURE + * @throws USER_INPUT + * @throws PENDING_REQUEST + * @throws CLIENT_UNSUPPORTED_OPERATION + */ chooseAsync(options: ContextOptions): Promise; + + /** + * Attempts to create or switch into a context between a specified player and the current player. The returned promise will reject if the player listed is not a Connected Player of the current + * player or if the player does not provide permission to enter the new context. Otherwise, the promise will resolve when the game has switched into the new context. + * + * @param playerID ID of the player + * @returns A promise that resolves when the game has switched into the new context, or rejects otherwise. + * @throws INVALID_PARAM + * @throws SAME_CONTEXT + * @throws NETWORK_FAILURE + * @throws USER_INPUT + * @throws PENDING_REQUEST + * @throws CLIENT_UNSUPPORTED_OPERATION + */ createAsync(playerID: string): Promise; + + /** + * Gets an array of ContextPlayer objects containing information about active players — people who actively played the game in the current context in the last 90 days. + * This may include the current player. + * @throws NETWORK_FAILURE + * @throws CLIENT_UNSUPPORTED_OPERATION + * @throws INVALID_OPERATION + */ getPlayersAsync(): Promise; } + /** + * An Instant Game leaderboard + */ interface Leaderboard { + /** + * The name of the leaderboard. + */ getName(): string; + + /** + * The ID of the context that the leaderboard is associated with, or null if the leaderboard is not tied to a particular context. + */ getContextID(): string | null; + + /** + * Fetches the total number of player entries in the leaderboard. + * + * @returns A unique identifier for the player. + * @throws NETWORK_FAILURE + * @throws RATE_LIMITED + */ getEntryCountAsync(): Promise; + + /** + * Updates the player's score. If the player has an existing score, the old score will only be replaced if the new score is better than it. + * NOTE: If the leaderboard is associated with a specific context, the game must be in that context to set a score for the player. + * + * @param score The new score for the player. Must be a 64-bit integer number. + * @param extraData Metadata to associate with the stored score. Must be less than 2KB in size. + * @returns Resolves with the current leaderboard entry for the player after the update. + * @throws LEADERBOARD_WRONG_CONTEXT + * @throws NETWORK_FAILURE + * @throws INVALID_PARAM + * @throws INVALID_OPERATION + * @throws RATE_LIMITED + */ setScoreAsync(score: number, extraData: string): Promise; + + /** + * Retrieves the leaderboard's entry for the current player, or null if the player has not set one yet. + * + * @returns Resolves with the current leaderboard entry for the player. + * @throws NETWORK_FAILURE + * @throws INVALID_OPERATION + * @throws RATE_LIMITED + */ getPlayerEntryAsync(): Promise; + + /** + * Retrieves a set of leaderboard entries, ordered by score ranking in the leaderboard. + * + * @param count The number of entries to attempt to fetch from the leaderboard. Defaults to 10 if not specified. Up to a maximum of 100 entries may be fetched per query. + * @param offset The offset from the top of the leaderboard that entries will be fetched from. + * @returns Resolves with the leaderboard entries that match the query. + * @throws NETWORK_FAILURE + * @throws RATE_LIMITED + */ getEntriesAsync(count: number, offset: number): Promise; + + /** + * Retrieves the leaderboard score entries of the current player's connected players (including the current player), ordered by local rank within the set of connected players. + * @param count The number of entries to attempt to fetch from the leaderboard. Defaults to 10 if not specified. Currently, up to a maximum of 100 entries may be fetched per query. + * @param offset The offset from the set of ordered connected player score entries to fetch from. + * @returns Resolves with the leaderboard entries that match the query. + */ getConnectedPlayerEntriesAsync(count: number, offset: number): Promise; } + /** + * A score entry for an Instant Game leaderboard + */ interface LeaderboardEntry { + /** + * Gets the score associated with the entry. + * @returns Returns an integer score value. + */ getScore(): number; + + /** + * Gets the score associated with the entry, formatted with the score format associated with the leaderboard. + * @returns Returns a formatted score. + */ getFormattedScore(): string; + + /** + * Gets the timestamp of when the leaderboard entry was last updated. + * @returns Returns a Unix timestamp. + */ getTimestamp(): number; + + /** + * Gets the rank of the player's score in the leaderboard + * @returns Returns the entry's leaderboard ranking. + */ getRank(): number; + + /** + * Gets the developer-specified payload associated with the score, or null if one was not set. + * @returns An optional developer-specified payload associated with the score. + */ getExtraData(): string | null; + + /** + * Gets information about the player associated with the entry. + */ getPlayer(): LeaderboardPlayer; } + /** + * Details about the player associated with a score entry. + */ interface LeaderboardPlayer { + /** + * Gets the player's localized display name. + * + * @returns The player's localized display name. + */ getName(): string; + + /** + * Returns a url to the player's public profile photo. + * + * @returns Url to the player's public profile photo. + */ getPhoto(): string | null; + + /** + * Gets the game's unique identifier for the player. + * + * @returns The game-scoped identifier for the player. + */ getID(): string | null; } + /** + * Represents information about a player who is connected to the current player. + */ interface ConnectedPlayer { + /** + * Get the id of the connected player. + * + * @returns The ID of the connected player + */ getID(): string; + + /** + * Get the player's full name. + * + * @returns The player's full name + */ getName(): string | null; + + /** + * Get the player's public profile photo. + * + * @returns A url to the player's public profile photo + */ getPhoto(): string | null; } + /** + * Represents information about the player along with a signature to verify that it indeed comes from Facebook. + */ interface SignedPlayerInfo { + /** + * Get the id of the player. + * @returns The ID of the player + */ getPlayerID(): string; + + /** + * A signature to verify this object indeed comes from Facebook. The string is base64url encoded and signed with an HMAC version of your App Secret, + * based on the OAuth 2.0 spec. + * + * You can validate it with the following 4 steps: + * + * Split the signature into two parts delimited by the '.' character. + * + * Decode the first part (the encoded signature) with base64url encoding. + * + * Decode the second part (the response payload) with base64url encoding, which should be a string representation of a JSON object that has the following fields: + * ** algorithm - always equals to HMAC-SHA256 + * ** issued_at - a unix timestamp of when this response was issued. + * ** player_id - unique identifier of the player. + * ** request_payload - the requestPayload string you specified when calling FBInstant.player.getSignedPlayerInfoAsync. + * + * Hash the whole response payload string using HMAC SHA-256 and your app secret and confirm that it is equal to the encoded signature. + * + * You may also wish to validate the issued_at timestamp in the response payload to ensure the request was made recently. + * + * Signature validation should only happen on your server. Never do it on the client side as it will compromise your app secret key. + * + * @returns The signature string. + */ getSignature(): string; } + /** + * Represents information about a player who is in the context that the current player is playing in. + */ interface ContextPlayer { + /** + * Get the id of the context player. + * + * @returns The ID of the context player + */ getID(): string; + + /** + * Get the player's localized display name. + * + * @returns The player's localized display name. + */ getName(): string | null; + + /** + * Get the player's public profile photo. + * + * @returns A url to the player's public profile photo + */ getPhoto(): string | null; } + /** + * Represents an instance of an ad. + */ interface AdInstance { + /** + * Return the Audience Network placement ID of this ad instance. + */ getPlacementID(): string; + + /** + * Preload the ad. The returned promise resolves when the preload completes, and rejects if it failed. + * @throws ADS_FREQUENT_LOAD + * @throws ADS_NO_FILL + * @throws INVALID_PARAM + * @throws NETWORK_FAILURE + */ loadAsync(): Promise; + + /** + * Present the ad. The returned promise resolves when user finished watching the ad, and rejects if it failed to present or was closed during the ad. + * @throws ADS_NOT_LOADED + * @throws INVALID_PARAM + * @throws NETWORK_FAILURE + * @throws INVALID_OPERATION + */ showAsync(): Promise; } interface Payments { + /** + * Fetches the game's product catalog. + * + * @returns The set of products that are registered to the game. + * @throws CLIENT_UNSUPPORTED_OPERATION + * @throws PAYMENTS_NOT_INITIALIZED + * @throws NETWORK_FAILURE + */ getCatalogAsync(): Promise; + + /** + * Begins the purchase flow for a specific product. Will immediately reject if called before FBInstant.startGameAsync() has resolved. + * + * @param purchaseConfig The purchase's configuration details. + * @returns A Promise that resolves when the product is successfully purchased by the player. Otherwise, it rejects. + * @throws CLIENT_UNSUPPORTED_OPERATION + * @throws PAYMENTS_NOT_INITIALIZED + * @throws INVALID_PARAM + * @throws NETWORK_FAILURE + * @throws INVALID_OPERATION + */ purchaseAsync(purchaseConfig: PurchaseConfig): Promise; + + /** + * Fetches all of the player's unconsumed purchases. As a best practice, the game should fetch the current player's purchases + * as soon as the client indicates that it is ready to perform payments-related operations. The game can then process and consume + * any purchases that are waiting to be consumed. + * + * @returns The set of purchases that the player has made for the game. + * @throws CLIENT_UNSUPPORTED_OPERATION + * @throws PAYMENTS_NOT_INITIALIZED + * @throws NETWORK_FAILURE + */ getPurchasesAsync(): Promise; + + /** + * Consumes a specific purchase belonging to the current player. Before provisioning a product's effects to the player, + * the game should request the consumption of the purchased product. Once the purchase is successfully consumed, the game + * should immediately provide the player with the effects of their purchase. + * + * @param purchaseToken The purchase token of the purchase that should be consumed. + * @throws CLIENT_UNSUPPORTED_OPERATION + * @throws PAYMENTS_NOT_INITIALIZED + * @throws INVALID_PARAM + * @throws NETWORK_FAILURE + */ consumePurchaseAsync(purchaseToken: string): Promise; + + /** + * Sets a callback to be triggered when Payments operations are available. + * @param callback The callback function to be executed when Payments are available. + */ onReady(callback: () => void): void; } + /** + * Represents a game's product information. + */ interface Product { + /** + * The title of the product + */ title: string; + + /** + * he product's game-specified identifier + */ productID: string; + + /** + * The product description + */ description?: string; + + /** + * A link to the product's associated image + */ imageURI?: string; + + /** + * The price of the product + */ price: string; + + /** + * The currency code for the product + */ priceCurrencyCode: string; } + /** + * The answer field is true if the current context size is between the minSize and maxSize values that are specified in the object, and false otherwise. + */ interface ContextSizeResponse { answer: boolean; minSize?: number; maxSize?: number; } + /** + * Represents an individual purchase of a game product. + */ interface Purchase { + /** + * A developer-specified string, provided during the purchase of the product + */ developerPayload?: string; + + /** + * The identifier for the purchase transaction + */ paymentID: string; + + /** + * The product's game-specified identifier + */ productID: string; + + /** + * Unix timestamp of when the purchase occurred + */ purchaseTime: string; + + /** + * A token representing the purchase that may be used to consume the purchase + */ purchaseToken: string; + + /** + * Server-signed encoding of the purchase request + */ signedRequest: SignedPurchaseRequest; } interface ContextOptions { + /** + * The set of filters to apply to the context suggestions. + */ filters?: ContextFilter[]; + + /** + * The maximum number of participants that a suggested context should ideally have. + */ maxSize?: number; + + /** + * The minimum number of participants that a suggested context should ideally have. + */ minSize?: number; } + /** + * Represents content to be shared by the user. + */ interface SharePayload { + /** + * Indicates the intent of the share. + */ intent: Intent; + + /** + * A base64 encoded image to be shared. + */ image: string; + + /** + * A text message to be shared. + */ text: string; + + /** + * A blob of data to attach to the share. All game sessions launched from the share will be able to access this blob through FBInstant.getEntryPointData(). + */ data?: any; } + /** + * An API Error returned by the Instant Games SDK + */ interface APIError { + /** + * The relevant error code + */ code: ErrorCodeType; + /** + * A message describing the error + */ message: string; } + /** + * The configuration of a purchase request for a product registered to the game. + */ interface PurchaseConfig { + /** + * The identifier of the product to purchase + */ productID: string; + + /** + * An optional developer-specified payload, to be included in the returned purchase's signed request. + */ developerPayload?: string; } + /** + * Represents a custom update for FBInstant.updateAsync. + */ interface CustomUpdatePayload { + /** + * For custom updates, this should be 'CUSTOM'. + */ action: UpdateAction; + + /** + * ID of the template this custom update is using. Templates should be predefined in fbapp-config.json. + * See the [Bundle Config documentation]https://developers.facebook.com/docs/games/instant-games/bundle-config + * or documentation about fbapp-config.json. + */ template: string; + + /** + * Optional call-to-action button text. By default we will use a localized 'Play' as the button text. To provide localized + * versions of your own call to action, pass an object with the default cta as the value of 'default' and another object mapping + * locale keys to translations as the value of 'localizations'. + */ cta?: (string | LocalizableContent); + + /** + * Data URL of a base64 encoded image. + */ image: string; + + /** + * A text message, or an object with the default text as the value of 'default' and another object mapping locale keys to + * translations as the value of 'localizations'. + */ text: (string | LocalizableContent); + + /** + * A blob of data to attach to the update. All game sessions launched from the update will be able to access this blob + * through FBInstant.getEntryPointData(). Must be less than or equal to 1000 characters when stringified. + */ data?: any; + + /** + * Specifies how the update should be delivered. This can be one of the following: + * + * 'IMMEDIATE' - The update should be posted immediately. + * + * 'LAST' - The update should be posted when the game session ends. The most recent update sent using the 'LAST' strategy will be the one sent. + * + * 'IMMEDIATE_CLEAR' - The update is posted immediately, and clears any other pending updates (such as those sent with the 'LAST' strategy). + * + * If no strategy is specified, we default to 'IMMEDIATE'. + */ strategy?: string; + + /** + * Specifies notification setting for the custom update. This can be 'NO_PUSH' or 'PUSH', and defaults to 'NO_PUSH'. + * Use push notification only for updates that are high-signal and immediately actionable for the recipients. + * Also note that push notification is not always guaranteed, depending on user setting and platform policies. + */ notification?: string; } + /** + * Represents a leaderboard update for FBInstant.updateAsync. + */ interface LeaderboardUpdatePayload { + /** + * For a leaderboard update, this should be 'LEADERBOARD'. text. By default we will use a localized 'Play Now' as the button text. + */ action: UpdateAction; + + /** + * The name of the leaderboard to feature in the update. + */ name: string; + + /** + * Optional text message. If not specified, a localized fallback message will be provided instead. + */ text?: string; } + /** + * Represents a string with localizations and a default value to fall back on. + */ interface LocalizableContent { + /** + * The default value of the string to use if the viewer's locale is not a key in the localizations object. + */ default: string; + /** + * Specifies what string to use for viewers in each locale. See https://origincache.facebook.com/developers/resources/?id=FacebookLocales.xml for a complete list of supported locale values. + */ localizations: LocalizationsDict; } @@ -189,16 +1043,35 @@ declare namespace FBInstant { interface IncrementObject { [ key: string ]: number; } + /** + * Represents a mapping from locales to translations of a given string. Each property is an optional five-character Facebook locale code of the form xx_XX. + * See https://origincache.facebook.com/developers/resources/?id=FacebookLocales.xml for a complete list of supported locale codes. + */ interface LocalizationsDict { [x: string]: string; } type SignedPurchaseRequest = string; + /** + * A filter that may be applied to a Context Choose operation + * 'NEW_CONTEXT_ONLY' - Prefer to only surface contexts the game has not been played in before. + * 'INCLUDE_EXISTING_CHALLENGES' - Include the "Existing Challenges" section, which surfaces actively played-in contexts that the player is a part of. + * 'NEW_PLAYERS_ONLY' - In sections containing individuals, prefer people who have not played the game. + */ type ContextFilter = "NEW_CONTEXT_ONLY" | "INCLUDE_EXISTING_CHALLENGES" | "NEW_PLAYERS_ONLY"; + /** + * Represents the type of the update action to perform. + * + * "CUSTOM": A custom update, with all content specified by the game. + * "LEADERBOARD": An update associated with an Instant Game leaderboard. + */ type UpdateAction = "CUSTOM" | "LEADERBOARD"; + /** + * Represents the current platform that the user is playing on. + */ type Platform = "IOS" | "ANDROID" | "WEB" | "MOBILE_WEB"; type Type = "POST" | "THREAD" | "GROUP" | "SOLO"; From 854a093d693e533240820f64977cac054a63edca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Johansen=20Amundrud?= Date: Sun, 20 May 2018 23:34:36 +0200 Subject: [PATCH 275/575] Exercise each function in test --- .../facebook-instant-games-tests.ts | 180 +++++++++++++----- 1 file changed, 128 insertions(+), 52 deletions(-) diff --git a/types/facebook-instant-games/facebook-instant-games-tests.ts b/types/facebook-instant-games/facebook-instant-games-tests.ts index 8d33e2c970..949782c41a 100644 --- a/types/facebook-instant-games/facebook-instant-games-tests.ts +++ b/types/facebook-instant-games/facebook-instant-games-tests.ts @@ -1,58 +1,134 @@ -class FBInstantTest { - winStreak: number; +const locale: string = FBInstant.getLocale()!; +const platform: string = FBInstant.getPlatform(); +const sdkVersion: string = FBInstant.getSDKVersion(); +FBInstant.initializeAsync().then(() => {}); +FBInstant.setLoadingProgress(10); +const supportedAPIs = FBInstant.getSupportedAPIs(); +const entryPointData = FBInstant.getEntryPointData(); +FBInstant.getEntryPointAsync().then(entryPointName => {}); +FBInstant.setSessionData({sessionData: "sessionData"}); +FBInstant.startGameAsync().then(() => {}); - init() { - FBInstant.initializeAsync().then(() => { - FBInstant.setLoadingProgress(100); - FBInstant.startGameAsync().then(() => { - this.startGame(); - }); - }); - } +const sharePayload = { + intent: "INVITE" as "INVITE", + image: "", + text: "text", + data: {score: 10}, +}; +FBInstant.shareAsync(sharePayload); - startGame() { - const contextId = FBInstant.context.getID(); - const contextType = FBInstant.context.getType(); +const customUpdatePayload = { + action: "CUSTOM" as "CUSTOM", + template: "template", + cta: "cta", + image: "image", + text: { + default: 'Edgar played their move', + localizations: { + en_US: 'Edgar played their move', + es_LA: '\u00A1Edgar jug\u00F3 su jugada!' + } + }, +}; +FBInstant.updateAsync(customUpdatePayload).then(() => {}); - const playerName = FBInstant.player.getName(); - const playerPic = FBInstant.player.getPhoto(); - const playerId = FBInstant.player.getID(); - } +const leaderboardUpdatePayload: FBInstant.LeaderboardUpdatePayload = { + action: "LEADERBOARD", + name: "name", + text: "text" +}; +FBInstant.updateAsync(leaderboardUpdatePayload).then(() => {}); +FBInstant.switchGameAsync("appID").then(() => {}); - saveState() { - FBInstant.player.setDataAsync({ - score: this.winStreak - }); - } +FBInstant.canCreateShortcutAsync().then((canCreateShortcut: boolean) => {}); +FBInstant.createShortcutAsync().then(() => {}); +FBInstant.quit(); +const apiError = FBInstant.logEvent("eventName", 10, {key1: "value1", key2: "value2"}); +FBInstant.onPause(() => { }); - getState() { - FBInstant.player.getDataAsync(['score']) - .then((data) => { - if (typeof data['score'] !== 'undefined') { - this.winStreak = +data['score']; - } - }); - } +FBInstant.getInterstitialAdAsync("placementID").then(adInstance => {}); +FBInstant.getRewardedVideoAsync("placementID").then(adInstance => { + const placementID: string = adInstance.getPlacementID(); + adInstance.loadAsync().then(() => {}); + adInstance.showAsync().then(() => {}); +}); - update() { - FBInstant.updateAsync({ - action: 'CUSTOM', - cta: 'Play', - image: '', - text: { - default: 'Edgar played their move', - localizations: { - en_US: 'Edgar played their move', - es_LA: '\u00A1Edgar jug\u00F3 su jugada!' - } - }, - template: 'play_turn', - data: { myReplayData: '...' }, - strategy: 'IMMEDIATE', - notification: 'NO_PUSH' - }).then(() => { - // closes the game after the update is posted. - FBInstant.quit(); - }); - } -} +FBInstant.matchPlayerAsync("matchTag", false).then(() => {}); +FBInstant.checkCanPlayerMatchAsync().then((canPlayerMatchAsync: boolean) => {}); +FBInstant.getLeaderboardAsync("name").then((leaderboard: FBInstant.Leaderboard) => { + leaderboard.getConnectedPlayerEntriesAsync(10, 0).then(leaderboardEntries => { + const leaderboardEntry = leaderboardEntries[0]; + const extraData: string = leaderboardEntry.getExtraData()!; + const formattedScore: string = leaderboardEntry.getFormattedScore(); + + const leaderboardPlayer = leaderboardEntry.getPlayer(); + const leaderboardPlayerID: string = leaderboardPlayer.getID()!; + const leaderboardPlayerName: string = leaderboardPlayer.getName(); + const leaderboardPlayerPhoto: string = leaderboardPlayer.getPhoto()!; + + const rank: number = leaderboardEntry.getRank(); + const score: number = leaderboardEntry.getScore(); + const timestamp: number = leaderboardEntry.getTimestamp(); + }); +}); + +FBInstant.player.canSubscribeBotAsync().then((canSubscribeBot: boolean) => {}); +FBInstant.player.flushDataAsync().then(() => {}); +FBInstant.player.getConnectedPlayersAsync().then((connectedPlayers: FBInstant.ConnectedPlayer[]) => { + const connectedPlayer: FBInstant.ConnectedPlayer = connectedPlayers[0]; + const id: string = connectedPlayer.getID(); + const name: string = connectedPlayer.getName()!; + const photo: string = connectedPlayer.getPhoto()!; +}); +FBInstant.player.getDataAsync(["score"]).then(data => { + const score: number = data["score"] as number; +}); +const playerID: string = FBInstant.player.getID()!; +const playerName: string = FBInstant.player.getName()!; +const playerPhoto: string = FBInstant.player.getPhoto()!; +FBInstant.player.getSignedPlayerInfoAsync('metadata').then(signedPlayerInfo => { + const playerID: string = signedPlayerInfo.getPlayerID(); + const signature: string = signedPlayerInfo.getSignature(); +}); +FBInstant.player.getStatsAsync(["score"]).then(result => { + const score: number = result["score"]; +}); +FBInstant.player.incrementStatsAsync({score: 1}).then(result => { + const incrementedScore: number = result["score"]; +}); +FBInstant.player.setDataAsync({score: 10}).then(() => {}); +FBInstant.player.setStatsAsync({score: 10}).then(() => {}); +FBInstant.player.subscribeBotAsync().then(() => {}); + +const contextOptions: FBInstant.ContextOptions = { + filters: ["NEW_CONTEXT_ONLY"], + maxSize: 10, + minSize: 1 +}; +FBInstant.context.chooseAsync(contextOptions); +FBInstant.context.createAsync("playerID").then(() => {}); +const contextID: string = FBInstant.context.getID()!; +FBInstant.context.getPlayersAsync().then((contextPlayers: FBInstant.ContextPlayer[]) => { + const contextPlayer: FBInstant.ContextPlayer = contextPlayers[0]; + const id: string = contextPlayer.getID(); + const name: string = contextPlayer.getName()!; + const photo: string = contextPlayer.getPhoto()!; +}); +const type = FBInstant.context.getType(); +const contextSizeResponse = FBInstant.context.isSizeBetween(1, 10)!; +const sizeIsBetween: boolean = contextSizeResponse.answer; +const maxSize: number = contextSizeResponse.maxSize!; +const minSize: number = contextSizeResponse.minSize!; + +FBInstant.context.switchAsync("id").then(() => {}); + +FBInstant.payments.consumePurchaseAsync("purchaseToken").then(() => {}); +FBInstant.payments.getCatalogAsync().then((products: FBInstant.Product[]) => { + const product = products[0]; + const description: string = product.description!; + const imageURI: string = product.imageURI!; + const price: string = product.price; + const priceCurrencyCode: string = product.priceCurrencyCode; + const productID: string = product.productID; + const title: string = product.title; +}); From 2a4b24f0d0d435acc61a3b2f7b3e4c6dbad5a1e9 Mon Sep 17 00:00:00 2001 From: GlenCFL Date: Sun, 20 May 2018 13:59:20 -0400 Subject: [PATCH 276/575] [atom] support Project.onDidReplace, add history interfaces --- types/atom/atom-tests.ts | 4 ++++ types/atom/index.d.ts | 35 +++++++++++++++++++++++++++-------- 2 files changed, 31 insertions(+), 8 deletions(-) diff --git a/types/atom/atom-tests.ts b/types/atom/atom-tests.ts index d6de0ef802..39cbb9ead0 100644 --- a/types/atom/atom-tests.ts +++ b/types/atom/atom-tests.ts @@ -1740,6 +1740,10 @@ function testProject() { subscription = project.onDidAddBuffer(buffer => buffer.id); subscription = project.observeBuffers(buffer => buffer.getUri()); + subscription = project.onDidReplace(projectSpec => { + if (projectSpec != null) str = projectSpec.originPath; + }); + // Accessing the git repository repositories = project.getRepositories(); diff --git a/types/atom/index.d.ts b/types/atom/index.d.ts index 77b79fbed2..8546e0e458 100644 --- a/types/atom/index.d.ts +++ b/types/atom/index.d.ts @@ -4485,6 +4485,10 @@ export interface Project { /** Invoke a callback when a filesystem change occurs within any open project path. */ onDidChangeFiles(callback: (events: FilesystemChangeEvent) => void): Disposable; + /** Invoke a callback whenever the project's configuration has been replaced. */ + onDidReplace(callback: (projectSpec: ProjectSpecification | null | undefined) => void): + Disposable; + // Accessing the Git Repository /** * Get an Array of GitRepositorys associated with the project's directories. @@ -5219,17 +5223,17 @@ export class TextBuffer { * Undo the last operation. If a transaction is in progress, aborts it. * @return A boolean of whether or not a change was made. */ - undo(options?: { selectionsMarkerLayer?: MarkerLayer }): boolean; + undo(options?: HistoryTraversalOptions): boolean; /** * Redo the last operation. * @return A boolean of whether or not a change was made. */ - redo(options?: { selectionsMarkerLayer?: MarkerLayer }): boolean; + redo(options?: HistoryTraversalOptions): boolean; /** Batch multiple operations as a single undo/redo step. */ - transact(optionsOrInterval: number | { groupingInterval?: number, - selectionsMarkerLayer?: MarkerLayer }, fn: () => T): T; + transact(optionsOrInterval: number | { groupingInterval?: number } & + HistoryTransactionOptions, fn: () => T): T; /** Batch multiple operations as a single undo/redo step. */ transact(fn: () => T): T; @@ -5248,13 +5252,13 @@ export class TextBuffer { * `::revertToCheckpoint` and `::groupChangesSinceCheckpoint`. * @return A checkpoint ID value. */ - createCheckpoint(options?: { selectionsMarkerLayer?: MarkerLayer }): number; + createCheckpoint(options?: HistoryTransactionOptions): number; /** * Revert the buffer to the state it was in when the given checkpoint was created. * @return A boolean indicating whether the operation succeeded. */ - revertToCheckpoint(checkpoint: number, options?: { selectionsMarkerLayer: MarkerLayer }): + revertToCheckpoint(checkpoint: number, options?: HistoryTraversalOptions): boolean; /** @@ -5262,8 +5266,7 @@ export class TextBuffer { * purposes of undo/redo. * @return A boolean indicating whether the operation succeeded. */ - groupChangesSinceCheckpoint(checkpoint: number, options?: - { selectionsMarkerLayer: MarkerLayer }): boolean; + groupChangesSinceCheckpoint(checkpoint: number, options?: HistoryTransactionOptions): boolean; /** * Group the last two text changes for purposes of undo/redo. @@ -6369,6 +6372,16 @@ export interface FindMarkerOptions { intersectsRow?: number; } +export interface HistoryTransactionOptions { + /** When provided, skip taking snapshot for other selections markerLayers except given one. */ + selectionsMarkerLayer?: MarkerLayer; +} + +export interface HistoryTraversalOptions { + /** Restore snapshot of selections marker layer to given selectionsMarkerLayer. */ + selectionsMarkerLayer?: MarkerLayer; +} + export interface MenuOptions { /** The menu itme's label. */ label: string; @@ -6840,6 +6853,12 @@ export interface ProjectHistory { lastOpened: Date; } +export interface ProjectSpecification { + paths: string[]; + originPath: string; + config?: ConfigValues; +} + export interface ScandalResult { filePath: string; matches: Array<{ From 95427c2bb49d3d8b9c63ccbc8d17b18fa13ac6a8 Mon Sep 17 00:00:00 2001 From: Mohsen Azimi Date: Sun, 20 May 2018 16:03:46 -0700 Subject: [PATCH 277/575] Add typings for favicons --- types/favicons/favicons-tests.ts | 28 ++++++++++ types/favicons/index.d.ts | 93 ++++++++++++++++++++++++++++++++ types/favicons/tsconfig.json | 16 ++++++ types/favicons/tslint.json | 3 ++ 4 files changed, 140 insertions(+) create mode 100644 types/favicons/favicons-tests.ts create mode 100644 types/favicons/index.d.ts create mode 100644 types/favicons/tsconfig.json create mode 100644 types/favicons/tslint.json diff --git a/types/favicons/favicons-tests.ts b/types/favicons/favicons-tests.ts new file mode 100644 index 0000000000..485ea1d505 --- /dev/null +++ b/types/favicons/favicons-tests.ts @@ -0,0 +1,28 @@ +import favicons, { Configuration } from "favicons"; + +let config: Partial = { + path: "/foo/bar" +}; + +config = { + icons: { + android: true + } +}; + +let html = ""; +favicons("path/to/file.png", config, (err, res) => { + html = res.html.join(""); + + for (const { name, contents } of [...res.files, ...res.images]) { + html = name + contents.toString(); + } +}); + +favicons("file.png", (err, res) => { + html = res.html.join(""); + + for (const { name, contents } of [...res.files, ...res.images]) { + html = name + contents.toString(); + } +}); diff --git a/types/favicons/index.d.ts b/types/favicons/index.d.ts new file mode 100644 index 0000000000..47a9a9d24a --- /dev/null +++ b/types/favicons/index.d.ts @@ -0,0 +1,93 @@ +// Type definitions for favicons 5.1 +// Project: https://github.com/evilebottnawi/favicons/blob/master/package.json +// Definitions by: Mohsen Azimi +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +/// + +export interface Configuration { + /** Path for overriding default icons path @default "/" */ + path: string; + /** Your application's name @default null */ + appName: string | null; + /** Your application's description @default null */ + appDescription: string | null; + /** Your (or your developer's) name @default null */ + developerName: string | null; + /** Your (or your developer's) URL @default null */ + developerURL: string | null; + /** Primary text direction for name, short_name, and description @default "auto" */ + dir: string; + /** Primary language for name and short_name @default "en-US */ + lang: string; + /** Background colour for flattened icons @default "#fff" */ + background: string; + /** Theme color user for example in Android's task switcher @default "#fff" */ + theme_color: string; + /** Preferred display mode: "fullscreen", "standalone", "minimal-ui" or "browser" @default "standalone" */ + display: "fullscreen" | "standalone" | "minimal-ui" | "browser"; + /** Default orientation: "any", "natural", "portrait" or "landscape" @default "any" */ + orientation: "any" | "natural" | "portrait" | "landscape"; + /** Start URL when launching the application from a device @default "/?homescreen=1" */ + start_url: string; + /** Your application's version string @default "1.0" */ + version: string; + /** Print logs to console? @default false */ + logging: boolean; + /** + * Platform Options: + * - offset - offset in percentage + * - background: + * * false - use default + * * true - force use default, e.g. set background for Android icons + * * color - set background for the specified icons + */ + icons: Partial<{ + /* Create Android homescreen icon. */ + android: boolean | { offset: string; background: string }; + /* Create Apple touch icons. */ + appleIcon: boolean | { offset: string; background: string }; + /* Create Apple startup images. */ + appleStartup: boolean | { offset: string; background: string }; + /* Create Opera Coast icon. */ + coast: boolean | { offset: string; background: string }; + /* Create regular favicons. */ + favicons: boolean; + /* Create Firefox OS icons. */ + firefox: boolean | { offset: string; background: string }; + /* Create Windows 8 tile icons. */ + windows: boolean | { background: string }; + /* Create Yandex browser icon. */ + yandex: boolean | { background: string }; + }>; +} + +export interface FavIconResponse { + images: Array<{ name: string; contents: Buffer }>; + files: Array<{ name: string; contents: Buffer }>; + html: string[]; +} + +export type Callback = (error: Error | null, response: FavIconResponse) => void; + +/** You can programmatically access Favicons configuration (icon filenames, HTML, manifest files, etc) with this export */ +export const config: Configuration; + +/** + * Generate favicons + * @param source Source image(s) + * @param configuration + * @param callback + */ +declare function favicons( + source: string | Buffer | string[], + callback?: Callback +): void; +declare function favicons( + source: string | Buffer | string[], + configuration?: Partial, + callback?: Callback +): void; + +export default favicons; diff --git a/types/favicons/tsconfig.json b/types/favicons/tsconfig.json new file mode 100644 index 0000000000..03d0b43577 --- /dev/null +++ b/types/favicons/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "favicons-tests.ts"] +} diff --git a/types/favicons/tslint.json b/types/favicons/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/favicons/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} From 4001ee72d35c225d9950afd447612ba6dcbabf96 Mon Sep 17 00:00:00 2001 From: John Ferreira Date: Mon, 21 May 2018 12:14:30 +0900 Subject: [PATCH 278/575] add renderLine options --- .../engine/framework/application.d.ts | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/types/playcanvas/engine/framework/application.d.ts b/types/playcanvas/engine/framework/application.d.ts index 6ef4d996d1..fccb92e2ca 100644 --- a/types/playcanvas/engine/framework/application.d.ts +++ b/types/playcanvas/engine/framework/application.d.ts @@ -436,6 +436,27 @@ declare namespace pc { */ renderLine(start: pc.Vec3, end: pc.Vec3, startColor: pc.Color, endColor: pc.Color, lineType: number): void; + /** + * @function + * @name pc.Application#renderLine^5 + * @description Draw a line which blends between two colors with specified line type + * @param {pc.Vec3} start The start of the line + * @param {pc.Vec3} end The end of the line + * @param {pc.Color} color The start color of the line + * @param {Object} options + * @param {Number} [options.layer] lineType The type of rendering to use: pc.LINEBATCH_WORLD, pc.LINEBATCH_OVERLAY, pc.LINEBATCH_GIZMO. Default is pc.LAYERID_IMMEDIATE + * @example + * var start = new pc.Vec3(0,0,0); + * var end = new pc.Vec3(1,0,0); + * var startColor = new pc.Color(1,1,1); + * const options = { + * layer: pc.LINEBATCH_OVERLAY, + * }; + * + * app.renderLine(start, end, color, options); + */ + renderLine(start: pc.Vec3, end: pc.Vec3, color: pc.Color, options: object): void; + /** * @function * @name pc.Application#renderLines From 641748a28a0df7e0717caecebb32d6c1c6c1302d Mon Sep 17 00:00:00 2001 From: Liveangela Date: Mon, 21 May 2018 14:59:33 +0800 Subject: [PATCH 279/575] [echarts]: add new feature of echarts4.0 and echarts-gl --- types/echarts/index.d.ts | 103 +++++++++++++++++++++++------------- types/echarts/tsconfig.json | 4 +- 2 files changed, 69 insertions(+), 38 deletions(-) diff --git a/types/echarts/index.d.ts b/types/echarts/index.d.ts index b217be12eb..15892864e5 100644 --- a/types/echarts/index.d.ts +++ b/types/echarts/index.d.ts @@ -1,13 +1,17 @@ // Type definitions for echarts // Project: http://echarts.baidu.com/ -// Definitions by: Xie Jingyang , AntiMoron +// Definitions by: Xie Jingyang +// AntiMoron +// Liveangela // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 declare namespace echarts { - function init(dom: HTMLDivElement | HTMLCanvasElement, theme?: Object | string, opts?: { + function init(dom: HTMLDivElement | HTMLCanvasElement, theme?: object | string, opts?: { devicePixelRatio?: number renderer?: string + width?: number | string + height?: number | string }): ECharts; const graphic: Graphic; @@ -15,10 +19,10 @@ declare namespace echarts { interface Graphic { clipPointsByRect(points: number[][], rect: ERectangle): number[][]; clipRectByRect(targetRect: ERectangle, rect: ERectangle): ERectangle; - LinearGradient: { new(x: number, y: number, x2: number, y2: number, colorStops: Array, globalCoord?: boolean): LinearGradient } + LinearGradient: { new(x: number, y: number, x2: number, y2: number, colorStops: object[], globalCoord?: boolean): LinearGradient } } - function connect(group: string | Array): void; + function connect(group: string | string[]): void; function disConnect(group: string): void; @@ -26,9 +30,9 @@ declare namespace echarts { function getInstanceByDom(target: HTMLDivElement | HTMLCanvasElement): ECharts; - function registerMap(mapName: string, geoJson: Object, specialAreas?: Object): void; + function registerMap(mapName: string, geoJson: object, specialAreas?: object): void; - function registerTheme(themeName: string, theme: Object): void; + function registerTheme(themeName: string, theme: object): void; interface MapObj { /** geoJson data for map */ @@ -40,7 +44,7 @@ declare namespace echarts { function getMap(mapName: string): MapObj; interface LinearGradient { - colorStops: Array; + colorStops: object[]; global: boolean; type: string; x: number @@ -60,17 +64,17 @@ declare namespace echarts { getDom(): HTMLCanvasElement | HTMLDivElement - getOption(): Object + getOption(): object resize(): void - dispatchAction(payload: Object): void + dispatchAction(payload: object): void - on(eventName: string, handler: Function, context?: Object): void + on(eventName: string, handler: Function, context?: object): void off(eventName: string, handler?: Function): void - showLoading(type?: string, opts?: Object): void + showLoading(type?: string, opts?: object): void hideLoading(): void @@ -99,13 +103,17 @@ declare namespace echarts { dispose(): void /** 转换逻辑点到像素 */ - convertToPixel(finder: ConvertFinder | string, value: string | Array): string | Array + convertToPixel(finder: ConvertFinder | string, value: string | any[]): string | any[] - convertFromPixel(finder: ConvertFinder | string, value: Array | string): Array | string + convertFromPixel(finder: ConvertFinder | string, value: any[] | string): any[] | string containPixel(finder: ConvertFinder | string, /** 要被判断的点,为像素坐标值,以 echarts 实例的 dom 节点的左上角为坐标 [0, 0] 点。*/ value: any[]): boolean + + getModel(): { + getComponent(finder: string): any; + } } interface ConvertFinder { @@ -135,31 +143,54 @@ declare namespace echarts { interface EChartOption { title?: EChartTitleOption - legend?: Object, - grid?: Object, - xAxis?: Object, - yAxis?: Object, - polar?: Object, - radiusAxis?: Object, - angleAxis?: Object, - radar?: Object, - dataZoom?: Array, - visualMap?: Array, - tooltip?: Object, - toolbox?: Object, - geo?: Object, - parallel?: Object, - parallelAxis?: Object, - timeline?: Object, - series?: Array, - color?: Array, + legend?: object, + grid?: object, + xAxis?: object, + yAxis?: object, + polar?: object, + radiusAxis?: object, + angleAxis?: object, + radar?: object, + dataZoom?: object[], + visualMap?: object[], + tooltip?: object, + axisPointer?: object, + toolbox?: object, + brush?: object, + geo?: object, + parallel?: object, + parallelAxis?: object, + singleAxis?: object, + timeline?: object, + graphic?: object | object[], + calendar?: object, + dataset?: object, + aria?: object, + series?: object[], + color?: string[], backgroundColor?: string, - textStyle?: Object, + textStyle?: object, animation?: boolean, + animationThreshold?: number, animationDuration?: number, animationEasing?: string, - animationDurationUpdate?: number, - animationEasingUpdate?: string + animationDelay?: number | Function, + animationDurationUpdate?: number | Function, + animationEasingUpdate?: string, + animationDelayUpdate?: number | Function, + progressive?: number, + progressiveThreshold?: number, + blendMode?: string, + hoverLayerThreshold?: number, + useUTC?: boolean, + /** echarts-gl options */ + globe?: object, + geo3D?: object, + mapbox3D?: object, + grid3D?: object, + xAxis3D?: object, + yAxis3D?: object, + zAxis3D?: object } interface EChartTitleOption { @@ -167,11 +198,11 @@ declare namespace echarts { text?: string; link?: string, target?: string, - textStyle?: Object, + textStyle?: object, subtext?: string, sublink?: string, subtarget?: string, - subtextStyle?: Object, + subtextStyle?: object, padding?: number, itemGap?: number, zlevel?: number, diff --git a/types/echarts/tsconfig.json b/types/echarts/tsconfig.json index 82e6284376..71e6b79545 100644 --- a/types/echarts/tsconfig.json +++ b/types/echarts/tsconfig.json @@ -7,7 +7,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ @@ -20,4 +20,4 @@ "files": [ "index.d.ts" ] -} \ No newline at end of file +} From 215d7f0324b3616dee3f2332ee958dcfbfd14311 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Veyret?= Date: Mon, 21 May 2018 10:25:13 +0200 Subject: [PATCH 280/575] express-session: add strictNullCheck --- .../express-session/express-session-tests.ts | 20 +++++----- types/express-session/index.d.ts | 38 +++++++++---------- types/express-session/tsconfig.json | 2 +- 3 files changed, 31 insertions(+), 29 deletions(-) diff --git a/types/express-session/express-session-tests.ts b/types/express-session/express-session-tests.ts index 6a619f162c..dc57e88f0d 100644 --- a/types/express-session/express-session-tests.ts +++ b/types/express-session/express-session-tests.ts @@ -11,7 +11,7 @@ app.use(session({ secret: 'keyboard cat', name: 'connect.sid', store: new session.MemoryStore(), - cookie: { path: '/', httpOnly: true, secure: false, maxAge: null }, + cookie: { path: '/', httpOnly: true, secure: false }, genid: (req: express.Request): string => '', rolling: false, resave: true, @@ -30,7 +30,7 @@ app.use((req, res, next) => { sess.views++; res.setHeader('Content-Type', 'text/html'); res.write(`

views: ${sess.views}

`); - res.write(`

expires in: ${(sess.cookie.maxAge / 1000)}s

`); + res.write(`

expires in: ${((sess.cookie.maxAge || 0) / 1000)}s

`); res.end(); } else { sess.views = 1; @@ -41,26 +41,28 @@ app.use((req, res, next) => { // Custom Session Store class MyStore extends session.Store { - private sessions: { [sid: string]: string }; + private sessions: { [sid: string]: string | undefined }; constructor() { super(); this.sessions = {}; } - get = (sid: string, callback: (err: any, session: Express.SessionData) => void): void => { - callback(null, JSON.parse(this.sessions[sid])); + get = (sid: string, callback: (err: any, session?: Express.SessionData | null) => void): void => { + const sessionString: string | undefined = this.sessions[sid]; + const sessionData: Express.SessionData | null = sessionString ? JSON.parse(sessionString) : null; + callback(null, sessionData); } - set = (sid: string, session: Express.Session, callback: (err: any) => void): void => { + set = (sid: string, session: Express.Session, callback?: (err?: any) => void): void => { this.sessions[sid] = JSON.stringify(session); - callback(null); + if (callback) callback(); } - destroy = (sid: string, callback: (err: any) => void): void => { + destroy = (sid: string, callback?: (err?: any) => void): void => { this.sessions[sid] = undefined; this.sessions = JSON.parse(JSON.stringify(this.sessions)); - callback(null); + if (callback) callback(); } } diff --git a/types/express-session/index.d.ts b/types/express-session/index.d.ts index d051f84df0..185753b0b6 100644 --- a/types/express-session/index.d.ts +++ b/types/express-session/index.d.ts @@ -67,35 +67,35 @@ declare namespace session { } interface BaseMemoryStore { - get: (sid: string, callback: (err: any, session: Express.SessionData) => void) => void; - set: (sid: string, session: Express.Session, callback: (err: any) => void) => void; - destroy: (sid: string, callback: (err: any) => void) => void; - length?: (callback: (err: any, length: number) => void) => void; - clear?: (callback: (err: any) => void) => void; + get: (sid: string, callback: (err: any, session?: Express.SessionData | null) => void) => void; + set: (sid: string, session: Express.Session, callback?: (err?: any) => void) => void; + destroy: (sid: string, callback?: (err?: any) => void) => void; + length?: (callback: (err: any, length?: number | null) => void) => void; + clear?: (callback?: (err?: any) => void) => void; } abstract class Store extends node.EventEmitter { constructor(config?: any); - regenerate: (req: express.Request, fn: (err: any) => any) => void; - load: (sid: string, fn: (err: any, session: Express.Session) => any) => void; + regenerate: (req: express.Request, fn: (err?: any) => any) => void; + load: (sid: string, fn: (err: any, session?: Express.Session | null) => any) => void; createSession: (req: express.Request, sess: Express.SessionData) => void; - get: (sid: string, callback: (err: any, session: Express.SessionData) => void) => void; - set: (sid: string, session: Express.Session, callback: (err: any) => void) => void; - destroy: (sid: string, callback: (err: any) => void) => void; - all: (callback: (err: any, obj: { [sid: string]: Express.SessionData; }) => void) => void; - length: (callback: (err: any, length: number) => void) => void; - clear: (callback: (err: any) => void) => void; + get: (sid: string, callback: (err: any, session?: Express.SessionData | null) => void) => void; + set: (sid: string, session: Express.Session, callback?: (err?: any) => void) => void; + destroy: (sid: string, callback?: (err?: any) => void) => void; + all: (callback: (err: any, obj?: { [sid: string]: Express.SessionData; } | null) => void) => void; + length: (callback: (err: any, length?: number | null) => void) => void; + clear: (callback?: (err?: any) => void) => void; } class MemoryStore implements BaseMemoryStore { - get: (sid: string, callback: (err: any, session: Express.SessionData) => void) => void; - set: (sid: string, session: Express.Session, callback: (err: any) => void) => void; - destroy: (sid: string, callback: (err: any) => void) => void; - all: (callback: (err: any, obj: { [sid: string]: Express.Session; }) => void) => void; - length: (callback: (err: any, length: number) => void) => void; - clear: (callback: (err: any) => void) => void; + get: (sid: string, callback: (err: any, session?: Express.SessionData | null) => void) => void; + set: (sid: string, session: Express.Session, callback?: (err?: any) => void) => void; + destroy: (sid: string, callback?: (err?: any) => void) => void; + all: (callback: (err: any, obj?: { [sid: string]: Express.Session; } | null) => void) => void; + length: (callback: (err: any, length?: number | null) => void) => void; + clear: (callback?: (err?: any) => void) => void; } } diff --git a/types/express-session/tsconfig.json b/types/express-session/tsconfig.json index 14c2e75bd5..dad933c3ea 100644 --- a/types/express-session/tsconfig.json +++ b/types/express-session/tsconfig.json @@ -6,7 +6,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ From b0ac435e1cbd13911dcfdba3ddfe83261a71f457 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Veyret?= Date: Mon, 21 May 2018 10:30:03 +0200 Subject: [PATCH 281/575] express-session: add touch method definition --- types/express-session/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/express-session/index.d.ts b/types/express-session/index.d.ts index 185753b0b6..29d2b4fbbc 100644 --- a/types/express-session/index.d.ts +++ b/types/express-session/index.d.ts @@ -87,6 +87,7 @@ declare namespace session { all: (callback: (err: any, obj?: { [sid: string]: Express.SessionData; } | null) => void) => void; length: (callback: (err: any, length?: number | null) => void) => void; clear: (callback?: (err?: any) => void) => void; + touch: (sid: string, session: Express.Session, callback?: (err?: any) => void) => void; } class MemoryStore implements BaseMemoryStore { @@ -96,6 +97,7 @@ declare namespace session { all: (callback: (err: any, obj?: { [sid: string]: Express.Session; } | null) => void) => void; length: (callback: (err: any, length?: number | null) => void) => void; clear: (callback?: (err?: any) => void) => void; + touch: (sid: string, session: Express.Session, callback?: (err?: any) => void) => void; } } From f316905e97948233051cbc4d4a76b9cffe0cceee Mon Sep 17 00:00:00 2001 From: KevinRamharak Date: Mon, 21 May 2018 10:52:33 +0200 Subject: [PATCH 282/575] added type definitions for NPM package module-alias --- types/module-alias/index.d.ts | 44 ++++++++++++++++++++++++ types/module-alias/module-alias-tests.ts | 3 ++ types/module-alias/tsconfig.json | 23 +++++++++++++ types/module-alias/tslint.json | 1 + 4 files changed, 71 insertions(+) create mode 100644 types/module-alias/index.d.ts create mode 100644 types/module-alias/module-alias-tests.ts create mode 100644 types/module-alias/tsconfig.json create mode 100644 types/module-alias/tslint.json diff --git a/types/module-alias/index.d.ts b/types/module-alias/index.d.ts new file mode 100644 index 0000000000..159b78111b --- /dev/null +++ b/types/module-alias/index.d.ts @@ -0,0 +1,44 @@ +// Type definitions for module-alias 2.0 +// Project: https://github.com/ilearnio/module-alias/ +// Definitions by: Kevin Ramharak +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped/ + +export = init; + +/** + * Import aliases from package.json + */ +declare function init(options?: string | init.Options): void; + +declare namespace init { + function isPathMatchesAlias(path: string, alias: string): boolean; + + /** + * Register a custom modules directory + */ + function addPath(path: string): void; + + /** + * Register a single alias + */ + function addAlias(alias: string, path: string): void; + + /** + * Register mutliple aliases + */ + function addAliases(aliases: { [alias: string]: string }): void; + + /** + * Reset any changes maded (resets all registered aliases + * and custom module directories) + * The function is undocumented and for testing purposes only + */ + function reset(): void; + + /** + * module intialis options type + */ + interface Options { + base: string; + } +} diff --git a/types/module-alias/module-alias-tests.ts b/types/module-alias/module-alias-tests.ts new file mode 100644 index 0000000000..06f56f3ac2 --- /dev/null +++ b/types/module-alias/module-alias-tests.ts @@ -0,0 +1,3 @@ +import * as moduleAlias from 'module-alias'; + +moduleAlias.isPathMatchesAlias('./path', '@alias'); // $ExpectType boolean diff --git a/types/module-alias/tsconfig.json b/types/module-alias/tsconfig.json new file mode 100644 index 0000000000..b9063a644a --- /dev/null +++ b/types/module-alias/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", + "module-alias-tests.ts" + ] +} diff --git a/types/module-alias/tslint.json b/types/module-alias/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/module-alias/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 617a2a8ad8135f39b3e917822a9cd07498976599 Mon Sep 17 00:00:00 2001 From: Hugues Stefanski Date: Mon, 21 May 2018 11:31:56 +0200 Subject: [PATCH 283/575] d3-color : added piecewise method #25582 --- types/d3-interpolate/d3-interpolate-tests.ts | 13 +++++++++++++ types/d3-interpolate/index.d.ts | 8 +++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/types/d3-interpolate/d3-interpolate-tests.ts b/types/d3-interpolate/d3-interpolate-tests.ts index 6baaf06092..50ade8008c 100644 --- a/types/d3-interpolate/d3-interpolate-tests.ts +++ b/types/d3-interpolate/d3-interpolate-tests.ts @@ -229,3 +229,16 @@ iString = d3Interpolate.interpolateCubehelixLong.gamma(2.2)('purple', 'orange'); iNum = d3Interpolate.interpolateBasis([1, 50, 30, 10]); iNum = d3Interpolate.interpolateBasisClosed([1, 50, 30, 10]); + +iString = d3Interpolate.piecewise(d3Interpolate.interpolateRgb.gamma(2.2), ['red', 'green', 'blue']); +iString = d3Interpolate.piecewise(d3Interpolate.interpolateCubehelix, ['red', 'green', 'blue']); +iZoom = d3Interpolate.piecewise(d3Interpolate.interpolateZoom, [[50, 50, 300], [100, 100, 500]] as d3Interpolate.ZoomView[]); +iNum = d3Interpolate.piecewise(d3Interpolate.interpolateNumber, [1, 2, 3]); +iNum = d3Interpolate.piecewise(d3Interpolate.interpolateRound, [1.1, 2.2, 3.3]); +iString = d3Interpolate.piecewise(d3Interpolate.interpolateString, ['a', 'b', 'c']); +iDate = d3Interpolate.piecewise(d3Interpolate.interpolateDate, [new Date(2018, 5, 1), new Date(2018, 5, 2), new Date(2018, 5, 3)]); +iArrayNum = d3Interpolate.piecewise(d3Interpolate.interpolateArray, [1, 2, 4, 8]); +iArrayStr = d3Interpolate.piecewise(d3Interpolate.interpolateArray, ['a', 'b', 'c', 'd']); +iArrayMixed = d3Interpolate.piecewise<[Date, string]>(d3Interpolate.interpolateArray, [new Date(2016, 6, 1), 'b: 1']); +iString = d3Interpolate.piecewise(d3Interpolate.interpolateTransformCss, ['rotate(0deg)', 'rotate(60deg)']); +iString = d3Interpolate.piecewise(d3Interpolate.interpolateTransformSvg, ['rotate(0)', 'rotate(60)']); diff --git a/types/d3-interpolate/index.d.ts b/types/d3-interpolate/index.d.ts index e3fcfa21d8..4d6d67f5d5 100644 --- a/types/d3-interpolate/index.d.ts +++ b/types/d3-interpolate/index.d.ts @@ -55,7 +55,9 @@ export function interpolateString(a: string | { toString(): string }, b: string export function interpolateDate(a: Date, b: Date): ((t: number) => Date); -export function interpolateArray(a: any[], b: A): ((t: number) => A); +type ArrayInterpolator = ((t: number) => A); + +export function interpolateArray(a: any[], b: A): ArrayInterpolator; export function interpolateObject(a: any, b: U): ((t: number) => U); // TODO: extends 'any' should become 'object' with TS 2.2+ definitions export function interpolateObject(a: { [key: string]: any }, b: { [key: string]: any }): ((t: number) => { [key: string]: any }); @@ -89,3 +91,7 @@ export const interpolateCubehelixLong: ColorGammaInterpolationFactory; export function interpolateBasis(splineNodes: number[]): ((t: number) => number); export function interpolateBasisClosed(splineNodes: number[]): ((t: number) => number); + +export function piecewise(interpolate: (a: ZoomView, b: ZoomView) => ZoomInterpolator, values: ZoomView[]): ZoomInterpolator; +export function piecewise(interpolate: (a: any[], b: A) => ArrayInterpolator, values: A): ArrayInterpolator; +export function piecewise(interpolate: (a: TData, b: TData) => Interpolator, values: TData[]): (t: number) => any; From 12bfa245679d7d299c6ad2a98a892109cc6358e5 Mon Sep 17 00:00:00 2001 From: GlenCFL Date: Mon, 21 May 2018 05:29:19 -0400 Subject: [PATCH 284/575] [atom] mark MarkerLayer.getRole's return as potentially undefined --- types/atom/atom-tests.ts | 3 ++- types/atom/index.d.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/types/atom/atom-tests.ts b/types/atom/atom-tests.ts index 39cbb9ead0..9d01e194a9 100644 --- a/types/atom/atom-tests.ts +++ b/types/atom/atom-tests.ts @@ -1327,7 +1327,8 @@ function testMarkerLayer() { markers = markerLayer.findMarkers({ containsRange: [[0, 0], pos] }); markers = markerLayer.findMarkers({ containsRange: [[0, 0], [0, 0]] }); - str = markerLayer.getRole(); + const role = markerLayer.getRole(); + if (role) str = role; // Marker creation marker = markerLayer.markRange(range); diff --git a/types/atom/index.d.ts b/types/atom/index.d.ts index 8546e0e458..232c20a034 100644 --- a/types/atom/index.d.ts +++ b/types/atom/index.d.ts @@ -1005,7 +1005,7 @@ export interface MarkerLayer { findMarkers(params: FindMarkerOptions): Marker[]; /** Get the role of the marker layer e.g. "atom.selection". */ - getRole(): string; + getRole(): string | undefined; // Marker Creation /** Create a marker with the given range. */ From bc24e50bc1d814d64f05880583cf515b03ca7086 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Magrin?= Date: Mon, 21 May 2018 11:53:22 +0200 Subject: [PATCH 285/575] Change type definition for v2 --- types/react-navigation/index.d.ts | 477 +++----- types/react-navigation/v2/index.d.ts | 1086 +++++++++++++++++ .../v2/react-navigation-tests.tsx | 453 +++++++ types/react-navigation/v2/tsconfig.json | 30 + types/react-navigation/v2/tslint.json | 1 + 5 files changed, 1744 insertions(+), 303 deletions(-) create mode 100644 types/react-navigation/v2/index.d.ts create mode 100644 types/react-navigation/v2/react-navigation-tests.tsx create mode 100644 types/react-navigation/v2/tsconfig.json create mode 100644 types/react-navigation/v2/tslint.json diff --git a/types/react-navigation/index.d.ts b/types/react-navigation/index.d.ts index 641dd8463f..1233ca39e3 100644 --- a/types/react-navigation/index.d.ts +++ b/types/react-navigation/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-navigation 2.0.1 +// Type definitions for react-navigation 1.5 // Project: https://github.com/react-navigation/react-navigation // Definitions by: Huhuanming // mhcgrq @@ -16,12 +16,11 @@ // Armando Assuncao // Ciaran Liedeman // Edward Sammut Alessi -// Jeremy Magrin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 /** - * Reference: https://github.com/react-navigation/react-navigation/tree/a37473c5e4833f48796ee6c7c9cb4a8ac49d9c06 + * Reference: https://github.com/react-navigation/react-navigation/tree/3f3ef6485c8932f49fddc3dd2c508629110bf2b6 * * NOTE: Please update the commit/link above when updating to a new Flow * react-navigation/flow/react-navigation.js reference, so we can conveniently just look at diffs on @@ -44,21 +43,15 @@ export type AnimatedValue = any; export type HeaderMode = 'float' | 'screen' | 'none'; -export interface HeaderForceInset { - horizontal?: string; - vertical?: string, - left?: string, - right?: string, - top?: string, - bottom?: string, -} - export interface HeaderProps extends NavigationSceneRendererProps { mode: HeaderMode; - router: NavigationRouter; - getScreenDetails: ( - navigationScene: NavigationScene - ) => NavigationScreenDetails; + router: NavigationRouter< + NavigationState, + NavigationStackScreenOptions + >; + getScreenDetails: (navigationScene: NavigationScene) => NavigationScreenDetails< + NavigationStackScreenOptions + >; style: StyleProp; } @@ -83,9 +76,7 @@ export interface NavigationState { routes: any[]; } -export type NavigationRoute = - | NavigationLeafRoute - | NavigationStateRoute; +export type NavigationRoute = NavigationLeafRoute | NavigationStateRoute; export interface NavigationLeafRoute { /** @@ -109,9 +100,7 @@ export interface NavigationLeafRoute { params?: Params; } -export type NavigationStateRoute< - NavigationLeafRouteParams - > = NavigationLeafRoute & NavigationState; +export type NavigationStateRoute = NavigationLeafRoute & NavigationState; export type NavigationScreenOptionsGetter = ( navigation: NavigationScreenProp>, @@ -124,10 +113,7 @@ export interface NavigationRouter { * an optional previous state. When the action is considered handled but the * state is unchanged, the output state is null. */ - getStateForAction: ( - action: NavigationAction, - lastState?: State - ) => State | null; + getStateForAction: (action: NavigationAction, lastState?: State) => (State | null); /** * Maps a URI-like string to an action. This can be mapped to a state @@ -136,14 +122,14 @@ export interface NavigationRouter { getActionForPathAndParams: ( path: string, params?: NavigationParams - ) => NavigationAction | null; + ) => (NavigationAction | null); getPathAndParamsForState: ( state: State ) => { - path: string; - params?: NavigationParams; - }; + path: string, + params?: NavigationParams, + }; getComponentForRouteName: (routeName: string) => NavigationComponent; @@ -161,8 +147,11 @@ export interface NavigationRouter { } export type NavigationScreenOption = - | T - | ((navigation: NavigationScreenProp, config: T) => T); + T + | (( + navigation: NavigationScreenProp, + config: T + ) => T); export interface NavigationScreenDetails { options: T; @@ -170,9 +159,7 @@ export interface NavigationScreenDetails { navigation: NavigationScreenProp; } -export type NavigationScreenOptions = NavigationStackScreenOptions & - NavigationTabScreenOptions & - NavigationDrawerScreenOptions; +export type NavigationScreenOptions = NavigationStackScreenOptions & NavigationTabScreenOptions & NavigationDrawerScreenOptions; export interface NavigationScreenConfigProps { navigation: NavigationScreenProp; @@ -180,34 +167,30 @@ export interface NavigationScreenConfigProps { } export type NavigationScreenConfig = - | Options - | (( - navigationOptionsContainer: NavigationScreenConfigProps & { - navigationOptions: NavigationScreenProp; - } - ) => Options); + Options + | ((navigationOptionsContainer: NavigationScreenConfigProps & { + navigationOptions: NavigationScreenProp, + }) => Options); export type NavigationComponent = - | NavigationScreenComponent - | NavigationNavigator - | any; + NavigationScreenComponent + | NavigationNavigator; export type NavigationScreenComponent< - Params = NavigationParams, - Options = {}, - Props = {} - > = React.ComponentType & Props> & { - navigationOptions?: NavigationScreenConfig; - }; + Params = NavigationParams, + Options = {}, + Props = {} +> = React.ComponentType & Props> & +{ navigationOptions?: NavigationScreenConfig }; export type NavigationNavigator< - State = NavigationState, - Options = {}, - Props = {} - > = React.ComponentType & Props> & { - router: NavigationRouter; - navigationOptions?: NavigationScreenConfig; - }; + State = NavigationState, + Options = {}, + Props = {} +> = React.ComponentType & Props> & { + router: NavigationRouter, + navigationOptions?: NavigationScreenConfig, +}; export interface NavigationParams { [key: string]: any; @@ -223,8 +206,7 @@ export interface NavigationNavigateActionPayload { key?: string; } -export interface NavigationNavigateAction - extends NavigationNavigateActionPayload { +export interface NavigationNavigateAction extends NavigationNavigateActionPayload { type: 'Navigation/NAVIGATE'; } @@ -244,8 +226,7 @@ export interface NavigationSetParamsActionPayload { params?: NavigationParams; } -export interface NavigationSetParamsAction - extends NavigationSetParamsActionPayload { +export interface NavigationSetParamsAction extends NavigationSetParamsActionPayload { type: 'Navigation/SET_PARAMS'; } @@ -290,69 +271,40 @@ export interface NavigationPopToTopActionPayload { immediate?: boolean; } -export interface NavigationPopToTopAction - extends NavigationPopToTopActionPayload { +export interface NavigationPopToTopAction extends NavigationPopToTopActionPayload { type: 'Navigation/POP_TO_TOP'; } export interface NavigationStackViewConfig { mode?: 'card' | 'modal'; headerMode?: HeaderMode; - headerTransitionPreset?: 'fade-in-place' | 'uikit'; cardStyle?: StyleProp; transitionConfig?: ( transitionProps: NavigationTransitionProps, prevTransitionProps: NavigationTransitionProps, - isModal: boolean + isModal: boolean, ) => TransitionConfig; - onTransitionStart?: ( - transitionProps: NavigationTransitionProps, - prevTransitionProps?: NavigationTransitionProps - ) => Promise | void; - onTransitionEnd?: ( - transitionProps: NavigationTransitionProps, - prevTransitionProps?: NavigationTransitionProps - ) => void; -} - -/** - * Switch Navigator - */ - -export interface NavigationSwitchRouterConfig { - initialRouteName?: string; - initialRouteParams?: NavigationParams; - paths?: NavigationPathsConfig; - navigationOptions?: NavigationScreenConfig; - order?: string[]; - backBehavior?: 'none' | 'initialRoute'; // defaults to `'none'` - resetOnBlur?: boolean; // defaults to `true` + onTransitionStart?: (transitionProps: NavigationTransitionProps, prevTransitionProps?: NavigationTransitionProps) => Promise | void; + onTransitionEnd?: (transitionProps: NavigationTransitionProps, prevTransitionProps?: NavigationTransitionProps) => void; } export interface NavigationStackScreenOptions { title?: string; - header?: - | ( - | React.ReactElement - | ((headerProps: HeaderProps) => React.ReactElement)) - | null; + header?: (React.ReactElement | ((headerProps: HeaderProps) => React.ReactElement)) | null; headerTransparent?: boolean; headerTitle?: string | React.ReactElement; headerTitleStyle?: StyleProp; headerTintColor?: string; headerLeft?: React.ReactElement; headerBackTitle?: string | null; - headerBackImage?: React.ReactElement; headerTruncatedBackTitle?: string; headerBackTitleStyle?: StyleProp; headerPressColorAndroid?: string; headerRight?: React.ReactElement; headerStyle?: StyleProp; - headerForceInset?: HeaderForceInset; headerBackground?: React.ReactNode | React.ReactType; gesturesEnabled?: boolean; gestureResponseDistance?: { vertical?: number; horizontal?: number }; - gestureDirection?: 'default' | 'inverted'; } export interface NavigationStackRouterConfig { @@ -365,7 +317,7 @@ export interface NavigationStackRouterConfig { } export type NavigationStackAction = - | NavigationInitAction + NavigationInitAction | NavigationNavigateAction | NavigationBackAction | NavigationSetParamsAction @@ -374,30 +326,25 @@ export type NavigationStackAction = | NavigationPopToTopAction; export type NavigationTabAction = - | NavigationInitAction + NavigationInitAction | NavigationNavigateAction | NavigationBackAction; export type NavigationAction = - | NavigationInitAction + NavigationInitAction | NavigationStackAction | NavigationTabAction; -export type NavigationRouteConfig = - | NavigationComponent - | ({ - navigationOptions?: NavigationScreenConfig; - path?: string; - } & NavigationScreenRouteConfig); +export type NavigationRouteConfig = NavigationComponent | ({ + navigationOptions?: NavigationScreenConfig, + path?: string, +} & NavigationScreenRouteConfig); -export type NavigationScreenRouteConfig = - | NavigationComponent - | { - screen: NavigationComponent; - } - | { - getScreen: () => NavigationComponent; - }; +export type NavigationScreenRouteConfig = NavigationComponent | { + screen: NavigationComponent, +} | { + getScreen: () => NavigationComponent, +}; export interface NavigationPathsConfig { [routeName: string]: string; @@ -413,48 +360,45 @@ export interface NavigationTabRouterConfig { backBehavior?: 'none' | 'initialRoute'; // defaults `initialRoute` } export interface TabScene { - route: NavigationRoute; - focused: boolean; - index: number; - tintColor?: string; + route: NavigationRoute; + focused: boolean; + index: number; + tintColor?: string; } export interface NavigationTabScreenOptions { title?: string; tabBarIcon?: - | React.ReactElement - | (( - options: { tintColor: string | null; focused: boolean } - ) => React.ReactElement | null); + React.ReactElement + | ((options: { tintColor: (string | null), focused: boolean }) => (React.ReactElement< + any + > | null)); tabBarLabel?: - | string - | React.ReactElement - | (( - options: { tintColor: string | null; focused: boolean } - ) => React.ReactElement | string | null); + string + | React.ReactElement + | ((options: { tintColor: (string | null), focused: boolean }) => (React.ReactElement< + any + > | string | null)); tabBarVisible?: boolean; - tabBarTestIDProps?: { testID?: string; accessibilityLabel?: string }; - tabBarOnPress?: ( - options: { - scene: TabScene; - jumpToIndex: (index: number) => void; - } - ) => void; + tabBarTestIDProps?: { testID?: string, accessibilityLabel?: string }; + tabBarOnPress?: (options: { + scene: TabScene, + jumpToIndex: (index: number) => void + }) => void; } export interface NavigationDrawerScreenOptions { title?: string; drawerIcon?: - | React.ReactElement - | (( - options: { tintColor: string | null; focused: boolean } - ) => React.ReactElement | null); + React.ReactElement + | ((options: { tintColor: (string | null), focused: boolean }) => (React.ReactElement< + any + > | null)); drawerLabel?: - | string - | React.ReactElement - | (( - options: { tintColor: string | null; focused: boolean } - ) => React.ReactElement | null); - drawerLockMode?: 'unlocked' | 'locked-closed' | 'locked-open'; + string + | React.ReactElement + | ((options: { tintColor: (string | null), focused: boolean }) => (React.ReactElement< + any + > | null)); } export interface NavigationRouteConfigMap { @@ -469,20 +413,22 @@ export interface NavigationProp { } export type EventType = - | 'willFocus' - | 'didFocus' - | 'willBlur' - | 'didBlur' - | 'action'; +| 'willFocus' +| 'didFocus' +| 'willBlur' +| 'didBlur' +| 'action'; export interface NavigationEventPayload { type: EventType; action: NavigationAction; state: NavigationState; - lastState: NavigationState | null | undefined; + lastState: NavigationState; } -export type NavigationEventCallback = (payload: NavigationEventPayload) => void; +export type NavigationEventCallback = ( + payload: NavigationEventPayload +) => void; export interface NavigationEventSubscription { remove: () => void; @@ -492,14 +438,8 @@ export interface NavigationScreenProp { state: S; dispatch: NavigationDispatch; goBack: (routeKey?: string | null) => boolean; - dismiss: () => boolean; navigate(options: { - routeName: string | { - routeName: string; - params?: NavigationParams; - action?: NavigationNavigateAction; - key?: string; - }; + routeName: string; params?: NavigationParams; action?: NavigationAction; key?: string; @@ -507,7 +447,7 @@ export interface NavigationScreenProp { navigate( routeNameOrOptions: string, params?: NavigationParams, - action?: NavigationAction + action?: NavigationAction, ): boolean; getParam: (param: T, fallback?: P[T]) => P[T]; setParams: (newParams: P) => boolean; @@ -527,7 +467,6 @@ export interface NavigationScreenProp { ) => boolean; pop: (n?: number, params?: { immediate?: boolean }) => boolean; popToTop: (params?: { immediate?: boolean }) => boolean; - isFocused: () => boolean; } export interface NavigationNavigatorProps { @@ -619,7 +558,7 @@ export type NavigationAnimationSetter = ( lastState: NavigationState ) => void; -export type NavigationSceneRenderer = () => React.ReactElement | null; +export type NavigationSceneRenderer = () => (React.ReactElement | null); export type NavigationStyleInterpolator = ( props: NavigationSceneRendererProps @@ -628,49 +567,50 @@ export type NavigationStyleInterpolator = ( export interface LayoutEvent { nativeEvent: { layout: { - x: number; - y: number; - width: number; - height: number; - }; + x: number, + y: number, + width: number, + height: number, + }, }; } export type NavigatorType = - | 'react-navigation/STACK' - | 'react-navigation/TABS' - | 'react-navigation/DRAWER'; +| 'react-navigation/STACK' +| 'react-navigation/TABS' +| 'react-navigation/DRAWER'; -export interface NavigationContainerProps { +export function addNavigationHelpers( + navigation: { + state: S; + dispatch: (action: NavigationAction) => any; + addListener?: ( + eventName: string, + callback: NavigationEventCallback + ) => NavigationEventSubscription; + } +): NavigationScreenProp; + +export interface NavigationContainerProps { uriPrefix?: string | RegExp; onNavigationStateChange?: ( prevNavigationState: NavigationState, nextNavigationState: NavigationState, - action: NavigationAction - ) => void | null | undefined; - navigation?: NavigationScreenProp; - persistenceKey?: string | null | undefined; - renderLoadingExperimental?: React.ComponentType<{}>, - screenProps?: any; - navigationOptions?: O; + action: NavigationAction, + ) => void; style?: StyleProp; } -export interface NavigationContainerComponent - extends React.Component< +export interface NavigationContainerComponent extends React.Component< NavigationContainerProps & NavigationNavigatorProps > { dispatch: NavigationDispatch; } -export interface NavigationContainer - extends React.ComponentClass< +export interface NavigationContainer extends React.ComponentClass< NavigationContainerProps & NavigationNavigatorProps > { - new( - props: NavigationContainerProps & NavigationNavigatorProps, - context?: any - ): NavigationContainerComponent; + new(props: NavigationContainerProps & NavigationNavigatorProps, context?: any): NavigationContainerComponent; router: NavigationRouter; screenProps: { [key: string]: any }; @@ -678,43 +618,29 @@ export interface NavigationContainer state: { nav: NavigationState | null }; } -export interface StackNavigatorConfig - extends NavigationStackViewConfig, - NavigationStackRouterConfig { +export interface StackNavigatorConfig extends NavigationStackViewConfig, NavigationStackRouterConfig { containerOptions?: any; } // Return createNavigationContainer export function StackNavigator( routeConfigMap: NavigationRouteConfigMap, - stackConfig?: StackNavigatorConfig -): NavigationContainer; - -export function createStackNavigator( - routeConfigMap: NavigationRouteConfigMap, - stackConfig?: StackNavigatorConfig + stackConfig?: StackNavigatorConfig, ): NavigationContainer; export interface SwitchNavigatorConfig { initialRouteName: string; resetOnBlur?: boolean; paths?: NavigationPathsConfig; - backBehavior?: 'none' | 'intialRoute'; + backBehavior?: 'none' | 'initialRoute'; } // Return createNavigationContainer -export type _SwitchNavigatorConfig = NavigationSwitchRouterConfig; - export function SwitchNavigator( routeConfigMap: NavigationRouteConfigMap, switchConfig?: SwitchNavigatorConfig ): NavigationContainer; -export function createSwitchNavigator( - routeConfigMap: NavigationRouteConfigMap, - switchConfig?: SwitchNavigatorConfig -): NavigationContainer; - // DrawerItems export const DrawerItems: React.ReactType; @@ -729,28 +655,21 @@ export interface DrawerViewConfig { contentOptions?: any; style?: StyleProp; } -export interface DrawerNavigatorConfig - extends NavigationTabRouterConfig, - DrawerViewConfig { +export interface DrawerNavigatorConfig extends NavigationTabRouterConfig, DrawerViewConfig { containerConfig?: any; contentOptions?: { - activeTintColor?: string; - activeBackgroundColor?: string; - inactiveTintColor?: string; - inactiveBackgroundColor?: string; - style?: StyleProp; - labelStyle?: StyleProp; + activeTintColor?: string, + activeBackgroundColor?: string, + inactiveTintColor?: string, + inactiveBackgroundColor?: string, + style?: StyleProp, + labelStyle?: StyleProp, }; } export function DrawerNavigator( routeConfigMap: NavigationRouteConfigMap, - drawerConfig?: DrawerNavigatorConfig -): NavigationContainer; - -export function createDrawerNavigator( - routeConfigMap: NavigationRouteConfigMap, - drawerConfig?: DrawerNavigatorConfig + drawerConfig?: DrawerNavigatorConfig, ): NavigationContainer; /** @@ -762,23 +681,23 @@ export interface TabViewConfig { tabBarComponent?: React.ReactType; tabBarPosition?: 'top' | 'bottom'; tabBarOptions?: { - activeTintColor?: string; - allowFontScaling?: boolean; - activeBackgroundColor?: string; - inactiveTintColor?: string; - inactiveBackgroundColor?: string; - showLabel?: boolean; - style?: StyleProp; - labelStyle?: StyleProp; - iconStyle?: StyleProp; + activeTintColor?: string, + allowFontScaling?: boolean, + activeBackgroundColor?: string, + inactiveTintColor?: string, + inactiveBackgroundColor?: string, + showLabel?: boolean, + style?: StyleProp, + labelStyle?: StyleProp, + iconStyle?: StyleProp, // Top - showIcon?: boolean; - upperCaseLabel?: boolean; - pressColor?: string; - pressOpacity?: number; - scrollEnabled?: boolean; - tabStyle?: StyleProp; - indicatorStyle?: StyleProp; + showIcon?: boolean, + upperCaseLabel?: boolean, + pressColor?: string, + pressOpacity?: number, + scrollEnabled?: boolean, + tabStyle?: StyleProp, + indicatorStyle?: StyleProp, }; swipeEnabled?: boolean; animationEnabled?: boolean; @@ -786,33 +705,16 @@ export interface TabViewConfig { } // From navigators/TabNavigator.js -export interface TabNavigatorConfig - extends NavigationTabRouterConfig, - TabViewConfig { +export interface TabNavigatorConfig extends NavigationTabRouterConfig, TabViewConfig { lazy?: boolean; removeClippedSubviews?: boolean; - initialLayout?: { height: number; width: number }; + initialLayout?: { height: number, width: number }; } // From navigators/TabNavigator.js export function TabNavigator( routeConfigMap: NavigationRouteConfigMap, - drawConfig?: TabNavigatorConfig -): NavigationContainer; - -export function createTabNavigator( - routeConfigMap: NavigationRouteConfigMap, - drawConfig?: TabNavigatorConfig -): NavigationContainer; - -export function createBottomTabNavigator( - routeConfigMap: NavigationRouteConfigMap, - drawConfig?: TabNavigatorConfig -): NavigationContainer; - -export function createMaterialTopNavigator( - routeConfigMap: NavigationRouteConfigMap, - drawConfig?: TabNavigatorConfig + drawConfig?: TabNavigatorConfig, ): NavigationContainer; export interface TabBarTopProps { @@ -827,17 +729,15 @@ export interface TabBarTopProps { tabBarPosition: string; navigation: NavigationScreenProp; jumpToIndex: (index: number) => void; - getLabel: (scene: TabScene) => React.ReactNode | string; + getLabel: (scene: TabScene) => (React.ReactNode | string); getOnPress: ( previousScene: NavigationRoute, scene: TabScene - ) => ( - args: { - previousScene: NavigationRoute; - scene: TabScene; - jumpToIndex: (index: number) => void; - } - ) => void; + ) => (args: { + previousScene: NavigationRoute, + scene: TabScene, + jumpToIndex: (index: number) => void, + }) => void; renderIcon: (scene: TabScene) => React.ReactElement; labelStyle?: TextStyle; iconStyle?: ViewStyle; @@ -854,17 +754,15 @@ export interface TabBarBottomProps { position: AnimatedValue; navigation: NavigationScreenProp; jumpToIndex: (index: number) => void; - getLabel: (scene: TabScene) => React.ReactNode | string; + getLabel: (scene: TabScene) => (React.ReactNode | string); getOnPress: ( previousScene: NavigationRoute, scene: TabScene - ) => ( - args: { - previousScene: NavigationRoute; - scene: TabScene; - jumpToIndex: (index: number) => void; - } - ) => void; + ) => (args: { + previousScene: NavigationRoute, + scene: TabScene, + jumpToIndex: (index: number) => void, + }) => void; getTestIDProps: (scene: TabScene) => (scene: TabScene) => any; renderIcon: (scene: TabScene) => React.ReactNode; style?: ViewStyle; @@ -891,18 +789,12 @@ export namespace NavigationActions { const POP_TO_TOP: 'Navigation/POP_TO_TOP'; function init(options?: NavigationInitActionPayload): NavigationInitAction; - function navigate( - options: NavigationNavigateActionPayload - ): NavigationNavigateAction; + function navigate(options: NavigationNavigateActionPayload): NavigationNavigateAction; function reset(options: NavigationResetActionPayload): NavigationResetAction; function back(options?: NavigationBackActionPayload): NavigationBackAction; - function setParams( - options: NavigationSetParamsActionPayload - ): NavigationSetParamsAction; + function setParams(options: NavigationSetParamsActionPayload): NavigationSetParamsAction; function pop(options: NavigationPopActionPayload): NavigationPopAction; - function popToTop( - options: NavigationPopToTopActionPayload - ): NavigationPopToTopAction; + function popToTop(options: NavigationPopToTopActionPayload): NavigationPopToTopAction; } /** @@ -915,14 +807,8 @@ export interface TransitionerProps { prevTransitionProps?: NavigationTransitionProps ) => NavigationTransitionSpec; navigation: NavigationScreenProp; - onTransitionStart?: ( - transitionProps: NavigationTransitionProps, - prevTransitionProps?: NavigationTransitionProps - ) => Promise | void; - onTransitionEnd?: ( - transitionProps: NavigationTransitionProps, - prevTransitionProps?: NavigationTransitionProps - ) => void; + onTransitionStart?: (transitionProps: NavigationTransitionProps, prevTransitionProps?: NavigationTransitionProps) => Promise | void; + onTransitionEnd?: (transitionProps: NavigationTransitionProps, prevTransitionProps?: NavigationTransitionProps) => void; render: ( transitionProps: NavigationTransitionProps, prevTransitionProps?: NavigationTransitionProps @@ -940,7 +826,7 @@ export interface TransitionerState { export class Transitioner extends React.Component< TransitionerProps, TransitionerState - > { } +> { } /** * Tab Router @@ -967,23 +853,12 @@ export function StackRouter( * * @see https://github.com/react-navigation/react-navigation/blob/master/src/navigators/createNavigator.js */ -export interface NavigationDescriptor { - key: string; - state: NavigationLeafRoute | NavigationStateRoute; - navigation: NavigationScreenProp; - getComponent: () => React.ComponentType<{}>; -} - -export type NavigationView = React.ComponentType<{ - descriptors: { [key: string]: NavigationDescriptor }; -} & NavigationInjectedProps>; - export function createNavigator( - view: NavigationView, router: NavigationRouter, + routeConfigs?: NavigationRouteConfigMap, navigatorConfig?: {} | null, navigatorType?: NavigatorType -): any; +): (NavigationView: React.ComponentClass) => NavigationNavigator; /** * Create an HOC that injects the navigation and manages the navigation state @@ -1004,10 +879,7 @@ export function createNavigationContainer( * BEGIN CUSTOM CONVENIENCE INTERFACES */ -export interface NavigationScreenProps< - Params = NavigationParams, - Options = any - > { +export interface NavigationScreenProps { navigation: NavigationScreenProp, Params>; screenProps?: { [key: string]: any }; navigationOptions?: NavigationScreenConfig; @@ -1064,7 +936,6 @@ export interface SafeAreaViewProps extends ViewProps { horizontal?: SafeAreaViewForceInsetValue; vertical?: SafeAreaViewForceInsetValue; }; - children?: React.ReactNode; } export const SafeAreaView: React.ComponentClass; diff --git a/types/react-navigation/v2/index.d.ts b/types/react-navigation/v2/index.d.ts new file mode 100644 index 0000000000..36251eba5b --- /dev/null +++ b/types/react-navigation/v2/index.d.ts @@ -0,0 +1,1086 @@ +// Type definitions for react-navigation 2.0 +// Project: https://github.com/react-navigation/react-navigation +// Definitions by: Huhuanming +// mhcgrq +// fangpenlin +// petejkim +// Kyle Roach +// phanalpha +// charlesfamu +// Tim Wang +// Qibang Sun +// Sergei Butko: +// Veit Lehmann: +// Roberto Huertas: +// Steven Miller +// Armando Assuncao +// Ciaran Liedeman +// Edward Sammut Alessi +// Jérémy Magrin +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +/** + * Reference: https://github.com/react-navigation/react-navigation/tree/a37473c5e4833f48796ee6c7c9cb4a8ac49d9c06 + * + * NOTE: Please update the commit/link above when updating to a new Flow + * react-navigation/flow/react-navigation.js reference, so we can conveniently just look at diffs on + * react-navigation/flow/react-navigation.js between this latest reference point and the one you are + * using when making new updates. + */ + +import * as React from 'react'; +import { + Animated, + TextStyle, + ViewProps, + ViewStyle, + StyleProp, +} from 'react-native'; + +// @todo when we split types into common, native and web, +// we can properly change Animated.Value to its real value +export type AnimatedValue = any; + +export type HeaderMode = 'float' | 'screen' | 'none'; + +export interface HeaderForceInset { + horizontal?: string; + vertical?: string, + left?: string, + right?: string, + top?: string, + bottom?: string, +} + +export interface HeaderProps extends NavigationSceneRendererProps { + mode: HeaderMode; + router: NavigationRouter; + getScreenDetails: ( + navigationScene: NavigationScene + ) => NavigationScreenDetails; + leftInterpolator: (props: NavigationSceneRendererProps) => {}; + titleInterpolator: (props: NavigationSceneRendererProps) => {}; + rightInterpolator: (props: NavigationSceneRendererProps) => {}; + style: StyleProp; +} + +/** + * NavigationState is a tree of routes for a single navigator, where each child + * route may either be a NavigationScreenRoute or a NavigationRouterRoute. + * NavigationScreenRoute represents a leaf screen, while the + * NavigationRouterRoute represents the state of a child navigator. + * + * NOTE: NavigationState is a state tree local to a single navigator and + * its child navigators (via the routes field). + * If we're in navigator nested deep inside the app, the state will only be the + * state for that navigator. + * The state for the root navigator of our app represents the whole navigation + * state for the whole app. + */ +export interface NavigationState { + /** + * Index refers to the active child route in the routes array. + */ + index: number; + routes: NavigationRoute[]; +} + +export type NavigationRoute = + | NavigationLeafRoute + | NavigationStateRoute; + +export interface NavigationLeafRoute { + /** + * React's key used by some navigators. No need to specify these manually, + * they will be defined by the router. + */ + key: string; + /** + * For example 'Home'. + * This is used as a key in a route config when creating a navigator. + */ + routeName: string; + /** + * Path is an advanced feature used for deep linking and on the web. + */ + path?: string; + /** + * Params passed to this route when navigating to it, + * e.g. `{ car_id: 123 }` in a route that displays a car. + */ + params?: Params; +} + +export type NavigationStateRoute< + NavigationLeafRouteParams + > = NavigationLeafRoute & NavigationState; + +export type NavigationScreenOptionsGetter = ( + navigation: NavigationScreenProp>, + screenProps?: { [key: string]: any } +) => Options; + +export interface NavigationRouter { + /** + * The reducer that outputs the new navigation state for a given action, with + * an optional previous state. When the action is considered handled but the + * state is unchanged, the output state is null. + */ + getStateForAction: ( + action: NavigationAction, + lastState?: State + ) => State | null; + + /** + * Maps a URI-like string to an action. This can be mapped to a state + * using `getStateForAction`. + */ + getActionForPathAndParams: ( + path: string, + params?: NavigationParams + ) => NavigationAction | null; + + getPathAndParamsForState: ( + state: State + ) => { + path: string; + params?: NavigationParams; + }; + + getComponentForRouteName: (routeName: string) => NavigationComponent; + + getComponentForState: (state: State) => NavigationComponent; + + /** + * Gets the screen navigation options for a given screen. + * + * For example, we could get the config for the 'Foo' screen when the + * `navigation.state` is: + * + * {routeName: 'Foo', key: '123'} + */ + getScreenOptions: NavigationScreenOptionsGetter; +} + +export type NavigationScreenOption = + | T + | ((navigation: NavigationScreenProp, config: T) => T); + +export interface NavigationScreenDetails { + options: T; + state: NavigationRoute; + navigation: NavigationScreenProp; +} + +export type NavigationScreenOptions = NavigationStackScreenOptions & + NavigationTabScreenOptions & + NavigationDrawerScreenOptions; + +export interface NavigationScreenConfigProps { + navigation: NavigationScreenProp; + screenProps: { [key: string]: any }; +} + +export type NavigationScreenConfig = + | Options + | (( + navigationOptionsContainer: NavigationScreenConfigProps & { + navigationOptions: NavigationScreenProp; + } + ) => Options); + +export type NavigationComponent = + | NavigationScreenComponent + | NavigationNavigator + | any; + +export type NavigationScreenComponent< + Params = NavigationParams, + Options = {}, + Props = {} + > = React.ComponentType & Props> & { + navigationOptions?: NavigationScreenConfig; + }; + +export type NavigationNavigator< + State = NavigationState, + Options = {}, + Props = {} + > = React.ComponentType & Props> & { + router: NavigationRouter; + navigationOptions?: NavigationScreenConfig; + }; + +export interface NavigationParams { + [key: string]: any; +} + +export interface NavigationNavigateActionPayload { + routeName: string; + params?: NavigationParams; + + // The action to run inside the sub-router + action?: NavigationNavigateAction; + + key?: string; +} + +export interface NavigationNavigateAction + extends NavigationNavigateActionPayload { + type: 'Navigation/NAVIGATE'; +} + +export interface NavigationBackActionPayload { + key?: string | null; +} + +export interface NavigationBackAction extends NavigationBackActionPayload { + type: 'Navigation/BACK'; +} + +export interface NavigationSetParamsActionPayload { + // The key of the route where the params should be set + key: string; + + // The new params to merge into the existing route params + params?: NavigationParams; +} + +export interface NavigationSetParamsAction + extends NavigationSetParamsActionPayload { + type: 'Navigation/SET_PARAMS'; +} + +export interface NavigationInitActionPayload { + params?: NavigationParams; +} + +export interface NavigationInitAction extends NavigationInitActionPayload { + type: 'Navigation/INIT'; +} + +export interface NavigationResetActionPayload { + index: number; + key?: string | null; + actions: NavigationNavigateAction[]; +} + +export interface NavigationResetAction extends NavigationResetActionPayload { + type: 'Navigation/RESET'; +} + +export interface NavigationUriActionPayload { + uri: string; +} + +export interface NavigationUriAction extends NavigationUriActionPayload { + type: 'Navigation/URI'; +} + +export interface NavigationPopActionPayload { + // n: the number of routes to pop of the stack + n?: number; + immediate?: boolean; +} + +export interface NavigationPopAction extends NavigationPopActionPayload { + type: 'Navigation/POP'; +} + +export interface NavigationPopToTopActionPayload { + key?: string; + immediate?: boolean; +} + +export interface NavigationPopToTopAction + extends NavigationPopToTopActionPayload { + type: 'Navigation/POP_TO_TOP'; +} + +export interface NavigationStackViewConfig { + mode?: 'card' | 'modal'; + headerMode?: HeaderMode; + headerTransitionPreset?: 'fade-in-place' | 'uikit'; + cardStyle?: StyleProp; + transitionConfig?: ( + transitionProps: NavigationTransitionProps, + prevTransitionProps: NavigationTransitionProps, + isModal: boolean + ) => TransitionConfig; + onTransitionStart?: ( + transitionProps: NavigationTransitionProps, + prevTransitionProps?: NavigationTransitionProps + ) => Promise | void; + onTransitionEnd?: ( + transitionProps: NavigationTransitionProps, + prevTransitionProps?: NavigationTransitionProps + ) => void; +} + +/** + * Switch Navigator + */ + +export interface NavigationSwitchRouterConfig { + initialRouteName?: string; + initialRouteParams?: NavigationParams; + paths?: NavigationPathsConfig; + navigationOptions?: NavigationScreenConfig; + order?: string[]; + backBehavior?: 'none' | 'initialRoute'; // defaults to `'none'` + resetOnBlur?: boolean; // defaults to `true` +} + +export interface NavigationStackScreenOptions { + title?: string; + header?: + | ( + | React.ReactElement + | ((headerProps: HeaderProps) => React.ReactElement)) + | null; + headerTransparent?: boolean; + headerTitle?: string | React.ReactElement; + headerTitleStyle?: StyleProp; + headerTitleAllowFontScaling?: boolean; + headerTintColor?: string; + headerLeft?: React.ReactElement; + headerBackTitle?: string | null; + headerBackImage?: React.ReactElement; + headerTruncatedBackTitle?: string; + headerBackTitleStyle?: StyleProp; + headerPressColorAndroid?: string; + headerRight?: React.ReactElement; + headerStyle?: StyleProp; + headerForceInset?: HeaderForceInset; + headerBackground?: React.ReactNode | React.ReactType; + gesturesEnabled?: boolean; + gestureResponseDistance?: { vertical?: number; horizontal?: number }; + gestureDirection?: 'default' | 'inverted'; +} + +export interface NavigationStackRouterConfig { + headerTransitionPreset?: 'fade-in-place' | 'uikit'; + initialRouteName?: string; + initialRouteParams?: NavigationParams; + paths?: NavigationPathsConfig; + navigationOptions?: NavigationScreenConfig; + initialRouteKey?: string; +} + +export type NavigationStackAction = + | NavigationInitAction + | NavigationNavigateAction + | NavigationBackAction + | NavigationSetParamsAction + | NavigationResetAction + | NavigationPopAction + | NavigationPopToTopAction; + +export type NavigationTabAction = + | NavigationInitAction + | NavigationNavigateAction + | NavigationBackAction; + +export type NavigationAction = + | NavigationInitAction + | NavigationStackAction + | NavigationTabAction; + +export type NavigationRouteConfig = + | NavigationComponent + | ({ + navigationOptions?: NavigationScreenConfig; + path?: string; + } & NavigationScreenRouteConfig); + +export type NavigationScreenRouteConfig = + | NavigationComponent + | { + screen: NavigationComponent; + } + | { + getScreen: () => NavigationComponent; + }; + +export interface NavigationPathsConfig { + [routeName: string]: string; +} + +export interface NavigationTabRouterConfig { + initialRouteName?: string; + initialRouteParams?: NavigationParams; + paths?: NavigationPathsConfig; + navigationOptions?: NavigationScreenConfig; + order?: string[]; // todo: type these as the real route names rather than 'string' + + // Does the back button cause the router to switch to the initial tab + backBehavior?: 'none' | 'initialRoute'; // defaults `initialRoute` +} +export interface TabScene { + route: NavigationRoute; + focused: boolean; + index: number; + tintColor?: string; +} +export interface NavigationTabScreenOptions { + title?: string; + tabBarIcon?: + | React.ReactElement + | (( + options: { tintColor: string | null; focused: boolean } + ) => React.ReactElement | null); + tabBarLabel?: + | string + | React.ReactElement + | (( + options: { tintColor: string | null; focused: boolean } + ) => React.ReactElement | string | null); + tabBarVisible?: boolean; + tabBarTestIDProps?: { testID?: string; accessibilityLabel?: string }; + tabBarOnPress?: ( + options: { + scene: TabScene; + jumpToIndex: (index: number) => void; + } + ) => void; +} + +export interface NavigationDrawerScreenOptions { + title?: string; + drawerIcon?: + | React.ReactElement + | (( + options: { tintColor: string | null; focused: boolean } + ) => React.ReactElement | null); + drawerLabel?: + | string + | React.ReactElement + | (( + options: { tintColor: string | null; focused: boolean } + ) => React.ReactElement | null); + drawerLockMode?: 'unlocked' | 'locked-closed' | 'locked-open'; +} + +export interface NavigationRouteConfigMap { + [routeName: string]: NavigationRouteConfig; +} + +export type NavigationDispatch = (action: NavigationAction) => boolean; + +export interface NavigationProp { + state: S; + dispatch: NavigationDispatch; +} + +export type EventType = + | 'willFocus' + | 'didFocus' + | 'willBlur' + | 'didBlur' + | 'action'; + +export interface NavigationEventPayload { + type: EventType; + action: NavigationAction; + state: NavigationState; + lastState: NavigationState | null | undefined; +} + +export type NavigationEventCallback = (payload: NavigationEventPayload) => void; + +export interface NavigationEventSubscription { + remove: () => void; +} + +export interface NavigationScreenProp { + state: S; + dispatch: NavigationDispatch; + goBack: (routeKey?: string | null) => boolean; + dismiss: () => boolean; + navigate(options: { + routeName: string | { + routeName: string; + params?: NavigationParams; + action?: NavigationNavigateAction; + key?: string; + }; + params?: NavigationParams; + action?: NavigationAction; + key?: string; + }): boolean; + navigate( + routeNameOrOptions: string, + params?: NavigationParams, + action?: NavigationAction + ): boolean; + openDrawer: () => any; + closeDrawer: () => any; + toggleDrawer: () => any; + getParam: (param: T, fallback?: P[T]) => P[T]; + setParams: (newParams: P) => boolean; + addListener: ( + eventName: string, + callback: NavigationEventCallback + ) => NavigationEventSubscription; + push: ( + routeName: string, + params?: NavigationParams, + action?: NavigationNavigateAction + ) => boolean; + replace: ( + routeName: string, + params?: NavigationParams, + action?: NavigationNavigateAction + ) => boolean; + pop: (n?: number, params?: { immediate?: boolean }) => boolean; + popToTop: (params?: { immediate?: boolean }) => boolean; + isFocused: () => boolean; +} + +export interface NavigationNavigatorProps { + navigation?: NavigationProp; + screenProps?: { [key: string]: any }; + navigationOptions?: O; +} + +/** + * Gestures, Animations, and Interpolators + */ + +export type NavigationGestureDirection = 'horizontal' | 'vertical'; + +export interface NavigationLayout { + height: AnimatedValue; + initHeight: number; + initWidth: number; + isMeasured: boolean; + width: AnimatedValue; +} + +export interface NavigationScene { + index: number; + isActive: boolean; + isStale: boolean; + key: string; + route: NavigationRoute; +} + +export interface NavigationTransitionProps { + // The layout of the screen container + layout: NavigationLayout; + + // The destination navigation state of the transition + navigation: NavigationScreenProp; + + // The progressive index of the transitioner's navigation state. + position: AnimatedValue; + + // The value that represents the progress of the transition when navigation + // state changes from one to another. Its numberic value will range from 0 + // to 1. + // progress.__getAnimatedValue() < 1 : transtion is happening. + // progress.__getAnimatedValue() == 1 : transtion completes. + progress: AnimatedValue; + + // All the scenes of the transitioner. + scenes: NavigationScene[]; + + // The active scene, corresponding to the route at + // `navigation.state.routes[navigation.state.index]`. When rendering + // NavigationSceneRendererPropsIndex, the scene does not refer to the active + // scene, but instead the scene that is being rendered. The index always + // is the index of the scene + scene: NavigationScene; + index: number; + + screenProps?: { [key: string]: any }; +} + +// The scene renderer props are nearly identical to the props used for rendering +// a transition. The exception is that the passed scene is not the active scene +// but is instead the scene that the renderer should render content for. +export type NavigationSceneRendererProps = NavigationTransitionProps; + +export interface NavigationTransitionSpec { + duration?: number; + // An easing function from `Easing`. + easing?: (t: number) => number; + // A timing function such as `Animated.timing`. + timing?: (value: AnimatedValue, config: any) => any; +} + +/** + * Describes a visual transition from one screen to another. + */ +export interface TransitionConfig { + // The basics properties of the animation, such as duration and easing + transitionSpec?: NavigationTransitionSpec; + // How to animate position and opacity of the screen + // based on the value generated by the transitionSpec + screenInterpolator?: (props: NavigationSceneRendererProps) => any; + // How to animate position and opacity of the header componetns + // based on the value generated by the transitionSpec + headerLeftInterpolator?: (props: NavigationSceneRendererProps) => any; + headerTitleInterpolator?: (props: NavigationSceneRendererProps) => any; + headerRightInterpolator?: (props: NavigationSceneRendererProps) => any; + // The style of the container. Useful when a scene doesn't have + // 100% opacity and the underlying container is visible. + containerStyle?: StyleProp; +} + +export type NavigationAnimationSetter = ( + position: AnimatedValue, + newState: NavigationState, + lastState: NavigationState +) => void; + +export type NavigationSceneRenderer = () => React.ReactElement | null; + +export type NavigationStyleInterpolator = ( + props: NavigationSceneRendererProps +) => ViewStyle; + +export interface LayoutEvent { + nativeEvent: { + layout: { + x: number; + y: number; + width: number; + height: number; + }; + }; +} + +export type NavigatorType = + | 'react-navigation/STACK' + | 'react-navigation/TABS' + | 'react-navigation/DRAWER'; + +export interface NavigationContainerProps { + uriPrefix?: string | RegExp; + onNavigationStateChange?: ( + prevNavigationState: NavigationState, + nextNavigationState: NavigationState, + action: NavigationAction + ) => void | null | undefined; + navigation?: NavigationScreenProp; + persistenceKey?: string | null | undefined; + renderLoadingExperimental?: React.ComponentType<{}>, + screenProps?: any; + navigationOptions?: O; + style?: StyleProp; +} + +export interface NavigationContainerComponent + extends React.Component< + NavigationContainerProps & NavigationNavigatorProps + > { + dispatch: NavigationDispatch; +} + +export interface NavigationContainer + extends React.ComponentClass< + NavigationContainerProps & NavigationNavigatorProps + > { + new( + props: NavigationContainerProps & NavigationNavigatorProps, + context?: any + ): NavigationContainerComponent; + + router: NavigationRouter; + screenProps: { [key: string]: any }; + navigationOptions: any; + state: { nav: NavigationState | null }; +} + +export interface StackNavigatorConfig + extends NavigationStackViewConfig, + NavigationStackRouterConfig { + containerOptions?: any; +} + +// Return createNavigationContainer +export function StackNavigator( + routeConfigMap: NavigationRouteConfigMap, + stackConfig?: StackNavigatorConfig +): NavigationContainer; + +export function createStackNavigator( + routeConfigMap: NavigationRouteConfigMap, + stackConfig?: StackNavigatorConfig +): NavigationContainer; + +export interface SwitchNavigatorConfig { + initialRouteName: string; + resetOnBlur?: boolean; + paths?: NavigationPathsConfig; + backBehavior?: 'none' | 'initialRoute'; +} + +// Return createNavigationContainer +export type _SwitchNavigatorConfig = NavigationSwitchRouterConfig; + +export function SwitchNavigator( + routeConfigMap: NavigationRouteConfigMap, + switchConfig?: SwitchNavigatorConfig +): NavigationContainer; + +export function createSwitchNavigator( + routeConfigMap: NavigationRouteConfigMap, + switchConfig?: SwitchNavigatorConfig +): NavigationContainer; + +// DrawerItems +export const DrawerItems: React.ReactType; + +/** + * Drawer Navigator + */ +export interface DrawerViewConfig { + drawerBackgroundColor?: string; + drawerWidth?: number; + drawerPosition?: 'left' | 'right'; + contentComponent?: React.ReactType; + contentOptions?: any; + style?: StyleProp; +} +export interface DrawerNavigatorConfig + extends NavigationTabRouterConfig, + DrawerViewConfig { + containerConfig?: any; + contentOptions?: { + activeTintColor?: string; + activeBackgroundColor?: string; + inactiveTintColor?: string; + inactiveBackgroundColor?: string; + style?: StyleProp; + labelStyle?: StyleProp; + }; +} + +export function DrawerNavigator( + routeConfigMap: NavigationRouteConfigMap, + drawerConfig?: DrawerNavigatorConfig +): NavigationContainer; + +export function createDrawerNavigator( + routeConfigMap: NavigationRouteConfigMap, + drawerConfig?: DrawerNavigatorConfig +): NavigationContainer; + +/** + * Tab Navigator + */ + +// From views/TabView/TabView.js +export interface TabViewConfig { + tabBarComponent?: React.ReactType; + tabBarPosition?: 'top' | 'bottom'; + tabBarOptions?: { + activeTintColor?: string; + allowFontScaling?: boolean; + activeBackgroundColor?: string; + inactiveTintColor?: string; + inactiveBackgroundColor?: string; + showLabel?: boolean; + style?: StyleProp; + labelStyle?: StyleProp; + iconStyle?: StyleProp; + // Top + showIcon?: boolean; + upperCaseLabel?: boolean; + pressColor?: string; + pressOpacity?: number; + scrollEnabled?: boolean; + tabStyle?: StyleProp; + indicatorStyle?: StyleProp; + }; + swipeEnabled?: boolean; + animationEnabled?: boolean; + lazy?: boolean; +} + +// From navigators/TabNavigator.js +export interface TabNavigatorConfig + extends NavigationTabRouterConfig, + TabViewConfig { + lazy?: boolean; + removeClippedSubviews?: boolean; + initialLayout?: { height: number; width: number }; +} + +// From navigators/TabNavigator.js +export function TabNavigator( + routeConfigMap: NavigationRouteConfigMap, + drawConfig?: TabNavigatorConfig +): NavigationContainer; + +export function createTabNavigator( + routeConfigMap: NavigationRouteConfigMap, + drawConfig?: TabNavigatorConfig +): NavigationContainer; + +export function createBottomTabNavigator( + routeConfigMap: NavigationRouteConfigMap, + drawConfig?: TabNavigatorConfig +): NavigationContainer; + +export function createMaterialTopNavigator( + routeConfigMap: NavigationRouteConfigMap, + drawConfig?: TabNavigatorConfig +): NavigationContainer; + +export interface TabBarTopProps { + activeTintColor: string; + inactiveTintColor: string; + indicatorStyle: StyleProp; + showIcon: boolean; + showLabel: boolean; + upperCaseLabel: boolean; + allowFontScaling: boolean; + position: AnimatedValue; + tabBarPosition: string; + navigation: NavigationScreenProp; + jumpToIndex: (index: number) => void; + getLabel: (scene: TabScene) => React.ReactNode | string; + getOnPress: ( + previousScene: NavigationRoute, + scene: TabScene + ) => ( + args: { + previousScene: NavigationRoute; + scene: TabScene; + jumpToIndex: (index: number) => void; + } + ) => void; + renderIcon: (scene: TabScene) => React.ReactElement; + labelStyle?: TextStyle; + iconStyle?: ViewStyle; +} + +export interface TabBarBottomProps { + activeTintColor: string; + activeBackgroundColor: string; + adaptive?: boolean; + inactiveTintColor: string; + inactiveBackgroundColor: string; + showLabel?: boolean; + allowFontScaling: boolean; + position: AnimatedValue; + navigation: NavigationScreenProp; + jumpToIndex: (index: number) => void; + getLabel: (scene: TabScene) => React.ReactNode | string; + getOnPress: ( + previousScene: NavigationRoute, + scene: TabScene + ) => ( + args: { + previousScene: NavigationRoute; + scene: TabScene; + jumpToIndex: (index: number) => void; + } + ) => void; + getTestIDProps: (scene: TabScene) => (scene: TabScene) => any; + renderIcon: (scene: TabScene) => React.ReactNode; + style?: ViewStyle; + animateStyle?: ViewStyle; + labelStyle?: TextStyle; + tabStyle?: ViewStyle; + showIcon?: boolean; +} + +export const TabBarTop: React.ComponentType; +export const TabBarBottom: React.ComponentType; + +/** + * NavigationActions + */ +export namespace NavigationActions { + const BACK: 'Navigation/BACK'; + const INIT: 'Navigation/INIT'; + const NAVIGATE: 'Navigation/NAVIGATE'; + const RESET: 'Navigation/RESET'; + const SET_PARAMS: 'Navigation/SET_PARAMS'; + const URI: 'Navigation/URI'; + const POP: 'Navigation/POP'; + const POP_TO_TOP: 'Navigation/POP_TO_TOP'; + + function init(options?: NavigationInitActionPayload): NavigationInitAction; + function navigate( + options: NavigationNavigateActionPayload + ): NavigationNavigateAction; + function reset(options: NavigationResetActionPayload): NavigationResetAction; + function back(options?: NavigationBackActionPayload): NavigationBackAction; + function setParams( + options: NavigationSetParamsActionPayload + ): NavigationSetParamsAction; + function pop(options: NavigationPopActionPayload): NavigationPopAction; + function popToTop( + options: NavigationPopToTopActionPayload + ): NavigationPopToTopAction; +} + +/** + * Transitioner + * @desc From react-navigation/src/views/Transitioner.js + */ +export interface TransitionerProps { + configureTransition: ( + transitionProps: NavigationTransitionProps, + prevTransitionProps?: NavigationTransitionProps + ) => NavigationTransitionSpec; + navigation: NavigationScreenProp; + onTransitionStart?: ( + transitionProps: NavigationTransitionProps, + prevTransitionProps?: NavigationTransitionProps + ) => Promise | void; + onTransitionEnd?: ( + transitionProps: NavigationTransitionProps, + prevTransitionProps?: NavigationTransitionProps + ) => void; + render: ( + transitionProps: NavigationTransitionProps, + prevTransitionProps?: NavigationTransitionProps + ) => any; + style?: StyleProp; +} + +export interface TransitionerState { + layout: NavigationLayout; + position: Animated.Value; + progress: Animated.Value; + scenes: NavigationScene[]; +} + +export class Transitioner extends React.Component< + TransitionerProps, + TransitionerState + > { } + +/** + * Tab Router + * + * @desc from react-navigation/src/routers/TabRouter.js + */ +export function TabRouter( + routeConfigs: NavigationRouteConfigMap, + config: NavigationTabRouterConfig +): NavigationRouter; + +/** + * Stack Router + * + * @desc from react-navigation/src/routers/StackRouter.js + */ +export function StackRouter( + routeConfigs: NavigationRouteConfigMap, + config: NavigationTabRouterConfig +): NavigationRouter; + +/** + * Create Navigator + * + * @see https://github.com/react-navigation/react-navigation/blob/master/src/navigators/createNavigator.js + */ +export interface NavigationDescriptor { + key: string; + state: NavigationLeafRoute | NavigationStateRoute; + navigation: NavigationScreenProp; + getComponent: () => React.ComponentType<{}>; +} + +export type NavigationView = React.ComponentType<{ + descriptors: { [key: string]: NavigationDescriptor }; +} & NavigationInjectedProps>; + +export function createNavigator( + view: NavigationView, + router: NavigationRouter, + navigatorConfig?: {} | null, + navigatorType?: NavigatorType +): any; + +/** + * Create an HOC that injects the navigation and manages the navigation state + * in case it's not passed from above. + * This allows to use e.g. the StackNavigator and TabNavigator as root-level + * components. + * + * @see https://github.com/react-navigation/react-navigation/blob/master/src/createNavigationContainer.js + */ +export function createNavigationContainer( + Component: NavigationNavigator +): NavigationContainer; +/** + * END MANUAL DEFINITIONS OUTSIDE OF TYPEDEFINITION.JS + */ + +/** + * BEGIN CUSTOM CONVENIENCE INTERFACES + */ + +export interface NavigationScreenProps< + Params = NavigationParams, + Options = any + > { + navigation: NavigationScreenProp, Params>; + screenProps?: { [key: string]: any }; + navigationOptions?: NavigationScreenConfig; +} + +/** + * END CUSTOM CONVENIENCE INTERFACES + */ + +/* + * Header + */ + +// src/views/HeaderBackButton.js + +export interface HeaderBackButtonProps { + onPress?: () => void; + pressColorAndroid?: string; + title?: string; + titleStyle?: StyleProp; + tintColor?: string; + truncatedTitle?: string; + width?: number; +} + +export const HeaderBackButton: React.ComponentClass; +/** + * Header Component + */ +export const Header: React.ComponentClass; + +export interface NavigationInjectedProps { + navigation: NavigationScreenProp; +} + +export function withNavigation( + Component: React.ComponentType +): React.ComponentType; + +export function withNavigationFocus( + Component: React.ComponentType +): React.ComponentType; + +/** + * SafeAreaView Component + */ +export type SafeAreaViewForceInsetValue = 'always' | 'never'; +export interface SafeAreaViewProps extends ViewProps { + forceInset?: { + top?: SafeAreaViewForceInsetValue; + bottom?: SafeAreaViewForceInsetValue; + left?: SafeAreaViewForceInsetValue; + right?: SafeAreaViewForceInsetValue; + horizontal?: SafeAreaViewForceInsetValue; + vertical?: SafeAreaViewForceInsetValue; + }; + children?: React.ReactNode; +} + +export const SafeAreaView: React.ComponentClass; diff --git a/types/react-navigation/v2/react-navigation-tests.tsx b/types/react-navigation/v2/react-navigation-tests.tsx new file mode 100644 index 0000000000..b59474bd11 --- /dev/null +++ b/types/react-navigation/v2/react-navigation-tests.tsx @@ -0,0 +1,453 @@ +import * as React from 'react'; +import { + TouchableOpacity, + View, + ViewStyle, +} from 'react-native'; +import { + createDrawerNavigator, + DrawerNavigatorConfig, + NavigationAction, + NavigationActions, + NavigationBackAction, + NavigationInitAction, + NavigationNavigateAction, + NavigationProp, + NavigationResetAction, + NavigationRouteConfigMap, + NavigationScreenProp, + NavigationScreenProps, + NavigationSetParamsAction, + NavigationStackAction, + NavigationStackScreenOptions, + NavigationTabScreenOptions, + NavigationTransitionProps, + createStackNavigator, + StackNavigatorConfig, + createSwitchNavigator, + SwitchNavigatorConfig, + TabBarTop, + createTabNavigator, + TabNavigatorConfig, + Transitioner, + HeaderBackButton, + Header, + NavigationContainer, + NavigationParams, + NavigationPopAction, + NavigationPopToTopAction, + NavigationScreenComponent, + NavigationContainerComponent, +} from 'react-navigation'; + +// Constants +const viewStyle: ViewStyle = { + flex: 1, + margin: 42, + padding: 0, + backgroundColor: "white", +}; + +const ROUTE_NAME_START_SCREEN = "StartScreen"; +const ROUTE_KEY_START_SCREEN = "StartScreen-key"; + +interface StartScreenNavigationParams { + id: number; + s: string; +} + +/** + * @desc Simple screen component class with typed component props that should + * receive the navigation prop from the AppNavigator. + */ +class StartScreen extends React.Component> { + render() { + // Implicit type checks. + const navigationStateParams: StartScreenNavigationParams | undefined = this.props.navigation.state.params; + const id = this.props.navigation.state.params && this.props.navigation.state.params.id; + const s = this.props.navigation.state.params && this.props.navigation.state.params.s; + + return ( + + + + + ); + } + private readonly navigateToNextScreen = (): void => { + const params = { + id: this.props.navigation.state.params && this.props.navigation.state.params.id, + name: this.props.navigation.state.params && this.props.navigation.state.params.s, + }; + this.props.navigation.navigate(ROUTE_NAME_NEXT_SCREEN, params); + } + private readonly navigateDifferentlyToNextScreen = (): void => { + const params = { + id: this.props.navigation.state.params && this.props.navigation.state.params.id, + name: this.props.navigation.state.params && this.props.navigation.state.params.s, + }; + this.props.navigation.navigate({routeName: ROUTE_NAME_NEXT_SCREEN, params}); + } +} + +const ROUTE_NAME_NEXT_SCREEN = "NextScreen"; + +interface NextScreenNavigationParams { + id: number; + name: string; +} + +class NextScreen extends React.Component> { + render() { + // Implicit type checks. + const navigationStateParams: NextScreenNavigationParams | undefined = this.props.navigation.state.params; + const id = this.props.navigation.state.params && this.props.navigation.state.params.id; + const name = this.props.navigation.getParam('name', 'Peter'); + + return ( + + ); + } +} + +const navigationOptions = { + headerBackTitle: null, +}; +const initialRouteParams: StartScreenNavigationParams = { + id: 1, + s: "Start", +}; +const routeConfigMap: NavigationRouteConfigMap = { + [ROUTE_NAME_START_SCREEN]: { + path: "start", + screen: StartScreen, + }, + [ROUTE_NAME_NEXT_SCREEN]: { + path: "next", + screen: NextScreen, + }, +}; +export const AppNavigator = createStackNavigator( + routeConfigMap, + { + initialRouteName: ROUTE_NAME_START_SCREEN, + initialRouteKey: ROUTE_KEY_START_SCREEN, + initialRouteParams, + navigationOptions, + }, +); + +interface StatelessScreenParams { + testID: string; +} + +const StatelessScreen: NavigationScreenComponent = (props) => + ; + +StatelessScreen.navigationOptions = { title: 'Stateless' }; + +const SimpleStackNavigator = createStackNavigator( + { + simple: { + screen: StatelessScreen, + }, + } +); + +/** + * Tab navigator. + */ + +const tabNavigatorScreenOptions: NavigationTabScreenOptions = { + title: 'title', + tabBarVisible: true, + tabBarIcon: , + tabBarLabel: 'label', + tabBarOnPress: ({scene, jumpToIndex}) => {} +}; + +const tabNavigatorConfig: TabNavigatorConfig = { + lazy: true, + tabBarComponent: TabBarTop, + tabBarOptions: { activeBackgroundColor: "blue" }, +}; + +const tabNavigatorConfigWithInitialLayout: TabNavigatorConfig = { + ...tabNavigatorConfig, + initialLayout: { height: 0, width: 100 }, +}; + +const tabNavigatorConfigWithNavigationOptions: TabNavigatorConfig = { + ...tabNavigatorConfig, + navigationOptions: { + tabBarOnPress: ({scene, jumpToIndex}) => { + jumpToIndex(scene.index); + }, + headerStyle: { + backgroundColor: 'red', + }, + }, +}; + +const BasicTabNavigator = createTabNavigator( + routeConfigMap, + tabNavigatorConfig, +); + +function renderBasicTabNavigator(): JSX.Element { + return ( + { }} + style={[viewStyle, undefined]} // Test that we are using StyleProp + /> + ); +} + +/** + * Stack navigator. + */ + +const stackNavigatorScreenOptions: NavigationStackScreenOptions = { + title: 'title', +}; + +const stackNavigatorConfig: StackNavigatorConfig = { + mode: "card", + headerMode: "screen", + navigationOptions: stackNavigatorScreenOptions, +}; + +const BasicStackNavigator = createStackNavigator( + routeConfigMap, + stackNavigatorConfig, +); + +function renderBasicStackNavigator(): JSX.Element { + return ( + { }} + style={viewStyle} + /> + ); +} + +const stackNavigatorConfigWithNavigationOptionsAsFunction: StackNavigatorConfig = { + mode: "card", + headerMode: "screen", + navigationOptions: ({navigationOptions, navigation, screenProps}) => (stackNavigatorScreenOptions), +}; + +const AdvancedStackNavigator = createStackNavigator( + routeConfigMap, + stackNavigatorConfigWithNavigationOptionsAsFunction +); + +function renderAdvancedStackNavigator(): JSX.Element { + return ( + { }} + style={viewStyle} + /> + ); +} + +/** + * Switch navigator. + */ + +const switchNavigatorConfig: SwitchNavigatorConfig = { + initialRouteName: 'screen', + resetOnBlur: false, + backBehavior: 'none' +}; + +const BasicSwitchNavigator = createSwitchNavigator( + routeConfigMap, + switchNavigatorConfig, +); + +function renderBasicSwitchNavigator(): JSX.Element { + return ( + { }} + style={viewStyle} + /> + ); +} + +const switchNavigatorConfigWithInitialRoute: SwitchNavigatorConfig = { + initialRouteName: 'screen', + resetOnBlur: false, + backBehavior: 'initialRoute' +}; + +const SwitchNavigatorWithInitialRoute = createSwitchNavigator( + routeConfigMap, + switchNavigatorConfigWithInitialRoute, +); + +function renderSwitchNavigatorWithInitialRoute(): JSX.Element { + return ( + { }} + style={viewStyle} + /> + ); +} + +/** + * Drawer navigator. + */ + +const drawerNavigatorScreenOptions: NavigationTabScreenOptions = { + title: 'title', +}; + +const drawerNavigatorConfig: DrawerNavigatorConfig = { + drawerBackgroundColor: '#777777', + contentOptions: { + activeTintColor: '#7A9B49', + inactiveTintColor: '#FFFFFF', + }, +}; + +const BasicDrawerNavigator = createDrawerNavigator( + routeConfigMap, + stackNavigatorConfig, +); + +function renderBasicDrawerNavigator(): JSX.Element { + return ( + { }} + style={viewStyle} + /> + ); +} + +interface CustomTransitionerProps { + navigation: NavigationScreenProp; +} +/** + * @desc Custom transitioner component. Follows react-navigation/src/views/CardStackTransitioner.js. + */ +class CustomTransitioner extends React.Component { + render() { + return ( + { + if (prev) { + prev.position.setValue(curr.navigation.state.index); + } + }} + onTransitionEnd={(curr, prev) => { + if (prev) { + prev.position.setValue(curr.navigation.state.index); + } + }} + /> + ); + } + _render = (props: NavigationTransitionProps, prevProps: NavigationTransitionProps): React.ReactElement => { + return ( + + ); + } + _configureTransition = ( + _transitionProps: NavigationTransitionProps, + _prevTransitionProps: NavigationTransitionProps + ) => { + return {}; + } +} + +/** + * Header + */ +function renderHeaderBackButton(schema: string): JSX.Element { + switch (schema) { + case 'compact': + return ( + + ); + + default: + return ( + 'noop'} + pressColorAndroid="#ccc" + title="Press Me" + titleStyle={{ color: '#333' }} + tintColor="#2196f3" + truncatedTitle="Press" + width={85} + /> + ); + } +} + +const initAction: NavigationInitAction = NavigationActions.init({ + params: { + foo: "bar" + } +}); + +const navigateAction: NavigationNavigateAction = NavigationActions.navigate({ + routeName: "FooScreen", + params: { + foo: "bar" + }, + action: NavigationActions.navigate({ routeName: "BarScreen" }) +}); + +const resetAction: NavigationResetAction = NavigationActions.reset({ + index: 0, + key: "foo", + actions: [ + NavigationActions.navigate({ routeName: "FooScreen" }) + ] +}); + +const backAction: NavigationBackAction = NavigationActions.back({ + key: "foo" +}); + +const setParamsAction: NavigationSetParamsAction = NavigationActions.setParams({ + key: "foo", + params: { + foo: "bar" + } +}); + +const popAction: NavigationPopAction = NavigationActions.pop({ + n: 1, + immediate: true +}); + +const popToTopAction: NavigationPopToTopAction = NavigationActions.popToTop({ + key: "foo", + immediate: true +}); + +class Page1 extends React.Component { } + +const RootNavigator: NavigationContainer = createSwitchNavigator({ + default: { getScreen: () => Page1 }, +}); + +class Page2 extends React.Component { + navigatorRef: NavigationContainerComponent | null; + + componentDidMount() { + if (this.navigatorRef) { + this.navigatorRef.dispatch(NavigationActions.navigate({ routeName: 'default' })); + } + } + + render() { + return { this.navigatorRef = instance; }} />; + } +} diff --git a/types/react-navigation/v2/tsconfig.json b/types/react-navigation/v2/tsconfig.json new file mode 100644 index 0000000000..1b793c0613 --- /dev/null +++ b/types/react-navigation/v2/tsconfig.json @@ -0,0 +1,30 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": false, + "baseUrl": "../../", + "jsx": "react", + "typeRoots": [ + "../../" + ], + "paths": { + "react-navigation": [ + "react-navigation/v2" + ] + }, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "react-navigation-tests.tsx" + ] +} diff --git a/types/react-navigation/v2/tslint.json b/types/react-navigation/v2/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-navigation/v2/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 819852455128460171d4023922f24320255e074e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matteus=20Hemstr=C3=B6m?= Date: Mon, 21 May 2018 12:16:03 +0200 Subject: [PATCH 286/575] [core-js] Change lpad/rpad to padStart/padEnd --- types/core-js/index.d.ts | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/types/core-js/index.d.ts b/types/core-js/index.d.ts index 171aebc943..86259f05ba 100644 --- a/types/core-js/index.d.ts +++ b/types/core-js/index.d.ts @@ -755,8 +755,8 @@ declare namespace core { raw(template: TemplateStringsArray, ...substitutions: any[]): string; startsWith(text: string, searchString: string, position?: number): boolean; at(text: string, index: number): string; - lpad(text: string, length: number, fillStr?: string): string; - rpad(text: string, length: number, fillStr?: string): string; + padStart(text: string, length: number, fillStr?: string): string; + padEnd(text: string, length: number, fillStr?: string): string; escapeHTML(text: string): string; unescapeHTML(text: string): string; }; @@ -1454,9 +1454,13 @@ declare module "core-js/fn/string/includes" { const includes: typeof core.String.includes; export = includes; } -declare module "core-js/fn/string/lpad" { - const lpad: typeof core.String.lpad; - export = lpad; +declare module "core-js/fn/string/pad-end" { + const padEnd: typeof core.String.padEnd; + export = padEnd; +} +declare module "core-js/fn/string/pad-start" { + const padStart: typeof core.String.padStart; + export = padStart; } declare module "core-js/fn/string/raw" { const raw: typeof core.String.raw; @@ -1466,10 +1470,6 @@ declare module "core-js/fn/string/repeat" { const repeat: typeof core.String.repeat; export = repeat; } -declare module "core-js/fn/string/rpad" { - const rpad: typeof core.String.rpad; - export = rpad; -} declare module "core-js/fn/string/starts-with" { const startsWith: typeof core.String.startsWith; export = startsWith; @@ -2273,9 +2273,13 @@ declare module "core-js/library/fn/string/includes" { const includes: typeof core.String.includes; export = includes; } -declare module "core-js/library/fn/string/lpad" { - const lpad: typeof core.String.lpad; - export = lpad; +declare module "core-js/library/fn/string/pad-end" { + const padEnd: typeof core.String.padEnd; + export = padEnd; +} +declare module "core-js/library/fn/string/pad-start" { + const padStart: typeof core.String.padStart; + export = padStart; } declare module "core-js/library/fn/string/raw" { const raw: typeof core.String.raw; @@ -2285,10 +2289,6 @@ declare module "core-js/library/fn/string/repeat" { const repeat: typeof core.String.repeat; export = repeat; } -declare module "core-js/library/fn/string/rpad" { - const rpad: typeof core.String.rpad; - export = rpad; -} declare module "core-js/library/fn/string/starts-with" { const startsWith: typeof core.String.startsWith; export = startsWith; From abf06b4f43e53c90e71e2abed2d3f5dcbb69d82c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Magrin?= Date: Mon, 21 May 2018 12:32:59 +0200 Subject: [PATCH 287/575] Try to fix dependencies --- types/react-navigation/v2/tsconfig.json | 5 ++++- types/react-router-navigation-core/tsconfig.json | 10 +++++++++- types/react-router-navigation/tsconfig.json | 10 +++++++++- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/types/react-navigation/v2/tsconfig.json b/types/react-navigation/v2/tsconfig.json index 1b793c0613..1afd5d30f6 100644 --- a/types/react-navigation/v2/tsconfig.json +++ b/types/react-navigation/v2/tsconfig.json @@ -14,12 +14,15 @@ "typeRoots": [ "../../" ], + "types": [], "paths": { "react-navigation": [ "react-navigation/v2" + ], + "react-navigation/*": [ + "react-navigation/v2/*" ] }, - "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true }, diff --git a/types/react-router-navigation-core/tsconfig.json b/types/react-router-navigation-core/tsconfig.json index b356b2d5c5..b773967cc9 100644 --- a/types/react-router-navigation-core/tsconfig.json +++ b/types/react-router-navigation-core/tsconfig.json @@ -5,6 +5,14 @@ "../" ], "types": [], + "paths": { + "react-navigation": [ + "react-navigation/v2" + ], + "react-navigation/*": [ + "react-navigation/v2/*" + ] + }, "module": "commonjs", "lib": [ "es6", @@ -22,4 +30,4 @@ "index.d.ts", "react-router-navigation-core-tests.tsx" ] -} \ No newline at end of file +} diff --git a/types/react-router-navigation/tsconfig.json b/types/react-router-navigation/tsconfig.json index e10c25a443..c55f423c19 100644 --- a/types/react-router-navigation/tsconfig.json +++ b/types/react-router-navigation/tsconfig.json @@ -5,6 +5,14 @@ "../" ], "types": [], + "paths": { + "react-navigation": [ + "react-navigation/v2" + ], + "react-navigation/*": [ + "react-navigation/v2/*" + ] + }, "module": "commonjs", "lib": [ "es6", @@ -22,4 +30,4 @@ "index.d.ts", "react-router-navigation-tests.tsx" ] -} \ No newline at end of file +} From 46ef3af9e6bac2b6cf0fcf48cb2ab4b729868269 Mon Sep 17 00:00:00 2001 From: Drew Diamantoukos Date: Mon, 21 May 2018 08:31:30 -0400 Subject: [PATCH 288/575] Added missing hoverinfo options --- types/plotly.js/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/plotly.js/index.d.ts b/types/plotly.js/index.d.ts index 48b97bab8b..8e098a366c 100644 --- a/types/plotly.js/index.d.ts +++ b/types/plotly.js/index.d.ts @@ -386,7 +386,7 @@ export interface ScatterData { 'marker.colorbar': {}; // TODO mode: 'lines' | 'markers' | 'text' | 'lines+markers' | 'text+markers' | 'text+lines' | 'text+lines+markers' | 'none'; hoveron: 'points' | 'fills'; - hoverinfo: 'all' | 'none' | 'skip' | + hoverinfo: 'all' | 'name' | 'none' | 'skip' | 'text' | 'x' | 'x+text' | 'x+name' | 'x+y' | 'x+y+text' | 'x+y+name' | 'x+y+z' | 'x+y+z+text' | 'x+y+z+name' | From 584fbe6c2453bbdcd4b5203afa10f0edb9167b83 Mon Sep 17 00:00:00 2001 From: Jim Bouquet Date: Mon, 21 May 2018 09:14:16 -0500 Subject: [PATCH 289/575] Added namespacing to server and client files --- .../clearbladejs-client-tests.ts | 6 +- types/clearbladejs-client/global.d.ts | 2 +- types/clearbladejs-client/index.d.ts | 876 +++++++++--------- .../clearbladejs-server-tests.ts | 8 +- types/clearbladejs-server/global.d.ts | 2 +- types/clearbladejs-server/index.d.ts | 741 ++++++++------- 6 files changed, 871 insertions(+), 764 deletions(-) diff --git a/types/clearbladejs-client/clearbladejs-client-tests.ts b/types/clearbladejs-client/clearbladejs-client-tests.ts index bce39bee2a..03584b629f 100644 --- a/types/clearbladejs-client/clearbladejs-client-tests.ts +++ b/types/clearbladejs-client/clearbladejs-client-tests.ts @@ -3,7 +3,7 @@ // Definitions by: Jim Bouquet // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -let genericCallback = (error: boolean, response: Resp) => {}; +let genericCallback = (error: boolean, response: CbClient.Resp) => {}; /////////////////////////////////////// // ClearBlade object API invocations @@ -65,12 +65,12 @@ coll1.count(query1.query, genericCallback); /////////////////////////////////////// query1.addSortToQuery( query1, - QuerySortDirections.QUERY_SORT_ASCENDING, + CbClient.QuerySortDirections.QUERY_SORT_ASCENDING, "column1" ); query1.addFilterToQuery( query1, - QueryConditions.QUERY_GREATERTHAN, + CbClient.QueryConditions.QUERY_GREATERTHAN, "key", "value" ); diff --git a/types/clearbladejs-client/global.d.ts b/types/clearbladejs-client/global.d.ts index d6e2e88a70..b6f2dbcf59 100644 --- a/types/clearbladejs-client/global.d.ts +++ b/types/clearbladejs-client/global.d.ts @@ -1,5 +1,5 @@ declare global { - var ClearBlade: ClearBladeGlobal; + var ClearBlade: CbClient.ClearBladeGlobal; } export {}; diff --git a/types/clearbladejs-client/index.d.ts b/types/clearbladejs-client/index.d.ts index 4cb8c4744b..fa27a5d076 100644 --- a/types/clearbladejs-client/index.d.ts +++ b/types/clearbladejs-client/index.d.ts @@ -1,436 +1,456 @@ -// Type definitions for clearbladejs-client 1.0 +// Type definitions for clearbladejs-client 1.1 // Project: https://github.com/ClearBlade/JavaScript-API // Definitions by: Jim Bouquet // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 /// +declare namespace CbClient { + interface Resp { + error(msg: any): never; // todo: figure out if we can have the compiler throw an error if someone adds code after this + success(msg: any): never; + } -interface Resp { - error(msg: any): never; // todo: figure out if we can have the compiler throw an error if someone adds code after this - success(msg: any): never; + enum MessagingQOS { + MESSAGING_QOS_AT_MOST_ONCE = 0, + MESSAGING_QOS_AT_LEAST_ONCE = 1, + MESSAGING_QOS_EXACTLY_ONCE = 2 + } + + interface InitOptions { + systemKey: string; + systemSecret: string; + masterSecret?: string; + logging?: boolean; + callback?: CbCallback; + email?: string; + password?: string; + registerUser?: boolean; + useUser?: APIUser; + URI?: string; + messagingURI?: string; + messagingPort?: number; + defaultQoS?: MessagingQOS; + callTimeout?: number; + messagingAuthPort?: number; + } + + interface RequestOptions { + method?: string; + endpoint?: string; + body?: string; + qs?: string; + URI?: string; + useUser?: boolean; + authToken?: string; + timeout?: number; + user?: APIUser; + } + + interface APIUser { + email: string; + authToken: string; + } + + type CbCallback = (error: boolean, response: Resp) => void; + + interface ClearBladeGlobal extends ClearBladeInt { + MESSAGING_QOS_AT_MOST_ONCE: MessagingQOS.MESSAGING_QOS_AT_MOST_ONCE; + MESSAGING_QOS_AT_LEAST_ONCE: MessagingQOS.MESSAGING_QOS_AT_LEAST_ONCE; + MESSAGING_QOS_EXACTLY_ONCE: MessagingQOS.MESSAGING_QOS_EXACTLY_ONCE; + + request(options: RequestOptions, callback: CbCallback): void; + } + + interface ClearBladeInt { + systemKey: string; + systemSecret: string; + masterSecret: string; + URI: string; + messagingURI: string; + messagingPort: number; + logging: boolean; + defaultQoS: MessagingQOS; + + init(options: InitOptions): void; + setUser(email: string, password: string): void; + registerUser( + email: string, + password: string, + callback: CbCallback + ): void; + isCurrentUserAuthenticated(callback: CbCallback): void; + logoutUser(callback: CbCallback): void; + loginAnon(callback: CbCallback): void; + loginUser(email: string, password: string, callback: CbCallback): void; + loginUserMqtt( + email: string, + password: string, + callback: CbCallback + ): void; + registerMasterCallback(callback: CbCallback): void; + Collection( + options: + | string + | CollectionOptionsWithName + | CollectionOptionsWithID + ): Collection; + Query( + options: string | QueryOptionsWithName | QueryOptionsWithID + ): QueryObj; + Item(data: object, collectionID: string | ItemOptions): Item; + Code(): Code; + User(): AppUser; + Messaging(options: MessagingOptions, callback: CbCallback): Messaging; + MessagingStats(): MessagingStats; + sendPush( + users: string[], + payload: object, + appId: string, + callback: CbCallback + ): void; + getEdges(query: Query, callback: CbCallback): void; + Edge(): Edge; + Metrics(): Metrics; + Device(): Device; + Analytics(): Analytics; + Portal(name: string): Portal; + Triggers(): Triggers; + + getAllCollections(callback: CbCallback): void; + } + interface CollectionOptionsWithName { + collectionName: string; + } + + interface CollectionOptionsWithID { + collectionID: string; + } + + interface Collection { + name: string; + endpoint: string; + isUsingCollectionName: boolean; + user: APIUser; + URI: string; + systemKey: string; + systemSecret: string; + + fetch(query: Query, callback: CbCallback): void; + create(newItem: Item, callback: CbCallback): void; + update(query: Query, changes: object, callback: CbCallback): void; + remove(query: Query, callback: CbCallback): void; + columns(callback: CbCallback): void; + count(query: Query, callback: CbCallback): void; + } + + enum QuerySortDirections { + QUERY_SORT_ASCENDING = "ASC", + QUERY_SORT_DESCENDING = "DESC" + } + + enum QueryConditions { + QUERY_EQUAL = "EQ", + QUERY_NOTEQUAL = "NEQ", + QUERY_GREATERTHAN = "GT", + QUERY_GREATERTHAN_EQUAL = "GTE", + QUERY_LESSTHAN = "LT", + QUERY_LESSTHAN_EQUAL = "LTE", + QUERY_MATCHES = "RE" + } + + type QueryValue = string | number | boolean; + + interface QueryOptions { + offset?: number; + limit?: number; + } + + interface QueryOptionsWithName + extends CollectionOptionsWithName, + QueryOptions {} + interface QueryOptionsWithID + extends CollectionOptionsWithID, + QueryOptions {} + + interface Query { + SELECTCOLUMNS?: string[]; + SORT?: QuerySortDirections; + FILTERS?: QueryFilter[]; + PAGESIZE?: number; + PAGENUM?: number; + } + + interface QueryFilter { + [QueryConditions: string]: QueryFilterValue; + } + + interface QueryFilterValue { + [name: string]: QueryValue; + } + + interface QueryObj { + endpoint: string; + user: APIUser; + URI: string; + systemKey: string; + systemSecret: string; + query: Query; + OR: Query[]; + offset: number; + limit: number; + + addSortToQuery( + query: QueryObj, + direction: QuerySortDirections, + column: string + ): void; + addFilterToQuery( + query: QueryObj, + condition: QueryConditions, + key: string, + value: QueryValue + ): void; + ascending(field: string): void; + descending(field: string): void; + equalTo(field: string, value: QueryValue): void; + greaterThan(field: string, value: QueryValue): void; + greaterThanEqualTo(field: string, value: QueryValue): void; + lessThan(field: string, value: QueryValue): void; + lessThanEqualTo(field: string, value: QueryValue): void; + notEqualTo(field: string, value: QueryValue): void; + matches(field: string, pattern: RegExp): void; + or(query: QueryObj): void; + setPage(pageSize: number, pageNum: number): void; + fetch(callback: CbCallback): void; + update(changes: object, callback: CbCallback): void; + columns(columnsArray: string[]): void; + remove(callback: CbCallback): void; + } + + interface ItemOptions extends CollectionOptionsWithID {} + + interface Item { + data: object; + + save(callback: CbCallback): void; + refresh(callback: CbCallback): void; + destroy(callback: CbCallback): void; + } + + interface Code { + user: APIUser; + URI: string; + systemKey: string; + systemSecret: string; + callTimeout: number; + + create(name: string, body: string, callback: CbCallback): void; + update(name: string, body: string, callback: CbCallback): void; + delete(name: string, callback: CbCallback): void; + execute(name: string, params: object, callback: CbCallback): void; + getCompletedServices(callback: CbCallback): void; + getFailedServices(callback: CbCallback): void; + getAllServices(callback: CbCallback): void; + } + + interface AppUser { + user: APIUser; + URI: string; + endpoint: string; + systemKey: string; + systemSecret: string; + callTimeout: number; + + getUser(callback: CbCallback): void; + setUser(data: object, callback: CbCallback): void; + allUsers(query: Query, callback: CbCallback): void; + setPassword( + old_password: string, + new_password: string, + callback: CbCallback + ): void; + count(query: Query, callback: CbCallback): void; + } + + interface Messaging { + user: APIUser; + URI: string; + endpoint: string; + systemKey: string; + systemSecret: string; + callTimeout: number; + client: Paho.MQTT.Client; + + getMessageHistoryWithTimeFrame( + topic: string, + count: number, + last: number, + start: number, + stop: number, + callback: CbCallback + ): void; + getMessageHistory( + topic: string, + last: number, + count: number, + callback: CbCallback + ): void; + getAndDeleteMessageHistory( + topic: string, + count: number, + last: number, + start: number, + stop: number, + callback: CbCallback + ): void; + currentTopics(callback: CbCallback): void; + publish(topic: string, payload: object): void; + publishREST(topic: string, payload: object, callback: CbCallback): void; + subscribe( + topic: string, + options: MessagingSubscribeOptions, + messageCallback: MessageCallback + ): void; + unsubscribe(topic: string, options: MessagingSubscribeOptions): void; + disconnect(): void; + } + + interface CommonMessagingProperties { + cleanSession?: boolean; + useSSL?: boolean; + hosts?: string; + ports?: string; + onSuccess?: Function; + onFailure?: Function; + } + + interface MessagingOptions extends CommonMessagingProperties { + qos?: MessagingQOS; + } + + interface MessagingConfiguration extends CommonMessagingProperties { + userName: string; + password: string; + } + + type MessageCallback = (message: string) => void; + + interface MessagingSubscribeOptions { + qos?: MessagingQOS; + invocationContext?: object; + onSuccess?: Function; + onFailure?: Function; + timeout?: number; + } + + interface MessagingStats { + user: APIUser; + URI: string; + endpoint: string; + systemKey: string; + + getAveragePayloadSize( + topic: string, + start: number, + stop: number, + callback: CbCallback + ): void; + getOpenConnections(callback: CbCallback): void; + getCurrentSubscribers(topic: string, callback: CbCallback): void; + } + + interface Edge { + user: APIUser; + URI: string; + systemKey: string; + systemSecret: string; + + updateEdgeByName( + name: string, + object: object, + callback: CbCallback + ): void; + deleteEdgeByName(name: string, callback: CbCallback): void; + create(newEdge: object, name: string, callback: CbCallback): void; + columns(callback: CbCallback): void; + count(query: Query, callback: CbCallback): void; + } + + interface Metrics { + user: APIUser; + URI: string; + systemKey: string; + + setQuery(query: Query): void; + getStatistics(callback: CbCallback): void; + getStatisticsHistory(callback: CbCallback): void; + getDBConnections(callback: CbCallback): void; + getLogs(callback: CbCallback): void; + } + + interface Device { + user: APIUser; + URI: string; + systemKey: string; + systemSecret: string; + + getDeviceByName(name: string, callback: CbCallback): void; + updateDeviceByName( + name: string, + object: object, + trigger: boolean, + callback: CbCallback + ): void; + deleteDeviceByName(name: string, callback: CbCallback): void; + fetch(query: Query, callback: CbCallback): void; + update( + query: Query, + object: object, + trigger: boolean, + callback: CbCallback + ): void; + delete(query: Query, callback: CbCallback): void; + create(newDevice: object, callback: CbCallback): void; + columns(callback: CbCallback): void; + count(query: Query, callback: CbCallback): void; + } + + interface Analytics { + user: APIUser; + URI: string; + systemKey: string; + systemSecret: string; + + getStorage(filter: QueryFilter, callback: CbCallback): void; + getCount(filter: QueryFilter, callback: CbCallback): void; + getEventList(filter: QueryFilter, callback: CbCallback): void; + getEventTotals(filter: QueryFilter, callback: CbCallback): void; + getUserEvents(filter: QueryFilter, callback: CbCallback): void; + } + + interface Portal { + name: string; + user: APIUser; + URI: string; + systemKey: string; + systemSecret: string; + + fetch(callback: CbCallback): void; + update(data: object, callback: CbCallback): void; + } + + interface Triggers { + user: APIUser; + URI: string; + systemKey: string; + systemSecret: string; + + fetchDefinitions(callback: CbCallback): void; + create(name: string, data: object, callback: CbCallback): void; + update(name: string, data: object, callback: CbCallback): void; + delete(name: string, callback: CbCallback): void; + } + + let ClearBlade: ClearBladeGlobal; } - -declare enum MessagingQOS { - MESSAGING_QOS_AT_MOST_ONCE = 0, - MESSAGING_QOS_AT_LEAST_ONCE = 1, - MESSAGING_QOS_EXACTLY_ONCE = 2 -} - -interface InitOptions { - systemKey: string; - systemSecret: string; - masterSecret?: string; - logging?: boolean; - callback?: CbCallback; - email?: string; - password?: string; - registerUser?: boolean; - useUser?: APIUser; - URI?: string; - messagingURI?: string; - messagingPort?: number; - defaultQoS?: MessagingQOS; - callTimeout?: number; - messagingAuthPort?: number; -} - -interface RequestOptions { - method?: string; - endpoint?: string; - body?: string; - qs?: string; - URI?: string; - useUser?: boolean; - authToken?: string; - timeout?: number; - user?: APIUser; -} - -interface APIUser { - email: string; - authToken: string; -} - -type CbCallback = (error: boolean, response: Resp) => void; - -interface ClearBladeGlobal extends ClearBladeInt { - MESSAGING_QOS_AT_MOST_ONCE: MessagingQOS.MESSAGING_QOS_AT_MOST_ONCE; - MESSAGING_QOS_AT_LEAST_ONCE: MessagingQOS.MESSAGING_QOS_AT_LEAST_ONCE; - MESSAGING_QOS_EXACTLY_ONCE: MessagingQOS.MESSAGING_QOS_EXACTLY_ONCE; - - request(options: RequestOptions, callback: CbCallback): void; -} - -interface ClearBladeInt { - systemKey: string; - systemSecret: string; - masterSecret: string; - URI: string; - messagingURI: string; - messagingPort: number; - logging: boolean; - defaultQoS: MessagingQOS; - - init(options: InitOptions): void; - setUser(email: string, password: string): void; - registerUser(email: string, password: string, callback: CbCallback): void; - isCurrentUserAuthenticated(callback: CbCallback): void; - logoutUser(callback: CbCallback): void; - loginAnon(callback: CbCallback): void; - loginUser(email: string, password: string, callback: CbCallback): void; - loginUserMqtt(email: string, password: string, callback: CbCallback): void; - registerMasterCallback(callback: CbCallback): void; - Collection(options: string | CollectionOptionsWithName | CollectionOptionsWithID): Collection; - Query( - options: string | QueryOptionsWithName | QueryOptionsWithID - ): QueryObj; - Item(data: object, collectionID: string | ItemOptions): Item; - Code(): Code; - User(): AppUser; - Messaging(options: MessagingOptions, callback: CbCallback): Messaging; - MessagingStats(): MessagingStats; - sendPush( - users: string[], - payload: object, - appId: string, - callback: CbCallback - ): void; - getEdges(query: Query, callback: CbCallback): void; - Edge(): Edge; - Metrics(): Metrics; - Device(): Device; - Analytics(): Analytics; - Portal(name: string): Portal; - Triggers(): Triggers; - - getAllCollections(callback: CbCallback): void; -} -interface CollectionOptionsWithName { - collectionName: string; -} - -interface CollectionOptionsWithID { - collectionID: string; -} - -interface Collection { - name: string; - endpoint: string; - isUsingCollectionName: boolean; - user: APIUser; - URI: string; - systemKey: string; - systemSecret: string; - - fetch(query: Query, callback: CbCallback): void; - create(newItem: Item, callback: CbCallback): void; - update(query: Query, changes: object, callback: CbCallback): void; - remove(query: Query, callback: CbCallback): void; - columns(callback: CbCallback): void; - count(query: Query, callback: CbCallback): void; -} - -declare enum QuerySortDirections { - QUERY_SORT_ASCENDING = "ASC", - QUERY_SORT_DESCENDING = "DESC" -} - -declare enum QueryConditions { - QUERY_EQUAL = "EQ", - QUERY_NOTEQUAL = "NEQ", - QUERY_GREATERTHAN = "GT", - QUERY_GREATERTHAN_EQUAL = "GTE", - QUERY_LESSTHAN = "LT", - QUERY_LESSTHAN_EQUAL = "LTE", - QUERY_MATCHES = "RE" -} - -type QueryValue = string | number | boolean; - -interface QueryOptions { - offset?: number; - limit?: number; -} - -interface QueryOptionsWithName - extends CollectionOptionsWithName, - QueryOptions {} -interface QueryOptionsWithID extends CollectionOptionsWithID, QueryOptions {} - -interface Query { - SELECTCOLUMNS?: string[]; - SORT?: QuerySortDirections; - FILTERS?: QueryFilter[]; - PAGESIZE?: number; - PAGENUM?: number; -} - -interface QueryFilter { - [QueryConditions: string]: QueryFilterValue; -} - -interface QueryFilterValue { - [name: string]: QueryValue; -} - -interface QueryObj { - endpoint: string; - user: APIUser; - URI: string; - systemKey: string; - systemSecret: string; - query: Query; - OR: Query[]; - offset: number; - limit: number; - - addSortToQuery( - query: QueryObj, - direction: QuerySortDirections, - column: string - ): void; - addFilterToQuery( - query: QueryObj, - condition: QueryConditions, - key: string, - value: QueryValue - ): void; - ascending(field: string): void; - descending(field: string): void; - equalTo(field: string, value: QueryValue): void; - greaterThan(field: string, value: QueryValue): void; - greaterThanEqualTo(field: string, value: QueryValue): void; - lessThan(field: string, value: QueryValue): void; - lessThanEqualTo(field: string, value: QueryValue): void; - notEqualTo(field: string, value: QueryValue): void; - matches(field: string, pattern: RegExp): void; - or(query: QueryObj): void; - setPage(pageSize: number, pageNum: number): void; - fetch(callback: CbCallback): void; - update(changes: object, callback: CbCallback): void; - columns(columnsArray: string[]): void; - remove(callback: CbCallback): void; -} - -interface ItemOptions extends CollectionOptionsWithID {} - -interface Item { - data: object; - - save(callback: CbCallback): void; - refresh(callback: CbCallback): void; - destroy(callback: CbCallback): void; -} - -interface Code { - user: APIUser; - URI: string; - systemKey: string; - systemSecret: string; - callTimeout: number; - - create(name: string, body: string, callback: CbCallback): void; - update(name: string, body: string, callback: CbCallback): void; - delete(name: string, callback: CbCallback): void; - execute(name: string, params: object, callback: CbCallback): void; - getCompletedServices(callback: CbCallback): void; - getFailedServices(callback: CbCallback): void; - getAllServices(callback: CbCallback): void; -} - -interface AppUser { - user: APIUser; - URI: string; - endpoint: string; - systemKey: string; - systemSecret: string; - callTimeout: number; - - getUser(callback: CbCallback): void; - setUser(data: object, callback: CbCallback): void; - allUsers(query: Query, callback: CbCallback): void; - setPassword( - old_password: string, - new_password: string, - callback: CbCallback - ): void; - count(query: Query, callback: CbCallback): void; -} - -interface Messaging { - user: APIUser; - URI: string; - endpoint: string; - systemKey: string; - systemSecret: string; - callTimeout: number; - client: Paho.MQTT.Client; - - getMessageHistoryWithTimeFrame( - topic: string, - count: number, - last: number, - start: number, - stop: number, - callback: CbCallback - ): void; - getMessageHistory( - topic: string, - last: number, - count: number, - callback: CbCallback - ): void; - getAndDeleteMessageHistory( - topic: string, - count: number, - last: number, - start: number, - stop: number, - callback: CbCallback - ): void; - currentTopics(callback: CbCallback): void; - publish(topic: string, payload: object): void; - publishREST(topic: string, payload: object, callback: CbCallback): void; - subscribe( - topic: string, - options: MessagingSubscribeOptions, - messageCallback: MessageCallback - ): void; - unsubscribe(topic: string, options: MessagingSubscribeOptions): void; - disconnect(): void; -} - -interface CommonMessagingProperties { - cleanSession?: boolean; - useSSL?: boolean; - hosts?: string; - ports?: string; - onSuccess?: Function; - onFailure?: Function; -} - -interface MessagingOptions extends CommonMessagingProperties { - qos?: MessagingQOS; -} - -interface MessagingConfiguration extends CommonMessagingProperties { - userName: string; - password: string; -} - -type MessageCallback = (message: string) => void; - -interface MessagingSubscribeOptions { - qos?: MessagingQOS; - invocationContext?: object; - onSuccess?: Function; - onFailure?: Function; - timeout?: number; -} - -interface MessagingStats { - user: APIUser; - URI: string; - endpoint: string; - systemKey: string; - - getAveragePayloadSize( - topic: string, - start: number, - stop: number, - callback: CbCallback - ): void; - getOpenConnections(callback: CbCallback): void; - getCurrentSubscribers(topic: string, callback: CbCallback): void; -} - -interface Edge { - user: APIUser; - URI: string; - systemKey: string; - systemSecret: string; - - updateEdgeByName(name: string, object: object, callback: CbCallback): void; - deleteEdgeByName(name: string, callback: CbCallback): void; - create(newEdge: object, name: string, callback: CbCallback): void; - columns(callback: CbCallback): void; - count(query: Query, callback: CbCallback): void; -} - -interface Metrics { - user: APIUser; - URI: string; - systemKey: string; - - setQuery(query: Query): void; - getStatistics(callback: CbCallback): void; - getStatisticsHistory(callback: CbCallback): void; - getDBConnections(callback: CbCallback): void; - getLogs(callback: CbCallback): void; -} - -interface Device { - user: APIUser; - URI: string; - systemKey: string; - systemSecret: string; - - getDeviceByName(name: string, callback: CbCallback): void; - updateDeviceByName( - name: string, - object: object, - trigger: boolean, - callback: CbCallback - ): void; - deleteDeviceByName(name: string, callback: CbCallback): void; - fetch(query: Query, callback: CbCallback): void; - update( - query: Query, - object: object, - trigger: boolean, - callback: CbCallback - ): void; - delete(query: Query, callback: CbCallback): void; - create(newDevice: object, callback: CbCallback): void; - columns(callback: CbCallback): void; - count(query: Query, callback: CbCallback): void; -} - -interface Analytics { - user: APIUser; - URI: string; - systemKey: string; - systemSecret: string; - - getStorage(filter: QueryFilter, callback: CbCallback): void; - getCount(filter: QueryFilter, callback: CbCallback): void; - getEventList(filter: QueryFilter, callback: CbCallback): void; - getEventTotals(filter: QueryFilter, callback: CbCallback): void; - getUserEvents(filter: QueryFilter, callback: CbCallback): void; -} - -interface Portal { - name: string; - user: APIUser; - URI: string; - systemKey: string; - systemSecret: string; - - fetch(callback: CbCallback): void; - update(data: object, callback: CbCallback): void; -} - -interface Triggers { - user: APIUser; - URI: string; - systemKey: string; - systemSecret: string; - - fetchDefinitions(callback: CbCallback): void; - create(name: string, data: object, callback: CbCallback): void; - update(name: string, data: object, callback: CbCallback): void; - delete(name: string, callback: CbCallback): void; -} - -declare var ClearBlade: ClearBladeGlobal; diff --git a/types/clearbladejs-server/clearbladejs-server-tests.ts b/types/clearbladejs-server/clearbladejs-server-tests.ts index d240f181ea..5fe134b5c4 100644 --- a/types/clearbladejs-server/clearbladejs-server-tests.ts +++ b/types/clearbladejs-server/clearbladejs-server-tests.ts @@ -3,7 +3,7 @@ // Definitions by: Jim Bouquet // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -const genericCallback = (error: boolean, response: Resp) => {}; +const genericCallback = (error: boolean, response: CbServer.Resp) => {}; /////////////////////////////////////// // ClearBlade object API invocations @@ -66,12 +66,12 @@ const device = ClearBlade.Device(); ClearBlade.addToQuery(query1, "key", "value"); ClearBlade.addSortToQuery( query1, - QuerySortDirections.QUERY_SORT_ASCENDING, + CbServer.QuerySortDirections.QUERY_SORT_ASCENDING, "column1" ); ClearBlade.addFilterToQuery( query1, - QueryConditions.QUERY_GREATERTHAN, + CbServer.QueryConditions.QUERY_GREATERTHAN, "key", "value" ); @@ -177,7 +177,7 @@ ClearBlade.Trigger.Create( { system_key: "key", name: "triggername", - def_module: TriggerModule.DEVICE, + def_module: CbServer.TriggerModule.DEVICE, def_name: "someName", key_value_pairs: [], service_name: "ServiceName" diff --git a/types/clearbladejs-server/global.d.ts b/types/clearbladejs-server/global.d.ts index d6e2e88a70..8276b9da44 100644 --- a/types/clearbladejs-server/global.d.ts +++ b/types/clearbladejs-server/global.d.ts @@ -1,5 +1,5 @@ declare global { - var ClearBlade: ClearBladeGlobal; + var ClearBlade: CbServer.ClearBladeGlobal; } export {}; diff --git a/types/clearbladejs-server/index.d.ts b/types/clearbladejs-server/index.d.ts index fb3ef065ce..2f6e8d672b 100644 --- a/types/clearbladejs-server/index.d.ts +++ b/types/clearbladejs-server/index.d.ts @@ -1,335 +1,422 @@ -// Type definitions for clearbladejs-server 1.0 +// Type definitions for clearbladejs-server 1.1 // Project: https://docs.clearblade.com/v/3/4-developer_reference/platformsdk/ClearBlade.js/ // Definitions by: Jim Bouquet // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 /// +declare namespace CbServer { + interface BasicReq { + readonly isLogging: boolean; + readonly params: { + [id: string]: any; + }; + readonly systemKey: string; + readonly systemSecret: string; + readonly userEmail: string; + readonly userToken: string; + readonly userid: string; + } + type ReqTypes = BasicReq; -interface BasicReq { - readonly isLogging: boolean; - readonly params: { - [id: string]: any; - }; - readonly systemKey: string; - readonly systemSecret: string; - readonly userEmail: string; - readonly userToken: string; - readonly userid: string; + let req: ReqTypes; + interface Resp { + error(msg: any): never; + success(msg: any): never; + } + let resp: Resp; + + enum MessagingQOS { + MESSAGING_QOS_AT_MOST_ONCE = 0, + MESSAGING_QOS_AT_LEAST_ONCE = 1, + MESSAGING_QOS_EXACTLY_ONCE = 2 + } + + interface InitOptions { + systemKey: string; + systemSecret: string; + logging?: boolean; + callback?: CbCallback; + authToken?: string; + userToken?: string; + email?: string; + password?: string; + registerUser?: boolean; + useUser?: APIUser; + URI?: string; + messagingURI?: string; + messagingPort?: number; + defaultQoS?: MessagingQOS; + callTimeout?: number; + } + + interface APIUser { + email: string; + authToken: string; + user_id?: string; + } + + interface KeyValuePair { + [key: string]: any; + } + + type CbCallback = (error: boolean, response: Resp) => void; + + interface ClearBladeGlobal extends ClearBladeInt { + user: APIUser; + } + + interface ClearBladeInt { + Trigger: TriggerClass; + Timer: TimerClass; + + about(): string; + addToQuery(queryObj: QueryObj, key: string, value: string): void; + addFilterToQuery( + queryObj: QueryObj, + condition: QueryConditions, + key: string, + value: QueryValue + ): void; + addSortToQuery( + queryObj: QueryObj, + direction: QuerySortDirections, + column: string + ): void; + Code(): Code; + Collection( + options: + | string + | CollectionOptionsWithName + | CollectionOptionsWithID + | CollectionOptionsWithCollection + ): Collection; + Deployment(): Deployment; + Device(): Device; + edgeId(): string; + execute(error: object, response: object, callback: CbCallback): any; + getAllCollections(callback: CbCallback): void; + http(): object; + init(options: InitOptions | { request: BasicReq }): void; + isEdge(callback: CbCallback): boolean; + isCurrentUserAuthenticated(callback: CbCallback): void; + isObjectEmpty(obj: object): boolean; + Item(data: object, options: string | ItemOptions): Item; + logger(message: string): void; + loginAnon(callback: CbCallback): void; + loginUser(email: string, password: string, callback: CbCallback): void; + logoutUser(callback: CbCallback): void; + makeKVPair(key: string, value: string): KeyValuePair; + Messaging(options: MessagingOptions, callback: CbCallback): Messaging; + newCollection(name: string, callback: CbCallback): void; + Query( + options: + | QueryOptionsWithCollection + | QueryOptionsWithName + | QueryOptionsWithID + ): QueryObj; + parseOperationQuery(query: Query): string; + parseQuery(query: Query | QueryObj): string; + registerUser( + email: string, + password: string, + callback: CbCallback + ): void; + setUser(email: string, authToken: string, userId: string): void; + User(): AppUser; + + createDevice( + name: string, + data: object, + causeTrigger: boolean, + callback: CbCallback + ): void; + deleteDevice( + name: string, + causeTrigger: boolean, + callback: CbCallback + ): void; + updateDevice( + name: string, + data: object, + causeTrigger: boolean, + callback: CbCallback + ): void; + getDeviceByName(name: string, callback: CbCallback): void; + getAllDevicesForSystem(callback: CbCallback): void; + validateEmailPassword(email: string, password: string): void; + } + + interface CollectionOptionsWithCollection { + collection: string; + } + + interface CollectionOptionsWithName { + collectionName: string; + } + + interface CollectionOptionsWithID { + collectionID: string; + } + + interface Collection { + user: APIUser; + URI: string; + systemKey: string; + systemSecret: string; + + addColumn(options: object, callback: CbCallback): void; + dropColumn(name: string, callback: CbCallback): void; + deleteCollection(callback: CbCallback): void; + fetch(query: Query, callback: CbCallback): void; + create(newItem: Item, callback: CbCallback): void; + update(query: Query, changes: object, callback: CbCallback): void; + remove(query: Query, callback: CbCallback): void; + columns(callback: CbCallback): void; + count(query: Query, callback: CbCallback): void; + } + + enum QuerySortDirections { + QUERY_SORT_ASCENDING = "ASC", + QUERY_SORT_DESCENDING = "DESC" + } + + enum QueryConditions { + QUERY_EQUAL = "EQ", + QUERY_NOTEQUAL = "NEQ", + QUERY_GREATERTHAN = "GT", + QUERY_GREATERTHAN_EQUAL = "GTE", + QUERY_LESSTHAN = "LT", + QUERY_LESSTHAN_EQUAL = "LTE", + QUERY_MATCHES = "RE" + } + + type QueryValue = string | number | boolean; + + interface QueryOptions { + offset?: number; + limit?: number; + } + + interface QueryOptionsWithCollection + extends CollectionOptionsWithCollection, + QueryOptions {} + + interface QueryOptionsWithName + extends CollectionOptionsWithName, + QueryOptions {} + + interface QueryOptionsWithID + extends CollectionOptionsWithID, + QueryOptions {} + + interface Query { + SELECTCOLUMNS?: string[]; + SORT?: QuerySortDirections; + FILTERS?: QueryFilter[]; + PAGESIZE?: number; + PAGENUM?: number; + } + + interface QueryFilter { + [QueryConditions: string]: QueryFilterValue; + } + + interface QueryFilterValue { + [name: string]: QueryValue; + } + + interface QueryObj { + id: string; + user: APIUser; + URI: string; + systemKey: string; + systemSecret: string; + query: Query; + OR: Query[]; + offset: number; + limit: number; + + ascending(field: string): void; + descending(field: string): void; + equalTo(field: string, value: QueryValue): void; + greaterThan(field: string, value: QueryValue): void; + greaterThanEqualTo(field: string, value: QueryValue): void; + lessThan(field: string, value: QueryValue): void; + lessThanEqualTo(field: string, value: QueryValue): void; + notEqualTo(field: string, value: QueryValue): void; + matches(field: string, pattern: QueryValue): void; + or(query: QueryObj): void; + setPage(pageSize: number, pageNum: number): void; + fetch(callback: CbCallback): void; + update(changes: object, callback: CbCallback): void; + columns(columnsArray: string[]): void; + remove(callback: CbCallback): void; + } + + interface ItemOptions extends CollectionOptionsWithID {} + + interface Item { + data: object; + + save(): void; + refresh(): void; + destroy(): void; + } + + interface Code { + user: APIUser; + systemKey: string; + systemSecret: string; + + execute( + name: string, + params: object, + loggingEnabled: boolean, + callback: CbCallback + ): void; + getAllServices(callback: CbCallback): void; + } + + interface DeploymentOptions {} + + interface Deployment { + user: APIUser; + systemKey: string; + systemSecret: string; + + create( + name: string, + description: string, + options: DeploymentOptions, + callback: CbCallback + ): void; + update( + name: string, + options: DeploymentOptions, + callback: CbCallback + ): void; + delete(name: string, callback: CbCallback): void; + read(name: string, callback: CbCallback): void; + readAll(query: QueryObj, callback: CbCallback): void; + } + + interface AppUser { + user: APIUser; + URI: string; + systemKey: string; + systemSecret: string; + + getUser(callback: CbCallback): void; + setUser(data: object, callback: CbCallback): void; + setUsers(query: QueryObj, data: object, callback: CbCallback): void; + allUsers(query: QueryObj, callback: CbCallback): void; + count(query: QueryObj, callback: CbCallback): void; + } + + interface Messaging { + user: APIUser; + systemKey: string; + systemSecret: string; + + getMessageHistoryWithTimeFrame( + topic: string, + count: number, + last: number, + start: number, + stop: number, + callback: CbCallback + ): void; + getMessageHistory( + topic: string, + start: number, + count: number, + callback: CbCallback + ): void; + getAndDeleteMessageHistory( + topic: string, + count: number, + last: number, + start: number, + stop: number, + callback: CbCallback + ): void; + getCurrentTopics(callback: CbCallback): void; + publish(topic: string, payload: string | ArrayBuffer): void; + } + + interface MessagingOptions {} + + interface Device { + URI: string; + systemKey: string; + systemSecret: string; + + fetch(query: Query, callback: CbCallback): void; + update(query: Query, changes: object, callback: CbCallback): void; + delete(query: Query, callback: CbCallback): void; + create(newDevice: object, callback: CbCallback): void; + } + + enum TriggerModule { + DEVICE = "Device", + Data = "Data", + MESSAGING = "Messaging", + USER = "User" + } + + interface TriggerCreateOptions { + system_key: string; + name: string; + def_module: TriggerModule; + def_name: string; + key_value_pairs: KeyValuePair[]; + service_name: string; + } + + interface TriggerClass { + Create( + name: string, + options: TriggerCreateOptions, + callback: CbCallback + ): void; + Fetch(name: string, callback: CbCallback): void; + } + + interface TimerCreateOptions { + description?: string; + start_time?: Date; + repeats?: number; + frequency?: number; + service_name?: string; + user_id?: string; + user_token?: string; + } + + interface TimerClass { + Create( + name: string, + options: TimerCreateOptions, + callback: CbCallback + ): void; + Fetch(name: string, callback: CbCallback): void; + } + + interface TriggerInstance { + name: string; + systemKey: string; + + Update(options: object, callback: CbCallback): void; + Delete(callback: CbCallback): void; + } + + interface TimerInstance { + name: string; + systemKey: string; + + Update(options: object, callback: CbCallback): void; + Delete(callback: CbCallback): void; + } + + let ClearBlade: ClearBladeGlobal; } -type ReqTypes = BasicReq; -declare var req: ReqTypes; -interface Resp { - error(msg: any): never; - success(msg: any): never; -} -declare var resp: Resp; - -declare enum MessagingQOS { - MESSAGING_QOS_AT_MOST_ONCE = 0, - MESSAGING_QOS_AT_LEAST_ONCE = 1, - MESSAGING_QOS_EXACTLY_ONCE = 2 -} - -interface InitOptions { - systemKey: string; - systemSecret: string; - logging?: boolean; - callback?: CbCallback; - authToken?: string; - userToken?: string; - email?: string; - password?: string; - registerUser?: boolean; - useUser?: APIUser; - URI?: string; - messagingURI?: string; - messagingPort?: number; - defaultQoS?: MessagingQOS; - callTimeout?: number; -} - -interface APIUser { - email: string; - authToken: string; - user_id?: string; -} - -interface KeyValuePair { - [key: string]: any; -} - -type CbCallback = (error: boolean, response: Resp) => void; - -interface ClearBladeGlobal extends ClearBladeInt { - user: APIUser; -} - -interface ClearBladeInt { - Trigger: TriggerClass; - Timer: TimerClass; - - about(): string; - addToQuery(queryObj: QueryObj, key: string, value: string): void; - addFilterToQuery(queryObj: QueryObj, condition: QueryConditions, key: string, value: QueryValue): void; - addSortToQuery(queryObj: QueryObj, direction: QuerySortDirections, column: string): void; - Code(): Code; - Collection(options: string | CollectionOptionsWithName | CollectionOptionsWithID | CollectionOptionsWithCollection): Collection; - Deployment(): Deployment; - Device(): Device; - edgeId(): string; - execute(error: object, response: object, callback: CbCallback): any; - getAllCollections(callback: CbCallback): void; - http(): object; - init(options: InitOptions | {request: BasicReq}): void; - isEdge(callback: CbCallback): boolean; - isCurrentUserAuthenticated(callback: CbCallback): void; - isObjectEmpty(obj: object): boolean; - Item(data: object, options: string | ItemOptions): Item; - logger(message: string): void; - loginAnon(callback: CbCallback): void; - loginUser(email: string, password: string, callback: CbCallback): void; - logoutUser(callback: CbCallback): void; - makeKVPair(key: string, value: string): KeyValuePair; - Messaging(options: MessagingOptions, callback: CbCallback): Messaging; - newCollection(name: string, callback: CbCallback): void; - Query(options: QueryOptionsWithCollection | QueryOptionsWithName | QueryOptionsWithID): QueryObj; - parseOperationQuery(query: Query): string; - parseQuery(query: Query | QueryObj): string; - registerUser(email: string, password: string, callback: CbCallback): void; - setUser(email: string, authToken: string, userId: string): void; - User(): AppUser; - - createDevice(name: string, data: object, causeTrigger: boolean, callback: CbCallback): void; - deleteDevice(name: string, causeTrigger: boolean, callback: CbCallback): void; - updateDevice(name: string, data: object, causeTrigger: boolean, callback: CbCallback): void; - getDeviceByName(name: string, callback: CbCallback): void; - getAllDevicesForSystem(callback: CbCallback): void; - validateEmailPassword(email: string, password: string): void; -} - -interface CollectionOptionsWithCollection { - collection: string; -} - -interface CollectionOptionsWithName { - collectionName: string; -} - -interface CollectionOptionsWithID { - collectionID: string; -} - -interface Collection { - user: APIUser; - URI: string; - systemKey: string; - systemSecret: string; - - addColumn(options: object, callback: CbCallback): void; - dropColumn(name: string, callback: CbCallback): void; - deleteCollection(callback: CbCallback): void; - fetch(query: Query, callback: CbCallback): void; - create(newItem: Item, callback: CbCallback): void; - update(query: Query, changes: object, callback: CbCallback): void; - remove(query: Query, callback: CbCallback): void; - columns(callback: CbCallback): void; - count(query: Query, callback: CbCallback): void; -} - -declare enum QuerySortDirections { - QUERY_SORT_ASCENDING = 'ASC', - QUERY_SORT_DESCENDING = 'DESC' -} - -declare enum QueryConditions { - QUERY_EQUAL = 'EQ', - QUERY_NOTEQUAL = 'NEQ', - QUERY_GREATERTHAN = 'GT', - QUERY_GREATERTHAN_EQUAL = 'GTE', - QUERY_LESSTHAN = 'LT', - QUERY_LESSTHAN_EQUAL = 'LTE', - QUERY_MATCHES = 'RE' -} - -type QueryValue = string|number|boolean; - -interface QueryOptions { - offset?: number; - limit?: number; -} - -interface QueryOptionsWithCollection extends CollectionOptionsWithCollection, QueryOptions {} - -interface QueryOptionsWithName extends CollectionOptionsWithName, QueryOptions {} - -interface QueryOptionsWithID extends CollectionOptionsWithID, QueryOptions {} - -interface Query { - SELECTCOLUMNS?: string[]; - SORT?: QuerySortDirections; - FILTERS?: QueryFilter[]; - PAGESIZE?: number; - PAGENUM?: number; -} - -interface QueryFilter { - [QueryConditions: string]: QueryFilterValue; -} - -interface QueryFilterValue { - [name: string]: QueryValue; -} - -interface QueryObj { - id: string; - user: APIUser; - URI: string; - systemKey: string; - systemSecret: string; - query: Query; - OR: Query[]; - offset: number; - limit: number; - - ascending(field: string): void; - descending(field: string): void; - equalTo(field: string, value: QueryValue): void; - greaterThan(field: string, value: QueryValue): void; - greaterThanEqualTo(field: string, value: QueryValue): void; - lessThan(field: string, value: QueryValue): void; - lessThanEqualTo(field: string, value: QueryValue): void; - notEqualTo(field: string, value: QueryValue): void; - matches(field: string, pattern: QueryValue): void; - or(query: QueryObj): void; - setPage(pageSize: number, pageNum: number): void; - fetch(callback: CbCallback): void; - update(changes: object, callback: CbCallback): void; - columns(columnsArray: string[]): void; - remove(callback: CbCallback): void; -} - -interface ItemOptions extends CollectionOptionsWithID {} - -interface Item { - data: object; - - save(): void; - refresh(): void; - destroy(): void; -} - -interface Code { - user: APIUser; - systemKey: string; - systemSecret: string; - - execute(name: string, params: object, loggingEnabled: boolean, callback: CbCallback): void; - getAllServices(callback: CbCallback): void; -} - -interface DeploymentOptions {} - -interface Deployment { - user: APIUser; - systemKey: string; - systemSecret: string; - - create(name: string, description: string, options: DeploymentOptions, callback: CbCallback): void; - update(name: string, options: DeploymentOptions, callback: CbCallback): void; - delete(name: string, callback: CbCallback): void; - read(name: string, callback: CbCallback): void; - readAll(query: QueryObj, callback: CbCallback): void; -} - -interface AppUser { - user: APIUser; - URI: string; - systemKey: string; - systemSecret: string; - - getUser(callback: CbCallback): void; - setUser(data: object, callback: CbCallback): void; - setUsers(query: QueryObj, data: object, callback: CbCallback): void; - allUsers(query: QueryObj, callback: CbCallback): void; - count(query: QueryObj, callback: CbCallback): void; -} - -interface Messaging { - user: APIUser; - systemKey: string; - systemSecret: string; - - getMessageHistoryWithTimeFrame(topic: string, count: number, last: number, start: number, stop: number, callback: CbCallback): void; - getMessageHistory(topic: string, start: number, count: number, callback: CbCallback): void; - getAndDeleteMessageHistory(topic: string, count: number, last: number, start: number, stop: number, callback: CbCallback): void; - getCurrentTopics(callback: CbCallback): void; - publish(topic: string, payload: string | ArrayBuffer): void; -} - -interface MessagingOptions {} - -interface Device { - URI: string; - systemKey: string; - systemSecret: string; - - fetch(query: Query, callback: CbCallback): void; - update(query: Query, changes: object, callback: CbCallback): void; - delete(query: Query, callback: CbCallback): void; - create(newDevice: object, callback: CbCallback): void; -} - -declare enum TriggerModule { - DEVICE = "Device", - Data = "Data", - MESSAGING = "Messaging", - USER = "User" -} - -interface TriggerCreateOptions { - system_key: string; - name: string; - def_module: TriggerModule; - def_name: string; - key_value_pairs: KeyValuePair[]; - service_name: string; -} - -interface TriggerClass { - Create(name: string, options: TriggerCreateOptions, callback: CbCallback): void; - Fetch(name: string, callback: CbCallback): void; -} - -interface TimerCreateOptions { - description?: string; - start_time?: Date; - repeats?: number; - frequency?: number; - service_name?: string; - user_id?: string; - user_token?: string; -} - -interface TimerClass { - Create(name: string, options: TimerCreateOptions, callback: CbCallback): void; - Fetch(name: string, callback: CbCallback): void; -} - -interface TriggerInstance { - name: string; - systemKey: string; - - Update(options: object, callback: CbCallback): void; - Delete(callback: CbCallback): void; -} - -interface TimerInstance { - name: string; - systemKey: string; - - Update(options: object, callback: CbCallback): void; - Delete(callback: CbCallback): void; -} - -declare var ClearBlade: ClearBladeGlobal; From fc0a7f609af8f0926718dd277ba6a8aa1da87a78 Mon Sep 17 00:00:00 2001 From: Zev Spitz Date: Mon, 21 May 2018 16:19:07 +0200 Subject: [PATCH 290/575] Fixes from autogenerated; default members; default value for parameters --- types/activex-access/index.d.ts | 739 +++++++++++-------------------- types/activex-access/tslint.json | 3 +- 2 files changed, 261 insertions(+), 481 deletions(-) diff --git a/types/activex-access/index.d.ts b/types/activex-access/index.d.ts index 4c531ea3ce..199fa22d36 100644 --- a/types/activex-access/index.d.ts +++ b/types/activex-access/index.d.ts @@ -2291,12 +2291,11 @@ declare namespace Access { Width: number; } - class _ItemsSelected { - private 'Access._ItemsSelected_typekey': _ItemsSelected; - private constructor(); + interface _ItemsSelected { readonly Count: number; IsMemberSafe(dispid: number): boolean; Item(Index: any): number; + (Index: any): number; } class _OptionButtonInOption { @@ -2746,9 +2745,7 @@ declare namespace Access { readonly Type: AcObjectType; } - class AccessObjectProperties { - private 'Access.AccessObjectProperties_typekey': AccessObjectProperties; - private constructor(); + interface AccessObjectProperties { Add(PropertyName: string, Value: any): void; readonly Application: Application; readonly Count: number; @@ -2756,6 +2753,7 @@ declare namespace Access { Item(Index: any): AccessObjectProperty; readonly Parent: any; Remove(Item: any): void; + (Index: any): AccessObjectProperty; } class AccessObjectProperty { @@ -2767,124 +2765,112 @@ declare namespace Access { Value: any; } - class AdditionalData { - private 'Access.AdditionalData_typekey': AdditionalData; - private constructor(); + interface AdditionalData { Add(var_0: string): AdditionalData; readonly Count: number; IsMemberSafe(dispid: number): boolean; Item(Index: any): AdditionalData; Name: string; + (Index: any): AdditionalData; } - class AllDataAccessPages { - private 'Access.AllDataAccessPages_typekey': AllDataAccessPages; - private constructor(); + interface AllDataAccessPages { readonly Application: Application; readonly Count: number; IsMemberSafe(dispid: number): boolean; Item(var_0: any): AccessObject; readonly Parent: any; + (var_0: any): AccessObject; } - class AllDatabaseDiagrams { - private 'Access.AllDatabaseDiagrams_typekey': AllDatabaseDiagrams; - private constructor(); + interface AllDatabaseDiagrams { readonly Application: Application; readonly Count: number; IsMemberSafe(dispid: number): boolean; Item(var_0: any): AccessObject; readonly Parent: any; + (var_0: any): AccessObject; } - class AllForms { - private 'Access.AllForms_typekey': AllForms; - private constructor(); + interface AllForms { readonly Application: Application; readonly Count: number; IsMemberSafe(dispid: number): boolean; Item(var_0: any): AccessObject; readonly Parent: any; + (var_0: any): AccessObject; } - class AllFunctions { - private 'Access.AllFunctions_typekey': AllFunctions; - private constructor(); + interface AllFunctions { readonly Application: Application; readonly Count: number; IsMemberSafe(dispid: number): boolean; Item(var_0: any): AccessObject; readonly Parent: any; + (var_0: any): AccessObject; } - class AllMacros { - private 'Access.AllMacros_typekey': AllMacros; - private constructor(); + interface AllMacros { readonly Application: Application; readonly Count: number; IsMemberSafe(dispid: number): boolean; Item(var_0: any): AccessObject; readonly Parent: any; + (var_0: any): AccessObject; } - class AllModules { - private 'Access.AllModules_typekey': AllModules; - private constructor(); + interface AllModules { readonly Application: Application; readonly Count: number; IsMemberSafe(dispid: number): boolean; Item(var_0: any): AccessObject; readonly Parent: any; + (var_0: any): AccessObject; } - class AllQueries { - private 'Access.AllQueries_typekey': AllQueries; - private constructor(); + interface AllQueries { readonly Application: Application; readonly Count: number; IsMemberSafe(dispid: number): boolean; Item(var_0: any): AccessObject; readonly Parent: any; + (var_0: any): AccessObject; } - class AllReports { - private 'Access.AllReports_typekey': AllReports; - private constructor(); + interface AllReports { readonly Application: Application; readonly Count: number; IsMemberSafe(dispid: number): boolean; Item(var_0: any): AccessObject; readonly Parent: any; + (var_0: any): AccessObject; } - class AllStoredProcedures { - private 'Access.AllStoredProcedures_typekey': AllStoredProcedures; - private constructor(); + interface AllStoredProcedures { readonly Application: Application; readonly Count: number; IsMemberSafe(dispid: number): boolean; Item(var_0: any): AccessObject; readonly Parent: any; + (var_0: any): AccessObject; } - class AllTables { - private 'Access.AllTables_typekey': AllTables; - private constructor(); + interface AllTables { readonly Application: Application; readonly Count: number; IsMemberSafe(dispid: number): boolean; Item(var_0: any): AccessObject; readonly Parent: any; + (var_0: any): AccessObject; } - class AllViews { - private 'Access.AllViews_typekey': AllViews; - private constructor(); + interface AllViews { readonly Application: Application; readonly Count: number; IsMemberSafe(dispid: number): boolean; Item(var_0: any): AccessObject; readonly Parent: any; + (var_0: any): AccessObject; } class Application { @@ -2915,45 +2901,41 @@ declare namespace Access { readonly COMAddIns: Office.COMAddIns; readonly CommandBars: Office.CommandBars; - /** @param boolean [LogFile=false] */ + /** @param LogFile [LogFile=false] */ CompactRepair(SourceFile: string, DestinationFile: string, LogFile?: boolean): boolean; ConvertAccessProject(SourceFilename: string, DestinationFilename: string, DestinationFileFormat: AcFileFormat): void; CreateAccessProject(filepath: string, Connect?: any): void; CreateAdditionalData(): AdditionalData; - /** @param Access.AcSection [Section=0] */ + /** @param Section [Section=0] */ CreateControl(FormName: string, ControlType: AcControlType, Section?: AcSection, Parent?: any, ColumnName?: any, Left?: any, Top?: any, Width?: any, Height?: any): Control; - CreateControlEx( - FormName: string, ControlType: AcControlType, Section: AcSection, Parent: string, ControlSource: string, Left: number, Top: number, Width: number, Height: number): Control; - CreateControlExOld( - FormName: string, ControlType: AcControlType, Section: AcSection, Parent: string, ControlSource: string, Left: number, Top: number, Width: number, Height: number): Control; + CreateControlEx(FormName: string, ControlType: AcControlType, Section: AcSection, Parent: string, ControlSource: string, Left: number, Top: number, Width: number, Height: number): Control; + CreateControlExOld(FormName: string, ControlType: AcControlType, Section: AcSection, Parent: string, ControlSource: string, Left: number, Top: number, Width: number, Height: number): Control; - /** @param Access.AcSection [Section=0] */ + /** @param Section [Section=0] */ CreateControlOld(FormName: string, ControlType: AcControlType, Section?: AcSection, Parent?: any, ColumnName?: any, Left?: any, Top?: any, Width?: any, Height?: any): Control; - /** @param boolean [CreateNewFile=true] */ + /** @param CreateNewFile [CreateNewFile=true] */ CreateDataAccessPage(FileName: any, CreateNewFile?: boolean): DataAccessPage; CreateForm(Database?: any, FormTemplate?: any): Form; CreateGroupLevel(ReportName: string, Expression: string, Header: number, Footer: number): number; /** - * @param string [Path=' '] - * @param string [Name=' '] - * @param string [Company=' '] - * @param string [WorkgroupID=' '] - * @param boolean [Replace=false] + * @param Path [Path=' '] + * @param Name [Name=' '] + * @param Company [Company=' '] + * @param WorkgroupID [WorkgroupID=' '] + * @param Replace [Replace=false] */ CreateNewWorkgroupFile(Path?: string, Name?: string, Company?: string, WorkgroupID?: string, Replace?: boolean): void; CreateReport(Database?: any, ReportTemplate?: any): Report; - /** @param Access.AcSection [Section=0] */ + /** @param Section [Section=0] */ CreateReportControl(ReportName: string, ControlType: AcControlType, Section?: AcSection, Parent?: any, ColumnName?: any, Left?: any, Top?: any, Width?: any, Height?: any): Control; - CreateReportControlEx( - ReportName: string, ControlType: AcControlType, Section: AcSection, Parent: string, ControlName: string, Left: number, Top: number, Width: number, Height: number): Control; - CreateReportControlExOld( - ReportName: string, ControlType: AcControlType, Section: AcSection, Parent: string, ControlName: string, Left: number, Top: number, Width: number, Height: number): Control; + CreateReportControlEx(ReportName: string, ControlType: AcControlType, Section: AcSection, Parent: string, ControlName: string, Left: number, Top: number, Width: number, Height: number): Control; + CreateReportControlExOld(ReportName: string, ControlType: AcControlType, Section: AcSection, Parent: string, ControlName: string, Left: number, Top: number, Width: number, Height: number): Control; - /** @param Access.AcSection [Section=0] */ + /** @param Section [Section=0] */ CreateReportControlOld(ReportName: string, ControlType: AcControlType, Section?: AcSection, Parent?: any, ColumnName?: any, Left?: any, Top?: any, Width?: any, Height?: any): Control; readonly CurrentData: CurrentData; CurrentDb(): DAO.Database; @@ -2991,54 +2973,49 @@ declare namespace Access { DVar(Expr: string, Domain: string, Criteria?: any): any; DVarP(Expr: string, Domain: string, Criteria?: any): any; - /** @param string [bstrStatusBarText=''] */ + /** @param bstrStatusBarText [bstrStatusBarText=''] */ Echo(EchoOn: number, bstrStatusBarText?: string): void; EuroConvert(Number: number, SourceCurrency: string, TargetCurrency: string, FullPrecision?: any, TriangulationPrecision?: any): number; Eval(StringExpr: string): any; /** - * @param boolean [SelectedRecords=false] - * @param number [FromPage=1] - * @param number [ToPage=-1] + * @param SelectedRecords [SelectedRecords=false] + * @param FromPage [FromPage=1] + * @param ToPage [ToPage=-1] */ - ExportCustomFixedFormat( - ExternalExporter: any, OutputFileName: string, ObjectName: string, ObjectType: AcOutputObjectType, SelectedRecords?: boolean, FromPage?: number, ToPage?: number): void; + ExportCustomFixedFormat(ExternalExporter: any, OutputFileName: string, ObjectName: string, ObjectType: AcOutputObjectType, SelectedRecords?: boolean, FromPage?: number, ToPage?: number): void; ExportNavigationPane(Path: string): void; /** - * @param string [DataTarget=''] - * @param string [SchemaTarget=''] - * @param string [PresentationTarget=''] - * @param string [ImageTarget=''] - * @param Access.AcExportXMLEncoding [Encoding=0] - * @param Access.AcExportXMLOtherFlags [OtherFlags=0] - * @param string [WhereCondition=''] + * @param DataTarget [DataTarget=''] + * @param SchemaTarget [SchemaTarget=''] + * @param PresentationTarget [PresentationTarget=''] + * @param ImageTarget [ImageTarget=''] + * @param Encoding [Encoding=0] + * @param OtherFlags [OtherFlags=0] + * @param WhereCondition [WhereCondition=''] */ - ExportXML( - ObjectType: AcExportXMLObjectType, DataSource: string, DataTarget?: string, SchemaTarget?: string, PresentationTarget?: string, ImageTarget?: string, - Encoding?: AcExportXMLEncoding, OtherFlags?: AcExportXMLOtherFlags, WhereCondition?: string, AdditionalData?: any): void; + ExportXML(ObjectType: AcExportXMLObjectType, DataSource: string, DataTarget?: string, SchemaTarget?: string, PresentationTarget?: string, ImageTarget?: string, Encoding?: AcExportXMLEncoding, OtherFlags?: AcExportXMLOtherFlags, WhereCondition?: string, AdditionalData?: any): void; /** - * @param string [DataTarget=''] - * @param string [SchemaTarget=''] - * @param string [PresentationTarget=''] - * @param string [ImageTarget=''] - * @param Access.AcExportXMLEncoding [Encoding=0] - * @param number [OtherFlags=0] + * @param DataTarget [DataTarget=''] + * @param SchemaTarget [SchemaTarget=''] + * @param PresentationTarget [PresentationTarget=''] + * @param ImageTarget [ImageTarget=''] + * @param Encoding [Encoding=0] + * @param OtherFlags [OtherFlags=0] */ - ExportXMLOld( - ObjectType: AcExportXMLObjectType, DataSource: string, DataTarget?: string, SchemaTarget?: string, PresentationTarget?: string, ImageTarget?: string, - Encoding?: AcExportXMLEncoding, OtherFlags?: number): void; + ExportXMLOld(ObjectType: AcExportXMLObjectType, DataSource: string, DataTarget?: string, SchemaTarget?: string, PresentationTarget?: string, ImageTarget?: string, Encoding?: AcExportXMLEncoding, OtherFlags?: number): void; FeatureInstall: Office.MsoFeatureInstall; FileDialog(dialogType: Office.MsoFileDialogType): Office.FileDialog; readonly FileSearch: Office.FileSearch; /** - * @param string [SubAddress=''] - * @param boolean [NewWindow=false] - * @param boolean [AddHistory=true] - * @param Office.MsoExtraInfoMethod [Method=0] - * @param string [HeaderInfo=''] + * @param SubAddress [SubAddress=''] + * @param NewWindow [NewWindow=false] + * @param AddHistory [AddHistory=true] + * @param Method [Method=0] + * @param HeaderInfo [HeaderInfo=''] */ FollowHyperlink(Address: string, SubAddress?: string, NewWindow?: boolean, AddHistory?: boolean, ExtraInfo?: any, Method?: Office.MsoExtraInfoMethod, HeaderInfo?: string): void; readonly Forms: Forms; @@ -3048,13 +3025,13 @@ declare namespace Access { HtmlEncode(PlainText: any, Length?: any): string; hWndAccessApp(): number; - /** @param Access.AcHyperlinkPart [Part=0] */ + /** @param Part [Part=0] */ HyperlinkPart(Hyperlink: any, Part?: AcHyperlinkPart): string; - /** @param boolean [fAppendOnly=false] */ + /** @param fAppendOnly [fAppendOnly=false] */ ImportNavigationPane(Path: string, fAppendOnly?: boolean): void; - /** @param Access.AcImportXMLOption [ImportOptions=1] */ + /** @param ImportOptions [ImportOptions=1] */ ImportXML(DataSource: string, ImportOptions?: AcImportXMLOption): void; InsertText(Text: string, ModuleName: string): void; InstantiateTemplate(Path: string): void; @@ -3076,25 +3053,25 @@ declare namespace Access { NewAccessProject(filepath: string, Connect?: any): void; /** - * @param Access.AcNewDatabaseFormat [FileFormat=0] - * @param string [SiteAddress=''] - * @param string [ListID=''] + * @param FileFormat [FileFormat=0] + * @param SiteAddress [SiteAddress=''] + * @param ListID [ListID=''] */ NewCurrentDatabase(filepath: string, FileFormat?: AcNewDatabaseFormat, Template?: any, SiteAddress?: string, ListID?: string): void; NewCurrentDatabaseOld(filepath: string): void; readonly NewFileTaskPane: Office.NewFile; Nz(Value: any, ValueIfNull?: any): any; - /** @param boolean [Exclusive=false] */ + /** @param Exclusive [Exclusive=false] */ OpenAccessProject(filepath: string, Exclusive?: boolean): void; /** - * @param boolean [Exclusive=false] - * @param string [bstrPassword=''] + * @param Exclusive [Exclusive=false] + * @param bstrPassword [bstrPassword=''] */ OpenCurrentDatabase(filepath: string, Exclusive?: boolean, bstrPassword?: string): void; - /** @param boolean [Exclusive=false] */ + /** @param Exclusive [Exclusive=false] */ OpenCurrentDatabaseOld(filepath: string, Exclusive?: boolean): void; readonly Parent: any; PlainText(RichText: any, Length?: any): string; @@ -3102,7 +3079,7 @@ declare namespace Access { readonly Printers: Printers; readonly ProductCode: string; - /** @param Access.AcQuitOption [Option=1] */ + /** @param Option [Option=1] */ Quit(Option?: AcQuitOption): void; readonly References: References; RefreshDatabaseWindow(): void; @@ -3111,15 +3088,10 @@ declare namespace Access { ReplaceModule(objtyp: number, ModuleName: string, FileName: string, token: number): void; readonly Reports: Reports; readonly ReturnVars: ReturnVars; - Run( - Procedure: string, Arg1?: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, - Arg12?: any, Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, - Arg24?: any, Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): any; + Run(Procedure: string, Arg1?: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): any; RunCommand(Command: AcCommand): void; SaveAsAXL(ObjectType: AcObjectType, ObjectName: string, FileName: string): void; - SaveAsTemplate( - Path: string, Title: string, IconPath: string, CoreTable: string, Category: string, PreviewPath?: any, Description?: any, InstantiationForm?: any, - ApplicationPart?: any, IncludeData?: any, Variation?: any): void; + SaveAsTemplate(Path: string, Title: string, IconPath: string, CoreTable: string, Category: string, PreviewPath?: any, Description?: any, InstantiationForm?: any, ApplicationPart?: any, IncludeData?: any, Variation?: any): void; SaveAsText(ObjectType: AcObjectType, ObjectName: string, FileName: string): void; readonly Screen: Screen; SetDefaultWorkgroupFile(Path: string): void; @@ -3132,8 +3104,8 @@ declare namespace Access { readonly TempVars: TempVars; /** - * @param boolean [WellFormedXMLOutput=false] - * @param Access.AcTransformXMLScriptOption [ScriptOption=1] + * @param WellFormedXMLOutput [WellFormedXMLOutput=false] + * @param ScriptOption [ScriptOption=1] */ TransformXML(DataSource: string, TransformSource: string, OutputTarget: string, WellFormedXMLOutput?: boolean, ScriptOption?: AcTransformXMLScriptOption): void; UserControl: boolean; @@ -3589,12 +3561,11 @@ declare namespace Access { Width: number; } - class Children { - private 'Access.Children_typekey': Children; - private constructor(); + interface Children { readonly Count: number; IsMemberSafe(dispid: number): boolean; Item(Index: any): any; + (Index: any): any; } class Class { @@ -4082,16 +4053,15 @@ declare namespace Access { VerticalAnchor: AcVerticalAnchor; } - class Controls { - private 'Access.Controls_typekey': Controls; - private constructor(); + interface Controls { readonly Application: Application; readonly Count: number; IsMemberSafe(dispid: number): boolean; // tslint:disable-next-line:no-unnecessary-generics - Item(index: number | string): T; - Item(Index: number | string): Control; + Item(Index: number | string): T; readonly Parent: any; + // tslint:disable-next-line:no-unnecessary-generics + (Index: number | string): T; } class CurrentData { @@ -4272,14 +4242,13 @@ declare namespace Access { readonly WindowWidth: number; } - class DataAccessPages { - private 'Access.DataAccessPages_typekey': DataAccessPages; - private constructor(); + interface DataAccessPages { readonly Application: Application; readonly Count: number; IsMemberSafe(dispid: number): boolean; Item(var_0: any): DataAccessPage; readonly Parent: any; + (var_0: any): DataAccessPage; } class DefaultWebOptions { @@ -4314,14 +4283,13 @@ declare namespace Access { readonly UnsupportedObjects: DependencyObjects; } - class DependencyObjects { - private 'Access.DependencyObjects_typekey': DependencyObjects; - private constructor(); + interface DependencyObjects { readonly Application: Application; readonly Count: number; IsMemberSafe(dispid: number): boolean; Item(Index: any): AccessObject; readonly Parent: any; + (Index: any): AccessObject; } class DoCmd { @@ -4332,41 +4300,41 @@ declare namespace Access { ApplyFilterOld0(FilterName?: any, WhereCondition?: any): void; Beep(): void; - /** @param Access.AcFormOpenDataMode [DataMode=1] */ + /** @param DataMode [DataMode=1] */ BrowseTo(ObjectType: AcBrowseToObjectType, ObjectName: any, PathtoSubformControl: any, WhereCondition: any, Page: any, DataMode?: AcFormOpenDataMode): void; CancelEvent(): void; ClearMacroError(): void; /** - * @param Access.AcObjectType [ObjectType=-1] - * @param Access.AcCloseSave [Save=0] + * @param ObjectType [ObjectType=-1] + * @param Save [Save=0] */ Close(ObjectType: AcObjectType, ObjectName: any, Save?: AcCloseSave): void; Close(): void; CloseDatabase(): void; CopyDatabaseFile(DatabaseFileName: any, OverwriteExistingFile?: any, DisconnectAllUsers?: any): void; - /** @param Access.AcObjectType [SourceObjectType=-1] */ + /** @param SourceObjectType [SourceObjectType=-1] */ CopyObject(DestinationDatabase: any, NewName: any, SourceObjectType?: AcObjectType, SourceObjectName?: any): void; - /** @param Access.AcObjectType [ObjectType=-1] */ + /** @param ObjectType [ObjectType=-1] */ DeleteObject(ObjectType?: AcObjectType, ObjectName?: any): void; DoMenuItem(MenuBar: any, MenuName: any, Command: any, Subcommand?: any, Version?: any): void; Echo(EchoOn: any, StatusBarText?: any): void; FindNext(): void; /** - * @param Access.AcFindMatch [Match=1] - * @param Access.AcSearchDirection [Search=2] - * @param Access.AcFindField [OnlyCurrentField=-1] + * @param Match [Match=1] + * @param Search [Search=2] + * @param OnlyCurrentField [OnlyCurrentField=-1] */ FindRecord(FindWhat: any, Match?: AcFindMatch, MatchCase?: any, Search?: AcSearchDirection, SearchAsFormatted?: any, OnlyCurrentField?: AcFindField, FindFirst?: any): void; GoToControl(ControlName: any): void; GoToPage(PageNumber: any, Right?: any, Down?: any): void; /** - * @param Access.AcDataObjectType [ObjectType=-1] - * @param Access.AcRecord [Record=1] + * @param ObjectType [ObjectType=-1] + * @param Record [Record=1] */ GoToRecord(ObjectType?: AcDataObjectType, ObjectName?: any, Record?: AcRecord, Offset?: any): void; Hourglass(HourglassOn: any): void; @@ -4376,76 +4344,76 @@ declare namespace Access { MoveSize(Right?: any, Down?: any, Width?: any, Height?: any): void; NavigateTo(Category?: any, Group?: any): void; - /** @param Access.AcDataAccessPageView [View=0] */ + /** @param View [View=0] */ OpenDataAccessPage(DataAccessPageName: any, View?: AcDataAccessPageView): void; OpenDiagram(DiagramName: any): void; /** - * @param Access.AcFormView [View=0] - * @param Access.AcFormOpenDataMode [DataMode=-1] - * @param Access.AcWindowMode [WindowMode=0] + * @param View [View=0] + * @param DataMode [DataMode=-1] + * @param WindowMode [WindowMode=0] */ OpenForm(FormName: any, View?: AcFormView, FilterName?: string, WhereCondition?: string, DataMode?: AcFormOpenDataMode, WindowMode?: AcWindowMode, OpenArgs?: string): void; /** - * @param Access.AcView [View=0] - * @param Access.AcOpenDataMode [DataMode=1] + * @param View [View=0] + * @param DataMode [DataMode=1] */ OpenFunction(FunctionName: any, View?: AcView, DataMode?: AcOpenDataMode): void; OpenModule(ModuleName?: any, ProcedureName?: any): void; /** - * @param Access.AcView [View=0] - * @param Access.AcOpenDataMode [DataMode=1] + * @param View [View=0] + * @param DataMode [DataMode=1] */ OpenQuery(QueryName: any, View?: AcView, DataMode?: AcOpenDataMode): void; /** - * @param Access.AcView [View=0] - * @param Access.AcWindowMode [WindowMode=0] + * @param View [View=0] + * @param WindowMode [WindowMode=0] */ OpenReport(ReportName: any, View?: AcView, FilterName?: string, WhereCondition?: string, WindowMode?: AcWindowMode, OpenArgs?: string): void; - /** @param Access.AcView [View=0] */ + /** @param View [View=0] */ OpenReportOld0(ReportName: any, View?: AcView, FilterName?: any, WhereCondition?: any): void; /** - * @param Access.AcView [View=0] - * @param Access.AcOpenDataMode [DataMode=1] + * @param View [View=0] + * @param DataMode [DataMode=1] */ OpenStoredProcedure(ProcedureName: any, View?: AcView, DataMode?: AcOpenDataMode): void; /** - * @param Access.AcView [View=0] - * @param Access.AcOpenDataMode [DataMode=1] + * @param View [View=0] + * @param DataMode [DataMode=1] */ OpenTable(TableName: any, View?: AcView, DataMode?: AcOpenDataMode): void; /** - * @param Access.AcView [View=0] - * @param Access.AcOpenDataMode [DataMode=1] + * @param View [View=0] + * @param DataMode [DataMode=1] */ OpenView(ViewName: any, View?: AcView, DataMode?: AcOpenDataMode): void; - /** @param Access.AcExportQuality [OutputQuality=0] */ + /** @param OutputQuality [OutputQuality=0] */ OutputTo(ObjectType: AcOutputObjectType, ObjectName: any, OutputFormat: any, OutputFile: any, AutoStart: any, TemplateFile: any, Encoding: any, OutputQuality?: AcExportQuality): void; OutputToOld0(ObjectType: AcOutputObjectType, ObjectName?: any, OutputFormat?: any, OutputFile?: any, AutoStart?: any, TemplateFile?: any): void; OutputToOld1(ObjectType: AcOutputObjectType, ObjectName?: any, OutputFormat?: any, OutputFile?: any, AutoStart?: any, TemplateFile?: any, Encoding?: any): void; /** - * @param Access.AcPrintRange [PrintRange=0] - * @param Access.AcPrintQuality [PrintQuality=0] + * @param PrintRange [PrintRange=0] + * @param PrintQuality [PrintQuality=0] */ PrintOut(PrintRange?: AcPrintRange, PageFrom?: any, PageTo?: any, PrintQuality?: AcPrintQuality, Copies?: any, CollateCopies?: any): void; - /** @param Access.AcQuitOption [Options=1] */ + /** @param Options [Options=1] */ Quit(Options?: AcQuitOption): void; RefreshRecord(): void; - /** @param Access.AcObjectType [ObjectType=-1] */ + /** @param ObjectType [ObjectType=-1] */ Rename(NewName: any, ObjectType?: AcObjectType, OldName?: any): void; - /** @param Access.AcObjectType [ObjectType=-1] */ + /** @param ObjectType [ObjectType=-1] */ RepaintObject(ObjectType?: AcObjectType, ObjectName?: any): void; Requery(ControlName?: any): void; Restore(): void; @@ -4455,50 +4423,48 @@ declare namespace Access { RunSavedImportExport(SavedImportExportName: any): void; RunSQL(SQLStatement: any, UseTransaction?: any): void; - /** @param Access.AcObjectType [ObjectType=-1] */ + /** @param ObjectType [ObjectType=-1] */ Save(ObjectType?: AcObjectType, ObjectName?: any): void; /** - * @param Access.AcDataObjectType [ObjectType=-1] - * @param Access.AcRecord [Record=2] + * @param ObjectType [ObjectType=-1] + * @param Record [Record=2] */ SearchForRecord(ObjectType?: AcDataObjectType, ObjectName?: any, Record?: AcRecord, WhereCondition?: any): void; SelectObject(ObjectType: AcObjectType, ObjectName?: any, InDatabaseWindow?: any): void; - /** @param Access.AcSendObjectType [ObjectType=-1] */ - SendObject( - ObjectType?: AcSendObjectType, ObjectName?: any, OutputFormat?: any, To?: any, Cc?: any, Bcc?: any, Subject?: any, MessageText?: any, EditMessage?: any, TemplateFile?: any): void; + /** @param ObjectType [ObjectType=-1] */ + SendObject(ObjectType?: AcSendObjectType, ObjectName?: any, OutputFormat?: any, To?: any, Cc?: any, Bcc?: any, Subject?: any, MessageText?: any, EditMessage?: any, TemplateFile?: any): void; SetDisplayedCategories(Show: any, Category?: any): void; SetFilter(FilterName?: any, WhereCondition?: any, ControlName?: any): void; SetMenuItem(MenuIndex: any, CommandIndex?: any, SubcommandIndex?: any, Flag?: any): void; SetOrderBy(OrderBy: any, ControlName?: any): void; SetParameter(Name: any, Expression: any): void; - /** @param Access.AcProperty [Property=0] */ + /** @param Property [Property=0] */ SetProperty(ControlName: any, Property?: AcProperty, Value?: any): void; SetWarnings(WarningsOn: any): void; ShowAllRecords(): void; - /** @param Access.AcShowToolbar [Show=0] */ + /** @param Show [Show=0] */ ShowToolbar(ToolbarName: any, Show?: AcShowToolbar): void; SingleStep(): void; /** - * @param Access.AcDataTransferType [TransferType=0] - * @param Access.AcObjectType [ObjectType=0] + * @param TransferType [TransferType=0] + * @param ObjectType [ObjectType=0] */ - TransferDatabase( - TransferType?: AcDataTransferType, DatabaseType?: any, DatabaseName?: any, ObjectType?: AcObjectType, Source?: any, Destination?: any, StructureOnly?: any, StoreLogin?: any): void; + TransferDatabase(TransferType?: AcDataTransferType, DatabaseType?: any, DatabaseName?: any, ObjectType?: AcObjectType, Source?: any, Destination?: any, StructureOnly?: any, StoreLogin?: any): void; TransferSharePointList(TransferType: AcSharePointListTransferType, SiteAddress: any, ListID: any, ViewID?: any, TableName?: any, GetLookupDisplayValues?: any): void; /** - * @param Access.AcDataTransferType [TransferType=0] - * @param Access.AcSpreadSheetType [SpreadsheetType=10] + * @param TransferType [TransferType=0] + * @param SpreadsheetType [SpreadsheetType=10] */ TransferSpreadsheet(TransferType?: AcDataTransferType, SpreadsheetType?: AcSpreadSheetType, TableName?: any, FileName?: any, HasFieldNames?: any, Range?: any, UseOA?: any): void; TransferSQLDatabase(Server: any, Database: any, UseTrustedConnection?: any, Login?: any, Password?: any, TransferCopyData?: any): void; - /** @param Access.AcTextTransferType [TransferType=0] */ + /** @param TransferType [TransferType=0] */ TransferText(TransferType?: AcTextTransferType, SpecificationName?: any, TableName?: any, FileName?: any, HasFieldNames?: any, HTMLTableName?: any, CodePage?: any): void; } @@ -4578,13 +4544,12 @@ declare namespace Access { Width: number; } - class Entities { - private 'Access.Entities_typekey': Entities; - private constructor(); + interface Entities { readonly Count: number; IsMemberSafe(dispid: number): boolean; Item(Index: any): Entity; readonly Parent: any; + (Index: any): Entity; } class Entity { @@ -4733,8 +4698,8 @@ declare namespace Access { FrozenColumns: number; /** - * @param number [Right=0] - * @param number [Down=0] + * @param Right [Right=0] + * @param Down [Down=0] */ GoToPage(PageNumber: number, Right?: number, Down?: number): void; GridX: number; @@ -4933,7 +4898,7 @@ declare namespace Access { LongestBarLimit: AcFormatBarLimits; LongestBarValue: string; - /** @param Access.AcFormatConditionOperator [Operator=0] */ + /** @param Operator [Operator=0] */ Modify(Type: AcFormatConditionType, Operator?: AcFormatConditionOperator, Expression1?: any, Expression2?: any): void; readonly Operator: AcFormatConditionOperator; ShortestBarLimit: AcFormatBarLimits; @@ -4942,11 +4907,8 @@ declare namespace Access { readonly Type: AcFormatConditionType; } - class FormatConditions { - private 'Access.FormatConditions_typekey': FormatConditions; - private constructor(); - - /** @param Access.AcFormatConditionOperator [Operator=0] */ + interface FormatConditions { + /** @param Operator [Operator=0] */ Add(Type: AcFormatConditionType, Operator?: AcFormatConditionOperator, Expression1?: any, Expression2?: any): FormatCondition; readonly Application: Application; readonly Count: number; @@ -4954,6 +4916,7 @@ declare namespace Access { IsMemberSafe(dispid: number): boolean; Item(Index: any): FormatCondition; readonly Parent: any; + (Index: any): FormatCondition; } class FormOld { @@ -5037,8 +5000,8 @@ declare namespace Access { FrozenColumns: number; /** - * @param number [Right=0] - * @param number [Down=0] + * @param Right [Right=0] + * @param Down [Down=0] */ GoToPage(PageNumber: number, Right?: number, Down?: number): void; GridX: number; @@ -5264,8 +5227,8 @@ declare namespace Access { FrozenColumns: number; /** - * @param number [Right=0] - * @param number [Down=0] + * @param Right [Right=0] + * @param Down [Down=0] */ GoToPage(PageNumber: number, Right?: number, Down?: number): void; GridX: number; @@ -5403,14 +5366,13 @@ declare namespace Access { ZoomControl: number; } - class Forms { - private 'Access.Forms_typekey': Forms; - private constructor(); + interface Forms { readonly Application: Application; readonly Count: number; IsMemberSafe(dispid: number): boolean; Item(Index: number | string): Form; readonly Parent: any; + (Index: number | string): Form; } class GroupLevel { @@ -5438,10 +5400,10 @@ declare namespace Access { EmailSubject: string; /** - * @param boolean [NewWindow=false] - * @param boolean [AddHistory=true] - * @param Office.MsoExtraInfoMethod [Method=0] - * @param string [HeaderInfo=''] + * @param NewWindow [NewWindow=false] + * @param AddHistory [AddHistory=true] + * @param Method [Method=0] + * @param HeaderInfo [HeaderInfo=''] */ Follow(NewWindow?: boolean, AddHistory?: boolean, ExtraInfo?: any, Method?: Office.MsoExtraInfoMethod, HeaderInfo?: string): void; IsMemberSafe(dispid: number): boolean; @@ -5555,15 +5517,15 @@ declare namespace Access { XML: string; } - class ImportExportSpecifications { - private 'Access.ImportExportSpecifications_typekey': ImportExportSpecifications; - private constructor(); + // tslint:disable-next-line:interface-name + interface ImportExportSpecifications { Add(Name: string, SpecificationDefinition: string): ImportExportSpecification; readonly Application: Application; readonly Count: number; IsMemberSafe(dispid: number): boolean; Item(Index: any): ImportExportSpecification; readonly Parent: any; + (Index: any): ImportExportSpecification; } class Label { @@ -5910,15 +5872,14 @@ declare namespace Access { Value: any; } - class LocalVars { - private 'Access.LocalVars_typekey': LocalVars; - private constructor(); + interface LocalVars { Add(Name: string, Value: any): void; readonly Application: Application; readonly Count: number; IsMemberSafe(dispid: number): boolean; Item(Index: any): LocalVar; readonly Parent: any; + (Index: any): LocalVar; } class MacroError { @@ -5945,9 +5906,9 @@ declare namespace Access { DeleteLines(StartLine: number, Count: number): void; /** - * @param boolean [WholeWord=false] - * @param boolean [MatchCase=false] - * @param boolean [PatternSearch=false] + * @param WholeWord [WholeWord=false] + * @param MatchCase [MatchCase=false] + * @param PatternSearch [PatternSearch=false] */ Find(Target: string, StartLine: number, StartColumn: number, EndLine: number, EndColumn: number, WholeWord?: boolean, MatchCase?: boolean, PatternSearch?: boolean): boolean; InsertLines(Line: number, String: string): void; @@ -5964,14 +5925,13 @@ declare namespace Access { readonly Type: AcModuleType; } - class Modules { - private 'Access.Modules_typekey': Modules; - private constructor(); + interface Modules { readonly Application: Application; readonly Count: number; IsMemberSafe(dispid: number): boolean; Item(Index: any): Module; readonly Parent: any; + (Index: any): Module; } class NavigationButton { @@ -6427,7 +6387,7 @@ declare namespace Access { private 'Access.Operation_typekey': Operation; private constructor(); - /** @param string [bstrParameters=''] */ + /** @param bstrParameters [bstrParameters=''] */ Execute(bstrParameters?: string): any; IsMemberSafe(dispid: number): boolean; readonly Name: string; @@ -6435,13 +6395,12 @@ declare namespace Access { readonly WSParameters: WSParameters; } - class Operations { - private 'Access.Operations_typekey': Operations; - private constructor(); + interface Operations { readonly Count: number; IsMemberSafe(dispid: number): boolean; Item(Index: any): Operation; readonly Parent: any; + (Index: any): Operation; } class OptionButton { @@ -6779,14 +6738,13 @@ declare namespace Access { Visible: boolean; } - class Pages { - private 'Access.Pages_typekey': Pages; - private constructor(); + interface Pages { Add(Before?: any): Page; readonly Count: number; IsMemberSafe(dispid: number): boolean; Item(Index: any): Page; Remove(Item?: any): void; + (Index: any): Page; } class PaletteButton { @@ -6903,24 +6861,22 @@ declare namespace Access { TopMargin: number; } - class Printers { - private 'Access.Printers_typekey': Printers; - private constructor(); + interface Printers { readonly Application: Application; readonly Count: number; IsMemberSafe(dispid: number): boolean; Item(Index: any): Printer; readonly Parent: any; + (Index: any): Printer; } - class Properties { - private 'Access.Properties_typekey': Properties; - private constructor(); + interface Properties { readonly Application: Application; readonly Count: number; IsMemberSafe(dispid: number): boolean; Item(Index: any): any; readonly Parent: any; + (Index: any): any; } class Rectangle { @@ -6991,9 +6947,7 @@ declare namespace Access { readonly Name: string; } - class References { - private 'Access.References_typekey': References; - private constructor(); + interface References { AddFromFile(FileName: string): Reference; AddFromGuid(Guid: string, Major: number, Minor: number): Reference; readonly Count: number; @@ -7001,6 +6955,7 @@ declare namespace Access { Item(var_0: any): Reference; readonly Parent: any; Remove(Reference: Reference): void; + (var_0: any): Reference; } class Report { @@ -7445,14 +7400,13 @@ declare namespace Access { ZoomControl: number; } - class Reports { - private 'Access.Reports_typekey': Reports; - private constructor(); + interface Reports { readonly Application: Application; readonly Count: number; IsMemberSafe(dispid: number): boolean; Item(Index: any): Report; readonly Parent: any; + (Index: any): Report; } class ReturnVar { @@ -7464,14 +7418,13 @@ declare namespace Access { readonly Value: any; } - class ReturnVars { - private 'Access.ReturnVars_typekey': ReturnVars; - private constructor(); + interface ReturnVars { readonly Application: Application; readonly Count: number; IsMemberSafe(dispid: number): boolean; Item(Index: any): ReturnVar; readonly Parent: any; + (Index: any): ReturnVar; } class Screen { @@ -7554,14 +7507,13 @@ declare namespace Access { readonly Type: AcResourceType; } - class SharedResources { - private 'Access.SharedResources_typekey': SharedResources; - private constructor(); + interface SharedResources { readonly Application: Application; readonly Count: number; IsMemberSafe(dispid: number): boolean; Item(Index: number): SharedResource; readonly Parent: any; + (Index: number): SharedResource; } class SmartTag { @@ -7588,25 +7540,23 @@ declare namespace Access { readonly Parent: any; } - class SmartTagActions { - private 'Access.SmartTagActions_typekey': SmartTagActions; - private constructor(); + interface SmartTagActions { readonly Application: Application; readonly Count: number; IsMemberSafe(dispid: number): boolean; Item(Index: any): SmartTagAction; readonly Parent: any; + (Index: any): SmartTagAction; } - class SmartTagProperties { - private 'Access.SmartTagProperties_typekey': SmartTagProperties; - private constructor(); + interface SmartTagProperties { Add(Name: string, Value: any): SmartTagProperty; readonly Application: Application; readonly Count: number; IsMemberSafe(dispid: number): boolean; Item(Index: any): SmartTagProperty; readonly Parent: any; + (Index: any): SmartTagProperty; } class SmartTagProperty { @@ -7618,15 +7568,14 @@ declare namespace Access { Value: string; } - class SmartTags { - private 'Access.SmartTags_typekey': SmartTags; - private constructor(); + interface SmartTags { Add(Name: string): SmartTag; readonly Application: Application; readonly Count: number; IsMemberSafe(dispid: number): boolean; Item(Index: any): SmartTag; readonly Parent: any; + (Index: any): SmartTag; } class SubForm { @@ -7887,9 +7836,7 @@ declare namespace Access { Value: any; } - class TempVars { - private 'Access.TempVars_typekey': TempVars; - private constructor(); + interface TempVars { Add(Name: string, Value: any): void; readonly Application: Application; readonly Count: number; @@ -7898,6 +7845,7 @@ declare namespace Access { readonly Parent: any; Remove(var_0: any): void; RemoveAll(): void; + (Index: any): TempVar; } class TextBox { @@ -8417,14 +8365,13 @@ declare namespace Access { readonly Parent: any; } - class WebServices { - private 'Access.WebServices_typekey': WebServices; - private constructor(); + interface WebServices { readonly Application: Application; readonly Count: number; IsMemberSafe(dispid: number): boolean; Item(Index: any): WebService; readonly Parent: any; + (Index: any): WebService; } class WizHook { @@ -8460,12 +8407,8 @@ declare namespace Access { GetColumns(bstrBase: string): string; GetCurrentView(bstrTableName: string): number; GetDisabledExtensions(): string; - GetFileName( - hwndOwner: number, AppName: string, DlgTitle: string, OpenTitle: string, File: string, InitialDir: string, Filter: string, FilterIndex: number, View: number, - flags: number, fOpen: boolean): number; - GetFileName2( - hwndOwner: number, AppName: string, DlgTitle: string, OpenTitle: string, File: string, InitialDir: string, Filter: string, FilterIndex: number, View: number, - flags: number, fOpen: boolean, fFileSystem: any): number; + GetFileName(hwndOwner: number, AppName: string, DlgTitle: string, OpenTitle: string, File: string, InitialDir: string, Filter: string, FilterIndex: number, View: number, flags: number, fOpen: boolean): number; + GetFileName2(hwndOwner: number, AppName: string, DlgTitle: string, OpenTitle: string, File: string, InitialDir: string, Filter: string, FilterIndex: number, View: number, flags: number, fOpen: boolean, fFileSystem: any): number; GetFileOdso(bstrExt: string, bstrFilename: string): number; GetImexTblName(): string; GetInfoForColumns(bstrBase: string): string; @@ -8515,13 +8458,12 @@ declare namespace Access { readonly Type: number; } - class WSParameters { - private 'Access.WSParameters_typekey': WSParameters; - private constructor(); + interface WSParameters { readonly Count: number; IsMemberSafe(dispid: number): boolean; Item(Index: any): WSParameter; readonly Parent: any; + (Index: any): WSParameter; } namespace EventHelperTypes { @@ -8543,71 +8485,45 @@ interface ActiveXObject { on(obj: Access._CheckBoxInOption, event: 'BeforeUpdate' | 'DblClick' | 'Exit', argNames: ['Cancel'], handler: (this: Access._CheckBoxInOption, parameter: {Cancel: number}) => void): void; on(obj: Access._CheckBoxInOption, event: 'KeyDown' | 'KeyUp', argNames: ['KeyCode', 'Shift'], handler: (this: Access._CheckBoxInOption, parameter: {KeyCode: number, Shift: number}) => void): void; on(obj: Access._CheckBoxInOption, event: 'KeyPress', argNames: ['KeyAscii'], handler: (this: Access._CheckBoxInOption, parameter: {KeyAscii: number}) => void): void; - on( - obj: Access._CheckBoxInOption, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: ( - this: Access._CheckBoxInOption, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; + on(obj: Access._CheckBoxInOption, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: (this: Access._CheckBoxInOption, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; on(obj: Access._OptionButtonInOption, event: 'BeforeUpdate' | 'DblClick' | 'Exit', argNames: ['Cancel'], handler: (this: Access._OptionButtonInOption, parameter: {Cancel: number}) => void): void; - on( - obj: Access._OptionButtonInOption, event: 'KeyDown' | 'KeyUp', argNames: ['KeyCode', 'Shift'], handler: ( - this: Access._OptionButtonInOption, parameter: {KeyCode: number, Shift: number}) => void): void; + on(obj: Access._OptionButtonInOption, event: 'KeyDown' | 'KeyUp', argNames: ['KeyCode', 'Shift'], handler: (this: Access._OptionButtonInOption, parameter: {KeyCode: number, Shift: number}) => void): void; on(obj: Access._OptionButtonInOption, event: 'KeyPress', argNames: ['KeyAscii'], handler: (this: Access._OptionButtonInOption, parameter: {KeyAscii: number}) => void): void; - on( - obj: Access._OptionButtonInOption, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], - handler: (this: Access._OptionButtonInOption, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; + on(obj: Access._OptionButtonInOption, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: (this: Access._OptionButtonInOption, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; on(obj: Access._PageHdrFtrInReport, event: 'DblClick', argNames: ['Cancel'], handler: (this: Access._PageHdrFtrInReport, parameter: {Cancel: number}) => void): void; - on( - obj: Access._PageHdrFtrInReport, event: 'Format', argNames: ['Cancel', 'FormatCount'], handler: ( - this: Access._PageHdrFtrInReport, parameter: {Cancel: number, FormatCount: number}) => void): void; - on( - obj: Access._PageHdrFtrInReport, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: ( - this: Access._PageHdrFtrInReport, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; + on(obj: Access._PageHdrFtrInReport, event: 'Format', argNames: ['Cancel', 'FormatCount'], handler: (this: Access._PageHdrFtrInReport, parameter: {Cancel: number, FormatCount: number}) => void): void; + on(obj: Access._PageHdrFtrInReport, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: (this: Access._PageHdrFtrInReport, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; on(obj: Access._PageHdrFtrInReport, event: 'Print', argNames: ['Cancel', 'PrintCount'], handler: (this: Access._PageHdrFtrInReport, parameter: {Cancel: number, PrintCount: number}) => void): void; on(obj: Access._SectionInReport, event: 'DblClick', argNames: ['Cancel'], handler: (this: Access._SectionInReport, parameter: {Cancel: number}) => void): void; on(obj: Access._SectionInReport, event: 'Format', argNames: ['Cancel', 'FormatCount'], handler: (this: Access._SectionInReport, parameter: {Cancel: number, FormatCount: number}) => void): void; - on( - obj: Access._SectionInReport, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: ( - this: Access._SectionInReport, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; + on(obj: Access._SectionInReport, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: (this: Access._SectionInReport, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; on(obj: Access._SectionInReport, event: 'Print', argNames: ['Cancel', 'PrintCount'], handler: (this: Access._SectionInReport, parameter: {Cancel: number, PrintCount: number}) => void): void; on(obj: Access._ToggleButtonInOption, event: 'BeforeUpdate' | 'DblClick' | 'Exit', argNames: ['Cancel'], handler: (this: Access._ToggleButtonInOption, parameter: {Cancel: number}) => void): void; - on( - obj: Access._ToggleButtonInOption, event: 'KeyDown' | 'KeyUp', argNames: ['KeyCode', 'Shift'], handler: ( - this: Access._ToggleButtonInOption, parameter: {KeyCode: number, Shift: number}) => void): void; + on(obj: Access._ToggleButtonInOption, event: 'KeyDown' | 'KeyUp', argNames: ['KeyCode', 'Shift'], handler: (this: Access._ToggleButtonInOption, parameter: {KeyCode: number, Shift: number}) => void): void; on(obj: Access._ToggleButtonInOption, event: 'KeyPress', argNames: ['KeyAscii'], handler: (this: Access._ToggleButtonInOption, parameter: {KeyAscii: number}) => void): void; - on( - obj: Access._ToggleButtonInOption, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], - handler: (this: Access._ToggleButtonInOption, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; + on(obj: Access._ToggleButtonInOption, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: (this: Access._ToggleButtonInOption, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; on(obj: Access.Attachment, event: 'BeforeUpdate' | 'DblClick' | 'Dirty' | 'Exit', argNames: ['Cancel'], handler: (this: Access.Attachment, parameter: {Cancel: number}) => void): void; on(obj: Access.Attachment, event: 'KeyDown' | 'KeyUp', argNames: ['KeyCode', 'Shift'], handler: (this: Access.Attachment, parameter: {KeyCode: number, Shift: number}) => void): void; on(obj: Access.Attachment, event: 'KeyPress', argNames: ['KeyAscii'], handler: (this: Access.Attachment, parameter: {KeyAscii: number}) => void): void; - on( - obj: Access.Attachment, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: ( - this: Access.Attachment, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; + on(obj: Access.Attachment, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: (this: Access.Attachment, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; on(obj: Access.BoundObjectFrame, event: 'BeforeUpdate' | 'DblClick' | 'Exit', argNames: ['Cancel'], handler: (this: Access.BoundObjectFrame, parameter: {Cancel: number}) => void): void; on(obj: Access.BoundObjectFrame, event: 'KeyDown' | 'KeyUp', argNames: ['KeyCode', 'Shift'], handler: (this: Access.BoundObjectFrame, parameter: {KeyCode: number, Shift: number}) => void): void; on(obj: Access.BoundObjectFrame, event: 'KeyPress', argNames: ['KeyAscii'], handler: (this: Access.BoundObjectFrame, parameter: {KeyAscii: number}) => void): void; - on( - obj: Access.BoundObjectFrame, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: ( - this: Access.BoundObjectFrame, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; + on(obj: Access.BoundObjectFrame, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: (this: Access.BoundObjectFrame, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; on(obj: Access.BoundObjectFrame, event: 'Updated', argNames: ['Code'], handler: (this: Access.BoundObjectFrame, parameter: {Code: number}) => void): void; on(obj: Access.CheckBox, event: 'BeforeUpdate' | 'DblClick' | 'Exit', argNames: ['Cancel'], handler: (this: Access.CheckBox, parameter: {Cancel: number}) => void): void; on(obj: Access.CheckBox, event: 'KeyDown' | 'KeyUp', argNames: ['KeyCode', 'Shift'], handler: (this: Access.CheckBox, parameter: {KeyCode: number, Shift: number}) => void): void; on(obj: Access.CheckBox, event: 'KeyPress', argNames: ['KeyAscii'], handler: (this: Access.CheckBox, parameter: {KeyAscii: number}) => void): void; - on( - obj: Access.CheckBox, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: ( - this: Access.CheckBox, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; + on(obj: Access.CheckBox, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: (this: Access.CheckBox, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; on(obj: Access.ComboBox, event: 'BeforeUpdate' | 'DblClick' | 'Dirty' | 'Exit' | 'Undo', argNames: ['Cancel'], handler: (this: Access.ComboBox, parameter: {Cancel: number}) => void): void; on(obj: Access.ComboBox, event: 'KeyDown' | 'KeyUp', argNames: ['KeyCode', 'Shift'], handler: (this: Access.ComboBox, parameter: {KeyCode: number, Shift: number}) => void): void; on(obj: Access.ComboBox, event: 'KeyPress', argNames: ['KeyAscii'], handler: (this: Access.ComboBox, parameter: {KeyAscii: number}) => void): void; - on( - obj: Access.ComboBox, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: ( - this: Access.ComboBox, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; + on(obj: Access.ComboBox, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: (this: Access.ComboBox, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; on(obj: Access.ComboBox, event: 'NotInList', argNames: ['NewData', 'Response'], handler: (this: Access.ComboBox, parameter: {NewData: string, Response: number}) => void): void; on(obj: Access.CommandButton, event: 'DblClick' | 'Exit', argNames: ['Cancel'], handler: (this: Access.CommandButton, parameter: {Cancel: number}) => void): void; on(obj: Access.CommandButton, event: 'KeyDown' | 'KeyUp', argNames: ['KeyCode', 'Shift'], handler: (this: Access.CommandButton, parameter: {KeyCode: number, Shift: number}) => void): void; on(obj: Access.CommandButton, event: 'KeyPress', argNames: ['KeyAscii'], handler: (this: Access.CommandButton, parameter: {KeyAscii: number}) => void): void; - on( - obj: Access.CommandButton, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: ( - this: Access.CommandButton, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; + on(obj: Access.CommandButton, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: (this: Access.CommandButton, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; on(obj: Access.CustomControl, event: 'Exit', argNames: ['Cancel'], handler: (this: Access.CustomControl, parameter: {Cancel: number}) => void): void; on(obj: Access.CustomControl, event: 'Updated', argNames: ['Code'], handler: (this: Access.CustomControl, parameter: {Code: number}) => void): void; on(obj: Access.Form, event: 'AfterDelConfirm', argNames: ['Status'], handler: (this: Access.Form, parameter: {Status: number}) => void): void; @@ -8615,16 +8531,9 @@ interface ActiveXObject { on(obj: Access.Form, event: 'AfterRender', argNames: ['drawObject', 'chartObject'], handler: (this: Access.Form, parameter: {readonly drawObject: any, readonly chartObject: any}) => void): void; on(obj: Access.Form, event: 'ApplyFilter', argNames: ['Cancel', 'ApplyType'], handler: (this: Access.Form, parameter: {Cancel: number, ApplyType: number}) => void): void; on(obj: Access.Form, event: 'BeforeDelConfirm', argNames: ['Cancel', 'Response'], handler: (this: Access.Form, parameter: {Cancel: number, Response: number}) => void): void; - on( - obj: Access.Form, event: 'BeforeInsert' | 'BeforeUpdate' | 'BeginBatchEdit' | 'DblClick' | 'Delete' | 'Dirty' | 'Open' | 'RecordExit' | 'Undo' | 'UndoBatchEdit' | - 'Unload', - argNames: ['Cancel'], handler: (this: Access.Form, parameter: {Cancel: number}) => void): void; - on( - obj: Access.Form, event: 'BeforeRender', argNames: ['drawObject', 'chartObject', 'Cancel'], handler: ( - this: Access.Form, parameter: {readonly drawObject: any, readonly chartObject: any, readonly Cancel: any}) => void): void; - on( - obj: Access.Form, event: 'BeforeScreenTip', argNames: ['ScreenTipText', 'SourceObject'], handler: ( - this: Access.Form, parameter: {readonly ScreenTipText: any, readonly SourceObject: any}) => void): void; + on(obj: Access.Form, event: 'BeforeInsert' | 'BeforeUpdate' | 'BeginBatchEdit' | 'DblClick' | 'Delete' | 'Dirty' | 'Open' | 'RecordExit' | 'Undo' | 'UndoBatchEdit' | 'Unload', argNames: ['Cancel'], handler: (this: Access.Form, parameter: {Cancel: number}) => void): void; + on(obj: Access.Form, event: 'BeforeRender', argNames: ['drawObject', 'chartObject', 'Cancel'], handler: (this: Access.Form, parameter: {readonly drawObject: any, readonly chartObject: any, readonly Cancel: any}) => void): void; + on(obj: Access.Form, event: 'BeforeScreenTip', argNames: ['ScreenTipText', 'SourceObject'], handler: (this: Access.Form, parameter: {readonly ScreenTipText: any, readonly SourceObject: any}) => void): void; on(obj: Access.Form, event: 'CommandBeforeExecute', argNames: ['Command', 'Cancel'], handler: (this: Access.Form, parameter: {readonly Command: any, readonly Cancel: any}) => void): void; on(obj: Access.Form, event: 'CommandChecked', argNames: ['Command', 'Checked'], handler: (this: Access.Form, parameter: {readonly Command: any, readonly Checked: any}) => void): void; on(obj: Access.Form, event: 'CommandEnabled', argNames: ['Command', 'Enabled'], handler: (this: Access.Form, parameter: {readonly Command: any, readonly Enabled: any}) => void): void; @@ -8634,33 +8543,18 @@ interface ActiveXObject { on(obj: Access.Form, event: 'Filter', argNames: ['Cancel', 'FilterType'], handler: (this: Access.Form, parameter: {Cancel: number, FilterType: number}) => void): void; on(obj: Access.Form, event: 'KeyDown' | 'KeyUp', argNames: ['KeyCode', 'Shift'], handler: (this: Access.Form, parameter: {KeyCode: number, Shift: number}) => void): void; on(obj: Access.Form, event: 'KeyPress', argNames: ['KeyAscii'], handler: (this: Access.Form, parameter: {KeyAscii: number}) => void): void; - on( - obj: Access.Form, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: ( - this: Access.Form, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; + on(obj: Access.Form, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: (this: Access.Form, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; on(obj: Access.Form, event: 'MouseWheel', argNames: ['Page', 'Count'], handler: (this: Access.Form, parameter: {readonly Page: boolean, readonly Count: number}) => void): void; - on( - obj: Access.FormOld, event: 'AfterBeginTransaction' | 'AfterCommitTransaction' | 'RollbackTransaction', argNames: ['Connection'], handler: ( - this: Access.FormOld, parameter: {readonly Connection: ADODB.Connection}) => void): void; + on(obj: Access.FormOld, event: 'AfterBeginTransaction' | 'AfterCommitTransaction' | 'RollbackTransaction', argNames: ['Connection'], handler: (this: Access.FormOld, parameter: {readonly Connection: ADODB.Connection}) => void): void; on(obj: Access.FormOld, event: 'AfterDelConfirm', argNames: ['Status'], handler: (this: Access.FormOld, parameter: {Status: number}) => void): void; on(obj: Access.FormOld, event: 'AfterFinalRender' | 'AfterLayout', argNames: ['drawObject'], handler: (this: Access.FormOld, parameter: {readonly drawObject: any}) => void): void; - on( - obj: Access.FormOld, event: 'AfterRender', argNames: ['drawObject', 'chartObject'], handler: ( - this: Access.FormOld, parameter: {readonly drawObject: any, readonly chartObject: any}) => void): void; + on(obj: Access.FormOld, event: 'AfterRender', argNames: ['drawObject', 'chartObject'], handler: (this: Access.FormOld, parameter: {readonly drawObject: any, readonly chartObject: any}) => void): void; on(obj: Access.FormOld, event: 'ApplyFilter', argNames: ['Cancel', 'ApplyType'], handler: (this: Access.FormOld, parameter: {Cancel: number, ApplyType: number}) => void): void; - on( - obj: Access.FormOld, event: 'BeforeBeginTransaction' | 'BeforeCommitTransaction', argNames: ['Cancel', 'Connection'], handler: ( - this: Access.FormOld, parameter: {Cancel: number, readonly Connection: ADODB.Connection}) => void): void; + on(obj: Access.FormOld, event: 'BeforeBeginTransaction' | 'BeforeCommitTransaction', argNames: ['Cancel', 'Connection'], handler: (this: Access.FormOld, parameter: {Cancel: number, readonly Connection: ADODB.Connection}) => void): void; on(obj: Access.FormOld, event: 'BeforeDelConfirm', argNames: ['Cancel', 'Response'], handler: (this: Access.FormOld, parameter: {Cancel: number, Response: number}) => void): void; - on( - obj: Access.FormOld, event: 'BeforeInsert' | 'BeforeUpdate' | 'BeginBatchEdit' | 'DblClick' | 'Delete' | 'Dirty' | 'Open' | 'RecordExit' | 'Undo' | - 'UndoBatchEdit' | 'Unload', - argNames: ['Cancel'], handler: (this: Access.FormOld, parameter: {Cancel: number}) => void): void; - on( - obj: Access.FormOld, event: 'BeforeRender', argNames: ['drawObject', 'chartObject', 'Cancel'], handler: ( - this: Access.FormOld, parameter: {readonly drawObject: any, readonly chartObject: any, readonly Cancel: any}) => void): void; - on( - obj: Access.FormOld, event: 'BeforeScreenTip', argNames: ['ScreenTipText', 'SourceObject'], handler: ( - this: Access.FormOld, parameter: {readonly ScreenTipText: any, readonly SourceObject: any}) => void): void; + on(obj: Access.FormOld, event: 'BeforeInsert' | 'BeforeUpdate' | 'BeginBatchEdit' | 'DblClick' | 'Delete' | 'Dirty' | 'Open' | 'RecordExit' | 'Undo' | 'UndoBatchEdit' | 'Unload', argNames: ['Cancel'], handler: (this: Access.FormOld, parameter: {Cancel: number}) => void): void; + on(obj: Access.FormOld, event: 'BeforeRender', argNames: ['drawObject', 'chartObject', 'Cancel'], handler: (this: Access.FormOld, parameter: {readonly drawObject: any, readonly chartObject: any, readonly Cancel: any}) => void): void; + on(obj: Access.FormOld, event: 'BeforeScreenTip', argNames: ['ScreenTipText', 'SourceObject'], handler: (this: Access.FormOld, parameter: {readonly ScreenTipText: any, readonly SourceObject: any}) => void): void; on(obj: Access.FormOld, event: 'CommandBeforeExecute', argNames: ['Command', 'Cancel'], handler: (this: Access.FormOld, parameter: {readonly Command: any, readonly Cancel: any}) => void): void; on(obj: Access.FormOld, event: 'CommandChecked', argNames: ['Command', 'Checked'], handler: (this: Access.FormOld, parameter: {readonly Command: any, readonly Checked: any}) => void): void; on(obj: Access.FormOld, event: 'CommandEnabled', argNames: ['Command', 'Enabled'], handler: (this: Access.FormOld, parameter: {readonly Command: any, readonly Enabled: any}) => void): void; @@ -8670,36 +8564,19 @@ interface ActiveXObject { on(obj: Access.FormOld, event: 'Filter', argNames: ['Cancel', 'FilterType'], handler: (this: Access.FormOld, parameter: {Cancel: number, FilterType: number}) => void): void; on(obj: Access.FormOld, event: 'KeyDown' | 'KeyUp', argNames: ['KeyCode', 'Shift'], handler: (this: Access.FormOld, parameter: {KeyCode: number, Shift: number}) => void): void; on(obj: Access.FormOld, event: 'KeyPress', argNames: ['KeyAscii'], handler: (this: Access.FormOld, parameter: {KeyAscii: number}) => void): void; - on( - obj: Access.FormOld, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: ( - this: Access.FormOld, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; + on(obj: Access.FormOld, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: (this: Access.FormOld, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; on(obj: Access.FormOld, event: 'MouseWheel', argNames: ['Page', 'Count'], handler: (this: Access.FormOld, parameter: {readonly Page: boolean, readonly Count: number}) => void): void; - on( - obj: Access.FormOldV10, event: 'AfterBeginTransaction' | 'AfterCommitTransaction' | 'RollbackTransaction', argNames: ['Connection'], - handler: (this: Access.FormOldV10, parameter: {readonly Connection: ADODB.Connection}) => void): void; + on(obj: Access.FormOldV10, event: 'AfterBeginTransaction' | 'AfterCommitTransaction' | 'RollbackTransaction', argNames: ['Connection'], handler: (this: Access.FormOldV10, parameter: {readonly Connection: ADODB.Connection}) => void): void; on(obj: Access.FormOldV10, event: 'AfterDelConfirm', argNames: ['Status'], handler: (this: Access.FormOldV10, parameter: {Status: number}) => void): void; on(obj: Access.FormOldV10, event: 'AfterFinalRender' | 'AfterLayout', argNames: ['drawObject'], handler: (this: Access.FormOldV10, parameter: {readonly drawObject: any}) => void): void; - on( - obj: Access.FormOldV10, event: 'AfterRender', argNames: ['drawObject', 'chartObject'], handler: ( - this: Access.FormOldV10, parameter: {readonly drawObject: any, readonly chartObject: any}) => void): void; + on(obj: Access.FormOldV10, event: 'AfterRender', argNames: ['drawObject', 'chartObject'], handler: (this: Access.FormOldV10, parameter: {readonly drawObject: any, readonly chartObject: any}) => void): void; on(obj: Access.FormOldV10, event: 'ApplyFilter', argNames: ['Cancel', 'ApplyType'], handler: (this: Access.FormOldV10, parameter: {Cancel: number, ApplyType: number}) => void): void; - on( - obj: Access.FormOldV10, event: 'BeforeBeginTransaction' | 'BeforeCommitTransaction', argNames: ['Cancel', 'Connection'], handler: ( - this: Access.FormOldV10, parameter: {Cancel: number, readonly Connection: ADODB.Connection}) => void): void; + on(obj: Access.FormOldV10, event: 'BeforeBeginTransaction' | 'BeforeCommitTransaction', argNames: ['Cancel', 'Connection'], handler: (this: Access.FormOldV10, parameter: {Cancel: number, readonly Connection: ADODB.Connection}) => void): void; on(obj: Access.FormOldV10, event: 'BeforeDelConfirm', argNames: ['Cancel', 'Response'], handler: (this: Access.FormOldV10, parameter: {Cancel: number, Response: number}) => void): void; - on( - obj: Access.FormOldV10, event: 'BeforeInsert' | 'BeforeUpdate' | 'BeginBatchEdit' | 'DblClick' | 'Delete' | 'Dirty' | 'Open' | 'RecordExit' | 'Undo' | - 'UndoBatchEdit' | 'Unload', - argNames: ['Cancel'], handler: (this: Access.FormOldV10, parameter: {Cancel: number}) => void): void; - on( - obj: Access.FormOldV10, event: 'BeforeRender', argNames: ['drawObject', 'chartObject', 'Cancel'], handler: ( - this: Access.FormOldV10, parameter: {readonly drawObject: any, readonly chartObject: any, readonly Cancel: any}) => void): void; - on( - obj: Access.FormOldV10, event: 'BeforeScreenTip', argNames: ['ScreenTipText', 'SourceObject'], handler: ( - this: Access.FormOldV10, parameter: {readonly ScreenTipText: any, readonly SourceObject: any}) => void): void; - on( - obj: Access.FormOldV10, event: 'CommandBeforeExecute', argNames: ['Command', 'Cancel'], handler: ( - this: Access.FormOldV10, parameter: {readonly Command: any, readonly Cancel: any}) => void): void; + on(obj: Access.FormOldV10, event: 'BeforeInsert' | 'BeforeUpdate' | 'BeginBatchEdit' | 'DblClick' | 'Delete' | 'Dirty' | 'Open' | 'RecordExit' | 'Undo' | 'UndoBatchEdit' | 'Unload', argNames: ['Cancel'], handler: (this: Access.FormOldV10, parameter: {Cancel: number}) => void): void; + on(obj: Access.FormOldV10, event: 'BeforeRender', argNames: ['drawObject', 'chartObject', 'Cancel'], handler: (this: Access.FormOldV10, parameter: {readonly drawObject: any, readonly chartObject: any, readonly Cancel: any}) => void): void; + on(obj: Access.FormOldV10, event: 'BeforeScreenTip', argNames: ['ScreenTipText', 'SourceObject'], handler: (this: Access.FormOldV10, parameter: {readonly ScreenTipText: any, readonly SourceObject: any}) => void): void; + on(obj: Access.FormOldV10, event: 'CommandBeforeExecute', argNames: ['Command', 'Cancel'], handler: (this: Access.FormOldV10, parameter: {readonly Command: any, readonly Cancel: any}) => void): void; on(obj: Access.FormOldV10, event: 'CommandChecked', argNames: ['Command', 'Checked'], handler: (this: Access.FormOldV10, parameter: {readonly Command: any, readonly Checked: any}) => void): void; on(obj: Access.FormOldV10, event: 'CommandEnabled', argNames: ['Command', 'Enabled'], handler: (this: Access.FormOldV10, parameter: {readonly Command: any, readonly Enabled: any}) => void): void; on(obj: Access.FormOldV10, event: 'CommandExecute', argNames: ['Command'], handler: (this: Access.FormOldV10, parameter: {readonly Command: any}) => void): void; @@ -8708,67 +8585,41 @@ interface ActiveXObject { on(obj: Access.FormOldV10, event: 'Filter', argNames: ['Cancel', 'FilterType'], handler: (this: Access.FormOldV10, parameter: {Cancel: number, FilterType: number}) => void): void; on(obj: Access.FormOldV10, event: 'KeyDown' | 'KeyUp', argNames: ['KeyCode', 'Shift'], handler: (this: Access.FormOldV10, parameter: {KeyCode: number, Shift: number}) => void): void; on(obj: Access.FormOldV10, event: 'KeyPress', argNames: ['KeyAscii'], handler: (this: Access.FormOldV10, parameter: {KeyAscii: number}) => void): void; - on( - obj: Access.FormOldV10, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: ( - this: Access.FormOldV10, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; + on(obj: Access.FormOldV10, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: (this: Access.FormOldV10, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; on(obj: Access.FormOldV10, event: 'MouseWheel', argNames: ['Page', 'Count'], handler: (this: Access.FormOldV10, parameter: {readonly Page: boolean, readonly Count: number}) => void): void; on(obj: Access.Image, event: 'DblClick', argNames: ['Cancel'], handler: (this: Access.Image, parameter: {Cancel: number}) => void): void; - on( - obj: Access.Image, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: ( - this: Access.Image, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; + on(obj: Access.Image, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: (this: Access.Image, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; on(obj: Access.Label, event: 'DblClick', argNames: ['Cancel'], handler: (this: Access.Label, parameter: {Cancel: number}) => void): void; - on( - obj: Access.Label, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: ( - this: Access.Label, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; + on(obj: Access.Label, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: (this: Access.Label, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; on(obj: Access.ListBox, event: 'BeforeUpdate' | 'DblClick' | 'Exit', argNames: ['Cancel'], handler: (this: Access.ListBox, parameter: {Cancel: number}) => void): void; on(obj: Access.ListBox, event: 'KeyDown' | 'KeyUp', argNames: ['KeyCode', 'Shift'], handler: (this: Access.ListBox, parameter: {KeyCode: number, Shift: number}) => void): void; on(obj: Access.ListBox, event: 'KeyPress', argNames: ['KeyAscii'], handler: (this: Access.ListBox, parameter: {KeyAscii: number}) => void): void; - on( - obj: Access.ListBox, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: ( - this: Access.ListBox, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; + on(obj: Access.ListBox, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: (this: Access.ListBox, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; on(obj: Access.NavigationButton, event: 'DblClick' | 'Exit', argNames: ['Cancel'], handler: (this: Access.NavigationButton, parameter: {Cancel: number}) => void): void; on(obj: Access.NavigationButton, event: 'KeyDown' | 'KeyUp', argNames: ['KeyCode', 'Shift'], handler: (this: Access.NavigationButton, parameter: {KeyCode: number, Shift: number}) => void): void; on(obj: Access.NavigationButton, event: 'KeyPress', argNames: ['KeyAscii'], handler: (this: Access.NavigationButton, parameter: {KeyAscii: number}) => void): void; - on( - obj: Access.NavigationButton, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: ( - this: Access.NavigationButton, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; - on( - obj: Access.NavigationControl, event: 'BeforeUpdate' | 'DblClick' | 'Dirty' | 'Exit' | 'Undo', argNames: ['Cancel'], handler: ( - this: Access.NavigationControl, parameter: {Cancel: number}) => void): void; + on(obj: Access.NavigationButton, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: (this: Access.NavigationButton, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; + on(obj: Access.NavigationControl, event: 'BeforeUpdate' | 'DblClick' | 'Dirty' | 'Exit' | 'Undo', argNames: ['Cancel'], handler: (this: Access.NavigationControl, parameter: {Cancel: number}) => void): void; on(obj: Access.NavigationControl, event: 'KeyDown' | 'KeyUp', argNames: ['KeyCode', 'Shift'], handler: (this: Access.NavigationControl, parameter: {KeyCode: number, Shift: number}) => void): void; on(obj: Access.NavigationControl, event: 'KeyPress', argNames: ['KeyAscii'], handler: (this: Access.NavigationControl, parameter: {KeyAscii: number}) => void): void; - on( - obj: Access.NavigationControl, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: ( - this: Access.NavigationControl, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; + on(obj: Access.NavigationControl, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: (this: Access.NavigationControl, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; on(obj: Access.ObjectFrame, event: 'DblClick' | 'Exit', argNames: ['Cancel'], handler: (this: Access.ObjectFrame, parameter: {Cancel: number}) => void): void; - on( - obj: Access.ObjectFrame, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: ( - this: Access.ObjectFrame, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; + on(obj: Access.ObjectFrame, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: (this: Access.ObjectFrame, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; on(obj: Access.ObjectFrame, event: 'Updated', argNames: ['Code'], handler: (this: Access.ObjectFrame, parameter: {Code: number}) => void): void; on(obj: Access.OptionButton, event: 'BeforeUpdate' | 'DblClick' | 'Exit', argNames: ['Cancel'], handler: (this: Access.OptionButton, parameter: {Cancel: number}) => void): void; on(obj: Access.OptionButton, event: 'KeyDown' | 'KeyUp', argNames: ['KeyCode', 'Shift'], handler: (this: Access.OptionButton, parameter: {KeyCode: number, Shift: number}) => void): void; on(obj: Access.OptionButton, event: 'KeyPress', argNames: ['KeyAscii'], handler: (this: Access.OptionButton, parameter: {KeyAscii: number}) => void): void; - on( - obj: Access.OptionButton, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: ( - this: Access.OptionButton, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; + on(obj: Access.OptionButton, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: (this: Access.OptionButton, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; on(obj: Access.OptionGroup, event: 'BeforeUpdate' | 'DblClick' | 'Exit', argNames: ['Cancel'], handler: (this: Access.OptionGroup, parameter: {Cancel: number}) => void): void; - on( - obj: Access.OptionGroup, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: ( - this: Access.OptionGroup, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; + on(obj: Access.OptionGroup, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: (this: Access.OptionGroup, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; on(obj: Access.Page, event: 'DblClick', argNames: ['Cancel'], handler: (this: Access.Page, parameter: {Cancel: number}) => void): void; - on( - obj: Access.Page, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: ( - this: Access.Page, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; + on(obj: Access.Page, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: (this: Access.Page, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; on(obj: Access.PaletteButton, event: 'BeforeUpdate' | 'DblClick' | 'Exit', argNames: ['Cancel'], handler: (this: Access.PaletteButton, parameter: {Cancel: number}) => void): void; on(obj: Access.PaletteButton, event: 'KeyDown' | 'KeyUp', argNames: ['KeyCode', 'Shift'], handler: (this: Access.PaletteButton, parameter: {KeyCode: number, Shift: number}) => void): void; on(obj: Access.PaletteButton, event: 'KeyPress', argNames: ['KeyAscii'], handler: (this: Access.PaletteButton, parameter: {KeyAscii: number}) => void): void; - on( - obj: Access.PaletteButton, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: ( - this: Access.PaletteButton, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; + on(obj: Access.PaletteButton, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: (this: Access.PaletteButton, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; on(obj: Access.Rectangle, event: 'DblClick', argNames: ['Cancel'], handler: (this: Access.Rectangle, parameter: {Cancel: number}) => void): void; - on( - obj: Access.Rectangle, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: ( - this: Access.Rectangle, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; + on(obj: Access.Rectangle, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: (this: Access.Rectangle, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; on(obj: Access.References, event: 'ItemAdded' | 'ItemRemoved', argNames: ['Reference'], handler: (this: Access.References, parameter: {readonly Reference: Access.Reference}) => void): void; on(obj: Access.Report, event: 'ApplyFilter', argNames: ['Cancel', 'ApplyType'], handler: (this: Access.Report, parameter: {Cancel: number, ApplyType: number}) => void): void; on(obj: Access.Report, event: 'DblClick' | 'NoData' | 'Open' | 'Unload', argNames: ['Cancel'], handler: (this: Access.Report, parameter: {Cancel: number}) => void): void; @@ -8776,58 +8627,36 @@ interface ActiveXObject { on(obj: Access.Report, event: 'Filter', argNames: ['Cancel', 'FilterType'], handler: (this: Access.Report, parameter: {Cancel: number, FilterType: number}) => void): void; on(obj: Access.Report, event: 'KeyDown' | 'KeyUp', argNames: ['KeyCode', 'Shift'], handler: (this: Access.Report, parameter: {KeyCode: number, Shift: number}) => void): void; on(obj: Access.Report, event: 'KeyPress', argNames: ['KeyAscii'], handler: (this: Access.Report, parameter: {KeyAscii: number}) => void): void; - on( - obj: Access.Report, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: ( - this: Access.Report, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; + on(obj: Access.Report, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: (this: Access.Report, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; on(obj: Access.Report, event: 'MouseWheel', argNames: ['Page', 'Count'], handler: (this: Access.Report, parameter: {readonly Page: boolean, readonly Count: number}) => void): void; on(obj: Access.ReportOld, event: 'Error', argNames: ['DataErr', 'Response'], handler: (this: Access.ReportOld, parameter: {DataErr: number, Response: number}) => void): void; on(obj: Access.ReportOld, event: 'NoData' | 'Open', argNames: ['Cancel'], handler: (this: Access.ReportOld, parameter: {Cancel: number}) => void): void; on(obj: Access.ReportOldV10, event: 'Error', argNames: ['DataErr', 'Response'], handler: (this: Access.ReportOldV10, parameter: {DataErr: number, Response: number}) => void): void; on(obj: Access.ReportOldV10, event: 'NoData' | 'Open', argNames: ['Cancel'], handler: (this: Access.ReportOldV10, parameter: {Cancel: number}) => void): void; on(obj: Access.Section, event: 'DblClick', argNames: ['Cancel'], handler: (this: Access.Section, parameter: {Cancel: number}) => void): void; - on( - obj: Access.Section, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: ( - this: Access.Section, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; + on(obj: Access.Section, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: (this: Access.Section, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; on(obj: Access.SubForm, event: 'Exit', argNames: ['Cancel'], handler: (this: Access.SubForm, parameter: {Cancel: number}) => void): void; on(obj: Access.SubReport, event: 'Exit', argNames: ['Cancel'], handler: (this: Access.SubReport, parameter: {Cancel: number}) => void): void; on(obj: Access.TabControl, event: 'DblClick', argNames: ['Cancel'], handler: (this: Access.TabControl, parameter: {Cancel: number}) => void): void; on(obj: Access.TabControl, event: 'KeyDown' | 'KeyUp', argNames: ['KeyCode', 'Shift'], handler: (this: Access.TabControl, parameter: {KeyCode: number, Shift: number}) => void): void; on(obj: Access.TabControl, event: 'KeyPress', argNames: ['KeyAscii'], handler: (this: Access.TabControl, parameter: {KeyAscii: number}) => void): void; - on( - obj: Access.TabControl, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: ( - this: Access.TabControl, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; + on(obj: Access.TabControl, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: (this: Access.TabControl, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; on(obj: Access.TextBox, event: 'BeforeUpdate' | 'DblClick' | 'Dirty' | 'Exit' | 'Undo', argNames: ['Cancel'], handler: (this: Access.TextBox, parameter: {Cancel: number}) => void): void; on(obj: Access.TextBox, event: 'KeyDown' | 'KeyUp', argNames: ['KeyCode', 'Shift'], handler: (this: Access.TextBox, parameter: {KeyCode: number, Shift: number}) => void): void; on(obj: Access.TextBox, event: 'KeyPress', argNames: ['KeyAscii'], handler: (this: Access.TextBox, parameter: {KeyAscii: number}) => void): void; - on( - obj: Access.TextBox, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: ( - this: Access.TextBox, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; + on(obj: Access.TextBox, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: (this: Access.TextBox, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; on(obj: Access.ToggleButton, event: 'BeforeUpdate' | 'DblClick' | 'Exit', argNames: ['Cancel'], handler: (this: Access.ToggleButton, parameter: {Cancel: number}) => void): void; on(obj: Access.ToggleButton, event: 'KeyDown' | 'KeyUp', argNames: ['KeyCode', 'Shift'], handler: (this: Access.ToggleButton, parameter: {KeyCode: number, Shift: number}) => void): void; on(obj: Access.ToggleButton, event: 'KeyPress', argNames: ['KeyAscii'], handler: (this: Access.ToggleButton, parameter: {KeyAscii: number}) => void): void; - on( - obj: Access.ToggleButton, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: ( - this: Access.ToggleButton, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; - on( - obj: Access.WebBrowserControl, event: 'BeforeNavigate2', argNames: Access.EventHelperTypes.WebBrowserControl_BeforeNavigate2_ArgNames, - handler: (this: Access.WebBrowserControl, parameter: Access.EventHelperTypes.WebBrowserControl_BeforeNavigate2_Parameter) => void): void; - on( - obj: Access.WebBrowserControl, event: 'BeforeUpdate' | 'DblClick' | 'Dirty' | 'Exit', argNames: ['Cancel'], handler: ( - this: Access.WebBrowserControl, parameter: {Cancel: number}) => void): void; - on( - obj: Access.WebBrowserControl, event: 'DocumentComplete', argNames: ['pDisp', 'URL'], handler: ( - this: Access.WebBrowserControl, parameter: {readonly pDisp: any, readonly URL: any}) => void): void; + on(obj: Access.ToggleButton, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: (this: Access.ToggleButton, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; + on(obj: Access.WebBrowserControl, event: 'BeforeNavigate2', argNames: Access.EventHelperTypes.WebBrowserControl_BeforeNavigate2_ArgNames, handler: (this: Access.WebBrowserControl, parameter: Access.EventHelperTypes.WebBrowserControl_BeforeNavigate2_Parameter) => void): void; + on(obj: Access.WebBrowserControl, event: 'BeforeUpdate' | 'DblClick' | 'Dirty' | 'Exit', argNames: ['Cancel'], handler: (this: Access.WebBrowserControl, parameter: {Cancel: number}) => void): void; + on(obj: Access.WebBrowserControl, event: 'DocumentComplete', argNames: ['pDisp', 'URL'], handler: (this: Access.WebBrowserControl, parameter: {readonly pDisp: any, readonly URL: any}) => void): void; on(obj: Access.WebBrowserControl, event: 'KeyDown' | 'KeyUp', argNames: ['KeyCode', 'Shift'], handler: (this: Access.WebBrowserControl, parameter: {KeyCode: number, Shift: number}) => void): void; on(obj: Access.WebBrowserControl, event: 'KeyPress', argNames: ['KeyAscii'], handler: (this: Access.WebBrowserControl, parameter: {KeyAscii: number}) => void): void; - on( - obj: Access.WebBrowserControl, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: ( - this: Access.WebBrowserControl, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; - on( - obj: Access.WebBrowserControl, event: 'NavigateError', argNames: ['pDisp', 'URL', 'TargetFrameName', 'StatusCode', 'Cancel'], - handler: (this: Access.WebBrowserControl, parameter: {readonly pDisp: any, readonly URL: any, readonly TargetFrameName: any, readonly StatusCode: any, Cancel: boolean}) => void): void; - on( - obj: Access.WebBrowserControl, event: 'ProgressChange', argNames: ['Progress', 'ProgressMax'], handler: ( - this: Access.WebBrowserControl, parameter: {readonly Progress: number, readonly ProgressMax: number}) => void): void; + on(obj: Access.WebBrowserControl, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'X', 'Y'], handler: (this: Access.WebBrowserControl, parameter: {Button: number, Shift: number, X: number, Y: number}) => void): void; + on(obj: Access.WebBrowserControl, event: 'NavigateError', argNames: ['pDisp', 'URL', 'TargetFrameName', 'StatusCode', 'Cancel'], handler: (this: Access.WebBrowserControl, parameter: {readonly pDisp: any, readonly URL: any, readonly TargetFrameName: any, readonly StatusCode: any, Cancel: boolean}) => void): void; + on(obj: Access.WebBrowserControl, event: 'ProgressChange', argNames: ['Progress', 'ProgressMax'], handler: (this: Access.WebBrowserControl, parameter: {readonly Progress: number, readonly ProgressMax: number}) => void): void; on(obj: Access.WebBrowserControl, event: 'Updated', argNames: ['Code'], handler: (this: Access.WebBrowserControl, parameter: {Code: number}) => void): void; on(obj: Access._CheckBoxInOption, event: 'AfterUpdate' | 'Click' | 'Enter' | 'GotFocus' | 'LostFocus', handler: (this: Access._CheckBoxInOption, parameter: {}) => void): void; on(obj: Access._OptionButtonInOption, event: 'AfterUpdate' | 'Click' | 'Enter' | 'GotFocus' | 'LostFocus', handler: (this: Access._OptionButtonInOption, parameter: {}) => void): void; @@ -8841,18 +8670,9 @@ interface ActiveXObject { on(obj: Access.ComboBox, event: 'AfterUpdate' | 'Change' | 'Click' | 'Enter' | 'GotFocus' | 'LostFocus', handler: (this: Access.ComboBox, parameter: {}) => void): void; on(obj: Access.CommandButton, event: 'Click' | 'Enter' | 'GotFocus' | 'LostFocus', handler: (this: Access.CommandButton, parameter: {}) => void): void; on(obj: Access.CustomControl, event: 'Enter' | 'GotFocus' | 'LostFocus', handler: (this: Access.CustomControl, parameter: {}) => void): void; - on( - obj: Access.Form, event: 'Activate' | 'AfterInsert' | 'AfterUpdate' | 'BeforeQuery' | 'Click' | 'Close' | 'Current' | 'DataSetChange' | 'Deactivate' | 'GotFocus' | - 'Load' | 'LostFocus' | 'OnConnect' | 'OnDisconnect' | 'Query' | 'Resize' | 'SelectionChange' | 'Timer', - handler: (this: Access.Form, parameter: {}) => void): void; - on( - obj: Access.FormOld, event: 'Activate' | 'AfterInsert' | 'AfterUpdate' | 'BeforeQuery' | 'Click' | 'Close' | 'Current' | 'DataSetChange' | 'Deactivate' | - 'GotFocus' | 'Load' | 'LostFocus' | 'OnConnect' | 'OnDisconnect' | 'Query' | 'Resize' | 'SelectionChange' | 'Timer', - handler: (this: Access.FormOld, parameter: {}) => void): void; - on( - obj: Access.FormOldV10, event: 'Activate' | 'AfterInsert' | 'AfterUpdate' | 'BeforeQuery' | 'Click' | 'Close' | 'Current' | 'DataSetChange' | 'Deactivate' | - 'GotFocus' | 'Load' | 'LostFocus' | 'OnConnect' | 'OnDisconnect' | 'Query' | 'Resize' | 'SelectionChange' | 'Timer', - handler: (this: Access.FormOldV10, parameter: {}) => void): void; + on(obj: Access.Form, event: 'Activate' | 'AfterInsert' | 'AfterUpdate' | 'BeforeQuery' | 'Click' | 'Close' | 'Current' | 'DataSetChange' | 'Deactivate' | 'GotFocus' | 'Load' | 'LostFocus' | 'OnConnect' | 'OnDisconnect' | 'Query' | 'Resize' | 'SelectionChange' | 'Timer', handler: (this: Access.Form, parameter: {}) => void): void; + on(obj: Access.FormOld, event: 'Activate' | 'AfterInsert' | 'AfterUpdate' | 'BeforeQuery' | 'Click' | 'Close' | 'Current' | 'DataSetChange' | 'Deactivate' | 'GotFocus' | 'Load' | 'LostFocus' | 'OnConnect' | 'OnDisconnect' | 'Query' | 'Resize' | 'SelectionChange' | 'Timer', handler: (this: Access.FormOld, parameter: {}) => void): void; + on(obj: Access.FormOldV10, event: 'Activate' | 'AfterInsert' | 'AfterUpdate' | 'BeforeQuery' | 'Click' | 'Close' | 'Current' | 'DataSetChange' | 'Deactivate' | 'GotFocus' | 'Load' | 'LostFocus' | 'OnConnect' | 'OnDisconnect' | 'Query' | 'Resize' | 'SelectionChange' | 'Timer', handler: (this: Access.FormOldV10, parameter: {}) => void): void; on(obj: Access.Image, event: 'Click', handler: (this: Access.Image, parameter: {}) => void): void; on(obj: Access.Label, event: 'Click', handler: (this: Access.Label, parameter: {}) => void): void; on(obj: Access.ListBox, event: 'AfterUpdate' | 'Click' | 'Enter' | 'GotFocus' | 'LostFocus', handler: (this: Access.ListBox, parameter: {}) => void): void; @@ -8864,9 +8684,7 @@ interface ActiveXObject { on(obj: Access.Page, event: 'Click', handler: (this: Access.Page, parameter: {}) => void): void; on(obj: Access.PaletteButton, event: 'AfterUpdate' | 'Click' | 'Enter' | 'GotFocus' | 'LostFocus', handler: (this: Access.PaletteButton, parameter: {}) => void): void; on(obj: Access.Rectangle, event: 'Click', handler: (this: Access.Rectangle, parameter: {}) => void): void; - on( - obj: Access.Report, event: 'Activate' | 'Click' | 'Close' | 'Current' | 'Deactivate' | 'GotFocus' | 'Load' | 'LostFocus' | 'Page' | 'Resize' | 'Timer', - handler: (this: Access.Report, parameter: {}) => void): void; + on(obj: Access.Report, event: 'Activate' | 'Click' | 'Close' | 'Current' | 'Deactivate' | 'GotFocus' | 'Load' | 'LostFocus' | 'Page' | 'Resize' | 'Timer', handler: (this: Access.Report, parameter: {}) => void): void; on(obj: Access.ReportOld, event: 'Activate' | 'Close' | 'Deactivate' | 'Page', handler: (this: Access.ReportOld, parameter: {}) => void): void; on(obj: Access.ReportOldV10, event: 'Activate' | 'Close' | 'Deactivate' | 'Page', handler: (this: Access.ReportOldV10, parameter: {}) => void): void; on(obj: Access.Section, event: 'Click' | 'Paint', handler: (this: Access.Section, parameter: {}) => void): void; @@ -8876,50 +8694,11 @@ interface ActiveXObject { on(obj: Access.TextBox, event: 'AfterUpdate' | 'Change' | 'Click' | 'Enter' | 'GotFocus' | 'LostFocus', handler: (this: Access.TextBox, parameter: {}) => void): void; on(obj: Access.ToggleButton, event: 'AfterUpdate' | 'Click' | 'Enter' | 'GotFocus' | 'LostFocus', handler: (this: Access.ToggleButton, parameter: {}) => void): void; on(obj: Access.WebBrowserControl, event: 'AfterUpdate' | 'Change' | 'Click' | 'Enter' | 'GotFocus' | 'LostFocus', handler: (this: Access.WebBrowserControl, parameter: {}) => void): void; - set( - obj: Access._CheckBoxInOption | Access._ChildLabel | Access._CustomControlInReport | Access._OptionButtonInOption | Access._ToggleButtonInOption | - Access.Attachment | Access.BoundObjectFrame | Access.CheckBox | Access.ComboBox | Access.CommandButton | Access.CustomControl | Access.EmptyCell | Access.Form | - Access.FormOld | Access.FormOldV10 | Access.Label | Access.ListBox | Access.NavigationButton | Access.NavigationControl | Access.ObjectFrame | - Access.OptionButton | Access.OptionGroup | Access.Page | Access.SubForm | Access.TabControl | Access.TextBox | Access.ToggleButton | Access.WebBrowserControl, - propertyName: 'accName' | 'accValue', parameterTypes: [any], newValue: string): void; + set(obj: Access._CheckBoxInOption | Access._ChildLabel | Access._CustomControlInReport | Access._OptionButtonInOption | Access._ToggleButtonInOption | Access.Attachment | Access.BoundObjectFrame | Access.CheckBox | Access.ComboBox | Access.CommandButton | Access.CustomControl | Access.EmptyCell | Access.Form | Access.FormOld | Access.FormOldV10 | Access.Label | Access.ListBox | Access.NavigationButton | Access.NavigationControl | Access.ObjectFrame | Access.OptionButton | Access.OptionGroup | Access.Page | Access.SubForm | Access.TabControl | Access.TextBox | Access.ToggleButton | Access.WebBrowserControl, propertyName: 'accName' | 'accValue', parameterTypes: [any], newValue: string): void; set(obj: Access._ControlInReportEvents | Access.ComboBox | Access.Control | Access.ListBox, propertyName: 'Selected', parameterTypes: [number], newValue: number): void; + new(progid: K): ActiveXObjectNameMap[K]; } interface ActiveXObjectNameMap { 'Access.Application': Access.Application; } - -interface EnumeratorConstructor { - new(col: Access._ItemsSelected): Enumerator; - new(col: Access.AccessObjectProperties): Enumerator; - new(col: Access.AdditionalData): Enumerator; - new( - col: Access.AllDataAccessPages | Access.AllDatabaseDiagrams | Access.AllForms | Access.AllFunctions | Access.AllMacros | Access.AllModules | Access.AllQueries | - Access.AllReports | Access.AllStoredProcedures | Access.AllTables | Access.AllViews | Access.DependencyObjects): Enumerator; - new(col: Access.Controls): Enumerator; - new(col: Access.Children | Access.Properties): Enumerator; // tslint:disable-line:use-default-type-parameter - new(col: Access.DataAccessPages): Enumerator; - new(col: Access.Entities): Enumerator; - new(col: Access.FormatConditions): Enumerator; - new(col: Access.Forms): Enumerator; - new(col: Access.ImportExportSpecifications): Enumerator; - new(col: Access.LocalVars): Enumerator; - new(col: Access.Modules): Enumerator; - new(col: Access.Operations): Enumerator; - new(col: Access.Pages): Enumerator; - new(col: Access.Printers): Enumerator; - new(col: Access.References): Enumerator; - new(col: Access.Reports): Enumerator; - new(col: Access.ReturnVars): Enumerator; - new(col: Access.SharedResources): Enumerator; - new(col: Access.SmartTagActions): Enumerator; - new(col: Access.SmartTagProperties): Enumerator; - new(col: Access.SmartTags): Enumerator; - new(col: Access.TempVars): Enumerator; - new(col: Access.WebServices): Enumerator; - new(col: Access.WSParameters): Enumerator; -} - -interface SafeArray { - _brand: SafeArray; -} diff --git a/types/activex-access/tslint.json b/types/activex-access/tslint.json index 3224b40b8b..7b89accc6d 100644 --- a/types/activex-access/tslint.json +++ b/types/activex-access/tslint.json @@ -1,6 +1,7 @@ { "extends": "dtslint/dt.json", "rules": { - "no-const-enum": false + "no-const-enum": false, + "max-line-length": false } } From b50cae0a825520c825ce9f3d37b2419ccf04da56 Mon Sep 17 00:00:00 2001 From: Zev Spitz Date: Mon, 21 May 2018 16:31:08 +0200 Subject: [PATCH 291/575] Reduce any 1 --- types/activex-access/index.d.ts | 540 ++++++++++++++++---------------- 1 file changed, 269 insertions(+), 271 deletions(-) diff --git a/types/activex-access/index.d.ts b/types/activex-access/index.d.ts index 199fa22d36..e553b82fad 100644 --- a/types/activex-access/index.d.ts +++ b/types/activex-access/index.d.ts @@ -988,6 +988,13 @@ declare namespace Access { acLayoutTabular = 1, } + const enum AcSetMenuItemState { + acMenuCheck = 3, + acMenuGray = 1, + acMenuUncheck = 2, + acMenuUngray = 0, + } + const enum AcModuleType { acClassModule = 1, acStandardModule = 0, @@ -1028,6 +1035,21 @@ declare namespace Access { acReadOnly = 2, } + const enum AcOutputFormat { + acFormatASP = 'Microsoft Active Server Pages (*.asp)', + acFormatDAP = 'Microsoft Access Data Access Page (*.htm; *.html)', + acFormatHTML = 'HTML (*.html)', + acFormatIIS = 'Microsoft IIS (*.htx; *.idc)', + acFormatPDF = 'PDF Format (*.pdf)', + acFormatRTF = 'Rich Text Format (*.rtf)', + acFormatSNP = 'Snapshot Format (*.snp)', + acFormatTXT = 'MS-DOS Text (*.txt)', + acFormatXLS = 'Microsoft Excel (*.xls)', + acFormatXLSB = 'Microsoft Excel Binary Workbook (*.xlsb)', + acFormatXLSX = 'Microsoft Excel Workbook (*.xlsx)', + acFormatXPS = 'XPS Format (*.xps)' + } + const enum AcOutputObjectType { acOutputDataAccessPage = 6, acOutputForm = 2, @@ -1865,6 +1887,10 @@ declare namespace Access { TypeLib = 0, } + type ByteArray = SafeArray; + + type DatabaseType = 'Microsoft Access (default)' | 'Jet 2.x' | 'Jet 3.x' | 'dBase III' | 'dBase IV' | 'dBase 5.0' | 'Paradox 3.x' | 'Paradox 4.x' | 'Paradox 5.x' | 'Paradox 7.x' | 'ODBC Database' | 'WSS'; + class _AccessProperty { private 'Access._AccessProperty_typekey': _AccessProperty; private constructor(); @@ -1958,7 +1984,7 @@ declare namespace Access { Left: number; LeftPadding: number; Locked: boolean; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Name: string; OldBorderStyle: number; readonly OldValue: any; @@ -2095,7 +2121,7 @@ declare namespace Access { LeftMargin: number; LeftPadding: number; LineSpacing: number; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Name: string; NumeralShapes: number; OldBorderStyle: number; @@ -2162,7 +2188,7 @@ declare namespace Access { readonly Layout: AcLayoutType; readonly LayoutID: number; LeftPadding: number; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Name: string; readonly Object: any; ObjectVerbs(Index: number): string; @@ -2250,7 +2276,7 @@ declare namespace Access { LeftPadding: number; Locked: boolean; LpOleObject: number; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Name: string; readonly Object: any; ObjectPalette: any; @@ -2377,7 +2403,7 @@ declare namespace Access { Left: number; LeftPadding: number; Locked: boolean; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Name: string; OldBorderStyle: number; readonly OldValue: any; @@ -2645,7 +2671,7 @@ declare namespace Access { Left: number; LeftPadding: number; Locked: boolean; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Name: string; ObjectPalette: any; readonly OldValue: any; @@ -2750,10 +2776,10 @@ declare namespace Access { readonly Application: Application; readonly Count: number; IsMemberSafe(dispid: number): boolean; - Item(Index: any): AccessObjectProperty; + Item(Index: number | string): AccessObjectProperty; readonly Parent: any; - Remove(Item: any): void; - (Index: any): AccessObjectProperty; + Remove(Item: number | string): void; + (Index: number | string): AccessObjectProperty; } class AccessObjectProperty { @@ -2765,118 +2791,28 @@ declare namespace Access { Value: any; } + interface AccessObjects { + readonly Application: Application; + readonly Count: number; + IsMemberSafe(dispid: number): boolean; + Item(var_0: number | string): AccessObject; + readonly Parent: any; + (var_0: number | string): AccessObject; + } + interface AdditionalData { Add(var_0: string): AdditionalData; readonly Count: number; IsMemberSafe(dispid: number): boolean; - Item(Index: any): AdditionalData; + Item(Index: number | string): AdditionalData; Name: string; - (Index: any): AdditionalData; - } - - interface AllDataAccessPages { - readonly Application: Application; - readonly Count: number; - IsMemberSafe(dispid: number): boolean; - Item(var_0: any): AccessObject; - readonly Parent: any; - (var_0: any): AccessObject; - } - - interface AllDatabaseDiagrams { - readonly Application: Application; - readonly Count: number; - IsMemberSafe(dispid: number): boolean; - Item(var_0: any): AccessObject; - readonly Parent: any; - (var_0: any): AccessObject; - } - - interface AllForms { - readonly Application: Application; - readonly Count: number; - IsMemberSafe(dispid: number): boolean; - Item(var_0: any): AccessObject; - readonly Parent: any; - (var_0: any): AccessObject; - } - - interface AllFunctions { - readonly Application: Application; - readonly Count: number; - IsMemberSafe(dispid: number): boolean; - Item(var_0: any): AccessObject; - readonly Parent: any; - (var_0: any): AccessObject; - } - - interface AllMacros { - readonly Application: Application; - readonly Count: number; - IsMemberSafe(dispid: number): boolean; - Item(var_0: any): AccessObject; - readonly Parent: any; - (var_0: any): AccessObject; - } - - interface AllModules { - readonly Application: Application; - readonly Count: number; - IsMemberSafe(dispid: number): boolean; - Item(var_0: any): AccessObject; - readonly Parent: any; - (var_0: any): AccessObject; - } - - interface AllQueries { - readonly Application: Application; - readonly Count: number; - IsMemberSafe(dispid: number): boolean; - Item(var_0: any): AccessObject; - readonly Parent: any; - (var_0: any): AccessObject; - } - - interface AllReports { - readonly Application: Application; - readonly Count: number; - IsMemberSafe(dispid: number): boolean; - Item(var_0: any): AccessObject; - readonly Parent: any; - (var_0: any): AccessObject; - } - - interface AllStoredProcedures { - readonly Application: Application; - readonly Count: number; - IsMemberSafe(dispid: number): boolean; - Item(var_0: any): AccessObject; - readonly Parent: any; - (var_0: any): AccessObject; - } - - interface AllTables { - readonly Application: Application; - readonly Count: number; - IsMemberSafe(dispid: number): boolean; - Item(var_0: any): AccessObject; - readonly Parent: any; - (var_0: any): AccessObject; - } - - interface AllViews { - readonly Application: Application; - readonly Count: number; - IsMemberSafe(dispid: number): boolean; - Item(var_0: any): AccessObject; - readonly Parent: any; - (var_0: any): AccessObject; + (Index: number | string): AdditionalData; } class Application { private 'Access.Application_typekey': Application; private constructor(); - AccessError(ErrorNumber: any): any; + AccessError(ErrorNumber: number): string; AddAutoCorrect(ChangeFrom: string, ChangeTo: string): void; AddToFavorites(): void; readonly ADOConnectString: string; @@ -2904,20 +2840,20 @@ declare namespace Access { /** @param LogFile [LogFile=false] */ CompactRepair(SourceFile: string, DestinationFile: string, LogFile?: boolean): boolean; ConvertAccessProject(SourceFilename: string, DestinationFilename: string, DestinationFileFormat: AcFileFormat): void; - CreateAccessProject(filepath: string, Connect?: any): void; + CreateAccessProject(filepath: string, Connect?: string): void; CreateAdditionalData(): AdditionalData; /** @param Section [Section=0] */ - CreateControl(FormName: string, ControlType: AcControlType, Section?: AcSection, Parent?: any, ColumnName?: any, Left?: any, Top?: any, Width?: any, Height?: any): Control; + CreateControl(FormName: string, ControlType: AcControlType, Section?: AcSection, Parent?: string, ColumnName?: string, Left?: number, Top?: number, Width?: number, Height?: number): Control; CreateControlEx(FormName: string, ControlType: AcControlType, Section: AcSection, Parent: string, ControlSource: string, Left: number, Top: number, Width: number, Height: number): Control; CreateControlExOld(FormName: string, ControlType: AcControlType, Section: AcSection, Parent: string, ControlSource: string, Left: number, Top: number, Width: number, Height: number): Control; /** @param Section [Section=0] */ - CreateControlOld(FormName: string, ControlType: AcControlType, Section?: AcSection, Parent?: any, ColumnName?: any, Left?: any, Top?: any, Width?: any, Height?: any): Control; + CreateControlOld(FormName: string, ControlType: AcControlType, Section?: AcSection, Parent?: string, ColumnName?: string, Left?: number, Top?: number, Width?: number, Height?: number): Control; /** @param CreateNewFile [CreateNewFile=true] */ - CreateDataAccessPage(FileName: any, CreateNewFile?: boolean): DataAccessPage; - CreateForm(Database?: any, FormTemplate?: any): Form; + CreateDataAccessPage(FileName: string, CreateNewFile?: boolean): DataAccessPage; + CreateForm(Database?: string, FormTemplate?: string): Form; CreateGroupLevel(ReportName: string, Expression: string, Header: number, Footer: number): number; /** @@ -2928,15 +2864,15 @@ declare namespace Access { * @param Replace [Replace=false] */ CreateNewWorkgroupFile(Path?: string, Name?: string, Company?: string, WorkgroupID?: string, Replace?: boolean): void; - CreateReport(Database?: any, ReportTemplate?: any): Report; + CreateReport(Database?: string, ReportTemplate?: string): Report; /** @param Section [Section=0] */ - CreateReportControl(ReportName: string, ControlType: AcControlType, Section?: AcSection, Parent?: any, ColumnName?: any, Left?: any, Top?: any, Width?: any, Height?: any): Control; + CreateReportControl(ReportName: string, ControlType: AcControlType, Section?: AcSection, Parent?: string, ColumnName?: string, Left?: number, Top?: number, Width?: number, Height?: number): Control; CreateReportControlEx(ReportName: string, ControlType: AcControlType, Section: AcSection, Parent: string, ControlName: string, Left: number, Top: number, Width: number, Height: number): Control; CreateReportControlExOld(ReportName: string, ControlType: AcControlType, Section: AcSection, Parent: string, ControlName: string, Left: number, Top: number, Width: number, Height: number): Control; /** @param Section [Section=0] */ - CreateReportControlOld(ReportName: string, ControlType: AcControlType, Section?: AcSection, Parent?: any, ColumnName?: any, Left?: any, Top?: any, Width?: any, Height?: any): Control; + CreateReportControlOld(ReportName: string, ControlType: AcControlType, Section?: AcSection, Parent?: string, ColumnName?: string, Left?: number, Top?: number, Width?: number, Height?: number): Control; readonly CurrentData: CurrentData; CurrentDb(): DAO.Database; readonly CurrentObjectName: string; @@ -2946,36 +2882,36 @@ declare namespace Access { CurrentWebUser(DisplayOption: AcWebUserDisplay): any; CurrentWebUserGroups(DisplayOption: AcWebUserGroupsDisplay): any; readonly DataAccessPages: DataAccessPages; - DAvg(Expr: string, Domain: string, Criteria?: any): any; + DAvg(Expr: string, Domain: string, Criteria?: string): number | null; readonly DBEngine: DAO.DBEngine; - DCount(Expr: string, Domain: string, Criteria?: any): any; - DDEExecute(ChanNum: any, Command: string): void; - DDEInitiate(Application: string, Topic: string): any; - DDEPoke(ChanNum: any, Item: string, Data: string): void; - DDERequest(ChanNum: any, Item: string): string; - DDETerminate(ChanNum: any): void; + DCount(Expr: string, Domain: string, Criteria?: string): number | null; + DDEExecute(ChanNum: number, Command: string): void; + DDEInitiate(Application: string, Topic: string): number; + DDEPoke(ChanNum: number, Item: string, Data: string): void; + DDERequest(ChanNum: number, Item: string): string; + DDETerminate(ChanNum: number): void; DDETerminateAll(): void; readonly DefaultWebOptions: DefaultWebOptions; DefaultWorkspaceClone(): DAO.Workspace; DelAutoCorrect(ChangeFrom: string): void; DeleteControl(FormName: string, ControlName: string): void; DeleteReportControl(ReportName: string, ControlName: string): void; - DFirst(Expr: string, Domain: string, Criteria?: any): any; + DFirst(Expr: string, Domain: string, Criteria?: string): any; DirtyObject(ObjectType: AcObjectType, ObjectName: string): void; - DLast(Expr: string, Domain: string, Criteria?: any): any; - DLookup(Expr: string, Domain: string, Criteria?: any): any; - DMax(Expr: string, Domain: string, Criteria?: any): any; - DMin(Expr: string, Domain: string, Criteria?: any): any; + DLast(Expr: string, Domain: string, Criteria?: string): any; + DLookup(Expr: string, Domain: string, Criteria?: string): any; + DMax(Expr: string, Domain: string, Criteria?: string): any; + DMin(Expr: string, Domain: string, Criteria?: string): any; readonly DoCmd: DoCmd; - DStDev(Expr: string, Domain: string, Criteria?: any): any; - DStDevP(Expr: string, Domain: string, Criteria?: any): any; - DSum(Expr: string, Domain: string, Criteria?: any): any; - DVar(Expr: string, Domain: string, Criteria?: any): any; - DVarP(Expr: string, Domain: string, Criteria?: any): any; + DStDev(Expr: string, Domain: string, Criteria?: string): number | null; + DStDevP(Expr: string, Domain: string, Criteria?: string): number | null; + DSum(Expr: string, Domain: string, Criteria?: string): number | null; + DVar(Expr: string, Domain: string, Criteria?: string): number | null; + DVarP(Expr: string, Domain: string, Criteria?: string): number | null; /** @param bstrStatusBarText [bstrStatusBarText=''] */ Echo(EchoOn: number, bstrStatusBarText?: string): void; - EuroConvert(Number: number, SourceCurrency: string, TargetCurrency: string, FullPrecision?: any, TriangulationPrecision?: any): number; + EuroConvert(Number: number, SourceCurrency: string, TargetCurrency: string, FullPrecision?: boolean, TriangulationPrecision?: number): number; Eval(StringExpr: string): any; /** @@ -2995,7 +2931,7 @@ declare namespace Access { * @param OtherFlags [OtherFlags=0] * @param WhereCondition [WhereCondition=''] */ - ExportXML(ObjectType: AcExportXMLObjectType, DataSource: string, DataTarget?: string, SchemaTarget?: string, PresentationTarget?: string, ImageTarget?: string, Encoding?: AcExportXMLEncoding, OtherFlags?: AcExportXMLOtherFlags, WhereCondition?: string, AdditionalData?: any): void; + ExportXML(ObjectType: AcExportXMLObjectType, DataSource: string, DataTarget?: string, SchemaTarget?: string, PresentationTarget?: string, ImageTarget?: string, Encoding?: AcExportXMLEncoding, OtherFlags?: AcExportXMLOtherFlags, WhereCondition?: string, AdditionalData?: AdditionalData): void; /** * @param DataTarget [DataTarget=''] @@ -3017,12 +2953,19 @@ declare namespace Access { * @param Method [Method=0] * @param HeaderInfo [HeaderInfo=''] */ - FollowHyperlink(Address: string, SubAddress?: string, NewWindow?: boolean, AddHistory?: boolean, ExtraInfo?: any, Method?: Office.MsoExtraInfoMethod, HeaderInfo?: string): void; + FollowHyperlink(Address: string, SubAddress?: string, NewWindow?: boolean, AddHistory?: boolean, ExtraInfo?: string | ByteArray, Method?: Office.MsoExtraInfoMethod, HeaderInfo?: string): void; readonly Forms: Forms; GetHiddenAttribute(ObjectType: AcObjectType, ObjectName: string): boolean; - GetOption(OptionName: string): any; - GUIDFromString(String: any): any; - HtmlEncode(PlainText: any, Length?: any): string; + + /** + * Returns different types of values based on how the options are set: + * * If by selecting / clearing a checkbox, returns `boolean` + * * If by typing a string or numeric value, returns `string` or `number` + * * If by choosing from a list, will return the 0-based index of the selected item + */ + GetOption(OptionName: string): boolean | string | number; + GUIDFromString(String: string): ByteArray; + HtmlEncode(PlainText: string, Length?: number): string; hWndAccessApp(): number; /** @param Part [Part=0] */ @@ -3050,14 +2993,14 @@ declare namespace Access { readonly Modules: Modules; readonly MsoDebugOptions: Office.MsoDebugOptions; readonly Name: string; - NewAccessProject(filepath: string, Connect?: any): void; + NewAccessProject(filepath: string, Connect?: string): void; /** * @param FileFormat [FileFormat=0] * @param SiteAddress [SiteAddress=''] * @param ListID [ListID=''] */ - NewCurrentDatabase(filepath: string, FileFormat?: AcNewDatabaseFormat, Template?: any, SiteAddress?: string, ListID?: string): void; + NewCurrentDatabase(filepath: string, FileFormat?: AcNewDatabaseFormat, Template?: string, SiteAddress?: string, ListID?: string): void; NewCurrentDatabaseOld(filepath: string): void; readonly NewFileTaskPane: Office.NewFile; Nz(Value: any, ValueIfNull?: any): any; @@ -3074,7 +3017,7 @@ declare namespace Access { /** @param Exclusive [Exclusive=false] */ OpenCurrentDatabaseOld(filepath: string, Exclusive?: boolean): void; readonly Parent: any; - PlainText(RichText: any, Length?: any): string; + PlainText(RichText: string, Length?: number): string; Printer: Printer; readonly Printers: Printers; readonly ProductCode: string; @@ -3091,16 +3034,27 @@ declare namespace Access { Run(Procedure: string, Arg1?: any, Arg2?: any, Arg3?: any, Arg4?: any, Arg5?: any, Arg6?: any, Arg7?: any, Arg8?: any, Arg9?: any, Arg10?: any, Arg11?: any, Arg12?: any, Arg13?: any, Arg14?: any, Arg15?: any, Arg16?: any, Arg17?: any, Arg18?: any, Arg19?: any, Arg20?: any, Arg21?: any, Arg22?: any, Arg23?: any, Arg24?: any, Arg25?: any, Arg26?: any, Arg27?: any, Arg28?: any, Arg29?: any, Arg30?: any): any; RunCommand(Command: AcCommand): void; SaveAsAXL(ObjectType: AcObjectType, ObjectName: string, FileName: string): void; - SaveAsTemplate(Path: string, Title: string, IconPath: string, CoreTable: string, Category: string, PreviewPath?: any, Description?: any, InstantiationForm?: any, ApplicationPart?: any, IncludeData?: any, Variation?: any): void; + SaveAsTemplate(Path: string, Title: string, IconPath: string, CoreTable: string, Category: string, PreviewPath?: any, Description?: string, InstantiationForm?: string, ApplicationPart?: boolean, IncludeData?: boolean, Variation?: any): void; SaveAsText(ObjectType: AcObjectType, ObjectName: string, FileName: string): void; readonly Screen: Screen; SetDefaultWorkgroupFile(Path: string): void; SetHiddenAttribute(ObjectType: AcObjectType, ObjectName: string, fHidden: boolean): void; - SetOption(OptionName: string, Setting: any): void; + + /** + * Pass different types of values based on how the option is set in the UI + * * If by selecting / clearing a checkbox, pass a `boolean` + * * If by typing a string or numeric value, pass a `string` or `number` + * * If by choosing from a list, pass the 0-based index of the tiem to select + */ + SetOption(OptionName: string, Setting: boolean | string | number): void; SetUndoRecording(yesno: number): void; ShortcutMenuBar: string; - StringFromGUID(Guid: any): any; - SysCmd(Action: AcSysCmdAction, Argument2?: any, Argument3?: any): any; + StringFromGUID(Guid: ByteArray): string; + SysCmd(Action: AcSysCmdAction.acSysCmdInitMeter, StatusText: string, MaxValue: number): null; + SysCmd(Action: AcSysCmdAction.acSysCmdUpdateMeter, CurrentValue: number): null; + SysCmd(Action: AcSysCmdAction.acSysCmdSetStatus, StatusText: string): null; + SysCmd(Action: AcSysCmdAction.acSysCmdGetObjectState, Argument2: AcObjectType, Argument3: string): Constants.acObjStateDirty | Constants.acObjStateNew | Constants.acObjStateOpen; + SysCmd(Acton: AcSysCmdAction.acSysCmdAccessDir | AcSysCmdAction.acSysCmdAccessVer | AcSysCmdAction.acSysCmdClearHelpTopic | AcSysCmdAction.acSysCmdClearStatus | AcSysCmdAction.acSysCmdGetWorkgroupFile | AcSysCmdAction.acSysCmdIniFile | AcSysCmdAction.acSysCmdProfile | AcSysCmdAction.acSysCmdRemoveMeter | AcSysCmdAction.acSysCmdRuntime): null; readonly TempVars: TempVars; /** @@ -3179,9 +3133,9 @@ declare namespace Access { Enabled: boolean; EventProcPrefix: string; FileData(var_0?: any): any; - FileName(var_0?: any): string; - FileType(var_0?: any): string; - FileURL(var_0?: any): string; + FileName(var_0?: number | string): string; + FileType(var_0?: number | string): string; + FileURL(var_0?: number | string): string; Forward(): void; Goto(): void; GridlineColor: number; @@ -3211,7 +3165,7 @@ declare namespace Access { Left: number; LeftPadding: number; Locked: boolean; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: null): void; Name: string; OldBorderStyle: number; readonly OldValue: any; @@ -3363,7 +3317,7 @@ declare namespace Access { LeftPadding: number; Locked: boolean; LpOleObject: number; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Name: string; readonly Object: any; ObjectPalette: any; @@ -3506,7 +3460,7 @@ declare namespace Access { Left: number; LeftPadding: number; Locked: boolean; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Name: string; OldBorderStyle: number; readonly OldValue: any; @@ -3564,8 +3518,10 @@ declare namespace Access { interface Children { readonly Count: number; IsMemberSafe(dispid: number): boolean; - Item(Index: any): any; - (Index: any): any; + // tslint:disable-next-line:no-unnecessary-generics + Item(Index: number | string): T; + // tslint:disable-next-line:no-unnecessary-generics + (Index: number | string): T; } class Class { @@ -3576,12 +3532,12 @@ declare namespace Access { class CodeData { private 'Access.CodeData_typekey': CodeData; private constructor(); - readonly AllDatabaseDiagrams: AllDatabaseDiagrams; - readonly AllFunctions: AllFunctions; - readonly AllQueries: AllQueries; - readonly AllStoredProcedures: AllStoredProcedures; - readonly AllTables: AllTables; - readonly AllViews: AllViews; + readonly AllDatabaseDiagrams: AccessObjects; + readonly AllFunctions: AccessObjects; + readonly AllQueries: AccessObjects; + readonly AllStoredProcedures: AccessObjects; + readonly AllTables: AccessObjects; + readonly AllViews: AccessObjects; IsMemberSafe(dispid: number): boolean; } @@ -3590,11 +3546,11 @@ declare namespace Access { private constructor(); readonly AccessConnection: ADODB.Connection; AddSharedImage(SharedImageName: string, FileName: string): void; - readonly AllDataAccessPages: AllDataAccessPages; - readonly AllForms: AllForms; - readonly AllMacros: AllMacros; - readonly AllModules: AllModules; - readonly AllReports: AllReports; + readonly AllDataAccessPages: AccessObjects; + readonly AllForms: AccessObjects; + readonly AllMacros: AccessObjects; + readonly AllModules: AccessObjects; + readonly AllReports: AccessObjects; readonly Application: Application; readonly BaseConnectionString: string; CloseConnection(): void; @@ -3607,7 +3563,7 @@ declare namespace Access { readonly IsTrusted: boolean; readonly IsWeb: boolean; readonly Name: string; - OpenConnection(BaseConnectionString?: any, UserID?: any, Password?: any): void; + OpenConnection(BaseConnectionString?: string, UserID?: string, Password?: string): void; readonly Parent: any; readonly Path: string; readonly ProjectType: AcProjectType; @@ -3643,7 +3599,7 @@ declare namespace Access { accState(varChild?: any): any; accValue(varChild?: any): string; AddColon: boolean; - AddItem(Item: string, Index?: any): void; + AddItem(Item: string, Index?: number): void; AfterUpdate: string; AfterUpdateMacro: string; AllowAutoCorrect: boolean; @@ -3672,7 +3628,7 @@ declare namespace Access { CanGrow: boolean; CanShrink: boolean; Coltyp: number; - Column(Index: number, Row?: any): any; + Column(Index: number, Row?: number): any; ColumnCount: number; ColumnHeads: boolean; ColumnHidden: boolean; @@ -3749,7 +3705,7 @@ declare namespace Access { ListRows: number; ListWidth: string; Locked: boolean; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Name: string; NumeralShapes: number; OldBorderStyle: number; @@ -3787,8 +3743,8 @@ declare namespace Access { readonly Parent: any; readonly Properties: Properties; ReadingOrder: number; - Recordset: any; - RemoveItem(Index: any): void; + Recordset: DAO.Recordset | ADODB.Recordset; + RemoveItem(Index: number | string): void; Requery(): void; RightMargin: number; RightPadding: number; @@ -3933,7 +3889,7 @@ declare namespace Access { readonly LayoutID: number; Left: number; LeftPadding: number; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Name: string; ObjectPalette: any; readonly OldValue: any; @@ -4011,7 +3967,7 @@ declare namespace Access { _Name: string; readonly Application: Application; BottomPadding: number; - Column(Index: number, Row?: any): any; + Column(Index: number, Row?: number): any; readonly Controls: Children; Dropdown(): void; readonly Form: Form; @@ -4033,7 +3989,7 @@ declare namespace Access { readonly Layout: AcLayoutType; readonly LayoutID: number; LeftPadding: number; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Name: string; readonly Object: any; ObjectVerbs(Index: number): string; @@ -4067,12 +4023,12 @@ declare namespace Access { class CurrentData { private 'Access.CurrentData_typekey': CurrentData; private constructor(); - readonly AllDatabaseDiagrams: AllDatabaseDiagrams; - readonly AllFunctions: AllFunctions; - readonly AllQueries: AllQueries; - readonly AllStoredProcedures: AllStoredProcedures; - readonly AllTables: AllTables; - readonly AllViews: AllViews; + readonly AllDatabaseDiagrams: AccessObjects; + readonly AllFunctions: AccessObjects; + readonly AllQueries: AccessObjects; + readonly AllStoredProcedures: AccessObjects; + readonly AllTables: AccessObjects; + readonly AllViews: AccessObjects; IsMemberSafe(dispid: number): boolean; } @@ -4081,11 +4037,11 @@ declare namespace Access { private constructor(); readonly AccessConnection: ADODB.Connection; AddSharedImage(SharedImageName: string, FileName: string): void; - readonly AllDataAccessPages: AllDataAccessPages; - readonly AllForms: AllForms; - readonly AllMacros: AllMacros; - readonly AllModules: AllModules; - readonly AllReports: AllReports; + readonly AllDataAccessPages: AccessObjects; + readonly AllForms: AccessObjects; + readonly AllMacros: AccessObjects; + readonly AllModules: AccessObjects; + readonly AllReports: AccessObjects; readonly Application: Application; readonly BaseConnectionString: string; CloseConnection(): void; @@ -4098,7 +4054,7 @@ declare namespace Access { readonly IsTrusted: boolean; readonly IsWeb: boolean; readonly Name: string; - OpenConnection(BaseConnectionString?: any, UserID?: any, Password?: any): void; + OpenConnection(BaseConnectionString?: string, UserID?: string, Password?: string): void; readonly Parent: any; readonly Path: string; readonly ProjectType: AcProjectType; @@ -4177,7 +4133,7 @@ declare namespace Access { LeftPadding: number; Locked: boolean; LpOleObject: number; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Name: string; readonly Object: any; ObjectPalette: any; @@ -4287,21 +4243,21 @@ declare namespace Access { readonly Application: Application; readonly Count: number; IsMemberSafe(dispid: number): boolean; - Item(Index: any): AccessObject; + Item(Index: number | string): AccessObject; readonly Parent: any; - (Index: any): AccessObject; + (Index: number | string): AccessObject; } class DoCmd { private 'Access.DoCmd_typekey': DoCmd; private constructor(); - AddMenu(MenuName: any, MenuMacroName: any, StatusBarText?: any): void; - ApplyFilter(FilterName?: any, WhereCondition?: any, ControlName?: any): void; - ApplyFilterOld0(FilterName?: any, WhereCondition?: any): void; + AddMenu(MenuName: string, MenuMacroName: string, StatusBarText?: string): void; + ApplyFilter(FilterName?: string, WhereCondition?: string, ControlName?: any): void; + ApplyFilterOld0(FilterName?: string, WhereCondition?: string): void; Beep(): void; /** @param DataMode [DataMode=1] */ - BrowseTo(ObjectType: AcBrowseToObjectType, ObjectName: any, PathtoSubformControl: any, WhereCondition: any, Page: any, DataMode?: AcFormOpenDataMode): void; + BrowseTo(ObjectType: AcBrowseToObjectType, ObjectName: string, PathtoSubformControl?: string, WhereCondition?: string, Page?: string, DataMode?: AcFormOpenDataMode): void; CancelEvent(): void; ClearMacroError(): void; @@ -4309,70 +4265,80 @@ declare namespace Access { * @param ObjectType [ObjectType=-1] * @param Save [Save=0] */ - Close(ObjectType: AcObjectType, ObjectName: any, Save?: AcCloseSave): void; + Close(ObjectType: AcObjectType, ObjectName: string, Save?: AcCloseSave): void; Close(): void; CloseDatabase(): void; - CopyDatabaseFile(DatabaseFileName: any, OverwriteExistingFile?: any, DisconnectAllUsers?: any): void; + CopyDatabaseFile(DatabaseFileName: string, OverwriteExistingFile?: boolean, DisconnectAllUsers?: boolean): void; /** @param SourceObjectType [SourceObjectType=-1] */ - CopyObject(DestinationDatabase: any, NewName: any, SourceObjectType?: AcObjectType, SourceObjectName?: any): void; + CopyObject(DestinationDatabase: string, NewName: string, SourceObjectType?: AcObjectType, SourceObjectName?: string): void; /** @param ObjectType [ObjectType=-1] */ - DeleteObject(ObjectType?: AcObjectType, ObjectName?: any): void; - DoMenuItem(MenuBar: any, MenuName: any, Command: any, Subcommand?: any, Version?: any): void; - Echo(EchoOn: any, StatusBarText?: any): void; + DeleteObject(ObjectType?: AcObjectType, ObjectName?: string): void; + + /** @deprecated Use the **RunCommand** method */ + DoMenuItem(MenuBar: Constants.acFormBar | number, MenuName: Constants.acFile | Constants.acEditMenu | Constants.acRecordsMenu | number, Command: Constants.acNew | Constants.acSaveForm | Constants.acSaveFormAs | Constants.acSaveRecord | Constants.acUndo | Constants.acCut | Constants.acCopy | Constants.acPaste | Constants.acDelete | Constants.acSelectRecord | Constants.acSelectAllRecords | Constants.acRefresh | number, Subcommand?: Constants.acObjectVerb | Constants.acObjectUpdate | number, Version?: Constants.acMenuVer70 | Constants.acMenuVer20 | Constants.acMenuVer1X): void; + Echo(EchoOn: boolean, StatusBarText?: string): void; FindNext(): void; /** * @param Match [Match=1] + * @param MatchCase [MatchCase=false] * @param Search [Search=2] + * @param SearchAsFormatted [SearchAsFormatted=false] * @param OnlyCurrentField [OnlyCurrentField=-1] */ - FindRecord(FindWhat: any, Match?: AcFindMatch, MatchCase?: any, Search?: AcSearchDirection, SearchAsFormatted?: any, OnlyCurrentField?: AcFindField, FindFirst?: any): void; - GoToControl(ControlName: any): void; - GoToPage(PageNumber: any, Right?: any, Down?: any): void; + FindRecord(FindWhat: string | number | VarDate, Match?: AcFindMatch, MatchCase?: boolean, Search?: AcSearchDirection, SearchAsFormatted?: boolean, OnlyCurrentField?: AcFindField, FindFirst?: boolean): void; + GoToControl(ControlName: string): void; + GoToPage(PageNumber: number, Right?: number, Down?: number): void; /** * @param ObjectType [ObjectType=-1] * @param Record [Record=1] */ - GoToRecord(ObjectType?: AcDataObjectType, ObjectName?: any, Record?: AcRecord, Offset?: any): void; - Hourglass(HourglassOn: any): void; - LockNavigationPane(Lock: any): void; + GoToRecord(ObjectType?: AcDataObjectType, ObjectName?: string, Record?: AcRecord.acFirst | AcRecord.acLast | AcRecord.acNewRec): void; + + /** + * @param ObjectType [ObjectType=-1] + * @param Record [Record=1] + */ + GoToRecord(ObjectType?: AcDataObjectType, ObjectName?: string, Record?: AcRecord, Offset?: AcRecord.acNext | AcRecord.acPrevious | AcRecord.acGoTo): void; + Hourglass(HourglassOn: boolean): void; + LockNavigationPane(Lock: boolean): void; Maximize(): void; Minimize(): void; - MoveSize(Right?: any, Down?: any, Width?: any, Height?: any): void; + MoveSize(Right?: number, Down?: number, Width?: number, Height?: number): void; NavigateTo(Category?: any, Group?: any): void; /** @param View [View=0] */ - OpenDataAccessPage(DataAccessPageName: any, View?: AcDataAccessPageView): void; - OpenDiagram(DiagramName: any): void; + OpenDataAccessPage(DataAccessPageName: string, View?: AcDataAccessPageView): void; + OpenDiagram(DiagramName: string): void; /** * @param View [View=0] * @param DataMode [DataMode=-1] * @param WindowMode [WindowMode=0] */ - OpenForm(FormName: any, View?: AcFormView, FilterName?: string, WhereCondition?: string, DataMode?: AcFormOpenDataMode, WindowMode?: AcWindowMode, OpenArgs?: string): void; + OpenForm(FormName: string, View?: AcFormView, FilterName?: string, WhereCondition?: string, DataMode?: AcFormOpenDataMode, WindowMode?: AcWindowMode, OpenArgs?: string): void; /** * @param View [View=0] * @param DataMode [DataMode=1] */ - OpenFunction(FunctionName: any, View?: AcView, DataMode?: AcOpenDataMode): void; - OpenModule(ModuleName?: any, ProcedureName?: any): void; + OpenFunction(FunctionName: string, View?: AcView, DataMode?: AcOpenDataMode): void; + OpenModule(ModuleName?: string, ProcedureName?: string): void; /** * @param View [View=0] * @param DataMode [DataMode=1] */ - OpenQuery(QueryName: any, View?: AcView, DataMode?: AcOpenDataMode): void; + OpenQuery(QueryName: string, View?: AcView, DataMode?: AcOpenDataMode): void; /** * @param View [View=0] * @param WindowMode [WindowMode=0] */ - OpenReport(ReportName: any, View?: AcView, FilterName?: string, WhereCondition?: string, WindowMode?: AcWindowMode, OpenArgs?: string): void; + OpenReport(ReportName: string, View?: AcView, FilterName?: string, WhereCondition?: string, WindowMode?: AcWindowMode, OpenArgs?: string): void; /** @param View [View=0] */ OpenReportOld0(ReportName: any, View?: AcView, FilterName?: any, WhereCondition?: any): void; @@ -4381,91 +4347,123 @@ declare namespace Access { * @param View [View=0] * @param DataMode [DataMode=1] */ - OpenStoredProcedure(ProcedureName: any, View?: AcView, DataMode?: AcOpenDataMode): void; + OpenStoredProcedure(ProcedureName: string, View?: AcView, DataMode?: AcOpenDataMode): void; /** * @param View [View=0] * @param DataMode [DataMode=1] */ - OpenTable(TableName: any, View?: AcView, DataMode?: AcOpenDataMode): void; + OpenTable(TableName: string, View?: AcView, DataMode?: AcOpenDataMode): void; /** * @param View [View=0] * @param DataMode [DataMode=1] */ - OpenView(ViewName: any, View?: AcView, DataMode?: AcOpenDataMode): void; + OpenView(ViewName: string, View?: AcView, DataMode?: AcOpenDataMode): void; /** @param OutputQuality [OutputQuality=0] */ - OutputTo(ObjectType: AcOutputObjectType, ObjectName: any, OutputFormat: any, OutputFile: any, AutoStart: any, TemplateFile: any, Encoding: any, OutputQuality?: AcExportQuality): void; + OutputTo(ObjectType: AcOutputObjectType.acOutputModule, ObjectName: string, OutputFormat: AcOutputFormat.acFormatTXT, OutputFile: string, AutoStart: boolean, TemplateFile: string, Encoding: any, OutputQuality?: AcExportQuality): void; + + /** @param OutputQuality [OutputQuality=0] */ + OutputTo(ObjectType: AcOutputObjectType, ObjectName?: string, OutputFormat?: AcOutputFormat, OutputFile?: string, AutoStart?: boolean, TemplateFile?: string, Encoding?: any, OutputQuality?: AcExportQuality): void; OutputToOld0(ObjectType: AcOutputObjectType, ObjectName?: any, OutputFormat?: any, OutputFile?: any, AutoStart?: any, TemplateFile?: any): void; OutputToOld1(ObjectType: AcOutputObjectType, ObjectName?: any, OutputFormat?: any, OutputFile?: any, AutoStart?: any, TemplateFile?: any, Encoding?: any): void; /** * @param PrintRange [PrintRange=0] * @param PrintQuality [PrintQuality=0] + * @param Copies [Copies=1] + * @param CollateCopies [CollateCopies=true] */ - PrintOut(PrintRange?: AcPrintRange, PageFrom?: any, PageTo?: any, PrintQuality?: AcPrintQuality, Copies?: any, CollateCopies?: any): void; + PrintOut(PrintRange: AcPrintRange.acPages, PageFrom?: number, PageTo?: number, PrintQuality?: AcPrintQuality, Copies?: number, CollateCopies?: boolean): void; + + /** + * @param PrintRange [PrintRange=0] + * @param PrintQuality [PrintQuality=0] + * @param Copies [Copies=1] + * @param CollateCopies [CollateCopies=true] + */ + PrintOut(PrintRange?: AcPrintRange, PageFrom?: undefined, PageTo?: undefined, PrintQuality?: AcPrintQuality, Copies?: number, CollateCopies?: boolean): void; /** @param Options [Options=1] */ Quit(Options?: AcQuitOption): void; RefreshRecord(): void; /** @param ObjectType [ObjectType=-1] */ - Rename(NewName: any, ObjectType?: AcObjectType, OldName?: any): void; + Rename(NewName: string, ObjectType: AcObjectType, OldName: string): void; + Rename(NewName: string): void; /** @param ObjectType [ObjectType=-1] */ - RepaintObject(ObjectType?: AcObjectType, ObjectName?: any): void; - Requery(ControlName?: any): void; + RepaintObject(ObjectType: AcObjectType, ObjectName: string): void; + RepaintObject(): void; + + Requery(ControlName?: string): void; Restore(): void; RunCommand(Command: AcCommand): void; - RunDataMacro(MacroName: any): void; - RunMacro(MacroName: any, RepeatCount?: any, RepeatExpression?: any): void; - RunSavedImportExport(SavedImportExportName: any): void; - RunSQL(SQLStatement: any, UseTransaction?: any): void; + RunDataMacro(MacroName: string): void; + RunMacro(MacroName: string, RepeatCount?: number, RepeatExpression?: string): void; + RunSavedImportExport(SavedImportExportName: string): void; + RunSQL(SQLStatement: string, UseTransaction?: boolean): void; /** @param ObjectType [ObjectType=-1] */ - Save(ObjectType?: AcObjectType, ObjectName?: any): void; + Save(ObjectType: AcObjectType | undefined, ObjectName: string): void; + Save(): void; /** * @param ObjectType [ObjectType=-1] * @param Record [Record=2] */ - SearchForRecord(ObjectType?: AcDataObjectType, ObjectName?: any, Record?: AcRecord, WhereCondition?: any): void; - SelectObject(ObjectType: AcObjectType, ObjectName?: any, InDatabaseWindow?: any): void; + SearchForRecord(ObjectType?: AcDataObjectType, ObjectName?: string, Record?: AcRecord, WhereCondition?: string): void; + SelectObject(ObjectType: AcObjectType, ObjectName: string | undefined, InDatabaseWindow: true): void; + SelectObject(ObjectType: AcObjectType, ObjectName: string): void; /** @param ObjectType [ObjectType=-1] */ - SendObject(ObjectType?: AcSendObjectType, ObjectName?: any, OutputFormat?: any, To?: any, Cc?: any, Bcc?: any, Subject?: any, MessageText?: any, EditMessage?: any, TemplateFile?: any): void; - SetDisplayedCategories(Show: any, Category?: any): void; - SetFilter(FilterName?: any, WhereCondition?: any, ControlName?: any): void; - SetMenuItem(MenuIndex: any, CommandIndex?: any, SubcommandIndex?: any, Flag?: any): void; - SetOrderBy(OrderBy: any, ControlName?: any): void; - SetParameter(Name: any, Expression: any): void; + SendObject(ObjectType?: AcSendObjectType, ObjectName?: string, OutputFormat?: AcOutputFormat, To?: string, Cc?: string, Bcc?: string, Subject?: string, MessageText?: string, EditMessage?: boolean, TemplateFile?: string): void; + SetDisplayedCategories(Show: boolean, Category?: string): void; + SetFilter(FilterName?: string, WhereCondition?: string, ControlName?: string): void; + SetMenuItem(MenuIndex: number, CommandIndex?: number, SubcommandIndex?: number, Flag?: AcSetMenuItemState): void; + SetOrderBy(OrderBy: string, ControlName?: string): void; + SetParameter(Name: string, Expression: any): void; /** @param Property [Property=0] */ - SetProperty(ControlName: any, Property?: AcProperty, Value?: any): void; - SetWarnings(WarningsOn: any): void; + SetProperty(ControlName: string, Property?: AcProperty, Value?: any): void; + SetWarnings(WarningsOn: boolean): void; ShowAllRecords(): void; /** @param Show [Show=0] */ - ShowToolbar(ToolbarName: any, Show?: AcShowToolbar): void; + ShowToolbar(ToolbarName: string, Show?: AcShowToolbar): void; SingleStep(): void; /** * @param TransferType [TransferType=0] * @param ObjectType [ObjectType=0] + * @param StructureOnly [StructureOnly=false\] + * @param StoreLogin [StoreLogin=false] */ - TransferDatabase(TransferType?: AcDataTransferType, DatabaseType?: any, DatabaseName?: any, ObjectType?: AcObjectType, Source?: any, Destination?: any, StructureOnly?: any, StoreLogin?: any): void; - TransferSharePointList(TransferType: AcSharePointListTransferType, SiteAddress: any, ListID: any, ViewID?: any, TableName?: any, GetLookupDisplayValues?: any): void; + TransferDatabase(TransferType?: AcDataTransferType, DatabaseType?: DatabaseType, DatabaseName?: string, ObjectType?: AcObjectType, Source?: string, Destination?: string, StructureOnly?: boolean, StoreLogin?: boolean): void; + TransferSharePointList(TransferType: AcSharePointListTransferType, SiteAddress: string, ListID: string, ViewID?: string, TableName?: string, GetLookupDisplayValues?: boolean): void; /** * @param TransferType [TransferType=0] * @param SpreadsheetType [SpreadsheetType=10] + * @param HasFieldNames [HasFieldNames=false] */ - TransferSpreadsheet(TransferType?: AcDataTransferType, SpreadsheetType?: AcSpreadSheetType, TableName?: any, FileName?: any, HasFieldNames?: any, Range?: any, UseOA?: any): void; - TransferSQLDatabase(Server: any, Database: any, UseTrustedConnection?: any, Login?: any, Password?: any, TransferCopyData?: any): void; + TransferSpreadsheet(TransferType: AcDataTransferType.acImport, SpreadsheetType?: AcSpreadSheetType, TableName?: string, FileName?: string, HasFieldNames?: boolean, Range?: any): void; - /** @param TransferType [TransferType=0] */ - TransferText(TransferType?: AcTextTransferType, SpecificationName?: any, TableName?: any, FileName?: any, HasFieldNames?: any, HTMLTableName?: any, CodePage?: any): void; + /** + * @param TransferType [TransferType=0] + * @param SpreadsheetType [SpreadsheetType=10] + * @param HasFieldNames [HasFieldNames=false] + */ + TransferSpreadsheet(TransferType?: AcDataTransferType, SpreadsheetType?: AcSpreadSheetType, TableName?: string, FileName?: string, HasFieldNames?: boolean): void; + TransferSQLDatabase(Server: string, Database: string, UseTrustedConnection?: boolean, Login?: string, Password?: string, TransferCopyData?: boolean): void; + + /** + * @param TransferType [TransferType=0] + * @param Encoding For valid values see https://msdn.microsoft.com/en-us/library/windows/desktop/dd317756(v=vs.85).aspx + */ + TransferText(TransferType?: AcTextTransferType.acExportHTML | AcTextTransferType.acImportHTML, SpecificationName?: string, TableName?: string, FileName?: string, HasFieldNames?: boolean, HTMLTableName?: string, CodePage?: number): void; + TransferText(TransferType?: AcTextTransferType, SpecificationName?: string, TableName?: string, FileName?: string, HasFieldNames?: boolean, HTMLTableName?: undefined, CodePage?: number): void; } class EmptyCell { @@ -4526,7 +4524,7 @@ declare namespace Access { readonly LayoutID: number; Left: number; LeftPadding: number; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Name: string; readonly Parent: any; readonly Properties: Properties; @@ -4637,7 +4635,7 @@ declare namespace Access { BeforeUpdateMacro: string; BeginBatchEdit: string; BeginBatchEditMacro: string; - Bookmark: any; + Bookmark: ADODB.Bookmark | DAO.Bookmark; BorderStyle: number; Caption: string; readonly ChartSpace: any; @@ -4726,7 +4724,7 @@ declare namespace Access { readonly Module: Module; MouseWheel: string; MouseWheelMacro: string; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Moveable: boolean; Name: string; NavigationButtons: boolean; @@ -4790,7 +4788,7 @@ declare namespace Access { OnUndoMacro: string; OnUnload: string; OnUnloadMacro: string; - OpenArgs: any; + OpenArgs: string; OrderBy: string; OrderByOn: boolean; OrderByOnLoad: boolean; @@ -5254,7 +5252,7 @@ declare namespace Access { Modal: boolean; readonly Module: Module; MouseWheel: string; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Moveable: boolean; Name: string; NavigationButtons: boolean; @@ -5465,7 +5463,7 @@ declare namespace Access { readonly LayoutID: number; Left: number; LeftPadding: number; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Name: string; ObjectPalette: any; OldBorderStyle: number; @@ -5610,7 +5608,7 @@ declare namespace Access { LeftMargin: number; LeftPadding: number; LineSpacing: number; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Name: string; NumeralShapes: number; OldBorderStyle: number; @@ -5672,7 +5670,7 @@ declare namespace Access { IsVisible: boolean; Left: number; LineSlant: boolean; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Name: string; OldBorderStyle: number; readonly Parent: any; @@ -5797,7 +5795,7 @@ declare namespace Access { ListIndex: number; ListItemsEditForm: string; Locked: boolean; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; MultiSelect: number; Name: string; NumeralShapes: number; @@ -6036,7 +6034,7 @@ declare namespace Access { readonly LayoutID: number; readonly Left: number; LeftPadding: number; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Name: string; NavigationTargetName: string; NavigationWhereClause: string; @@ -6184,7 +6182,7 @@ declare namespace Access { Left: number; LeftPadding: number; LineSpacing: number; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Name: string; NumeralShapes: number; OldBorderStyle: number; @@ -6321,7 +6319,7 @@ declare namespace Access { LinkMasterFields: string; Locked: boolean; LpOleObject: number; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Name: string; readonly Object: any; ObjectPalette: any; @@ -6482,7 +6480,7 @@ declare namespace Access { Left: number; LeftPadding: number; Locked: boolean; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Name: string; OldBorderStyle: number; readonly OldValue: any; @@ -6604,7 +6602,7 @@ declare namespace Access { LabelY: number; Left: number; Locked: boolean; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Name: string; OldBorderStyle: number; readonly OldValue: any; @@ -6683,7 +6681,7 @@ declare namespace Access { IsMemberSafe(dispid: number): boolean; IsVisible: boolean; Left: number; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Name: string; OnClick: string; OnClickMacro: string; @@ -6727,7 +6725,7 @@ declare namespace Access { IsMemberSafe(dispid: number): boolean; IsVisible: boolean; Left: number; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Name: string; readonly Parent: any; readonly Properties: Properties; @@ -6785,7 +6783,7 @@ declare namespace Access { LabelY: number; Left: number; Locked: boolean; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Name: string; readonly OldValue: any; OnClick: string; @@ -6907,7 +6905,7 @@ declare namespace Access { IsMemberSafe(dispid: number): boolean; IsVisible: boolean; Left: number; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Name: string; OldBorderStyle: number; OnClick: string; @@ -7031,7 +7029,7 @@ declare namespace Access { readonly Module: Module; MouseWheel: string; MouseWheelMacro: string; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Moveable: boolean; MoveLayout: boolean; Name: string; @@ -7327,7 +7325,7 @@ declare namespace Access { MinMaxButtons: number; Modal: boolean; readonly Module: Module; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Moveable: boolean; MoveLayout: boolean; Name: string; @@ -7651,7 +7649,7 @@ declare namespace Access { LinkChildFields: string; LinkMasterFields: string; Locked: boolean; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Name: string; OldBorderStyle: number; OnEnter: string; @@ -7771,7 +7769,7 @@ declare namespace Access { readonly LayoutID: number; Left: number; LeftPadding: number; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; MultiRow: boolean; Name: string; readonly OldValue: any; @@ -7968,7 +7966,7 @@ declare namespace Access { LeftPadding: number; LineSpacing: number; Locked: boolean; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Name: string; NumeralShapes: number; OldBorderStyle: number; @@ -8149,7 +8147,7 @@ declare namespace Access { Left: number; LeftPadding: number; Locked: boolean; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Name: string; ObjectPalette: any; readonly OldValue: any; @@ -8285,7 +8283,7 @@ declare namespace Access { Left: number; LeftPadding: number; readonly LocationURL: string; - Move(Left: any, Top?: any, Width?: any, Height?: any): void; + Move(Left: number, Top?: number, Width?: number, Height?: number): void; Name: string; readonly Object: any; readonly OldValue: any; From 8eb8a46af9eafbf6f5df807ec0d87fc91297c8c7 Mon Sep 17 00:00:00 2001 From: jonbretman Date: Mon, 21 May 2018 08:58:01 +0100 Subject: [PATCH 292/575] fix(stripe): listSource should be listSources --- types/stripe/index.d.ts | 14 +++++++------- types/stripe/stripe-tests.ts | 19 +++++++++++++++++++ 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/types/stripe/index.d.ts b/types/stripe/index.d.ts index 418525d38f..991d4a618a 100644 --- a/types/stripe/index.d.ts +++ b/types/stripe/index.d.ts @@ -4460,7 +4460,7 @@ declare namespace Stripe { billing?: SubscriptionBilling; /** - * Number of days a customer has to pay invoices generated by this subscription. + * Number of days a customer has to pay invoices generated by this subscription. * Only valid for subscriptions where billing=send_invoice. */ days_until_due?: number; @@ -5753,8 +5753,8 @@ declare namespace Stripe { * @param customerId The ID of the customer whose cards will be retrieved * @param data Filtering options */ - listSource(customerId: string, data: customers.ICardSourceListOptions, options: HeaderOptions, response?: IResponseFn>): Promise>; - listSource(customerId: string, data: customers.ICardSourceListOptions, response?: IResponseFn>): Promise>; + listSources(customerId: string, data: customers.ICardSourceListOptions, options: HeaderOptions, response?: IResponseFn>): Promise>; + listSources(customerId: string, data: customers.ICardSourceListOptions, response?: IResponseFn>): Promise>; /** * You can see a list of the bank accounts belonging to a customer or recipient. Note that the 10 most recent * bank accounts are always available by default on the customer or recipient object. If you need more than @@ -5768,8 +5768,8 @@ declare namespace Stripe { * @param customerId The ID of the customer whose cards will be retrieved * @param data Filtering options */ - listSource(customerId: string, data: customers.IBankAccountSourceListOptions, options: HeaderOptions, response?: IResponseFn>): Promise>; - listSource(customerId: string, data: customers.IBankAccountSourceListOptions, response?: IResponseFn>): Promise>; + listSources(customerId: string, data: customers.IBankAccountSourceListOptions, options: HeaderOptions, response?: IResponseFn>): Promise>; + listSources(customerId: string, data: customers.IBankAccountSourceListOptions, response?: IResponseFn>): Promise>; /** * By default, you can see the 10 most recent cards/bank accounts stored on a customer or recipient directly on the customer or recipient object, but @@ -7104,10 +7104,10 @@ declare namespace Stripe { * Many objects contain the ID of a related object in their response properties. For example, a Charge may have an associated Customer ID. * Those objects can be expanded inline with the expand request parameter. Objects that can be expanded are noted in this documentation. * This parameter is available on all API requests, and applies to the response of that request only. - * + * * You can nest expand requests with the dot property. For example, requesting invoice.customer on a charge will expand the invoice property * into a full Invoice object, and will then expand the customer property on that invoice into a full Customer object. - * + * * You can expand multiple objects at once by identifying multiple items in the expand array. */ expand?: string[]; diff --git a/types/stripe/stripe-tests.ts b/types/stripe/stripe-tests.ts index e56a454108..91cfa0f50c 100644 --- a/types/stripe/stripe-tests.ts +++ b/types/stripe/stripe-tests.ts @@ -495,6 +495,25 @@ stripe.customers.listCards('cu_15fvyVEe31JkLCeQvr155iqc').then(function (cards) // asynchronously called }); +stripe.customers.listSources('cu_15fvyVEe31JkLCeQvr155iqc', null, function (err, cards) { + // asynchronously called +}); +stripe.customers.listSources('cu_15fvyVEe31JkLCeQvr155iqc', null).then(function (cards) { + // asynchronously called +}); +stripe.customers.listSources('cu_15fvyVEe31JkLCeQvr155iqc', { + object: "card", + limit: 100 +}).then(function (cards) { + // asynchronously called +}); +stripe.customers.listSources('cu_15fvyVEe31JkLCeQvr155iqc', { + object: "bank_account", + limit: 100 +}).then(function (cards) { + // asynchronously called +}); + stripe.customers.retrieveSubscription( "cus_5rfJKDJkuxzh5Q", "sub_5rfJxnBLGSwsYp", From fce821fb6e5cfb5e69ad561e1121be030a1ee25d Mon Sep 17 00:00:00 2001 From: David Rouyer Date: Mon, 21 May 2018 18:28:45 +0200 Subject: [PATCH 293/575] [Dropzone] Add chunks options --- types/dropzone/dropzone-tests.ts | 17 +++++++++++++++++ types/dropzone/index.d.ts | 7 +++++++ 2 files changed, 24 insertions(+) diff --git a/types/dropzone/dropzone-tests.ts b/types/dropzone/dropzone-tests.ts index 4abc3a6223..1caed5f4e2 100644 --- a/types/dropzone/dropzone-tests.ts +++ b/types/dropzone/dropzone-tests.ts @@ -14,6 +14,12 @@ const dropzoneWithOptions = new Dropzone(".test", { withCredentials: false, parallelUploads: 2, uploadMultiple: true, + chunking: true, + forceChunking: true, + chunkSize: 4000000, + parallelChunkUploads: true, + retryChunks: true, + retryChunksLimit: 6, maxFilesize: 1024, paramName: "file", createImageThumbnails: true, @@ -69,6 +75,17 @@ const dropzoneWithOptions = new Dropzone(".test", { done(new Error(file.status)); } }, + chunksUploaded: (file: Dropzone.DropzoneFile, done: (error?: string | Error) => void) => { + if (file.accepted) { + file.previewElement.classList.add("accepted"); + file.previewTemplate.classList.add("accepted"); + file.previewsContainer.classList.add("accepted"); + done(); + } + else { + done(new Error(file.status)); + } + }, init: () => console.log("Initialized"), forceFallback: false, fallback: () => console.log("Fallback"), diff --git a/types/dropzone/index.d.ts b/types/dropzone/index.d.ts index 0295afbed2..93f95d2a65 100644 --- a/types/dropzone/index.d.ts +++ b/types/dropzone/index.d.ts @@ -42,6 +42,12 @@ declare namespace Dropzone { timeout?: number; parallelUploads?: number; uploadMultiple?: boolean; + chunking?: boolean; + forceChunking?: boolean; + chunkSize?: number; + parallelChunkUploads?: boolean; + retryChunks?: boolean; + retryChunksLimit?: number; maxFilesize?: number; paramName?: string; createImageThumbnails?: boolean; @@ -83,6 +89,7 @@ declare namespace Dropzone { dictFileSizeUnits?: DropzoneDictFileSizeUnits; accept?(file: DropzoneFile, done: (error?: string | Error) => void): void; + chunksUploaded?(file: DropzoneFile, done: (error?: string | Error) => void): void; init?(): void; forceFallback?: boolean; fallback?(): void; From 13bc1daa61b85c4674364259392e715aa1dd3a19 Mon Sep 17 00:00:00 2001 From: kaaboaye Date: Mon, 21 May 2018 18:32:54 +0200 Subject: [PATCH 294/575] layout can be also a filename, so boolean is not enough. It should be boolean | string --- types/vision/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/vision/index.d.ts b/types/vision/index.d.ts index 1c4e2ddc33..6c6c2a23bd 100644 --- a/types/vision/index.d.ts +++ b/types/vision/index.d.ts @@ -72,7 +72,7 @@ declare namespace vision { * Disable layout when using Jade as it will handle including any layout files independently. * Defaults to false. */ - layout?: boolean; + layout?: boolean | string; /** the root file path, or array of file paths, where layout templates are located (using the relativeTo prefix if present). Defaults to path. */ layoutPath?: string | string[]; /** the key used by the template engine to denote where primary template content should go. Defaults to 'content'. */ From 7cdd1daa0dbc33389249ba2376003601b36cf6cd Mon Sep 17 00:00:00 2001 From: Alex Jerabek <38896772+AlexJerabek@users.noreply.github.com> Date: Mon, 21 May 2018 10:46:26 -0700 Subject: [PATCH 295/575] Spacing cleanup and removing 'last modified in' comments (#4) --- types/office-js/index.d.ts | 58 ++++++++------------------------------ 1 file changed, 12 insertions(+), 46 deletions(-) diff --git a/types/office-js/index.d.ts b/types/office-js/index.d.ts index cf1c5dbb51..d29491618e 100644 --- a/types/office-js/index.d.ts +++ b/types/office-js/index.d.ts @@ -145,38 +145,30 @@ declare namespace Office { } // Objects /** - * An object which encapsulates the result of an asynchronous request, including status and error information if the request failed. - * + * An object which encapsulates the result of an asynchronous request, including status and error information if the request failed. + * * **Hosts**: Access, Excel, Outlook, PowerPoint, Project, Word * - * **Last changed in**: 1.1 - * * @remarks * When the function you pass to the `callback` parameter of an "Async" method executes, it receives an AsyncResult object that you can access from the `callback` function's only parameter. - */ + */ export interface AsyncResult { /** * Gets the user-defined item passed to the optional `asyncContext` parameter of the invoked method in the same state as it was passed in. This the user-defined item (which can be of any JavaScript type: String, Number, Boolean, Object, Array, Null, or Undefined) passed to the optional `asyncContext` parameter of the invoked method. Returns Undefined, if you didn't pass anything to the asyncContext parameter. * * **Hosts**: Access, Excel, Outlook, PowerPoint, Project, Word - * - * **Last changed in**: 1.1 */ asyncContext: any; /** * Gets the [AsyncResultStatus](office.asyncresultstatus.md) of the asynchronous operation. * * **Hosts**: Access, Excel, Outlook, PowerPoint, Project, Word - * - * **Last changed in**: 1.1 */ status: AsyncResultStatus; /** * Gets an [Error](office.error.md) object that provides a description of the error, if any error occurred. * * **Hosts**: Access, Excel, Outlook, PowerPoint, Project, Word - * - * **Last changed in**: 1.1 */ error: Error; /** @@ -186,8 +178,6 @@ declare namespace Office { * * **Hosts**: Access, Excel, Outlook, PowerPoint, Project, Word * - * **Last changed in**: 1.1 - * * @remarks * You access the AsyncResult object in the function passed as the argument to the callback parameter of an "Async" method, such as the `getSelectedDataAsync` and `setSelectedDataAsync` methods of the Document object. */ @@ -482,8 +472,6 @@ declare namespace Office { * * Hosts: Access, Excel, Word * - * Last changed in: 1.1 - * * @remarks * To add an event handler for the BindingDataChanged event of a binding, use the addHandlerAsync method of the Binding object. The event handler receives an argument of type BindingDataChangedEventArgs. */ @@ -495,8 +483,6 @@ declare namespace Office { * * Available in Requirement set: BindingEvents * - * Last changed in: 1.1 - * * @remarks * To add an event handler for the BindingSelectionChanged event of a binding, use the addHandlerAsync method of the Binding object. The event handler receives an argument of type BindingSelectionChangedEventArgs. */ @@ -656,8 +642,6 @@ declare namespace Office { * * **Available in Requirement sets**: MatrixBinding, TableBinding, TextBinding * - * **Last changed in**: 1.1 - * * @remarks * The Binding object exposes the functionality possessed by all bindings regardless of type. * @@ -668,25 +652,19 @@ declare namespace Office { * Get the Document object associated with the binding. * * **Hosts**: Access, Excel, Word - * - * **Last changed in**: 1.1 */ document: Document; /** * A string that uniquely identifies this binding among the bindings in the same Document object. * * Hosts: Access, Excel, Word - * - * Last changed in: 1.1 */ id: string; /** - * Gets the type of the binding. - * + * Gets the type of the binding. + * * **Hosts**: Access, Excel, Word - - * **Last changed in**: 1.1 - */ + */ type: BindingType; /** * Adds an event handler to the object for the specified event type. @@ -707,8 +685,6 @@ declare namespace Office { * * Available in Requirement sets: MatrixBindings, TableBindings, TextBindings * - * Last changed in: 1.1 - * * @remarks * When called from a MatrixBinding or TableBinding, the getDataAsync method will return a subset of the bound values if the optional startRow, startColumn, rowCount, and columnCount parameters are specified (and they specify a contiguous and valid range). * @@ -742,8 +718,6 @@ declare namespace Office { * * **Available in Requirement set**: BindingEvents * - * **Last changed in**: 1.1 - * * @param eventType The event type. For binding can be 'bindingDataChanged' and 'bindingSelectionChanged' * @param options An object with any of the following: * @@ -761,8 +735,6 @@ declare namespace Office { * * **Available in Requirement sets**: MatrixBindings, TableBindings, TextBindings * - * **Last changed in**: 1.1 - * * @param data The data to be set in the current selection. Possible data types by host: * * string: Excel, Excel Online, Word, and Word Online only @@ -1174,31 +1146,25 @@ declare namespace Office { * * **Available in Requirement set**: MatrixBindings * - * **Last changed in**: 1.1 - * * @remarks * The MatrixBinding object inherits the id property, type property, getDataAsync method, and setDataAsync method from the Binding object. */ export interface MatrixBinding extends Binding { /** - * Gets the number of columns in the matrix data structure, as an integer value. - * + * Gets the number of columns in the matrix data structure, as an integer value. + * * **Hosts**: Access, Excel, PowerPoint, Project, Word * * Available in Requirement set: MatrixBindings - * - * **Last changed in**: 1.1 - */ + */ columnCount: number; /** - * Gets the number of rows in the matrix data structure, as an integer value. - * + * Gets the number of rows in the matrix data structure, as an integer value. + * * **Hosts**: Access, Excel, PowerPoint, Project, Word * * Available in Requirement set: MatrixBindings - * - * **Last changed in**: 1.1 - */ + */ rowCount: number; } /** From 4e3aa7a59c1eade452dd1bf2f1f5923374ba6487 Mon Sep 17 00:00:00 2001 From: Alex Jerabek Date: Mon, 21 May 2018 11:14:06 -0700 Subject: [PATCH 296/575] Fix spacing and 'last modified in' prose --- types/office-js/index.d.ts | 219 +++++-------------------------------- 1 file changed, 28 insertions(+), 191 deletions(-) diff --git a/types/office-js/index.d.ts b/types/office-js/index.d.ts index 6ec8e726e1..8c687606c0 100644 --- a/types/office-js/index.d.ts +++ b/types/office-js/index.d.ts @@ -151,23 +151,19 @@ declare namespace Office { } // Objects /** - * An object which encapsulates the result of an asynchronous request, including status and error information if the request failed. - * + * An object which encapsulates the result of an asynchronous request, including status and error information if the request failed. + * * @remarks * Hosts: Access, Excel, Outlook, PowerPoint, Project, Word - * - * Last changed in: 1.1 * * When the function you pass to the `callback` parameter of an "Async" method executes, it receives an AsyncResult object that you can access from the `callback` function's only parameter. - */ + */ export interface AsyncResult { /** * Gets the user-defined item passed to the optional `asyncContext` parameter of the invoked method in the same state as it was passed in. This the user-defined item (which can be of any JavaScript type: String, Number, Boolean, Object, Array, Null, or Undefined) passed to the optional `asyncContext` parameter of the invoked method. Returns Undefined, if you didn't pass anything to the asyncContext parameter. * * @remarks * Hosts: Access, Excel, Outlook, PowerPoint, Project, Word - * - * Last changed in: 1.1 */ asyncContext: any; /** @@ -175,8 +171,6 @@ declare namespace Office { * * @remarks * Hosts: Access, Excel, Outlook, PowerPoint, Project, Word - * - * Last changed in: 1.1 */ status: AsyncResultStatus; /** @@ -184,8 +178,6 @@ declare namespace Office { * * @remarks * Hosts: Access, Excel, Outlook, PowerPoint, Project, Word - * - * Last changed in: 1.1 */ error: Error; /** @@ -197,8 +189,6 @@ declare namespace Office { * Note: What the value property returns for a particular "Async" method varies depending on the purpose and context of that method. To determine what is returned by the value property for an "Async" method, refer to the "Callback value" section of the method's topic. For a complete listing of the "Async" methods, see the Remarks section of the AsyncResult object topic. * * Hosts: Access, Excel, Outlook, PowerPoint, Project, Word - * - * Last changed in: 1.1 */ value: any; } @@ -207,8 +197,6 @@ declare namespace Office { * * @remarks * Hosts: Access, Excel, Outlook, PowerPoint, Project, Word - * - * Last changed in: 1.1 */ export interface Context { /** @@ -295,14 +283,12 @@ declare namespace Office { export interface UI { /** * Displays a dialog to show or collect information from the user or to facilitate Web navigation. - * + * * @remarks * Hosts: Word, Excel, Outlook, PowerPoint * * Requirement sets: DialogApi, Mailbox 1.4 * - * Last changed in: DialogApi 1.1, Mailbox 1.4 - * * The initial page must be on the same domain as the parent page (the startAddress parameter). After the initial page loads, you can go to other domains. * * Any page calling office.context.ui.messageParent must also be on the same domain as the parent page. @@ -374,9 +360,7 @@ declare namespace Office { * @remarks * Hosts: Excel, OneNote, Outlook, PowerPoint, Word * - * Requirement sets: IdentityAPI - * - * Last changed in: 1.1 + * Requirement sets: IdentityApi * * This API requires a single sign-on configuration that bridges the add-in to an Azure application. Office users sign-in with Organizational Accounts and Microsoft Accounts. Microsoft Azure returns tokens intended for both user account types to access resources in the Microsoft Graph. * @@ -554,8 +538,6 @@ declare namespace Office { * @remarks * Hosts: Access, Excel, Word * - * Last changed in: 1.1 - * * To add an event handler for the BindingDataChanged event of a binding, use the addHandlerAsync method of the Binding object. The event handler receives an argument of type BindingDataChangedEventArgs. */ BindingDataChanged, @@ -567,8 +549,6 @@ declare namespace Office { * * Available in Requirement set: BindingEvents * - * Last changed in: 1.1 - * * To add an event handler for the BindingSelectionChanged event of a binding, use the addHandlerAsync method of the Binding object. The event handler receives an argument of type BindingSelectionChangedEventArgs. */ BindingSelectionChanged, @@ -728,8 +708,6 @@ declare namespace Office { * * Available in Requirement sets: MatrixBinding, TableBinding, TextBinding * - * Last changed in: 1.1 - * * The Binding object exposes the functionality possessed by all bindings regardless of type. * * The Binding object is never called directly. It is the abstract parent class of the objects that represent each type of binding: MatrixBinding, TableBinding, or TextBinding. All three of these objects inherit the getDataAsync and setDataAsync methods from the Binding object that enable to you interact with the data in the binding. They also inherit the id and type properties for querying those property values. Additionally, the MatrixBinding and TableBinding objects expose additional methods for matrix- and table-specific features, such as counting the number of rows and columns. @@ -740,8 +718,6 @@ declare namespace Office { * *@remarks * Hosts: Access, Excel, Word - * - * Last changed in: 1.1 */ document: Document; /** @@ -749,18 +725,14 @@ declare namespace Office { * *@remarks * Hosts: Access, Excel, Word - * - * Last changed in: 1.1 */ id: string; /** - * Gets the type of the binding. - * + * Gets the type of the binding. + * *@remarks * Hosts: Access, Excel, Word - * - * Last changed in: 1.1 - */ + */ type: BindingType; /** * Adds an event handler to the object for the specified event type. @@ -782,8 +754,6 @@ declare namespace Office { * * Available in Requirement sets: MatrixBindings, TableBindings, TextBindings * - * Last changed in: 1.1 - * * When called from a MatrixBinding or TableBinding, the getDataAsync method will return a subset of the bound values if the optional startRow, startColumn, rowCount, and columnCount parameters are specified (and they specify a contiguous and valid range). * * @param options An object with any of the following (example: {coercionType: 'matrix, 'valueFormat: 'formatted', filterType:'all'}): @@ -817,8 +787,6 @@ declare namespace Office { * * Available in Requirement set: BindingEvents * - * Last changed in: 1.1 - * * @param eventType The event type. For binding can be 'bindingDataChanged' and 'bindingSelectionChanged' * @param options An object with any of the following: * @@ -837,8 +805,6 @@ declare namespace Office { * * Available in Requirement sets: MatrixBindings, TableBindings, TextBindings * - * Last changed in: 1.1 - * * @param data The data to be set in the current selection. Possible data types by host: * * string: Excel, Excel Online, Word, and Word Online only @@ -878,22 +844,18 @@ declare namespace Office { * *@remarks * Hosts: - * - * Last changed in: 1.1 */ export interface Bindings { /** - * Gets a Document object that represents the document associated with this set of bindings. - * + * Gets a Document object that represents the document associated with this set of bindings. + * *remarks * Hosts: Access, Excel, Word - * - * Last changed in: 1.1 - */ + */ document: Document; /** * Creates a binding against a named object in the document. - * + * *@remarks * Hosts: Access, Excel, Word * @@ -932,8 +894,6 @@ declare namespace Office { * * Available in Requirement set: Not in a set * - * Last changed in: 1.1 - * * Adds a binding object of the specified type to the Bindings collection, which will be identified with the supplied id. The method fails if the specified selection cannot be bound. * * @param bindingType Specifies the type of the binding object to create. Required. Returns null if the selected object cannot be coerced into the specified type. @@ -958,8 +918,6 @@ declare namespace Office { * * Available in Requirement set: MatrixBindings, TableBindings, TextBindings * - * Last changed in: 1.1 - * * Adds the specified type of binding object to the Bindings collection, which will be identified with the supplied id. * * Note In Excel, if you call the addFromSelectionAsync method passing in the Binding.id of an existing binding, the Binding.type of that binding is used, and its type cannot be changed by specifying a different value for the bindingType parameter.If you need to use an existing id and change the bindingType, call the Bindings.releaseByIdAsync method first to release the binding, and then call the addFromSelectionAsync method to reestablish the binding with a new type. @@ -986,8 +944,6 @@ declare namespace Office { * * Available in Requirement set: MatrixBindings, TableBindings, TextBindings * - * Last changed in: 1.1 - * * @param options An object like {asyncContext:context} where `context` is a user-defined item of any type that is returned in the AsyncResult object without being altered. * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ @@ -1000,8 +956,6 @@ declare namespace Office { * * Available in Requirement set: CustomXmlParts, MatrixBindings, TableBindings, TextBindings * - * Last changed in: 1.1 - * * Fails if the specified id does not exist. * * @param id Specifies the unique name of the binding object. Required. @@ -1017,8 +971,6 @@ declare namespace Office { * * Available in Requirement set: MatrixBindings, TableBindings, TextBindings * - * Last changed in: 1.1 - * * Fails if the specified id does not exist. * * @param id Specifies the unique name to be used to identify the binding object. Required. @@ -1032,8 +984,6 @@ declare namespace Office { * *@remarks * Hosts: Access, Excel, Outlook, PowerPoint, Project, Word - * - * Last changed in: 1.1 */ export interface Context { /** @@ -1048,8 +998,6 @@ declare namespace Office { * Hosts: Word * * Available in Requirement set: CustomXmlParts - * - * Last changed in: 1.1 */ export interface CustomXmlNode { /** @@ -1059,8 +1007,6 @@ declare namespace Office { * Hosts: Word * * Available in Requirement set: CustomXmlParts - * - * Last changed in: 1.1 */ baseName: string; /** @@ -1070,8 +1016,6 @@ declare namespace Office { * Hosts: Word * * Available in Requirement set: CustomXmlParts - * - * Last changed in: 1.1 */ namespaceUri: string; /** @@ -1081,8 +1025,6 @@ declare namespace Office { * Hosts: Word * * Available in Requirement set: CustomXmlParts - * - * Last changed in: 1.1 */ nodeType: string; /** @@ -1093,8 +1035,6 @@ declare namespace Office { * * Available in Requirement set: CustomXmlParts * - * Last changed in: 1.1 - * * @param xPath The XPath expression that specifies the nodes to get. Required. * @param options An object like {asyncContext:context} where `context` is a user-defined item of any type that is returned in the AsyncResult object without being altered. * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. @@ -1108,8 +1048,6 @@ declare namespace Office { * * Available in Requirement set: CustomXmlParts * - * Last changed in: 1.1 - * * @param options An object like {asyncContext:context} where `context` is a user-defined item of any type that is returned in the AsyncResult object without being altered. * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ @@ -1122,8 +1060,6 @@ declare namespace Office { * * Available in Requirement set: CustomXmlParts * - * Last changed in: 1.2 - * * @param options An object like {asyncContext:context} where `context` is a user-defined item of any type that is returned in the AsyncResult object without being altered. * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ @@ -1136,8 +1072,6 @@ declare namespace Office { * * Available in Requirement set: CustomXmlParts * - * Last changed in: 1.1 - * * @param options An object like {asyncContext:context} where `context` is a user-defined item of any type that is returned in the AsyncResult object without being altered. * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ @@ -1150,8 +1084,6 @@ declare namespace Office { * * Available in Requirement set: CustomXmlParts * - * Last changed in: 1.1 - * * @param value The value to be set on the node * @param options An object like {asyncContext:context} where `context` is a user-defined item of any type that is returned in the AsyncResult object without being altered. * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. @@ -1165,8 +1097,6 @@ declare namespace Office { * * Available in Requirement set: CustomXmlParts * - * Last changed in: 1.2 - * * @param text Required. The text value of the XML node. * @param options An object like {asyncContext:context} where `context` is a user-defined item of any type that is returned in the AsyncResult object without being altered. * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. @@ -1180,8 +1110,6 @@ declare namespace Office { * * Available in Requirement set: CustomXmlParts * - * Last changed in: 1.1 - * * @param xml The XML to be set on the node * @param options An object like {asyncContext:context} where `context` is a user-defined item of any type that is returned in the AsyncResult object without being altered. * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. @@ -1195,8 +1123,6 @@ declare namespace Office { * Hosts: Word * * Available in Requirement set: CustomXmlParts - * - * Last changed in: 1.1 */ export interface CustomXmlPart { /** @@ -1206,8 +1132,6 @@ declare namespace Office { * Hosts: Word * * Available in Requirement set: CustomXmlParts - * - * Last changed in: 1.1 * */ builtIn: boolean; /** @@ -1217,8 +1141,6 @@ declare namespace Office { * Hosts: Word * * Available in Requirement set: CustomXmlParts - * - * Last changed in: 1.1 * */ id: string; /** @@ -1228,8 +1150,6 @@ declare namespace Office { * Hosts: Word * * Available in Requirement set: CustomXmlParts - * - * Last changed in: 1.1 * */ namespaceManager: CustomXmlPrefixMappings; /** @@ -1237,8 +1157,6 @@ declare namespace Office { * *@remarks * Hosts: Word - * - * Last changed in: 1.1 * * You can add multiple event handlers for the specified eventType as long as the name of each event handler function is unique. * @@ -1255,8 +1173,6 @@ declare namespace Office { * Hosts: Word * * Available in Requirement set: CustomXmlParts - * - * Last changed in: 1.1 * * @param options An object like {asyncContext:context} where `context` is a user-defined item of any type that is returned in the AsyncResult object without being altered. * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. @@ -1269,8 +1185,6 @@ declare namespace Office { * Hosts: Word * * Available in Requirement set: CustomXmlParts - * - * Last changed in: 1.1 * * @param xPath An XPath expression that specifies the nodes you want returned. Required. * @param options An object like {asyncContext:context} where `context` is a user-defined item of any type that is returned in the AsyncResult object without being altered. @@ -1284,8 +1198,6 @@ declare namespace Office { * Hosts: Word * * Available in Requirement set: CustomXmlParts - * - * Last changed in: 1.1 * * @param options An object like {asyncContext:context} where `context` is a user-defined item of any type that is returned in the AsyncResult object without being altered. * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. @@ -1298,8 +1210,6 @@ declare namespace Office { * Hosts: Word * * Available in Requirement set: CustomXmlParts - * - * Last changed in: 1.1 * * @param eventType Specifies the type of event to remove. Required.For a CustomXmlPart object event, the eventType parameter can be specified as Office.EventType.DataNodeDeleted, Office.EventType.DataNodeInserted, Office.EventType.DataNodeReplaced, or the corresponding text values of these enumerations. * @param handler The event handler function to remove. If not specified, all event handlers for the specified eventType will be removed. @@ -1315,8 +1225,6 @@ declare namespace Office { * Hosts: Word * * Available in Requirement set: CustomXmlParts - * - * Last changed in: 1.1 */ export interface CustomXmlParts { /** @@ -1326,8 +1234,6 @@ declare namespace Office { * Hosts: Word * * Available in Requirement set: CustomXmlParts - * - * Last changed in: 1.1 * * @param xml The XML to add to the newly created custom XML part. * @param options An object like {asyncContext:context} where `context` is a user-defined item of any type that is returned in the AsyncResult object without being altered. @@ -1341,8 +1247,6 @@ declare namespace Office { * Hosts: Word * * Available in Requirement set: CustomXmlParts - * - * Last changed in: 1.1 * * @param id The GUID of the custom XML part, including opening and closing braces. * @param options An object like {asyncContext:context} where `context` is a user-defined item of any type that is returned in the AsyncResult object without being altered. @@ -1356,8 +1260,6 @@ declare namespace Office { * Hosts: Word * * Available in Requirement set: CustomXmlParts - * - * Last changed in: 1.1 * * @param ns The namespace URI. * @param options An object like {asyncContext:context} where `context` is a user-defined item of any type that is returned in the AsyncResult object without being altered. @@ -1370,8 +1272,6 @@ declare namespace Office { * *@remarks * Hosts: Word - * - * Last changed in: 1.1 */ export interface CustomXmlPrefixMappings { /** @@ -1382,8 +1282,6 @@ declare namespace Office { * * Available in Requirement set: CustomXmlParts * - * Last changed in: 1.1 - * * If no namespace is assigned to the requested prefix, the method returns an empty string (""). * * @param prefix Specifies the prefix to add to the prefix mapping list. Required. @@ -1400,8 +1298,6 @@ declare namespace Office { * * Available in Requirement set: CustomXmlParts * - * Last changed in: 1.1 - * * If the prefix already exists in the namespace manager, this method will overwrite the mapping of that prefix except when the prefix is one added or used by the data store internally, in which case it will return an error. * * @param prefix TSpecifies the prefix to get the namespace for. Required. @@ -1417,8 +1313,6 @@ declare namespace Office { * * Available in Requirement set: CustomXmlParts * - * Last changed in: 1.1 - * * If no prefix is assigned to the requested namespace, the method returns an empty string (""). If there are multiple prefixes specified in the namespace manager, the method returns the first prefix that matches the supplied namespace. * * @param ns Specifies the namespace to get the prefix for. Required. @@ -1432,8 +1326,6 @@ declare namespace Office { * *@remarks * Hosts: Access, Excel, PowerPoint, Project, Word - * - * Last changed in: 1.1 */ export interface Document { /** @@ -1442,8 +1334,6 @@ declare namespace Office { *@remarks * Hosts: Access, Excel, Word * - * Last changed in: 1.1 - * * You don't instantiate the Document object directly in your script. To call members of the Document object to interact with the current document or worksheet, use Office.context.document in your script. */ bindings: Bindings; @@ -1452,8 +1342,6 @@ declare namespace Office { * *@remarks * Hosts: Word - * - * Last changed in: 1.1 */ customXmlParts: CustomXmlParts; /** @@ -1461,8 +1349,6 @@ declare namespace Office { * *@remarks * Hosts: Word - * - * Last changed in: 1.1 */ mode: DocumentMode; /** @@ -1470,8 +1356,6 @@ declare namespace Office { * *@remarks * Hosts: Word - * - * Last changed in: 1.1 */ settings: Settings; /** @@ -1479,8 +1363,6 @@ declare namespace Office { * *@remarks * Hosts: Word - * - * Last changed in: 1.1 */ url: string; /** @@ -1491,8 +1373,6 @@ declare namespace Office { * * Available in Requirement set: DocumentEvents * - * Last changed in: 1.1 - * * You can add multiple event handlers for the specified eventType as long as the name of each event handler function is unique. * * @param eventType For a Document object event, the eventType parameter can be specified as Office.EventType.Document.SelectionChanged or Office.EventType.Document.ActiveViewChanged, or the corresponding text value of this enumeration. @@ -1509,8 +1389,6 @@ declare namespace Office { * * Available in Requirement set: ActiveView * - * Last changed in: 1.1 - * * Can trigger an event when the view changes. * * @param options An object like {asyncContext:context} where `context` is a user-defined item of any type that is returned in the AsyncResult object without being altered. @@ -1525,8 +1403,6 @@ declare namespace Office { * * Available in Requirement set: File * - * Last changed in: 1.1 - * * For add-ins running in Office host applications other than Office for iOS, the getFileAsync method supports getting files in slices of up to 4194304 bytes (4 MB). For add-ins running in Office for iOS apps, the getFileAsync method supports getting files in slices of up to 65536 (64 KB). * * The fileType parameter can be specified by using the FileType enumeration or text values. But the possible values vary with the host: @@ -1557,8 +1433,6 @@ declare namespace Office { * * Available in Requirement set: not in a set * - * Last changed in: 1.1 - * * You get the file's URL with the url property ( asyncResult.value.url). * * @param options An object like {asyncContext:context} where `context` is a user-defined item of any type that is returned in the AsyncResult object without being altered. @@ -1573,8 +1447,6 @@ declare namespace Office { * * Available in Requirement set: Selection * - * Last changed in: 1.1 - * * The possible values for the coercionType parameter vary by the host: * * Excel, Excel Online, PowerPoint, PowerPoint Online, Word, and Word Online only: Office.CoercionType.Text (string) @@ -1609,8 +1481,6 @@ declare namespace Office { * * Available in Requirement set: not in a set * - * Last changed in: 1.1 - * * PowerPoint doesn't support the goToByIdAsync method in Master Views. * * The behavior caused by the selectionMode option varies by host: @@ -1640,7 +1510,6 @@ declare namespace Office { * * Available in Requirement set: DocumentEvents * - * Last changed in: 1.1 * @param eventType The event type. For document can be 'Document.SelectionChanged' or 'Document.ActiveViewChanged'. * @param options An object like Syntax example: {asyncContext:context} that has any of the following properties: * @@ -1659,8 +1528,6 @@ declare namespace Office { * * Available in Requirement set: Selection * - * Last changed in: 1.1 - * * The possible CoercionTypes that can be used for the data parameter, or for the coercionType option, vary by host: * * Office.CoercionType.Text: Excel, Word, PowerPoint @@ -1781,32 +1648,26 @@ declare namespace Office { * * Available in Requirement set: MatrixBindings * - * Last changed in: 1.1 - * * The MatrixBinding object inherits the id property, type property, getDataAsync method, and setDataAsync method from the Binding object. */ export interface MatrixBinding extends Binding { /** - * Gets the number of columns in the matrix data structure, as an integer value. - * + * Gets the number of columns in the matrix data structure, as an integer value. + * *@remarks * Hosts: Access, Excel, PowerPoint, Project, Word * * Available in Requirement set: MatrixBindings - * - * Last changed in: 1.1 - */ + */ columnCount: number; /** - * Gets the number of rows in the matrix data structure, as an integer value. - * + * Gets the number of rows in the matrix data structure, as an integer value. + * *@remarks * Hosts: Access, Excel, PowerPoint, Project, Word * * Available in Requirement set: MatrixBindings - * - * Last changed in: 1.1 - */ + */ rowCount: number; } /** @@ -1977,45 +1838,37 @@ declare namespace Office { * * Available in Requirement set: TableBindings * - * Last changed in: 1.1 - * * The TableBinding object inherits the id property, type property, getDataAsync method, and setDataAsync method from the Binding object. * * For Excel, note that after you establish a table binding in Excel, each new row a user adds to the table is automatically included in the binding and rowCount increases. */ export interface TableBinding extends Binding { /** - * Gets the number of columns in the TableBinding, as an integer value. - * + * Gets the number of columns in the TableBinding, as an integer value. + * *@remarks * Hosts: Access, Excel,Word * * Available in Requirement set: TableBindings - * - * Last changed in: 1.1 - */ + */ columnCount: number; /** - * True, if the table has headers; otherwise false. - * + * True, if the table has headers; otherwise false. + * *@remarks * Hosts: Access, Excel, PowerPoint, Project, Word * * Available in Requirement set: TableBindings - * - * Last changed in: 1.1 - */ + */ hasHeaders: boolean; /** - * Gets the number of rows in the TableBinding, as an integer value. - * + * Gets the number of rows in the TableBinding, as an integer value. + * *@remarks * Hosts: Access, Excel,Word * * Available in Requirement set: TableBindings * - * Last changed in: 1.1 - * * When you insert an empty table by selecting a single row in Excel 2013 and Excel Online (using Table on the Insert tab), both Office host applications create a single row of headers followed by a single blank row. However, if your add-in's script creates a binding for this newly inserted table (for example, by using the addFromSelectionAsync method), and then checks the value of the rowCount property, the value returned will differ depending whether the spreadsheet is open in Excel 2013 or Excel Online. * - In Excel on the desktop, rowCount will return 0 (the blank row following the headers is not counted). @@ -2025,7 +1878,7 @@ declare namespace Office { * You can work around this difference in your script by checking if rowCount == 1, and if so, then checking if the row contains all empty strings. * * In content add-ins for Access, for performance reasons the rowCount property always returns -1. - */ + */ rowCount: number; /** * Adds the specified data to the table as additional columns. @@ -2035,8 +1888,6 @@ declare namespace Office { * * Available in Requirement set: TableBindings * - * Last changed in: 1.0 - * * To add one or more columns specifying the values of the data and headers, pass a TableData object as the data parameter. To add one or more columns specifying only the data, pass an array of arrays ("matrix") as the data parameter. * * The success or failure of an addColumnsAsync operation is atomic. That is, the entire add columns operation must succeed, or it will be completely rolled back (and the AsyncResult.status property returned to the callback will report failure): @@ -2062,8 +1913,6 @@ declare namespace Office { * * Available in Requirement set: TableBindings * - * Last changed in: 1.1 - * * To add one or more columns specifying the values of the data and headers, pass a TableData object as the data parameter. To add one or more columns specifying only the data, pass an array of arrays ("matrix") as the data parameter. * * The success or failure of an addRowsAsync operation is atomic. That is, the entire add columns operation must succeed, or it will be completely rolled back (and the AsyncResult.status property returned to the callback will report failure): @@ -2089,8 +1938,6 @@ declare namespace Office { * * Available in Requirement set: TableBindings * - * Last changed in: 1.1 - * * In Excel, if the table has no header row, this method will delete the table itself. * * @param options The object like {asyncContext:context}, where context is a user-defined item of any type that is returned in the AsyncResult object without being altered. @@ -2105,8 +1952,6 @@ declare namespace Office { * * Available in Requirement set: Not in a set * - * Last changed in: 1.1 - * * See [Format tables in add-ins for Excel](https://docs.microsoft.com/en-us/office/dev/add-ins/excel/excel-add-ins-tables#format-a-table) for more information. * * @param options The object like {asyncContext:context}, where context is a user-defined item of any type that is returned in the AsyncResult object without being altered. @@ -2128,8 +1973,6 @@ declare namespace Office { * Hosts: Excel * * Available in Requirement set: Not in a set - * - * Last changed in: 1.1 * * @param formatsInfo Array elements are themselves three-element arrays:[target, type, formats] * @@ -2146,12 +1989,10 @@ declare namespace Office { /** * Updates table formatting options on the bound table. * - *@remarks + *@remarks * Hosts: Excel * * Available in Requirement set: Not in a set - * - * Last changed in: 1.1 * * @param tableOptions An object literal containing a list of property name-value pairs that define the table options to apply. * @param options The object {asyncContext:context}, where context is a user-defined item of any type that is returned in the AsyncResult object without being altered. @@ -2224,8 +2065,6 @@ declare namespace Office { * * Available in Requirement set: TextBindings * - * Last changed in: 1.1 - * * The TextBinding object inherits the id property, type property, getDataAsync method, and setDataAsync method from the Binding object. It does not implement any additional properties or methods of its own. */ export interface TextBinding extends Binding { } @@ -4665,8 +4504,6 @@ declare namespace Office { * *@remarks * Hosts: Access, Excel, Outlook, PowerPoint, Project, Word - * - * Last changed in: 1.1 */ export interface Context { mailbox: Mailbox; From 55fabd3ae7b3e2dd548d02d4c9a0818bdea5d593 Mon Sep 17 00:00:00 2001 From: Hugues Stefanski Date: Mon, 21 May 2018 20:16:19 +0200 Subject: [PATCH 297/575] d3-interpolate : fix linting errors Switch to TypeScript 2.3 --- types/d3-interpolate/d3-interpolate-tests.ts | 2 +- types/d3-interpolate/index.d.ts | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/types/d3-interpolate/d3-interpolate-tests.ts b/types/d3-interpolate/d3-interpolate-tests.ts index 50ade8008c..e77d3d4aef 100644 --- a/types/d3-interpolate/d3-interpolate-tests.ts +++ b/types/d3-interpolate/d3-interpolate-tests.ts @@ -232,7 +232,7 @@ iNum = d3Interpolate.interpolateBasisClosed([1, 50, 30, 10]); iString = d3Interpolate.piecewise(d3Interpolate.interpolateRgb.gamma(2.2), ['red', 'green', 'blue']); iString = d3Interpolate.piecewise(d3Interpolate.interpolateCubehelix, ['red', 'green', 'blue']); -iZoom = d3Interpolate.piecewise(d3Interpolate.interpolateZoom, [[50, 50, 300], [100, 100, 500]] as d3Interpolate.ZoomView[]); +iZoom = d3Interpolate.piecewise(d3Interpolate.interpolateZoom, [[50, 50, 300], [100, 100, 500]]); iNum = d3Interpolate.piecewise(d3Interpolate.interpolateNumber, [1, 2, 3]); iNum = d3Interpolate.piecewise(d3Interpolate.interpolateRound, [1.1, 2.2, 3.3]); iString = d3Interpolate.piecewise(d3Interpolate.interpolateString, ['a', 'b', 'c']); diff --git a/types/d3-interpolate/index.d.ts b/types/d3-interpolate/index.d.ts index 4d6d67f5d5..3853bff326 100644 --- a/types/d3-interpolate/index.d.ts +++ b/types/d3-interpolate/index.d.ts @@ -1,9 +1,10 @@ -// Type definitions for D3JS d3-interpolate module 1.1 +// Type definitions for D3JS d3-interpolate module 1.2 // Project: https://github.com/d3/d3-interpolate/ // Definitions by: Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 -// Last module patch version validated against: 1.1.1 +// Last module patch version validated against: 1.2.0 import { ColorCommonInstance } from 'd3-color'; From 0d24e9589b1b9feab135807e3ecede0e7c634783 Mon Sep 17 00:00:00 2001 From: Alex Jerabek Date: Mon, 21 May 2018 11:16:21 -0700 Subject: [PATCH 298/575] Correcting IdentityAPI capitalization --- types/office-js/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/office-js/index.d.ts b/types/office-js/index.d.ts index 8c687606c0..d819833fb7 100644 --- a/types/office-js/index.d.ts +++ b/types/office-js/index.d.ts @@ -360,7 +360,7 @@ declare namespace Office { * @remarks * Hosts: Excel, OneNote, Outlook, PowerPoint, Word * - * Requirement sets: IdentityApi + * Requirement sets: IdentityAPI * * This API requires a single sign-on configuration that bridges the add-in to an Azure application. Office users sign-in with Organizational Accounts and Microsoft Accounts. Microsoft Azure returns tokens intended for both user account types to access resources in the Microsoft Graph. * From c3b80513fd56b0c4bdf075bf0674289ef6a6860d Mon Sep 17 00:00:00 2001 From: Hugues Stefanski Date: Mon, 21 May 2018 20:22:41 +0200 Subject: [PATCH 299/575] Typescript version for d3-scale, required for d3-interpoalte --- types/d3-scale/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/d3-scale/index.d.ts b/types/d3-scale/index.d.ts index b3ca4114e2..9471096fb9 100644 --- a/types/d3-scale/index.d.ts +++ b/types/d3-scale/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/d3/d3-scale/ // Definitions by: Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 // Last module patch version validated against: 2.0.0 From 94e8c22ab383e2a3f4111961637dfbea0d3fc48c Mon Sep 17 00:00:00 2001 From: Alex Jerabek Date: Mon, 21 May 2018 11:38:34 -0700 Subject: [PATCH 300/575] Adding Requirement Sets and spacing cleanup --- types/office-js/index.d.ts | 200 ++++++++++++++++++++++++------------- 1 file changed, 128 insertions(+), 72 deletions(-) diff --git a/types/office-js/index.d.ts b/types/office-js/index.d.ts index d819833fb7..33b0f373f0 100644 --- a/types/office-js/index.d.ts +++ b/types/office-js/index.d.ts @@ -716,21 +716,21 @@ declare namespace Office { /** * Get the Document object associated with the binding. * - *@remarks + * @remarks * Hosts: Access, Excel, Word */ document: Document; /** * A string that uniquely identifies this binding among the bindings in the same Document object. * - *@remarks + * @remarks * Hosts: Access, Excel, Word */ id: string; /** * Gets the type of the binding. * - *@remarks + * @remarks * Hosts: Access, Excel, Word */ type: BindingType; @@ -749,7 +749,7 @@ declare namespace Office { /** * Returns the data contained within the binding. * - *@remarks + * @remarks * Hosts: Access, Excel, Word * * Available in Requirement sets: MatrixBindings, TableBindings, TextBindings @@ -782,7 +782,7 @@ declare namespace Office { /** * Removes the specified handler from the binding for the specified event type. * - *@remarks + * @remarks * Hosts: Access, Excel, Word * * Available in Requirement set: BindingEvents @@ -800,7 +800,7 @@ declare namespace Office { /** * Writes data to the bound section of the document represented by the specified binding object. * - *@remarks + * @remarks * Hosts: Access, Excel, Word * * Available in Requirement sets: MatrixBindings, TableBindings, TextBindings @@ -842,7 +842,7 @@ declare namespace Office { /** * Represents the bindings the add-in has within the document. * - *@remarks + * @remarks * Hosts: */ export interface Bindings { @@ -856,7 +856,7 @@ declare namespace Office { /** * Creates a binding against a named object in the document. * - *@remarks + * @remarks * Hosts: Access, Excel, Word * * Available in Requirement set: MatrixBindings, TableBindings, TextBindings @@ -889,7 +889,7 @@ declare namespace Office { /** * Create a binding by prompting the user to make a selection on the document. * - *@remarks + * @remarks * Hosts: Access, Excel * * Available in Requirement set: Not in a set @@ -913,7 +913,7 @@ declare namespace Office { /** * Create a binding based on the user's current selection. * - *@remarks + * @remarks * Hosts: Access, Excel, Word * * Available in Requirement set: MatrixBindings, TableBindings, TextBindings @@ -939,7 +939,7 @@ declare namespace Office { /** * Gets all bindings that were previously created. * - *@remarks + * @remarks * Hosts: Access, Excel, Word * * Available in Requirement set: MatrixBindings, TableBindings, TextBindings @@ -951,7 +951,7 @@ declare namespace Office { /** * Retrieves a binding based on its Name * - *@remarks + * @remarks * Hosts: Access, Excel, Word * * Available in Requirement set: CustomXmlParts, MatrixBindings, TableBindings, TextBindings @@ -966,7 +966,7 @@ declare namespace Office { /** * Removes the binding from the document * - *@remarks + * @remarks * Hosts: Access, Excel, Word * * Available in Requirement set: MatrixBindings, TableBindings, TextBindings @@ -982,7 +982,7 @@ declare namespace Office { /** * Represents the runtime environment of the add-in and provides access to key objects of the API. * - *@remarks + * @remarks * Hosts: Access, Excel, Outlook, PowerPoint, Project, Word */ export interface Context { @@ -994,7 +994,7 @@ declare namespace Office { /** * Represents an XML node in a tree in a document. * - *@remarks + * @remarks * Hosts: Word * * Available in Requirement set: CustomXmlParts @@ -1003,7 +1003,7 @@ declare namespace Office { /** * Gets the base name of the node without the namespace prefix, if one exists. * - *@remarks + * @remarks * Hosts: Word * * Available in Requirement set: CustomXmlParts @@ -1012,7 +1012,7 @@ declare namespace Office { /** * Retrieves the string GUID of the CustomXMLPart. * - *@remarks + * @remarks * Hosts: Word * * Available in Requirement set: CustomXmlParts @@ -1021,7 +1021,7 @@ declare namespace Office { /** * Gets the type of the CustomXMLNode. * - *@remarks + * @remarks * Hosts: Word * * Available in Requirement set: CustomXmlParts @@ -1030,7 +1030,7 @@ declare namespace Office { /** * Gets the nodes associated with the XPath expression. * - *@remarks + * @remarks * Hosts: Word * * Available in Requirement set: CustomXmlParts @@ -1043,7 +1043,7 @@ declare namespace Office { /** * Gets the node value. * - *@remarks + * @remarks * Hosts: Word * * Available in Requirement set: CustomXmlParts @@ -1055,7 +1055,7 @@ declare namespace Office { /** * Gets the text of an XML node in a custom XML part. * - *@remarks + * @remarks * Hosts: Word * * Available in Requirement set: CustomXmlParts @@ -1067,7 +1067,7 @@ declare namespace Office { /** * Gets the node's XML. * - *@remarks + * @remarks * Hosts: Word * * Available in Requirement set: CustomXmlParts @@ -1079,7 +1079,7 @@ declare namespace Office { /** * Sets the node value. * - *@remarks + * @remarks * Hosts: Word * * Available in Requirement set: CustomXmlParts @@ -1092,7 +1092,7 @@ declare namespace Office { /** * Asynchronously sets the text of an XML node in a custom XML part. * - *@remarks + * @remarks * Hosts: Word * * Available in Requirement set: CustomXmlParts @@ -1105,7 +1105,7 @@ declare namespace Office { /** * Sets the node XML. * - *@remarks + * @remarks * Hosts: Word * * Available in Requirement set: CustomXmlParts @@ -1119,7 +1119,7 @@ declare namespace Office { /** * Represents a single CustomXMLPart in a CustomXMLParts collection. * - *@remarks + * @remarks * Hosts: Word * * Available in Requirement set: CustomXmlParts @@ -1128,7 +1128,7 @@ declare namespace Office { /** * True, if the custom XML part is built in; otherwise false. * - *@remarks + * @remarks * Hosts: Word * * Available in Requirement set: CustomXmlParts @@ -1137,7 +1137,7 @@ declare namespace Office { /** * Gets the GUID of the CustomXMLPart. * - *@remarks + * @remarks * Hosts: Word * * Available in Requirement set: CustomXmlParts @@ -1146,7 +1146,7 @@ declare namespace Office { /** * Gets the set of namespace prefix mappings (CustomXMLPrefixMappings) used against the current CustomXMLPart. * - *@remarks + * @remarks * Hosts: Word * * Available in Requirement set: CustomXmlParts @@ -1155,7 +1155,7 @@ declare namespace Office { /** * Adds an event handler to the object using the specified event type. * - *@remarks + * @remarks * Hosts: Word * * You can add multiple event handlers for the specified eventType as long as the name of each event handler function is unique. @@ -1169,7 +1169,7 @@ declare namespace Office { /** * Deletes the Custom XML Part. * - *@remarks + * @remarks * Hosts: Word * * Available in Requirement set: CustomXmlParts @@ -1181,7 +1181,7 @@ declare namespace Office { /** * Asynchronously gets any CustomXmlNodes in this custom XML part which match the specified XPath. * - *@remarks + * @remarks * Hosts: Word * * Available in Requirement set: CustomXmlParts @@ -1194,7 +1194,7 @@ declare namespace Office { /** * Asynchronously gets the XML inside this custom XML part. * - *@remarks + * @remarks * Hosts: Word * * Available in Requirement set: CustomXmlParts @@ -1206,7 +1206,7 @@ declare namespace Office { /** * Removes an event handler for the specified event type. * - *@remarks + * @remarks * Hosts: Word * * Available in Requirement set: CustomXmlParts @@ -1221,7 +1221,7 @@ declare namespace Office { /** * Represents a collection of CustomXmlPart objects. * - *@remarks + * @remarks * Hosts: Word * * Available in Requirement set: CustomXmlParts @@ -1230,7 +1230,7 @@ declare namespace Office { /** * Asynchronously adds a new custom XML part to a file. * - *@remarks + * @remarks * Hosts: Word * * Available in Requirement set: CustomXmlParts @@ -1243,7 +1243,7 @@ declare namespace Office { /** * Asynchronously gets the specified custom XML part by its id. * - *@remarks + * @remarks * Hosts: Word * * Available in Requirement set: CustomXmlParts @@ -1256,7 +1256,7 @@ declare namespace Office { /** * Asynchronously gets the specified custom XML part(s) by its namespace. * - *@remarks + * @remarks * Hosts: Word * * Available in Requirement set: CustomXmlParts @@ -1270,14 +1270,14 @@ declare namespace Office { /** * Represents a collection of CustomXmlPart objects. * - *@remarks + * @remarks * Hosts: Word */ export interface CustomXmlPrefixMappings { /** * Asynchronously adds a prefix to namespace mapping to use when querying an item. * - *@remarks + * @remarks * Hosts: Word * * Available in Requirement set: CustomXmlParts @@ -1293,7 +1293,7 @@ declare namespace Office { /** * Asynchronously gets the namespace mapped to the specified prefix. * - *@remarks + * @remarks * Hosts: Word * * Available in Requirement set: CustomXmlParts @@ -1308,7 +1308,7 @@ declare namespace Office { /** * Asynchronously gets the prefix for the specified namespace. * - *@remarks + * @remarks * Hosts: Word * * Available in Requirement set: CustomXmlParts @@ -1324,14 +1324,14 @@ declare namespace Office { /** * An abstract class that represents the document the add-in is interacting with. * - *@remarks + * @remarks * Hosts: Access, Excel, PowerPoint, Project, Word */ export interface Document { /** * Gets an object that provides access to the bindings defined in the document. * - *@remarks + * @remarks * Hosts: Access, Excel, Word * * You don't instantiate the Document object directly in your script. To call members of the Document object to interact with the current document or worksheet, use Office.context.document in your script. @@ -1340,35 +1340,35 @@ declare namespace Office { /** * Gets an object that represents the custom XML parts in the document. * - *@remarks + * @remarks * Hosts: Word */ customXmlParts: CustomXmlParts; /** * Gets the mode the document is in. * - *@remarks + * @remarks * Hosts: Word */ mode: DocumentMode; /** * Gets an object that represents the saved custom settings of the content or task pane add-in for the current document. * - *@remarks + * @remarks * Hosts: Word */ settings: Settings; /** * Gets the URL of the document that the host application currently has open. Returns null if the URL is unavailable. * - *@remarks + * @remarks * Hosts: Word */ url: string; /** * Adds an event handler for a Document object event. * - *@remarks + * @remarks * Hosts: Excel, PowerPoint, Project, Word * * Available in Requirement set: DocumentEvents @@ -1384,7 +1384,7 @@ declare namespace Office { /** * Returns the state of the current view of the presentation (edit or read). * - *@remarks + * @remarks * Hosts: Excel, PowerPoint, Word * * Available in Requirement set: ActiveView @@ -1398,7 +1398,7 @@ declare namespace Office { /** * Returns the entire document file in slices of up to 4194304 bytes (4 MB). For add-ins for iOS, file slice is supported up to 65536 (64 KB). Note that specifying file slice size of above permitted limit will result in an "Internal Error" failure. * - *@remarks + * @remarks * Hosts: Excel, PowerPoint, Word * * Available in Requirement set: File @@ -1428,7 +1428,7 @@ declare namespace Office { /** * Gets file properties of the current document. * - *@remarks + * @remarks * Hosts: Excel, PowerPoint, Word * * Available in Requirement set: not in a set @@ -1442,7 +1442,7 @@ declare namespace Office { /** * Reads the data contained in the current selection in the document. * - *@remarks + * @remarks * Hosts: Access, Excel, PowerPoint, Project, Word * * Available in Requirement set: Selection @@ -1476,7 +1476,7 @@ declare namespace Office { /** * Goes to the specified object or location in the document. * - *@remarks + * @remarks * Hosts: Excel, PowerPoint, Word * * Available in Requirement set: not in a set @@ -1505,7 +1505,7 @@ declare namespace Office { /** * Removes an event handler for the specified event type. * - *@remarks + * @remarks * Hosts: Excel, PowerPoint, Project, Word * * Available in Requirement set: DocumentEvents @@ -1523,7 +1523,7 @@ declare namespace Office { /** * Writes the specified data into the current selection. * - *@remarks + * @remarks * Hosts: Access, Excel, PowerPoint, Project, Word, Word Online * * Available in Requirement set: Selection @@ -1588,8 +1588,11 @@ declare namespace Office { export interface File { /** * Gets the document file size in bytes. + * * @remarks * Hosts: PowerPoint, Word + * + * Available in Requirement set: File */ size: number; /** @@ -1605,6 +1608,7 @@ declare namespace Office { * * Hosts: PowerPoint, Word * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. Optional. + * * @remarks * When the function you passed to the callback parameter executes, it receives an AsyncResult object that you can access from the callback function's only parameter. * In the callback function passed to the closeAsync method, you can use the properties of the AsyncResult object to return the following information. @@ -1614,6 +1618,8 @@ declare namespace Office { * |AsyncResult.status|Determine the success or failure of the operation.| * |AsyncResult.error|Access an Error object that provides error information if the operation failed.| * |AsyncResult.asyncContext|Access your user-defined object or value, if you passed one as the asyncContext parameter.| + * + * Available in Requirement set: File */ closeAsync(callback?: (result: AsyncResult) => void): void; /** @@ -1631,6 +1637,8 @@ declare namespace Office { * |AsyncResult.status|Determine the success or failure of the operation.| * |AsyncResult.error|Access an Error object that provides error information if the operation failed.| * |AsyncResult.asyncContext|Access your user-defined object or value, if you passed one as the asyncContext parameter.| + * + * Available in Requirement set: File */ getSliceAsync(sliceIndex: number, callback?: (result: AsyncResult) => void): void; } @@ -1643,7 +1651,7 @@ declare namespace Office { /** * Represents a binding in two dimensions of rows and columns. * - *@remarks + * @remarks * Hosts: Excel, Word * * Available in Requirement set: MatrixBindings @@ -1654,7 +1662,7 @@ declare namespace Office { /** * Gets the number of columns in the matrix data structure, as an integer value. * - *@remarks + * @remarks * Hosts: Access, Excel, PowerPoint, Project, Word * * Available in Requirement set: MatrixBindings @@ -1663,7 +1671,7 @@ declare namespace Office { /** * Gets the number of rows in the matrix data structure, as an integer value. * - *@remarks + * @remarks * Hosts: Access, Excel, PowerPoint, Project, Word * * Available in Requirement set: MatrixBindings @@ -1681,10 +1689,13 @@ declare namespace Office { * The Settings object is automatically loaded as part of the Document object, and is available by calling the settings property of that object when the add-in is activated. The developer is responsible for calling the saveAsync method after adding or deleting settings to save the settings in the document. * * Hosts: Access, Excel, PowerPoint, Word + * + * Available in Requirement set: Settings */ export interface Settings { /** * Adds an event handler for the settingsChanged event. + * * @remarks * You can add multiple event handlers for the specified eventType as long as the name of each event handler function is unique. * @@ -1692,6 +1703,9 @@ declare namespace Office { * > Your add-in's code can register a handler for the settingsChanged event when the add-in is running with any Excel client, but the event will fire only when the add-in is loaded with a spreadsheet that is opened in Excel Online, and more than one user is editing the spreadsheet (co-authoring). Therefore, effectively the settingsChanged event is supported only in Excel Online in co-authoring scenarios. * * Hosts: Excel + * + * Available in Requirement set: Settings + * * @param eventType Specifies the type of event to add. Required. * @param handler The event handler function to add. Required. * @param options Specifies any of the following optional parameters. @@ -1710,19 +1724,27 @@ declare namespace Office { addHandlerAsync(eventType: EventType, handler: any, options?: any, callback?: (result: AsyncResult) => void): void; /** * Retrieves the specified setting. + * * @remarks * Hosts: Access, Excel, PowerPoint, Word + * + * Available in Requirement set: Settings + * * @param settingName The case-sensitive name of the setting to retrieve. * @returns An object that has property names mapped to JSON serialized values. */ get(name: string): any; /** * Reads all settings persisted in the document and refreshes the content or task pane add-in's copy of those settings held in memory. + * * @remarks * This method is useful in Word and PowerPoint coauthoring scenarios when multiple instances of the same add-in are working against the same document. Because each add-in is working against an in-memory copy of the settings loaded from the document at the time the user opened it, the settings values used by each user can get out of sync. This can happen whenever an instance of the add-in calls the Settings.saveAsync method to persist all of that user's settings to the document. Calling the refreshAsync method from the event handler for the settingsChanged event of the add-in will refresh the settings values for all users. * The refreshAsync method can be called from add-ins created for Excel, but since it doesn't support coauthoring there is no reason to do so. * * Hosts: Access, Excel, PowerPoint, Word + * + * Available in Requirement set: Settings + * * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. * @remarks * When the function you passed to the callback parameter executes, it receives an AsyncResult object that you can access from the callback function's only parameter. @@ -1737,21 +1759,29 @@ declare namespace Office { refreshAsync(callback?: (result: AsyncResult) => void): void; /** * Removes the specified setting. + * * @remarks * null is a valid value for a setting. Therefore, assigning null to the setting will not remove it from the settings property bag. * * > [!IMPORTANT] * > Be aware that the Settings.remove method affects only the in-memory copy of the settings property bag. To persist the removal of the specified setting in the document, at some point after calling the Settings.remove method and before the add-in is closed, you must call the Settings.saveAsync method. * Hosts: Access, Excel, PowerPoint, Word + * + * Available in Requirement set: Settings + * * @param settingName The case-sensitive name of the setting to remove. */ remove(name: string): void; /** * Removes an event handler for the settingsChanged event. + * * @remarks * If the optional handler parameter is omitted when calling the removeHandlerAsync method, all event handlers for the specified eventType will be removed. * * Hosts: Access, Excel, PowerPoint + * + * Available in Requirement set: Settings + * * @param eventType Specifies the type of event to remove. Required. * @param options Specifies any of the following optional parameters. * @param handler Specifies the name of the handler to remove. @@ -1772,6 +1802,9 @@ declare namespace Office { * > The refreshAsync method is only useful in coauthoring scenarios (which are only supported in Word) when other instances of the same add-in might change the settings and those changes should be made available to all instances. * * Hosts: Access, Excel, PowerPoint, Word + * + * Available in Requirement set: Settings + * * @param options Syntax example: {overwriteIfStale:false} * @param overwriteIfStale Indicates whether the setting will be replaced if stale. * asyncContext: Object keeping state for the callback @@ -1789,6 +1822,7 @@ declare namespace Office { saveAsync(callback?: (result: AsyncResult) => void): void; /** * Sets or creates the specified setting. + * * @remarks * The set method creates a new setting of the specified name if it does not already exist, or sets an existing setting of the specified name in the in-memory copy of the settings property bag. After you call the Settings.saveAsync method, the value is stored in the document as the serialized JSON representation of its data type. A maximum of 2MB is available for the settings of each add-in. * @@ -1796,6 +1830,9 @@ declare namespace Office { * > Be aware that the Settings.set method affects only the in-memory copy of the settings property bag. To make sure that additions or changes to settings will be available to your add-in the next time the document is opened, at some point after calling the Settings.set method and before the add-in is closed, you must call the Settings.saveAsync method to persist settings in the document. * * Hosts: Access, Excel, PowerPoint, Word + * + * Available in Requirement set: Settings + * * @param settingName The case-sensitive name of the setting to set or create. * @param value Specifies the value to be stored. */ @@ -1803,37 +1840,49 @@ declare namespace Office { } /** * Represents a slice of a document file. + * * @remarks * The Slice object is accessed with the File.getSliceAsync method. * * Hosts: PowerPoint, Word + * + * Available in Requirement set: File */ export interface Slice { /** * Gets the raw data of the file slice in Office.FileType.Text ("text") or Office.FileType.Compressed ("compressed") format as specified by the fileType parameter of the call to the Document.getFileAsync method. + * * @remarks * Files in the "compressed" format will return a byte array that can be transformed to a base64-encoded string if required. * * Hosts: PowerPoint, Word + * + * Available in Requirement set: File */ data: any; /** * Gets the zero-based index of the file slice. + * * @remarks * Hosts: PowerPoint, Word + * + * Available in Requirement set: File */ index: number; /** * Gets the size of the slice in bytes. + * * @remarks * Hosts: PowerPoint, Word + * + * Available in Requirement set: File */ size: number; } /** * Represents a binding in two dimensions of rows and columns, optionally with headers. * - *@remarks + * @remarks * Hosts: Access, Excel, PowerPoint, Project, Word * * Available in Requirement set: TableBindings @@ -1846,7 +1895,7 @@ declare namespace Office { /** * Gets the number of columns in the TableBinding, as an integer value. * - *@remarks + * @remarks * Hosts: Access, Excel,Word * * Available in Requirement set: TableBindings @@ -1855,7 +1904,7 @@ declare namespace Office { /** * True, if the table has headers; otherwise false. * - *@remarks + * @remarks * Hosts: Access, Excel, PowerPoint, Project, Word * * Available in Requirement set: TableBindings @@ -1864,7 +1913,7 @@ declare namespace Office { /** * Gets the number of rows in the TableBinding, as an integer value. * - *@remarks + * @remarks * Hosts: Access, Excel,Word * * Available in Requirement set: TableBindings @@ -1883,7 +1932,7 @@ declare namespace Office { /** * Adds the specified data to the table as additional columns. * - *@remarks + * @remarks * Hosts: Excel, Word * * Available in Requirement set: TableBindings @@ -1908,7 +1957,7 @@ declare namespace Office { /** * Adds the specified data to the table as additional rows. * - *@remarks + * @remarks * Hosts: Access, Excel, Word * * Available in Requirement set: TableBindings @@ -1933,7 +1982,7 @@ declare namespace Office { /** * Deletes all non-header rows and their values in the table, shifting appropriately for the host application. * - *@remarks + * @remarks * Hosts: Access, Excel, Word * * Available in Requirement set: TableBindings @@ -1947,7 +1996,7 @@ declare namespace Office { /** * Clears formatting on the bound table. * - *@remarks + * @remarks * Hosts: Excel * * Available in Requirement set: Not in a set @@ -1969,7 +2018,7 @@ declare namespace Office { /** * Sets formatting on specified items and data in the table. * - *@remarks + * @remarks * Hosts: Excel * * Available in Requirement set: Not in a set @@ -1989,7 +2038,7 @@ declare namespace Office { /** * Updates table formatting options on the bound table. * - *@remarks + * @remarks * Hosts: Excel * * Available in Requirement set: Not in a set @@ -2002,8 +2051,11 @@ declare namespace Office { } /** * Represents the data in a table or a TableBinding. + * * @remarks * Hosts: Excel, Word + * + * Available in Requirement set: TableBindings */ export class TableData { constructor(rows: any[][], headers: any[]); @@ -2020,6 +2072,8 @@ declare namespace Office { * - If you overwrite or update an existing table, the existing headers are not altered. * * Hosts: Excel, Word + * + * Available in Requirement set: TableBindings */ headers: any[]; /** @@ -2034,6 +2088,8 @@ declare namespace Office { * - If you overwrite or update an existing table, the existing rows are not altered. * * Hosts: Excel, Word + * + * Available in Requirement set: TableBindings */ rows: any[][]; } @@ -2060,7 +2116,7 @@ declare namespace Office { /** * Represents a bound text selection in the document. * - *@remarks + * @remarks * Hosts: Access, Excel, PowerPoint, Project, Word * * Available in Requirement set: TextBindings @@ -4502,7 +4558,7 @@ declare namespace Office { /** * Represents the runtime environment of the add-in and provides access to key objects of the API. * - *@remarks + * @remarks * Hosts: Access, Excel, Outlook, PowerPoint, Project, Word */ export interface Context { @@ -5742,7 +5798,7 @@ declare namespace Excel { * * Gets the Binding object that represents the binding that raised the SelectionChanged event. * - *@remarks + * @remarks * Hosts: Access, Excel, Word * * [Api set: ExcelApi 1.2] From 7526c00cc01a1e84dfb30e0e97d7dc4725b25e90 Mon Sep 17 00:00:00 2001 From: Hugues Stefanski Date: Mon, 21 May 2018 20:44:39 +0200 Subject: [PATCH 301/575] Typescript version for d3-array, required for d3-interpoalte --- types/d3-array/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/d3-array/index.d.ts b/types/d3-array/index.d.ts index 67cd291f22..a42f8e1fe9 100644 --- a/types/d3-array/index.d.ts +++ b/types/d3-array/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/d3/d3-array // Definitions by: Alex Ford , Boris Yankov , Tom Wanzek // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 // Last module patch version validated against: 1.2.0 From d43c45aaa37bc14fbded6e3410b2367c74730f0f Mon Sep 17 00:00:00 2001 From: Alex Jerabek Date: Mon, 21 May 2018 11:45:52 -0700 Subject: [PATCH 302/575] Adding documention from UI.Dialog to DialogHandler class --- types/office-js/index.d.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/types/office-js/index.d.ts b/types/office-js/index.d.ts index 33b0f373f0..b8d34d89ab 100644 --- a/types/office-js/index.d.ts +++ b/types/office-js/index.d.ts @@ -403,7 +403,11 @@ declare namespace Office { */ close(): void; /** - * Adds an event handler for DialogMessageReceived or DialogEventReceived + * Registers an event handler. The two supported events are: + * + * - DialogMessageReceived. Triggered when the dialog box sends a message to its parent. + * + * - DialogEventReceived. Triggered when the dialog box has been closed or otherwise unloaded. */ addEventHandler(eventType: Office.EventType, handler: Function): void; From 09f426148f2bdd052de40d224b4ea207054d1cf5 Mon Sep 17 00:00:00 2001 From: Hugues Stefanski Date: Mon, 21 May 2018 20:46:23 +0200 Subject: [PATCH 303/575] d3-interpolate : removed TS2.3 constraint --- types/d3-array/index.d.ts | 1 - types/d3-interpolate/index.d.ts | 3 +-- types/d3-scale/index.d.ts | 1 - 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/types/d3-array/index.d.ts b/types/d3-array/index.d.ts index a42f8e1fe9..67cd291f22 100644 --- a/types/d3-array/index.d.ts +++ b/types/d3-array/index.d.ts @@ -2,7 +2,6 @@ // Project: https://github.com/d3/d3-array // Definitions by: Alex Ford , Boris Yankov , Tom Wanzek // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 // Last module patch version validated against: 1.2.0 diff --git a/types/d3-interpolate/index.d.ts b/types/d3-interpolate/index.d.ts index 3853bff326..ceab2db551 100644 --- a/types/d3-interpolate/index.d.ts +++ b/types/d3-interpolate/index.d.ts @@ -2,7 +2,6 @@ // Project: https://github.com/d3/d3-interpolate/ // Definitions by: Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 // Last module patch version validated against: 1.2.0 @@ -56,7 +55,7 @@ export function interpolateString(a: string | { toString(): string }, b: string export function interpolateDate(a: Date, b: Date): ((t: number) => Date); -type ArrayInterpolator = ((t: number) => A); +type ArrayInterpolator = ((t: number) => A); export function interpolateArray(a: any[], b: A): ArrayInterpolator; diff --git a/types/d3-scale/index.d.ts b/types/d3-scale/index.d.ts index 9471096fb9..b3ca4114e2 100644 --- a/types/d3-scale/index.d.ts +++ b/types/d3-scale/index.d.ts @@ -2,7 +2,6 @@ // Project: https://github.com/d3/d3-scale/ // Definitions by: Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 // Last module patch version validated against: 2.0.0 From 1e824708e8f2a46cd231d8346bcac9cdd36b1d68 Mon Sep 17 00:00:00 2001 From: Hugues Stefanski Date: Mon, 21 May 2018 20:57:27 +0200 Subject: [PATCH 304/575] d3-interpolate : exported type Added rule to tslint --- types/d3-interpolate/index.d.ts | 2 +- types/d3-interpolate/tslint.json | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/types/d3-interpolate/index.d.ts b/types/d3-interpolate/index.d.ts index ceab2db551..7d8ee60252 100644 --- a/types/d3-interpolate/index.d.ts +++ b/types/d3-interpolate/index.d.ts @@ -55,7 +55,7 @@ export function interpolateString(a: string | { toString(): string }, b: string export function interpolateDate(a: Date, b: Date): ((t: number) => Date); -type ArrayInterpolator = ((t: number) => A); +export type ArrayInterpolator = ((t: number) => A); export function interpolateArray(a: any[], b: A): ArrayInterpolator; diff --git a/types/d3-interpolate/tslint.json b/types/d3-interpolate/tslint.json index 604d5950cf..9846c79a4d 100644 --- a/types/d3-interpolate/tslint.json +++ b/types/d3-interpolate/tslint.json @@ -2,6 +2,7 @@ "extends": "dtslint/dt.json", "rules": { "unified-signatures": false, - "callable-types": false + "callable-types": false, + "no-unnecessary-generics": false } } From 4563f43f69fded015ce81ac1fbf790d43240dbc5 Mon Sep 17 00:00:00 2001 From: Sean Kelley Date: Mon, 21 May 2018 13:14:29 -0700 Subject: [PATCH 305/575] Reactstrap: StatelessComponent -> Component where appropriate. (See also #24846 for prior work.) Update Reactstrap to declare components that aren't stateless functional components as regular components. This allows consumers to use ref-related APIs, namely, the `ref` prop and `forwardRef`. Previously, Typescript would outright deny passing `ref`, and any attempts to use `forwardRef` would cause very confusing type errors claiming that the component class you were trying to refer to didn't exist (?!). Note that many components actually are implemented as stateless components, and as such their typings haven't been changed. I found the list of components needing this update by checking out current master of reactstrap (1d20d6d52c258428df39429e09c84b0ddcac76ee), then ```sh cd src rg 'extends (React.)?Component' -l | grep -v '__tests__' ``` --- types/reactstrap/lib/Button.d.ts | 3 ++- types/reactstrap/lib/Carousel.d.ts | 3 ++- types/reactstrap/lib/CarouselItem.d.ts | 3 ++- types/reactstrap/lib/Collapse.d.ts | 3 ++- types/reactstrap/lib/Dropdown.d.ts | 5 +++-- types/reactstrap/lib/DropdownItem.d.ts | 3 ++- types/reactstrap/lib/DropdownToggle.d.ts | 3 ++- types/reactstrap/lib/Form.d.ts | 3 ++- types/reactstrap/lib/Modal.d.ts | 3 ++- types/reactstrap/lib/NavLink.d.ts | 3 ++- types/reactstrap/lib/Popover.d.ts | 5 ++--- types/reactstrap/lib/TabContent.d.ts | 3 ++- types/reactstrap/lib/Tooltip.d.ts | 5 ++--- types/reactstrap/lib/Uncontrolled.d.ts | 10 ++++++---- types/reactstrap/reactstrap-tests.tsx | 25 ++++++++++++++++++++---- 15 files changed, 54 insertions(+), 26 deletions(-) diff --git a/types/reactstrap/lib/Button.d.ts b/types/reactstrap/lib/Button.d.ts index 50f69b1fb1..de1e92482f 100644 --- a/types/reactstrap/lib/Button.d.ts +++ b/types/reactstrap/lib/Button.d.ts @@ -1,3 +1,4 @@ +import * as React from 'react'; import { CSSModule } from '../index'; export interface ButtonProps extends React.HTMLProps { @@ -17,5 +18,5 @@ export interface ButtonProps extends React.HTMLProps { cssModule?: CSSModule; } -declare const Button: React.StatelessComponent; +declare class Button extends React.Component {} export default Button; diff --git a/types/reactstrap/lib/Carousel.d.ts b/types/reactstrap/lib/Carousel.d.ts index 1fc992ada2..1f21364cdf 100644 --- a/types/reactstrap/lib/Carousel.d.ts +++ b/types/reactstrap/lib/Carousel.d.ts @@ -1,3 +1,4 @@ +import * as React from 'react'; import { CSSModule } from '../index'; export interface CarouselProps extends React.HTMLProps { @@ -14,5 +15,5 @@ export interface CarouselProps extends React.HTMLProps { cssModule?: CSSModule } -declare const Carousel: React.StatelessComponent; +declare class Carousel extends React.Component {} export default Carousel; diff --git a/types/reactstrap/lib/CarouselItem.d.ts b/types/reactstrap/lib/CarouselItem.d.ts index 6be3c28d5e..88e93dfcf1 100644 --- a/types/reactstrap/lib/CarouselItem.d.ts +++ b/types/reactstrap/lib/CarouselItem.d.ts @@ -1,3 +1,4 @@ +import * as React from 'react'; import { CSSModule } from '../index'; export interface Transition { @@ -16,5 +17,5 @@ export interface CarouselItemProps extends React.HTMLProps, Transit slide?: boolean; } -declare const CarouselItem: React.StatelessComponent; +declare class CarouselItem extends React.Component {} export default CarouselItem; diff --git a/types/reactstrap/lib/Collapse.d.ts b/types/reactstrap/lib/Collapse.d.ts index 9fa6ebd4ad..d83ff45666 100644 --- a/types/reactstrap/lib/Collapse.d.ts +++ b/types/reactstrap/lib/Collapse.d.ts @@ -1,3 +1,4 @@ +import * as React from 'react'; import { CSSModule } from '../index'; export interface CollapseProps extends React.HTMLProps { @@ -19,5 +20,5 @@ export interface CollapseProps extends React.HTMLProps { onExited?: () => void; } -declare const Collapse: React.StatelessComponent; +declare class Collapse extends React.Component {} export default Collapse; diff --git a/types/reactstrap/lib/Dropdown.d.ts b/types/reactstrap/lib/Dropdown.d.ts index 52194dac65..4d892fff5c 100644 --- a/types/reactstrap/lib/Dropdown.d.ts +++ b/types/reactstrap/lib/Dropdown.d.ts @@ -1,6 +1,7 @@ +import * as React from 'react'; import { CSSModule } from '../index'; -export type Direction = +export type Direction = | "up" | "down" | "left" @@ -30,5 +31,5 @@ export interface DropdownProps extends Props { /* intentionally blank */ } -declare const Dropdown: React.StatelessComponent; +declare class Dropdown extends React.Component {} export default Dropdown; diff --git a/types/reactstrap/lib/DropdownItem.d.ts b/types/reactstrap/lib/DropdownItem.d.ts index 598c2fbfc8..723e4707d4 100644 --- a/types/reactstrap/lib/DropdownItem.d.ts +++ b/types/reactstrap/lib/DropdownItem.d.ts @@ -1,3 +1,4 @@ +import * as React from 'react'; import { CSSModule } from '../index'; export interface DropdownItemProps extends React.HTMLAttributes { @@ -13,5 +14,5 @@ export interface DropdownItemProps extends React.HTMLAttributes { active?: boolean; } -declare const DropdownItem: React.StatelessComponent; +declare class DropdownItem extends React.Component {} export default DropdownItem; diff --git a/types/reactstrap/lib/DropdownToggle.d.ts b/types/reactstrap/lib/DropdownToggle.d.ts index 5c27af11ad..d02edd50b2 100644 --- a/types/reactstrap/lib/DropdownToggle.d.ts +++ b/types/reactstrap/lib/DropdownToggle.d.ts @@ -1,3 +1,4 @@ +import * as React from 'react'; import { CSSModule } from '../index'; export interface DropdownToggleProps extends React.HTMLAttributes { @@ -16,5 +17,5 @@ export interface DropdownToggleProps extends React.HTMLAttributes { size?: string; } -declare const DropdownToggle: React.StatelessComponent; +declare class DropdownToggle extends React.Component {} export default DropdownToggle; diff --git a/types/reactstrap/lib/Form.d.ts b/types/reactstrap/lib/Form.d.ts index 997f4c4e5c..534a5d3988 100644 --- a/types/reactstrap/lib/Form.d.ts +++ b/types/reactstrap/lib/Form.d.ts @@ -1,3 +1,4 @@ +import * as React from 'react'; import { CSSModule } from '../index'; export interface FormProps extends React.HTMLProps { @@ -8,5 +9,5 @@ export interface FormProps extends React.HTMLProps { cssModule?: CSSModule; } -declare const Form: React.StatelessComponent; +declare class Form extends React.Component {} export default Form; diff --git a/types/reactstrap/lib/Modal.d.ts b/types/reactstrap/lib/Modal.d.ts index cead67c943..1049ec7918 100644 --- a/types/reactstrap/lib/Modal.d.ts +++ b/types/reactstrap/lib/Modal.d.ts @@ -1,3 +1,4 @@ +import * as React from 'react'; import { CSSModule } from '../index'; import { FadeProps } from './Fade'; @@ -28,5 +29,5 @@ export interface ModalProps extends React.HTMLAttributes { role?: string; } -declare const Modal: React.StatelessComponent; +declare class Modal extends React.Component {} export default Modal; diff --git a/types/reactstrap/lib/NavLink.d.ts b/types/reactstrap/lib/NavLink.d.ts index 53640c65e1..9625f92bc9 100644 --- a/types/reactstrap/lib/NavLink.d.ts +++ b/types/reactstrap/lib/NavLink.d.ts @@ -1,3 +1,4 @@ +import * as React from 'react'; import { CSSModule } from '../index'; export interface NavLinkProps extends React.HTMLProps { @@ -11,5 +12,5 @@ export interface NavLinkProps extends React.HTMLProps { href?: string; } -declare const NavLink: React.StatelessComponent; +declare class NavLink extends React.Component {} export default NavLink; diff --git a/types/reactstrap/lib/Popover.d.ts b/types/reactstrap/lib/Popover.d.ts index 3012b64485..e1ef254ee2 100644 --- a/types/reactstrap/lib/Popover.d.ts +++ b/types/reactstrap/lib/Popover.d.ts @@ -1,5 +1,4 @@ -/// - +import * as React from 'react'; import { CSSModule } from '../index'; import { Popper } from './Popper'; @@ -19,5 +18,5 @@ export interface PopoverProps extends React.HTMLAttributes { cssModule?: CSSModule; } -declare const Popover: React.StatelessComponent; +declare class Popover extends React.Component {} export default Popover; diff --git a/types/reactstrap/lib/TabContent.d.ts b/types/reactstrap/lib/TabContent.d.ts index 0a180cf3c4..46bf48d079 100644 --- a/types/reactstrap/lib/TabContent.d.ts +++ b/types/reactstrap/lib/TabContent.d.ts @@ -1,3 +1,4 @@ +import * as React from 'react'; import { CSSModule } from '../index'; export interface TabContentProps extends React.HTMLAttributes { @@ -7,5 +8,5 @@ export interface TabContentProps extends React.HTMLAttributes { cssModule?: CSSModule; } -declare const TabContent: React.StatelessComponent; +declare class TabContent extends React.Component {} export default TabContent; diff --git a/types/reactstrap/lib/Tooltip.d.ts b/types/reactstrap/lib/Tooltip.d.ts index bf472477c6..9c79c8a6d3 100644 --- a/types/reactstrap/lib/Tooltip.d.ts +++ b/types/reactstrap/lib/Tooltip.d.ts @@ -1,5 +1,4 @@ -/// - +import * as React from 'react'; import { CSSModule } from '../index'; import {Popper} from './Popper'; @@ -23,5 +22,5 @@ export interface TooltipProps extends UncontrolledTooltipProps { isOpen?: boolean; } -declare const Tooltip: React.StatelessComponent; +declare class Tooltip extends React.Component {} export default Tooltip; diff --git a/types/reactstrap/lib/Uncontrolled.d.ts b/types/reactstrap/lib/Uncontrolled.d.ts index d241477adb..d7aed3962f 100644 --- a/types/reactstrap/lib/Uncontrolled.d.ts +++ b/types/reactstrap/lib/Uncontrolled.d.ts @@ -1,12 +1,14 @@ +import * as React from 'react'; + import { UncontrolledAlertProps } from './Alert'; import { UncontrolledButtonDropdownProps } from './ButtonDropdown'; import { UncontrolledDropdownProps } from './Dropdown'; import { UncontrolledTooltipProps } from './Tooltip'; -export const UncontrolledAlert: React.StatelessComponent; -export const UncontrolledButtonDropdown: React.StatelessComponent; -export const UncontrolledDropdown: React.StatelessComponent; -export const UncontrolledTooltip: React.StatelessComponent; +export class UncontrolledAlert extends React.Component {} +export class UncontrolledButtonDropdown extends React.Component {} +export class UncontrolledDropdown extends React.Component {} +export class UncontrolledTooltip extends React.Component {} export { UncontrolledAlertProps } from './Alert'; export { UncontrolledButtonDropdownProps } from './ButtonDropdown'; diff --git a/types/reactstrap/reactstrap-tests.tsx b/types/reactstrap/reactstrap-tests.tsx index 9215bc7ba9..6f922a6dd4 100644 --- a/types/reactstrap/reactstrap-tests.tsx +++ b/types/reactstrap/reactstrap-tests.tsx @@ -3691,8 +3691,25 @@ const Example116 = (props: any) => { ); }; -class Example117 extends React.Component { - render() { - return { console.log(e); }}/>; - } +function Example117() { + const ref = (e: any) => {}; + + ; + + + + + + + + + ); + } +} From 4ad5d42d17dfb697be5834053cb32ba705d2a66d Mon Sep 17 00:00:00 2001 From: Nguyen Xuan Khanh Date: Tue, 22 May 2018 17:52:22 +0700 Subject: [PATCH 338/575] Added Grid children, label, stretchy props Specified children type for some components. Slider: added `max`, `min` props ColorButton: onClick to onChange Removed undocumented components. --- types/proton-native/index.d.ts | 205 ++++++++++++++++----------------- 1 file changed, 101 insertions(+), 104 deletions(-) diff --git a/types/proton-native/index.d.ts b/types/proton-native/index.d.ts index bf06ad879c..b49efe6014 100644 --- a/types/proton-native/index.d.ts +++ b/types/proton-native/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for proton-native 0.55 +// Type definitions for proton-native 1.1 // Project: https://github.com/kusti8/proton-native // Definitions by: Nguyen Xuan Khanh // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -18,7 +18,7 @@ export interface AppProps { */ export class App extends React.Component { } -export interface AreaBaseProps { +export interface AreaBaseProps extends GridChildrenProps, Label, Stretchy { /** * The fill color for the component. */ @@ -258,12 +258,7 @@ export class Area extends React.Component { static Rectangle: typeof AreaRectangle; } -/** - * Undocumented - */ -export class AreaInternal extends React.Component { } - -export interface BoxProps { +export interface BoxProps extends GridChildrenProps, Label, Stretchy { /** * Whether the Box is enabled. */ @@ -284,7 +279,11 @@ export interface BoxProps { export class Box extends React.Component { } -export interface ButtonProps { +export interface ButtonProps extends GridChildrenProps, Label, Stretchy { + /** + * The text to display in the button. + */ + children?: string; /** * Whether the button can be clicked. */ @@ -304,15 +303,19 @@ export interface ButtonProps { */ export class Button extends React.Component { } -export interface CheckboxProps { - /** - * Whether the checkbox can be used. - */ - enabled?: boolean; +export interface CheckboxProps extends GridChildrenProps, Label, Stretchy { /** * Whether the checkbox is checked or not. */ checked?: boolean; + /** + * The text to display next to the check box. + */ + children?: string; + /** + * Whether the checkbox can be used. + */ + enabled?: boolean; /** * Called when the checkbox is clicked. The current checkbox state is passed as an argument. */ @@ -325,7 +328,7 @@ export interface CheckboxProps { export class Checkbox extends React.Component { } -export interface ColorButtonProps { +export interface ColorButtonProps extends GridChildrenProps, Label, Stretchy { /** * The initial color for the ColorButton. Can be passed as standard color seen in CSS (a color name, hex, rgb, rgba, hsl, hsla). */ @@ -333,7 +336,7 @@ export interface ColorButtonProps { /** * Called when the color is changed for the ColorButton. The current color is passed as an object of RGBA. */ - onClick?: (color: { + onChange?: (color: { r: number, g: number, b: number, @@ -346,32 +349,7 @@ export interface ColorButtonProps { */ export class ColorButton extends React.Component { } -/** - * Undocumented - */ -export class Combobox extends React.Component { } - -/** - * Undocumented - */ -export class ComboboxItem extends React.Component { } - -/** - * Undocumented - */ -export class EditableCombobox extends React.Component { } - -/** - * Undocumented - */ -export class Entry extends React.Component { } - -/** - * Undocumented - */ -export class FontButton extends React.Component { } - -export interface FormProps { +export interface FormProps extends GridChildrenProps, Stretchy { /** * Whether the Form is enabled. */ @@ -438,7 +416,11 @@ export interface GridProps { */ export class Grid extends React.Component { } -export interface GroupProps { +export interface GroupProps extends GridChildrenProps, Label, Stretchy { + /** + * Group can only have one child. To have more than one child, use boxes. + */ + children?: JSX.Element; /** * Whether the Group is enabled. */ @@ -459,18 +441,17 @@ export interface GroupProps { /** * A named group of components. + * + * **Note:** Group can only have one child. To have more than one child, use boxes */ export class Group extends React.Component { } -/** - * Undocumented - */ -export class HorizontalBox extends React.Component { } - -/** - * Undocumented - */ -export class HorizontalSeparator extends React.Component { } +export interface Label { + /** + * Label for Form and Tab children + */ + label?: string; +} export interface MenuProps { /** @@ -480,6 +461,14 @@ export interface MenuProps { } export interface MenuItemProps { + /** + * The text to display for the menu item. + */ + children?: string; + /** + * If the type is `Check`, then set whether it is checked or not. + */ + checked?: boolean; /** * How the menu item is displayed. * @@ -491,16 +480,15 @@ export interface MenuItemProps { * - `Item` - a normal menu button. This is the default. */ type?: 'Check' | 'Quit' | 'About' | 'Preferences' | 'Separator' | 'Item'; - /** - * If the type is `Check`, then set whether it is checked or not. - */ - checked?: boolean; /** * Called when the menu item is clicked. If the type is `Check`, then it passes whether it is checked as an argument. */ onClick?: (checked: boolean) => void; } +/** + * A single item in a Menu. + */ export class MenuItem extends React.Component { } /** @@ -515,27 +503,7 @@ export class Menu extends React.Component { static Item: typeof MenuItem; } -/** - * Undocumented - */ -export class MenuBar extends React.Component { } - -/** - * Undocumented - */ -export class MenuBarItem extends React.Component { } - -/** - * Undocumented - */ -export class MultilineEntry extends React.Component { } - -/** - * Undocumented - */ -export class PasswordEntry extends React.Component { } - -export interface PickerProps { +export interface PickerProps extends GridChildrenProps, Label, Stretchy { /** * Whether the user can enter their own custom text in addition to the drop down menu. */ @@ -571,7 +539,7 @@ export interface PickerProps { */ export class Picker extends React.Component { } -export interface ProgressBarProps { +export interface ProgressBarProps extends GridChildrenProps, Label, Stretchy { /** * Whether the ProgressBar is enabled. */ @@ -591,14 +559,13 @@ export interface ProgressBarProps { */ export class ProgressBar extends React.Component { } -/** - * Undocumented - */ -export class RadioButton extends React.Component { } +export interface RadioButtonsItemProps { + children: string; +} -export class RadioButtonItem extends React.Component { } +export class RadioButtonsItem extends React.Component { } -export interface RadioButtonsProps { +export interface RadioButtonsProps extends GridChildrenProps, Label, Stretchy { /** * Whether the RadioButtons can be used. */ @@ -623,10 +590,10 @@ export interface RadioButtonsProps { * Every child must be a RadioButtons.Item, that requires a string child that is the label to display to the right of the RadioButton. */ export class RadioButtons extends React.Component { - static Item: typeof RadioButtonItem; + static Item: typeof RadioButtonsItem; } -export interface SeparatorProps { +export interface SeparatorProps extends GridChildrenProps, Label, Stretchy { /** * Whether the Separator is enabled. */ @@ -646,11 +613,19 @@ export interface SeparatorProps { */ export class Separator extends React.Component { } -export interface SliderProps { +export interface SliderProps extends GridChildrenProps, Label, Stretchy { /** * Whether the Slider is enabled. */ enabled?: boolean; + /** + * The minimum value for the slider. + */ + min?: number; + /** + * The maximum value for the slider. + */ + max?: number; /** * Called when the value of the slider is changed. The current value is passed as an argument. */ @@ -670,7 +645,7 @@ export interface SliderProps { */ export class Slider extends React.Component { } -export interface SpinBoxProps { +export interface SpinBoxProps extends GridChildrenProps, Label, Stretchy { /** * Whether the Spinbox is enabled. */ @@ -694,7 +669,20 @@ export interface SpinBoxProps { */ export class SpinBox extends React.Component { } -export interface TabProps { +export interface Stretchy { + /** + * Whether the component should stretch to fill the available space. Defaults to true. + * + * Excluded on: + * - Tabs + * - Grid children + * - Combobox/RadioButton Items + * - MenuBar + */ + stretchy?: boolean; +} + +export interface TabProps extends GridChildrenProps { /** * Whether the Tab is enabled. */ @@ -712,12 +700,23 @@ export interface TabProps { */ export class Tab extends React.Component { } +export interface TextProps extends GridChildrenProps, Label, Stretchy { + /** + * The text to display. + */ + children?: string; +} + /** * Displays some text. */ -export class Text extends React.Component { } +export class Text extends React.Component { } -export interface TextInputProps { +export interface TextInputProps extends GridChildrenProps, Label, Stretchy { + /** + * The default text in the TextInput. + */ + children?: string; /** * Whether the TextInput can be used. */ @@ -749,21 +748,15 @@ export interface TextInputProps { */ export class TextInput extends React.Component { } -/** - * Undocumented - */ -export class VerticalBox extends React.Component { } - -/** - * Undocumented - */ -export class VerticalSeparator extends React.Component { } - export interface WindowProps { /** * Whether the window will have a border on the inside. */ borderless?: boolean; + /** + * Window can only have one child. To have more than one child, use boxes. + */ + children?: JSX.Element; /** * Whether the window is closed. If set to closed, then the window will be closed. */ @@ -810,10 +803,15 @@ export interface WindowProps { /** * The window is the basis where all other components reside. + * + * **Note:** Window can only have one child. To have more than one child, use boxes. */ export class Window extends React.Component { } -export function render(element: JSX.Element): React.ReactNode; +/** + * Renders the input component + */ +export function render(element: JSX.Element): void; /** * A method to display an alert, or a dialog to save or open a file. @@ -830,8 +828,7 @@ export function Dialog( options?: { title: string, description?: string - } - | { + } | { title?: string, description: string } From 571f1889da6d4220551c2b877d2ad24ef40865c5 Mon Sep 17 00:00:00 2001 From: "Amir.Tugi@Gmail.com" Date: Tue, 22 May 2018 15:23:39 +0300 Subject: [PATCH 339/575] Fix tests --- types/express-paginate/express-paginate-tests.ts | 4 ++-- types/express-paginate/index.d.ts | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/types/express-paginate/express-paginate-tests.ts b/types/express-paginate/express-paginate-tests.ts index d31c70362c..20f1a0a558 100644 --- a/types/express-paginate/express-paginate-tests.ts +++ b/types/express-paginate/express-paginate-tests.ts @@ -5,7 +5,7 @@ declare function findAndCountAll(params: object): Promise<{count: number, rows: const app = express(); -app.use(paginate.middleware(10, 50)) +app.use(paginate.middleware(10, 50)); app.get('/users', async (req, res, next) => { // req.skip should be available @@ -22,5 +22,5 @@ app.get('/users', async (req, res, next) => { hasNextPages: paginate.hasNextPages(req)(pageCount), pages: paginate.getArrayPages(req)(3, pageCount, req.query.page) }); - }).catch(err => next(err)) + }).catch(next); }); diff --git a/types/express-paginate/index.d.ts b/types/express-paginate/index.d.ts index 403bd92979..1f722d1b28 100644 --- a/types/express-paginate/index.d.ts +++ b/types/express-paginate/index.d.ts @@ -2,19 +2,20 @@ // Project: https://github.com/niftylettuce/express-paginate // Definitions by: My Self // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.7 import * as express from 'express'; declare global { namespace Express { - export interface Request { - skip?: number, - offset?: number, + interface Request { + skip?: number; + offset?: number; } } } -interface PageElement { +export interface PageElement { number: number; url: typeof href; } From f4f78cffa35452fd094bd52ba38c91e71f89db46 Mon Sep 17 00:00:00 2001 From: Dmitry Mazurok Date: Tue, 22 May 2018 20:45:49 +0700 Subject: [PATCH 340/575] [@types/mem-fs-editor] Add 'commit' override and 'object' -> 'any' --- types/mem-fs-editor/index.d.ts | 29 ++++++++++++---------- types/mem-fs-editor/mem-fs-editor-tests.ts | 16 ++++++++++++ 2 files changed, 32 insertions(+), 13 deletions(-) diff --git a/types/mem-fs-editor/index.d.ts b/types/mem-fs-editor/index.d.ts index 01234bbc0c..60f5b51867 100644 --- a/types/mem-fs-editor/index.d.ts +++ b/types/mem-fs-editor/index.d.ts @@ -17,30 +17,33 @@ export function create(store: Store): memFsEditor.Editor; export namespace memFsEditor { type Contents = string|Buffer; - type ReplacerFunc = (key: string, value: any) => string|null|undefined; + type ReplacerFunc = (key: string, value: any) => any; type Space = string|number; type ProcessFunc = (contents: Buffer) => Contents; + type Callback = (err: any) => any; + interface CopyOptions { process?: ProcessFunc; globOptions?: GlobOptions; } interface Editor { - read: (filepath: string, options?: { raw: boolean, defaults: string }) => string; - readJSON: (filepath: string, defaults?: string) => string; - write: (filepath: string, contents: Contents) => void; - writeJSON: (filepath: string, contents: object, replacer?: ReplacerFunc, space?: Space) => void; - append: (filepath: string, contents: Contents, options?: { trimEnd: boolean, separator: string }) => void; - extendJSON: (filepath: string, contents: object, replacer?: ReplacerFunc, space?: Space) => void; - delete: (filepath: string, options?: { globOptions: GlobOptions }) => void; - copy: (from: string, to: string, options?: CopyOptions) => void; - copyTpl: (from: string, to: string, context: object, templateOptions?: TemplateOptions, copyOptions?: CopyOptions) => void; - move: (from: string, to: string, options?: { globOptions: GlobOptions }) => void; - exists: (filepath: string) => boolean; - commit: (filters: ReadonlyArray, callback: () => void) => void; + read(filepath: string, options?: { raw: boolean, defaults: string }): string; + readJSON(filepath: string, defaults?: any): any; + write(filepath: string, contents: Contents): void; + writeJSON(filepath: string, contents: any, replacer?: ReplacerFunc, space?: Space): void; + append(filepath: string, contents: Contents, options?: { trimEnd: boolean, separator: string }): void; + extendJSON(filepath: string, contents: object, replacer?: ReplacerFunc, space?: Space): void; + delete(filepath: string, options?: { globOptions: GlobOptions }): void; + copy(from: string, to: string, options?: CopyOptions): void; + copyTpl(from: string, to: string, context: object, templateOptions?: TemplateOptions, copyOptions?: CopyOptions): void; + move(from: string, to: string, options?: { globOptions: GlobOptions }): void; + exists(filepath: string): boolean; + commit(callback: Callback): void; + commit(filters: ReadonlyArray, callback: Callback): void; } const prototype: { diff --git a/types/mem-fs-editor/mem-fs-editor-tests.ts b/types/mem-fs-editor/mem-fs-editor-tests.ts index 355c714bf9..ff3c52c5a0 100644 --- a/types/mem-fs-editor/mem-fs-editor-tests.ts +++ b/types/mem-fs-editor/mem-fs-editor-tests.ts @@ -1,3 +1,5 @@ +import { Transform } from 'stream'; + import memFs = require('mem-fs'); import editor = require('mem-fs-editor'); @@ -16,3 +18,17 @@ fs.copy('template.js', 'template.tpl', { fs.copyTpl('template.tpl', 'output.js', { foo: 'bar' }); + +const obj = fs.readJSON('template.json'); +fs.writeJSON('template.json', obj); +fs.extendJSON('template.json', {qwer: 'asdf'}); + +fs.writeJSON('template.json', 'qwer'); // should not be an error, because the parameter is passed to JSON.stringify and it accepts the string +// fs.extendJSON('template.json', 'qwer'); // should be an error, because it does not make sense to extend a json with string + +// should accept both versions of commit - with filters and without: +const cb = (err: any) => ({adsf: 'adsf'}); +fs.commit(cb); + +const filters: Transform[] = []; +fs.commit(filters, cb); From acf760be0c5a04c2ffc194855750a336a7a9bb89 Mon Sep 17 00:00:00 2001 From: Pablo Moleri Date: Tue, 22 May 2018 11:01:55 -0300 Subject: [PATCH 341/575] [sequelize] Add explanation for Model.associate? method --- types/sequelize/index.d.ts | 9 +++++++++ types/sequelize/sequelize-tests.ts | 7 +++++++ 2 files changed, 16 insertions(+) diff --git a/types/sequelize/index.d.ts b/types/sequelize/index.d.ts index cc4bef61ba..673225665a 100644 --- a/types/sequelize/index.d.ts +++ b/types/sequelize/index.d.ts @@ -4085,6 +4085,15 @@ declare namespace sequelize { /** * Set associations with other models * + * Not part of the sequelize API, used as convention to associate models after creation. e.g.: + * ```js + * Object.keys(models).forEach(modelName => { + * if (models[modelName].associate) { + * models[modelName].associate(models); + * } + * }); + * ``` + * * @param models */ associate?(models: Models): void; diff --git a/types/sequelize/sequelize-tests.ts b/types/sequelize/sequelize-tests.ts index bc600c961d..3d2bbdfe05 100644 --- a/types/sequelize/sequelize-tests.ts +++ b/types/sequelize/sequelize-tests.ts @@ -1523,6 +1523,13 @@ s.define( 'ScopeMe', { } } ); +// Test convention method used to associate models after creation +Object.keys(s.models).forEach(modelName => { + if (s.models[modelName].associate) { + s.models[modelName].associate(s.models); + } +}); + // Generic find options interface ChairAttributes { id: number; From c1e00e25e96757183996545fd546cd74b38e7e4e Mon Sep 17 00:00:00 2001 From: "Amir.Tugi@Gmail.com" Date: Tue, 22 May 2018 17:32:22 +0300 Subject: [PATCH 342/575] Fill correct metadata --- types/express-paginate/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/express-paginate/index.d.ts b/types/express-paginate/index.d.ts index 1f722d1b28..b816d11b1b 100644 --- a/types/express-paginate/index.d.ts +++ b/types/express-paginate/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for express-paginate 1.0 // Project: https://github.com/niftylettuce/express-paginate -// Definitions by: My Self +// Definitions by: Amir Tugendhaft // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.7 From c6f240a492bf43681df0fe8fb9bd37224b0d60e8 Mon Sep 17 00:00:00 2001 From: gmalicky <34336799+gmalicky@users.noreply.github.com> Date: Tue, 22 May 2018 17:03:42 +0200 Subject: [PATCH 343/575] Fix toMatchElement() definition --- types/expect-puppeteer/expect-puppeteer-tests.ts | 5 +++-- types/expect-puppeteer/index.d.ts | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/types/expect-puppeteer/expect-puppeteer-tests.ts b/types/expect-puppeteer/expect-puppeteer-tests.ts index 84a7e65486..4ad0ce1f3c 100644 --- a/types/expect-puppeteer/expect-puppeteer-tests.ts +++ b/types/expect-puppeteer/expect-puppeteer-tests.ts @@ -13,8 +13,9 @@ const testGlobal = async (instance: ElementHandle | Page) => { await expect(instance).toMatch("selector"); await expect(instance).toMatch("selector", { timeout: 777 }); - await expect(instance).toMatchElement("selector", "value"); - await expect(instance).toMatchElement("selector", "value", { polling: "mutation" }); + await expect(instance).toMatchElement("selector"); + await expect(instance).toMatchElement("selector", { polling: "raf", timeout: 777 }); + await expect(instance).toMatchElement("selector", { polling: "mutation", text: "text" }); await expect(instance).toSelect("selector", "valueOrText"); await expect(instance).toSelect("selector", "valueOrText", { polling: "raf" }); diff --git a/types/expect-puppeteer/index.d.ts b/types/expect-puppeteer/index.d.ts index ce20675d37..4d599f99fe 100644 --- a/types/expect-puppeteer/index.d.ts +++ b/types/expect-puppeteer/index.d.ts @@ -42,7 +42,7 @@ interface ExpectPuppeteer { toDisplayDialog(block: () => Promise): Promise; toFill(selector: string, value: string, options?: ExpectTimingActions): Promise; toMatch(selector: string, options?: ExpectTimingActions): Promise; - toMatchElement(selector: string, value: string, options?: ExpectTimingActions): Promise; + toMatchElement(selector: string, options?: ExpectToClickOptions): Promise; toSelect(selector: string, valueOrText: string, options?: ExpectTimingActions): Promise; toUploadFile(selector: string, filePath: string, options?: ExpectTimingActions): Promise; } @@ -57,7 +57,7 @@ declare global { toDisplayDialog(block: () => Promise): Promise; toFill(selector: string, value: string, options?: ExpectTimingActions): Promise; toMatch(selector: string, options?: ExpectTimingActions): Promise; - toMatchElement(selector: string, value: string, options?: ExpectTimingActions): Promise; + toMatchElement(selector: string, options?: ExpectToClickOptions): Promise; toSelect(selector: string, valueOrText: string, options?: ExpectTimingActions): Promise; toUploadFile(selector: string, filePath: string, options?: ExpectTimingActions): Promise; } From 1dd1072c1059059f32c7ca056e493517d7b08846 Mon Sep 17 00:00:00 2001 From: Craig Boland Date: Tue, 22 May 2018 11:28:11 -0500 Subject: [PATCH 344/575] Add explicit typing for 'this' references. --- types/datatables.net/datatables.net-tests.ts | 9 +++++++++ types/datatables.net/index.d.ts | 6 +++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/types/datatables.net/datatables.net-tests.ts b/types/datatables.net/datatables.net-tests.ts index 0c9f3db3cc..423dcaf4c9 100644 --- a/types/datatables.net/datatables.net-tests.ts +++ b/types/datatables.net/datatables.net-tests.ts @@ -533,6 +533,9 @@ $('#example').on('click', 'tbody td', () => { cells.every(() => { }); cells.every((cellRowIdx, cellColIdx, tableLoop, cellLoop) => { }); +cells.every(function(cellRowIdx, cellColIdx, tableLoop, cellLoop) { + const cell: DataTables.CellMethods = this; +}); let cell = dt.cell(":contains('Not shipped')"); cell = dt.cell(() => { }); @@ -815,6 +818,9 @@ dt.columns.adjust().draw(false); // adjust column sizing and redraw dt.columns().every(() => { }); dt.columns().every((colIdx, tableLoop, colLoop) => { }); +dt.columns().every(function(colIdx, tableLoop, colLoop) { + const col: DataTables.ColumnMethods = this; +}); $('#example').on('column-visibility.dt', (e: object, settings: DataTables.Settings, column: number, state: boolean, recalc: boolean | undefined) => { const widthRecalced = (recalc || recalc === undefined); @@ -864,6 +870,9 @@ const rows_12 = dt.rows("selector").nodes(); const rows_13 = dt.rows.add([{}, {}]); dt.rows().every(() => { }); dt.rows().every((rowIdx, tableLoop, rowLoop) => { }); +dt.rows().every(function(rowIdx, tableLoop, rowLoop) { + const row: DataTables.RowMethods = this; +}); const rows_14: DataTables.Api = dt.rows("selector").ids(); const rows_15: DataTables.Api = dt.rows("selector").ids(false); diff --git a/types/datatables.net/index.d.ts b/types/datatables.net/index.d.ts index c0a37145ab..2fd3f3ae45 100644 --- a/types/datatables.net/index.d.ts +++ b/types/datatables.net/index.d.ts @@ -684,7 +684,7 @@ declare namespace DataTables { * * @param fn Function to execute for every cell selected. */ - every(fn: (cellRowIdx: number, cellColIdx: number, tableLoop: number, cellLoop: number) => void): Api; + every(fn: (this: CellMethods, cellRowIdx: number, cellColIdx: number, tableLoop: number, cellLoop: number) => void): Api; /** * Get index information about the selected cells @@ -812,7 +812,7 @@ declare namespace DataTables { * * @param fn Function to execute for every column selected. */ - every(fn: (colIdx: number, tableLoop: number, colLoop: number) => void): Api; + every(fn: (this: ColumnMethods, colIdx: number, tableLoop: number, colLoop: number) => void): Api; /** * Get the column indexes of the selected columns. @@ -995,7 +995,7 @@ declare namespace DataTables { * * @param fn Function to execute for every row selected. */ - every(fn: (rowIdx: number, tableLoop: number, rowLoop: number) => void): Api; + every(fn: (this: RowMethods, rowIdx: number, tableLoop: number, rowLoop: number) => void): Api; /** * Get the ids of the selected rows. Since: 1.10.8 From 92281d5ff0151d9e520583b0655e74d92dc441d4 Mon Sep 17 00:00:00 2001 From: Alex Jerabek Date: Tue, 22 May 2018 10:23:34 -0700 Subject: [PATCH 345/575] fix merge changes --- types/office-js/index.d.ts | 1013 ++++++++++++++++++++++++++++++------ 1 file changed, 863 insertions(+), 150 deletions(-) diff --git a/types/office-js/index.d.ts b/types/office-js/index.d.ts index 7ecd02afd1..729b4c1bc1 100644 --- a/types/office-js/index.d.ts +++ b/types/office-js/index.d.ts @@ -15,7 +15,13 @@ Copyright (c) Microsoft Corporation //////////////////////////////////////////////////////////////// declare namespace Office { + /** + * Provides a container for APIs that are still in Preview, not released for use in production add-ins. + */ export var Preview: { + /** + * Initializes the use of custom JavaScript functions in Excel. + */ startCustomFunctions(): Promise; } @@ -146,63 +152,105 @@ declare namespace Office { // Objects /** * An object which encapsulates the result of an asynchronous request, including status and error information if the request failed. - * - * **Hosts**: Access, Excel, Outlook, PowerPoint, Project, Word - * + * * @remarks + * Hosts: Access, Excel, Outlook, PowerPoint, Project, Word + * * When the function you pass to the `callback` parameter of an "Async" method executes, it receives an AsyncResult object that you can access from the `callback` function's only parameter. */ export interface AsyncResult { /** * Gets the user-defined item passed to the optional `asyncContext` parameter of the invoked method in the same state as it was passed in. This the user-defined item (which can be of any JavaScript type: String, Number, Boolean, Object, Array, Null, or Undefined) passed to the optional `asyncContext` parameter of the invoked method. Returns Undefined, if you didn't pass anything to the asyncContext parameter. - * - * **Hosts**: Access, Excel, Outlook, PowerPoint, Project, Word + * + * @remarks + * Hosts: Access, Excel, Outlook, PowerPoint, Project, Word */ asyncContext: any; /** * Gets the [AsyncResultStatus](office.asyncresultstatus.md) of the asynchronous operation. * - * **Hosts**: Access, Excel, Outlook, PowerPoint, Project, Word + * @remarks + * Hosts: Access, Excel, Outlook, PowerPoint, Project, Word */ status: AsyncResultStatus; /** * Gets an [Error](office.error.md) object that provides a description of the error, if any error occurred. * - * **Hosts**: Access, Excel, Outlook, PowerPoint, Project, Word + * @remarks + * Hosts: Access, Excel, Outlook, PowerPoint, Project, Word */ error: Error; /** * Gets the payload or content of this asynchronous operation, if any. + + * @remarks + * You access the AsyncResult object in the function passed as the argument to the callback parameter of an "Async" method, such as the `getSelectedDataAsync` and `setSelectedDataAsync` methods of the Document object. * * Note: What the value property returns for a particular "Async" method varies depending on the purpose and context of that method. To determine what is returned by the value property for an "Async" method, refer to the "Callback value" section of the method's topic. For a complete listing of the "Async" methods, see the Remarks section of the AsyncResult object topic. * - * **Hosts**: Access, Excel, Outlook, PowerPoint, Project, Word - * - * @remarks - * You access the AsyncResult object in the function passed as the argument to the callback parameter of an "Async" method, such as the `getSelectedDataAsync` and `setSelectedDataAsync` methods of the Document object. + * Hosts: Access, Excel, Outlook, PowerPoint, Project, Word */ value: any; } + /** + * Represents the runtime environment of the add-in and provides access to key objects of the API. + * + * @remarks + * Hosts: Access, Excel, Outlook, PowerPoint, Project, Word + */ export interface Context { + /** + * Provides information and access to the signed-in user. + */ auth: Auth; + /** + * Gets the locale (language) specified by the user for editing the document or item. + */ contentLanguage: string; + /** + * Gets the locale (language) specified by the user for the UI of the Office host application. + */ displayLanguage: string; + /** + * + */ license: string; + /** + * Provides access to the properties for Office theme colors. + */ officeTheme: OfficeTheme; + /** + * Provides access to the properties for Office theme colors. + */ touchEnabled: boolean; + /** + * Provides objects and methods that you can use to create and manipulate UI components, such as dialog boxes. + */ ui: UI; + /** + * Contains the host in which the add-in (web application) is running in. Possible values are: Word, Excel, PowerPoint + */ host: HostType; + /** + * Provides the platform on which the add-in is running. Possible values are: PC, OfficeOnline, Mac, iOS, Android, Universal + */ platform: PlatformType; + /** + * + */ diagnostics: { host: HostType; platform: PlatformType; version: string; }; + /** + * Provides a method for determining what requirement sets are supported on the current host and platform. + */ requirements: { /** * Check if the specified requirement set is supported by the host Office application. - * @param name - Set name. e.g.: "MatrixBindings". - * @param minVersion - The minimum required version. + * @param name - Set name; e.g., "MatrixBindings". + * @param minVersion - The minimum required version; e.g., "1.4". */ isSetSupported(name: string, minVersion?: number): boolean; } @@ -234,29 +282,42 @@ declare namespace Office { */ export interface UI { /** - * Displays a dialog to show or collect information from the user or to facilitate Web navigation. + * Displays a dialog to show or collect information from the user or to facilitate Web navigation. + * + * @remarks + * Hosts: Word, Excel, Outlook, PowerPoint + * + * Requirement sets: DialogApi, Mailbox 1.4 + * + * The initial page must be on the same domain as the parent page (the startAddress parameter). After the initial page loads, you can go to other domains. + * + * Any page calling office.context.ui.messageParent must also be on the same domain as the parent page. + * + * The following design considerations apply to dialog boxes: + * + * - An Office Add-in can have only one dialog box open at any time. + * + * - Every dialog box can be moved and resized by the user. + * + * - Every dialog box is centered on the screen when opened. + * + * - Dialog boxes appear on top of the host application and in the order in which they were created. + * + * Use a dialog box to: + * + * - Display authentication pages to collect user credentials. + * + * - Display an error/progress/input screen from a ShowTaspane or ExecuteAction command. + * + * - Temporarily increase the surface area that a user has available to complete a task. + * + * Do not use a dialog box to interact with a document. Use a task pane instead. + * * @param startAddress - Accepts the initial HTTPS URL that opens in the dialog. + * @param options - Optional. Accepts a DialogOptions object to define dialog display. + * @param callback - Optional. Accepts a callback method to handle the dialog creation attempt. If successful, the AsyncResult.value is a DialogHandler object. */ - displayDialogAsync(startAddress: string): void; - /** - * Displays a dialog to show or collect information from the user or to facilitate Web navigation. - * @param startAddress - Accepts the initial HTTPS URL that opens in the dialog. - * @param options - Optional. Accepts a DialogOptions object to define dialog behaviors. - */ - displayDialogAsync(startAddress: string, options: DialogOptions): void; - /** - * Displays a dialog to show or collect information from the user or to facilitate Web navigation. - * @param startAddress - Accepts the initial HTTPS URL that opens in the dialog. - * @param callback - Optional. Accepts a callback method to handle the dialog creation attempt. - */ - displayDialogAsync(startAddress: string, callback: (result: AsyncResult) => void): void; - /** - * Displays a dialog to show or collect information from the user or to facilitate Web navigation. - * @param startAddress - Accepts the initial HTTPS URL that opens in the dialog. - * @param options - Optional. Accepts a DialogOptions object to define dialog behaviors. - * @param callback - Optional. Accepts a callback method to handle the dialog creation attempt. - */ - displayDialogAsync(startAddress: string, options: DialogOptions, callback: (result: AsyncResult) => void): void; + displayDialogAsync(startAddress: string, options?: DialogOptions, callback?: (result: AsyncResult) => void): void; /** * Delivers a message from the dialog box to its parent/opener page. The page calling this API must be on the same domain as the parent. * @param messageObject Accepts a message from the dialog to deliver to the add-in. @@ -265,6 +326,7 @@ declare namespace Office { /** * Closes the UI container where the JavaScript is executing. * + * @remarks * The behavior of this method is specified by the following: * * - Called from a UI-less command button: No effect. Any dialog opened by displayDialogAsync will remain open. @@ -273,36 +335,39 @@ declare namespace Office { * * - Called from a module extension: No effect. * - * Hosts: Outlook - Minimum requirement set: Mailbox 1.5 + * Hosts: Excel, Word, PowerPoint, Outlook (Minimum requirement set: Mailbox 1.5) */ closeContainer(): void; } export interface DialogOptions { /** - * Optional. Defines the width of the dialog as a percentage of the current display. Defaults to 99%. 250px minimum. + * Defines the width of the dialog as a percentage of the current display. Defaults to 80%. 250px minimum. */ height?: number, /** - * Optional. Defines the height of the dialog as a percentage of the current display. Defaults to 99%. 150px minimum. + * Defines the height of the dialog as a percentage of the current display. Defaults to 80%. 150px minimum. */ width?: number, /** - * Optional. Determines whether the dialog box should be displayed within an IFrame. This setting is only applicable in Office Online clients, and is ignored on other platforms. + * Determines whether the dialog box should be displayed within an IFrame. This setting is only applicable in Office Online clients, and is ignored by other platforms. If false (default), the dialog will be displayed as a new browser window (pop-up). Recommended for authentication pages that cannot be displayed in an IFrame. If true, the dialog will be displayed as a floating overlay with an IFrame. This is best for user experience and performance. */ displayInIframe?: boolean } export interface Auth { /** * Obtains an access token from AAD V 2.0 endpoint to grant the Office host application access to the add-in's web application. - * @param callback - Optional. Accepts a callback method to handle the token acquisition attempt. If AsyncResult.status is "succeeded", then AsyncResult.value is the raw AAD v. 2.0-formatted access token. - */ - getAccessTokenAsync(callback: (result: AsyncResult) => void): void; - /** - * Obtains an access token from AAD V 2.0 endpoint to grant the Office host application access to the add-in's web application. + * + * @remarks + * Hosts: Excel, OneNote, Outlook, PowerPoint, Word + * + * Requirement sets: IdentityAPI + * + * This API requires a single sign-on configuration that bridges the add-in to an Azure application. Office users sign-in with Organizational Accounts and Microsoft Accounts. Microsoft Azure returns tokens intended for both user account types to access resources in the Microsoft Graph. + * * @param options - Optional. Accepts an AuthOptions object to define sign-on behaviors. * @param callback - Optional. Accepts a callback method to handle the token acquisition attempt. If AsyncResult.status is "succeeded", then AsyncResult.value is the raw AAD v. 2.0-formatted access token. */ - getAccessTokenAsync(options: AuthOptions, callback: (result: AsyncResult) => void): void; + getAccessTokenAsync(options?: AuthOptions, callback?: (result: AsyncResult) => void): void; } export interface AuthOptions { @@ -338,7 +403,11 @@ declare namespace Office { */ close(): void; /** - * Adds an event handler for DialogMessageReceived or DialogEventReceived + * Registers an event handler. The two supported events are: + * + * - DialogMessageReceived. Triggered when the dialog box sends a message to its parent. + * + * - DialogEventReceived. Triggered when the dialog box has been closed or otherwise unloaded. */ addEventHandler(eventType: Office.EventType, handler: Function): void; @@ -470,20 +539,20 @@ declare namespace Office { /** * Occurs when data within the binding is changed. * + * @remarks * Hosts: Access, Excel, Word * - * @remarks * To add an event handler for the BindingDataChanged event of a binding, use the addHandlerAsync method of the Binding object. The event handler receives an argument of type BindingDataChangedEventArgs. */ BindingDataChanged, /** * Occurs when the selection is changed within the binding. * + * @remarks * Hosts: Access, Excel, Word * * Available in Requirement set: BindingEvents * - * @remarks * To add an event handler for the BindingSelectionChanged event of a binding, use the addHandlerAsync method of the Binding object. The event handler receives an argument of type BindingSelectionChangedEventArgs. */ BindingSelectionChanged, @@ -544,7 +613,7 @@ declare namespace Office { */ Text, /** - * Returns the entire document (.pptx or .docx) in Office Open XML (OOXML) format as a byte array. + * Returns the entire document (.pptx, .docx, or .xslx) in Office Open XML (OOXML) format as a byte array. */ Compressed, /** @@ -638,11 +707,11 @@ declare namespace Office { /** * Represents a binding to a section of the document. * - * **Hosts**: Access, Excel, Word - * - * **Available in Requirement sets**: MatrixBinding, TableBinding, TextBinding - * * @remarks + * Hosts: Access, Excel, Word + * + * Available in Requirement sets: MatrixBinding, TableBinding, TextBinding + * * The Binding object exposes the functionality possessed by all bindings regardless of type. * * The Binding object is never called directly. It is the abstract parent class of the objects that represent each type of binding: MatrixBinding, TableBinding, or TextBinding. All three of these objects inherit the getDataAsync and setDataAsync methods from the Binding object that enable to you interact with the data in the binding. They also inherit the id and type properties for querying those property values. Additionally, the MatrixBinding and TableBinding objects expose additional methods for matrix- and table-specific features, such as counting the number of rows and columns. @@ -651,19 +720,22 @@ declare namespace Office { /** * Get the Document object associated with the binding. * - * **Hosts**: Access, Excel, Word + * @remarks + * Hosts: Access, Excel, Word */ document: Document; /** * A string that uniquely identifies this binding among the bindings in the same Document object. * + * @remarks * Hosts: Access, Excel, Word */ id: string; /** * Gets the type of the binding. * - * **Hosts**: Access, Excel, Word + * @remarks + * Hosts: Access, Excel, Word */ type: BindingType; /** @@ -682,11 +754,11 @@ declare namespace Office { /** * Returns the data contained within the binding. * + * @remarks * Hosts: Access, Excel, Word * * Available in Requirement sets: MatrixBindings, TableBindings, TextBindings * - * @remarks * When called from a MatrixBinding or TableBinding, the getDataAsync method will return a subset of the bound values if the optional startRow, startColumn, rowCount, and columnCount parameters are specified (and they specify a contiguous and valid range). * * @param options An object with any of the following (example: {coercionType: 'matrix, 'valueFormat: 'formatted', filterType:'all'}): @@ -715,9 +787,10 @@ declare namespace Office { /** * Removes the specified handler from the binding for the specified event type. * - * **Hosts**: Access, Excel, Word + * @remarks + * Hosts: Access, Excel, Word * - * **Available in Requirement set**: BindingEvents + * Available in Requirement set: BindingEvents * * @param eventType The event type. For binding can be 'bindingDataChanged' and 'bindingSelectionChanged' * @param options An object with any of the following: @@ -732,9 +805,10 @@ declare namespace Office { /** * Writes data to the bound section of the document represented by the specified binding object. * - * **Hosts**: Access, Excel, Word + * @remarks + * Hosts: Access, Excel, Word * - * **Available in Requirement sets**: MatrixBindings, TableBindings, TextBindings + * Available in Requirement sets: MatrixBindings, TableBindings, TextBindings * * @param data The data to be set in the current selection. Possible data types by host: * @@ -770,75 +844,206 @@ declare namespace Office { */ setDataAsync(data: TableData | any, options?: any, callback?: (result: AsyncResult) => void): void; } + /** + * Represents the bindings the add-in has within the document. + * + * @remarks + * Hosts: + */ export interface Bindings { + /** + * Gets a Document object that represents the document associated with this set of bindings. + * + *remarks + * Hosts: Access, Excel, Word + */ document: Document; /** - * Creates a binding against a named object in the document + * Creates a binding against a named object in the document. + * + * @remarks + * Hosts: Access, Excel, Word + * + * Available in Requirement set: MatrixBindings, TableBindings, TextBindings + * + * For Excel, the itemName parameter can refer to a named range or a table. + * + * By default, adding a table in Excel assigns the name "Table1" for the first table you add, "Table2" for the second table you add, and so on. To assign a meaningful name for a table in the Excel UI, use the Table Name property on the Table Tools | Design tab of the ribbon. + * + * Note: In Excel, when specifying a table as a named item, you must fully qualify the name to include the worksheet name in the name of the table in this format: "Sheet1!Table1" + * + * For Word, the itemName parameter refers to the Title property of a Rich Text content control. (You can't bind to content controls other than the Rich Text content control.) + * + * By default, a content control has no Title value assigned. To assign a meaningful name in the Word UI, after inserting a Rich Text content control from the Controls group on the Developer tab of the ribbon, use the Properties command in the Controls group to display the Content Control Properties dialog box. Then set the Title property of the content control to the name you want to reference from your code. + * + * Note: In Word, if there are multiple Rich Text content controls with the same Title property value (name), and you try to bind to one these content controls with this method (by specifying its name as the itemName parameter), the operation will fail. + * * @param itemName Name of the bindable object in the document. For Example 'MyExpenses' table in Excel." - * @param bindingType The Office BindingType for the data - * @param options Syntax example: {id: "BindingID"} - * id: Name of the binding, autogenerated if not supplied. + * @param bindingType The Office BindingType for the data. The method returns null if the selected object cannot be coerced into the specified type. + * @param options An object like {id: "BindingID"} that has any of the following properties: + * + * id: Unique name of the binding. Autogenerated if not supplied. + * * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. - * columns: The string[] of the columns involved in the binding + * + * columns: The string[] of the columns involved in the binding. + * * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ addFromNamedItemAsync(itemName: string, bindingType: BindingType, options?: any, callback?: (result: AsyncResult) => void): void; /** * Create a binding by prompting the user to make a selection on the document. - * @param bindingType The Office BindingType for the data - * @param options addFromPromptAsyncOptions- e.g. {promptText: "Please select data", id: "mySales"} - * promptText: Greet your users with a friendly word. + * + * @remarks + * Hosts: Access, Excel + * + * Available in Requirement set: Not in a set + * + * Adds a binding object of the specified type to the Bindings collection, which will be identified with the supplied id. The method fails if the specified selection cannot be bound. + * + * @param bindingType Specifies the type of the binding object to create. Required. Returns null if the selected object cannot be coerced into the specified type. + * @param options An object like {promptText: "Please select data", id: "mySales"} with any of the following properties: + * + * promptText: Specifies the string to display in the prompt UI that tells the user what to select. Limited to 200 characters. If no promptText argument is passed, "Please make a selection" is displayed. + * * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. - * id: Identifier. - * sampleData: A TableData that gives sample table in the Dialog.TableData.Headers is [][] of string. + * + * id: Specifies the unique name to be used to identify the new binding object.If no argument is passed for the id parameter, the Binding.id is autogenerated. + * + * sampleData: Specifies a table of sample data displayed in the prompt UI as an example of the kinds of fields (columns) that can be bound by your add-in. The headers provided in the TableData object specify the labels used in the field selection UI. Optional. Note: This parameter is used only in add-ins for Access. It is ignored if provided when calling the method in an add-in for Excel. + * * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ addFromPromptAsync(bindingType: BindingType, options?: any, callback?: (result: AsyncResult) => void): void; /** - * Create a binding based on what the user's current selection. - * @param bindingType The Office BindingType for the data - * @param options addFromSelectionAsyncOptions- e.g. {id: "BindingID"} - * id: Identifier. + * Create a binding based on the user's current selection. + * + * @remarks + * Hosts: Access, Excel, Word + * + * Available in Requirement set: MatrixBindings, TableBindings, TextBindings + * + * Adds the specified type of binding object to the Bindings collection, which will be identified with the supplied id. + * + * Note In Excel, if you call the addFromSelectionAsync method passing in the Binding.id of an existing binding, the Binding.type of that binding is used, and its type cannot be changed by specifying a different value for the bindingType parameter.If you need to use an existing id and change the bindingType, call the Bindings.releaseByIdAsync method first to release the binding, and then call the addFromSelectionAsync method to reestablish the binding with a new type. + * + * @param bindingType Specifies the type of the binding object to create. Required. Returns null if the selected object cannot be coerced into the specified type. + * @param options An object like {id: "BindingID"} with any of the following properties: + * + * id: Specifies the unique name to be used to identify the new binding object.If no argument is passed for the id parameter, the Binding.id is autogenerated. + * * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * * columns: The string[] of the columns involved in the binding + * * sampleData: A TableData that gives sample table in the Dialog.TableData.Headers is [][] of string. + * * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ addFromSelectionAsync(bindingType: BindingType, options?: any, callback?: (result: AsyncResult) => void): void; /** - * Gets an array with all the binding objects in the document. + * Gets all bindings that were previously created. + * + * @remarks + * Hosts: Access, Excel, Word + * + * Available in Requirement set: MatrixBindings, TableBindings, TextBindings + * * @param options Syntax example: {asyncContext:context} * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ getAllAsync(options?: any, callback?: (result: AsyncResult) => void): void; /** * Retrieves a binding based on its Name - * @param id The binding id + * + * @remarks + * Hosts: Access, Excel, Word + * + * Available in Requirement set: CustomXmlParts, MatrixBindings, TableBindings, TextBindings + * + * Fails if the specified id does not exist. + * + * @param id Specifies the unique name of the binding object. Required. * @param options Syntax example: {asyncContext:context} * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. - */ + */ getByIdAsync(id: string, options?: any, callback?: (result: AsyncResult) => void): void; /** * Removes the binding from the document - * @param id The binding id + * + * @remarks + * Hosts: Access, Excel, Word + * + * Available in Requirement set: MatrixBindings, TableBindings, TextBindings + * + * Fails if the specified id does not exist. + * + * @param id Specifies the unique name to be used to identify the binding object. Required. * @param options Syntax example: {asyncContext:context} * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ releaseByIdAsync(id: string, options?: any, callback?: (result: AsyncResult) => void): void; } + /** + * Represents the runtime environment of the add-in and provides access to key objects of the API. + * + * @remarks + * Hosts: Access, Excel, Outlook, PowerPoint, Project, Word + */ export interface Context { + /** + * Gets an object that represents the document the content or task pane add-in is interacting with. + */ document: Document; } + /** + * Represents an XML node in a tree in a document. + * + * @remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + */ export interface CustomXmlNode { + /** + * Gets the base name of the node without the namespace prefix, if one exists. + * + * @remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + */ baseName: string; + /** + * Retrieves the string GUID of the CustomXMLPart. + * + * @remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + */ namespaceUri: string; + /** + * Gets the type of the CustomXMLNode. + * + * @remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + */ nodeType: string; /** - * Gets the nodes associated with the xPath expression. - * @param xPath The xPath expression + * Gets the nodes associated with the XPath expression. + * + * @remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + * + * @param xPath The XPath expression that specifies the nodes to get. Required. * @param options Syntax example: {asyncContext:context} * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. @@ -846,13 +1051,25 @@ declare namespace Office { getNodesAsync(xPath: string, options?: any, callback?: (result: AsyncResult) => void): void; /** * Gets the node value. + * + * @remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + * * @param options Syntax example: {asyncContext:context} * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ getNodeValueAsync(options?: any, callback?: (result: AsyncResult) => void): void; /** - * Asynchronously gets the text of an XML node in a custom XML part. + * Gets the text of an XML node in a custom XML part. + * + * @remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + * * @param options Syntax example: {asyncContext:context} * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. @@ -860,6 +1077,12 @@ declare namespace Office { getTextAsync(options?: any, callback?: (result: AsyncResult) => void): void; /** * Gets the node's XML. + * + * @remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + * * @param options Syntax example: {asyncContext:context} * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. @@ -867,6 +1090,12 @@ declare namespace Office { getXmlAsync(options?: any, callback?: (result: AsyncResult) => void): void; /** * Sets the node value. + * + * @remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + * * @param value The value to be set on the node * @param options Syntax example: {asyncContext:context} * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. @@ -875,6 +1104,12 @@ declare namespace Office { setNodeValueAsync(value: string, options?: any, callback?: (result: AsyncResult) => void): void; /** * Asynchronously sets the text of an XML node in a custom XML part. + * + * @remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + * * @param text Required. The text value of the XML node. * @param options Syntax example: {asyncContext:context} * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. @@ -883,6 +1118,12 @@ declare namespace Office { setTextAsync(text: string, options?: any, callback?: (result: AsyncResult) => void): void; /** * Sets the node XML. + * + * @remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + * * @param xml The XML to be set on the node * @param options Syntax example: {asyncContext:context} * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. @@ -890,54 +1131,130 @@ declare namespace Office { */ setXmlAsync(xml: string, options?: any, callback?: (result: AsyncResult) => void): void; } + /** + * Represents a single CustomXMLPart in a CustomXMLParts collection. + * + * @remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + */ export interface CustomXmlPart { + /** + * True, if the custom XML part is built in; otherwise false. + * + * @remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + */ builtIn: boolean; + /** + * Gets the GUID of the CustomXMLPart. + * + * @remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + */ id: string; + /** + * Gets the set of namespace prefix mappings (CustomXMLPrefixMappings) used against the current CustomXMLPart. + * + * @remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + */ namespaceManager: CustomXmlPrefixMappings; /** * Adds an event handler to the object using the specified event type. - * @param eventType The event type. For CustomXmlPartNode it can be 'nodeDeleted', 'nodeInserted' or 'nodeReplaced' - * @param handler The name of the handler + * + * @remarks + * Hosts: Word + * + * You can add multiple event handlers for the specified eventType as long as the name of each event handler function is unique. + * + * @param eventType Specifies the type of event to add. Required. For a CustomXmlPart object event, the eventType parameter can be specified as Office.EventType.DataNodeDeleted, Office.EventType.DataNodeInserted, Office.EventType.DataNodeReplaced, or the corresponding text values of these enumerations. + * @param handler The event handler function to add, whose only parameter is of type NodeDeletedEventArgs, NodeInsertedEventArgs, or NodeReplaceEventArgs. Required. * @param options Syntax example: {asyncContext:context} * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ - addHandlerAsync(eventType: EventType, handler?: (result: any) => void, options?: any, callback?: (result: AsyncResult) => void): void; + addHandlerAsync(eventType: EventType, handler: (result: any) => void, options?: any, callback?: (result: AsyncResult) => void): void; /** * Deletes the Custom XML Part. + * + * @remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + * * @param options Syntax example: {asyncContext:context} * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ deleteAsync(options?: any, callback?: (result: AsyncResult) => void): void; /** - * Gets the nodes associated with the xPath expression. - * @param xPath The xPath expression + * Asynchronously gets any CustomXmlNodes in this custom XML part which match the specified XPath. + * + * @remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + * + * @param xPath An XPath expression that specifies the nodes you want returned. Required. * @param options Syntax example: {asyncContext:context} * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. - */ + */ getNodesAsync(xPath: string, options?: any, callback?: (result: AsyncResult) => void): void; /** - * Gets the XML for the Custom XML Part. + * Asynchronously gets the XML inside this custom XML part. + * + * @remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + * + * @param options Syntax example: {asyncContext:context} + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + */ + getXmlAsync(options?: any, callback?: (result: AsyncResult) => void): void; + /** + * Removes an event handler for the specified event type. + * + * @remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + * + * @param eventType Specifies the type of event to remove. Required.For a CustomXmlPart object event, the eventType parameter can be specified as Office.EventType.DataNodeDeleted, Office.EventType.DataNodeInserted, Office.EventType.DataNodeReplaced, or the corresponding text values of these enumerations. + * @param handler The event handler function to remove. If not specified, all event handlers for the specified eventType will be removed. * @param options Syntax example: {asyncContext:context} * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ - getXmlAsync(options?: any, callback?: (result: AsyncResult) => void): void; - /** - * Removes an event handler from the object using the specified event type. - * @param eventType The event type. For CustomXmlPartNode it can be 'nodeDeleted', 'nodeInserted' or 'nodeReplaced' - * @param options Syntax example: {handler:eventHandler} - * handler: Indicates a specific handler to be removed, if not specified all handlers are removed - * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. - */ - removeHandlerAsync(eventType: EventType, options?: any, callback?: (result: AsyncResult) => void): void; + removeHandlerAsync(eventType: EventType, handler?: (result: any) => void, options?: any, callback?: (result: AsyncResult) => void): void; } + /** + * Represents a collection of CustomXmlPart objects. + * + * @remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + */ export interface CustomXmlParts { /** * Asynchronously adds a new custom XML part to a file. + * + * @remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + * * @param xml The XML to add to the newly created custom XML part. * @param options Syntax example: {asyncContext:context} * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. @@ -946,7 +1263,13 @@ declare namespace Office { addAsync(xml: string, options?: any, callback?: (result: AsyncResult) => void): void; /** * Asynchronously gets the specified custom XML part by its id. - * @param id The id of the custom XML part. + * + * @remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + * + * @param id The GUID of the custom XML part, including opening and closing braces. * @param options Syntax example: {asyncContext:context} * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. @@ -954,111 +1277,314 @@ declare namespace Office { getByIdAsync(id: string, options?: any, callback?: (result: AsyncResult) => void): void; /** * Asynchronously gets the specified custom XML part(s) by its namespace. - * @param ns The namespace to search. + * + * @remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + * + * @param ns The namespace URI. * @param options Syntax example: {asyncContext:context} * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. - */ + */ getByNamespaceAsync(ns: string, options?: any, callback?: (result: AsyncResult) => void): void; } + /** + * Represents a collection of CustomXmlPart objects. + * + * @remarks + * Hosts: Word + */ export interface CustomXmlPrefixMappings { /** - * Adds a namespace. - * @param prefix The namespace prefix - * @param ns The namespace URI + * Asynchronously adds a prefix to namespace mapping to use when querying an item. + * + * @remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + * + * If no namespace is assigned to the requested prefix, the method returns an empty string (""). + * + * @param prefix Specifies the prefix to add to the prefix mapping list. Required. + * @param ns Specifies the namespace URI to assign to the newly added prefix. Required. * @param options Syntax example: {asyncContext:context} * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ addNamespaceAsync(prefix: string, ns: string, options?: any, callback?: (result: AsyncResult) => void): void; /** - * Gets a namespace with the specified prefix - * @param prefix The namespace prefix + * Asynchronously gets the namespace mapped to the specified prefix. + * + * @remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + * + * If the prefix already exists in the namespace manager, this method will overwrite the mapping of that prefix except when the prefix is one added or used by the data store internally, in which case it will return an error. + * + * @param prefix TSpecifies the prefix to get the namespace for. Required. * @param options Syntax example: {asyncContext:context} * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ getNamespaceAsync(prefix: string, options?: any, callback?: (result: AsyncResult) => void): void; /** - * Gets a prefix for the specified URI - * @param ns The namespace URI + * Asynchronously gets the prefix for the specified namespace. + * + * @remarks + * Hosts: Word + * + * Available in Requirement set: CustomXmlParts + * + * If no prefix is assigned to the requested namespace, the method returns an empty string (""). If there are multiple prefixes specified in the namespace manager, the method returns the first prefix that matches the supplied namespace. + * + * @param ns Specifies the namespace to get the prefix for. Required. * @param options Syntax example: {asyncContext:context} * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. - */ + */ getPrefixAsync(ns: string, options?: any, callback?: (result: AsyncResult) => void): void; } + /** + * An abstract class that represents the document the add-in is interacting with. + * + * @remarks + * Hosts: Access, Excel, PowerPoint, Project, Word + */ export interface Document { + /** + * Gets an object that provides access to the bindings defined in the document. + * + * @remarks + * Hosts: Access, Excel, Word + * + * You don't instantiate the Document object directly in your script. To call members of the Document object to interact with the current document or worksheet, use Office.context.document in your script. + */ bindings: Bindings; + /** + * Gets an object that represents the custom XML parts in the document. + * + * @remarks + * Hosts: Word + */ customXmlParts: CustomXmlParts; + /** + * Gets the mode the document is in. + * + * @remarks + * Hosts: Word + */ mode: DocumentMode; + /** + * Gets an object that represents the saved custom settings of the content or task pane add-in for the current document. + * + * @remarks + * Hosts: Word + */ settings: Settings; + /** + * Gets the URL of the document that the host application currently has open. Returns null if the URL is unavailable. + * + * @remarks + * Hosts: Word + */ url: string; /** - * Adds an event handler for the specified event type. - * @param eventType The event type. For document can be 'DocumentSelectionChanged' - * @param handler The name of the handler - * @param options Syntax example: {asyncContext:context} - * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * Adds an event handler for a Document object event. + * + * @remarks + * Hosts: Excel, PowerPoint, Project, Word + * + * Available in Requirement set: DocumentEvents + * + * You can add multiple event handlers for the specified eventType as long as the name of each event handler function is unique. + * + * @param eventType For a Document object event, the eventType parameter can be specified as Office.EventType.Document.SelectionChanged or Office.EventType.Document.ActiveViewChanged, or the corresponding text value of this enumeration. + * @param handler The event handler function to add, whose only parameter is of type DocumentSelectionChangedEventArgs. Required. + * @param options An object like {asyncContext:context} where `context` is a user-defined item of any type that is returned in the AsyncResult object without being altered. * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ addHandlerAsync(eventType: EventType, handler: any, options?: any, callback?: (result: AsyncResult) => void): void; /** - * Returns the current view of the presentation. - * @param options Syntax example: {asyncContext:context} - * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * Returns the state of the current view of the presentation (edit or read). + * + * @remarks + * Hosts: Excel, PowerPoint, Word + * + * Available in Requirement set: ActiveView + * + * Can trigger an event when the view changes. + * + * @param options An object like {asyncContext:context} where `context` is a user-defined item of any type that is returned in the AsyncResult object without being altered. * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. - */ + */ getActiveViewAsync(options?: any, callback?: (result: AsyncResult) => void): void; /** - * Gets the entire file in slices of up to 4MB. + * Returns the entire document file in slices of up to 4194304 bytes (4 MB). For add-ins for iOS, file slice is supported up to 65536 (64 KB). Note that specifying file slice size of above permitted limit will result in an "Internal Error" failure. + * + * @remarks + * Hosts: Excel, PowerPoint, Word + * + * Available in Requirement set: File + * + * For add-ins running in Office host applications other than Office for iOS, the getFileAsync method supports getting files in slices of up to 4194304 bytes (4 MB). For add-ins running in Office for iOS apps, the getFileAsync method supports getting files in slices of up to 65536 (64 KB). + * + * The fileType parameter can be specified by using the FileType enumeration or text values. But the possible values vary with the host: + * + * Excel Online, Win32, Mac, and iOS: Office.FileType.Compressed + * + * PowerPoint on Windows desktop, Mac, and iPad, and PowerPoint Online: Office.FileType.Compressed, Office.FileType.Pdf + * + * Word on Windows desktop, Word on Mac, and Word Online: Office.FileType.Compressed, Office.FileType.Pdf, Office.FileType.Text + * + * Word on iPad: Office.FileType.Compressed, Office.FileType.Text + * * @param fileType The format in which the file will be returned - * @param options Syntax example: {sliceSize:1024} + * @param options An object like {sliceSize:1024} that has any of the following properties: + * * sliceSize: Specifies the desired slice size (in bytes) up to 4MB. If not specified a default slice size of 4MB will be used. + * + * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ getFileAsync(fileType: FileType, options?: any, callback?: (result: AsyncResult) => void): void; /** * Gets file properties of the current document. - * @param options Syntax example: {asyncContext:context} - * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. - */ + * + * @remarks + * Hosts: Excel, PowerPoint, Word + * + * Available in Requirement set: not in a set + * + * You get the file's URL with the url property ( asyncResult.value.url). + * + * @param options An object like {asyncContext:context} where `context` is a user-defined item of any type that is returned in the AsyncResult object without being altered. + * @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. + */ getFilePropertiesAsync(options?: any, callback?: (result: AsyncResult) => void): void; /** - * Returns the current selection. - * @param coercionType The expected shape of the selection. - * @param options Syntax example: {valueFormat: 'formatted', filterType:'all'} + * Reads the data contained in the current selection in the document. + * + * @remarks + * Hosts: Access, Excel, PowerPoint, Project, Word + * + * Available in Requirement set: Selection + * + * The possible values for the coercionType parameter vary by the host: + * + * Excel, Excel Online, PowerPoint, PowerPoint Online, Word, and Word Online only: Office.CoercionType.Text (string) + * + * Excel, Word, and Word Online only: Office.CoercionType.Matrix (array of arrays) + * + * Access, Excel, Word, and Word Online only: Office.CoercionType.Table (TableData object) + * + * Word only: Office.CoercionType.Html + * + * Word and Word Online only: Office.CoercionType.Ooxml (Office Open XML) + * + * PowerPoint and PowerPoint Online only: Office.CoercionType.SlideRange + * + * @param coercionType The type of data structure to return. + * @param options An object like {valueFormat: 'formatted', filterType:'all'} that has any of the following properties: + * * valueFormat: Get data with or without format. Use Office.ValueFormat or text value. - * filterType: Get the visible or all the data. Useful when filtering data. Use Office.FilterType or text value. + * + * filterType: Get the visible or all the data. Useful when filtering data. Use Office.FilterType or text value. This parameter is ignored in Word documents. + * * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ getSelectedDataAsync(coercionType: CoercionType, options?: any, callback?: (result: AsyncResult) => void): void; /** * Goes to the specified object or location in the document. + * + * @remarks + * Hosts: Excel, PowerPoint, Word + * + * Available in Requirement set: not in a set + * + * PowerPoint doesn't support the goToByIdAsync method in Master Views. + * + * The behavior caused by the selectionMode option varies by host: + * + * In Excel: Office.SelectionMode.Selected selects all content in the binding, or named item. Office.SelectionMode.None for text bindings, selects the cell; for matrix bindings, table bindings, and named items, selects the first data cell (not first cell in header row for tables). + * + * In PowerPoint: Office.SelectionMode.Selected selects the slide title or first textbox on the slide. Office.SelectionMode.None Doesn't select anything. + * + * In Word: Office.SelectionMode.Selected selects all content in the binding. Office.SelectionMode.None for text bindings, moves the cursor to the beginning of the text; for matrix bindings and table bindings, selects the first data cell (not first cell in header row for tables). + * * @param id The identifier of the object or location to go to. * @param goToType The type of the location to go to. - * @param options Syntax example: {selectionMode:Office.SelectionMode.Selected} - * selectionMode: Use Office.SelectionMode or text value. + * @param options An object like {asyncContext:context} with any of the following values: + * + * selectionMode: Specifies whether the location specified by the id parameter is selected (highlighted). Use Office.SelectionMode or text value. See Remarks for more. + * * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. + * * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ goToByIdAsync(id: string | number, goToType: GoToType, options?: any, callback?: (result: AsyncResult) => void): void; /** * Removes an event handler for the specified event type. - * @param eventType The event type. For document can be 'DocumentSelectionChanged' - * @param options Syntax example: {asyncContext:context} + * + * @remarks + * Hosts: Excel, PowerPoint, Project, Word + * + * Available in Requirement set: DocumentEvents + * + * @param eventType The event type. For document can be 'Document.SelectionChanged' or 'Document.ActiveViewChanged'. + * @param options An object like Syntax example: {asyncContext:context} that has any of the following properties: + * * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. - * handler: The name of the handler. If not specified all handlers are removed + * + * handler: The name of the handler. If not specified all handlers are removed. + * * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ removeHandlerAsync(eventType: EventType, options?: any, callback?: (result: AsyncResult) => void): void; /** * Writes the specified data into the current selection. - * @param data The data to be set. Either a string or value, 2d array or TableData object - * @param options Syntax example: {coercionType:Office.CoercionType.Matrix} or {coercionType: 'matrix'} + * + * @remarks + * Hosts: Access, Excel, PowerPoint, Project, Word, Word Online + * + * Available in Requirement set: Selection + * + * The possible CoercionTypes that can be used for the data parameter, or for the coercionType option, vary by host: + * + * Office.CoercionType.Text: Excel, Word, PowerPoint + * + * Office.CoercionType.Matrix: Excel, Word + * + * Office.CoercionType.Table: Access, Excel, Word + * + * Office.CoercionType.Html: Word + * + * Office.CoercionType.Ooxml: Word + * + * Office.CoercionType.Image: Excel, Word, PowerPoint + * + * @param data The data to be set. Either a string or CoercionType value, 2d array or TableData object. + * @param options An object like {coercionType:Office.CoercionType.Matrix} with any of the following properties: + * * coercionType: Explicitly sets the shape of the data object. Use Office.CoercionType or text value. If not supplied is inferred from the data type. + * + * tableOptions: For an inserted table, a list of key-value pairs that specify table formatting options, such as header row, total row, and banded rows + * + * cellFormat: For an inserted table, a list of key-value pairs that specify a range of columns, rows, or cells and the cell formatting to apply to that range + * + * imageLeft: (number) This option is applicable for inserting images. Indicates the insert location in relation to the left side of the slide for PowerPoint, and its relation to the currently selected cell in Excel. This value is ignored for Word. This value is in points. + * + * imageTop: (number) This option is applicable for inserting images. Indicates the insert location in relation to the top of the slide for PowerPoint, and its relation to the currently selected cell in Excel. This value is ignored for Word. This value is in points. + * + * imageWidth: (number) This option is applicable for inserting images. Indicates the image width. If this option is provided without the imageHeight, the image will scale to match the value of the image width. If both image width and image height are provided, the image will be resized accordingly. If neither the image height or width is provided, the default image size and aspect ratio will be used. This value is in points. + * + * imageHeight: (number) This option is applicable for inserting images. Indicates the image height. If this option is provided without the imageWidth, the image will scale to match the value of the image height. If both image width and image height are provided, the image will be resized accordingly. If neither the image height or width is provided, the default image size and aspect ratio will be used. This value is in points. + * * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ @@ -1088,8 +1614,11 @@ declare namespace Office { export interface File { /** * Gets the document file size in bytes. + * * @remarks * Hosts: PowerPoint, Word + * + * Available in Requirement set: File */ size: number; /** @@ -1104,7 +1633,7 @@ declare namespace Office { * No more than two documents are allowed to be in memory; otherwise the Document.getFileAsync operation will fail. Use the File.closeAsync method to close the file when you are finished working with it. * * Hosts: PowerPoint, Word - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. Optional. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. * @remarks * When the function you passed to the callback parameter executes, it receives an AsyncResult object that you can access from the callback function's only parameter. * In the callback function passed to the closeAsync method, you can use the properties of the AsyncResult object to return the following information. @@ -1114,6 +1643,8 @@ declare namespace Office { * |AsyncResult.status|Determine the success or failure of the operation.| * |AsyncResult.error|Access an Error object that provides error information if the operation failed.| * |AsyncResult.asyncContext|A user-defined item of any type that is returned in the AsyncResult object without being altered.| + * + * Available in Requirement set: File */ closeAsync(callback?: (result: AsyncResult) => void): void; /** @@ -1121,7 +1652,7 @@ declare namespace Office { * @remarks * Hosts: PowerPoint, Word * @param sliceIndex Specifies the zero-based index of the slice to be retrieved. Required. - * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. Optional. + * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult * @remarks * When the function you passed to the callback parameter executes, it receives an AsyncResult object that you can access from the callback function's only parameter. * In the callback function passed to the getSliceAsync method, you can use the properties of the AsyncResult object to return the following information. @@ -1131,6 +1662,8 @@ declare namespace Office { * |AsyncResult.status|Determine the success or failure of the operation.| * |AsyncResult.error|Access an Error object that provides error information if the operation failed.| * |AsyncResult.asyncContext|A user-defined item of any type that is returned in the AsyncResult object without being altered.| + * + * Available in Requirement set: File */ getSliceAsync(sliceIndex: number, callback?: (result: AsyncResult) => void): void; } @@ -1143,18 +1676,19 @@ declare namespace Office { /** * Represents a binding in two dimensions of rows and columns. * - * **Hosts**: Excel, Word - * - * **Available in Requirement set**: MatrixBindings - * * @remarks + * Hosts: Excel, Word + * + * Available in Requirement set: MatrixBindings + * * The MatrixBinding object inherits the id property, type property, getDataAsync method, and setDataAsync method from the Binding object. */ export interface MatrixBinding extends Binding { /** * Gets the number of columns in the matrix data structure, as an integer value. * - * **Hosts**: Access, Excel, PowerPoint, Project, Word + * @remarks + * Hosts: Access, Excel, PowerPoint, Project, Word * * Available in Requirement set: MatrixBindings */ @@ -1162,7 +1696,8 @@ declare namespace Office { /** * Gets the number of rows in the matrix data structure, as an integer value. * - * **Hosts**: Access, Excel, PowerPoint, Project, Word + * @remarks + * Hosts: Access, Excel, PowerPoint, Project, Word * * Available in Requirement set: MatrixBindings */ @@ -1179,10 +1714,13 @@ declare namespace Office { * The Settings object is automatically loaded as part of the Document object, and is available by calling the settings property of that object when the add-in is activated. The developer is responsible for calling the saveAsync method after adding or deleting settings to save the settings in the document. * * Hosts: Access, Excel, PowerPoint, Word + * + * Available in Requirement set: Settings */ export interface Settings { /** * Adds an event handler for the settingsChanged event. + * * @remarks * You can add multiple event handlers for the specified eventType as long as the name of each event handler function is unique. * @@ -1190,6 +1728,9 @@ declare namespace Office { * > Your add-in's code can register a handler for the settingsChanged event when the add-in is running with any Excel client, but the event will fire only when the add-in is loaded with a spreadsheet that is opened in Excel Online, and more than one user is editing the spreadsheet (co-authoring). Therefore, effectively the settingsChanged event is supported only in Excel Online in co-authoring scenarios. * * Hosts: Excel + * + * Available in Requirement set: Settings + * * @param eventType Specifies the type of event to add. Required. * @param handler The event handler function to add. Required. * @param options Specifies any of the following optional parameters. @@ -1208,19 +1749,27 @@ declare namespace Office { addHandlerAsync(eventType: EventType, handler: any, options?: any, callback?: (result: AsyncResult) => void): void; /** * Retrieves the specified setting. + * * @remarks * Hosts: Access, Excel, PowerPoint, Word + * + * Available in Requirement set: Settings + * * @param settingName The case-sensitive name of the setting to retrieve. * @returns An object that has property names mapped to JSON serialized values. */ get(name: string): any; /** * Reads all settings persisted in the document and refreshes the content or task pane add-in's copy of those settings held in memory. + * * @remarks * This method is useful in Word and PowerPoint coauthoring scenarios when multiple instances of the same add-in are working against the same document. Because each add-in is working against an in-memory copy of the settings loaded from the document at the time the user opened it, the settings values used by each user can get out of sync. This can happen whenever an instance of the add-in calls the Settings.saveAsync method to persist all of that user's settings to the document. Calling the refreshAsync method from the event handler for the settingsChanged event of the add-in will refresh the settings values for all users. * The refreshAsync method can be called from add-ins created for Excel, but since it doesn't support coauthoring there is no reason to do so. * * Hosts: Access, Excel, PowerPoint, Word + * + * Available in Requirement set: Settings + * * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. * @remarks * When the function you passed to the callback parameter executes, it receives an AsyncResult object that you can access from the callback function's only parameter. @@ -1235,21 +1784,29 @@ declare namespace Office { refreshAsync(callback?: (result: AsyncResult) => void): void; /** * Removes the specified setting. + * * @remarks * null is a valid value for a setting. Therefore, assigning null to the setting will not remove it from the settings property bag. * * > [!IMPORTANT] * > Be aware that the Settings.remove method affects only the in-memory copy of the settings property bag. To persist the removal of the specified setting in the document, at some point after calling the Settings.remove method and before the add-in is closed, you must call the Settings.saveAsync method. * Hosts: Access, Excel, PowerPoint, Word + * + * Available in Requirement set: Settings + * * @param settingName The case-sensitive name of the setting to remove. */ remove(name: string): void; /** * Removes an event handler for the settingsChanged event. + * * @remarks * If the optional handler parameter is omitted when calling the removeHandlerAsync method, all event handlers for the specified eventType will be removed. * * Hosts: Access, Excel, PowerPoint + * + * Available in Requirement set: Settings + * * @param eventType Specifies the type of event to remove. Required. * @param options Specifies any of the following optional parameters. * @param handler Specifies the name of the handler to remove. @@ -1287,6 +1844,7 @@ declare namespace Office { saveAsync(callback?: (result: AsyncResult) => void): void; /** * Sets or creates the specified setting. + * * @remarks * The set method creates a new setting of the specified name if it does not already exist, or sets an existing setting of the specified name in the in-memory copy of the settings property bag. After you call the Settings.saveAsync method, the value is stored in the document as the serialized JSON representation of its data type. A maximum of 2MB is available for the settings of each add-in. * @@ -1294,6 +1852,9 @@ declare namespace Office { * > Be aware that the Settings.set method affects only the in-memory copy of the settings property bag. To make sure that additions or changes to settings will be available to your add-in the next time the document is opened, at some point after calling the Settings.set method and before the add-in is closed, you must call the Settings.saveAsync method to persist settings in the document. * * Hosts: Access, Excel, PowerPoint, Word + * + * Available in Requirement set: Settings + * * @param settingName The case-sensitive name of the setting to set or create. * @param value Specifies the value to be stored. */ @@ -1301,55 +1862,157 @@ declare namespace Office { } /** * Represents a slice of a document file. + * * @remarks * The Slice object is accessed with the File.getSliceAsync method. * * Hosts: PowerPoint, Word + * + * Available in Requirement set: File */ export interface Slice { /** * Gets the raw data of the file slice in Office.FileType.Text ("text") or Office.FileType.Compressed ("compressed") format as specified by the fileType parameter of the call to the Document.getFileAsync method. + * * @remarks * Files in the "compressed" format will return a byte array that can be transformed to a base64-encoded string if required. * * Hosts: PowerPoint, Word + * + * Available in Requirement set: File */ data: any; /** * Gets the zero-based index of the file slice. + * * @remarks * Hosts: PowerPoint, Word + * + * Available in Requirement set: File */ index: number; /** * Gets the size of the slice in bytes. + * * @remarks * Hosts: PowerPoint, Word + * + * Available in Requirement set: File */ size: number; } + /** + * Represents a binding in two dimensions of rows and columns, optionally with headers. + * + * @remarks + * Hosts: Access, Excel, PowerPoint, Project, Word + * + * Available in Requirement set: TableBindings + * + * The TableBinding object inherits the id property, type property, getDataAsync method, and setDataAsync method from the Binding object. + * + * For Excel, note that after you establish a table binding in Excel, each new row a user adds to the table is automatically included in the binding and rowCount increases. + */ export interface TableBinding extends Binding { + /** + * Gets the number of columns in the TableBinding, as an integer value. + * + * @remarks + * Hosts: Access, Excel,Word + * + * Available in Requirement set: TableBindings + */ columnCount: number; + /** + * True, if the table has headers; otherwise false. + * + * @remarks + * Hosts: Access, Excel, PowerPoint, Project, Word + * + * Available in Requirement set: TableBindings + */ hasHeaders: boolean; + /** + * Gets the number of rows in the TableBinding, as an integer value. + * + * @remarks + * Hosts: Access, Excel,Word + * + * Available in Requirement set: TableBindings + * + * When you insert an empty table by selecting a single row in Excel 2013 and Excel Online (using Table on the Insert tab), both Office host applications create a single row of headers followed by a single blank row. However, if your add-in's script creates a binding for this newly inserted table (for example, by using the addFromSelectionAsync method), and then checks the value of the rowCount property, the value returned will differ depending whether the spreadsheet is open in Excel 2013 or Excel Online. + + * - In Excel on the desktop, rowCount will return 0 (the blank row following the headers is not counted). + * + * - In Excel Online, rowCount will return 1 (the blank row following the headers is counted). + * + * You can work around this difference in your script by checking if rowCount == 1, and if so, then checking if the row contains all empty strings. + * + * In content add-ins for Access, for performance reasons the rowCount property always returns -1. + */ rowCount: number; /** - * Adds the specified columns to the table - * @param tableData A TableData object with the headers and rows + * Adds the specified data to the table as additional columns. + * + * @remarks + * Hosts: Excel, Word + * + * Available in Requirement set: TableBindings + * + * To add one or more columns specifying the values of the data and headers, pass a TableData object as the data parameter. To add one or more columns specifying only the data, pass an array of arrays ("matrix") as the data parameter. + * + * The success or failure of an addColumnsAsync operation is atomic. That is, the entire add columns operation must succeed, or it will be completely rolled back (and the AsyncResult.status property returned to the callback will report failure): + * + * - Each row in the array you pass as the data argument must have the same number of rows as the table being updated. If not, the entire operation will fail. + * + * - Each row and cell in the array must successfully add that row or cell to the table in the newly added column(s). If any row or cell fails to be set for any reason, the entire operation will fail. + * + * - If you pass a TableData object as the data argument, the number of header rows must match that of the table being updated. + * + * Additional remark for Excel Online: The total number of cells in the TableData object passed to the data parameter can't exceed 20,000 in a single call to this method. + * + * @param tableData An array of arrays ("matrix") or a TableData object that contains one or more columns of data to add to the table. Required. * @param options Syntax example: {asyncContext:context} * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ addColumnsAsync(tableData: TableData | any[][], options?: any, callback?: (result: AsyncResult) => void): void; /** - * Adds the specified rows to the table - * @param rows A 2D array with the rows to add + * Adds the specified data to the table as additional rows. + * + * @remarks + * Hosts: Access, Excel, Word + * + * Available in Requirement set: TableBindings + * + * To add one or more columns specifying the values of the data and headers, pass a TableData object as the data parameter. To add one or more columns specifying only the data, pass an array of arrays ("matrix") as the data parameter. + * + * The success or failure of an addRowsAsync operation is atomic. That is, the entire add columns operation must succeed, or it will be completely rolled back (and the AsyncResult.status property returned to the callback will report failure): + * + * - Each row in the array you pass as the data argument must have the same number of columns as the table being updated. If not, the entire operation will fail. + * + * - Each column and cell in the array must successfully add that column or cell to the table in the newly added rows(s). If any column or cell fails to be set for any reason, the entire operation will fail. + * + * - If you pass a TableData object as the data argument, the number of header rows must match that of the table being updated. + * + * Additional remark for Excel Online: The total number of cells in the TableData object passed to the data parameter can't exceed 20,000 in a single call to this method. + * + * @param rows An array of arrays ("matrix") or a TableData object that contains one or more rows of data to add to the table. Required. * @param options Syntax example: {asyncContext:context} * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. */ addRowsAsync(rows: TableData | any[][], options?: any, callback?: (result: AsyncResult) => void): void; /** - * Clears the table + * Deletes all non-header rows and their values in the table, shifting appropriately for the host application. + * + * @remarks + * Hosts: Access, Excel, Word + * + * Available in Requirement set: TableBindings + * + * In Excel, if the table has no header row, this method will delete the table itself. + * * @param options Syntax example: {asyncContext:context} * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. @@ -1357,6 +2020,14 @@ declare namespace Office { deleteAllDataValuesAsync(options?: any, callback?: (result: AsyncResult) => void): void; /** * Clears formatting on the bound table. + * + * @remarks + * Hosts: Excel + * + * Available in Requirement set: Not in a set + * + * See [Format tables in add-ins for Excel](https://docs.microsoft.com/en-us/office/dev/add-ins/excel/excel-add-ins-tables#format-a-table) for more information. + * * @param options Syntax example: {asyncContext:context} * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult. @@ -1373,9 +2044,18 @@ declare namespace Office { getFormatsAsync(cellReference?: any, formats?: any[], options?: any, callback?: (result: AsyncResult) => void): void; /** * Sets formatting on specified items and data in the table. + * + * @remarks + * Hosts: Excel + * + * Available in Requirement set: Not in a set + * * @param formatsInfo Array elements are themselves three-element arrays:[target, type, formats] + * * target: The identifier of the item to format. String. + * * type: The kind of item to format. String. + * * formats: An object literal containing a list of property name-value pairs that define the formatting to apply. * @param options Syntax example: {asyncContext:context} * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. @@ -1384,6 +2064,12 @@ declare namespace Office { setFormatsAsync(formatsInfo?: any[], options?: any, callback?: (result: AsyncResult) => void): void; /** * Updates table formatting options on the bound table. + * + * @remarks + * Hosts: Excel + * + * Available in Requirement set: Not in a set + * * @param tableOptions An object literal containing a list of property name-value pairs that define the table options to apply. * @param options Syntax example: {asyncContext:context} * asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered. @@ -1393,8 +2079,11 @@ declare namespace Office { } /** * Represents the data in a table or a TableBinding. + * * @remarks * Hosts: Excel, Word + * + * Available in Requirement set: TableBindings */ export class TableData { constructor(rows: any[][], headers: any[]); @@ -1411,6 +2100,8 @@ declare namespace Office { * - If you overwrite or update an existing table, the existing headers are not altered. * * Hosts: Excel, Word + * + * Available in Requirement set: TableBindings */ headers: any[]; /** @@ -1425,6 +2116,8 @@ declare namespace Office { * - If you overwrite or update an existing table, the existing rows are not altered. * * Hosts: Excel, Word + * + * Available in Requirement set: TableBindings */ rows: any[][]; } @@ -1448,6 +2141,16 @@ declare namespace Office { */ Headers } + /** + * Represents a bound text selection in the document. + * + * @remarks + * Hosts: Access, Excel, PowerPoint, Project, Word + * + * Available in Requirement set: TextBindings + * + * The TextBinding object inherits the id property, type property, getDataAsync method, and setDataAsync method from the Binding object. It does not implement any additional properties or methods of its own. + */ export interface TextBinding extends Binding { } /** * Specifies the project fields that are available as a parameter for the getProjectFieldAsync method. @@ -3880,8 +4583,17 @@ declare namespace Office { phoneNumbers: Array; urls: Array; } + /** + * Represents the runtime environment of the add-in and provides access to key objects of the API. + * + * @remarks + * Hosts: Access, Excel, Outlook, PowerPoint, Project, Word + */ export interface Context { mailbox: Mailbox; + /** + * Gets an object that represents the saved custom settings of the add-in. + */ roamingSettings: RoamingSettings; } export interface CustomProperties { @@ -5114,7 +5826,8 @@ declare namespace Excel { * * Gets the Binding object that represents the binding that raised the SelectionChanged event. * - * **Hosts:** Access, Excel, Word + * @remarks + * Hosts: Access, Excel, Word * * [Api set: ExcelApi 1.2] */ @@ -46473,4 +47186,4 @@ declare namespace Visio { //////////////////////////////////////////////////////////////// //////////////////////// End Visio APIs //////////////////////// -//////////////////////////////////////////////////////////////// \ No newline at end of file +////////////////////////////////////////////////////////////////Contains the host in which the add-in (web application) is running in. Possible values are: Word, Excel, PowerPoint \ No newline at end of file From 842c88286cfa9e56e0464b8a34adb2047cd32b70 Mon Sep 17 00:00:00 2001 From: Paito Anderson Date: Tue, 22 May 2018 14:12:07 -0400 Subject: [PATCH 346/575] Update for react-bootstrap-typeahead 3.1 --- types/react-bootstrap-typeahead/index.d.ts | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/types/react-bootstrap-typeahead/index.d.ts b/types/react-bootstrap-typeahead/index.d.ts index 659b2034fd..005a7633ed 100644 --- a/types/react-bootstrap-typeahead/index.d.ts +++ b/types/react-bootstrap-typeahead/index.d.ts @@ -1,7 +1,8 @@ -// Type definitions for react-bootstrap-typeahead 2.3 +// Type definitions for react-bootstrap-typeahead 3.1 // Project: https://github.com/ericgio/react-bootstrap-typeahead // Definitions by: Guymestef // Rajab Shakirov +// Paito Anderson // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 // TODO: , , , components @@ -75,8 +76,8 @@ export interface TypeaheadProps { /* Specify which option key to use for display or a render function. By default, the selector will use the label key. */ labelKey?: string | ((option: T | string) => string); - /* Maximum height of the dropdown menu, in px. */ - maxHeight?: number; + /* Maximum height of the dropdown menu. */ + maxHeight?: string; /* Maximum number of results to display by default. Mostly done for performance reasons so as not to render too many DOM nodes in the case of large data sets. */ @@ -100,8 +101,8 @@ export interface TypeaheadProps { /* Invoked when the input is focused. Receives an event. */ onFocus?: (e: Event) => any; - /* Invoked when the input value changes. Receives the string value of the input. */ - onInputChange?: (input: string) => any; + /* Invoked when the input value changes. Receives the string value of the input, as well as the original event. */ + onInputChange?: (input: string, e: Event) => any; /* Invoked when a key is pressed. Receives an event. */ onKeyDown?: (e: Event) => any; @@ -141,9 +142,6 @@ export interface TypeaheadProps { /* Allows selecting the hinted result by pressing enter. */ selectHintOnEnter?: boolean; - - /* Propagate event to parent form. */ - submitFormOnEnter?: boolean; } export const Typeahead: React.ClassicComponentClass>; From 1aec142aa496f285d8125cc720b7580acd54c7dd Mon Sep 17 00:00:00 2001 From: Paito Anderson Date: Tue, 22 May 2018 14:14:16 -0400 Subject: [PATCH 347/575] Added tests --- .../react-bootstrap-typeahead-tests.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/react-bootstrap-typeahead/react-bootstrap-typeahead-tests.tsx b/types/react-bootstrap-typeahead/react-bootstrap-typeahead-tests.tsx index 425bfe313b..10237b1fa0 100644 --- a/types/react-bootstrap-typeahead/react-bootstrap-typeahead-tests.tsx +++ b/types/react-bootstrap-typeahead/react-bootstrap-typeahead-tests.tsx @@ -24,6 +24,8 @@ class BasicExample extends React.Component { labelKey="name" multiple={multiple} options={options} + maxHeight='300px' + onInputChange={(value, e) => {}} placeholder="Choose a state..." /> From 287fd3f4a1c790088178ead61c40038b4de7c3b3 Mon Sep 17 00:00:00 2001 From: Simon Schick Date: Tue, 22 May 2018 12:00:09 -0700 Subject: [PATCH 348/575] fix(inert): augment correct interface (#25922) --- types/inert/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/inert/index.d.ts b/types/inert/index.d.ts index d8c1d90422..3bcbb81a29 100644 --- a/types/inert/index.d.ts +++ b/types/inert/index.d.ts @@ -127,7 +127,7 @@ declare const inert: Plugin; export = inert; declare module 'hapi' { - interface RouteOptions { + interface HandlerDecorations { /** * The file handler * From 5e7310f944e83149b4ab68a3cd966feaf24914a0 Mon Sep 17 00:00:00 2001 From: BryceCicada Date: Tue, 22 May 2018 22:27:36 +0100 Subject: [PATCH 349/575] [pegjs] Added support for parser options --- types/pegjs/index.d.ts | 5 +++-- types/pegjs/pegjs-tests.ts | 7 ++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/types/pegjs/index.d.ts b/types/pegjs/index.d.ts index 722153038b..c5cdb533ec 100644 --- a/types/pegjs/index.d.ts +++ b/types/pegjs/index.d.ts @@ -51,8 +51,9 @@ export type GrammarError = PegjsError; export var GrammarError: any; export interface ParserOptions { - startRule: string; - tracer: any; + startRule?: string; + tracer?: any; + [key: string]: any; } export interface Parser { diff --git a/types/pegjs/pegjs-tests.ts b/types/pegjs/pegjs-tests.ts index 267a64b060..f2a3d543ed 100644 --- a/types/pegjs/pegjs-tests.ts +++ b/types/pegjs/pegjs-tests.ts @@ -26,6 +26,11 @@ import * as pegjs from 'pegjs'; }) } +{ + let parser: pegjs.Parser = pegjs.generate('start = "a" { return options; }'); + let parsed: any = parser.parse("a", {a: 42}); +} + try { let source: string = pegjs.generate("A = 'test'", {output: "source"}); } catch (error) { @@ -44,4 +49,4 @@ try { console.log(e.location.end.line); console.log(e.message); console.log(e.name); -} \ No newline at end of file +} From 9fe70e21141bc51bac33b2d9709ae1582de3c70a Mon Sep 17 00:00:00 2001 From: Alec Zopf Date: Tue, 22 May 2018 17:32:48 -0400 Subject: [PATCH 350/575] adding types and tests for pg-format module --- types/pg-format/index.d.ts | 23 +++++++++++ types/pg-format/pg-format-tests.ts | 64 ++++++++++++++++++++++++++++++ types/pg-format/tsconfig.json | 23 +++++++++++ types/pg-format/tslint.json | 3 ++ 4 files changed, 113 insertions(+) create mode 100644 types/pg-format/index.d.ts create mode 100644 types/pg-format/pg-format-tests.ts create mode 100644 types/pg-format/tsconfig.json create mode 100644 types/pg-format/tslint.json diff --git a/types/pg-format/index.d.ts b/types/pg-format/index.d.ts new file mode 100644 index 0000000000..e1de1f2ba4 --- /dev/null +++ b/types/pg-format/index.d.ts @@ -0,0 +1,23 @@ +// Type definitions for pg-format 1.0 +// Project: https://github.com/datalanche/node-pg-format +// Definitions by: Alec Zopf +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 +/// +export = format; + +declare function format(fmt: string, ...args: any[]): string; + +declare namespace format { + function config(config?: { + pattern: { + ident?: string, + literal?: string, + string?: string + } + }): void; + function ident(val: string | number | boolean | any[] | Date): string; + function literal(val: string | number | boolean | any[] | Date | object | null | undefined): string; + function string(val: string | number | boolean | any[] | Date | object | null | undefined): string; + function withArray(fmt: string, array: any[]): string; +} diff --git a/types/pg-format/pg-format-tests.ts b/types/pg-format/pg-format-tests.ts new file mode 100644 index 0000000000..e6239ef575 --- /dev/null +++ b/types/pg-format/pg-format-tests.ts @@ -0,0 +1,64 @@ +import format = require('pg-format'); + +const testDate = new Date(Date.UTC(2012, 11, 14, 13, 6, 43, 152)); +const testArray = [ 'abc', 1, true, null, testDate ]; +const testIdentArray = [ 'abc', 'AbC', 1, true, testDate ]; +const testObject = { a: 1, b: 2 }; +const testNestedArray = [ [1, 2], [3, 4], [5, 6] ]; + +format.config({ + pattern: { + ident: 'V', + literal: 'C', + string: 't' + } +}); +format.config(); + +format('some %s thing %s', 'long', 'here'); +format('%L', testNestedArray); + +format.withArray('some %s thing %s', [ 'long', 'here' ]); +format.withArray('many %s %s', ['things', testNestedArray]); + +format.string(undefined); +format.string(null); +format.string(true); +format.string(false); +format.string(0); +format.string(15); +format.string(-15); +format.string(45.13); +format.string(-45.13); +format.string('something'); +format.string(testArray); +format.string(testNestedArray); +format.string(testDate); +format.string(testObject); + +format.ident(true); +format.ident(false); +format.ident(0); +format.ident(15); +format.ident(-15); +format.ident(45.13); +format.ident(-45.13); +format.ident('something'); +format.ident(testIdentArray); +format.ident(testNestedArray); +format.ident(testDate); + +format.literal(null); +format.literal(undefined); +format.literal(true); +format.literal(false); +format.literal(0); +format.literal(15); +format.literal(-15); +format.literal(45.13); +format.literal(-45.13); +format.literal('something'); +format.literal(testArray); +format.literal(testNestedArray); +format.literal(testDate); +format.literal(testObject); diff --git a/types/pg-format/tsconfig.json b/types/pg-format/tsconfig.json new file mode 100644 index 0000000000..185d95cd07 --- /dev/null +++ b/types/pg-format/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", + "pg-format-tests.ts" + ] +} diff --git a/types/pg-format/tslint.json b/types/pg-format/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/pg-format/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} From fd5fd9a23bac3e7a6b000c7413df937e8d40be48 Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 22 May 2018 17:31:29 -0500 Subject: [PATCH 351/575] Update index.d.ts Per documentation at [1] array of data might be numbers or Date objects. [1] http://dygraphs.com/data.html#array --- types/dygraphs/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/dygraphs/index.d.ts b/types/dygraphs/index.d.ts index 6e45d5ccd7..4a4a9f0492 100644 --- a/types/dygraphs/index.d.ts +++ b/types/dygraphs/index.d.ts @@ -6,7 +6,7 @@ /// declare namespace dygraphs { - type DataArray = number[][]; + type DataArray = (number|Date)[][]; type Data = string | DataArray | google.visualization.DataTable; From f74c0ea5a182d10087e865583f4652bd3a724391 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Johansen=20Amundrud?= Date: Wed, 23 May 2018 01:47:39 +0200 Subject: [PATCH 352/575] Add optional and null --- .../facebook-instant-games/facebook-instant-games-tests.ts | 2 +- types/facebook-instant-games/index.d.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/types/facebook-instant-games/facebook-instant-games-tests.ts b/types/facebook-instant-games/facebook-instant-games-tests.ts index 949782c41a..6223c3d5e3 100644 --- a/types/facebook-instant-games/facebook-instant-games-tests.ts +++ b/types/facebook-instant-games/facebook-instant-games-tests.ts @@ -1,5 +1,5 @@ const locale: string = FBInstant.getLocale()!; -const platform: string = FBInstant.getPlatform(); +const platform: string = FBInstant.getPlatform()!; const sdkVersion: string = FBInstant.getSDKVersion(); FBInstant.initializeAsync().then(() => {}); FBInstant.setLoadingProgress(10); diff --git a/types/facebook-instant-games/index.d.ts b/types/facebook-instant-games/index.d.ts index 74c93c6c96..2e6da873cd 100644 --- a/types/facebook-instant-games/index.d.ts +++ b/types/facebook-instant-games/index.d.ts @@ -33,7 +33,7 @@ declare namespace FBInstant { /** * The platform on which the game is currently running. The value will always be null until FBInstant.initializeAsync() resolves. */ - function getPlatform(): Platform; + function getPlatform(): Platform | null; /** * The string representation of this SDK version. @@ -458,7 +458,7 @@ declare namespace FBInstant { * @throws PENDING_REQUEST * @throws CLIENT_UNSUPPORTED_OPERATION */ - chooseAsync(options: ContextOptions): Promise; + chooseAsync(options?: ContextOptions): Promise; /** * Attempts to create or switch into a context between a specified player and the current player. The returned promise will reject if the player listed is not a Connected Player of the current @@ -521,7 +521,7 @@ declare namespace FBInstant { * @throws INVALID_OPERATION * @throws RATE_LIMITED */ - setScoreAsync(score: number, extraData: string): Promise; + setScoreAsync(score: number, extraData?: string): Promise; /** * Retrieves the leaderboard's entry for the current player, or null if the player has not set one yet. From 69e739a7ab02312393774f44a63e659507da22dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Johansen=20Amundrud?= Date: Wed, 23 May 2018 01:58:50 +0200 Subject: [PATCH 353/575] Add missing function for testing leaderboard --- .../facebook-instant-games/facebook-instant-games-tests.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/types/facebook-instant-games/facebook-instant-games-tests.ts b/types/facebook-instant-games/facebook-instant-games-tests.ts index 6223c3d5e3..cf93053288 100644 --- a/types/facebook-instant-games/facebook-instant-games-tests.ts +++ b/types/facebook-instant-games/facebook-instant-games-tests.ts @@ -70,6 +70,12 @@ FBInstant.getLeaderboardAsync("name").then((leaderboard: FBInstant.Leaderboard) const score: number = leaderboardEntry.getScore(); const timestamp: number = leaderboardEntry.getTimestamp(); }); + const contextID: string = leaderboard.getContextID()!; + leaderboard.getEntriesAsync(10, 10).then(entries => {}); + leaderboard.getEntryCountAsync().then((entryCount: number) => {}); + const name = leaderboard.getName(); + leaderboard.getPlayerEntryAsync().then(playerEntry => {}); + leaderboard.setScoreAsync(10).then(leaderboardEntry => {}); }); FBInstant.player.canSubscribeBotAsync().then((canSubscribeBot: boolean) => {}); From b78b4d15d4c0de3ac5c5cd51d3d2e866c8c91544 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Johansen=20Amundrud?= Date: Wed, 23 May 2018 02:03:25 +0200 Subject: [PATCH 354/575] Plural spelling --- types/facebook-instant-games/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/facebook-instant-games/index.d.ts b/types/facebook-instant-games/index.d.ts index 2e6da873cd..c0722b11ec 100644 --- a/types/facebook-instant-games/index.d.ts +++ b/types/facebook-instant-games/index.d.ts @@ -174,11 +174,11 @@ declare namespace FBInstant { * * @param eventName Name of the event. Must be 2 to 40 characters, and can only contain '_', '-', ' ', and alphanumeric characters. * @param valueToSum An optional numeric value that FB Analytics can calculate a sum with. - * @param parameter An optional object that can contain up to 25 key-value pairs to be logged with the event. Keys must be 2 to 40 characters, + * @param parameters An optional object that can contain up to 25 key-value pairs to be logged with the event. Keys must be 2 to 40 characters, * and can only contain '_', '-', ' ', and alphanumeric characters. Values must be less than 100 characters in length. * @returns The error if the event failed to log; otherwise returns null. */ - function logEvent(eventName: string, valueToSum?: number, parameter?: { [key: string]: string; }): APIError | null; + function logEvent(eventName: string, valueToSum?: number, parameters?: { [key: string]: string; }): APIError | null; /** * Set a callback to be fired when a pause event is triggered. From f46cd6448bb8ba489848cbd6a3df0eccfcf17592 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Johansen=20Amundrud?= Date: Wed, 23 May 2018 02:20:51 +0200 Subject: [PATCH 355/575] Add type --- types/facebook-instant-games/facebook-instant-games-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/facebook-instant-games/facebook-instant-games-tests.ts b/types/facebook-instant-games/facebook-instant-games-tests.ts index cf93053288..f8fc559360 100644 --- a/types/facebook-instant-games/facebook-instant-games-tests.ts +++ b/types/facebook-instant-games/facebook-instant-games-tests.ts @@ -73,7 +73,7 @@ FBInstant.getLeaderboardAsync("name").then((leaderboard: FBInstant.Leaderboard) const contextID: string = leaderboard.getContextID()!; leaderboard.getEntriesAsync(10, 10).then(entries => {}); leaderboard.getEntryCountAsync().then((entryCount: number) => {}); - const name = leaderboard.getName(); + const name: string = leaderboard.getName(); leaderboard.getPlayerEntryAsync().then(playerEntry => {}); leaderboard.setScoreAsync(10).then(leaderboardEntry => {}); }); From 202a537935e6aba0a26129968475d56ad238d453 Mon Sep 17 00:00:00 2001 From: stuartlo Date: Tue, 22 May 2018 18:23:25 -0700 Subject: [PATCH 356/575] Fix boolean issue --- types/ckeditor/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/ckeditor/index.d.ts b/types/ckeditor/index.d.ts index b6cef62744..44c40f3699 100644 --- a/types/ckeditor/index.d.ts +++ b/types/ckeditor/index.d.ts @@ -221,7 +221,7 @@ declare namespace CKEDITOR { breakParent(parent: element): void; contains(node: node): boolean; copyAttributes(dest: element, skipAttributes: { [key: string]: string }): void; - data(name: string, value?: string | false): string; + data(name: string, value?: string | boolean): string; disableContextMenu(): void; find(selector: string): nodeList; findOne(selector: string): element; @@ -1533,7 +1533,7 @@ declare namespace CKEDITOR { filter(filter: htmlParser.filter): boolean; filterChildren(filter: htmlParser.filter): void; find(criteria: string | ((el: htmlParser.node) => boolean), recursive?: boolean): htmlParser.node[]; - forEach(callback: (node: htmlParser.node) => void | false, type?: number, skipRoot?: boolean): void; + forEach(callback: (node: htmlParser.node) => void | boolean, type?: number, skipRoot?: boolean): void; getFirst(condition: string | { [key: string]: string } | ((node: htmlParser.node) => boolean)): htmlParser.node; getHtml(): string; getOuterHtml(): string; @@ -1591,7 +1591,7 @@ declare namespace CKEDITOR { add(node: htmlParser.node, index?: number): void; filter(filter: htmlParser.filter): void; filterChildren(filter: htmlParser.filter, filterRoot?: boolean): void; - forEach(callback: (node: htmlParser.node,) => void | false, type?: number, skipRoot?: boolean): void; + forEach(callback: (node: htmlParser.node,) => void | boolean, type?: number, skipRoot?: boolean): void; writeChildrenHtml(writer: basicWriter, filter?: htmlParser.filter, filterRoot?: boolean): void; writeHtml(writer: basicWriter, filter?: htmlParser.filter): void; From 7f820b490e27ed3cabb8c013ab56b355e7b99fd8 Mon Sep 17 00:00:00 2001 From: Umar Bolatov Date: Tue, 22 May 2018 22:06:29 -0700 Subject: [PATCH 357/575] Fix #25954 --- types/googlemaps/googlemaps-tests.ts | 20 ++++++++++++++++++++ types/googlemaps/index.d.ts | 19 +++++++++++++++++-- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/types/googlemaps/googlemaps-tests.ts b/types/googlemaps/googlemaps-tests.ts index 973a15d03f..561e53f91a 100644 --- a/types/googlemaps/googlemaps-tests.ts +++ b/types/googlemaps/googlemaps-tests.ts @@ -40,6 +40,26 @@ let map: google.maps.Map = new google.maps.Map( mapOptions ); +/***** Fitting map to bounds *****/ +map.fitBounds({ + north: 10, + east: 10, + west: 10, + south: 10 +}, 50); + +map.fitBounds({ + east: 10, + north: 10, + south: 10, + west: 10 +}, { + bottom: 100, + left: 150, + right: 150, + top: 50 +}); + /***** Data *****/ diff --git a/types/googlemaps/index.d.ts b/types/googlemaps/index.d.ts index 5c4cca2eb3..9430698fe6 100644 --- a/types/googlemaps/index.d.ts +++ b/types/googlemaps/index.d.ts @@ -1,6 +1,14 @@ // Type definitions for Google Maps JavaScript API 3.30 // Project: https://developers.google.com/maps/ -// Definitions by: Folia A/S , Chris Wrench , Kiarash Ghiaseddin , Grant Hutchins , Denis Atyasov , Michael McMullin , Martin Costello , Sven Kreiss +// Definitions by: Folia A/S , +// Chris Wrench , +// Kiarash Ghiaseddin , +// Grant Hutchins , +// Denis Atyasov , +// Michael McMullin , +// Martin Costello , +// Sven Kreiss +// Umar Bolatov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /* @@ -31,7 +39,7 @@ declare namespace google.maps { /***** Map *****/ export class Map extends MVCObject { constructor(mapDiv: Element|null, opts?: MapOptions); - fitBounds(bounds: LatLngBounds|LatLngBoundsLiteral, padding?: number): void; + fitBounds(bounds: LatLngBounds|LatLngBoundsLiteral, padding?: number|Padding): void; getBounds(): LatLngBounds|null|undefined; getCenter(): LatLng; getDiv(): Element; @@ -58,6 +66,13 @@ declare namespace google.maps { setClickableIcons(clickable: boolean): void; } + export interface Padding { + bottom: number; + left: number; + right: number; + top: number; + } + export interface MapOptions { /** * Color used for the background of the Map div. This color will be visible when From 516d4bb607c925d0983048525083051e156c2c25 Mon Sep 17 00:00:00 2001 From: nofree Date: Wed, 23 May 2018 13:29:32 +0800 Subject: [PATCH 358/575] Fix FontLoader/Font json type declare --- types/three/three-core.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/three/three-core.d.ts b/types/three/three-core.d.ts index a7f7950a48..1d6831805a 100644 --- a/types/three/three-core.d.ts +++ b/types/three/three-core.d.ts @@ -1911,7 +1911,7 @@ export class Layers { } export class Font { - constructor(jsondata: string); + constructor(jsondata: any); data: string; @@ -2214,7 +2214,7 @@ export class FontLoader { manager: LoadingManager; load(url: string, onLoad?: (responseFont: Font) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void; - parse(json: string): Font; + parse(json: any): Font; } /** From bb5c9b6271338b89b4030942df1c36032963bb32 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 23 May 2018 09:56:05 +0200 Subject: [PATCH 359/575] sharepoint: removed useless PageCOntextInfoInstance --- types/sharepoint/index.d.ts | 46 ++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/types/sharepoint/index.d.ts b/types/sharepoint/index.d.ts index 5340aa5983..7238e6c2b8 100644 --- a/types/sharepoint/index.d.ts +++ b/types/sharepoint/index.d.ts @@ -108,31 +108,29 @@ declare namespace SP { class PageContextInfo { constructor(); - get_siteServerRelativeUrl(): string; - get_webServerRelativeUrl(): string; - get_webAbsoluteUrl(): string; - get_serverRequestPath(): string; - get_siteAbsoluteUrl(): string; - get_webTitle(): string; - get_tenantAppVersion(): string; - get_isAppWeb(): boolean; - get_webLogoUrl(): string; - get_webLanguage(): number; - get_currentLanguage(): number; - get_pageItemId(): number; - get_pageListId(): string; - get_webPermMasks(): { High: number; Low: number; }; - get_currentCultureName(): string; - get_currentUICultureName(): string; - get_clientServerTimeDelta(): number; - get_userLoginName(): string; - get_webTemplate(): string; + static get_clientServerTimeDelta(): number; + static get_siteServerRelativeUrl(): string; + static get_webServerRelativeUrl(): string; + static get_webAbsoluteUrl(): string; + static get_serverRequestPath(): string; + static get_siteAbsoluteUrl(): string; + static get_webTitle(): string; + static get_tenantAppVersion(): string; + static get_isAppWeb(): boolean; + static get_webLogoUrl(): string; + static get_webLanguage(): number; + static get_currentLanguage(): number; + static get_pageItemId(): number; + static get_pageListId(): string; + static get_webPermMasks(): { High: number; Low: number; }; + static get_currentCultureName(): string; + static get_currentUICultureName(): string; + static get_clientServerTimeDelta(): number; + static get_userLoginName(): string; + static get_webTemplate(): string; + static get_pagePersonalizationScope(): string; + static get_webPermMasks(): SP.ContextPermissions; } - - interface PageContextInfoInstance { - get_pagePersonalizationScope(): string; - } - class ContextPermissions { has(perm: number): boolean; hasPermissions(high: number, low: number): boolean; From 81089459ca8d9791e469fe0e51fbb75c70ce28b0 Mon Sep 17 00:00:00 2001 From: "Amir.Tugi@Gmail.com" Date: Wed, 23 May 2018 10:59:20 +0300 Subject: [PATCH 360/575] CR Fix --- types/express-paginate/express-paginate-tests.ts | 2 +- types/express-paginate/index.d.ts | 2 +- types/express-paginate/tsconfig.json | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/types/express-paginate/express-paginate-tests.ts b/types/express-paginate/express-paginate-tests.ts index 20f1a0a558..ddd87ce441 100644 --- a/types/express-paginate/express-paginate-tests.ts +++ b/types/express-paginate/express-paginate-tests.ts @@ -1,4 +1,4 @@ -import * as express from 'express'; +import express from 'express'; import * as paginate from 'express-paginate'; declare function findAndCountAll(params: object): Promise<{count: number, rows: object[]}>; diff --git a/types/express-paginate/index.d.ts b/types/express-paginate/index.d.ts index b816d11b1b..638ae944ad 100644 --- a/types/express-paginate/index.d.ts +++ b/types/express-paginate/index.d.ts @@ -4,7 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.7 -import * as express from 'express'; +import express = require("express"); declare global { namespace Express { diff --git a/types/express-paginate/tsconfig.json b/types/express-paginate/tsconfig.json index 9370f2106b..d524beee7a 100644 --- a/types/express-paginate/tsconfig.json +++ b/types/express-paginate/tsconfig.json @@ -8,6 +8,7 @@ "noImplicitThis": true, "strictNullChecks": true, "strictFunctionTypes": true, + "esModuleInterop": true, "baseUrl": "../", "typeRoots": [ "../" From 038389633599b2235e7a510e30829dbcb47e0253 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 23 May 2018 10:02:07 +0200 Subject: [PATCH 361/575] removing duplicated method --- types/sharepoint/index.d.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/types/sharepoint/index.d.ts b/types/sharepoint/index.d.ts index 7238e6c2b8..b05d498648 100644 --- a/types/sharepoint/index.d.ts +++ b/types/sharepoint/index.d.ts @@ -108,7 +108,6 @@ declare namespace SP { class PageContextInfo { constructor(); - static get_clientServerTimeDelta(): number; static get_siteServerRelativeUrl(): string; static get_webServerRelativeUrl(): string; static get_webAbsoluteUrl(): string; @@ -129,7 +128,6 @@ declare namespace SP { static get_userLoginName(): string; static get_webTemplate(): string; static get_pagePersonalizationScope(): string; - static get_webPermMasks(): SP.ContextPermissions; } class ContextPermissions { has(perm: number): boolean; From 66150a31df378ded046a6d9c94efbd7b93e521e9 Mon Sep 17 00:00:00 2001 From: Denis Artyuhovich Date: Tue, 22 May 2018 18:17:21 +0300 Subject: [PATCH 362/575] Add defenition for allure-js-commons --- .../allure-js-commons-tests.ts | 24 ++++ types/allure-js-commons/index.d.ts | 109 ++++++++++++++++++ types/allure-js-commons/tsconfig.json | 23 ++++ types/allure-js-commons/tslint.json | 1 + 4 files changed, 157 insertions(+) create mode 100644 types/allure-js-commons/allure-js-commons-tests.ts create mode 100644 types/allure-js-commons/index.d.ts create mode 100644 types/allure-js-commons/tsconfig.json create mode 100644 types/allure-js-commons/tslint.json diff --git a/types/allure-js-commons/allure-js-commons-tests.ts b/types/allure-js-commons/allure-js-commons-tests.ts new file mode 100644 index 0000000000..9d4dd653da --- /dev/null +++ b/types/allure-js-commons/allure-js-commons-tests.ts @@ -0,0 +1,24 @@ +import * as Allure from "allure-js-commons"; + +const shouldMakeError = new Allure("test"); // $ExpectError +const allure = new Allure(); + +allure.startSuite("suite"); +allure.startCase("case"); +allure.startCase("case", 123456789); + +allure.endCase("passed"); +allure.endCase("pending"); +allure.endCase("skipped"); +allure.endCase("failed"); +allure.endCase("broken", 1232131232); +allure.endCase("error"); // $ExpectError + +allure.startStep("error"); +allure.endStep("error"); // $ExpectError + +allure.setDescription("description"); +allure.addAttachment("image", {}, "image/jpeg"); +allure.pendingCase("pending"); + +allure.endSuite(); diff --git a/types/allure-js-commons/index.d.ts b/types/allure-js-commons/index.d.ts new file mode 100644 index 0000000000..6331423d1e --- /dev/null +++ b/types/allure-js-commons/index.d.ts @@ -0,0 +1,109 @@ +// Type definitions for allure-js-commons 0.0 +// Project: https://github.com/allure-framework/allure-js-commons +// Definitions by: Denis Artyuhovich +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.4 + +declare class Allure { + constructor(); + + setOptions(options: Allure.Options): void; + + getCurrentSuite(): Allure.Suite; + + getCurrentTest(): Allure.Test; + + startSuite(suiteName: string, timestamp?: number): void; + + endSuite(timestamp?: number): void; + + startCase(testName: string, timestamp?: number): void; + + endCase(status: Allure.Status, err?: {}, timestamp?: number): void; + + startStep(stepName: string, timestamp?: number): void; + + endStep(status: Allure.Status, timestamp?: number): void; + + setDescription(description: string, timestamp?: number): void; + + addAttachment(attachmentName: string, buffer: any, type: string): void; + + pendingCase(testName: string, timestamp?: number): void; +} + +export = Allure; +export as namespace Allure; +declare namespace Allure { + interface Options { + targetDir: string; + } + + type Status = "passed" | "pending" | "skipped" | "failed" | "broken"; + + enum TYPE { + TEXT = "text", + HTML = "html", + MARKDOWN = "markdown" + } + + class Suite { + constructor(name: string, timestamp?: number); + + end(timestamp?: number): void; + + hasTests(): boolean; + + addTest(test: Test): boolean; + + toXML(): string; + } + + class Test { + constructor(name: string, timestamp?: number); + + setDescription(description: string, type: TYPE): void; + + addLabel(name: string, value: string): void; + + addParameter(kind: any, name: string, value: string): void; + + addStep(step: Step): void; + + addAttachment(attachment: Attachment): void; + + end(status: Status, error: Error, timestamp?: number): void; + + toXML(): string; + } + + class Description { + constructor(value: string, type: TYPE); + + toXML(): string; + } + + class Step { + constructor(name: string, timestamp?: number); + + addStep(step: Step): void; + + addAttachment(attachment: Attachment): void; + + end(status: Status, error: Error, timestamp?: number): void; + + toXML(): string; + } + + class Attachment { + constructor(title: string, source: any, size: number, mime: string); + + addStep(step: Step): void; + + addAttachment(attachment: Attachment): void; + + end(status: Status, error: Error, timestamp?: number): void; + + toXML(): string; + } +} diff --git a/types/allure-js-commons/tsconfig.json b/types/allure-js-commons/tsconfig.json new file mode 100644 index 0000000000..9355cb2e42 --- /dev/null +++ b/types/allure-js-commons/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", + "allure-js-commons-tests.ts" + ] +} diff --git a/types/allure-js-commons/tslint.json b/types/allure-js-commons/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/allure-js-commons/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 88e4b902be876ca37f0c5090ec745659501adcb8 Mon Sep 17 00:00:00 2001 From: liul85 Date: Wed, 23 May 2018 16:14:39 +0800 Subject: [PATCH 363/575] add basic type declaration for solr-client --- types/solr-client/index.d.ts | 165 +++++++++++++++++++++++++ types/solr-client/solr-client-tests.ts | 21 ++++ types/solr-client/tsconfig.json | 23 ++++ types/solr-client/tslint.json | 1 + 4 files changed, 210 insertions(+) create mode 100644 types/solr-client/index.d.ts create mode 100644 types/solr-client/solr-client-tests.ts create mode 100644 types/solr-client/tsconfig.json create mode 100644 types/solr-client/tslint.json diff --git a/types/solr-client/index.d.ts b/types/solr-client/index.d.ts new file mode 100644 index 0000000000..f2f15f48c2 --- /dev/null +++ b/types/solr-client/index.d.ts @@ -0,0 +1,165 @@ +// Type definitions for solr-client 0.7 +// Project: https://github.com/lbdremy/solr-node-client#readme +// Definitions by: liul85 +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +/// +import { ClientRequest } from "http"; + +export function createClient(options?: Options): Client; +export function createQuery(options?: {solrVersion: string}): Query; + +export interface Options { + host?: string; + port?: number; + core?: string; + path?: string; + agent?: string; + secure?: string; + bigint?: string; + solrVersion?: string; +} + +export interface RangeFilterOption { + field: string; + start: string | number | Date; + end: string | number | Date; +} + +export interface GroupOptions { + on?: boolean; + field?: string | string[]; + limit?: number; + offset?: number; + sort?: string; + format?: string; + main?: boolean; + ngroups?: boolean; + truncate?: boolean; + cache?: number; +} + +export interface FacetOptions { + on: boolean; + query?: string; + field?: string | string[]; + prefix: string; + sort?: string; + limit?: number; + offset?: number; + mincout?: number; + missing?: boolean; + method?: string; + pivot?: string | string[]; +} + +export interface MoreLikeThisOptions { + on: boolean; + fl?: string | string[]; + count?: number; + mintf?: number; + mindf?: number; + minwl?: number; + maxwl?: number; + maxqt?: number; + maxntp?: number; + boost?: boolean; + qf?: string | object; +} + +export interface HighlightOptions { + on: boolean; + q?: string | string[]; + qparser?: string; + fl?: string | string[]; + snippets?: number; + fragsize?: number; + mergeContiguous?: boolean; + maxAnalyzedChars?: number; + maxMultiValuedToExamine?: number; + maxMultiValuedToMatch?: number; + alternateField?: string; + maxAlternateFieldLength?: number; + formatter?: string; + simplePre?: string; + simplePost?: string; + fragmenter?: string; + highlightMultiTerm?: boolean; + requireFieldMatch?: boolean; + usePhraseHighlighter?: boolean; + regexSlop?: number; + regexPattern?: string; + regexMaxAnalyzedChars?: number; + preserveMulti?: boolean; + payloads?: boolean; +} + +export interface AddRemoteResourceOptions { + path: string; + format: string; + contentType: string; + parameters: object; +} + +export interface Query { + set(parameters: string): Query; + defType(type: string): Query; + requestHandler(handler: string): Query; + q(q: string | object): Query; + qop(op: string): Query; + df(df: string): Query; + start(start: number): Query; + rows(rows: number): Query; + cursorMark(mark: string): Query; + sort(options: object): Query; + rangeFilter(options: RangeFilterOption[]): Query; + matchFilter(field: string, value: string | number | Date): Query; + fl(fields: string | string[]): Query; + timeout(time: string | number): Query; + groupBy(field: string): Query; + group(options: GroupOptions): Query; + facet(options: FacetOptions): Query; + mlt(options: MoreLikeThisOptions): Query; + dismax(): Query; + edismax(): Query; + debugQuery(): Query; + qf(options: object): Query; + mm(minimum: string | number): Query; + pf(options: object): Query; + ps(slop: number): Query; + qs(slop: number): Query; + tie(tiebreaker: number): Query; + bq(options: object): Query; + bf(functions: string): Query; + boost(functions: string): Query; + build(): string; + hl(options: HighlightOptions): Query; +} + +export interface Client { + basicAuth(username: string, password: string): Client; + unauth(): Client; + add(docs: object[], options?: Options, callback?: (err: Error, data: object) => void): ClientRequest; + realTimeGet(ids: string | string[], query?: Query, callback?: (err: Error, data: object) => void): ClientRequest; + addRemoteResource(options: AddRemoteResourceOptions, callback?: (err: Error, data: object) => void): ClientRequest; + commit(options?: Options, callback?: (err: Error, data: object) => void): ClientRequest; + prepareCommit(callback?: (err: Error, data: object) => void): ClientRequest; + softCommit(callback?: (err: Error, data: object) => void): ClientRequest; + delete(field: string, text: string, options?: Options, callback?: (err: Error, data: object) => void): ClientRequest; + deleteByRange(field: string, start: string | Date, stop: string | Date, options?: object, callback?: (err: Error, data: object) => void): ClientRequest; + deleteById(id: string | number, options?: Options, callback?: (err: Error, data: object) => void): ClientRequest; + deleteByQuery(query: string, options?: Options, callback?: (err: Error, data: object) => void): ClientRequest; + deleteAll(options?: Options, callback?: (err: Error, data: object) => void): ClientRequest; + optimize(options: object, callback?: (err: Error, data: object) => void): ClientRequest; + rollback(callback?: (err: Error, data: object) => void): ClientRequest; + update(data: object, options?: object, callback?: (err: Error, data: object) => void): ClientRequest; + search(query: Query, callback?: (err: Error, data: object) => void): ClientRequest; + executeCollection(collection: Query | object | string, callback?: (err: Error, data: object) => void): ClientRequest; + searchAll(callback?: (err: Error, data: object) => void): ClientRequest; + get(handler: string, query: Query | object | string, callback?: (err: Error, data: object) => void): ClientRequest; + post(handler: string, query: Query | object | string, callback?: (err: Error, data: object) => void): ClientRequest; + escapeSpecialChars(s: string): string; +} + +export as namespace Solr; diff --git a/types/solr-client/solr-client-tests.ts b/types/solr-client/solr-client-tests.ts new file mode 100644 index 0000000000..d9acb225c3 --- /dev/null +++ b/types/solr-client/solr-client-tests.ts @@ -0,0 +1,21 @@ +import { createQuery, createClient } from "solr-client"; + +const query = createQuery(); +const client = createClient(); + +query; // $ExpectType Query +client; // $ExpectType Client + +query.q({id: "1"}); // $ExpectType Query + +client.search(query); // $ExpectType ClientRequest + +(() => { + client.search(query, (err, data) => { + if (err) { + console.log(err); + } else { + console.log(data); + } + }); +}); diff --git a/types/solr-client/tsconfig.json b/types/solr-client/tsconfig.json new file mode 100644 index 0000000000..50d5352cd3 --- /dev/null +++ b/types/solr-client/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", + "solr-client-tests.ts" + ] +} diff --git a/types/solr-client/tslint.json b/types/solr-client/tslint.json new file mode 100644 index 0000000000..d04fe2e1fa --- /dev/null +++ b/types/solr-client/tslint.json @@ -0,0 +1 @@ +{"extends": "dtslint/dt.json"} \ No newline at end of file From 605969f059069a091a541d0fcb54fc3bacea7ce1 Mon Sep 17 00:00:00 2001 From: liul85 Date: Wed, 23 May 2018 17:44:34 +0800 Subject: [PATCH 364/575] fix incorrect implementation of creating solr query --- types/solr-client/index.d.ts | 2 +- types/solr-client/solr-client-tests.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/types/solr-client/index.d.ts b/types/solr-client/index.d.ts index f2f15f48c2..74e8e2ba94 100644 --- a/types/solr-client/index.d.ts +++ b/types/solr-client/index.d.ts @@ -8,7 +8,6 @@ import { ClientRequest } from "http"; export function createClient(options?: Options): Client; -export function createQuery(options?: {solrVersion: string}): Query; export interface Options { host?: string; @@ -160,6 +159,7 @@ export interface Client { get(handler: string, query: Query | object | string, callback?: (err: Error, data: object) => void): ClientRequest; post(handler: string, query: Query | object | string, callback?: (err: Error, data: object) => void): ClientRequest; escapeSpecialChars(s: string): string; + query(): Query; } export as namespace Solr; diff --git a/types/solr-client/solr-client-tests.ts b/types/solr-client/solr-client-tests.ts index d9acb225c3..99f4700fb5 100644 --- a/types/solr-client/solr-client-tests.ts +++ b/types/solr-client/solr-client-tests.ts @@ -1,7 +1,7 @@ -import { createQuery, createClient } from "solr-client"; +import { createClient } from "solr-client"; -const query = createQuery(); const client = createClient(); +const query = client.query(); query; // $ExpectType Query client; // $ExpectType Client From 8157193c263947c9bdb7f012639df511cea289ce Mon Sep 17 00:00:00 2001 From: Holger Jeromin Date: Wed, 23 May 2018 15:58:57 +0200 Subject: [PATCH 365/575] fixing file.expand typing --- types/grunt/grunt-tests.ts | 12 +++++++++--- types/grunt/index.d.ts | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/types/grunt/grunt-tests.ts b/types/grunt/grunt-tests.ts index 5dd6550582..94eb12a46f 100644 --- a/types/grunt/grunt-tests.ts +++ b/types/grunt/grunt-tests.ts @@ -1,6 +1,6 @@ -// Official code sample from +// Official code sample from // http://gruntjs.com/getting-started#an-example-gruntfile interface MyTaskData { @@ -12,7 +12,7 @@ interface MyOptions { repeat: number; } -// exports should work same as module.exports +// exports should work same as module.exports exports = (grunt: IGrunt) => { // Project configuration. @@ -126,4 +126,10 @@ exports.exports = function(grunt: IGrunt) { }); }); -}; \ No newline at end of file +}; + + +let myTest = function (grunt: IGrunt) { + grunt.file.expand(['*.ts']); + grunt.file.expand('*.ts'); +} diff --git a/types/grunt/index.d.ts b/types/grunt/index.d.ts index 34e5b7e3cb..5187e5e965 100644 --- a/types/grunt/index.d.ts +++ b/types/grunt/index.d.ts @@ -445,7 +445,7 @@ declare namespace grunt { * File paths are relative to the Gruntfile unless the current working directory is changed with * grunt.file.setBase or the --base command-line option. */ - expand(patterns: string[]): string[]; + expand(patterns: string | string[]): string[]; expand(options: IFilesConfig, patterns: string[]): string[]; /** From 64138e36f3c139a879399b14328eefed999a9c30 Mon Sep 17 00:00:00 2001 From: Dave Lee Date: Wed, 23 May 2018 10:06:21 -0400 Subject: [PATCH 366/575] fix stream support in jszip typings, as the library supports this --- types/jszip/index.d.ts | 3 ++- types/jszip/jszip-tests.ts | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/types/jszip/index.d.ts b/types/jszip/index.d.ts index bca2b6899c..ba3ea392c9 100644 --- a/types/jszip/index.d.ts +++ b/types/jszip/index.d.ts @@ -31,6 +31,7 @@ interface InputByType { uint8array: Uint8Array; arraybuffer: ArrayBuffer; blob: Blob; + stream: NodeJS.ReadableStream; } interface OutputByType { @@ -44,7 +45,7 @@ interface OutputByType { nodebuffer: Buffer; } -type InputFileFormat = InputByType[keyof InputByType] | NodeJS.ReadableStream; +type InputFileFormat = InputByType[keyof InputByType]; declare namespace JSZip { type InputType = keyof InputByType; diff --git a/types/jszip/jszip-tests.ts b/types/jszip/jszip-tests.ts index 5d332a8070..d634767d58 100644 --- a/types/jszip/jszip-tests.ts +++ b/types/jszip/jszip-tests.ts @@ -1,5 +1,7 @@ import JSZip = require('jszip'); +import { Readable } from "stream"; + const SEVERITY = { DEBUG: 0, INFO: 1, @@ -10,9 +12,12 @@ const SEVERITY = { function createTestZip(): JSZip { const zip = new JSZip(); + const stream = new Readable(); + stream.push("test stream"); zip.file("test.txt", "test string"); zip.file("test", null, { dir: true }); zip.file("test/test.txt", "test string"); + zip.file("stream.txt", stream); return zip; } @@ -105,6 +110,14 @@ function testJSZip() { log(SEVERITY.ERROR, "wrong number of files"); } }).catch((e: any) => log(SEVERITY.ERROR, e)); + + newJszip.file("stream.txt").async('text').then((text: string) => { + if (text === "test string") { + log(SEVERITY.INFO, "all ok"); + } else { + log(SEVERITY.ERROR, "no matching file found"); + } + }).catch((e: any) => log(SEVERITY.ERROR, e)); }).catch((e: any) => { console.error(e); }); } From 8c4b85f862cdb722f13caa1de06299244d29e5ac Mon Sep 17 00:00:00 2001 From: Dave Date: Wed, 23 May 2018 10:28:51 -0400 Subject: [PATCH 367/575] Update jszip-tests.ts --- types/jszip/jszip-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/jszip/jszip-tests.ts b/types/jszip/jszip-tests.ts index d634767d58..2910b5f729 100644 --- a/types/jszip/jszip-tests.ts +++ b/types/jszip/jszip-tests.ts @@ -112,7 +112,7 @@ function testJSZip() { }).catch((e: any) => log(SEVERITY.ERROR, e)); newJszip.file("stream.txt").async('text').then((text: string) => { - if (text === "test string") { + if (text === "test stream") { log(SEVERITY.INFO, "all ok"); } else { log(SEVERITY.ERROR, "no matching file found"); From 5a88056e4c0c62208a813faaf6aacbe0e6438f66 Mon Sep 17 00:00:00 2001 From: Joshua Goldberg Date: Wed, 23 May 2018 16:31:17 +0200 Subject: [PATCH 368/575] Added .headless() to Firefox options --- types/selenium-webdriver/firefox.d.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/types/selenium-webdriver/firefox.d.ts b/types/selenium-webdriver/firefox.d.ts index 0c2ecdbe92..ce8a14216e 100644 --- a/types/selenium-webdriver/firefox.d.ts +++ b/types/selenium-webdriver/firefox.d.ts @@ -149,6 +149,13 @@ export class Profile { * Configuration options for the FirefoxDriver. */ export class Options { + /** + * Sets the browser to be in headless mode. + * + * @return {!Options} A self reference. + */ + headless(): Options; + /** * Sets the profile to use. The profile may be specified as a * {@link Profile} object or as the path to an existing Firefox profile to use From 26fbcf48bfdc702f5b4e3c4018eda5f020b68b76 Mon Sep 17 00:00:00 2001 From: Ika Date: Wed, 23 May 2018 22:44:46 +0800 Subject: [PATCH 369/575] fix(prettier): add missing prop --- types/prettier/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/prettier/index.d.ts b/types/prettier/index.d.ts index dbc358bfc9..7789c957a6 100644 --- a/types/prettier/index.d.ts +++ b/types/prettier/index.d.ts @@ -107,6 +107,7 @@ export interface RequiredOptions extends doc.printer.Options { export interface ParserOptions extends RequiredOptions { locStart: (node: any) => number; locEnd: (node: any) => number; + originalText: string; } export interface Plugin { From 898bf3a95bbb475137274e37bf3a3309f054bd38 Mon Sep 17 00:00:00 2001 From: Eiji Kitamura Date: Wed, 23 May 2018 23:44:06 +0900 Subject: [PATCH 370/575] Adds `BooleanCondition` and `GradientCondition` --- .../google-apps-script.spreadsheet.d.ts | 60 ++++++++++++++++++- 1 file changed, 58 insertions(+), 2 deletions(-) diff --git a/types/google-apps-script/google-apps-script.spreadsheet.d.ts b/types/google-apps-script/google-apps-script.spreadsheet.d.ts index b656032a96..dd2bc1d9f3 100644 --- a/types/google-apps-script/google-apps-script.spreadsheet.d.ts +++ b/types/google-apps-script/google-apps-script.spreadsheet.d.ts @@ -1,7 +1,8 @@ -// Type definitions for Google Apps Script 2018-05-03 +// Type definitions for Google Apps Script 2018-05-23 // Project: https://developers.google.com/apps-script/ // Definitions by: motemen // linlex +// agektmr // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -22,6 +23,25 @@ declare namespace GoogleAppsScript { */ export enum BorderStyle { DOTTED, DASHED, SOLID } + /** + * Access boolean conditions in `ConditionalFormatRules`. Each conditional + * format rule may contain a single boolean condition. The boolean condition + * itself contains a boolean criteria (with values) and formatting settings. + * The criteria is evaluated against the content of a cell resulting in + * either a `true` or `false` value. If the criteria evaluates to `true`, + * the condition's formatting settings are applied to the cell. + */ + export interface BooleanCondition { + getBackground(): string; + getBold(): boolean; + getCriteriaType(): BooleanCriteria; + getCriteriaValue(): Object[]; + getFontColor(): string, + getItalic(): boolean; + getStrikethrough(): boolean; + getUnderline(): boolean; + } + /** * The chart's position within a sheet. Can be updated using the EmbeddedChart.modify() * function. @@ -588,6 +608,42 @@ declare namespace GoogleAppsScript { useAlternatingRowStyle(alternate: boolean): EmbeddedTableChartBuilder; } + /** + * Access gradient (color) conditions in `ConditionalFormatRuleApis`. Each + * conditional format rule may contain a single gradient condition. A + * gradient condition is defined by three points along a number scale (min, + * mid, and max), each of which has a color, a value, and a + * `InterpolationType`. The content of a cell is compared to the values in + * the number scale and the color applied to the cell is interpolated based + * on the cell content's proximity to the gradient condition min, mid, and + * max points. + * + * // Logs all the information inside gradient conditional format rules on * a sheet. + * var sheet = SpreadsheetApp.getActiveSheet(); + * var rules = sheet.getConditionalFormatRules(); + * for (int i = 0; i < rules.length; i++) { + * var gradient = rules[i].getGradientCondition(); + * Logger.log("The conditional format gradient information for rule %d:\n + * MinColor %s, MinType %s, MinValue %s, \n + * MidColor %s, MidType %s, MidValue %s, \n + * MaxColor %s, MaxType %s, MaxValue %s \n", i, + * gradient.getMinColor(), gradient.getMinType(), gradient.getMinValue(), + * gradient.getMidColor(), gradient.getMidType(), gradient.getMidValue(), + * gradient.getMaxColor(), gradient.getMaxType(), gradient.getMaxValue()); + * } + **/ + export interface GradientCondition { + getMaxColor(): string; + getMaxType(): InterpolationType; + getMaxValue(): string; + getMidColor(): string; + getMidType(): InterpolationType; + getMidValue(): string; + getMinColor(): string; + getMinType(): InterpolationType; + getMinValue(): string; + } + /** * Create, access and modify named ranges in a spreadsheet. * Named ranges are ranges that have associated string aliases. @@ -1244,7 +1300,7 @@ declare namespace GoogleAppsScript { /** * Sets the conditional format rule's gradient minpoint fields. */ - setGradientMinpointWithValue(color: string, type: SpreadsheetApp.InterpolationType, value: string): ConditionalFormatRuleBuilder; + setGradientMinpointWithValue(color: string, type: InterpolationType, value: string): ConditionalFormatRuleBuilder; /** * Sets text italics for the conditional format rule's format. From a6cdf1200d91a1f9631662e210dcc7761d5490f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joona=20Heikkil=C3=A4?= Date: Wed, 23 May 2018 18:04:38 +0300 Subject: [PATCH 371/575] Add force close Connection#close variant Connection#close can take a boolean argument `force`. This change goes back all the way to v4.11.14 (f9e0525fa2f7c8e254f3f949cab6273469b3df30). --- types/mongoose/index.d.ts | 3 +++ types/mongoose/mongoose-tests.ts | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/types/mongoose/index.d.ts b/types/mongoose/index.d.ts index a28bfc6d84..310417089f 100644 --- a/types/mongoose/index.d.ts +++ b/types/mongoose/index.d.ts @@ -236,6 +236,9 @@ declare module "mongoose" { /** Closes the connection */ close(callback?: (err: any) => void): Promise; + /** Closes the connection */ + close(force?: boolean, callback?: (err: any) => void): Promise; + /** * Retrieves a collection, creating it if not cached. * Not typically needed by applications. Just talk to your collection through your model. diff --git a/types/mongoose/mongoose-tests.ts b/types/mongoose/mongoose-tests.ts index df4762c488..a43c690572 100644 --- a/types/mongoose/mongoose-tests.ts +++ b/types/mongoose/mongoose-tests.ts @@ -135,7 +135,10 @@ conn1.openUri('mongodb://localhost/test', 'myDb', 27017, { autoIndex: false } }, function (err) {}).open(''); -conn1.close().catch(function (err) {}); +conn1.close().then(function () {}).catch(function (err) {}); +conn1.close(true).then(function () {}).catch(function (err) {}); +conn1.close(function (err) {}); +conn1.close(true, function (err) {}); conn1.collection('name').$format(999); conn1.model('myModel', new mongoose.Schema({}), 'myCol').find(); conn1.models.myModel.findOne().exec(); From 6cca6281c4bc6b482e77ba34a9c11f75baf95f7f Mon Sep 17 00:00:00 2001 From: Olegs Jeremejevs Date: Wed, 23 May 2018 18:36:11 +0300 Subject: [PATCH 372/575] is-svg: Allow Buffer input --- types/is-svg/index.d.ts | 4 +++- types/is-svg/is-svg-tests.ts | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/types/is-svg/index.d.ts b/types/is-svg/index.d.ts index 21e85cd2e2..568810f94b 100644 --- a/types/is-svg/index.d.ts +++ b/types/is-svg/index.d.ts @@ -3,6 +3,8 @@ // Definitions by: BendingBender // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +/// + export = isSvg; -declare function isSvg(input: string): boolean; +declare function isSvg(input: string | Buffer): boolean; diff --git a/types/is-svg/is-svg-tests.ts b/types/is-svg/is-svg-tests.ts index d556a944f9..d9ccb6f3db 100644 --- a/types/is-svg/is-svg-tests.ts +++ b/types/is-svg/is-svg-tests.ts @@ -1,3 +1,7 @@ import isSvg = require('is-svg'); -const result: boolean = isSvg(''); +const dataString = ''; +const dataBuffer = Buffer.from(dataString); + +const resultString: boolean = isSvg(dataString); +const resultBuffer: boolean = isSvg(dataBuffer); From 512616ac65e48a695af085529a5705b02c5b2f38 Mon Sep 17 00:00:00 2001 From: Olegs Jeremejevs Date: Wed, 23 May 2018 18:47:33 +0300 Subject: [PATCH 373/575] is-svg: Allow falsy input --- types/is-svg/index.d.ts | 2 +- types/is-svg/is-svg-tests.ts | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/types/is-svg/index.d.ts b/types/is-svg/index.d.ts index 568810f94b..9e36b57b45 100644 --- a/types/is-svg/index.d.ts +++ b/types/is-svg/index.d.ts @@ -7,4 +7,4 @@ export = isSvg; -declare function isSvg(input: string | Buffer): boolean; +declare function isSvg(input?: string | Buffer | false | null): boolean; diff --git a/types/is-svg/is-svg-tests.ts b/types/is-svg/is-svg-tests.ts index d9ccb6f3db..fe68014630 100644 --- a/types/is-svg/is-svg-tests.ts +++ b/types/is-svg/is-svg-tests.ts @@ -1,7 +1,11 @@ import isSvg = require('is-svg'); -const dataString = ''; -const dataBuffer = Buffer.from(dataString); +const data = ''; +let result = false; -const resultString: boolean = isSvg(dataString); -const resultBuffer: boolean = isSvg(dataBuffer); +result = isSvg(data); +result = isSvg(Buffer.from(data)); +result = isSvg(false); +result = isSvg(null); +result = isSvg(undefined); +result = isSvg(); From 70b686c494aa6bcc8dc2549abeb6dff896864fda Mon Sep 17 00:00:00 2001 From: Steve Hetzel Date: Wed, 23 May 2018 09:49:17 -0600 Subject: [PATCH 374/575] [@types/jsforce] fixes Connection.query signature to accept the options arg as ExecuteOptions type from Query.d.ts. Modifies the Connection.queryMore options type to be ExecuteOptions as well. Fixes the scanAll property on ExecuteOptions to be a boolean rather than number and add the headers property as optional. Adds a test to jsforce-tests.ts for the changes. --- types/jsforce/connection.d.ts | 6 +++--- types/jsforce/jsforce-tests.ts | 8 ++++++++ types/jsforce/query.d.ts | 3 ++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/types/jsforce/connection.d.ts b/types/jsforce/connection.d.ts index 27d79fdd5b..32ed4de267 100644 --- a/types/jsforce/connection.d.ts +++ b/types/jsforce/connection.d.ts @@ -1,6 +1,6 @@ import { EventEmitter } from 'events'; import { DescribeSObjectResult, DescribeGlobalResult } from './describe-result'; -import { Query, QueryResult } from './query'; +import { Query, QueryResult, ExecuteOptions } from './query'; import { Record } from './record'; import { RecordResult } from './record-result'; import { SObject } from './salesforce-object'; @@ -93,8 +93,8 @@ export type ConnectionEvent = "refresh"; export abstract class BaseConnection extends EventEmitter { _baseUrl(): string; request(info: RequestInfo | string, options?: Object, callback?: (err: Error, Object: object) => void): Promise; - query(soql: string, callback?: (err: Error, result: QueryResult) => void): Query>; - queryMore(locator: string, options?: object, callback?: (err: Error, result: QueryResult) => void): Promise>; + query(soql: string, options?: ExecuteOptions, callback?: (err: Error, result: QueryResult) => void): Query>; + queryMore(locator: string, options?: ExecuteOptions, callback?: (err: Error, result: QueryResult) => void): Promise>; create(type: string, records: Record | Array>, options?: Object, callback?: (err: Error, result: RecordResult | RecordResult[]) => void): Promise<(RecordResult | RecordResult[])>; insert(type: string, records: Record | Array>, options?: Object, diff --git a/types/jsforce/jsforce-tests.ts b/types/jsforce/jsforce-tests.ts index 0aa98d62d1..c0be86e92c 100644 --- a/types/jsforce/jsforce-tests.ts +++ b/types/jsforce/jsforce-tests.ts @@ -30,6 +30,14 @@ const requestInfo: sf.RequestInfo = { }; salesforceConnection.request(requestInfo); +const queryOptions: sf.ExecuteOptions = { + autoFetch: true, + maxFetch: 5000, + headers: {}, + scanAll: true +}; +salesforceConnection.query('SELECT Id, Name FROM Account', queryOptions); + // note the following should never compile: // salesforceConnection.sobject("Dummy").select(["lol"]); diff --git a/types/jsforce/query.d.ts b/types/jsforce/query.d.ts index b33af41ede..964037123b 100644 --- a/types/jsforce/query.d.ts +++ b/types/jsforce/query.d.ts @@ -5,7 +5,8 @@ import { RecordResult } from './record-result'; export interface ExecuteOptions { autoFetch?: boolean; maxFetch?: number; - scanAll?: number; + headers?: object; + scanAll?: boolean; } export interface QueryResult { From 4a7b434868f8ad87e539c54266fb15c9e85f4022 Mon Sep 17 00:00:00 2001 From: Olegs Jeremejevs Date: Wed, 23 May 2018 18:54:24 +0300 Subject: [PATCH 375/575] is-svg: Bump to 3.0 --- types/is-svg/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/is-svg/index.d.ts b/types/is-svg/index.d.ts index 9e36b57b45..1fbdc486ad 100644 --- a/types/is-svg/index.d.ts +++ b/types/is-svg/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for is-svg 2.1 +// Type definitions for is-svg 3.0 // Project: https://github.com/sindresorhus/is-svg#readme // Definitions by: BendingBender // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 5f80843518a77463eb23e6b5e9618e0c375f0729 Mon Sep 17 00:00:00 2001 From: Olegs Jeremejevs Date: Wed, 23 May 2018 19:07:28 +0300 Subject: [PATCH 376/575] is-svg: Export namespace --- types/is-svg/index.d.ts | 7 +++++-- types/is-svg/is-svg-tests.ts | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/types/is-svg/index.d.ts b/types/is-svg/index.d.ts index 1fbdc486ad..54ebb84457 100644 --- a/types/is-svg/index.d.ts +++ b/types/is-svg/index.d.ts @@ -5,6 +5,9 @@ /// -export = isSvg; - declare function isSvg(input?: string | Buffer | false | null): boolean; + +// So that `import * as X` is possible +declare namespace isSvg {} + +export = isSvg; diff --git a/types/is-svg/is-svg-tests.ts b/types/is-svg/is-svg-tests.ts index fe68014630..73ba29062c 100644 --- a/types/is-svg/is-svg-tests.ts +++ b/types/is-svg/is-svg-tests.ts @@ -1,4 +1,4 @@ -import isSvg = require('is-svg'); +import * as isSvg from 'is-svg'; const data = ''; let result = false; From 969d99802b7fef695219d5600de872d57c78e12c Mon Sep 17 00:00:00 2001 From: denis Date: Wed, 23 May 2018 18:35:57 +0200 Subject: [PATCH 377/575] d3-timer Activate strictNullChecks --- types/d3-timer/index.d.ts | 4 ++-- types/d3-timer/tsconfig.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/types/d3-timer/index.d.ts b/types/d3-timer/index.d.ts index 08fee97696..34bef32aba 100644 --- a/types/d3-timer/index.d.ts +++ b/types/d3-timer/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// Last module patch version validated against: 1.0.2 +// Last module patch version validated against: 1.0.7 /** * Returns the current time as defined by performance.now if available, and Date.now if not. @@ -44,7 +44,7 @@ export interface Timer { export function timer(callback: (elapsed: number) => void, delay?: number, time?: number): Timer; /** - * Immediately invoke any eligible timer callbacks + * Immediately invoke any eligible timer callbacks. */ export function timerFlush(): void; diff --git a/types/d3-timer/tsconfig.json b/types/d3-timer/tsconfig.json index f3af0c7d8e..91aaaf2092 100644 --- a/types/d3-timer/tsconfig.json +++ b/types/d3-timer/tsconfig.json @@ -7,7 +7,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ From 0dcddbf82ed69b17b12063f886af70e0224ca8f9 Mon Sep 17 00:00:00 2001 From: denis Date: Wed, 23 May 2018 19:06:03 +0200 Subject: [PATCH 378/575] Remove hex inherited from Color in d3-hsv --- types/d3-hsv/d3-hsv-tests.ts | 1 + types/d3-hsv/index.d.ts | 6 ------ 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/types/d3-hsv/d3-hsv-tests.ts b/types/d3-hsv/d3-hsv-tests.ts index 780f584c7c..20cdd4f911 100644 --- a/types/d3-hsv/d3-hsv-tests.ts +++ b/types/d3-hsv/d3-hsv-tests.ts @@ -48,6 +48,7 @@ cHSV = cHSV.darker(); cHSV = cHSV.darker(0.2); displayable = cHSV.displayable(); cString = cHSV.toString(); +cString = cHSV.hex(); console.log('Channels = (h : %d, s: %d, v: %d)', cHSV.h, cHSV.s, cHSV.v); console.log('Opacity = %d', cHSV.opacity); diff --git a/types/d3-hsv/index.d.ts b/types/d3-hsv/index.d.ts index 7452dbcc2b..1728af0874 100644 --- a/types/d3-hsv/index.d.ts +++ b/types/d3-hsv/index.d.ts @@ -68,12 +68,6 @@ export interface HSVColor extends Color { * Returns the RGB equivalent of this color. */ rgb(): RGBColor; - - /** - * Returns a hexadecimal string representing this color. - * If this color is not displayable, a suitable displayable color is returned instead. For example, RGB channel values greater than 255 are clamped to 255. - */ - hex(): string; } export const hsv: HSVColorFactory; From a0e91ea034f573e3007913b78813e3fa1259492a Mon Sep 17 00:00:00 2001 From: Niklas Mollenhauer Date: Wed, 23 May 2018 19:45:20 +0200 Subject: [PATCH 379/575] Remove react-monaco-editor --- notNeededPackages.json | 6 + types/react-monaco-editor/index.d.ts | 78 --------- types/react-monaco-editor/package.json | 6 - .../react-monaco-editor-tests.tsx | 149 ------------------ types/react-monaco-editor/tsconfig.json | 25 --- types/react-monaco-editor/tslint.json | 1 - 6 files changed, 6 insertions(+), 259 deletions(-) delete mode 100644 types/react-monaco-editor/index.d.ts delete mode 100644 types/react-monaco-editor/package.json delete mode 100644 types/react-monaco-editor/react-monaco-editor-tests.tsx delete mode 100644 types/react-monaco-editor/tsconfig.json delete mode 100644 types/react-monaco-editor/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index dd5523d102..4fb2ecedb3 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -1158,6 +1158,12 @@ "sourceRepoURL": "https://github.com/react-ga/react-ga", "asOfVersion": "2.3.0" }, + { + "libraryName": "react-monaco-editor", + "typingsPackageName": "react-monaco-editor", + "sourceRepoURL": "https://github.com/superRaytin/react-monaco-editor", + "asOfVersion": "0.16.0" + }, { "libraryName": "react-native-collapsible", "typingsPackageName": "react-native-collapsible", diff --git a/types/react-monaco-editor/index.d.ts b/types/react-monaco-editor/index.d.ts deleted file mode 100644 index f6245a82f4..0000000000 --- a/types/react-monaco-editor/index.d.ts +++ /dev/null @@ -1,78 +0,0 @@ -// Type definitions for react-monaco-editor 0.10 -// Project: https://github.com/superRaytin/react-monaco-editor -// Definitions by: Joshua Netterfield -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 - -/// - -import * as React from "react"; - -export interface ReactMonacoEditorProps { - /** - * Width of editor. Defaults to 100%. - */ - width?: string | number; - - /** - * Height of editor. Defaults to 500. - */ - height?: string | number; - - /** - * Value of the auto created model in the editor. - * If you specify value property, the component behaves in controlled mode. Otherwise, it behaves in uncontrolled mode. - */ - value?: string; - - /** - * The initial value of the auto created model in the editor. - */ - defaultValue?: string; - - /** - * The initial language of the auto created model in the editor. Defaults to 'javascript'. - */ - language?: string; - - /** - * Theme to be used for rendering. - * The current out-of-the-box available themes are: 'vs' (default), 'vs-dark', 'hc-black'. - * You can create custom themes via `monaco.editor.defineTheme`. - */ - theme?: string; - - /** - * Refer to Monaco interface IEditorOptions. - */ - options?: monaco.editor.IEditorOptions; - - /** - * An event emitted when the editor has been mounted (similar to componentDidMount of React). - */ - editorDidMount?(editor: monaco.editor.ICodeEditor, monacoModule: typeof monaco): void; - - /** - * An event emitted before the editor mounted (similar to componentWillMount of React). - */ - editorWillMount?(monacoModule: typeof monaco): void; - - /** - * An event emitted when the content of the current model has changed. - */ - onChange?(val: string, ev: monaco.editor.IModelContentChangedEvent): void; - - /** - * Optional, allow to config loader url and relative path of module, refer to require.config. - */ - requireConfig?: object; - - /** - * Optional, allow to pass a different context then the global window onto which the monaco instance will be loaded. Useful if you want to load the editor in an iframe. - */ - context?: object; -} - -export default class ReactMonacoEditor extends React.Component { - editor: monaco.editor.ICodeEditor; -} diff --git a/types/react-monaco-editor/package.json b/types/react-monaco-editor/package.json deleted file mode 100644 index c30b05905b..0000000000 --- a/types/react-monaco-editor/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "private": true, - "dependencies": { - "monaco-editor": "^0.10.0" - } -} diff --git a/types/react-monaco-editor/react-monaco-editor-tests.tsx b/types/react-monaco-editor/react-monaco-editor-tests.tsx deleted file mode 100644 index 0c46e4cfd8..0000000000 --- a/types/react-monaco-editor/react-monaco-editor-tests.tsx +++ /dev/null @@ -1,149 +0,0 @@ -// Adapted from https://github.com/superRaytin/react-monaco-editor/blob/master/examples/index.js - -import * as React from 'react'; -import { render } from 'react-dom'; -import MonacoEditor from 'react-monaco-editor'; - -interface CodeEditorState { - code?: string; -} - -// Using with webpack -class CodeEditor extends React.Component { - constructor(props: object) { - super(props); - this.state = { - code: '// type your code... \n', - }; - } - editor: monaco.editor.ICodeEditor; - editorDidMount = (editor: monaco.editor.ICodeEditor) => { - console.log('editorDidMount', editor, editor.getValue(), editor.getModel()); - this.editor = editor; - } - onChange = (newValue: string, e: monaco.editor.IModelContentChangedEvent) => { - console.log('onChange', newValue, e); - this.setState({ - code: newValue, - }); - } - changeEditorValue = () => { - if (this.editor) { - this.editor.setValue('// code changed! \n'); - } - } - changeBySetState = () => { - this.setState({code: '// code changed by setState! \n'}); - } - render() { - const code = this.state.code; - const options = { - selectOnLineNumbers: true, - roundedSelection: false, - readOnly: false, - theme: 'vs', - cursorStyle: 'line', - automaticLayout: false, - }; - return ( -
-
- - -
-
- -
- ); - } -} - -// Using with require.config -class AnotherEditor extends React.Component { - constructor(props: object) { - super(props); - const jsonCode = [ - '{', - ' "$schema": "http://myserver/foo-schema.json"', - "}" - ].join('\n'); - this.state = { - code: jsonCode, - }; - } - editorWillMount = (monacoModule: typeof monaco) => { - monacoModule.languages.json.jsonDefaults.setDiagnosticsOptions({ - schemas: [{ - uri: "http://myserver/foo-schema.json", - schema: { - type: "object", - properties: { - p1: { - enum: [ "v1", "v2"] - }, - p2: { - $ref: "http://myserver/bar-schema.json" - } - } - } - }, { - uri: "http://myserver/bar-schema.json", - schema: { - type: "object", - properties: { - q1: { - enum: [ "x1", "x2"] - } - } - } - }] - }); - } - render() { - const code = this.state.code; - const requireConfig = { - url: 'https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.1/require.min.js', - paths: { - vs: 'https://as.alipayobjects.com/g/cicada/monaco-editor-mirror/0.6.1/min/vs' - } - }; - return ( -
- -
- ); - } -} - -class App extends React.Component { - render() { - return ( -
-

Monaco Editor Sample (controlled mode)

- -
-

Another editor (uncontrolled mode)

- -
- ); - } -} - -render( - , - document.getElementById('root') -); diff --git a/types/react-monaco-editor/tsconfig.json b/types/react-monaco-editor/tsconfig.json deleted file mode 100644 index 8d55416feb..0000000000 --- a/types/react-monaco-editor/tsconfig.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true, - "jsx": "react" - }, - "files": [ - "index.d.ts", - "react-monaco-editor-tests.tsx" - ] -} \ No newline at end of file diff --git a/types/react-monaco-editor/tslint.json b/types/react-monaco-editor/tslint.json deleted file mode 100644 index 3db14f85ea..0000000000 --- a/types/react-monaco-editor/tslint.json +++ /dev/null @@ -1 +0,0 @@ -{ "extends": "dtslint/dt.json" } From 3247e3e62016de225b89089de04eb46420694d98 Mon Sep 17 00:00:00 2001 From: Sooraj Date: Wed, 23 May 2018 13:56:44 -0400 Subject: [PATCH 380/575] Added a new type surface for 3d surface plots @soorajpudiyadath --- types/plotly.js/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/plotly.js/index.d.ts b/types/plotly.js/index.d.ts index ac35dc064b..fbb94d4a5f 100644 --- a/types/plotly.js/index.d.ts +++ b/types/plotly.js/index.d.ts @@ -7,6 +7,7 @@ // Dadstart // Jared Szechy // Drew Diamantoukos +// Sooraj Pudiyadath // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -356,7 +357,7 @@ export type Color = string | Array | Array Date: Mon, 21 May 2018 07:12:36 -0700 Subject: [PATCH 381/575] [@types/react-relay] QueryRendererProps["query"] can be null/undefined --- types/react-relay/index.d.ts | 3 ++- types/react-relay/test/react-relay-tests.tsx | 23 +++++++++++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/types/react-relay/index.d.ts b/types/react-relay/index.d.ts index 35a194b0e7..f87ce26356 100644 --- a/types/react-relay/index.d.ts +++ b/types/react-relay/index.d.ts @@ -4,6 +4,7 @@ // Matt Martin // Eloy Durán // Nicolas Pirotte +// Cameron Knight // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -76,7 +77,7 @@ export const graphql: GraphqlInterface; export interface QueryRendererProps { cacheConfig?: RelayRuntimeTypes.CacheConfig; environment: RelayRuntimeTypes.Environment; - query: RelayRuntimeTypes.GraphQLTaggedNode; + query?: RelayRuntimeTypes.GraphQLTaggedNode | null; render(readyState: ReadyState): React.ReactElement | undefined | null; variables: RelayRuntimeTypes.Variables; rerunParamExperimental?: RelayRuntimeTypes.RerunParam; diff --git a/types/react-relay/test/react-relay-tests.tsx b/types/react-relay/test/react-relay-tests.tsx index cc25f5f368..bf3e2d1475 100644 --- a/types/react-relay/test/react-relay-tests.tsx +++ b/types/react-relay/test/react-relay-tests.tsx @@ -28,16 +28,16 @@ const modernEnvironment = new Environment({ network, store }); // ~~~~~~~~~~~~~~~~~~~~~ // Modern QueryRenderer // ~~~~~~~~~~~~~~~~~~~~~ -const MyQueryRenderer = (props: { name: string }) => ( +const MyQueryRenderer = (props: { name: string, show: boolean }) => ( ( /> ); +const MyEmptyQueryRenderer = () => ( + { + if (error) { + return
{error.message}
; + } else if (props) { + throw new Error('This code path should never be hit'); + } + return
Loading
; + }} + /> +); + // ~~~~~~~~~~~~~~~~~~~~~ // Modern RefetchContainer // ~~~~~~~~~~~~~~~~~~~~~ From 5d1092441c26ca29f63e279829bd6a34f74cd6aa Mon Sep 17 00:00:00 2001 From: Avi Vahl Date: Thu, 24 May 2018 00:14:22 +0300 Subject: [PATCH 382/575] source-map-support: retrieveSourceMap can return null to indicate no source map has been found for source, function should return null see README: https://github.com/evanw/node-source-map-support#options --- types/source-map-support/index.d.ts | 2 +- types/source-map-support/source-map-support-tests.ts | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/types/source-map-support/index.d.ts b/types/source-map-support/index.d.ts index 3898c471a2..f3f289dce6 100644 --- a/types/source-map-support/index.d.ts +++ b/types/source-map-support/index.d.ts @@ -24,7 +24,7 @@ export interface Options { overrideRetrieveFile?: boolean; overrideRetrieveSourceMap?: boolean; retrieveFile?(path: string): string; - retrieveSourceMap?(source: string): UrlAndMap; + retrieveSourceMap?(source: string): UrlAndMap | null; } export interface Position { diff --git a/types/source-map-support/source-map-support-tests.ts b/types/source-map-support/source-map-support-tests.ts index 9a30b6a68f..7b07c2970f 100644 --- a/types/source-map-support/source-map-support-tests.ts +++ b/types/source-map-support/source-map-support-tests.ts @@ -6,11 +6,11 @@ function retrieveFile(path: string): string { return "foo"; } -function retrieveSourceMap(source: string): sms.UrlAndMap { - return { +function retrieveSourceMap(source: string): sms.UrlAndMap | null { + return source ? { url: "http://foo", map: "foo" - }; + } : null; } const options: sms.Options = { @@ -39,5 +39,5 @@ let p: sms.Position = { }; p = sms.mapSourcePosition(p); -let u: sms.UrlAndMap; +let u: sms.UrlAndMap | null; u = retrieveSourceMap("foo"); From 99f61a7bb4ce300faece749207449652c2367871 Mon Sep 17 00:00:00 2001 From: stuartlo Date: Wed, 23 May 2018 15:20:33 -0700 Subject: [PATCH 383/575] Add tests --- types/ckeditor/ckeditor-tests.ts | 824 ++++- types/ckeditor/index.d.ts | 5526 +++++++++++++++--------------- 2 files changed, 3482 insertions(+), 2868 deletions(-) diff --git a/types/ckeditor/ckeditor-tests.ts b/types/ckeditor/ckeditor-tests.ts index 21288c1f93..acc23ae096 100644 --- a/types/ckeditor/ckeditor-tests.ts +++ b/types/ckeditor/ckeditor-tests.ts @@ -35,6 +35,13 @@ function test_CKEDITOR() { CKEDITOR.replaceAll(); CKEDITOR.replaceAll('myClassName'); CKEDITOR.replaceAll((textarea, config) => false); + + var editor: CKEDITOR.editor = CKEDITOR.appendTo('append here', CKEDITOR.config, 'data'); + var editor: CKEDITOR.editor = CKEDITOR.appendTo(document.createElement('div')); + CKEDITOR.error('code'); + CKEDITOR.error('500', { moreData: true }); + CKEDITOR.warn('danger'); + CKEDITOR.warn('303', 12345); } function test_CKEDITOR_events() { @@ -83,6 +90,8 @@ function test_dom_comment() { var nativeNode = document.createComment('Example'); var comment = new CKEDITOR.dom.comment(nativeNode); var comment2 = new CKEDITOR.dom.comment('Example'); + var comment3 = new CKEDITOR.dom.comment('Example', new CKEDITOR.dom.document(document)); + var html: string = comment.getOuterHtml(); } function test_dom_document() { @@ -103,10 +112,16 @@ function test_dom_document() { 'Document contents created by code' + '' ); + var styles: CSSStyleSheet = document.appendStyleText('some styles'); + var element: CKEDITOR.dom.element = document.createElement('div'); + var element2: CKEDITOR.dom.element = document.createElement('div', { styles: { height: '1234' } }); + var element3: CKEDITOR.dom.element = document.createElement('div', { attributes: { id: '1234' } }); + var element4: CKEDITOR.dom.element = document.createElement('div', { attributes: { tabIndex: '1234' }, styles: { width: '1234' } }); } function test_dom_documentFragment() { var type = CKEDITOR.NODE_DOCUMENT_FRAGMENT; + alert(new CKEDITOR.dom.documentFragment(document.body).type === type); } function test_dom_domObject() { @@ -124,6 +139,8 @@ function test_dom_domObject() { var elementB = new CKEDITOR.dom.element(nativeElement).getPrivate().value; var element3 = new CKEDITOR.dom.element('span'); element.setCustomData('hasCustomData', true); + + var domObject = new CKEDITOR.dom.domObject(document.createElement('div')); } function test_dom_element() { @@ -156,6 +173,7 @@ function test_dom_element() { element.appendTo(CKEDITOR.document.getBody()); alert(element.getEditor().name); var first = element.getFirst(); + var first2 = element.getFirst((node: CKEDITOR.dom.node) => node.equals(document.body)); alert(element.getHtml()); alert(element.getId()); alert(element.getName()); @@ -199,6 +217,26 @@ function test_dom_element() { alert(element == CKEDITOR.dom.element.get(element)); var htmlElement = document.getElementById('myElement'); alert(CKEDITOR.dom.element.get(htmlElement).getName()); + + var dtd: CKEDITOR.dtdDefinition = element.getDtd(); + var last: CKEDITOR.dom.node = element.getLast(); + var last2: CKEDITOR.dom.node = element.getLast((node: CKEDITOR.dom.node) => node.equals(document.body)); + if (element.isBlockBoundary({ 'div': 1, 'span': 1 })) { + element.setState(1, 'hex', false); + } + + CKEDITOR.dom.element.clearMarkers({}, element, true); + var element1: CKEDITOR.dom.element = CKEDITOR.dom.element.get('div'); + var element2: CKEDITOR.dom.element = CKEDITOR.dom.element.get(document.createElement('div')); + var element3: CKEDITOR.dom.element = CKEDITOR.dom.element.get(element2); + var markedElement: CKEDITOR.dom.element = CKEDITOR.dom.element.setMarker({}, element, 'key', 0); +} + +function test_dom_elementPath() { + var path: CKEDITOR.dom.elementPath = new CKEDITOR.dom.elementPath(CKEDITOR.dom.element.get('div')); + var path2: CKEDITOR.dom.elementPath = new CKEDITOR.dom.elementPath(CKEDITOR.dom.element.get('div'), CKEDITOR.dom.element.get(document.body)); + + var dir: 'ltr' | 'rtl' = path.direction(); } function test_dom_event() { @@ -226,8 +264,10 @@ function test_dom_event() { function test_dom_iterator() { var range = new CKEDITOR.dom.range(new CKEDITOR.dom.element('div')); var iterator = range.createIterator(); - iterator.getNextParagraph(); - iterator.getNextParagraph(); + var paragrah1: CKEDITOR.dom.element = iterator.getNextParagraph(); + var paragrah2: CKEDITOR.dom.element = iterator.getNextParagraph('div'); + alert(iterator.forceBrBreak === false); + var itRange: CKEDITOR.dom.range = iterator.range; } function test_dom_node() { @@ -255,6 +295,7 @@ function test_dom_node() { function test_dom_nodeList() { var nodeList = CKEDITOR.document.getBody().getChildren(); alert(nodeList.count()); + var nodes: CKEDITOR.dom.node[] = nodeList.toArray(); } function test_dom_range() { @@ -277,10 +318,87 @@ function test_dom_range() { alert(range.startOffset); } +function test_dom_selection() { + var element: CKEDITOR.dom.element = CKEDITOR.dom.element.get('div'); + var selection: CKEDITOR.dom.selection = new CKEDITOR.dom.selection(new CKEDITOR.dom.document(document)); + selection = new CKEDITOR.dom.selection(element); + selection = new CKEDITOR.dom.selection(selection); + + var marks: CKEDITOR.dom.bookmark[] = selection.createBookmarks('serialized'); + var marks2: CKEDITOR.dom.bookmark2[] = selection.createBookmarks2({ normalized: true }); + selection.fake(element); + selection.fake(element, true); + element = selection.getCommonAncestor(); + var domSel: Selection = selection.getNative(); + var ranges: CKEDITOR.dom.range[] = selection.getRanges(); + ranges = selection.getRanges(true); + element = selection.getSelectedElement(); + var text: string = selection.getSelectedText(); + element = selection.getStartElement(); + + var type: number = selection.getType(); + + var isSomething: boolean = selection.isCollapsed(); + isSomething = selection.isHidden(); + isSomething = selection.isInTable(); + isSomething = selection.isInTable(false); + + selection.lock(); + selection.removeAllRanges(); + selection.reset(); + selection.removeAllRanges(); + selection.reset(); + selection.scrollIntoView(); + selection = selection.selectBookmarks(marks); + selection = selection.selectBookmarks(marks2); + selection.selectElement(element); + selection.selectRanges(ranges); + selection.unlock(false); +} + +function test_dom_walker() { + var element: CKEDITOR.dom.element = CKEDITOR.dom.element.get('div'); + var range: CKEDITOR.dom.range = new CKEDITOR.dom.range(element); + + var walker: CKEDITOR.dom.walker = new CKEDITOR.dom.walker(range); + + var isSomething: boolean = walker.checkBackward(); + isSomething = walker.checkForward(); + walker.end(); + + var node: CKEDITOR.dom.node = walker.lastBackward(); + node = walker.lastForward(); + node = walker.next(); + node = walker.previous(); + walker.reset(); + + isSomething = CKEDITOR.dom.walker.blockBoundary({ 'div': 1 })(node); + isSomething = CKEDITOR.dom.walker.bogus()(node); + isSomething = CKEDITOR.dom.walker.bogus(isSomething)(node); + isSomething = CKEDITOR.dom.walker.bookmark()(node); + isSomething = CKEDITOR.dom.walker.bookmark(true)(node); + isSomething = CKEDITOR.dom.walker.bookmark(true, false)(node); + isSomething = CKEDITOR.dom.walker.editable()(node); + isSomething = CKEDITOR.dom.walker.editable(isSomething)(node); + isSomething = CKEDITOR.dom.walker.empty()(node); + isSomething = CKEDITOR.dom.walker.empty(true)(node); + isSomething = CKEDITOR.dom.walker.ignored()(node); + isSomething = CKEDITOR.dom.walker.ignored(true)(node); + isSomething = CKEDITOR.dom.walker.listItemBoundary()(node); + isSomething = CKEDITOR.dom.walker.nodeType(0)(node); + isSomething = CKEDITOR.dom.walker.nodeType(1, true)(node); + isSomething = CKEDITOR.dom.walker.temp()(node); + isSomething = CKEDITOR.dom.walker.temp(isSomething)(node); + isSomething = CKEDITOR.dom.walker.whitespaces()(node); + isSomething = CKEDITOR.dom.walker.whitespaces(isSomething)(node); +} + function test_dom_text() { var nativeNode = document.createTextNode('Example'); var text = new CKEDITOR.dom.text(nativeNode); var text2 = new CKEDITOR.dom.text('Example'); + text.substring(1, 2); + text.substring(1); } function test_dom_window() { @@ -292,6 +410,545 @@ function test_dom_window() { var size = win.getViewPaneSize(); alert(size.width); alert(size.height); + + var frame: CKEDITOR.dom.element = win.getFrame(); + win.focus(); +} + +function test_ajax() { + var req: string = CKEDITOR.ajax.load('https://ckeditor.com/ckeditor-4/'); + req = CKEDITOR.ajax.load('https://ckeditor.com/ckeditor-4/', (data: any) => console.log(data)); + + var xml: CKEDITOR.xml = CKEDITOR.ajax.loadXml('https://ckeditor.com/ckeditor-4/'); + xml = CKEDITOR.ajax.loadXml('https://ckeditor.com/ckeditor-4/', (data: any) => console.log(data)); + + CKEDITOR.ajax.post('https://ckeditor.com/ckeditor-4/', {}); + CKEDITOR.ajax.post('https://ckeditor.com/ckeditor-4/', {}, 'html'); + CKEDITOR.ajax.post('https://ckeditor.com/ckeditor-4/', {}, 'text', (data: any) => console.log(data)); +} + +function test_dataProcessor() { + var processor: CKEDITOR.dataProcessor; + processor.toDataFormat('html', 'fix'); + processor.toHtml('data'); + processor.toHtml('data', 'fix'); +} + +function test_dialog() { + var dialog: CKEDITOR.dialog = new CKEDITOR.dialog(CKEDITOR.instances[0], 'dialog'); + + var element: CKEDITOR.dom.element = CKEDITOR.dom.element.get('div'); + dialog.addFocusable(element); + dialog.addFocusable(element, 13); + dialog.addPage({ some: true, object: false }); + var ret = dialog.click('1234'); + dialog.commitContent(); + dialog.disableButton('some button'); + dialog.enableButton('4321'); + dialog = dialog.foreach(() => console.log('hey')); + + var button: CKEDITOR.ui.dialog.button = dialog.getButton('button1'); + var uiEl: CKEDITOR.ui.dialog.uiElement = dialog.getContentElement('page1', 'element1'); + element = dialog.getElement(); + var str: string = dialog.getName(); + var numb: number = dialog.getPageCount(); + var editor: CKEDITOR.editor = dialog.getParentEditor(); + var obj: { [key: string]: any } = dialog.getPosition(); + element = dialog.getSelectedElement(); + obj = dialog.getSize(); + obj = dialog.getValueOf('page1', 'ele1'); + dialog.hide(); + dialog.hidePage('1234'); + dialog.layout(); + dialog.move(1, 2, true); + dialog = dialog.reset(); + dialog.resize(numb, numb); + dialog.selectPage('1'); + dialog.setState(4); + dialog.setValueOf('page1', 'ele1', false); + dialog.setupContent(); + dialog.show(); + dialog.showPage('1234'); + dialog.updateStyle(); + + CKEDITOR.dialog.add( 'abbrDialog', this.path + 'dialogs/abbr.js' ); + CKEDITOR.dialog.add( 'abbrDialog', function ( editor: CKEDITOR.editor ) { + return { + title: 'Abbreviation Properties', + minWidth: 400, + minHeight: 200, + onLoad: () => {}, + onOk: () => {}, + onCancel: () => {}, + onShow: () => {}, + onHide: () => {}, + contents: [ + { + id: 'tab-basic', + label: 'Basic Settings', + elements: [] + }, + { + id: 'tab-adv', + label: 'Advanced Settings', + elements: [] + } + ] + }; + }); + + CKEDITOR.dialog.addIframe('frame', 'frame', 1234, 4321); + CKEDITOR.dialog.addIframe('frame', 'frame', 1234, 4321, () => console.log('loaded')); + CKEDITOR.dialog.addIframe('frame', 'frame', 1234, 4321, () => console.log('loaded'), obj); + + CKEDITOR.dialog.addUIElement('node', () => console.log('build')); + CKEDITOR.dialog.cancelButton(); + CKEDITOR.dialog.exists('dialog1'); + CKEDITOR.dialog.exists(1234); + dialog = CKEDITOR.dialog.getCurrent(); + + var isEnabled: boolean = CKEDITOR.dialog.isTabEnabled(editor, 'dialog', 'table'); + + CKEDITOR.dialog.okButton(); +} + +function test_editable() { + var element: CKEDITOR.dom.element; + var editor: CKEDITOR.editor; + + var editable: CKEDITOR.editable = new CKEDITOR.editable(editor, element); + editable = new CKEDITOR.editable(editor, document.createElement('div')); + + editable.attachClass('class'); + editable.attachListener(editable, 'event', (evt: CKEDITOR.eventInfo) => console.log('listen')).removeListener(); + editable.attachListener(new CKEDITOR.event(), 'event', (evt: CKEDITOR.eventInfo) => console.log('listen')).removeListener(); + editable.attachListener(new CKEDITOR.event(), 'event', (evt: CKEDITOR.eventInfo) => console.log('listen'), { scope: 'object' }).removeListener(); + editable.attachListener(editable, 'event', (evt: CKEDITOR.eventInfo) => console.log('listen'), { scope: 'object' }, 'data').removeListener(); + editable.attachListener(editable, 'event', (evt: CKEDITOR.eventInfo) => console.log('listen'), { scope: 'object' }, 'data', 1).removeListener(); + + editable.changeAttr('attr', 'val'); + editable.detach(); + + var range: CKEDITOR.dom.range; + editable.insertElement(element); + editable.insertElement(element, range); + editable.insertHtml('data'); + editable.insertHtml('data', 'mode'); + editable.insertHtml('data', 'mode', range); + editable.insertText(new CKEDITOR.dom.text('text')); + + var inline: boolean = editable.isInline(); + editable.setReadOnly(inline); +} + +function test_fileTools() { + var editor: CKEDITOR.editor; + var def: CKEDITOR.fileTools.uploadWidgetDefinition; + var loader: CKEDITOR.fileTools.fileLoader; + var blob: Blob; + var element: CKEDITOR.dom.element; + + CKEDITOR.fileTools.addUploadWidget(editor, 'editor', def); + CKEDITOR.fileTools.bindNotification(editor, loader); + var url: string = CKEDITOR.fileTools.getUploadUrl({ some: 'object' }); + url = CKEDITOR.fileTools.getUploadUrl({ some: 'object' }, 'type'); + + var supported = CKEDITOR.fileTools.isTypeSupported(blob, /regex/); + CKEDITOR.fileTools.markElement(element, 'name', 45); +} + +function test_fileTools_fileLoader() { + var editor: CKEDITOR.editor; + var def: CKEDITOR.fileTools.uploadWidgetDefinition; + var blob: Blob; + var element: CKEDITOR.dom.element; + + var loader: CKEDITOR.fileTools.fileLoader = new CKEDITOR.fileTools.fileLoader(editor, 'data'); + loader = new CKEDITOR.fileTools.fileLoader(editor, blob); + loader = new CKEDITOR.fileTools.fileLoader(editor, blob, 'name'); + + loader.abort(); + var finished: boolean = loader.isFinished(); + loader.load(); + loader.loadAndUpload('url'); + loader.loadAndUpload('url', { someHeader: '1234' }); + + loader.update(); + loader.upload('url'); + loader.upload('url', { someHeader: '1234' }); +} + +function test_fileTools_uploadRepository() { + var editor: CKEDITOR.editor; + var blob: Blob; + var repo: CKEDITOR.fileTools.uploadRepository = new CKEDITOR.fileTools.uploadRepository(editor); + + var loader: CKEDITOR.fileTools.fileLoader = repo.create('data', 'name'); + loader = repo.create(blob, 'name', 'type'); + + var fin: boolean = loader.isFinished(); +} + +function test_filter() { + var editor: CKEDITOR.editor; + var style: CKEDITOR.style; + + var filter: CKEDITOR.filter = new CKEDITOR.filter(editor); + filter = new CKEDITOR.filter('rule'); + filter = new CKEDITOR.filter(style); + filter = new CKEDITOR.filter([ style, 'rule', [ style, 'rule' ] ]); + filter = CKEDITOR.filter.instances['1234']; + + filter.addContentForms([ { form: true } ]); + filter.addElementCallback((el: CKEDITOR.htmlParser.element) => 4); + filter.addFeature({ allowedContent: style }); + filter.addTransformations([ [ 'transform1', { right: (element: CKEDITOR.htmlParser.element, tools: string | CKEDITOR.filter.transformationTools) => true } ] ]); + + var allowed: boolean = filter.allow(style); + allowed = filter.allow([style], 'name'); + allowed = filter.allow('rule', 'name', false); + + var apply: boolean = filter.applyTo(CKEDITOR.htmlParser.fragment.fromHtml('string'), true, false, 1); + apply = filter.applyTo(new CKEDITOR.htmlParser.element('name', null), true, false, 1); + + var checked: boolean = filter.check(style); + checked = filter.check('rule', true); + checked = filter.check(style, false, true); + + checked = filter.checkFeature({ allowedContent: style }); + + filter = filter.clone(); + filter.destroy(); + filter.disable(); + + filter.disallow(filter.disallowedContent); + var mode: number = filter.getAllowedEnterMode(1); + mode = filter.getAllowedEnterMode(1, false); +} + +function test_focusManager() { + var textarea = document.createElement('textarea'); + var instance = CKEDITOR.replace(textarea); + var element = CKEDITOR.document.getById('myElement'); + + instance.focusManager.focus(); + instance.focusManager.focus(element); + instance.focusManager.lock(); + instance.focusManager.unlock(); + instance.focusManager.blur(); + instance.focusManager.blur(true); + instance.focusManager.add(element, true); + instance.focusManager.remove(element); + + var focusManager = new CKEDITOR.focusManager(CKEDITOR.instances[0]); + var object: CKEDITOR.dom.domObject = focusManager.currentActive; + var bool: boolean = focusManager.hasFocus; +} + + +function test_htmlParser_basicWriter() { + var writer = new CKEDITOR.htmlParser.basicWriter(); + writer.attribute('class', 'MyClass'); + writer.closeTag('p'); + writer.comment('hello'); + alert(writer.getHtml(true)); // '

Hello

' + writer.openTag('p', {}); + writer.openTagClose('p', false); + writer.reset(); + writer.text('Hello'); + writer.write('data'); +} + +function test_htmlParser_cdata() { + var cdata: CKEDITOR.htmlParser.cdata = new CKEDITOR.htmlParser.cdata('hey'); + cdata.writeHtml(new CKEDITOR.htmlParser.basicWriter()); +} + +function test_htmlParser_comment() { + var filter: CKEDITOR.htmlParser.filter; + var comment: CKEDITOR.htmlParser.comment = new CKEDITOR.htmlParser.comment('hey'); + var filtered: boolean = comment.filter(filter); + comment.writeHtml(new CKEDITOR.htmlParser.basicWriter()); + comment.writeHtml(new CKEDITOR.htmlParser.basicWriter(), filter); +} + +function test_htmlParser_cssStyle() { + var element: CKEDITOR.htmlParser.element; + + var style: CKEDITOR.htmlParser.cssStyle = new CKEDITOR.htmlParser.cssStyle(element); + style = new CKEDITOR.htmlParser.cssStyle('styles'); + + style.populate(element); + style.populate(new CKEDITOR.dom.element('div')); + style.populate({ 'width': 1 }); +} + +function test_htmlParser_element() { + var element: CKEDITOR.htmlParser.element = new CKEDITOR.htmlParser.element('el', { 'id': '1'}); + + var node: CKEDITOR.htmlParser.node; + element.add(node); + element.add(node, 5); + element.addClass('class'); + element = element.clone(); + + var filter: CKEDITOR.htmlParser.filter; + var filtered: boolean = element.filter(filter); + element.filterChildren(filter); + + var nodes: CKEDITOR.htmlParser.node[] = element.find('*'); + nodes = element.find((el: CKEDITOR.htmlParser.node) => false, true); + + element.forEach((el: CKEDITOR.htmlParser.node) => console.log('node')); + element.forEach((el: CKEDITOR.htmlParser.node) => console.log('node'), 1); + element.forEach((el: CKEDITOR.htmlParser.node) => false, 2, true); + + var node: CKEDITOR.htmlParser.node = element.getFirst('*'); + node = element.getFirst({ 'id': '1' }); + node = element.getFirst((el: CKEDITOR.htmlParser.node) => true); + + var html: string = element.getHtml(); + html = element.getOuterHtml(); + + var hasClass: boolean = element.hasClass('class'); + element.removeClass('class'); + element.replaceWithChildren(); + element.setHtml('html'); + var el2: CKEDITOR.htmlParser.element = element.split(1); + + element.writeChildrenHtml(new CKEDITOR.htmlParser.basicWriter()); + element.writeChildrenHtml(new CKEDITOR.htmlParser.basicWriter(), filter); + + element.writeHtml(new CKEDITOR.htmlParser.basicWriter()); + element.writeHtml(new CKEDITOR.htmlParser.basicWriter(), filter); +} + +function test_htmlParser_filter() { + var filter: CKEDITOR.htmlParser.filter = new CKEDITOR.htmlParser.filter({ elementNames: [ 'div' ] }); + filter = new CKEDITOR.htmlParser.filter(); + + filter.addRules({ text: 'text' }); + filter.addRules({ attributes: { 'id': '1234' }}, 1); + filter.addRules({ comment: 'hey', text: 'text' }, { priority: 1 }); + filter.addRules({ root: document.body }, { applyToAll: false }); + + var node: CKEDITOR.htmlParser.node; + filter.applyTo(node); +} + + +function test_htmlParser_filterRulesGroup() { + var rules: CKEDITOR.htmlParser.filterRulesGroup = new CKEDITOR.htmlParser.filterRulesGroup(); + + rules.add([ 'some', 'rule' ], 1, { applyToAll: false, excludeNestedEditable: true }); + + rules.addMany([ (value: CKEDITOR.htmlParser.node | CKEDITOR.htmlParser.fragment | string) => false, [ 'some', 'rule' ] ], 1, { applyToAll: false }); + + var nodeFragOrString: CKEDITOR.htmlParser.node | CKEDITOR.htmlParser.fragment | string; + nodeFragOrString = rules.exec(nodeFragOrString); + + var str: string; + str = rules.execOnName(str); + + var idx: number = rules.findIndex(1); +} + +function test_htmlParser_fragment() { + var frag: CKEDITOR.htmlParser.fragment = new CKEDITOR.htmlParser.fragment(); + + var node: CKEDITOR.htmlParser.node; + frag.add(node); + frag.add(node, 1); + + var filter: CKEDITOR.htmlParser.filter; + frag.filter(filter); + frag.filterChildren(filter); + frag.filterChildren(filter, true); + frag.forEach((node: CKEDITOR.htmlParser.node) => console.log('node')); + frag.forEach((node: CKEDITOR.htmlParser.node) => false, 1); + frag.forEach((node: CKEDITOR.htmlParser.node) => false, 2, true); + + frag.writeChildrenHtml(new CKEDITOR.htmlParser.basicWriter()); + frag.writeChildrenHtml(new CKEDITOR.htmlParser.basicWriter(), filter); + + frag.writeHtml(new CKEDITOR.htmlParser.basicWriter()); + frag.writeHtml(new CKEDITOR.htmlParser.basicWriter(), filter); + + frag = CKEDITOR.htmlParser.fragment.fromBBCode('code'); + + var fragOrEl: CKEDITOR.htmlParser.fragment | CKEDITOR.htmlParser.element = CKEDITOR.htmlParser.fragment.fromHtml('html'); + fragOrEl = CKEDITOR.htmlParser.fragment.fromHtml('html', 'parent'); + fragOrEl = CKEDITOR.htmlParser.fragment.fromHtml('html', 'parent', 'fix'); + fragOrEl = CKEDITOR.htmlParser.fragment.fromHtml('html', new CKEDITOR.htmlParser.element('name', null), true); +} + +function test_htmlParser_node() { + var node: CKEDITOR.htmlParser.node = new CKEDITOR.htmlParser.node(); + + var el: CKEDITOR.htmlParser.element = node.getAscendant('condition'); + el = node.getAscendant({ 'id': '1234' }); + el = node.getAscendant((node: CKEDITOR.htmlParser.element) => false); + + var idx: number = node.getIndex(); + node.insertAfter(node); + node.insertBefore(node); + node.remove(); + node.replaceWith(node); + el = node.wrapWith(el); + +} + +function test_htmlParser_text() { + var text: CKEDITOR.htmlParser.text = new CKEDITOR.htmlParser.text('text'); + var filtered: boolean = text.filter(new CKEDITOR.htmlParser.filter()); + text.writeHtml(new CKEDITOR.htmlParser.basicWriter()); + text.writeHtml(new CKEDITOR.htmlParser.basicWriter(), new CKEDITOR.htmlParser.filter()); +} + +function test_htmlWriter() { + var writer = new CKEDITOR.htmlWriter(); + writer.openTag('p', {}); + writer.attribute('class', 'MyClass'); + writer.openTagClose('p', false); + writer.text('Hello'); + writer.closeTag('p'); + alert(writer.getHtml(true)); // '

Hello

' + + writer.indentationChars = '\t'; + writer.lineBreakChars = '\r\n'; + writer.selfClosingEnd = '>'; + writer.indentation(); + writer.lineBreak(); + writer.setRules('img', {breakBeforeOpen: true, breakAfterOpen: true}); +} + +function test_htmlParser() { + var html = '
text
'; + var fragment = CKEDITOR.htmlParser.fragment.fromHtml(html); + fragment.forEach(function(node) { + if (node instanceof CKEDITOR.htmlParser.element) { + node.forEach(function(node) { + console.log(node); + }); + } + }, CKEDITOR.NODE_ELEMENT, true); +} + +function test_keystrokeHandler() { + var handler: CKEDITOR.keystrokeHandler = new CKEDITOR.keystrokeHandler(CKEDITOR.instances[0]); + handler.attach(new CKEDITOR.dom.domObject(document.body)); +} + +function test_lang() { + var lang: string = CKEDITOR.lang.detect('en'); + lang = CKEDITOR.lang.detect('zh', 'sw'); + + CKEDITOR.lang.load('tk', 'pr', (code: string, entries: any) => console.log('loaded')); +} + +function test_loader() { + CKEDITOR.loader.load('script'); + CKEDITOR.loader.load('script', true); + + CKEDITOR.loader.loadPending(); +} + +function test_menu() { + var menu: CKEDITOR.menu = new CKEDITOR.menu(); + + menu.add({ anything: true }); + menu.addListener((startElement: CKEDITOR.dom.element, selection: CKEDITOR.dom.selection, path: CKEDITOR.dom.elementPath) => 'return'); + var { item, element } = menu.findItemByCommandName('command'); + menu.hide(); + menu.hide(false); + menu.removeAll(); + menu.show(new CKEDITOR.dom.element('div')); + menu.show(new CKEDITOR.dom.element('div'), 1); + menu.show(new CKEDITOR.dom.element('div'), 1, 2); + menu.show(new CKEDITOR.dom.element('div'), 1, 2, 3); +} + +function test_plugins() { + CKEDITOR.plugins.add( 'abbr', { + init: function( editor: CKEDITOR.editor ) { + // empty logic + } + }); + + console.log(CKEDITOR.plugins.registered['abbr']); +} + +function test_resourceManager() { + var manager: CKEDITOR.resourceManager = new CKEDITOR.resourceManager('path', 'name'); + + manager.add('name'); + manager.add('name', { hidpi: true }); + manager.addExternal('names', 'path'); + manager.addExternal('names', 'path', 'name'); + + var def: CKEDITOR.pluginDefinition = manager.get('name'); + var path: string = manager.getFilePath('path'); + path = manager.getPath('path'); + + manager.load('name', (loaded: string[]) => console.log('hey')); + manager.load([ 'name' ], (loaded: string[]) => console.log('hey'), manager); +} + +function test_scriptLoader() { + CKEDITOR.scriptLoader.load('url', (succeededUrls: boolean | string[], failedUrls: string[]) => console.log('loaded')); + CKEDITOR.scriptLoader.load([ 'url' ], (succeededUrls: boolean | string[], failedUrls: string[]) => console.log('loaded'), null); + CKEDITOR.scriptLoader.load([ 'url' ], (succeededUrls: boolean | string[], failedUrls: string[]) => console.log('loaded'), null, true); + CKEDITOR.scriptLoader.queue('url', (succeeded: boolean) => console.log('loaded')); +} + +function test_skin() { + CKEDITOR.skin.addIcon('name', 'path'); + CKEDITOR.skin.addIcon('name', 'path', 1); + CKEDITOR.skin.addIcon('name', 'path', 1, 'small'); + + CKEDITOR.skin.chameleon('editor', 'part'); + + var style: any = CKEDITOR.skin.getIconStyle('name'); + style = CKEDITOR.skin.getIconStyle('name', true); + style = CKEDITOR.skin.getIconStyle('name', true, 1); + style = CKEDITOR.skin.getIconStyle('name', true, 1, 'large'); + + var path: any = CKEDITOR.skin.getPath('part'); + + CKEDITOR.skin.loadPart('part', () => console.log('load')); + + var path2: string = CKEDITOR.skin.path(); +} + +function test_style() { + var style: CKEDITOR.style = new CKEDITOR.style({ element: 'div' }, { 'key': 'value '}); + style.apply(CKEDITOR.instances[0]); + + var el: CKEDITOR.dom.element; + style.applyToObject(el, CKEDITOR.instances[0]); + + var range: Range; + style.applyToRange(range, CKEDITOR.instances[0]); + + var str: string = style.buildPreview(); + str = style.buildPreview('label'); + + var path: CKEDITOR.dom.elementPath; + var bool: boolean = style.checkActive(path, CKEDITOR.instances[0]); + + var filter: CKEDITOR.filter; + bool = style.checkApplicable(path, CKEDITOR.instances[0], filter); + + bool = style.checkElementMatch(el, true, CKEDITOR.instances[0]); + bool = style.checkElementRemovable(el, false, CKEDITOR.instances[0]); + + var def: CKEDITOR.style.definition = style.getDefintion(); + style.remove(CKEDITOR.instances[0]); + style.removeFromRange(range, CKEDITOR.instances[0]); + + var rules: CKEDITOR.filter.allowedContentRules; + rules = style.toAllowedContentRules(); + rules = style.toAllowedContentRules(CKEDITOR.instances[0]); } function test_adding_command_and_buttons() { @@ -320,47 +977,6 @@ function test_adding_command_and_buttons() { }); } -function test_adding_dialog_by_path() { - CKEDITOR.dialog.add( 'abbrDialog', this.path + 'dialogs/abbr.js' ); -} - -function test_adding_dialog_by_definition() { - CKEDITOR.dialog.add( 'abbrDialog', function ( editor: CKEDITOR.editor ) { - return { - title: 'Abbreviation Properties', - minWidth: 400, - minHeight: 200, - onLoad: () => {}, - onOk: () => {}, - onCancel: () => {}, - onShow: () => {}, - onHide: () => {}, - contents: [ - { - id: 'tab-basic', - label: 'Basic Settings', - elements: [] - }, - { - id: 'tab-adv', - label: 'Advanced Settings', - elements: [] - } - ] - }; - }); -} - -function test_plugins() { - CKEDITOR.plugins.add( 'abbr', { - init: function( editor: CKEDITOR.editor ) { - // empty logic - } - }); - - console.log(CKEDITOR.plugins.registered['abbr']); -} - function test_adding_widget() { function wrapper(editor: CKEDITOR.editor) { editor.widgets.add("widgetty", { @@ -374,52 +990,6 @@ function test_adding_widget() { } } -function test_focusManager() { - var textarea = document.createElement('textarea'); - var instance = CKEDITOR.replace(textarea); - var element = CKEDITOR.document.getById('myElement'); - - instance.focusManager.focus(); - instance.focusManager.focus(element); - instance.focusManager.lock(); - instance.focusManager.unlock(); - instance.focusManager.blur(); - instance.focusManager.blur(true); - instance.focusManager.add(element, true); - instance.focusManager.remove(element); - - var focusManager = new CKEDITOR.focusManager(instance); - var object: CKEDITOR.dom.domObject = focusManager.currentActive; - var bool: boolean = focusManager.hasFocus; -} - -function test_basicWriter() { - var writer = new CKEDITOR.htmlParser.basicWriter(); - writer.openTag('p', {}); - writer.attribute('class', 'MyClass'); - writer.openTagClose('p', false); - writer.text('Hello'); - writer.closeTag('p'); - alert(writer.getHtml(true)); // '

Hello

' -} - -function test_htmlWriter() { - var writer = new CKEDITOR.htmlWriter(); - writer.openTag('p', {}); - writer.attribute('class', 'MyClass'); - writer.openTagClose('p', false); - writer.text('Hello'); - writer.closeTag('p'); - alert(writer.getHtml(true)); // '

Hello

' - - writer.indentationChars = '\t'; - writer.lineBreakChars = '\r\n'; - writer.selfClosingEnd = '>'; - writer.indentation(); - writer.lineBreak(); - writer.setRules('img', {breakBeforeOpen: true, breakAfterOpen: true}); -} - function test_sharedSpace() { CKEDITOR.inline('content', { removePlugins: 'maximize,resize', @@ -570,31 +1140,75 @@ function test_selection() { } function test_tools() { - var obj = { key: 'value' }; + var obj: { [key: string]: any } = { key: 'value' }; + + CKEDITOR.tools.addFunction(console.log); + CKEDITOR.tools.addFunction(console.log, obj); + var bool = CKEDITOR.tools.arrayCompare([ 1 ], [ 2, 3 ]); CKEDITOR.tools.clone(obj); CKEDITOR.tools.copy(obj); - CKEDITOR.tools.prototypedCopy(obj); - + obj = CKEDITOR.tools.createClass(obj); + var str = CKEDITOR.tools.cssStyleToDomStyle('style'); + var prefixes: { [cssClass: string]: string | number } = CKEDITOR.tools.cssVendorPrefix('prop', 'val'); + prefixes = CKEDITOR.tools.cssVendorPrefix('prop', 'val', true); + var fn: (param: any) => boolean + fn = CKEDITOR.tools.defer<(param: any) => boolean>(fn); + CKEDITOR.tools.enableHtml5Elements(document); + CKEDITOR.tools.enableHtml5Elements(document.createDocumentFragment(), true); + str = CKEDITOR.tools.escapeCss('css'); + var { input, reset } = CKEDITOR.tools.eventsBuffer(1, console.log, obj); + obj = CKEDITOR.tools.extend(obj, obj, true, obj); + bool = CKEDITOR.tools.fixDomain(); + str = CKEDITOR.tools.genKey(str); + str = CKEDITOR.tools.getCookie(str); + str = CKEDITOR.tools.getCsrfToken(); + var numb: number = CKEDITOR.tools.getIndex(['string', 'array'], (element: string) => false); + bool = CKEDITOR.tools.getMouseButton(new CKEDITOR.dom.event(document.createEvent(null))); + str = CKEDITOR.tools.getNextId(); + numb = CKEDITOR.tools.getNextNumber(); + str = CKEDITOR.tools.getUniqueId(); + str = CKEDITOR.tools.htmlDecode(str); + str = CKEDITOR.tools.htmlDecodeAttr(str); + str = CKEDITOR.tools.htmlEncode(str); + str = CKEDITOR.tools.htmlEncodeAttr(str); + numb = CKEDITOR.tools.indexOf(['string', 'array'], 'string'); + numb = CKEDITOR.tools.indexOf([true, false], (val: boolean) => false); console.log(CKEDITOR.tools.isArray([1])); // true console.log(CKEDITOR.tools.isArray(obj)); // false console.log(CKEDITOR.tools.isArray(null)); // false console.log(CKEDITOR.tools.isArray(undefined)); // false - + bool = CKEDITOR.tools.isEmpty(obj); + var ret1: { display: string[], aria: string[] } = CKEDITOR.tools.keystrokeToArray(obj, 1); + var ret2: { display: string, aria: string } = CKEDITOR.tools.keystrokeToString(obj, 1); + str = CKEDITOR.tools.ltrim(str); + str = CKEDITOR.tools.normalizeCssText(str, bool); + str = CKEDITOR.tools.normalizeHex(str); + bool = CKEDITOR.tools.objectCompare(obj, obj); + bool = CKEDITOR.tools.objectCompare(obj, obj, true); + var strArr: string[] = CKEDITOR.tools.objectKeys(obj); CKEDITOR.tools.override(parseInt, function(_parseInt) { return function(value: any, radix?: number) { return _parseInt(value, radix); }; }); -} - -function test_htmlParser() { - var html = '
text
'; - var fragment = CKEDITOR.htmlParser.fragment.fromHtml(html); - fragment.forEach(function(node) { - if (node instanceof CKEDITOR.htmlParser.element) { - node.forEach(function(node) { - console.log(node); - }); - } - }, CKEDITOR.NODE_ELEMENT, true); + obj = CKEDITOR.tools.parseCssText(str); + obj = CKEDITOR.tools.parseCssText(str, bool); + obj = CKEDITOR.tools.parseCssText(str, bool, bool); + obj = CKEDITOR.tools.prototypedCopy(obj); + CKEDITOR.tools.removeFunction(1); + str = CKEDITOR.tools.repeat(str, 40); + str = CKEDITOR.tools.rtrim(str); + str = CKEDITOR.tools.search(strArr, 'string'); + str = CKEDITOR.tools.search(strArr, (el: string) => true); + CKEDITOR.tools.setCookie('name', 'value'); + numb = CKEDITOR.tools.setTimeout(console.log); + numb = CKEDITOR.tools.setTimeout(console.log, 1000); + numb = CKEDITOR.tools.setTimeout(console.log, 1000, obj); + numb = CKEDITOR.tools.setTimeout(console.log, 1000, obj, 'timeout'); + numb = CKEDITOR.tools.setTimeout(console.log, 1000, obj, 'timeout', window); + str = CKEDITOR.tools.transformPlainTextToHtml(str, 1); + str = CKEDITOR.tools.trim(str); + CKEDITOR.tools.tryThese([ console.log, console.warn ]); + str = CKEDITOR.tools.writeCssText(obj); + str = CKEDITOR.tools.writeCssText(obj, true); } diff --git a/types/ckeditor/index.d.ts b/types/ckeditor/index.d.ts index 44c40f3699..95852e9e04 100644 --- a/types/ckeditor/index.d.ts +++ b/types/ckeditor/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for CKEditor 4.9.2 +// Type definitions for CKEditor 4.9 // Project: https://ckeditor.com/ckeditor-4/ // Definitions by: Thomas Wittwer // Stuart Long @@ -7,2765 +7,2765 @@ // WORK-IN-PROGRESS: Any contribution support welcomed. // See https://github.com/DefinitelyTyped/DefinitelyTyped/issues/1827 for more informations. interface Window { - CKEDITOR_BASEPATH: string; -} - -declare namespace CKEDITOR { - - // Config options - var disableAutoInline: boolean; - var replaceClass: string; - var skinName: string; - - // Properties - const ALT: number; - const CTRL: number; - const DATA_TRANSFER_CROSS_EDITORS: number; - const DATA_TRANSFER_EXTERNAL: number; - const DATA_TRANSFER_INTERNAL: number; - const DIALOG_RESIZE_BOTH: number; - const DIALOG_RESIZE_HEIGHT: number; - const DIALOG_RESIZE_NONE: number; - const DIALOG_RESIZE_WIDTH: number; - const DIALOG_STATE_BUSY: number; - const DIALOG_STATE_IDLE: number; - const ELEMENT_MODE_APPENDTO: number; - const ELEMENT_MODE_INLINE: number; - const ELEMENT_MODE_NONE: number; - const ELEMENT_MODE_REPLACE: number; - const END: number; - const ENLARGE_BLOCK_CONTENTS: number; - const ENLARGE_ELEMENT: number; - const ENLARGE_INLINE: number; - const ENLARGE_LIST_ITEM_CONTENTS: number; - const ENTER_BR: number; - const ENTER_DIV: number; - const ENTER_P: number; - const EVENT_PHASE_AT_TARGET: number; - const EVENT_PHASE_BUBBLING: number; - const EVENT_PHASE_CAPTURING: number; - const FILTER_SKIP_TREE: number; - const LINEUTILS_AFTER: number; - const LINEUTILS_BEFORE: number; - const LINEUTIS_INSIDE: number; - const MOUSE_BUTTON_LEFT: number; - const MOUSE_BUTTON_MIDDLE: number; - const MOUSE_BUTTON_RIGHT: number; - const NODE_COMMENT: number; - const NODE_DOCUMENT: number; - const NODE_DOCUMENT_FRAGMENT: number; - const NODE_ELEMENT: number; - const NODE_TEXT: number; - const POSITION_AFTER_END: number; - const POSITION_AFTER_START: number; - const POSITION_BEFORE_END: number; - const POSITION_BEFORE_START: number; - const POSITION_CONTAINS: number; - const POSITION_DISCONNECTED: number; - const POSITION_FOLLOWING: number; - const POSITION_IDENTICAL: number; - const POSITION_IS_CONTAINED: number; - const POSITION_PRECEDING: number; - const SELECTION_ELEMENT: number; - const SELECTION_NONE: number; - const SELECTION_TEXT: number; - const SHIFT: number; - const SHRINK_ELEMENT: number; - const SHRINK_TEXT: number; - const START: number; - const STYLE_BLOCK: string; - const STYLE_INLINE: string; - const STYLE_OBJECT: string; - const TRISTATE_DISABLED: number; - const TRISTATE_OFF: number; - const TRISTATE_ON: number; - const UI_BUTTON: string; - const UI_MENUBUTTON: string; - const UI_PANEL: string; - const UI_PANELBUTTON: string; - const UI_RICHCOMBO: string; - const UI_SEPARATOR: string; - const VERBOSITY_ERROR: number; - const VERBOSITY_WARN: number; - - var basePath: string; - var currentInstance: editor; - var document: dom.document; - var instances: { [id: string]: editor }; - var loadFullCoreTimeout: number; - var revision: string; - var rnd: number; - var status: string; - var timestamp: string; - var verbosity: number; - var version: string; - const config: config; - - // Methods - function add(editor: editor): void; - function addCss(css: string): void; - function addTemplate(name: string, source: string): template; - function appendTo(element: string | HTMLElement, config?: config, data?: string): editor; - function domReady(): void; - function editorConfig(config: config): void; - function error(errorCode: string, additionalData?: any): void; - function getCss(): string; - function getTemplate(name: string): template; - function getUrl(resource: string): string; - function inline(element: string | HTMLElement, instanceConfig?: config): editor; - function inlineAll(): void; - function loadFullCore(): void; - function replace(element: string | HTMLTextAreaElement, config?: config): editor; - function replaceAll(className?: string): void; - function replaceAll(assertionFunction: (textarea: HTMLTextAreaElement, config: config) => boolean): void; - function warn(errorCode: string, additionalData?: any): void; - - // Event interface - function capture(): void; - function define(name: string, meta: { [key: string]: any }): void; - function fire(eventName: string, data?: { [key: string]: any }, editor?: editor): any; - function fireOnce(eventName: string, data?: { [key: string]: any }, editor?: editor): any; - function hasListeners(eventName: string): boolean; - function on(eventName: string, listenerFunction: (eventInfo: eventInfo) => void, scopeObj?: { [key: string]: any }, listenerData?: { [key: string]: any }, priority?: number): void; - function once(eventName: string, listenerFunction: (eventInfo: eventInfo) => void, scopeObj?: { [key: string]: any }, listenerData?: { [key: string]: any }, priority?: number): void; - function removeAllListeners(): void; - function removeListener(eventName: string, listenerFunction: (eventInfo: eventInfo) => void): void; - - type listenerRegistration = { - removeListener: () => void; - } - - namespace dom { - - interface bookmark { - startNode: dom.node | string; - endNode: dom.node | string; - serializable: boolean; - collapsed: boolean; - } - - interface bookmark2 { - start: number[]; - end: number[]; - startOffset: number; - endOffset: number; - collapsed: boolean; - normalized: boolean; - is2: boolean; - } - - class comment extends node { - readonly type: number; - - constructor(comment: string | Node, ownerDocument?: document); - getOuterHtml(): string; - } - - class document extends domObject { - readonly $: Document; - readonly type: number; - - constructor(domDocument: { [key: string]: any }); - appendStyleSheet(cssFileUrl: string): void; - appendStyleText(cssStyleText: string): CSSStyleSheet; - createElement(name: string, attribsAndStyles?: { attributes: { [key: string]: any }; styles: { [key: string]: any }; }): element; - createText(text: string): element; - find(selector: string): nodeList; - findOne(selector: string): element; - focus(): void; - getActive(): element; - getBody(): element; - getByAddress(address: any[], normalized?: boolean): node; - getById(elementId: string): element; - getDocumentElement(): element; - getElementsByTag(tagName: string): nodeList; - getHead(): element; - getSelection(): selection; - getWindow(): window; - write(html: string): void; - } - - class documentFragment extends node { - readonly type: number; - - constructor(nodeOrDoc: { [key: string]: any }); - insertAfterNode(node: node): void; - } - - class domObject extends event { - readonly $: any; - - constructor(nativeDomObject: { [key: string]: any }); - clearCustomData(): void; - equals(object: any): boolean; - fire(eventName: string, data?: any, editor?: editor): any; - getCustomData(key: string): any; - getPrivate(): any; - getUniqueId(): number; - removeAllListeners(): void; - removeCustomData(key: string): any; - setCustomData(key: string, value: any): domObject; - } - - class element extends node { - readonly $: HTMLElement; - readonly type: number; - - constructor(element: string, ownerDocument?: document); - constructor(element: HTMLElement, ownerDocument?: document); - addClass(className: string): void; - append(node: node | string, toStart?: boolean): node; - appendBogus(force: boolean): void; - appendHtml(html: string): void; - appendText(text: string): node; - breakParent(parent: element): void; - contains(node: node): boolean; - copyAttributes(dest: element, skipAttributes: { [key: string]: string }): void; - data(name: string, value?: string | boolean): string; - disableContextMenu(): void; - find(selector: string): nodeList; - findOne(selector: string): element; - focus(defer?: boolean): void; - focusNext(ignoreChildren?: boolean, indexToUse?: number): void; - focusPrevious(ignoreChildren?: boolean, indexToUse?: number): void; - forEach(callback: (node: node) => void, type?: number, skipRoot?: boolean): void; - getAttribute(name: string): string; - getBogus(): node | boolean; - getChild(indices: number | number[]): node; - getChildCount(): number; - getChildren(): nodeList; - getClientRect(): ClientRect; - getComputedStyle(propertyName: string): string; - getDirection(useComputed: boolean): string; - getDocumentPosition(refDocument: document): position; - getDtd(): dtdDefinition; - getEditor(): editor; - getElementsByTag(tagName: string): nodeList; - getFirst(evaluator?: (node: node) => boolean): node; - getFrameDocument(): document; - getHtml(): string; - getId(): string; - getLast(evaluator?: (node: node) => boolean): node; - getName(): string; - getNameAtt(): string; - getOuterHtml(): string; - getPositionedAncestor(): element; - getSize(type: string, isBorderBox: boolean): void; - getStyle(name: string): string; - getTabIndex(): number; - getText(): string; - getValue(): string; - getWindow(): window; - hasAttributes(): boolean; - hasAttribute(name: string): boolean; - hasClass(className: string): boolean; - hide(): void; - is(...name: string[]): boolean; - is(name: any): boolean; - isBlockBoundary(customNodeNames: { [tagName: string]: 1 }): boolean; - isEditable(textCursor?: boolean): boolean; - isEmptyInlineRemoveable(): boolean; - isIdentical(otherElement: element): boolean; - isVisible(): boolean; - mergeSiblings(inlineOnly?: boolean): void; - moveChildren(target: element, toStart?: boolean): void; - removeAttribute(name: string): void; - removeAttributes(attributes?: string[]): void; - removeClass(className: string): void; - removeStyle(name: string): void; - renameNode(newTag: string): void; - scrollIntoParent(parent: element, alignToTop: boolean, hscroll: boolean): void; - scrollIntoParent(parent: window, alignToTop: boolean, hscroll: boolean): void; - scrollIntoView(alignToTop?: boolean): void; - setAttribute(name: string, value: string): element; - setAttributes(attributesPairs: { [key: string]: string }): element; - setHtml(html: string): string; - setOpacity(opacity: number): void; - setSize(type: string, size: number, isBorderBox: boolean): void; - setState(state: number, base?: string, useAria?: boolean): void; - setStyle(name: string, value: string): element; - setStyles(stylesPair: { [key: string]: string }): element; - setText(text: string): string; - setValue(value: string): element; - show(): void; - unselectable(): void; - - //static method - static clearAllMarkers(database: any): any; - static clearMarkers(database: any, element: dom.element, removeFromDatabase: boolean): void; - static createFromHtml(html: string): element; - static get(element: string | HTMLElement | element): element; - static setMarker(database: any, element: dom.element, name: string, value: any): dom.element; - } - - class elementPath { - readonly block: element; - readonly blockLimit: element; - readonly elements: element[]; - readonly lastElement: element; - readonly root: element; - - constructor(startNode: element, root?: element); - compare(otherPath: elementPath): boolean; - contains(query: string | string[] | ((element: element) => boolean) | { [key: string]: any } | element, excludeRoot?: boolean, fromTop?: boolean): element; - direction(): 'ltr' | 'rtl'; - isContextFor(tag: string): boolean; - } - - class event { - constructor(domEvent: Event); - getKey(): number; - getKeystroke(): number; - preventDefault(stopPropagation?: boolean): void; - stopPropagation(): void; - getTarget(): node; - getPhase(): number; - getPhaseOffset(): position; - on(eventName: string, listenerFunction: (eventInfo: eventInfo) => void, scopeObj?: any, listenerData?: any, priority?: number): { removeListener: () => void }; - } - - class iterator { - readonly activeFilter: filter; - enforceRealBlocks: boolean; - enlargeBr: boolean; - readonly filter: filter; - forceBrBreak: boolean; - readonly range: range; - constructor(range: range); - getNextParagraph(blockTag?: string): element; - } - - class node extends domObject { - constructor(domNode: Node); - appendTo(element: element): element; - clone(includeChildren: boolean, cloneId: boolean): node; - hasPrevious(): boolean; - hasNext(): boolean; - insertAfter(node: node): node; - insertBefore(node: node): node; - insertBeforeMe(node: node): node; - getAddress(normalized?: boolean): number[]; - getAscendant(reference: string, includeSelf?: boolean): node; - getCommonAncestor(node: node): void; - getDocument(): document; - getIndex(normalized?: boolean): number; - getNext(evaluator?: (node: node) => boolean): node; - getNextSourceNode(startFromSibling: boolean, nodeType: number, guard: node | ((node: node) => boolean)): void; - getParent(allowFragmentParent?: boolean): element; - getParents(closerFirst?: boolean): node[]; - getPosition(otherNode: node): void; - getPrevious(evaluator?: (node: node) => boolean): node; - getPreviousSourceNode(startFromSibling: boolean, nodeType: number, guard: node | ((node: node) => boolean)): void; - hasAscendant(name: string, includeSelf: boolean): boolean; - remove(preserveChildren?: boolean): node; - replace(nodeToReplace: node): void; - trim(): void; - ltrim(): void; - rtrim(): void; - isReadOnly(): boolean; - } - - class nodeList { - constructor(nativeList: NodeList); - count(): number; - getItem(index: number): node; - toArray(): node[]; - } - - class range { - readonly collapsed: boolean; - readonly document: document; - readonly endContainer: element | text; - readonly endOffset: number; - readonly root: element; - readonly startContainer: element | text; - readonly startOffset: number; - - constructor(root: element | document); - checkBoundaryOfElement(element: element, checkType: number): boolean; - checkEndOfBlock(): boolean; - checkReadOnly(): boolean; - checkStartOfBlock(): boolean; - clone(cloneId?: boolean): range; - cloneContents(): documentFragment; - collapse(toStart?: boolean): boolean; - createBookmark(serializable?: boolean): bookmark; - createBookmark2(normalized?: boolean): bookmark2; - createIterator(): iterator; - deleteContents(mergeThen?: boolean): void; - endPath(): elementPath; - enlarge(unit: number, excludeBrs?: boolean): void; - extractContents(mergeThen?: boolean, cloneId?: boolean): documentFragment; - fixBlock(isStart: boolean, blockTag: string): element; - getBoundaryNodes(): { startNode: node; endNode: node; }; - getCommonAncestor(includeSelf?: boolean, ignoreTextNode?: boolean): element; - getEnclosedNode(): node; - getNextEditableNode(): element | text; - getNextNode(evaluator: (element: dom.element) => boolean, guard?: (element: dom.element) => boolean, boundary?: element): element; - getPreviousEditableNode(): element | text; - getPreviousNode(evaluator: (element: dom.element) => boolean, guard?: (element: dom.element) => boolean, boundary?: element): element; - getTouchedEndNode(): node; - getTouchedStartNode(): node; - insertNode(node: node): void; - moveToBookmark(bookmark: bookmark | bookmark2): void; - moveToClosestEditablePosition(element?: element, isMoveForward?: boolean): boolean; - moveToElementEditEnd(target: element): boolean; - moveToElementEditStart(target: element): boolean; - moveToElementEditablePosition(element: element, isMoveToEnd: boolean): boolean; - moveToPosition(node: node, position: number): void; - moveToRange(range: range): void; - optimize(): void; - optimizeBookmark(): void; - removeEmptyBlocksAtEnd(atEnd: boolean): void; - scrollIntoView(): void; - select(): selection; - selectNodeContents(node: node): void; - setEnd(endNode: node, endOffset: number): void; - setEndAfter(node: node): void; - setEndAt(node: node, position: number): void; - setEndBefore(node: node): void; - setStart(startNode: node, startOffset: number): void; - setStartAfter(node: node): void; - setStartAt(node: node, position: number): void; - setStartBefore(node: node): void; - shrink(mode: number, selectContents?: boolean, options?: boolean | shrinkOptions): void; - splitBlock(cloneId?: boolean): void; - splitElement(toSplit: element, cloneId?: boolean): element; - startPath(): elementPath; - trim(ignoreStart?: boolean, ignoreEnd?: boolean): void; - - static mergeRanges(ranges: range[]): range[]; - } - - interface shrinkOptions { - shrinkOnBlockBoundary?: boolean, - skipBogus?: boolean - } - - class rangeList { - constructor(ranges?: range | range[]); - createBokmarks(serializable?: boolean): bookmark[]; - createBookmarks2(normalized?: boolean): bookmark2[]; - createIterator(): rangeListIterator; - moveToBookmarks(bookmarks: bookmark[]): void; - } - - - interface rangeListIterator { - getNextRange(mergeConsequent?: boolean): range; - } - - // see https://docs.com/ckeditor4/latest/api/CKEDITOR_dom_selection.html - class selection { - readonly FILLING_CHAR_SEQUENCE: string; - readonly document: document; - readonly isFake: boolean; - readonly isLocked: boolean; - readonly rev: number; - readonly root: element; - - constructor(target: document | element | selection); - createBookmarks(serializable: any): bookmark[]; - createBookmarks2(normalized: any): bookmark2[]; - fake(element: element, ariaLabel?: boolean): void; - getCommonAncestor(): element; - getNative(): Selection; - getRanges(onlyEditables?: boolean): range[]; - getSelectedElement(): element; - getSelectedText(): string; - getStartElement(): element; - getType(): number; - isCollapsed(): boolean; - isHidden(): boolean; - isInTable(allowPartialSelection?: boolean): boolean; - lock(): void; - removeAllRanges(): void; - reset(): void; - scrollIntoView(): void; - selectBookmarks(bookmarks: (bookmark | bookmark2)[]): selection; - selectElement(element: element): void; - selectRanges(ranges: range[]): void; - unlock(restore: boolean): void; - } - - class text extends node { - readonly $: Text; - readonly type: number; - - constructor(text: Text | string, ownerDocument?: document); - getLength(): number; - getText(): string; - setText(text: string): void; - split(offset: number): text; - substring(indexA: number, indexB?: number): void; - } - - class walker { - evaluator: (node: node) => boolean; - guard: (node: node) => boolean; - - static validEmptyBlockContainers: { [key: string]: any }; - - constructor(range: range); - checkBackward(): boolean; - checkForward(): boolean; - end(): void; - lastBackward(): node; - lastForward(): node; - next(): node; - previous(): node; - reset(): void; - - static blockBoundary(customNodeNames: any): (node: node) => boolean; - static bogus(isReject?: boolean): (node: node) => boolean; - static bookmark(contentOnly?: boolean, isReject?: boolean): (node: node) => boolean; - static editable(isReject?: boolean): (node: node) => boolean; - static empty(isReject?: boolean): (node: node) => boolean; - static ignored(isReject?: boolean): (node: node) => boolean; - static invisible(isReject?: boolean): (node: node) => boolean; - static listItemBoundary(): (node: node) => boolean; - static nodeType(type: number, isReject?: boolean): (node: node) => boolean; - static temp(isReject?: boolean): (node: node) => boolean; - static whitespaces(isReject?: boolean): (node: node) => boolean; - } - - interface position { - x: number; - y: number; - } - - interface widthAndHeight { - width: number; - height: number; - } - - class window extends domObject { - constructor(domWindow: Window); - focus(): void; - getViewPaneSize(): widthAndHeight; - getScrollPosition(): position; - getFrame(): element; - } - } - - - namespace ajax { - function load(url: string, callback?: (data: any) => void): string; - function loadXml(url: string, callback?: (data: any) => void): xml; - function post(url: string, data: any, contentType?: string, callback?: (data: any) => void): void; - } - - - class command extends event implements commandDefinition { - fakeKeystroke: number; - previousState: number; - state: number; - uiItems: any[]; - - // Methods - constructor(editor: editor, commandDefinition: commandDefinition); - checkAllowed(noCache: boolean): boolean; - disable(): void; - enable(): void; - exec(data?: { [key: string]: any }): boolean; - refresh(editor: editor, path: dom.elementPath): void; - setState(newState: number): boolean; - toggleState(): void; - - } - - interface commandDefinition { - async?: boolean; - canUndo?: boolean; - context?: boolean; - contextSensitive?: boolean; - editorFocus?: boolean; - fakeKeystroke?: number; - modes?: { [key: string]: any }; - startDisabled?: boolean; - readOnly?: boolean; - exec(editor: editor, data?: any): boolean; - refresh?(editor: editor, path: dom.elementPath): void; - } - - // https://docs.com/ckeditor4/latest/api/CKEDITOR_config.html - interface config { - allowedContent?: boolean | filter.allowedContentRules; - autoEmbed_widget?: string | ((url: string) => string); - autoGrow_bottomSpace?: number; - autoGrow_maxHeight?: number; - autoGrow_minHeight?: number; - autoGrow_onStartup?: boolean; - autoUpdateElement?: boolean; - - baseFloatZIndex?: number; - baseHref?: string; - basicEntities?: boolean; - blockedKeystrokes?: number[]; - bodyClass?: string; - bodyId?: string; - browserContextMenuOnCtrl?: boolean; - - clipboard_defaultContentType?: 'html' | 'text'; - clipboard_notificationDuration?: number; - cloudServices_tokenUrl?: string; - cloudServices_uploadUrl?: string; - codeSnippetGeshi_url?: string; - codeSnippet_codeClass?: string; - codeSnippet_languages?: { [key: string]: any }; - coceSnippet_theme?: string; - colorButton_backStyle?: config.styleObject; - colorButton_colors?: string; - colorButton_colorsPerRow?: number; - colorButton_enableAutomatic?: boolean; - colorButton_enableMore?: boolean; - colorButton_foreStyle?: config.styleObject; - colorButton_normalizeBackground?: boolean; - contentsCss?: string | string[]; - contentsLangDirection?: string; - contentsLanguage?: string; - copyFormatting_allowRules?: string; - copyFormatting_allowedContexts?: boolean | string[]; - copyFormatting_keystrokeCopy?: number; - copyFormatting_keystrokePaste?: number; - copyFormatting_outerCursor?: boolean; - coreStyles_bold?: config.styleObject; - coreStyles_italic?: config.styleObject; - coreStyles_strike?: config.styleObject; - coreStyles_subscript?: config.styleObject; - coreStyles_superscript?: config.styleObject; - coreStyles_underline?: config.styleObject; - customConfig?: string; - - dataIndentationChars?: string; - defaultLanguage?: string; - devtools_styles?: string; - devtools_textCallback?: (editor: editor, dialog: dialog, element: dom.element, tabName: string) => string; - dialog_backgroundCoverColor?: string; - dialog_backgroundCoverOpacity?: number; - dialog_buttonsOrder?: string; - dialog_magnetDistance?: number; - dialog_noConfirmCancel?: boolean; - dialog_startupFocusTab?: boolean; - disableNativeSpellChecker?: boolean; - disableNativeTableHandles?: boolean; - disableNativeObjectResizing?: boolean; - disableNativeReadonlyStyling?: boolean; - disallowedContent?: filter.disallowedContentRules; - div_wrapTable?: boolean; - docType?: string; - - easyimage_class?: string; - easyimage_defaultStyle?: string; - easyimage_styles?: { [key: string]: any }; - easyimage_toolbar?: string[] | string; - emailProtection?: string; - embed_provider?: string; - enableTabKeyTools?: boolean; - enterMode?: number; - entities?: boolean; - entities_additional?: string; - entities_greek?: boolean; - entities_latin?: boolean; - entities_processNumerical?: boolean | string; - extraAllowedContent?: filter.allowedContentRules; - extraPlugins?: string; - - fileTools_defaultFileName?: string; - fileTools_requestHeaders?: { [key: string]: any }; - filebrowserBrowseUrl?: string; - filebrowserFlashBrowseUrl?: string; - filebrowserFlashUploadUrl?: string; - filebrowserImageBrowseLinkUrl?: string; - filebrowserImageBrowseUrl?: string; - filebrowserImageUploadUrl?: string; - filebrowserUploadMethod?: string; - filebrowserUploadUrl?: string; - filebrowserWindowFeatures?: string; - filebrowserWindowHeight?: number | string; - filebrowserWindowWidth?: number | string; - fillEmptyBlocks?: boolean | ((element: htmlParser.element) => boolean); - find_highlight?: config.styleObject; - flashAddEmbedTag?: boolean; - flashConvertOnEdit?: boolean; - flashEmbedTagOnly?: boolean; - floatSpaceDockedOffsetX?: number; - floatSpaceDockedOffsetY?: number; - floatSpacePinnedOffsetX?: number; - floatSpacePinnedOffsetY?: number; - floatSpacePreferRight?: boolean; - fontSize_defaultLabel?: string; - fontSize_sizes?: string; - fontSize_style?: config.styleObject; - font_defaultLabel?: string; - font_names?: string; - font_style?: config.styleObject; - forceEnterMode?: boolean; - forcePasteAsPlainText?: boolean; - forceSimpleAmpersand?: boolean; - format_address?: config.styleObject; - format_div?: config.styleObject; - format_h1?: config.styleObject; - format_h2?: config.styleObject; - format_h3?: config.styleObject; - format_h4?: config.styleObject; - format_h5?: config.styleObject; - format_h6?: config.styleObject; - format_p?: config.styleObject; - format_pre?: config.styleObject; - format_tags?: string; - fullPage?: boolean; - - grayt_autoStartup?: boolean; - - height?: string | number; - htmlEncodeOutput?: boolean; - - ignoreEmptyParagraph?: boolean; - image2_alignClasses?: string[]; - image2_altRequired?: boolean; - image2_captionedClass?: string; - image2_disableResizer?: boolean; - image2_prefillDimensions?: boolean; - imageUploadUrl?: string; - image_prefillDimensions?: boolean; - image_previewText?: string; - image_removeLinkByEmptyUrl?: boolean; - indentClasses?: string[]; - indentOffset?: number; - indentUnit?: string; - - jqueryOverrideVal?: boolean; - justifyClasses?: string[]; - - keystrokes?: [number, string][]; - - language?: string; - language_list?: string[]; - linkJavaScriptLinksAllowed?: boolean; - linkShowAdvancedTab?: boolean; - linkShowTargetTab?: boolean; - - magicline_color?: string - magicline_everywhere?: boolean; - magicline_holdDistance?: number; - magicline_keystrokeNext?: number; - magicline_keystrokePrevious?: number; - magicline_tabuList?: string[]; - magicline_triggerOffset?: number; - mathJaxClass?: string; - mathJaxLib?: string; - menu_groups?: string; - menu_subMenuDelay?: number; - - newpage_html?: string; - notification_duration?: number; - - on?: editor.eventObject; - - pasteFilter?: string; - pasteFromWordCleanupFile?: string; - pasteFromWordNumberedHeadingToList?: boolean; - pasteFromWordPromptCleanup?: boolean; - pasteFromWordRemoveFontStyles?: boolean; - pasteFromWorkRemoveStyles?: boolean; - pasteFromWord_heuristicsEdgeList?: boolean; - pasteFromWord_inlineImages?: boolean; - plugins?: string; - protectedSource?: RegExp[]; - - readOnly?: boolean; - removeButtons?: string; - removeDialogTabs?: string; - removeFormatAttributes?: string; - removeFormatTags?: string; - removePlugins?: string; - resize_dir?: string; - resize_enabled?: boolean; - resize_maxHeight?: number; - resize_maxWidth?: number; - resize_minHeight?: number; - resize_minWidth?: number; - - scayt_autoStartup?: boolean; - scayt_contextCommands?: string; - scayt_contextMenuItemsOrder?: string; - scayt_customDictionaryIds?: string; - scayt_customerId?: string; - scayt_disableOptionsStorage?: string | string[]; - scayt_elementsToIgnore?: string; - scayt_handleCheckDirty?: string; - scayt_handleUndoRedo?: string; - scayt_ignoreAllCapsWords?: boolean; - scayt_ignoreDomainNames?: boolean; - scayt_ignoreWordsWithMixedCases?: boolean; - scayt_ignoreWordsWithNumbers?: boolean; - scayt_inlineModeImmediateMarkup?: boolean; - scayt_maxSuggestions?: number; - scayt_minWordLength?: number; - scayt_moreSuggestions?: string; - scayt_multiLanguageMode?: boolean; - scayt_multiLanguageStyles?: { [key: string]: any }; - scayt_sLang?: string; - scayt_serviceHost?: string; - scayt_servicePath?: string; - scayt_servicePort?: string; - scayt_serviceProtocol?: string; - scayt_srcUrl?: string; - scayt_uiTabs?: string; - scayt_userDictionaryName?: string; - - sharedSpaces?: sharedSpace; - shiftEnterMode?: number; - skin?: string; - smiley_columns?: number; - smiley_descriptions?: string[]; - smiley_images?: string[]; - smiley_path?: string; - sourceAreaTabSize?: number; - specialChars?: (string | [string, string])[]; - startupFocus?: string | boolean; - startupMode?: string; - startupOutlineBlocks?: boolean; - startupShowBorders?: boolean; - stylesSet?: string | boolean | config.styleObject[]; - stylesheetParser_skipSelectors?: RegExp; - stylesheetParser_validSelectors?: RegExp; - - tabIndex?: number; - tabSpaces?: number; - templates?: string; - templates_files?: { [key: string]: any }; - templates_replaceContent?: boolean; - title?: string | boolean; - toolbar?: string | (string | string[] | { name: string, items?: string[], groups?: string[] })[] | null; - toolbarCanCollapse?: boolean; - toolbarGroupCycling?: boolean; - toolbarGroups?: (toolbarGroups | string)[]; - toolbarLocation?: string; - toolbarStartupExpanded?: boolean; - - uiColor?: string; - undoStackSize?: number; - uploadUrl?: string; - useComputedState?: boolean; - - width?: string | number; - wsc_cmd?: string; - wsc_customDictionaryIds?: string; - wsc_customLoaderScript?: string; - wsc_customerId?: string; - wsc_height?: string; - wsc_lang?: string; - wsc_left?: string; - wsc_top?: string; - wsc_userDictionaryName?: string; - wsc_width?: string; - } - - interface dataProcessor { - toDataFormat(html: string, fixForBody: string): void; - toHtml(data: string, fixForBody?: string): void; - } - - class dialog { - readonly state: number; - - constructor(editor: editor, dialogName: string); - - addFocusable(element: dom.element, index?: number): void; - addPage(contents: { [key: string]: any }): void; - click(id: string): any; - commitContent(): void; - diableButton(id: string): void; - enableButton(id: string): void; - foreach(fn: () => void): dialog; - getButton(id: string): ui.dialog.button; - getContentElement(pageId: string, elementId: string): ui.dialog.uiElement; - getElement(): dom.element; - getName(): string; - getPageCount(): number; - getParentEditor(): editor; - getPosition(): { [key: string]: any }; - getSelectedElement(): dom.element; - getSize(): { [key: string]: any }; - getValueOf(pageId: string, elementId: string): any; - hide(): void; - hidePage(id: string): void; - layout(): void; - move(x: number, y: number, save: boolean): void; - reset(): dialog; - resize(width: number, height: number): void; - selectPage(id: string): void; - setState(state: number): void; - setValueOf(pageId: string, elementId: string, value: any): void; - setupContent(): void; - show(): void; - showPage(id: string): void; - updateStyle(): void; - - static add(name: string, dialogDefinition: string | ((editor: editor) => dialog.IDialogDefinition)): void; - static addIframe(name: string, title: string, minWidth: number, minHeight: number, onContentLoad?: () => void, userDefinition?: { [key: string]: any }): void; - static addUIElement(typeName: string, builder: () => void): void; - static cancelButton(): void; - static exists(name: string | number): void; // NOTE: documentation says object, but it's an array accessor, so really a string or number will work - static getCurrent(): dialog; - static isTabEnabled(editor: editor, dialogName: string, tabName: string): boolean; - static okButton(): void; - } - - namespace dialog { - - namespace definition { - - interface button extends uiElement { - disabled?: boolean; - } - - interface checkbox extends uiElement { - default?: string; - validate?: () => boolean; - } - - interface content { - accessKey?: string; - elements?: dialog.definition.uiElement[]; - id?: string; - label?: string; - title?: string; - } - - interface file extends labeledElement { - action?: string; - size?: string; - validate?: () => boolean; - } - - interface fileButton extends uiElement { - filebrowser?: string; - for?: string; - validate?: () => boolean; - } - - interface hbox extends uiElement { - children?: ui.dialog.uiElement[]; - height?: number; - padding?: number; - validate?: () => boolean; - widths?: number[]; - } - - interface html extends uiElement { - html?: string; - } - - interface labeledElement extends uiElement { - controlStyle?: string; - inputStyle?: string; - labelLayout?: string; - labelStyle?: string; - widths?: number[]; - } - - interface radio extends labeledElement { - default?: string; - items?: string[] | (string[])[]; - validate?: () => boolean; - } - - interface select extends labeledElement { - default?: string; - items?: string[] | (string[])[]; - multiple?: boolean; - size?: number; - validate?: () => boolean; - } - - interface textarea extends labeledElement { - bidi?: boolean; - cols?: number; - default?: string; - rows?: number; - validate?: () => boolean; - } - - interface textInput extends labeledElement { - bidi?: boolean; - default?: string; - maxLength?: number; - size?: number; - validate?: () => boolean; - } - - interface uiElement { - align?: string; - className?: string; - commit?: (widget: plugins.widget) => void; - id?: string; - label?: string; - onHide?: (elem: ui.dialog.uiElement) => void; - onLoad?: (elem: ui.dialog.uiElement) => void; - onShow?: (elem: ui.dialog.uiElement) => void; - requiredContent?: string | { [key: string]: any } | style; - setup?: (widget: plugins.widget) => void; - style?: string; - title?: string; - type?: string; - } - - interface vbox extends uiElement { - children?: ui.dialog.uiElement[]; - expand?: boolean; - heights?: number[]; - padding?: number; - styles?: string; - width?: number[]; - } - } - - interface IDialogDefinition { - buttons?: dialog.definition.button[]; - contents?: dialog.definition.content[]; - height?: number; - minHeight?: number; - minWidth?: number; - onCancel?: () => void; - onLoad?: () => void; - onOk?: () => void; - onShow?: () => void; - onHide?: () => void; - resizable?: number; - title?: string; - width?: number; - } - } - - class dialogCommand { - value: any; - - constructor(dialogName: string, ext?: { tabId?: string }); - } - - interface dtdDefinition { - [outerTagName: string]: {[innerTagName: string]: 1}; - $block: {[tagName: string]: 1}; - $blockLimit: {[tagName: string]: 1}; - $cdata: {[tagName: string]: 1}; - $editable: {[tagName: string]: 1}; - $empty: {[tagName: string]: 1}; - $inline: {[tagName: string]: 1}; - $intermediate: {[tagName: string]: 1}; - $list: {[tagName: string]: 1}; - $listItem: {[tagName: string]: 1}; - $nonBodyContent: {[tagName: string]: 1}; - $nonEditable: {[tagName: string]: 1}; - $object: {[tagName: string]: 1}; - $removeEmpty: {[tagName: string]: 1}; - $tabIndex: {[tagName: string]: 1}; - $tableContent: {[tagName: string]: 1}; - $transparent: {[tagName: string]: 1}; - } - - var dtd: dtdDefinition; - - class editable extends dom.element { - hasFocus: boolean; - readonly status: string; - - constructor(editor: editor, element: HTMLElement | dom.element); - attachClass(className: string): void; - attachListener(obj: event | editable, eventName: string, listenerFunction: (ei: eventInfo) => void, scopeobj?: {}, listenerData?: any, priority?: number): listenerRegistration; - changeAttr(attr: string, val: string): void; - detach(): void; - insertElement(element: dom.element, range?: dom.range): void; - insertHtml(data: string, mode?: string, range?: dom.range): void; - insertText(text: dom.text): void; - isInline(): boolean; - setReadOnly(isReadOnly: boolean): void; - } - - class editor extends event { - readonly activeEnterMode: number; - readonly activeFilter: filter; - readonly activeShiftEnterMode: number; - readonly blockless: boolean; - readonly config: config; - readonly container: dom.element; - readonly contextMenu: plugins.contextMenu; - copyFormatting: plugins.copyformatting.state; - dataProcessor: dataProcessor; - readonly document: dom.document; - readonly element: dom.element; - readonly elementMode: number; - readonly enterMode: number; - readonly filter: filter; - readonly focusManager: focusManager; - readonly id: string; - readonly keystrokeHandler: keystrokeHandler; - readonly lang: any; - readonly langCode: string; - readonly mode: string; - readonly name: string; - readonly pasteFilter: filter; - readonly plugins: any; - readonly readOnly: boolean; - readonly shiftEnterMode: number; - readonly status: string; - readonly tabIndex: number; - readonly templates: any; - readonly title: any; - readonly toolbar: any; - readonly ui: ui; - readonly widgets: plugins.widget.repository; - readonly window: dom.window; - - constructor(instanceConfig?: config, element?: dom.element, mode?: number); - addCommand(commandName: string, commandDefinition: commandDefinition): void; - addContentsCss(cssPath: string): void; - addFeature(feature: feature): boolean; - addMenuGroup(name: string, order?: number): void; - addMenuItem(name: string, definition?: IMenuItemDefinition): void; - addMenuItems(definitions: { [id:string]: IMenuItemDefinition }): void; - addMode(mode: string, exec: () => void): void; - addRemoveFormatFilter(func: (element: dom.element) => boolean): void; - applyStyle(style: style): void; - attachStyleStateChange(style: style, callback: (state: number) => void): void; - checkDirty(): boolean; - createFakeElement(realElement: dom.element, className: string, realElementType: string, isResizable: boolean): void; - createFakeParserElement(realElement: dom.element, className: string, realElementType: string, isResizable: boolean): void; - createRange(): dom.range; - destroy(noUpdate?: boolean): void; - editable(elementOrEditable?: dom.element | editable): editable; - elementPath(startNode?: dom.node): dom.elementPath; - execCommand(commandName: string, data?: any): boolean; - extractSelectedHtml(toString?: boolean, removeEmptyBlock?: boolean): dom.documentFragment | string | void; - focus(): void; - forceNextSelectionCheck(): void; - getClipboardData(callbackOrOptions: { title: string } | ((data: any) => void), callback: (data: any) => void): void; - getColorFromDialog(callback: (color: string) => void, scope?: { [key: string]: any }): void; - getCommand(commandName: string): command; - getCommandKeystroke(command: command | string): number | null; - getData(internal: boolean): string; - getMenuItem(name: string): IMenuItemDefinition; - getResizable(forContents: boolean): dom.element; - getSelectedHtml(toString?: false): dom.documentFragment; - getSelectedHtml(toString: true): string; - getSelectedHtml(toString?: boolean): dom.documentFragment | string; - getSelection(forceRealSelection: boolean): dom.selection; - getSnapshot(): string; - getStylesSet(callback: (stylesDefinitions: style.definition[]) => void): void; - getUiColor(): string; - insertElement(element: dom.element): void; - insertHtml(html: string, mode?: string, range?: dom.range): void; - insertText(text: string): void; - loadSnapshot(snapshot: any): void; - lockSelection(sel?: dom.selection): boolean; - openDialog(dialogName: string, callback: () => void): dialog; - popup(url: string, width?: number | string, height?: number | string, options?: string): void; - removeMenuItem(name: string): void; - removeStyle(style: style): void; - resetDirty(): void; - resetUndo(): void; - resize(width: number | string, height: number | string, isContentHeight?: boolean, resizeInner?: boolean): void; - restoreRealElement(fakeElement: dom.element): dom.element; - selectionChange(checkNow?: boolean): void; - setActiveEnterMode(enterMode: number, shiftEnterMode: number): void; - setActiveFilter(filter: filter): void; - setData(data: string, options?: { internal?: boolean; callback?: () => void; noSnapshot?: boolean; }): void; - setKeystroke(keystroke: number, behavior: string | boolean): void; - setKeystroke(keystroke: [number, string | boolean][]): void; - setMode(newMode: string, callback: () => void): void; - setReadOnly(isReadOnly?: boolean): void; - setUiColor(color: string): void; - showNotification(message: string, type: plugins.notification.type, progressOrDuration: number): plugins.notification; - unlockSelection(restore?: boolean): void; - updateElement(): void; - } - - namespace editor { - interface eventObject { - activeEnterModeChange?: (evt: eventInfo) => void; - activeFilterChange?: (evt: eventInfo) => void; - afterCommandExec?: (evt: eventInfo) => void; - afterInsertHtml?: (evt: eventInfo) => void; - afterPaste?: (evt: eventInfo) => void; - afterPasteFromWord?: (evt: eventInfo) => void; - afterSetData?: (evt: eventInfo) => void; - afterUndoImage?: (evt: eventInfo) => void; - ariaEditorHelpLabel?: (evt: eventInfo) => void; - ariaWidget?: (evt: eventInfo) => void; - autogrow?: (evt: eventInfo) => void; - - beforeCommandExec?: (evt: eventInfo) => void; - beforeDestroy?: (evt: eventInfo) => void; - beforeGetData?: (evt: eventInfo) => void; - beforeModeUnload?: (evt: eventInfo) => void; - beforeSetMode?: (evt: eventInfo) => void; - beforeUndoImage?: (evt: eventInfo) => void; - blur?: (evt: eventInfo) => void; - - change?: (evt: eventInfo) => void; - configLoaded?: (evt: eventInfo) => void; - contentDirChanged?: (evt: eventInfo) => void; - contentDom?: (evt: eventInfo) => void; - contentDomInvalidated?: (evt: eventInfo) => void; - contentDomUnload?: (evt: eventInfo) => void; - customConfigLoaded?: (evt: eventInfo) => void; - - dataFiltered?: (evt: eventInfo) => void; - dataReady?: (evt: eventInfo) => void; - destroy?: (evt: eventInfo) => void; - dialogHide?: (evt: eventInfo) => void; - dialogShow?: (evt: eventInfo) => void; - dirChanged?: (evt: eventInfo) => void; - doubleclick?: (evt: eventInfo) => void; - dragend?: (evt: eventInfo) => void; - dragstart?: (evt: eventInfo) => void; - drop?: (evt: eventInfo) => void; - - elementsPathUpdate?: (evt: eventInfo) => void; - - fileUploadRequest?: (evt: eventInfo) => void; - fileUploadResponse?: (evt: eventInfo) => void; - floatingSpaceLayout?: (evt: eventInfo) => void; - focus?: (evt: eventInfo) => void; - - getData?: (evt: eventInfo) => void; - getSnapshot?: (evt: eventInfo) => void; - - insertElement?: (evt: eventInfo) => void; - insertHtml?: (evt: eventInfo) => void; - insertText?: (evt: eventInfo) => void; - instanceReady?: (evt: eventInfo) => void; - - key?: (evt: eventInfo) => void; - - langLoaded?: (evt: eventInfo) => void; - loadSnapshot?: (evt: eventInfo) => void; - loaded?: (evt: eventInfo) => void; - lockSnapshot?: (evt: eventInfo) => void; - maximize?: (evt: eventInfo) => void; - menuShow?: (evt: eventInfo) => void; - mode?: (evt: eventInfo) => void; - - notificationHide?: (evt: eventInfo) => void; - notificationShow?: (evt: eventInfo) => void; - notificationUpdate?: (evt: eventInfo) => void; - - paste?: (evt: eventInfo) => void; - pasteFromWord?: (evt: eventInfo) => void; - pluginsLoaded?: (evt: eventInfo) => void; - - readOnly?: (evt: eventInfo) => void; - removeFormatCleanup?: (evt: eventInfo) => void; - required?: (evt: eventInfo) => void; - resize?: (evt: eventInfo) => void; - - save?: (evt: eventInfo) => void; - saveSnapshot?: (evt: eventInfo) => void; - selectionChange?: (evt: eventInfo) => void; - setData?: (evt: eventInfo) => void; - stylesSet?: (evt: eventInfo) => void; - - template?: (evt: eventInfo) => void; - toDataFormat?: (evt: eventInfo) => void; - toHtml?: (evt: eventInfo) => void; - - unlockSnapshot?: (evt: eventInfo) => void; - updateSnapshot?: (evt: eventInfo) => void; - - widgetDefinition?: (evt: eventInfo) => void; - } - } - - namespace env { - var air: boolean; - var chrome: boolean; - var cssClass: string; - var edge: boolean; - var gecko: boolean; - var hc: boolean; - var hidpi: boolean; - var iOS: boolean; - var ie: boolean; - var isCompatible: boolean; - var mac: boolean; - var needsBrFiller: boolean; - var needsNbspFiller: boolean; - var quirks: boolean; - var safari: boolean; - var version: number; - var webkit: boolean; - - function secure(): boolean; - } - - class event { - static useCapture: boolean; - - constructor(); - capture(): void; - define(name: string, meta: { [key: string]: any }): void; - fire(eventName: string, data?: { [key: string]: any }, editor?: editor): any; - fireOnce(eventName: string, data?: { [key: string]: any }, editor?: editor): any; - hasListeners(eventName: string): boolean; - on(eventName: string, listenerFunction: (eventInfo: eventInfo) => void, scopeObj?: { [key: string]: any } | null, listenerData?: any, priority?: number): listenerRegistration; - once(eventName: string, listenerFunction: (eventInfo: eventInfo) => void, scopeObj?: { [key: string]: any } | null, listenerData?: any, priority?: number): listenerRegistration; - removeAllListeners(): void; - removeListener(eventName: string, listenerFunction: (eventInfo: eventInfo) => void): void; - - static implementOn(targetObject: { [key: string]: any }): void; - } - - interface eventInfo { - data: any; - editor: editor; - listenerData: any; - name: string; - sender: { [key: string]: any }; - - cancel(): void; - removeListener(): void; - stop(): void; - } - - interface feature { - allowedContent?: filter.allowedContentRules; - contentForms?: any; - contentTransformations?: any; - name?: string; - requiredContent?: string | style; - toFeature?: () => feature; - } - - namespace fileTools { - var isFileUploadSupported: boolean; - - function addUploadWidget(editor: editor, name: string, def: uploadWidgetDefinition): void; - function bindNotification(editor: editor, fileLoader: fileLoader): void; - function getUploadUrl(config: { [key: string]: any }, type?: string): string; - function isTypeSupported(file: Blob, supportedTypes: RegExp): boolean; - function markElement(element: dom.element, widgetName: string, loaderId: number): void; - - class fileLoader extends event { - readonly data: string; - readonly file: Blob; - readonly fileName: string; - readonly id: number; - readonly loaded: number; - readonly message: string; - readonly reader: FileReader; - readonly responseData: any; - status: string; - readonly total: number; - readonly uploadTotal: number; - readonly uploadUrl: string; - readonly uploaded: string; - readonly url: string; - readonly xhr: XMLHttpRequest; - - constructor(editor: editor, fileOrData: Blob | string, fileName?: string); - abort(): void; - isFinished(): boolean; - load(): void; - loadAndUpload(url: string, additionalRequestParameters?: any): void; - update(): void; - upload(url: string, additionalRequestParameters?: any): void; - } - - class uploadRepository extends event { - readonly loaders: fileLoader[]; - - constructor(editor: editor); - create(fileOrData: Blob | string, fileName: string, loaderType?: any): fileLoader; - isFinished(): boolean; - } - - interface uploadWidgetDefinition extends plugins.widget.definition { - additionalRequestParameters: any; - fileToElement: (pastedFile: any) => HTMLElement; - loadMethod: string; - loaderType: any; - onAbort: () => boolean; - onError: () => boolean; - onLoaded: () => boolean; - onUploaded: () => boolean; - onUploading: () => boolean; - replaceWith: () => any; - skipNotifications: boolean; - supportedTypes: string; - uploadUrl: string; - } - } - - module filter { - type allowedContentRule = string | style | { [key: string]: any}; - type allowedContentRules = allowedContentRule | allowedContentRule[]; - type contentRule = string | style; - type disallowedContentRules = string | { [key: string]: any}; - - interface transformation { - check?: string; - element?: string | style; - left?: (element: htmlParser.element | style) => boolean; - right: (element: htmlParser.element, tools: string | filter.transformationTools) => boolean; - } - - var transformationTools: transformationTools; - - interface transformationTools { - alignmentToAttribute(element: htmlParser.element): void; - alignmentToStyle(element: htmlParser.element): void; - lengthToAttribute(element: htmlParser.element, styleName: string, attrName?: string): void; - lengthToStyle(element: htmlParser.element, styleName: string, attrName?: string): void; - matchesTyle(element: htmlParser.element, style: style): void; - sizeToAttribute(element: htmlParser.element): void; - sizeToStyle(element: htmlParser.element): void; - splitBorderShorthand(element: htmlParser.element): void; - splitMarginShorthand(element: htmlParser.element): void; - transform(element: htmlParser.element, form: style | string): void; - } - } - - class filter { - readonly allowedContent: filter.allowedContentRules[]; - readonly customConfig: boolean; - readonly disabled: boolean; - readonly disallowedContent: any[]; - readonly editor: editor; - readonly elementCallbacks:((element: htmlParser.element) => number)[]; - readonly id: number; - - static instances: { [id: string]: filter }; - - constructor(editorOrRules: editor | filter.allowedContentRules); - addContentForms(forms: any[]): void; - addElementCallback(callback: (element: htmlParser.element) => number): void; - addFeature(feature: feature): boolean; - addTransformations(transformations: (string | filter.transformation)[][]): void; - allow(newRules: filter.allowedContentRules, featureName?: string, overrideCustom?: boolean): boolean; - applyTo(fragment: htmlParser.fragment | htmlParser.element, toHrml: boolean, transformOnly: boolean, enterMode: number): boolean; - check(test: filter.contentRule, applyTransformations?: boolean, strictCheck?: boolean): boolean; - checkFeature(feature: feature): boolean; - clone(): filter; - destroy(): void; - disable(): void; - disallow(newRules: filter.disallowedContentRules): void; - getAllowedEnterMode(defaultMode: number, reverse?: boolean): number; - } - - class focusManager { - currentActive: dom.domObject; - hasFocus: boolean; - - constructor(editor: editor); - add(element: dom.element, isCapture: boolean): void; - blur(noDelay?: boolean): void; - focus(currentActive?: dom.element): void; - lock(): void; - remove(element: dom.element): void; - unlock(): void; - } - - class htmlDataProcessor implements dataProcessor { - dataFilter: htmlParser.filter; - htmlFilter: htmlParser.filter; - writer: htmlParser.basicWriter; - - constructor(editor: editor); - toDataFormat(html: string, options?: string | { context?: string, filter?: filter, enterMode?: number }): string; - toHtml(data: string, options?: string | htmlDataProcessorOptions): string; - } - - interface htmlDataProcessorOptions { - context?: string; - fixForBody?: boolean; - filter?: filter; - dontFilter?: boolean; - enterMode?: number; - protectedWhitespaces?: boolean; - } - - namespace htmlParser { - class basicWriter { - constructor(); - attribute(attName: string, attValue: string): void; - closeTag(tagName: string): void; - comment(comment: string): void; - getHtml(reset: boolean): string; - openTag(tagName: string, attributes: { [key: string]: string }): void; - openTagClose(tagName: string, isSelfClose: boolean): void; - reset(): void; - text(text: string): void; - write(data: string): void; - } - - class cdata extends node { - constructor(value: string); - type: number; - writeHtml(writer: htmlParser.basicWriter): void; - } - - class comment extends node { - type: number; - value: string; - - constructor(value: string); - filter(filter: filter): boolean; - writeHtml(writer: htmlParser.basicWriter, filter?: htmlParser.filter): void; - } - - class cssStyle { - constructor(elementOrStyleText: htmlParser.element | string); - populate(obj: htmlParser.element | dom.element | { [key: string]: any}): void; - } - - class element extends node { - attributes: { [name: string]: string }; - children: htmlParser.node[]; - name: string; - type: number; - - constructor(name: string, attributes: { [name: string]: string }); - add(node: node, index?: number): void; - addClass(className: string): void; - clone(): element; - filter(filter: htmlParser.filter): boolean; - filterChildren(filter: htmlParser.filter): void; - find(criteria: string | ((el: htmlParser.node) => boolean), recursive?: boolean): htmlParser.node[]; - forEach(callback: (node: htmlParser.node) => void | boolean, type?: number, skipRoot?: boolean): void; - getFirst(condition: string | { [key: string]: string } | ((node: htmlParser.node) => boolean)): htmlParser.node; - getHtml(): string; - getOuterHtml(): string; - hasClass(className: string): boolean; - removeClass(className: string): void; - replaceWithChildren(): void; - setHtml(html: string): void; - split(index: number): htmlParser.element; - writeChildrenHtml(writer: htmlParser.basicWriter, filter?: htmlParser.filter): void; - writeHtml(writer: basicWriter, filter?: htmlParser.filter): void; - } - - class filter { - attributeNameRules: filterRulesGroup; - attributesRules: { [name: string]: filterRulesGroup }; - commentRules: filterRulesGroup; - elementNameRules: filterRulesGroup; - elementsRules: { [name: string]: filterRulesGroup }; - id: number; - rootRules: filterRulesGroup; - textRules: filterRulesGroup; - - constructor(rules?: filterRulesDefinition); - addRules(rules: filterRulesDefinition, options?: number | { priority?: number; applyToAll?: boolean; }): void; - applyTo(node: node): void; - } - - interface filterRulesDefinition { - elementNames: any; - attributeNames: any; - elements: any; - attributes: any; - text: any; - comment: any; - root: any; - } - - class filterRulesGroup { - rules: { value: rule, priority: number, option: ruleOptions }[]; - - add(rule: rule, priority: number, options: ruleOptions): void; - addMany(rules: { [key: string]: any }[], priority: number, options: ruleOptions): void; - exec(currentValue: htmlParser.node | htmlParser.fragment | string): htmlParser.node | htmlParser.fragment | string; - execOnName(currentName: string): string; - findIndex(priority: number): number; - } - - class fragment { - children: htmlParser.node[]; - parent: htmlParser.fragment; - readonly type: number; - - constructor(); - - add(node: htmlParser.node, index?: number): void; - filter(filter: htmlParser.filter): void; - filterChildren(filter: htmlParser.filter, filterRoot?: boolean): void; - forEach(callback: (node: htmlParser.node,) => void | boolean, type?: number, skipRoot?: boolean): void; - writeChildrenHtml(writer: basicWriter, filter?: htmlParser.filter, filterRoot?: boolean): void; - writeHtml(writer: basicWriter, filter?: htmlParser.filter): void; - - static fromBBCode(source: string): htmlParser.fragment; - static fromHtml(fragmentHtml: string, parent?: htmlParser.element | string, fixingBlock?: string | boolean): fragment | htmlParser.element; - } - - class node { - constructor(); - getAscendant(condition: string | { [name: string]: string | ((node: htmlParser.element) => boolean)}): element; - getIndex(): number; - insertAfter(node: node): void; - insertBefore(node: node): void; - remove(): node; - replaceWith(node: node): void; - wrapWith(wrapper: element): element; - } - - type rule = ((value: htmlParser.node | htmlParser.fragment | string) => boolean) | [ string, string ]; - - interface ruleOptions { - applyToAll?: boolean, - excludeNestedEditable?: boolean - } - - class text extends node { - constructor(value: string); - type: number; - filter(filter: filter): boolean; - writeHtml(writer: basicWriter, filter?: filter): void; - } - } - - class htmlWriter extends htmlParser.basicWriter { - indentationChars: string; - lineBreakChars: string; - selfClosingEnd: string; - - indentation(): void; - lineBreak(): void; - setRules(tagName: string, rules: { [key: string]: any }): void; - } - - class keystrokeHandler { - blockedKeystrokes: { [key: number]: string | boolean }; - keystrokes: { [key: number]: string | boolean }; - - constructor(editor: editor); - - attach(domObject: dom.domObject): void; - } - - namespace lang { - var languages: { [code: string]: number }; - var rtl: { [code: string]: number }; - - function detect(defaultLanguage: string, probeLanguage?: string): string; - function load(languageCode: string, defaultLanguage: string, callback: (code: string, entries: any) => void): void; - } - - namespace loader { - var loadedScripts: string[]; - var scripts: string[]; - - function load(scriptName: string, defer?: boolean): void; - function loadPending(): void; - } - - class menu { - constructor(); - - add(item: any): void; - addListener(listenerFn: (startElement: dom.element, selection: dom.selection, path: dom.elementPath) => any): void; - findItemByCommandName(commandName: string): { item: any, element: dom.element }; - hide(returnFocus?: boolean): void; - removeAll(): void; - show(offsetParent: dom.element, corner?: number, offsetX?: number, offsetY?: number): void; - } - - interface pluginDefinition { - hidpi?: boolean; - lang?: string | string[]; - requires?: string | string[]; - - afterInit?(editor: editor): any; - beforeInit?(editor: editor): any; - init?(editor: editor): void; - onLoad?(): any; - } - - namespace plugins { - - namespace cloudservices { - class cloudServicesLoader extends fileTools.fileLoader { - customToken: string; - - constructor(editor: editor, fileOrData: Blob | string, fileName?: string, token?: string); - loadAndUpload(url?: string, additionalRequestParameters?: any): void; - upload(url?: string, additionalRequestParameters?: any): void; - } - } - - class autoEmbed { - getWidgetDefinition(editor: editor, url: string): widget.definition; - } - - namespace balloontoolbar { - const PRIORITY: { [pri: string]: number }; - - class context { - editor: editor; - options: contextDefinition; - toolbar: ui.balloonToolbar; - - constructor(editor: editor, options: contextDefinition); - destroy(): void; - hide(): void; - refresh(): void; - show(pointedElement?: dom.element): void; - } - - interface contextDefinition { - cssSelector?: string; - priority?: number; - widgets?: string[] | string; - - refresh?: (editor: editor, path: dom.elementPath, selection: dom.selection) => dom.element; - } - - class contextManager { - editor: editor; - - constructor(editor: editor); - add(context: context): void; - check(selection?: dom.selection): void; - create(options: contextDefinition): context; - destroy(): void; - hide(): void; - } - } - - namespace clipboard { - const isCustomCopyCutSupported: boolean; - const isCustomDataTypesSupported: boolean; - const isFileApiSupported: boolean; - const mainPasteEvent: string; - - function addPasteButton(editor: editor, name: string, definition: { [key: string]: any}): void; - function canClipboardApiBeTrusted(dataTransfer: dataTransfer, editor: editor): boolean; - function getDropTarget(editor: editor): dom.domObject; - function getRangeAtDropPosition(domEvent: Event, editor: editor): dom.range; - function initDragDataTransfer(evt?: dom.event, editor?: editor): void; - function initPasteDataTransfer(evt?: dom.event, sourceEditor?: editor): void; - function preventDefaultDropOnElement(element: dom.element): void; - function resetDragDataTransfer(): void; - - class dataTransfer { - readonly $: DataTransfer; - readonly id: string; - readonly sourceEditor: editor; - - constructor(nativeDataTransfer?: DataTransfer, editor?: editor); - cacheData(): void; - getData(type: string, getNative?: boolean): string; - getFile(i: number): File; - getFilesCount(): number; - getTransferType(targetEditor: editor): number; - isEmpty(): boolean; - setData(type: string, value: string): void; - storeId(): void; - } - - class fallbackDataTransfer { - constructor(dataTransfer: dataTransfer); - getData(type: string, getNative?: boolean): string; - isRequired(): boolean; - setData(type: string, value: string): string; - } - } - - namespace condesnippet { - function setHighlighter(highlighter: highlighter): void; - - class highlighter { - highlighter: (code: string, lang: string, callback: (highlightedCode: string) => void) => void; - init: (ready: () => void) => void; - languages: { [lang: string]: string }; - readonly queue: ((code: string, lang: string, callback: (highlightedCode: string) => void) => void)[]; - readonly ready: boolean; - - highlight(code: string, lang: string, callback: (highlightedCode: string) => void): void; - } - } - - class contextMenu extends menu { - constructor(editor: editor); - addTarget(element: dom.element, nativeContextMenuOnCtrl?: boolean): void; - open(offsetParent: dom.element, corner?: number, offsetX?: number, offsetY?: number): void; - } - - namespace copyformatting { - var breakOnElements: string[]; - var elementsForInlineTransform: string[]; - var excludedAttributes: string[]; - var excludedAttributesFromInlineTransform: string[]; - var inlineBoundary: string[]; - var preservedElements: string[]; - - class state extends event { - editor: editor; - filter: filter; - sticky: boolean; - styles: style[]; - - constructor(editor: editor); - } - } - - namespace easyimage { - - } - - namespace embedBase { - function createWidgetBaseDefinition(editor: editor): baseDefinition; - - interface baseDefinition extends widget.definition { - providerUrl: template; - urlRegExp: RegExp; - - getErrorMessage(messageTypeOrMessage: string, url?: string, suffix?: string): string; - isUrlValid(url: string): boolean; - loadContent(url: string, callback?: () => void, errorCallback?: (error: string) => void, noNotifications?: boolean): request; - } - - interface request { - callback: () => void; - errorCallback: (error: string) => void; - response: { [key: string]: string }; - task: notificationAggregator.task; - url: string; - - cancel(): void; - } - } - - namespace image2 { - function checkHasNaturalRatio(image: dom.element): boolean; - function getLinkAttributesGetter(): (editor: editor, data: { [key: string]: string }) => { set: { [tag: string]: string }, removed: string[] }; - function getLinkAttributesParser(): (editor: editor, element: dom.element) => { [key: string]: string }; - function getNatural(image: dom.element): { [key: string]: string }; - } - - namespace imagebase { - var featuresDefinitions: { [key: string]: string }; - - function addFeature(editor: editor, name: string, definition: imageWidgetDefinition): imageWidgetDefinition; - function addImageWidget(editor: editor, name: string, definition: imageWidgetDefinition): void; - - interface imageWidgetDefinition extends widget.definition { - features: string[]; - upcast: string; - } - - class progressBar extends progressReporter { - bar: dom.element; - - constructor(); - - } - - class progressReporter { - wrapper: dom.element; - - constructor(wrapperHtml?: string); - aborted(): void; - bindLoader(loader: fileTools.fileLoader): void; - done(): void; - failed(): void; - remove(): void; - updated(progress: number): void; - } - } - - namespace indent { - function registerCommands(editor: editor, commands: { [key: string]: command} ): void; - - class genericDefinition implements commandDefinition { - async: boolean; - canUndo: boolean; - context: boolean; - contextSensitive: boolean; - editorFocus: boolean; - fakeKeystroke: number; - readonly isIndent: boolean; - modes: { [key: string]: any }; - readOnly: boolean; - startDisabled: boolean; - - exec(editor: editor, data?: any): boolean; - refresh?(editor: editor, path: dom.elementPath): void; - } - - class specificDefinition { - database: { [key: string]: any }; - readonly enterBr: boolean; - readonly indentKey: { [key: string]: any }; - readonly isIndent: boolean; - readonly jobs: { [priority: string]: { refresh: (editor: editor, path: dom.elementPath) => number, exec: (editor: editor) => boolean } }; - readonly relatedGlobal: { [key: string]: any }; - - execJob(editor: editor, priority: number): boolean; - getContext(node: dom.elementPath): dom.element; - refreshJob(editor: editor, priority: number): number; - } - } - - namespace indentList { - function firstItemInPath(query: string | string[] | { [tagName: string]: any} | dom.element | ((element: dom.element) => boolean)): boolean; - } - - namespace link { - // DEPRECATED 4.3.3 - const emptyAnchorFix: boolean; - - // DEPRECATED 4.3.3 - const fakeAnchor: boolean; - - // DEPRECATED 4.3.3 - const synAnchorSelector: boolean; - - function getEditorAnchors(editor: editor): dom.element[]; - function getLinkAttributes(editor: editor, data: { [key: string]: any}): { set: { [key: string]: string }, removed: string[] } - function getSelectedLink(editor: editor, returnMultiple?: boolean): dom.element | dom.element[]; - function parseLinkAttributes(editor: editor, element: dom.element): { [key: string]: any }; - function showDisplayTextForElement(element: dom.element, editor: editor): boolean; - function tryRestoreFakeAnchor(editor: editor, element: dom.element): dom.element; - } - - class list { - arrayToList(listArray: any, database: any, paragraphMode: any, dir: any): void; - listToArray(listNode: any, database: any, baseArray: any, baseIndentLevel: any, grandparentNode: any): void; - } - - class notification { - readonly area: notification.area; - readonly duration: number; - readonly editor: editor; - readonly element: dom.element; - readonly id: number; - readonly message: string; - readonly progress: number; - readonly type: notification.type; - - constructor(editor: editor, options: notification.options); - hide(): void; - isVisible(): boolean; - show(): void; - update(options: notification.updateOptions): void; - } - - namespace notification { - interface area { - readonly editor: editor; - readonly element: dom.element; - readonly notifications: notification[]; - - add(notification: notification): void; - remove(notification: notification): void; - } - - interface optionsBase { - duration?: number; - progress?: number; - type?: type; - } - - interface options extends optionsBase { - message: string; - } - - interface updateOptions extends optionsBase { - message?: string; - important?: boolean; - } - - type type = 'info' | 'warning' | 'success' | 'progress'; - } - - class notificationAggregator extends event { - readonly editor: editor; - readonly notification: notification; - - constructor(editor: editor, message: string, singularMessage?: string); - createTask(options?: { weight?: number }): notificationAggregator.task; - getDoneTaskCount(): number; - getPercentage(): number; - getTaskCount(): number; - isFinished(): boolean; - update(): void; - } - - namespace notificationAggregator { - class task extends event { - constructor(weight?: number); - cancel(): void; - done(): void; - isCanceled(): boolean; - isDone(): boolean; - update(weight: number): void; - } - } - - namespace pastefromword { - class lists { - numbering: lists.numbering; - } - - namespace lists { - class numbering { - getStyle(marker: string): string; - toNumber(marker: string, markerType: string): number; - } - } - - class styles { - pushStylesLower(element: htmlParser.element, exceptions: { [style: string]: boolean }, wrapText?: boolean ): boolean; - } - } - - namespace tableselection { - function getCellsBetween(first: dom.element, last: dom.element): dom.element[]; - } - - namespace widget { - var WRAPPER_CLASS_PREFIX: string; - - function getNestedEditable(guard: dom.element, node: dom.node): dom.element; - function isDomDragHandler(node: dom.node): boolean; - function isDomDragHandlerContainer(node: dom.node): boolean; - function isDomNestedEditable(node: dom.node): boolean; - function isDomWidget(node: dom.node): boolean; - function isDomWidgetElement(node: dom.node): boolean; - function isDomWidgetWrapper(node: dom.node): boolean; - function isParserWidgetElement(node: dom.node): boolean; - function isParserWidgetWrapper(node: dom.node): boolean; - - namespace nestedEditable { - interface definition { - allowedContent?: filter.allowedContentRules; - disallowedContent?: filter.disallowedContentRules; - pathName?: string; - selector?: string; - } - } - - class nestedEditable extends dom.element { - readonly editor: editor; - readonly enterMode: number; - readonly filter: filter; - readonly shiftEnterMode: number; - - constructor(editor: editor, element: dom.element, config: { filter?: filter }); - getData(): string; - setData(data: string): void; - } - - - interface definition extends feature { - button?: string; - data?: (evt: eventInfo) => void; - defaults?: { [key: string]: any }; - dialog?: string; - downcast?: string | ((element: htmlParser.element) => void); - downcasts?: { [key: string]: any }; - draggable?: boolean; - edit?: () => void; - editables?: { [key: string]: any }; - getLabel?: () => any; - init?: () => void; - inline?: boolean; - insert?: () => void; - mask?: boolean; - parts?: { [key: string]: any }; - pathName?: string; - styleToAllowedContentRules?: (style: style) => filter.allowedContentRules; - styleableElements?: string; - template?: string | template; - upcast?: string | ((element: htmlParser.element, data: any) => boolean); - upcastPriority?: number; - upcasts?: { [key: string]: any }; - } - - class repository extends event { - readonly editor: editor; - readonly focused: widget; - readonly instances: { [id: string]: widget }; - readonly registered: { [name: string]: definition }; - readonly selected: widget[]; - readonly widgetHoldingFocusedEditable: widget; - - add(name: string, widgetDef: plugins.widget.definition): void; - addUpcastCallback(callback: (element: htmlParser.element, data: any) => boolean): void; - checkSelection(): void; - checkWidgets(options?: { initOnlyNew?: boolean; focusInited?: boolean }): void; - del(widget: plugins.widget): void; - destroy(widget: plugins.widget, offline?: boolean): void; - destroyAll(offline?: boolean): void; - finalizeCreation(container: any): void; - getByElement(element: any, checkWrapperOnly: boolean): plugins.widget; - initOn(element: dom.element, widgetDef?: plugins.widget.definition, startupData?: { [key: string]: any }): plugins.widget; - initOn(element: dom.element, widgetDef?: string, startupData?: { [key: string]: any }): plugins.widget; - initOnAll(container?: dom.element): plugins.widget[]; - parseElementClasses(classes: string): any; - wrapElement(element: any, widgetName?: string): any; - } - - class widgetselection { - addFillers(editable: editable): boolean; - removeFillers(editable: editable): void; - } - } - - class widget extends event implements widget.definition { - readonly dataReady: boolean; - readonly definition: plugins.widget.definition; - readonly editor: editor; - readonly element: dom.element; - readonly focusedEditable: plugins.widget.nestedEditable - readonly id: number; - readonly inited: boolean; - readonly ready: boolean; - readonly repository: plugins.widget.repository; - readonly wrapper: dom.element; - - constructor(widgetsRepo: plugins.widget.repository, id: number, element: dom.element, widgetDef: plugins.widget.definition, starupData?: any); - - addClass(className: string): void; - applyStyle(style: style): void; - checkStyleActive(style: style): boolean; - destroy(offline?: boolean): void; - destroyEditable(editableName: string, offline?: boolean): void; - edit(): boolean; - focus(): void; - getClasses(): any; - hasClass(className: string, Whether: boolean): void; - initEditable(editableName: string, definition: plugins.widget.nestedEditable.definition): boolean; - isInited(): boolean; - isReady(): boolean; - removeClass(className: string): void; - removeStyle(style: style): void; - setData(keyOrData: any, value: any): plugins.widget; - setFocused(selected: boolean): plugins.widget; - setSelected(selected: boolean): plugins.widget; - updateDragHandlerPosition(): void; - } - - function add(name: string, definition: pluginDefinition): void; - function add(name: string): void; - function addExternal(name: string, path: string, fileName?: string): void; - function get(name: string): any; - function getFilePath(name: string): string; - function getPath(name: string): string; - function load(name: string, callback: (plugins: string[]) => void, scope?: { [key: string]: any }): void; - function setLang(pluginName: string, languageCode: string, languageEntries: any): void; - var registered: {[key: string]: pluginDefinition}; - } - - class resourceManager { - basePath: string; - externals: { [key: string]: any }; - fileName: string; - loaded: { [key: string]: any }; - registered: { [key: string]: any }; - - constructor(basePath: string, fileName: string); - add(name: string, definition?: pluginDefinition): void; - addExternal(names: string, path: string, fileName?: string): void; - get(name: string): pluginDefinition; - getFilePath(name: string): string; - getPath(name: string): string; - load(name: string | string[], callback: (loaded: string[]) => void, scope?: { [key: string]: any }): void; - } - - // see https://docs.com/ckeditor4/latest/api/CKEDITOR_scriptLoader.html - namespace scriptLoader { - function load(scriptUrls: string | string[], callback: (succeededUrls: boolean | string[], failedUrls?: string[]) => void, scope?: any, showBusy?: boolean): void; - function queue(scriptUrl: string, callback?: (succeeded: boolean) => void): void; - } - - namespace skin { - var icons: { [name: string]: { path: string } }; - var name: string; - var ua: { [name: string]: any }; - - function addIcon(name: string, path: string, offset?: number, bgsize?: string): void; - function chameleon(editor: string, part: string): void; - function getIconStyle(name: string, rtl?: boolean, overridePath?: number, overrideBgsize?: string): any; - function getPath(part: string): any; - function loadPart(part: string, fn: () => void): void; - function path(): string; - } - - namespace style { - function addCustomHandler(defintion: customHandler): style; - function getStyleText(style: definition): string; - - namespace customHandlers { - class widget extends style { - group: any[]; - widget: string; - checkElement(element: dom.element): boolean; - getClassesArray(): string[]; - getDefintion(): definition; - removeStylesFromSameGroup(editor: editor): boolean; - } - } - - interface definition { - attributes?: { [att: string]: string }, - element: string, - name?: string, - styles?: { [att: string]: string }, - type?: string | number - } - - interface customHandler { - type: string | number; - setup?: (style: definition) => void; - assignedTo?: number; - } - } - - class style { - alwaysRemoveElement: boolean; - includeReadonly: boolean; - constructor(styleDefinition: style.definition, variableValues: any); - apply(editor: editor): void; - applyToObject(element: dom.element, editor: editor): void; - applyToRange(range: Range, editor: editor): void; - buildPreview(label?: string): string; - checkActive(elementPath: dom.elementPath, editor: editor): boolean; - checkApplicable(elementPath: dom.elementPath, editor: editor, filter?: filter): boolean; - checkElementMatch(element: dom.element, fullMatch: boolean, editor: editor): boolean; - checkElementRemovable(element: dom.element, fullMatch: boolean, editor: editor): boolean; - getDefintion(): style.definition; - remove(editor: editor): void; - removeFromRange(range: Range, editor: editor): void; - toAllowedContentRules(editor?: editor): filter.allowedContentRules; - } - - class styleCommand { - constructor(style: style, ext?: any); - exec(editor: editor): void; - } - - var stylesSet: resourceManager; - - class template { - readonly source: string; - - constructor(source: string); - output(data: any, buffer?: any[]): string | number; - } - - namespace tools { - function addFunction(fn: () => any, scope?: any): number; - function arrayCompare(arrayA: any[], arrayB: any[]): boolean; - function clone(source: { [key: string]: any }): { [key: string]: any }; - function copy(source: { [key: string]: any }): { [key: string]: any }; - function createClass(definition: { [key: string]: any }): any; - function cssStyleToDomStyle(cssName: string): string; - function cssVendorPrefix(property: string, value: string, asString?: boolean): { [cssClass: string]: string | number }; - function defer(fn: T): T; - function enableHtml5Elements(doc: Document | DocumentFragment, withAppend?: boolean): void; - function escapeCss(selector: string): string; - function eventsBuffer(minInterval: number, output: () => void, scopeObj: any): { input: () => void, reset: () => void }; - function extend(target: { [key: string]: any }, source: { [key: string]: any }, overwrite: boolean, properties: { [key: string]: any }): { [key: string]: any }; - function fixDomain(): boolean; - function genKey(subKey: string): string; - function getCookie(name: string): string; - function getCsrfToken(): string; - function getIndex(array: T[], compareFunction: (element: T) => boolean): number; - function getMouseButton(evt: dom.event): boolean; - function getNextId(): string; - function getNextNumber(): number; - function getUniqueId(): string; - function htmlDecode(text: string): string; - function htmlDecodeAttr(text: string): string; - function htmlEncode(text: string): string; - function htmlEncodeAttr(text: string): string; - function indexOf(array: T[], value: T | ((el: T) => boolean)): number; - function isArray(object: any): object is T[]; - function isEmpty(object: { [key: string]: any }): boolean; - function keystrokeToArray(lang: { [key: string]: any }, keystroke: number): { display: string[], aria: string[] }; - function keystrokeToString(lang: { [key: string]: any }, keystroke: number): { display: string, aria: string }; - function ltrim(str: string): string; - function normalizeCssText(styleText: string, nativeNormalize: boolean): string; - function normalizeHex(styleText: string): string; - function objectCompare(left: { [key: string]: any }, right: { [key: string]: any }, onlyLef?: boolean): boolean; - function objectKeys(obj: { [key: string]: any }): string[]; - function override(originalFunction: T, functionBuilder: (originalFunction: T) => T): T; - function parseCssText(styleText: string, normalize?: boolean, nativeNormalize?: boolean): { [key: string]: any }; - function prototypedCopy(source: { [key: string]: any }): { [key: string]: any }; - function removeFunction(ref: number): void; - function repeat(str: string, times: number): string; - function rtrim(str: string): string; - function search(array: T[], value: T | ((element: T) => boolean)): T; - function setCookie(name: string, value: string): void; - function setTimeout(func: Function, milliseconds?: number, scope?: { [key: string]: any }, args?: any, ownerWindow?: Window): number; - function transformPlainTextToHtml(text: string, etnerMode: number): string; - function trim(str: string): string; - function tryThese(fn: Function[]): any; - function writeCssText(styles: { [key: string]: any }, sort?: boolean): string; - - namespace array { - function every(array: T[], fn: (value: T, index: number, array: T[]) => boolean, thisArg?: { [key: string]: any }): boolean; - function filter(array: T[], fn: (value: T, index: number, array: T[]) => boolean, thisArg?: { [key: string]: any }): T[]; - function forEach(array: T[], fn: (value: T, index: number, array: T[]) => void, thisArg?: { [key: string]: any }): void; - function isArray(object: any): boolean; - function map(array: T[], fn: (value: T) => K, thisArg?: { [key: string]: any }): K[]; - function reduce(array: T[], fn: (accumulator: K, a: T, index: number, array: T[]) => K, initial: K, thisArg?: { [key: string]: any }): K; - } - - namespace object { - function findKey(obj: { [key: string]: any }, value: any): string; - function merge(obj1: { [key: string]: any }, obj2: { [key: string]: any }): { [key: string]: any }; - } - - namespace style { - namespace parse { - function background(value: string): { color: string, unprocessed: string}; - function border(value: string): { width: string, style: string, color: string }; - function margin(value: string): { top: number, right: number, bottom: number, left: number }; - } - } - } - - class ui extends event { - constructor(editor: editor); - add(name: string, type: { [key: string]: any }, definition: { [key: string]: any }): void; - addButton(name: string, definition: buttonDefinition): void; - addHandler(type: { [key: string]: any }, handler: { [key: string]: any }): void; - addRichCombo(name: string, definition: { [key: string]: any }): void; - addToolbarGroup(name: string, previous: number | string, subgroupOf?: string): void; - create(name: string): { [key: string]: any }; - get(name: string): { [key: string]: any }; - space(name: string): dom.element; - spaceId(name: string): string; - } - - namespace ui { - namespace dialog { - class button extends uiElement { - constructor(dialog: dialog, elementDefinition: definitions.button, htmlList: any[]); - - accessKeyDown(): void; - accessKeyUp(): void; - click(): any; - } - - class checkbox extends uiElement { - constructor(dialog: dialog, elementDefinition: definitions.checkbox, htmlList: any[]); - - accessKeyUp(): void; - getValue(): boolean; - setValue(checked: boolean, noChangeEvent: boolean): undefined; - } - - namespace definitions { - interface button { - label: string; - disabled?: boolean; - } - - interface checkbox { - checked?: boolean; - validate?: () => boolean; - label?: string; - } - - interface fieldSet { - label?: string; - children: any[]; - } - - interface file { - validate?: () => boolean; - } - - interface fileButton { - for: string; - validate?: () => boolean; - } - - interface hbox { - widths?: string[]; - height?: string; - padding?: string; - align?: string; - } - - interface html { - html: string; - } - - interface iframeElement { - src: string; - width: string; - height: string; - onContentLoad?: () => void; - } - - interface labeledElement { - label: string; - labelLayout?: 'horizontal' | 'vertical'; - widths?: [ string, string ]; - role?: string; - includeLabel?: boolean; - } - - interface radio { - default: any; - validate?: () => boolean; - items: ([string, string] | [string])[]; - } - - interface select { - default: any; - validate?: () => boolean; - items: ([string, string] | [string])[]; - multiple?: boolean; - size?: number; - } - - interface textarea { - rows?: number; - cols?: number; - default?: string; - validate?: () => boolean; - } - - interface textInput { - default?: string; - validate?: () => boolean; - maxLength?: number; - size?: string; - } - - interface uiElement { - id: string; - type: number; - title?: string; - hidden?: boolean; - className?: string; - style?: string; - accessKey?: string; - } - - interface vbox { - width?: string; - heights?: string[]; - align?: string; - padding?: string; - expand?: boolean; - } - } - - class fieldset extends uiElement { - constructor(dialog: dialog, childObjList: any[], childHtmlList: any[], htmlList: any[], elementDefinition: definitions.fieldSet); - } - - - class file extends ui.dialog.labeledElement { - constructor(dialog: dialog, elementDefinition: definitions.file, htmlList: any[]); - - getAction(): string; - registerEvents(definition: { [key: string]: any }): file; - reset(): void; - setInitValue(): void; - submit(): file; - } - - - class fileButton extends button { - constructor(dialog: dialog, elementDefinition: definitions.fileButton, htmlList: any[]); - } - - - class hbox extends uiElement { - constructor(dialog: dialog, childObjList: any[], childHtmlList: any[], htmlList: any[], elementDefinition: definitions.hbox); - - getChild(indices: number): ui.dialog.uiElement; - getChild(indices: number[]): ui.dialog.uiElement[]; - } - - - class html extends uiElement { - constructor(dialog: dialog, elementDefinition: definitions.html, htmlList: any[]); - - } - - - class iframeElement extends uiElement { - - } - - - class labeledElement extends uiElement { - constructor(dialog: dialog, elementDefinition: definitions.labeledElement, htmlList: any[], contentHtml: () => string); - - getLabel(): string; - setlabel(label: string): ui.dialog.labeledElement; - } - - - class radio extends ui.dialog.labeledElement { - constructor(dialog: dialog, elementDefinition: definitions.radio, htmlList: any[]); - - accessKeyUp(): void; - getValue(): string; - setValue(value: string, noChangeEvent: boolean): undefined; - } - - - class select extends uiElement { - constructor(dialog: dialog, elementDefinition: definitions.select, htmlList: any[]); - - add(label: string, value?: string, indexedDB?: number): select; - clear(): select; - remove(index: number): select; - } - - - class textarea extends labeledElement { - constructor(dialog: dialog, elementDefinition: definitions.textarea, htmlList: any[]); - } - - - class textInput extends ui.dialog.labeledElement { - constructor(dialog: dialog, elementDefinition: definitions.textInput, htmlList: any[]); - - accessKeyUp(): void; - focus(): undefined; - getDirectionMarker(): string; - getValue(): string; - select(): void; - setDirectionMarker(dir: string): void; - setValue(value: string, noChangeEvent: boolean): textInput; - } - - class uiElement { - eventProcessors: any; - - constructor(dialog: dialog, elementDefinition: definitions.uiElement, htmlList: any[], nodeNameArg?: () => string | string, stylesArg?: () => { [key: string]: any } | { [key: string]: any }, attributesArg?: () => { [key: string]: any } | { [key: string]: any }, contentsArg?: () => { [key: string]: any } | string); // Not sure that the htmlList array type is right. - - accessKeyDown(dialog: dialog, key: string): void; - accessKeyUp(dialog: dialog, key: string): void; - disable(): void; - enable(): void; - focus(): ui.dialog.uiElement; - getDialog(): dialog; - getElement(): dom.element; - getInputElement(): dom.element; - getValue(): any; - isChanged(): boolean; - isEnabled(): boolean; - isFocusable(): boolean; - isVisible(): boolean; - registerEvents(definition: CKEDITOR.dialog.definition.uiElement): ui.dialog.uiElement; - selectParentTab(): ui.dialog.uiElement; - setValue(value: any, noChangeEvent: boolean): ui.dialog.uiElement; - } - - class vbox extends hbox { - constructor(dialog: dialog, childObjList: any[], childHtmlList: any[], htmlList: any[], elementDefinition: definitions.vbox); - } - } - - class balloonPanel { - activeShowListeners: { [id: number]: { removeListener: listenerRegistration }}; - editor: editor; - focusables: { [id: number]: dom.element }; - height: string; - parts: balloonPanel.parts; - rect: balloonPanel.rect; - showListeners: { [id: number]: () => listenerRegistration }; - templateDefinitions: balloonPanel.templateDefinitions; - templates: balloonPanel.templates; - triangleHeight: number; - triangleMinDistance: number; - triangleWidth: number; - width: number; - - activeShowListener(id: number): void; - activateShowListeners(): void; - addShowListener(listener: () => listenerRegistration): listenerRegistration; - attach(element: dom.element, options?: dom.element | boolean | { focusElement?: dom.element | boolean, show?: boolean }): void; - blur(): void; - build(): void; - deactivateShowListener(id: number): void; - deregisterFocusable(element: dom.element): void; - destroy(): void; - getHeight(): number; - getWidth(): number; - hide(): void; - move(top: number, left: number): void; - registerFocusable(element: dom.element): void; - removeShowListener(id: number): void; - resize(width: number, height: number): void; - setTitle(title: string): void; - setTriangle(side: 'left' | 'right' | 'top' | 'bottom'): void; - show(): void; - } - - namespace balloonPanel { - interface definition { - content?: string; - title?: string; - } - - interface templates { - close?: template; - content?: template; - panel?: template; - title?: template; - triangle?: template; - triangleInner?: template; - triangleOuter?: template; - } - - interface templateDefinitions { - close?: string; - content?: string; - panel?: string; - title?: string; - triangle?: string; - triangleInner?: string; - triangleOuter?: string; - } - - interface rect { - height?: number; - left?: number; - top?: number; - visible?: boolean; - width?: number; - } - - interface parts { - close?: dom.element; - content?: dom.element; - panel?: dom.element; - title?: dom.element; - triangle?: dom.element; - triangleInner?: dom.element; - triangleOuter?: dom.element; - } - } - - class balloonToolbar { - constructor(editor: editor, definition: { [key: string]: any }); - addItem(name: string, element: button | richCombo): void; - addItems(elements: { [itemName: string]: button | richCombo }): void; - deleteItem(name: string): void; - destroy(): void; - getItem(name: string): button | richCombo; - hide(): void; - refresh(): void; - show(): void; - } - - class button { - static readonly handler: handlerDefinition