From 057754cfd31cf552d2617769667109a7441761ca Mon Sep 17 00:00:00 2001 From: aj-r Date: Sat, 23 Dec 2017 12:34:07 -0500 Subject: [PATCH 001/100] 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/100] 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/100] 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 1e7f4242377340083bb988f6cbc58869b603d44a Mon Sep 17 00:00:00 2001 From: AJ Richardson Date: Thu, 3 May 2018 21:22:50 -0400 Subject: [PATCH 004/100] 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 005/100] 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 006/100] #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 007/100] #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 008/100] #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 009/100] 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 010/100] 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 2016139475410827edcbbbcc17d6794e14c65bee Mon Sep 17 00:00:00 2001 From: Zev Spitz Date: Thu, 10 May 2018 16:37:44 +0200 Subject: [PATCH 011/100] 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 012/100] 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 013/100] 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 2341c608c142049274d331fff83bbe0ce878ab56 Mon Sep 17 00:00:00 2001 From: Zev Spitz Date: Fri, 11 May 2018 02:58:34 +0200 Subject: [PATCH 014/100] 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 015/100] 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 016/100] 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 017/100] 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 018/100] 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 019/100] 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 77b25f26c0448ab1c42d4b0b33a67d209c524502 Mon Sep 17 00:00:00 2001 From: Rodrigo Saboya Date: Fri, 11 May 2018 08:49:53 -0300 Subject: [PATCH 020/100] 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 021/100] 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 120a90e9670c7197fc0a2e5c83a62898c5c6114c Mon Sep 17 00:00:00 2001 From: Hugues Stefanski Date: Fri, 11 May 2018 20:27:08 +0200 Subject: [PATCH 022/100] 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 023/100] 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 024/100] 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 025/100] 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 026/100] 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 027/100] 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 028/100] 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 029/100] 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 030/100] 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 031/100] 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 032/100] 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 033/100] 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 034/100] 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 035/100] 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 036/100] 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 037/100] 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 038/100] 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 039/100] 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 72ade1444e92dfca78d412c4465d171e214e449b Mon Sep 17 00:00:00 2001 From: Hugues Stefanski Date: Sun, 13 May 2018 12:14:28 +0200 Subject: [PATCH 040/100] 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 041/100] 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 042/100] 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 043/100] 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 044/100] 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 045/100] 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 046/100] 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 047/100] @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 2f1d5dc21fa486a29f141df9ca24721356c77047 Mon Sep 17 00:00:00 2001 From: Muhammad Fawwaz Orabi Date: Mon, 14 May 2018 23:00:21 +0300 Subject: [PATCH 048/100] 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 7640f36d26142183ef124f3edd3505303829fb63 Mon Sep 17 00:00:00 2001 From: Muhammad Fawwaz Orabi Date: Mon, 14 May 2018 23:14:07 +0300 Subject: [PATCH 049/100] 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 7a2fa0a98e77583e9dde205a0c8c07f68e3f79ba Mon Sep 17 00:00:00 2001 From: Carson Howard Date: Mon, 14 May 2018 15:11:22 -0700 Subject: [PATCH 050/100] 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 051/100] 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 e79a26e4b5324b44a621ec15803732b24ed100f2 Mon Sep 17 00:00:00 2001 From: Carson Howard Date: Mon, 14 May 2018 15:33:45 -0700 Subject: [PATCH 052/100] 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 053/100] 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 054/100] 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 f3eb7df93f86be3652cc69aaa04460e5e023fad4 Mon Sep 17 00:00:00 2001 From: Oliver Joseph Ash Date: Tue, 15 May 2018 08:32:09 +0100 Subject: [PATCH 055/100] 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 0f644a7cbe037901eb47e4aa0f9542f38a650308 Mon Sep 17 00:00:00 2001 From: Arylo Date: Tue, 15 May 2018 18:15:11 +0800 Subject: [PATCH 056/100] 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 2cdf91a8b37ab09161a74e98ca7fffd7d7b7daf8 Mon Sep 17 00:00:00 2001 From: Alan Plum Date: Tue, 15 May 2018 17:15:27 +0200 Subject: [PATCH 057/100] 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 058/100] 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 059/100] 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 c2cd90a611ffc174be0c29c17d0388d054a8bbc7 Mon Sep 17 00:00:00 2001 From: spacejack Date: Tue, 15 May 2018 23:54:12 -0400 Subject: [PATCH 060/100] 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 061/100] 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 ad76e164ab712acc5ac5c5ba5cca197d02b60cfc Mon Sep 17 00:00:00 2001 From: knegusen Date: Wed, 16 May 2018 08:48:24 +0200 Subject: [PATCH 062/100] 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 063/100] 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 abe1825055ff967255fa698b97a2fcac81b6c9b6 Mon Sep 17 00:00:00 2001 From: Edward Sammut Alessi Date: Wed, 16 May 2018 10:52:50 +0200 Subject: [PATCH 064/100] 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 065/100] 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 066/100] 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 067/100] 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 18f8612b62a88530c33d8444d9249c83f885867f Mon Sep 17 00:00:00 2001 From: Edward Sammut Alessi Date: Wed, 16 May 2018 11:36:12 +0200 Subject: [PATCH 068/100] 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 9abbb97f487ab233cbce02f82616fe58c5931a1a Mon Sep 17 00:00:00 2001 From: Thomas Gossmann Date: Wed, 16 May 2018 17:30:14 +0200 Subject: [PATCH 069/100] 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 ebb93d17ef6d9050deb943acf4ec7657db12734a Mon Sep 17 00:00:00 2001 From: Thomas Gossmann Date: Wed, 16 May 2018 22:35:16 +0200 Subject: [PATCH 070/100] 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 071/100] 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 1b2f3e2ba1dfac8dfe8ea5d34918e0960c653bf7 Mon Sep 17 00:00:00 2001 From: Ionut Botizan Date: Thu, 17 May 2018 09:24:41 +0300 Subject: [PATCH 072/100] [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 073/100] 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 ff0c5eb0c03b26f5928cef50132c50d92339c051 Mon Sep 17 00:00:00 2001 From: Nick Holloway Date: Thu, 17 May 2018 09:35:00 +0100 Subject: [PATCH 074/100] 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 63337ec9f8696a07ab2fa080925bebad7779e709 Mon Sep 17 00:00:00 2001 From: Anastasiia Antonova Date: Thu, 17 May 2018 17:06:30 +0700 Subject: [PATCH 075/100] "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 076/100] "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 077/100] "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 078/100] 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 079/100] 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 080/100] "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 502c045aef9f93c846a198e59efc8c55386f8d15 Mon Sep 17 00:00:00 2001 From: Thomas Gossmann Date: Thu, 17 May 2018 17:37:42 +0200 Subject: [PATCH 081/100] 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 082/100] @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 083/100] 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 084/100] 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 085/100] 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 086/100] 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 087/100] 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 088/100] 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 089/100] 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 e41d767e634d8b915f5d460aea27e2e3741a7815 Mon Sep 17 00:00:00 2001 From: Thomas Gossmann Date: Thu, 17 May 2018 20:01:51 +0200 Subject: [PATCH 090/100] 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 091/100] 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 d3285aecfbf49636899b85b69ef63d715db926c5 Mon Sep 17 00:00:00 2001 From: Jack Walters Date: Thu, 17 May 2018 14:43:30 -0700 Subject: [PATCH 092/100] 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 4ef613d9f91dc57cee0af83dd367cba1df5413cf Mon Sep 17 00:00:00 2001 From: Haroen Viaene Date: Fri, 18 May 2018 14:02:25 +0200 Subject: [PATCH 093/100] 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 094/100] 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 f65854486264a626b71000e8159e121a96f787e6 Mon Sep 17 00:00:00 2001 From: Chris Santero Date: Fri, 18 May 2018 11:54:26 -0400 Subject: [PATCH 095/100] [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 096/100] 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 097/100] 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 5bc9242a2116253c71c5871c130a655291298f95 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Fri, 18 May 2018 15:21:04 -0400 Subject: [PATCH 098/100] 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 099/100] 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 100/100] 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;