From 6f9c8eab6ed8451765eee36dfdb774cf9ecd011e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20M=C3=BCller?= Date: Fri, 21 Apr 2017 18:30:36 +0200 Subject: [PATCH 0001/1105] added import of definition file in test --- types/es6-shim/es6-shim-tests.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/es6-shim/es6-shim-tests.ts b/types/es6-shim/es6-shim-tests.ts index ed89d2ac35..b8834d3ab7 100644 --- a/types/es6-shim/es6-shim-tests.ts +++ b/types/es6-shim/es6-shim-tests.ts @@ -1,4 +1,4 @@ - +import './index' interface Point { x: number; y: number; } interface Point3D extends Point { z: number; } @@ -219,4 +219,4 @@ b = Reflect.preventExtensions(a); b = Reflect.set(a, s, a, a); b = Reflect.set(a, i, a, a); b = Reflect.set(a, sym, a, a); -b = Reflect.setPrototypeOf(a, a); \ No newline at end of file +b = Reflect.setPrototypeOf(a, a); From adc61a210d1c86a32f3d824f6d6386f6eb42882d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20M=C3=BCller?= Date: Fri, 21 Apr 2017 18:37:45 +0200 Subject: [PATCH 0002/1105] Fix "error TS2304: Cannot find name 'object'." with tsc 2.0.10 --- types/es6-shim/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/es6-shim/index.d.ts b/types/es6-shim/index.d.ts index 483f4357e0..179313246f 100644 --- a/types/es6-shim/index.d.ts +++ b/types/es6-shim/index.d.ts @@ -594,7 +594,7 @@ interface SetConstructor { declare var Set: SetConstructor; -interface WeakMap { +interface WeakMap { delete(key: K): boolean; get(key: K): V; has(key: K): boolean; @@ -602,8 +602,8 @@ interface WeakMap { } interface WeakMapConstructor { - new (): WeakMap; - new (iterable: IterableShim<[K, V]>): WeakMap; + new (): WeakMap; + new (iterable: IterableShim<[K, V]>): WeakMap; prototype: WeakMap; } From 316eb32560c7e0b2f2e9f536733e8c4c3b22456a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20M=C3=BCller?= Date: Fri, 21 Apr 2017 18:43:01 +0200 Subject: [PATCH 0003/1105] (Weak)Map.get(key) may return undefined - Enabled strictNullChecks - Intialized variables in test where needed --- types/es6-shim/es6-shim-tests.ts | 50 +++++++++++++++++--------------- types/es6-shim/index.d.ts | 4 +-- types/es6-shim/tsconfig.json | 4 +-- 3 files changed, 30 insertions(+), 28 deletions(-) diff --git a/types/es6-shim/es6-shim-tests.ts b/types/es6-shim/es6-shim-tests.ts index b8834d3ab7..60a0e9fb4b 100644 --- a/types/es6-shim/es6-shim-tests.ts +++ b/types/es6-shim/es6-shim-tests.ts @@ -4,28 +4,30 @@ interface Point { x: number; y: number; } interface Point3D extends Point { z: number; } let a: any; -let s: string; +let s: string = ''; let i: number; let b: boolean; -let f: () => void; +let f: () => void = () => {}; let o: Object; -let r: RegExp; -let sym: symbol; -let e: Error; +let r: RegExp = /a/; +let sym: symbol = {} as symbol; +let e: Error = new Error(); let date: Date; let key: PropertyKey; -let point: Point; -let point3d: Point3D; -let arrayOfPoint: Point[]; +let point: Point = { x: 1, y: 2 }; +let point3d: Point3D = { x: 1, y: 2, z: 3 }; +let point3dOrUndef: Point3D | undefined; +let pointOrUndef: Point | undefined; +let arrayOfPoint: Point[] = []; let arrayOfPoint3D: Point3D[]; let arrayOfSymbol: symbol[]; let arrayOfPropertyKey: PropertyKey[]; let arrayOfAny: any[]; let arrayOfStringAny: [string, any][]; -let arrayLikeOfAny: ArrayLike; -let iterableOfPoint: IterableShim; -let iterableOfStringPoint: IterableShim<[string, Point]>; -let iterableOfPointPoint3D: IterableShim<[Point, Point3D]>; +let arrayLikeOfAny: ArrayLike = []; +let iterableOfPoint: IterableShim = []; +let iterableOfStringPoint: IterableShim<[string, Point]> = []; +let iterableOfPointPoint3D: IterableShim<[Point, Point3D]> = []; let iterableIteratorOfPoint: IterableIteratorShim; let iterableIteratorOfNumberPoint: IterableIteratorShim<[number, Point]>; let iterableIteratorOfNumber: IterableIteratorShim; @@ -37,16 +39,16 @@ let iterableIteratorOfAny: IterableIteratorShim; let iterableIteratorOfPropertyKey: IterableIteratorShim; let iterableIteratorOfPropertyKeyPoint: IterableIteratorShim<[PropertyKey, Point]>; let nodeList: NodeList; -let pd: PropertyDescriptor; -let pdm: PropertyDescriptorMap; -let map: Map; -let set: Set; -let weakMap: WeakMap; -let weakSet: WeakSet; -let promiseLikeOfPoint: PromiseLike; -let promiseLikeOfPoint3D: PromiseLike; -let promiseOfPoint: Promise; -let promiseOfPoint3D: Promise; +let pd: PropertyDescriptor = {}; +let pdm: PropertyDescriptorMap = {}; +let map: Map = new Map(); +let set: Set = new Set(); +let weakMap: WeakMap = new WeakMap(); +let weakSet: WeakSet = new WeakSet(); +let promiseLikeOfPoint: PromiseLike = Promise.resolve(point); +let promiseLikeOfPoint3D: PromiseLike = Promise.resolve(point3d); +let promiseOfPoint: Promise = Promise.resolve(point); +let promiseOfPoint3D: Promise = Promise.resolve(point); let promiseOfArrayOfPoint: Promise; let promiseOfVoid: Promise; @@ -102,7 +104,7 @@ i = Math.cbrt(i); map.clear(); map.delete(s); map.forEach((value: Point, key: string) => { }); -point = map.get(s); +pointOrUndef = map.get(s); b = map.has(s); map = map.set(s, point); i = map.size; @@ -117,7 +119,7 @@ i = set.size; set = new Set(); set = new Set(iterableOfPoint); weakMap.delete(point); -point3d = weakMap.get(point); +point3dOrUndef = weakMap.get(point); b = weakMap.has(point); weakMap = weakMap.set(point, point3d); weakMap = new WeakMap(); diff --git a/types/es6-shim/index.d.ts b/types/es6-shim/index.d.ts index 179313246f..9543bf770c 100644 --- a/types/es6-shim/index.d.ts +++ b/types/es6-shim/index.d.ts @@ -556,7 +556,7 @@ interface Map { clear(): void; delete(key: K): boolean; forEach(callbackfn: (value: V, index: K, map: Map) => void, thisArg?: any): void; - get(key: K): V; + get(key: K): V | undefined; has(key: K): boolean; set(key: K, value?: V): Map; size: number; @@ -596,7 +596,7 @@ declare var Set: SetConstructor; interface WeakMap { delete(key: K): boolean; - get(key: K): V; + get(key: K): V | undefined; has(key: K): boolean; set(key: K, value?: V): WeakMap; } diff --git a/types/es6-shim/tsconfig.json b/types/es6-shim/tsconfig.json index 1243a36ddb..02c35aee5a 100644 --- a/types/es6-shim/tsconfig.json +++ b/types/es6-shim/tsconfig.json @@ -7,7 +7,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" @@ -20,4 +20,4 @@ "index.d.ts", "es6-shim-tests.ts" ] -} \ No newline at end of file +} From d063f5275781a5a0eb35080065edec961e233a83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20M=C3=BCller?= Date: Fri, 21 Apr 2017 20:05:25 +0200 Subject: [PATCH 0004/1105] =?UTF-8?q?Several=20fixes=20in=20tests,=20find(?= =?UTF-8?q?=E2=80=A6)=20may=20return=20`undefined`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - `Array.find()` may return `undefined` according to MDN - `Array.findIndex()` may *not* return undefined in contrast to the JSDoc -> fixed JSDoc - installed es6-shim ^0.34 (not newest as `Reflect.enumerate()` is removed since es6-shim 0.35) - include yarn.lock in Git for es6-shim - import es6-shim module for running tests using CommonJS syntax - --- types/es6-shim/.gitignore | 1 + types/es6-shim/es6-shim-tests.ts | 26 ++++++++++++++++++-------- types/es6-shim/index.d.ts | 5 ++--- types/es6-shim/package.json | 5 +++++ types/es6-shim/yarn.lock | 7 +++++++ 5 files changed, 33 insertions(+), 11 deletions(-) create mode 100644 types/es6-shim/.gitignore create mode 100644 types/es6-shim/package.json create mode 100644 types/es6-shim/yarn.lock diff --git a/types/es6-shim/.gitignore b/types/es6-shim/.gitignore new file mode 100644 index 0000000000..a59389a0ad --- /dev/null +++ b/types/es6-shim/.gitignore @@ -0,0 +1 @@ +!yarn.lock diff --git a/types/es6-shim/es6-shim-tests.ts b/types/es6-shim/es6-shim-tests.ts index 60a0e9fb4b..8f187e4d2b 100644 --- a/types/es6-shim/es6-shim-tests.ts +++ b/types/es6-shim/es6-shim-tests.ts @@ -1,11 +1,15 @@ -import './index' +declare const require: (module: string) => Object; +if (require !== null) { + require('es6-shim'); +} interface Point { x: number; y: number; } interface Point3D extends Point { z: number; } let a: any; let s: string = ''; -let i: number; +let i: number = 2; +let iOrUndef: number | undefined; let b: boolean; let f: () => void = () => {}; let o: Object; @@ -54,8 +58,8 @@ let promiseOfVoid: Promise; point = Object.assign(point, point); b = Object.is(point, point); -Object.setPrototypeOf(point, point); -point = arrayOfPoint.find(p => b); +Object.setPrototypeOf(point, {}); +pointOrUndef = arrayOfPoint.find(p => b); i = arrayOfPoint.findIndex(p => b); arrayOfPoint = arrayOfPoint.fill(point, i, arrayOfPoint.length); arrayOfPoint = arrayOfPoint.copyWithin(i, i, i); @@ -71,7 +75,7 @@ b = s.includes(s, i); b = s.endsWith(s, i); s = s.repeat(i); b = s.startsWith(s, i); -s = String.fromCodePoint(i, i); +s = String.fromCodePoint(2 as number, 3 as number); s = String.raw`abc`; s = r.flags; i = Number.EPSILON; @@ -186,6 +190,8 @@ promiseOfPoint = new Promise((resolve, reject) => resolve(point)); promiseOfPoint = new Promise((resolve, reject) => resolve(promiseOfPoint)); promiseOfPoint = new Promise((resolve, reject) => resolve(promiseLikeOfPoint)); promiseOfPoint = new Promise((resolve, reject) => reject(e)); +// To prevent UnhandledPromiseRejectionWarning +promiseOfPoint.catch(() => {}); promiseOfArrayOfPoint = Promise.all(arrayOfPoint); promiseOfArrayOfPoint = Promise.all(iterableOfPoint); promiseOfPoint = Promise.race(arrayOfPoint); @@ -195,7 +201,11 @@ promiseOfPoint = Promise.resolve(point3d); promiseOfPoint = Promise.resolve(promiseOfPoint); promiseOfPoint = Promise.resolve(promiseLikeOfPoint); promiseOfVoid = Promise.reject(e); +// To prevent UnhandledPromiseRejectionWarning +promiseOfVoid.catch(() => {}); promiseOfPoint = Promise.reject(e); +// To prevent UnhandledPromiseRejectionWarning +promiseOfPoint.catch(() => {}); a = Reflect.apply(f, a, arrayLikeOfAny); a = Reflect.construct(f, arrayLikeOfAny); b = Reflect.defineProperty(a, s, pd); @@ -205,9 +215,9 @@ b = Reflect.deleteProperty(a, s); b = Reflect.deleteProperty(a, i); b = Reflect.deleteProperty(a, sym); iterableIteratorOfAny = Reflect.enumerate(a); -a = Reflect.get(a, s, a); -a = Reflect.get(a, i, a); -a = Reflect.get(a, sym, a); +Reflect.get(a, s, a); +Reflect.get(a, i, a); +Reflect.get(a, sym, a); pd = Reflect.getOwnPropertyDescriptor(a, s); pd = Reflect.getOwnPropertyDescriptor(a, i); pd = Reflect.getOwnPropertyDescriptor(a, sym); diff --git a/types/es6-shim/index.d.ts b/types/es6-shim/index.d.ts index 9543bf770c..f310cfc231 100644 --- a/types/es6-shim/index.d.ts +++ b/types/es6-shim/index.d.ts @@ -185,11 +185,10 @@ interface Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: T, index: number, obj: Array) => boolean, thisArg?: any): T; + find(predicate: (value: T, index: number, obj: Array) => boolean, thisArg?: any): T | undefined; /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. + * Returns the index of the first element in the array where predicate is true, and -1 otherwise. * @param predicate find calls predicate once for each element of the array, in ascending * order, until it finds one where predicate returns true. If such an element is found, find * immediately returns that element value. Otherwise, find returns undefined. diff --git a/types/es6-shim/package.json b/types/es6-shim/package.json new file mode 100644 index 0000000000..f9a738c9e5 --- /dev/null +++ b/types/es6-shim/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "es6-shim": "0.34" + } +} diff --git a/types/es6-shim/yarn.lock b/types/es6-shim/yarn.lock new file mode 100644 index 0000000000..c45109041f --- /dev/null +++ b/types/es6-shim/yarn.lock @@ -0,0 +1,7 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +es6-shim@0.34: + version "0.34.4" + resolved "https://registry.yarnpkg.com/es6-shim/-/es6-shim-0.34.4.tgz#b2f34d85ea0fd577fb2a5016cb978d44c5049969" From 9c1fa58d90eb1d359d86525879366f148199109e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20M=C3=BCller?= Date: Fri, 21 Apr 2017 21:13:12 +0200 Subject: [PATCH 0005/1105] removed .gitignore --- types/es6-shim/.gitignore | 1 - 1 file changed, 1 deletion(-) delete mode 100644 types/es6-shim/.gitignore diff --git a/types/es6-shim/.gitignore b/types/es6-shim/.gitignore deleted file mode 100644 index a59389a0ad..0000000000 --- a/types/es6-shim/.gitignore +++ /dev/null @@ -1 +0,0 @@ -!yarn.lock From 7428e541f8397a42b45dd52824b029862bb24e3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20M=C3=BCller?= Date: Fri, 21 Apr 2017 21:15:02 +0200 Subject: [PATCH 0006/1105] removed yarn.lock --- types/es6-shim/yarn.lock | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 types/es6-shim/yarn.lock diff --git a/types/es6-shim/yarn.lock b/types/es6-shim/yarn.lock deleted file mode 100644 index c45109041f..0000000000 --- a/types/es6-shim/yarn.lock +++ /dev/null @@ -1,7 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - -es6-shim@0.34: - version "0.34.4" - resolved "https://registry.yarnpkg.com/es6-shim/-/es6-shim-0.34.4.tgz#b2f34d85ea0fd577fb2a5016cb978d44c5049969" From 6292510eddb891a0eb305d2cb08c2e5f6206635e Mon Sep 17 00:00:00 2001 From: richardgong1987 <909253305@qq.com> Date: Mon, 24 Apr 2017 09:28:52 +0800 Subject: [PATCH 0007/1105] add loopback Remote hooks definitely types --- .gitignore | 1 + types/loopback/index.d.ts | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/.gitignore b/.gitignore index 5b79863e52..bf7fc48845 100644 --- a/.gitignore +++ b/.gitignore @@ -41,3 +41,4 @@ node_modules .vs .vscode yarn.lock +.idea diff --git a/types/loopback/index.d.ts b/types/loopback/index.d.ts index adb14ae209..0f7737c316 100644 --- a/types/loopback/index.d.ts +++ b/types/loopback/index.d.ts @@ -11,6 +11,7 @@ ************************************************/ import * as core from "express-serve-static-core"; +import {NextFunction} from "../express-serve-static-core/index"; declare function l(): l.LoopBackApplication; declare namespace l { @@ -886,8 +887,27 @@ declare namespace l { * See [Setting up a custom model](docs.strongloop.com/display/LB/Extending+built-in+models#Extendingbuilt-inmodels-Settingupacustommodel) */ static setup(): void; + + static setup(): void; + + /** + * loopback 3.x Remote hooks + * http://loopback.io/doc/en/lb3/Remote-hooks.html + * @param method + * @param fn + */ + beforeRemote(method: string, backback: (ctx: Context, modelInstanceOrNext: Model + | NextFunction, next?: NextFunction)=>void): void; + + afterRemote(method: string, backback: (ctx: Context, modelInstanceOrNext: Model + | NextFunction, next?: NextFunction) => void): void; + + afterRemoteError(method: string, next: NextFunction): void; + } + + /** * SharedClass * Create a new SharedClass with the given options. From 5dd01a9a7182bedf0cb8b42a5ed9daef0a03caa7 Mon Sep 17 00:00:00 2001 From: richardgong1987 <909253305@qq.com> Date: Mon, 24 Apr 2017 09:37:42 +0800 Subject: [PATCH 0008/1105] add loopback Remote hooks definitely types --- types/loopback/index.d.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/types/loopback/index.d.ts b/types/loopback/index.d.ts index 0f7737c316..d4ba602f25 100644 --- a/types/loopback/index.d.ts +++ b/types/loopback/index.d.ts @@ -11,7 +11,7 @@ ************************************************/ import * as core from "express-serve-static-core"; -import {NextFunction} from "../express-serve-static-core/index"; +import {NextFunction} from "../express/index"; declare function l(): l.LoopBackApplication; declare namespace l { @@ -888,8 +888,6 @@ declare namespace l { */ static setup(): void; - static setup(): void; - /** * loopback 3.x Remote hooks * http://loopback.io/doc/en/lb3/Remote-hooks.html From 7e22b1422f4c602615e57bd295acc6ccfe7cc3e9 Mon Sep 17 00:00:00 2001 From: richardgong1987 <909253305@qq.com> Date: Mon, 24 Apr 2017 09:39:46 +0800 Subject: [PATCH 0009/1105] add loopback Remote hooks definitely types --- types/loopback/index.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/types/loopback/index.d.ts b/types/loopback/index.d.ts index d4ba602f25..fd3c363cbb 100644 --- a/types/loopback/index.d.ts +++ b/types/loopback/index.d.ts @@ -892,15 +892,15 @@ declare namespace l { * loopback 3.x Remote hooks * http://loopback.io/doc/en/lb3/Remote-hooks.html * @param method - * @param fn + * @param backback */ - beforeRemote(method: string, backback: (ctx: Context, modelInstanceOrNext: Model + beforeRemote(method: string, callback: (ctx: Context, modelInstanceOrNext: Model | NextFunction, next?: NextFunction)=>void): void; - afterRemote(method: string, backback: (ctx: Context, modelInstanceOrNext: Model + afterRemote(method: string, callback: (ctx: Context, modelInstanceOrNext: Model | NextFunction, next?: NextFunction) => void): void; - afterRemoteError(method: string, next: NextFunction): void; + afterRemoteError(method: string, callback: NextFunction): void; } From 498022ec6842fe17ac6cb7abc9b413c6283ec60b Mon Sep 17 00:00:00 2001 From: richardgong1987 <909253305@qq.com> Date: Mon, 24 Apr 2017 09:40:32 +0800 Subject: [PATCH 0010/1105] add loopback Remote hooks definitely types --- types/loopback/index.d.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/types/loopback/index.d.ts b/types/loopback/index.d.ts index fd3c363cbb..e17b6f368e 100644 --- a/types/loopback/index.d.ts +++ b/types/loopback/index.d.ts @@ -901,11 +901,8 @@ declare namespace l { | NextFunction, next?: NextFunction) => void): void; afterRemoteError(method: string, callback: NextFunction): void; - } - - /** * SharedClass * Create a new SharedClass with the given options. From 9d3a210b057ccb0217f44475c95c9664d139f5a6 Mon Sep 17 00:00:00 2001 From: shane Date: Fri, 28 Apr 2017 16:20:06 +1000 Subject: [PATCH 0011/1105] Improve lifecycle this typing --- types/recompose/index.d.ts | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/types/recompose/index.d.ts b/types/recompose/index.d.ts index 6cef47160e..5621792156 100644 --- a/types/recompose/index.d.ts +++ b/types/recompose/index.d.ts @@ -143,18 +143,32 @@ declare module 'recompose' { contextTypes: ValidationMap ) : InferableComponentEnhancer; - // lifecycle: https://github.com/acdlite/recompose/blob/master/docs/API.md#lifecycle - interface ReactLifeCycleFunctions { - componentWillMount?: Function; - componentDidMount?: Function; - componentWillReceiveProps?: Function; - shouldComponentUpdate?: Function; - componentWillUpdate?: Function; - componentDidUpdate?: Function; - componentWillUnmount?: Function; + interface ReactLifeCycleFunctionsThisArguments { + props: TProps, + state: TState, + setState(f: (prevState: TState, props: TProps) => Pick, callback?: () => any): void; + setState(state: Pick, callback?: () => any): void; + forceUpdate(callBack?: () => any): void; + + context: any; + refs: { + [key: string]: React.ReactInstance + }; } - export function lifecycle( - spec: ReactLifeCycleFunctions + + // lifecycle: https://github.com/acdlite/recompose/blob/master/docs/API.md#lifecycle + interface ReactLifeCycleFunctions { + componentWillMount?: (this: ReactLifeCycleFunctionsThisArguments) => void; + componentDidMount?: (this: ReactLifeCycleFunctionsThisArguments) => void; + componentWillReceiveProps?: (this: ReactLifeCycleFunctionsThisArguments, nextProps:TProps) => void; + shouldComponentUpdate?: (this: ReactLifeCycleFunctionsThisArguments, nextProps:TProps, nextState: TState) => boolean; + componentWillUpdate?: (this: ReactLifeCycleFunctionsThisArguments, nextProps:TProps, nextState: TState) => void; + componentDidUpdate?: (this: ReactLifeCycleFunctionsThisArguments, prevProps:TProps, prevState: TState) => void; + componentWillUnmount?: (this: ReactLifeCycleFunctionsThisArguments) => void; + } + + export function lifecycle( + spec: ReactLifeCycleFunctions ): InferableComponentEnhancer; // toClass: https://github.com/acdlite/recompose/blob/master/docs/API.md#toClass From 07ba4da3c59ae61303b2b53772b9f18cd40662ab Mon Sep 17 00:00:00 2001 From: shane Date: Fri, 28 Apr 2017 16:37:04 +1000 Subject: [PATCH 0012/1105] Bumped version number --- types/recompose/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/recompose/index.d.ts b/types/recompose/index.d.ts index 5621792156..9d383cae15 100644 --- a/types/recompose/index.d.ts +++ b/types/recompose/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Recompose v0.22.0 +// Type definitions for Recompose v0.22.1 // Project: https://github.com/acdlite/recompose // Definitions by: Iskander Sierra // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 9d6c0c12f4b2846790db5e5a42f300176721bc19 Mon Sep 17 00:00:00 2001 From: Kanchalai Tanglertsampan Date: Mon, 1 May 2017 11:56:54 -0700 Subject: [PATCH 0013/1105] Fixing breaking form 2.3 by using default type paramters instead --- types/react-leaflet/index.d.ts | 34 ++++++++++----------- types/react-leaflet/react-leaflet-tests.tsx | 4 +-- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/types/react-leaflet/index.d.ts b/types/react-leaflet/index.d.ts index da829ff2cc..d59527932b 100644 --- a/types/react-leaflet/index.d.ts +++ b/types/react-leaflet/index.d.ts @@ -143,7 +143,7 @@ export interface MapProps extends MapEvents, Leaflet.MapOptions, Leaflet.LocateO zoom?: number; } -export class Map

extends MapComponent { +export class Map

extends MapComponent { className?: string; container: HTMLDivElement; getChildContext(): { layerContainer: E, map: E }; @@ -165,7 +165,7 @@ export interface PaneProps { export interface PaneState { name?: string; } -export class Pane

extends React.Component { +export class Pane

extends React.Component { getChildContext(): { pane: string }; createPane(props: P): void; removePane(): void; @@ -196,13 +196,13 @@ export interface TileLayerProps extends TileLayerEvents, Leaflet.TileLayerOption children?: Children; url: string; } -export class TileLayer

extends GridLayer { } +export class TileLayer

extends GridLayer { } export interface WMSTileLayerProps extends TileLayerEvents, Leaflet.WMSOptions { children?: Children; url: string; } -export class WMSTileLayer

extends GridLayer { } +export class WMSTileLayer

extends GridLayer { } export interface ImageOverlayProps extends Leaflet.ImageOverlayOptions { bounds: Leaflet.LatLngBoundsExpression; @@ -224,7 +224,7 @@ export interface MarkerProps extends MarkerEvents, Leaflet.MarkerOptions { children?: Children; position: Leaflet.LatLngExpression; } -export class Marker

extends MapLayer { +export class Marker

extends MapLayer { getChildContext(): { popupContainer: E }; } @@ -241,19 +241,19 @@ export interface CircleProps extends PathEvents, Leaflet.CircleMarkerOptions { children?: Children; radius: number; } -export class Circle

extends Path { } +export class Circle

extends Path { } export interface CircleMarkerProps extends PathEvents, Leaflet.CircleMarkerOptions { center: Leaflet.LatLngExpression; children?: Children; radius: number; } -export class CircleMarker

extends Path { } +export class CircleMarker

extends Path { } export interface FeatureGroupProps extends FeatureGroupEvents, Leaflet.PathOptions { children?: Children; } -export class FeatureGroup

extends Path { +export class FeatureGroup

extends Path { getChildContext(): { layerContainer: E, popupContainer: E }; } @@ -268,27 +268,27 @@ export interface PolylineProps extends PathEvents, Leaflet.PolylineOptions { children?: Children; positions: Leaflet.LatLngExpression[] | Leaflet.LatLngExpression[][]; } -export class Polyline

extends Path { } +export class Polyline

extends Path { } export interface PolygonProps extends PathEvents, Leaflet.PolylineOptions { children?: Children; popupContainer?: Leaflet.FeatureGroup; positions: Leaflet.LatLngExpression[] | Leaflet.LatLngExpression[][] | Leaflet.LatLngExpression[][][]; } -export class Polygon

extends Path { } +export class Polygon

extends Path { } export interface RectangleProps extends PathEvents, Leaflet.PolylineOptions { children?: Children; bounds: Leaflet.LatLngBoundsExpression; popupContainer?: Leaflet.FeatureGroup; } -export class Rectangle

extends Path { } +export class Rectangle

extends Path { } export interface PopupProps extends Leaflet.PopupOptions { children?: Children; position?: Leaflet.LatLngExpression; } -export class Popup

extends MapComponent { +export class Popup

extends MapComponent { onPopupOpen(arg: { popup: E }): void; onPopupClose(arg: { popup: E }): void; renderPopupContent(): void; @@ -298,7 +298,7 @@ export class Popup

extends MapCom export interface TooltipProps extends Leaflet.TooltipOptions { children?: Children; } -export class Tooltip

extends MapComponent { +export class Tooltip

extends MapComponent { onTooltipOpen(arg: { tooltip: E }): void; onTooltipClose(arg: { tooltip: E }): void; renderTooltipContent(): void; @@ -320,7 +320,7 @@ export interface LayersControlProps extends LayersControlEvents, Leaflet.Control children?: Children; overlays?: Leaflet.Control.LayersObject; } -export class LayersControl

extends MapControl { } +export class LayersControl

extends MapControl { } export namespace LayersControl { interface BaseControlledLayerProps { @@ -340,12 +340,12 @@ export namespace LayersControl { addLayer(): void; removeLayer(layer: Leaflet.Layer): void; } - class BaseLayer

extends ControlledLayer

{ } - class Overlay

extends ControlledLayer

{ } + class BaseLayer

extends ControlledLayer

{ } + class Overlay

extends ControlledLayer

{ } } export type ScaleControlProps = Leaflet.Control.ScaleOptions; export class ScaleControl

extends MapControl { } export type ZoomControlProps = Leaflet.Control.ZoomOptions; -export class ZoomControl

extends MapControl { } +export class ZoomControl

extends MapControl { } diff --git a/types/react-leaflet/react-leaflet-tests.tsx b/types/react-leaflet/react-leaflet-tests.tsx index 667d92d6ea..d87d4f995e 100644 --- a/types/react-leaflet/react-leaflet-tests.tsx +++ b/types/react-leaflet/react-leaflet-tests.tsx @@ -686,7 +686,7 @@ class CenterControl extends MapControl { // n const centerControl = new L.Control({ position: 'bottomright' }); // see http://leafletjs.com/reference.html#control-positions for other positions const jsx = ( // PUT YOUR JSX FOR THE COMPONENT HERE: -

+
{/* add your JSX */}
); @@ -713,7 +713,7 @@ class LegendControl extends MapControl +
{this.props.children}
); From 488ab0050dd26e9fa780a3f3acc0e2ac1d85dad8 Mon Sep 17 00:00:00 2001 From: liudongpu Date: Tue, 2 May 2017 22:25:32 +0800 Subject: [PATCH 0014/1105] emit ...param:any[] --- types/react-native/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index fe7602bb9f..2822ffca80 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -234,7 +234,7 @@ interface EventEmitter extends EventEmitterListener { * * emitter.emit('someEvent', 'abc'); // logs 'abc' */ - emit(eventType: string): void + emit(eventType: string,...param:any[]): void /** * Removes the given listener for event of specific type. From 42a15de2ebbd752c47cc5faefe1e3b2e7717027f Mon Sep 17 00:00:00 2001 From: Kanchalai Tanglertsampan Date: Tue, 2 May 2017 10:27:11 -0700 Subject: [PATCH 0015/1105] Address PR : add type parameter --- types/react-leaflet/index.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/types/react-leaflet/index.d.ts b/types/react-leaflet/index.d.ts index d59527932b..aac671947d 100644 --- a/types/react-leaflet/index.d.ts +++ b/types/react-leaflet/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/PaulLeCam/react-leaflet // Definitions by: Dave Leaver , David Schneider // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.2 +// TypeScript Version: 2.3 import * as Leaflet from 'leaflet'; import * as React from 'react'; @@ -202,7 +202,7 @@ export interface WMSTileLayerProps extends TileLayerEvents, Leaflet.WMSOptions { children?: Children; url: string; } -export class WMSTileLayer

extends GridLayer { } +export class WMSTileLayer

extends GridLayer { } export interface ImageOverlayProps extends Leaflet.ImageOverlayOptions { bounds: Leaflet.LatLngBoundsExpression; @@ -320,7 +320,7 @@ export interface LayersControlProps extends LayersControlEvents, Leaflet.Control children?: Children; overlays?: Leaflet.Control.LayersObject; } -export class LayersControl

extends MapControl { } +export class LayersControl

extends MapControl { } export namespace LayersControl { interface BaseControlledLayerProps { @@ -348,4 +348,4 @@ export type ScaleControlProps = Leaflet.Control.ScaleOptions; export class ScaleControl

extends MapControl { } export type ZoomControlProps = Leaflet.Control.ZoomOptions; -export class ZoomControl

extends MapControl { } +export class ZoomControl

extends MapControl { } From b596befb5ad07f5fd9c9d6386baa538b0a385c45 Mon Sep 17 00:00:00 2001 From: Kanchalai Tanglertsampan Date: Tue, 2 May 2017 10:29:10 -0700 Subject: [PATCH 0016/1105] Address PR: add type parameter --- types/react-leaflet/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-leaflet/index.d.ts b/types/react-leaflet/index.d.ts index aac671947d..8c36af705e 100644 --- a/types/react-leaflet/index.d.ts +++ b/types/react-leaflet/index.d.ts @@ -196,7 +196,7 @@ export interface TileLayerProps extends TileLayerEvents, Leaflet.TileLayerOption children?: Children; url: string; } -export class TileLayer

extends GridLayer { } +export class TileLayer

extends GridLayer { } export interface WMSTileLayerProps extends TileLayerEvents, Leaflet.WMSOptions { children?: Children; From 25dfb2fb8c3a718bbea0203ba682e10ae2e26bb1 Mon Sep 17 00:00:00 2001 From: Yui Date: Tue, 2 May 2017 13:13:30 -0700 Subject: [PATCH 0017/1105] Update header of the index.d.ts file --- types/react-leaflet/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-leaflet/index.d.ts b/types/react-leaflet/index.d.ts index 8c36af705e..ddbfc786e3 100644 --- a/types/react-leaflet/index.d.ts +++ b/types/react-leaflet/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for react-leaflet 1.1 // Project: https://github.com/PaulLeCam/react-leaflet -// Definitions by: Dave Leaver , David Schneider +// Definitions by: Dave Leaver , David Schneider , Yui T. // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 From 920d2d7bdfc6cd50f06bd2020991f25f46d8c7a6 Mon Sep 17 00:00:00 2001 From: beary Date: Thu, 4 May 2017 18:13:19 +0800 Subject: [PATCH 0018/1105] Add default generic to Collection TypeScript support default generic since version 2.3, so add generic to Collection. --- types/mongodb/index.d.ts | 52 ++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/types/mongodb/index.d.ts b/types/mongodb/index.d.ts index 5fe6332350..6f5cf3df0e 100644 --- a/types/mongodb/index.d.ts +++ b/types/mongodb/index.d.ts @@ -181,20 +181,20 @@ export class Db extends EventEmitter { close(forceClose?: boolean): Promise; close(forceClose: boolean, callback: MongoCallback): void; // http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#collection - collection(name: string): Collection; - collection(name: string, callback: MongoCallback): Collection; - collection(name: string, options: DbCollectionOptions, callback: MongoCallback): Collection; + collection(name: string): Collection; + collection(name: string, callback: MongoCallback>): Collection; + collection(name: string, options: DbCollectionOptions, callback: MongoCallback>): Collection; //http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#collections - collections(): Promise; - collections(callback: MongoCallback): void; + collections(): Promise[]>; + collections(callback: MongoCallback[]>): void; //http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#command command(command: Object, callback: MongoCallback): void; command(command: Object, options?: { readPreference: ReadPreference | string }): Promise; command(command: Object, options: { readPreference: ReadPreference | string }, callback: MongoCallback): void; //http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#createCollection - createCollection(name: string, callback: MongoCallback): void; - createCollection(name: string, options?: CollectionCreateOptions): Promise; - createCollection(name: string, options: CollectionCreateOptions, callback: MongoCallback): void; + createCollection(name: string, callback: MongoCallback>): void; + createCollection(name: string, options?: CollectionCreateOptions): Promise>; + createCollection(name: string, options: CollectionCreateOptions, callback: MongoCallback>): void; //http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#createIndex createIndex(name: string, fieldOrSpec: string | Object, callback: MongoCallback): void; createIndex(name: string, fieldOrSpec: string | Object, options?: IndexOptions): Promise; @@ -236,9 +236,9 @@ export class Db extends EventEmitter { removeUser(username: string, options?: { w?: number | string, wtimeout?: number, j?: boolean }): Promise; removeUser(username: string, options: { w?: number | string, wtimeout?: number, j?: boolean }, callback: MongoCallback): void; // http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#renameCollection - renameCollection(fromCollection: string, toCollection: string, callback: MongoCallback): void; - renameCollection(fromCollection: string, toCollection: string, options?: { dropTarget?: boolean }): Promise; - renameCollection(fromCollection: string, toCollection: string, options: { dropTarget?: boolean }, callback: MongoCallback): void; + renameCollection(fromCollection: string, toCollection: string, callback: MongoCallback>): void; + renameCollection(fromCollection: string, toCollection: string, options?: { dropTarget?: boolean }): Promise>; + renameCollection(fromCollection: string, toCollection: string, options: { dropTarget?: boolean }, callback: MongoCallback>): void; //http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#stats stats(callback: MongoCallback): void; stats(options?: { scale?: number }): Promise; @@ -409,7 +409,7 @@ export interface FSyncOptions { } // Documentation : http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html -export interface Collection { +export interface Collection { // Get the collection name. collectionName: string; // Get the full collection namespace. @@ -421,10 +421,10 @@ export interface Collection { // Get current index hint for collection. hint: any; //http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#aggregate - aggregate(pipeline: Object[], callback: MongoCallback): AggregationCursor; - aggregate(pipeline: Object[], options?: CollectionAggregationOptions, callback?: MongoCallback): AggregationCursor; - aggregate(pipeline: Object[], callback: MongoCallback): AggregationCursor; - aggregate(pipeline: Object[], options?: CollectionAggregationOptions, callback?: MongoCallback): AggregationCursor; + // aggregate(pipeline: Object[], callback: MongoCallback): AggregationCursor; + // aggregate(pipeline: Object[], options?: CollectionAggregationOptions, callback?: MongoCallback): AggregationCursor; + aggregate(pipeline: Object[], callback: MongoCallback): AggregationCursor; + aggregate(pipeline: Object[], options?: CollectionAggregationOptions, callback?: MongoCallback): AggregationCursor; //http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#bulkWrite bulkWrite(operations: Object[], callback: MongoCallback): void; bulkWrite(operations: Object[], options?: CollectionBluckWriteOptions): Promise; @@ -463,14 +463,14 @@ export interface Collection { dropIndexes(): Promise; dropIndexes(callback?: MongoCallback): void; //http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#find - find(query?: Object): Cursor; - find(query?: Object): Cursor; + // find(query?: Object): Cursor; + find(query?: Object): Cursor; /** @deprecated */ - find(query: Object, fields?: Object, skip?: number, limit?: number, timeout?: number): Cursor; + find(query: Object, fields?: Object, skip?: number, limit?: number, timeout?: number): Cursor; //http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#findOne - findOne(filter: Object, callback: MongoCallback): void; - findOne(filter: Object, options?: FindOneOptions): Promise; - findOne(filter: Object, options: FindOneOptions, callback: MongoCallback): void; + findOne(filter: Object, callback: MongoCallback): void; + findOne(filter: Object, options?: FindOneOptions): Promise; + findOne(filter: Object, options: FindOneOptions, callback: MongoCallback): void; //http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#findOneAndDelete findOneAndDelete(filter: Object, callback: MongoCallback): void; findOneAndDelete(filter: Object, options?: { projection?: Object, sort?: Object, maxTimeMS?: number }): Promise; @@ -551,9 +551,9 @@ export interface Collection { /** @deprecated Use use deleteOne, deleteMany or bulkWrite */ remove(selector: Object, options?: CollectionOptions & { single?: boolean }, callback?: MongoCallback): void; //http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#rename - rename(newName: string, callback: MongoCallback): void; - rename(newName: string, options?: { dropTarget?: boolean }): Promise; - rename(newName: string, options: { dropTarget?: boolean }, callback: MongoCallback): void; + rename(newName: string, callback: MongoCallback>): void; + rename(newName: string, options?: { dropTarget?: boolean }): Promise>; + rename(newName: string, options: { dropTarget?: boolean }, callback: MongoCallback>): void; //http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#replaceOne replaceOne(filter: Object, doc: Object, callback: MongoCallback): void; replaceOne(filter: Object, doc: Object, options?: ReplaceOneOptions): Promise; @@ -1204,7 +1204,7 @@ export interface GridFSBucketOpenUploadStreamOptions { // https://mongodb.github.io/node-mongodb-native/2.1/api/GridFSBucketReadStream.html export class GridFSBucketReadStream extends Readable { - constructor(chunks: Collection, files: Collection, readPreference: Object, filter: Object, options?: GridFSBucketReadStreamOptions); + constructor(chunks: Collection, files: Collection, readPreference: Object, filter: Object, options?: GridFSBucketReadStreamOptions); } // https://mongodb.github.io/node-mongodb-native/2.1/api/GridFSBucketReadStream.html From 22b3831e3141b51b0d2038b465d9f2a7fcafea6a Mon Sep 17 00:00:00 2001 From: beary Date: Thu, 4 May 2017 18:22:34 +0800 Subject: [PATCH 0019/1105] Add generic to collection --- types/mongodb/index.d.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/types/mongodb/index.d.ts b/types/mongodb/index.d.ts index 6f5cf3df0e..bd15f3bd07 100644 --- a/types/mongodb/index.d.ts +++ b/types/mongodb/index.d.ts @@ -421,8 +421,6 @@ export interface Collection { // Get current index hint for collection. hint: any; //http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#aggregate - // aggregate(pipeline: Object[], callback: MongoCallback): AggregationCursor; - // aggregate(pipeline: Object[], options?: CollectionAggregationOptions, callback?: MongoCallback): AggregationCursor; aggregate(pipeline: Object[], callback: MongoCallback): AggregationCursor; aggregate(pipeline: Object[], options?: CollectionAggregationOptions, callback?: MongoCallback): AggregationCursor; //http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#bulkWrite @@ -463,7 +461,6 @@ export interface Collection { dropIndexes(): Promise; dropIndexes(callback?: MongoCallback): void; //http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#find - // find(query?: Object): Cursor; find(query?: Object): Cursor; /** @deprecated */ find(query: Object, fields?: Object, skip?: number, limit?: number, timeout?: number): Cursor; From b0d31d86b194178eb882ca60fc37d53b16c7e12e Mon Sep 17 00:00:00 2001 From: beary Date: Thu, 4 May 2017 19:19:41 +0800 Subject: [PATCH 0020/1105] Add generic to findOneAnd*** functions --- types/mongodb/index.d.ts | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/types/mongodb/index.d.ts b/types/mongodb/index.d.ts index bd15f3bd07..02208e721b 100644 --- a/types/mongodb/index.d.ts +++ b/types/mongodb/index.d.ts @@ -461,25 +461,25 @@ export interface Collection { dropIndexes(): Promise; dropIndexes(callback?: MongoCallback): void; //http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#find - find(query?: Object): Cursor; + find(query?: Object): Cursor; /** @deprecated */ find(query: Object, fields?: Object, skip?: number, limit?: number, timeout?: number): Cursor; //http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#findOne - findOne(filter: Object, callback: MongoCallback): void; + findOne(filter: Object, callback: MongoCallback): void; findOne(filter: Object, options?: FindOneOptions): Promise; findOne(filter: Object, options: FindOneOptions, callback: MongoCallback): void; //http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#findOneAndDelete - findOneAndDelete(filter: Object, callback: MongoCallback): void; - findOneAndDelete(filter: Object, options?: { projection?: Object, sort?: Object, maxTimeMS?: number }): Promise; - findOneAndDelete(filter: Object, options: { projection?: Object, sort?: Object, maxTimeMS?: number }, callback: MongoCallback): void; + findOneAndDelete(filter: Object, callback: MongoCallback>): void; + findOneAndDelete(filter: Object, options?: { projection?: Object, sort?: Object, maxTimeMS?: number }): Promise>; + findOneAndDelete(filter: Object, options: { projection?: Object, sort?: Object, maxTimeMS?: number }, callback: MongoCallback>): void; //http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#findOneAndReplace - findOneAndReplace(filter: Object, replacement: Object, callback: MongoCallback): void; - findOneAndReplace(filter: Object, replacement: Object, options?: FindOneAndReplaceOption): Promise; - findOneAndReplace(filter: Object, replacement: Object, options: FindOneAndReplaceOption, callback: MongoCallback): void; + findOneAndReplace(filter: Object, replacement: Object, callback: MongoCallback>): void; + findOneAndReplace(filter: Object, replacement: Object, options?: FindOneAndReplaceOption): Promise>; + findOneAndReplace(filter: Object, replacement: Object, options: FindOneAndReplaceOption, callback: MongoCallback>): void; //http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#findOneAndUpdate - findOneAndUpdate(filter: Object, update: Object, callback: MongoCallback): void; - findOneAndUpdate(filter: Object, update: Object, options?: FindOneAndReplaceOption): Promise; - findOneAndUpdate(filter: Object, update: Object, options: FindOneAndReplaceOption, callback: MongoCallback): void; + findOneAndUpdate(filter: Object, update: Object, callback: MongoCallback>): void; + findOneAndUpdate(filter: Object, update: Object, options?: FindOneAndReplaceOption): Promise>; + findOneAndUpdate(filter: Object, update: Object, options: FindOneAndReplaceOption, callback: MongoCallback>): void; //http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#geoHaystackSearch geoHaystackSearch(x: number, y: number, callback: MongoCallback): void; geoHaystackSearch(x: number, y: number, options?: GeoHaystackSearchOptions): Promise; @@ -707,9 +707,9 @@ export interface DeleteWriteOpResultObject { } //http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#~findAndModifyWriteOpResult -export interface FindAndModifyWriteOpResultObject { +export interface FindAndModifyWriteOpResultObject { //Document returned from findAndModify command. - value?: any; + value?: TSchema; //The raw lastErrorObject returned from the command. lastErrorObject?: any; //Is 1 if the command executed correctly. From 997f2064c8e72af73069dc4df7e1b5150bc2c6a9 Mon Sep 17 00:00:00 2001 From: Chaz Clark Date: Thu, 4 May 2017 14:46:00 -0400 Subject: [PATCH 0021/1105] Add response argument to verifyCallback handler This is provided by Recaptcha upon successful verification. --- types/react-recaptcha/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-recaptcha/index.d.ts b/types/react-recaptcha/index.d.ts index af6853efb3..873882c433 100644 --- a/types/react-recaptcha/index.d.ts +++ b/types/react-recaptcha/index.d.ts @@ -19,7 +19,7 @@ interface RecaptchaProps { tabindex?: string; theme?: "dark" | "light"; type?: string; - verifyCallback?(): any; + verifyCallback?(response:string): any; verifyCallbackName?: string; sitekey?: string; } From be1c9f19e17ebec1c59c27cc46a857dd982301d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20M=C3=BCller?= Date: Sat, 6 May 2017 11:19:33 +0200 Subject: [PATCH 0022/1105] Deleted package.json --- types/es6-shim/package.json | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 types/es6-shim/package.json diff --git a/types/es6-shim/package.json b/types/es6-shim/package.json deleted file mode 100644 index f9a738c9e5..0000000000 --- a/types/es6-shim/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "dependencies": { - "es6-shim": "0.34" - } -} From 958fad8fcfd8a48bd6f4a530e76046aec6127e22 Mon Sep 17 00:00:00 2001 From: nat1130NS Date: Tue, 9 May 2017 09:06:30 -0700 Subject: [PATCH 0023/1105] Adding pluginService functionality for chart.js --- types/chart.js/index.d.ts | 61 ++++++++++++++++++++++++++++++++------- 1 file changed, 50 insertions(+), 11 deletions(-) diff --git a/types/chart.js/index.d.ts b/types/chart.js/index.d.ts index cad58a2aa8..5c3b654459 100644 --- a/types/chart.js/index.d.ts +++ b/types/chart.js/index.d.ts @@ -13,22 +13,61 @@ declare class Chart { ); config: Chart.ChartConfiguration; data: Chart.ChartData; - destroy: () => {}; - update: (duration?: any, lazy?: any) => {}; - render: (duration?: any, lazy?: any) => {}; - stop: () => {}; - resize: () => {}; - clear: () => {}; - toBase64: () => string; - generateLegend: () => {}; - getElementAtEvent: (e: any) => {}; - getElementsAtEvent: (e: any) => {}[]; - getDatasetAtEvent: (e: any) => {}[]; + public destroy: () => {}; + public update: (duration?: any, lazy?: any) => {}; + public render: (duration?: any, lazy?: any) => {}; + public stop: () => {}; + public resize: () => {}; + public clear: () => {}; + public toBase64: () => string; + public generateLegend: () => {}; + public getElementAtEvent: (e: any) => {}; + public getElementsAtEvent: (e: any) => {}[]; + public getDatasetAtEvent: (e: any) => {}[]; + public static pluginService: PluginServiceStatic; static defaults: { global: Chart.ChartOptions; } } +declare class PluginServiceStatic { + public register(plugin?: PluginServiceRegistrationOptions): void; +} + +declare interface PluginServiceRegistrationOptions { + beforeInit?: (chartInstance: Chart) => void, + afterInit?: (chartInstance: Chart) => void, + + resize?: (chartInstance: Chart, newChartSize: Size) => void, + + beforeUpdate?: (chartInstance: Chart) => void, + afterScaleUpdate?: (chartInstance: Chart) => void, + beforeDatasetsUpdate?: (chartInstance: Chart) => void, + afterDatasetsUpdate?: (chartInstance: Chart) => void, + afterUpdate?: (chartInstance: Chart) => void, + + // This is called at the start of a render. It is only called once, even if the animation will run for a number of frames. Use beforeDraw or afterDraw + // to do something on each animation frame + beforeRender?: (chartInstance: Chart) => void, + + // Easing is for animation + beforeDraw?: (chartInstance: Chart, easing: string) => void, + afterDraw?: (chartInstance: Chart, easing: string) => void, + // Before the datasets are drawn but after scales are drawn + beforeDatasetsDraw?: (chartInstance: Chart, easing: string) => void, + afterDatasetsDraw?: (chartInstance: Chart, easing: string) => void, + + destroy?: (chartInstance: Chart) => void, + + // Called when an event occurs on the chart + beforeEvent?: (chartInstance: Chart, event: Event) => void, + afterEvent?: (chartInstance: Chart, event: Event) => void +} + +declare interface Size { + height: number; + width: number; +} declare namespace Chart { export type ChartType = 'line' | 'bar' | 'radar' | 'doughnut' | 'polarArea' | 'bubble'; From e235463cdba408797d7dbb6cefe4d2f9557cf923 Mon Sep 17 00:00:00 2001 From: Brian Love Date: Wed, 10 May 2017 15:00:43 -0600 Subject: [PATCH 0024/1105] * Added constructor function to the Storage class. --- types/google-cloud__storage/index.d.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/types/google-cloud__storage/index.d.ts b/types/google-cloud__storage/index.d.ts index e97249be24..eaf1177950 100644 --- a/types/google-cloud__storage/index.d.ts +++ b/types/google-cloud__storage/index.d.ts @@ -301,6 +301,21 @@ declare module "@google-cloud/storage/storage" { updated?: string; } + interface Credentials { + client_email?: string; + private_key?: string; + } + + interface ConfigurationObject { + autoRetry?: boolean; + credentials?: Credentials; + email?: string; + keyFilename?: string; + maxRetries?: number; + projectId?: string; + promise?: Function; + } + /** * The options when downloading a file. */ @@ -343,6 +358,7 @@ declare module "@google-cloud/storage/storage" { * The Storage class allows you interact with Google Cloud Storage. */ class Storage { + constructor(options?: ConfigurationObject); acl: Acl; bucket(name: string|Bucket): Bucket; channel(id: string, resourceId: string): Channel; From c3d08f7d2e4473b36cae15ebfa82cd442ce1e0fa Mon Sep 17 00:00:00 2001 From: Brian Love Date: Wed, 10 May 2017 15:26:01 -0600 Subject: [PATCH 0025/1105] Fixed declaration to pass test. --- types/google-cloud__storage/google-cloud__storage-tests.ts | 2 +- types/google-cloud__storage/index.d.ts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/types/google-cloud__storage/google-cloud__storage-tests.ts b/types/google-cloud__storage/google-cloud__storage-tests.ts index e701fe5681..a301aa063c 100644 --- a/types/google-cloud__storage/google-cloud__storage-tests.ts +++ b/types/google-cloud__storage/google-cloud__storage-tests.ts @@ -38,7 +38,7 @@ export class TestStorage { }; // import Storage class - static gcs: Storage; + static gcs: Storage = new Storage(); // the bucket private buckets: Bucket[] = []; diff --git a/types/google-cloud__storage/index.d.ts b/types/google-cloud__storage/index.d.ts index eaf1177950..c87a2cc606 100644 --- a/types/google-cloud__storage/index.d.ts +++ b/types/google-cloud__storage/index.d.ts @@ -313,7 +313,7 @@ declare module "@google-cloud/storage/storage" { keyFilename?: string; maxRetries?: number; projectId?: string; - promise?: Function; + promise?: PromiseLibrary; } /** @@ -366,4 +366,6 @@ declare module "@google-cloud/storage/storage" { getBuckets(query?: BucketQuery): Promise<[Bucket[]]>; getBucketsStream(query?: BucketQuery): Promise<[ReadStream]>; } + + type PromiseLibrary = () => PromiseLike; } From 4b994c6e211079dfdaeb2942a9c0b886e1a83740 Mon Sep 17 00:00:00 2001 From: Brian Love Date: Wed, 10 May 2017 16:33:04 -0600 Subject: [PATCH 0026/1105] Updated header. --- types/google-cloud__storage/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/google-cloud__storage/index.d.ts b/types/google-cloud__storage/index.d.ts index c87a2cc606..88743b8af8 100644 --- a/types/google-cloud__storage/index.d.ts +++ b/types/google-cloud__storage/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for @google-cloud/storage 0.6 +// Type definitions for @google-cloud/storage v1.1.0 // Project: https://github.com/GoogleCloudPlatform/google-cloud-node/tree/master/packages/storage -// Definitions by: Brian Love +// Definitions by: Brian Love // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// From 00251fcd7546c56e43db6d7042ddade0eeda7e49 Mon Sep 17 00:00:00 2001 From: motemen Date: Fri, 12 May 2017 11:02:46 +0900 Subject: [PATCH 0027/1105] update google-apps-script generated by https://github.com/motemen/dts-google-apps-script --- .../google-apps-script-tests.ts | 6 + .../google-apps-script.base.d.ts | 15 +- .../google-apps-script.cache.d.ts | 6 +- .../google-apps-script.calendar.d.ts | 26 +- .../google-apps-script.charts.d.ts | 28 +- .../google-apps-script.contacts.d.ts | 23 +- .../google-apps-script.content.d.ts | 8 +- .../google-apps-script.document.d.ts | 91 +++- .../google-apps-script.drive.d.ts | 18 +- .../google-apps-script.forms.d.ts | 412 ++++++++++++++++-- .../google-apps-script.gmail.d.ts | 6 +- .../google-apps-script.groups.d.ts | 8 +- .../google-apps-script.html.d.ts | 67 ++- .../google-apps-script.jdbc.d.ts | 6 +- .../google-apps-script.language.d.ts | 4 +- .../google-apps-script.lock.d.ts | 4 +- .../google-apps-script.mail.d.ts | 4 +- .../google-apps-script.maps.d.ts | 22 +- .../google-apps-script.optimization.d.ts | 9 +- .../google-apps-script.properties.d.ts | 4 +- .../google-apps-script.script.d.ts | 42 +- .../google-apps-script.sites.d.ts | 68 ++- .../google-apps-script.spreadsheet.d.ts | 143 +++++- .../google-apps-script.types.d.ts | 2 +- .../google-apps-script.ui.d.ts | 14 +- .../google-apps-script.url-fetch.d.ts | 34 +- .../google-apps-script.utilities.d.ts | 13 +- .../google-apps-script.xml-service.d.ts | 10 +- 28 files changed, 864 insertions(+), 229 deletions(-) diff --git a/types/google-apps-script/google-apps-script-tests.ts b/types/google-apps-script/google-apps-script-tests.ts index 5160a5fdae..17de10a2fc 100644 --- a/types/google-apps-script/google-apps-script-tests.ts +++ b/types/google-apps-script/google-apps-script-tests.ts @@ -25,3 +25,9 @@ function createAndSendDocument() { // Send yourself an email with a link to the document. GmailApp.sendEmail(email, subject, body); } + +// Regression + +ScriptApp.getService().getUrl(); + +CalendarApp.GuestStatus.NO; diff --git a/types/google-apps-script/google-apps-script.base.d.ts b/types/google-apps-script/google-apps-script.base.d.ts index 538883cb19..82f92078dd 100644 --- a/types/google-apps-script/google-apps-script.base.d.ts +++ b/types/google-apps-script/google-apps-script.base.d.ts @@ -1,9 +1,9 @@ -// Type definitions for Google Apps Script 2015-11-12 +// Type definitions for Google Apps Script 2017-05-12 // Project: https://developers.google.com/apps-script/ // Definitions by: motemen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - +/// declare namespace GoogleAppsScript { export module Base { @@ -58,6 +58,8 @@ declare namespace GoogleAppsScript { * * JdbcClobA JDBC Clob. * + * PositionedImageFixed position image anchored to a Paragraph. + * * SpreadsheetThis class allows users to access and modify Google Sheets files. * * StaticMapAllows for the creation and decoration of static map images. @@ -68,7 +70,7 @@ declare namespace GoogleAppsScript { } /** - * This class provides access to Google Apps specific dialog boxes. + * This class provides access to G Suite specific dialog boxes. * * The methods in this class are only available for use in the context of a Google Spreadsheet. * See also @@ -76,7 +78,7 @@ declare namespace GoogleAppsScript { * ButtonSet */ export interface Browser { - Buttons: ButtonSet + Buttons: typeof ButtonSet; inputBox(prompt: string): string; inputBox(prompt: string, buttons: ButtonSet): string; inputBox(title: string, prompt: string, buttons: ButtonSet): string; @@ -219,6 +221,7 @@ declare namespace GoogleAppsScript { getActiveUserLocale(): string; getEffectiveUser(): User; getScriptTimeZone(): string; + getTemporaryActiveUserKey(): string; getTimeZone(): string; getUser(): User; } @@ -244,8 +247,8 @@ declare namespace GoogleAppsScript { * } */ export interface Ui { - Button: Button - ButtonSet: ButtonSet + Button: typeof Button; + ButtonSet: typeof ButtonSet; alert(prompt: string): Button; alert(prompt: string, buttons: ButtonSet): Button; alert(title: string, prompt: string, buttons: ButtonSet): Button; diff --git a/types/google-apps-script/google-apps-script.cache.d.ts b/types/google-apps-script/google-apps-script.cache.d.ts index bdeee152ba..c0cf592b43 100644 --- a/types/google-apps-script/google-apps-script.cache.d.ts +++ b/types/google-apps-script/google-apps-script.cache.d.ts @@ -1,9 +1,9 @@ -// Type definitions for Google Apps Script 2015-11-12 +// Type definitions for Google Apps Script 2017-05-12 // Project: https://developers.google.com/apps-script/ // Definitions by: motemen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - +/// declare namespace GoogleAppsScript { export module Cache { @@ -16,7 +16,7 @@ declare namespace GoogleAppsScript { * to speed up access on an average request. * * function getRssFeed() { - * var cache = CacheService.getPublicCache(); + * var cache = CacheService.getScriptCache(); * var cached = cache.get("rss-feed-contents"); * if (cached != null) { * return cached; diff --git a/types/google-apps-script/google-apps-script.calendar.d.ts b/types/google-apps-script/google-apps-script.calendar.d.ts index c217e67a07..d94ec25ad3 100644 --- a/types/google-apps-script/google-apps-script.calendar.d.ts +++ b/types/google-apps-script/google-apps-script.calendar.d.ts @@ -1,10 +1,10 @@ -// Type definitions for Google Apps Script 2015-11-12 +// Type definitions for Google Apps Script 2017-05-12 // Project: https://developers.google.com/apps-script/ // Definitions by: motemen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - +/// +/// declare namespace GoogleAppsScript { export module Calendar { @@ -51,11 +51,12 @@ declare namespace GoogleAppsScript { * that the user owns or is subscribed to. */ export interface CalendarApp { - Color: Color - GuestStatus: GuestStatus - Month: Base.Month - Visibility: Visibility - Weekday: Base.Weekday + Color: typeof Color; + EventColor: typeof EventColor; + GuestStatus: typeof GuestStatus; + Month: typeof Base.Month; + Visibility: typeof Visibility; + Weekday: typeof Base.Weekday; createAllDayEvent(title: string, date: Date): CalendarEvent; createAllDayEvent(title: string, date: Date, options: Object): CalendarEvent; createAllDayEventSeries(title: string, startDate: Date, recurrence: EventRecurrence): CalendarEventSeries; @@ -113,6 +114,7 @@ declare namespace GoogleAppsScript { getAllDayEndDate(): Date; getAllDayStartDate(): Date; getAllTagKeys(): String[]; + getColor(): string; getCreators(): String[]; getDateCreated(): Date; getDescription(): string; @@ -144,6 +146,7 @@ declare namespace GoogleAppsScript { resetRemindersToDefault(): CalendarEvent; setAllDayDate(date: Date): CalendarEvent; setAnyoneCanAddSelf(anyoneCanAddSelf: boolean): CalendarEvent; + setColor(color: string): CalendarEvent; setDescription(description: string): CalendarEvent; setGuestsCanInviteOthers(guestsCanInviteOthers: boolean): CalendarEvent; setGuestsCanModify(guestsCanModify: boolean): CalendarEvent; @@ -168,6 +171,7 @@ declare namespace GoogleAppsScript { deleteEventSeries(): void; deleteTag(key: string): CalendarEventSeries; getAllTagKeys(): String[]; + getColor(): string; getCreators(): String[]; getDateCreated(): Date; getDescription(): string; @@ -193,6 +197,7 @@ declare namespace GoogleAppsScript { removeGuest(email: string): CalendarEventSeries; resetRemindersToDefault(): CalendarEventSeries; setAnyoneCanAddSelf(anyoneCanAddSelf: boolean): CalendarEventSeries; + setColor(color: string): CalendarEventSeries; setDescription(description: string): CalendarEventSeries; setGuestsCanInviteOthers(guestsCanInviteOthers: boolean): CalendarEventSeries; setGuestsCanModify(guestsCanModify: boolean): CalendarEventSeries; @@ -211,6 +216,11 @@ declare namespace GoogleAppsScript { */ export enum Color { BLUE, BROWN, CHARCOAL, CHESTNUT, GRAY, GREEN, INDIGO, LIME, MUSTARD, OLIVE, ORANGE, PINK, PLUM, PURPLE, RED, RED_ORANGE, SEA_BLUE, SLATE, TEAL, TURQOISE, YELLOW } + /** + * An enum representing the named event colors available in the Calendar service. + */ + export enum EventColor { PALE_BLUE, PALE_GREEN, MAUVE, PALE_RED, YELLOW, ORANGE, CYAN, GRAY, BLUE, GREEN, RED } + /** * Represents a guest of an event. */ diff --git a/types/google-apps-script/google-apps-script.charts.d.ts b/types/google-apps-script/google-apps-script.charts.d.ts index 2e1b65290a..de6de7b767 100644 --- a/types/google-apps-script/google-apps-script.charts.d.ts +++ b/types/google-apps-script/google-apps-script.charts.d.ts @@ -1,11 +1,11 @@ -// Type definitions for Google Apps Script 2015-11-12 +// Type definitions for Google Apps Script 2017-05-12 // Project: https://developers.google.com/apps-script/ // Definitions by: motemen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - - +/// +/// +/// declare namespace GoogleAppsScript { export module Charts { @@ -232,7 +232,7 @@ declare namespace GoogleAppsScript { /** * Chart types supported by the Charts service. */ - export enum ChartType { AREA, BAR, COLUMN, LINE, PIE, SCATTER, TABLE } + export enum ChartType { AREA, BAR, COLUMN, COMBO, HISTOGRAM, LINE, PIE, SCATTER, TABLE } /** * Entry point for creating Charts in scripts. @@ -265,14 +265,14 @@ declare namespace GoogleAppsScript { * } */ export interface Charts { - ChartType: ChartType - ColumnType: ColumnType - CurveStyle: CurveStyle - MatchType: MatchType - Orientation: Orientation - PickerValuesLayout: PickerValuesLayout - PointStyle: PointStyle - Position: Position + ChartType: typeof ChartType; + ColumnType: typeof ColumnType; + CurveStyle: typeof CurveStyle; + MatchType: typeof MatchType; + Orientation: typeof Orientation; + PickerValuesLayout: typeof PickerValuesLayout; + PointStyle: typeof PointStyle; + Position: typeof Position; newAreaChart(): AreaChartBuilder; newBarChart(): BarChartBuilder; newCategoryFilter(): CategoryFilterBuilder; @@ -446,10 +446,10 @@ declare namespace GoogleAppsScript { * } */ export interface DashboardPanel { - add(widget: UI.Widget): DashboardPanel; getId(): string; getType(): string; setId(id: string): DashboardPanel; + add(widget: UI.Widget): DashboardPanel; } /** diff --git a/types/google-apps-script/google-apps-script.contacts.d.ts b/types/google-apps-script/google-apps-script.contacts.d.ts index 389951d563..46337d87d5 100644 --- a/types/google-apps-script/google-apps-script.contacts.d.ts +++ b/types/google-apps-script/google-apps-script.contacts.d.ts @@ -1,10 +1,10 @@ -// Type definitions for Google Apps Script 2015-11-12 +// Type definitions for Google Apps Script 2017-05-12 // Project: https://developers.google.com/apps-script/ // Definitions by: motemen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - +/// +/// declare namespace GoogleAppsScript { export module Contacts { @@ -136,12 +136,12 @@ declare namespace GoogleAppsScript { * contacts listed therein. */ export interface ContactsApp { - ExtendedField: ExtendedField - Field: Field - Gender: Gender - Month: Base.Month - Priority: Priority - Sensitivity: Sensitivity + ExtendedField: typeof ExtendedField; + Field: typeof Field; + Gender: typeof Gender; + Month: typeof Base.Month; + Priority: typeof Priority; + Sensitivity: typeof Sensitivity; createContact(givenName: string, familyName: string, email: string): Contact; createContactGroup(name: string): ContactGroup; deleteContact(contact: Contact): void; @@ -197,6 +197,11 @@ declare namespace GoogleAppsScript { /** * A date field in a Contact. + * + * This class is only used by the Contacts service, and dates used elsewhere in App Script use + * JavaScript's standard + * + * Date object. */ export interface DateField { deleteDateField(): void; diff --git a/types/google-apps-script/google-apps-script.content.d.ts b/types/google-apps-script/google-apps-script.content.d.ts index afd34deca1..eaa3057a49 100644 --- a/types/google-apps-script/google-apps-script.content.d.ts +++ b/types/google-apps-script/google-apps-script.content.d.ts @@ -1,9 +1,9 @@ -// Type definitions for Google Apps Script 2015-11-12 +// Type definitions for Google Apps Script 2017-05-12 // Project: https://developers.google.com/apps-script/ // Definitions by: motemen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - +/// declare namespace GoogleAppsScript { export module Content { @@ -17,7 +17,7 @@ declare namespace GoogleAppsScript { * } */ export interface ContentService { - MimeType: MimeType + MimeType: typeof MimeType; createTextOutput(): TextOutput; createTextOutput(content: string): TextOutput; } @@ -37,7 +37,7 @@ declare namespace GoogleAppsScript { * You can return text content like this: * * function doGet() { - * return ContentService.createPlainTextOutput("hello world!"); + * return ContentService.createTextOutput("hello world!"); * } * * ContentService diff --git a/types/google-apps-script/google-apps-script.document.d.ts b/types/google-apps-script/google-apps-script.document.d.ts index 7477261602..bee604636a 100644 --- a/types/google-apps-script/google-apps-script.document.d.ts +++ b/types/google-apps-script/google-apps-script.document.d.ts @@ -1,10 +1,10 @@ -// Type definitions for Google Apps Script 2015-11-12 +// Type definitions for Google Apps Script 2017-05-12 // Project: https://developers.google.com/apps-script/ // Definitions by: motemen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - +/// +/// declare namespace GoogleAppsScript { export module Document { @@ -64,6 +64,7 @@ declare namespace GoogleAppsScript { getAttributes(): Object; getChild(childIndex: Integer): Element; getChildIndex(child: Element): Integer; + getHeadingAttributes(paragraphHeading: ParagraphHeading): Object; getImages(): InlineImage[]; getListItems(): ListItem[]; getMarginBottom(): Number; @@ -94,6 +95,7 @@ declare namespace GoogleAppsScript { removeChild(child: Element): Body; replaceText(searchPattern: string, replacement: string): Element; setAttributes(attributes: Object): Body; + setHeadingAttributes(paragraphHeading: ParagraphHeading, attributes: Object): Body; setMarginBottom(marginBottom: Number): Body; setMarginLeft(marginLeft: Number): Body; setMarginRight(marginRight: Number): Body; @@ -230,14 +232,15 @@ declare namespace GoogleAppsScript { * doc = DocumentApp.create('Document Name'); */ export interface DocumentApp { - Attribute: Attribute - ElementType: ElementType - FontFamily: FontFamily - GlyphType: GlyphType - HorizontalAlignment: HorizontalAlignment - ParagraphHeading: ParagraphHeading - TextAlignment: TextAlignment - VerticalAlignment: VerticalAlignment + Attribute: typeof Attribute; + ElementType: typeof ElementType; + FontFamily: typeof FontFamily; + GlyphType: typeof GlyphType; + HorizontalAlignment: typeof HorizontalAlignment; + ParagraphHeading: typeof ParagraphHeading; + PositionedLayout: typeof PositionedLayout; + TextAlignment: typeof TextAlignment; + VerticalAlignment: typeof VerticalAlignment; create(name: string): Document; getActiveDocument(): Document; getUi(): Base.Ui; @@ -737,6 +740,8 @@ declare namespace GoogleAppsScript { */ export interface InlineDrawing { copy(): InlineDrawing; + getAltDescription(): string; + getAltTitle(): string; getAttributes(): Object; getNextSibling(): Element; getParent(): ContainerElement; @@ -745,6 +750,8 @@ declare namespace GoogleAppsScript { isAtDocumentEnd(): boolean; merge(): InlineDrawing; removeFromParent(): InlineDrawing; + setAltDescription(description: string): InlineDrawing; + setAltTitle(title: string): InlineDrawing; setAttributes(attributes: Object): InlineDrawing; } @@ -757,6 +764,8 @@ declare namespace GoogleAppsScript { */ export interface InlineImage { copy(): InlineImage; + getAltDescription(): string; + getAltTitle(): string; getAs(contentType: string): Base.Blob; getAttributes(): Object; getBlob(): Base.Blob; @@ -770,6 +779,8 @@ declare namespace GoogleAppsScript { isAtDocumentEnd(): boolean; merge(): InlineImage; removeFromParent(): InlineImage; + setAltDescription(description: string): InlineImage; + setAltTitle(title: string): InlineImage; setAttributes(attributes: Object): InlineImage; setHeight(height: Integer): InlineImage; setLinkUrl(url: string): InlineImage; @@ -810,6 +821,7 @@ declare namespace GoogleAppsScript { * item2.setListId(item1); */ export interface ListItem { + addPositionedImage(image: Base.BlobSource): PositionedImage; appendHorizontalRule(): HorizontalRule; appendInlineImage(image: Base.BlobSource): InlineImage; appendInlineImage(image: InlineImage): InlineImage; @@ -840,6 +852,8 @@ declare namespace GoogleAppsScript { getNextSibling(): Element; getNumChildren(): Integer; getParent(): ContainerElement; + getPositionedImage(id: string): PositionedImage; + getPositionedImages(): PositionedImage[]; getPreviousSibling(): Element; getSpacingAfter(): Number; getSpacingBefore(): Number; @@ -858,6 +872,7 @@ declare namespace GoogleAppsScript { merge(): ListItem; removeChild(child: Element): ListItem; removeFromParent(): ListItem; + removePositionedImage(id: string): boolean; replaceText(searchPattern: string, replacement: string): Element; setAlignment(alignment: HorizontalAlignment): ListItem; setAttributes(attributes: Object): ListItem; @@ -945,6 +960,7 @@ declare namespace GoogleAppsScript { * body.appendParagraph("This is a typical paragraph."); */ export interface Paragraph { + addPositionedImage(image: Base.BlobSource): PositionedImage; appendHorizontalRule(): HorizontalRule; appendInlineImage(image: Base.BlobSource): InlineImage; appendInlineImage(image: InlineImage): InlineImage; @@ -972,6 +988,8 @@ declare namespace GoogleAppsScript { getNextSibling(): Element; getNumChildren(): Integer; getParent(): ContainerElement; + getPositionedImage(id: string): PositionedImage; + getPositionedImages(): PositionedImage[]; getPreviousSibling(): Element; getSpacingAfter(): Number; getSpacingBefore(): Number; @@ -990,6 +1008,7 @@ declare namespace GoogleAppsScript { merge(): Paragraph; removeChild(child: Element): Paragraph; removeFromParent(): Paragraph; + removePositionedImage(id: string): boolean; replaceText(searchPattern: string, replacement: string): Element; setAlignment(alignment: HorizontalAlignment): Paragraph; setAttributes(attributes: Object): Paragraph; @@ -1059,6 +1078,54 @@ declare namespace GoogleAppsScript { insertText(text: string): Text; } + /** + * Fixed position image anchored to a Paragraph. + * Unlike an InlineImage, + * a PositionedImage is not an + * Element. + * It does not have a parent or sibling + * Element. + * Instead, it is anchored to a Paragraph + * or ListItem, + * and is placed via offsets from that anchor. A PositionedImage + * has an ID that can be used to reference it. + * + * var body = DocumentApp.getActiveDocument().getBody(); + * + * // Append a new paragraph. + * var paragraph = body.appendParagraph("New paragraph to anchor the image to."); + * + * // Get an image in Drive from its ID. + * var image = DriveApp.getFileById('ENTER_IMAGE_FILE_ID_HERE').getBlob(); + * + * // Add the PositionedImage with offsets (in points). + * var posImage = paragraph.addPositionedImage(image) + * .setTopOffset(60) + * .setLeftOffset(40); + */ + export interface PositionedImage { + getAs(contentType: string): Base.Blob; + getBlob(): Base.Blob; + getHeight(): Integer; + getId(): string; + getLayout(): PositionedLayout; + getLeftOffset(): Number; + getParagraph(): Paragraph; + getTopOffset(): Number; + getWidth(): Integer; + setHeight(height: Integer): PositionedImage; + setLayout(layout: PositionedLayout): PositionedImage; + setLeftOffset(offset: Number): PositionedImage; + setTopOffset(offset: Number): PositionedImage; + setWidth(width: Integer): PositionedImage; + } + + /** + * An enumeration that specifies how to lay out a PositionedImage in + * relation to surrounding text. + */ + export enum PositionedLayout { ABOVE_TEXT, BREAK_BOTH, BREAK_LEFT, BREAK_RIGHT, WRAP_TEXT } + /** * A range of elements in a document. The user's selection is represented as a * Range, among other uses. Scripts can only access the selection of the user who is running @@ -1215,6 +1282,7 @@ declare namespace GoogleAppsScript { getBackgroundColor(): string; getChild(childIndex: Integer): Element; getChildIndex(child: Element): Integer; + getColSpan(): Integer; getLinkUrl(): string; getNextSibling(): Element; getNumChildren(): Integer; @@ -1226,6 +1294,7 @@ declare namespace GoogleAppsScript { getParentRow(): TableRow; getParentTable(): Table; getPreviousSibling(): Element; + getRowSpan(): Integer; getText(): string; getTextAlignment(): TextAlignment; getType(): ElementType; diff --git a/types/google-apps-script/google-apps-script.drive.d.ts b/types/google-apps-script/google-apps-script.drive.d.ts index d0fba208f8..36693eaf9f 100644 --- a/types/google-apps-script/google-apps-script.drive.d.ts +++ b/types/google-apps-script/google-apps-script.drive.d.ts @@ -1,10 +1,10 @@ -// Type definitions for Google Apps Script 2015-11-12 +// Type definitions for Google Apps Script 2017-05-12 // Project: https://developers.google.com/apps-script/ // Definitions by: motemen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - +/// +/// declare namespace GoogleAppsScript { export module Drive { @@ -14,8 +14,7 @@ declare namespace GoogleAppsScript { * DriveApp.Access. * * // Creates a folder that anyone on the Internet can read from and write to. (Domain - * // administrators can prohibit this setting for users of Google Apps for Business, Google Apps - * // for Education, or Google Apps for Your Domain.) + * // administrators can prohibit this setting for users of a G Suite domain.) * var folder = DriveApp.createFolder('Shared Folder'); * folder.setSharing(DriveApp.Access.ANYONE, DriveApp.Permission.EDIT); */ @@ -32,8 +31,8 @@ declare namespace GoogleAppsScript { * } */ export interface DriveApp { - Access: Access - Permission: Permission + Access: typeof Access; + Permission: typeof Permission; addFile(child: File): Folder; addFolder(child: Folder): Folder; continueFileIterator(continuationToken: string): FileIterator; @@ -234,12 +233,11 @@ declare namespace GoogleAppsScript { * DriveApp.Permission. * * // Creates a folder that anyone on the Internet can read from and write to. (Domain - * // administrators can prohibit this setting for users of Google Apps for Business, Google Apps - * // for Education, or Google Apps for Your Domain.) + * // administrators can prohibit this setting for users of a G Suite domain.) * var folder = DriveApp.createFolder('Shared Folder'); * folder.setSharing(DriveApp.Access.ANYONE, DriveApp.Permission.EDIT); */ - export enum Permission { VIEW, EDIT, COMMENT, OWNER, NONE } + export enum Permission { VIEW, EDIT, COMMENT, OWNER, ORGANIZER, NONE } /** * A user associated with a file in Google Drive. Users can be accessed from diff --git a/types/google-apps-script/google-apps-script.forms.d.ts b/types/google-apps-script/google-apps-script.forms.d.ts index 3ce3e41672..e10c47b169 100644 --- a/types/google-apps-script/google-apps-script.forms.d.ts +++ b/types/google-apps-script/google-apps-script.forms.d.ts @@ -1,10 +1,10 @@ -// Type definitions for Google Apps Script 2015-11-12 +// Type definitions for Google Apps Script 2017-05-12 // Project: https://developers.google.com/apps-script/ // Definitions by: motemen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - +/// +/// declare namespace GoogleAppsScript { export module Forms { @@ -22,8 +22,9 @@ declare namespace GoogleAppsScript { export enum Alignment { LEFT, CENTER, RIGHT } /** - * A question item that allows the respondent to select one or more checkboxes, as well as an - * optional "other" field. Items can be accessed or created from a Form. + * A question item that allows the respondent to select one or more checkboxes, as well + * as an optional "other" field. Items can be accessed or created from a Form. When used in + * a quiz, these items are autograded. * * // Open a form by ID and add a new checkbox item. * var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz'); @@ -37,25 +38,81 @@ declare namespace GoogleAppsScript { * .showOtherOption(true); */ export interface CheckboxItem { + clearValidation(): CheckboxItem; createChoice(value: string): Choice; + createChoice(value: string, isCorrect: boolean): Choice; createResponse(responses: String[]): ItemResponse; duplicate(): CheckboxItem; getChoices(): Choice[]; + getFeedbackForCorrect(): QuizFeedback; + getFeedbackForIncorrect(): QuizFeedback; getHelpText(): string; getId(): Integer; getIndex(): Integer; + getPoints(): Integer; getTitle(): string; getType(): ItemType; hasOtherOption(): boolean; isRequired(): boolean; setChoiceValues(values: String[]): CheckboxItem; setChoices(choices: Choice[]): CheckboxItem; + setFeedbackForCorrect(feedback: QuizFeedback): CheckboxItem; + setFeedbackForIncorrect(feedback: QuizFeedback): CheckboxItem; setHelpText(text: string): CheckboxItem; + setPoints(points: Integer): CheckboxItem; setRequired(enabled: boolean): CheckboxItem; setTitle(title: string): CheckboxItem; + setValidation(validation: CheckboxValidation): CheckboxItem; showOtherOption(enabled: boolean): CheckboxItem; } + /** + * A DataValidation for a CheckboxItem. + * + * // Add a checkBox item to a form and require exactly two selections. + * var checkBoxItem = form.addCheckboxItem(); + * checkBoxItem.setTitle('What two condiments would you like on your hot dog?'); + * checkBoxItem.setChoices([ + * checkBoxItem.createChoice('Ketchup'), + * checkBoxItem.createChoice('Mustard'), + * checkBoxItem.createChoice('Relish') + * ]); + * var checkBoxValidation = FormApp.createCheckboxValidation() + * .setHelpText(“Select two condiments.”) + * .requireSelectExactly(2) + * .build(); + * checkBoxItem.setValidation(checkBoxValidation); + */ + export interface CheckboxValidation { + getHelpText(): string; + } + + /** + * A DataValidationBuilder for a CheckboxValidation. + * + * // Add a checkBox item to a form and require exactly two selections. + * var checkBoxItem = form.addCheckboxItem(); + * checkBoxItem.setTitle('What two condiments would you like on your hot dog?'); + * checkBoxItem.setChoices([ + * checkBoxItem.createChoice('Ketchup'), + * checkBoxItem.createChoice('Mustard'), + * checkBoxItem.createChoice('Relish') + * ]); + * var checkBoxValidation = FormApp.createCheckboxValidation() + * .setHelpText(“Select two condiments.”) + * .requireSelectExactly(2) + * .build(); + * checkBoxItem.setValidation(checkBoxValidation); + */ + export interface CheckboxValidationBuilder { + build(): CheckboxValidation; + copy(): CheckboxValidationBuilder; + requireSelectAtLeast(number: Integer): CheckboxValidationBuilder; + requireSelectAtMost(number: Integer): CheckboxValidationBuilder; + requireSelectExactly(number: Integer): CheckboxValidationBuilder; + setHelpText(text: string): CheckboxValidationBuilder; + } + /** * A single choice associated with a type of Item that supports choices, like * CheckboxItem, ListItem, or MultipleChoiceItem. @@ -84,11 +141,45 @@ declare namespace GoogleAppsScript { getGotoPage(): PageBreakItem; getPageNavigationType(): PageNavigationType; getValue(): string; + isCorrectAnswer(): boolean; } /** - * A question item that allows the respondent to indicate a date. Items can be accessed or created - * from a Form. + * The base DataValidation that contains properties common to all validations, such as help text. + * Validations can be added to certain Form items. + * + * // Add a text item to a form and require it to be a number within a range. + * var textItem = form.addTextItem().setTitle('Pick a number between 1 and 100?'); + * var textValidation = FormApp.createTextValidation() + * .setHelpText(“Input was not a number between 1 and 100.”) + * .requireNumberBetween(1, 100); + * textItem.setValidation(textValidation); + */ + export interface DataValidation { + getHelpText(): string; + } + + /** + * The base DataValidationBuilder that contains setters for properties common to all validations, + * such as help text. Used to build DataValadation objects. + * + * // Add a text item to a form and require it to be a number within a range. + * var textItem = form.addTextItem().setTitle('Pick a number between 1 and 100?'); + * var textValidation = FormApp.createTextValidation() + * .setHelpText(“Input was not a number between 1 and 100.”) + * .requireNumberBetween(1, 100) + * .build(); + * textItem.setValidation(textValidation); + */ + export interface DataValidationBuilder { + build(): DataValidation; + copy(): DataValidationBuilder; + setHelpText(text: string): DataValidationBuilder; + } + + /** + * A question item that allows the respondent to indicate a date. Items can be accessed or + * created from a Form. When used in a quiz, these items are graded. * * // Open a form by ID and add a new date item. * var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz'); @@ -98,22 +189,26 @@ declare namespace GoogleAppsScript { export interface DateItem { createResponse(response: Date): ItemResponse; duplicate(): DateItem; + getGeneralFeedback(): QuizFeedback; getHelpText(): string; getId(): Integer; getIndex(): Integer; + getPoints(): Integer; getTitle(): string; getType(): ItemType; includesYear(): boolean; isRequired(): boolean; + setGeneralFeedback(feedback: QuizFeedback): DateItem; setHelpText(text: string): DateItem; setIncludesYear(enableYear: boolean): DateItem; + setPoints(points: Integer): DateItem; setRequired(enabled: boolean): DateItem; setTitle(title: string): DateItem; } /** - * A question item that allows the respondent to indicate a date and time. Items can be accessed or - * created from a Form. + * A question item that allows the respondent to indicate a date and time. Items can be + * accessed or created from a Form. When used in a quiz, these items are graded. * * // Open a form by ID and add a new date-time item. * var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz'); @@ -123,15 +218,19 @@ declare namespace GoogleAppsScript { export interface DateTimeItem { createResponse(response: Date): ItemResponse; duplicate(): DateTimeItem; + getGeneralFeedback(): QuizFeedback; getHelpText(): string; getId(): Integer; getIndex(): Integer; + getPoints(): Integer; getTitle(): string; getType(): ItemType; includesYear(): boolean; isRequired(): boolean; + setGeneralFeedback(feedback: QuizFeedback): DateTimeItem; setHelpText(text: string): DateTimeItem; setIncludesYear(enableYear: boolean): DateTimeItem; + setPoints(points: Integer): DateTimeItem; setRequired(enabled: boolean): DateTimeItem; setTitle(title: string): DateTimeItem; } @@ -153,8 +252,8 @@ declare namespace GoogleAppsScript { export enum DestinationType { SPREADSHEET } /** - * A question item that allows the respondent to indicate a length of time. Items can be accessed or - * created from a Form. + * A question item that allows the respondent to indicate a length of time. Items can be + * accessed or created from a Form. When used in a quiz, these items are graded. * * // Open a form by ID and add a new duration item. * var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz'); @@ -164,21 +263,44 @@ declare namespace GoogleAppsScript { export interface DurationItem { createResponse(hours: Integer, minutes: Integer, seconds: Integer): ItemResponse; duplicate(): DurationItem; + getGeneralFeedback(): QuizFeedback; getHelpText(): string; getId(): Integer; getIndex(): Integer; + getPoints(): Integer; getTitle(): string; getType(): ItemType; isRequired(): boolean; + setGeneralFeedback(feedback: QuizFeedback): DurationItem; setHelpText(text: string): DurationItem; + setPoints(points: Integer): DurationItem; setRequired(enabled: boolean): DurationItem; setTitle(title: string): DurationItem; } /** - * A form that contains overall properties (such as title, settings, and where responses are stored) - * and items (which includes question items like checkboxes and layout items like page breaks). - * Forms can be accessed or created from FormApp. + * An enum representing the supported types of feedback. Feedback types can be accessed from + * FormApp.FeedbackType. + * + * // Open a form by ID and add a new list item. + * var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz'); + * var item = form.addListItem(); + * item.setTitle('Do you prefer cats or dogs?'); + * // Set "Dogs" as the correct answer to this question. + * item.setChoices([ + * item.createChoice('Dogs', true), + * item.createChoice('Cats', false)]); + * // Add feedback which will be shown for correct responses; ie "Dogs". + * item.setFeedbackForCorrect( + * FormApp.createFeedback().setDisplayText("Dogs rule, cats drool.").build()); + */ + export enum FeedbackType { CORRECT, INCORRECT, GENERAL } + + /** + * A form that contains overall properties and items. Properties include title, settings, and + * where responses are stored. Items include question items like checkboxes or radio items, while + * layout items refer to things like page breaks. Forms can be accessed or created from + * FormApp. * * // Open a form by ID and create a new spreadsheet. * var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz'); @@ -242,6 +364,7 @@ declare namespace GoogleAppsScript { hasRespondAgainLink(): boolean; isAcceptingResponses(): boolean; isPublishingSummary(): boolean; + isQuiz(): boolean; moveItem(from: Integer, to: Integer): Item; moveItem(item: Item, toIndex: Integer): Item; removeDestination(): Form; @@ -255,6 +378,7 @@ declare namespace GoogleAppsScript { setCustomClosedFormMessage(message: string): Form; setDescription(description: string): Form; setDestination(type: DestinationType, id: string): Form; + setIsQuiz(enabled: boolean): Form; setLimitOneResponsePerUser(enabled: boolean): Form; setProgressBar(enabled: boolean): Form; setPublishingSummary(enabled: boolean): Form; @@ -263,10 +387,11 @@ declare namespace GoogleAppsScript { setShuffleQuestions(shuffle: boolean): Form; setTitle(title: string): Form; shortenFormUrl(url: string): string; + submitGrades(responses: FormResponse[]): Form; } /** - * Allows a script to open existing Forms or create new ones. + * Allows a script to open an existing Form or create a new one. * * // Open a form by ID. * var existingForm = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz'); @@ -275,11 +400,17 @@ declare namespace GoogleAppsScript { * var newForm = FormApp.create('Form Name'); */ export interface FormApp { - Alignment: Alignment - DestinationType: DestinationType - ItemType: ItemType - PageNavigationType: PageNavigationType + Alignment: typeof Alignment; + DestinationType: typeof DestinationType; + FeedbackType: typeof FeedbackType; + ItemType: typeof ItemType; + PageNavigationType: typeof PageNavigationType; create(title: string): Form; + createCheckboxValidation(): CheckboxValidationBuilder; + createFeedback(): QuizFeedbackBuilder; + createGridValidation(): GridValidationBuilder; + createParagraphTextValidation(): ParagraphTextValidationBuilder; + createTextValidation(): TextValidationBuilder; getActiveForm(): Form; getUi(): Base.Ui; openById(id: string): Form; @@ -287,11 +418,11 @@ declare namespace GoogleAppsScript { } /** - * A response to the form as a whole. Form responses have three main uses: they contain the answers - * submitted by a respondent (see getItemResponses(), they can be used to programmatically - * respond to the form (see withItemResponse(response) and submit()), and they - * can be used as a template to create a URL for the form with pre-filled answers. Form responses - * can be created or accessed from a Form. + * A response to the form as a whole. A FormResponse can be used in three ways: to + * access the answers submitted by a respondent (see getItemResponses()), to + * programmatically submit a response to the form (see withItemResponse(response) and + * submit()), and to generate a URL for the form which pre-fills fields using the + * provided answers. FormResponses can be created or accessed from a Form. * * // Open a form by ID and log the responses to each question. * var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz'); @@ -310,6 +441,8 @@ declare namespace GoogleAppsScript { */ export interface FormResponse { getEditResponseUrl(): string; + getGradableItemResponses(): ItemResponse[]; + getGradableResponseForItem(item: Item): ItemResponse; getId(): string; getItemResponses(): ItemResponse[]; getRespondentEmail(): string; @@ -317,13 +450,14 @@ declare namespace GoogleAppsScript { getTimestamp(): Date; submit(): FormResponse; toPrefilledUrl(): string; + withItemGrade(gradedResponse: ItemResponse): FormResponse; withItemResponse(response: ItemResponse): FormResponse; } /** * A question item, presented as a grid of columns and rows, that allows the respondent to select * one choice per row from a sequence of radio buttons. Items can be accessed or created from a - * Form. + * Form. * * // Open a form by ID and add a new grid item. * var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz'); @@ -333,6 +467,7 @@ declare namespace GoogleAppsScript { * .setColumns(['Boring', 'So-so', 'Interesting']); */ export interface GridItem { + clearValidation(): GridItem; createResponse(responses: String[]): ItemResponse; duplicate(): GridItem; getColumns(): String[]; @@ -348,6 +483,46 @@ declare namespace GoogleAppsScript { setRequired(enabled: boolean): GridItem; setRows(rows: String[]): GridItem; setTitle(title: string): GridItem; + setValidation(validation: GridValidation): GridItem; + } + + /** + * A DataValidation for a GridItem. + * + * // Add a grid item to a form and require one response per column. + * var gridItem = form.addGridItem(); + * gridItem.setTitle('Rate your interests') + * .setRows(['Cars', 'Computers', 'Celebrities']) + * .setColumns(['Boring', 'So-so', 'Interesting']); + * var gridValidation = FormApp.createGridValidation() + * .setHelpText(“Select one item per column.”) + * .requireLimitOneResponsePerColumn() + * .build(); + * gridItem.setValidation(gridValidation); + */ + export interface GridValidation { + getHelpText(): string; + } + + /** + * A DataValidationBuilder for a GridValidation. + * + * // Add a grid item to a form and require one response per column. + * var gridItem = form.addGridItem(); + * gridItem.setTitle('Rate your interests') + * .setRows(['Cars', 'Computers', 'Celebrities']) + * .setColumns(['Boring', 'So-so', 'Interesting']); + * var gridValidation = FormApp.createGridValidation() + * .setHelpText(“Select one item per column.”) + * .requireLimitOneResponsePerColumn() + * .build(); + * gridItem.setValidation(gridValidation); + */ + export interface GridValidationBuilder { + build(): GridValidation; + copy(): GridValidationBuilder; + requireLimitOneResponsePerColumn(): GridValidationBuilder; + setHelpText(text: string): GridValidationBuilder; } /** @@ -447,8 +622,12 @@ declare namespace GoogleAppsScript { * } */ export interface ItemResponse { + getFeedback(): Object; getItem(): Item; getResponse(): Object; + getScore(): Object; + setFeedback(feedback: Object): ItemResponse; + setScore(score: Object): ItemResponse; } /** @@ -482,27 +661,35 @@ declare namespace GoogleAppsScript { */ export interface ListItem { createChoice(value: string): Choice; + createChoice(value: string, isCorrect: boolean): Choice; createChoice(value: string, navigationItem: PageBreakItem): Choice; createChoice(value: string, navigationType: PageNavigationType): Choice; createResponse(response: string): ItemResponse; duplicate(): ListItem; getChoices(): Choice[]; + getFeedbackForCorrect(): QuizFeedback; + getFeedbackForIncorrect(): QuizFeedback; getHelpText(): string; getId(): Integer; getIndex(): Integer; + getPoints(): Integer; getTitle(): string; getType(): ItemType; isRequired(): boolean; setChoiceValues(values: String[]): ListItem; setChoices(choices: Choice[]): ListItem; + setFeedbackForCorrect(feedback: QuizFeedback): ListItem; + setFeedbackForIncorrect(feedback: QuizFeedback): ListItem; setHelpText(text: string): ListItem; + setPoints(points: Integer): ListItem; setRequired(enabled: boolean): ListItem; setTitle(title: string): ListItem; } /** - * A question item that allows the respondent to select one choice from a list of radio buttons or - * an optional "other" field. Items can be accessed or created from a Form. + * A question item that allows the respondent to select one choice from a list of radio + * buttons or an optional "other" field. Items can be accessed or created from a Form. + * When used in a quiz, these items are autograded. * * // Open a form by ID and add a new multiple choice item. * var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz'); @@ -516,21 +703,28 @@ declare namespace GoogleAppsScript { */ export interface MultipleChoiceItem { createChoice(value: string): Choice; + createChoice(value: string, isCorrect: boolean): Choice; createChoice(value: string, navigationItem: PageBreakItem): Choice; createChoice(value: string, navigationType: PageNavigationType): Choice; createResponse(response: string): ItemResponse; duplicate(): MultipleChoiceItem; getChoices(): Choice[]; + getFeedbackForCorrect(): QuizFeedback; + getFeedbackForIncorrect(): QuizFeedback; getHelpText(): string; getId(): Integer; getIndex(): Integer; + getPoints(): Integer; getTitle(): string; getType(): ItemType; hasOtherOption(): boolean; isRequired(): boolean; setChoiceValues(values: String[]): MultipleChoiceItem; setChoices(choices: Choice[]): MultipleChoiceItem; + setFeedbackForCorrect(feedback: QuizFeedback): MultipleChoiceItem; + setFeedbackForIncorrect(feedback: QuizFeedback): MultipleChoiceItem; setHelpText(text: string): MultipleChoiceItem; + setPoints(points: Integer): MultipleChoiceItem; setRequired(enabled: boolean): MultipleChoiceItem; setTitle(title: string): MultipleChoiceItem; showOtherOption(enabled: boolean): MultipleChoiceItem; @@ -593,8 +787,8 @@ declare namespace GoogleAppsScript { export enum PageNavigationType { CONTINUE, GO_TO_PAGE, RESTART, SUBMIT } /** - * A question item that allows the respondent to enter a block of text. Items can be accessed or - * created from a Form. + * A question item that allows the respondent to enter a block of text. Items can be + * accessed or created from a Form. When used in a quiz, these items are graded. * * // Open a form by ID and add a new paragraph text item. * var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz'); @@ -602,22 +796,107 @@ declare namespace GoogleAppsScript { * item.setTitle('What is your address?'); */ export interface ParagraphTextItem { + clearValidation(): ParagraphTextItem; createResponse(response: string): ItemResponse; duplicate(): ParagraphTextItem; + getGeneralFeedback(): QuizFeedback; getHelpText(): string; getId(): Integer; getIndex(): Integer; + getPoints(): Integer; getTitle(): string; getType(): ItemType; isRequired(): boolean; + setGeneralFeedback(feedback: QuizFeedback): ParagraphTextItem; setHelpText(text: string): ParagraphTextItem; + setPoints(points: Integer): ParagraphTextItem; setRequired(enabled: boolean): ParagraphTextItem; setTitle(title: string): ParagraphTextItem; + setValidation(validation: ParagraphTextValidation): ParagraphTextItem; } /** - * A question item that allows the respondent to choose one option from a numbered sequence of radio - * buttons. Items can be accessed or created from a Form. + * A DataValidation for a ParagraphTextItem. + * + * // Add a paragraph text item to a form and require the answer to be at least 100 characters. + * var paragraphTextItem = form.addParagraphTextItem().setTitle('Describe yourself:'); + * var paragraphtextValidation = FormApp.createParagraphTextValidation() + * .setHelpText(“Answer must be more than 100 characters.”) + * .requireTextLengthGreatherThan(100); + * paragraphTextItem.setValidation(paragraphtextValidation); + */ + export interface ParagraphTextValidation { + getHelpText(): string; + } + + /** + * A DataValidationBuilder for a ParagraphTextValidation. + * + * // Add a paragraph text item to a form and require the answer to be at least 100 characters. + * var paragraphTextItem = form.addParagraphTextItem().setTitle('Describe yourself:'); + * var paragraphtextValidation = FormApp.createParagraphTextValidation() + * .setHelpText(“Answer must be more than 100 characters.”) + * .requireTextLengthGreatherThan(100); + * paragraphTextItem.setValidation(paragraphtextValidation); + */ + export interface ParagraphTextValidationBuilder { + build(): ParagraphTextValidation; + copy(): ParagraphTextValidationBuilder; + requireTextContainsPattern(pattern: string): ParagraphTextValidationBuilder; + requireTextDoesNotContainPattern(pattern: string): ParagraphTextValidationBuilder; + requireTextDoesNotMatchPattern(pattern: string): ParagraphTextValidationBuilder; + requireTextLengthGreaterThanOrEqualTo(number: Integer): ParagraphTextValidationBuilder; + requireTextLengthLessThanOrEqualTo(number: Integer): ParagraphTextValidationBuilder; + requireTextMatchesPattern(pattern: string): ParagraphTextValidationBuilder; + setHelpText(text: string): ParagraphTextValidationBuilder; + } + + /** + * The bean implementation of a Feedback, which contains properties common to all feedback, such as + * display text or links. + * + * Feedback can be added to gradeable Form items. + * + * // Setting feedback which should be automatically shown when a user responds to a question + * // incorrectly. + * var textItem = form.addTextItem().setTitle('Re-hydrating dried fruit is an example of what?'); + * var feedback = FormApp.createFeedback() + * .setDisplayText( + * “Good answer, but not quite right. Please review chapter 4 before next time.”) + * .addLink("http://wikipedia.com/osmosis"); + * textItem.setFeedbackForIncorrect(feedback); + */ + export interface QuizFeedback { + getLinkUrls(): String[]; + getText(): string; + } + + /** + * The base FeedbackBuilder that contains setters for properties common to all feedback, + * such as display text. Used to build Feedback objects. + * + * // Open a form by ID and add a new list item. + * var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz'); + * var item = form.addListItem(); + * item.setTitle('Do you prefer cats or dogs?'); + * item.setChoices([ + * item.createChoice('Dogs', true), + * item.createChoice('Cats', false)]); + * // Add feedback which will be shown for correct responses; ie "Dogs". + * item.setFeedbackForCorrect(FormApp.createFeedback().setText("Dogs rule, cats drool.").build()); + */ + export interface QuizFeedbackBuilder { + addLink(url: string): QuizFeedbackBuilder; + addLink(url: string, displayText: string): QuizFeedbackBuilder; + build(): QuizFeedback; + copy(): QuizFeedbackBuilder; + setText(text: string): QuizFeedbackBuilder; + } + + /** + * A question item that allows the respondent to choose one option from a numbered sequence + * of radio buttons. Items can be accessed or created from a Form. When used in a quiz, + * these items are graded. * * // Open a form by ID and add a new scale item. * var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz'); @@ -628,19 +907,23 @@ declare namespace GoogleAppsScript { export interface ScaleItem { createResponse(response: Integer): ItemResponse; duplicate(): ScaleItem; + getGeneralFeedback(): QuizFeedback; getHelpText(): string; getId(): Integer; getIndex(): Integer; getLeftLabel(): string; getLowerBound(): Integer; + getPoints(): Integer; getRightLabel(): string; getTitle(): string; getType(): ItemType; getUpperBound(): Integer; isRequired(): boolean; setBounds(lower: Integer, upper: Integer): ScaleItem; + setGeneralFeedback(feedback: QuizFeedback): ScaleItem; setHelpText(text: string): ScaleItem; setLabels(lower: string, upper: string): ScaleItem; + setPoints(points: Integer): ScaleItem; setRequired(enabled: boolean): ScaleItem; setTitle(title: string): ScaleItem; } @@ -666,8 +949,8 @@ declare namespace GoogleAppsScript { } /** - * A question item that allows the respondent to enter a single line of text. Items can be accessed - * or created from a Form. + * A question item that allows the respondent to enter a single line of text. Items can be + * accessed or created from a Form. When used in a quiz, these items are graded. * * // Open a form by ID and add a new text item. * var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz'); @@ -675,22 +958,77 @@ declare namespace GoogleAppsScript { * item.setTitle('What is your name?'); */ export interface TextItem { + clearValidation(): TextItem; createResponse(response: string): ItemResponse; duplicate(): TextItem; + getGeneralFeedback(): QuizFeedback; getHelpText(): string; getId(): Integer; getIndex(): Integer; + getPoints(): Integer; getTitle(): string; getType(): ItemType; isRequired(): boolean; + setGeneralFeedback(feedback: QuizFeedback): TextItem; setHelpText(text: string): TextItem; + setPoints(points: Integer): TextItem; setRequired(enabled: boolean): TextItem; setTitle(title: string): TextItem; + setValidation(validation: TextValidation): TextItem; } /** - * A question item that allows the respondent to indicate a time of day. Items can be accessed or - * created from a Form. + * A DataValidation for a TextItem. + * + * // Add a text item to a form and require it to be a number within a range. + * var textItem = form.addTextItem().setTitle('Pick a number between 1 and 100?'); + * var textValidation = FormApp.createTextValidation() + * .setHelpText(“Input was not a number between 1 and 100.”) + * .requireNumberBetween(1, 100) + * .build(); + * textItem.setValidation(textValidation); + */ + export interface TextValidation { + getHelpText(): string; + } + + /** + * A DataValidationBuilder for a TextValidation. + * + * // Add a text item to a form and require it to be a number within a range. + * var textItem = form.addTextItem().setTitle('Pick a number between 1 and 100?'); + * var textValidation = FormApp.createTextValidation() + * .setHelpText(“Input was not a number between 1 and 100.”) + * .requireNumberBetween(1, 100); + * textItem.setValidation(textValidation); + */ + export interface TextValidationBuilder { + build(): TextValidation; + copy(): TextValidationBuilder; + requireNumber(): TextValidationBuilder; + requireNumberBetween(start: Number, end: Number): TextValidationBuilder; + requireNumberEqualTo(number: Number): TextValidationBuilder; + requireNumberGreaterThan(number: Number): TextValidationBuilder; + requireNumberGreaterThanOrEqualTo(number: Number): TextValidationBuilder; + requireNumberLessThan(number: Number): TextValidationBuilder; + requireNumberLessThanOrEqualTo(number: Number): TextValidationBuilder; + requireNumberNotBetween(start: Number, end: Number): TextValidationBuilder; + requireNumberNotEqualTo(number: Number): TextValidationBuilder; + requireTextContainsPattern(pattern: string): TextValidationBuilder; + requireTextDoesNotContainPattern(pattern: string): TextValidationBuilder; + requireTextDoesNotMatchPattern(pattern: string): TextValidationBuilder; + requireTextIsEmail(): TextValidationBuilder; + requireTextIsUrl(): TextValidationBuilder; + requireTextLengthGreaterThanOrEqualTo(number: Integer): TextValidationBuilder; + requireTextLengthLessThanOrEqualTo(number: Integer): TextValidationBuilder; + requireTextMatchesPattern(pattern: string): TextValidationBuilder; + requireWholeNumber(): TextValidationBuilder; + setHelpText(text: string): TextValidationBuilder; + } + + /** + * A question item that allows the respondent to indicate a time of day. Items can be + * accessed or created from a Form. When used in a quiz, these items are graded. * * // Open a form by ID and add a new time item. * var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz'); @@ -700,13 +1038,17 @@ declare namespace GoogleAppsScript { export interface TimeItem { createResponse(hour: Integer, minute: Integer): ItemResponse; duplicate(): TimeItem; + getGeneralFeedback(): QuizFeedback; getHelpText(): string; getId(): Integer; getIndex(): Integer; + getPoints(): Integer; getTitle(): string; getType(): ItemType; isRequired(): boolean; + setGeneralFeedback(feedback: QuizFeedback): TimeItem; setHelpText(text: string): TimeItem; + setPoints(points: Integer): TimeItem; setRequired(enabled: boolean): TimeItem; setTitle(title: string): TimeItem; } diff --git a/types/google-apps-script/google-apps-script.gmail.d.ts b/types/google-apps-script/google-apps-script.gmail.d.ts index d76f0f1895..fd0bda2b13 100644 --- a/types/google-apps-script/google-apps-script.gmail.d.ts +++ b/types/google-apps-script/google-apps-script.gmail.d.ts @@ -1,10 +1,10 @@ -// Type definitions for Google Apps Script 2015-11-12 +// Type definitions for Google Apps Script 2017-05-12 // Project: https://developers.google.com/apps-script/ // Definitions by: motemen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - +/// +/// declare namespace GoogleAppsScript { export module Gmail { diff --git a/types/google-apps-script/google-apps-script.groups.d.ts b/types/google-apps-script/google-apps-script.groups.d.ts index dfcf7d79a5..e6833bb840 100644 --- a/types/google-apps-script/google-apps-script.groups.d.ts +++ b/types/google-apps-script/google-apps-script.groups.d.ts @@ -1,10 +1,10 @@ -// Type definitions for Google Apps Script 2015-11-12 +// Type definitions for Google Apps Script 2017-05-12 // Project: https://developers.google.com/apps-script/ // Definitions by: motemen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - +/// +/// declare namespace GoogleAppsScript { export module Groups { @@ -46,7 +46,7 @@ declare namespace GoogleAppsScript { * Logger.log('You belong to ' + groups.length + ' groups.'); */ export interface GroupsApp { - Role: Role + Role: typeof Role; getGroupByEmail(email: string): Group; getGroups(): Group[]; } diff --git a/types/google-apps-script/google-apps-script.html.d.ts b/types/google-apps-script/google-apps-script.html.d.ts index 3b62ffcb08..f471d23eb3 100644 --- a/types/google-apps-script/google-apps-script.html.d.ts +++ b/types/google-apps-script/google-apps-script.html.d.ts @@ -1,10 +1,10 @@ -// Type definitions for Google Apps Script 2015-11-12 +// Type definitions for Google Apps Script 2017-05-12 // Project: https://developers.google.com/apps-script/ // Definitions by: motemen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - +/// +/// declare namespace GoogleAppsScript { export module HTML { @@ -22,6 +22,7 @@ declare namespace GoogleAppsScript { * guide to restrictions in HTML service */ export interface HtmlOutput { + addMetaTag(name: string, content: string): HtmlOutput; append(addedContent: string): HtmlOutput; appendUntrusted(addedContent: string): HtmlOutput; asTemplate(): HtmlTemplate; @@ -29,14 +30,33 @@ declare namespace GoogleAppsScript { getAs(contentType: string): Base.Blob; getBlob(): Base.Blob; getContent(): string; + getFaviconUrl(): string; getHeight(): Integer; + getMetaTags(): HtmlOutputMetaTag[]; getTitle(): string; getWidth(): Integer; setContent(content: string): HtmlOutput; + setFaviconUrl(iconUrl: string): HtmlOutput; setHeight(height: Integer): HtmlOutput; setSandboxMode(mode: SandboxMode): HtmlOutput; setTitle(title: string): HtmlOutput; setWidth(width: Integer): HtmlOutput; + setXFrameOptionsMode(mode: XFrameOptionsMode): HtmlOutput; + } + + /** + * An object that represents a meta tag added to the page by calling + * HtmlOutput.addMetaTag(name, content). + * + * var output = HtmlService.createHtmlOutput('Hello, world!'); + * output.addMetaTag('viewport', 'width=device-width, initial-scale=1'); + * + * var tags = output.getMetaTags(); + * Logger.log('', tags[0].getName(), tags[0].getContent()); + */ + export interface HtmlOutputMetaTag { + getContent(): string; + getName(): string; } /** @@ -47,7 +67,8 @@ declare namespace GoogleAppsScript { * HtmlOutput for what limitations this implies on what can be returned. */ export interface HtmlService { - SandboxMode: SandboxMode + SandboxMode: typeof SandboxMode; + XFrameOptionsMode: typeof XFrameOptionsMode; createHtmlOutput(): HtmlOutput; createHtmlOutput(blob: Base.BlobSource): HtmlOutput; createHtmlOutput(html: string): HtmlOutput; @@ -74,24 +95,17 @@ declare namespace GoogleAppsScript { * scripts. These values can be accessed from HtmlService.SandboxMode, and set by calling * HtmlOutput.setSandboxMode(mode). * + * The NATIVE and EMULATED modes were + * deprecated on October 13, 2015 and both are + * now sunset. + * Only IFRAME mode is now supported. * To protect users from being served malicious HTML or JavaScript, client-side code served from * HTML service executes in a security sandbox that imposes restrictions on the code. The method - * HtmlOutput.setSandboxMode(mode) allows script authors to choose between - * different versions of the sandbox. For more information, see the + * HtmlOutput.setSandboxMode(mode) previously allowed script authors to choose + * between different versions of the sandbox, but now has no effect. For more information, see the * guide to restrictions in HTML service. - * If a script does not set a sandbox mode, Apps Script uses NATIVE mode as the default. - * Prior to February 2014, the default was EMULATED. The default is subject to change. * The IFRAME mode imposes many fewer restrictions than the other sandbox modes and runs - * fastest, but does not work at all in certain older browsers, including Internet Explorer 9. By - * contrast, EMULATED mode is more likely to work in - * older browsers that do not support ECMAScript 5 strict - * mode, most notably Internet Explorer 9. NATIVE mode is the middle ground. If - * NATIVE mode is set but not supported in the user's browser, the sandbox mode falls back - * to EMULATED mode for that user. - * - * // Serve HTML with a defined sandbox mode (in Apps Script server-side code). - * var output = HtmlService.createHtmlOutput('Hello, world!'); - * output.setSandboxMode(HtmlService.SandboxMode.IFRAME); + * fastest, but does not work at all in certain older browsers, including Internet Explorer 9. * * google.script.sandbox.mode * @@ -102,6 +116,23 @@ declare namespace GoogleAppsScript { */ export enum SandboxMode { EMULATED, IFRAME, NATIVE } + /** + * An enum representing the X-Frame-Options modes that can be used for client-side + * HtmlService scripts. These values can be accessed from + * HtmlService.XFrameOptionsMode, and set by calling + * HtmlOutput.setXFrameOptionsMode(mode). + * + * Setting XFrameOptionsMode.ALLOWALL will let any site iframe the page, so the developer + * should implement their own protection against clickjacking. + * If a script does not set an X-Frame-Options mode, Apps Script uses DEFAULT + * mode as the default. + * + * // Serve HTML with no X-Frame-Options header (in Apps Script server-side code). + * var output = HtmlService.createHtmlOutput('Hello, world!'); + * output.setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL); + */ + export enum XFrameOptionsMode { ALLOWALL, DEFAULT } + } } diff --git a/types/google-apps-script/google-apps-script.jdbc.d.ts b/types/google-apps-script/google-apps-script.jdbc.d.ts index 16950cff32..ff1a0baf13 100644 --- a/types/google-apps-script/google-apps-script.jdbc.d.ts +++ b/types/google-apps-script/google-apps-script.jdbc.d.ts @@ -1,10 +1,10 @@ -// Type definitions for Google Apps Script 2015-11-12 +// Type definitions for Google Apps Script 2017-05-12 // Project: https://developers.google.com/apps-script/ // Definitions by: motemen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - +/// +/// declare namespace GoogleAppsScript { export module JDBC { diff --git a/types/google-apps-script/google-apps-script.language.d.ts b/types/google-apps-script/google-apps-script.language.d.ts index c820f7620e..488568feec 100644 --- a/types/google-apps-script/google-apps-script.language.d.ts +++ b/types/google-apps-script/google-apps-script.language.d.ts @@ -1,9 +1,9 @@ -// Type definitions for Google Apps Script 2015-11-12 +// Type definitions for Google Apps Script 2017-05-12 // Project: https://developers.google.com/apps-script/ // Definitions by: motemen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - +/// declare namespace GoogleAppsScript { export module Language { diff --git a/types/google-apps-script/google-apps-script.lock.d.ts b/types/google-apps-script/google-apps-script.lock.d.ts index 65891f2844..f255efbc14 100644 --- a/types/google-apps-script/google-apps-script.lock.d.ts +++ b/types/google-apps-script/google-apps-script.lock.d.ts @@ -1,9 +1,9 @@ -// Type definitions for Google Apps Script 2015-11-12 +// Type definitions for Google Apps Script 2017-05-12 // Project: https://developers.google.com/apps-script/ // Definitions by: motemen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - +/// declare namespace GoogleAppsScript { export module Lock { diff --git a/types/google-apps-script/google-apps-script.mail.d.ts b/types/google-apps-script/google-apps-script.mail.d.ts index 11c97f80fa..2cb8b3cb5f 100644 --- a/types/google-apps-script/google-apps-script.mail.d.ts +++ b/types/google-apps-script/google-apps-script.mail.d.ts @@ -1,9 +1,9 @@ -// Type definitions for Google Apps Script 2015-11-12 +// Type definitions for Google Apps Script 2017-05-12 // Project: https://developers.google.com/apps-script/ // Definitions by: motemen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - +/// declare namespace GoogleAppsScript { export module Mail { diff --git a/types/google-apps-script/google-apps-script.maps.d.ts b/types/google-apps-script/google-apps-script.maps.d.ts index 02e4ac0195..e9620ee144 100644 --- a/types/google-apps-script/google-apps-script.maps.d.ts +++ b/types/google-apps-script/google-apps-script.maps.d.ts @@ -1,10 +1,10 @@ -// Type definitions for Google Apps Script 2015-11-12 +// Type definitions for Google Apps Script 2017-05-12 // Project: https://developers.google.com/apps-script/ // Definitions by: motemen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - +/// +/// declare namespace GoogleAppsScript { export module Maps { @@ -93,8 +93,8 @@ declare namespace GoogleAppsScript { * A collection of enums used by DirectionFinder. */ export interface DirectionFinderEnums { - Avoid: Avoid - Mode: Mode + Avoid: typeof Avoid; + Mode: typeof Mode; } /** @@ -200,8 +200,8 @@ declare namespace GoogleAppsScript { * images. */ export interface Maps { - DirectionFinder: DirectionFinderEnums - StaticMap: StaticMapEnums + DirectionFinder: DirectionFinderEnums; + StaticMap: StaticMapEnums; decodePolyline(polyline: string): Number[]; encodePolyline(points: Number[]): string; newDirectionFinder(): DirectionFinder; @@ -299,10 +299,10 @@ declare namespace GoogleAppsScript { * A collection of enums used by StaticMap. */ export interface StaticMapEnums { - Color: Color - Format: Format - MarkerSize: MarkerSize - Type: Type + Color: typeof Color; + Format: typeof Format; + MarkerSize: typeof MarkerSize; + Type: typeof Type; } /** diff --git a/types/google-apps-script/google-apps-script.optimization.d.ts b/types/google-apps-script/google-apps-script.optimization.d.ts index 0217618a25..8ac192c1e6 100644 --- a/types/google-apps-script/google-apps-script.optimization.d.ts +++ b/types/google-apps-script/google-apps-script.optimization.d.ts @@ -1,9 +1,9 @@ -// Type definitions for Google Apps Script 2015-11-12 +// Type definitions for Google Apps Script 2017-05-12 // Project: https://developers.google.com/apps-script/ // Definitions by: motemen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - +/// declare namespace GoogleAppsScript { export module Optimization { @@ -86,6 +86,7 @@ declare namespace GoogleAppsScript { addConstraint(lowerBound: Number, upperBound: Number): LinearOptimizationConstraint; addVariable(name: string, lowerBound: Number, upperBound: Number): LinearOptimizationEngine; addVariable(name: string, lowerBound: Number, upperBound: Number, type: VariableType): LinearOptimizationEngine; + addVariable(name: string, lowerBound: Number, upperBound: Number, type: VariableType, objectiveCoefficient: Number): LinearOptimizationEngine; setMaximization(): LinearOptimizationEngine; setMinimization(): LinearOptimizationEngine; setObjectiveCoefficient(variableName: string, coefficient: Number): LinearOptimizationEngine; @@ -146,8 +147,8 @@ declare namespace GoogleAppsScript { * } */ export interface LinearOptimizationService { - Status: Status - VariableType: VariableType + Status: typeof Status; + VariableType: typeof VariableType; createEngine(): LinearOptimizationEngine; } diff --git a/types/google-apps-script/google-apps-script.properties.d.ts b/types/google-apps-script/google-apps-script.properties.d.ts index 9ceb24608e..5622fec6f8 100644 --- a/types/google-apps-script/google-apps-script.properties.d.ts +++ b/types/google-apps-script/google-apps-script.properties.d.ts @@ -1,9 +1,9 @@ -// Type definitions for Google Apps Script 2015-11-12 +// Type definitions for Google Apps Script 2017-05-12 // Project: https://developers.google.com/apps-script/ // Definitions by: motemen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - +/// declare namespace GoogleAppsScript { export module Properties { diff --git a/types/google-apps-script/google-apps-script.script.d.ts b/types/google-apps-script/google-apps-script.script.d.ts index bd1a5340d9..209feaa0a1 100644 --- a/types/google-apps-script/google-apps-script.script.d.ts +++ b/types/google-apps-script/google-apps-script.script.d.ts @@ -1,13 +1,13 @@ -// Type definitions for Google Apps Script 2015-11-12 +// Type definitions for Google Apps Script 2017-05-12 // Project: https://developers.google.com/apps-script/ // Definitions by: motemen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - - - - +/// +/// +/// +/// +/// declare namespace GoogleAppsScript { export module Script { @@ -118,18 +118,18 @@ declare namespace GoogleAppsScript { * triggers and control publishing the script as a service. */ export interface ScriptApp { - AuthMode: AuthMode - AuthorizationStatus: AuthorizationStatus - EventType: EventType - InstallationSource: InstallationSource - TriggerSource: TriggerSource - WeekDay: Base.Weekday + AuthMode: typeof AuthMode; + AuthorizationStatus: typeof AuthorizationStatus; + EventType: typeof EventType; + InstallationSource: typeof InstallationSource; + TriggerSource: typeof TriggerSource; + WeekDay: typeof Base.Weekday; deleteTrigger(trigger: Trigger): void; getAuthorizationInfo(authMode: AuthMode): AuthorizationInfo; getInstallationSource(): InstallationSource; getOAuthToken(): string; - getProjectKey(): string; getProjectTriggers(): Trigger[]; + getScriptId(): string; getService(): Service; getUserTriggers(document: Document.Document): Trigger[]; getUserTriggers(form: Forms.Form): Trigger[]; @@ -137,13 +137,27 @@ declare namespace GoogleAppsScript { invalidateAuth(): void; newStateToken(): StateTokenBuilder; newTrigger(functionName: string): TriggerBuilder; + getProjectKey(): string; getScriptTriggers(): Trigger[]; } + /** + * Access and manipulate script publishing. + */ + export interface Service { + Restriction: typeof Service.Restriction; + disable(): void; + getUrl(): string; + isEnabled(): boolean; + enable(restriction: Service.Restriction): void; + } + /** * */ - export enum Service { MYSELF, DOMAIN, ALL } + namespace Service { + export enum Restriction { MYSELF, DOMAIN, ALL } + } /** * Builder for spreadsheet triggers. diff --git a/types/google-apps-script/google-apps-script.sites.d.ts b/types/google-apps-script/google-apps-script.sites.d.ts index acf1f8d6dc..6b21ffe529 100644 --- a/types/google-apps-script/google-apps-script.sites.d.ts +++ b/types/google-apps-script/google-apps-script.sites.d.ts @@ -1,10 +1,10 @@ -// Type definitions for Google Apps Script 2015-11-12 +// Type definitions for Google Apps Script 2017-05-12 // Project: https://developers.google.com/apps-script/ // Definitions by: motemen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - +/// +/// declare namespace GoogleAppsScript { export module Sites { @@ -12,6 +12,12 @@ declare namespace GoogleAppsScript { * A Sites Attachment such as a file attached to a page. * * Note that an Attachment is a Blob and can be used anywhere Blob input is expected. + * A + * rebuilt + * version of Sites was launched on November 22, 2016. Apps Script cannot currently access or + * modify Sites made with this version, but script can still access + * + * classic Sites. * * var filesPage = SitesApp.getSite('example.com', 'mysite').getChildByName("files"); * var attachments = filesPage.getAttachments(); @@ -42,11 +48,23 @@ declare namespace GoogleAppsScript { /** * A typesafe enum for sites attachment type. + * A + * rebuilt + * version of Sites was launched on November 22, 2016. Apps Script cannot currently access or + * modify Sites made with this version, but script can still access + * + * classic Sites. */ export enum AttachmentType { WEB, HOSTED } /** * A Sites Column - a column from a Sites List page. + * A + * rebuilt + * version of Sites was launched on November 22, 2016. Apps Script cannot currently access or + * modify Sites made with this version, but script can still access + * + * classic Sites. */ export interface Column { deleteColumn(): void; @@ -57,6 +75,12 @@ declare namespace GoogleAppsScript { /** * A Comment attached to any Sites page. + * A + * rebuilt + * version of Sites was launched on November 22, 2016. Apps Script cannot currently access or + * modify Sites made with this version, but script can still access + * + * classic Sites. */ export interface Comment { deleteComment(): void; @@ -72,6 +96,12 @@ declare namespace GoogleAppsScript { /** * A Sites ListItem - a list element from a Sites List page. + * A + * rebuilt + * version of Sites was launched on November 22, 2016. Apps Script cannot currently access or + * modify Sites made with this version, but script can still access + * + * classic Sites. */ export interface ListItem { deleteListItem(): void; @@ -87,6 +117,12 @@ declare namespace GoogleAppsScript { /** * A Page on a Google Site. + * A + * rebuilt + * version of Sites was launched on November 22, 2016. Apps Script cannot currently access or + * modify Sites made with this version, but script can still access + * + * classic Sites. */ export interface Page { addColumn(name: string): Column; @@ -113,8 +149,6 @@ declare namespace GoogleAppsScript { getChildren(): Page[]; getChildren(options: Object): Page[]; getColumns(): Column[]; - getComments(): Comment[]; - getComments(optOptions: Object): Comment[]; getDatePublished(): Date; getHtmlContent(): string; getIsDraft(): boolean; @@ -139,17 +173,31 @@ declare namespace GoogleAppsScript { setParent(parent: Page): Page; setTitle(title: string): Page; addComment(content: string): Comment; + getComments(): Comment[]; + getComments(optOptions: Object): Comment[]; getPageName(): string; getSelfLink(): string; } /** * A typesafe enum for sites page type. + * A + * rebuilt + * version of Sites was launched on November 22, 2016. Apps Script cannot currently access or + * modify Sites made with this version, but script can still access + * + * classic Sites. */ export enum PageType { WEB_PAGE, LIST_PAGE, ANNOUNCEMENT, ANNOUNCEMENTS_PAGE, FILE_CABINET_PAGE } /** * An object representing a Google Site. + * A + * rebuilt + * version of Sites was launched on November 22, 2016. Apps Script cannot currently access or + * modify Sites made with this version, but script can still access + * + * classic Sites. */ export interface Site { addEditor(emailAddress: string): Site; @@ -215,10 +263,16 @@ declare namespace GoogleAppsScript { /** * Create and access Google Sites. + * A + * rebuilt + * version of Sites was launched on November 22, 2016. Apps Script cannot currently access or + * modify Sites made with this version, but script can still access + * + * classic Sites. */ export interface SitesApp { - AttachmentType: AttachmentType - PageType: PageType + AttachmentType: typeof AttachmentType; + PageType: typeof PageType; copySite(domain: string, name: string, title: string, summary: string, site: Site): Site; createSite(domain: string, name: string, title: string, summary: string): Site; getActivePage(): Page; diff --git a/types/google-apps-script/google-apps-script.spreadsheet.d.ts b/types/google-apps-script/google-apps-script.spreadsheet.d.ts index a8f554e4bc..74ca8b2e79 100644 --- a/types/google-apps-script/google-apps-script.spreadsheet.d.ts +++ b/types/google-apps-script/google-apps-script.spreadsheet.d.ts @@ -1,15 +1,21 @@ -// Type definitions for Google Apps Script 2015-11-12 +// Type definitions for Google Apps Script 2017-05-12 // Project: https://developers.google.com/apps-script/ // Definitions by: motemen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - - - +/// +/// +/// +/// declare namespace GoogleAppsScript { export module Spreadsheet { + /** + * Styles that can be set on a range using + * Range.setBorder(top, left, bottom, right, vertical, horizontal, color, style). + */ + export enum BorderStyle { DOTTED, DASHED, SOLID } + /** * The chart's position within a sheet. Can be updated using the EmbeddedChart.modify() * function. @@ -135,6 +141,8 @@ declare namespace GoogleAppsScript { asAreaChart(): EmbeddedAreaChartBuilder; asBarChart(): EmbeddedBarChartBuilder; asColumnChart(): EmbeddedColumnChartBuilder; + asComboChart(): EmbeddedComboChartBuilder; + asHistogramChart(): EmbeddedHistogramChartBuilder; asLineChart(): EmbeddedLineChartBuilder; asPieChart(): EmbeddedPieChartBuilder; asScatterChart(): EmbeddedScatterChartBuilder; @@ -175,6 +183,8 @@ declare namespace GoogleAppsScript { asAreaChart(): EmbeddedAreaChartBuilder; asBarChart(): EmbeddedBarChartBuilder; asColumnChart(): EmbeddedColumnChartBuilder; + asComboChart(): EmbeddedComboChartBuilder; + asHistogramChart(): EmbeddedHistogramChartBuilder; asLineChart(): EmbeddedLineChartBuilder; asPieChart(): EmbeddedPieChartBuilder; asScatterChart(): EmbeddedScatterChartBuilder; @@ -265,6 +275,8 @@ declare namespace GoogleAppsScript { asAreaChart(): EmbeddedAreaChartBuilder; asBarChart(): EmbeddedBarChartBuilder; asColumnChart(): EmbeddedColumnChartBuilder; + asComboChart(): EmbeddedComboChartBuilder; + asHistogramChart(): EmbeddedHistogramChartBuilder; asLineChart(): EmbeddedLineChartBuilder; asPieChart(): EmbeddedPieChartBuilder; asScatterChart(): EmbeddedScatterChartBuilder; @@ -288,6 +300,8 @@ declare namespace GoogleAppsScript { asAreaChart(): EmbeddedAreaChartBuilder; asBarChart(): EmbeddedBarChartBuilder; asColumnChart(): EmbeddedColumnChartBuilder; + asComboChart(): EmbeddedComboChartBuilder; + asHistogramChart(): EmbeddedHistogramChartBuilder; asLineChart(): EmbeddedLineChartBuilder; asPieChart(): EmbeddedPieChartBuilder; asScatterChart(): EmbeddedScatterChartBuilder; @@ -318,6 +332,88 @@ declare namespace GoogleAppsScript { useLogScale(): EmbeddedColumnChartBuilder; } + /** + * Builder for combo charts. For more details, see the Gviz + * documentation. + */ + export interface EmbeddedComboChartBuilder { + addRange(range: Range): EmbeddedChartBuilder; + asAreaChart(): EmbeddedAreaChartBuilder; + asBarChart(): EmbeddedBarChartBuilder; + asColumnChart(): EmbeddedColumnChartBuilder; + asComboChart(): EmbeddedComboChartBuilder; + asHistogramChart(): EmbeddedHistogramChartBuilder; + asLineChart(): EmbeddedLineChartBuilder; + asPieChart(): EmbeddedPieChartBuilder; + asScatterChart(): EmbeddedScatterChartBuilder; + asTableChart(): EmbeddedTableChartBuilder; + build(): EmbeddedChart; + getChartType(): Charts.ChartType; + getContainer(): ContainerInfo; + getRanges(): Range[]; + removeRange(range: Range): EmbeddedChartBuilder; + reverseCategories(): EmbeddedComboChartBuilder; + setBackgroundColor(cssValue: string): EmbeddedComboChartBuilder; + setChartType(type: Charts.ChartType): EmbeddedChartBuilder; + setColors(cssValues: String[]): EmbeddedComboChartBuilder; + setLegendPosition(position: Charts.Position): EmbeddedComboChartBuilder; + setLegendTextStyle(textStyle: Charts.TextStyle): EmbeddedComboChartBuilder; + setOption(option: string, value: Object): EmbeddedChartBuilder; + setPosition(anchorRowPos: Integer, anchorColPos: Integer, offsetX: Integer, offsetY: Integer): EmbeddedChartBuilder; + setRange(start: Number, end: Number): EmbeddedComboChartBuilder; + setStacked(): EmbeddedComboChartBuilder; + setTitle(chartTitle: string): EmbeddedComboChartBuilder; + setTitleTextStyle(textStyle: Charts.TextStyle): EmbeddedComboChartBuilder; + setXAxisTextStyle(textStyle: Charts.TextStyle): EmbeddedComboChartBuilder; + setXAxisTitle(title: string): EmbeddedComboChartBuilder; + setXAxisTitleTextStyle(textStyle: Charts.TextStyle): EmbeddedComboChartBuilder; + setYAxisTextStyle(textStyle: Charts.TextStyle): EmbeddedComboChartBuilder; + setYAxisTitle(title: string): EmbeddedComboChartBuilder; + setYAxisTitleTextStyle(textStyle: Charts.TextStyle): EmbeddedComboChartBuilder; + useLogScale(): EmbeddedComboChartBuilder; + } + + /** + * Builder for histogram charts. For more details, see the Gviz + * documentation. + */ + export interface EmbeddedHistogramChartBuilder { + addRange(range: Range): EmbeddedChartBuilder; + asAreaChart(): EmbeddedAreaChartBuilder; + asBarChart(): EmbeddedBarChartBuilder; + asColumnChart(): EmbeddedColumnChartBuilder; + asComboChart(): EmbeddedComboChartBuilder; + asHistogramChart(): EmbeddedHistogramChartBuilder; + asLineChart(): EmbeddedLineChartBuilder; + asPieChart(): EmbeddedPieChartBuilder; + asScatterChart(): EmbeddedScatterChartBuilder; + asTableChart(): EmbeddedTableChartBuilder; + build(): EmbeddedChart; + getChartType(): Charts.ChartType; + getContainer(): ContainerInfo; + getRanges(): Range[]; + removeRange(range: Range): EmbeddedChartBuilder; + reverseCategories(): EmbeddedHistogramChartBuilder; + setBackgroundColor(cssValue: string): EmbeddedHistogramChartBuilder; + setChartType(type: Charts.ChartType): EmbeddedChartBuilder; + setColors(cssValues: String[]): EmbeddedHistogramChartBuilder; + setLegendPosition(position: Charts.Position): EmbeddedHistogramChartBuilder; + setLegendTextStyle(textStyle: Charts.TextStyle): EmbeddedHistogramChartBuilder; + setOption(option: string, value: Object): EmbeddedChartBuilder; + setPosition(anchorRowPos: Integer, anchorColPos: Integer, offsetX: Integer, offsetY: Integer): EmbeddedChartBuilder; + setRange(start: Number, end: Number): EmbeddedHistogramChartBuilder; + setStacked(): EmbeddedHistogramChartBuilder; + setTitle(chartTitle: string): EmbeddedHistogramChartBuilder; + setTitleTextStyle(textStyle: Charts.TextStyle): EmbeddedHistogramChartBuilder; + setXAxisTextStyle(textStyle: Charts.TextStyle): EmbeddedHistogramChartBuilder; + setXAxisTitle(title: string): EmbeddedHistogramChartBuilder; + setXAxisTitleTextStyle(textStyle: Charts.TextStyle): EmbeddedHistogramChartBuilder; + setYAxisTextStyle(textStyle: Charts.TextStyle): EmbeddedHistogramChartBuilder; + setYAxisTitle(title: string): EmbeddedHistogramChartBuilder; + setYAxisTitleTextStyle(textStyle: Charts.TextStyle): EmbeddedHistogramChartBuilder; + useLogScale(): EmbeddedHistogramChartBuilder; + } + /** * Builder for line charts. For more details, see the Gviz * documentation. @@ -327,6 +423,8 @@ declare namespace GoogleAppsScript { asAreaChart(): EmbeddedAreaChartBuilder; asBarChart(): EmbeddedBarChartBuilder; asColumnChart(): EmbeddedColumnChartBuilder; + asComboChart(): EmbeddedComboChartBuilder; + asHistogramChart(): EmbeddedHistogramChartBuilder; asLineChart(): EmbeddedLineChartBuilder; asPieChart(): EmbeddedPieChartBuilder; asScatterChart(): EmbeddedScatterChartBuilder; @@ -367,6 +465,8 @@ declare namespace GoogleAppsScript { asAreaChart(): EmbeddedAreaChartBuilder; asBarChart(): EmbeddedBarChartBuilder; asColumnChart(): EmbeddedColumnChartBuilder; + asComboChart(): EmbeddedComboChartBuilder; + asHistogramChart(): EmbeddedHistogramChartBuilder; asLineChart(): EmbeddedLineChartBuilder; asPieChart(): EmbeddedPieChartBuilder; asScatterChart(): EmbeddedScatterChartBuilder; @@ -398,6 +498,8 @@ declare namespace GoogleAppsScript { asAreaChart(): EmbeddedAreaChartBuilder; asBarChart(): EmbeddedBarChartBuilder; asColumnChart(): EmbeddedColumnChartBuilder; + asComboChart(): EmbeddedComboChartBuilder; + asHistogramChart(): EmbeddedHistogramChartBuilder; asLineChart(): EmbeddedLineChartBuilder; asPieChart(): EmbeddedPieChartBuilder; asScatterChart(): EmbeddedScatterChartBuilder; @@ -438,6 +540,8 @@ declare namespace GoogleAppsScript { asAreaChart(): EmbeddedAreaChartBuilder; asBarChart(): EmbeddedBarChartBuilder; asColumnChart(): EmbeddedColumnChartBuilder; + asComboChart(): EmbeddedComboChartBuilder; + asHistogramChart(): EmbeddedHistogramChartBuilder; asLineChart(): EmbeddedLineChartBuilder; asPieChart(): EmbeddedPieChartBuilder; asScatterChart(): EmbeddedScatterChartBuilder; @@ -462,6 +566,20 @@ declare namespace GoogleAppsScript { useAlternatingRowStyle(alternate: boolean): EmbeddedTableChartBuilder; } + /** + * Create, access and modify named ranges in a spreadsheet. + * Named ranges are ranges that have associated string aliases. + * They can be viewed and edited via the Sheets UI under the + * Data > Named ranges... menu. + */ + export interface NamedRange { + getName(): string; + getRange(): Range; + remove(): void; + setName(name: string): NamedRange; + setRange(range: Range): NamedRange; + } + /** * * Deprecated. For spreadsheets created in the newer version of Google Sheets, use the more powerful @@ -539,6 +657,7 @@ declare namespace GoogleAppsScript { removeEditors(emailAddresses: String[]): Protection; setDescription(description: string): Protection; setDomainEdit(editable: boolean): Protection; + setNamedRange(namedRange: NamedRange): Protection; setRange(range: Range): Protection; setRangeName(rangeName: string): Protection; setUnprotectedRanges(ranges: Range[]): Protection; @@ -599,6 +718,8 @@ declare namespace GoogleAppsScript { getDataTable(firstRowIsHeader: boolean): Charts.DataTable; getDataValidation(): DataValidation; getDataValidations(): DataValidation[][]; + getDisplayValue(): string; + getDisplayValues(): String[][]; getFontColor(): string; getFontColors(): String[][]; getFontFamilies(): String[][]; @@ -621,6 +742,7 @@ declare namespace GoogleAppsScript { getHorizontalAlignments(): String[][]; getLastColumn(): Integer; getLastRow(): Integer; + getMergedRanges(): Range[]; getNote(): string; getNotes(): String[][]; getNumColumns(): Integer; @@ -640,6 +762,7 @@ declare namespace GoogleAppsScript { isBlank(): boolean; isEndColumnBounded(): boolean; isEndRowBounded(): boolean; + isPartOfMerge(): boolean; isStartColumnBounded(): boolean; isStartRowBounded(): boolean; merge(): Range; @@ -654,6 +777,7 @@ declare namespace GoogleAppsScript { setBackgroundRGB(red: Integer, green: Integer, blue: Integer): Range; setBackgrounds(color: String[][]): Range; setBorder(top: boolean, left: boolean, bottom: boolean, right: boolean, vertical: boolean, horizontal: boolean): Range; + setBorder(top: boolean, left: boolean, bottom: boolean, right: boolean, vertical: boolean, horizontal: boolean, color: string, style: BorderStyle): Range; setDataValidation(rule: DataValidation): Range; setDataValidations(rules: DataValidation[][]): Range; setFontColor(color: string): Range; @@ -718,6 +842,7 @@ declare namespace GoogleAppsScript { getMaxColumns(): Integer; getMaxRows(): Integer; getName(): string; + getNamedRanges(): NamedRange[]; getParent(): Spreadsheet; getProtections(type: ProtectionType): Protection[]; getRange(row: Integer, column: Integer): Range; @@ -728,6 +853,7 @@ declare namespace GoogleAppsScript { getSheetId(): Integer; getSheetName(): string; getSheetValues(startRow: Integer, startColumn: Integer, numRows: Integer, numColumns: Integer): Object[][]; + getTabColor(): string; hideColumn(column: Range): void; hideColumns(columnIndex: Integer): void; hideColumns(columnIndex: Integer, numColumns: Integer): void; @@ -764,6 +890,7 @@ declare namespace GoogleAppsScript { setFrozenRows(rows: Integer): void; setName(name: string): Sheet; setRowHeight(rowPosition: Integer, height: Integer): Sheet; + setTabColor(color: string): Sheet; showColumns(columnIndex: Integer): void; showColumns(columnIndex: Integer, numColumns: Integer): void; showRows(rowIndex: Integer): void; @@ -815,6 +942,7 @@ declare namespace GoogleAppsScript { getLastColumn(): Integer; getLastRow(): Integer; getName(): string; + getNamedRanges(): NamedRange[]; getNumSheets(): Integer; getOwner(): Base.User; getProtections(type: ProtectionType): Protection[]; @@ -893,8 +1021,9 @@ declare namespace GoogleAppsScript { * the parent class for the Spreadsheet service. */ export interface SpreadsheetApp { - DataValidationCriteria: DataValidationCriteria - ProtectionType: ProtectionType + BorderStyle: typeof BorderStyle; + DataValidationCriteria: typeof DataValidationCriteria; + ProtectionType: typeof ProtectionType; create(name: string): Spreadsheet; create(name: string, rows: Integer, columns: Integer): Spreadsheet; flush(): void; diff --git a/types/google-apps-script/google-apps-script.types.d.ts b/types/google-apps-script/google-apps-script.types.d.ts index d5d2989b5c..5204a8a2a4 100644 --- a/types/google-apps-script/google-apps-script.types.d.ts +++ b/types/google-apps-script/google-apps-script.types.d.ts @@ -3,7 +3,7 @@ // Definitions by: motemen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare namespace GoogleAppsScript { +declare module GoogleAppsScript { type BigNumber = any; type Byte = number; type Integer = number; diff --git a/types/google-apps-script/google-apps-script.ui.d.ts b/types/google-apps-script/google-apps-script.ui.d.ts index 6d08082dc8..bd4424351e 100644 --- a/types/google-apps-script/google-apps-script.ui.d.ts +++ b/types/google-apps-script/google-apps-script.ui.d.ts @@ -1,9 +1,9 @@ -// Type definitions for Google Apps Script 2015-11-12 +// Type definitions for Google Apps Script 2017-05-12 // Project: https://developers.google.com/apps-script/ // Definitions by: motemen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - +/// declare namespace GoogleAppsScript { export module UI { @@ -3263,13 +3263,13 @@ declare namespace GoogleAppsScript { * * deprecated on December 11, 2014. To create user interfaces, use the * HTML service instead. - * Create user interfaces for use inside Google Apps or as standalone services. + * Create user interfaces for use inside G Suite or as standalone services. */ export interface UiApp { - DateTimeFormat: DateTimeFormat - FileType: FileType - HorizontalAlignment: HorizontalAlignment - VerticalAlignment: VerticalAlignment + DateTimeFormat: typeof DateTimeFormat; + FileType: typeof FileType; + HorizontalAlignment: typeof HorizontalAlignment; + VerticalAlignment: typeof VerticalAlignment; createApplication(): UiInstance; getActiveApplication(): UiInstance; getUserAgent(): string; diff --git a/types/google-apps-script/google-apps-script.url-fetch.d.ts b/types/google-apps-script/google-apps-script.url-fetch.d.ts index 94db3c3a7c..b9ede5163e 100644 --- a/types/google-apps-script/google-apps-script.url-fetch.d.ts +++ b/types/google-apps-script/google-apps-script.url-fetch.d.ts @@ -1,10 +1,10 @@ -// Type definitions for Google Apps Script 2015-11-12 +// Type definitions for Google Apps Script 2017-05-12 // Project: https://developers.google.com/apps-script/ // Definitions by: motemen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - +/// +/// declare namespace GoogleAppsScript { export module URL_Fetch { @@ -25,30 +25,6 @@ declare namespace GoogleAppsScript { getResponseCode(): Integer; } - /** - * - * Deprecated. This class is deprecated and should not be used in new scripts. - * Represents configuration settings for an OAuth-enabled remote service. - * See also - * - * UrlFetchApp - */ - export interface OAuthConfig { - getAccessTokenUrl(): string; - getAuthorizationUrl(): string; - getMethod(): string; - getParamLocation(): string; - getRequestTokenUrl(): string; - getServiceName(): string; - setAccessTokenUrl(url: string): void; - setAuthorizationUrl(url: string): void; - setConsumerKey(consumerKey: string): void; - setConsumerSecret(consumerSecret: string): void; - setMethod(method: string): void; - setParamLocation(location: string): void; - setRequestTokenUrl(url: string): void; - } - /** * Fetch resources and communicate with other hosts over the Internet. * @@ -58,8 +34,6 @@ declare namespace GoogleAppsScript { * and scaling purposes. * See also * - * OAuthConfig - * * HTTPResponse */ export interface UrlFetchApp { @@ -67,8 +41,6 @@ declare namespace GoogleAppsScript { fetch(url: string, params: Object): HTTPResponse; getRequest(url: string): Object; getRequest(url: string, params: Object): Object; - addOAuthService(serviceName: string): OAuthConfig; - removeOAuthService(serviceName: string): void; } } diff --git a/types/google-apps-script/google-apps-script.utilities.d.ts b/types/google-apps-script/google-apps-script.utilities.d.ts index 3deb1734f4..2beda0bfc1 100644 --- a/types/google-apps-script/google-apps-script.utilities.d.ts +++ b/types/google-apps-script/google-apps-script.utilities.d.ts @@ -1,10 +1,10 @@ -// Type definitions for Google Apps Script 2015-11-12 +// Type definitions for Google Apps Script 2017-05-12 // Project: https://developers.google.com/apps-script/ // Definitions by: motemen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - +/// +/// declare namespace GoogleAppsScript { export module Utilities { @@ -28,9 +28,9 @@ declare namespace GoogleAppsScript { * and other miscellaneous tasks. */ export interface Utilities { - Charset: Charset - DigestAlgorithm: DigestAlgorithm - MacAlgorithm: MacAlgorithm + Charset: typeof Charset; + DigestAlgorithm: typeof DigestAlgorithm; + MacAlgorithm: typeof MacAlgorithm; base64Decode(encoded: string): Byte[]; base64Decode(encoded: string, charset: Charset): Byte[]; base64DecodeWebSafe(encoded: string): Byte[]; @@ -51,6 +51,7 @@ declare namespace GoogleAppsScript { computeRsaSha256Signature(value: string, key: string, charset: Charset): Byte[]; formatDate(date: Date, timeZone: string, format: string): string; formatString(template: string, ...args: Object[]): string; + getUuid(): string; newBlob(data: Byte[]): Base.Blob; newBlob(data: Byte[], contentType: string): Base.Blob; newBlob(data: Byte[], contentType: string, name: string): Base.Blob; diff --git a/types/google-apps-script/google-apps-script.xml-service.d.ts b/types/google-apps-script/google-apps-script.xml-service.d.ts index d45d4d16a8..664fbfc2b9 100644 --- a/types/google-apps-script/google-apps-script.xml-service.d.ts +++ b/types/google-apps-script/google-apps-script.xml-service.d.ts @@ -1,9 +1,9 @@ -// Type definitions for Google Apps Script 2015-11-12 +// Type definitions for Google Apps Script 2017-05-12 // Project: https://developers.google.com/apps-script/ // Definitions by: motemen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - +/// declare namespace GoogleAppsScript { export module XML_Service { @@ -283,9 +283,9 @@ declare namespace GoogleAppsScript { /** * This service allows scripts to parse, navigate, and programmatically create XML documents. * - * // Log the title and labels for the first page of blog posts on the Google Apps Developer blog. + * // Log the title and labels for the first page of blog posts on the G Suite Developer blog. * function parseXml() { - * var url = 'http://googleappsdeveloper.blogspot.com/atom.xml'; + * var url = 'https://gsuite-developers.googleblog.com/atom.xml'; * var xml = UrlFetchApp.fetch(url).getContentText(); * var document = XmlService.parse(xml); * var root = document.getRootElement(); @@ -320,7 +320,7 @@ declare namespace GoogleAppsScript { * } */ export interface XmlService { - ContentTypes: ContentType + ContentTypes: typeof ContentType; createCdata(text: string): Cdata; createComment(text: string): Comment; createDocType(elementName: string): DocType; From 88b5e8747b100e295508f06595edb81f49125681 Mon Sep 17 00:00:00 2001 From: olamothe Date: Fri, 12 May 2017 11:02:04 -0400 Subject: [PATCH 0028/1105] _.pairs in chaining mode should return T[] instead of T --- types/underscore/index.d.ts | 2 +- types/underscore/underscore-tests.ts | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/types/underscore/index.d.ts b/types/underscore/index.d.ts index 856bf8e0fa..eb8fdb57e0 100644 --- a/types/underscore/index.d.ts +++ b/types/underscore/index.d.ts @@ -5689,7 +5689,7 @@ declare module _ { * Wrapped type `object`. * @see _.pairs **/ - pairs(): _Chain; + pairs(): _Chain; /** * Wrapped type `object`. diff --git a/types/underscore/underscore-tests.ts b/types/underscore/underscore-tests.ts index 9953540fa8..6a423355e2 100644 --- a/types/underscore/underscore-tests.ts +++ b/types/underscore/underscore-tests.ts @@ -520,6 +520,11 @@ function chain_tests() { .groupBy('property') .mapObject((objects: any) => _.pluck(objects, 'value')) .value(); // { odd: [1], even: [0, 2] } + + var matrixOfString : string[][] = _.chain({'foo' : '1', 'bar': '1'}) + .keys() // return ['foo', 'bar'] : string[] + .pairs() // return [['foo', '0'], ['bar', '1']] : string[][] + .value(); } var obj: { [k: string] : number } = { From b1411b43c807c4ac2054bcbae8ac058264bc89ad Mon Sep 17 00:00:00 2001 From: olamothe Date: Fri, 12 May 2017 11:05:41 -0400 Subject: [PATCH 0029/1105] Alignment --- types/underscore/underscore-tests.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/underscore/underscore-tests.ts b/types/underscore/underscore-tests.ts index 6a423355e2..047c367769 100644 --- a/types/underscore/underscore-tests.ts +++ b/types/underscore/underscore-tests.ts @@ -522,9 +522,9 @@ function chain_tests() { .value(); // { odd: [1], even: [0, 2] } var matrixOfString : string[][] = _.chain({'foo' : '1', 'bar': '1'}) - .keys() // return ['foo', 'bar'] : string[] - .pairs() // return [['foo', '0'], ['bar', '1']] : string[][] - .value(); + .keys() // return ['foo', 'bar'] : string[] + .pairs() // return [['foo', '0'], ['bar', '1']] : string[][] + .value(); } var obj: { [k: string] : number } = { From a85e080d33c12ff87269fc5aa71a3427e09c6cbc Mon Sep 17 00:00:00 2001 From: Olivier Lamothe Date: Fri, 12 May 2017 11:08:37 -0400 Subject: [PATCH 0030/1105] Update test --- types/underscore/underscore-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/underscore/underscore-tests.ts b/types/underscore/underscore-tests.ts index 047c367769..11dcf477a0 100644 --- a/types/underscore/underscore-tests.ts +++ b/types/underscore/underscore-tests.ts @@ -522,7 +522,7 @@ function chain_tests() { .value(); // { odd: [1], even: [0, 2] } var matrixOfString : string[][] = _.chain({'foo' : '1', 'bar': '1'}) - .keys() // return ['foo', 'bar'] : string[] + .keys() // return ['foo', 'bar'] : string[] .pairs() // return [['foo', '0'], ['bar', '1']] : string[][] .value(); } From a06e0abe58d11a2eaad6abd4ebfe7e31e47d9f80 Mon Sep 17 00:00:00 2001 From: fretje Date: Fri, 12 May 2017 22:13:47 +0200 Subject: [PATCH 0031/1105] Add SchedulerView and TimelineView Previous SchedulerView => SchedulerViewOptions (more inline with the rest of the naming) Also: remove some ? from event parameters that don't need it (the javascript code has been checked) --- types/kendo-ui/index.d.ts | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/types/kendo-ui/index.d.ts b/types/kendo-ui/index.d.ts index 9848335e49..53a5a36602 100644 --- a/types/kendo-ui/index.d.ts +++ b/types/kendo-ui/index.d.ts @@ -1294,7 +1294,7 @@ declare namespace kendo.data { interface DataSourcePushEvent extends DataSourceEvent { items?: DataSourceItemOrGroup[]; type?: string; - + } interface DataSourceErrorEvent extends DataSourceEvent { @@ -1553,15 +1553,27 @@ declare namespace kendo.drawing.pdf { } declare namespace kendo.ui { - class AgendaView implements kendo.ui.SchedulerView { - static fn: AgendaView; + class SchedulerView extends Widget { + static fn: SchedulerView; startDate(): Date; endDate(): Date; + static extend(proto: Object): SchedulerView; + } + + class AgendaView extends SchedulerView { + static fn: AgendaView; + static extend(proto: Object): AgendaView; } + class TimelineView extends SchedulerView { + static fn: TimelineView; + + static extend(proto: Object): TimelineView; + } + class Alert extends kendo.ui.Dialog { static fn: Alert; @@ -4018,7 +4030,7 @@ declare namespace kendo.ui { interface GridDetailInitEvent extends GridEvent { data?: kendo.data.ObservableObject; - detailCell?: JQuery; + detailCell: JQuery; detailRow?: JQuery; masterRow?: JQuery; } @@ -4595,7 +4607,7 @@ declare namespace kendo.ui { } interface NotificationShowEvent extends NotificationEvent { - element?: JQuery; + element: JQuery; } @@ -5408,8 +5420,7 @@ declare namespace kendo.ui { slotByPosition(xPosition: number, yPosition: number): any; slotByElement(element: Element): any; slotByElement(element: JQuery): any; - view(type?: string): void; - view(): kendo.ui.SchedulerView; + view(type?: string): void | SchedulerView; viewName(): string; } @@ -5620,7 +5631,7 @@ declare namespace kendo.ui { orientation?: string; } - interface SchedulerView { + interface SchedulerViewOptions { allDayEventTemplate?: string|Function; allDaySlot?: boolean; allDaySlotTemplate?: string|Function; @@ -5629,7 +5640,7 @@ declare namespace kendo.ui { dayTemplate?: string|Function; editable?: boolean|SchedulerViewEditable; endDate?(): Date; - endTime?: Date; + endTime?: Date; eventHeight?: number; eventTemplate?: string|Function; eventTimeTemplate?: string|Function; @@ -5643,10 +5654,10 @@ declare namespace kendo.ui { selectedShortDateFormat?: string; showWorkHours?: boolean; slotTemplate?: string|Function; - startDate?(): Date; + startDate?(): Date; startTime?: Date; title?: string; - type?: string; + type?: string | SchedulerView; workWeekStart?: number; workWeekEnd?: number; } @@ -5691,7 +5702,7 @@ declare namespace kendo.ui { startTime?: Date; timezone?: string; toolbar?: SchedulerToolbarItem[]; - views?: SchedulerView[]; + views?: SchedulerViewOptions[]; width?: number|string; workDayStart?: Date; workDayEnd?: Date; @@ -18498,7 +18509,7 @@ declare namespace kendo.ooxml { interface WorkbookSheetRow { cells?: WorkbookSheetRowCell[]; index?: number; - height?: number; + height?: number; type?: "header" | "footer" | "group-header" | "group-footer" | "data"; } @@ -18756,7 +18767,7 @@ declare namespace kendo.dataviz.geometry { setHeight(value: number): kendo.geometry.Size; } - + interface SizeOptions { name?: string; } From 0da3fd26fe726bd8d895881cbec31f5021bcf5e9 Mon Sep 17 00:00:00 2001 From: Peter Burns Date: Fri, 12 May 2017 13:19:53 -0700 Subject: [PATCH 0032/1105] node: pause() and resume() return `this` Readable streams and streamlike interfaces in node have pause() and resume() methods. They're defined to return `this` in the documentation: https://nodejs.org/api/stream.html#stream_readable_pause This is relevant when someone extends a stream, as the pause and resume methods on a subtype should return the subtype, not the super type. --- types/node/v6/index.d.ts | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/types/node/v6/index.d.ts b/types/node/v6/index.d.ts index ebc2b516d6..6e3ce46435 100644 --- a/types/node/v6/index.d.ts +++ b/types/node/v6/index.d.ts @@ -281,8 +281,8 @@ declare namespace NodeJS { readable: boolean; read(size?: number): string | Buffer; setEncoding(encoding: string | null): void; - pause(): ReadableStream; - resume(): ReadableStream; + pause(): this; + resume(): this; isPaused(): boolean; pipe(destination: T, options?: { end?: boolean; }): T; unpipe(destination?: T): void; @@ -301,10 +301,7 @@ declare namespace NodeJS { end(str: string, encoding?: string, cb?: Function): void; } - export interface ReadWriteStream extends ReadableStream, WritableStream { - pause(): ReadWriteStream; - resume(): ReadWriteStream; - } + export interface ReadWriteStream extends ReadableStream, WritableStream {} export interface Events extends EventEmitter { } @@ -1431,8 +1428,8 @@ declare module "readline" { setPrompt(prompt: string): void; prompt(preserveCursor?: boolean): void; question(query: string, callback: (answer: string) => void): void; - pause(): ReadLine; - resume(): ReadLine; + pause(): this; + resume(): this; close(): void; write(data: string | Buffer, key?: Key): void; @@ -1939,8 +1936,6 @@ declare module "net" { setEncoding(encoding?: string): void; write(data: any, encoding?: string, callback?: Function): void; destroy(): void; - pause(): Socket; - resume(): Socket; setTimeout(timeout: number, callback?: Function): void; setNoDelay(noDelay?: boolean): void; setKeepAlive(enable?: boolean, initialDelay?: number): void; @@ -3432,8 +3427,8 @@ declare module "stream" { _read(size: number): void; read(size?: number): any; setEncoding(encoding: string): void; - pause(): Readable; - resume(): Readable; + pause(): this; + resume(): this; isPaused(): boolean; pipe(destination: T, options?: { end?: boolean; }): T; unpipe(destination?: T): void; From 603afd5edbbf395c93ca6e3e71313183ee735818 Mon Sep 17 00:00:00 2001 From: Simon Mo Date: Sat, 13 May 2017 10:54:59 +0100 Subject: [PATCH 0033/1105] Linted algoliasearch-tests.ts --- types/algoliasearch/algoliasearch-tests.ts | 98 +++++++++++----------- 1 file changed, 48 insertions(+), 50 deletions(-) diff --git a/types/algoliasearch/algoliasearch-tests.ts b/types/algoliasearch/algoliasearch-tests.ts index a3a04aadc2..1e1a6296ba 100644 --- a/types/algoliasearch/algoliasearch-tests.ts +++ b/types/algoliasearch/algoliasearch-tests.ts @@ -1,19 +1,19 @@ -import algoliasearch = require('algoliasearch'); +import * as algoliasearch from "algoliasearch"; import { ClientOptions, SynonymOption, AlgoliaUserKeyOptions, SearchSynonymOptions, AlgoliaSecuredApiOptions, AlgoliaIndexSettings, AlgoliaQueryParameters, AlgoliaIndex } from "algoliasearch"; -var _clientOptions: ClientOptions = { - timeout : 12, +let _clientOptions: ClientOptions = { + timeout: 12, protocol: "", httpAgent: "" }; -var _synonymOption: SynonymOption = { +let _synonymOption: SynonymOption = { forwardToSlaves: false, replaceExistingSynonyms: false }; -var _algoliaUserKeyOptions : AlgoliaUserKeyOptions = { +let _algoliaUserKeyOptions: AlgoliaUserKeyOptions = { validity: 0, maxQueriesPerIPPerHour: 0, indexes: [""], @@ -21,21 +21,21 @@ var _algoliaUserKeyOptions : AlgoliaUserKeyOptions = { description: "" }; -var _searchSynonymOptions : SearchSynonymOptions = { +let _searchSynonymOptions: SearchSynonymOptions = { query: "", page: 0, type: "", hitsPerPage: 0 }; -var _algoliaSecuredApiOptions: AlgoliaSecuredApiOptions = { +let _algoliaSecuredApiOptions: AlgoliaSecuredApiOptions = { filters: "", validUntil: 0, restrictIndices: "", userToken: "" }; -var _algoliaIndexSettings : AlgoliaIndexSettings = { +let _algoliaIndexSettings: AlgoliaIndexSettings = { attributesToIndex: [""], attributesforFaceting: [""], unretrievableAttributes: [""], @@ -43,12 +43,12 @@ var _algoliaIndexSettings : AlgoliaIndexSettings = { ranking: [""], customRanking: [""], slaves: [""], - maxValuesPerFacet: '', + maxValuesPerFacet: "", attributesToHighlight: [""], attributesToSnippet: [""], - highlightPreTag: '', - highlightPostTag: '', - snippetEllipsisText: '', + highlightPreTag: "", + highlightPostTag: "", + snippetEllipsisText: "", restrictHighlightAndSnippetArrays: false, hitsPerPage: 0, minWordSizefor1Typo: 0, @@ -56,16 +56,16 @@ var _algoliaIndexSettings : AlgoliaIndexSettings = { typoTolerance: false, allowTyposOnNumericTokens: false, ignorePlurals: false, - disableTypoToleranceOnAttributes: '', - separatorsToIndex: '', - queryType: '', - removeWordsIfNoResults: '', + disableTypoToleranceOnAttributes: "", + separatorsToIndex: "", + queryType: "", + removeWordsIfNoResults: "", advancedSyntax: false, optionalWords: [""], removeStopWords: [""], disablePrefixOnAttributes: [""], disableExactOnAttributes: [""], - exactOnSingleWordQuery: '', + exactOnSingleWordQuery: "", alternativesAsExact: false, attributeForDistinct: "", distinct: false, @@ -73,21 +73,21 @@ var _algoliaIndexSettings : AlgoliaIndexSettings = { allowCompressionOfIntegerArray: false, altCorrections: [{}], minProximity: 0, - placeholders: '' + placeholders: "" }; -var _algoliaQueryParameters : AlgoliaQueryParameters = { - query: '', - filters: '', +let _algoliaQueryParameters: AlgoliaQueryParameters = { + query: "", + filters: "", attributesToRetrieve: [""], restrictSearchableAttributes: [""], - facets: '', - maxValuesPerFacet: '', - attributesToHighlight: [''], - attributesToSnippet: [''], - highlightPreTag: '', - highlightPostTag: '', - snippetEllipsisText: '', + facets: "", + maxValuesPerFacet: "", + attributesToHighlight: [""], + attributesToSnippet: [""], + highlightPreTag: "", + highlightPostTag: "", + snippetEllipsisText: "", restrictHighlightAndSnippetArrays: false, hitsPerPage: 0, page: 0, @@ -98,38 +98,36 @@ var _algoliaQueryParameters : AlgoliaQueryParameters = { typoTolerance: false, allowTyposOnNumericTokens: false, ignorePlurals: false, - disableTypoToleranceOnAttributes: '', - aroundLatLng: '', - aroundLatLngViaIP: '', - aroundRadius: '', + disableTypoToleranceOnAttributes: "", + aroundLatLng: "", + aroundLatLngViaIP: "", + aroundRadius: "", aroundPrecision: 0, minimumAroundRadius: 0, - insideBoundingBox: '', - queryType: '', - insidePolygon: '', - removeWordsIfNoResults: '', + insideBoundingBox: "", + queryType: "", + insidePolygon: "", + removeWordsIfNoResults: "", advancedSyntax: false, - optionalWords: [''], - removeStopWords: [''], - disableExactOnAttributes: [''], - exactOnSingleWordQuery: '', + optionalWords: [""], + removeStopWords: [""], + disableExactOnAttributes: [""], + exactOnSingleWordQuery: "", alternativesAsExact: true, distinct: 0, getRankingInfo: false, - numericAttributesToIndex: [''], - numericFilters: [''], - tagFilters: '', - facetFilters: '', + numericAttributesToIndex: [""], + numericFilters: [""], + tagFilters: "", + facetFilters: "", analytics: false, - analyticsTags: [''], + analyticsTags: [""], synonyms: true, replaceSynonymsInHighlight: false, minProximity: 0 }; -var index: AlgoliaIndex = algoliasearch('', '').initIndex(''); - -var search = index.search({query: ""}); -index.search({query: ""}, function(err, res){}); - +let index: AlgoliaIndex = algoliasearch("", "").initIndex(""); +let search = index.search({query: ""}); + index.search({query: ""}, (err, res) => {}); From b305b30c3d903ec4058a48826ce725a5af4bc95a Mon Sep 17 00:00:00 2001 From: Simon Mo Date: Sat, 13 May 2017 10:56:01 +0100 Subject: [PATCH 0034/1105] Updated algolia nbPages param and options param in saveSynonym function --- types/algoliasearch/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/algoliasearch/index.d.ts b/types/algoliasearch/index.d.ts index 582e91999b..2fdd00f983 100644 --- a/types/algoliasearch/index.d.ts +++ b/types/algoliasearch/index.d.ts @@ -24,7 +24,7 @@ declare namespace algoliasearch { * Number of pages * https://github.com/algolia/algoliasearch-client-js#response-format */ - nbPage: number; + nbPages: number; /** * Number of hits per pages * https://github.com/algolia/algoliasearch-client-js#response-format @@ -407,7 +407,7 @@ declare namespace algoliasearch { * @param cb(err, res) * https://github.com/algolia/algoliasearch-client-js#save-synonym---savesynonym */ - saveSynonym(synonym: AlgoliaSynonym, option: SynonymOption, cb: (err: Error, res: any) => void): void; + saveSynonym(synonym: AlgoliaSynonym, options: SynonymOption, cb: (err: Error, res: any) => void): void; /** * Save a synonym object * @param synonyms @@ -659,7 +659,7 @@ declare namespace algoliasearch { * return {Promise} * https://github.com/algolia/algoliasearch-client-js#save-synonym---savesynonym */ - saveSynonym(synonym: AlgoliaSynonym, option: SynonymOption): Promise ; + saveSynonym(synonym: AlgoliaSynonym, options: SynonymOption): Promise ; /** * Save a synonym object * @param synonyms From 5ea24bf9e13bb6157475ec2e374c27f172b52602 Mon Sep 17 00:00:00 2001 From: Roberto Desideri Date: Sun, 14 May 2017 08:10:21 +0200 Subject: [PATCH 0035/1105] [node] Edit fs.readdir() and fs.readdirSync() --- types/node/index.d.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 67f275c7b6..bcb24150f8 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -1,6 +1,9 @@ // Type definitions for Node.js v7.x // Project: http://nodejs.org/ -// Definitions by: Microsoft TypeScript , DefinitelyTyped , Parambir Singh +// Definitions by: Microsoft TypeScript +// DefinitelyTyped +// Parambir Singh +// Roberto Desideri // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /************************************************ @@ -2569,8 +2572,9 @@ declare module "fs" { * @returns Returns the created folder path. */ export function mkdtempSync(prefix: string): string; - export function readdir(path: string | Buffer, callback?: (err: NodeJS.ErrnoException, files: string[]) => void): void; - export function readdirSync(path: string | Buffer): string[]; + export function readdir(path: string | Buffer, callback: (err: NodeJS.ErrnoException, files: string[]) => void): void; + export function readdir(path: string | Buffer, options: string | Object, callback: (err: NodeJS.ErrnoException, files: string[]) => void): void; + export function readdirSync(path: string | Buffer, options?: string | Object): string[]; export function close(fd: number, callback?: (err?: NodeJS.ErrnoException) => void): void; export function closeSync(fd: number): void; export function open(path: string | Buffer, flags: string | number, callback: (err: NodeJS.ErrnoException, fd: number) => void): void; From 5dcda0ca0b73e2eb3ee06ba20c56e4b507b687f4 Mon Sep 17 00:00:00 2001 From: Hugo Wood Date: Mon, 15 May 2017 14:13:32 +0200 Subject: [PATCH 0036/1105] highland: add support for mapping hints Also fixes the signature of _(source) for the Event Emitter case. The signature was missing the first parameter. Closes #13727. --- types/highland/highland-tests.ts | 8 ++++++- types/highland/index.d.ts | 36 +++++++++++++++++++++++++++----- 2 files changed, 38 insertions(+), 6 deletions(-) diff --git a/types/highland/highland-tests.ts b/types/highland/highland-tests.ts index 7c813e1c1e..e4af44c0a0 100644 --- a/types/highland/highland-tests.ts +++ b/types/highland/highland-tests.ts @@ -134,7 +134,10 @@ fooStream = _((push, next) => { fooStream = _(fooStream); fooStream = _(readable); -fooStream = _(emitter); +fooStream = _(str, emitter); +fooStream = _(str, emitter, num); +fooStream = _(str, emitter, strArr); +fooStream = _(str, emitter, f); fooStream = _(fooStreamThen); fooStream = _(fooThen); @@ -210,6 +213,9 @@ _.log(str, num, foo); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - f = _.wrapCallback(func); +f = _.wrapCallback(func, num); +f = _.wrapCallback(func, strArr); +f = _.wrapCallback(func, fn); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/types/highland/index.d.ts b/types/highland/index.d.ts index b10f8e00bf..82806d6349 100644 --- a/types/highland/index.d.ts +++ b/types/highland/index.d.ts @@ -1,6 +1,7 @@ -// Type definitions for Highland 1.14.0 +// Type definitions for Highland 2.10.5 // Project: http://highlandjs.org/ // Definitions by: Bart van der Schoor +// Hugo Wood // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -48,6 +49,17 @@ interface HighlandStatic { * event emitter as the two arguments to the constructor and the first * argument emitted to the event handler will be written to the new Stream. * + * You can pass a mapping hint as the third argument, which specifies how + * event arguments are pushed into the stream. If no mapping hint is + * provided, only the first value emitted with the event to the will be + * pushed onto the Stream. + * + * If mappingHint is a number, an array of that length will be pushed onto + * the stream, containing exactly that many parameters from the event. If + * it's an array, it's used as keys to map the arguments into an object which + * is pushed to the tream. If it is a function, it's called with the event + * arguments, and the returned value is pushed. + * * **Promise -** Accepts an ES6 / jQuery style promise and returns a * Highland Stream which will emit a single value (or an error). * @@ -63,7 +75,7 @@ interface HighlandStatic { (xs: Highland.Stream): Highland.Stream; (xs: NodeJS.ReadableStream): Highland.Stream; - (xs: NodeJS.EventEmitter): Highland.Stream; + (eventName: string, xs: NodeJS.EventEmitter, mappingHint?: Highland.MappingHint): Highland.Stream; // moar (promise for everything?) (xs: Highland.Thenable>): Highland.Stream; @@ -298,16 +310,28 @@ interface HighlandStatic { /** * Wraps a node-style async function which accepts a callback, transforming * it to a function which accepts the same arguments minus the callback and - * returns a Highland Stream instead. Only the first argument to the - * callback (or an error) will be pushed onto the Stream. + * returns a Highland Stream instead. The wrapped function keeps its context, + * so you can safely use it as a method without binding (see the second + * example below). + * + * wrapCallback also accepts an optional mappingHint, which specifies how + * callback arguments are pushed to the stream. This can be used to handle + * non-standard callback protocols that pass back more than one value. + * + * mappingHint can be a function, number, or array. See the documentation on + * EventEmitter Stream Objects for details on the mapping hint. If + * mappingHint is a function, it will be called with all but the first + * argument that is passed to the callback. The first is still assumed to be + * the error argument. * * @id wrapCallback * @section Utils * @name _.wrapCallback(f) * @param {Function} f - the node-style function to wrap + * @param {Array | Function | Number} [mappingHint] - how to pass the arguments to the callback * @api public */ - wrapCallback(f: Function): Function; + wrapCallback(f: Function, mappingHint?: Highland.MappingHint): (...args: any[]) => Highland.Stream; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1009,6 +1033,8 @@ declare namespace Highland { */ latest(): Stream; } + + type MappingHint = number | string[] | Function; } declare var highland:HighlandStatic; From 56b2a624924d1dc69926498995c380a6e95f0560 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vesa=20Poikaj=C3=A4rvi?= Date: Mon, 15 May 2017 16:05:20 +0300 Subject: [PATCH 0037/1105] [basic-auth] Add auth.parse --- types/basic-auth/basic-auth-tests.ts | 2 ++ types/basic-auth/index.d.ts | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/types/basic-auth/basic-auth-tests.ts b/types/basic-auth/basic-auth-tests.ts index 1fab9c10e2..fee30eb32b 100644 --- a/types/basic-auth/basic-auth-tests.ts +++ b/types/basic-auth/basic-auth-tests.ts @@ -2,3 +2,5 @@ import auth = require('basic-auth'); auth(null); + +auth.parse('QmFzaWM6QXV0aA=='); diff --git a/types/basic-auth/index.d.ts b/types/basic-auth/index.d.ts index 51ada3b0c7..be8dcb1f01 100644 --- a/types/basic-auth/index.d.ts +++ b/types/basic-auth/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for basic-auth +// Type definitions for basic-auth v1.1.0 // Project: https://github.com/jshttp/basic-auth -// Definitions by: Clément Bourgeois +// Definitions by: Clément Bourgeois , Vesa Poikajärvi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -14,6 +14,9 @@ declare namespace auth { name: string; pass: string; } + + // See https://github.com/jshttp/basic-auth/blob/v1.1.0/index.js#L87-L95 + function parse(authorizationHeader: string): auth.BasicAuthResult; } export = auth; From 12c0225f5ebf2f436bb7c14e81a373a3ee163c7d Mon Sep 17 00:00:00 2001 From: Takeshi YAEDA Date: Tue, 16 May 2017 01:14:52 +0900 Subject: [PATCH 0038/1105] Add global namespace --- types/noble/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/noble/index.d.ts b/types/noble/index.d.ts index 4e293993f7..ce47d3a010 100644 --- a/types/noble/index.d.ts +++ b/types/noble/index.d.ts @@ -8,6 +8,8 @@ import events = require("events"); +export as namespace Noble; + export declare function startScanning(): void; export declare function startScanning(serviceUUIDs: string[]): void; export declare function startScanning(serviceUUIDs: string[], allowDuplicates: boolean): void; From 5dc25616cc77d1769768202f48a14218be85236c Mon Sep 17 00:00:00 2001 From: Takeshi YAEDA Date: Tue, 16 May 2017 01:17:03 +0900 Subject: [PATCH 0039/1105] Add listener option to (start|stop)Scanning --- types/noble/index.d.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/types/noble/index.d.ts b/types/noble/index.d.ts index ce47d3a010..4b913a8255 100644 --- a/types/noble/index.d.ts +++ b/types/noble/index.d.ts @@ -10,10 +10,8 @@ import events = require("events"); export as namespace Noble; -export declare function startScanning(): void; -export declare function startScanning(serviceUUIDs: string[]): void; -export declare function startScanning(serviceUUIDs: string[], allowDuplicates: boolean): void; -export declare function stopScanning(): void; +export declare function startScanning(serviceUUIDs?: string[], allowDuplicates?: boolean, listener?: (error: Error) => void): void; +export declare function stopScanning(listener?: () => void): void; export declare function on(event: string, listener: Function): events.EventEmitter; export declare function on(event: "stateChange", listener: (state: string) => void): events.EventEmitter; From 53357af3b02f38e500a7edd5b7a98f02e5a4c065 Mon Sep 17 00:00:00 2001 From: Jan Klimke Date: Mon, 15 May 2017 18:54:11 +0200 Subject: [PATCH 0040/1105] Add options to unmanaged transaction call for sequelize --- types/sequelize/index.d.ts | 2 +- types/sequelize/sequelize-tests.ts | 12 ++++++++++++ types/sequelize/v3/index.d.ts | 2 +- types/sequelize/v3/sequelize-tests.ts | 12 ++++++++++++ 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/types/sequelize/index.d.ts b/types/sequelize/index.d.ts index 43196e4aec..38140b70e5 100644 --- a/types/sequelize/index.d.ts +++ b/types/sequelize/index.d.ts @@ -5728,7 +5728,7 @@ declare namespace sequelize { transaction(options: TransactionOptions, autoCallback: (t: Transaction) => PromiseLike): Promise; transaction(autoCallback: (t: Transaction) => PromiseLike): Promise; - transaction(): Promise; + transaction(options?: TransactionOptions): Promise; /** * Close all connections used by this sequelize instance, and free all references so the instance can be diff --git a/types/sequelize/sequelize-tests.ts b/types/sequelize/sequelize-tests.ts index a02b1a38f8..8e3a4e3b04 100644 --- a/types/sequelize/sequelize-tests.ts +++ b/types/sequelize/sequelize-tests.ts @@ -1619,6 +1619,18 @@ s.transaction().then( function( t ) { } ); +s.transaction({ + isolationLevel: s.Transaction.ISOLATION_LEVELS.READ_COMMITTED + }).then(function(t2) { + return User.find({ + where: { + username: 'jan' + }, + lock: t2.LOCK.UPDATE, + transaction: t2 + }); + }); + s.transaction( function() { return Bluebird.resolve(); } ); diff --git a/types/sequelize/v3/index.d.ts b/types/sequelize/v3/index.d.ts index 59c06f05bf..b0d920c32b 100644 --- a/types/sequelize/v3/index.d.ts +++ b/types/sequelize/v3/index.d.ts @@ -5706,7 +5706,7 @@ declare namespace sequelize { transaction(options: TransactionOptions, autoCallback: (t: Transaction) => PromiseLike): Promise; transaction(autoCallback: (t: Transaction) => PromiseLike): Promise; - transaction(): Promise; + transaction(options?: TransactionOptions): Promise; /** * Close all connections used by this sequelize instance, and free all references so the instance can be diff --git a/types/sequelize/v3/sequelize-tests.ts b/types/sequelize/v3/sequelize-tests.ts index 3cce75b440..8526eca809 100644 --- a/types/sequelize/v3/sequelize-tests.ts +++ b/types/sequelize/v3/sequelize-tests.ts @@ -1601,6 +1601,18 @@ s.transaction().then( function( t ) { } ); + +s.transaction({ + isolationLevel: s.Transaction.ISOLATION_LEVELS.READ_COMMITTED + }).then(function(t2) { + return User.find({ + where: { + username: 'jan' + }, + lock: t2.LOCK.UPDATE, + transaction: t2 + }); + }); s.transaction( function() { return Promise.resolve(); } ); From 12a5b8c297a030ba99fdc203141f1a894e73b60d Mon Sep 17 00:00:00 2001 From: Takeshi YAEDA Date: Tue, 16 May 2017 02:18:02 +0900 Subject: [PATCH 0041/1105] Replace with --- types/noble/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/noble/index.d.ts b/types/noble/index.d.ts index 4b913a8255..6ee7fd85b3 100644 --- a/types/noble/index.d.ts +++ b/types/noble/index.d.ts @@ -10,8 +10,8 @@ import events = require("events"); export as namespace Noble; -export declare function startScanning(serviceUUIDs?: string[], allowDuplicates?: boolean, listener?: (error: Error) => void): void; -export declare function stopScanning(listener?: () => void): void; +export declare function startScanning(serviceUUIDs?: string[], allowDuplicates?: boolean, callback?: (error: Error) => void): void; +export declare function stopScanning(callback?: () => void): void; export declare function on(event: string, listener: Function): events.EventEmitter; export declare function on(event: "stateChange", listener: (state: string) => void): events.EventEmitter; From 9211be1b8d449634f44b96818e6f0204d2d057ba Mon Sep 17 00:00:00 2001 From: Giedrius Grabauskas Date: Tue, 16 May 2017 12:48:33 +0300 Subject: [PATCH 0042/1105] Created tslint.json. --- types/react-slick/tslint.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 types/react-slick/tslint.json diff --git a/types/react-slick/tslint.json b/types/react-slick/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-slick/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From a9be423793f10f010679ae966c2bea3ff2d9642f Mon Sep 17 00:00:00 2001 From: Takeshi YAEDA Date: Tue, 16 May 2017 19:10:07 +0900 Subject: [PATCH 0043/1105] Update test --- types/noble/noble-tests.ts | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/types/noble/noble-tests.ts b/types/noble/noble-tests.ts index 9c3f403944..3f5a035dcd 100644 --- a/types/noble/noble-tests.ts +++ b/types/noble/noble-tests.ts @@ -6,24 +6,26 @@ function test_startScanning(): void { noble.startScanning(); noble.startScanning(["0x180d"]); noble.startScanning(["0x180d"], true); + noble.startScanning(["0x180d"], true, (error: Error): void => {}); } test_startScanning(); function test_stopScanning(): void { "use strict"; noble.stopScanning(); + noble.stopScanning((): void => {}); } test_stopScanning(); noble.on("stateChange", (state: string): void => {}); noble.on("scanStart", (): void => {}); noble.on("scanStop", (): void => {}); -noble.on("discover", (peripheral: noble.Peripheral): void => { +noble.on("discover", (peripheral: Noble.Peripheral): void => { peripheral.connect((error: string): void => {}); peripheral.disconnect((): void => {}); }); -var peripheral: noble.Peripheral = new noble.Peripheral(); +var peripheral: Noble.Peripheral = new noble.Peripheral(); peripheral.uuid = "12ad4e81"; peripheral.advertisement = { localName: "device", @@ -39,19 +41,19 @@ peripheral.disconnect((): void => {}); peripheral.updateRssi(); peripheral.updateRssi((error: string, rssi: number): void => {}); peripheral.discoverServices(["180d"]); -peripheral.discoverServices(["180d"], (error: string, services: noble.Service[]): void => {}); +peripheral.discoverServices(["180d"], (error: string, services: Noble.Service[]): void => {}); peripheral.discoverAllServicesAndCharacteristics(); -peripheral.discoverAllServicesAndCharacteristics((error: string, services: noble.Service[], characteristics: noble.Characteristic[]): void => {}); +peripheral.discoverAllServicesAndCharacteristics((error: string, services: Noble.Service[], characteristics: Noble.Characteristic[]): void => {}); peripheral.discoverSomeServicesAndCharacteristics(["180d"], ["2a38"]); -peripheral.discoverSomeServicesAndCharacteristics(["180d"], ["2a38"], (error: string, services: noble.Service[], characteristics: noble.Characteristic[]): void => {}); +peripheral.discoverSomeServicesAndCharacteristics(["180d"], ["2a38"], (error: string, services: Noble.Service[], characteristics: Noble.Characteristic[]): void => {}); peripheral.readHandle(new Buffer(1), (error: string, data: NodeBuffer): void => {}); peripheral.writeHandle(new Buffer(1), new Buffer(1), true, (error: string): void => {}); peripheral.on("connect", (error: string): void => {}); peripheral.on("disconnect", (error: string): void => {}); peripheral.on("rssiUpdate", (rssi: number): void => {}); -peripheral.on("servicesDiscover", (services: noble.Service[]): void => {}); +peripheral.on("servicesDiscover", (services: Noble.Service[]): void => {}); -var service: noble.Service = new noble.Service(); +var service: Noble.Service = new noble.Service(); service.uuid = "180a"; service.name = ""; service.type = ""; @@ -59,11 +61,11 @@ service.includedServiceUuids = ["180d"]; service.discoverIncludedServices(["180d"]); service.discoverIncludedServices(["180d"], (error: string, includedServiceUuids: string[]): void => {}); service.discoverCharacteristics(["2a38"]); -service.discoverCharacteristics(["2a38"], (error: string, characteristics: noble.Characteristic[]): void => {}); +service.discoverCharacteristics(["2a38"], (error: string, characteristics: Noble.Characteristic[]): void => {}); service.on("includedServicesDiscover", (includedServiceUuids: string[]): void => {}); -service.on("characteristicsDiscover", (characteristics: noble.Characteristic[]): void => {}); +service.on("characteristicsDiscover", (characteristics: Noble.Characteristic[]): void => {}); -var characteristic: noble.Characteristic = new noble.Characteristic(); +var characteristic: Noble.Characteristic = new noble.Characteristic(); characteristic.uuid = "2a37"; characteristic.name = ""; characteristic.type = ""; @@ -77,14 +79,14 @@ characteristic.broadcast(true, (error: string): void => {}); characteristic.notify(true); characteristic.notify(true, (error: string): void => {}); characteristic.discoverDescriptors(); -characteristic.discoverDescriptors((error: string, descriptors: noble.Descriptor[]): void => {}); +characteristic.discoverDescriptors((error: string, descriptors: Noble.Descriptor[]): void => {}); characteristic.on("read", (data: NodeBuffer, isNotification: boolean): void => {}); characteristic.on("write", true, (error: string): void => {}); characteristic.on("broadcast", (state: string): void => {}); characteristic.on("notify", (state: string): void => {}); -characteristic.on("descriptorsDiscover", (descriptors: noble.Descriptor[]): void => {}); +characteristic.on("descriptorsDiscover", (descriptors: Noble.Descriptor[]): void => {}); -var descriptor: noble.Descriptor = new noble.Descriptor(); +var descriptor: Noble.Descriptor = new noble.Descriptor(); descriptor.uuid = ""; descriptor.name = ""; descriptor.type = ""; From 91db150773e48a2bc84cdee42e69af0fe4027060 Mon Sep 17 00:00:00 2001 From: Jason Cheatham Date: Tue, 16 May 2017 13:43:56 -0400 Subject: [PATCH 0044/1105] source-map-support updates - Handle new config options - Enable strictNullChecks - Setup tslint --- types/source-map-support/index.d.ts | 23 +++++++++++-------- .../source-map-support-tests.ts | 19 ++++++++------- types/source-map-support/tsconfig.json | 4 ++-- types/source-map-support/tslint.json | 3 +++ 4 files changed, 29 insertions(+), 20 deletions(-) create mode 100644 types/source-map-support/tslint.json diff --git a/types/source-map-support/index.d.ts b/types/source-map-support/index.d.ts index 8df4456483..3898c471a2 100644 --- a/types/source-map-support/index.d.ts +++ b/types/source-map-support/index.d.ts @@ -1,11 +1,10 @@ -// Type definitions for source-map-support 0.2.10 +// Type definitions for source-map-support 0.4 // Project: https://github.com/evanw/source-map-support -// Definitions by: Bart van der Schoor +// Definitions by: Bart van der Schoor , Jason Cheatham // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// - /** * Output of retrieveSourceMap(). */ @@ -19,9 +18,13 @@ export interface UrlAndMap { */ export interface Options { handleUncaughtExceptions?: boolean; + hookRequire?: boolean; emptyCacheBetweenOperations?: boolean; - retrieveFile?: (path: string) => string; - retrieveSourceMap?: (source: string) => UrlAndMap; + environment?: 'auto' | 'browser' | 'node'; + overrideRetrieveFile?: boolean; + overrideRetrieveSourceMap?: boolean; + retrieveFile?(path: string): string; + retrieveSourceMap?(source: string): UrlAndMap; } export interface Position { @@ -30,13 +33,13 @@ export interface Position { column: number; } -export declare function wrapCallSite(frame: any /* StackFrame */): any /* StackFrame */; -export declare function getErrorSource(error: Error): string; -export declare function mapSourcePosition(position: Position): Position; -export declare function retrieveSourceMap(source: string): UrlAndMap; +export function wrapCallSite(frame: any /* StackFrame */): any /* StackFrame */; +export function getErrorSource(error: Error): string | null; +export function mapSourcePosition(position: Position): Position; +export function retrieveSourceMap(source: string): UrlAndMap | null; /** * Install SourceMap support. * @param options Can be used to e.g. disable uncaughtException handler. */ -export declare function install(options?: Options): void; +export function install(options?: Options): void; diff --git a/types/source-map-support/source-map-support-tests.ts b/types/source-map-support/source-map-support-tests.ts index 602547509e..9a30b6a68f 100644 --- a/types/source-map-support/source-map-support-tests.ts +++ b/types/source-map-support/source-map-support-tests.ts @@ -1,4 +1,3 @@ - import sms = require('source-map-support'); sms.install(); @@ -14,27 +13,31 @@ function retrieveSourceMap(source: string): sms.UrlAndMap { }; } -var options: sms.Options = { +const options: sms.Options = { emptyCacheBetweenOperations: false, handleUncaughtExceptions: false, - retrieveFile: retrieveFile, - retrieveSourceMap: retrieveSourceMap + retrieveFile, + retrieveSourceMap, + environment: 'node', + hookRequire: false, + overrideRetrieveSourceMap: false, + overrideRetrieveFile: false }; sms.install(options); -var stackFrame: any; // TODO: this should be a StackFrame, but it seems this would need to be defined elsewhere (in e.g. lib.d.ts) +let stackFrame: any; // TODO: this should be a StackFrame, but it seems this would need to be defined elsewhere (in e.g. lib.d.ts) stackFrame = sms.wrapCallSite(stackFrame); -var s: string; +let s: string | null; s = sms.getErrorSource(new Error("foo")); -var p: sms.Position = { +let p: sms.Position = { column: 0, line: 0, source: "foo" }; p = sms.mapSourcePosition(p); -var u: sms.UrlAndMap; +let u: sms.UrlAndMap; u = retrieveSourceMap("foo"); diff --git a/types/source-map-support/tsconfig.json b/types/source-map-support/tsconfig.json index 8a90e5ecec..3f07ef5207 100644 --- a/types/source-map-support/tsconfig.json +++ b/types/source-map-support/tsconfig.json @@ -6,7 +6,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" @@ -19,4 +19,4 @@ "index.d.ts", "source-map-support-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/source-map-support/tslint.json b/types/source-map-support/tslint.json new file mode 100644 index 0000000000..d88586e5bd --- /dev/null +++ b/types/source-map-support/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} From 50220b73ef4fae2c560d5d425cc7757c3299b173 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Paulo?= Date: Tue, 16 May 2017 16:24:59 -0300 Subject: [PATCH 0045/1105] Update three-core.d.ts fixing typos - lighhtMap to lightMap --- types/three/three-core.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/types/three/three-core.d.ts b/types/three/three-core.d.ts index 8f3cc5ce7f..4b89a9367c 100644 --- a/types/three/three-core.d.ts +++ b/types/three/three-core.d.ts @@ -2563,7 +2563,7 @@ export interface MeshLambertMaterialParameters extends MaterialParameters { emissiveIntensity?: number; emissiveMap?: Texture; map?: Texture; - lighhtMap?: Texture; + lightMap?: Texture; lightMapIntensity?: number; aoMap?: Texture; aoMapIntensity?: number; @@ -2590,7 +2590,7 @@ export class MeshLambertMaterial extends Material { emissiveIntensity: number; emissiveMap: Texture; map: Texture; - lighhtMap: Texture; + lightMap: Texture; lightMapIntensity: number; aoMap: Texture; aoMapIntensity: number; @@ -2616,7 +2616,7 @@ export interface MeshStandardMaterialParameters extends MaterialParameters { roughness?: number; metalness?: number; map?: Texture; - lighhtMap?: Texture; + lightMap?: Texture; lightMapIntensity?: number; aoMap?: Texture; aoMapIntensity?: number; @@ -2651,7 +2651,7 @@ export class MeshStandardMaterial extends Material { roughness: number; metalness: number; map: Texture; - lighhtMap: Texture; + lightMap: Texture; lightMapIntensity: number; aoMap: Texture; aoMapIntensity: number; From d28f34da926464e031d8f57cdf8d9be166c776b5 Mon Sep 17 00:00:00 2001 From: Ryan Schwers Date: Tue, 16 May 2017 14:39:14 -0700 Subject: [PATCH 0046/1105] [Draft-js] Support custom keyBindingFN strings The current typings don't work for custom keyBindingFn return values. keyBindingFn implementations may return any string or null. TypeScript's handling of string unions is preventing the fn type definition overloading from working as intended. This change removes overloading and moves the union to a type, and adds nullability to the type definition. --- types/draft-js/draft-js-tests.tsx | 102 +++++++++++++++++++++++++++++- types/draft-js/index.d.ts | 16 ++--- 2 files changed, 108 insertions(+), 10 deletions(-) diff --git a/types/draft-js/draft-js-tests.tsx b/types/draft-js/draft-js-tests.tsx index 1ac3c622a0..d4aabcbb7f 100644 --- a/types/draft-js/draft-js-tests.tsx +++ b/types/draft-js/draft-js-tests.tsx @@ -2,7 +2,29 @@ import * as React from "react"; import * as ReactDOM from "react-dom"; import {Map} from "immutable"; -import {Editor, EditorState, RichUtils, DefaultDraftBlockRenderMap, ContentBlock} from 'draft-js'; +import { + ContentBlock, + DefaultDraftBlockRenderMap, + Editor, + EditorState, + Modifier, + RichUtils, + SelectionState, + getDefaultKeyBinding, +} from 'draft-js'; + +const SPLIT_HEADER_BLOCK = 'split-header-block'; + +export type KeyName = + 'ENTER'; + +export type KeyCode = number; + +export const KEYCODES: Record = { + ENTER: 13, +}; + +type SyntheticKeyboardEvent = React.KeyboardEvent<{}>; class RichEditorExample extends React.Component<{}, { editorState: EditorState }> { constructor() { @@ -13,13 +35,40 @@ class RichEditorExample extends React.Component<{}, { editorState: EditorState } onChange: (editorState: EditorState) => void = (editorState: EditorState) => this.setState({ editorState }); + keyBindingFn(e: SyntheticKeyboardEvent): string { + if (e.keyCode === KEYCODES.ENTER) { + const { editorState } = this.state; + const contentState = editorState.getCurrentContent(); + const selectionState = editorState.getSelection(); + + // only split headers into header and unstyled if we press 'Enter' + // at the end of a header (without text selected) + if (selectionState.isCollapsed()) { + const endKey = selectionState.getEndKey(); + const endOffset = selectionState.getEndOffset(); + const endBlock = contentState.getBlockForKey(endKey); + if (isHeaderBlock(endBlock) && endOffset === endBlock.getText().length) { + return SPLIT_HEADER_BLOCK; + } + } + } + + return getDefaultKeyBinding(e); + } + handleKeyCommand = (command: string) => { + if (command === SPLIT_HEADER_BLOCK) { + this.onChange(this.splitHeaderToNewBlock()); + return 'handled'; + } + const {editorState} = this.state; const newState = RichUtils.handleKeyCommand(editorState, command); + if (newState) { this.onChange(newState); return "handled"; - } + } return "not-handled"; } @@ -32,6 +81,40 @@ class RichEditorExample extends React.Component<{}, { editorState: EditorState } this.onChange(RichUtils.toggleInlineStyle(this.state.editorState, inlineStyle)); } + splitHeaderToNewBlock(): EditorState { + const { editorState } = this.state; + const selection = editorState.getSelection(); + + // Add a new block after the cursor + const contentWithBlock = Modifier.splitBlock( + editorState.getCurrentContent(), + selection, + ); + + // Change the new block type to be normal 'unstyled' text, + const newBlock = contentWithBlock.getBlockAfter(selection.getEndKey()); + const contentWithUnstyledBlock = Modifier.setBlockType( + contentWithBlock, + SelectionState.createEmpty(newBlock.getKey()), + 'unstyled', + ); + + // push the new state with 'insert-characters' to preserve the undo/redo stack + const stateWithNewline = EditorState.push( + editorState, + contentWithUnstyledBlock, + 'insert-characters' + ); + + // manually move the cursor to the next line (as expected) + const nextState = EditorState.forceSelection( + stateWithNewline, + SelectionState.createEmpty(newBlock.getKey()), + ); + + return nextState; + } + render(): React.ReactElement<{}> { // If the user changes block type before entering any text, we can // either style the placeholder or hide it. Let's just hide it now. @@ -58,6 +141,7 @@ class RichEditorExample extends React.Component<{}, { editorState: EditorState } blockStyleFn={getBlockStyle} customStyleMap={styleMap} editorState={this.state.editorState} + keyBindingFn={this.keyBindingFn} handleKeyCommand={this.handleKeyCommand} onChange={this.onChange} placeholder="Tell a story..." @@ -125,6 +209,20 @@ const BLOCK_TYPES = [ { label: 'Code Block', style: 'code-block' }, ]; +const isHeaderBlock = (block: ContentBlock): boolean => { + switch (block.getType()) { + case 'header-one': + case 'header-two': + case 'header-three': + case 'header-four': + case 'header-five': + case 'header-six': { + return true; + } + default: return false; + } +} + const BlockStyleControls = (props: {editorState: EditorState, onToggle: (blockType: string) => void}) => { const {editorState} = props; const selection = editorState.getSelection(); diff --git a/types/draft-js/index.d.ts b/types/draft-js/index.d.ts index c0086319a3..ef1a02099f 100644 --- a/types/draft-js/index.d.ts +++ b/types/draft-js/index.d.ts @@ -1,6 +1,8 @@ // Type definitions for Draft.js v0.10.0 // Project: https://facebook.github.io/draft-js/ -// Definitions by: Dmitry Rogozhny , Eelco Lempsink +// Definitions by: Dmitry Rogozhny +// Eelco Lempsink +// Ryan Schwers // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 @@ -27,6 +29,8 @@ declare namespace Draft { type DraftBlockRenderMap = Immutable.Map; + type EditorCommand = DraftEditorCommand | string; + /** * `DraftEditor` is the root editor component. It composes a `contentEditable` * div, and provides a wide variety of useful function props for managing the @@ -78,8 +82,7 @@ declare namespace Draft { // A function that accepts a synthetic key event and returns // the matching DraftEditorCommand constant, or null if no command should // be invoked. - keyBindingFn?(e: SyntheticKeyboardEvent): DraftEditorCommand; - keyBindingFn?(e: SyntheticKeyboardEvent): string; + keyBindingFn?(e: SyntheticKeyboardEvent): EditorCommand | null; // Set whether the `DraftEditor` component should be editable. Useful for // temporarily disabling edit behavior or allowing `DraftEditor` rendering @@ -118,9 +121,7 @@ declare namespace Draft { // Map a key command string provided by your key binding function to a // specified behavior. - handleKeyCommand?(command: DraftEditorCommand): DraftHandleValue, - handleKeyCommand?(command: string): DraftHandleValue, - + handleKeyCommand?(command: EditorCommand): DraftHandleValue, // Handle intended text insertion before the insertion occurs. This may be // useful in cases where the user has entered characters that you would like @@ -201,8 +202,7 @@ declare namespace Draft { /** * Retrieve a bound key command for the given event. */ - function getDefaultKeyBinding(e: SyntheticKeyboardEvent): DraftEditorCommand; - function getDefaultKeyBinding(e: SyntheticKeyboardEvent): string; + function getDefaultKeyBinding(e: SyntheticKeyboardEvent): DraftEditorCommand | null; } } From 09b956231b4dd42e1cb04f5b2b8ecea4906623b7 Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Wed, 17 May 2017 13:20:13 +0200 Subject: [PATCH 0047/1105] fix(fs-extra): `ensureSymlink` and `ensureLink` should accept more params --- types/fs-extra/fs-extra-tests.ts | 12 ++++++------ types/fs-extra/index.d.ts | 13 +++++++------ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/types/fs-extra/fs-extra-tests.ts b/types/fs-extra/fs-extra-tests.ts index 005857e48c..9c43bbf64d 100644 --- a/types/fs-extra/fs-extra-tests.ts +++ b/types/fs-extra/fs-extra-tests.ts @@ -167,16 +167,16 @@ fs.ensureFile(path).then(() => { }); fs.ensureFile(path, errorCallback); fs.ensureFileSync(path); -fs.ensureLink(path).then(() => { +fs.ensureLink(path, path).then(() => { // stub }); -fs.ensureLink(path, errorCallback); -fs.ensureLinkSync(path); -fs.ensureSymlink(path).then(() => { +fs.ensureLink(path, path, errorCallback); +fs.ensureLinkSync(path, path); +fs.ensureSymlink(path, path).then(() => { // stub }); -fs.ensureSymlink(path, errorCallback); -fs.ensureSymlinkSync(path); +fs.ensureSymlink(path, path, errorCallback); +fs.ensureSymlinkSync(path, path); fs.emptyDir(path).then(() => { // stub }); diff --git a/types/fs-extra/index.d.ts b/types/fs-extra/index.d.ts index 481fbad644..e84fea7e58 100644 --- a/types/fs-extra/index.d.ts +++ b/types/fs-extra/index.d.ts @@ -79,13 +79,14 @@ export function ensureFile(path: string): Promise; export function ensureFile(path: string, callback: (err: Error) => void): void; export function ensureFileSync(path: string): void; -export function ensureLink(path: string): Promise; -export function ensureLink(path: string, callback: (err: Error) => void): void; -export function ensureLinkSync(path: string): void; +export function ensureLink(src: string, dest: string): Promise; +export function ensureLink(src: string, dest: string, callback: (err: Error) => void): void; +export function ensureLinkSync(src: string, dest: string): void; -export function ensureSymlink(path: string): Promise; -export function ensureSymlink(path: string, callback: (err: Error) => void): void; -export function ensureSymlinkSync(path: string): void; +export function ensureSymlink(src: string, dest: string, type?: string): Promise; +export function ensureSymlink(src: string, dest: string, type: string, callback: (err: Error) => void): void; +export function ensureSymlink(src: string, dest: string, callback: (err: Error) => void): void; +export function ensureSymlinkSync(src: string, dest: string, type?: string): void; export function emptyDir(path: string): Promise; export function emptyDir(path: string, callback: (err: Error) => void): void; From 5669de27d9e0dd81d3fe427f8b7769f7beb55d9e Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Wed, 17 May 2017 13:42:44 +0200 Subject: [PATCH 0048/1105] fs-extra: fix headers --- types/fs-extra/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/fs-extra/index.d.ts b/types/fs-extra/index.d.ts index e84fea7e58..dbf4ac65a3 100644 --- a/types/fs-extra/index.d.ts +++ b/types/fs-extra/index.d.ts @@ -1,8 +1,8 @@ // Type definitions for fs-extra 3.0 // Project: https://github.com/jprichardson/node-fs-extra -// Definitions by: Alan Agius -// midknight41 -// Brendan Forster +// Definitions by: Alan Agius , +// midknight41 , +// Brendan Forster , // Mees van Dijk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 From 8ee13ea122f8f0ca227b35c1efe07af40c3857ae Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Wed, 17 May 2017 13:48:57 +0200 Subject: [PATCH 0049/1105] Revert "fix headers" This reverts commit 752e09694aa56e4a4ca5e4ae2c5e744c7a7a5618. From 2175c7d3f9b5812f554a780e0e45f4ed75c5f4ee Mon Sep 17 00:00:00 2001 From: Tim Schumacher Date: Wed, 17 May 2017 14:20:23 +0200 Subject: [PATCH 0050/1105] Update the typings to the official version 1.10.4 --- types/twig/index.d.ts | 24 +++++++++++++++++------- types/twig/twig-tests.ts | 13 +++++++------ 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/types/twig/index.d.ts b/types/twig/index.d.ts index ddce91ea6b..d094e6364e 100644 --- a/types/twig/index.d.ts +++ b/types/twig/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for twig -// Project: https://github.com/justjohn/twig.js +// Project: https://github.com/twigjs/twig.js // Definitions by: Carlos Ballesteros Velasco +// Tim Schumacher // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // Imported from: https://github.com/soywiz/typescript-node-definitions/twig.d.ts @@ -8,16 +9,25 @@ export interface Parameters { id?: any; - ref?: any; - href?: any; + blocks?: any; + macros?: any; + base?: any; path?: any; - debug?: boolean; - trace?: boolean; - strict_variables?: boolean; - data: any; + url?: any; + name?: any; + method?: any; + options?: any; } export interface Template { + reset(blocks: any): void; + render(context?: any, params?: any, allow_async?: boolean): string | Promise; + renderAsync(context?: any, params?: any): Promise; + importFile(file: string): Template; + importBlocks(file: string, override?: boolean): void; + importMacros(file: string): Template; + getLoaderMethod(): string; + compile(options: any) : string; } export interface CompileOptions { diff --git a/types/twig/twig-tests.ts b/types/twig/twig-tests.ts index 6b517d0c73..292962a0a0 100644 --- a/types/twig/twig-tests.ts +++ b/types/twig/twig-tests.ts @@ -8,13 +8,14 @@ var bool: boolean; var params: twig.Parameters = { id: value, - ref: value, - href: value, path: value, - debug: bool, - trace: bool, - strict_variables: bool, - data: value + base: value, + blocks: value, + macros: value, + method: value, + name: value, + options: value, + url: value }; var temp: twig.Template; From 5cde3df79e33136343530ddb41ca7c9cda43e1ed Mon Sep 17 00:00:00 2001 From: Tim Schumacher Date: Wed, 17 May 2017 14:36:15 +0200 Subject: [PATCH 0051/1105] Add a version number --- types/twig/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/twig/index.d.ts b/types/twig/index.d.ts index d094e6364e..d9e42fc38b 100644 --- a/types/twig/index.d.ts +++ b/types/twig/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for twig +// Type definitions for twig 1.10.4 // Project: https://github.com/twigjs/twig.js // Definitions by: Carlos Ballesteros Velasco // Tim Schumacher From dff5e2f04f98ba5ec029c68bc813f7ba97b0c6eb Mon Sep 17 00:00:00 2001 From: Tim Schumacher Date: Wed, 17 May 2017 14:43:20 +0200 Subject: [PATCH 0052/1105] Add tslint.json and fix all the issues --- types/twig/index.d.ts | 23 +++++++++++------------ types/twig/tslint.json | 1 + types/twig/twig-tests.ts | 28 ++++++++++++++-------------- 3 files changed, 26 insertions(+), 26 deletions(-) create mode 100644 types/twig/tslint.json diff --git a/types/twig/index.d.ts b/types/twig/index.d.ts index d9e42fc38b..cdbf94a8b4 100644 --- a/types/twig/index.d.ts +++ b/types/twig/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for twig 1.10.4 +// Type definitions for twig 1.10 // Project: https://github.com/twigjs/twig.js // Definitions by: Carlos Ballesteros Velasco // Tim Schumacher @@ -6,7 +6,6 @@ // Imported from: https://github.com/soywiz/typescript-node-definitions/twig.d.ts - export interface Parameters { id?: any; blocks?: any; @@ -27,7 +26,7 @@ export interface Template { importBlocks(file: string, override?: boolean): void; importMacros(file: string): Template; getLoaderMethod(): string; - compile(options: any) : string; + compile(options: any): string; } export interface CompileOptions { @@ -35,12 +34,12 @@ export interface CompileOptions { settings: any; } -export declare function twig(params: Parameters): Template; -export declare function extendFilter(name: string, definition: (left: any, ...params: any[]) => string): void; -export declare function extendFunction(name: string, definition: (...params: any[]) => string): void; -export declare function extendTest(name: string, definition: (value: any) => boolean): void; -export declare function extendTag(definition: any): void; -export declare function compile(markup: string, options: CompileOptions): (context: any) => any; -export declare function renderFile(path: string, options: CompileOptions, fn: (err: Error, result: any) => void): void; -export declare function __express(path: string, options: CompileOptions, fn: (err: Error, result: any) => void): void; -export declare function cache(value: boolean): void; +export function twig(params: Parameters): Template; +export function extendFilter(name: string, definition: (left: any, ...params: any[]) => string): void; +export function extendFunction(name: string, definition: (...params: any[]) => string): void; +export function extendTest(name: string, definition: (value: any) => boolean): void; +export function extendTag(definition: any): void; +export function compile(markup: string, options: CompileOptions): (context: any) => any; +export function renderFile(path: string, options: CompileOptions, fn: (err: Error, result: any) => void): void; +export function __express(path: string, options: CompileOptions, fn: (err: Error, result: any) => void): void; +export function cache(value: boolean): void; diff --git a/types/twig/tslint.json b/types/twig/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/twig/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/twig/twig-tests.ts b/types/twig/twig-tests.ts index 292962a0a0..1c3d34755e 100644 --- a/types/twig/twig-tests.ts +++ b/types/twig/twig-tests.ts @@ -1,12 +1,11 @@ - import twig = require('twig'); -var value: any; -var str: string; -var num: number; -var bool: boolean; +const value: any = ""; +const str: string = ""; +const num: number = 0; +const bool: boolean = false; -var params: twig.Parameters = { +const params: twig.Parameters = { id: value, path: value, base: value, @@ -18,28 +17,29 @@ var params: twig.Parameters = { url: value }; -var temp: twig.Template; -var compOpts: twig.CompileOptions = { +const temp: twig.Template = twig.twig(params); + +const compOpts: twig.CompileOptions = { filename: str, settings: value }; -var compiled:(context: any) => any; - -temp = twig.twig(params); twig.extendFilter(str, (left: any, ...params: any[]) => { return str; }); + twig.extendFunction(str, (...params: any[]) => { return str; }); + twig.extendTest(str, (value: any) => bool); twig.extendTag(value); -compiled = twig.compile(str, compOpts); + +const compiled = twig.compile(str, compOpts); + twig.renderFile(str, compOpts, (err, result) => { - }); -twig.__express(str, compOpts, (err, result) => { +twig.__express(str, compOpts, (err, result) => { }); twig.cache(bool); From 8e9ed1a60d0adddc055f313c6d0ffc5f3fe8409f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Sch=C3=BCrmann?= Date: Wed, 17 May 2017 15:01:59 +0200 Subject: [PATCH 0053/1105] Allow all HTML elements for CKEDITOR.appendTo() --- 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 518c44ae2a..dc4d27871e 100644 --- a/types/ckeditor/index.d.ts +++ b/types/ckeditor/index.d.ts @@ -77,7 +77,7 @@ declare namespace CKEDITOR { function addCss(css: string): void; function addTemplate(name: string, source: string): template; function appendTo(element: string, config?: config, data?: string): editor; - function appendTo(element: HTMLTextAreaElement, config?: config, data?: string): editor; + function appendTo(element: HTMLElement, config?: config, data?: string): editor; function domReady(): void; function dialogCommand(dialogName: string): void; function editorConfig(config: config): void; From d6d84ab954458e466efd86d0f2a125d853b2c0e2 Mon Sep 17 00:00:00 2001 From: Matt Dziuban Date: Wed, 17 May 2017 09:32:16 -0400 Subject: [PATCH 0054/1105] Fix tryCatch definition. --- types/ramda/index.d.ts | 4 ++-- types/ramda/ramda-tests.ts | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index 7fde62feee..81976e8e6d 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for ramda // Project: https://github.com/donnut/typescript-ramda -// Definitions by: Erwin Poeze , Matt DeKrey , Liam Goodacre +// Definitions by: Erwin Poeze , Matt DeKrey , Liam Goodacre , Matt Dziuban // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -1598,7 +1598,7 @@ declare namespace R { * function and returns its result. Note that for effective composition with this function, both the tryer and * catcher functions must return the same type of results. */ - tryCatch(tryer: (...args: any[]) => T, catcher: (...args: any[]) => T, x: any): T; + tryCatch(tryer: (...args: any[]) => T, catcher: (...args: any[]) => T): (...args: any[]) => T; /** * Gives a single-word string description of the (native) type of a value, returning such answers as 'Object', diff --git a/types/ramda/ramda-tests.ts b/types/ramda/ramda-tests.ts index 5c5948b047..e60f3afa79 100644 --- a/types/ramda/ramda-tests.ts +++ b/types/ramda/ramda-tests.ts @@ -972,8 +972,9 @@ type Pair = KeyValuePair () => { const x = R.prop('x'); - const a: boolean = R.tryCatch(R.prop('x'), R.F, {x: true}); //=> true - const b: boolean = R.tryCatch(R.prop('x'), R.F, null); //=> false + const a: boolean = R.tryCatch(R.prop('x'), R.F)({x: true}); //=> true + const b: boolean = R.tryCatch(R.prop('x'), R.F)(null); //=> false + const c: boolean = R.tryCatch(R.and, R.F)(true, true); //=> true } () => { From d31294e091cc71b52dfcfc673ae38334107364fa Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Wed, 17 May 2017 22:57:47 +0200 Subject: [PATCH 0055/1105] feat(fs-extra): add `SymlinkType` --- types/fs-extra/fs-extra-tests.ts | 2 +- types/fs-extra/index.d.ts | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/types/fs-extra/fs-extra-tests.ts b/types/fs-extra/fs-extra-tests.ts index 9c43bbf64d..00b526783d 100644 --- a/types/fs-extra/fs-extra-tests.ts +++ b/types/fs-extra/fs-extra-tests.ts @@ -172,7 +172,7 @@ fs.ensureLink(path, path).then(() => { }); fs.ensureLink(path, path, errorCallback); fs.ensureLinkSync(path, path); -fs.ensureSymlink(path, path).then(() => { +fs.ensureSymlink(path, path, "file").then(() => { // stub }); fs.ensureSymlink(path, path, errorCallback); diff --git a/types/fs-extra/index.d.ts b/types/fs-extra/index.d.ts index dbf4ac65a3..0fcbf9a509 100644 --- a/types/fs-extra/index.d.ts +++ b/types/fs-extra/index.d.ts @@ -83,8 +83,8 @@ export function ensureLink(src: string, dest: string): Promise; export function ensureLink(src: string, dest: string, callback: (err: Error) => void): void; export function ensureLinkSync(src: string, dest: string): void; -export function ensureSymlink(src: string, dest: string, type?: string): Promise; -export function ensureSymlink(src: string, dest: string, type: string, callback: (err: Error) => void): void; +export function ensureSymlink(src: string, dest: string, type?: SymlinkType): Promise; +export function ensureSymlink(src: string, dest: string, type: SymlinkType, callback: (err: Error) => void): void; export function ensureSymlink(src: string, dest: string, callback: (err: Error) => void): void; export function ensureSymlinkSync(src: string, dest: string, type?: string): void; @@ -262,6 +262,8 @@ export type CopyFilterFunction = (src: string) => boolean; export type CopyFilter = CopyFilterFunction | RegExp; +export type SymlinkType = "dir" | "file"; + export interface CopyOptions { dereference?: boolean; overwrite?: boolean; From dfb61f898f89a6b4078d9e91bf7b12e0ff2616b1 Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Wed, 17 May 2017 22:59:29 +0200 Subject: [PATCH 0056/1105] feat(fs-extra): chnage parameter from `string` to `SymlinkType` --- types/fs-extra/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/fs-extra/index.d.ts b/types/fs-extra/index.d.ts index 0fcbf9a509..713b7e7ec4 100644 --- a/types/fs-extra/index.d.ts +++ b/types/fs-extra/index.d.ts @@ -86,7 +86,7 @@ export function ensureLinkSync(src: string, dest: string): void; export function ensureSymlink(src: string, dest: string, type?: SymlinkType): Promise; export function ensureSymlink(src: string, dest: string, type: SymlinkType, callback: (err: Error) => void): void; export function ensureSymlink(src: string, dest: string, callback: (err: Error) => void): void; -export function ensureSymlinkSync(src: string, dest: string, type?: string): void; +export function ensureSymlinkSync(src: string, dest: string, type?: SymlinkType): void; export function emptyDir(path: string): Promise; export function emptyDir(path: string, callback: (err: Error) => void): void; From 3a344fb28eabf2c11c11097347ed59d3b844b95b Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Wed, 17 May 2017 23:03:07 +0200 Subject: [PATCH 0057/1105] refactor(fs-extra): remove redundant types --- types/fs-extra/index.d.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/types/fs-extra/index.d.ts b/types/fs-extra/index.d.ts index 713b7e7ec4..9415274740 100644 --- a/types/fs-extra/index.d.ts +++ b/types/fs-extra/index.d.ts @@ -258,10 +258,6 @@ export interface PathEntryStream { read(): PathEntry | null; } -export type CopyFilterFunction = (src: string) => boolean; - -export type CopyFilter = CopyFilterFunction | RegExp; - export type SymlinkType = "dir" | "file"; export interface CopyOptions { @@ -269,7 +265,7 @@ export interface CopyOptions { overwrite?: boolean; preserveTimestamps?: boolean; errorOnExist?: boolean; - filter?: CopyFilter; + filter?: ((src: string) => boolean) | RegExp; recursive?: boolean; } From 7796afc8e09bbd8eb4101b19350870f4bfd8eddf Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Wed, 17 May 2017 23:10:58 +0200 Subject: [PATCH 0058/1105] Revert "refactor(fs-extra): remove redundant types" This reverts commit 3a344fb28eabf2c11c11097347ed59d3b844b95b. --- types/fs-extra/index.d.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/types/fs-extra/index.d.ts b/types/fs-extra/index.d.ts index 9415274740..713b7e7ec4 100644 --- a/types/fs-extra/index.d.ts +++ b/types/fs-extra/index.d.ts @@ -258,6 +258,10 @@ export interface PathEntryStream { read(): PathEntry | null; } +export type CopyFilterFunction = (src: string) => boolean; + +export type CopyFilter = CopyFilterFunction | RegExp; + export type SymlinkType = "dir" | "file"; export interface CopyOptions { @@ -265,7 +269,7 @@ export interface CopyOptions { overwrite?: boolean; preserveTimestamps?: boolean; errorOnExist?: boolean; - filter?: ((src: string) => boolean) | RegExp; + filter?: CopyFilter; recursive?: boolean; } From 4d6cad830528c877d85d418589cf557494b55b9d Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Wed, 17 May 2017 23:11:31 +0200 Subject: [PATCH 0059/1105] feat(fs-extra): remove `CopyFilterFunction` --- types/fs-extra/index.d.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/types/fs-extra/index.d.ts b/types/fs-extra/index.d.ts index 713b7e7ec4..5f64023dee 100644 --- a/types/fs-extra/index.d.ts +++ b/types/fs-extra/index.d.ts @@ -258,9 +258,7 @@ export interface PathEntryStream { read(): PathEntry | null; } -export type CopyFilterFunction = (src: string) => boolean; - -export type CopyFilter = CopyFilterFunction | RegExp; +export type CopyFilter = ((src: string) => boolean) | RegExp; export type SymlinkType = "dir" | "file"; From e724b60c9227e8629653c89269471d0742a8eef1 Mon Sep 17 00:00:00 2001 From: andraaspar Date: Thu, 18 May 2017 11:43:55 +0200 Subject: [PATCH 0060/1105] Improve feedback & auto-completion in attribute objects. --- types/mithril/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/mithril/index.d.ts b/types/mithril/index.d.ts index 46fbb061ab..e17064abfc 100644 --- a/types/mithril/index.d.ts +++ b/types/mithril/index.d.ts @@ -52,9 +52,9 @@ declare namespace Mithril { /** Creates a virtual element (Vnode). */ (selector: string, attributes: Attributes, ...children: Children[]): Vnode; /** Creates a virtual element (Vnode). */ - (component: ComponentTypes, attributes: Attrs & Lifecycle & { key?: string | number }, ...args: Children[]): Vnode; - /** Creates a virtual element (Vnode). */ (component: ComponentTypes, ...args: Children[]): Vnode; + /** Creates a virtual element (Vnode). */ + (component: ComponentTypes, attributes: Attrs & Lifecycle & { key?: string | number }, ...args: Children[]): Vnode; /** Creates a fragment virtual element (Vnode). */ fragment(attrs: Lifecycle & { [key: string]: any }, children: ChildArrayOrPrimitive): Vnode; /** Turns an HTML string into a virtual element (Vnode). Do not use trust on unsanitized user input. */ From 0249359fe12157f849f59475d3f2a66cfcb01b0e Mon Sep 17 00:00:00 2001 From: Michael Zugelder Date: Thu, 18 May 2017 14:36:55 +0200 Subject: [PATCH 0061/1105] basic-auth: Make auth return value optional --- types/basic-auth/basic-auth-tests.ts | 7 +++++-- types/basic-auth/index.d.ts | 3 ++- types/basic-auth/tsconfig.json | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/types/basic-auth/basic-auth-tests.ts b/types/basic-auth/basic-auth-tests.ts index 1fab9c10e2..84f99d9f2f 100644 --- a/types/basic-auth/basic-auth-tests.ts +++ b/types/basic-auth/basic-auth-tests.ts @@ -1,4 +1,7 @@ - +import {IncomingMessage} from 'http'; import auth = require('basic-auth'); -auth(null); +const loginData = auth(undefined! as IncomingMessage); +if (loginData) { + const {name, pass} = loginData; +} diff --git a/types/basic-auth/index.d.ts b/types/basic-auth/index.d.ts index 51ada3b0c7..37a8495f83 100644 --- a/types/basic-auth/index.d.ts +++ b/types/basic-auth/index.d.ts @@ -7,7 +7,8 @@ import * as http from 'http'; -declare function auth(req: http.IncomingMessage): auth.BasicAuthResult; +// See https://github.com/jshttp/basic-auth/blob/v1.1.0/index.js#L49 +declare function auth(req: http.IncomingMessage): auth.BasicAuthResult | undefined; declare namespace auth { interface BasicAuthResult { diff --git a/types/basic-auth/tsconfig.json b/types/basic-auth/tsconfig.json index b9f77df9d2..8d9222de2c 100644 --- a/types/basic-auth/tsconfig.json +++ b/types/basic-auth/tsconfig.json @@ -6,7 +6,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" From 8d227a304596ee2b71351057bc4d04e5821b349e Mon Sep 17 00:00:00 2001 From: Spectral Radius Systems Date: Thu, 18 May 2017 10:01:03 -0400 Subject: [PATCH 0062/1105] Update ws for version 3.0.0 (https://github.com/websockets/ws/releases/tag/3.0.0) --- types/ws/index.d.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/types/ws/index.d.ts b/types/ws/index.d.ts index 9fce6f9dc3..da44eb0247 100644 --- a/types/ws/index.d.ts +++ b/types/ws/index.d.ts @@ -22,7 +22,6 @@ declare class WebSocket extends events.EventEmitter { protocolVersion: string; url: string; supports: any; - upgradeReq: http.IncomingMessage; protocol: string; bufferedAmount: number; binaryType: string; @@ -72,9 +71,9 @@ declare class WebSocket extends events.EventEmitter { addListener(event: 'error', cb: (err: Error) => void): this; addListener(event: 'close', cb: (code: number, message: string) => void): this; - addListener(event: 'message', cb: (data: any, flags: { binary: boolean }) => void): this; - addListener(event: 'ping', cb: (data: any, flags: { binary: boolean }) => void): this; - addListener(event: 'pong', cb: (data: any, flags: { binary: boolean }) => void): this; + addListener(event: 'message', cb: (data: any) => void): this; + addListener(event: 'ping', cb: (data: any) => void): this; + addListener(event: 'pong', cb: (data: any) => void): this; addListener(event: 'open', cb: () => void): this; addListener(event: string, listener: () => void): this; } @@ -138,12 +137,12 @@ declare namespace WebSocket { // Events on(event: 'error', cb: (err: Error) => void): this; on(event: 'headers', cb: (headers: string[]) => void): this; - on(event: 'connection', cb: (client: WebSocket) => void): this; + on(event: 'connection', cb: (client: WebSocket, req: http.IncomingMessage) => void): this; on(event: string, listener: () => void): this; addListener(event: 'error', cb: (err: Error) => void): this; addListener(event: 'headers', cb: (headers: string[]) => void): this; - addListener(event: 'connection', cb: (client: WebSocket) => void): this; + addListener(event: 'connection', cb: (client: WebSocket, req: http.IncomingMessage) => void): this; addListener(event: string, listener: () => void): this; } From 36a4e93a914013a6dcb3f3d73d9d35db96593ced Mon Sep 17 00:00:00 2001 From: Spectral Radius Systems Date: Thu, 18 May 2017 10:05:22 -0400 Subject: [PATCH 0063/1105] Update ws for version 3.0.0 --- types/ws/ws-tests.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/ws/ws-tests.ts b/types/ws/ws-tests.ts index a015f4c387..33df02a62a 100644 --- a/types/ws/ws-tests.ts +++ b/types/ws/ws-tests.ts @@ -8,7 +8,7 @@ var WebSocketServer = WebSocket.Server; { var ws = new WebSocket('ws://www.host.com/path'); ws.on('open', () => ws.send('something')); - ws.on('message', (data, flags) => {}); + ws.on('message', (data) => {}); } { @@ -46,8 +46,8 @@ var WebSocketServer = WebSocket.Server; wsc.on('open', () => wsc.send(Date.now().toString(), {mask: true})); wsc.on('close', () => console.log('disconnected')); - wsc.on('message', (data, flags) => { - console.log('Roundtrip time: ' + (Date.now() - parseInt(data)) + 'ms', flags); + wsc.on('message', (data) => { + console.log('Roundtrip time: ' + (Date.now() - parseInt(data)) + 'ms'); setTimeout(() => { wsc.send(Date.now().toString(), {mask: true}); }, 500); From 6ab6d781770a1e87a86c75865c37ec50d05b04b3 Mon Sep 17 00:00:00 2001 From: Giedrius Grabauskas Date: Thu, 18 May 2017 18:31:22 +0300 Subject: [PATCH 0064/1105] Created types for react-slick 0.14. --- types/react-slick/index.d.ts | 112 ++++++++++++++---------- types/react-slick/react-slick-tests.tsx | 106 +++++++++++++++++----- types/react-slick/tsconfig.json | 4 +- 3 files changed, 151 insertions(+), 71 deletions(-) diff --git a/types/react-slick/index.d.ts b/types/react-slick/index.d.ts index 1278605b27..87f9bbad50 100644 --- a/types/react-slick/index.d.ts +++ b/types/react-slick/index.d.ts @@ -1,55 +1,75 @@ -// Type definitions for react-slick +// Type definitions for react-slick 0.14 // Project: https://github.com/akiran/react-slick -// Definitions by: Andrey Balokha +// Definitions by: Andrey Balokha , Giedrius Grabauskas // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.1 -/// +import * as React from "react"; -interface __config { - accessibility?: boolean - nextArrow?: HTMLElement | any - prevArrow?: HTMLElement | any - pauseOnHover?: boolean - className?: string - adaptiveHeight?: boolean - arrows?: boolean - autoplay?: boolean - autoplaySpeed?: number // integer - centerMode?: boolean - centerPadding?: string | any - cssEase?: string | any - dots?: boolean - dotsClass?: string - draggable?: boolean - easing?: string - fade?: boolean - focusOnSelect?: boolean - infinite?: boolean // should the gallery wrap around it's contents - initialSlide?: number // int - lazyLoad?: boolean - rtl?: boolean - slide?: string - slidesToShow?: number // int - slidesToScroll?: number // int - speed?: number //int - swipe?: boolean - swipeToSlide?: boolean - touchMove?: boolean - touchThreshold?: number // int - variableWidth?: boolean - useCSS?: boolean - vertical?: boolean - afterChange?: ((currentSlide: number) => void) - beforeChange?: ((currentSlide: number, nextSlide: number) => void) - slickGoTo?: number // int +type ComponentConstructor = React.ComponentClass | React.StatelessComponent; + +export interface CustomArrowProps { + className?: string; + style?: React.CSSProperties; + onClick?: React.MouseEventHandler; } -interface Slider extends __config { - responsive?: { breakpoint: number; settings: __config}[] +export interface ResponsiveObject { + breakpoint: number; + settings: "unslick" | Settings; } -declare module "react-slick" { - var Slider: React.ClassicComponentClass; - export = Slider; +export type SwipeDirection = "left" | "down" | "right" | "up" | string; + +export interface Settings { + accessibility?: boolean; + className?: string; + adaptiveHeight?: boolean; + arrows?: boolean; + nextArrow?: JSX.Element; + prevArrow?: JSX.Element; + autoplay?: boolean; + autoplaySpeed?: number; + centerMode?: boolean; + centerPadding?: string; + cssEase?: string; + customPaging?(index: number): JSX.Element; + dots?: boolean; + dotsClass?: string; + draggable?: boolean; + easing?: string; + fade?: boolean; + focusOnSelect?: boolean; + infinite?: boolean; + initialSlide?: number; + lazyLoad?: boolean; + pauseOnHover?: boolean; + responsive?: ResponsiveObject[]; + rtl?: boolean; + slide?: string; + slidesToShow?: number; + slidesToScroll?: number; + speed?: number; + swipe?: boolean; + swipeToSlide?: boolean; + touchMove?: boolean; + touchThreshold?: number; + variableWidth?: boolean; + useCSS?: boolean; + vertical?: boolean; + afterChange?(currentSlide: number): void; + beforeChange?(currentSlide: number, nextSlide: number): void; + slickGoTo?: number; + edgeFriction?: number; + waitForAnimate?: boolean; + edgeEvent?(swipeDirection: SwipeDirection): void; + swipeEvent?(swipeDirection: SwipeDirection): void; + init?(): void; } + +declare class Slider extends React.Component { + slickNext(): void; + slickPrev(): void; + slickGoTo(slideNumber: number): void; +} + +export default Slider; diff --git a/types/react-slick/react-slick-tests.tsx b/types/react-slick/react-slick-tests.tsx index 2d26b0dcf1..dde5f43fb4 100644 --- a/types/react-slick/react-slick-tests.tsx +++ b/types/react-slick/react-slick-tests.tsx @@ -1,28 +1,88 @@ -import * as React from "react" -import * as ReactDOM from "react-dom" -import * as Slider from "react-slick" - -class SliderTest extends React.Component, {}> { +import * as React from "react"; +import { default as Slider, Settings, CustomArrowProps } from "react-slick"; +class LeftNavArrow extends React.Component { render() { - let settings = { - speed: 500, - slidesToShow: 8, - slidesToScroll: 1, - draggable: false, - infinite: false, - prevArrow: link - }; - - return ( -

- -

Slide1

-

Slide2

-
-
- ) + return ; } } -ReactDOM.render(, document.body); +function RightNavArrow(props: CustomArrowProps): JSX.Element { + const { className, style, onClick } = props; + return
; +} + +const defaultSettings: Settings = { + className: "", + accessibility: true, + adaptiveHeight: false, + arrows: true, + autoplay: false, + autoplaySpeed: 3000, + centerMode: false, + centerPadding: "50px", + cssEase: "ease", + customPaging: (i: number) => { + return ; + }, + dots: false, + dotsClass: "slick-dots", + draggable: true, + easing: "linear", + edgeFriction: 0.35, + fade: false, + focusOnSelect: false, + infinite: true, + initialSlide: 0, + lazyLoad: false, + pauseOnHover: true, + responsive: [{ breakpoint: 1000, settings: "unslick" }, { breakpoint: 2000, settings: { arrows: false } }], + rtl: false, + slide: "div", + slidesToShow: 1, + slidesToScroll: 1, + speed: 500, + swipe: true, + swipeToSlide: false, + touchMove: true, + touchThreshold: 5, + useCSS: true, + variableWidth: false, + vertical: false, + waitForAnimate: true, + afterChange: (currentSlide: number) => { }, + beforeChange: (currentSlide: number, nextSlide: number) => { }, + edgeEvent: (swipeDirection: string) => { }, + init: () => { }, + swipeEvent: (swipeDirection: string) => { }, + nextArrow: , + prevArrow: +}; + +class SliderTest extends React.Component<{}, {}> { + private slider: Slider; + render() { + return
+ { this.slider = component; }} + > +

1

+

2

+

3

+

4

+

5

+

6

+
+
+ + + +
+
; + } +} diff --git a/types/react-slick/tsconfig.json b/types/react-slick/tsconfig.json index 295e4cd738..72d192fbf8 100644 --- a/types/react-slick/tsconfig.json +++ b/types/react-slick/tsconfig.json @@ -7,7 +7,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "jsx": "react", "typeRoots": [ @@ -21,4 +21,4 @@ "index.d.ts", "react-slick-tests.tsx" ] -} \ No newline at end of file +} From cdca61035a709b4c022b91c52ac65061e29d43f2 Mon Sep 17 00:00:00 2001 From: Mike Dvorscak Date: Thu, 18 May 2017 11:40:32 -0500 Subject: [PATCH 0065/1105] Add JQueryCssProperties interface for $.css(properties: object) Adding JQueryCssProperties interface and changing the signature for $.css(properties: object) to $.css(properties: JQueryCssProperties) --- types/jquery/index.d.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/types/jquery/index.d.ts b/types/jquery/index.d.ts index ca799f21e5..9dc1bf466e 100644 --- a/types/jquery/index.d.ts +++ b/types/jquery/index.d.ts @@ -679,6 +679,13 @@ interface JQueryCoordinates { top: number; } +/** + * The interface used to specify the properties parameter in css() + */ +interface JQueryCssProperties { + [propertyName: string]: string | number | Function; +} + /** * Elements in the array returned by serializeArray() */ @@ -1687,7 +1694,7 @@ interface JQuery { * @param properties An object of property-value pairs to set. * @see {@link https://api.jquery.com/css/#css-properties} */ - css(properties: Object): JQuery; + css(properties: JQueryCssProperties): JQuery; /** * Get the current computed height for the first element in the set of matched elements. From 99f3e10a1db60ab71c45489a05064888ad861046 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vesa=20Poikaj=C3=A4rvi?= Date: Thu, 18 May 2017 20:31:09 +0300 Subject: [PATCH 0066/1105] {basic-auth] auth.parse can return undefined In reference to #16607 add undefined also to parse return value --- types/basic-auth/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/basic-auth/index.d.ts b/types/basic-auth/index.d.ts index be8dcb1f01..ac5f4cdafb 100644 --- a/types/basic-auth/index.d.ts +++ b/types/basic-auth/index.d.ts @@ -16,7 +16,7 @@ declare namespace auth { } // See https://github.com/jshttp/basic-auth/blob/v1.1.0/index.js#L87-L95 - function parse(authorizationHeader: string): auth.BasicAuthResult; + function parse(authorizationHeader: string): auth.BasicAuthResult | undefined; } export = auth; From b7612018f25f01cc9ea097ca243db0d629a7a99a Mon Sep 17 00:00:00 2001 From: Samuel DeSota Date: Thu, 18 May 2017 14:44:55 -0400 Subject: [PATCH 0067/1105] added typings for mapPropsStreamWithConfig and componentFromStreamWithConfig --- types/recompose/index.d.ts | 10 ++++++++++ types/recompose/recompose-tests.tsx | 1 - 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/types/recompose/index.d.ts b/types/recompose/index.d.ts index 6cef47160e..4b37d35fda 100644 --- a/types/recompose/index.d.ts +++ b/types/recompose/index.d.ts @@ -255,11 +255,21 @@ declare module 'recompose' { propsToReactNode: mapper, Subscribable> ): Component; // ??? + // componentFromStreamWithConfig: https://github.com/acdlite/recompose/blob/master/docs/API.md#componentfromstreamwithconfig + export function componentFromStreamWithConfig(config: ObservableConfig): ( + propsToReactNode: mapper, Subscribable> + ) => Component + // mapPropsStream: https://github.com/acdlite/recompose/blob/master/docs/API.md#mapPropsStream export function mapPropsStream( transform: mapper, Subscribable> ): ComponentEnhancer; + // mapPropsStreamWithConfig: https://github.com/acdlite/recompose/blob/master/docs/API.md#mappropsstreamwithconfig + export function mapPropsStreamWithConfig(config: ObservableConfig): ( + transform: mapper, Subscribable> + ) => ComponentEnhancer; + // createEventHandler: https://github.com/acdlite/recompose/blob/master/docs/API.md#createEventHandler type EventHandlerOf> = { handler: (value: T) => void; diff --git a/types/recompose/recompose-tests.tsx b/types/recompose/recompose-tests.tsx index 01bd1d28f5..ce8c55044f 100644 --- a/types/recompose/recompose-tests.tsx +++ b/types/recompose/recompose-tests.tsx @@ -178,4 +178,3 @@ function testRenderComponent() { const enhancer = renderComponent(() => Nop!); const enhanced: React.ComponentClass = enhancer(innerComponent); } - From 9eea1e8a919aff0c71b9ccf34eb782206a6c7727 Mon Sep 17 00:00:00 2001 From: Samuel DeSota Date: Thu, 18 May 2017 14:53:04 -0400 Subject: [PATCH 0068/1105] added to defs by, changed generic position, and added defs by --- types/recompose/index.d.ts | 7 ++++--- types/recompose/recompose-tests.tsx | 9 +++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/types/recompose/index.d.ts b/types/recompose/index.d.ts index 4b37d35fda..0951a04a9f 100644 --- a/types/recompose/index.d.ts +++ b/types/recompose/index.d.ts @@ -1,6 +1,7 @@ -// Type definitions for Recompose v0.22.0 +// Type definitions for Recompose v0.23.4 // Project: https://github.com/acdlite/recompose // Definitions by: Iskander Sierra +// Samuel DeSota // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 @@ -256,7 +257,7 @@ declare module 'recompose' { ): Component; // ??? // componentFromStreamWithConfig: https://github.com/acdlite/recompose/blob/master/docs/API.md#componentfromstreamwithconfig - export function componentFromStreamWithConfig(config: ObservableConfig): ( + export function componentFromStreamWithConfig(config: ObservableConfig): ( propsToReactNode: mapper, Subscribable> ) => Component @@ -266,7 +267,7 @@ declare module 'recompose' { ): ComponentEnhancer; // mapPropsStreamWithConfig: https://github.com/acdlite/recompose/blob/master/docs/API.md#mappropsstreamwithconfig - export function mapPropsStreamWithConfig(config: ObservableConfig): ( + export function mapPropsStreamWithConfig(config: ObservableConfig): ( transform: mapper, Subscribable> ) => ComponentEnhancer; diff --git a/types/recompose/recompose-tests.tsx b/types/recompose/recompose-tests.tsx index ce8c55044f..1d645f412d 100644 --- a/types/recompose/recompose-tests.tsx +++ b/types/recompose/recompose-tests.tsx @@ -16,6 +16,7 @@ import { createSink, componentFromProp, nest, hoistStatics, // Observable utilities componentFromStream, mapPropsStream, createEventHandler, + componentFromStreamWithConfig, mapPropsStreamWithConfig, setObservableConfig, } from "recompose"; import rxjsconfig from "recompose/rxjsObservableConfig"; @@ -178,3 +179,11 @@ function testRenderComponent() { const enhancer = renderComponent(() => Nop!); const enhanced: React.ComponentClass = enhancer(innerComponent); } + +function testWithObservableConfig() { + let componentFromStreamMost = componentFromStreamWithConfig(mostConfig) + componentFromStreamMost = componentFromStream + + let mapPropsStreamMost = mapPropsStreamWithConfig(mostConfig) + mapPropsStreamMost = mapPropsStream +} From 09d36cb59e3c8317e03539625ba6721bcd084a4d Mon Sep 17 00:00:00 2001 From: Takeshi YAEDA Date: Fri, 19 May 2017 09:03:08 +0900 Subject: [PATCH 0069/1105] Make namespace lower-case (types/noble) --- types/noble/index.d.ts | 2 +- types/noble/noble-tests.ts | 26 +++++++++++++------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/types/noble/index.d.ts b/types/noble/index.d.ts index 6ee7fd85b3..94ba4f8922 100644 --- a/types/noble/index.d.ts +++ b/types/noble/index.d.ts @@ -8,7 +8,7 @@ import events = require("events"); -export as namespace Noble; +export as namespace noble; export declare function startScanning(serviceUUIDs?: string[], allowDuplicates?: boolean, callback?: (error: Error) => void): void; export declare function stopScanning(callback?: () => void): void; diff --git a/types/noble/noble-tests.ts b/types/noble/noble-tests.ts index 3f5a035dcd..2f985d2888 100644 --- a/types/noble/noble-tests.ts +++ b/types/noble/noble-tests.ts @@ -20,12 +20,12 @@ test_stopScanning(); noble.on("stateChange", (state: string): void => {}); noble.on("scanStart", (): void => {}); noble.on("scanStop", (): void => {}); -noble.on("discover", (peripheral: Noble.Peripheral): void => { +noble.on("discover", (peripheral: noble.Peripheral): void => { peripheral.connect((error: string): void => {}); peripheral.disconnect((): void => {}); }); -var peripheral: Noble.Peripheral = new noble.Peripheral(); +var peripheral: noble.Peripheral = new noble.Peripheral(); peripheral.uuid = "12ad4e81"; peripheral.advertisement = { localName: "device", @@ -41,19 +41,19 @@ peripheral.disconnect((): void => {}); peripheral.updateRssi(); peripheral.updateRssi((error: string, rssi: number): void => {}); peripheral.discoverServices(["180d"]); -peripheral.discoverServices(["180d"], (error: string, services: Noble.Service[]): void => {}); +peripheral.discoverServices(["180d"], (error: string, services: noble.Service[]): void => {}); peripheral.discoverAllServicesAndCharacteristics(); -peripheral.discoverAllServicesAndCharacteristics((error: string, services: Noble.Service[], characteristics: Noble.Characteristic[]): void => {}); +peripheral.discoverAllServicesAndCharacteristics((error: string, services: noble.Service[], characteristics: noble.Characteristic[]): void => {}); peripheral.discoverSomeServicesAndCharacteristics(["180d"], ["2a38"]); -peripheral.discoverSomeServicesAndCharacteristics(["180d"], ["2a38"], (error: string, services: Noble.Service[], characteristics: Noble.Characteristic[]): void => {}); +peripheral.discoverSomeServicesAndCharacteristics(["180d"], ["2a38"], (error: string, services: noble.Service[], characteristics: noble.Characteristic[]): void => {}); peripheral.readHandle(new Buffer(1), (error: string, data: NodeBuffer): void => {}); peripheral.writeHandle(new Buffer(1), new Buffer(1), true, (error: string): void => {}); peripheral.on("connect", (error: string): void => {}); peripheral.on("disconnect", (error: string): void => {}); peripheral.on("rssiUpdate", (rssi: number): void => {}); -peripheral.on("servicesDiscover", (services: Noble.Service[]): void => {}); +peripheral.on("servicesDiscover", (services: noble.Service[]): void => {}); -var service: Noble.Service = new noble.Service(); +var service: noble.Service = new noble.Service(); service.uuid = "180a"; service.name = ""; service.type = ""; @@ -61,11 +61,11 @@ service.includedServiceUuids = ["180d"]; service.discoverIncludedServices(["180d"]); service.discoverIncludedServices(["180d"], (error: string, includedServiceUuids: string[]): void => {}); service.discoverCharacteristics(["2a38"]); -service.discoverCharacteristics(["2a38"], (error: string, characteristics: Noble.Characteristic[]): void => {}); +service.discoverCharacteristics(["2a38"], (error: string, characteristics: noble.Characteristic[]): void => {}); service.on("includedServicesDiscover", (includedServiceUuids: string[]): void => {}); -service.on("characteristicsDiscover", (characteristics: Noble.Characteristic[]): void => {}); +service.on("characteristicsDiscover", (characteristics: noble.Characteristic[]): void => {}); -var characteristic: Noble.Characteristic = new noble.Characteristic(); +var characteristic: noble.Characteristic = new noble.Characteristic(); characteristic.uuid = "2a37"; characteristic.name = ""; characteristic.type = ""; @@ -79,14 +79,14 @@ characteristic.broadcast(true, (error: string): void => {}); characteristic.notify(true); characteristic.notify(true, (error: string): void => {}); characteristic.discoverDescriptors(); -characteristic.discoverDescriptors((error: string, descriptors: Noble.Descriptor[]): void => {}); +characteristic.discoverDescriptors((error: string, descriptors: noble.Descriptor[]): void => {}); characteristic.on("read", (data: NodeBuffer, isNotification: boolean): void => {}); characteristic.on("write", true, (error: string): void => {}); characteristic.on("broadcast", (state: string): void => {}); characteristic.on("notify", (state: string): void => {}); -characteristic.on("descriptorsDiscover", (descriptors: Noble.Descriptor[]): void => {}); +characteristic.on("descriptorsDiscover", (descriptors: noble.Descriptor[]): void => {}); -var descriptor: Noble.Descriptor = new noble.Descriptor(); +var descriptor: noble.Descriptor = new noble.Descriptor(); descriptor.uuid = ""; descriptor.name = ""; descriptor.type = ""; From 7072e33836ac0fc6ea1b1424d55d31e62d5d0cee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20=C3=81ngel=20L=C3=B3pez=20Vicente?= Date: Fri, 19 May 2017 09:34:39 +0200 Subject: [PATCH 0070/1105] Add id to AmGraph --- types/amcharts/index.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/types/amcharts/index.d.ts b/types/amcharts/index.d.ts index bc41907d50..5250613fe3 100644 --- a/types/amcharts/index.d.ts +++ b/types/amcharts/index.d.ts @@ -2271,6 +2271,10 @@ If you do not set properties such as dashLength, lineAlpha, lineColor, etc - val hideBulletsCount: number; /** Name of the high field (used by candlesticks and ohlc) in your dataProvider. */ highField: string; + + /** Unique id of a graph. It is not required to set one, unless you want to use this graph for as your scrollbar's graph and need to indicate which graph should be used.*// + id: string; + /** Whether to include this graph when calculating min and max value of the axis. @default true */ From 1c09309c27547cd5fc5162f5047f1d05d8d5ca6f Mon Sep 17 00:00:00 2001 From: Dolan Date: Fri, 19 May 2017 12:26:21 +0100 Subject: [PATCH 0071/1105] Exported SalesforceId and fixed typo --- types/jsforce/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/jsforce/index.d.ts b/types/jsforce/index.d.ts index 4c0f82b626..bf8f98b574 100644 --- a/types/jsforce/index.d.ts +++ b/types/jsforce/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for archiver 1.8 +// Type definitions for jsforce 1.8 // Project: https://github.com/jsforce/jsforce // Definitions by: Dolan Miu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -12,3 +12,4 @@ export { Date } from './date-enum'; export { RecordResult } from './record-result'; export { Connection } from './connection'; export { SObject } from './salesforce-object'; +export { SalesforceId } from './salesforce-id'; From e48cabe2bff3350ba38f7f0d9ba8fb50a542ba16 Mon Sep 17 00:00:00 2001 From: Dolan Date: Fri, 19 May 2017 12:43:33 +0100 Subject: [PATCH 0072/1105] Added upsert --- types/jsforce/salesforce-object.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/jsforce/salesforce-object.d.ts b/types/jsforce/salesforce-object.d.ts index ac2288fe33..96036376c1 100644 --- a/types/jsforce/salesforce-object.d.ts +++ b/types/jsforce/salesforce-object.d.ts @@ -12,7 +12,7 @@ export class SObject { update(options: SObjectCreateOptions, callback?: (err: Error, ret: any) => void): void; retrieve(ids: string | string[], callback?: (err: Error, ret: any) => void): void; retrieve(ids: string | string[], options?: Object, callback?: (err: Error, ret: any) => void): void; - // upsert(options: SObjectOptions): void; + upsert(records: Record | Record[], extIdField: SalesforceId, options: object, callback?: (err: Error, ret: RecordResult) => void): Promise; describeGlobal(callback: (err: Error, res: any) => void): void; describe$(callback: (err: Error, ret: DescribeSObjectResult) => void): void; describeGlobal$(callback: (err: Error, res: any) => void): void; From f58e431dfccd1564f959ebbe986cd111c97cad8b Mon Sep 17 00:00:00 2001 From: Dolan Date: Fri, 19 May 2017 12:49:16 +0100 Subject: [PATCH 0073/1105] Fixed typo --- types/jsforce/salesforce-object.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/jsforce/salesforce-object.d.ts b/types/jsforce/salesforce-object.d.ts index 96036376c1..c416fcc115 100644 --- a/types/jsforce/salesforce-object.d.ts +++ b/types/jsforce/salesforce-object.d.ts @@ -12,7 +12,7 @@ export class SObject { update(options: SObjectCreateOptions, callback?: (err: Error, ret: any) => void): void; retrieve(ids: string | string[], callback?: (err: Error, ret: any) => void): void; retrieve(ids: string | string[], options?: Object, callback?: (err: Error, ret: any) => void): void; - upsert(records: Record | Record[], extIdField: SalesforceId, options: object, callback?: (err: Error, ret: RecordResult) => void): Promise; + upsert(records: Record | Record[], extIdField: SalesforceId, options?: Object, callback?: (err: Error, ret: RecordResult) => void): Promise; describeGlobal(callback: (err: Error, res: any) => void): void; describe$(callback: (err: Error, ret: DescribeSObjectResult) => void): void; describeGlobal$(callback: (err: Error, res: any) => void): void; From f10061da3f143c2f62ae672ab93e91194cccce94 Mon Sep 17 00:00:00 2001 From: Dolan Date: Fri, 19 May 2017 12:52:35 +0100 Subject: [PATCH 0074/1105] Used string instead of String Added upsertBulk --- types/jsforce/salesforce-object.d.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/types/jsforce/salesforce-object.d.ts b/types/jsforce/salesforce-object.d.ts index c416fcc115..12c9b97cf7 100644 --- a/types/jsforce/salesforce-object.d.ts +++ b/types/jsforce/salesforce-object.d.ts @@ -13,6 +13,7 @@ export class SObject { retrieve(ids: string | string[], callback?: (err: Error, ret: any) => void): void; retrieve(ids: string | string[], options?: Object, callback?: (err: Error, ret: any) => void): void; upsert(records: Record | Record[], extIdField: SalesforceId, options?: Object, callback?: (err: Error, ret: RecordResult) => void): Promise; + upsertBulk(input?: Record[] | stream.Stream | string, callback?: (err: Error, ret: RecordResult) => void): Batch; describeGlobal(callback: (err: Error, res: any) => void): void; describe$(callback: (err: Error, ret: DescribeSObjectResult) => void): void; describeGlobal$(callback: (err: Error, res: any) => void): void; @@ -30,18 +31,18 @@ export class SObject { compactLayouts(callback?: CompactLayoutInfo): Promise; count(conditions?: Object | string, callback?: (err: Error, num: number) => void): Promise; create(options: any | any[], callback?: (err: Error, ret: RecordResult | RecordResult[]) => void): Promise; - createBulk(input?: Record[] | stream.Stream | String, callback?: (err: Error, ret: RecordResult) => void): Batch; + createBulk(input?: Record[] | stream.Stream | string, callback?: (err: Error, ret: RecordResult) => void): Batch; del(ids: string | string[], callback?: (err: Error, ret: any) => void): void; destroy(ids: string | string[], callback?: (err: Error, ret: any) => void): void; delete(ids: string | string[], callback?: (err: Error, ret: any) => void): void; - deleteBulk(input?: Record[] | stream.Stream | String, callback?: (err: Error, ret: RecordResult) => void): Batch; - destroyBulk(input?: Record[] | stream.Stream | String, callback?: (err: Error, ret: RecordResult) => void): Batch; - destroyHardBulk(input?: Record[] | stream.Stream | String, callback?: (err: Error, ret: RecordResult) => void): Batch; + deleteBulk(input?: Record[] | stream.Stream | string, callback?: (err: Error, ret: RecordResult) => void): Batch; + destroyBulk(input?: Record[] | stream.Stream | string, callback?: (err: Error, ret: RecordResult) => void): Batch; + destroyHardBulk(input?: Record[] | stream.Stream | string, callback?: (err: Error, ret: RecordResult) => void): Batch; deleted(start: Date | string, end: Date | string, callback?: (info: DeletedRecordsInfo) => void): Promise; - deleteHardBulk(input?: Record[] | stream.Stream | String, callback?: (err: Error, ret: RecordResult) => void): Batch; + deleteHardBulk(input?: Record[] | stream.Stream | string, callback?: (err: Error, ret: RecordResult) => void): Batch; describe(callback?: (err: Error, ret: DescribeSObjectResult) => void): Promise; insert(options: any | any[], callback?: (err: Error, ret: RecordResult | RecordResult[]) => void): Promise; - insertBulk(input?: Record[] | stream.Stream | String, callback?: (err: Error, ret: RecordResult) => void): Batch; + insertBulk(input?: Record[] | stream.Stream | string, callback?: (err: Error, ret: RecordResult) => void): Batch; layouts(layoutName?: string, callback?: (err: Error, info: LayoutInfo) => void): Promise; listview(id: string): ListView; listviews(callback?: (err: Error, info: ListViewsInfo) => void): Promise; From 0129c3b4a2771ecddd4e252eb8d220c1168d7a14 Mon Sep 17 00:00:00 2001 From: andraaspar Date: Fri, 19 May 2017 15:32:24 +0200 Subject: [PATCH 0075/1105] Fixed tslint rules. --- types/mithril/tslint.json | 1 + 1 file changed, 1 insertion(+) diff --git a/types/mithril/tslint.json b/types/mithril/tslint.json index 4f44991c3c..f60b65d69d 100644 --- a/types/mithril/tslint.json +++ b/types/mithril/tslint.json @@ -1,6 +1,7 @@ { "extends": "dtslint/dt.json", "rules": { + "object-literal-key-quotes": false, "no-empty-interface": false } } From 72c44b6d9ef2fd92f56363820de57ac5234b37b8 Mon Sep 17 00:00:00 2001 From: lax20attack Date: Fri, 19 May 2017 11:32:19 -0400 Subject: [PATCH 0076/1105] Update index.d.ts --- types/leaflet/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/leaflet/index.d.ts b/types/leaflet/index.d.ts index 41da11d362..2d0ed95c74 100644 --- a/types/leaflet/index.d.ts +++ b/types/leaflet/index.d.ts @@ -1374,6 +1374,7 @@ declare namespace L { wrapLatLng(latlng: LatLngExpression): LatLng; distance(latlng1: LatLngExpression, latlng2: LatLngExpression): number; containerPointToLayerPoint(point: PointExpression): Point; + containerPointToLatLng(point: PointExpression): LatLng; layerPointToContainerPoint(point: PointExpression): Point; latLngToContainerPoint(latlng: LatLngExpression): Point; mouseEventToContainerPoint(ev: MouseEvent): Point; From 9d9aad622f688044f0e94ab64451e53795e27077 Mon Sep 17 00:00:00 2001 From: Gabe Scholz Date: Fri, 19 May 2017 11:44:50 -0700 Subject: [PATCH 0077/1105] Add resolves and rejects matchers from Jest 20 --- types/jest/index.d.ts | 2 ++ types/jest/jest-tests.ts | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/types/jest/index.d.ts b/types/jest/index.d.ts index 36011e67a7..7ac5c7486b 100644 --- a/types/jest/index.d.ts +++ b/types/jest/index.d.ts @@ -178,6 +178,8 @@ declare namespace jest { interface Matchers { /** If you know how to test something, `.not` lets you test its opposite. */ not: Matchers; + resolves: Matchers; + rejects: Matchers; lastCalledWith(...args: any[]): void; /** Checks that a value is what you expect. It uses `===` to check strict equality. Don't use `toBe` with floating-point numbers. */ toBe(expected: any): void; diff --git a/types/jest/jest-tests.ts b/types/jest/jest-tests.ts index d951153842..0605724334 100644 --- a/types/jest/jest-tests.ts +++ b/types/jest/jest-tests.ts @@ -501,3 +501,18 @@ describe('Mocks', function () { anotherIns.testMethod.mockImplementation(() => 1); }); }); + +// https://facebook.github.io/jest/docs/en/expect.html#resolves +describe('resolves', function () { + it('unwraps the expected Promise', function () { + return expect(Promise.resolve('test')).resolves.toEqual('test'); + }); +}); + +// https://facebook.github.io/jest/docs/en/expect.html#rejects +describe('rejects', function () { + it('unwraps the expected Promise', function () { + const error = new Error('error'); + return expect(Promise.reject(error)).rejects.toBeDefined(); + }); +}); \ No newline at end of file From 6246d0d62bc14a1297e2d8ab5f300daf50949937 Mon Sep 17 00:00:00 2001 From: Aluan Haddad Date: Sat, 20 May 2017 10:12:03 -0400 Subject: [PATCH 0078/1105] updated to use Mapped Types and align with Object.freeze in lib.d.ts Updated the declaration to take advantage of Mapped Types. Specifically, I added a `DeepReadonly` recursive generic mapped type. Additionally, I took the opportunity to add overloads that mirroring those of `Object.freeze` as specified in the latest `lib.d.ts`. I removed the interface as it is now unused. --- types/deep-freeze/index.d.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/types/deep-freeze/index.d.ts b/types/deep-freeze/index.d.ts index 92f6c8db2f..423cecf81c 100644 --- a/types/deep-freeze/index.d.ts +++ b/types/deep-freeze/index.d.ts @@ -1,13 +1,13 @@ -// Type definitions for deep-freeze +// Type definitions for deep-freeze 0.1 // Project: https://github.com/substack/deep-freeze // Definitions by: Bart van der Schoor // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 -declare var deepFreeze: DeepFreeze.DeepFreezeInterface; export = deepFreeze; -declare namespace DeepFreeze { - export interface DeepFreezeInterface { - (obj: T): T; - } -} +declare function deepFreeze(a: T[]): ReadonlyArray>; +declare function deepFreeze(f: T): T; +declare function deepFreeze(o: T): DeepReadonly; + +declare type DeepReadonly = Readonly<{ [P in keyof T]: Readonly }>; From 8e4832bbdd306a5960ccc1f312591a7fdb5ca0c9 Mon Sep 17 00:00:00 2001 From: Aluan Haddad Date: Sat, 20 May 2017 10:19:44 -0400 Subject: [PATCH 0079/1105] add tslint.json --- types/deep-freeze/tslint.json | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 types/deep-freeze/tslint.json diff --git a/types/deep-freeze/tslint.json b/types/deep-freeze/tslint.json new file mode 100644 index 0000000000..1cd17c5dc4 --- /dev/null +++ b/types/deep-freeze/tslint.json @@ -0,0 +1,7 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + // This package uses the Function type to align with lib.d.ts + "ban-types": false + } +} From 10297b8f3eb3c15bb5c0a1e0c2e49ea030de7faa Mon Sep 17 00:00:00 2001 From: Aluan Haddad Date: Sat, 20 May 2017 10:30:53 -0400 Subject: [PATCH 0080/1105] lint tests --- types/deep-freeze/deep-freeze-tests.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/types/deep-freeze/deep-freeze-tests.ts b/types/deep-freeze/deep-freeze-tests.ts index 4eeb1e9890..77f111c30f 100644 --- a/types/deep-freeze/deep-freeze-tests.ts +++ b/types/deep-freeze/deep-freeze-tests.ts @@ -1,8 +1,7 @@ - - import df = require('deep-freeze'); class Foo { - foo: string; + foo: string; } -var foo:Foo = df(new Foo()); +const foo: Foo = df(new Foo()); +const items = [{id: 0, name: 'first'}]; From 01065233d5943a9bcebd78a1a28c34801086793a Mon Sep 17 00:00:00 2001 From: Aluan Haddad Date: Sat, 20 May 2017 10:37:00 -0400 Subject: [PATCH 0081/1105] lint declaration --- types/deep-freeze/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/deep-freeze/index.d.ts b/types/deep-freeze/index.d.ts index 423cecf81c..3579a5f673 100644 --- a/types/deep-freeze/index.d.ts +++ b/types/deep-freeze/index.d.ts @@ -10,4 +10,4 @@ declare function deepFreeze(a: T[]): ReadonlyArray>; declare function deepFreeze(f: T): T; declare function deepFreeze(o: T): DeepReadonly; -declare type DeepReadonly = Readonly<{ [P in keyof T]: Readonly }>; +type DeepReadonly = Readonly<{ [P in keyof T]: Readonly }>; From f2172aa7beea7eb61cd823c3f92902172ae50fef Mon Sep 17 00:00:00 2001 From: Aluan Haddad Date: Sat, 20 May 2017 10:50:27 -0400 Subject: [PATCH 0082/1105] Use recursive mapped type --- types/deep-freeze/deep-freeze-tests.ts | 2 +- types/deep-freeze/index.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/types/deep-freeze/deep-freeze-tests.ts b/types/deep-freeze/deep-freeze-tests.ts index 77f111c30f..40be1faa47 100644 --- a/types/deep-freeze/deep-freeze-tests.ts +++ b/types/deep-freeze/deep-freeze-tests.ts @@ -3,5 +3,5 @@ import df = require('deep-freeze'); class Foo { foo: string; } -const foo: Foo = df(new Foo()); +const foo = df(new Foo()); const items = [{id: 0, name: 'first'}]; diff --git a/types/deep-freeze/index.d.ts b/types/deep-freeze/index.d.ts index 3579a5f673..d96003a6be 100644 --- a/types/deep-freeze/index.d.ts +++ b/types/deep-freeze/index.d.ts @@ -10,4 +10,4 @@ declare function deepFreeze(a: T[]): ReadonlyArray>; declare function deepFreeze(f: T): T; declare function deepFreeze(o: T): DeepReadonly; -type DeepReadonly = Readonly<{ [P in keyof T]: Readonly }>; +type DeepReadonly = Readonly<{ [P in keyof T]: DeepReadonly }>; From bb60981e527c3c25ba99fcab3d05a4b8cf03cb8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vesa=20Poikaj=C3=A4rvi?= Date: Sun, 21 May 2017 18:48:23 +0300 Subject: [PATCH 0083/1105] [basic-auth] Copy jsdoc --- types/basic-auth/basic-auth-tests.ts | 2 +- types/basic-auth/index.d.ts | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/types/basic-auth/basic-auth-tests.ts b/types/basic-auth/basic-auth-tests.ts index fee30eb32b..22e27a5a49 100644 --- a/types/basic-auth/basic-auth-tests.ts +++ b/types/basic-auth/basic-auth-tests.ts @@ -3,4 +3,4 @@ import auth = require('basic-auth'); auth(null); -auth.parse('QmFzaWM6QXV0aA=='); +auth.parse('Basic QmFzaWM6QXV0aA=='); diff --git a/types/basic-auth/index.d.ts b/types/basic-auth/index.d.ts index ac5f4cdafb..f5e0499b44 100644 --- a/types/basic-auth/index.d.ts +++ b/types/basic-auth/index.d.ts @@ -15,7 +15,13 @@ declare namespace auth { pass: string; } - // See https://github.com/jshttp/basic-auth/blob/v1.1.0/index.js#L87-L95 + /** + * Parse basic auth to object. + * + * @param {string} string + * @return {object} + * @public + */ function parse(authorizationHeader: string): auth.BasicAuthResult | undefined; } From 1a19f3cd5c04726d1826526435e7bd14f8929e28 Mon Sep 17 00:00:00 2001 From: Chad Auld Date: Sun, 21 May 2017 12:05:29 -0600 Subject: [PATCH 0084/1105] Adding missing property (onTouchTap) to material-ui GridTile component --- types/material-ui/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/material-ui/index.d.ts b/types/material-ui/index.d.ts index 832cdd04dd..c69b4af323 100644 --- a/types/material-ui/index.d.ts +++ b/types/material-ui/index.d.ts @@ -1046,6 +1046,7 @@ declare namespace __MaterialUI { title?: React.ReactNode; titleBackground?: string; titlePosition?: "top" | "bottom"; + onTouchTap?: TouchTapEventHandler; } export class GridTile extends React.Component { } From 7316dccd5401253d20d1991f005cd72336b9d1ca Mon Sep 17 00:00:00 2001 From: Chad Auld Date: Sun, 21 May 2017 12:07:04 -0600 Subject: [PATCH 0085/1105] Adding missing property (onTouchTap) to material-ui GridTile component --- types/material-ui/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/material-ui/index.d.ts b/types/material-ui/index.d.ts index c69b4af323..79082c531b 100644 --- a/types/material-ui/index.d.ts +++ b/types/material-ui/index.d.ts @@ -1046,7 +1046,7 @@ declare namespace __MaterialUI { title?: React.ReactNode; titleBackground?: string; titlePosition?: "top" | "bottom"; - onTouchTap?: TouchTapEventHandler; + onTouchTap?: TouchTapEventHandler; } export class GridTile extends React.Component { } From b8948098f4752d5cf0063bd17dcff3bfe8e2e439 Mon Sep 17 00:00:00 2001 From: Ruben Slabbert Date: Mon, 22 May 2017 12:13:35 +1000 Subject: [PATCH 0086/1105] Updated react-dates to 12.1.0 --- types/react-dates/index.d.ts | 71 +++++++++++++++++++++--------------- 1 file changed, 42 insertions(+), 29 deletions(-) diff --git a/types/react-dates/index.d.ts b/types/react-dates/index.d.ts index d64d9cdbca..e9b2e10798 100644 --- a/types/react-dates/index.d.ts +++ b/types/react-dates/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-dates v10.0.1 +// Type definitions for react-dates v12.1.0 // Project: https://github.com/airbnb/react-dates // Definitions by: Artur Ampilogov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -9,30 +9,32 @@ import * as moment from "moment"; export = ReactDates; -declare namespace momentPropTypes{ +declare namespace momentPropTypes { type momentObj = moment.Moment; type momentString = any; type momentDurationObj = any; } - -declare namespace ReactDates{ + +declare namespace ReactDates { type AnchorDirectionShape = 'left' | 'right'; type FocusedInputShape = 'startDate' | 'endDate'; - type OrientationShape = 'horizontal' | 'vertical'; - type ScrollableOrientationShape = 'horizontal' | 'vertical' | 'verticalScrollable'; - + type OrientationShape = 'horizontal' | 'vertical'; + type ScrollableOrientationShape = 'horizontal' | 'vertical' | 'verticalScrollable'; - interface DateRangePickerShape{ + + interface DateRangePickerShape { // REQUIRED props startDate: momentPropTypes.momentObj | null, endDate: momentPropTypes.momentObj | null, - onDatesChange: (arg: { startDate: momentPropTypes.momentObj | null, - endDate: momentPropTypes.momentObj | null } - ) => void, + onDatesChange: (arg: { + startDate: momentPropTypes.momentObj | null, + endDate: momentPropTypes.momentObj | null + } + ) => void, focusedInput: FocusedInputShape | null, onFocusChange: (arg: FocusedInputShape | null) => void, - + // input related props startDateId?: string, startDatePlaceholderText?: string, @@ -40,6 +42,7 @@ declare namespace ReactDates{ endDatePlaceholderText?: string, disabled?: boolean, required?: boolean, + readOnly?: boolean, screenReaderInputMessage?: string, showClearDates?: boolean, showDefaultInputIcon?: boolean, @@ -57,13 +60,16 @@ declare namespace ReactDates{ numberOfMonths?: number, keepOpenOnDateSelect?: boolean, reopenPickerOnClearDates?: boolean, - renderCalendarInfo?: () => (string | JSX.Element), + renderCalendarInfo?: () => (string | JSX.Element), + hideKeyboardShortcutsPanel?: boolean, + isRTL?: boolean, // navigation related props navPrev?: string | JSX.Element, navNext?: string | JSX.Element, onPrevMonthClick?: (e: React.EventHandler>) => void, onNextMonthClick?: (e: React.EventHandler>) => void, + onClose?: (final: { startDate: momentPropTypes.momentObj, endDate: momentPropTypes.momentObj }) => void, // day presentation and interaction related props renderDay?: (day: momentPropTypes.momentObj) => (string | JSX.Element), @@ -72,10 +78,10 @@ declare namespace ReactDates{ isDayBlocked?: (day: any) => boolean, isOutsideRange?: (day: any) => boolean, isDayHighlighted?: (day: any) => boolean, - + // internationalization props - displayFormat?: (string | (()=> string)), + displayFormat?: (string | (() => string)), monthFormat?: string, phrases?: { closeDatePicker: string, @@ -111,22 +117,25 @@ declare namespace ReactDates{ type DateRangePicker = React.ClassicComponentClass; var DateRangePicker: React.ClassicComponentClass; - interface SingleDatePickerShape{ + interface SingleDatePickerShape { // REQUIRED props date: momentPropTypes.momentObj | null, onDateChange: (date: momentPropTypes.momentObj | null) => void, focused: boolean, onFocusChange: (arg: { focused: boolean | null }) => void, - + id: string, // input related props placeholder?: string, disabled?: boolean, required?: boolean, + readOnly?: boolean, screenReaderInputMessage?: string, showClearDate?: boolean, customCloseIcon?: string | JSX.Element, + showDefaultInputIcon?: boolean, + customInputIcon?: string | JSX.Element, // calendar presentation and interaction related props orientation?: OrientationShape, @@ -138,24 +147,26 @@ declare namespace ReactDates{ numberOfMonths?: number, keepOpenOnDateSelect?: boolean, reopenPickerOnClearDates?: boolean, - renderCalendarInfo?: () => (string | JSX.Element), + renderCalendarInfo?: () => (string | JSX.Element), + hideKeyboardShortcutsPanel?: boolean, + isRTL?: boolean, // navigation related props navPrev?: string | JSX.Element, navNext?: string | JSX.Element, onPrevMonthClick?: (e: React.EventHandler>) => void, onNextMonthClick?: (e: React.EventHandler>) => void, + onClose?: (final: { startDate: momentPropTypes.momentObj, endDate: momentPropTypes.momentObj }) => void, - // day presentation and interaction related props + // day presentation and interaction related props renderDay?: (day: momentPropTypes.momentObj) => (string | JSX.Element), enableOutsideDays?: boolean, isDayBlocked?: (day: any) => boolean, isOutsideRange?: (day: any) => boolean, isDayHighlighted?: (day: any) => boolean, - // internationalization props - displayFormat?: (string | (()=> string)), + displayFormat?: (string | (() => string)), monthFormat?: string, phrases?: { closeDatePicker: string, @@ -194,9 +205,11 @@ declare namespace ReactDates{ // REQUIRED props startDate: momentPropTypes.momentObj | null, endDate: momentPropTypes.momentObj | null, - onDatesChange: (arg: { startDate: momentPropTypes.momentObj | null, - endDate: momentPropTypes.momentObj | null } - ) => void, + onDatesChange: (arg: { + startDate: momentPropTypes.momentObj | null, + endDate: momentPropTypes.momentObj | null + } + ) => void, focusedInput: FocusedInputShape | null, onFocusChange: (arg: FocusedInputShape | null) => void, @@ -206,10 +219,10 @@ declare namespace ReactDates{ orientation?: ScrollableOrientationShape, withPortal?: boolean, initialVisibleMonth?: () => momentPropTypes.momentObj, - renderCalendarInfo?: () => (string | JSX.Element), + renderCalendarInfo?: () => (string | JSX.Element), onOutsideClick?: (e: any) => void, keepOpenOnDateSelect?: boolean, - + // navigation related props navPrev?: string | JSX.Element, navNext?: string | JSX.Element, @@ -234,7 +247,7 @@ declare namespace ReactDates{ type DayPickerRangeController = React.ClassicComponentClass; var DayPickerRangeController: React.ClassicComponentClass; - + @@ -245,6 +258,6 @@ declare namespace ReactDates{ var toISODateString: (date: moment.MomentInput, currentFormat: moment.MomentFormatSpecification) => string | null; var toLocalizedDateString: (date: moment.MomentInput, currentFormat: moment.MomentFormatSpecification) => string | null; - - var toMomentObject: (dateString: moment.MomentInput, customFormat: moment.MomentFormatSpecification) => moment.Moment | null; + + var toMomentObject: (dateString: moment.MomentInput, customFormat: moment.MomentFormatSpecification) => moment.Moment | null; } From a3ea32c6a8ce9a5701964fbe1238a9271da3df53 Mon Sep 17 00:00:00 2001 From: shane Date: Mon, 22 May 2017 17:17:58 +1000 Subject: [PATCH 0087/1105] Added spacing --- types/recompose/index.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/types/recompose/index.d.ts b/types/recompose/index.d.ts index 9d383cae15..4a96181eb5 100644 --- a/types/recompose/index.d.ts +++ b/types/recompose/index.d.ts @@ -160,10 +160,10 @@ declare module 'recompose' { interface ReactLifeCycleFunctions { componentWillMount?: (this: ReactLifeCycleFunctionsThisArguments) => void; componentDidMount?: (this: ReactLifeCycleFunctionsThisArguments) => void; - componentWillReceiveProps?: (this: ReactLifeCycleFunctionsThisArguments, nextProps:TProps) => void; - shouldComponentUpdate?: (this: ReactLifeCycleFunctionsThisArguments, nextProps:TProps, nextState: TState) => boolean; - componentWillUpdate?: (this: ReactLifeCycleFunctionsThisArguments, nextProps:TProps, nextState: TState) => void; - componentDidUpdate?: (this: ReactLifeCycleFunctionsThisArguments, prevProps:TProps, prevState: TState) => void; + componentWillReceiveProps?: (this: ReactLifeCycleFunctionsThisArguments, nextProps: TProps) => void; + shouldComponentUpdate?: (this: ReactLifeCycleFunctionsThisArguments, nextProps: TProps, nextState: TState) => boolean; + componentWillUpdate?: (this: ReactLifeCycleFunctionsThisArguments, nextProps: TProps, nextState: TState) => void; + componentDidUpdate?: (this: ReactLifeCycleFunctionsThisArguments, prevProps: TProps, prevState: TState) => void; componentWillUnmount?: (this: ReactLifeCycleFunctionsThisArguments) => void; } From 485f913ab730e724f243885b2a039217a302562a Mon Sep 17 00:00:00 2001 From: Eliot Fallon Date: Mon, 22 May 2017 14:24:16 +0100 Subject: [PATCH 0088/1105] Updated to include 'playsinline' parameter --- types/youtube/index.d.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/types/youtube/index.d.ts b/types/youtube/index.d.ts index a45ec6a8c8..5a2dc3f19e 100644 --- a/types/youtube/index.d.ts +++ b/types/youtube/index.d.ts @@ -2,7 +2,8 @@ // Project: https://developers.google.com/youtube/ // Definitions by: Daz Wilkin , // Ian Obermiller , -// Josh Goldberg +// Josh Goldberg +// Eliot Fallon // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 @@ -518,6 +519,11 @@ declare namespace YT * Comma separated list of video IDs to play after the URL path's video. */ playlist?: string; + + /** + * Whether videos play inline or fullscreen in an HTML5 player on iOS. Valid values are: 1 or 0. + */ + playsinline?: number; /** * Whether to show related videos after the video finishes (by default, Show). From 8117819ce704fe73c3ac9f0db5cb9dfbf2b70f01 Mon Sep 17 00:00:00 2001 From: Ragg Date: Sat, 20 May 2017 14:10:04 +0900 Subject: [PATCH 0089/1105] Typing koa.Context for koa-generic-session --- types/koa-generic-session/index.d.ts | 11 ++++++++++- .../koa-generic-session/koa-generic-session-tests.ts | 12 ++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/types/koa-generic-session/index.d.ts b/types/koa-generic-session/index.d.ts index f3a84e7b20..d5a616b248 100644 --- a/types/koa-generic-session/index.d.ts +++ b/types/koa-generic-session/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for koa-generic-session 1.x // Project: https://github.com/koajs/generic-session -// Definitions by: Nick Simmons +// Definitions by: Nick Simmons , Ragg // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped import * as Koa from "koa"; @@ -8,6 +8,7 @@ import * as Koa from "koa"; declare namespace koaSession { interface Session { cookie: any; + [key: string]: any; } interface SessionIdStore { @@ -50,5 +51,13 @@ declare namespace koaSession { const MemoryStore: SessionStore; } +declare module 'koa' { + interface Context { + session: koaSession.Session|null; + sessionSave: boolean|null; + regenerateSession(): Generator; + } +} + declare function koaSession(options: koaSession.SessionOptions): Koa.Middleware; export = koaSession; diff --git a/types/koa-generic-session/koa-generic-session-tests.ts b/types/koa-generic-session/koa-generic-session-tests.ts index fb8d69b0e0..a00e7f5384 100644 --- a/types/koa-generic-session/koa-generic-session-tests.ts +++ b/types/koa-generic-session/koa-generic-session-tests.ts @@ -32,4 +32,16 @@ app.use(session({ beforeSave: (ctx: Koa.Context, session: Session) => {} })); +app.use((context: Koa.Context) => { + if (! context.session) { + return; + } + + context.regenerateSession(); + context.sessionSave = true; + context.session.cookie; + context.session.key = 'value'; + context.session = null; +}); + app.listen(80); From 9f0275c3931a773debcd2357fe56333493db8444 Mon Sep 17 00:00:00 2001 From: Huw McNamara Date: Mon, 22 May 2017 20:30:14 +0100 Subject: [PATCH 0090/1105] added slots interface, dialog states and confirmation statuses --- types/alexa-sdk/index.d.ts | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/types/alexa-sdk/index.d.ts b/types/alexa-sdk/index.d.ts index 9f99b14995..3e8096ca15 100644 --- a/types/alexa-sdk/index.d.ts +++ b/types/alexa-sdk/index.d.ts @@ -1,12 +1,15 @@ // Type definitions for Alexa SDK for Node.js v1.0.3 // Project: https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs -// Definitions by: Pete Beegle +// Definitions by: Pete Beegle , Huw // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export function handler(event: RequestBody, context: Context, callback?: Function): AlexaObject; export function CreateStateHandler(state: string, obj: any): any; export var StateString: string; +type DialogStates = 'STARTED' | 'IN_PROGRESS' | 'COMPLETED'; +type ConfirmationStatuses = 'NONE' | 'DENIED' | 'CONFIRMED'; + interface AlexaObject { _event: any; _context: any; @@ -74,12 +77,22 @@ interface SessionUser { interface LaunchRequest extends IRequest { } interface IntentRequest extends IRequest { + dialogState: DialogStates; intent: Intent; } +interface ISlots { + [slot: string]: { + name: string, + value?: any, + confirmationStatus: ConfirmationStatuses; + } +} + interface Intent { + confirmationStatus: ConfirmationStatuses; name: string; - slots: any; + slots: ISlots; } interface SessionEndedRequest extends IRequest { @@ -127,5 +140,3 @@ interface Image { interface Reprompt { outputSpeech: OutputSpeech; } - - From ec6fd79ea1317583e014e01c7366fb92186d962d Mon Sep 17 00:00:00 2001 From: Huw McNamara Date: Mon, 22 May 2017 20:32:11 +0100 Subject: [PATCH 0091/1105] alphabetised keys --- types/alexa-sdk/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/alexa-sdk/index.d.ts b/types/alexa-sdk/index.d.ts index 3e8096ca15..1243392569 100644 --- a/types/alexa-sdk/index.d.ts +++ b/types/alexa-sdk/index.d.ts @@ -7,8 +7,8 @@ export function handler(event: RequestBody, context: Context, callback?: Functio export function CreateStateHandler(state: string, obj: any): any; export var StateString: string; -type DialogStates = 'STARTED' | 'IN_PROGRESS' | 'COMPLETED'; type ConfirmationStatuses = 'NONE' | 'DENIED' | 'CONFIRMED'; +type DialogStates = 'STARTED' | 'IN_PROGRESS' | 'COMPLETED'; interface AlexaObject { _event: any; @@ -83,9 +83,9 @@ interface IntentRequest extends IRequest { interface ISlots { [slot: string]: { + confirmationStatus: ConfirmationStatuses; name: string, value?: any, - confirmationStatus: ConfirmationStatuses; } } From cda924591dfe6541dbbcdf8951708840fc28a5b9 Mon Sep 17 00:00:00 2001 From: Huw McNamara Date: Mon, 22 May 2017 20:37:11 +0100 Subject: [PATCH 0092/1105] increased version number --- types/alexa-sdk/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/alexa-sdk/index.d.ts b/types/alexa-sdk/index.d.ts index 1243392569..b06855489a 100644 --- a/types/alexa-sdk/index.d.ts +++ b/types/alexa-sdk/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Alexa SDK for Node.js v1.0.3 +// Type definitions for Alexa SDK for Node.js v1.1.0 // Project: https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs // Definitions by: Pete Beegle , Huw // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 940ace74aba9f1eeb1f4b344b6226c7e6a17bdca Mon Sep 17 00:00:00 2001 From: Huw McNamara Date: Mon, 22 May 2017 20:48:58 +0100 Subject: [PATCH 0093/1105] linting errors --- types/alexa-sdk/index.d.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/types/alexa-sdk/index.d.ts b/types/alexa-sdk/index.d.ts index b06855489a..fca31e45e4 100644 --- a/types/alexa-sdk/index.d.ts +++ b/types/alexa-sdk/index.d.ts @@ -7,8 +7,8 @@ export function handler(event: RequestBody, context: Context, callback?: Functio export function CreateStateHandler(state: string, obj: any): any; export var StateString: string; -type ConfirmationStatuses = 'NONE' | 'DENIED' | 'CONFIRMED'; -type DialogStates = 'STARTED' | 'IN_PROGRESS' | 'COMPLETED'; +type ConfirmationStatuses = "NONE" | "DENIED" | "CONFIRMED"; +type DialogStates = "STARTED" | "IN_PROGRESS" | "COMPLETED"; interface AlexaObject { _event: any; @@ -84,9 +84,9 @@ interface IntentRequest extends IRequest { interface ISlots { [slot: string]: { confirmationStatus: ConfirmationStatuses; - name: string, - value?: any, - } + name: string; + value?: any; + }; } interface Intent { From bbe4aab4f419d20208ce7b89544d68c1204f1dd5 Mon Sep 17 00:00:00 2001 From: amiram Date: Tue, 23 May 2017 10:40:47 +0300 Subject: [PATCH 0094/1105] auth0 fix getUser returns only a single user fix deleteUser returns void fix getUser and deleteUser mandatory params --- types/auth0/auth0-tests.ts | 36 ++++++++++++++++++++++++++++++++++++ types/auth0/index.d.ts | 8 ++++---- 2 files changed, 40 insertions(+), 4 deletions(-) diff --git a/types/auth0/auth0-tests.ts b/types/auth0/auth0-tests.ts index 24a4aad87d..b84e92e223 100644 --- a/types/auth0/auth0-tests.ts +++ b/types/auth0/auth0-tests.ts @@ -28,6 +28,42 @@ management // Handle the error. }); +// Using a callback. +management.getUser({id: 'user_id'},(err: Error, user: auth0.User) => { + if (err) { + // Handle error. + } + console.log(user); +}); + +// Using a Promise. +management + .getUser({id: 'user_id'}) + .then((user) => { + console.log(user); + }) + .catch((err) => { + // Handle the error. + }); + +// Using a callback. +management.deleteUser({id: 'user_id'},(err: Error) => { + if (err) { + // Handle error. + } + console.log('deleted'); +}); + +// Using a Promise. +management + .deleteUser({id: 'user_id'}) + .then(() => { + console.log('deleted'); + }) + .catch((err) => { + // Handle the error. + }); + management .createUser({ connection: 'My-Connection', diff --git a/types/auth0/index.d.ts b/types/auth0/index.d.ts index a8a6242bb4..096ba489a5 100644 --- a/types/auth0/index.d.ts +++ b/types/auth0/index.d.ts @@ -307,8 +307,8 @@ export class ManagementClient { getUsers(params?: GetUsersData): Promise; getUsers(params?: GetUsersData, cb?: (err: Error, users: User[]) => void): void; - getUser(params?: ObjectWithId): Promise; - getUser(params?: ObjectWithId, cb?: (err: Error, users: User[]) => void): void; + getUser(params: ObjectWithId): Promise; + getUser(params: ObjectWithId, cb?: (err: Error, user: User) => void): void; createUser(data: UserData): Promise; createUser(data: UserData, cb: (err: Error, data: User) => void): void; @@ -322,8 +322,8 @@ export class ManagementClient { deleteAllUsers(): Promise; deleteAllUsers(cb: (err: Error, data: any) => void): void; - deleteUser(params?: ObjectWithId): Promise; - deleteUser(params?: ObjectWithId, cb?: (err: Error, users: User[]) => void): void; + deleteUser(params: ObjectWithId): Promise; + deleteUser(params: ObjectWithId, cb?: (err: Error) => void): void; updateAppMetadata(params: UpdateUserParameters, data: AppMetadata): Promise; updateAppMetadata(params: UpdateUserParameters, data: AppMetadata, cb: (err: Error, data: User) => void): void; From e4a921428005061a0796734543058a720f1b318f Mon Sep 17 00:00:00 2001 From: amiram Date: Tue, 23 May 2017 10:44:03 +0300 Subject: [PATCH 0095/1105] auth0 fix getUser returns only a single user fix deleteUser returns void fix getUser and deleteUser mandatory params --- types/auth0/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/auth0/index.d.ts b/types/auth0/index.d.ts index 096ba489a5..c920f3709a 100644 --- a/types/auth0/index.d.ts +++ b/types/auth0/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for auth0 2.4 // Project: https://github.com/auth0/node-auth0 -// Definitions by: Wilson Hobbs , Seth Westphal +// Definitions by: Wilson Hobbs , Seth Westphal , Amiram Korach // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped import * as Promise from 'bluebird'; From 163ae5a140eae83b28705339781f41b675d780eb Mon Sep 17 00:00:00 2001 From: amiram Date: Tue, 23 May 2017 10:47:44 +0300 Subject: [PATCH 0096/1105] auth0 fix getUser returns only a single user fix deleteUser returns void fix getUser and deleteUser mandatory params --- types/auth0/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/auth0/index.d.ts b/types/auth0/index.d.ts index c920f3709a..be4de08f1f 100644 --- a/types/auth0/index.d.ts +++ b/types/auth0/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for auth0 2.4 +// Type definitions for auth0 3.0 // Project: https://github.com/auth0/node-auth0 // Definitions by: Wilson Hobbs , Seth Westphal , Amiram Korach // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 673e4d70ec792560b1173cb7822dcef68b89049e Mon Sep 17 00:00:00 2001 From: Bernd Hacker Date: Tue, 23 May 2017 11:45:51 +0200 Subject: [PATCH 0097/1105] add type definitions for HERE data lens --- types/heredatalens/heredatalens-tests.ts | 136 ++++ types/heredatalens/index.d.ts | 939 +++++++++++++++++++++++ types/heredatalens/tsconfig.json | 22 + types/heredatalens/tslint.json | 3 + 4 files changed, 1100 insertions(+) create mode 100644 types/heredatalens/heredatalens-tests.ts create mode 100644 types/heredatalens/index.d.ts create mode 100644 types/heredatalens/tsconfig.json create mode 100644 types/heredatalens/tslint.json diff --git a/types/heredatalens/heredatalens-tests.ts b/types/heredatalens/heredatalens-tests.ts new file mode 100644 index 0000000000..51fa56b380 --- /dev/null +++ b/types/heredatalens/heredatalens-tests.ts @@ -0,0 +1,136 @@ +/** + * Typescript definition tests for heredatalens + * + * Note: These tests are intended to test the definitions only + * in the sense of typing and call signature consistency. They + * are not intended as functional tests. + */ + +import './index'; + + +let service: H.datalens.Service; +let serviceOptions: H.datalens.Service.Options = { + subDomain: 'sub', + version: 'version', + access_token: 'token', + refresh_token: 'token', + domainSharding: ['a', 'b'], + baseUrl: 'url' +}; + +let queryTileProviderTileParamNames: H.datalens.QueryTileProvider.TileParamNames = { + x: 'x', + y: 'y', + z: 'z' +}; + +let queryTileProviderOptions: H.datalens.QueryTileProvider.Options = { + queryId: 'id', + queryParams: 'params', + tileParamNames: queryTileProviderTileParamNames +}; + +let queryTileProvider = new H.datalens.QueryTileProvider(service, queryTileProviderOptions); +queryTileProvider.setQueryId('some id'); +queryTileProvider.setQueryParams('some params'); +queryTileProvider.setTileParamNames(queryTileProviderTileParamNames); + + +service = new H.datalens.Service(serviceOptions); +service.request('method', 'endpoint', 'params', 'body', function(result) {}, function(error) {}).then(data => {}); +service.fetchQueryData('id', 'params', function(result) {}, function(error) {}).then(data => {}); +service.fetchQueryStats('id', 'query', function(result) {}, function(error) {}).then(data => {}); +service.fetchLayer('name', 'params', function(result) {}, function(error) {}).then(data => {}); +service.fetchLayerTile('name', 1, 2, 3, 'params', function(result) {}, function(error) {}).then(data => {}); +service.setTokens('token', 'refresh_token'); +service.configure('app_id', 'app_code', true, true, new H.service.Url('scheme', 'host')); + + +let provider = new H.datalens.Provider({ columns: ['1', '2'], rows: [[], []]}); +provider.getData(); +provider.setData({ columns: ['3', '4'], rows: [[], []]}); + + +let queryProviderOptions: H.datalens.QueryProvider.Options = { + queryId: 'id', + queryParams: 'params' +}; +let queryProvider = new H.datalens.QueryProvider({ columns: ['1', '2'], rows: [[], []]}, queryProviderOptions); +queryProvider.setQueryId('id'); +queryProvider.setQueryParams('params'); +queryProvider.reload(); +queryProvider.getData(); +queryProvider.setData({ columns: ['3', '4'], rows: [[], []]}); + + +let rasterLayerOptions: H.datalens.RasterLayer.Options = { + dataToRows: (): H.datalens.RasterLayer.Row[] => { return []; }, + rowToTilePoint: (): H.datalens.RasterLayer.TilePoint => { return { x: 1, y: 2 }; }, + buffer: (): number => { return 1; }, + renderTile: () => {} +}; + +let rasterLayer = new H.datalens.RasterLayer(); +rasterLayer.redraw(); + + +let heatmapLayerOptions: H.datalens.HeatmapLayer.Options = { + dataToRows: (): H.datalens.HeatmapLayer.Row[] => { return []; }, + rowToTilePoint: (): H.datalens.HeatmapLayer.TilePoint => { return { x: 1, y: 2, value: 5, count: 5 }; }, + bandwidth: 5, + valueRange: (): number[] => { return []; }, + countRange: (): number[] => { return []; }, + colorScale: (): string => { return '2'; }, + alphaScale: (): number => { return 1; }, + aggregation: H.datalens.HeatmapLayer.Aggregation.SUM, + inputScale: H.datalens.HeatmapLayer.InputScale.LINEAR +}; + +let heatmapLayer = new H.datalens.HeatmapLayer(queryTileProvider, heatmapLayerOptions); +heatmapLayer.getOptionsPerZoom(5); +heatmapLayer.dispose(); +heatmapLayer.redraw(); + + +let objectLayerOptions: H.datalens.ObjectLayer.Options = { + dataToRows: (): H.datalens.ObjectLayer.Row[] => { return []; }, + rowToMapObject: (): H.map.Object => { return new H.map.Object() }, + rowToStyle: (): H.datalens.ObjectLayer.ObjectStyleOptions => { return { icon: new H.map.Icon('x'), style: {}, arrows: {}, zIndex: 1 }; }, + dataDomains: 2, + clustering: { rowToDataPoint: (): H.clustering.DataPoint => { return; }, options: (): H.clustering.Provider.ClusteringOptions => { return {}; } } +} + +let objectLayer = new H.datalens.ObjectLayer(provider, objectLayerOptions); +objectLayer.redraw(); +objectLayer.updateObjectStyle(new H.map.Object, { icon: new H.map.Icon('x'), style: {}, arrows: {}, zIndex: 1 }); + + +let rawDataProviderOptions: H.datalens.RawDataProvider.Options = { + dataUrl: 'url', + dataToFeatures: (): H.datalens.RawDataProvider.Feature[] => { return []; }, + featuresToRows: (): H.datalens.ObjectLayer.Row[] => { return []; } +}; + +let rawDataProvider = new H.datalens.RawDataProvider(rawDataProviderOptions); + + +let spatialTileProviderOptions: H.datalens.SpatialTileProvider.Options = { + layerName: 'name', + queryParams: 'params' +}; + +let spatialProvider: H.datalens.SpatialTileProvider = new H.datalens.SpatialTileProvider(service, spatialTileProviderOptions); + +let spatialLayerOptions: H.datalens.SpatialLayer.Options = { + dataToRows: (): H.datalens.SpatialLayer.Row[] => { return []; }, + rowToSpatialId: (): string => { return 'asd'; }, + featureToSpatialId: (): string => { return 'asd'; }, + rowToStyle: (): any => { return; }, + defaultStyle: (): any => { return; }, + transformFeature: 1 +}; + +let spatialLayer = new H.datalens.SpatialLayer(provider, spatialProvider, spatialLayerOptions); + + diff --git a/types/heredatalens/index.d.ts b/types/heredatalens/index.d.ts new file mode 100644 index 0000000000..9c7c5d910c --- /dev/null +++ b/types/heredatalens/index.d.ts @@ -0,0 +1,939 @@ +// Type definitions for HERE Data Lens API for JavaScript v2.3.0-31 +// Project: https://developer.here.com/ +// Definitions by: Bernd Hacker +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare namespace H { + /** + * Data Lens REST API connector for HERE Maps API + * Data Lens JavaScript API is a module for HERE Maps API. + * It connects Data Lens REST API and provides data-driven styling of data on a map. + */ + namespace datalens { + /** + * HERE Maps API and Data Lens JavaScript API can be used to visualize data from different network sources. + * For each network source type, a service class is required. The service also stores API connection credentials. + * The service instance must be configured with a H.service.Platform instance. + */ + class Service implements H.service.IConfigurable { + /** + * Constructor + * @param options {H.datalens.Service.Options=} - Overrides the configuration from the H.service.Platform instance + */ + constructor(options?: H.datalens.Service.Options); + + /** + * This method makes an HTTP request to the Data Lens REST API. + * It makes any CRUD request (GET, PUT, POST, DELETE). + * This method can be used when implementing a custom provider or implementing data management. + * Otherwise existing providers are used to get data from the Data Lens REST API. + * @param method {string} - Any HTTP method (GET, PUT, POST, etc.) + * @param endpoint {string} - The REST API endpoint + * @param params {any=} - URL parameters + * @param body {any=} - The payload of the request + * @param onResult {function(any)=} - Callback called on a successful request with response data + * @param onError {function(Error)=} - Callback called on an unsuccessful request with the Error object + * @returns {Promise} - Response Promise + */ + request(method: string, endpoint: string, params?: any, body?: any, onResult?: (result: any) => void, onError?: (error: any) => void): Promise; + + /** + * This method fetches query data for a given query ID. + * This method can be used when implementing a custom provider. + * Otherwise existing providers are used to get data from the Data Lens REST API. + * @param queryId {string} - The ID of the Data Lens REST API query + * @param params {any=} - Query dynamic parameters + * @param onResult {function(any)=} - Callback called on a successful request with response data + * @param onError {function(Error)=} - Callback called on an unsuccessful request with the Error object + * @returns {Promise} - Response Promise + */ + fetchQueryData(queryId: string, params?: any, onResult?: (result: any) => void, onError?: (error: any) => void): Promise; + + /** + * This method fetches statistical data for the Data Lens query (eg minimum and maximum values for the query metric). + * It can be used to define visualization boundaries, scales and legends. + * @param queryId {string} - The ID of the Data Lens REST API query + * @param statsQuery {any} - A JSON object which defines a statistics query for the Data Lens query + * @param onResult {function(any)=} - Callback called on a successful request with response data + * @param onError {function(Error)=} - Callback called on an unsuccessful request with the Error object + * @returns {Promise} - Response Promise + */ + fetchQueryStats(queryId: string, statsQuery: any, onResult?: (result: any) => void, onError?: (error: any) => void): Promise; + + /** + * This method fetches a layer of geometries (eg buildings or administrative boundaries). + * @param layerName {string} - The name of the layer + * @param params {any=} - URL parameters (eg bounding box) + * @param onResult {function(any)=} - Callback called on a successful request with response data + * @param onError {function(Error)=} - Callback called on an unsuccessful request with the Error object + * @returns {Promise} - Response Promise + */ + fetchLayer(layerName: string, params?: any, onResult?: (result: any) => void, onError?: (error: any) => void): Promise; + + /** + * This method fetches vector tile data from the layer. + * @param layerName {string} + * @param x {H.datalens.QueryTileProvider.X} - Tile columns + * @param y {H.datalens.QueryTileProvider.Y} - Tile row + * @param z {H.datalens.QueryTileProvider.Zoom} - zoom level + * @param params {any=} - URL parameters (eg bounding box) + * @param onResult {function(any)=} - Callback called on a successful request with response data + * @param onError {function(Error)=} - Callback called on an unsuccessful request with the Error object + * @returns {Promise} - Typed array with tile data + */ + fetchLayerTile(layerName: string, x: H.datalens.QueryTileProvider.X, y: H.datalens.QueryTileProvider.Y, z: H.datalens.QueryTileProvider.Zoom, + params?: any, onResult?: (result: any) => void, onError?: (error: any) => void): Promise; + + /** + * Sets the access and refresh tokens used to authenticate all requests against the Data Lens REST API. + * Use this method to implement custom authentication to the Data Lens REST API. + * @param accessToken {string} - The token used to authenticate all requests + * @param refreshToken {string} - The token used to fetch a new access token after the previous access token has expired. + * When refreshToken is provided, Service will automatically update the expired accessToken. + */ + setTokens(accessToken: string, refreshToken: string): void; + + /** + * This method implements H.service.IConfigurable interface. It is called by the H.service.Platform instance. + * @param appId {string} - The appId + * @param appCode {string} - The appCode + * @param useHTTPS {boolean} - A flag to use HTTPS or not + * @param useCIT {boolean} - A flag to use the staging server (CIT) or not + * @param baseUrl {H.service.Url=} - The base URL for all requests to the Data Lens REST API + * @returns {H.datalens.Service} + */ + configure(appId: string, appCode: string, useHTTPS: boolean, useCIT: boolean, baseUrl?: H.service.Url): H.datalens.Service; + } + + namespace Service { + /** + * Overrides the H.datalens.Service configuration + * Normally the H.datalens.Service instance is configured with the H.service.Platform instance. + * This configuration can be overridden by specifying these options. + * It can be useful when the Data Lens environment is different from the HERE Platform environment. + * @property subDomain {string=} - Subdomain of the Data Lens REST API URL + * @property version {string=} - Pathname prefix of the Data Lens REST API endpoints + * @property access_token {string=} - The token used to authenticate all requests + * @property refresh_token {string=} - The token used to fetch a new access token after the previous access token has expired. + * When refresh_token is provided, Service will automatically update the expired access_token. + * @property domainSharding {string[]=} - To increase the number of simultaneous requests to the Data Lens REST API, domain sharding is used. + * This option can be used when the Data Lens environment does not support domain sharding. + * @property baseUrl {string=} - Defines an alternative host for the Data Lens REST API URL + */ + interface Options { + subDomain?: string; + version?: string; + access_token?: string; + refresh_token?: string; + domainSharding?: string[]; + baseUrl?: string; + } + + /** + * The format of Data Lens query data. + * The Data Lens query data has a table-like structure with named columns and rows. + * @property columns {string[]} - Column names + * @property rows {Array} - Rows of data + */ + interface Data { + columns: string[]; + rows: [any[]]; // rows : { Array. } + } + } + + /** + * Providers define interfaces for layers to access data. + * The input data can be stored locally or loaded from the network. Data can be loaded by tiles or in one chunk. + * This provider allows you to supply data stored locally or fetched using external tools. + */ + class Provider extends H.map.provider.Provider { + /** + * Constructor + * @param data {H.datalens.Service.Data=} - JSON object + * @param options {H.map.provider.Provider.Options=} - Configures data accessibility parameters + */ + constructor(data?: H.datalens.Service.Data, options?: H.map.provider.Provider.Options); + + /** + * Updates the provider data. When data is updated, the update event is triggered so that the consuming layers are redrawn. + * @param data {H.datalens.Service.Data} - JSON object + */ + setData(data: H.datalens.Service.Data): void; + + /** + * Retrieves the provider data. + * @returns {H.datalens.Service.Data} - JSON object + */ + getData(): H.datalens.Service.Data; + } + + /** + * Defines the source of the data for layers from a Data Lens query. + * Providers define interfaces for layers to access data. The input data can be stored locally or loaded from the network. + * Data can be loaded by tiles or in one chunk. This provider loads query data with the Data Lens REST API. + * Note that this provider must be used only for non-tiled queries. + */ + class QueryProvider extends H.datalens.Provider { + /** + * Constructor + * @param service {H.datalens.Service} - Data Lens REST API service + * @param options {H.datalens.QueryProvider.Options=} - Configures source query and data accessibility parameters + */ + constructor(data: H.datalens.Service.Data, options?: H.map.provider.Provider.Options); + + /** + * Updates the query ID to be used in the next call of the Data Lens REST API. + * Note that new data will be fetched only after the reload method is called. + * @param queryId {string} + */ + setQueryId(queryId: string): void; + + /** + * Updates the query's dynamic parameters to be used in the next call of the Data Lens REST API. + * Note that new data will be fetched only after the reload method is called. + * This method is normally used when updating your visualization. + * @param queryParams {any|null} - Query dynamic parameters + */ + setQueryParams(queryParams: any|null): void; + + /** + * Fetches new data from the Data Lens REST API. + * When data is fetched, the update event is triggered so that the consuming layers are redrawn. + */ + reload(): void; + + /** + * Updates the provider data. + * When data is updated, the update event is triggered so that the consuming layers are redrawn. + * @param data {H.datalens.Service.Data} - JSON object + */ + setData(data: H.datalens.Service.Data): void; + + /** + * Retrieves the provider data. + * @returns {H.datalens.Service.Data} - JSON object + */ + getData(): H.datalens.Service.Data; + } + + namespace QueryProvider { + /** + * Configures source query and data accessibility parameters for H.datalens.QueryProvider + * Specifies the query credentials and dynamic parameters required for fetching query data with the Data Lens REST API. Other options from H.datalens.Provider.Options are available. + * @property queryId {string} - The ID of the Data Lens REST API query + * @property queryParams {any=} - The query's dynamic parameters. The dynamic parameters can be used to filter data provided by the query. + */ + interface Options { + queryId: string; + queryParams?: any; + } + } + + /** + * Providers define interfaces for layers to access data. + * The input data can be stored locally or loaded from the network. Data can be loaded by tiles or in one chunk. + * This provider loads tiled query data with the Data Lens REST API. Tiled queries are used to load data only for the current viewport. + * This optimizes memory and network usage and enables progressive rendering. + */ + class QueryTileProvider extends H.map.provider.RemoteTileProvider { + /** + * Constructor + * @param service {H.datalens.Service} - Data Lens REST API service + * @param options {H.datalens.QueryTileProvider.Options} - Configures source query and data accessibility parameters + */ + constructor(service: H.datalens.Service, options: H.datalens.QueryTileProvider.Options); + + /** + * Updates the query ID to be used in the next call of the Data Lens REST API. + * Note that new data will be fetched only after the reload method is called. + * @param queryId {string} + */ + setQueryId(queryId: string): void; + + /** + * Updates the query's dynamic parameters to be used in the next call of the Data Lens REST API. + * Note that new data will be fetched only after the reload method is called. This method is normally used when updating your visualization. + * @param queryParams {any|null} + */ + setQueryParams(queryParams: any|null): void; + + /** + * Updates the names of the dynamic parameters that defines tiles. This method is only needed when the query ID is updated. + * Note that new data will be fetched only after the reload method is called. + * @param tileParamNames {H.datalens.QueryTileProvider.TileParamNames} - Names of the URI parameters that control the x/y/z of a tiled query + */ + setTileParamNames(tileParamNames: H.datalens.QueryTileProvider.TileParamNames): void; + } + + namespace QueryTileProvider { + /** + * Represents the names of the URI parameters that control the x/y/z of tiled query. + * When defining the Data Lens query, dynamic parameters that control tiling can be arbitrarily named. + * Names of these parameters must be specified to fetch tiles. + * @property x {string} - Name of the dynamic parameter that defines tile column + * @property y {string} - Name of the dynamic parameter that defines tile row + * @property z {string} - Name of the dynamic parameter that defines zoom level + */ + interface TileParamNames { + x: string; + y: string; + z: string; + } + + /** + * Configures source query and data accessibility parameters for H.datalens.QueryTileProvider + * Specifies the query credentials and dynamic parameters required for fetching tiled query data with the Data Lens REST API. + * Other options from H.datalens.Provider.Options are available. + * @property tileParamNames {H.datalens.QueryTileProvider.TileParamNames=} - Names of the URI parameters that control the x/y/z of a tiled query + * @property queryId {string} - The ID for the Data Lens REST API query + * @property queryParams {any=} - The query's dynamic parameters. The dynamic parameters can be used to filter data provided by the query. + */ + interface Options { + tileParamNames: H.datalens.QueryTileProvider.TileParamNames; + queryId: string; + queryParams?: string; + } + + /** + * Tile X coordinate (column) + * Coordinate in XYZ tile numbering scheme. + */ + type X = number; + + /** + * Tile Y coordinate (row) + * Coordinate in XYZ tile numbering scheme. + */ + type Y = number; + + /** + * Zoom level + * Coordinate in XYZ tile numbering scheme. May vary within range 1 to 20. + */ + type Zoom = number; + } + + /** + * Provides pixel-wise rendering of data. + * Layer used when you need to visualize more than 10k points. The layer requires source data to be located in pixel coordinates. + * The rendering is implemented by drawing directly on a canvas. The layer is often used together with a Data Lens query which groups rows by pixels. + * This reduces the amount of data delivered to the client. + */ + class RasterLayer extends H.map.layer.TileLayer { + /** + * Constructor + */ + constructor(); + + /** + * Default value for dataToRows callback option. + * It represents each row as an object where property names correspond to data column names. + */ + static defaultDataToRows: any; + + /** + * Force re-rendering of the layer. + * In the case where the callbacks passed to the layer options are not pure functions, you can call this method to force re-rendering. + */ + redraw(): void; + + /** + * This is a default implementation of renderTile callback. This method represents each point as a black 1x1 pixel square. + * @param points {Array} - Input data points within a tile + * @param canvas {HTMLCanvasElement} - The target canvas + */ + static defaultRenderTile(points: H.datalens.RasterLayer.TilePoint[], canvas: HTMLCanvasElement): void; + } + + namespace RasterLayer { + /** + * Defines data processing and rendering options for RasterLayer. + * The initial step of rendering is to split the tile data by rows, where each row represents a bucket. + * By default this step is processed with H.datalens.RasterLayer.defaultDataToRows. + * This behavior can be changed by defining the dataToRows callback. + * To collect the rows for a tile including buffer, the rows must be translated to H.datalens.RasterLayer.TilePoint. + * This translation must be specified with the rowToTilePoint callback. The final rendering on the tile canvas must be defined in renderTile. + * @property dataToRows {function(H.datalens.Service.Data, H.datalens.QueryTileProvider.X, H.datalens.QueryTileProvider.Y, H.datalens.QueryTileProvider.Zoom)=} - + * Defines how the input tile data is split by rows. You can specify this callback to define client-side aggregation and filtering. This callback is called for each tile. + * @property rowToTilePoint {function(H.datalens.RasterLayer.Row, H.datalens.RasterLayer.X, H.datalens.RasterLayer.Y)=} - + * Defines how the row is translated to the H.datalens.RasterLayer.TilePoint. This callback is called for each row that is returned from dataToRows. + * @property buffer {function(H.datalens.QueryTileProvider.Zoom)=} - Defines the buffer as a function of the zoom level. + * The buffer is a value (in pixels) that defines an extra area around each tile to capture data points from. + * This is done to avoid drawing edges between tiles. For example, if data points represented with circles with a maximum radius of 10 pixels, then the buffer must be 10 pixels. + * @property renderTile {function(Array, HTMLCanvasElement, H.datalens.QueryTileProvider.Zoom)=} - + * Defines how tile data is represented on a canvas. Input points for each tile are collected with respect to the buffer. + * For progressive rendering this callback may be called more than once for the tile. + */ + interface Options { + dataToRows?(data: H.datalens.Service.Data, x: H.datalens.QueryTileProvider.X, y: H.datalens.QueryTileProvider.Y, zoom: H.datalens.QueryTileProvider.Zoom): + H.datalens.RasterLayer.Row[]; + rowToTilePoint?(row: H.datalens.RasterLayer.Row, x: H.datalens.RasterLayer.X, y: H.datalens.RasterLayer.Y): H.datalens.RasterLayer.TilePoint; + buffer?(zoom: H.datalens.QueryTileProvider.Zoom): number; + renderTile?(points: H.datalens.RasterLayer.TilePoint[], canvas: HTMLCanvasElement, zoom: H.datalens.QueryTileProvider.Zoom): void; + } + + /** + * Defines the input data format for heat map rendering. + * To collect data rows for each tile with respect to the buffer, each row must be represented as a point within the map tile. + * @property x {number} - Row relative to tile + * @property y {number} - Column relative to tile + * @property data {H.datalens.RasterLayer.Row=} - Reference to source data row + */ + interface TilePoint { + x: number; + y: number; + data?: H.datalens.RasterLayer.Row; + } + + /** + * Tile X coordinate (column) + * Coordinate in XYZ tile numbering scheme. + */ + type X = number; + + /** + * Tile Y coordinate (row) + * Coordinate in XYZ tile numbering scheme. + */ + type Y = number; + + /** + * Slice of data (eg Data Lens query data row) that represents a data point. + * Each row is transformed into TilePoint and passed to renderTile callback. By default each row is an Object where property names correspond to data column names. + * This representation can be changed with the dataToRows callback. + */ + type Row = number; + } + + /** + * Provides functionality of value-based heat map with density alpha mask. + * Layer support different types of blending, including weighted average. Also it allows to apply alpha mask calculated by density. + * In most cases, the layer consumes data grouped by 1x1 pixels buckets. For proper averaging it requires aggregated value and count (number of rows in bucket) for each bucket. + * Blending of buckets is implemented via kernel density estimation (KDE) with a Gaussian kernel. + */ + class HeatmapLayer extends H.datalens.RasterLayer { + /** + * Constructor + * @param provider {H.datalens.QueryTileProvider} - Source of tiled data + * @param options {H.datalens.HeatmapLayer.Options} - Configuration for data processing and rendering + */ + constructor(provider: H.datalens.QueryTileProvider, options: H.datalens.HeatmapLayer.Options); + + /** + * Default value for dataToRows callback option. It represents each row as an object where property names correspond to data column names. + * @param data {H.datalens.Service.Data} + * @param x {H.datalens.QueryTileProvider.X} + * @param y {H.datalens.QueryTileProvider.Y} + * @param zoom {H.datalens.QueryTileProvider.Zoom} + * @returns {Array} + */ + static defaultDataToRows: (data: H.datalens.Service.Data, x: H.datalens.QueryTileProvider.X, y: H.datalens.QueryTileProvider.Y, zoom: H.datalens.QueryTileProvider.Zoom) => + H.datalens.HeatmapLayer.Row[]; + + /** + * Set of possible values for the inputScale option + * @type {H.datalens.HeatmapLayer.InputScale} + */ + static inputScale: H.datalens.HeatmapLayer.InputScale; + + /** + * Set of possible values for the aggregation option + * @type {H.datalens.HeatmapLayer.Aggregation} + */ + static aggregation: H.datalens.HeatmapLayer.Aggregation; + + /** + * @param zoom {number} - zoom level + * @return {H.datalens.HeatmapLayer.Options} + */ + getOptionsPerZoom(zoom: number): H.datalens.HeatmapLayer.Options; + + /** + * Removes listeners, and references to memory consuming objects, from this layer. Call this method when you no longer need the layer. + */ + dispose(): void; + + /** + * Force re-rendering of the layer. In the case where the callbacks passed to the layer options are not pure functions, you can call this method to force re-rendering. + */ + redraw(): void; + } + + namespace HeatmapLayer { + /** + * Defines data processing and rendering options for HeatmapLayer. + * The data processing flow of HeatmapLayer is similar to RasterLayer. The initial step of rendering is to split the tile data by rows, where each row represents a bucket. + * By default this step is processed with H.datalens.HeatmapLayer.defaultDataToRows. This behavior can be changed by defining the dataToRows callback. + * To collect the rows for a tile including buffer, the rows must be translated to H.datalens.HeatmapLayer.TilePoint. This translation must be specified with the rowToTilePoint callback. + * Other options define the blending options for the heat map. + * @property dataToRows {function(H.datalens.Service.Data, H.datalens.QueryTileProvider.X, H.datalens.QueryTileProvider.Y, H.datalens.QueryTileProvider.Zoom)=} - + * Defines how the input tile data is split by rows. You can specify this callback to define client-side aggregation and filtering. This callback is called for each tile. + * @property rowToTilePoint {function(H.datalens.HeatmapLayer.Row, H.datalens.HeatmapLayer.X, H.datalens.HeatmapLayer.Y)=} - + * Defines how the row is translated to the H.datalens.HeatmapLayer.TilePoint. This callback is called for each row that is returned from dataToRows. + * @property bandwidth {H.datalens.HeatmapLayer~Bandwidth | H.datalens.HeatmapLayer~BandwidthStop | Array. | + * H.datalens.HeatmapLayer~BandwidthCallback=} - Describes the bandwidth behavior in relation to current zoom level A numeric value sets it static across all levels + * An Object with zoom, value and optional zoomIncrementFactor (1 equals doubling on every zoom increment) defines a behavior across all zoom levels + * An Array of one or more zoom, value objects describes the behavior between the two defined levels and extrapolates the implied change outside of the defined range + * Alternatively defines the level of smoothing as a function of the zoom level. The callback must return a value in pixels. + * The cut-off of the Gaussian kernel is defined as 3 * bandwidth , a multiple (default 3) of bandwidth. + * @property valueRange {function(H.datalens.QueryTileProvider.Zoom)} - Defines the range for the color scale as a function of the zoom level. + * The returned value must be an array of 2 numbers. + * @property countRange {function(H.datalens.QueryTileProvider.Zoom)} - Defines the range for the density alpha mask as a function of the zoom level. + * When defined, the density alpha mask is applied. The returned value must be an array of 2 numbers. + * @property colorScale {function(number)} - Defines a color palette as a function of the normalized value. You can use D3.js library scale functions with the domain [0, 1]. + * @property alphaScale {function(number)} - Defines the alpha mask value as a function of the normalized count. + * You can use D3.js library scale functions with the domain [0, 1] and the range [0, 1]. + * @property aggregation {H.datalens.HeatmapLayer.Aggregation} - Specifies which type of aggregation was applied (eg. type of aggregation function for bucket in the Data Lens query). + * Possible values are SUM or AVERAGE. If the aggregation type is AVERAGE , then an averaged heat map is rendered. + * @property inputScale {H.datalens.HeatmapLayer.InputScale} - Defines the scale (eg logarithmic scale) of the TilePoint value. + * Note: if the value is not in a linear scale, then the aggregation in the source query must be defined with respect to the scale type. + * For example, before applying the average aggregation function in a query, the value must be transformed to the linear scale. This guarantees correct linear averaging of values. + */ + interface Options { + dataToRows?(data: H.datalens.Service.Data, x: H.datalens.QueryTileProvider.X, y: H.datalens.QueryTileProvider.Y, zoom: H.datalens.QueryTileProvider.Zoom): + H.datalens.HeatmapLayer.Row[]; + rowToTilePoint(row: H.datalens.HeatmapLayer.Row, x: H.datalens.HeatmapLayer.X, y: H.datalens.HeatmapLayer.Y): H.datalens.HeatmapLayer.TilePoint; + bandwidth?: H.datalens.HeatmapLayer.Bandwidth | H.datalens.HeatmapLayer.BandwidthStop | H.datalens.HeatmapLayer.BandwidthStop[] | H.datalens.HeatmapLayer.BandwidthCallback; + valueRange?(zoom: H.datalens.QueryTileProvider.Zoom): number[]; + countRange?(zoom: H.datalens.QueryTileProvider.Zoom): number[]; + colorScale?(scale: number): string; + alphaScale?(scale: number): number; + aggregation?: H.datalens.HeatmapLayer.Aggregation; + inputScale?: H.datalens.HeatmapLayer.InputScale; + } + + /** + * Tile X coordinate (column) + * Coordinate in XYZ tile numbering scheme. + */ + type X = number; + + /** + * Tile Y coordinate (row) + * Coordinate in XYZ tile numbering scheme. + */ + type Y = number; + + /** + * Slice of data (eg Data Lens query data row) that represents a data point. + * Each row is transformed into TilePoint and then rendered on a heat map. By default each row is an Object where property names correspond to data column names. + * This representation can be changed with the dataToRows callback. + */ + type Row = number; + + /** + * Defines a constant for the bandwidth + * A number that sets a constant for the bandwidth across all zoom levels. + */ + type Bandwidth = number; + + /** + * Sets the bandwidth for a given zoom level and uses this to calculate the increment or decrement of the bandwidth at other zoom levels + * This object defines the behavior of the bandwidth value across all zoom levels, initialized by a reference zoom level and its value at that level. + * The default behavior with zoomIncrementFactor = 1 doubles the bandwidth with every increasing zoom level and halves it on every decrease in zoom level. + * For example, a bandwidth of 10@zoom1 turns to 20@zoom2 and 5@zoom0. A zoomIncrementFactor of 0 effectively equals the bandwidth number, ignoring the provided zoom level. + * A zoomIncrementFactor of 0.5 mean a bandwidth increase of 50% compared to a factor of 1. So a bandwidth of 10@zoom1 computes to 15@zoom2. + */ + interface BandwidthStop { + zoom: number; + value: number; + zoomIncrementFactor?: number; + } + + /** + * TODO: this is missing in the documentation: https://developer.here.com/visualization/documentation/datalens/h-datalens-heatmaplayer-options.html + */ + type BandwidthCallback = () => void; + + /** + * Defines the input data format for heat map rendering. + * For heat map rendering, each row of data must be represented as a point within the map tile. + * @property x {number} - Row relative to tile + * @property y {number} - Column relative to tile + * @property value {number} - Value at the point (eg aggregated bucket value) + * @property count {number} - Number of contributors to the value at the point (eg number of rows in a bucket) + * @property data {H.datalens.HeatmapLayer.Row} - Reference to source data row + */ + interface TilePoint { + x: number; + y: number; + value: number; + count: number; + data?: H.datalens.HeatmapLayer.Row; + } + + /** + * Set of possible values for the aggregation option. + * If the heat map input data is buckets, then different types of aggregation can be applied to the rows in a bucket. + * The aggregation type is required for proper blending mode of the heat map. For the AVERAGE aggregation type, an averaged heat map is rendered. + * @property SUM {string} - Specifies that the sum aggregation was applied to the bucket value + * @property AVERAGE {string} - Specifies that the average aggregation was applied to the bucket value + */ + enum Aggregation { + SUM, + AVERAGE + } + + /** + * Set of possible values for the inputScale option. + * The input scale is required for proper heat map blending. If the input scale is not linear, then the TilePoint.value is converted to linear scale before calculating the sum or average. + * @property DB {string} - Decibel (dB) scale + * @property LINEAR {string} - Linear scale + * @property LOG {string} - Logarithmic scale + */ + enum InputScale { + DB, + LINEAR, + LOG + } + } + + /** + * Presents data as points or spatial map objects with data-driven styles and client-side clustering. + * Applicable for drawing interactive map objects like markers, polygons, circles and other instances of H.map.Object. Source of data can be either tiled or not tiled. + * Styles for objects can be parametrized with data rows and zoom level. Allows to create data-driven icons for markers like donuts or bars. + * Also enables clustering and data domains for visualizing up to 100k points or more. + */ + class ObjectLayer extends H.map.layer.ObjectLayer { + /** + * Constructor + * @param provider {H.map.provider.RemoteTileProvider | H.datalens.Provider | H.datalens.QueryProvider | H.datalens.QueryTileProvider} - Data source (tiled or not) + * @param options {H.datalens.ObjectLayer.Options} - Defines data processing, clustering and data-driven styling + */ + constructor(provider: H.map.provider.RemoteTileProvider | H.datalens.Provider | H.datalens.QueryProvider | H.datalens.QueryTileProvider, options: H.datalens.ObjectLayer.Options); + + /** + * Default value for dataToRows callback option. It represents each row as an object where property names correspond to data column names. + * @property data {H.datalens.Service.Data} + * @returns {Array} + */ + static defaultDataToRows(data: H.datalens.Service.Data): H.datalens.ObjectLayer.Row[]; + + /** + * A factory method for data-driven icons. The method allows you to build an icon from SVG markup or JsonML object. Provides caching of icons with the same markup. + * @param svg {string | Array} - SVG presented as markup or JsonML Array + * @param options {H.map.Icon.Options} - Icon options (eg size and anchor). Note that the default anchor is in the middle. + * @param options.size {H.math.ISize | number} - When the icon is a square, you can define the size as a number in pixels + * @returns {H.map.Icon} - Icon which can be used for marker or cluster + */ + static createIcon(svg: string | any[], options?: H.map.Icon.Options): H.map.Icon; + + /** + * Returns cache of icons created with the createIcon method. Can be used to clean the icon cache. + * @return {H.util.Cache} - Icon cache + */ + static getIconCache(): H.util.Cache; + + /** + * Force re-rendering of the layer. In the case where the callbacks passed to the layer options are not pure functions, you can call this method to force re-rendering. + */ + redraw(): void; + + /** + * Recalculates the style and applies it to the map object based on the new StyleState + * @param object {H.map.Object} - Map object + * @param state {H.datalens.ObjectLayer.StyleState} - New state + */ + updateObjectStyle(any: H.map.Object, state: H.datalens.ObjectLayer.StyleState): void; + } + + namespace ObjectLayer { + /** + * Defines data processing and data-driven styling for ObjectLayer + * The initial step of rendering is to split the tile data by rows, where each row represents a bucket. + * By default this step is processed with H.datalens.ObjectLayer.defaultDataToRows. This behavior can be changed by defining the dataToRows callback. + * In the next step each row must be presented as a map object with the rowToMapObject callback. Data-driven styling can be provided with the rowToStyle callback. + * @property dataToRows {function(H.datalens.Service.Data)=} - Defines how the input data is split by rows. You can specify this callback to define client-side aggregation and filtering. + * @property rowToMapObject {function(H.datalens.ObjectLayer.Row, H.datalens.QueryTileProvider.Zoom)} - Defines how each row is presented on the map (eg marker, polygon) + * @property rowToStyle {function(H.datalens.ObjectLayer.Row, H.datalens.QueryTileProvider.Zoom, H.datalens.ObjectLayer.StyleState)=} - + * Defines map object style and icon according to data row and zoom level. Also it can define different styles depending on the StyleState (eg hovered, selected). + * @property dataDomains {H.datalens.ObjectLayer.DataDomains=} - Defines quantization of data for improving data-driven styling performance + * @property clustering {H.datalens.ObjectLayer.Clustering=} - When present, client-side clustering is applied + */ + interface Options { + dataToRows?(data: H.datalens.Service.Data): H.datalens.ObjectLayer.Row[]; + rowToMapObject(row: H.datalens.ObjectLayer.Row, z: H.datalens.QueryTileProvider.Zoom): H.map.Object; + rowToStyle?(row: H.datalens.ObjectLayer.Row, z: H.datalens.QueryTileProvider.Zoom, styleState: H.datalens.ObjectLayer.StyleState): H.datalens.ObjectLayer.ObjectStyleOptions; + dataDomains?: H.datalens.ObjectLayer.DataDomains; + clustering?: H.datalens.ObjectLayer.Clustering; + } + + /** + * Defines client-side clustering in the ObjectLayer. + * When the clustering option is provided, rows returned from dataToRows go to the clustering.rowToDataPoint callback to be transformed to data points. + * Then, the data points are clustered according to clustering.options. Clustering produces clusters and noise points (data points that are not clustered). + * Clusters and noise points must be presented as map objects with the rowToMapObject callback and can be styled with the rowToStyle callback. + * @property rowToDataPoint {H.datalens.ObjectLayer.Row} - Defines data points from rows + * @property options {function(H.datalens.QueryTileProvider.Zoom)} - Defines clustering options as a function of the zoom level + */ + interface Clustering { + rowToDataPoint(row: H.datalens.ObjectLayer.Row): H.clustering.DataPoint; + options(zoom: H.datalens.QueryTileProvider.Zoom): H.clustering.Provider.ClusteringOptions; + } + + /** + * Slice of data (eg Data Lens query data row) that represents a data point. + * Each row is translated to map objects with the rowToMapObject callback. By default each row is an Object where property names correspond to data column names. + * This representation can be changed with the dataToRows callback. + */ + type Row = number; + + /** + * User defined modification of a data-driven style + * StyleState appears as a parameter in the rowToStyle callback. By default it is 'DEFAULT_STATE'. To change StyleState, use the ObjectLayer.updateObjectStyle method. + */ + type StyleState = any; + + /** + * Output from the rowToStyle callback. + * Defines the styles or the icon that is applied to the map object. + * @property icon {H.map.Icon} - Marker icon + * @property style {H.map.SpatialStyle.Options} - Spatial style + * @property arrows {H.map.ArrowStyle.Options} - Style of arrows to render along a polyline + * @property zIndex {number} - The z-index value of the map object, default is 0 + */ + interface ObjectStyleOptions { + icon: H.map.Icon; + style: H.map.SpatialStyle.Options; + arrows: H.map.ArrowStyle.Options; + zIndex: number; + } + + /** + * Input data quantization domain, used to optimize styling performance. + * The option must have properties corresponding to the properties of H.datalens.ObjectLayer.Row. Values must be represented as an Array of Numbers that defines the quantization domain. + * When provided, the input data will be quantized, and rowToStyle will be called only for quantized values. + */ + type DataDomains = any; + } + + /** + * Defines how to load data from a raw data file + * This provider defines the interface for loading data, such as geometries or coordinates, from a local or remote data file in GeoJSON or CSV format + */ + class RawDataProvider extends H.map.provider.RemoteTileProvider { + /** + * Constructor + * @param options {H.datalens.RawDataProvider.Options} - Configures options + */ + constructor(options: H.datalens.RawDataProvider.Options); + + /** + * Updates the data url. Note that new data will be fetched only after the reload method is called. + * @param dataUrl {string} + */ + setDataUrl(dataUrl: string): void; + } + + namespace RawDataProvider { + /** + * Defines options for RawDataProvider + * Options for RawDataProvider + * @property dataUrl - The data url to fetch + * @property dataToFeatures {function(any)=} - Defines how the input data is mapped to an array of GeoJSON features + * @property featuresToRows {function(Array, H.datalens.QueryTileProvider.X, H.datalens.QueryTileProvider.Y, H.datalens.QueryTileProvider.Zoom, + * H.datalens.RawDataProvider.TileSize, H.datalens.RawDataProvider.Helpers)=} - + * Defines how GeoJSON features on a tile should be mapped to data rows, which are inputs to layers such as ObjectLayer and HeatmapLayer + */ + interface Options { + dataUrl?: string; + dataToFeatures?(obj: any): H.datalens.RawDataProvider.Feature[]; + featuresToRows?(features: H.datalens.RawDataProvider.Feature[], x: H.datalens.QueryTileProvider.X, y: H.datalens.QueryTileProvider.Y, z: H.datalens.QueryTileProvider.Zoom, + tileSize: H.datalens.RawDataProvider.TileSize, helpers: H.datalens.RawDataProvider.Helpers): H.datalens.ObjectLayer.Row[]; + } + + /** + * A GeoJSON feature + * A GeoJSON feature object which conforms to the standard GeoJSON spec + */ + type Feature = any; + + /** + * Tile size + * The tile size in pixels. + */ + type TileSize = any; + + /** + * A helper class used in the worker thread + * This helper class provides convenience functions you can use in the worker thread + * @property latLngToPixel {function(H.datalens.RawDataProvider.Latitude, H.datalens.RawDataProvider.Longitude, H.datalens.QueryTileProvider.Zoom, H.datalens.RawDataProvider.TileSize)=} - + * Translates geographical coordinates (latitude, longitude) to world pixel coordinates. + * @property pixelToLatLng {function(H.datalens.RawDataProvider.PX, H.datalens.RawDataProvider.PY, H.datalens.QueryTileProvider.Zoom, H.datalens.RawDataProvider.TileSize)=} - + * Translates world pixel coordinates to geographical coordinates (latitude, longitude). + * @property parseCSV {function(any)=} - Takes CSV data as input, parses it, and return the parsed result. + */ + interface Helpers { + latLngToPixel?(latitude: H.datalens.RawDataProvider.Latitude, longitude: H.datalens.RawDataProvider.Longitude, z: H.datalens.QueryTileProvider.Zoom, + tileSize: H.datalens.RawDataProvider.TileSize): H.datalens.RawDataProvider.PixelCoordinates; + pixelToLatLng?(x: H.datalens.RawDataProvider.PX, y: H.datalens.RawDataProvider.PY, z: H.datalens.QueryTileProvider.Zoom, tileSize: H.datalens.RawDataProvider.TileSize): + H.datalens.RawDataProvider.GeoCoordinates; + parseCSV?(obj: any): any[]; + } + + /** + * Geographic coordinates + * A geographic coordinates pair [lat, lng] + */ + type GeoCoordinates = [number, number]; + + /** + * Latitude coordinate + * The latitude in the geographic coordinates pair + */ + type Latitude = number; + + /** + * Longitude coordinate + * The longitude in the geographic coordinates pair + */ + type Longitude = number; + + /** + * Pixel coordinates + * Pixel coordinates [px, py] pair + */ + type PixelCoordinates = [number, number]; + + /** + * Pixel coordinate in the x direction + * The x coordinate of the pixel coordinates pair [px, py] + */ + type PX = number; + + /** + * Pixel coordinate in the y direction + * The y coordinate of the pixel coordinates pair [px, py] + */ + type PY = number; + } + + /** + * Renders vector tiles using data-driven styles + * This layer binds the spatial data and user data, all provided by the Data Lens REST API. The layer renders geometry features using data-driven styles. + */ + class SpatialLayer extends H.map.layer.TileLayer { + /** + * Constructor + * @param dataProvider {H.datalens.Provider} - Source of tiled data (pass in null if data come from feature properties) + * @param spatialProvider {H.datalens.SpatialTileProvider} - Source of geometry data + * @param options {H.datalens.SpatialLayer.Options} - Configuration for data processing and rendering + */ + constructor(dataProvider: H.datalens.Provider, spatialProvider: H.datalens.SpatialTileProvider, options: H.datalens.SpatialLayer.Options); + + static DEFAULT_STATE: any; + static Spatial: any; + + /** + * Default value for dataToRows callback option. It represents each row as an object where property names correspond to data column names. + */ + static defaultDataToRows: any; + + /** + * Forces re-rendering of the layer. When the callbacks passed to the layer options are not pure functions, you can call this method to force re-rendering. + */ + redraw(): void; + + /** + * This method changes the state of a map object; for example, style on mouse event. + * @param {H.map.Object} spatial + * @param {H.datalens.SpatialLayer.StyleState} state + */ + updateSpatialStyle(spatial: H.map.Object, state: H.datalens.SpatialLayer.StyleState): void; + } + + namespace SpatialLayer { + /** + * Defines data processing and rendering options for SpatialLayer + * The initial step of rendering is to split the tile data by rows, where each row represents a bucket. + * By default this step is processed with H.datalens.SpatialLayer.defaultDataToRows. This behavior can be changed by defining the dataToRows callback. + * @property dataToRows {function(H.datalens.Service.Data, H.datalens.QueryTileProvider.X, H.datalens.QueryTileProvider.Y, H.datalens.QueryTileProvider.Zoom)=} - + * Defines how the input tile data is split by rows. You can specify this callback to define client-side aggregation and filtering. This callback is called for each tile. + * @property rowToSpatialId {function(H.datalens.SpatialLayer.Row)} - + * Defines how to get the spatial ID from a data row. This callback is called for each row that is returned from dataToRows. + * @property featureToSpatialId {function(H.datalens.SpatialLayer.Feature)} - + * Defines how to get the spatial ID from a geometry feature. This callback is called for each geometry feature in the vector tile. + * @property rowToStyle {function(H.datalens.SpatialLayer.Row, H.datalens.QueryTileProvider.Zoom, H.datalens.SpatialLayer.StyleState)} - + * Defines how the row is translated to map object style. This callback is called for each row that is returned from dataToRows. + * @property defaultStyle {function(H.datalens.QueryTileProvider.Zoom, H.datalens.SpatialLayer.StyleState)} - Defines the default map object style. + * @property transformFeature {H.datalens.SpatialLayer.transformFeature} - Defines how to transform the features. + */ + interface Options { + dataToRows?(data: H.datalens.Service.Data, x: H.datalens.QueryTileProvider.X, y: H.datalens.QueryTileProvider.Y, z: H.datalens.QueryTileProvider.Zoom): + H.datalens.SpatialLayer.Row[]; + rowToSpatialId(row: H.datalens.SpatialLayer.Row): string; + featureToSpatialId(feature: H.datalens.SpatialLayer.Feature): string; + rowToStyle(row: H.datalens.SpatialLayer.Row, z: H.datalens.QueryTileProvider.Zoom, styleState: H.datalens.SpatialLayer.StyleState): any; + defaultStyle(z: H.datalens.QueryTileProvider.Zoom, styleState: H.datalens.SpatialLayer.StyleState): any; + transformFeature: H.datalens.SpatialLayer.transformFeature; + } + + /** + * Defines modification of a data-driven style + * StyleState appears as a parameter in the rowToStyle callback. By default it is 'DEFAULT_STATE'. To change StyleState, use the SpatialLayer.updateSpatialStyle method. + */ + type StyleState = any; + + /** + * Defines a slice of data (eg Data Lens query data row) that represents a data point + * By default each row is an object where property names correspond to data column names. This representation can be changed with the dataToRows callback. + */ + type Row = any; + + /** + * Defines a geometry in the vector tile + * Each geometry is described by various properties, including a unique identifier which must be used to map the geometry to user data. + */ + type Feature = any; + + /** + * TODO: missing in documentation: https://developer.here.com/visualization/documentation/datalens/h-datalens-spatiallayer-options.html + */ + type transformFeature = any; + } + + /** + * Specifies how to access layer data (shapes, geometries) using the Data Lens REST API. + * This provider defines the interface for accessing shape layers via the Data Lens REST API. The input data is provided as vector tiles in the MapBox format (Protobuf). + * Data is loaded by tiles. + */ + class SpatialTileProvider extends H.map.provider.RemoteTileProvider { + /** + * Constructor + * @param service {H.datalens.Service} - Data Lens REST API service + * @param options {H.datalens.SpatialTileProvider.Options} - Configures layer name + */ + constructor(service: H.datalens.Service, options: H.datalens.SpatialTileProvider.Options); + + static VectorTile: any; + + /** + * Updates the layer name to be used in the next call of the Data Lens REST API. Note that new data will be fetched only after the reload method is called. + * @param {string} layerName + */ + setLayerName(layerName: string): void; + + /** + * Updates the query's dynamic parameters to be used in the next call of the Data Lens REST API. Note that new data will be fetched only after the reload method is called. + * This method is normally used when updating your visualization. + * @param {any|null} queryParams + */ + setQueryParams(queryParams: any | null): void; + } + + namespace SpatialTileProvider { + /** + * Defines layer name and data accessibility parameters for H.datalens.SpatialTileProvider + * This defines the layer name and dynamic parameters required for fetching tiled geometry data with the Data Lens REST API. Other options from H.datalens.Provider.Options are available. + * @property layerName {string} - The name of the layer to fetch with the Data Lens REST API query + * @property queryParams {any} - The query's dynamic parameters. The dynamic parameters can be used to filter data provided by the query. + */ + interface Options { + layerName: string; + queryParams?: any; + } + } + } +} diff --git a/types/heredatalens/tsconfig.json b/types/heredatalens/tsconfig.json new file mode 100644 index 0000000000..d687f69017 --- /dev/null +++ b/types/heredatalens/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts" + ] +} \ No newline at end of file diff --git a/types/heredatalens/tslint.json b/types/heredatalens/tslint.json new file mode 100644 index 0000000000..e60c15844f --- /dev/null +++ b/types/heredatalens/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file From 5cced096319d160a84587c0ae96c0d9fff73e9e5 Mon Sep 17 00:00:00 2001 From: Bernd Hacker Date: Tue, 23 May 2017 11:55:28 +0200 Subject: [PATCH 0098/1105] add missing test file to tsconfig.json --- types/heredatalens/tsconfig.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/heredatalens/tsconfig.json b/types/heredatalens/tsconfig.json index d687f69017..9c60b13753 100644 --- a/types/heredatalens/tsconfig.json +++ b/types/heredatalens/tsconfig.json @@ -17,6 +17,7 @@ "forceConsistentCasingInFileNames": true }, "files": [ - "index.d.ts" + "index.d.ts", + "heredatalens-tests.ts" ] } \ No newline at end of file From ed212228d8616ac151fe67f7b6d431baf3377d94 Mon Sep 17 00:00:00 2001 From: Jos van den Oever Date: Tue, 23 May 2017 15:12:44 +0200 Subject: [PATCH 0099/1105] Add more options to JSZipGeneratorOptions Source: https://stuk.github.io/jszip/documentation/api_jszip/generate_async.html --- types/jszip/index.d.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/types/jszip/index.d.ts b/types/jszip/index.d.ts index be9b053d43..b44d2bc538 100644 --- a/types/jszip/index.d.ts +++ b/types/jszip/index.d.ts @@ -168,9 +168,18 @@ interface JSZipGeneratorOptions { base64?: boolean; /** DEFLATE or STORE */ compression?: string; - /** base64 (default), string, uint8array, blob */ + /** base64 (default), string, uint8array, arraybuffer, blob */ type?: string; comment?: string; + /** + * mime-type for the generated file. + * Useful when you need to generate a file with a different extension, ie: “.ods”. + */ + mimeType?: string; + /** streaming uses less memory */ + streamFiles?: boolean; + /** DOS (default) or UNIX */ + platform?: string; } interface JSZipLoadOptions { From 5ae5974c52014bcb22101dacf90a9b7b8509bd79 Mon Sep 17 00:00:00 2001 From: Andrew Sheehan Date: Tue, 23 May 2017 09:58:22 -0500 Subject: [PATCH 0100/1105] Update typings for xmldoc --- types/xmldoc/index.d.ts | 51 +++++++++++++++++++++++++++++++++--- types/xmldoc/xmldoc-tests.ts | 44 +++++++++++++++++++++++++++++-- 2 files changed, 90 insertions(+), 5 deletions(-) diff --git a/types/xmldoc/index.d.ts b/types/xmldoc/index.d.ts index 8590c68e16..7d521ac237 100644 --- a/types/xmldoc/index.d.ts +++ b/types/xmldoc/index.d.ts @@ -1,11 +1,13 @@ -// Type definitions for xmldoc 0.5.1 +// Type definitions for xmldoc 1.1.0 // Project: https://www.npmjs.com/package/xmldoc -// Definitions by: Xavier Stouder +// Definitions by: Xavier Stouder , Andrew Sheehan // Definitions: https://github.com/DefinitelyTyped/ export class XmlDocument { constructor(xmlString: string); + doctype: string; + eachChild(func: (child: XmlElement, index?: number, array?: XmlElement[]) => void): void; childNamed(name: string): XmlElement; childrenNamed(name: string): XmlElement[]; @@ -13,8 +15,19 @@ export class XmlDocument { descendantWithPath(path: string): XmlElement; valueWithPath(path: string): string; toString(opts?: XmlOptions): string; + toStringWithIndent(indent: string, opts?: XmlOptions): string; } + export class XmlElement { + constructor(tag: XmlElement); + + name: string; + attr: XmlAttributes; + val: string; + children: XmlElement[]; + firstChild: XmlElement; + lastChild: XmlElement; + eachChild(func: (child: XmlElement, index?: number, array?: XmlElement[]) => void): void; childNamed(name: string): XmlElement; childrenNamed(name: string): XmlElement[]; @@ -22,10 +35,42 @@ export class XmlElement { descendantWithPath(path: string): XmlElement; valueWithPath(path: string): string; toString(opts?: XmlOptions): string; + toStringWithIndent(indent: string, opts?: XmlOptions): string; +} + +export class XmlTextNode { + constructor(text: string); + + toString(opts?: XmlOptions): string; + toStringWithIndent(indent: string, opts?: XmlOptions): string; +} + +export class XmlCDataNode { + constructor(cdata: string); + + toString(opts?: XmlOptions): string; + toStringWithIndent(indent: string, opts?: XmlOptions): string; +} + +export class XmlCommentNode { + constructor(comment: string); + + toString(opts?: XmlOptions): string; + toStringWithIndent(indent: string, opts?: XmlOptions): string; } export interface XmlOptions { compressed?: boolean; - trimmed?: boolean; + html?: boolean; preserveWhitespace?: boolean; + trimmed?: boolean; +} + +export interface XmlTag { + name: string; + attributes: XmlAttributes; +} + +export interface XmlAttributes { + [key: string]: string; } diff --git a/types/xmldoc/xmldoc-tests.ts b/types/xmldoc/xmldoc-tests.ts index 09a3f35d9e..17942e2658 100644 --- a/types/xmldoc/xmldoc-tests.ts +++ b/types/xmldoc/xmldoc-tests.ts @@ -1,4 +1,44 @@ import * as xmldoc from "xmldoc"; -const doc = new xmldoc.XmlDocument("magic"); -console.log(doc.toString()); \ No newline at end of file +// +// https://github.com/nfarina/xmldoc#usage +// +const document = new xmldoc.XmlDocument("xml"); + +// +// https://github.com/nfarina/xmldoc#descendantwithpathpath +// +const bookNode = new xmldoc.XmlDocument(` + + + George R. R. Martin + ... + + ... + `); + +const nameNode = bookNode.descendantWithPath("author.name"); // return node + +// +// https://github.com/nfarina/xmldoc#valuewithpathpath +// +const authorName = bookNode.valueWithPath("author.name"); // return "George R. R. Martin" +const authorIsProper = bookNode.valueWithPath("author.name@isProper"); // return "true" + +// +// https://github.com/nfarina/xmldoc#tostringoptions +// +document.toString({ compressed: true }) // strips indents and linebreaks +document.toString({ trimmed: true }) // trims long strings for easier debugging +document.toString({ preserveWhitespace: true }) // prevents whitespace being removed from around element values + +const xml = "looooooong value"; +console.log("My document: \n" + new xmldoc.XmlDocument(xml).toString({ trimmed: true })) +/* Prints: + +My Document: + + loooooooo… + + +*/ From 41dbea195761fe91c99cf855080ae778feab0249 Mon Sep 17 00:00:00 2001 From: Dom Armstrong Date: Tue, 23 May 2017 16:08:37 +0100 Subject: [PATCH 0101/1105] dottie: get default value is optional --- types/dottie/dottie-tests.ts | 1 + types/dottie/index.d.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/types/dottie/dottie-tests.ts b/types/dottie/dottie-tests.ts index 366d2e32d9..35b02946eb 100644 --- a/types/dottie/dottie-tests.ts +++ b/types/dottie/dottie-tests.ts @@ -12,6 +12,7 @@ const nestedObject = { dottie.exists(nestedObject, 'some.nested'); dottie.default(nestedObject, 'some.nested.value', 'b'); +dottie.get(nestedObject, 'some.nested.value'); dottie.get(nestedObject, 'some.nested.value', 'b'); dottie.set(nestedObject, 'some.nested.value', 'b'); dottie.transform({ 'foo.bar': 'baz' }); diff --git a/types/dottie/index.d.ts b/types/dottie/index.d.ts index 66fb81df5f..1c9f601380 100644 --- a/types/dottie/index.d.ts +++ b/types/dottie/index.d.ts @@ -76,7 +76,7 @@ declare namespace dottie { * dottie.get(values, 'some.undefined.key', 'defaultval'); // 'defaultval' * dottie.get(values, ['some.dot.included', 'key']); // 'barfoo' */ - get(obj: object, path: DottiePath, defaultValue: T): T; + get(obj: object, path: DottiePath, defaultValue?: T): T; /** * Sets nested value, creates nested structure if needed From 6ce5f0c003b191c0ea8be204171b6b570d8868a1 Mon Sep 17 00:00:00 2001 From: Andrew Sheehan Date: Tue, 23 May 2017 10:11:52 -0500 Subject: [PATCH 0102/1105] Include tslint.json in xmldoc folder --- types/xmldoc/tslint.json | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 types/xmldoc/tslint.json diff --git a/types/xmldoc/tslint.json b/types/xmldoc/tslint.json new file mode 100644 index 0000000000..d88586e5bd --- /dev/null +++ b/types/xmldoc/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} From 740b493d82af3095e87cf146ca4b1464b7991590 Mon Sep 17 00:00:00 2001 From: Jonathon Kelly Date: Tue, 23 May 2017 16:19:55 +0100 Subject: [PATCH 0103/1105] add required to TextFieldProps --- types/material-ui/index.d.ts | 3 ++- types/material-ui/material-ui-tests.tsx | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/types/material-ui/index.d.ts b/types/material-ui/index.d.ts index 832cdd04dd..633c8aa699 100644 --- a/types/material-ui/index.d.ts +++ b/types/material-ui/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for material-ui v0.17.51 // Project: https://github.com/callemall/material-ui -// Definitions by: Nathan Brown , Igor Belagorudsky , Ali Taheri Moghaddar , Oliver Herrmann , Daniel Roth , Aurelién Allienne +// Definitions by: Nathan Brown , Igor Belagorudsky , Ali Taheri Moghaddar , Oliver Herrmann , Daniel Roth , Aurelién Allienne , Jonathon Kelly // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -1812,6 +1812,7 @@ declare namespace __MaterialUI { onKeyDown?: React.KeyboardEventHandler<{}>; onKeyUp?: React.KeyboardEventHandler<{}>; onKeyPress?: React.KeyboardEventHandler<{}>; + required?: boolean; rows?: number, rowsMax?: number, style?: React.CSSProperties; diff --git a/types/material-ui/material-ui-tests.tsx b/types/material-ui/material-ui-tests.tsx index d81155dfcc..77a0445fb2 100644 --- a/types/material-ui/material-ui-tests.tsx +++ b/types/material-ui/material-ui-tests.tsx @@ -4854,6 +4854,11 @@ const TextFieldExampleSimple = () => ( min={5} max={50} step={5} + />
+
); From b77b131956c3b5abca9a17c3b3e7837d1d96ed4f Mon Sep 17 00:00:00 2001 From: spectralradius Date: Tue, 23 May 2017 11:20:39 -0400 Subject: [PATCH 0104/1105] Update spdy to avoid redeclaring node types. --- types/spdy/index.d.ts | 319 ++---------------------------------------- types/ws/index.d.ts | 11 +- types/ws/ws-tests.ts | 10 +- 3 files changed, 26 insertions(+), 314 deletions(-) diff --git a/types/spdy/index.d.ts b/types/spdy/index.d.ts index 8371ca4f9f..d0f44fa6a9 100644 --- a/types/spdy/index.d.ts +++ b/types/spdy/index.d.ts @@ -3,14 +3,19 @@ // Definitions by: Anthony Trinh // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +/// + +import * as http from 'http'; +import * as https from 'https'; + declare module "spdy" { // lib/spdy/agent.js namespace agent { - export class Agent extends node.https.Agent {} - export class PlainAgent extends node.http.Agent {} + export class Agent extends https.Agent {} + export class PlainAgent extends http.Agent {} export function create(base: any, options: AgentOptions): Agent | PlainAgent; - export interface AgentOptions extends node.https.AgentOptions { + export interface AgentOptions extends https.AgentOptions { port?: number, spdy?: { plain?: boolean, @@ -48,16 +53,16 @@ declare module "spdy" { // lib/spdy/server.js namespace server { - export interface Server extends node.https.Server {} - export interface PlainServer extends node.http.Server {} - export interface IncomingMessage extends node.http.IncomingMessage {} - export interface ServerResponse extends node.http.ServerResponse { + export interface Server extends https.Server {} + export interface PlainServer extends http.Server {} + export interface IncomingMessage extends http.IncomingMessage {} + export interface ServerResponse extends http.ServerResponse { push(filename: string, options: PushOptions): any; } export function create(base: any, - options: node.https.ServerOptions, + options: https.ServerOptions, handler: (request: IncomingMessage, response: ServerResponse) => void): Server; - export function create(options: node.https.ServerOptions, + export function create(options: https.ServerOptions, handler: (request: IncomingMessage, response: ServerResponse) => void): Server; export function create(handler: (request: IncomingMessage, response: ServerResponse) => void): Server; @@ -76,7 +81,7 @@ declare module "spdy" { response?: any } - export interface ServerOptions extends node.https.ServerOptions { + export interface ServerOptions extends https.ServerOptions { spdy?: { protocols?: Protocol[], plain?: boolean, @@ -89,300 +94,6 @@ declare module "spdy" { } } - // copied from definitions of Node 6.7.0 - namespace node { - namespace http { - interface Server extends net.Server { - setTimeout(msecs: number, callback: Function): any; - - maxHeadersCount: number; - timeout: number; - listening: boolean; - } - - interface AgentOptions { - /** - * Keep sockets around in a pool to be used by other requests in the future. Default = false - */ - keepAlive?: boolean; - /** - * When using HTTP KeepAlive, how often to send TCP KeepAlive packets over sockets being kept alive. Default = 1000. - * Only relevant if keepAlive is set to true. - */ - keepAliveMsecs?: number; - /** - * Maximum number of sockets to allow per host. Default for Node 0.10 is 5, default for Node 0.12 is Infinity - */ - maxSockets?: number; - /** - * Maximum number of sockets to leave open in a free state. Only relevant if keepAlive is set to true. Default = 256. - */ - maxFreeSockets?: number; - } - - class Agent { - maxSockets: number; - sockets: any; - requests: any; - - constructor(opts?: AgentOptions); - - /** - * Destroy any sockets that are currently in use by the agent. - * It is usually not necessary to do this. However, if you are using an agent with KeepAlive enabled, - * then it is best to explicitly shut down the agent when you know that it will no longer be used. Otherwise, - * sockets may hang open for quite a long time before the server terminates them. - */ - destroy(): void; - } - - export interface IncomingMessage { - path: string; - httpVersion: string; - httpVersionMajor: number; - httpVersionMinor: number; - connection: any; - headers: any; - rawHeaders: string[]; - trailers: any; - rawTrailers: any; - setTimeout(msecs: number, callback: Function): any; - /** - * Only valid for request obtained from http.Server. - */ - method?: string; - /** - * Only valid for request obtained from http.Server. - */ - url?: string; - /** - * Only valid for response obtained from http.ClientRequest. - */ - statusCode?: number; - /** - * Only valid for response obtained from http.ClientRequest. - */ - statusMessage?: string; - socket: any; - destroy(error?: Error): void; - get(name: string): string; - } - - export interface ServerResponse { - // Extended base methods - write(buffer: any): boolean; - write(buffer: any, cb?: Function): boolean; - write(str: string, cb?: Function): boolean; - write(str: string, encoding?: string, cb?: Function): boolean; - write(str: string, encoding?: string, fd?: string): boolean; - - writeContinue(): void; - writeHead(statusCode: number, reasonPhrase?: string, headers?: any): void; - writeHead(statusCode: number, headers?: any): void; - statusCode: number; - statusMessage: string; - headersSent: boolean; - setHeader(name: string, value: string | string[]): void; - setTimeout(msecs: number, callback: Function): ServerResponse; - sendDate: boolean; - getHeader(name: string): string; - removeHeader(name: string): void; - write(chunk: any, encoding?: string): any; - addTrailers(headers: any): void; - finished: boolean; - - // Extended base methods - end(): void; - end(buffer: any, cb?: Function): void; - end(str: string, cb?: Function): void; - end(str: string, encoding?: string, cb?: Function): void; - end(data?: any, encoding?: string): void; - } - } - - namespace https { - interface Server extends tls.Server { - close(callback?: Function): Server; - } - - interface ServerOptions { - pfx?: any; - key?: any; - passphrase?: string; - cert?: any; - ca?: any; - crl?: any; - ciphers?: string; - honorCipherOrder?: boolean; - requestCert?: boolean; - rejectUnauthorized?: boolean; - NPNProtocols?: any; - SNICallback?: (servername: string, cb: (err: Error, ctx: tls.SecureContext) => any) => any; - } - - class Agent extends http.Agent {} - - interface AgentOptions extends http.AgentOptions { - pfx?: any; - key?: any; - passphrase?: string; - cert?: any; - ca?: any; - ciphers?: string; - rejectUnauthorized?: boolean; - secureProtocol?: string; - maxCachedSessions?: number; - } - } - - namespace tls { - interface Server extends net.Server { - close(): Server; - address(): { port: number; family: string; address: string; }; - addContext(hostName: string, credentials: { - key: string; - cert: string; - ca: string; - }): void; - maxConnections: number; - connections: number; - - /** - * events.EventEmitter - * 1. tlsClientError - * 2. newSession - * 3. OCSPRequest - * 4. resumeSession - * 5. secureConnection - **/ - addListener(event: string, listener: Function): this; - addListener(event: "tlsClientError", listener: (err: Error, tlsSocket: any) => void): this; - addListener(event: "newSession", listener: (sessionId: any, sessionData: any, callback: (err: Error, resp: any) => void) => void): this; - addListener(event: "OCSPRequest", listener: (certificate: any, issuer: any, callback: Function) => void): this; - addListener(event: "resumeSession", listener: (sessionId: any, callback: (err: Error, sessionData: any) => void) => void): this; - addListener(event: "secureConnection", listener: (tlsSocket: any) => void): this; - - emit(event: string, ...args: any[]): boolean; - emit(event: "tlsClientError", err: Error, tlsSocket: any): boolean; - emit(event: "newSession", sessionId: any, sessionData: any, callback: (err: Error, resp: any) => void): boolean; - emit(event: "OCSPRequest", certificate: any, issuer: any, callback: Function): boolean; - emit(event: "resumeSession", sessionId: any, callback: (err: Error, sessionData: any) => void): boolean; - emit(event: "secureConnection", tlsSocket: any): boolean; - - on(event: string, listener: Function): this; - on(event: "tlsClientError", listener: (err: Error, tlsSocket: any) => void): this; - on(event: "newSession", listener: (sessionId: any, sessionData: any, callback: (err: Error, resp: any) => void) => void): this; - on(event: "OCSPRequest", listener: (certificate: any, issuer: any, callback: Function) => void): this; - on(event: "resumeSession", listener: (sessionId: any, callback: (err: Error, sessionData: any) => void) => void): this; - on(event: "secureConnection", listener: (tlsSocket: any) => void): this; - - once(event: string, listener: Function): this; - once(event: "tlsClientError", listener: (err: Error, tlsSocket: any) => void): this; - once(event: "newSession", listener: (sessionId: any, sessionData: any, callback: (err: Error, resp: any) => void) => void): this; - once(event: "OCSPRequest", listener: (certificate: any, issuer: any, callback: Function) => void): this; - once(event: "resumeSession", listener: (sessionId: any, callback: (err: Error, sessionData: any) => void) => void): this; - once(event: "secureConnection", listener: (tlsSocket: any) => void): this; - - prependListener(event: string, listener: Function): this; - prependListener(event: "tlsClientError", listener: (err: Error, tlsSocket: any) => void): this; - prependListener(event: "newSession", listener: (sessionId: any, sessionData: any, callback: (err: Error, resp: any) => void) => void): this; - prependListener(event: "OCSPRequest", listener: (certificate: any, issuer: any, callback: Function) => void): this; - prependListener(event: "resumeSession", listener: (sessionId: any, callback: (err: Error, sessionData: any) => void) => void): this; - prependListener(event: "secureConnection", listener: (tlsSocket: any) => void): this; - - prependOnceListener(event: string, listener: Function): this; - prependOnceListener(event: "tlsClientError", listener: (err: Error, tlsSocket: any) => void): this; - prependOnceListener(event: "newSession", listener: (sessionId: any, sessionData: any, callback: (err: Error, resp: any) => void) => void): this; - prependOnceListener(event: "OCSPRequest", listener: (certificate: any, issuer: any, callback: Function) => void): this; - prependOnceListener(event: "resumeSession", listener: (sessionId: any, callback: (err: Error, sessionData: any) => void) => void): this; - prependOnceListener(event: "secureConnection", listener: (tlsSocket: any) => void): this; - } - - interface SecureContext { - context: any; - } - } - - namespace net { - interface Server { - // net.Server - listen(port: number, hostname?: string, backlog?: number, listeningListener?: Function): Server; - listen(port: number, hostname?: string, listeningListener?: Function): Server; - listen(port: number, backlog?: number, listeningListener?: Function): Server; - listen(port: number, listeningListener?: Function): Server; - listen(path: string, backlog?: number, listeningListener?: Function): Server; - listen(path: string, listeningListener?: Function): Server; - listen(handle: any, backlog?: number, listeningListener?: Function): Server; - listen(handle: any, listeningListener?: Function): Server; - listen(options: ListenOptions, listeningListener?: Function): Server; - - close(callback?: Function): Server; - - address(): { port: number; family: string; address: string; }; - - getConnections(cb: (error: Error, count: number) => void): void; - - ref(): Server; - - unref(): Server; - - maxConnections: number; - connections: number; - - /** - * events.EventEmitter - * 1. close - * 2. connection - * 3. error - * 4. listening - */ - addListener(event: string, listener: Function): this; - addListener(event: "close", listener: () => void): this; - addListener(event: "connection", listener: (socket: Socket) => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "listening", listener: () => void): this; - - emit(event: string, ...args: any[]): boolean; - emit(event: "close"): boolean; - emit(event: "connection", socket: Socket): boolean; - emit(event: "error", err: Error): boolean; - emit(event: "listening"): boolean; - - on(event: string, listener: Function): this; - on(event: "close", listener: () => void): this; - on(event: "connection", listener: (socket: Socket) => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "listening", listener: () => void): this; - - once(event: string, listener: Function): this; - once(event: "close", listener: () => void): this; - once(event: "connection", listener: (socket: Socket) => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "listening", listener: () => void): this; - - prependListener(event: string, listener: Function): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "connection", listener: (socket: Socket) => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "listening", listener: () => void): this; - - prependOnceListener(event: string, listener: Function): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "connection", listener: (socket: Socket) => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "listening", listener: () => void): this; - } - - interface ListenOptions { - port?: number; - host?: string; - backlog?: number; - path?: string; - exclusive?: boolean; - } - } - } - // lib/spdy/socket.js namespace socket { export interface Socket { diff --git a/types/ws/index.d.ts b/types/ws/index.d.ts index da44eb0247..9fce6f9dc3 100644 --- a/types/ws/index.d.ts +++ b/types/ws/index.d.ts @@ -22,6 +22,7 @@ declare class WebSocket extends events.EventEmitter { protocolVersion: string; url: string; supports: any; + upgradeReq: http.IncomingMessage; protocol: string; bufferedAmount: number; binaryType: string; @@ -71,9 +72,9 @@ declare class WebSocket extends events.EventEmitter { addListener(event: 'error', cb: (err: Error) => void): this; addListener(event: 'close', cb: (code: number, message: string) => void): this; - addListener(event: 'message', cb: (data: any) => void): this; - addListener(event: 'ping', cb: (data: any) => void): this; - addListener(event: 'pong', cb: (data: any) => void): this; + addListener(event: 'message', cb: (data: any, flags: { binary: boolean }) => void): this; + addListener(event: 'ping', cb: (data: any, flags: { binary: boolean }) => void): this; + addListener(event: 'pong', cb: (data: any, flags: { binary: boolean }) => void): this; addListener(event: 'open', cb: () => void): this; addListener(event: string, listener: () => void): this; } @@ -137,12 +138,12 @@ declare namespace WebSocket { // Events on(event: 'error', cb: (err: Error) => void): this; on(event: 'headers', cb: (headers: string[]) => void): this; - on(event: 'connection', cb: (client: WebSocket, req: http.IncomingMessage) => void): this; + on(event: 'connection', cb: (client: WebSocket) => void): this; on(event: string, listener: () => void): this; addListener(event: 'error', cb: (err: Error) => void): this; addListener(event: 'headers', cb: (headers: string[]) => void): this; - addListener(event: 'connection', cb: (client: WebSocket, req: http.IncomingMessage) => void): this; + addListener(event: 'connection', cb: (client: WebSocket) => void): this; addListener(event: string, listener: () => void): this; } diff --git a/types/ws/ws-tests.ts b/types/ws/ws-tests.ts index 33df02a62a..8b2ef3a968 100644 --- a/types/ws/ws-tests.ts +++ b/types/ws/ws-tests.ts @@ -8,7 +8,7 @@ var WebSocketServer = WebSocket.Server; { var ws = new WebSocket('ws://www.host.com/path'); ws.on('open', () => ws.send('something')); - ws.on('message', (data) => {}); + ws.on('message', (data, flags) => {}); } { @@ -46,8 +46,8 @@ var WebSocketServer = WebSocket.Server; wsc.on('open', () => wsc.send(Date.now().toString(), {mask: true})); wsc.on('close', () => console.log('disconnected')); - wsc.on('message', (data) => { - console.log('Roundtrip time: ' + (Date.now() - parseInt(data)) + 'ms'); + wsc.on('message', (data, flags) => { + console.log('Roundtrip time: ' + (Date.now() - parseInt(data)) + 'ms', flags); setTimeout(() => { wsc.send(Date.now().toString(), {mask: true}); }, 500); @@ -71,11 +71,11 @@ var WebSocketServer = WebSocket.Server; ): void { callback(true) } - + var wsv = new WebSocketServer({ verifyClient }) - + wsv.on('connection', function connection(ws) { console.log(ws.protocol) }) From c1a65853d41ebd7f385ac01f8a0543ed4df730a4 Mon Sep 17 00:00:00 2001 From: Spectral Radius Systems Date: Tue, 23 May 2017 11:24:14 -0400 Subject: [PATCH 0105/1105] put back spaces to avoid pull-request problems --- types/ws/ws-tests.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/ws/ws-tests.ts b/types/ws/ws-tests.ts index 8b2ef3a968..a015f4c387 100644 --- a/types/ws/ws-tests.ts +++ b/types/ws/ws-tests.ts @@ -71,11 +71,11 @@ var WebSocketServer = WebSocket.Server; ): void { callback(true) } - + var wsv = new WebSocketServer({ verifyClient }) - + wsv.on('connection', function connection(ws) { console.log(ws.protocol) }) From 84241ecf3dd73fbb70991b064361fd9cbb74a2b7 Mon Sep 17 00:00:00 2001 From: Andrew Sheehan Date: Tue, 23 May 2017 10:41:37 -0500 Subject: [PATCH 0106/1105] Add TypeScript version to definition header for xmldoc, fix lint failures in tests for xmldoc --- types/xmldoc/index.d.ts | 4 ++-- types/xmldoc/xmldoc-tests.ts | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/types/xmldoc/index.d.ts b/types/xmldoc/index.d.ts index 7d521ac237..a4373606d9 100644 --- a/types/xmldoc/index.d.ts +++ b/types/xmldoc/index.d.ts @@ -1,7 +1,7 @@ -// Type definitions for xmldoc 1.1.0 +// Type definitions for xmldoc 1.1 // Project: https://www.npmjs.com/package/xmldoc // Definitions by: Xavier Stouder , Andrew Sheehan -// Definitions: https://github.com/DefinitelyTyped/ +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped): // TypeScript Version: 2.1 export class XmlDocument { constructor(xmlString: string); diff --git a/types/xmldoc/xmldoc-tests.ts b/types/xmldoc/xmldoc-tests.ts index 17942e2658..5698bac85b 100644 --- a/types/xmldoc/xmldoc-tests.ts +++ b/types/xmldoc/xmldoc-tests.ts @@ -28,12 +28,12 @@ const authorIsProper = bookNode.valueWithPath("author.name@isProper"); // retur // // https://github.com/nfarina/xmldoc#tostringoptions // -document.toString({ compressed: true }) // strips indents and linebreaks -document.toString({ trimmed: true }) // trims long strings for easier debugging -document.toString({ preserveWhitespace: true }) // prevents whitespace being removed from around element values +document.toString({ compressed: true }); // strips indents and linebreaks +document.toString({ trimmed: true }); // trims long strings for easier debugging +document.toString({ preserveWhitespace: true }); // prevents whitespace being removed from around element values const xml = "looooooong value"; -console.log("My document: \n" + new xmldoc.XmlDocument(xml).toString({ trimmed: true })) +console.log("My document: \n" + new xmldoc.XmlDocument(xml).toString({ trimmed: true })); /* Prints: My Document: From 0ef498c36a0d303e795a224aac72817757239bda Mon Sep 17 00:00:00 2001 From: Huw McNamara Date: Tue, 23 May 2017 19:09:07 +0100 Subject: [PATCH 0107/1105] addressed feedback --- types/alexa-sdk/index.d.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/types/alexa-sdk/index.d.ts b/types/alexa-sdk/index.d.ts index fca31e45e4..141d41743e 100644 --- a/types/alexa-sdk/index.d.ts +++ b/types/alexa-sdk/index.d.ts @@ -81,18 +81,16 @@ interface IntentRequest extends IRequest { intent: Intent; } -interface ISlots { - [slot: string]: { - confirmationStatus: ConfirmationStatuses; - name: string; - value?: any; - }; +interface SlotValue { + confirmationStatus: ConfirmationStatuses; + name: string; + value?: any; } interface Intent { confirmationStatus: ConfirmationStatuses; name: string; - slots: ISlots; + slots: Record; } interface SessionEndedRequest extends IRequest { From 528a0c1e224f5ebf70092a19328fe498d834b116 Mon Sep 17 00:00:00 2001 From: Huw McNamara Date: Tue, 23 May 2017 19:13:28 +0100 Subject: [PATCH 0108/1105] updated typescript version --- types/alexa-sdk/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/alexa-sdk/index.d.ts b/types/alexa-sdk/index.d.ts index 141d41743e..d051c44ccc 100644 --- a/types/alexa-sdk/index.d.ts +++ b/types/alexa-sdk/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs // Definitions by: Pete Beegle , Huw // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 export function handler(event: RequestBody, context: Context, callback?: Function): AlexaObject; export function CreateStateHandler(state: string, obj: any): any; From dd14b496587c5d4497378ab0da1a656ff03130f1 Mon Sep 17 00:00:00 2001 From: Gabe Scholz Date: Tue, 23 May 2017 12:01:10 -0700 Subject: [PATCH 0109/1105] Ensure that typings for resolves and rejects return type Matchers> --- types/jest/index.d.ts | 72 +++++++++++++++++++++------------------- types/jest/jest-tests.ts | 39 +++++++++++++++++----- 2 files changed, 68 insertions(+), 43 deletions(-) diff --git a/types/jest/index.d.ts b/types/jest/index.d.ts index 7ac5c7486b..9c96fd1615 100644 --- a/types/jest/index.d.ts +++ b/types/jest/index.d.ts @@ -159,7 +159,7 @@ declare namespace jest { * * @param {any} actual The value to apply matchers against. */ - (actual: any): Matchers; + (actual: any): Matchers; anything(): any; /** Matches anything that was created with the given constructor. You can use it inside `toEqual` or `toBeCalledWith` instead of a literal value. */ any(classType: any): any; @@ -175,69 +175,71 @@ declare namespace jest { stringMatching(str: string | RegExp): any; } - interface Matchers { + interface Matchers { /** If you know how to test something, `.not` lets you test its opposite. */ - not: Matchers; - resolves: Matchers; - rejects: Matchers; - lastCalledWith(...args: any[]): void; + not: Matchers; + /** Use resolves to unwrap the value of a fulfilled promise so any other matcher can be chained. If the promise is rejected the assertion fails. */ + resolves: Matchers>; + /** Unwraps the reason of a rejected promise so any other matcher can be chained. If the promise is fulfilled the assertion fails. */ + rejects: Matchers>; + lastCalledWith(...args: any[]): R; /** Checks that a value is what you expect. It uses `===` to check strict equality. Don't use `toBe` with floating-point numbers. */ - toBe(expected: any): void; + toBe(expected: any): R; /** Ensures that a mock function is called. */ - toBeCalled(): void; + toBeCalled(): R; /** Ensure that a mock function is called with specific arguments. */ - toBeCalledWith(...args: any[]): void; + toBeCalledWith(...args: any[]): R; /** Using exact equality with floating point numbers is a bad idea. Rounding means that intuitive things fail. */ - toBeCloseTo(expected: number, delta?: number): void; + toBeCloseTo(expected: number, delta?: number): R; /** Ensure that a variable is not undefined. */ - toBeDefined(): void; + toBeDefined(): R; /** When you don't care what a value is, you just want to ensure a value is false in a boolean context. */ - toBeFalsy(): void; + toBeFalsy(): R; /** For comparing floating point numbers. */ - toBeGreaterThan(expected: number): void; + toBeGreaterThan(expected: number): R; /** For comparing floating point numbers. */ - toBeGreaterThanOrEqual(expected: number): void; + toBeGreaterThanOrEqual(expected: number): R; /** Ensure that an object is an instance of a class. This matcher uses `instanceof` underneath. */ - toBeInstanceOf(expected: any): void + toBeInstanceOf(expected: any): R /** For comparing floating point numbers. */ - toBeLessThan(expected: number): void; + toBeLessThan(expected: number): R; /** For comparing floating point numbers. */ - toBeLessThanOrEqual(expected: number): void; + toBeLessThanOrEqual(expected: number): R; /** This is the same as `.toBe(null)` but the error messages are a bit nicer. So use `.toBeNull()` when you want to check that something is null. */ - toBeNull(): void; + toBeNull(): R; /** Use when you don't care what a value is, you just want to ensure a value is true in a boolean context. In JavaScript, there are six falsy values: `false`, `0`, `''`, `null`, `undefined`, and `NaN`. Everything else is truthy. */ - toBeTruthy(): void; + toBeTruthy(): R; /** Used to check that a variable is undefined. */ - toBeUndefined(): void; + toBeUndefined(): R; /** Used when you want to check that an item is in a list. For testing the items in the list, this uses `===`, a strict equality check. */ - toContain(expected: any): void; + toContain(expected: any): R; /** Used when you want to check that an item is in a list. For testing the items in the list, this matcher recursively checks the equality of all fields, rather than checking for object identity. */ - toContainEqual(expected: any): void; + toContainEqual(expected: any): R; /** Used when you want to check that two objects have the same value. This matcher recursively checks the equality of all fields, rather than checking for object identity. */ - toEqual(expected: any): void; + toEqual(expected: any): R; /** Ensures that a mock function is called. */ - toHaveBeenCalled(): boolean; + toHaveBeenCalled(): R; /** Ensures that a mock function is called an exact number of times. */ - toHaveBeenCalledTimes(expected: number): boolean; + toHaveBeenCalledTimes(expected: number): R; /** Ensure that a mock function is called with specific arguments. */ - toHaveBeenCalledWith(...params: any[]): boolean; + toHaveBeenCalledWith(...params: any[]): R; /** If you have a mock function, you can use `.toHaveBeenLastCalledWith` to test what arguments it was last called with. */ - toHaveBeenLastCalledWith(...params: any[]): boolean; + toHaveBeenLastCalledWith(...params: any[]): R; /** Used to check that an object has a `.length` property and it is set to a certain numeric value. */ - toHaveLength(expected: number): void; - toHaveProperty(propertyPath: string, value?: any): void; + toHaveLength(expected: number): R; + toHaveProperty(propertyPath: string, value?: any): R; /** Check that a string matches a regular expression. */ - toMatch(expected: string | RegExp): void; + toMatch(expected: string | RegExp): R; /** Used to check that a JavaScript object matches a subset of the properties of an objec */ - toMatchObject(expected: {}): void; + toMatchObject(expected: {}): R; /** This ensures that a value matches the most recent snapshot. Check out [the Snapshot Testing guide](http://facebook.github.io/jest/docs/snapshot-testing.html) for more information. */ - toMatchSnapshot(snapshotName?: string): void; + toMatchSnapshot(snapshotName?: string): R; /** Used to test that a function throws when it is called. */ - toThrow(error?: string | Constructable | RegExp): void; + toThrow(error?: string | Constructable | RegExp): R; /** If you want to test that a specific error is thrown inside a function. */ - toThrowError(error?: string | Constructable | RegExp): void; + toThrowError(error?: string | Constructable | RegExp): R; /** Used to test that a function throws a error matching the most recent snapshot when it is called. */ - toThrowErrorMatchingSnapshot(): void; + toThrowErrorMatchingSnapshot(): R; } interface Constructable { diff --git a/types/jest/jest-tests.ts b/types/jest/jest-tests.ts index 0605724334..eb86e1c861 100644 --- a/types/jest/jest-tests.ts +++ b/types/jest/jest-tests.ts @@ -503,16 +503,39 @@ describe('Mocks', function () { }); // https://facebook.github.io/jest/docs/en/expect.html#resolves -describe('resolves', function () { - it('unwraps the expected Promise', function () { - return expect(Promise.resolve('test')).resolves.toEqual('test'); +describe('resolves', function() { + it('unwraps the expected Promise', function() { + const expectation = expect(Promise.resolve('test')).resolves.toEqual('test'); + expect(expectation instanceof Promise).toBeTruthy(); + return expectation; + }); + + it('unwraps a .toHaveBeenCalledX', function(done) { + expect.assertions(2); + + const fn = jest.fn(); + return expect(Promise.resolve(fn)).resolves.toHaveBeenCalledTimes(0).then(val => { + expect(val).toEqual(true); + done(); + }); + }); + + it('unwraps a not.toHaveBeenCalledX', function(done) { + expect.assertions(2); + + const fn = jest.fn(); + return expect(Promise.resolve(fn)).resolves.not.toHaveBeenCalledTimes(1).then(val => { + expect(val).toEqual(true); + done(); + }); }); }); // https://facebook.github.io/jest/docs/en/expect.html#rejects -describe('rejects', function () { - it('unwraps the expected Promise', function () { - const error = new Error('error'); - return expect(Promise.reject(error)).rejects.toBeDefined(); +describe('rejects', function() { + it('unwraps the expected Promise', function() { + const expectation = expect(Promise.reject(new Error('error'))).rejects.toMatch('error'); + expect(expectation instanceof Promise).toBeTruthy(); + return expectation; }); -}); \ No newline at end of file +}); From e85e05d0b2f99fd2597ebeb7081e6607f453e7a0 Mon Sep 17 00:00:00 2001 From: Peter Burns Date: Tue, 23 May 2017 12:03:17 -0700 Subject: [PATCH 0110/1105] Add tests of types. --- types/node/v6/node-tests.ts | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/types/node/v6/node-tests.ts b/types/node/v6/node-tests.ts index b2ca08898c..b405459b7e 100644 --- a/types/node/v6/node-tests.ts +++ b/types/node/v6/node-tests.ts @@ -542,6 +542,32 @@ function simplified_stream_ctor_test() { }) } +// Subclassing stream classes +{ + class SubclassedReadable extends stream.Readable {}; + + let subclassedReadable: SubclassedReadable = new SubclassedReadable(); + subclassedReadable = subclassedReadable.pause(); + subclassedReadable = subclassedReadable.resume(); + + class SubclassedTransform extends stream.Transform {}; + + let subclassedTransform: SubclassedTransform = new SubclassedTransform(); + subclassedTransform = subclassedTransform.pause(); + subclassedTransform = subclassedTransform.resume(); + + class SubclassedDuplex extends stream.Duplex {}; + + let subclassedDuplex: SubclassedDuplex = new SubclassedDuplex(); + subclassedDuplex = subclassedDuplex.pause(); + subclassedDuplex = subclassedDuplex.resume(); + + // assignability + let readable: stream.Readable = subclassedDuplex; + readable = subclassedTransform; + let duplex: stream.Duplex = subclassedTransform; +} + //////////////////////////////////////////////////////// /// Crypto tests : http://nodejs.org/api/crypto.html /// //////////////////////////////////////////////////////// From 4f2ab268eadc60495005bdbbc2d0924771daafc2 Mon Sep 17 00:00:00 2001 From: Jordan Holliday Date: Tue, 23 May 2017 16:18:15 -0400 Subject: [PATCH 0111/1105] [Mixpanel] add reset method to mixpanel global instance --- types/mixpanel/index.d.ts | 4 +++- types/mixpanel/mixpanel-tests.ts | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/types/mixpanel/index.d.ts b/types/mixpanel/index.d.ts index 345f33bb46..43f805b761 100644 --- a/types/mixpanel/index.d.ts +++ b/types/mixpanel/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Mixpanel +// Type definitions for Mixpanel for 2.11.1 // Project: https://mixpanel.com/ // https://github.com/mixpanel/mixpanel-js // Definitions by: Knut Eirik Leira Hjelle @@ -24,6 +24,8 @@ interface Mixpanel register_once(params:{[index:string]:any}, defaultValue?:string, days?:number):void; + reset():void; + unregister(propertyName:string):void; identify(id?:string):void; diff --git a/types/mixpanel/mixpanel-tests.ts b/types/mixpanel/mixpanel-tests.ts index f85406f3f8..d826478665 100644 --- a/types/mixpanel/mixpanel-tests.ts +++ b/types/mixpanel/mixpanel-tests.ts @@ -32,6 +32,8 @@ function mixpanel_base() mixpanel.get_config(); mixpanel.get_property('device'); + + mixpanel.reset(); } function mixpanel_people() From c42655ba9dc3b7b59e693e99f7b4626b16f91111 Mon Sep 17 00:00:00 2001 From: james1293 Date: Tue, 23 May 2017 16:37:38 -0400 Subject: [PATCH 0112/1105] Add undefined as possible output of Map.get() --- types/es6-shim/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/es6-shim/index.d.ts b/types/es6-shim/index.d.ts index 483f4357e0..b1dd1d8fd4 100644 --- a/types/es6-shim/index.d.ts +++ b/types/es6-shim/index.d.ts @@ -556,7 +556,7 @@ interface Map { clear(): void; delete(key: K): boolean; forEach(callbackfn: (value: V, index: K, map: Map) => void, thisArg?: any): void; - get(key: K): V; + get(key: K): V | undefined; has(key: K): boolean; set(key: K, value?: V): Map; size: number; From 4f0face89dfec6305fef20f3859819e45c55f35b Mon Sep 17 00:00:00 2001 From: amiram Date: Wed, 24 May 2017 08:00:30 +0300 Subject: [PATCH 0113/1105] CreateUserData: add more properties. UpdateUserData: added. DeleteMultifactorParams: added type for provider. UnlinkAccountsParams: added type for provider. UnlinkAccountsResponse: added. deleteUserMultifactor: removed returned value. --- types/auth0/index.d.ts | 85 +++++++++++++++++++++++++++++++++--------- 1 file changed, 67 insertions(+), 18 deletions(-) diff --git a/types/auth0/index.d.ts b/types/auth0/index.d.ts index be4de08f1f..a27493244a 100644 --- a/types/auth0/index.d.ts +++ b/types/auth0/index.d.ts @@ -13,7 +13,7 @@ export interface ManagementClientOptions { export interface UserMetadata { } export interface AppMetadata { } -export interface UserData { +export interface CreateUserData { connection: string; email?: string; username?: string; @@ -21,9 +21,28 @@ export interface UserData { phone_number?: string; user_metadata?: UserMetadata; email_verified?: boolean; + verify_email?: boolean; + phone_verified?: boolean, app_metadata?: AppMetadata; } +export interface UpdateUserData { + blocked?: boolean; + email_verified?: boolean; + email?: string; + verify_email?: boolean, + phone_number?: string, + phone_verified?: boolean, + verify_phone_number?: boolean, + password?: string, + verify_password?: boolean, + user_metadata?: UserMetadata, + app_metadata?: AppMetadata, + connection?: string, + username?: string, + client_id?: string +} + export interface GetUsersData { per_page?: number; page?: number; @@ -67,8 +86,7 @@ export interface Identity { isSocial: boolean; } -export interface UpdateUserParameters { - id: string; +export interface UpdateUserParameters extends ObjectWithId { } export interface AuthenticationClientOptions { @@ -134,17 +152,47 @@ export interface ClientParams { client_id: string; } +export type DeleteDeleteMultifactorParamsProvider = 'duo' | 'google-authenticator'; + export interface DeleteMultifactorParams { id: string; - provider: string; + provider: DeleteDeleteMultifactorParamsProvider; } -export interface LinkAccountsParams { +export type UnlinkAccountsParamsProvider = 'ad' | 'adfs' | 'amazon' | 'dropbox' | 'bitbucket' | 'aol' | 'auth0-adldap' | + 'auth0-oidc' | 'auth0' | 'baidu' | 'bitly' | 'box' | 'custom' | 'dwolla' | 'email' | 'evernote-sandbox' | 'evernote' | + 'exact' | 'facebook' | 'fitbit' | 'flickr' | 'github' | 'google-apps' | 'google-oauth2' | 'guardian' | 'instagram' | + 'ip' | 'linkedin' | 'miicard' | 'oauth1' | 'oauth2' | 'office365' | 'paypal' | 'paypal-sandbox' | 'pingfederate' | + 'planningcenter' | 'renren' | 'salesforce-community' | 'salesforce-sandbox' | 'salesforce' | 'samlp' | 'sharepoint' | + 'shopify' | 'sms' | 'soundcloud' | 'thecity-sandbox' | 'thecity' | 'thirtysevensignals' | 'twitter' | 'untappd' | + 'vkontakte' | 'waad' | 'weibo' | 'windowslive' | 'wordpress' | 'yahoo' | 'yammer' | 'yandex'; + +export interface UnlinkAccountsParams { id: string; - provider: string; + provider: UnlinkAccountsParamsProvider; user_id: string; } +export interface UnlinkAccountsResponseProfile { + email?: string; + email_verified?: boolean; + name?: string; + username?: string; + given_name?: string; + phone_number?: string; + phone_verified?: boolean; + family_name?: string; +} + +export interface UnlinkAccountsResponse { + connection: string; + user_id: string; + provider: string; + isSocial?: boolean; + access_token?: string; + profileData?: UnlinkAccountsResponseProfile +} + export interface LinkAccountsData { user_id: string; connection_id: string; @@ -310,29 +358,30 @@ export class ManagementClient { getUser(params: ObjectWithId): Promise; getUser(params: ObjectWithId, cb?: (err: Error, user: User) => void): void; - createUser(data: UserData): Promise; - createUser(data: UserData, cb: (err: Error, data: User) => void): void; + createUser(data: CreateUserData): Promise; + createUser(data: CreateUserData, cb: (err: Error, data: User) => void): void; - updateUser(params: UpdateUserParameters, data: User): Promise; - updateUser(params: UpdateUserParameters, data: User, cb: (err: Error, data: User) => void): void; + updateUser(params: ObjectWithId, data: UpdateUserData): Promise; + updateUser(params: ObjectWithId, data: UpdateUserData, cb: (err: Error, data: User) => void): void; - updateUserMetadata(params: UpdateUserParameters, data: UserMetadata): Promise; - updateUserMetadata(params: UpdateUserParameters, data: UserMetadata, cb: (err: Error, data: User) => void): void; + updateUserMetadata(params: ObjectWithId, data: UserMetadata): Promise; + updateUserMetadata(params: ObjectWithId, data: UserMetadata, cb: (err: Error, data: User) => void): void; + // Should be removed from auth0 also. Doesn't exist in api. deleteAllUsers(): Promise; deleteAllUsers(cb: (err: Error, data: any) => void): void; deleteUser(params: ObjectWithId): Promise; deleteUser(params: ObjectWithId, cb?: (err: Error) => void): void; - updateAppMetadata(params: UpdateUserParameters, data: AppMetadata): Promise; - updateAppMetadata(params: UpdateUserParameters, data: AppMetadata, cb: (err: Error, data: User) => void): void; + updateAppMetadata(params: ObjectWithId, data: AppMetadata): Promise; + updateAppMetadata(params: ObjectWithId, data: AppMetadata, cb: (err: Error, data: User) => void): void; - deleteUserMultifactor(params: DeleteMultifactorParams): Promise; - deleteUserMultifactor(params: DeleteMultifactorParams, cb: (err: Error, data: any) => void): void; + deleteUserMultifactor(params: DeleteMultifactorParams): Promise; + deleteUserMultifactor(params: DeleteMultifactorParams, cb: (err: Error) => void): void; - unlinkUsers(params: LinkAccountsParams): Promise; - unlinkUsers(params: LinkAccountsParams, cb: (err: Error, data: any) => void): void; + unlinkUsers(params: UnlinkAccountsParams): Promise; + unlinkUsers(params: UnlinkAccountsParams, cb: (err: Error, data: UnlinkAccountsResponse) => void): void; linkUsers(params: ObjectWithId, data: LinkAccountsData): Promise; linkUsers(params: ObjectWithId, data: LinkAccountsData, cb: (err: Error, data: any) => void): void; From 3c74c9177ae449efe328eabd7aa3a429aa32b863 Mon Sep 17 00:00:00 2001 From: LKay Date: Wed, 24 May 2017 14:48:34 +0900 Subject: [PATCH 0114/1105] Fix export for react-icon-base --- types/react-icon-base/index.d.ts | 19 ++++++++++++------- .../react-icon-base/react-icon-base-tests.tsx | 6 +++--- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/types/react-icon-base/index.d.ts b/types/react-icon-base/index.d.ts index 600d33dff7..11628505e0 100644 --- a/types/react-icon-base/index.d.ts +++ b/types/react-icon-base/index.d.ts @@ -1,15 +1,20 @@ // Type definitions for react-icon-base 2.0 // Project: https://github.com/gorangajic/react-icon-base#readme -// Definitions by: Alexandre Paré +// Definitions by: Alexandre Paré , Karol Janyst // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 -import * as React from 'react'; +import * as React from "react"; -export interface IconBaseProps { - color?: string; - size?: string | number; - style?: React.CSSProperties; +export = IconBaseClass; + +declare namespace IconBaseClass { + export interface IconBaseProps { + color?: string; + size?: string | number; + style?: React.CSSProperties; + viewBox?: string; + } } -export default class IconBase extends React.Component {} +declare class IconBaseClass extends React.Component {} diff --git a/types/react-icon-base/react-icon-base-tests.tsx b/types/react-icon-base/react-icon-base-tests.tsx index 16ebafd133..c0d56f03f2 100644 --- a/types/react-icon-base/react-icon-base-tests.tsx +++ b/types/react-icon-base/react-icon-base-tests.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; -import IconBase from 'react-icon-base'; +import * as React from "react"; +import * as IconBase from "react-icon-base"; -export default ; +export default ; From 36eb56cdf2dabb554ba5c20c922224e1a18fc90b Mon Sep 17 00:00:00 2001 From: LKay Date: Wed, 24 May 2017 14:54:37 +0900 Subject: [PATCH 0115/1105] Fix type to use correct NavLinkProps --- types/react-router-bootstrap/lib/IndexLinkContainer.d.ts | 6 +++--- types/react-router-bootstrap/lib/LinkContainer.d.ts | 4 ++-- .../react-router-bootstrap/react-router-bootstrap-tests.tsx | 1 + 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/types/react-router-bootstrap/lib/IndexLinkContainer.d.ts b/types/react-router-bootstrap/lib/IndexLinkContainer.d.ts index 6deafb847a..10db7e399e 100644 --- a/types/react-router-bootstrap/lib/IndexLinkContainer.d.ts +++ b/types/react-router-bootstrap/lib/IndexLinkContainer.d.ts @@ -1,9 +1,9 @@ import { ComponentClass } from "react"; -import { LinkProps } from "react-router-dom"; +import { NavLinkProps } from "react-router-dom"; -//IndexLink is removed in react-router, but continues there in react-router-bootstrap for backwards compatibility. +//IndexLink is removed in react-router, but continues there in react-router-bootstrap for backwards compatibility. //Better use -type IndexLinkContainer = ComponentClass; +type IndexLinkContainer = ComponentClass; declare const IndexLinkContainer: IndexLinkContainer; export default IndexLinkContainer; diff --git a/types/react-router-bootstrap/lib/LinkContainer.d.ts b/types/react-router-bootstrap/lib/LinkContainer.d.ts index 95ee85ed48..b6fe025053 100644 --- a/types/react-router-bootstrap/lib/LinkContainer.d.ts +++ b/types/react-router-bootstrap/lib/LinkContainer.d.ts @@ -1,7 +1,7 @@ import { ComponentClass } from "react"; -import { LinkProps } from "react-router-dom"; +import { NavLinkProps } from "react-router-dom"; -type LinkContainer = ComponentClass; +type LinkContainer = ComponentClass; declare const LinkContainer: LinkContainer; export default LinkContainer; diff --git a/types/react-router-bootstrap/react-router-bootstrap-tests.tsx b/types/react-router-bootstrap/react-router-bootstrap-tests.tsx index 7816933fe6..455446f225 100644 --- a/types/react-router-bootstrap/react-router-bootstrap-tests.tsx +++ b/types/react-router-bootstrap/react-router-bootstrap-tests.tsx @@ -15,6 +15,7 @@ export class ReactRouterBootstrapTest extends Component {
+
From b918472ea5c2bfdba70bce1d818e804b986ff736 Mon Sep 17 00:00:00 2001 From: LKay Date: Wed, 24 May 2017 16:07:46 +0900 Subject: [PATCH 0116/1105] Remove unnecessary export --- types/react-icon-base/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-icon-base/index.d.ts b/types/react-icon-base/index.d.ts index 11628505e0..121b846ed8 100644 --- a/types/react-icon-base/index.d.ts +++ b/types/react-icon-base/index.d.ts @@ -9,7 +9,7 @@ import * as React from "react"; export = IconBaseClass; declare namespace IconBaseClass { - export interface IconBaseProps { + interface IconBaseProps { color?: string; size?: string | number; style?: React.CSSProperties; From 7c3baa4616a9c634f6242f9035030007390f512c Mon Sep 17 00:00:00 2001 From: Eliot Fallon Date: Wed, 24 May 2017 10:05:42 +0100 Subject: [PATCH 0117/1105] Added a new type to better restrict playsinline parameter to 1 or 0. --- types/youtube/index.d.ts | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/types/youtube/index.d.ts b/types/youtube/index.d.ts index 5a2dc3f19e..11e2a4e30d 100644 --- a/types/youtube/index.d.ts +++ b/types/youtube/index.d.ts @@ -251,6 +251,22 @@ declare namespace YT */ Modest = 1 } + + /** + * Whether to playback video inline or full-screen in an HTML5 player on iOS + */ + export const enum PlaysInline + { + /** + * Playback in fullscreen. + */ + Fullscreen = 0, + + /** + * Playback inline + */ + Inline = 1 + } /** * Whether to show related videos after the video finishes. @@ -267,7 +283,7 @@ declare namespace YT */ Show = 1 } - + /** * Whether to show video information before playing. */ @@ -521,9 +537,9 @@ declare namespace YT playlist?: string; /** - * Whether videos play inline or fullscreen in an HTML5 player on iOS. Valid values are: 1 or 0. + * Whether videos play inline or fullscreen in an HTML5 player on iOS. (currently by default, Fullscreen). */ - playsinline?: number; + playsinline?: PlaysInline; /** * Whether to show related videos after the video finishes (by default, Show). From b8b1b9d1accadc39f3cdf55e407d498f5df70d6e Mon Sep 17 00:00:00 2001 From: Marius Olbertz Date: Wed, 24 May 2017 14:44:18 +0200 Subject: [PATCH 0118/1105] Make addWidget take HTMLElement or jQuery element Although the docs are not 100% accurate, [this code here](https://github.com/troolee/gridstack.js/blob/develop/src/gridstack.js#L1271) shows that the first parameter is wrapped with jQuery, thus making `HTMLElement` and `JQuery` also valid types. --- types/gridstack/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/gridstack/index.d.ts b/types/gridstack/index.d.ts index 8d912e3a33..b1c5f14c0f 100644 --- a/types/gridstack/index.d.ts +++ b/types/gridstack/index.d.ts @@ -14,14 +14,14 @@ interface GridStack { * * Widget will be always placed even if result height is more than actual grid height. You need to use willItFit method before calling addWidget for additional check. * - * @param {string} el widget to add + * @param {string | HTMLElement | JQuery} el widget to add * @param {number} x widget position x * @param {number} y widget position y * @param {number} width widget dimension width * @param {number} height widget dimension height * @param {boolean} autoPosition if true then x, y parameters will be ignored and widget will be places on the first available position */ - addWidget(el: string, x?: number, y?: number, width?: number, height?: number, autoPosition?: boolean, minWidth?: number, maxWidth?: number, minHeight?: number, maxHeight?: number, id?: number): JQuery + addWidget(el: string | HTMLElement | JQuery, x?: number, y?: number, width?: number, height?: number, autoPosition?: boolean, minWidth?: number, maxWidth?: number, minHeight?: number, maxHeight?: number, id?: number): JQuery /** * Initializes batch updates. You will see no changes until commit method is called. */ From 1f1491ee8b65ab25365e0e1f7a4b52ba3c71da0b Mon Sep 17 00:00:00 2001 From: "FUJI Goro (gfx)" Date: Wed, 24 May 2017 22:47:26 +0900 Subject: [PATCH 0119/1105] fix type of react-intl/{FormattedDate,FormattedTime,FormattedRelative} --- types/react-intl/index.d.ts | 14 ++++++----- types/react-intl/react-intl-tests.tsx | 34 +++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 6 deletions(-) diff --git a/types/react-intl/index.d.ts b/types/react-intl/index.d.ts index 2b55a471ec..9777987c8d 100644 --- a/types/react-intl/index.d.ts +++ b/types/react-intl/index.d.ts @@ -11,6 +11,8 @@ declare namespace ReactIntl { + type DateSource = Date | string | number; + interface Locale { locale: string; fields?: { [key: string]: string }, @@ -62,9 +64,9 @@ declare namespace ReactIntl { const intlShape: IntlShape; interface InjectedIntl { - formatDate: (date: Date, options?: FormattedDate.PropsBase) => string; - formatTime: (date: Date, options?: FormattedTime.PropsBase) => string; - formatRelative: (value: number, options?: FormattedRelative.PropsBase & { now?: any }) => string; + formatDate: (value: DateSource, options?: FormattedDate.PropsBase) => string; + formatTime: (value: DateSource, options?: FormattedTime.PropsBase) => string; + formatRelative: (value: DateSource, options?: FormattedRelative.PropsBase & { now?: any }) => string; formatNumber: (value: number, options?: FormattedNumber.PropsBase) => string; formatPlural: (value: number, options?: FormattedPlural.Base) => keyof FormattedPlural.PropsBase; formatMessage: (messageDescriptor: FormattedMessage.MessageDescriptor, values?: {[key: string]: string | number}) => string; @@ -91,7 +93,7 @@ declare namespace ReactIntl { export interface PropsBase extends IntlComponent.DateTimeFormatProps {} export interface Props extends PropsBase { - value: Date; + value: DateSource; } } @@ -101,7 +103,7 @@ declare namespace ReactIntl { export interface PropsBase extends IntlComponent.DateTimeFormatProps {} export interface Props extends PropsBase { - value: Date; + value: DateSource; } } class FormattedTime extends React.Component { } @@ -122,7 +124,7 @@ declare namespace ReactIntl { } export interface Props extends PropsBase { - value: number; + value: DateSource; } } diff --git a/types/react-intl/react-intl-tests.tsx b/types/react-intl/react-intl-tests.tsx index a9717147e9..8b21ef8651 100644 --- a/types/react-intl/react-intl-tests.tsx +++ b/types/react-intl/react-intl-tests.tsx @@ -165,6 +165,23 @@ class SomeComponent extends React.Component + + + + {(formattedNum: string) => ( {formattedNum} From 6f9df7ac43fd38d92a8bc52d4a45a5dfacbb7ec9 Mon Sep 17 00:00:00 2001 From: Marius Olbertz Date: Wed, 24 May 2017 16:05:34 +0200 Subject: [PATCH 0120/1105] Add tests for addWidget --- types/gridstack/gridstack-tests.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/gridstack/gridstack-tests.ts b/types/gridstack/gridstack-tests.ts index 9330d2019e..0ef4a7691b 100644 --- a/types/gridstack/gridstack-tests.ts +++ b/types/gridstack/gridstack-tests.ts @@ -17,6 +17,8 @@ var gsFromElement: GridStack = element.data("gridstack"); if (gridstack !== gsFromElement) throw Error('These should match!'); gridstack.addWidget("test", 1, 2, 3, 4, true); +gridstack.addWidget(document.createElement('div'), 1, 2, 3, 4, true); +gridstack.addWidget($(document.createElement('div')), 1, 2, 3, 4, true); gridstack.batchUpdate(); gridstack.cellHeight();; gridstack.cellHeight(2); From 4a362a17c38eb1cf6a453bc8d7d82bea35536b7e Mon Sep 17 00:00:00 2001 From: york yao Date: Wed, 24 May 2017 22:11:17 +0800 Subject: [PATCH 0121/1105] improve types of qrcode@0.8.2 --- types/qrcode/index.d.ts | 218 +++++++++++++++++++++++++++++++---- types/qrcode/qrcode-tests.ts | 58 ++++++++-- 2 files changed, 243 insertions(+), 33 deletions(-) diff --git a/types/qrcode/index.d.ts b/types/qrcode/index.d.ts index f3f355d90b..cb2ce4a9b7 100644 --- a/types/qrcode/index.d.ts +++ b/types/qrcode/index.d.ts @@ -1,35 +1,203 @@ -// Type definitions for qrcode +// Type definitions for qrcode 0.8.2 // Project: https://github.com/soldair/node-qrcode // Definitions by: York Yao // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -type QRCodeOptions = { - errorCorrectLevel?: "minimum" | "medium" | "high" | "max"; +/// + +import * as stream from "stream"; + +export interface QRCodeOptions { + /** + * QR Code version. If not specified the more suitable value will be calculated. + */ + version?: number; + /** + * Error correction level. + * Possible values are low, medium, quartile, high or L, M, Q, H. + * Default: M + */ + errorCorrectionLevel?: "low" | "medium" | "quartile" | "high" | "L" | "M" | "Q" | "H"; + /** + * Helper function used internally to convert a kanji to its Shift JIS value. + * Provide this function if you need support for Kanji mode. + */ + toSJISFunc?: Function; } -declare module "qrcode" { - var qrcode: { - toDataURL(text: string, callback: (error: Error, dataURL: string) => void): void; - toDataURL(text: string, options: QRCodeOptions, callback: (error: Error, dataURL: string) => void): void; - draw(text: string, callback: (error: Error, canvas: HTMLCanvasElement) => void): void; - draw(text: string, options: QRCodeOptions, callback: (error: Error, canvas: HTMLCanvasElement) => void): void; - drawSvg(text: string, callback: (error: Error, svgString: string) => void): void; - drawSvg(text: string, options: QRCodeOptions, callback: (error: Error, svgString: string) => void): void; - save(path: string, text: string, callback: (error: Error, written: any) => void): void; - save(path: string, text: string, options: QRCodeOptions, callback: (error: Error, written: any) => void): void; - drawText(text: string, callback: (error: Error) => void): void; - drawText(text: string, options: QRCodeOptions, callback: (error: Error) => void): void; - drawBitArray(text: string, callback: (error: Error, bits: any, width: number) => void): void; - drawBitArray(text: string, options: QRCodeOptions, callback: (error: Error, bits: any, width: number) => void): void; +export interface QRCodeToDataURLOptions extends QRCodeRenderersOptions { + /** + * Data URI format. + * Default: image/png + */ + type?: "image/png" | "image/jpeg" | "image/webp"; + rendererOpts?: { + /** + * A Number between 0 and 1 indicating image quality if the requested type is image/jpeg or image/webp. + * Default: 0.92 + */ + quality?: number; }; - export = qrcode; } -declare var QRCodeLib: { - QRCodeDraw: { - new (): { - draw(element: HTMLCanvasElement, text: string, callback: (error: Error, canvas: HTMLCanvasElement) => void): void; - draw(element: HTMLCanvasElement, text: string, options: QRCodeOptions, callback: (error: Error, canvas: HTMLCanvasElement) => void): void; - } +export interface QRCodeToStringOptions extends QRCodeOptions { + /** + * Output format. + * Default: utf8 + */ + type?: "utf8" | "svg" | "terminal"; +} + +export interface QRCodeToFileOptions extends QRCodeRenderersOptions { + /** + * Output format. + * Default: png + */ + type?: "png" | "svg" | "utf8"; + rendererOpts?: { + /** + * Compression level for deflate. + * Default: 9 + */ + deflateLevel?: number; + /** + * Compression strategy for deflate. + * Default: 3 + */ + deflateStrategy?: number; }; -}; +} + +export interface QRCodeRenderersOptions extends QRCodeOptions { + /** + * Define how much wide the quiet zone should be. + * Default: 4 + */ + margin?: number; + /** + * Scale factor. A value of 1 means 1px per modules (black dots). + * Default: 4 + */ + scale?: number; + color?: { + /** + * Color of dark module. Value must be in hex format (RGBA). + * Note: dark color should always be darker than color.light. + * Default: #000000ff + */ + dark?: string; + /** + * Color of light module. Value must be in hex format (RGBA). + * Default: #ffffffff + */ + light?: string; + }; +} + +export interface QRCodeSegment { + data: string; + mode: 'alphanumeric' | 'numeric'; +} + +export interface QRCode { + /** + * Bitmatrix class with modules data + */ + modules: any; + /** + * Calculated QR Code version + */ + version: number; + /** + * Error Correction Level + */ + errorCorrectionLevel: number; + /** + * Calculated Mask pattern + */ + maskPattern: any; + /** + * Generated segments + */ + segments: QRCodeSegment[]; +} + +/** + * Creates QR Code symbol and returns a qrcode object. + */ +export function create(text: string | QRCodeSegment[], options: QRCodeOptions): QRCode; + +/** + * Draws qr code symbol to canvas. + */ +export function toCanvas(canvasElement: HTMLCanvasElement, text: string | QRCodeSegment[], callback: (error: Error) => void): void; +/** + * Draws qr code symbol to canvas. + */ +export function toCanvas(canvasElement: HTMLCanvasElement, text: string | QRCodeSegment[], options: QRCodeOptions, callback: (error: Error) => void): void; +/** + * Draws qr code symbol to canvas. + */ +export function toCanvas(text: string | QRCodeSegment[], callback: (error: Error, canvas: HTMLCanvasElement) => void): void; +/** + * Draws qr code symbol to canvas. + */ +export function toCanvas(text: string | QRCodeSegment[], options: QRCodeOptions, callback: (error: Error, canvas: HTMLCanvasElement) => void): void; +/** + * Draws qr code symbol to node canvas. + */ +export function toCanvas(canvas: any, text: string | QRCodeSegment[], callback: (error: Error) => void): void; +/** + * Draws qr code symbol to node canvas. + */ +export function toCanvas(canvas: any, text: string | QRCodeSegment[], options: QRCodeOptions, callback: (error: Error) => void): void; + +/** + * Returns a Data URI containing a representation of the QR Code image. + */ +export function toDataURL(canvasElement: HTMLCanvasElement, text: string | QRCodeSegment[], callback: (error: Error, url: string) => void): void; +/** + * Returns a Data URI containing a representation of the QR Code image. + */ +export function toDataURL(canvasElement: HTMLCanvasElement, text: string | QRCodeSegment[], options: QRCodeToDataURLOptions, callback: (error: Error, url: string) => void): void; +/** + * Returns a Data URI containing a representation of the QR Code image. + */ +export function toDataURL(text: string | QRCodeSegment[], callback: (error: Error, url: string) => void): void; +/** + * Returns a Data URI containing a representation of the QR Code image. + */ +export function toDataURL(text: string | QRCodeSegment[], options: QRCodeToDataURLOptions, callback: (error: Error, url: string) => void): void; + +/** + * Returns a string representation of the QR Code. + * If choosen output format is svg it will returns a string containing xml code. + */ +export function toString(text: string | QRCodeSegment[], callback: (error: Error, string: string) => void): void; +/** + * Returns a string representation of the QR Code. + * If choosen output format is svg it will returns a string containing xml code. + */ +export function toString(text: string | QRCodeSegment[], options: QRCodeToStringOptions, callback: (error: Error, string: string) => void): void; + +/** + * Saves QR Code to image file. + * If options.type is not specified, the format will be guessed from file extension. + * Recognized extensions are png, svg, txt. + */ +export function toFile(path: string, text: string | QRCodeSegment[], callback: (error: Error) => void): void; +/** + * Saves QR Code to image file. + * If options.type is not specified, the format will be guessed from file extension. + * Recognized extensions are png, svg, txt. + */ +export function toFile(path: string, text: string | QRCodeSegment[], options: QRCodeToFileOptions, callback: (error: Error) => void): void; + +/** + * Writes QR Code image to stream. Only works with png format for now. + */ +export function toFileStream(stream: stream.Writable, text: string | QRCodeSegment[], callback: (error: Error) => void): void; +/** + * Writes QR Code image to stream. Only works with png format for now. + */ +export function toFileStream(stream: stream.Writable, text: string | QRCodeSegment[], options: QRCodeOptions, callback: (error: Error) => void): void; diff --git a/types/qrcode/qrcode-tests.ts b/types/qrcode/qrcode-tests.ts index eecfb4a0d1..6a94a5f580 100644 --- a/types/qrcode/qrcode-tests.ts +++ b/types/qrcode/qrcode-tests.ts @@ -1,14 +1,56 @@ import * as QRCode from 'qrcode'; -QRCode.toDataURL('i am a pony!', function (err, url) { +const canvas = document.getElementById('canvas') as HTMLCanvasElement; + +QRCode.toCanvas(canvas, 'sample text', function (error) { + if (error) console.error(error) + console.log('success!'); +}); + +QRCode.toDataURL('I am a pony!', function (err, url) { console.log(url); }); -var qrcodedraw = new QRCodeLib.QRCodeDraw(); - -qrcodedraw.draw(document.getElementById('test') as HTMLCanvasElement, "this text will be in the code!", function (error, canvas) { - if (error) { - return console.log('Error =( ', error); - } - console.log('success!'); +QRCode.toDataURL('some text', { errorCorrectionLevel: 'H' }, function (err, url) { + console.log(url); +}); + +QRCode.toDataURL('some text', { version: 2 }, function (err, url) { + console.log(url); +}); + +QRCode.toDataURL([ + { data: 'ABCDEFG', mode: 'alphanumeric' }, + { data: '0123456', mode: 'numeric' } +], function (err, url) { + console.log(url); +}); + +QRCode.toCanvas('text', { errorCorrectionLevel: 'H' }, function (err, canvas) { + if (err) throw err; +}); + +QRCode.toDataURL('text', { + errorCorrectionLevel: 'H', + type: 'image/jpeg', + rendererOpts: { + quality: 0.3 + } +}, function (err, url) { + if (err) throw err; +}); + +QRCode.toString('http://www.google.com', function (err, string) { + if (err) throw err; + console.log(string); +}); + +QRCode.toFile('path/to/filename.png', 'Some text', { + color: { + dark: '#00F', // Blue dots + light: '#0000' // Transparent background + } +}, function (err) { + if (err) throw err; + console.log('done'); }); From 5b4c1f883233a0018dbec1010d6da3e87b83bc3d Mon Sep 17 00:00:00 2001 From: Andrea Briganti Date: Wed, 24 May 2017 16:25:53 +0200 Subject: [PATCH 0122/1105] Add jquery-match-height typings --- types/jquery-match-height/index.d.ts | 29 +++++++++++++++ .../jquery-match-height-tests.ts | 36 +++++++++++++++++++ types/jquery-match-height/tsconfig.json | 23 ++++++++++++ 3 files changed, 88 insertions(+) create mode 100644 types/jquery-match-height/index.d.ts create mode 100644 types/jquery-match-height/jquery-match-height-tests.ts create mode 100644 types/jquery-match-height/tsconfig.json diff --git a/types/jquery-match-height/index.d.ts b/types/jquery-match-height/index.d.ts new file mode 100644 index 0000000000..e17cb841c0 --- /dev/null +++ b/types/jquery-match-height/index.d.ts @@ -0,0 +1,29 @@ +// Type definitions for jquery-match-height v0.7.2 +// Project: https://github.com/liabru/jquery-match-height +// Definitions by: Andrea Briganti +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +// We cannot add the jQuery.fn definitions of the plugin until this +// issue is resolved +// https://github.com/DefinitelyTyped/DefinitelyTyped/issues/12685 + +declare namespace JQueryMatchHeight { + interface Options { + byRow?: boolean, + property?: string, + target?: string, + remove?: boolean + } +} + +interface JQuery { + /** + * Set all selected elements to the height of the tallest. + * If the items are on multiple rows, the items of each row will be set to the tallest of that row. + * + * @param options + */ + matchHeight(options?: JQueryMatchHeight.Options): JQuery; +} diff --git a/types/jquery-match-height/jquery-match-height-tests.ts b/types/jquery-match-height/jquery-match-height-tests.ts new file mode 100644 index 0000000000..3adc5936a7 --- /dev/null +++ b/types/jquery-match-height/jquery-match-height-tests.ts @@ -0,0 +1,36 @@ +/* from documentation at https://github.com/liabru/jquery-match-height */ + +$(document).ready(() => { + $(".containers").matchHeight(); + $(".containers").matchHeight({ + byRow: true, + property: "height", + target: null, + remove: true} + ); +}); + +$.fn.matchHeight._update(); + +$.fn.matchHeight._rows($('.containers')); + +$('.containers').matchHeight({ remove: true }); + +$.fn.matchHeight._beforeUpdate = function(event: any, groups: any) { + // do something before any updates are applied +}; + +$.fn.matchHeight._afterUpdate = function(event: any, groups: any) { + // do something after all updates are applied +}; + +let elements = $('.containers'); +let options = {byRow: true}; + +$.fn.matchHeight._apply(elements, options); + +$.fn.matchHeight._throttle = 80; + +$.fn.matchHeight._maintainScroll = true; + +$.fn.matchHeight._groups diff --git a/types/jquery-match-height/tsconfig.json b/types/jquery-match-height/tsconfig.json new file mode 100644 index 0000000000..f90e113f27 --- /dev/null +++ b/types/jquery-match-height/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "jquery-match-height-tests.ts" + ] +} From 3248ac28b49b09c89938c8865ac304f372385e34 Mon Sep 17 00:00:00 2001 From: Andrea Briganti Date: Wed, 24 May 2017 16:37:04 +0200 Subject: [PATCH 0123/1105] jquery-match-height tslint --- types/jquery-match-height/index.d.ts | 10 +++++----- types/jquery-match-height/jquery-match-height-tests.ts | 8 +++++--- types/jquery-match-height/tslint.json | 7 +++++++ 3 files changed, 17 insertions(+), 8 deletions(-) create mode 100644 types/jquery-match-height/tslint.json diff --git a/types/jquery-match-height/index.d.ts b/types/jquery-match-height/index.d.ts index e17cb841c0..0d25344e65 100644 --- a/types/jquery-match-height/index.d.ts +++ b/types/jquery-match-height/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for jquery-match-height v0.7.2 +// Type definitions for jquery-match-height 0.7 // Project: https://github.com/liabru/jquery-match-height // Definitions by: Andrea Briganti // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -11,10 +11,10 @@ declare namespace JQueryMatchHeight { interface Options { - byRow?: boolean, - property?: string, - target?: string, - remove?: boolean + byRow?: boolean; + property?: string; + target?: string; + remove?: boolean; } } diff --git a/types/jquery-match-height/jquery-match-height-tests.ts b/types/jquery-match-height/jquery-match-height-tests.ts index 3adc5936a7..ad0eedcdc3 100644 --- a/types/jquery-match-height/jquery-match-height-tests.ts +++ b/types/jquery-match-height/jquery-match-height-tests.ts @@ -16,11 +16,13 @@ $.fn.matchHeight._rows($('.containers')); $('.containers').matchHeight({ remove: true }); -$.fn.matchHeight._beforeUpdate = function(event: any, groups: any) { +// tslint:disable-next-line no-used-variable +$.fn.matchHeight._beforeUpdate = (event: any, groups: any) => { // do something before any updates are applied }; -$.fn.matchHeight._afterUpdate = function(event: any, groups: any) { +// tslint:disable-next-line no-used-variable +$.fn.matchHeight._afterUpdate = (event: any, groups: any) => { // do something after all updates are applied }; @@ -33,4 +35,4 @@ $.fn.matchHeight._throttle = 80; $.fn.matchHeight._maintainScroll = true; -$.fn.matchHeight._groups +$.fn.matchHeight._groups; diff --git a/types/jquery-match-height/tslint.json b/types/jquery-match-height/tslint.json new file mode 100644 index 0000000000..c9a409bbed --- /dev/null +++ b/types/jquery-match-height/tslint.json @@ -0,0 +1,7 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + // This package uses the Function type, and it will take effort to fix. + "ban-types": false + } +} From a1d65618d82a65983b06168bbc42d3cc3753fbb0 Mon Sep 17 00:00:00 2001 From: Andrea Briganti Date: Wed, 24 May 2017 17:22:24 +0200 Subject: [PATCH 0124/1105] jquery-match-height pr fixes --- types/jquery-match-height/jquery-match-height-tests.ts | 1 - types/jquery-match-height/tsconfig.json | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/types/jquery-match-height/jquery-match-height-tests.ts b/types/jquery-match-height/jquery-match-height-tests.ts index ad0eedcdc3..d26f29fa9a 100644 --- a/types/jquery-match-height/jquery-match-height-tests.ts +++ b/types/jquery-match-height/jquery-match-height-tests.ts @@ -5,7 +5,6 @@ $(document).ready(() => { $(".containers").matchHeight({ byRow: true, property: "height", - target: null, remove: true} ); }); diff --git a/types/jquery-match-height/tsconfig.json b/types/jquery-match-height/tsconfig.json index f90e113f27..2dd28f9c69 100644 --- a/types/jquery-match-height/tsconfig.json +++ b/types/jquery-match-height/tsconfig.json @@ -7,7 +7,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" From a524192bf5fe8472feea0dbee5c5100ce94512df Mon Sep 17 00:00:00 2001 From: Cameron Little Date: Wed, 24 May 2017 09:34:25 -0700 Subject: [PATCH 0125/1105] Add `Component

` class This allows declaring a parameter or variable as a general "component with props P" instead of needing to declare it class based or function. --- types/react/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/react/index.d.ts b/types/react/index.d.ts index e9aa299934..26a77b8055 100644 --- a/types/react/index.d.ts +++ b/types/react/index.d.ts @@ -26,6 +26,7 @@ declare namespace React { // ---------------------------------------------------------------------- type ReactType = string | ComponentClass | StatelessComponent; + type Component

= ComponentClass

| StatelessComponent

; type Key = string | number; type Ref = string | ((instance: T) => any); From bedfaf0249d23f5b960ae1cbf1a1f00b8c97ecb2 Mon Sep 17 00:00:00 2001 From: Cameron Little Date: Wed, 24 May 2017 09:40:34 -0700 Subject: [PATCH 0126/1105] Update index.d.ts --- types/react/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react/index.d.ts b/types/react/index.d.ts index 26a77b8055..2d6a3c6d08 100644 --- a/types/react/index.d.ts +++ b/types/react/index.d.ts @@ -26,7 +26,7 @@ declare namespace React { // ---------------------------------------------------------------------- type ReactType = string | ComponentClass | StatelessComponent; - type Component

= ComponentClass

| StatelessComponent

; + type ReactComponent

= ComponentClass

| StatelessComponent

; type Key = string | number; type Ref = string | ((instance: T) => any); From 106d8bd25a6f90e8660c257600a11d7e09c3f8f3 Mon Sep 17 00:00:00 2001 From: Horus Lugo Date: Wed, 24 May 2017 22:27:56 +0200 Subject: [PATCH 0127/1105] Fixes a typo on routerActions's symbol name Changes symbol name from 'routerAction' to 'routerActions'. --- types/react-router-redux/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-router-redux/index.d.ts b/types/react-router-redux/index.d.ts index e224f92530..8432000793 100644 --- a/types/react-router-redux/index.d.ts +++ b/types/react-router-redux/index.d.ts @@ -41,7 +41,7 @@ export function go(n: number): RouterAction; export function goBack(): RouterAction; export function goForward(): RouterAction; -export const routerAction: { +export const routerActions: { push: typeof push replace: typeof replace go: typeof go From bc6bf3c3161ac67abb982bb439d3cf622a94f596 Mon Sep 17 00:00:00 2001 From: Alexander James Phillips Date: Thu, 25 May 2017 01:49:23 +0100 Subject: [PATCH 0128/1105] Add example of using initialValues --- types/redux-form/redux-form-tests.tsx | 60 +++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/types/redux-form/redux-form-tests.tsx b/types/redux-form/redux-form-tests.tsx index 798327f60c..b575269143 100644 --- a/types/redux-form/redux-form-tests.tsx +++ b/types/redux-form/redux-form-tests.tsx @@ -81,3 +81,63 @@ reduxForm({ form: 'forceUnregisterOnMountForm', forceUnregisterOnUnmount: true }); + +// adapted from: http://redux-form.com/6.0.0-alpha.4/examples/initializeFromState/ + +import { connect } from 'react-redux' +const { DOM: { input } } = React + +interface DataShape { + firstName: string; +} + +interface Props extends FormProps {} + +let InitializeFromStateFormFunction = (props: Props) => { + const { handleSubmit, pristine, reset, submitting } = props; + return ( +

+
+ +
+ +
+
+
+ + +
+
+ ); +} + +// Decorate with reduxForm(). It will read the initialValues prop provided by connect() +const DecoratedInitializeFromStateFormFunction = reduxForm({ + form: 'initializeFromState' // a unique identifier for this form +})(InitializeFromStateFormFunction) + +// You have to connect() to any reducers that you wish to connect to yourself +const ConnectedDecoratedInitializeFromStateFormFunction = connect( + state => ({ + initialValues: state.account.data // pull initial values from account reducer + }), +)(DecoratedInitializeFromStateFormFunction); + +// React ComponentClass instead of StatelessComponent + +class InitializeFromStateFormClass extends React.Component { + render() { + return InitializeFromStateFormFunction(this.props); + } +} + +// Decorate with reduxForm(). It will read the initialValues prop provided by connect() +const DecoratedInitializeFromStateFormClass = reduxForm({ + form: 'initializeFromState' // a unique identifier for this form +})(InitializeFromStateFormClass); + +// You have to connect() to any reducers that you wish to connect to yourself +const mapStateToProps = (state: any) => ({ + initialValues: { firstName: "some value" } // pull initial values from account reducer +} as {initialValues?: Partial}); +const ConnectedDecoratedInitializeFromStateFormClass = connect(mapStateToProps)(DecoratedInitializeFromStateFormClass); From 8e9543bf94ed676265b1edb4f59c8cddb0b8b3bb Mon Sep 17 00:00:00 2001 From: Alexander James Phillips Date: Thu, 25 May 2017 02:56:44 +0100 Subject: [PATCH 0129/1105] Update redux-form-tests.tsx Improve test examples use of state --- types/redux-form/redux-form-tests.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/redux-form/redux-form-tests.tsx b/types/redux-form/redux-form-tests.tsx index b575269143..d14b7a35cd 100644 --- a/types/redux-form/redux-form-tests.tsx +++ b/types/redux-form/redux-form-tests.tsx @@ -138,6 +138,6 @@ const DecoratedInitializeFromStateFormClass = reduxForm({ // You have to connect() to any reducers that you wish to connect to yourself const mapStateToProps = (state: any) => ({ - initialValues: { firstName: "some value" } // pull initial values from account reducer + initialValues: { firstName: state.account.data.firstName } // pull initial values from account reducer } as {initialValues?: Partial}); const ConnectedDecoratedInitializeFromStateFormClass = connect(mapStateToProps)(DecoratedInitializeFromStateFormClass); From c34962bc59ffe35185dd67e2e9604eb69be10a35 Mon Sep 17 00:00:00 2001 From: Cameron Little Date: Thu, 25 May 2017 09:29:01 -0700 Subject: [PATCH 0130/1105] Update index.d.ts --- types/react/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react/index.d.ts b/types/react/index.d.ts index 2d6a3c6d08..17141985da 100644 --- a/types/react/index.d.ts +++ b/types/react/index.d.ts @@ -26,7 +26,7 @@ declare namespace React { // ---------------------------------------------------------------------- type ReactType = string | ComponentClass | StatelessComponent; - type ReactComponent

= ComponentClass

| StatelessComponent

; + type ComponentType

= ComponentClass

| StatelessComponent

; type Key = string | number; type Ref = string | ((instance: T) => any); From cbb74ca81c516cda8c3040d00203cc1f1eeac234 Mon Sep 17 00:00:00 2001 From: Aluan Haddad Date: Thu, 25 May 2017 13:21:21 -0400 Subject: [PATCH 0131/1105] Export DeepReadonly via declaration merging --- types/deep-freeze/index.d.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/types/deep-freeze/index.d.ts b/types/deep-freeze/index.d.ts index d96003a6be..809db01dfe 100644 --- a/types/deep-freeze/index.d.ts +++ b/types/deep-freeze/index.d.ts @@ -6,8 +6,10 @@ export = deepFreeze; -declare function deepFreeze(a: T[]): ReadonlyArray>; +declare function deepFreeze(a: T[]): ReadonlyArray>; declare function deepFreeze(f: T): T; -declare function deepFreeze(o: T): DeepReadonly; +declare function deepFreeze(o: T): deepFreeze.DeepReadonly; -type DeepReadonly = Readonly<{ [P in keyof T]: DeepReadonly }>; +declare namespace deepFreeze { + export type DeepReadonly = Readonly<{ [P in keyof T]: DeepReadonly }>; +} From 6a2127b2be99eb03ea3e86c96a9e81b941a514a7 Mon Sep 17 00:00:00 2001 From: Aluan Haddad Date: Thu, 25 May 2017 13:34:43 -0400 Subject: [PATCH 0132/1105] lint --- types/deep-freeze/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/deep-freeze/index.d.ts b/types/deep-freeze/index.d.ts index 809db01dfe..2e08d1532a 100644 --- a/types/deep-freeze/index.d.ts +++ b/types/deep-freeze/index.d.ts @@ -11,5 +11,5 @@ declare function deepFreeze(f: T): T; declare function deepFreeze(o: T): deepFreeze.DeepReadonly; declare namespace deepFreeze { - export type DeepReadonly = Readonly<{ [P in keyof T]: DeepReadonly }>; + type DeepReadonly = Readonly<{ [P in keyof T]: DeepReadonly }>; } From 5552b831b90dbfa8e30d8f3e69bfad0cc2002413 Mon Sep 17 00:00:00 2001 From: Cameron Little Date: Thu, 25 May 2017 13:06:38 -0700 Subject: [PATCH 0133/1105] Update index.d.ts --- types/react/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react/index.d.ts b/types/react/index.d.ts index 17141985da..b52c4b6aa6 100644 --- a/types/react/index.d.ts +++ b/types/react/index.d.ts @@ -25,7 +25,7 @@ declare namespace React { // React Elements // ---------------------------------------------------------------------- - type ReactType = string | ComponentClass | StatelessComponent; + type ReactType = string | ComponentType; type ComponentType

= ComponentClass

| StatelessComponent

; type Key = string | number; From 7309ef449891f2b3e4b5f4ce6d4b191020a45c39 Mon Sep 17 00:00:00 2001 From: Aaron Petcoff Date: Thu, 25 May 2017 17:40:39 -0400 Subject: [PATCH 0134/1105] adds promise to PoolConfig in pg --- types/pg/index.d.ts | 3 ++- types/pg/pg-tests.ts | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/types/pg/index.d.ts b/types/pg/index.d.ts index 6a2bd068d5..2b442b1227 100644 --- a/types/pg/index.d.ts +++ b/types/pg/index.d.ts @@ -42,6 +42,7 @@ export interface PoolConfig extends ClientConfig { reapIntervalMillis?: number; returnToHead?: boolean; application_name?: string; + Promise?: PromiseConstructorLike; } export interface QueryConfig { @@ -71,7 +72,7 @@ export declare class Pool extends events.EventEmitter { connect(callback: (err: Error, client: Client, done: () => void) => void): void; end(): Promise; - + query(queryStream: QueryConfig & stream.Readable): stream.Readable; query(queryTextOrConfig: string | QueryConfig): Promise; query(queryText: string, values: any[]): Promise; diff --git a/types/pg/pg-tests.ts b/types/pg/pg-tests.ts index bdf49ab240..989a35ea87 100644 --- a/types/pg/pg-tests.ts +++ b/types/pg/pg-tests.ts @@ -1,5 +1,6 @@ import * as pg from "pg"; +import * as bluebird "bluebird"; var conString = "postgres://username:password@localhost/database"; @@ -54,6 +55,7 @@ var config = { port: 5432, //env var: PGPORT max: 10, // max number of clients in the pool idleTimeoutMillis: 30000, // how long a client is allowed to remain idle before being closed + Promise: bluebird }; var pool = new pg.Pool(config); From ee909ca4979c3f9b2add7d93ce502158aa3755c0 Mon Sep 17 00:00:00 2001 From: Aaron Petcoff Date: Thu, 25 May 2017 17:49:47 -0400 Subject: [PATCH 0135/1105] duh forgot to add the word 'from' --- types/pg/pg-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/pg/pg-tests.ts b/types/pg/pg-tests.ts index 989a35ea87..2fe301935a 100644 --- a/types/pg/pg-tests.ts +++ b/types/pg/pg-tests.ts @@ -1,6 +1,6 @@ import * as pg from "pg"; -import * as bluebird "bluebird"; +import * as bluebird from "bluebird"; var conString = "postgres://username:password@localhost/database"; From 8fb52b5f6c84c4c0d641f308ed3d556c5247d9fc Mon Sep 17 00:00:00 2001 From: Aluan Haddad Date: Fri, 26 May 2017 11:08:36 -0400 Subject: [PATCH 0136/1105] Update deep-freeze-tests.ts Fix tests --- types/deep-freeze/deep-freeze-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/deep-freeze/deep-freeze-tests.ts b/types/deep-freeze/deep-freeze-tests.ts index 40be1faa47..b8a6061859 100644 --- a/types/deep-freeze/deep-freeze-tests.ts +++ b/types/deep-freeze/deep-freeze-tests.ts @@ -4,4 +4,4 @@ class Foo { foo: string; } const foo = df(new Foo()); -const items = [{id: 0, name: 'first'}]; +const items = df([{id: 0, name: 'first'}]); From 8ac5e5b4ecb93c70ce14eeec1baea412171f272f Mon Sep 17 00:00:00 2001 From: Leonard Thieu Date: Fri, 26 May 2017 20:06:57 -0400 Subject: [PATCH 0137/1105] Define type for JQueryStatic.fn. --- types/jquery/index.d.ts | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/types/jquery/index.d.ts b/types/jquery/index.d.ts index ca799f21e5..d9841c1185 100644 --- a/types/jquery/index.d.ts +++ b/types/jquery/index.d.ts @@ -1,6 +1,26 @@ // Type definitions for jQuery 1.10.x / 2.0.x // Project: http://jquery.com/ -// Definitions by: Boris Yankov , Christian Hoffmeister , Steve Fenton , Diullei Gomes , Tass Iliopoulos , Jason Swearingen , Sean Hill , Guus Goossens , Kelly Summerlin , Basarat Ali Syed , Nicholas Wolverson , Derek Cicerone , Andrew Gaspar , Seikichi Kondo , Benjamin Jackman , Poul Sorensen , Josh Strobl , John Reilly , Dick van den Brink , Thomas Schulz +// Definitions by: Boris Yankov +// Christian Hoffmeister +// Steve Fenton +// Diullei Gomes +// Tass Iliopoulos +// Jason Swearingen +// Sean Hill +// Guus Goossens +// Kelly Summerlin +// Basarat Ali Syed +// Nicholas Wolverson +// Derek Cicerone +// Andrew Gaspar +// Seikichi Kondo +// Benjamin Jackman +// Poul Sorensen +// Josh Strobl +// John Reilly +// Dick van den Brink +// Thomas Schulz +// Leonard Thieu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /* ***************************************************************************** @@ -1146,7 +1166,7 @@ interface JQueryStatic { error(message: any): JQuery; expr: any; - fn: any; //TODO: Decide how we want to type this + readonly fn: JQuery; isReady: boolean; @@ -3781,6 +3801,14 @@ interface JQuery { * @see {@link https://api.jquery.com/queue/#queue-queueName-callback} */ queue(queueName: string, callback: Function): JQuery; + + /** + * Merge the contents of an object onto the jQuery prototype to provide new jQuery instance methods. + * + * @param object An object to merge onto the jQuery prototype. + * @see {@link https://api.jquery.com/jQuery.fn.extend/#jQuery-fn-extend-object} + */ + extend(object: { [method: string]: (...args: any[]) => any; }): JQuery; } declare module "jquery" { export = $; From d5ef015d8108544c46c20a22f5a1a2fb5ad43086 Mon Sep 17 00:00:00 2001 From: Leonard Thieu Date: Thu, 25 May 2017 20:12:22 -0400 Subject: [PATCH 0138/1105] Update type definitions for Semantic UI. --- types/semantic-ui/index.d.ts | 2698 ++++++++++++------------ types/semantic-ui/semantic-ui-tests.ts | 236 ++- types/semantic-ui/tslint.json | 3 +- 3 files changed, 1620 insertions(+), 1317 deletions(-) diff --git a/types/semantic-ui/index.d.ts b/types/semantic-ui/index.d.ts index 96d660d82b..b069899b69 100644 --- a/types/semantic-ui/index.d.ts +++ b/types/semantic-ui/index.d.ts @@ -2,1314 +2,39 @@ // Project: http://semantic-ui.com/ // Definitions by: Leonard Thieu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// interface JQueryStatic { - accordion: { settings: SemanticUI.AccordionSettings }; - checkbox: { settings: SemanticUI.CheckboxSettings }; - dimmer: { settings: SemanticUI.DimmerSettings }; - dropdown: { settings: SemanticUI.DropdownSettings }; - embed: { settings: SemanticUI.EmbedSettings }; - modal: { settings: SemanticUI.ModalSettings }; - nag: { settings: SemanticUI.NagSettings }; - popup: { settings: SemanticUI.PopupSettings }; - progress: { settings: SemanticUI.ProgressSettings }; - rating: { settings: SemanticUI.RatingSettings }; - search: { settings: SemanticUI.SearchSettings }; - shape: { settings: SemanticUI.ShapeSettings }; - sidebar: { settings: SemanticUI.SidebarSettings }; - sticky: { settings: SemanticUI.StickySettings }; - tab: { settings: SemanticUI.TabSettings }; - transition: { settings: SemanticUI.TransitionSettings }; + site: SemanticUI.Site; - api: { settings: SemanticUI.ApiSettings }; - form: { settings: SemanticUI.FormSettings }; - visibility: { settings: SemanticUI.VisibilitySettings }; + api: SemanticUI.Api; } interface JQuery { - // TODO: Do all modules have a 'setting' behavior? + site: SemanticUI.Site; - // region Modules + accordion: SemanticUI.Accordion; + checkbox: SemanticUI.Checkbox; + dimmer: SemanticUI.Dimmer; + dropdown: SemanticUI.Dropdown; + embed: SemanticUI.Embed; + modal: SemanticUI.Modal; + nag: SemanticUI.Nag; + popup: SemanticUI.Popup; + progress: SemanticUI.Progress; + rating: SemanticUI.Rating; + search: SemanticUI.Search; + shape: SemanticUI.Shape; + sidebar: SemanticUI.Sidebar; + sticky: SemanticUI.Sticky; + tab: SemanticUI.Tab; + transition: SemanticUI.Transition; - // region Accordion - - /** - * Refreshes all cached selectors and data - */ - accordion(behavior: 'refresh'): JQuery; - /** - * Opens accordion content at index - */ - accordion(behavior: 'open', index: number): JQuery; - /** - * Closes accordion content that are not active - */ - accordion(behavior: 'close others'): JQuery; - /** - * Closes accordion content at index - */ - accordion(behavior: 'close', index: number): JQuery; - /** - * Toggles accordion content at index - */ - accordion(behavior: 'toggle', index: number): JQuery; - accordion(settings: SemanticUI.AccordionSettings): JQuery; - accordion(): JQuery; - - // endregion - - // region Checkbox - - /** - * Switches a checkbox from current state - */ - checkbox(behavior: 'toggle'): JQuery; - /** - * Set a checkbox state to checked - */ - checkbox(behavior: 'check'): JQuery; - /** - * Set a checkbox state to unchecked - */ - checkbox(behavior: 'uncheck'): JQuery; - /** - * Set as indeterminate checkbox - */ - checkbox(behavior: 'indeterminate'): JQuery; - /** - * Set as determinate checkbox - */ - checkbox(behavior: 'determinate'): JQuery; - /** - * Enable interaction with a checkbox - */ - checkbox(behavior: 'enable'): JQuery; - /** - * Set a checkbox state to checked without callbacks - */ - checkbox(behavior: 'set checked'): JQuery; - /** - * Set a checkbox state to unchecked without callbacks - */ - checkbox(behavior: 'set unchecked'): JQuery; - /** - * Set as indeterminate checkbox without callbacks - */ - checkbox(behavior: 'set indeterminate'): JQuery; - /** - * Set as determinate checkbox without callbacks - */ - checkbox(behavior: 'set determinate'): JQuery; - /** - * Enable interaction with a checkbox without callbacks - */ - checkbox(behavior: 'set enabled'): JQuery; - /** - * Disable interaction with a checkbox without callbacks - */ - checkbox(behavior: 'set disabled'): JQuery; - /** - * Attach checkbox events to another element - */ - checkbox(behavior: 'attach events', selector: string, event: string): JQuery; - /** - * Returns whether element is radio selection - */ - checkbox(behavior: 'is radio'): boolean; - /** - * Returns whether element is currently checked - */ - checkbox(behavior: 'is checked'): boolean; - /** - * Returns whether element is not checked - */ - checkbox(behavior: 'is unchecked'): boolean; - /** - * Returns whether element is able to be changed - */ - checkbox(behavior: 'can change'): boolean; - /** - * Returns whether element can be checked (checking if already checked or `beforeChecked` would cancel) - */ - checkbox(behavior: 'should allow check'): boolean; - /** - * Returns whether element can be unchecked (checking if already unchecked or `beforeUnchecked` would cancel) - */ - checkbox(behavior: 'should allow uncheck'): boolean; - /** - * Returns whether element can be determinate (checking if already determinate or `beforeDeterminate` would cancel) - */ - checkbox(behavior: 'should allow determinate'): boolean; - /** - * Returns whether element can be indeterminate (checking if already indeterminate or `beforeIndeterminate` would cancel) - */ - checkbox(behavior: 'should allow indeterminate'): boolean; - /** - * Returns whether element is able to be unchecked - */ - checkbox(behavior: 'can uncheck'): boolean; - checkbox(settings: SemanticUI.CheckboxSettings): JQuery; - checkbox(): JQuery; - - // endregion - - // region Dimmer - - /** - * Detaches a given element from DOM and reattaches element inside dimmer - */ - dimmer(behavior: 'add content', element: SemanticUI.Selector): JQuery; - /** - * Shows dimmer - */ - dimmer(behavior: 'show'): JQuery; - /** - * Hides dimmer - */ - dimmer(behavior: 'hide'): JQuery; - /** - * Toggles current dimmer visibility - */ - dimmer(behavior: 'toggle'): JQuery; - /** - * Changes dimmer opacity - */ - dimmer(behavior: 'set opacity', opacity: number): JQuery; - /** - * Creates a new dimmer in dimmable context - */ - dimmer(behavior: 'create'): JQuery; - /** - * Returns current duration for show or hide event depending on current visibility - */ - dimmer(behavior: 'get duration'): number; - /** - * Returns DOM element for dimmer - */ - dimmer(behavior: 'get dimmer'): JQuery; - /** - * Returns whether current dimmable has a dimmer - */ - dimmer(behavior: 'has dimmer'): boolean; - /** - * Whether section's dimmer is active - */ - dimmer(behavior: 'is active'): boolean; - /** - * Whether dimmer is animating - */ - dimmer(behavior: 'is animating'): boolean; - /** - * Whether current element is a dimmer - */ - dimmer(behavior: 'is dimmer'): boolean; - /** - * Whether current element is a dimmable section - */ - dimmer(behavior: 'is dimmable'): boolean; - /** - * Whether dimmer is disabled - */ - dimmer(behavior: 'is disabled'): boolean; - /** - * Whether dimmer is not disabled - */ - dimmer(behavior: 'is enabled'): boolean; - /** - * Whether dimmable section is body - */ - dimmer(behavior: 'is page'): boolean; - /** - * Whether dimmer is a page dimmer - */ - dimmer(behavior: 'is page dimmer'): boolean; - /** - * Sets page dimmer to active - */ - dimmer(behavior: 'set active'): JQuery; - /** - * Sets an element as a dimmable section - */ - dimmer(behavior: 'set dimmable'): JQuery; - /** - * Sets a dimmable section as dimmed - */ - dimmer(behavior: 'set dimmed'): JQuery; - /** - * Sets current dimmer as a page dimmer - */ - dimmer(behavior: 'set page dimmer'): JQuery; - /** - * Sets a dimmer as disabled - */ - dimmer(behavior: 'set disabled'): JQuery; - dimmer(settings: SemanticUI.DimmerSettings): JQuery; - dimmer(): JQuery; - - // endregion - - // region Dropdown - - // TODO: Should 'value'/'values' parameters be of type 'string' instead of 'any'? - - /** - * Recreates dropdown menu from select option values. - */ - dropdown(behavior: 'setup menu'): JQuery; - /** - * Refreshes all cached selectors and data - */ - dropdown(behavior: 'refresh'): JQuery; - /** - * Toggles current visibility of dropdown - */ - dropdown(behavior: 'toggle'): JQuery; - /** - * Shows dropdown - */ - dropdown(behavior: 'show'): JQuery; - /** - * Hides dropdown - */ - dropdown(behavior: 'hide'): JQuery; - /** - * Clears dropdown of selection - */ - dropdown(behavior: 'clear'): JQuery; - /** - * Hides all other dropdowns that is not current dropdown - */ - dropdown(behavior: 'hide others'): JQuery; - /** - * Restores dropdown text and value to its value on page load - */ - dropdown(behavior: 'restore defaults'): JQuery; - /** - * Restores dropdown text to its value on page load - */ - dropdown(behavior: 'restore default text'): JQuery; - /** - * Restores dropdown text to its prompt, placeholder text - */ - dropdown(behavior: 'restore placeholder text'): JQuery; - /** - * Restores dropdown value to its value on page load - */ - dropdown(behavior: 'restore default value'): JQuery; - /** - * Saves current text and value as new defaults (for use with restore) - */ - dropdown(behavior: 'save defaults'): JQuery; - /** - * Sets value as selected - */ - dropdown(behavior: 'set selected', value: any): JQuery; - /** - * Remove value from selected - */ - dropdown(behavior: 'remove selected', value: any): JQuery; - /** - * Adds a group of values as selected - */ - dropdown(behavior: 'set selected', values: any[]): JQuery; - /** - * Sets selected values to exactly specified values, removing current selection - */ - dropdown(behavior: 'set exactly', values: any[]): JQuery; - /** - * Sets dropdown text to a value - */ - dropdown(behavior: 'set text', text: string): JQuery; - /** - * Sets dropdown input to value (does not update display state) - */ - dropdown(behavior: 'set value', value: any): JQuery; - /** - * Returns current dropdown text - */ - dropdown(behavior: 'get text'): string; - /** - * Returns current dropdown input value - */ - dropdown(behavior: 'get value'): any; - /** - * Returns DOM element that matches a given input value - */ - dropdown(behavior: 'get item', value: any): JQuery; - /** - * Adds touch events to element - */ - dropdown(behavior: 'bind touch events'): JQuery; - /** - * Adds mouse events to element - */ - dropdown(behavior: 'bind mouse events'): JQuery; - /** - * Binds a click to document to determine if you click away from a dropdown - */ - dropdown(behavior: 'bind intent'): JQuery; - /** - * Unbinds document intent click - */ - dropdown(behavior: 'unbind intent'): JQuery; - /** - * Returns whether event occurred inside dropdown - */ - dropdown(behavior: 'determine intent'): boolean; - /** - * Triggers preset item selection action based on settings passing text/value - */ - dropdown(behavior: 'determine select action', text: string, value: any): JQuery; - /** - * Sets dropdown to active state - */ - dropdown(behavior: 'set active'): JQuery; - /** - * Sets dropdown to visible state - */ - dropdown(behavior: 'set visible'): JQuery; - /** - * Removes dropdown active state - */ - dropdown(behavior: 'remove active'): JQuery; - /** - * Removes dropdown visible state - */ - dropdown(behavior: 'remove visible'): JQuery; - /** - * Returns whether dropdown is a selection dropdown - */ - dropdown(behavior: 'is selection'): boolean; - /** - * Returns whether dropdown is animated - */ - dropdown(behavior: 'is animated'): boolean; - /** - * Returns whether dropdown is visible - */ - dropdown(behavior: 'is visible'): boolean; - /** - * Returns whether dropdown is hidden - */ - dropdown(behavior: 'is hidden'): boolean; - /** - * Returns dropdown value as set on page load - */ - dropdown(behavior: 'get default text'): string; - /** - * Returns placeholder text - */ - dropdown(behavior: 'get placeholder text'): string; - dropdown(settings: SemanticUI.DropdownSettings): JQuery; - dropdown(): JQuery; - - // endregion - - // region Embed - - /** - * Changes iframe to a new content source - */ - embed(behavior: 'change', source: string, id: string, url: string): JQuery; - /** - * Removes embed and shows placeholder content if available - */ - embed(behavior: 'reset'): JQuery; - /** - * Shows embed content - */ - embed(behavior: 'show'): JQuery; - /** - * Hides embed content and shows placeholder content - */ - embed(behavior: 'hide'): JQuery; - /** - * Returns current content id - */ - embed(behavior: 'get id'): string; - /** - * Returns placeholder image url - */ - embed(behavior: 'get placeholder'): string; - /** - * Returns source name - */ - embed(behavior: 'get sources'): string; - /** - * Returns source type - */ - embed(behavior: 'get type'): string; - /** - * Returns URL with all parameters added - */ - embed(behavior: 'get url'): string; - /** - * Returns whether embed content has placeholder - */ - embed(behavior: 'has placeholder'): boolean; - /** - * Destroys instance and removes all events - */ - embed(behavior: 'destroy'): JQuery; - embed(settings: SemanticUI.EmbedSettings): JQuery; - embed(): JQuery; - - // endregion - - // region Modal - - /** - * Shows the modal - */ - modal(behavior: 'show'): JQuery; - /** - * Hides the modal - */ - modal(behavior: 'hide'): JQuery; - /** - * Toggles the modal - */ - modal(behavior: 'toggle'): JQuery; - /** - * Refreshes centering of modal on page - */ - modal(behavior: 'refresh'): JQuery; - /** - * Shows associated page dimmer - */ - modal(behavior: 'show dimmer'): JQuery; - /** - * Hides associated page dimmer - */ - modal(behavior: 'hide dimmer'): JQuery; - /** - * Hides all modals not selected modal in a dimmer - */ - modal(behavior: 'hide others'): JQuery; - /** - * Hides all visible modals in the same dimmer - */ - modal(behavior: 'hide all'): JQuery; - /** - * Caches current modal size - */ - modal(behavior: 'cache sizes'): JQuery; - /** - * Returns whether the modal can fit on the page - */ - modal(behavior: 'can fit'): boolean; - /** - * Returns whether the modal is active - */ - modal(behavior: 'is active'): boolean; - /** - * Sets modal to active - */ - modal(behavior: 'set active'): JQuery; - modal(behavior: 'attach events', selector: SemanticUI.Selector, event?: string): JQuery; - modal(behavior: 'setting', name: string, value: any): JQuery; - modal(settings: SemanticUI.ModalSettings): JQuery; - modal(): JQuery; - - // endregion - - // region Nag - - // TODO: Documentation is lacking. Is it possible to infer intended behaviors? - - nag(behavior: 'show'): JQuery; - /** - * Clears cookie so nag shows again - */ - nag(behavior: 'clear'): JQuery; - nag(settings: SemanticUI.NagSettings): JQuery; - - // endregion - - // region Popup - - /** - * Shows popup - */ - popup(behavior: 'show'): JQuery; - /** - * Hides popup - */ - popup(behavior: 'hide'): JQuery; - /** - * Hides all visible pop ups on the page - */ - popup(behavior: 'hide all'): JQuery; - /** - * Returns current popup dom element - */ - popup(behavior: 'get popup'): JQuery; - /** - * Changes current popup content - */ - popup(behavior: 'change content', html: string): JQuery; - /** - * Toggles visibility of popup - */ - popup(behavior: 'toggle'): JQuery; - /** - * Returns whether popup is visible - */ - popup(behavior: 'is visible'): boolean; - /** - * Returns whether popup is hidden - */ - popup(behavior: 'is hidden'): boolean; - /** - * Returns whether popup is created and inserted into the page - */ - popup(behavior: 'exists'): boolean; - /** - * Adjusts popup when content size changes (only necessary for centered popups) - */ - popup(behavior: 'reposition'): JQuery; - /** - * Repositions a popup - */ - popup(behavior: 'set position', position: string): JQuery; - /** - * Removes popup from the page and removes all events - */ - popup(behavior: 'destroy'): JQuery; - /** - * Removes popup from the page - */ - popup(behavior: 'remove popup'): JQuery; - popup(settings: SemanticUI.PopupSettings): JQuery; - popup(): JQuery; - - // endregion - - // region Progress - - /** - * Sets current percent of progress to value. If using a total will convert from percent to estimated value. - */ - progress(behavior: 'set percent', percent: number): JQuery; - /** - * Sets progress to specified value. Will automatically calculate percent from total. - */ - progress(behavior: 'set progress', value: number): JQuery; - /** - * Increments progress by increment value, if not passed a value will use random amount specified in settings - */ - progress(behavior: 'increment', incrementValue: number): JQuery; - /** - * Decrements progress by decrement value, if not passed a value will use random amount specified in settings - */ - progress(behavior: 'decrement', decrementValue: number): JQuery; - /** - * Immediately updates progress to value, ignoring progress animation interval delays - */ - progress(behavior: 'update progress', value: number): JQuery; - /** - * Finishes progress and sets loaded to 100% - */ - progress(behavior: 'complete'): JQuery; - /** - * Resets progress to zero - */ - progress(behavior: 'reset'): JQuery; - /** - * Set total to a new value - */ - progress(behavior: 'set total', total: number): JQuery; - /** - * Replaces templated string with value, total, percent left and percent. - */ - progress(behavior: 'get text', text: string): string; - /** - * Returns normalized value inside acceptable range specified by total. - */ - progress(behavior: 'get normalized value', value: number): number; - /** - * Returns percent as last specified - */ - progress(behavior: 'get percent'): number; - /** - * Returns current progress value - */ - progress(behavior: 'get value'): number; - /** - * Returns total - */ - progress(behavior: 'get total'): number; - /** - * Returns whether progress is completed - */ - progress(behavior: 'is complete'): boolean; - /** - * Returns whether progress was a success - */ - progress(behavior: 'is success'): boolean; - /** - * Returns whether progress is in warning state - */ - progress(behavior: 'is warning'): boolean; - /** - * Returns whether progress is in error state - */ - progress(behavior: 'is error'): boolean; - /** - * Returns whether progress is in active state - */ - progress(behavior: 'is active'): boolean; - /** - * Sets progress to active state - */ - progress(behavior: 'set active'): JQuery; - /** - * Sets progress to warning state - */ - progress(behavior: 'set warning'): JQuery; - /** - * Sets progress to success state - */ - progress(behavior: 'set success'): JQuery; - /** - * Sets progress to error state - */ - progress(behavior: 'set error'): JQuery; - /** - * Changes progress animation speed - */ - progress(behavior: 'set duration', value: number): JQuery; - /** - * Sets progress exterior label to text - */ - progress(behavior: 'set label', text: string): JQuery; - /** - * Sets progress bar label to text - */ - progress(behavior: 'set bar label', text: string): JQuery; - /** - * Removes progress to active state - */ - progress(behavior: 'remove active'): JQuery; - /** - * Removes progress to warning state - */ - progress(behavior: 'remove warning'): JQuery; - /** - * Removes progress to success state - */ - progress(behavior: 'remove success'): JQuery; - /** - * Removes progress to error state - */ - progress(behavior: 'remove error'): JQuery; - progress(settings: SemanticUI.ProgressSettings): JQuery; - progress(): JQuery; - - // endregion - - // region Rating - - /** - * Sets rating programmatically - */ - rating(behavior: 'set rating', rating: number): JQuery; - /** - * Gets current rating - */ - rating(behavior: 'get rating'): number; - /** - * Disables interactive rating mode - */ - rating(behavior: 'disable'): JQuery; - /** - * Enables interactive rating mode - */ - rating(behavior: 'enable'): JQuery; - /** - * Clears current rating - */ - rating(behavior: 'clear rating'): JQuery; - rating(settings: SemanticUI.RatingSettings): JQuery; - rating(): JQuery; - - // endregion - - // region Search - - /** - * Search for value currently set in search input - */ - search(behavior: 'query', callback?: () => void): JQuery; - /** - * Displays message in search results with text, using template matching type - */ - search(behavior: 'display message', text: string, type: string): JQuery; - /** - * Cancels current remote search query - */ - search(behavior: 'cancel query'): JQuery; - /** - * Search local object for specified query and display results - */ - search(behavior: 'search local', query: string): JQuery; - /** - * Whether has minimum characters - */ - search(behavior: 'has minimum characters'): boolean; - /** - * Search remote endpoint for specified query and display results - */ - search(behavior: 'search remote', query: string, callback?: () => void): JQuery; - /** - * Search object for specified query and return results - */ - search(behavior: 'search object', query: string, object: any, searchFields: string[]): any; - /** - * Cancels current remote search request - */ - search(behavior: 'cancel query'): JQuery; - /** - * Whether search is currently focused - */ - search(behavior: 'is focused'): boolean; - /** - * Whether search results are visible - */ - search(behavior: 'is visible'): boolean; - /** - * Whether search results are empty - */ - search(behavior: 'is empty'): boolean; - /** - * Returns current search value - */ - search(behavior: 'get value'): any; - /** - * Returns JSON object matching searched title or id (see above) - */ - search(behavior: 'get result', value: any): any; - /** - * Sets search input to value - */ - search(behavior: 'set value', value: any): JQuery; - /** - * Reads cached results for query - */ - search(behavior: 'read cache', query: string): JQuery; - /** - * Clears value from cache, if no parameter passed clears all cache - */ - search(behavior: 'clear cache', query?: string): JQuery; - /** - * Writes cached results for query - */ - search(behavior: 'write cache', query: string): JQuery; - /** - * Adds HTML to results and displays - */ - search(behavior: 'add results', html: string): JQuery; - /** - * Shows results container - */ - search(behavior: 'show results', callback?: () => void): JQuery; - /** - * Hides results container - */ - search(behavior: 'hide results', callback?: () => void): JQuery; - /** - * Generates results using parser specified by settings.template - */ - search(behavior: 'generate results', response: any): JQuery; - /** - * Removes all events - */ - search(behavior: 'destroy'): JQuery; - search(settings: SemanticUI.SearchSettings): JQuery; - search(): JQuery; - - // endregion - - // region Shape - - /** - * Flips the shape upward - */ - shape(behavior: 'flip up'): JQuery; - /** - * Flips the shape downward - */ - shape(behavior: 'flip down'): JQuery; - /** - * Flips the shape right - */ - shape(behavior: 'flip right'): JQuery; - /** - * Flips the shape left - */ - shape(behavior: 'flip left'): JQuery; - /** - * Flips the shape over clock-wise - */ - shape(behavior: 'flip over'): JQuery; - /** - * Flips the shape over counter-clockwise - */ - shape(behavior: 'flip back'): JQuery; - /** - * Set the next side to a specific selector - */ - shape(behavior: 'set next side', selector: SemanticUI.Selector): JQuery; - /** - * Returns whether shape is currently animating - */ - shape(behavior: 'is animating'): boolean; - /** - * Removes all inline styles - */ - shape(behavior: 'reset'): JQuery; - /** - * Queues an animation until after current animation - */ - shape(behavior: 'queue', animation: string): JQuery; - /** - * Forces a reflow on element - */ - shape(behavior: 'repaint'): JQuery; - /** - * Set the next side to next sibling to active element - */ - shape(behavior: 'set default side'): JQuery; - /** - * Sets shape to the content size of the next side - */ - shape(behavior: 'set stage size'): JQuery; - /** - * Refreshes the selector cache for element sides - */ - shape(behavior: 'refresh'): JQuery; - /** - * Returns translation for next side staged below - */ - shape(behavior: 'get transform down'): SemanticUI.Translation; - /** - * Returns translation for next side staged left - */ - shape(behavior: 'get transform left'): SemanticUI.Translation; - /** - * Returns translation for next side staged right - */ - shape(behavior: 'get transform right'): SemanticUI.Translation; - /** - * Returns translation for next side staged up - */ - shape(behavior: 'get transform up'): SemanticUI.Translation; - /** - * Returns translation for next side staged down - */ - shape(behavior: 'get transform down'): SemanticUI.Translation; - shape(settings: SemanticUI.ShapeSettings): JQuery; - shape(): JQuery; - - // endregion - - // region Sidebar - - /** - * Attaches sidebar action to given selector. Default event if none specified is toggle - */ - sidebar(behavior: 'attach events', selector: string, event?: string): JQuery; - /** - * Shows sidebar - */ - sidebar(behavior: 'show'): JQuery; - /** - * Hides sidebar - */ - sidebar(behavior: 'hide'): JQuery; - /** - * Toggles visibility of sidebar - */ - sidebar(behavior: 'toggle'): JQuery; - /** - * Returns whether sidebar is visible - */ - sidebar(behavior: 'is visible'): boolean; - /** - * Returns whether sidebar is hidden - */ - sidebar(behavior: 'is hidden'): boolean; - /** - * Pushes page content to be visible alongside sidebar - */ - sidebar(behavior: 'push page'): JQuery; - /** - * Returns direction of current sidebar - */ - sidebar(behavior: 'get direction'): string; - /** - * Returns page content to original position - */ - sidebar(behavior: 'pull page'): JQuery; - /** - * Adds stylesheet to page head to trigger sidebar animations - */ - sidebar(behavior: 'add body CSS'): JQuery; - /** - * Removes any inline stylesheets for sidebar animation - */ - sidebar(behavior: 'remove body CSS'): JQuery; - /** - * Returns vendor prefixed transition end event - */ - sidebar(behavior: 'get transition event'): string; - sidebar(settings: SemanticUI.SidebarSettings): JQuery; - sidebar(): JQuery; - - // endregion - - // region Sticky - - /** - * recalculates offsets - */ - sticky(behavior: 'refresh'): JQuery; - sticky(settings: SemanticUI.StickySettings): JQuery; - sticky(): JQuery; - - // endregion - - // region Tab - - /** - * Attaches tab action to given selector. Default event if none specified is toggle - */ - tab(behavior: 'attach events', selector: string, event?: string): JQuery; - /** - * Changes tab to path - */ - tab(behavior: 'change tab', path: string): JQuery; - /** - * Sets current path to state - */ - tab(behavior: 'set state', path: string): JQuery; - /** - * Returns current path - */ - tab(behavior: 'get path'): string; - /** - * Returns whether tab exists - */ - tab(behavior: 'is tab'): boolean; - /** - * Returns cached HTML for path - */ - tab(behavior: 'cache read', path: string): string | false; - /** - * Sets cached HTML for path - */ - tab(behavior: 'cache add', path: string, html: string): JQuery; - /** - * Removes cached HTML for path - */ - tab(behavior: 'cache remove', path: string): JQuery; - tab(settings: SemanticUI.TabSettings): JQuery; - tab(): JQuery; - - // endregion - - // region Transition - - /** - * Stop current animation and preserve queue - */ - transition(behavior: 'stop'): JQuery; - /** - * Stop current animation and queued animations - */ - transition(behavior: 'stop all'): JQuery; - /** - * Clears all queued animations - */ - transition(behavior: 'clear queue'): JQuery; - /** - * Stop current animation and show element - */ - transition(behavior: 'show'): JQuery; - /** - * Stop current animation and hide element - */ - transition(behavior: 'hide'): JQuery; - /** - * Toggles between hide and show - */ - transition(behavior: 'toggle'): JQuery; - /** - * Forces reflow using a more expensive but stable method - */ - transition(behavior: 'force repaint'): JQuery; - /** - * Triggers reflow on element - */ - transition(behavior: 'repaint'): JQuery; - /** - * Resets all conditions changes during transition - */ - transition(behavior: 'reset'): JQuery; - /** - * Enables animation looping - */ - transition(behavior: 'looping'): JQuery; - /** - * Removes looping state from element - */ - transition(behavior: 'remove looping'): JQuery; - /** - * Adds disabled state (stops ability to animate) - */ - transition(behavior: 'disable'): JQuery; - /** - * Removes disabled state - */ - transition(behavior: 'enable'): JQuery; - /** - * Modifies element animation duration - */ - transition(behavior: 'set duration', duration: number): JQuery; - /** - * Saves all class names and styles to cache to be retrieved after animation - */ - transition(behavior: 'save conditions'): JQuery; - /** - * Adds back cached names and styles to element - */ - transition(behavior: 'restore conditions'): JQuery; - /** - * Returns vendor prefixed animation property for animationname - */ - transition(behavior: 'get animation name'): string; - /** - * Returns vendor prefixed animation property for animationend - */ - transition(behavior: 'get animation event'): string; - /** - * Returns whether element is currently visible - */ - transition(behavior: 'is visible'): boolean; - /** - * Returns whether transition is currently occurring - */ - transition(behavior: 'is animating'): boolean; - /** - * Returns whether animation looping is set - */ - transition(behavior: 'is looping'): boolean; - /** - * Returns whether animations are supported - */ - transition(behavior: 'is supported'): boolean; - transition(transition: string): JQuery; - transition(settings: SemanticUI.TransitionSettings): JQuery; - transition(): JQuery; - - // endregion - - // endregion - - // region Behaviors - - // region API - - /** - * Execute query using existing API settings - */ - api(behavior: 'query'): JQuery; - /** - * Adds data to existing templated url and returns full url string - */ - api(behavior: 'add url data', url: string, data: any): string; - /** - * Gets promise for current API request - */ - api(behavior: 'get request'): JQueryDeferred | false; - /** - * Aborts current API request - */ - api(behavior: 'abort'): JQuery; - /** - * Removes loading and error state from element - */ - api(behavior: 'reset'): JQuery; - /** - * Returns whether last request was cancelled - */ - api(behavior: 'was cancelled'): boolean; - /** - * Returns whether last request was failure - */ - api(behavior: 'was failure'): boolean; - /** - * Returns whether last request was successful - */ - api(behavior: 'was successful'): boolean; - /** - * Returns whether last request was completed - */ - api(behavior: 'was complete'): boolean; - /** - * Returns whether element is disabled - */ - api(behavior: 'is disabled'): boolean; - /** - * Returns whether element response is mocked - */ - api(behavior: 'is mocked'): boolean; - /** - * Returns whether element is loading - */ - api(behavior: 'is loading'): boolean; - /** - * Sets loading state to element - */ - api(behavior: 'set loading'): JQuery; - /** - * Sets error state to element - */ - api(behavior: 'set error'): JQuery; - /** - * Removes loading state to element - */ - api(behavior: 'remove loading'): JQuery; - /** - * Removes error state to element - */ - api(behavior: 'remove error'): JQuery; - /** - * Gets event that API request will occur on - */ - api(behavior: 'get event'): string; - /** - * Returns encodeURIComponent value only if value passed is not already encoded - */ - api(behavior: 'get url encoded value', value: any): string; - /** - * Reads a locally cached response for a URL - */ - api(behavior: 'read cached response', url: string): any; - /** - * Writes a cached response for a URL - */ - api(behavior: 'write cached response', url: string, response: any): JQuery; - /** - * Creates new cache, removing all locally cached URLs - */ - api(behavior: 'create cache'): JQuery; - /** - * Removes API settings from the page and all events - */ - api(behavior: 'destroy'): JQuery; - api(settings: SemanticUI.ApiSettings): JQuery; - api(): JQuery; - - // endregion - - // region Form Validation - - /** - * Submits selected form - */ - form(behavior: 'submit'): JQuery; - /** - * Returns true/false whether a form passes its validation rules - */ - form(behavior: 'is valid'): boolean; - /** - * Validates form and calls onSuccess or onFailure - */ - form(behavior: 'validate form'): JQuery; - /** - * gets browser property change event - */ - form(behavior: 'get change event'): string; - /** - * Returns element with matching name, id, or data-validate metadata to ID - */ - form(behavior: 'get field', id: string): JQuery; - /** - * Returns value of element with id - */ - form(behavior: 'get value', id: string): any; - /** - * Returns object of element values that match array of ids. If no IDS are passed will return all fields - */ - form(behavior: 'get values', ids?: string[]): any; - /** - * Sets value of element with id - */ - form(behavior: 'set value', id: string): JQuery; - /** - * Sets key/value pairs from passed values object to matching ids - */ - form(behavior: 'set values', values: any): JQuery; - /** - * Returns validation rules for a given jQuery-referenced input field - */ - form(behavior: 'get validation', element: JQuery): any; - /** - * Returns whether a field exists - */ - form(behavior: 'has field', identifier: string): boolean; - /** - * Adds errors to form, given an array errors - */ - form(behavior: 'add errors', errors: string[]): JQuery; - form(settings: SemanticUI.FormSettings): JQuery; - form(): JQuery; - - // endregion - - // region Visibility - - /** - * Disable callbacks temporarily. This is useful if you need to adjust scroll position and do not want to trigger callbacks during the position change. - */ - visibility(behavior: 'disable callbacks'): JQuery; - /** - * Re-enable callbacks - */ - visibility(behavior: 'enable callbacks'): JQuery; - /** - * Returns whether element is on screen - */ - visibility(behavior: 'is on screen'): boolean; - /** - * Returns whether element is off screen - */ - visibility(behavior: 'is off screen'): boolean; - /** - * Returns number of pixels passed in current element from top of element - */ - visibility(behavior: 'get pixels passed'): number; - /** - * Returns element calculations as object - */ - visibility(behavior: 'get element calculations'): SemanticUI.ElementCalculations; - /** - * Returns screen calculations as object - */ - visibility(behavior: 'get screen calculations'): SemanticUI.ScreenCalculations; - /** - * Returns screen size as object - */ - visibility(behavior: 'get screen size'): SemanticUI.ScreenSize; - visibility(settings: SemanticUI.VisibilitySettings): JQuery; - visibility(): JQuery; - - // endregion - - // endregion + api: SemanticUI.Api; + form: SemanticUI.Form; + visibility: SemanticUI.Visibility; } declare namespace SemanticUI { @@ -1354,10 +79,70 @@ declare namespace SemanticUI { // endregion } + // region Globals + + // region Site + + interface Site { + settings: SiteSettings; + + (behavior: 'destroy'): JQuery; + (behavior: 'setting', name: K, value?: undefined): SiteSettings[K]; + (behavior: 'setting', name: K, value: SiteSettings[K]): JQuery; + (behavior: 'setting', value: SiteSettings): JQuery; + (settings?: SiteSettings): JQuery; + } + + interface SiteSettings extends ComponentSettings { + modules?: string[]; + siteNamespace?: string; + namespaceStub?: { + cache?: any; + config?: any; + sections?: any; + section?: any; + utilities?: any; + }; + } + + // endregion + + // endregion + // region Modules // region Accordion + interface Accordion { + settings: AccordionSettings; + + /** + * Refreshes all cached selectors and data + */ + (behavior: 'refresh'): JQuery; + /** + * Opens accordion content at index + */ + (behavior: 'open', index: number): JQuery; + /** + * Closes accordion content that are not active + */ + (behavior: 'close others'): JQuery; + /** + * Closes accordion content at index + */ + (behavior: 'close', index: number): JQuery; + /** + * Toggles accordion content at index + */ + (behavior: 'toggle', index: number): JQuery; + (behavior: 'destroy'): JQuery; + (behavior: 'setting', name: K, value?: undefined): AccordionSettings[K]; + (behavior: 'setting', name: K, value: AccordionSettings[K]): JQuery; + (behavior: 'setting', value: AccordionSettings): JQuery; + (settings?: AccordionSettings): JQuery; + } + /** * @see {@link http://semantic-ui.com/modules/accordion.html#/settings} */ @@ -1407,8 +192,12 @@ declare namespace SemanticUI { * @see {@link http://gsgd.co.uk/sandbox/jquery/easing/} */ easing?: string; - // TODO: Undocumented but probably intended to be public? - // observeChanges?: boolean; + /** + * whether accordion should automatically refresh on DOM insertion + * + * @default true + */ + observeChanges?: boolean; // endregion @@ -1492,6 +281,104 @@ declare namespace SemanticUI { // region Checkbox + interface Checkbox { + settings: CheckboxSettings; + + /** + * Switches a checkbox from current state + */ + (behavior: 'toggle'): JQuery; + /** + * Set a checkbox state to checked + */ + (behavior: 'check'): JQuery; + /** + * Set a checkbox state to unchecked + */ + (behavior: 'uncheck'): JQuery; + /** + * Set as indeterminate checkbox + */ + (behavior: 'indeterminate'): JQuery; + /** + * Set as determinate checkbox + */ + (behavior: 'determinate'): JQuery; + /** + * Enable interaction with a checkbox + */ + (behavior: 'enable'): JQuery; + /** + * Set a checkbox state to checked without callbacks + */ + (behavior: 'set checked'): JQuery; + /** + * Set a checkbox state to unchecked without callbacks + */ + (behavior: 'set unchecked'): JQuery; + /** + * Set as indeterminate checkbox without callbacks + */ + (behavior: 'set indeterminate'): JQuery; + /** + * Set as determinate checkbox without callbacks + */ + (behavior: 'set determinate'): JQuery; + /** + * Enable interaction with a checkbox without callbacks + */ + (behavior: 'set enabled'): JQuery; + /** + * Disable interaction with a checkbox without callbacks + */ + (behavior: 'set disabled'): JQuery; + /** + * Attach checkbox events to another element + */ + (behavior: 'attach events', selector: Selector, event?: string): JQuery; + /** + * Returns whether element is radio selection + */ + (behavior: 'is radio'): boolean; + /** + * Returns whether element is currently checked + */ + (behavior: 'is checked'): boolean; + /** + * Returns whether element is not checked + */ + (behavior: 'is unchecked'): boolean; + /** + * Returns whether element is able to be changed + */ + (behavior: 'can change'): boolean; + /** + * Returns whether element can be checked (checking if already checked or `beforeChecked` would cancel) + */ + (behavior: 'should allow check'): boolean; + /** + * Returns whether element can be unchecked (checking if already unchecked or `beforeUnchecked` would cancel) + */ + (behavior: 'should allow uncheck'): boolean; + /** + * Returns whether element can be determinate (checking if already determinate or `beforeDeterminate` would cancel) + */ + (behavior: 'should allow determinate'): boolean; + /** + * Returns whether element can be indeterminate (checking if already indeterminate or `beforeIndeterminate` would cancel) + */ + (behavior: 'should allow indeterminate'): boolean; + /** + * Returns whether element is able to be unchecked + */ + (behavior: 'can uncheck'): boolean; + (behavior: 'destroy'): JQuery; + (behavior: 'setting', name: K, value?: undefined): CheckboxSettings[K]; + (behavior: 'setting', name: K, value: CheckboxSettings[K]): JQuery; + (behavior: 'setting', value: CheckboxSettings): JQuery; + (settings?: CheckboxSettings): JQuery; + } + /** * @see {@link http://semantic-ui.com/modules/checkbox.html#/settings} */ @@ -1629,6 +516,104 @@ declare namespace SemanticUI { // region Dimmer + interface Dimmer { + settings: DimmerSettings; + + /** + * Detaches a given element from DOM and reattaches element inside dimmer + */ + (behavior: 'add content', element: Selector): JQuery; + /** + * Shows dimmer + */ + (behavior: 'show'): JQuery; + /** + * Hides dimmer + */ + (behavior: 'hide'): JQuery; + /** + * Toggles current dimmer visibility + */ + (behavior: 'toggle'): JQuery; + /** + * Changes dimmer opacity + */ + (behavior: 'set opacity', opacity: number): JQuery; + /** + * Creates a new dimmer in dimmable context + */ + (behavior: 'create'): JQuery; + /** + * Returns current duration for show or hide event depending on current visibility + */ + (behavior: 'get duration'): number; + /** + * Returns DOM element for dimmer + */ + (behavior: 'get dimmer'): JQuery; + /** + * Returns whether current dimmable has a dimmer + */ + (behavior: 'has dimmer'): boolean; + /** + * Whether section's dimmer is active + */ + (behavior: 'is active'): boolean; + /** + * Whether dimmer is animating + */ + (behavior: 'is animating'): boolean; + /** + * Whether current element is a dimmer + */ + (behavior: 'is dimmer'): boolean; + /** + * Whether current element is a dimmable section + */ + (behavior: 'is dimmable'): boolean; + /** + * Whether dimmer is disabled + */ + (behavior: 'is disabled'): boolean; + /** + * Whether dimmer is not disabled + */ + (behavior: 'is enabled'): boolean; + /** + * Whether dimmable section is body + */ + (behavior: 'is page'): boolean; + /** + * Whether dimmer is a page dimmer + */ + (behavior: 'is page dimmer'): boolean; + /** + * Sets page dimmer to active + */ + (behavior: 'set active'): JQuery; + /** + * Sets an element as a dimmable section + */ + (behavior: 'set dimmable'): JQuery; + /** + * Sets a dimmable section as dimmed + */ + (behavior: 'set dimmed'): JQuery; + /** + * Sets current dimmer as a page dimmer + */ + (behavior: 'set page dimmer'): JQuery; + /** + * Sets a dimmer as disabled + */ + (behavior: 'set disabled'): JQuery; + (behavior: 'destroy'): JQuery; + (behavior: 'setting', name: K, value?: undefined): DimmerSettings[K]; + (behavior: 'setting', name: K, value: DimmerSettings[K]): JQuery; + (behavior: 'setting', value: DimmerSettings): JQuery; + (settings?: DimmerSettings): JQuery; + } + /** * @see {@link http://semantic-ui.com/modules/dimmer.html#/settings} */ @@ -1707,7 +692,7 @@ declare namespace SemanticUI { /** * Callback on element show or hide */ - onchange?(this: JQuery): void; + onChange?(this: JQuery): void; // endregion @@ -1795,12 +780,170 @@ declare namespace SemanticUI { // region Dropdown + // TODO: Should 'value'/'values' parameters be of type 'string' instead of 'any'? + + interface Dropdown { + settings: DropdownSettings; + + /** + * Recreates dropdown menu from select option values. + */ + (behavior: 'setup menu'): JQuery; + /** + * Refreshes all cached selectors and data + */ + (behavior: 'refresh'): JQuery; + /** + * Toggles current visibility of dropdown + */ + (behavior: 'toggle'): JQuery; + /** + * Shows dropdown + */ + (behavior: 'show'): JQuery; + /** + * Hides dropdown + */ + (behavior: 'hide'): JQuery; + /** + * Clears dropdown of selection + */ + (behavior: 'clear'): JQuery; + /** + * Hides all other dropdowns that is not current dropdown + */ + (behavior: 'hide others'): JQuery; + /** + * Restores dropdown text and value to its value on page load + */ + (behavior: 'restore defaults'): JQuery; + /** + * Restores dropdown text to its value on page load + */ + (behavior: 'restore default text'): JQuery; + /** + * Restores dropdown text to its prompt, placeholder text + */ + (behavior: 'restore placeholder text'): JQuery; + /** + * Restores dropdown value to its value on page load + */ + (behavior: 'restore default value'): JQuery; + /** + * Saves current text and value as new defaults (for use with restore) + */ + (behavior: 'save defaults'): JQuery; + /** + * Sets value as selected + */ + (behavior: 'set selected', value: any): JQuery; + /** + * Remove value from selected + */ + (behavior: 'remove selected', value: any): JQuery; + /** + * Adds a group of values as selected + */ + (behavior: 'set selected', values: any[]): JQuery; + /** + * Sets selected values to exactly specified values, removing current selection + */ + (behavior: 'set exactly', values: any[]): JQuery; + /** + * Sets dropdown text to a value + */ + (behavior: 'set text', text: string): JQuery; + /** + * Sets dropdown input to value (does not update display state) + */ + (behavior: 'set value', value: any): JQuery; + /** + * Returns current dropdown text + */ + (behavior: 'get text'): string; + /** + * Returns current dropdown input value + */ + (behavior: 'get value'): any; + /** + * Returns DOM element that matches a given input value + */ + (behavior: 'get item', value: any): JQuery; + /** + * Adds touch events to element + */ + (behavior: 'bind touch events'): JQuery; + /** + * Adds mouse events to element + */ + (behavior: 'bind mouse events'): JQuery; + /** + * Binds a click to document to determine if you click away from a dropdown + */ + (behavior: 'bind intent'): JQuery; + /** + * Unbinds document intent click + */ + (behavior: 'unbind intent'): JQuery; + /** + * Returns whether event occurred inside dropdown + */ + (behavior: 'determine intent'): boolean; + /** + * Triggers preset item selection action based on settings passing text/value + */ + (behavior: 'determine select action', text: string, value: any): JQuery; + /** + * Sets dropdown to active state + */ + (behavior: 'set active'): JQuery; + /** + * Sets dropdown to visible state + */ + (behavior: 'set visible'): JQuery; + /** + * Removes dropdown active state + */ + (behavior: 'remove active'): JQuery; + /** + * Removes dropdown visible state + */ + (behavior: 'remove visible'): JQuery; + /** + * Returns whether dropdown is a selection dropdown + */ + (behavior: 'is selection'): boolean; + /** + * Returns whether dropdown is animated + */ + (behavior: 'is animated'): boolean; + /** + * Returns whether dropdown is visible + */ + (behavior: 'is visible'): boolean; + /** + * Returns whether dropdown is hidden + */ + (behavior: 'is hidden'): boolean; + /** + * Returns dropdown value as set on page load + */ + (behavior: 'get default text'): string; + /** + * Returns placeholder text + */ + (behavior: 'get placeholder text'): string; + (behavior: 'destroy'): JQuery; + (behavior: 'setting', name: K, value?: undefined): DropdownSettings[K]; + (behavior: 'setting', name: K, value: DropdownSettings[K]): JQuery; + (behavior: 'setting', value: DropdownSettings): JQuery; + (settings?: DropdownSettings): JQuery; + } + /** * @see {@link http://semantic-ui.com/modules/dropdown.html#/settings} */ interface DropdownSettings extends ComponentSettings { - // TODO: Should 'value'/'values' parameters be of type 'string' instead of 'any'? - // region Frequently Used Settings /** @@ -2362,6 +1505,59 @@ declare namespace SemanticUI { // region Embed + interface Embed { + settings: EmbedSettings; + + /** + * Changes iframe to a new content source + */ + (behavior: 'change', source: string, id: string, url: string): JQuery; + /** + * Removes embed and shows placeholder content if available + */ + (behavior: 'reset'): JQuery; + /** + * Shows embed content + */ + (behavior: 'show'): JQuery; + /** + * Hides embed content and shows placeholder content + */ + (behavior: 'hide'): JQuery; + /** + * Returns current content id + */ + (behavior: 'get id'): string; + /** + * Returns placeholder image url + */ + (behavior: 'get placeholder'): string; + /** + * Returns source name + */ + (behavior: 'get sources'): string; + /** + * Returns source type + */ + (behavior: 'get type'): string; + /** + * Returns URL with all parameters added + */ + (behavior: 'get url'): string; + /** + * Returns whether embed content has placeholder + */ + (behavior: 'has placeholder'): boolean; + /** + * Destroys instance and removes all events + */ + (behavior: 'destroy'): JQuery; + (behavior: 'setting', name: K, value?: undefined): EmbedSettings[K]; + (behavior: 'setting', name: K, value: EmbedSettings[K]): JQuery; + (behavior: 'setting', value: EmbedSettings): JQuery; + (settings?: EmbedSettings): JQuery; + } + /** * @see {@link http://semantic-ui.com/modules/embed.html#/settings} */ @@ -2542,6 +1738,65 @@ declare namespace SemanticUI { // region Modal + interface Modal { + settings: ModalSettings; + + /** + * Shows the modal + */ + (behavior: 'show'): JQuery; + /** + * Hides the modal + */ + (behavior: 'hide'): JQuery; + /** + * Toggles the modal + */ + (behavior: 'toggle'): JQuery; + /** + * Refreshes centering of modal on page + */ + (behavior: 'refresh'): JQuery; + /** + * Shows associated page dimmer + */ + (behavior: 'show dimmer'): JQuery; + /** + * Hides associated page dimmer + */ + (behavior: 'hide dimmer'): JQuery; + /** + * Hides all modals not selected modal in a dimmer + */ + (behavior: 'hide others'): JQuery; + /** + * Hides all visible modals in the same dimmer + */ + (behavior: 'hide all'): JQuery; + /** + * Caches current modal size + */ + (behavior: 'cache sizes'): JQuery; + /** + * Returns whether the modal can fit on the page + */ + (behavior: 'can fit'): boolean; + /** + * Returns whether the modal is active + */ + (behavior: 'is active'): boolean; + /** + * Sets modal to active + */ + (behavior: 'set active'): JQuery; + (behavior: 'attach events', selector: Selector, event?: string): JQuery; + (behavior: 'destroy'): JQuery; + (behavior: 'setting', name: K, value?: undefined): ModalSettings[K]; + (behavior: 'setting', name: K, value: ModalSettings[K]): JQuery; + (behavior: 'setting', value: ModalSettings): JQuery; + (settings?: ModalSettings): JQuery; + } + /** * @see {@link http://semantic-ui.com/modules/modal.html#/settings} */ @@ -2698,6 +1953,22 @@ declare namespace SemanticUI { // region Nag + interface Nag { + settings: NagSettings; + + (behavior: 'show'): JQuery; + (behavior: 'hide'): JQuery; + /** + * Clears cookie so nag shows again + */ + (behavior: 'clear'): JQuery; + (behavior: 'destroy'): JQuery; + (behavior: 'setting', name: K, value?: undefined): NagSettings[K]; + (behavior: 'setting', name: K, value: NagSettings[K]): JQuery; + (behavior: 'setting', value: NagSettings): JQuery; + (settings?: NagSettings): JQuery; + } + /** * @see {@link http://semantic-ui.com/modules/nag.html} */ @@ -2826,6 +2097,67 @@ declare namespace SemanticUI { // region Popup + interface Popup { + settings: PopupSettings; + + /** + * Shows popup + */ + (behavior: 'show'): JQuery; + /** + * Hides popup + */ + (behavior: 'hide'): JQuery; + /** + * Hides all visible pop ups on the page + */ + (behavior: 'hide all'): JQuery; + /** + * Returns current popup dom element + */ + (behavior: 'get popup'): JQuery; + /** + * Changes current popup content + */ + (behavior: 'change content', html: string): JQuery; + /** + * Toggles visibility of popup + */ + (behavior: 'toggle'): JQuery; + /** + * Returns whether popup is visible + */ + (behavior: 'is visible'): boolean; + /** + * Returns whether popup is hidden + */ + (behavior: 'is hidden'): boolean; + /** + * Returns whether popup is created and inserted into the page + */ + (behavior: 'exists'): boolean; + /** + * Adjusts popup when content size changes (only necessary for centered popups) + */ + (behavior: 'reposition'): JQuery; + /** + * Repositions a popup + */ + (behavior: 'set position', position: string): JQuery; + /** + * Removes popup from the page and removes all events + */ + (behavior: 'destroy'): JQuery; + /** + * Removes popup from the page + */ + (behavior: 'remove popup'): JQuery; + (behavior: 'setting', name: K, value?: undefined): PopupSettings[K]; + (behavior: 'setting', name: K, value: PopupSettings[K]): JQuery; + (behavior: 'setting', value: PopupSettings): JQuery; + (settings?: PopupSettings): JQuery; + } + /** * @see {@link http://semantic-ui.com/modules/popup.html#/settings} */ @@ -3144,6 +2476,132 @@ declare namespace SemanticUI { // region Progress + interface Progress { + settings: ProgressSettings; + + /** + * Sets current percent of progress to value. If using a total will convert from percent to estimated value. + */ + (behavior: 'set percent', percent: number): JQuery; + /** + * Sets progress to specified value. Will automatically calculate percent from total. + */ + (behavior: 'set progress', value: number): JQuery; + /** + * Increments progress by increment value, if not passed a value will use random amount specified in settings + */ + (behavior: 'increment', incrementValue: number): JQuery; + /** + * Decrements progress by decrement value, if not passed a value will use random amount specified in settings + */ + (behavior: 'decrement', decrementValue: number): JQuery; + /** + * Immediately updates progress to value, ignoring progress animation interval delays + */ + (behavior: 'update progress', value: number): JQuery; + /** + * Finishes progress and sets loaded to 100% + */ + (behavior: 'complete'): JQuery; + /** + * Resets progress to zero + */ + (behavior: 'reset'): JQuery; + /** + * Set total to a new value + */ + (behavior: 'set total', total: number): JQuery; + /** + * Replaces templated string with value, total, percent left and percent. + */ + (behavior: 'get text', text: string): string; + /** + * Returns normalized value inside acceptable range specified by total. + */ + (behavior: 'get normalized value', value: number): number; + /** + * Returns percent as last specified + */ + (behavior: 'get percent'): number; + /** + * Returns current progress value + */ + (behavior: 'get value'): number; + /** + * Returns total + */ + (behavior: 'get total'): number; + /** + * Returns whether progress is completed + */ + (behavior: 'is complete'): boolean; + /** + * Returns whether progress was a success + */ + (behavior: 'is success'): boolean; + /** + * Returns whether progress is in warning state + */ + (behavior: 'is warning'): boolean; + /** + * Returns whether progress is in error state + */ + (behavior: 'is error'): boolean; + /** + * Returns whether progress is in active state + */ + (behavior: 'is active'): boolean; + /** + * Sets progress to active state + */ + (behavior: 'set active'): JQuery; + /** + * Sets progress to warning state + */ + (behavior: 'set warning'): JQuery; + /** + * Sets progress to success state + */ + (behavior: 'set success'): JQuery; + /** + * Sets progress to error state + */ + (behavior: 'set error'): JQuery; + /** + * Changes progress animation speed + */ + (behavior: 'set duration', value: number): JQuery; + /** + * Sets progress exterior label to text + */ + (behavior: 'set label', text: string): JQuery; + /** + * Sets progress bar label to text + */ + (behavior: 'set bar label', text: string): JQuery; + /** + * Removes progress to active state + */ + (behavior: 'remove active'): JQuery; + /** + * Removes progress to warning state + */ + (behavior: 'remove warning'): JQuery; + /** + * Removes progress to success state + */ + (behavior: 'remove success'): JQuery; + /** + * Removes progress to error state + */ + (behavior: 'remove error'): JQuery; + (behavior: 'destroy'): JQuery; + (behavior: 'setting', name: K, value?: undefined): ProgressSettings[K]; + (behavior: 'setting', name: K, value: ProgressSettings[K]): JQuery; + (behavior: 'setting', value: ProgressSettings): JQuery; + (settings?: ProgressSettings): JQuery; + } + /** * @see {@link http://semantic-ui.com/modules/progress.html#/settings} */ @@ -3352,6 +2810,36 @@ declare namespace SemanticUI { // region Rating + interface Rating { + settings: RatingSettings; + + /** + * Sets rating programmatically + */ + (behavior: 'set rating', rating: number): JQuery; + /** + * Gets current rating + */ + (behavior: 'get rating'): number; + /** + * Disables interactive rating mode + */ + (behavior: 'disable'): JQuery; + /** + * Enables interactive rating mode + */ + (behavior: 'enable'): JQuery; + /** + * Clears current rating + */ + (behavior: 'clear rating'): JQuery; + (behavior: 'destroy'): JQuery; + (behavior: 'setting', name: K, value?: undefined): RatingSettings[K]; + (behavior: 'setting', name: K, value: RatingSettings[K]): JQuery; + (behavior: 'setting', value: RatingSettings): JQuery; + (settings?: RatingSettings): JQuery; + } + /** * @see {@link http://semantic-ui.com/modules/rating.html#/settings} */ @@ -3435,6 +2923,103 @@ declare namespace SemanticUI { // region Search + interface Search { + settings: SearchSettings; + + /** + * Search for value currently set in search input + */ + (behavior: 'query', callback?: () => void): JQuery; + /** + * Displays message in search results with text, using template matching type + */ + (behavior: 'display message', text: string, type: string): JQuery; + /** + * Cancels current remote search query + */ + (behavior: 'cancel query'): JQuery; + /** + * Search local object for specified query and display results + */ + (behavior: 'search local', query: string): JQuery; + /** + * Whether has minimum characters + */ + (behavior: 'has minimum characters'): boolean; + /** + * Search remote endpoint for specified query and display results + */ + (behavior: 'search remote', query: string, callback?: () => void): JQuery; + /** + * Search object for specified query and return results + */ + (behavior: 'search object', query: string, object: any, searchFields: string[]): any; + /** + * Cancels current remote search request + */ + (behavior: 'cancel query'): JQuery; + /** + * Whether search is currently focused + */ + (behavior: 'is focused'): boolean; + /** + * Whether search results are visible + */ + (behavior: 'is visible'): boolean; + /** + * Whether search results are empty + */ + (behavior: 'is empty'): boolean; + /** + * Returns current search value + */ + (behavior: 'get value'): any; + /** + * Returns JSON object matching searched title or id (see above) + */ + (behavior: 'get result', value: any): any; + /** + * Sets search input to value + */ + (behavior: 'set value', value: any): JQuery; + /** + * Reads cached results for query + */ + (behavior: 'read cache', query: string): JQuery; + /** + * Clears value from cache, if no parameter passed clears all cache + */ + (behavior: 'clear cache', query?: string): JQuery; + /** + * Writes cached results for query + */ + (behavior: 'write cache', query: string): JQuery; + /** + * Adds HTML to results and displays + */ + (behavior: 'add results', html: string): JQuery; + /** + * Shows results container + */ + (behavior: 'show results', callback?: () => void): JQuery; + /** + * Hides results container + */ + (behavior: 'hide results', callback?: () => void): JQuery; + /** + * Generates results using parser specified by settings.template + */ + (behavior: 'generate results', response: any): JQuery; + /** + * Removes all events + */ + (behavior: 'destroy'): JQuery; + (behavior: 'setting', name: K, value?: undefined): SearchSettings[K]; + (behavior: 'setting', name: K, value: SearchSettings[K]): JQuery; + (behavior: 'setting', value: SearchSettings): JQuery; + (settings?: SearchSettings): JQuery; + } + /** * @see {@link http://semantic-ui.com/modules/search.html#/settings} */ @@ -3761,6 +3346,92 @@ declare namespace SemanticUI { // region Shape + interface Shape { + settings: ShapeSettings; + + /** + * Flips the shape upward + */ + (behavior: 'flip up'): JQuery; + /** + * Flips the shape downward + */ + (behavior: 'flip down'): JQuery; + /** + * Flips the shape right + */ + (behavior: 'flip right'): JQuery; + /** + * Flips the shape left + */ + (behavior: 'flip left'): JQuery; + /** + * Flips the shape over clock-wise + */ + (behavior: 'flip over'): JQuery; + /** + * Flips the shape over counter-clockwise + */ + (behavior: 'flip back'): JQuery; + /** + * Set the next side to a specific selector + */ + (behavior: 'set next side', selector: Selector): JQuery; + /** + * Returns whether shape is currently animating + */ + (behavior: 'is animating'): boolean; + /** + * Removes all inline styles + */ + (behavior: 'reset'): JQuery; + /** + * Queues an animation until after current animation + */ + (behavior: 'queue', animation: string): JQuery; + /** + * Forces a reflow on element + */ + (behavior: 'repaint'): JQuery; + /** + * Set the next side to next sibling to active element + */ + (behavior: 'set default side'): JQuery; + /** + * Sets shape to the content size of the next side + */ + (behavior: 'set stage size'): JQuery; + /** + * Refreshes the selector cache for element sides + */ + (behavior: 'refresh'): JQuery; + /** + * Returns translation for next side staged below + */ + (behavior: 'get transform down'): Translation; + /** + * Returns translation for next side staged left + */ + (behavior: 'get transform left'): Translation; + /** + * Returns translation for next side staged right + */ + (behavior: 'get transform right'): Translation; + /** + * Returns translation for next side staged up + */ + (behavior: 'get transform up'): Translation; + /** + * Returns translation for next side staged down + */ + (behavior: 'get transform down'): Translation; + (behavior: 'destroy'): JQuery; + (behavior: 'setting', name: K, value?: undefined): ShapeSettings[K]; + (behavior: 'setting', name: K, value: ShapeSettings[K]): JQuery; + (behavior: 'setting', value: ShapeSettings): JQuery; + (settings?: ShapeSettings): JQuery; + } + /** * @see {@link http://semantic-ui.com/modules/shape.html#/settings} */ @@ -3864,6 +3535,64 @@ declare namespace SemanticUI { // region Sidebar + interface Sidebar { + settings: SidebarSettings; + + /** + * Attaches sidebar action to given selector. Default event if none specified is toggle + */ + (behavior: 'attach events', selector: string, event?: string): JQuery; + /** + * Shows sidebar + */ + (behavior: 'show'): JQuery; + /** + * Hides sidebar + */ + (behavior: 'hide'): JQuery; + /** + * Toggles visibility of sidebar + */ + (behavior: 'toggle'): JQuery; + /** + * Returns whether sidebar is visible + */ + (behavior: 'is visible'): boolean; + /** + * Returns whether sidebar is hidden + */ + (behavior: 'is hidden'): boolean; + /** + * Pushes page content to be visible alongside sidebar + */ + (behavior: 'push page'): JQuery; + /** + * Returns direction of current sidebar + */ + (behavior: 'get direction'): string; + /** + * Returns page content to original position + */ + (behavior: 'pull page'): JQuery; + /** + * Adds stylesheet to page head to trigger sidebar animations + */ + (behavior: 'add body CSS'): JQuery; + /** + * Removes any inline stylesheets for sidebar animation + */ + (behavior: 'remove body CSS'): JQuery; + /** + * Returns vendor prefixed transition end event + */ + (behavior: 'get transition event'): string; + (behavior: 'destroy'): JQuery; + (behavior: 'setting', name: K, value?: undefined): SidebarSettings[K]; + (behavior: 'setting', name: K, value: SidebarSettings[K]): JQuery; + (behavior: 'setting', value: SidebarSettings): JQuery; + (settings?: SidebarSettings): JQuery; + } + /** * @see {@link http://semantic-ui.com/modules/sidebar.html#/settings} */ @@ -4127,6 +3856,20 @@ declare namespace SemanticUI { // region Sticky + interface Sticky { + settings: StickySettings; + + /** + * recalculates offsets + */ + (behavior: 'refresh'): JQuery; + (behavior: 'destroy'): JQuery; + (behavior: 'setting', name: K, value?: undefined): StickySettings[K]; + (behavior: 'setting', name: K, value: StickySettings[K]): JQuery; + (behavior: 'setting', value: StickySettings): JQuery; + (settings?: StickySettings): JQuery; + } + /** * @see {@link http://semantic-ui.com/modules/sticky.html#/settings} */ @@ -4269,6 +4012,49 @@ declare namespace SemanticUI { // region Tab + interface Tab { + settings: TabSettings; + + // Documentation says this exists but it does not. + // /** + // * Attaches tab action to given selector. Default event if none specified is toggle + // */ + // (behavior: 'attach events', selector: Selector, event?: string): JQuery; + /** + * Changes tab to path + */ + (behavior: 'change tab', path: string): JQuery; + /** + * Sets current path to state + */ + (behavior: 'set state', path: string): JQuery; + /** + * Returns current path + */ + (behavior: 'get path'): string; + /** + * Returns whether tab exists + */ + (behavior: 'is tab'): boolean; + /** + * Returns cached HTML for path + */ + (behavior: 'cache read', path: string): string | false; + /** + * Sets cached HTML for path + */ + (behavior: 'cache add', path: string, html: string): JQuery; + /** + * Removes cached HTML for path + */ + (behavior: 'cache remove', path: string): JQuery; + (behavior: 'destroy'): JQuery; + (behavior: 'setting', name: K, value?: undefined): TabSettings[K]; + (behavior: 'setting', name: K, value: TabSettings[K]): JQuery; + (behavior: 'setting', value: TabSettings): JQuery; + (settings?: TabSettings): JQuery; + } + /** * @see {@link http://semantic-ui.com/modules/tab.html#/settings} */ @@ -4496,6 +4282,105 @@ declare namespace SemanticUI { // region Transition + interface Transition { + settings: TransitionSettings; + + /** + * Stop current animation and preserve queue + */ + (behavior: 'stop'): JQuery; + /** + * Stop current animation and queued animations + */ + (behavior: 'stop all'): JQuery; + /** + * Clears all queued animations + */ + (behavior: 'clear queue'): JQuery; + /** + * Stop current animation and show element + */ + (behavior: 'show'): JQuery; + /** + * Stop current animation and hide element + */ + (behavior: 'hide'): JQuery; + /** + * Toggles between hide and show + */ + (behavior: 'toggle'): JQuery; + /** + * Forces reflow using a more expensive but stable method + */ + (behavior: 'force repaint'): JQuery; + /** + * Triggers reflow on element + */ + (behavior: 'repaint'): JQuery; + /** + * Resets all conditions changes during transition + */ + (behavior: 'reset'): JQuery; + /** + * Enables animation looping + */ + (behavior: 'looping'): JQuery; + /** + * Removes looping state from element + */ + (behavior: 'remove looping'): JQuery; + /** + * Adds disabled state (stops ability to animate) + */ + (behavior: 'disable'): JQuery; + /** + * Removes disabled state + */ + (behavior: 'enable'): JQuery; + /** + * Modifies element animation duration + */ + (behavior: 'set duration', duration: number): JQuery; + /** + * Saves all class names and styles to cache to be retrieved after animation + */ + (behavior: 'save conditions'): JQuery; + /** + * Adds back cached names and styles to element + */ + (behavior: 'restore conditions'): JQuery; + /** + * Returns vendor prefixed animation property for animationname + */ + (behavior: 'get animation name'): string; + /** + * Returns vendor prefixed animation property for animationend + */ + (behavior: 'get animation event'): string; + /** + * Returns whether element is currently visible + */ + (behavior: 'is visible'): boolean; + /** + * Returns whether transition is currently occurring + */ + (behavior: 'is animating'): boolean; + /** + * Returns whether animation looping is set + */ + (behavior: 'is looping'): boolean; + /** + * Returns whether animations are supported + */ + (behavior: 'is supported'): boolean; + (behavior: 'destroy'): JQuery; + (behavior: 'setting', name: K, value?: undefined): TransitionSettings[K]; + (behavior: 'setting', name: K, value: TransitionSettings[K]): JQuery; + (behavior: 'setting', value: TransitionSettings): JQuery; + (transition: string): JQuery; + (settings?: TransitionSettings): JQuery; + } + /** * @see {@link http://semantic-ui.com/modules/transition.html#/settings} */ @@ -4638,6 +4523,103 @@ declare namespace SemanticUI { // region API + interface Api { + settings: ApiSettings; + + /** + * Execute query using existing API settings + */ + (behavior: 'query'): JQuery; + /** + * Adds data to existing templated url and returns full url string + */ + (behavior: 'add url data', url: string, data: any): string; + /** + * Gets promise for current API request + */ + (behavior: 'get request'): JQueryDeferred | false; + /** + * Aborts current API request + */ + (behavior: 'abort'): JQuery; + /** + * Removes loading and error state from element + */ + (behavior: 'reset'): JQuery; + /** + * Returns whether last request was cancelled + */ + (behavior: 'was cancelled'): boolean; + /** + * Returns whether last request was failure + */ + (behavior: 'was failure'): boolean; + /** + * Returns whether last request was successful + */ + (behavior: 'was successful'): boolean; + /** + * Returns whether last request was completed + */ + (behavior: 'was complete'): boolean; + /** + * Returns whether element is disabled + */ + (behavior: 'is disabled'): boolean; + /** + * Returns whether element response is mocked + */ + (behavior: 'is mocked'): boolean; + /** + * Returns whether element is loading + */ + (behavior: 'is loading'): boolean; + /** + * Sets loading state to element + */ + (behavior: 'set loading'): JQuery; + /** + * Sets error state to element + */ + (behavior: 'set error'): JQuery; + /** + * Removes loading state to element + */ + (behavior: 'remove loading'): JQuery; + /** + * Removes error state to element + */ + (behavior: 'remove error'): JQuery; + /** + * Gets event that API request will occur on + */ + (behavior: 'get event'): string; + /** + * Returns encodeURIComponent value only if value passed is not already encoded + */ + (behavior: 'get url encoded value', value: any): string; + /** + * Reads a locally cached response for a URL + */ + (behavior: 'read cached response', url: string): any; + /** + * Writes a cached response for a URL + */ + (behavior: 'write cached response', url: string, response: any): JQuery; + /** + * Creates new cache, removing all locally cached URLs + */ + (behavior: 'create cache'): JQuery; + /** + * Removes API settings from the page and all events + */ + (behavior: 'destroy'): JQuery; + (behavior: 'setting', name: K, value?: undefined): ApiSettings[K]; + (behavior: 'setting', name: K, value: ApiSettings[K]): JQuery; + (behavior: 'setting', value: ApiSettings): JQuery; + (settings?: ApiSettings): JQuery; + } + /** * @see {@link http://semantic-ui.com/behaviors/api.html#/settings} */ @@ -4936,6 +4918,64 @@ declare namespace SemanticUI { // region Form Validation + interface Form { + settings: FormSettings; + + /** + * Submits selected form + */ + (behavior: 'submit'): JQuery; + /** + * Returns true/false whether a form passes its validation rules + */ + (behavior: 'is valid'): boolean; + /** + * Validates form and calls onSuccess or onFailure + */ + (behavior: 'validate form'): JQuery; + /** + * gets browser property change event + */ + (behavior: 'get change event'): string; + /** + * Returns element with matching name, id, or data-validate metadata to ID + */ + (behavior: 'get field', id: string): JQuery; + /** + * Returns value of element with id + */ + (behavior: 'get value', id: string): any; + /** + * Returns object of element values that match array of ids. If no IDS are passed will return all fields + */ + (behavior: 'get values', ids?: string[]): any; + /** + * Sets value of element with id + */ + (behavior: 'set value', id: string): JQuery; + /** + * Sets key/value pairs from passed values object to matching ids + */ + (behavior: 'set values', values: any): JQuery; + /** + * Returns validation rules for a given jQuery-referenced input field + */ + (behavior: 'get validation', element: JQuery): any; + /** + * Returns whether a field exists + */ + (behavior: 'has field', identifier: string): boolean; + /** + * Adds errors to form, given an array errors + */ + (behavior: 'add errors', errors: string[]): JQuery; + (behavior: 'destroy'): JQuery; + (behavior: 'setting', name: K, value?: undefined): FormSettings[K]; + (behavior: 'setting', name: K, value: FormSettings[K]): JQuery; + (behavior: 'setting', value: FormSettings): JQuery; + (settings?: FormSettings): JQuery; + } + /** * @see {@link http://semantic-ui.com/behaviors/form.html#/settings} */ @@ -5136,8 +5176,8 @@ declare namespace SemanticUI { // region Templates templates?: { - error?: (errors: string[]) => JQuery; - prompt?: (errors: string[]) => JQuery; + error?(errors: string[]): JQuery; + prompt?(errors: string[]): JQuery; }; // endregion @@ -5240,6 +5280,48 @@ declare namespace SemanticUI { // region Visibility + interface Visibility { + settings: VisibilitySettings; + + /** + * Disable callbacks temporarily. This is useful if you need to adjust scroll position and do not want to trigger callbacks during the position change. + */ + (behavior: 'disable callbacks'): JQuery; + /** + * Re-enable callbacks + */ + (behavior: 'enable callbacks'): JQuery; + /** + * Returns whether element is on screen + */ + (behavior: 'is on screen'): boolean; + /** + * Returns whether element is off screen + */ + (behavior: 'is off screen'): boolean; + /** + * Returns number of pixels passed in current element from top of element + */ + (behavior: 'get pixels passed'): number; + /** + * Returns element calculations as object + */ + (behavior: 'get element calculations'): ElementCalculations; + /** + * Returns screen calculations as object + */ + (behavior: 'get screen calculations'): ScreenCalculations; + /** + * Returns screen size as object + */ + (behavior: 'get screen size'): ScreenSize; + (behavior: 'destroy'): JQuery; + (behavior: 'setting', name: K, value?: undefined): VisibilitySettings[K]; + (behavior: 'setting', name: K, value: VisibilitySettings[K]): JQuery; + (behavior: 'setting', value: VisibilitySettings): JQuery; + (settings?: VisibilitySettings): JQuery; + } + /** * @see {@link http://semantic-ui.com/behaviors/visibility.html#/settings} */ @@ -5382,9 +5464,9 @@ declare namespace SemanticUI { /** * Element's bottom edge has not passed top of screen */ - onBottomPassedReverse?: (this: JQuery) => void; - onOnScreen?: (this: JQuery) => void; - onOffScreen?: (this: JQuery) => void; + onBottomPassedReverse?(this: JQuery): void; + onOnScreen?(this: JQuery): void; + onOffScreen?(this: JQuery): void; // endregion diff --git a/types/semantic-ui/semantic-ui-tests.ts b/types/semantic-ui/semantic-ui-tests.ts index ad71c0fe92..be142a089e 100644 --- a/types/semantic-ui/semantic-ui-tests.ts +++ b/types/semantic-ui/semantic-ui-tests.ts @@ -1,3 +1,51 @@ +function test_site() { + const selector = '.ui.site'; + $(selector).site('destroy') === $(); + $(selector).site('setting', 'debug', undefined) === false; + $(selector).site('setting', 'debug') === false; + $(selector).site('setting', 'debug', true) === $(); + $(selector).site('setting', { + namespace: 'namespace', + name: 'name', + silent: false, + debug: true, + performance: true, + verbose: true + }) === $(); + $(selector).site({ + modules: [ + 'accordion', + 'api', + 'checkbox', + 'dimmer', + 'dropdown', + 'embed', + 'form', + 'modal', + 'nag', + 'popup', + 'rating', + 'shape', + 'sidebar', + 'state', + 'sticky', + 'tab', + 'transition', + 'visit', + 'visibility' + ], + siteNamespace: 'site', + namespaceStub: { + cache: {}, + config: {}, + sections: {}, + section: {}, + utilities: {} + } + }) === $(); + $(selector).site() === $(); +} + function test_accordion() { const selector = '.ui.accordion'; $(selector).accordion('refresh'); @@ -5,6 +53,10 @@ function test_accordion() { $(selector).accordion('close others'); $(selector).accordion('close', 0); $(selector).accordion('toggle', 0); + $(selector).accordion('destroy'); + $(selector).accordion('setting', 'exclusive', undefined) === true; + $(selector).accordion('setting', 'exclusive', true) === $(); + $(selector).accordion('setting', 'exclusive') === true; $(selector).accordion({ selector: { trigger: '.title .icon' @@ -19,10 +71,97 @@ function test_checkbox() { $(selector).checkbox(); } +function test_dimmer_settings() { + $.fn.dimmer.settings.namespace = 'namespace'; + $.fn.dimmer.settings.name = 'name'; + $.fn.dimmer.settings.silent = false; + $.fn.dimmer.settings.debug = true; + $.fn.dimmer.settings.performance = true; + $.fn.dimmer.settings.verbose = true; +} + function test_dimmer() { const selector = '.ui.dimmer'; - $(selector).dimmer({}); - $(selector).dimmer(); + $(selector).dimmer('add content', $()) === $(); + $(selector).dimmer('show') === $(); + $(selector).dimmer('hide') === $(); + $(selector).dimmer('toggle') === $(); + $(selector).dimmer('set opacity', 1) === $(); + $(selector).dimmer('create') === $(); + $(selector).dimmer('get duration') === 10; + $(selector).dimmer('get dimmer') === $(); + $(selector).dimmer('has dimmer') === true; + $(selector).dimmer('is active') === true; + $(selector).dimmer('is animating') === true; + $(selector).dimmer('is dimmer') === true; + $(selector).dimmer('is dimmable') === true; + $(selector).dimmer('is disabled') === true; + $(selector).dimmer('is enabled') === true; + $(selector).dimmer('is page') === true; + $(selector).dimmer('is page dimmer') === true; + $(selector).dimmer('set active') === $(); + $(selector).dimmer('set dimmable') === $(); + $(selector).dimmer('set dimmed') === $(); + $(selector).dimmer('set page dimmer') === $(); + $(selector).dimmer('set disabled') === $(); + $(selector).dimmer('destroy') === $(); + $(selector).dimmer('setting', 'debug', undefined) === false; + $(selector).dimmer('setting', 'debug') === false; + $(selector).dimmer('setting', 'debug', true) === $(); + $(selector).dimmer('setting', { + namespace: 'namespace', + name: 'name', + silent: false, + debug: true, + performance: true, + verbose: true + }) === $(); + $(selector).dimmer({ + opacity: 1, + variation: 'variation', + dimmerName: 'dimmerName', + closable: true, + on: 'click', + useCSS: true, + duration: { + show: 200, + hide: 300 + }, + transition: 'fade', + onShow() { + this === $(); + }, + onHide() { + this === $(); + }, + onChange() { + this === $(); + }, + selector: { + dimmable: '.dimmable', + dimmer: '.dimmer', + content: '.content' + }, + template: { + dimmer() { + return $(); + } + }, + className: { + active: 'active', + dimmable: 'dimmable', + dimmed: 'dimmed', + disabled: 'disabled', + pageDimmer: 'pageDimmer', + hide: 'hide', + show: 'show', + transition: 'transition' + }, + error: { + method: 'method' + } + }) === $(); + $(selector).dimmer() === $(); } function test_dropdown() { @@ -101,10 +240,90 @@ function test_tab() { $(selector).tab(); } +function test_transition_settings() { + $.fn.transition.settings.namespace = 'namespace'; + $.fn.transition.settings.name = 'name'; + $.fn.transition.settings.silent = false; + $.fn.transition.settings.debug = true; + $.fn.transition.settings.performance = true; + $.fn.transition.settings.verbose = true; +} + function test_transition() { const selector = '.ui.transition'; - $(selector).transition({}); - $(selector).transition(); + $(selector).transition('stop') === $(); + $(selector).transition('stop all') === $(); + $(selector).transition('clear queue') === $(); + $(selector).transition('show') === $(); + $(selector).transition('hide') === $(); + $(selector).transition('toggle') === $(); + $(selector).transition('force repaint') === $(); + $(selector).transition('repaint') === $(); + $(selector).transition('reset') === $(); + $(selector).transition('looping') === $(); + $(selector).transition('remove looping') === $(); + $(selector).transition('disable') === $(); + $(selector).transition('enable') === $(); + $(selector).transition('set duration', 10) === $(); + $(selector).transition('save conditions') === $(); + $(selector).transition('restore conditions') === $(); + $(selector).transition('get animation name') === 'animation name'; + $(selector).transition('get animation event') === 'animation event'; + $(selector).transition('is visible') === false; + $(selector).transition('is animating') === false; + $(selector).transition('is looping') === false; + $(selector).transition('is supported') === false; + $(selector).transition('destroy') === $(); + $(selector).transition('setting', 'debug', undefined) === false; + $(selector).transition('setting', 'debug') === false; + $(selector).transition('setting', 'debug', true) === $(); + $(selector).transition('setting', { + namespace: 'namespace', + name: 'name', + silent: false, + debug: true, + performance: true, + verbose: true + }) === $(); + $(selector).transition('fade') === $(); + $(selector).transition({ + animation: 'fade', + interval: 200, + reverse: true, + displayType: 'inline-block', + duration: 300, + useFailSafe: false, + allowRepeats: true, + queue: false, + onShow() { + this === $(); + }, + onHide() { + this === $(); + }, + onStart() { + this === $(); + }, + onComplete() { + this === $(); + }, + className: { + animating: 'animating', + disabled: 'disabled', + hidden: 'hidden', + inward: 'inward', + loading: 'loading', + looping: 'looping', + outward: 'outward', + transition: 'transition', + visible: 'visible' + }, + error: { + noAnimation: 'noAnimation', + method: 'method' + } + }); + $(selector).transition() === $(); } function test_api() { @@ -207,9 +426,14 @@ function test_visibility() { } function test_settings() { + $.site.settings.verbose = true; + + $.api.settings.verbose = true; + + $.fn.site.settings.verbose = true; + $.fn.accordion.settings.verbose = true; $.fn.checkbox.settings.verbose = true; - $.fn.dimmer.settings.verbose = true; $.fn.dropdown.settings.verbose = true; $.fn.embed.settings.verbose = true; $.fn.modal.settings.verbose = true; @@ -222,10 +446,8 @@ function test_settings() { $.fn.sidebar.settings.verbose = true; $.fn.sticky.settings.verbose = true; $.fn.tab.settings.verbose = true; - $.fn.transition.settings.verbose = true; $.fn.api.settings.verbose = true; $.fn.form.settings.verbose = true; $.fn.visibility.settings.verbose = true; } -test_settings(); diff --git a/types/semantic-ui/tslint.json b/types/semantic-ui/tslint.json index 3ea8f1c1f1..08b1465cd6 100644 --- a/types/semantic-ui/tslint.json +++ b/types/semantic-ui/tslint.json @@ -1,7 +1,6 @@ { "extends": "dtslint/dt.json", "rules": { - "unified-signatures": false, - "prefer-method-signature": false + "unified-signatures": false } } From 52c5e0734682fc73882a3d751581c7a6d3385f5a Mon Sep 17 00:00:00 2001 From: amiram Date: Sun, 28 May 2017 21:30:21 +0300 Subject: [PATCH 0139/1105] Make UpdateUserData extend UserData --- types/auth0/index.d.ts | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/types/auth0/index.d.ts b/types/auth0/index.d.ts index a27493244a..5fab6ff513 100644 --- a/types/auth0/index.d.ts +++ b/types/auth0/index.d.ts @@ -13,33 +13,23 @@ export interface ManagementClientOptions { export interface UserMetadata { } export interface AppMetadata { } -export interface CreateUserData { +export interface UserData { connection: string; email?: string; username?: string; - password?: string; - phone_number?: string; - user_metadata?: UserMetadata; email_verified?: boolean; verify_email?: boolean; + password?: string; + phone_number?: string; phone_verified?: boolean, + user_metadata?: UserMetadata; app_metadata?: AppMetadata; } -export interface UpdateUserData { +export interface UpdateUserData extends UserData { blocked?: boolean; - email_verified?: boolean; - email?: string; - verify_email?: boolean, - phone_number?: string, - phone_verified?: boolean, verify_phone_number?: boolean, - password?: string, verify_password?: boolean, - user_metadata?: UserMetadata, - app_metadata?: AppMetadata, - connection?: string, - username?: string, client_id?: string } @@ -358,8 +348,8 @@ export class ManagementClient { getUser(params: ObjectWithId): Promise; getUser(params: ObjectWithId, cb?: (err: Error, user: User) => void): void; - createUser(data: CreateUserData): Promise; - createUser(data: CreateUserData, cb: (err: Error, data: User) => void): void; + createUser(data: UserData): Promise; + createUser(data: UserData, cb: (err: Error, data: User) => void): void; updateUser(params: ObjectWithId, data: UpdateUserData): Promise; updateUser(params: ObjectWithId, data: UpdateUserData, cb: (err: Error, data: User) => void): void; From babb37825c209e7c9630414ca0968847611db7df Mon Sep 17 00:00:00 2001 From: amiram Date: Mon, 29 May 2017 07:32:13 +0300 Subject: [PATCH 0140/1105] Make CreateUserData extend UserData --- types/auth0/index.d.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/types/auth0/index.d.ts b/types/auth0/index.d.ts index 5fab6ff513..79e02498c2 100644 --- a/types/auth0/index.d.ts +++ b/types/auth0/index.d.ts @@ -14,7 +14,6 @@ export interface UserMetadata { } export interface AppMetadata { } export interface UserData { - connection: string; email?: string; username?: string; email_verified?: boolean; @@ -26,7 +25,12 @@ export interface UserData { app_metadata?: AppMetadata; } +export interface CreateUserData extends UserData { + connection: string; +} + export interface UpdateUserData extends UserData { + connection?: string; blocked?: boolean; verify_phone_number?: boolean, verify_password?: boolean, @@ -348,8 +352,8 @@ export class ManagementClient { getUser(params: ObjectWithId): Promise; getUser(params: ObjectWithId, cb?: (err: Error, user: User) => void): void; - createUser(data: UserData): Promise; - createUser(data: UserData, cb: (err: Error, data: User) => void): void; + createUser(data: CreateUserData): Promise; + createUser(data: CreateUserData, cb: (err: Error, data: User) => void): void; updateUser(params: ObjectWithId, data: UpdateUserData): Promise; updateUser(params: ObjectWithId, data: UpdateUserData, cb: (err: Error, data: User) => void): void; From 5332c59958bcdf3220c211ce21530b12b7144dcc Mon Sep 17 00:00:00 2001 From: Geert Jansen Date: Mon, 29 May 2017 09:04:45 +0200 Subject: [PATCH 0141/1105] update methodNames parameter type on createSpyObj Adds missing Object type to the methodNames parameter on the jasmine.createSpyObj method. --- types/jasmine/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/jasmine/index.d.ts b/types/jasmine/index.d.ts index 11b0d1919c..4f57d976fe 100644 --- a/types/jasmine/index.d.ts +++ b/types/jasmine/index.d.ts @@ -58,8 +58,8 @@ declare namespace jasmine { function objectContaining(sample: Partial): ObjectContaining; function createSpy(name: string, originalFn?: Function): Spy; - function createSpyObj(baseName: string, methodNames: any[]): any; - function createSpyObj(baseName: string, methodNames: any[]): T; + function createSpyObj(baseName: string, methodNames: any[] | {[methodName: string]: any}): any; + function createSpyObj(baseName: string, methodNames: any[] | {[methodName: string]: any}): T; function pp(value: any): string; From 649f8e44f145620cd9409aa8ac4ca87888a11796 Mon Sep 17 00:00:00 2001 From: Gabe Scholz Date: Mon, 29 May 2017 16:17:51 -0700 Subject: [PATCH 0142/1105] PR Fixes: - Fix Jest version - Add hasAssertions() --- types/jest/index.d.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/types/jest/index.d.ts b/types/jest/index.d.ts index 9c96fd1615..9abee06c9f 100644 --- a/types/jest/index.d.ts +++ b/types/jest/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Jest 19.2.0 +// Type definitions for Jest 20.0.4 // Project: http://facebook.github.io/jest/ // Definitions by: Asana , Ivo Stratev , jwbay , Alexey Svetliakov , Alex Jover Morales // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -167,6 +167,8 @@ declare namespace jest { arrayContaining(arr: any[]): any; /** Verifies that a certain number of assertions are called during a test. This is often useful when testing asynchronous code, in order to make sure that assertions in a callback actually got called. */ assertions(num: number): void; + /** Verifies that at least one assertion is called during a test. This is often useful when testing asynchronous code, in order to make sure that assertions in a callback actually got called. */ + hasAssertions(): void; /** You can use `expect.extend` to add your own matchers to Jest. */ extend(obj: ExpectExtendMap): void; /** Matches any object that recursively matches the provided keys. This is often handy in conjunction with other asymmetric matchers. */ From 357b6211e56b080a06106f6f0856f75086068078 Mon Sep 17 00:00:00 2001 From: Nick Mertens Date: Tue, 30 May 2017 20:36:04 +1200 Subject: [PATCH 0143/1105] Add screenProps to NavigationContainerProps interface --- types/react-navigation/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/react-navigation/index.d.ts b/types/react-navigation/index.d.ts index ffa936f6d0..d5a8553a95 100644 --- a/types/react-navigation/index.d.ts +++ b/types/react-navigation/index.d.ts @@ -476,6 +476,7 @@ export interface LayoutEvent { } interface NavigationContainerProps { + screenProps?: any navigation?: NavigationProp onNavigationStateChange?: ( preNavigationState: NavigationState, From 3e4702451619a9c6d0cb2a9e1d7dce9650914264 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vesa=20Poikaj=C3=A4rvi?= Date: Tue, 30 May 2017 18:18:18 +0300 Subject: [PATCH 0144/1105] [basic-auth] removed redundant JSDoc --- types/basic-auth/index.d.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/types/basic-auth/index.d.ts b/types/basic-auth/index.d.ts index f5e0499b44..8292f1349f 100644 --- a/types/basic-auth/index.d.ts +++ b/types/basic-auth/index.d.ts @@ -17,10 +17,6 @@ declare namespace auth { /** * Parse basic auth to object. - * - * @param {string} string - * @return {object} - * @public */ function parse(authorizationHeader: string): auth.BasicAuthResult | undefined; } From 52318fe24f42759f3f41bbf86075b0aff9aab432 Mon Sep 17 00:00:00 2001 From: Leonard Thieu Date: Tue, 30 May 2017 13:46:54 -0400 Subject: [PATCH 0145/1105] Conform header label. --- types/jquery/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/jquery/index.d.ts b/types/jquery/index.d.ts index d9841c1185..a8b2895d6b 100644 --- a/types/jquery/index.d.ts +++ b/types/jquery/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for jQuery 1.10.x / 2.0.x +// Type definitions for jQuery 2.0 // Project: http://jquery.com/ // Definitions by: Boris Yankov // Christian Hoffmeister From 5f2d685e7beacdff66692804471b7c5b9dff41d7 Mon Sep 17 00:00:00 2001 From: Herrington Darkholme Date: Wed, 31 May 2017 17:13:37 +0800 Subject: [PATCH 0146/1105] update js-beautify typing According to https://github.com/beautify-web/js-beautify/blob/895a45d95b36d8e37a2b8ad4dda488c0e1a8f272/tools/template/beautify-html.begin.js --- types/js-beautify/index.d.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/types/js-beautify/index.d.ts b/types/js-beautify/index.d.ts index 47fdd8292e..e73e013325 100644 --- a/types/js-beautify/index.d.ts +++ b/types/js-beautify/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for js_beautify // Project: https://github.com/beautify-web/js-beautify/ -// Definitions by: Josh Goldberg , Hans Windhoff +// Definitions by: Josh Goldberg , Hans Windhoff // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped interface JsBeautifyOptions { @@ -30,18 +30,20 @@ interface HTMLBeautifyOptions { indent_size?: number; indent_char?: string; indent_with_tabs?: boolean; + indent_handlebars?: boolean; eol?: string; end_with_newline?: boolean; preserve_newlines?: boolean; max_preserve_newlines?: number; indent_inner_html?: boolean; brace_style?: 'collapse-preserve-inline'|'collapse'|'expand'|'end-expand'|'none'; - indent_scripts?: boolean; + indent_scripts?: 'keep'|'separate'|'normal'; wrap_line_length?: number; wrap_attributes?: 'auto'|'force' ; wrap_attributes_indent_size?: number; - unformatted?: string; - extra_liners?: string; + unformatted?: string[]; + content_unformatted?: string[]; + extra_liners?: string|string[]; } interface CSSBeautifyOptions { @@ -50,7 +52,7 @@ interface CSSBeautifyOptions { indent_with_tabs?: boolean; eol?: string; end_with_newline?: boolean; - selector_separator_newline?: boolean; + selector_separator_newline?: boolean; newline_between_rules?: boolean; } @@ -61,7 +63,7 @@ interface jsb{ css:(js_source_text: string, options?: CSSBeautifyOptions) => string ; css_beautify:(js_source_text: string, options?: CSSBeautifyOptions) => string ; - + html:(js_source_text: string, options?: HTMLBeautifyOptions) => string ; html_beautify:(js_source_text: string, options?: HTMLBeautifyOptions) => string ; } From b674889b5b3df164961b60e3bec25e43c52211d1 Mon Sep 17 00:00:00 2001 From: Fried-Chicken Date: Wed, 31 May 2017 15:11:57 +0100 Subject: [PATCH 0147/1105] Added test for AlgoliaResponse typing --- types/algoliasearch/algoliasearch-tests.ts | 27 +++++++++++++++------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/types/algoliasearch/algoliasearch-tests.ts b/types/algoliasearch/algoliasearch-tests.ts index 1e1a6296ba..43a4d677cf 100644 --- a/types/algoliasearch/algoliasearch-tests.ts +++ b/types/algoliasearch/algoliasearch-tests.ts @@ -1,16 +1,27 @@ import * as algoliasearch from "algoliasearch"; -import { ClientOptions, SynonymOption, AlgoliaUserKeyOptions, SearchSynonymOptions, +import { ClientOptions, SynonymOption, AlgoliaUserKeyOptions, SearchSynonymOptions, AlgoliaResponse, AlgoliaSecuredApiOptions, AlgoliaIndexSettings, AlgoliaQueryParameters, AlgoliaIndex } from "algoliasearch"; +let _algoliaResponse: AlgoliaResponse = { + hits: [{}, {}], + page: 0, + nbHits: 12, + nbPages: 6, + hitsPerPage: 2, + processingTimeMS: 32, + query: "", + params: "", +}; + let _clientOptions: ClientOptions = { timeout: 12, protocol: "", - httpAgent: "" + httpAgent: "", }; let _synonymOption: SynonymOption = { forwardToSlaves: false, - replaceExistingSynonyms: false + replaceExistingSynonyms: false, }; let _algoliaUserKeyOptions: AlgoliaUserKeyOptions = { @@ -18,21 +29,21 @@ let _algoliaUserKeyOptions: AlgoliaUserKeyOptions = { maxQueriesPerIPPerHour: 0, indexes: [""], queryParameters: { attributesToRetrieve: ["algolia"] }, - description: "" + description: "", }; let _searchSynonymOptions: SearchSynonymOptions = { query: "", page: 0, type: "", - hitsPerPage: 0 + hitsPerPage: 0, }; let _algoliaSecuredApiOptions: AlgoliaSecuredApiOptions = { filters: "", validUntil: 0, restrictIndices: "", - userToken: "" + userToken: "", }; let _algoliaIndexSettings: AlgoliaIndexSettings = { @@ -73,7 +84,7 @@ let _algoliaIndexSettings: AlgoliaIndexSettings = { allowCompressionOfIntegerArray: false, altCorrections: [{}], minProximity: 0, - placeholders: "" + placeholders: "", }; let _algoliaQueryParameters: AlgoliaQueryParameters = { @@ -124,7 +135,7 @@ let _algoliaQueryParameters: AlgoliaQueryParameters = { analyticsTags: [""], synonyms: true, replaceSynonymsInHighlight: false, - minProximity: 0 + minProximity: 0, }; let index: AlgoliaIndex = algoliasearch("", "").initIndex(""); From dad073b3fdbd5166aabefdde106eef9215202bba Mon Sep 17 00:00:00 2001 From: Christian Tellnes Date: Fri, 12 May 2017 19:49:42 +0200 Subject: [PATCH 0148/1105] node - update tls `getPeerCertificate` return value definition --- types/node/index.d.ts | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 84c5773976..174423dbe6 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -1,6 +1,9 @@ // Type definitions for Node.js v7.x // Project: http://nodejs.org/ -// Definitions by: Microsoft TypeScript , DefinitelyTyped , Parambir Singh +// Definitions by: Microsoft TypeScript +// DefinitelyTyped +// Parambir Singh +// Christian Vaagland Tellnes // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /************************************************ @@ -3004,6 +3007,25 @@ declare module "tls" { CN: string; } + export interface PeerCertificate { + subject: Certificate; + issuer: Certificate; + subjectaltname: string; + infoAccess: { [index: string]: string[] }; + modulus: string; + exponent: string; + valid_from: string; + valid_to: string; + fingerprint: string; + ext_key_usage: string[]; + serialNumber: string; + raw: Buffer; + } + + export interface DetailedPeerCertificate extends PeerCertificate { + issuerCertificate: DetailedPeerCertificate; + } + export interface CipherNameAndProtocol { /** * The cipher name. @@ -3112,18 +3134,11 @@ declare module "tls" { * if false only the top certificate without issuer property. * If the peer does not provide a certificate, it returns null or an empty object. * @param {boolean} detailed - If true; the full chain with issuer property will be returned. - * @returns {any} - An object representing the peer's certificate. + * @returns {PeerCertificate | DetailedPeerCertificate} - An object representing the peer's certificate. */ - getPeerCertificate(detailed?: boolean): { - subject: Certificate; - issuerInfo: Certificate; - issuer: Certificate; - raw: any; - valid_from: string; - valid_to: string; - fingerprint: string; - serialNumber: string; - }; + getPeerCertificate(detailed: true): DetailedPeerCertificate; + getPeerCertificate(detailed?: false): PeerCertificate; + getPeerCertificate(detailed?: boolean): PeerCertificate | DetailedPeerCertificate; /** * Could be used to speed up handshake establishment when reconnecting to the server. * @returns {any} - ASN.1 encoded TLS session or undefined if none was negotiated. From 1c845dbe2e82039dba15eec3df29f2d7c0220bd5 Mon Sep 17 00:00:00 2001 From: Max Battcher Date: Wed, 31 May 2017 23:01:02 -0400 Subject: [PATCH 0149/1105] Add blob-util typings (#16844) * Add blob-util typings Library author is not interested in maintaining Typescript typings. See nolanlawson/blob-util#26 * In blob-util typings, move Typescript version tag Move the Typescript version tag to the bottom of the headers. --- types/blob-util/blob-util-tests.ts | 17 +++++++++++++++++ types/blob-util/index.d.ts | 19 +++++++++++++++++++ types/blob-util/tsconfig.json | 23 +++++++++++++++++++++++ types/blob-util/tslint.json | 1 + 4 files changed, 60 insertions(+) create mode 100644 types/blob-util/blob-util-tests.ts create mode 100644 types/blob-util/index.d.ts create mode 100644 types/blob-util/tsconfig.json create mode 100644 types/blob-util/tslint.json diff --git a/types/blob-util/blob-util-tests.ts b/types/blob-util/blob-util-tests.ts new file mode 100644 index 0000000000..af860a7ee1 --- /dev/null +++ b/types/blob-util/blob-util-tests.ts @@ -0,0 +1,17 @@ +import * as blobUtil from 'blob-util'; + +const testBlob = new Blob(['abcd']); + +blobUtil.base64StringToBlob('abcd'); // $ExpectType Promise +blobUtil.createObjectURL(testBlob); // $ExpectType string +blobUtil.imgSrcToBlob('test.jpg'); // $ExpectType Promise +blobUtil.createBlob(['abcd']); // $ExpectType Blob +blobUtil.arrayBufferToBlob(new ArrayBuffer(0)); // $ExpectType Promise +blobUtil.binaryStringToBlob('0101'); // $ExpectType Promise +blobUtil.blobToArrayBuffer(testBlob); // $ExpectType Promise +blobUtil.blobToBase64String(testBlob); // $ExpectType Promise +blobUtil.blobToBinaryString(testBlob); // $ExpectType Promise +blobUtil.canvasToBlob(new HTMLCanvasElement()); // $ExpectType Promise +blobUtil.dataURLToBlob('data:abcd'); // $ExpectType Promise +blobUtil.imgSrcToDataURL('test.jpg'); // $ExpectType Promise +blobUtil.revokeObjectURL('blob:example'); // $ExpectType void diff --git a/types/blob-util/index.d.ts b/types/blob-util/index.d.ts new file mode 100644 index 0000000000..ce99c3d893 --- /dev/null +++ b/types/blob-util/index.d.ts @@ -0,0 +1,19 @@ +// Type definitions for blob-util 1.2 +// Project: https://github.com/nolanlawson/blob-util#readme +// Definitions by: Max Battcher +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +export function createBlob(parts: any[], options?: { type: string }): Blob; +export function createObjectURL(blob: Blob): string; +export function revokeObjectURL(url: string): void; +export function blobToBinaryString(blob: Blob): Promise; +export function binaryStringToBlob(binary: string, type?: string): Promise; +export function blobToBase64String(blob: Blob): Promise; +export function base64StringToBlob(base64: string, type?: string): Promise; +export function dataURLToBlob(dataURL: string): Promise; +export function imgSrcToDataURL(src: string, type?: string, crossOrigin?: string): Promise; +export function canvasToBlob(canvas: HTMLCanvasElement, type?: string): Promise; +export function imgSrcToBlob(src: string, type?: string, crossOrigin?: string): Promise; +export function arrayBufferToBlob(arrayBuff: ArrayBuffer, type?: string): Promise; +export function blobToArrayBuffer(blob: Blob): Promise; diff --git a/types/blob-util/tsconfig.json b/types/blob-util/tsconfig.json new file mode 100644 index 0000000000..f34519775d --- /dev/null +++ b/types/blob-util/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "blob-util-tests.ts" + ] +} diff --git a/types/blob-util/tslint.json b/types/blob-util/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/blob-util/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From a7af0d6fc843183f70ffd6016d3281d5196d81b0 Mon Sep 17 00:00:00 2001 From: huhuanming Date: Thu, 1 Jun 2017 11:10:29 +0800 Subject: [PATCH 0150/1105] Fix Spelling Mistakes (#16770) --- types/react-navigation/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-navigation/index.d.ts b/types/react-navigation/index.d.ts index 083139a165..0c44d6ad00 100644 --- a/types/react-navigation/index.d.ts +++ b/types/react-navigation/index.d.ts @@ -607,7 +607,7 @@ export type NavigationResetActionCreator = (options: NavigationResetAction) => b export type NavigationBackActionCreator = (options?: NavigationBackAction) => boolean; export type NavigationSetParamsActionCreator = (options: NavigationSetParamsAction) => boolean; -export interface NavgationComponentProps { +export interface NavigationComponentProps { screenProps: any navigation: { dispatch: any From 6ae1b1ea58611cd5457424e91335323044e24c72 Mon Sep 17 00:00:00 2001 From: "Juan J. Jimenez-Anca" Date: Thu, 1 Jun 2017 04:14:07 +0100 Subject: [PATCH 0151/1105] Moved node-feedparser to /types (#16874) * move node-feedparser to /types * deleted node-feedparser from root * changes after tests --- .../node-feedparser}/index.d.ts | 18 +++++++++--------- .../node-feedparser}/node-feedparser-tests.ts | 2 +- .../node-feedparser}/tsconfig.json | 0 .../node-feedparser}/tslint.json | 0 4 files changed, 10 insertions(+), 10 deletions(-) rename {node-feedparser => types/node-feedparser}/index.d.ts (94%) rename {node-feedparser => types/node-feedparser}/node-feedparser-tests.ts (94%) rename {node-feedparser => types/node-feedparser}/tsconfig.json (100%) rename {node-feedparser => types/node-feedparser}/tslint.json (100%) diff --git a/node-feedparser/index.d.ts b/types/node-feedparser/index.d.ts similarity index 94% rename from node-feedparser/index.d.ts rename to types/node-feedparser/index.d.ts index bed830265c..775a4a7fa0 100644 --- a/node-feedparser/index.d.ts +++ b/types/node-feedparser/index.d.ts @@ -14,12 +14,16 @@ declare class FeedParser extends stream.Duplex { constructor(options: FeedParser.Options); options: FeedParser.Options; stream: SAXStream; - meta: object; + meta: { + [key: string]: any + }; _emitted_meta: boolean; stack: any[]; xmlbase: any[]; in_xhtml: boolean; - xhtml: object; + xhtml: { + [key: string]: any + }; errors: Error[]; addListener(ev: any, fn: any): any; @@ -79,7 +83,7 @@ declare class FeedParser extends stream.Duplex { setEncoding(enc: any): any; setMaxListeners(n: any): any; - + uncork(): void; unpipe(dest: any): any; @@ -88,9 +92,8 @@ declare class FeedParser extends stream.Duplex { wrap(stream: SAXStream, ...args: any[]): any; - private _transform(data: any, encoding: string, done: Function): void; - private _flush(done: Function): void; - + private _transform(data: any, encoding: string, done: () => any): void; + private _flush(done: () => any): void; } declare namespace FeedParser { @@ -104,7 +107,6 @@ declare namespace FeedParser { MAX_BUFFER_LENGTH?: number; } - interface Node { [key: string]: any; } @@ -161,6 +163,4 @@ declare namespace FeedParser { enclosures: string[]; meta: Meta; } - } - diff --git a/node-feedparser/node-feedparser-tests.ts b/types/node-feedparser/node-feedparser-tests.ts similarity index 94% rename from node-feedparser/node-feedparser-tests.ts rename to types/node-feedparser/node-feedparser-tests.ts index 25d652de8c..f36698372b 100644 --- a/node-feedparser/node-feedparser-tests.ts +++ b/types/node-feedparser/node-feedparser-tests.ts @@ -1,5 +1,5 @@ import request = require('request'); -import * as FeedParser from "feedparser"; +import * as FeedParser from "node-feedparser"; const req = request('https://news.google.com/news?cf=all&hl=en&pz=1&ned=us&output=rss'); const feedparser = new FeedParser({}); diff --git a/node-feedparser/tsconfig.json b/types/node-feedparser/tsconfig.json similarity index 100% rename from node-feedparser/tsconfig.json rename to types/node-feedparser/tsconfig.json diff --git a/node-feedparser/tslint.json b/types/node-feedparser/tslint.json similarity index 100% rename from node-feedparser/tslint.json rename to types/node-feedparser/tslint.json From a2ce078f6e0308d6f4e0f6bb76a75167ad066336 Mon Sep 17 00:00:00 2001 From: Brian Donovan Date: Wed, 31 May 2017 20:22:02 -0700 Subject: [PATCH 0152/1105] Add missing `Scope` visitor type. (#16823) --- types/babel-traverse/babel-traverse-tests.ts | 12 ++++++++++++ types/babel-traverse/index.d.ts | 1 + 2 files changed, 13 insertions(+) diff --git a/types/babel-traverse/babel-traverse-tests.ts b/types/babel-traverse/babel-traverse-tests.ts index 98afbbc0a7..5952faefd1 100644 --- a/types/babel-traverse/babel-traverse-tests.ts +++ b/types/babel-traverse/babel-traverse-tests.ts @@ -120,3 +120,15 @@ const BindingKindTest: Visitor = { // kind === 'anythingElse'; }, }; + +// https://github.com/babel/babel/blob/d33d02359474296402b1577ef53f20d94e9085c4/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/exec/scope-bindings.js#L15-L25 +const vScope: Visitor = { + Scope: { + enter(path) { + console.log(`Entering scope: ${path.node.type}`); + }, + exit(path) { + console.log(`Exiting scope: ${path.node.type}`); + } + } +}; diff --git a/types/babel-traverse/index.d.ts b/types/babel-traverse/index.d.ts index e307cd664d..8d34144d0a 100644 --- a/types/babel-traverse/index.d.ts +++ b/types/babel-traverse/index.d.ts @@ -305,6 +305,7 @@ export interface Visitor extends VisitNodeObject { FlowBaseAnnotation?: VisitNode; FlowDeclaration?: VisitNode; JSX?: VisitNode; + Scope?: VisitNode; } export type VisitNode = VisitNodeFunction | VisitNodeObject; From 010980994fd348887701c5ac4fbb53ba380d0d38 Mon Sep 17 00:00:00 2001 From: Eric Eslinger Date: Wed, 31 May 2017 20:23:23 -0700 Subject: [PATCH 0153/1105] adding nested keyword for chai v4 (#16852) * adding nested keyword for chai v4 * bumping version to v4 --- types/chai/chai-tests.ts | 34 +++---- types/chai/index.d.ts | 207 ++++++++++++++++++++------------------- 2 files changed, 124 insertions(+), 117 deletions(-) diff --git a/types/chai/chai-tests.ts b/types/chai/chai-tests.ts index 756212995d..85e16c4f63 100644 --- a/types/chai/chai-tests.ts +++ b/types/chai/chai-tests.ts @@ -490,20 +490,20 @@ function property() { ({ foo: { bar: 'baz' } }).should.have.property('foo.bar'); } -function deepProperty() { +function nestedProperty() { expect({ 'foo.bar': 'baz' }) - .to.not.have.deep.property('foo.bar'); + .to.not.have.nested.property('foo.bar'); ({ 'foo.bar': 'baz' }).should - .not.have.deep.property('foo.bar'); + .not.have.nested.property('foo.bar'); expect({ foo: { bar: 'baz' } }) - .to.have.deep.property('foo.bar'); + .to.have.nested.property('foo.bar'); ({ foo: { bar: 'baz' } }).should - .have.deep.property('foo.bar'); + .have.nested.property('foo.bar'); expect({ 'foo.bar': 'baz' }) - .to.have.deep.property('foo.bar'); + .to.have.nested.property('foo.bar'); ({ 'foo.bar': 'baz' }).should - .have.deep.property('foo.bar'); + .have.nested.property('foo.bar'); } function property2() { @@ -525,24 +525,24 @@ function property2() { 'asd'.should.have.property('constructor', Number, 'blah'); } -function deepProperty2() { +function nestedProperty2() { expect({ foo: { bar: 'baz' } }) - .to.have.deep.property('foo.bar', 'baz'); + .to.have.nested.property('foo.bar', 'baz'); ({ foo: { bar: 'baz' } }).should - .have.deep.property('foo.bar', 'baz'); + .have.nested.property('foo.bar', 'baz'); expect({ foo: { bar: 'baz' } }) - .to.have.deep.property('foo.bar', 'quux', 'blah'); + .to.have.nested.property('foo.bar', 'quux', 'blah'); ({ foo: { bar: 'baz' } }).should - .have.deep.property('foo.bar', 'quux', 'blah'); + .have.nested.property('foo.bar', 'quux', 'blah'); expect({ foo: { bar: 'baz' } }) - .to.not.have.deep.property('foo.bar', 'baz', 'blah'); + .to.not.have.nested.property('foo.bar', 'baz', 'blah'); ({ foo: { bar: 'baz' } }).should - .not.have.deep.property('foo.bar', 'baz', 'blah'); + .not.have.nested.property('foo.bar', 'baz', 'blah'); expect({ foo: 5 }) - .to.not.have.deep.property('foo.bar', 'baz', 'blah'); + .to.not.have.nested.property('foo.bar', 'baz', 'blah'); ({ foo: 5 }).should - .not.have.deep.property('foo.bar', 'baz', 'blah'); + .not.have.nested.property('foo.bar', 'baz', 'blah'); } function ownProperty() { @@ -1659,4 +1659,4 @@ suite('assert', () => { assert.notFrozen(obj); assert.notFrozen(obj, 'message'); }); -}); \ No newline at end of file +}); diff --git a/types/chai/index.d.ts b/types/chai/index.d.ts index 7690fe49a7..b9a079af86 100644 --- a/types/chai/index.d.ts +++ b/types/chai/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for chai 3.5.0 +// Type definitions for chai 4.0.0 // Project: http://chaijs.com/ // Definitions by: Jed Mao , // Bart van der Schoor , @@ -61,6 +61,7 @@ declare namespace Chai { interface Assertion extends LanguageChains, NumericComparison, TypeComparison { not: Assertion; deep: Deep; + nested: Nested; any: KeyFilter; all: KeyFilter; a: TypeComparison; @@ -167,6 +168,12 @@ declare namespace Chai { (expected: number, delta: number, message?: string): Assertion; } + interface Nested { + include: Include; + property: Property; + members: Members; + } + interface Deep { equal: Equal; equals: Equal; @@ -256,7 +263,7 @@ declare namespace Chai { /** * Throws a failure. - * + * * @type T Type of the objects. * @param actual Actual value. * @param expected Potential expected value. @@ -268,7 +275,7 @@ declare namespace Chai { /** * Asserts that object is truthy. - * + * * @type T Type of object. * @param object Object to test. * @param message Message to display on error. @@ -277,7 +284,7 @@ declare namespace Chai { /** * Asserts that object is truthy. - * + * * @type T Type of object. * @param object Object to test. * @param message Message to display on error. @@ -286,7 +293,7 @@ declare namespace Chai { /** * Asserts that object is falsy. - * + * * @type T Type of object. * @param object Object to test. * @param message Message to display on error. @@ -295,7 +302,7 @@ declare namespace Chai { /** * Asserts that object is falsy. - * + * * @type T Type of object. * @param object Object to test. * @param message Message to display on error. @@ -304,7 +311,7 @@ declare namespace Chai { /** * Asserts non-strict equality (==) of actual and expected. - * + * * @type T Type of the objects. * @param actual Actual value. * @param expected Potential expected value. @@ -314,7 +321,7 @@ declare namespace Chai { /** * Asserts non-strict inequality (==) of actual and expected. - * + * * @type T Type of the objects. * @param actual Actual value. * @param expected Potential expected value. @@ -324,7 +331,7 @@ declare namespace Chai { /** * Asserts strict equality (===) of actual and expected. - * + * * @type T Type of the objects. * @param actual Actual value. * @param expected Potential expected value. @@ -334,7 +341,7 @@ declare namespace Chai { /** * Asserts strict inequality (==) of actual and expected. - * + * * @type T Type of the objects. * @param actual Actual value. * @param expected Potential expected value. @@ -344,7 +351,7 @@ declare namespace Chai { /** * Asserts that actual is deeply equal to expected. - * + * * @type T Type of the objects. * @param actual Actual value. * @param expected Potential expected value. @@ -354,7 +361,7 @@ declare namespace Chai { /** * Asserts that actual is not deeply equal to expected. - * + * * @type T Type of the objects. * @param actual Actual value. * @param expected Potential expected value. @@ -364,7 +371,7 @@ declare namespace Chai { /** * Asserts valueToCheck is strictly greater than (>) valueToBeAbove. - * + * * @param valueToCheck Actual value. * @param valueToBeAbove Minimum Potential expected value. * @param message Message to display on error. @@ -373,7 +380,7 @@ declare namespace Chai { /** * Asserts valueToCheck is greater than or equal to (>=) valueToBeAtLeast. - * + * * @param valueToCheck Actual value. * @param valueToBeAtLeast Minimum Potential expected value. * @param message Message to display on error. @@ -382,7 +389,7 @@ declare namespace Chai { /** * Asserts valueToCheck is strictly less than (<) valueToBeBelow. - * + * * @param valueToCheck Actual value. * @param valueToBeBelow Minimum Potential expected value. * @param message Message to display on error. @@ -391,7 +398,7 @@ declare namespace Chai { /** * Asserts valueToCheck is greater than or equal to (>=) valueToBeAtMost. - * + * * @param valueToCheck Actual value. * @param valueToBeAtMost Minimum Potential expected value. * @param message Message to display on error. @@ -400,7 +407,7 @@ declare namespace Chai { /** * Asserts that value is true. - * + * * @type T Type of value. * @param value Actual value. * @param message Message to display on error. @@ -409,7 +416,7 @@ declare namespace Chai { /** * Asserts that value is false. - * + * * @type T Type of value. * @param value Actual value. * @param message Message to display on error. @@ -418,7 +425,7 @@ declare namespace Chai { /** * Asserts that value is not true. - * + * * @type T Type of value. * @param value Actual value. * @param message Message to display on error. @@ -427,7 +434,7 @@ declare namespace Chai { /** * Asserts that value is not false. - * + * * @type T Type of value. * @param value Actual value. * @param message Message to display on error. @@ -436,7 +443,7 @@ declare namespace Chai { /** * Asserts that value is null. - * + * * @type T Type of value. * @param value Actual value. * @param message Message to display on error. @@ -445,7 +452,7 @@ declare namespace Chai { /** * Asserts that value is not null. - * + * * @type T Type of value. * @param value Actual value. * @param message Message to display on error. @@ -454,7 +461,7 @@ declare namespace Chai { /** * Asserts that value is not null. - * + * * @type T Type of value. * @param value Actual value. * @param message Message to display on error. @@ -463,7 +470,7 @@ declare namespace Chai { /** * Asserts that value is not null. - * + * * @type T Type of value. * @param value Actual value. * @param message Message to display on error. @@ -472,7 +479,7 @@ declare namespace Chai { /** * Asserts that value is undefined. - * + * * @type T Type of value. * @param value Actual value. * @param message Message to display on error. @@ -481,7 +488,7 @@ declare namespace Chai { /** * Asserts that value is not undefined. - * + * * @type T Type of value. * @param value Actual value. * @param message Message to display on error. @@ -490,7 +497,7 @@ declare namespace Chai { /** * Asserts that value is a function. - * + * * @type T Type of value. * @param value Actual value. * @param message Message to display on error. @@ -499,7 +506,7 @@ declare namespace Chai { /** * Asserts that value is not a function. - * + * * @type T Type of value. * @param value Actual value. * @param message Message to display on error. @@ -509,7 +516,7 @@ declare namespace Chai { /** * Asserts that value is an object of type 'Object' * (as revealed by Object.prototype.toString). - * + * * @type T Type of value. * @param value Actual value. * @param message Message to display on error. @@ -520,7 +527,7 @@ declare namespace Chai { /** * Asserts that value is not an object of type 'Object' * (as revealed by Object.prototype.toString). - * + * * @type T Type of value. * @param value Actual value. * @param message Message to display on error. @@ -529,7 +536,7 @@ declare namespace Chai { /** * Asserts that value is an array. - * + * * @type T Type of value. * @param value Actual value. * @param message Message to display on error. @@ -538,7 +545,7 @@ declare namespace Chai { /** * Asserts that value is not an array. - * + * * @type T Type of value. * @param value Actual value. * @param message Message to display on error. @@ -547,7 +554,7 @@ declare namespace Chai { /** * Asserts that value is a string. - * + * * @type T Type of value. * @param value Actual value. * @param message Message to display on error. @@ -556,7 +563,7 @@ declare namespace Chai { /** * Asserts that value is not a string. - * + * * @type T Type of value. * @param value Actual value. * @param message Message to display on error. @@ -565,7 +572,7 @@ declare namespace Chai { /** * Asserts that value is a number. - * + * * @type T Type of value. * @param value Actual value. * @param message Message to display on error. @@ -574,7 +581,7 @@ declare namespace Chai { /** * Asserts that value is not a number. - * + * * @type T Type of value. * @param value Actual value. * @param message Message to display on error. @@ -583,7 +590,7 @@ declare namespace Chai { /** * Asserts that value is a boolean. - * + * * @type T Type of value. * @param value Actual value. * @param message Message to display on error. @@ -592,7 +599,7 @@ declare namespace Chai { /** * Asserts that value is not a boolean. - * + * * @type T Type of value. * @param value Actual value. * @param message Message to display on error. @@ -601,7 +608,7 @@ declare namespace Chai { /** * Asserts that value's type is name, as determined by Object.prototype.toString. - * + * * @type T Type of value. * @param value Actual value. * @param name Potential expected type name of value. @@ -611,7 +618,7 @@ declare namespace Chai { /** * Asserts that value's type is not name, as determined by Object.prototype.toString. - * + * * @type T Type of value. * @param value Actual value. * @param name Potential expected type name of value. @@ -621,7 +628,7 @@ declare namespace Chai { /** * Asserts that value is an instance of constructor. - * + * * @type T Type of value. * @param value Actual value. * @param constructor Potential expected contructor of value. @@ -631,7 +638,7 @@ declare namespace Chai { /** * Asserts that value is not an instance of constructor. - * + * * @type T Type of value. * @param value Actual value. * @param constructor Potential expected contructor of value. @@ -641,7 +648,7 @@ declare namespace Chai { /** * Asserts that haystack includes needle. - * + * * @param haystack Container string. * @param needle Potential expected substring of haystack. * @param message Message to display on error. @@ -650,7 +657,7 @@ declare namespace Chai { /** * Asserts that haystack includes needle. - * + * * @type T Type of values in haystack. * @param haystack Container array. * @param needle Potential value contained in haystack. @@ -660,7 +667,7 @@ declare namespace Chai { /** * Asserts that haystack does not include needle. - * + * * @param haystack Container string. * @param needle Potential expected substring of haystack. * @param message Message to display on error. @@ -669,7 +676,7 @@ declare namespace Chai { /** * Asserts that haystack does not include needle. - * + * * @type T Type of values in haystack. * @param haystack Container array. * @param needle Potential value contained in haystack. @@ -679,7 +686,7 @@ declare namespace Chai { /** * Asserts that value matches the regular expression regexp. - * + * * @param value Actual value. * @param regexp Potential match of value. * @param message Message to display on error. @@ -688,7 +695,7 @@ declare namespace Chai { /** * Asserts that value does not match the regular expression regexp. - * + * * @param value Actual value. * @param regexp Potential match of value. * @param message Message to display on error. @@ -697,7 +704,7 @@ declare namespace Chai { /** * Asserts that object has a property named by property. - * + * * @type T Type of object. * @param object Container object. * @param property Potential contained property of object. @@ -707,7 +714,7 @@ declare namespace Chai { /** * Asserts that object has a property named by property. - * + * * @type T Type of object. * @param object Container object. * @param property Potential contained property of object. @@ -718,7 +725,7 @@ declare namespace Chai { /** * Asserts that object has a property named by property, which can be a string * using dot- and bracket-notation for deep reference. - * + * * @type T Type of object. * @param object Container object. * @param property Potential contained property of object. @@ -729,7 +736,7 @@ declare namespace Chai { /** * Asserts that object does not have a property named by property, which can be a * string using dot- and bracket-notation for deep reference. - * + * * @type T Type of object. * @param object Container object. * @param property Potential contained property of object. @@ -739,7 +746,7 @@ declare namespace Chai { /** * Asserts that object has a property named by property with value given by value. - * + * * @type T Type of object. * @type V Type of value. * @param object Container object. @@ -751,7 +758,7 @@ declare namespace Chai { /** * Asserts that object has a property named by property with value given by value. - * + * * @type T Type of object. * @type V Type of value. * @param object Container object. @@ -764,7 +771,7 @@ declare namespace Chai { /** * Asserts that object has a property named by property, which can be a string * using dot- and bracket-notation for deep reference. - * + * * @type T Type of object. * @type V Type of value. * @param object Container object. @@ -777,7 +784,7 @@ declare namespace Chai { /** * Asserts that object does not have a property named by property, which can be a * string using dot- and bracket-notation for deep reference. - * + * * @type T Type of object. * @type V Type of value. * @param object Container object. @@ -789,7 +796,7 @@ declare namespace Chai { /** * Asserts that object has a length property with the expected value. - * + * * @type T Type of object. * @param object Container object. * @param length Potential expected length of object. @@ -799,7 +806,7 @@ declare namespace Chai { /** * Asserts that fn will throw an error. - * + * * @param fn Function that may throw. * @param message Message to display on error. */ @@ -807,7 +814,7 @@ declare namespace Chai { /** * Asserts that function will throw an error with message matching regexp. - * + * * @param fn Function that may throw. * @param regExp Potential expected message match. * @param message Message to display on error. @@ -816,7 +823,7 @@ declare namespace Chai { /** * Asserts that function will throw an error that is an instance of constructor. - * + * * @param fn Function that may throw. * @param constructor Potential expected error constructor. * @param message Message to display on error. @@ -826,7 +833,7 @@ declare namespace Chai { /** * Asserts that function will throw an error that is an instance of constructor * and an error with message matching regexp. - * + * * @param fn Function that may throw. * @param constructor Potential expected error constructor. * @param message Message to display on error. @@ -835,7 +842,7 @@ declare namespace Chai { /** * Asserts that fn will throw an error. - * + * * @param fn Function that may throw. * @param message Message to display on error. */ @@ -843,7 +850,7 @@ declare namespace Chai { /** * Asserts that function will throw an error with message matching regexp. - * + * * @param fn Function that may throw. * @param regExp Potential expected message match. * @param message Message to display on error. @@ -852,7 +859,7 @@ declare namespace Chai { /** * Asserts that function will throw an error that is an instance of constructor. - * + * * @param fn Function that may throw. * @param constructor Potential expected error constructor. * @param message Message to display on error. @@ -862,7 +869,7 @@ declare namespace Chai { /** * Asserts that function will throw an error that is an instance of constructor * and an error with message matching regexp. - * + * * @param fn Function that may throw. * @param constructor Potential expected error constructor. * @param message Message to display on error. @@ -871,7 +878,7 @@ declare namespace Chai { /** * Asserts that fn will throw an error. - * + * * @param fn Function that may throw. * @param message Message to display on error. */ @@ -879,7 +886,7 @@ declare namespace Chai { /** * Asserts that function will throw an error with message matching regexp. - * + * * @param fn Function that may throw. * @param regExp Potential expected message match. * @param message Message to display on error. @@ -888,7 +895,7 @@ declare namespace Chai { /** * Asserts that function will throw an error that is an instance of constructor. - * + * * @param fn Function that may throw. * @param constructor Potential expected error constructor. * @param message Message to display on error. @@ -898,7 +905,7 @@ declare namespace Chai { /** * Asserts that function will throw an error that is an instance of constructor * and an error with message matching regexp. - * + * * @param fn Function that may throw. * @param constructor Potential expected error constructor. * @param message Message to display on error. @@ -907,7 +914,7 @@ declare namespace Chai { /** * Asserts that fn will not throw an error. - * + * * @param fn Function that may throw. * @param message Message to display on error. */ @@ -915,7 +922,7 @@ declare namespace Chai { /** * Asserts that function will throw an error with message matching regexp. - * + * * @param fn Function that may throw. * @param regExp Potential expected message match. * @param message Message to display on error. @@ -924,7 +931,7 @@ declare namespace Chai { /** * Asserts that function will throw an error that is an instance of constructor. - * + * * @param fn Function that may throw. * @param constructor Potential expected error constructor. * @param message Message to display on error. @@ -934,7 +941,7 @@ declare namespace Chai { /** * Asserts that function will throw an error that is an instance of constructor * and an error with message matching regexp. - * + * * @param fn Function that may throw. * @param constructor Potential expected error constructor. * @param message Message to display on error. @@ -943,7 +950,7 @@ declare namespace Chai { /** * Compares two values using operator. - * + * * @param val1 Left value during comparison. * @param operator Comparison operator. * @param val2 Right value during comparison. @@ -953,7 +960,7 @@ declare namespace Chai { /** * Asserts that the target is equal to expected, to within a +/- delta range. - * + * * @param actual Actual value * @param expected Potential expected value. * @param delta Maximum differenced between values. @@ -963,7 +970,7 @@ declare namespace Chai { /** * Asserts that the target is equal to expected, to within a +/- delta range. - * + * * @param actual Actual value * @param expected Potential expected value. * @param delta Maximum differenced between values. @@ -973,7 +980,7 @@ declare namespace Chai { /** * Asserts that set1 and set2 have the same members. Order is not take into account. - * + * * @type T Type of set values. * @param set1 Actual set of values. * @param set2 Potential expected set of values. @@ -984,7 +991,7 @@ declare namespace Chai { /** * Asserts that set1 and set2 have the same members using deep equality checking. * Order is not take into account. - * + * * @type T Type of set values. * @param set1 Actual set of values. * @param set2 Potential expected set of values. @@ -994,7 +1001,7 @@ declare namespace Chai { /** * Asserts that subset is included in superset. Order is not take into account. - * + * * @type T Type of set values. * @param superset Actual set of values. * @param subset Potential contained set of values. @@ -1005,7 +1012,7 @@ declare namespace Chai { /** * Asserts that subset is included in superset using deep equality checking. * Order is not take into account. - * + * * @type T Type of set values. * @param superset Actual set of values. * @param subset Potential contained set of values. @@ -1015,7 +1022,7 @@ declare namespace Chai { /** * Asserts that non-object, non-array value inList appears in the flat array list. - * + * * @type T Type of list values. * @param inList Value expected to be in the list. * @param list List of values. @@ -1025,7 +1032,7 @@ declare namespace Chai { /** * Asserts that a function changes the value of a property. - * + * * @type T Type of object. * @param modifier Function to run. * @param object Container object. @@ -1036,7 +1043,7 @@ declare namespace Chai { /** * Asserts that a function does not change the value of a property. - * + * * @type T Type of object. * @param modifier Function to run. * @param object Container object. @@ -1047,7 +1054,7 @@ declare namespace Chai { /** * Asserts that a function increases an object property. - * + * * @type T Type of object. * @param modifier Function to run. * @param object Container object. @@ -1058,7 +1065,7 @@ declare namespace Chai { /** * Asserts that a function does not increase an object property. - * + * * @type T Type of object. * @param modifier Function to run. * @param object Container object. @@ -1069,7 +1076,7 @@ declare namespace Chai { /** * Asserts that a function decreases an object property. - * + * * @type T Type of object. * @param modifier Function to run. * @param object Container object. @@ -1080,7 +1087,7 @@ declare namespace Chai { /** * Asserts that a function does not decrease an object property. - * + * * @type T Type of object. * @param modifier Function to run. * @param object Container object. @@ -1091,7 +1098,7 @@ declare namespace Chai { /** * Asserts if value is not a false value, and throws if it is a true value. - * + * * @type T Type of object. * @param object Actual value. * @param message Message to display on error. @@ -1102,7 +1109,7 @@ declare namespace Chai { /** * Asserts that object is extensible (can have new properties added to it). - * + * * @type T Type of object * @param object Actual value. * @param message Message to display on error. @@ -1111,7 +1118,7 @@ declare namespace Chai { /** * Asserts that object is extensible (can have new properties added to it). - * + * * @type T Type of object * @param object Actual value. * @param message Message to display on error. @@ -1120,7 +1127,7 @@ declare namespace Chai { /** * Asserts that object is not extensible. - * + * * @type T Type of object * @param object Actual value. * @param message Message to display on error. @@ -1129,7 +1136,7 @@ declare namespace Chai { /** * Asserts that object is not extensible. - * + * * @type T Type of object * @param object Actual value. * @param message Message to display on error. @@ -1139,7 +1146,7 @@ declare namespace Chai { /** * Asserts that object is sealed (can have new properties added to it * and its existing properties cannot be removed). - * + * * @type T Type of object * @param object Actual value. * @param message Message to display on error. @@ -1149,7 +1156,7 @@ declare namespace Chai { /** * Asserts that object is sealed (can have new properties added to it * and its existing properties cannot be removed). - * + * * @type T Type of object * @param object Actual value. * @param message Message to display on error. @@ -1158,7 +1165,7 @@ declare namespace Chai { /** * Asserts that object is not sealed. - * + * * @type T Type of object * @param object Actual value. * @param message Message to display on error. @@ -1167,7 +1174,7 @@ declare namespace Chai { /** * Asserts that object is not sealed. - * + * * @type T Type of object * @param object Actual value. * @param message Message to display on error. @@ -1177,7 +1184,7 @@ declare namespace Chai { /** * Asserts that object is frozen (cannot have new properties added to it * and its existing properties cannot be removed). - * + * * @type T Type of object * @param object Actual value. * @param message Message to display on error. @@ -1187,7 +1194,7 @@ declare namespace Chai { /** * Asserts that object is frozen (cannot have new properties added to it * and its existing properties cannot be removed). - * + * * @type T Type of object * @param object Actual value. * @param message Message to display on error. @@ -1197,7 +1204,7 @@ declare namespace Chai { /** * Asserts that object is not frozen (cannot have new properties added to it * and its existing properties cannot be removed). - * + * * @type T Type of object * @param object Actual value. * @param message Message to display on error. @@ -1207,7 +1214,7 @@ declare namespace Chai { /** * Asserts that object is not frozen (cannot have new properties added to it * and its existing properties cannot be removed). - * + * * @type T Type of object * @param object Actual value. * @param message Message to display on error. From 895a8920bc06306b6184e95aa107267d01c45885 Mon Sep 17 00:00:00 2001 From: Leonard Thieu Date: Wed, 31 May 2017 23:29:52 -0400 Subject: [PATCH 0154/1105] Add type definitions for tough-cookie. (#16847) --- types/tough-cookie/index.d.ts | 262 +++++++++++++++++++++++ types/tough-cookie/tough-cookie-tests.ts | 15 ++ types/tough-cookie/tsconfig.json | 22 ++ types/tough-cookie/tslint.json | 6 + 4 files changed, 305 insertions(+) create mode 100644 types/tough-cookie/index.d.ts create mode 100644 types/tough-cookie/tough-cookie-tests.ts create mode 100644 types/tough-cookie/tsconfig.json create mode 100644 types/tough-cookie/tslint.json diff --git a/types/tough-cookie/index.d.ts b/types/tough-cookie/index.d.ts new file mode 100644 index 0000000000..9871e2579f --- /dev/null +++ b/types/tough-cookie/index.d.ts @@ -0,0 +1,262 @@ +// Type definitions for tough-cookie 2.3 +// Project: https://github.com/salesforce/tough-cookie +// Definitions by: Leonard Thieu +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +/** + * Parse a cookie date string into a Date. + * Parses according to RFC6265 Section 5.1.1, not Date.parse(). + */ +export function parseDate(string: string): Date; + +/** + * Format a Date into a RFC1123 string (the RFC6265-recommended format). + */ +export function formatDate(date: Date): string; + +/** + * Transforms a domain-name into a canonical domain-name. + * The canonical domain-name is a trimmed, lowercased, stripped-of-leading-dot + * and optionally punycode-encoded domain-name (Section 5.1.2 of RFC6265). + * For the most part, this function is idempotent (can be run again on its output without ill effects). + */ +export function canonicalDomain(str: string): string; + +/** + * Answers "does this real domain match the domain in a cookie?". + * The str is the "current" domain-name and the domStr is the "cookie" domain-name. + * Matches according to RFC6265 Section 5.1.3, but it helps to think of it as a "suffix match". + * + * The canonicalize parameter will run the other two paramters through canonicalDomain or not. + */ +export function domainMatch(str: string, domStr: string, canonicalize?: boolean): boolean; + +/** + * Given a current request/response path, gives the Path apropriate for storing in a cookie. + * This is basically the "directory" of a "file" in the path, but is specified by Section 5.1.4 of the RFC. + * + * The path parameter MUST be only the pathname part of a URI (i.e. excludes the hostname, query, fragment, etc.). + * This is the .pathname property of node's uri.parse() output. + */ +export function defaultPath(path: string): string; + +/** + * Answers "does the request-path path-match a given cookie-path?" as per RFC6265 Section 5.1.4. + * Returns a boolean. + * + * This is essentially a prefix-match where cookiePath is a prefix of reqPath. + */ +export function pathMatch(reqPath: string, cookiePath: string): boolean; + +/** + * alias for Cookie.fromJSON(string) + */ +export function fromJSON(string: string): Cookie; + +export function getPublicSuffix(hostname: string): string | null; + +export function cookieCompare(a: Cookie, b: Cookie): number; + +export function permuteDomain(domain: string): string[]; + +export function permutePath(path: string): string[]; + +// region Cookie + +export class Cookie { + static parse(cookieString: string, options?: Cookie.ParseOptions | object): Cookie | undefined; + + static fromJSON(strOrObj: string | object): Cookie | null; + + constructor(properties?: Cookie.Properties | object); + + // TODO: Some of the following properties might actually be nullable. + + key: string; + value: string; + expires: Date; + maxAge: number | 'Infinity' | '-Infinity'; + domain: string; + path: string; + secure: boolean; + httpOnly: boolean; + extensions: string[]; + creation: Date; + creationIndex: number; + + hostOnly: boolean | null; + pathIsDefault: boolean | null; + lastAccessed: Date | null; + + toString(): string; + + cookieString(): string; + + setExpires(String: string): void; + + setMaxAge(number: number): void; + + expiryTime(now?: number): number | typeof Infinity; + + expiryDate(now?: number): Date; + + TTL(now?: Date): number | typeof Infinity; + + canonicalizedDomain(): string; + + cdomain(): string; + + toJSON(): { [key: string]: any; }; + + clone(): Cookie; + + validate(): boolean | string; +} + +export namespace Cookie { + interface ParseOptions extends Pick { } + + namespace ParseOptions { + interface _Impl { + loose: boolean; + } + } + + interface Properties extends Pick { } + + namespace Properties { + interface _Impl { + key: string; + value: string; + expires: Date; + maxAge: number | 'Infinity' | '-Infinity'; + domain: string; + path: string; + secure: boolean; + httpOnly: boolean; + extensions: string[]; + creation: Date; + creationIndex: number; + + hostOnly: boolean; + pathIsDefault: boolean; + lastAccessed: Date; + } + } + + interface Serialized { + [key: string]: any; + } +} + +// endregion + +// region CookieJar + +export class CookieJar { + static deserialize(serialized: CookieJar.Serialized | string, store: Store, cb: (err: Error | null, object: CookieJar) => void): void; + static deserialize(serialized: CookieJar.Serialized | string, cb: (err: Error | null, object: CookieJar) => void): void; + + static deserializeSync(serialized: CookieJar.Serialized | string): CookieJar; + + static fromJSON(string: string): CookieJar; + + constructor(store?: Store, options?: CookieJar.Options | object); + + setCookie(cookieOrString: Cookie | string, currentUrl: string, options: CookieJar.SetCookieOptions | object, cb: (err: Error | null, cookie: Cookie) => void): void; + setCookie(cookieOrString: Cookie | string, currentUrl: string, cb: (err: Error, cookie: Cookie) => void): void; + + setCookieSync(cookieOrString: Cookie | string, currentUrl: string, options: CookieJar.SetCookieOptions | object): void; + + getCookies(currentUrl: string, options: CookieJar.GetCookiesOptions | object, cb: (err: Error | null, cookies: Cookie[]) => void): void; + getCookies(currentUrl: string, cb: (err: Error | null, cookies: Cookie[]) => void): void; + + getCookiesSync(currentUrl: string, options?: CookieJar.GetCookiesOptions | object): Cookie[]; + + getCookieString(currentUrl: string, options: CookieJar.GetCookiesOptions | object, cb: (err: Error | null, cookies: string) => void): void; + getCookieString(currentUrl: string, cb: (err: Error | null, cookies: string) => void): void; + + getCookieStringSync(currentUrl: string, options?: CookieJar.GetCookiesOptions | object): string; + + getSetCookieStrings(currentUrl: string, options: CookieJar.GetCookiesOptions | object, cb: (err: Error | null, cookies: string) => void): void; + getSetCookieStrings(currentUrl: string, cb: (err: Error | null, cookies: string) => void): void; + + getSetCookieStringsSync(currentUrl: string, options?: CookieJar.GetCookiesOptions | object): string; + + serialize(cb: (err: Error | null, serializedObject: CookieJar.Serialized) => void): void; + + serializeSync(): CookieJar.Serialized; + + toJSON(): CookieJar.Serialized; + + clone(store: Store, cb: (err: Error | null, newJar: CookieJar) => void): void; + clone(cb: (err: Error | null, newJar: CookieJar) => void): void; + + cloneSync(store: Store): CookieJar; +} + +export namespace CookieJar { + interface Options extends Pick { } + + namespace Options { + interface _Impl { + rejectPublicSuffixes: boolean; + looseMode: boolean; + } + } + + interface SetCookieOptions extends Pick { } + + namespace SetCookieOptions { + interface _Impl { + http: boolean; + secure: boolean; + now: Date; + ignoreError: boolean; + } + } + + interface GetCookiesOptions extends Pick { } + + namespace GetCookiesOptions { + interface _Impl { + http: boolean; + secure: boolean; + date: Date; + expire: boolean; + allPoints: boolean; + } + } + + interface Serialized { + version: string; + storeType: string; + rejectPublicSuffixes: boolean; + cookies: Cookie.Serialized[]; + } +} + +// endregion + +// region Store + +export abstract class Store { + findCookie(domain: string, path: string, key: string, cb: (err: Error | null, cookie: Cookie | null) => void): void; + + findCookies(domain: string, path: string, cb: (err: Error | null, cookie: Cookie[]) => void): void; + + putCookie(cookie: Cookie, cb: (err: Error | null) => void): void; + + updateCookie(oldCookie: Cookie, newCookie: Cookie, cb: (err: Error | null) => void): void; + + removeCookie(domain: string, path: string, key: string, cb: (err: Error | null) => void): void; + + removeCookies(domain: string, path: string, cb: (err: Error | null) => void): void; + + getAllCookies(cb: (err: Error | null, cookie: Cookie[]) => void): void; +} + +export class MemoryCookieStore extends Store { } + +// endregion diff --git a/types/tough-cookie/tough-cookie-tests.ts b/types/tough-cookie/tough-cookie-tests.ts new file mode 100644 index 0000000000..8798e0d840 --- /dev/null +++ b/types/tough-cookie/tough-cookie-tests.ts @@ -0,0 +1,15 @@ +import { Cookie, CookieJar } from 'tough-cookie'; + +let header = ''; +const cb = () => { }; + +const cookie = Cookie.parse(header)!; +cookie.value = 'somethingdifferent'; +header = cookie.toString(); + +const cookiejar = new CookieJar(); +cookiejar.setCookie(cookie, 'http://currentdomain.example.com/path', cb); +// ... +cookiejar.getCookies('http://example.com/otherpath', (err, cookies) => { + // res.headers['cookie'] = cookies.join('; '); +}); diff --git a/types/tough-cookie/tsconfig.json b/types/tough-cookie/tsconfig.json new file mode 100644 index 0000000000..7c324c4ec3 --- /dev/null +++ b/types/tough-cookie/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", + "tough-cookie-tests.ts" + ] +} diff --git a/types/tough-cookie/tslint.json b/types/tough-cookie/tslint.json new file mode 100644 index 0000000000..4f44991c3c --- /dev/null +++ b/types/tough-cookie/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "no-empty-interface": false + } +} From 3b1ba96df2f377c2cbc884d4764c74f867e2187b Mon Sep 17 00:00:00 2001 From: Michael Strobel Date: Thu, 1 Jun 2017 12:56:38 +0800 Subject: [PATCH 0155/1105] [react-router] add RouteComponentProps.staticContext (#16812) * [react-router] add RouteComponentProps.staticContext * [react-router] revert RouteConfig test file * [react-router] Add example for StaticRouter and staticContext --- types/react-router/index.d.ts | 1 + types/react-router/test/StaticRouter.tsx | 55 ++++++++++++++++++++++++ types/react-router/tsconfig.json | 1 + 3 files changed, 57 insertions(+) create mode 100644 types/react-router/test/StaticRouter.tsx diff --git a/types/react-router/index.d.ts b/types/react-router/index.d.ts index 384cb2289e..f1c24b778f 100644 --- a/types/react-router/index.d.ts +++ b/types/react-router/index.d.ts @@ -59,6 +59,7 @@ export interface RouteComponentProps

{ match: match

; location: H.Location; history: H.History; + staticContext?: any; } export interface RouteProps { diff --git a/types/react-router/test/StaticRouter.tsx b/types/react-router/test/StaticRouter.tsx new file mode 100644 index 0000000000..89999d84cb --- /dev/null +++ b/types/react-router/test/StaticRouter.tsx @@ -0,0 +1,55 @@ +import * as React from 'react'; +import { StaticRouter, Route } from 'react-router-dom'; + +interface StaticContext { + statusCode?: number; +} + +interface RouteStatusProps { + statusCode: number; +} + +const RouteStatus: React.SFC = (props) => ( + { + if (staticContext) { + (staticContext as StaticContext).statusCode = props.statusCode; + } + + return ( +

+ {props.children} +
+ ); + }} + /> +); + +interface PrintContextProps { + staticContext: StaticContext; +} + +const PrintContext: React.SFC = (props) => ( +

+ Static context: {JSON.stringify(props.staticContext)} +

+); + +class StaticRouterExample extends React.Component<{}, {}> { + staticContext: StaticContext = {}; + + render() { + return ( + +
+ +

Route with statusCode 404

+ +
+
+
+ ); + } +} + +export default StaticRouterExample; diff --git a/types/react-router/tsconfig.json b/types/react-router/tsconfig.json index f3a225ece1..4790f0b53d 100644 --- a/types/react-router/tsconfig.json +++ b/types/react-router/tsconfig.json @@ -29,6 +29,7 @@ "test/Recursive.tsx", "test/RouteConfig.tsx", "test/Sidebar.tsx", + "test/StaticRouter.tsx", "test/Switch.tsx", "test/WithRouter.tsx" ] From 470a4e1eaab227126dc2b2c4b51f96a96595e280 Mon Sep 17 00:00:00 2001 From: Jure Skelin Date: Thu, 1 Jun 2017 06:58:25 +0200 Subject: [PATCH 0156/1105] implement declarations from jasmine.createSpyObj (#16838) (#16843) --- types/jasmine/index.d.ts | 10 +++++-- types/jasmine/jasmine-tests.ts | 50 +++++++++++++++++++++++++++++++++- 2 files changed, 56 insertions(+), 4 deletions(-) diff --git a/types/jasmine/index.d.ts b/types/jasmine/index.d.ts index 11b0d1919c..c4ad8841c0 100644 --- a/types/jasmine/index.d.ts +++ b/types/jasmine/index.d.ts @@ -34,7 +34,7 @@ interface DoneFn extends Function { (): void; /** fails the spec and indicates that it has completed. If the message is an Error, Error.message is used */ - fail: (message?: Error|string) => void; + fail: (message?: Error | string) => void; } declare function spyOn(object: T, method: keyof T): jasmine.Spy; @@ -61,6 +61,10 @@ declare namespace jasmine { function createSpyObj(baseName: string, methodNames: any[]): any; function createSpyObj(baseName: string, methodNames: any[]): T; + function createSpyObj(baseName: string, methodNames: any): any; + function createSpyObj(methodNames: any[]): any; + function createSpyObj(methodNames: any): any; + function pp(value: any): string; function getEnv(): Env; @@ -248,7 +252,7 @@ declare namespace jasmine { } interface Order { - new (options: {random: boolean, seed: string}): any; + new (options: { random: boolean, seed: string }): any; random: boolean; seed: string; sort(items: T[]): T[]; @@ -510,7 +514,7 @@ declare namespace jasmine { identity: string; and: SpyAnd; calls: Calls; - mostRecentCall: {args: any[]; }; + mostRecentCall: { args: any[]; }; argsForCall: any[]; } diff --git a/types/jasmine/jasmine-tests.ts b/types/jasmine/jasmine-tests.ts index d681d972b0..8cf892e17a 100644 --- a/types/jasmine/jasmine-tests.ts +++ b/types/jasmine/jasmine-tests.ts @@ -841,7 +841,7 @@ describe("Fail", () => { // test based on http://jasmine.github.io/2.2/custom_equality.html describe("custom equality", () => { - var myCustomEquality: jasmine.CustomEqualityTester = function(first: any, second: any): boolean { + var myCustomEquality: jasmine.CustomEqualityTester = function (first: any, second: any): boolean { if (typeof first === "string" && typeof second === "string") { return first[0] === second[1]; } @@ -983,6 +983,54 @@ describe("Randomize Tests", () => { }); }); +//dest spces copied from jasmine project (https://github.com/jasmine/jasmine/blob/master/spec/core/SpecSpec.js) +describe("createSpyObj", function () { + it("should create an object with spy methods and corresponding return values when you call jasmine.createSpyObj() with an object", function () { + var spyObj = jasmine.createSpyObj('BaseName', { 'method1': 42, 'method2': 'special sauce' }); + + expect(spyObj.method1()).toEqual(42); + expect(spyObj.method1.and.identity()).toEqual('BaseName.method1'); + + expect(spyObj.method2()).toEqual('special sauce'); + expect(spyObj.method2.and.identity()).toEqual('BaseName.method2'); + }); + + + it("should create an object with a bunch of spy methods when you call jasmine.createSpyObj()", function () { + var spyObj = jasmine.createSpyObj('BaseName', ['method1', 'method2']); + + expect(spyObj).toEqual({ method1: jasmine.any(Function), method2: jasmine.any(Function) }); + expect(spyObj.method1.and.identity()).toEqual('BaseName.method1'); + expect(spyObj.method2.and.identity()).toEqual('BaseName.method2'); + }); + + it("should allow you to omit the baseName", function () { + var spyObj = jasmine.createSpyObj(['method1', 'method2']); + + expect(spyObj).toEqual({ method1: jasmine.any(Function), method2: jasmine.any(Function) }); + expect(spyObj.method1.and.identity()).toEqual('unknown.method1'); + expect(spyObj.method2.and.identity()).toEqual('unknown.method2'); + }); + + it("should throw if you do not pass an array or object argument", function () { + expect(function () { + jasmine.createSpyObj('BaseName'); + }).toThrow("createSpyObj requires a non-empty array or object of method names to create spies for"); + }); + + it("should throw if you pass an empty array argument", function () { + expect(function () { + jasmine.createSpyObj('BaseName', []); + }).toThrow("createSpyObj requires a non-empty array or object of method names to create spies for"); + }); + + it("should throw if you pass an empty object argument", function () { + expect(function () { + jasmine.createSpyObj('BaseName', {}); + }).toThrow("createSpyObj requires a non-empty array or object of method names to create spies for"); + }); +}); + (() => { // from boot.js var env = jasmine.getEnv(); From eb8b6abb9f0545cbfedf4173b86d3dd3c47fc9f0 Mon Sep 17 00:00:00 2001 From: Cory Deppen Date: Thu, 1 Jun 2017 00:59:39 -0400 Subject: [PATCH 0157/1105] Add href property to DropdownItem (#16711) The `DropdownItem` component was recently modified to accept an `href` prop (reactstrap/reactstrap#367). /cc @alihammad, @mfal, @danilobjr --- types/reactstrap/lib/DropdownItem.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/reactstrap/lib/DropdownItem.d.ts b/types/reactstrap/lib/DropdownItem.d.ts index 28a253e022..e28715e42f 100644 --- a/types/reactstrap/lib/DropdownItem.d.ts +++ b/types/reactstrap/lib/DropdownItem.d.ts @@ -5,7 +5,8 @@ interface Props { header?: boolean; onClick?: (event: React.MouseEvent) => void; className?: string; + href?: string; } declare var DropdownItem: React.StatelessComponent; -export default DropdownItem; \ No newline at end of file +export default DropdownItem; From 67edbd5ffbcd7659a5bf559fd4f8e6d3918ae241 Mon Sep 17 00:00:00 2001 From: Ruben Slabbert Date: Thu, 1 Jun 2017 15:01:09 +1000 Subject: [PATCH 0158/1105] Added qlik sense 3.1 typings (#16836) * Added qlik sense 3.1 typings * Fixed linting issues * Add explicit typescript version to header * Bump required typescript version to 2.2 * No relative imports --- types/qlik/index.d.ts | 914 +++++++++++++++++++++++++++++++++++++++ types/qlik/qlik-tests.ts | 53 +++ types/qlik/tsconfig.json | 23 + types/qlik/tslint.json | 1 + 4 files changed, 991 insertions(+) create mode 100644 types/qlik/index.d.ts create mode 100644 types/qlik/qlik-tests.ts create mode 100644 types/qlik/tsconfig.json create mode 100644 types/qlik/tslint.json diff --git a/types/qlik/index.d.ts b/types/qlik/index.d.ts new file mode 100644 index 0000000000..22c84f0ff1 --- /dev/null +++ b/types/qlik/index.d.ts @@ -0,0 +1,914 @@ +// Type definitions for Qlik Sense 3.1 +// Project: https://help.qlik.com/en-US/sense-developer/3.1/Content/APIs-and-SDKs.htm +// Definitions by: Ruben Slabbert , AginicX +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +import 'jquery'; + +export interface Size { + qcx: number; + qcy: number; +} + +export interface NxValidationError { + qErrorCode: number; + qContext: string; + qExtendedMessage: string; +} + +export interface NxStateCounts { + qLocked: number; + qSelected: number; + qOption: number; + qDeselected: number; + qAlternative: number; + qExcluded: number; + qSelectedExcluded: number; + qLockedExcluded: number; +} + +export interface FieldAttributes { + qType: 'U' | 'A' | 'I' | 'R' | 'F' | 'M' | 'D' | 'T' | 'TS' | 'IV'; + qnDec: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15; + qUseThou: 0 | 1; + qFmt: string; + qDec: string; + qThou: string; + qSAFEARRAY: any[]; +} + +export interface CharRange { + qCharPos: number; + qCharCount: number; +} + +export interface NxHighlightRanges { + qRanges: CharRange[]; +} + +export interface NxSimpleValue { + qText: string; + qNum: number; +} + +export interface NxAttributeExpressionValues { + qValues: NxSimpleValue[]; +} + +export type NxCellRows = NxCell[]; + +export interface NxGroupTail { + qUp: number; + qDown: number; +} + +export interface Rect { + qLeft: number; + qTop: number; + qWdith: number; + qHeight: number; +} + +export interface NxPivotDimensioncell { + qText: string; + qElemNo: number; + qValue: number; + qCanExpand: boolean; + qCanCollapse: boolean; + qType: 'V' | 'E' | 'N' | 'T' | 'P' | 'R' | 'U'; + qUp: number; + qDown: number; + qSubNodes: NxPivotDimensioncell[]; + qAttrExps: NxAttributeExpressionValues[]; + qAttrDims: NxAttributeDimValues[]; +} + +export interface NxPivotValuePoint { + qLabel?: string; + qText: string; + qNum: number; + qType: 'V' | 'E' | 'N' | 'T' | 'P' | 'R' | 'U'; + qAttrExps: NxAttributeExpressionValues; +} + +export interface NxPivotPage { + qLeft: NxPivotDimensioncell[]; + qTop: NxPivotDimensioncell[]; + qData: NxPivotValuePoint[]; + qArea: Rect; +} + +export interface NxStackedPivotCell { + qText: string; + qElemNo: number; + qValue: number; + qCanExpand: boolean; + qCanCollapse: boolean; + qType: 'V' | 'E' | 'N' | 'T' | 'P' | 'R' | 'U'; + qMaxPos: number; + qMinNeg: number; + qUp: number; + qDown: number; + qRow: number; + qSubNodes: NxStackedPivotCell[]; + qAttrExps: NxAttributeExpressionValues; + qAttrDims: NxAttributeDimValues; +} + +export interface NxStackPage { + qData: NxStackedPivotCell[]; + qArea: Rect; +} + +export interface NxCellPosition { + qx: number; + qy: number; +} + +export interface NxDataPage { + qMatrix: NxCellRows[]; + qTails: NxGroupTail[]; + qArea: Rect; + qIsReduced: boolean; +} + +export interface NxAttributeDimValues { + qValues: NxSimpleDimValue[]; +} + +export interface NxSimpleDimValue { + qText: string; + qElemNo: number; +} + +export interface NxCell { + qText: string; + qNum: number; + qElemNumber: number; + qState: 'L' | 'S' | 'O' | 'D' | 'A' | 'X' | 'XS' | 'XL'; + qIsEmpty: boolean; + qIsTotalCell: boolean; + qIsOtherCell: boolean; + qFrequency: string; + qHighlightRanges: NxHighlightRanges; + qAttrExps: NxAttributeExpressionValues; + qIsNull: boolean; + qAttrDims: NxAttributeDimValues; +} + +export interface NxAttrExprInfo { + qMin: number; + qMax: number; + qContinuousAxes: boolean; + qIsCyclic: boolean; + qFallbackTitle: string; +} + +export interface NxAttrDimInfo { + qCardinal: number; + qSize: Size; + qFallbackTitle: string; + qLocked: boolean; + qError: NxValidationError; +} + +export interface ColumnInfo { + qFallbackTitle: string; + qApprMaxGlyphCount: number; + qCardinal: string; + qSortIndicator: 'N' | 'A' | 'D'; + qNumFormat: FieldAttributes; + qIsAutoFormat: boolean; + qMin: number; + qMax: number; + qError: NxValidationError; + qReverseSort: boolean; + qAttrExprInfo: NxAttrExprInfo[]; + qAttrDimInfo: NxAttrDimInfo[]; +} + +export interface NxDimensionInfo extends ColumnInfo { + qLocker: string; + qGroupFallbackTitles: string[]; + qGroupPos: number; + qStateCounts: NxStateCounts; + qTags: string[]; + qDimensionType: 'D' | 'N' | 'T'; + qGrouping: 'N' | 'H' | 'C'; + qIsSemantic: boolean; + qGroupFieldDefs: string[]; + qContinuousAxes: boolean; + qIsCyclic: boolean; + qDerivedField: boolean; +} + +export type NxMeasureInfo = ColumnInfo; + +export interface HyperCube { + qStateName: string; + qSize: Size; + qError: NxValidationError; + qDimensionInfo: NxDimensionInfo[]; + qMeasureInfo: NxMeasureInfo[]; + qEffectiveInterColumnSortOrder: number[]; + qGrandTotalRow: NxCell[]; + qDataPages: NxDataPage[]; + qPivotDataPages: NxPivotPage[]; + qStackedDataPages: NxStackPage[]; + qMode: 'S' | 'P' | 'K'; + qNoOfLeftDims: number; + qIndentMode: boolean; + qLastExpandedPos: NxCellPosition; + qHasOtherValues: boolean; +} + +export interface NxInfo { + qId: string; + qType: string; +} + +export interface NxCurrentSelectionItem { + qTotal: number; + qIsNum?: boolean; + qField: string; + qLocked?: boolean; + qOneAndOnlyOne?: boolean; + qTextSearch?: string; + qSelectedCount: number; + qSelected: string; + qRangeInfo: RangeSelectInfo[]; + qSortIndex: number; + qStateCounts: NxStateCounts; + qSelectedFieldSelectionInfo: NxFieldSelectionInfo[]; + qNotSelectedFieldSelectionInfo: NxFieldSelectionInfo[]; + qSelectionThreshold: number; +} + +export interface RangeSelectInfo { + qRangeLo: number; + qRangeHi: number; + qMeasure: string; +} + +export interface NxFieldSelectionInfo { + qName: string; + qFieldSelectionmode: 'NORMAL' | 'AND' | 'NOT'; +} + +export interface Selectionobject { + qBackCount: number; + qForwardCount: number; + qSelections: NxCurrentSelectionItem[]; +} + +export interface Layout { + qHyperCube: HyperCube; + qInfo: NxInfo; + qSelectionInfo: Selectionobject; +} + +export interface ValueExpr { + qv: string; +} + +export interface SortCriteria { + qSortByState: -1 | 0 | 1; + qSortByFrequency: -1 | 0 | 1; + qSortByNumeric: -1 | 0 | 1; + qSortByAscii: -1 | 0 | 1; + qSortByLoadOrder: -1 | 0 | 1; + qSortByExpression: -1 | 0 | 1; + qExpression: ValueExpr; +} + +export interface NxInlineDimensionDef { + qGrouping: 'N' | 'H' | 'C'; + qFieldDefs: string[]; + qSortCriteries: SortCriteria[]; + qNumberPresentations: FieldAttributes[]; + qReverseSort: boolean; + qActiveField: number; +} + +export interface OtherTotalSpecProp { + qOtherMode: 'OTHER_OFF' | 'OTHER_COUNTED' + | 'OTHER_ABS_LIMITED' | 'OTHER_ABS_ACC_TARGET' + | 'OTHER_REL_LIMITED' | 'OTHER_REL_ACC_TARGET'; + qOtherCounted: ValueExpr; + qOtherLimit: ValueExpr; + qOtherLimitMode: 'OTHER_GE_LIMIT' | 'OTHER_LE_LIMIT' | 'OTHER_GT_LIMIT' | 'OTHER_LT_LIMIT'; + qSupressOther: boolean; + qForceBadValueKeeping: boolean; + qApplyEvenWhenPossiblyWrongResult: boolean; + qGlobalOtherGrouping: boolean; + qOtherCollapseInnerDimensions: boolean; + qOtherSortMode: 'OTHER_SORT_DEFAULT' | 'OTHER_SORT_DESCENDING' | 'OTHER_SORT_ASCENDING'; + qTotalMode: 'TOTAL_OFF' | 'TOTAL_EXPR'; + qReferencedExpression: string; +} + +export interface NxAttrExprDef { + qExpression: string; + qLibraryId: string; +} + +export interface NxAttrDimDef { + qDef: string; + qLibraryId: string; + qSortBy: SortCriteria; +} + +export interface NxDimension { + qLibraryId: string; + qDef: NxInlineDimensionDef; + qNullSuppression: boolean; + qOtherTotalSpec: OtherTotalSpecProp; + qShowAll: boolean; + qOtherLabel: string; + qTotalLabel: string; + qCalcCond: ValueExpr; + qAttributeExpressions: NxAttrExprDef[]; + qAttributeDimensions: NxAttrDimDef[]; +} + +export interface NxMeasure { + qLibraryId: string; + qDef: NxInlineMeasureDef; + qSortBy: SortCriteria; + qAttributeExpressions: NxAttrExprDef[]; + qCalcCond: ValueExpr; + qAttributeDimensions: NxAttrDimDef[]; +} + +export interface NxInlineMeasureDef { + qcx: number; + qcy: number; +} + +export interface NxPage { + qLeft?: number; + qTop?: number; + qWidth?: number; + qHeight?: number; +} + +export interface HyperCubeDef { + qStateName?: string; + qDimensions?: NxDimension[]; + qMeasures?: NxMeasure[]; + qInterColumnSortOrder?: number[]; + qSuppressZero?: boolean; + qSupressMissing?: boolean; + qInitialDataFetch?: NxPage[]; + qMode?: 'S' | 'P' | 'K'; + qNoOfLeftDims?: number; + qAlwaysFullyExpanded?: boolean; + qMaxStackedCells?: number; + qPopulateMissing?: boolean; + qShowTotalsAbove?: boolean; + qIndentMode?: boolean; + qCalcCond?: ValueExpr; + qSortByYValue?: -1 | 0 | 1; +} + +export interface NxAutoSortByStateDef { + qDisplayNumberOfRows: number; +} + +export interface NxListobjectExpressionDef { + qExpr: string; + qLibraryId: string; +} + +export interface ListobjectDef { + qStateName: string; + qLibraryId: string; + qDef: NxInlineDimensionDef; + qAutoSortByState: NxAutoSortByStateDef; + qFrequencyMode: 'NX_FREQUENCY_NONE' | 'NX_FREQUENCY_VALUE' | 'NX_FREQUENCY_PERCENT' | 'NX_FREQUENCY_RELATIVE'; + qShowAlternatives: boolean; + qInitialDataFetch: NxPage[]; + qExpressions: NxListobjectExpressionDef[]; +} + +export interface InitialPropertiesHyperCube { + qHyperCubeDef: HyperCubeDef; + + [key: string]: any; +} + +export interface InitialPropertiesListobject { + qListobjectDef: ListobjectDef; + + [key: string]: any; +} + +export type InitialProperties = InitialPropertiesHyperCube | InitialPropertiesListobject; + +export interface SnapshotLegacy { + canTakeSnapshot: boolean; +} + +export type SupportFunction = (layout: Layout) => boolean; +export type SupportItem = boolean | SupportFunction; + +export interface Support { + snapshot: SupportItem | SnapshotLegacy; + export: SupportItem; + exportData: SupportItem; +} + +export type Paint = ( + this: ExtensionContext, + $element?: JQuery, + layout?: Layout, + qDimensionInfo?: NxDimensionInfo, + qMeasureInfo?: NxDimensionInfo, + qMatrix?: NxCellRows[], + dimensions?: NxCell[], + measures?: NxCell[], + qSize?: Size, + qId?: string, + qSelectionInfo?: Selectionobject +) => void; + +export interface VisualizationCommon { + qHyperCubeDef: HyperCubeDef; + title: string; + showTitles: boolean; + subtitle: string; + footnote: string; +} + +// TODO: Other types of visualizations +export type VisualizationOptions = VisualizationCommon; + +// TODO: Figure out other types +export type ShowFunction = (layout: Layout, cls: any, obj: any) => boolean + | ((measure: NxMeasure) => boolean); + +export interface CustomPropertyCommon { + type?: 'string' | 'integer' | 'number' | 'array' | 'boolean' | 'items'; + ref?: string; + label?: string; + show?: boolean | ShowFunction; +} + +export interface CustomPropertyString extends CustomPropertyCommon { + type: 'string'; + expression?: 'always' | 'optional' | ''; + maxLength?: number; + defaultValue?: string; +} + +export interface CustomPropertyInteger extends CustomPropertyCommon { + type: 'integer'; + component?: string; + min?: string; + max?: string; + defaultValue?: number; +} + +export interface CustomPropertyNumber extends CustomPropertyCommon { + type: 'number'; + component?: string; + min?: string; + max?: string; + defaultValue?: number; +} + +export interface CustomPropertyArray extends CustomPropertyCommon { + type: 'array'; + component?: undefined; + itemTitleRef?: string; + allowAdd?: boolean; + allowRemove?: boolean; + addTranslation?: string; + allowMove?: boolean; +} + +export interface CustomPropertyButton extends CustomPropertyCommon { + component: 'button'; + action(data: VisualizationOptions): void; +} + +export interface ButtonGroupOption { + value: string; + label: string; + tooltip: string; +} + +export interface CustomPropertyButtonGroup extends CustomPropertyCommon { + type: 'string'; + component: 'buttongroup'; + defaultValue?: string; + options?: ButtonGroupOption[] | (() => ButtonGroupOption[]); +} + +export interface CustomPropertyCheckbox extends CustomPropertyCommon { + type: 'boolean'; + defaultValue?: boolean; +} + +export interface CustomPropertyColorPicker extends CustomPropertyCommon { + type: 'integer'; + component: 'color-picker'; + defaultValue?: number; +} + +export interface CustomPropertyOption { + value: string; + label: string; +} + +export type CustomPropertyOptions = CustomPropertyOption[] | (() => CustomPropertyOption[]); + +export interface CustomPropertyDropdown extends CustomPropertyCommon { + type: 'string'; + ref: string; + component: 'dropdown'; + defaultValue?: string; + options?: CustomPropertyOptions; +} + +export interface CustomPropertyLink extends CustomPropertyCommon { + component: 'link'; + url?: string; +} + +export interface CustomProperyMedia extends CustomPropertyCommon { + type: 'string'; + component: 'media'; + layoutRef?: string; +} + +export interface CustomPropertyRadio extends CustomPropertyCommon { + type: 'string'; + component: 'radiobuttons'; + defaultValue?: string; + options?: CustomPropertyOptions; +} + +export interface CustomPropertySlider extends CustomPropertyCommon { + type: 'number'; + component: 'slider'; + defaultValue?: number; + min?: number; + max?: number; + step?: number; +} + +export interface CustomPropertyRangeSlider extends CustomPropertyCommon { + type: 'array'; + component: 'slider'; + defaultValue?: number; + min?: number; + max?: number; + step?: number; +} + +export interface CustomPropertySwitch extends CustomPropertyCommon { + type: 'boolean'; + component: 'switch'; + defaultValue?: string; + options?: CustomPropertyOptions; +} + +export interface CustomPropertyText extends CustomPropertyCommon { + component: 'text'; +} + +export interface CustomPropertyTextArea extends CustomPropertyCommon { + type: 'string'; + component: 'textarea'; + rows?: number; + maxlength?: number; + defaultValue?: string; +} + +export interface CustomPropertyExpression extends CustomPropertyCommon { + type: undefined; + component: 'expression'; + expressionType: 'dimension' | 'measure' | 'StringExpr' | 'ValueExpr' | 'ValueExpression' | 'StringExpression'; + defaultValue?: string; +} + +export interface CustomPropertyItems extends CustomPropertyCommon { + type: 'items'; + items: { + [key: string]: CustomProperty; + }; +} + +export type CustomProperty = CustomPropertyString | CustomPropertyInteger | CustomPropertyNumber + | CustomPropertyArray | CustomPropertyButton | CustomPropertyButtonGroup + | CustomPropertyCheckbox | CustomPropertyColorPicker | CustomPropertyDropdown + | CustomPropertyLink | CustomProperyMedia | CustomPropertyRadio + | CustomPropertySlider | CustomPropertyRangeSlider | CustomPropertySwitch + | CustomPropertyText | CustomPropertyTextArea | CustomPropertyExpression + | CustomPropertyItems; + +export interface Definition { + type: 'items'; + component: 'accordion'; + items: { + data?: { + uses: 'data'; + }; + dimensions?: { + uses: 'dimensions'; + ref?: string; + min?: number; + max?: number; + items?: { + [key: string]: CustomProperty; + } + }; + measures?: { + uses: 'measures'; + ref?: string; + min?: number; + max?: number; + items?: { + [key: string]: CustomProperty; + } + }; + sorting?: { + uses: 'sorting'; + items?: { + [key: string]: CustomProperty; + } + }; + settings?: { + uses: 'settings'; + items?: { + [key: string]: CustomProperty; + } + }; + }; +} + +export interface Extension { + initialProperties: InitialProperties; + definition: Definition; + paint: Paint; + support?: Support; +} + +export interface Patch { + qOp: 'add' | 'remove' | 'replace'; + qPath: string; + qValue: string; +} + +export interface BackendApi { + abortSearch(): void; + acceptSearch(toggleMode: boolean): void; + applyPatches(qPatches: Patch[], qSoftPatch: boolean): Promise; + clearSelections(): void; + clearSoftPatches(): Promise; + collapseLeft(qRow: number, qCol: number, qAll?: boolean): Promise; + collapseTop(qRow: number, qCol: number, qAll?: boolean): Promise; + eachDataRow(callback: (i: number, d: NxCellRows) => boolean | void): NxCellRows; + expandLeft(qRow: number, qCol: number, qAll?: boolean): Promise; + expandTop(qRow: number, qCol: number, qAll?: boolean): Promise; + getData(qPages: NxPage[]): Promise; + getDataRow(rownum: number): NxCellRows | null; + getDimensionInfos(): NxDimensionInfo[]; + getMeasureInfos(): NxMeasureInfo[]; + getPivotData(qPages: NxPage[]): Promise; + // TODO: getProperties(): Promise; + // TODO: getReducedData(qPages: NxPage[], qZoomFactor: number, qReductionMode: 'N' | 'D1' | 'S' | 'C' | 'ST'): Promise; + getRowCount(): number; + getStackeddata(qPages: NxPage[], qMaxNbrCells: number): Promise; + hasSelections(): boolean; + save(): Promise; + search(term: string): void; + // TODO: selectRange(qRanges: Ranges, qOrMode: boolean): void; + selectValues(qDimNo: number, qValues: number[], qToggleMode: boolean): void; + selectProperties(props: {}): Promise; +} + +export interface ExtensionContext { + $element: JQuery; + $scope: any; + _inAnalysisState: boolean; + _inEditState: boolean; + _interactionState: number; + _on: boolean; + backendApi: BackendApi; + // TODO: options: ExtensionOptions; + paint: Paint; + selectionsEnabled: boolean; + toggleLasso(): void; + + selectValues(dimNo: number, values: number[], toggleMode: boolean): void; + + // TODO: LOTS MORE +} + +export interface QDimensionCell { + qText: string; + qElemNumber: number; + qState: string; + qNum?: number; + + select(): void; +} + +export interface QMeasureCell { + qText: string; + qNum?: number; + + getPercent(): number; + getPercentOfMax(): number; +} + +export interface QRow { + dimensions: QDimensionCell[]; + measures: QMeasureCell[]; + cells: Array; +} + +export interface QHeader { + qFallbackTitle: string; + qSortIndicator: 'A' | 'B'; + isOrderedBy: boolean; + qReverseSort: boolean; + col: number; + qCardinal?: number; + qStateCounts?: { [state: string]: number }; + // field?: Field + qMin?: number; + qMax?: number; + errorCode?: number; + errorMessage?: number; + + orderBy(): void; + reverseOrder(): void; + selectRange(min: number, max: number, inclMin: boolean, inclMax: boolean): Promise; +} + +export interface ExportDataOptions { + format: 'OOXML' | 'CSV_C' | 'CSV_T'; + filename?: string; + state: 'A' | 'P'; + download: boolean; +} + +export interface QTable { + rows: QRow[]; + headers: QHeader[]; + totals: QMeasureCell[]; + rowCount: number; + colCount: number; + + exportData(options: ExportDataOptions, callback: (url: string) => void): void; + getColByName(fld: string): number | undefined; + getMoreData(): void; +} + +export interface Variable { + qContent: { + qIsNum: boolean; + qString: string; + }; +} + +export interface QFieldValue { + qText: string; + qElemNumber: number; + qState: any; // TODO + qNum?: string; + qFrequency?: string; + + select(toggle?: boolean, softlock?: boolean): Promise; +} + +export interface GetDataOptions { + rows: number; + frequencyMode: 'V' | 'P' | 'R' | 'N'; +} + +export interface QField { + rows?: QFieldValue[]; + rowCount?: number; + qStateCounts?: { [state: string]: number; }; + + clear(): Promise; + clearOther(softlock: boolean): Promise; + getData(options: GetDataOptions): this; + getMoreData(): this; + lock(): Promise; + select(values: number[], toggle?: boolean, softlock?: boolean): Promise; + selectAll(softlock?: boolean): Promise; + selectAlternative(softlock?: boolean): Promise; + selectExcluded(softlock?: boolean): Promise; + selectMatch(match: string, softlock?: boolean): Promise; + selectPossible(softlock?: boolean): Promise; + selectValues(values: QFieldValue[], toggle?: boolean, softlock?: boolean): Promise; + toggleSelect(match: string, softlock?: boolean): Promise; + unlock(): Promise; +} + +export type ListTypes = 'FieldList' | 'MeasureList' | 'DimensionList' | 'BookmarkList' + | 'Selectionobject' | 'SnapshotList' | 'MediaList' | 'sheet' + | 'Materobject' | 'VariableList' | 'story'; + +export interface App { + addAlternateState(qStateName: string): Promise; + back(): Promise; + clearrAll(lockedAlso?: boolean, state?: string): Promise; + close(): void; + createCube(qHyperCubeDef: HyperCubeDef, callback?: (hypercube: HyperCube) => void): Promise; // TODO: Returns Promise + // TODO: createGenericobject + // TODO: createList(qListobjectDef: ListobjectDef, callback?: (hypercube: TODO) => void): Promise; + // TODO: createTable(dimensions: Array, measures: Array, options?: object): QTable; + destroySession(id: string): Promise; + doReload(qMode?: '0' | '1' | '2', qPartial?: boolean, qDebug?: boolean): Promise; + doSave(qFileName?: string): Promise; + field(field: string, state?: string): QField; + forward(): Promise; + getAppLayout(callback: (layout: Layout) => void): Promise; + // getAppobjectList(type: 'sheet' | 'masterobject', callback: (list: )) + getFullPropertyTree(id: string): Promise; + // getList(type: ListTypes, callback): Promise; + getobject(elem?: HTMLElement | string, id?: string | 'CurrentSelections', options?: { noInteraction?: boolean, noSelections?: boolean }): Promise; + getobjectProperties(id: string): Promise; + getSnapshot(elem?: HTMLElement | string, id?: string): Promise; + lockAll(state?: string): Promise; + removeAlternateState(qStateName: string): Promise; + // searchResults(qTerms: any[], qPage) + // searchSuggest(qTerms: any[], qOptions: { qSearchFields: any[] }, ): Promise; + // selectAssociations + // selectionState(state?: string): QSelectionState; + unlockAll(state?: string): Promise; + + variable: { + getContent(variable: string, callback: (value: Variable, app: App) => void): Promise; + setContent(variable: string, value: string): void; + }; +} + +export function callRepository(path: string, method: string, body: string): Promise; +export function currApp(reference: object): App; + +export interface GetAppConfig { + host?: string; + port: string | number; + prefix?: string; + isSecure?: boolean; + openWithoutData?: boolean; + identity?: string; +} + +export function getAppList(callback: App[], config: GetAppConfig): void; + +// TODO: fix any +export function getExtensionList(callback: any[]): Promise; + +export type Global = any; + +export interface GetGlobalConfig { + host: string; + port: string; + prefix: string; + isSecure: boolean; + identity: string; +} + +export function getGlobal(config: GetGlobalConfig): Global; +export function openApp(appId: string, config: GetAppConfig): App; +export function registerExtension(id: string, impl: Extension, metadata: object): void; +export function resize(ID?: string): void; + +export namespace LanguageCodes { + type German = 'de' | 'de-DE'; + type English = 'en' | 'en-US'; + type Spanish = 'es' | 'es-ES'; + type French = 'fr' | 'fr-FR'; + type Italian = 'it' | 'it-IT'; + type Japanese = 'ja' | 'ja-JP'; + type Korean = 'ko' | 'ko-KR'; + type Dutch = 'nl' | 'nl-NL'; + type Polish = 'pl' | 'pl-PL'; + type BrazilianPortuguese = 'pt' | 'pt-BR'; + type Russian = 'ru' | 'ru-RU'; + type Swedish = 'sv' | 'sv-SE'; + type Turkish = 'ts' | 'ts-TR'; + type SimplifiedChinese = 'zh-CN'; + type TraditionalChinese = 'zh-TW'; + + type ALL = German | English | Spanish | French | Italian | Japanese + | Korean | Dutch | Polish | BrazilianPortuguese | Russian + | Swedish | Turkish | SimplifiedChinese | TraditionalChinese; +} +export function setLanguage(lang: LanguageCodes.ALL): void; + +export interface Error { + code: any; // TODO: Find out if String or number + message: string; +} +export function setOnError(onError: (error: Error) => void, onWarning: (warning: string) => void): void; +export function table(ext: object, path?: string): void; diff --git a/types/qlik/qlik-tests.ts b/types/qlik/qlik-tests.ts new file mode 100644 index 0000000000..3256ac477f --- /dev/null +++ b/types/qlik/qlik-tests.ts @@ -0,0 +1,53 @@ +import * as Qlik from 'qlik'; + +// Extension API Test +() => { + const definition: Qlik.Definition = { + type: 'items', + component: 'accordion', + items: { + dimensions: { + uses: 'dimensions', + min: 1, + ref: "qHyperCubeDef.qDimensions", + items: { + isGrouping: { + type: 'boolean', + ref: 'qDef.isGrouping', + label: 'Is Grouping', + defaultValue: false, + }, + }, + }, + measures: { + uses: 'measures', + ref: "qHyperCubeDef.qMeasures", + min: 0, + }, + } + }; + + const initialProperties: Qlik.InitialProperties = { + qHyperCubeDef: { + qDimensions: [], + qMeasures: [], + qInitialDataFetch: [{ + qWidth: 10, + qHeight: 100, + }], + }, + }; + + function paint(this: Qlik.ExtensionContext, $element: JQuery, layout: Qlik.Layout) { + const dataRow = this.backendApi.getDataRow(0); + if (dataRow) { + $element.html(dataRow[0].qText); + } + } + + const e: Qlik.Extension = { + definition, + initialProperties, + paint, + }; +}; diff --git a/types/qlik/tsconfig.json b/types/qlik/tsconfig.json new file mode 100644 index 0000000000..88e56e6236 --- /dev/null +++ b/types/qlik/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "qlik-tests.ts" + ] +} diff --git a/types/qlik/tslint.json b/types/qlik/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/qlik/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From c5a75a3c319ac012571540195e6a7a59357fef73 Mon Sep 17 00:00:00 2001 From: Leonard Thieu Date: Thu, 1 Jun 2017 01:02:41 -0400 Subject: [PATCH 0159/1105] [simplebar] Update type definitions (new for v2) (#16767) * Update type definitions for simplebar (new for v2). * dtslint bug workaround (and fix linter errors exposed). --- types/simplebar/index.d.ts | 54 ++++++++++++--------------- types/simplebar/simplebar-tests.ts | 53 ++++++++++++++++++++++++-- types/simplebar/tslint.json | 3 ++ types/simplebar/v1/index.d.ts | 24 ++++++++++++ types/simplebar/v1/simplebar-tests.ts | 2 + types/simplebar/v1/tsconfig.json | 28 ++++++++++++++ 6 files changed, 131 insertions(+), 33 deletions(-) create mode 100644 types/simplebar/tslint.json create mode 100644 types/simplebar/v1/index.d.ts create mode 100644 types/simplebar/v1/simplebar-tests.ts create mode 100644 types/simplebar/v1/tsconfig.json diff --git a/types/simplebar/index.d.ts b/types/simplebar/index.d.ts index 0e43773d64..64533d7408 100644 --- a/types/simplebar/index.d.ts +++ b/types/simplebar/index.d.ts @@ -1,37 +1,31 @@ -// Type definitions for simplebar.js 1.1.7 +// Type definitions for simplebar.js 2.4 // Project: https://github.com/Grsmto/simplebar -// Definitions by: Gregor Woiwode +// Definitions by: Leonard Thieu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 -interface SimplebarOptions { - autoHide?: boolean; - wrapContent?: boolean; +declare class SimpleBar { + static removeObserver(): void; + + constructor(element: HTMLElement, options?: SimpleBar.Options); + + recalculate(): void; + getScrollElement(): Element; + getContentElement(): Element; } -interface JQuery { - /** - * Enables simplebar on calling element. - */ - simplebar: { - /** - * Define if scrollbar should be faded out automatically - * - * @param indicator if scrollbar should be faded out automatically. - */ - (options?: SimplebarOptions): JQuery; - }; -} +declare namespace SimpleBar { + interface Options { + wrapContent?: boolean; + autoHide?: boolean; + scrollbarMinSize?: number; + classNames?: ClassNamesOptions; + } -interface JQueryStatic { - /** - * Enables simplebar on calling element. - */ - simplebar: { - /** - * Define if scrollbar should be faded out automatically - * - * @param indicator if scrollbar should be faded out automatically. - */ - (options?: SimplebarOptions): JQuery; - }; + interface ClassNamesOptions { + content?: string; + scrollContent?: string; + scrollbar?: string; + track?: string; + } } diff --git a/types/simplebar/simplebar-tests.ts b/types/simplebar/simplebar-tests.ts index 9ce78c1fdf..ad403d22a5 100644 --- a/types/simplebar/simplebar-tests.ts +++ b/types/simplebar/simplebar-tests.ts @@ -1,4 +1,51 @@ -/// +function test_start() { + new SimpleBar(document.getElementById('myElement')); +} -var simplebar = $.fn.simplebar.noConflict(); -$.fn.simplebar = simplebar; +function test_options_wrapContent() { + new SimpleBar(document.getElementById('myElement'), { wrapContent: false }); +} + +function test_options_autoHide() { + new SimpleBar(document.getElementById('myElement'), { autoHide: false }); +} + +function test_options_scrollbarMinSize() { + new SimpleBar(document.getElementById('myElement'), { scrollbarMinSize: 10 }); +} + +function test_options_classNames() { + new SimpleBar(document.getElementById('myElement'), { + classNames: { + // defaults + content: 'simplebar-content', + scrollContent: 'simplebar-scroll-content', + scrollbar: 'simplebar-scrollbar', + track: 'simplebar-track' + } + }); +} + +function test_recalculate() { + const el = new SimpleBar(document.getElementById('myElement')); + el.recalculate(); +} + +function test_getScrollElement() { + const el = new SimpleBar(document.getElementById('myElement')); + el.getScrollElement(); +} + +function test_scrollEvent() { + const el = new SimpleBar(document.getElementById('myElement')); + el.getScrollElement().addEventListener('scroll', () => { }); +} + +function test_getContentElement() { + const el = new SimpleBar(document.getElementById('myElement')); + el.getContentElement(); +} + +function test_removeObserver() { + SimpleBar.removeObserver(); +} diff --git a/types/simplebar/tslint.json b/types/simplebar/tslint.json new file mode 100644 index 0000000000..d88586e5bd --- /dev/null +++ b/types/simplebar/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/simplebar/v1/index.d.ts b/types/simplebar/v1/index.d.ts new file mode 100644 index 0000000000..1a5f4f3fa6 --- /dev/null +++ b/types/simplebar/v1/index.d.ts @@ -0,0 +1,24 @@ +// Type definitions for simplebar.js 1.1.7 +// Project: https://github.com/Grsmto/simplebar +// Definitions by: Gregor Woiwode , Leonard Thieu +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +interface SimplebarOptions { + autoHide?: boolean; + wrapContent?: boolean; +} + +interface SimpleBar { + noConflict(): SimpleBar & JQuery; + + /** + * Enables simplebar on calling element. + */ + (options?: SimplebarOptions): JQuery; +} + +interface JQuery { + simplebar: SimpleBar; +} \ No newline at end of file diff --git a/types/simplebar/v1/simplebar-tests.ts b/types/simplebar/v1/simplebar-tests.ts new file mode 100644 index 0000000000..dc66c129bf --- /dev/null +++ b/types/simplebar/v1/simplebar-tests.ts @@ -0,0 +1,2 @@ +var simplebar = $.fn.simplebar.noConflict(); +$.fn.simplebar = simplebar; diff --git a/types/simplebar/v1/tsconfig.json b/types/simplebar/v1/tsconfig.json new file mode 100644 index 0000000000..48fd782d24 --- /dev/null +++ b/types/simplebar/v1/tsconfig.json @@ -0,0 +1,28 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "paths": { + "simplebar": [ + "simplebar/v1" + ] + }, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "simplebar-tests.ts" + ] +} From 88c5b37ce566d3dab4c3524619849416ca2e8c5c Mon Sep 17 00:00:00 2001 From: Bradley Ayers Date: Thu, 1 Jun 2017 15:03:48 +1000 Subject: [PATCH 0160/1105] Add orderedmap 1.0 (#16829) --- types/orderedmap/index.d.ts | 23 +++++++++++++++++++++++ types/orderedmap/orderedmap-tests.ts | 27 +++++++++++++++++++++++++++ types/orderedmap/tsconfig.json | 22 ++++++++++++++++++++++ types/orderedmap/tslint.json | 1 + 4 files changed, 73 insertions(+) create mode 100644 types/orderedmap/index.d.ts create mode 100644 types/orderedmap/orderedmap-tests.ts create mode 100644 types/orderedmap/tsconfig.json create mode 100644 types/orderedmap/tslint.json diff --git a/types/orderedmap/index.d.ts b/types/orderedmap/index.d.ts new file mode 100644 index 0000000000..3e957c14d4 --- /dev/null +++ b/types/orderedmap/index.d.ts @@ -0,0 +1,23 @@ +// Type definitions for orderedmap 1.0 +// Project: https://github.com/marijnh/orderedmap +// Definitions by: Bradley Ayers +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +export = OrderedMap; + +declare class OrderedMap { + get(key: string): T | undefined; + update(key: string, value: T, newKey?: string): this; + remove(key: string): this; + addToStart(key: string, value: T): this; + addToEnd(key: string, value: T): this; + addBefore(place: string, key: string, value: T): this; + forEach(f: (key: string, value: T) => void): void; + prepend(map: { [key: string]: T } | OrderedMap): this; + append(map: { [key: string]: T } | OrderedMap): this; + subtract(map: { [key: string]: T } | OrderedMap): this; + readonly size: number; + + static from(value?: { [key: string]: T } | OrderedMap): OrderedMap; +} diff --git a/types/orderedmap/orderedmap-tests.ts b/types/orderedmap/orderedmap-tests.ts new file mode 100644 index 0000000000..2125c1f918 --- /dev/null +++ b/types/orderedmap/orderedmap-tests.ts @@ -0,0 +1,27 @@ +import OrderedMap = require('orderedmap'); + +// Ensure .get() returns the correct type. +OrderedMap + .from({ one: 1 }) + .get('one')!.toExponential(); +OrderedMap + .from({ one: '1' }) + .get('one')!.codePointAt(0); + +const om = OrderedMap.from({ key: 'value' }); + +// Terminating methods / properties +om.get('key'); +om.forEach((key: string, value: string) => {}); +om.size + 1; + +// Method chaining +om + .update('key', 'value') + .remove('key') + .addToStart('key', 'value') + .addToEnd('key', 'value') + .addBefore('key', 'key', 'value') + .prepend({ key: 'value' }) + .append({ key: 'value' }) + .subtract({ key: 'value' }); diff --git a/types/orderedmap/tsconfig.json b/types/orderedmap/tsconfig.json new file mode 100644 index 0000000000..cc31c6b296 --- /dev/null +++ b/types/orderedmap/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", + "orderedmap-tests.ts" + ] +} diff --git a/types/orderedmap/tslint.json b/types/orderedmap/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/orderedmap/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 49069db3ca9c9618e24d1644dad59e6daf9d6071 Mon Sep 17 00:00:00 2001 From: Bradley Ayers Date: Thu, 1 Jun 2017 15:04:23 +1000 Subject: [PATCH 0161/1105] Add prosemirror-schema-list 0.21 (#16832) * Add orderedmap 1.0 * Add prosemirror-schema-list 0.21 --- types/prosemirror-schema-list/index.d.ts | 19 ++++++++++++++++ .../prosemirror-schema-list-tests.ts | 10 +++++++++ types/prosemirror-schema-list/tsconfig.json | 22 +++++++++++++++++++ types/prosemirror-schema-list/tslint.json | 1 + 4 files changed, 52 insertions(+) create mode 100644 types/prosemirror-schema-list/index.d.ts create mode 100644 types/prosemirror-schema-list/prosemirror-schema-list-tests.ts create mode 100644 types/prosemirror-schema-list/tsconfig.json create mode 100644 types/prosemirror-schema-list/tslint.json diff --git a/types/prosemirror-schema-list/index.d.ts b/types/prosemirror-schema-list/index.d.ts new file mode 100644 index 0000000000..2378dc8b3c --- /dev/null +++ b/types/prosemirror-schema-list/index.d.ts @@ -0,0 +1,19 @@ +// Type definitions for prosemirror-schema-list 0.21 +// Project: https://github.com/ProseMirror/prosemirror-schema-list +// Definitions by: Bradley Ayers +// David Hahn +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +import OrderedMap = require('orderedmap'); +import { NodeSpec, NodeType } from 'prosemirror-model'; +import { EditorState, Transaction } from 'prosemirror-state'; + +export let orderedList: NodeSpec; +export let bulletList: NodeSpec; +export let listItem: NodeSpec; +export function addListNodes(nodes: OrderedMap, itemContent: string, listGroup?: string): OrderedMap; +export function wrapInList(listType: NodeType, attrs?: { [key: string]: any }): (state: EditorState, dispatch?: (tr: Transaction) => void) => boolean; +export function splitListItem(itemType: NodeType): (state: EditorState, dispatch?: (tr: Transaction) => void) => boolean; +export function liftListItem(itemType: NodeType): (state: EditorState, dispatch?: (tr: Transaction) => void) => boolean; +export function sinkListItem(itemType: NodeType): (state: EditorState, dispatch?: (tr: Transaction) => void) => boolean; diff --git a/types/prosemirror-schema-list/prosemirror-schema-list-tests.ts b/types/prosemirror-schema-list/prosemirror-schema-list-tests.ts new file mode 100644 index 0000000000..a96d3b9a04 --- /dev/null +++ b/types/prosemirror-schema-list/prosemirror-schema-list-tests.ts @@ -0,0 +1,10 @@ +import { + orderedList, + bulletList, + listItem, + addListNodes, + wrapInList, + splitListItem, + liftListItem, + sinkListItem +} from 'prosemirror-schema-list'; diff --git a/types/prosemirror-schema-list/tsconfig.json b/types/prosemirror-schema-list/tsconfig.json new file mode 100644 index 0000000000..a02b0a9255 --- /dev/null +++ b/types/prosemirror-schema-list/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", + "prosemirror-schema-list-tests.ts" + ] +} diff --git a/types/prosemirror-schema-list/tslint.json b/types/prosemirror-schema-list/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/prosemirror-schema-list/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 3ae258b5c6e11eec7da9895511a6e6a15d0fb5ab Mon Sep 17 00:00:00 2001 From: Leonard Thieu Date: Thu, 1 Jun 2017 01:07:45 -0400 Subject: [PATCH 0162/1105] Add type definitions for parse-git-config. (#16817) --- types/parse-git-config/index.d.ts | 45 +++++++++++ .../parse-git-config-tests.ts | 78 +++++++++++++++++++ types/parse-git-config/tsconfig.json | 22 ++++++ types/parse-git-config/tslint.json | 3 + 4 files changed, 148 insertions(+) create mode 100644 types/parse-git-config/index.d.ts create mode 100644 types/parse-git-config/parse-git-config-tests.ts create mode 100644 types/parse-git-config/tsconfig.json create mode 100644 types/parse-git-config/tslint.json diff --git a/types/parse-git-config/index.d.ts b/types/parse-git-config/index.d.ts new file mode 100644 index 0000000000..4d5897ca5b --- /dev/null +++ b/types/parse-git-config/index.d.ts @@ -0,0 +1,45 @@ +// Type definitions for parse-git-config 1.1 +// Project: https://github.com/jonschlinkert/parse-git-config +// Definitions by: Leonard Thieu +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +declare const parse: Parse; +export = parse; + +interface Parse { + /** + * Asynchronously parse a .git/config file. + * If only the callback is passed, the .git/config file relative to process.cwd() is used. + */ + (options: (Options | object) | string, cb: ParseCallback): void; + /** + * Asynchronously parse a .git/config file. + * If only the callback is passed, the .git/config file relative to process.cwd() is used. + */ + (cb: ParseCallback): void; + /** + * Synchronously parse a .git/config file. + * If no arguments are passed, the .git/config file relative to process.cwd() is used. + */ + sync(options?: (Options | object) | string): Config; + /** + * Returns an object with only the properties that had ini-style keys converted to objects. + */ + keys(config: Config): Config; +} + +// no-empty-interface is disabled for a better debugging experience. Empty interfaces are used to alias a type alias. +// tslint:disable-next-line no-empty-interface +interface Options extends Pick<_Options, keyof _Options> { } + +interface _Options { + cwd: string; + path: string; +} + +type ParseCallback = ((err: Error | null, config: Config) => void); +// TODO: Can this be defined more precisely? +interface Config { + [key: string]: any; +} diff --git a/types/parse-git-config/parse-git-config-tests.ts b/types/parse-git-config/parse-git-config-tests.ts new file mode 100644 index 0000000000..e08fce8029 --- /dev/null +++ b/types/parse-git-config/parse-git-config-tests.ts @@ -0,0 +1,78 @@ +import parse = require('parse-git-config'); + +function test_parse_options() { + parse({ cwd: 'foo', path: '.git/config' }, (err, config) => { + if (err) { + throw err; + } + + let origin = config['remote "origin"']; + if (origin && origin.url) { + origin.url.split('/'); + } + }) === undefined; +} + +function test_parse_cwd() { + parse('foo', (err, config) => { + if (err) { + throw err; + } + + let origin = config['remote "origin"']; + if (origin && origin.url) { + origin.url.split('/'); + } + }) === undefined; +} + +function test_parse() { + parse((err, config) => { + if (err) { + throw err; + } + + let origin = config['remote "origin"']; + if (origin && origin.url) { + origin.url.split('/'); + } + }) === undefined; +} + +function test_sync_options() { + const config = parse.sync({ cwd: 'foo', path: '.git/config' }); + + let origin = config['remote "origin"']; + if (origin && origin.url) { + origin.url.split('/'); + } +} + +function test_sync_cwd() { + const config = parse.sync('foo'); + + let origin = config['remote "origin"']; + if (origin && origin.url) { + origin.url.split('/'); + } +} + +function test_sync() { + const config = parse.sync(); + + let origin = config['remote "origin"']; + if (origin && origin.url) { + origin.url.split('/'); + } +} + +function test_keys() { + const config = { + 'foo "bar"': { doStuff: true }, + 'foo "baz"': { doStuff: true } + }; + const keys = parse.keys(config); + + keys.foo.bar.doStuff === true; + keys.foo.baz.doStuff === true; +} diff --git a/types/parse-git-config/tsconfig.json b/types/parse-git-config/tsconfig.json new file mode 100644 index 0000000000..453d805680 --- /dev/null +++ b/types/parse-git-config/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", + "parse-git-config-tests.ts" + ] +} diff --git a/types/parse-git-config/tslint.json b/types/parse-git-config/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/parse-git-config/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} From b2304899ad8fa065e37ddc2cd8163f7ffb09b2ad Mon Sep 17 00:00:00 2001 From: Leonard Thieu Date: Thu, 1 Jun 2017 01:09:06 -0400 Subject: [PATCH 0163/1105] Add type definitions for angular-tooltips. (#16816) --- .../angular-tooltips-tests.ts | 21 +++++++++++++++ types/angular-tooltips/index.d.ts | 26 +++++++++++++++++++ types/angular-tooltips/tsconfig.json | 23 ++++++++++++++++ types/angular-tooltips/tslint.json | 3 +++ 4 files changed, 73 insertions(+) create mode 100644 types/angular-tooltips/angular-tooltips-tests.ts create mode 100644 types/angular-tooltips/index.d.ts create mode 100644 types/angular-tooltips/tsconfig.json create mode 100644 types/angular-tooltips/tslint.json diff --git a/types/angular-tooltips/angular-tooltips-tests.ts b/types/angular-tooltips/angular-tooltips-tests.ts new file mode 100644 index 0000000000..5b89ec363f --- /dev/null +++ b/types/angular-tooltips/angular-tooltips-tests.ts @@ -0,0 +1,21 @@ +import * as angular from 'angular'; +import * as angularTooltips from 'angular-tooltips'; + +angular + .module('test.angular-tooltips', [ + angularTooltips + ]) + .config((tooltipsConfProvider: angularTooltips.TooltipsConfProvider) => { + tooltipsConfProvider.configure({ + side: 'left', + showTrigger: 'click', + hideTrigger: 'click', + class: 'class', + smart: true, + closeButton: false, + size: 'small', + speed: 'slow', + tooltipTemplateUrlCache: true, + show: false + }); + }); diff --git a/types/angular-tooltips/index.d.ts b/types/angular-tooltips/index.d.ts new file mode 100644 index 0000000000..d3cf83c1ec --- /dev/null +++ b/types/angular-tooltips/index.d.ts @@ -0,0 +1,26 @@ +// Type definitions for angular-tooltips 1.2 +// Project: http://720kb.github.io/angular-tooltips +// Definitions by: Leonard Thieu +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare const AngularTooltips: '720kb.tooltips'; +export = AngularTooltips; + +declare namespace AngularTooltips { + interface TooltipsConfProvider { + configure(options: TooltipsConfProviderOptions): void; + } + + interface TooltipsConfProviderOptions { + side?: 'left' | 'right' | 'top' | 'bottom' | 'top left' | 'top right' | 'bottom left' | 'bottom right'; + showTrigger?: string; + hideTrigger?: string; + class?: string; + smart?: boolean; + closeButton?: boolean; + size?: 'small' | 'medium' | 'large'; + speed?: 'slow' | 'medium' | 'fast'; + tooltipTemplateUrlCache?: boolean; + show?: boolean; + } +} diff --git a/types/angular-tooltips/tsconfig.json b/types/angular-tooltips/tsconfig.json new file mode 100644 index 0000000000..945fa84c71 --- /dev/null +++ b/types/angular-tooltips/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "angular-tooltips-tests.ts" + ] +} diff --git a/types/angular-tooltips/tslint.json b/types/angular-tooltips/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/angular-tooltips/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} From 5da11947ec8edaecd762a2ac324a7d81ae2e9b2b Mon Sep 17 00:00:00 2001 From: Kyle Roach Date: Thu, 1 Jun 2017 01:10:16 -0400 Subject: [PATCH 0164/1105] [react-native] Added keyboardShouldPersistTaps prop to FlatList (#16818) --- types/react-native/index.d.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index 2e22ad489b..8f0af54667 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -3450,6 +3450,14 @@ export interface FlatListProperties extends ScrollViewProperties { */ columnWrapperStyle?: ViewStyle + /** + * When false tapping outside of the focused text input when the keyboard + * is up dismisses the keyboard. When true the scroll view will not catch + * taps and the keyboard will not dismiss automatically. The default value + * is false. + */ + keyboardShouldPersistTaps?: boolean | 'always' | 'never' | 'handled' + /** * For simplicity, data is just a plain array. If you want to use something else, * like an immutable list, use the underlying VirtualizedList directly. From 5c066b335cb7fbe11fe6c0702e94bdf70c12abbc Mon Sep 17 00:00:00 2001 From: Stefan Fochler Date: Thu, 1 Jun 2017 07:12:10 +0200 Subject: [PATCH 0165/1105] Add types for 'react-pointable' (#16806) --- types/react-pointable/index.d.ts | 30 +++++++++++++++++++ .../react-pointable/react-pointable-tests.tsx | 27 +++++++++++++++++ types/react-pointable/tsconfig.json | 24 +++++++++++++++ types/react-pointable/tslint.json | 1 + 4 files changed, 82 insertions(+) create mode 100644 types/react-pointable/index.d.ts create mode 100644 types/react-pointable/react-pointable-tests.tsx create mode 100644 types/react-pointable/tsconfig.json create mode 100644 types/react-pointable/tslint.json diff --git a/types/react-pointable/index.d.ts b/types/react-pointable/index.d.ts new file mode 100644 index 0000000000..6439df14eb --- /dev/null +++ b/types/react-pointable/index.d.ts @@ -0,0 +1,30 @@ +// Type definitions for react-pointable 1.1 +// Project: https://github.com/MilllerTime/react-pointable +// Definitions by: Stefan Fochler +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +import * as React from 'react'; + +export type TouchAction = 'auto' | 'none' | 'pan-x' | 'pan-y' | 'manipulation'; + +export interface PointableProps extends React.HTMLAttributes { + tagName?: keyof HTMLElementTagNameMap; + touchAction?: TouchAction; + elementRef?(el: HTMLElement): void; + onPointerMove?(evt: PointerEvent): void; + onPointerDown?(evt: PointerEvent): void; + onPointerUp?(evt: PointerEvent): void; + onPointerOver?(evt: PointerEvent): void; + onPointerOut?(evt: PointerEvent): void; + onPointerEnter?(evt: PointerEvent): void; + onPointerLeave?(evt: PointerEvent): void; + onPointerCancel?(evt: PointerEvent): void; +} + +export default class Pointable extends React.Component { + static defaultProps: { + tagName: 'div', + touchAction: 'auto' + }; +} diff --git a/types/react-pointable/react-pointable-tests.tsx b/types/react-pointable/react-pointable-tests.tsx new file mode 100644 index 0000000000..6331b88386 --- /dev/null +++ b/types/react-pointable/react-pointable-tests.tsx @@ -0,0 +1,27 @@ +import * as React from "react"; +import Pointable from 'react-pointable'; + +class Test extends React.Component { + elementRef(el: HTMLElement) {} + somePointerEvent(evt: PointerEvent) {} + + render() { + return ( + + Child Contents + + ); + } +} diff --git a/types/react-pointable/tsconfig.json b/types/react-pointable/tsconfig.json new file mode 100644 index 0000000000..866ea95bb4 --- /dev/null +++ b/types/react-pointable/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "jsx": "react", + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "react-pointable-tests.tsx" + ] +} diff --git a/types/react-pointable/tslint.json b/types/react-pointable/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-pointable/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From f7ef6b01f6354c135a48e8088f22eccfb2ae79de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vesa=20Poikaj=C3=A4rvi?= Date: Thu, 1 Jun 2017 08:14:20 +0300 Subject: [PATCH 0166/1105] [koa-morgan] Add type definitions (#16796) * [koa-morgan] New type definitions * [koa-morgan] strictNullChecks to true * [koa-morgan] remove app.listen from test * [koa-morgan] npm run lint passing * [koa-morgan] Revert irrelevant whitespace cleanup --- types/koa-morgan/index.d.ts | 211 +++++++++++++++++++++++++++ types/koa-morgan/koa-morgan-tests.ts | 75 ++++++++++ types/koa-morgan/tsconfig.json | 22 +++ types/koa-morgan/tslint.json | 9 ++ 4 files changed, 317 insertions(+) create mode 100644 types/koa-morgan/index.d.ts create mode 100644 types/koa-morgan/koa-morgan-tests.ts create mode 100644 types/koa-morgan/tsconfig.json create mode 100644 types/koa-morgan/tslint.json diff --git a/types/koa-morgan/index.d.ts b/types/koa-morgan/index.d.ts new file mode 100644 index 0000000000..494f4d3f19 --- /dev/null +++ b/types/koa-morgan/index.d.ts @@ -0,0 +1,211 @@ +// Type definitions for koa-morgan 1.0 +// Project: https://github.com/koa-modules/morgan +// Definitions by: Vesa Poikajärvi +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +import * as Koa from 'koa'; +import * as originalMorgan from 'morgan'; + +declare namespace morgan { + interface FormatFn { + (tokens: TokenIndexer, req: Koa.Request, res: Koa.Response): string; + } + + interface TokenCallbackFn { + (req: Koa.Request, res: Koa.Response, arg?: string | number | boolean): string; + } + + interface TokenIndexer extends originalMorgan.TokenIndexer {} + + /** + * Public interface of morgan logger + */ + interface KoaMorgan { + /*** + * Create a new morgan logger middleware function using the given format and options. The + * format argument may be a string of a predefined name (see below for the names), + * or a string of a format string containing defined tokens. + * @param format + * @param options + */ + (format: string, options?: Options): Koa.Middleware; + + /*** + * Standard Apache combined log output. + * :remote-addr - :remote-user [:date] ":method :url HTTP/:http-version" :status :res[content-length] ":referrer" ":user-agent" + * @param format + * @param options + */ + (format: 'combined', options?: Options): Koa.Middleware; + + /*** + * Standard Apache common log output. + * :remote-addr - :remote-user [:date] ":method :url HTTP/:http-version" :status :res[content-length] + * @param format + * @param options + */ + (format: 'common', options?: Options): Koa.Middleware; + + /** + * Concise output colored by response status for development use. The :status token will be colored red for + * server error codes, yellow for client error codes, cyan for redirection codes, and uncolored for all other codes. + * :method :url :status :response-time ms - :res[content-length] + * @param format + * @param options + */ + (format: 'dev', options?: Options): Koa.Middleware; + + /*** + * Shorter than default, also including response time. + * :remote-addr :remote-user :method :url HTTP/:http-version :status :res[content-length] - :response-time ms + * @param format + * @param options + */ + (format: 'short', options?: Options): Koa.Middleware; + + /*** + * The minimal output. + * :method :url :status :res[content-length] - :response-time ms + * @param format + * @param options + */ + (format: 'tiny', options?: Options): Koa.Middleware; + + /*** + * Create a new morgan logger middleware function using the given format and options. The format argument may be a + * custom format function which adheres to the signature. + * @param format + * @param options + */ + (format: FormatFn, options?: Options): Koa.Middleware; + + /** + * Define a custom token which can be used in custom morgan logging formats. + */ + token(name: string, callback: TokenCallbackFn): KoaMorgan; + + /** + * Define a named custom format by specifying a format string in token notation + */ + format(name: string, fmt: string): KoaMorgan; + + /** + * Define a named custom format by specifying a format function + */ + format(name: string, fmt: FormatFn): KoaMorgan; + + /** + * Compile a format string in token notation into a format function + */ + compile(format: string): FormatFn; + } + + /** + * Define a custom token which can be used in custom morgan logging formats. + */ + function token(name: string, callback: TokenCallbackFn): KoaMorgan; + + /** + * Define a named custom format by specifying a format string in token notation + */ + function format(name: string, fmt: string): KoaMorgan; + + /** + * Define a named custom format by specifying a format function + */ + function format(name: string, fmt: FormatFn): KoaMorgan; + + /** + * Compile a format string in token notation into a format function + */ + function compile(format: string): FormatFn; + + interface StreamOptions extends originalMorgan.StreamOptions {} + + /*** + * Morgan accepts these properties in the options object. + */ + interface Options { + /*** + * Buffer duration before writing logs to the stream, defaults to false. When set to true, defaults to 1000 ms. + */ + buffer?: boolean; + + /*** + * Write log line on request instead of response. This means that a requests will be logged even if the server + * crashes, but data from the response cannot be logged (like the response code). + */ + immediate?: boolean; + + /*** + * Function to determine if logging is skipped, defaults to false. This function will be called as skip(req, res). + */ + skip?: (req: Koa.Request, res: Koa.Response) => boolean; + + /*** + * Output stream for writing log lines, defaults to process.stdout. + * @param str + */ + stream?: StreamOptions; + } +} + +/*** + * Create a new morgan logger middleware function using the given format and options. The format argument may be a string + * of a predefined name (see below for the names), or a string of a format string containing defined tokens. + * @param format + * @param options + */ +declare function morgan(format: string, options?: morgan.Options): Koa.Middleware; + +/*** + * Standard Apache combined log output. + * :remote-addr - :remote-user [:date] ":method :url HTTP/:http-version" :status :res[content-length] ":referrer" ":user-agent" + * @param format + * @param options + */ +declare function morgan(format: 'combined', options?: morgan.Options): Koa.Middleware; + +/*** + * Standard Apache common log output. + * :remote-addr - :remote-user [:date] ":method :url HTTP/:http-version" :status :res[content-length] + * @param format + * @param options + */ +declare function morgan(format: 'common', options?: morgan.Options): Koa.Middleware; + +/*** + * Concise output colored by response status for development use. The :status token will be colored red for server error codes, + * yellow for client error codes, cyan for redirection codes, and uncolored for all other codes. + * :method :url :status :response-time ms - :res[content-length] + * @param format + * @param options + */ +declare function morgan(format: 'dev', options?: morgan.Options): Koa.Middleware; + +/*** + * Shorter than default, also including response time. + * :remote-addr :remote-user :method :url HTTP/:http-version :status :res[content-length] - :response-time ms + * @param format + * @param options + */ +declare function morgan(format: 'short', options?: morgan.Options): Koa.Middleware; + +/*** + * The minimal output. + * :method :url :status :res[content-length] - :response-time ms + * @param format + * @param options + */ +declare function morgan(format: 'tiny', options?: morgan.Options): Koa.Middleware; + +/*** + * Create a new morgan logger middleware function using the given format and options. The format argument may be a + * custom format function which adheres to the signature. + * @param format + * @param options + */ +declare function morgan(custom: (req: Koa.Request, res: Koa.Response) => string): Koa.Middleware; + +export = morgan; diff --git a/types/koa-morgan/koa-morgan-tests.ts b/types/koa-morgan/koa-morgan-tests.ts new file mode 100644 index 0000000000..c52d9dc0a5 --- /dev/null +++ b/types/koa-morgan/koa-morgan-tests.ts @@ -0,0 +1,75 @@ +import * as Koa from 'koa'; +import * as morgan from 'koa-morgan'; + +const app = new Koa(); + +app.use(morgan('combined')); +app.use(morgan('common')); +app.use(morgan('dev')); +app.use(morgan('short')); +app.use(morgan('tiny')); +app.use(morgan(':remote-addr :method :url')); + +const stream: morgan.StreamOptions = { + write: (str: string) => { + console.log(str); + } +}; + +app.use(morgan('combined', { + buffer: true, + immediate: true, + skip: (req: Koa.Request, res: Koa.Response) => res.status < 400, + stream +})); + +// test interface definition for morgan + +// a named custom format defined as string (example: extend 'tiny' format with user-agent token) +morgan.format('tiny-extended', ':method :url :status :res[content-length] - :response-time ms :user-agent'); +app.use(morgan('tiny-extended')); + +// a named custom format defined using the Function signature (example: extend 'dev' format with user-agent token) + +// extend morgan.FormatFn interface with memoizer property to avoid unnecessary re-compiling +// of status-code range driven colorized format functions +interface FormatFnIndexer { + [memoizerName: string]: morgan.FormatFn; +} + +interface ExtendedFormatFn extends morgan.FormatFn { + memoizer?: FormatFnIndexer; +} + +const developmentExtendedFormatLine: ExtendedFormatFn = (tokens, req: Koa.Request, res: Koa.Response): string => { + // get the status code if response written + const status = res.status + ? res.status + : undefined; + + // get status color + const color = status && status >= 500 ? 31 // red + : status && status >= 400 ? 33 // yellow + : status && status >= 300 ? 36 // cyan + : status && status >= 200 ? 32 // green + : 0; // no color + + // get colored format function, if previously memoized, otherwise undefined + let fn: morgan.FormatFn|undefined = developmentExtendedFormatLine.memoizer ? developmentExtendedFormatLine.memoizer[color] : undefined; + + if (!fn) { + if (!developmentExtendedFormatLine.memoizer) { + developmentExtendedFormatLine.memoizer = {}; + } + + fn = developmentExtendedFormatLine.memoizer[color] = morgan.compile('\x1b[0m:method :url \x1b[' + + color + 'm:status \x1b[0m:response-time ms - :res[content-length]\x1b[0m :user-agent'); + } + + return fn(tokens, req, res); +}; + +developmentExtendedFormatLine.memoizer = {}; + +morgan.format('dev-extended', developmentExtendedFormatLine); +app.use(morgan('dev-extended')); diff --git a/types/koa-morgan/tsconfig.json b/types/koa-morgan/tsconfig.json new file mode 100644 index 0000000000..d8dae4f5fc --- /dev/null +++ b/types/koa-morgan/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", + "koa-morgan-tests.ts" + ] +} diff --git a/types/koa-morgan/tslint.json b/types/koa-morgan/tslint.json new file mode 100644 index 0000000000..5b6c04888d --- /dev/null +++ b/types/koa-morgan/tslint.json @@ -0,0 +1,9 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "unified-signatures": false, + "no-empty-interface": false, + "prefer-method-signature": false, + "callable-types": false + } +} From a8dca3c8f5e001930f9061379b34053524e03a03 Mon Sep 17 00:00:00 2001 From: Downpooooour Date: Thu, 1 Jun 2017 13:15:00 +0800 Subject: [PATCH 0167/1105] add types for react-native-swiper, fix types for react-navigation (#16552) * add missing types which lists in the docs but not in the propTypes of src * fix types in react-navigation * fix `Definitions by` * Update index.d.ts * Update index.d.ts * stash * fix `Definitions by` * add test for react-native-swiper --- types/react-native-swiper/index.d.ts | 74 ++++++++++++++++++- .../react-native-swiper-tests.tsx | 42 ++++++++++- types/react-navigation/index.d.ts | 2 +- 3 files changed, 111 insertions(+), 7 deletions(-) diff --git a/types/react-native-swiper/index.d.ts b/types/react-native-swiper/index.d.ts index 41c9722934..67dc970145 100644 --- a/types/react-native-swiper/index.d.ts +++ b/types/react-native-swiper/index.d.ts @@ -1,14 +1,33 @@ // Type definitions for react-native-swiper 1.5 // Project: https://github.com/leecade/react-native-swiper#readme -// Definitions by: CaiHuan , HuHuanming +// Definitions by: CaiHuan +// HuHuanming +// mhcgrq // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 import * as React from 'react'; import { - ViewStyle + ViewStyle, + NativeSyntheticEvent, + NativeScrollEvent, } from 'react-native'; +export interface SwiperState { + autoplayEnd: boolean; + dir: 'x' | 'y'; + height: number; + width: number; + index: number; + isScrolling: boolean; + loopJump: boolean; + offset: { + x: number; + y: number; + }; + total: number; +} + export interface SwiperProperties extends React.Props { horizontal?: boolean; @@ -24,6 +43,8 @@ export interface SwiperProperties extends React.Props { scrollsToTop?: boolean; + scrollEnabled?: boolean; + removeClippedSubviews?: boolean; automaticallyAdjustContentInsets?: boolean; @@ -54,6 +75,10 @@ export interface SwiperProperties extends React.Props { activeDotStyle?: ViewStyle; + activeDot?: JSX.Element; + + dot?: JSX.Element; + dotColor?: string; activeDotColor?: string; @@ -63,7 +88,50 @@ export interface SwiperProperties extends React.Props { width?: number; paginationStyle?: ViewStyle; + + buttonWrapperStyle?: ViewStyle; + + nextButton?: JSX.Element; + + prevButton?: JSX.Element; + + onScrollBeginDrag?( + event: NativeSyntheticEvent, + state: SwiperState, + context: Swiper + ): void; + + onMomentumScrollEnd?( + event: NativeSyntheticEvent, + state: SwiperState, + context: Swiper + ): void; + + onTouchStartCapture?( + event: NativeSyntheticEvent, + state: SwiperState, + context: Swiper + ): void; + + onTouchStart?( + event: NativeSyntheticEvent, + state: SwiperState, + context: Swiper + ): void; + + onTouchEnd?( + event: NativeSyntheticEvent, + state: SwiperState, + context: Swiper + ): void; + + onResponderRelease?( + event: NativeSyntheticEvent, + state: SwiperState, + context: Swiper + ): void; } -export default class Swiper extends React.Component { +export default class Swiper extends React.Component { + scrollBy(index: number, animated: boolean): void; } diff --git a/types/react-native-swiper/react-native-swiper-tests.tsx b/types/react-native-swiper/react-native-swiper-tests.tsx index 5bd12c3868..0dedb9cb5a 100644 --- a/types/react-native-swiper/react-native-swiper-tests.tsx +++ b/types/react-native-swiper/react-native-swiper-tests.tsx @@ -3,18 +3,54 @@ import { StyleSheet, Text, View, - ViewStyle + ViewStyle, + NativeSyntheticEvent, + NativeScrollEvent } from 'react-native'; -import Swiper from 'react-native-swiper'; +import Swiper, { SwiperState } from 'react-native-swiper'; class SwiperTest extends React.Component<{}, {}> { constructor(props: {}) { super(props); } - + callback = ( + event: NativeSyntheticEvent, + state: SwiperState, + context: Swiper + ) => { + console.log(this.callback.name, event, state, context); + } render(): React.ReactElement { return ( ()} + height={100} + width={200} + nextButton={NEXT} + prevButton={PREV} + onScrollBeginDrag={this.callback} + onMomentumScrollEnd={this.callback} + onTouchStartCapture={this.callback} + onTouchStart={this.callback} + onTouchEnd={this.callback} + onResponderRelease={this.callback} style={styles.wrapper}> diff --git a/types/react-navigation/index.d.ts b/types/react-navigation/index.d.ts index 0c44d6ad00..3a5dd48d4f 100644 --- a/types/react-navigation/index.d.ts +++ b/types/react-navigation/index.d.ts @@ -490,7 +490,7 @@ interface NavigationContainerState { export interface NavigationContainer extends React.ComponentClass< NavigationContainerProps > { - router: any + router: NavigationRouter } export type StackNavigatorConfig = From 412030b7950e7868358b7a7559187baa1af73bba Mon Sep 17 00:00:00 2001 From: Bradley Ayers Date: Thu, 1 Jun 2017 15:15:35 +1000 Subject: [PATCH 0168/1105] Add prosemirror-schema-basic 0.21 (#16831) --- types/prosemirror-schema-basic/index.d.ts | 27 +++++++++++++++++++ .../prosemirror-schema-basic-tests.ts | 5 ++++ types/prosemirror-schema-basic/tsconfig.json | 22 +++++++++++++++ types/prosemirror-schema-basic/tslint.json | 1 + 4 files changed, 55 insertions(+) create mode 100644 types/prosemirror-schema-basic/index.d.ts create mode 100644 types/prosemirror-schema-basic/prosemirror-schema-basic-tests.ts create mode 100644 types/prosemirror-schema-basic/tsconfig.json create mode 100644 types/prosemirror-schema-basic/tslint.json diff --git a/types/prosemirror-schema-basic/index.d.ts b/types/prosemirror-schema-basic/index.d.ts new file mode 100644 index 0000000000..e5db9ffb80 --- /dev/null +++ b/types/prosemirror-schema-basic/index.d.ts @@ -0,0 +1,27 @@ +// Type definitions for prosemirror-schema-basic 0.21 +// Project: https://github.com/ProseMirror/prosemirror-schema-basic +// Definitions by: Bradley Ayers +// David Hahn +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +import { MarkSpec, NodeSpec, Schema } from 'prosemirror-model'; + +export let nodes: { + doc: NodeSpec, + paragraph: NodeSpec, + blockquote: NodeSpec, + horizontal_rule: NodeSpec, + heading: NodeSpec, + code_block: NodeSpec, + text: NodeSpec, + image: NodeSpec, + hard_break: NodeSpec +}; +export let marks: { + link: MarkSpec, + em: MarkSpec, + strong: MarkSpec, + code: MarkSpec +}; +export let schema: Schema; diff --git a/types/prosemirror-schema-basic/prosemirror-schema-basic-tests.ts b/types/prosemirror-schema-basic/prosemirror-schema-basic-tests.ts new file mode 100644 index 0000000000..1a93bf8ecb --- /dev/null +++ b/types/prosemirror-schema-basic/prosemirror-schema-basic-tests.ts @@ -0,0 +1,5 @@ +import { nodes, marks, schema } from 'prosemirror-schema-basic'; + +nodes.blockquote; +marks.code; +schema.mark; diff --git a/types/prosemirror-schema-basic/tsconfig.json b/types/prosemirror-schema-basic/tsconfig.json new file mode 100644 index 0000000000..0c90a14f5c --- /dev/null +++ b/types/prosemirror-schema-basic/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", + "prosemirror-schema-basic-tests.ts" + ] +} diff --git a/types/prosemirror-schema-basic/tslint.json b/types/prosemirror-schema-basic/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/prosemirror-schema-basic/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 1790ce07573eadd848a5da084898a6c5f8ceabd4 Mon Sep 17 00:00:00 2001 From: Brian J Brennan Date: Thu, 1 Jun 2017 01:30:14 -0400 Subject: [PATCH 0169/1105] Add package `are-we-there-yet` (#16783) --- .../are-we-there-yet-tests.ts | 25 ++++++ types/are-we-there-yet/index.d.ts | 90 +++++++++++++++++++ types/are-we-there-yet/tsconfig.json | 22 +++++ types/are-we-there-yet/tslint.json | 1 + 4 files changed, 138 insertions(+) create mode 100644 types/are-we-there-yet/are-we-there-yet-tests.ts create mode 100644 types/are-we-there-yet/index.d.ts create mode 100644 types/are-we-there-yet/tsconfig.json create mode 100644 types/are-we-there-yet/tslint.json diff --git a/types/are-we-there-yet/are-we-there-yet-tests.ts b/types/are-we-there-yet/are-we-there-yet-tests.ts new file mode 100644 index 0000000000..1750cac0c2 --- /dev/null +++ b/types/are-we-there-yet/are-we-there-yet-tests.ts @@ -0,0 +1,25 @@ +import { Tracker, TrackerStream, TrackerGroup } from "are-we-there-yet"; + +let simple = new Tracker("simple"); +simple.addListener("change", (name, completed, tracker) => { + console.log(`name: ${name}, completed: ${completed}`); +}); +simple.addWork(10); +simple.completeWork(1); +console.log(simple.completed() < 1); + +let group = new TrackerGroup("group"); +group.addUnit(simple); + +let subgroup = group.newGroup("subgroup"); +console.log(group.completed()); + +let stream = new TrackerStream("stream", 100, { encoding: "utf8" }); +subgroup.addUnit(stream); + +stream.addListener("change", (name, completed, tracker) => { + console.log(`name: ${name}, completed: ${completed}`); +}); + +simple.finish(); +console.log(group.debug()); diff --git a/types/are-we-there-yet/index.d.ts b/types/are-we-there-yet/index.d.ts new file mode 100644 index 0000000000..4b70c7a012 --- /dev/null +++ b/types/are-we-there-yet/index.d.ts @@ -0,0 +1,90 @@ +// Type definitions for are-we-there-yet 1.1 +// Project: https://github.com/iarna/are-we-there-yet +// Definitions by: Brian J Brennan +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +import { EventEmitter } from "events"; +import { Transform, TransformOptions } from "stream"; + +export type TrackerObject = Tracker | TrackerGroup | TrackerStream; +export type TrackerEventListener = (name: string, completed: number, tracker: TrackerObject) => void; +export type GenericEventListener = (...args: any[]) => void; + +export class TrackerBase extends EventEmitter { + constructor(name?: string); + addListener(event: "change", listener: TrackerEventListener): this; + addListener(event: string, listener: GenericEventListener): this; + on(event: "change", listener: TrackerEventListener): this; + on(event: string, listener: GenericEventListener): this; + once(event: "change", listener: TrackerEventListener): this; + once(event: string, listener: GenericEventListener): this; + prependListener(event: "change", listener: TrackerEventListener): this; + prependListener(event: string, listener: GenericEventListener): this; + prependOnceListener(event: "change", listener: TrackerEventListener): this; + prependOnceListener(event: string, listener: GenericEventListener): this; + removeListener(event: "change", listener: TrackerEventListener): this; + removeListener(event: string, listener: GenericEventListener): this; +} + +export class Tracker extends TrackerBase { + constructor(name?: string, todo?: number); + addWork(work: number): void; + completeWork(completed: number): void; + completed(): number; + finish(): void; +} + +export class TrackerGroup extends TrackerBase { + constructor(name?: string); + addUnit(tracker: TrackerBase, weight?: number): TrackerObject; + completed(): number; + debug(): string; + finish(): void; + newGroup(name?: string, weight?: number): TrackerGroup; + newItem(name?: string, todo?: number, weight?: number): Tracker; + newStream(name?: string, todo?: number, weight?: number): TrackerStream; +} + +export class TrackerStream extends Transform { + constructor(name?: string, size?: number, options?: TransformOptions); + addWork(work: number): void; + completed(): number; + + addListener(event: "change", listener: TrackerEventListener): this; + addListener(event: "data", listener: (chunk: Buffer | string) => void): this; + addListener(event: "readable" | "end" | "close", listener: () => void): this; + addListener(event: "error", listener: (err: Error) => void): this; + addListener(event: string, listener: GenericEventListener): this; + + on(event: "change", listener: TrackerEventListener): this; + on(event: "data", listener: (chunk: Buffer | string) => void): this; + on(event: "readable" | "end" | "close", listener: () => void): this; + on(event: "error", listener: (err: Error) => void): this; + on(event: string, listener: GenericEventListener): this; + + once(event: "change", listener: TrackerEventListener): this; + once(event: "data", listener: (chunk: Buffer | string) => void): this; + once(event: "readable" | "end" | "close", listener: () => void): this; + once(event: "error", listener: (err: Error) => void): this; + once(event: string, listener: GenericEventListener): this; + + prependListener(event: "change", listener: TrackerEventListener): this; + prependListener(event: "data", listener: (chunk: Buffer | string) => void): this; + prependListener(event: "readable" | "end" | "close", listener: () => void): this; + prependListener(event: "error", listener: (err: Error) => void): this; + prependListener(event: string, listener: GenericEventListener): this; + + prependOnceListener(event: "change", listener: TrackerEventListener): this; + prependOnceListener(event: "data", listener: (chunk: Buffer | string) => void): this; + prependOnceListener(event: "readable" | "end" | "close", listener: () => void): this; + prependOnceListener(event: "error", listener: (err: Error) => void): this; + prependOnceListener(event: string, listener: GenericEventListener): this; + + removeListener(event: "change", listener: TrackerEventListener): this; + removeListener(event: "data", listener: (chunk: Buffer | string) => void): this; + removeListener(event: "readable" | "end" | "close", listener: () => void): this; + removeListener(event: "error", listener: (err: Error) => void): this; + removeListener(event: string, listener: GenericEventListener): this; +} diff --git a/types/are-we-there-yet/tsconfig.json b/types/are-we-there-yet/tsconfig.json new file mode 100644 index 0000000000..e4dc1462ce --- /dev/null +++ b/types/are-we-there-yet/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", + "are-we-there-yet-tests.ts" + ] +} diff --git a/types/are-we-there-yet/tslint.json b/types/are-we-there-yet/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/are-we-there-yet/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 3537f59e0bbde80a10dfae49152aff696dbba795 Mon Sep 17 00:00:00 2001 From: Ben Davies Date: Wed, 31 May 2017 22:32:50 -0700 Subject: [PATCH 0170/1105] [cloud-env] Add type declarations (#16772) --- types/cloud-env/cloud-env-tests.ts | 9 ++++++ types/cloud-env/index.d.ts | 51 ++++++++++++++++++++++++++++++ types/cloud-env/tsconfig.json | 19 +++++++++++ 3 files changed, 79 insertions(+) create mode 100644 types/cloud-env/cloud-env-tests.ts create mode 100644 types/cloud-env/index.d.ts create mode 100644 types/cloud-env/tsconfig.json diff --git a/types/cloud-env/cloud-env-tests.ts b/types/cloud-env/cloud-env-tests.ts new file mode 100644 index 0000000000..64cbadd7f0 --- /dev/null +++ b/types/cloud-env/cloud-env-tests.ts @@ -0,0 +1,9 @@ +import * as cloudEnv from 'cloud-env'; + +if (cloudEnv.get('IP', '0.0.0.0') !== '0.0.0.0') { + throw new Error(`cloudEnv.get: expected value 0.0.0.0, but actually received value ${cloudEnv.get('IP', '0.0.0.0')}`); +} + +if (!(cloudEnv.defaults instanceof Object)) { + throw new Error(`cloudEnv.defaults: expected value of defaults be an instance of Object, but it was actually an instance of another class: ${typeof cloudEnv.defaults}`); +} diff --git a/types/cloud-env/index.d.ts b/types/cloud-env/index.d.ts new file mode 100644 index 0000000000..daec09022f --- /dev/null +++ b/types/cloud-env/index.d.ts @@ -0,0 +1,51 @@ +// Type definitions for cloud-env 0.2.2 +// Project: https://github.com/ryanj/cloud-env +// Definitions by: Ben Davies +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare interface DefaultSettings { + PORT?: number; + IP?: string; + HOSTNAME?: string; + APP_NAME?: string; + MONGODB_DB_URL?: string; + MONGODB_DB_HOST?: string; + MONGODB_DB_PORT?: number; + MONGODB_DB_USERNAME?: string; + MONGODB_DB_PASSWORD?: string; + POSTGRESQL_DB_URL?: string; + POSTGRESQL_DB_HOST?: string; + POSTGRESQL_DB_PORT?: number; + POSTGRESQL_DB_USERNAME?: string; + POSTGRESQL_DB_PASSWORD?: string; + MYSQL_DB_URL?: string; + MYSQL_DB_HOST?: string; + MYSQL_DB_PORT?: number; + MYSQL_DB_USERNAME?: string; + MYSQL_DB_PASSWORD?: string; +} + +declare type MaybeNum = number | void; +declare type MaybeStr = string | void; + +export const get: (key: string, default_key?: string) => MaybeStr; +export const defaults: { [key: string]: DefaultSettings; }; +export const PORT: MaybeNum; +export const IP: MaybeStr; +export const HOSTNAME: MaybeStr; +export const APP_NAME: MaybeStr; +export const MONGODB_DB_URL: MaybeStr; +export const MONGODB_DB_HOST: MaybeStr; +export const MONGODB_DB_PORT: MaybeNum; +export const MONGODB_DB_USERNAME: MaybeStr; +export const MONGODB_DB_PASSWORD: MaybeStr; +export const POSTGRESQL_DB_URL: MaybeStr; +export const POSTGRESQL_DB_HOST: MaybeStr; +export const POSTGRESQL_DB_PORT: MaybeNum; +export const POSTGRESQL_DB_USERNAME: MaybeStr; +export const POSTGRESQL_DB_PASSWORD: MaybeStr; +export const MYSQL_DB_URL: MaybeStr; +export const MYSQL_DB_HOST: MaybeStr; +export const MYSQL_DB_PORT: MaybeNum; +export const MYSQL_DB_USERNAME: MaybeStr; +export const MYSQL_DB_PASSWORD: MaybeStr; diff --git a/types/cloud-env/tsconfig.json b/types/cloud-env/tsconfig.json new file mode 100644 index 0000000000..e6a1323629 --- /dev/null +++ b/types/cloud-env/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "cloud-env-tests.ts" + ] +} From f38b79a46dbfc5385e46c83fc5aa3441b8482156 Mon Sep 17 00:00:00 2001 From: Alex Muench Date: Thu, 1 Jun 2017 00:33:50 -0500 Subject: [PATCH 0171/1105] Add Typings for node-telegram-bot-api (#16734) * Add types file for node-telegram-bot-api@0.27 * Switch object to any * Use all double-quotes * Fix for lint breaking with OBJECT.Entries error * Fix tslint.json structure * Revert changes to tslint * Add version info to fix dts error * Fix lint issues --- types/node-telegram-bot-api/index.d.ts | 59 +++++++++++++++++++ .../node-telegram-bot-api-tests.ts | 51 ++++++++++++++++ types/node-telegram-bot-api/tsconfig.json | 22 +++++++ types/node-telegram-bot-api/tslint.json | 3 + 4 files changed, 135 insertions(+) create mode 100644 types/node-telegram-bot-api/index.d.ts create mode 100644 types/node-telegram-bot-api/node-telegram-bot-api-tests.ts create mode 100644 types/node-telegram-bot-api/tsconfig.json create mode 100644 types/node-telegram-bot-api/tslint.json diff --git a/types/node-telegram-bot-api/index.d.ts b/types/node-telegram-bot-api/index.d.ts new file mode 100644 index 0000000000..1a7d15ec34 --- /dev/null +++ b/types/node-telegram-bot-api/index.d.ts @@ -0,0 +1,59 @@ +// Type definitions for node-telegram-bot-api 0.27 +// Project: https://github.com/yagop/node-telegram-bot-api +// Definitions by: Alex Muench +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +declare class TelegramBot { + constructor(token: string, opts?: any); + + startPolling(options?: any): Promise; + initPolling(options?: any): Promise; + stopPolling(): Promise; + isPolling(): boolean; + openWebHook(): Promise; + closeWebHook(): Promise; + hasOpenWebHook(): boolean; + getMe(): Promise; + setWebHook(url: string, options?: any): Promise; + deleteWebHook(): Promise; + getWebHookInfo(): Promise; + getUpdates(options?: any): Promise; + processUpdate(update: any): void; + sendMessage(chatId: number | string, text: string, options?: any): Promise; + answerInlineQuery(inlineQueryId: string, results: any[], options?: any): Promise; + forwardMessage(chatId: number | string, fromChatId: number | string, messageId: number | string, options?: any): Promise; + sendPhoto(chatId: number | string, photo: any, options?: any): Promise; + sendAudio(chatId: number | string, audio: any, options?: any): Promise; + sendDocument(chatId: number | string, doc: any, options?: any, fileOpts?: any): Promise; + sendSticker(chatId: number | string, sticker: any, options?: any): Promise; + sendVideo(chatId: number | string, video: any, options?: any): Promise; + sendVoice(chatId: number | string, voice: any, options?: any): Promise; + sendChatAction(chatId: number | string, action: string): Promise; + kickChatMember(chatId: number | string, userId: string): Promise; + unbanChatMember(chatId: number | string, userId: string): Promise; + answerCallbackQuery(callbackQueryId: number | string, text: string, showAlert: boolean, options?: any): Promise; + editMessageText(text: string, options?: any): Promise; + editMessageCaption(caption: string, options?: any): Promise; + editMessageReplyMarkup(replyMarkup: any, options?: any): Promise; + getUserProfilePhotos(userId: string, options?: any): Promise; + sendLocation(chatId: number | string, latitude: number, longitude: number, options?: any): Promise; + sendVenue(chatId: number | string, latitude: number, longitude: number, title: string, address: string, options?: any): Promise; + sendContact(chatId: number | string, phoneNumber: string, firstName: string, options?: any): Promise; + getFile(fileId: string): Promise; + getFileLink(fileId: string): Promise; + downloadFile(fileId: string, downloadDir: string): Promise; + onText(regexp: any, callback: ((msg: any, match: any[]) => void)): void; + onReplyToMessage(chatId: number | string, messageId: number | string, callback: ((msg: any) => void)): number; + removeReplyListener(replyListenerId: number): any; + getChat(chatId: number | string): Promise; + getChatAdministrators(chatId: number | string): Promise; + getChatMembersCount(chatId: number | string): Promise; + getChatMember(chatId: number | string, userId: string): Promise; + leaveChat(chatId: number | string): Promise; + sendGame(chatId: number | string, gameShortName: string, options?: any): Promise; + setGameScore(userId: string, score: number, options?: any): Promise; + getGameHighScores(userId: string, options?: any): Promise; +} + +export = TelegramBot; diff --git a/types/node-telegram-bot-api/node-telegram-bot-api-tests.ts b/types/node-telegram-bot-api/node-telegram-bot-api-tests.ts new file mode 100644 index 0000000000..80b44216fb --- /dev/null +++ b/types/node-telegram-bot-api/node-telegram-bot-api-tests.ts @@ -0,0 +1,51 @@ +import TelegramBot = require("node-telegram-bot-api"); + +const MyTelegramBot = new TelegramBot("token"); + +MyTelegramBot.startPolling({ foo: "bar" }); +MyTelegramBot.initPolling({ foo: "bar" }); +MyTelegramBot.stopPolling(); +MyTelegramBot.isPolling(); +MyTelegramBot.openWebHook(); +MyTelegramBot.closeWebHook(); +MyTelegramBot.hasOpenWebHook(); +MyTelegramBot.getMe(); +MyTelegramBot.setWebHook("http://typescriptlang.org", { foo: "bar" }); +MyTelegramBot.deleteWebHook(); +MyTelegramBot.getWebHookInfo(); +MyTelegramBot.getUpdates({ foo: "bar" }); +MyTelegramBot.processUpdate("Update Method/Stream/Etc"); +MyTelegramBot.sendMessage(1234, "test-text", { foo: "bar" }); +MyTelegramBot.answerInlineQuery("queryId", ["test", "test", "test"], { foo: "bar" }); +MyTelegramBot.forwardMessage(1234, 5678, "memberID", { foo: "bar" }); +MyTelegramBot.sendPhoto(1234, "photo/path", { foo: "bar" }); +MyTelegramBot.sendAudio(1234, "audio/path", { foo: "bar" }); +MyTelegramBot.sendDocument(1234, "doc/path", { foo: "bar" }, { fileOption: true }); +MyTelegramBot.sendSticker(1234, "sticker/path", { foo: "bar" }); +MyTelegramBot.sendVideo(1234, "video/path", { foo: "bar" }); +MyTelegramBot.sendVoice(1234, "voice/path", { foo: "bar" }); +MyTelegramBot.sendChatAction(1234, "ACTION!"); +MyTelegramBot.kickChatMember(1234, "myUserID"); +MyTelegramBot.unbanChatMember(1234, "myUserID"); +MyTelegramBot.answerCallbackQuery("myCallbackQueryID", "test-text", false, { foo: "bar" }); +MyTelegramBot.editMessageText("test-text", { foo: "bar" }); +MyTelegramBot.editMessageCaption("My Witty Caption", { foo: "bar" }); +MyTelegramBot.editMessageReplyMarkup({ replyMarkup: "something" }, { foo: "bar" }); +MyTelegramBot.getUserProfilePhotos("myUserID", { foo: "bar" }); +MyTelegramBot.sendLocation(1234, 100, 200, { foo: "bar" }); +MyTelegramBot.sendVenue(1234, 100, 200, "Venue Title", "123 Fake St.", { foo: "bar" }); +MyTelegramBot.sendContact(1234, "345-555-0192", "John", { foo: "bar" }); +MyTelegramBot.getFile("My/File/ID"); +MyTelegramBot.getFileLink("My/File/ID"); +MyTelegramBot.downloadFile("My/File/ID", "mydownloaddir/"); +MyTelegramBot.onText(/regex/, (msg, match) => { }); +MyTelegramBot.onReplyToMessage(1234, "mymessageID", (msg) => { }); +MyTelegramBot.removeReplyListener(5466); +MyTelegramBot.getChat(1234); +MyTelegramBot.getChatAdministrators(1234); +MyTelegramBot.getChatMembersCount(1234); +MyTelegramBot.getChatMember(1234, "myUserID"); +MyTelegramBot.leaveChat(1234); +MyTelegramBot.sendGame(1234, "MygameName", { foo: "bar" }); +MyTelegramBot.setGameScore("myUserID", 99, { foo: "bar" }); +MyTelegramBot.getGameHighScores("myUserID", { foo: "bar" }); diff --git a/types/node-telegram-bot-api/tsconfig.json b/types/node-telegram-bot-api/tsconfig.json new file mode 100644 index 0000000000..253e5929e6 --- /dev/null +++ b/types/node-telegram-bot-api/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", + "node-telegram-bot-api-tests.ts" + ] +} diff --git a/types/node-telegram-bot-api/tslint.json b/types/node-telegram-bot-api/tslint.json new file mode 100644 index 0000000000..30a1bdde2e --- /dev/null +++ b/types/node-telegram-bot-api/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file From f3c96a99d1bebede157fae5ec32909cc345e9bde Mon Sep 17 00:00:00 2001 From: Leonard Thieu Date: Thu, 1 Jun 2017 01:36:53 -0400 Subject: [PATCH 0172/1105] Add static members. (#16760) --- types/intl-tel-input/index.d.ts | 184 +++++++++++++++++--------------- 1 file changed, 97 insertions(+), 87 deletions(-) diff --git a/types/intl-tel-input/index.d.ts b/types/intl-tel-input/index.d.ts index 38ac9274ca..59e010fc83 100644 --- a/types/intl-tel-input/index.d.ts +++ b/types/intl-tel-input/index.d.ts @@ -1,17 +1,107 @@ // Type definitions for intl-tel-input // Project: https://github.com/jackocnr/intl-tel-input -// Definitions by: Fidan Hakaj +// Definitions by: Fidan Hakaj , Leonard Thieu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// Static methods that are defined in JQueryStatic.fn are not typed -// as jquery.d.ts has no interface for fn -// https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/jquery/jquery.d.ts#L958 -// fn: any; //TODO: Decide how we want to type this - /// declare namespace IntlTelInput { + interface Plugin { + /** + * Get all of the plugin's country data - either to re-use elsewhere + * e.g. to populate a country dropdown. + */ + getCountryData(): CountryData[]; + /** + * Load the utils.js script (included in the lib directory) to enable + * formatting/validation etc. + */ + loadUtils(path: string, utilsScriptDeferred?: boolean): void; + + /** + * Remove the plugin from the input, and unbind any event listeners. + */ + (method: 'destroy'): void; + /** + * Get the extension from the current number. + * Requires the utilsScript option. + * e.g. if the input value was "(702) 555-5555 ext. 1234", this would + * return "1234". + */ + (method: 'getExtension'): string; + /** + * Get the current number in the given format (defaults to E.164 standard). + * The different formats are available in the enum + * intlTelInputUtils.numberFormat - taken from here. + * Requires the utilsScript option. + * Note that even if nationalMode is enabled, this can still return a full + * international number. + */ + (method: 'getNumber'): string; + /** + * Get the type (fixed-line/mobile/toll-free etc) of the current number. + * Requires the utilsScript option. + * Returns an integer, which you can match against the various options in the + * global enum intlTelInputUtils.numberType. + * Note that in the US there's no way to differentiate between fixed-line and + * mobile numbers, so instead it will return FIXED_LINE_OR_MOBILE. + */ + (method: 'getNumberType'): intlTelInputUtils.numberType; + /** + * Get the country data for the currently selected flag. + */ + (method: 'getSelectedCountryData'): IntlTelInput.CountryData; + /** + * Get more information about a validation error. + * Requires the utilsScript option. + * Returns an integer, which you can match against the various options in the + * global enum intlTelInputUtils.validationError + */ + (method: 'getValidationError'): intlTelInputUtils.validationError; + /** + * Validate the current number. Expects an internationally formatted number + * (unless nationalMode is enabled). If validation fails, you can use + * getValidationError to get more information. + * Requires the utilsScript option. + * Also see getNumberType if you want to make sure the user enters a certain + * type of number e.g. a mobile number. + */ + (method: 'isValidNumber'): boolean; + (method: string): void; + /** + * Change the country selection (e.g. when the user is entering their address). + * @param countryCode country code of the country to be set. + */ + (method: 'setCountry', countryCode: string): void; + /** + * Insert a number, and update the selected flag accordingly. + * Note that by default, if nationalMode is enabled it will try to use + * national formatting. + * @param aNumber number to be set. + */ + (method: 'setNumber', aNumber: string): void; + (method: string, value: string): void; + + /** + * Get the current number in the given format (defaults to E.164 standard). + * The different formats are available in the enum + * intlTelInputUtils.numberFormat - taken from here. + * Requires the utilsScript option. + * Note that even if nationalMode is enabled, this can still return a full + * international number. + * @param numberFormat the format in which the number will be returned. + */ + (method: 'getNumber', numberFormat: intlTelInputUtils.numberFormat): string; + (method: string, numberFormat: intlTelInputUtils.numberFormat): string; + + /** + * initialise the plugin with optional options. + * @param options options that can be provided during initialization. + */ + (options?: IntlTelInput.Options): JQueryDeferred; + } + interface Options { /** * Whether or not to allow the dropdown. If disabled, there is no dropdown @@ -154,85 +244,5 @@ declare namespace intlTelInputUtils { } interface JQuery { - /** - * Remove the plugin from the input, and unbind any event listeners. - */ - intlTelInput(method: 'destroy'): void; - /** - * Get the extension from the current number. - * Requires the utilsScript option. - * e.g. if the input value was "(702) 555-5555 ext. 1234", this would - * return "1234". - */ - intlTelInput(method: 'getExtension'): string; - /** - * Get the current number in the given format (defaults to E.164 standard). - * The different formats are available in the enum - * intlTelInputUtils.numberFormat - taken from here. - * Requires the utilsScript option. - * Note that even if nationalMode is enabled, this can still return a full - * international number. - */ - intlTelInput(method: 'getNumber'): string; - /** - * Get the type (fixed-line/mobile/toll-free etc) of the current number. - * Requires the utilsScript option. - * Returns an integer, which you can match against the various options in the - * global enum intlTelInputUtils.numberType. - * Note that in the US there's no way to differentiate between fixed-line and - * mobile numbers, so instead it will return FIXED_LINE_OR_MOBILE. - */ - intlTelInput(method: 'getNumberType'): intlTelInputUtils.numberType; - /** - * Get the country data for the currently selected flag. - */ - intlTelInput(method: 'getSelectedCountryData'): IntlTelInput.CountryData; - /** - * Get more information about a validation error. - * Requires the utilsScript option. - * Returns an integer, which you can match against the various options in the - * global enum intlTelInputUtils.validationError - */ - intlTelInput(method: 'getValidationError'): intlTelInputUtils.validationError; - /** - * Validate the current number. Expects an internationally formatted number - * (unless nationalMode is enabled). If validation fails, you can use - * getValidationError to get more information. - * Requires the utilsScript option. - * Also see getNumberType if you want to make sure the user enters a certain - * type of number e.g. a mobile number. - */ - intlTelInput(method: 'isValidNumber'): boolean; - intlTelInput(method: string): void; - /** - * Change the country selection (e.g. when the user is entering their address). - * @param countryCode country code of the country to be set. - */ - intlTelInput(method: 'setCountry', countryCode: string): void; - /** - * Insert a number, and update the selected flag accordingly. - * Note that by default, if nationalMode is enabled it will try to use - * national formatting. - * @param aNumber number to be set. - */ - intlTelInput(method: 'setNumber', aNumber: string): void; - intlTelInput(method: string, value: string): void; - - /** - * Get the current number in the given format (defaults to E.164 standard). - * The different formats are available in the enum - * intlTelInputUtils.numberFormat - taken from here. - * Requires the utilsScript option. - * Note that even if nationalMode is enabled, this can still return a full - * international number. - * @param numberFormat the format in which the number will be returned. - */ - intlTelInput(method: 'getNumber', numberFormat: intlTelInputUtils.numberFormat): string; - intlTelInput(method: string, numberFormat: intlTelInputUtils.numberFormat): string; - - /** - * initialise the plugin with optional options. - * @param options options that can be provided during initialization. - */ - intlTelInput(options?: IntlTelInput.Options): JQueryDeferred; + intlTelInput: IntlTelInput.Plugin; } From c35d7a97986eeb805b8d064890446e45544c951a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martynas=20Kunig=C4=97lis?= Date: Thu, 1 Jun 2017 08:39:26 +0300 Subject: [PATCH 0173/1105] Knex: added declarations and tests for clearSelect() and clearWhere(). (#16746) --- types/knex/index.d.ts | 4 ++++ types/knex/knex-tests.ts | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/types/knex/index.d.ts b/types/knex/index.d.ts index a68cabf66e..fa84243b76 100644 --- a/types/knex/index.d.ts +++ b/types/knex/index.d.ts @@ -120,6 +120,10 @@ declare namespace Knex { orHaving: Having; orHavingRaw: RawQueryBuilder; + // Clear + clearSelect(): QueryBuilder; + clearWhere(): QueryBuilder; + // Paging offset(offset: number): QueryBuilder; limit(limit: number): QueryBuilder; diff --git a/types/knex/knex-tests.ts b/types/knex/knex-tests.ts index f057034006..1f12a1044a 100644 --- a/types/knex/knex-tests.ts +++ b/types/knex/knex-tests.ts @@ -406,6 +406,14 @@ knex.table('users').first(knex.raw('round(sum(products)) as p')).then(function(r console.log(row); }); +knex.table('users').select('*').clearSelect().select('id').then(function(rows) { + console.log(rows); +}); + +knex('accounts').where('userid', '=', 1).clearWhere().select().then(function (rows) { + console.log(rows); +}); + // Using trx as a query builder: knex.transaction(function(trx) { From 86da68051e1f76c33c2164a489a393d374c3d09e Mon Sep 17 00:00:00 2001 From: TeamworkGuy2 Date: Thu, 1 Jun 2017 01:42:15 -0400 Subject: [PATCH 0174/1105] [umd] Add umd@3.0.1 type definition (#16627) --- types/umd/index.d.ts | 25 +++++++++++++++++++++++++ types/umd/tsconfig.json | 22 ++++++++++++++++++++++ types/umd/umd-tests.ts | 14 ++++++++++++++ 3 files changed, 61 insertions(+) create mode 100644 types/umd/index.d.ts create mode 100644 types/umd/tsconfig.json create mode 100644 types/umd/umd-tests.ts diff --git a/types/umd/index.d.ts b/types/umd/index.d.ts new file mode 100644 index 0000000000..f1a561bfe2 --- /dev/null +++ b/types/umd/index.d.ts @@ -0,0 +1,25 @@ +// Type definitions for umd 3.0 +// Project: https://github.com/ForbesLindesay/umd +// Definitions by: TeamworkGuy2 +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/** Universal Module Definition for use in automated build systems + * - simple synchronous wrapping of a string + * - return style module support + * - CommonJS support + * - prevents internal UMDs from conflicting + */ +declare function Umd(name: string, src: string, options?: boolean | Umd.Options): string; + +declare namespace Umd { + + interface Options { + commonJS?: boolean; + } + + function prelude(moduleName: string, options?: boolean | Options): string; + + function postlude(moduleName: string, options?: boolean | Options): string; +} + +export = Umd; diff --git a/types/umd/tsconfig.json b/types/umd/tsconfig.json new file mode 100644 index 0000000000..6327c1cf47 --- /dev/null +++ b/types/umd/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", + "umd-tests.ts" + ] +} \ No newline at end of file diff --git a/types/umd/umd-tests.ts b/types/umd/umd-tests.ts new file mode 100644 index 0000000000..9320a4d493 --- /dev/null +++ b/types/umd/umd-tests.ts @@ -0,0 +1,14 @@ + +import umd = require("umd"); + +var res1: string = umd("name1", "return 123"); + +var res2: string = umd("name2", "return 'abc'", { commonJS: true }); + +var res3: string = umd.prelude("pre1", false); + +var res4: string = umd.postlude("post1", true); + +var res5: string = umd.prelude("pre2"); + +var res6: string = umd.postlude("post2"); \ No newline at end of file From 8926f7fbff48ef8182c58a48a1bb53cb401a920e Mon Sep 17 00:00:00 2001 From: warnersean Date: Thu, 1 Jun 2017 00:43:45 -0500 Subject: [PATCH 0175/1105] Added passport-client-cert type definition (#16710) * Added passport-client-cert type definition * Added passport-client-cert type definition * Minor fixes for PR corrected ts version call changed index accessor for subject and issuer to any. Any makes more sense than anything else, due to potential variation in response. --- types/passport-client-cert/index.d.ts | 35 +++++++++++++++++++ .../passport-client-cert-tests.ts | 14 ++++++++ types/passport-client-cert/tsconfig.json | 22 ++++++++++++ types/passport-client-cert/tslint.json | 1 + 4 files changed, 72 insertions(+) create mode 100644 types/passport-client-cert/index.d.ts create mode 100644 types/passport-client-cert/passport-client-cert-tests.ts create mode 100644 types/passport-client-cert/tsconfig.json create mode 100644 types/passport-client-cert/tslint.json diff --git a/types/passport-client-cert/index.d.ts b/types/passport-client-cert/index.d.ts new file mode 100644 index 0000000000..5bb80c5027 --- /dev/null +++ b/types/passport-client-cert/index.d.ts @@ -0,0 +1,35 @@ +// Type definitions for passport-jwt 2.0 +// Project: https://github.com/ripjar/passport-client-cert +// Definitions by: Sean Warner +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +import {Strategy as PassportStrategy} from 'passport-strategy'; +import {Request} from 'express'; + +export class Strategy extends PassportStrategy { + constructor(verify: PkiCallback); + constructor(opt: StrategyOptions, verify: PkiCallback | PkiCallbackWithRequest); +} + +export interface StrategyOptions { + passReqToCallback?: boolean; +} + +export type PkiCallback = (payload: ClientCert, done: PkiVerifiedCallback) => void; + +export type PkiCallbackWithRequest = (req: Request, payload: ClientCert, done: PkiVerifiedCallback) => void; + +export interface ClientCert { + exponent: string; + fingerprint: string; + issuer: any; + modulus: string; + raw: Uint8Array; + serialNumber: string; + subject: any; + valid_from: string; + valid_to: string; +} + +export type PkiVerifiedCallback = (error: any, user?: any, info?: any) => void; diff --git a/types/passport-client-cert/passport-client-cert-tests.ts b/types/passport-client-cert/passport-client-cert-tests.ts new file mode 100644 index 0000000000..256d2ddcd6 --- /dev/null +++ b/types/passport-client-cert/passport-client-cert-tests.ts @@ -0,0 +1,14 @@ +import * as passport from "passport"; +import {ClientCert, PkiVerifiedCallback, Strategy as ClientCertStrategy} from "passport-client-cert"; + +passport.use(new ClientCertStrategy( (clientCert: ClientCert, done: PkiVerifiedCallback) => { + let cn = clientCert.subject.cn; + let user = null; + + // The CN will typically be checked against a database + if (cn === 'test-cn') { + user = { name: 'Test User' }; + } + + done(null, user); +})); diff --git a/types/passport-client-cert/tsconfig.json b/types/passport-client-cert/tsconfig.json new file mode 100644 index 0000000000..614afd9842 --- /dev/null +++ b/types/passport-client-cert/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", + "passport-client-cert-tests.ts" + ] +} diff --git a/types/passport-client-cert/tslint.json b/types/passport-client-cert/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/passport-client-cert/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 99ee60a4774e9f6d71117c9a5f9a6c0d4cd82b41 Mon Sep 17 00:00:00 2001 From: Leonard Thieu Date: Thu, 1 Jun 2017 01:48:45 -0400 Subject: [PATCH 0176/1105] Add type definitions for insert-module-globals (#16674) --- types/insert-module-globals/index.d.ts | 67 +++++++++++++++++++ .../insert-module-globals-tests.ts | 60 +++++++++++++++++ types/insert-module-globals/tsconfig.json | 22 ++++++ types/insert-module-globals/tslint.json | 1 + 4 files changed, 150 insertions(+) create mode 100644 types/insert-module-globals/index.d.ts create mode 100644 types/insert-module-globals/insert-module-globals-tests.ts create mode 100644 types/insert-module-globals/tsconfig.json create mode 100644 types/insert-module-globals/tslint.json diff --git a/types/insert-module-globals/index.d.ts b/types/insert-module-globals/index.d.ts new file mode 100644 index 0000000000..1fb0b6e7ba --- /dev/null +++ b/types/insert-module-globals/index.d.ts @@ -0,0 +1,67 @@ +// Type definitions for insert-module-globals 7.0 +// Project: https://github.com/substack/insert-module-globals +// Definitions by: Leonard Thieu +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +import * as stream from 'stream'; + +export = InsertModuleGlobals; + +interface InsertModuleGlobals { + /** + * Return a transform stream inserter for the filename file that will accept a javascript file as input and + * will output the file with a closure around the contents as necessary to define extra builtins. + */ + (file: string, opts?: InsertModuleGlobals.Options): stream.Transform; + + /** + * Defaults + */ + readonly vars: { + process(file: string): string; + global(): string; + 'Buffer.isBuffer'(file: string): string; + Buffer(): string; + __filename(file: string, basedir: string): string; + __dirname(file: string, basedir: string): string; + }; +} + +declare const InsertModuleGlobals: InsertModuleGlobals; + +declare namespace InsertModuleGlobals { + interface Options { + /** + * When opts.always is true, wrap every file with all the global variables without parsing. + * This is handy because parsing the scope can take a long time, so you can prioritize fast builds over saving bytes in the final output. + * When opts.always is truthy but not true, avoid parsing but perform a quick test to determine if wrapping should be skipped. + */ + always?: boolean; + /** + * Use opts.vars to override the default inserted variables, or set opts.vars[name] to undefined to not insert a variable which would otherwise be inserted. + * + * opts.vars properties with a . in their name will be executed instead of the parent object if ONLY that property is used. + * For example, "Buffer.isBuffer" will mask "Buffer" only when there is a Buffer.isBuffer() call in a file and no other references to Buffer. + */ + vars?: VarsOption; + /** + * If opts.debug is true, an inline source map will be generated to compensate for the extra lines. + */ + debug?: boolean; + basedir?: string; + } + + interface VarsOption { + [name: string]: InsertFunction | undefined; + } + + type InsertFunction = (file: string, basedir: string) => VariableConfig | string; + + interface VariableConfig { + id: string; + source: string; + suffix?: string; + } +} diff --git a/types/insert-module-globals/insert-module-globals-tests.ts b/types/insert-module-globals/insert-module-globals-tests.ts new file mode 100644 index 0000000000..0fa6c1af38 --- /dev/null +++ b/types/insert-module-globals/insert-module-globals-tests.ts @@ -0,0 +1,60 @@ +import insert = require('insert-module-globals'); +import { VarsOption } from 'insert-module-globals'; + +function example() { + function inserter(file: string) { + return insert(file, { basedir: __dirname + '/files' }); + } + + return inserter; +} + +function insert_custom_globals() { + const customProcessContent = 'customProcessContent'; + const files: string[] = []; + + const vars: VarsOption = { + process(file, basedir) { + return { + id: "path/to/custom_process.js", + source: customProcessContent + }; + }, + Buffer(file, basedir) { + return { + id: 'path/to/custom_buffer.js', + source: customProcessContent, + // suffix is optional + // it's used to extract the value from the module. + // it becomes: require(...).Buffer in this case. + suffix: '.Buffer' + }; + }, + Math() { + // if you return a string, + // it's simply set as the value. + return '{}'; + // ^ any attempt to use Math[x] will throw! + } + }; + + function inserter(file: string) { + return insert(file, { vars }); + } + + return inserter; +} + +function disable_select_globals() { + const insertGlobalVars: VarsOption = {}; + const wantedGlobalVars = ['__filename', '__dirname']; + Object.keys(insert.vars).forEach((x) => { + if (wantedGlobalVars.indexOf(x) === -1) { + insertGlobalVars[x] = undefined; + } + }); + + return insert('index.js', { + vars: insertGlobalVars + }); +} diff --git a/types/insert-module-globals/tsconfig.json b/types/insert-module-globals/tsconfig.json new file mode 100644 index 0000000000..0a6e51fb74 --- /dev/null +++ b/types/insert-module-globals/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", + "insert-module-globals-tests.ts" + ] +} diff --git a/types/insert-module-globals/tslint.json b/types/insert-module-globals/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/insert-module-globals/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 17c9c37033ab416ae1cd17239533dd197ea58a68 Mon Sep 17 00:00:00 2001 From: Yoriki Yamaguchi Date: Thu, 1 Jun 2017 14:52:52 +0900 Subject: [PATCH 0177/1105] Add definition for AWS Lambda Cognito User Pool event (#16458) * add definition: AWS Lambda Cognito User Pool event * add `userName` to CognitoUserPoolEvent --- types/aws-lambda/aws-lambda-tests.ts | 50 +++++++++++++++++++++++++++- types/aws-lambda/index.d.ts | 45 ++++++++++++++++++++++++- 2 files changed, 93 insertions(+), 2 deletions(-) diff --git a/types/aws-lambda/aws-lambda-tests.ts b/types/aws-lambda/aws-lambda-tests.ts index e793442177..e3356cae42 100644 --- a/types/aws-lambda/aws-lambda-tests.ts +++ b/types/aws-lambda/aws-lambda-tests.ts @@ -60,7 +60,7 @@ var S3CreateEvent: AWSLambda.S3CreateEvent = { } ] }; - +var cognitoUserPoolEvent: AWSLambda.CognitoUserPoolEvent; /* API Gateway Event */ str = apiGwEvt.body; @@ -164,6 +164,54 @@ authResponse = { policyDocument: policyDocument }; +// CognitoUserPoolEvent +num = cognitoUserPoolEvent.version; +cognitoUserPoolEvent.triggerSource === "PreSignUp_SignUp"; +cognitoUserPoolEvent.triggerSource === "PostConfirmation_ConfirmSignUp"; +cognitoUserPoolEvent.triggerSource === "PreAuthentication_Authentication"; +cognitoUserPoolEvent.triggerSource === "PostAuthentication_Authentication"; +cognitoUserPoolEvent.triggerSource === "CustomMessage_SignUp"; +cognitoUserPoolEvent.triggerSource === "CustomMessage_AdminCreateUser"; +cognitoUserPoolEvent.triggerSource === "CustomMessage_ResendCode"; +cognitoUserPoolEvent.triggerSource === "CustomMessage_ForgotPassword"; +cognitoUserPoolEvent.triggerSource === "CustomMessage_UpdateUserAttribute"; +cognitoUserPoolEvent.triggerSource === "CustomMessage_VerifyUserAttribute"; +cognitoUserPoolEvent.triggerSource === "CustomMessage_Authentication"; +cognitoUserPoolEvent.triggerSource === "DefineAuthChallenge_Authentication"; +cognitoUserPoolEvent.triggerSource === "CreateAuthChallenge_Authentication"; +cognitoUserPoolEvent.triggerSource === "VerifyAuthChallengeResponse_Authentication"; +str = cognitoUserPoolEvent.region; +str = cognitoUserPoolEvent.userPoolId; +str = cognitoUserPoolEvent.userName; +str = cognitoUserPoolEvent.callerContext.awsSdkVersion; +str = cognitoUserPoolEvent.callerContext.clientId; +str = cognitoUserPoolEvent.request.userAttributes["email"]; +str = cognitoUserPoolEvent.request.validationData["k1"]; +str = cognitoUserPoolEvent.request.codeParameter; +b = cognitoUserPoolEvent.request.newDeviceUsed; +cognitoUserPoolEvent.request.session[0].challengeName === "CUSTOM_CHALLENGE"; +cognitoUserPoolEvent.request.session[0].challengeName === "PASSWORD_VERIFIER"; +cognitoUserPoolEvent.request.session[0].challengeName === "SMS_MFA"; +cognitoUserPoolEvent.request.session[0].challengeName === "DEVICE_SRP_AUTH"; +cognitoUserPoolEvent.request.session[0].challengeName === "DEVICE_PASSWORD_VERIFIER"; +cognitoUserPoolEvent.request.session[0].challengeName === "ADMIN_NO_SRP_AUTH"; +b = cognitoUserPoolEvent.request.session[0].challengeResult; +str = cognitoUserPoolEvent.request.session[0].challengeMetaData; +str = cognitoUserPoolEvent.request.challengeName; +str = cognitoUserPoolEvent.request.privateChallengeParameters["answer"]; +str = cognitoUserPoolEvent.request.challengeAnswer["answer"]; +b = cognitoUserPoolEvent.response.answerCorrect; +str = cognitoUserPoolEvent.response.smsMessage; +str = cognitoUserPoolEvent.response.emailMessage; +str = cognitoUserPoolEvent.response.emailSubject; +str = cognitoUserPoolEvent.response.challengeName; +b = cognitoUserPoolEvent.response.issueTokens; +b = cognitoUserPoolEvent.response.failAuthentication; +str = cognitoUserPoolEvent.response.publicChallengeParameters["captchaUrl"]; +str = cognitoUserPoolEvent.response.privateChallengeParameters["answer"]; +str = cognitoUserPoolEvent.response.challengeMetaData; +b = cognitoUserPoolEvent.response.answerCorrect; + /* Context */ b = context.callbackWaitsForEmptyEventLoop; str = context.functionName; diff --git a/types/aws-lambda/index.d.ts b/types/aws-lambda/index.d.ts index a5fa271699..2af4e09ae7 100644 --- a/types/aws-lambda/index.d.ts +++ b/types/aws-lambda/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for AWS Lambda // Project: http://docs.aws.amazon.com/lambda -// Definitions by: James Darbyshire , Michael Skarum , Stef Heyenrath , Toby Hede , Rich Buggy , Simon Ramsay +// Definitions by: James Darbyshire , Michael Skarum , Stef Heyenrath , Toby Hede , Rich Buggy , Simon Ramsay , Yoriki Yamaguchi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // API Gateway "event" @@ -124,6 +124,49 @@ interface S3CreateEvent { ]; } +/** + * Cognito User Pool event + * http://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-identity-pools-working-with-aws-lambda-triggers.html + */ +interface CognitoUserPoolEvent { + version: number; + triggerSource: "PreSignUp_SignUp" | "PostConfirmation_ConfirmSignUp" | "PreAuthentication_Authentication" | "PostAuthentication_Authentication" | "CustomMessage_SignUp" | "CustomMessage_AdminCreateUser" | "CustomMessage_ResendCode" | "CustomMessage_ForgotPassword" | "CustomMessage_UpdateUserAttribute" | "CustomMessage_VerifyUserAttribute" | "CustomMessage_Authentication" | "DefineAuthChallenge_Authentication" | "CreateAuthChallenge_Authentication" | "VerifyAuthChallengeResponse_Authentication"; + region: string; + userPoolId: string; + userName?: string; + callerContext: { + awsSdkVersion: string; + clientId: string; + }; + request: { + userAttributes: {[key: string]: string}; + validationData?: {[key: string]: string}; + codeParameter?: string; + newDeviceUsed?: boolean; + session?: { + challengeName: "CUSTOM_CHALLENGE" | "PASSWORD_VERIFIER" | "SMS_MFA" | "DEVICE_SRP_AUTH" | "DEVICE_PASSWORD_VERIFIER" | "ADMIN_NO_SRP_AUTH"; + challengeResult: boolean; + challengeMetaData?: string; + }[]; + challengeName?: string; + privateChallengeParameters?: {[key: string]: string}; + challengeAnswer?: {[key: string]: string}; + }; + response: { + autoConfirmUser?: boolean; + smsMessage?: string; + emailMessage?: string; + emailSubject?: string; + challengeName?: string; + issueTokens?: boolean; + failAuthentication?: boolean; + publicChallengeParameters?: {[key: string]: string}; + privateChallengeParameters?: {[key: string]: string}; + challengeMetaData?: string; + answerCorrect?: boolean; + }; +} + // Context // http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-context.html interface Context { From 44202e43756f31141bf8d5fae226ca7a01181c1d Mon Sep 17 00:00:00 2001 From: Lee Siong Chan Date: Thu, 1 Jun 2017 13:56:26 +0800 Subject: [PATCH 0178/1105] Add missing definitions for libphonenumber (#16576) --- types/google-libphonenumber/index.d.ts | 94 +++++++++++++++++++++++--- 1 file changed, 84 insertions(+), 10 deletions(-) diff --git a/types/google-libphonenumber/index.d.ts b/types/google-libphonenumber/index.d.ts index 13659182a9..1fc2d321aa 100644 --- a/types/google-libphonenumber/index.d.ts +++ b/types/google-libphonenumber/index.d.ts @@ -26,7 +26,71 @@ declare namespace libphonenumber { UNKNOWN = -1 } - interface PhoneNumber { + export module PhoneNumber { + export enum CountryCodeSource { + FROM_NUMBER_WITH_PLUS_SIGN = 1, + FROM_NUMBER_WITH_IDD = 5, + FROM_NUMBER_WITHOUT_PLUS_SIGN = 10, + FROM_DEFAULT_COUNTRY = 20, + } + } + + export interface PhoneNumber { + getCountryCode(): number | undefined; + getCountryCodeOrDefault(): number; + setCountryCode(value: number): void; + hasCountryCode(): boolean; + countryCodeCount(): number; + clearCountryCode(): void; + + getNationalNumber(): number | undefined; + getNationalNumberOrDefault(): number; + setNationalNumber(value: number): number; + hasNationalNumber(): boolean; + nationalNumberCount(): number; + clearNationalNumber(): void; + + getExtension(): string | undefined; + getExtensionOrDefault(): string; + setExtension(value: string): void; + hasExtension(): boolean; + extensionCount(): number; + clearExtension(): void; + + getItalianLeadingZero(): boolean | undefined; + getItalianLeadingZeroOrDefault(): boolean; + setItalianLeadingZero(value: boolean): void; + hasItalianLeadingZero(): boolean; + italianLeadingZeroCount(): number; + clearItalianLeadingZero(): void; + + getNumberOfLeadingZeros(): number | undefined; + getNumberOfLeadingZerosOrDefault(): number; + setNumberOfLeadingZeros(value: number): void; + hasNumberOfLeadingZeros(): boolean; + numberOfLeadingZerosCount(): number; + clearNumberOfLeadingZeros(): void; + + getRawInput(): string | undefined; + getRawInputOrDefault(): string; + setRawInput(value: string): void; + hasRawInput(): boolean; + rawInputCount(): number; + clearRawInput(): void; + + getCountryCodeSource(): PhoneNumber.CountryCodeSource | undefined; + getCountryCodeSourceOrDefault(): PhoneNumber.CountryCodeSource; + setCountryCodeSource(value: PhoneNumber.CountryCodeSource): void; + hasCountryCodeSource(): boolean; + countryCodeSourceCount(): number; + clearCountryCodeSource(): void; + + getPreferredDomesticCarrierCode(): string | undefined; + getPreferredDomesticCarrierCodeOrDefault(): string; + setPreferredDomesticCarrierCode(value: string): void; + hasPreferredDomesticCarrierCode(): boolean; + preferredDomesticCarrierCodeCount(): number; + clearPreferredDomesticCarrierCode(): void; } export module PhoneNumberUtil { @@ -40,16 +104,26 @@ declare namespace libphonenumber { export class PhoneNumberUtil { static getInstance(): PhoneNumberUtil - parse(number: string, region: string): PhoneNumber; - isValidNumber(phoneNumber: PhoneNumber): boolean; - isPossibleNumber(phoneNumber: PhoneNumber): boolean; - isPossibleNumberWithReason(phoneNumber: PhoneNumber): PhoneNumberUtil.ValidationResult; - isValidNumberForRegion(phoneNumber: PhoneNumber, region: string): boolean; - getNumberType(phoneNumber: PhoneNumber): PhoneNumberType; - getRegionCodeForNumber(phoneNumber: PhoneNumber): string; - isNANPACountry(regionCode: string): boolean; format(phoneNumber: PhoneNumber, format: PhoneNumberFormat): string; - parseAndKeepRawInput(number: string, regionCode: string): PhoneNumber; + getNddPrefixForRegion(regionCode?: string, stripNonDigits?: boolean): string | undefined; + getNumberType(phoneNumber: PhoneNumber): PhoneNumberType; + getRegionCodeForCountryCode(countryCallingCode: number): string; + getRegionCodeForNumber(phoneNumber: PhoneNumber): string | undefined; + isAlphaNumber(number: string): boolean; + isLeadingZeroPossible(countryCallingCode: number): boolean; + isNANPACountry(regionCode?: string): boolean; + isPossibleNumber(number: PhoneNumber): boolean; + isPossibleNumber(phoneNumber: PhoneNumber): boolean; + isPossibleNumberForType(number: PhoneNumber, type: PhoneNumberType): boolean; + isPossibleNumberForTypeWithReason(number: PhoneNumber, type: PhoneNumberType): PhoneNumberUtil.ValidationResult; + isPossibleNumberString(number: string, regionDialingFrom: string): boolean; + isPossibleNumberWithReason(number: PhoneNumber): PhoneNumberUtil.ValidationResult; + isPossibleNumberWithReason(phoneNumber: PhoneNumber): PhoneNumberUtil.ValidationResult; + isValidNumber(phoneNumber: PhoneNumber): boolean; + isValidNumberForRegion(phoneNumber: PhoneNumber, region?: string): boolean; + parse(number?: string, region?: string): PhoneNumber; + parseAndKeepRawInput(number: string, regionCode?: string): PhoneNumber; + truncateTooLongNumber(number: PhoneNumber): boolean; } export class AsYouTypeFormatter { From ffeb5e742cc0f6c863233e240083144d5190738e Mon Sep 17 00:00:00 2001 From: soucekv Date: Thu, 1 Jun 2017 07:56:58 +0200 Subject: [PATCH 0179/1105] Add leaflet-polylinedecorator 1.1 types (#16609) --- types/leaflet-polylinedecorator/index.d.ts | 62 +++++++++++++++++++ .../leaflet-polylinedecorator-tests.ts | 52 ++++++++++++++++ types/leaflet-polylinedecorator/tsconfig.json | 22 +++++++ types/leaflet-polylinedecorator/tslint.json | 1 + 4 files changed, 137 insertions(+) create mode 100644 types/leaflet-polylinedecorator/index.d.ts create mode 100644 types/leaflet-polylinedecorator/leaflet-polylinedecorator-tests.ts create mode 100644 types/leaflet-polylinedecorator/tsconfig.json create mode 100644 types/leaflet-polylinedecorator/tslint.json diff --git a/types/leaflet-polylinedecorator/index.d.ts b/types/leaflet-polylinedecorator/index.d.ts new file mode 100644 index 0000000000..db3bea8dd6 --- /dev/null +++ b/types/leaflet-polylinedecorator/index.d.ts @@ -0,0 +1,62 @@ +// Type definitions for leaflet-polylinedecorator 1.1 +// Project: https://github.com/bbecquet/Leaflet.PolylineDecorator#readme +// Definitions by: Viktor Soucek +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare namespace L { + namespace Symbol { + interface DashOptions { + pixelSize?: number; + pathOptions?: PathOptions; + } + + class Dash { + constructor(options?: DashOptions); + } + + function dash(options?: DashOptions): Dash; + + interface ArrowHeadOptions { + polygon?: boolean; + pixelSize?: number; + headAngle?: number; + pathOptions?: PathOptions; + } + + class ArrowHead { + constructor(options?: ArrowHeadOptions); + } + + function arrowHead(options?: ArrowHeadOptions): ArrowHead; + + interface MarkerOptions { + rotate?: boolean; + markerOptions?: L.MarkerOptions; + } + + class Marker { + constructor(options?: L.Symbol.MarkerOptions); + } + + function marker(options?: L.Symbol.MarkerOptions): L.Symbol.Marker; + } + + interface Pattern { + offset?: number; + endOffset?: number; + repeat: number; + symbol: Symbol.Dash | Symbol.ArrowHead | Symbol.Marker; + } + + interface PolylineDecoratorOptions { + patterns: Pattern[]; + } + + class PolylineDecorator extends FeatureGroup { + constructor(paths: Polyline | Polygon | LatLngExpression[] | Polyline[] | Polygon[] | LatLngExpression[][], options?: PolylineDecoratorOptions); + } + + function polylineDecorator(paths: Polyline | Polyline[], options?: PolylineDecoratorOptions): PolylineDecorator; +} diff --git a/types/leaflet-polylinedecorator/leaflet-polylinedecorator-tests.ts b/types/leaflet-polylinedecorator/leaflet-polylinedecorator-tests.ts new file mode 100644 index 0000000000..19bf57e6bd --- /dev/null +++ b/types/leaflet-polylinedecorator/leaflet-polylinedecorator-tests.ts @@ -0,0 +1,52 @@ +const osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'; +const osmAttrib = '© OpenStreetMap contributors'; +const osm = L.tileLayer(osmUrl, {maxZoom: 18, attribution: osmAttrib}); +const map = L.map('map', {layers: [osm], center: L.latLng(-37.7772, 175.2756), zoom: 15 }); + +const polyline = L.polyline([[0, 0], [1, 1]]); + +L.polylineDecorator(polyline, { + patterns: [ + // defines a pattern of 10px-wide dashes, repeated every 20px on the line + {offset: 0, repeat: 20, symbol: L.Symbol.dash({pixelSize: 10})} + ] +}); + +L.polylineDecorator(polyline, { + patterns: [ + { + offset: 0, + endOffset: 10, + repeat: 15, + symbol: L.Symbol.dash({ + pixelSize: 12, + pathOptions: {} + })} + ] +}).addTo(map); + +L.polylineDecorator(polyline, { + patterns: [ + { + offset: 0, + endOffset: 10, + repeat: 15, + symbol: L.Symbol.arrowHead({ + polygon: true, + headAngle: 45, + pixelSize: 12, + pathOptions: {} + })} + ] +}).addTo(map); + +L.polylineDecorator(polyline, { + patterns: [ + { + repeat: 15, + symbol: L.Symbol.marker({ + rotate: false, + markerOptions: {} + })} + ] +}).addTo(map); diff --git a/types/leaflet-polylinedecorator/tsconfig.json b/types/leaflet-polylinedecorator/tsconfig.json new file mode 100644 index 0000000000..d50a96123e --- /dev/null +++ b/types/leaflet-polylinedecorator/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", + "leaflet-polylinedecorator-tests.ts" + ] +} diff --git a/types/leaflet-polylinedecorator/tslint.json b/types/leaflet-polylinedecorator/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/leaflet-polylinedecorator/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 2c2b9e42c830759e083a045d00d6e1d9c24172ba Mon Sep 17 00:00:00 2001 From: Matus Gura Date: Thu, 1 Jun 2017 07:59:11 +0200 Subject: [PATCH 0180/1105] [node] Added missing on net.Socket (#16810) --- types/node/index.d.ts | 1 + types/node/node-tests.ts | 1 + types/node/v6/index.d.ts | 1 + types/node/v6/node-tests.ts | 1 + 4 files changed, 4 insertions(+) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 84c5773976..a331173657 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -2061,6 +2061,7 @@ declare module "net" { localPort: number; bytesRead: number; bytesWritten: number; + connecting: boolean; destroyed: boolean; // Extended base methods diff --git a/types/node/node-tests.ts b/types/node/node-tests.ts index 55940e5a0c..e8ac602625 100644 --- a/types/node/node-tests.ts +++ b/types/node/node-tests.ts @@ -2076,6 +2076,7 @@ namespace net_tests { }) _socket = _socket.prependOnceListener("timeout", () => { }) + bool = _socket.connecting; bool = _socket.destroyed; _socket.destroy(); } diff --git a/types/node/v6/index.d.ts b/types/node/v6/index.d.ts index ebc2b516d6..384966b4aa 100644 --- a/types/node/v6/index.d.ts +++ b/types/node/v6/index.d.ts @@ -1955,6 +1955,7 @@ declare module "net" { localPort: number; bytesRead: number; bytesWritten: number; + connecting: boolean; destroyed: boolean; // Extended base methods diff --git a/types/node/v6/node-tests.ts b/types/node/v6/node-tests.ts index b2ca08898c..6023217947 100644 --- a/types/node/v6/node-tests.ts +++ b/types/node/v6/node-tests.ts @@ -1942,6 +1942,7 @@ namespace net_tests { }) _socket = _socket.prependOnceListener("timeout", () => { }) + bool = _socket.connecting; bool = _socket.destroyed; _socket.destroy(); } From 6d155c6d27e9bd6e3610fa4ccd770aea31823f16 Mon Sep 17 00:00:00 2001 From: Ivan Cheremnov Date: Thu, 1 Jun 2017 13:23:09 +0700 Subject: [PATCH 0181/1105] Add missing definitions (#16878) --- types/ip/index.d.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/types/ip/index.d.ts b/types/ip/index.d.ts index 0e3bb7bd14..602a71eed9 100644 --- a/types/ip/index.d.ts +++ b/types/ip/index.d.ts @@ -75,6 +75,16 @@ declare module "ip" { **/ export function isLoopback(ip: string): boolean; + /** + * Check whether an IP is a IPv4 address. + **/ + export function isV4Format(ip: string): boolean; + + /** + * Check whether an IP is a IPv6 address. + **/ + export function isV6Format(ip: string): boolean; + /** * Get the loopback address for an IP family. * From 5f3a9040e8e3690dd64115b45a884e5898516379 Mon Sep 17 00:00:00 2001 From: Michael Zlatkovsky Date: Wed, 31 May 2017 23:25:43 -0700 Subject: [PATCH 0182/1105] Update index.d.ts (#16881) --- types/office-js/index.d.ts | 590 +++++++++++++++++++++---------------- 1 file changed, 341 insertions(+), 249 deletions(-) diff --git a/types/office-js/index.d.ts b/types/office-js/index.d.ts index 520928823e..935c7b3c35 100644 --- a/types/office-js/index.d.ts +++ b/types/office-js/index.d.ts @@ -2135,314 +2135,405 @@ declare namespace Office { //////////////////////////////////////////////////////////////// -///////////////// Begin OfficeExtension runtime //////////////// +//////////////// Begin OfficeExtension runtime ///////////////// //////////////////////////////////////////////////////////////// - -declare module OfficeExtension { - /** An abstract proxy object that represents an object in an Office document. You create proxy objects from the context (or from other proxy objects), add commands to a queue to act on the object, and then synchronize the proxy object state with the document by calling "context.sync()". */ - class ClientObject { - /** The request context associated with the object */ - context: ClientRequestContext; - /** Returns a boolean value for whether the corresponding object is a null object. You must call "context.sync()" before reading the isNullObject property. */ - isNullObject: boolean; - } +declare namespace OfficeExtension { + /** An abstract proxy object that represents an object in an Office document. You create proxy objects from the context (or from other proxy objects), add commands to a queue to act on the object, and then synchronize the proxy object state with the document by calling "context.sync()". */ + class ClientObject { + /** The request context associated with the object */ + context: ClientRequestContext; + /** Returns a boolean value for whether the corresponding object is a null object. You must call "context.sync()" before reading the isNullObject property. */ + isNullObject: boolean; + } } -declare module OfficeExtension { - interface LoadOption { - select?: string | string[]; - expand?: string | string[]; - top?: number; - skip?: number; - } - /** An abstract RequestContext object that facilitates requests to the host Office application. The "Excel.run" and "Word.run" methods provide a request context. */ - class ClientRequestContext { - constructor(url?: string); +declare namespace OfficeExtension { + interface LoadOption { + select?: string | string[]; + expand?: string | string[]; + top?: number; + skip?: number; + } + /** An abstract RequestContext object that facilitates requests to the host Office application. The "Excel.run" and "Word.run" methods provide a request context. */ + class ClientRequestContext { + constructor(url?: string); - /** Collection of objects that are tracked for automatic adjustments based on surrounding changes in the document. */ - trackedObjects: TrackedObjects; + /** Collection of objects that are tracked for automatic adjustments based on surrounding changes in the document. */ + trackedObjects: TrackedObjects; - /** Request headers */ - requestHeaders: { [name: string]: string }; + /** Request headers */ + requestHeaders: { [name: string]: string }; - /** Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. */ - load(object: ClientObject, option?: string | string[] | LoadOption): void; + /** Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. */ + load(object: ClientObject, option?: string | string[]| LoadOption): void; - /** - * Queues up a command to recursively load the specified properties of the object and its navigation properties. - * You must call "context.sync()" before reading the properties. - * - * @param object The object to be loaded. - * @param options The key-value pairing of load options for the types, such as { "Workbook": "worksheets,tables", "Worksheet": "tables", "Tables": "name" } - * @param maxDepth The maximum recursive depth. - */ - loadRecursive(object: ClientObject, options: { [typeName: string]: string | string[] | LoadOption }, maxDepth?: number): void; + /** + * Queues up a command to recursively load the specified properties of the object and its navigation properties. + * You must call "context.sync()" before reading the properties. + * + * @param object The object to be loaded. + * @param options The key-value pairing of load options for the types, such as { "Workbook": "worksheets,tables", "Worksheet": "tables", "Tables": "name" } + * @param maxDepth The maximum recursive depth. + */ + loadRecursive(object: ClientObject, options: { [typeName: string]: string | string[] | LoadOption }, maxDepth?: number): void; - /** Adds a trace message to the queue. If the promise returned by "context.sync()" is rejected due to an error, this adds a ".traceMessages" array to the OfficeExtension.Error object, containing all trace messages that were executed. These messages can help you monitor the program execution sequence and detect the cause of the error. */ - trace(message: string): void; + /** Adds a trace message to the queue. If the promise returned by "context.sync()" is rejected due to an error, this adds a ".traceMessages" array to the OfficeExtension.Error object, containing all trace messages that were executed. These messages can help you monitor the program execution sequence and detect the cause of the error. */ + trace(message: string): void; - /** Synchronizes the state between JavaScript proxy objects and the Office document, by executing instructions queued on the request context and retrieving properties of loaded Office objects for use in your code. This method returns a promise, which is resolved when the synchronization is complete. */ - sync(passThroughValue?: T): IPromise; - } + /** Synchronizes the state between JavaScript proxy objects and the Office document, by executing instructions queued on the request context and retrieving properties of loaded Office objects for use in your code.�This method returns a promise, which is resolved when the synchronization is complete. */ + sync(passThroughValue?: T): IPromise; + } } -declare module OfficeExtension { - /** Contains the result for methods that return primitive types. The object's value property is retrieved from the document after "context.sync()" is invoked. */ - class ClientResult { - /** The value of the result that is retrieved from the document after "context.sync()" is invoked. */ - value: T; - } +declare namespace OfficeExtension { + /** Contains the result for methods that return primitive types. The object's value property is retrieved from the document after "context.sync()" is invoked. */ + class ClientResult { + /** The value of the result that is retrieved from the document after "context.sync()" is invoked. */ + value: T; + } } -declare module OfficeExtension { - /** The error object returned by "context.sync()", if a promise is rejected due to an error while processing the request. */ - class Error { - /** Error name: "OfficeExtension.Error".*/ - name: string; - /** The error message passed through from the host Office application. */ - message: string; - /** Stack trace, if applicable. */ - stack: string; - /** Error code string, such as "InvalidArgument". */ - code: string; - /** Trace messages (if any) that were added via a "context.trace()" invocation before calling "context.sync()". If there was an error, this contains all trace messages that were executed before the error occurred. These messages can help you monitor the program execution sequence and detect the case of the error. */ - traceMessages: Array; - /** Debug info, if applicable. The ".errorLocation" property can describe the object and method or property that caused the error. */ - debugInfo: { - /** If applicable, will return the object type and the name of the method or property that caused the error. */ - errorLocation?: string; - }; - } +declare namespace OfficeExtension { + export interface DebugInfo { + /** Error code string, such as "InvalidArgument". */ + code: string; + /** The error message passed through from the host Office application. */ + message: string; + /** Inner error, if applicable. */ + innerError?: DebugInfo | string; + + /** The object type and property or method name (or similar information), if available. */ + errorLocation?: string + } + + /** The error object returned by "context.sync()", if a promise is rejected due to an error while processing the request. */ + class Error { + /** Error name: "OfficeExtension.Error".*/ + name: string; + /** The error message passed through from the host Office application. */ + message: string; + /** Stack trace, if applicable. */ + stack: string; + /** Error code string, such as "InvalidArgument". */ + code: string; + /** Trace messages (if any) that were added via a "context.trace()" invocation before calling "context.sync()". If there was an error, this contains all trace messages that were executed before the error occurred. These messages can help you monitor the program execution sequence and detect the case of the error. */ + traceMessages: Array; + /** Debug info (useful for detailed logging of the error, i.e., via JSON.stringify(...)). */ + debugInfo: DebugInfo; + /** Inner error, if applicable. */ + innerError: Error; + } } -declare module OfficeExtension { - class ErrorCodes { - static accessDenied: string; - static generalException: string; - static activityLimitReached: string; - } +declare namespace OfficeExtension { + class ErrorCodes { + public static accessDenied: string; + public static generalException: string; + public static activityLimitReached: string; + public static invalidObjectPath: string; + public static propertyNotLoaded: string; + public static valueNotLoaded: string; + public static invalidRequestContext: string; + public static invalidArgument: string; + public static runMustReturnPromise: string; + public static cannotRegisterEvent: string; + public static apiNotFound: string; + public static connectionFailure: string; + } } -declare module OfficeExtension { - /** An IPromise object that represents a deferred interaction with the host Office application. */ - interface IPromise { - /** - * This method will be called once the previous promise has been resolved. - * Both the onFulfilled on onRejected callbacks are optional. - * If either or both are omitted, the next onFulfilled/onRejected in the chain will be called called. +declare namespace OfficeExtension { + /** An IPromise object that represents a deferred interaction with the host Office application. */ + interface IPromise { + /** + * This method will be called once the previous promise has been resolved. + * Both the onFulfilled on onRejected callbacks are optional. + * If either or both are omitted, the next onFulfilled/onRejected in the chain will be called called. - * @returns A new promise for the value or error that was returned from onFulfilled/onRejected. - */ - then(onFulfilled?: (value: R) => IPromise, onRejected?: (error: any) => IPromise): IPromise; + * @returns A new promise for the value or error that was returned from onFulfilled/onRejected. + */ + then(onFulfilled?: (value: R) => IPromise, onRejected?: (error: any) => IPromise): IPromise; - /** - * This method will be called once the previous promise has been resolved. - * Both the onFulfilled on onRejected callbacks are optional. - * If either or both are omitted, the next onFulfilled/onRejected in the chain will be called called. + /** + * This method will be called once the previous promise has been resolved. + * Both the onFulfilled on onRejected callbacks are optional. + * If either or both are omitted, the next onFulfilled/onRejected in the chain will be called called. - * @returns A new promise for the value or error that was returned from onFulfilled/onRejected. - */ - then(onFulfilled?: (value: R) => IPromise, onRejected?: (error: any) => U): IPromise; + * @returns A new promise for the value or error that was returned from onFulfilled/onRejected. + */ + then(onFulfilled?: (value: R) => IPromise, onRejected?: (error: any) => U): IPromise; - /** - * This method will be called once the previous promise has been resolved. - * Both the onFulfilled on onRejected callbacks are optional. - * If either or both are omitted, the next onFulfilled/onRejected in the chain will be called called. + /** + * This method will be called once the previous promise has been resolved. + * Both the onFulfilled on onRejected callbacks are optional. + * If either or both are omitted, the next onFulfilled/onRejected in the chain will be called called. - * @returns A new promise for the value or error that was returned from onFulfilled/onRejected. - */ - then(onFulfilled?: (value: R) => IPromise, onRejected?: (error: any) => void): IPromise; + * @returns A new promise for the value or error that was returned from onFulfilled/onRejected. + */ + then(onFulfilled?: (value: R) => IPromise, onRejected?: (error: any) => void): IPromise; - /** - * This method will be called once the previous promise has been resolved. - * Both the onFulfilled on onRejected callbacks are optional. - * If either or both are omitted, the next onFulfilled/onRejected in the chain will be called called. + /** + * This method will be called once the previous promise has been resolved. + * Both the onFulfilled on onRejected callbacks are optional. + * If either or both are omitted, the next onFulfilled/onRejected in the chain will be called called. - * @returns A new promise for the value or error that was returned from onFulfilled/onRejected. - */ - then(onFulfilled?: (value: R) => U, onRejected?: (error: any) => IPromise): IPromise; + * @returns A new promise for the value or error that was returned from onFulfilled/onRejected. + */ + then(onFulfilled?: (value: R) => U, onRejected?: (error: any) => IPromise): IPromise; - /** - * This method will be called once the previous promise has been resolved. - * Both the onFulfilled on onRejected callbacks are optional. - * If either or both are omitted, the next onFulfilled/onRejected in the chain will be called called. + /** + * This method will be called once the previous promise has been resolved. + * Both the onFulfilled on onRejected callbacks are optional. + * If either or both are omitted, the next onFulfilled/onRejected in the chain will be called called. - * @returns A new promise for the value or error that was returned from onFulfilled/onRejected. - */ - then(onFulfilled?: (value: R) => U, onRejected?: (error: any) => U): IPromise; + * @returns A new promise for the value or error that was returned from onFulfilled/onRejected. + */ + then(onFulfilled?: (value: R) => U, onRejected?: (error: any) => U): IPromise; - /** - * This method will be called once the previous promise has been resolved. - * Both the onFulfilled on onRejected callbacks are optional. - * If either or both are omitted, the next onFulfilled/onRejected in the chain will be called called. + /** + * This method will be called once the previous promise has been resolved. + * Both the onFulfilled on onRejected callbacks are optional. + * If either or both are omitted, the next onFulfilled/onRejected in the chain will be called called. - * @returns A new promise for the value or error that was returned from onFulfilled/onRejected. - */ - then(onFulfilled?: (value: R) => U, onRejected?: (error: any) => void): IPromise; + * @returns A new promise for the value or error that was returned from onFulfilled/onRejected. + */ + then(onFulfilled?: (value: R) => U, onRejected?: (error: any) => void): IPromise; - /** - * Catches failures or exceptions from actions within the promise, or from an unhandled exception earlier in the call stack. - * @param onRejected function to be called if or when the promise rejects. - */ - catch(onRejected?: (error: any) => IPromise): IPromise; + /** + * Catches failures or exceptions from actions within the promise, or from an unhandled exception earlier in the call stack. + * @param onRejected function to be called if or when the promise rejects. + */ + catch(onRejected?: (error: any) => IPromise): IPromise; - /** - * Catches failures or exceptions from actions within the promise, or from an unhandled exception earlier in the call stack. - * @param onRejected function to be called if or when the promise rejects. - */ - catch(onRejected?: (error: any) => U): IPromise; + /** + * Catches failures or exceptions from actions within the promise, or from an unhandled exception earlier in the call stack. + * @param onRejected function to be called if or when the promise rejects. + */ + catch(onRejected?: (error: any) => U): IPromise; - /** - * Catches failures or exceptions from actions within the promise, or from an unhandled exception earlier in the call stack. - * @param onRejected function to be called if or when the promise rejects. - */ - catch(onRejected?: (error: any) => void): IPromise; - } + /** + * Catches failures or exceptions from actions within the promise, or from an unhandled exception earlier in the call stack. + * @param onRejected function to be called if or when the promise rejects. + */ + catch(onRejected?: (error: any) => void): IPromise; + } - /** An Promise object that represents a deferred interaction with the host Office application. The publically-consumable OfficeExtension.Promise is available starting in ExcelApi 1.2 and WordApi 1.2. Promises can be chained via ".then", and errors can be caught via ".catch". Remember to always use a ".catch" on the outer promise, and to return intermediary promises so as not to break the promise chain. When a "native" Promise implementation is available, OfficeExtension.Promise will switch to use the native Promise instead. */ - export class Promise implements IPromise - { - /** - * Creates a new promise based on a function that accepts resolve and reject handlers. - */ - constructor(func: (resolve: (value?: R | IPromise) => void, reject: (error?: any) => void) => void); + /** An Promise object that represents a deferred interaction with the host Office application. The publically-consumable OfficeExtension.Promise is available starting in ExcelApi 1.2 and WordApi 1.2. Promises can be chained via ".then", and errors can be caught via ".catch". Remember to always use a ".catch" on the outer promise, and to return intermediary promises so as not to break the promise chain. When a "native" Promise implementation is available, OfficeExtension.Promise will switch to use the native Promise instead. */ + export class Promise implements IPromise + { + /** + * Creates a new promise based on a function that accepts resolve and reject handlers. + */ + constructor(func: (resolve: (value?: R | IPromise) => void, reject: (error?: any) => void) => void); - /** - * Creates a promise that resolves when all of the child promises resolve. - */ - static all(promises: OfficeExtension.IPromise[]): IPromise; + /** + * Creates a promise that resolves when all of the child promises resolve. + */ + static all(promises: OfficeExtension.IPromise[]): IPromise; - /** - * Creates a promise that is resolved. - */ - static resolve(value: U): IPromise; + /** + * Creates a promise that is resolved. + */ + static resolve(value: U): IPromise; - /** - * Creates a promise that is rejected. - */ - static reject(error: any): IPromise; + /** + * Creates a promise that is rejected. + */ + static reject(error: any): IPromise; - /* This method will be called once the previous promise has been resolved. - * Both the onFulfilled on onRejected callbacks are optional. - * If either or both are omitted, the next onFulfilled/onRejected in the chain will be called called. + /* This method will be called once the previous promise has been resolved. + * Both the onFulfilled on onRejected callbacks are optional. + * If either or both are omitted, the next onFulfilled/onRejected in the chain will be called called. - * @returns A new promise for the value or error that was returned from onFulfilled/onRejected. - */ - then(onFulfilled?: (value: R) => IPromise, onRejected?: (error: any) => IPromise): IPromise; + * @returns A new promise for the value or error that was returned from onFulfilled/onRejected. + */ + then(onFulfilled?: (value: R) => IPromise, onRejected?: (error: any) => IPromise): IPromise; - /** - * This method will be called once the previous promise has been resolved. - * Both the onFulfilled on onRejected callbacks are optional. - * If either or both are omitted, the next onFulfilled/onRejected in the chain will be called called. + /** + * This method will be called once the previous promise has been resolved. + * Both the onFulfilled on onRejected callbacks are optional. + * If either or both are omitted, the next onFulfilled/onRejected in the chain will be called called. - * @returns A new promise for the value or error that was returned from onFulfilled/onRejected. - */ - then(onFulfilled?: (value: R) => IPromise, onRejected?: (error: any) => U): IPromise; + * @returns A new promise for the value or error that was returned from onFulfilled/onRejected. + */ + then(onFulfilled?: (value: R) => IPromise, onRejected?: (error: any) => U): IPromise; - /** - * This method will be called once the previous promise has been resolved. - * Both the onFulfilled on onRejected callbacks are optional. - * If either or both are omitted, the next onFulfilled/onRejected in the chain will be called called. + /** + * This method will be called once the previous promise has been resolved. + * Both the onFulfilled on onRejected callbacks are optional. + * If either or both are omitted, the next onFulfilled/onRejected in the chain will be called called. - * @returns A new promise for the value or error that was returned from onFulfilled/onRejected. - */ - then(onFulfilled?: (value: R) => IPromise, onRejected?: (error: any) => void): IPromise; + * @returns A new promise for the value or error that was returned from onFulfilled/onRejected. + */ + then(onFulfilled?: (value: R) => IPromise, onRejected?: (error: any) => void): IPromise; - /** - * This method will be called once the previous promise has been resolved. - * Both the onFulfilled on onRejected callbacks are optional. - * If either or both are omitted, the next onFulfilled/onRejected in the chain will be called called. + /** + * This method will be called once the previous promise has been resolved. + * Both the onFulfilled on onRejected callbacks are optional. + * If either or both are omitted, the next onFulfilled/onRejected in the chain will be called called. - * @returns A new promise for the value or error that was returned from onFulfilled/onRejected. - */ - then(onFulfilled?: (value: R) => U, onRejected?: (error: any) => IPromise): IPromise; + * @returns A new promise for the value or error that was returned from onFulfilled/onRejected. + */ + then(onFulfilled?: (value: R) => U, onRejected?: (error: any) => IPromise): IPromise; - /** - * This method will be called once the previous promise has been resolved. - * Both the onFulfilled on onRejected callbacks are optional. - * If either or both are omitted, the next onFulfilled/onRejected in the chain will be called called. + /** + * This method will be called once the previous promise has been resolved. + * Both the onFulfilled on onRejected callbacks are optional. + * If either or both are omitted, the next onFulfilled/onRejected in the chain will be called called. - * @returns A new promise for the value or error that was returned from onFulfilled/onRejected. - */ - then(onFulfilled?: (value: R) => U, onRejected?: (error: any) => U): IPromise; + * @returns A new promise for the value or error that was returned from onFulfilled/onRejected. + */ + then(onFulfilled?: (value: R) => U, onRejected?: (error: any) => U): IPromise; - /** - * This method will be called once the previous promise has been resolved. - * Both the onFulfilled on onRejected callbacks are optional. - * If either or both are omitted, the next onFulfilled/onRejected in the chain will be called called. + /** + * This method will be called once the previous promise has been resolved. + * Both the onFulfilled on onRejected callbacks are optional. + * If either or both are omitted, the next onFulfilled/onRejected in the chain will be called called. - * @returns A new promise for the value or error that was returned from onFulfilled/onRejected. - */ - then(onFulfilled?: (value: R) => U, onRejected?: (error: any) => void): IPromise; + * @returns A new promise for the value or error that was returned from onFulfilled/onRejected. + */ + then(onFulfilled?: (value: R) => U, onRejected?: (error: any) => void): IPromise; - /** - * Catches failures or exceptions from actions within the promise, or from an unhandled exception earlier in the call stack. - * @param onRejected function to be called if or when the promise rejects. - */ - catch(onRejected?: (error: any) => IPromise): IPromise; + /** + * Catches failures or exceptions from actions within the promise, or from an unhandled exception earlier in the call stack. + * @param onRejected function to be called if or when the promise rejects. + */ + catch(onRejected?: (error: any) => IPromise): IPromise; - /** - * Catches failures or exceptions from actions within the promise, or from an unhandled exception earlier in the call stack. - * @param onRejected function to be called if or when the promise rejects. - */ - catch(onRejected?: (error: any) => U): IPromise; + /** + * Catches failures or exceptions from actions within the promise, or from an unhandled exception earlier in the call stack. + * @param onRejected function to be called if or when the promise rejects. + */ + catch(onRejected?: (error: any) => U): IPromise; - /** - * Catches failures or exceptions from actions within the promise, or from an unhandled exception earlier in the call stack. - * @param onRejected function to be called if or when the promise rejects. - */ - catch(onRejected?: (error: any) => void): IPromise; - } + /** + * Catches failures or exceptions from actions within the promise, or from an unhandled exception earlier in the call stack. + * @param onRejected function to be called if or when the promise rejects. + */ + catch(onRejected?: (error: any) => void): IPromise; + } } -declare module OfficeExtension { - /** Collection of tracked objects, contained within a request context. See "context.trackedObjects" for more information. */ - class TrackedObjects { - /** Track a new object for automatic adjustment based on surrounding changes in the document. Only some object types require this. If you are using an object across ".sync" calls and outside the sequential execution of a ".run" batch, and get an "InvalidObjectPath" error when setting a property or invoking a method on the object, you needed to have added the object to the tracked object collection when the object was first created. */ - add(object: ClientObject): void; - /** Track a new object for automatic adjustment based on surrounding changes in the document. Only some object types require this. If you are using an object across ".sync" calls and outside the sequential execution of a ".run" batch, and get an "InvalidObjectPath" error when setting a property or invoking a method on the object, you needed to have added the object to the tracked object collection when the object was first created. */ - add(objects: ClientObject[]): void; - /** Release the memory associated with an object that was previously added to this collection. Having many tracked objects slows down the host application, so please remember to free any objects you add, once you're done using them. You will need to call "context.sync()" before the memory release takes effect. */ - remove(object: ClientObject): void; - /** Release the memory associated with an object that was previously added to this collection. Having many tracked objects slows down the host application, so please remember to free any objects you add, once you're done using them. You will need to call "context.sync()" before the memory release takes effect. */ - remove(objects: ClientObject[]): void; - } +declare namespace OfficeExtension { + /** Collection of tracked objects, contained within a request context. See "context.trackedObjects" for more information. */ + class TrackedObjects { + /** Track a new object for automatic adjustment based on surrounding changes in the document. Only some object types require this. If you are using an object across ".sync" calls and outside the sequential execution of a ".run" batch, and get an "InvalidObjectPath" error when setting a property or invoking a method on the object, you needed to have added the object to the tracked object collection when the object was first created. */ + add(object: ClientObject): void; + /** Track a new object for automatic adjustment based on surrounding changes in the document. Only some object types require this. If you are using an object across ".sync" calls and outside the sequential execution of a ".run" batch, and get an "InvalidObjectPath" error when setting a property or invoking a method on the object, you needed to have added the object to the tracked object collection when the object was first created. */ + add(objects: ClientObject[]): void; + /** Release the memory associated with an object that was previously added to this collection. Having many tracked objects slows down the host application, so please remember to free any objects you add, once you're done using them. You will need to call "context.sync()" before the memory release takes effect. */ + remove(object: ClientObject): void; + /** Release the memory associated with an object that was previously added to this collection. Having many tracked objects slows down the host application, so please remember to free any objects you add, once you're done using them. You will need to call "context.sync()" before the memory release takes effect. */ + remove(objects: ClientObject[]): void; + } } -declare module OfficeExtension { - export class EventHandlers { - constructor(context: ClientRequestContext, parentObject: ClientObject, name: string, eventInfo: EventInfo); - add(handler: (args: T) => IPromise): EventHandlerResult; - remove(handler: (args: T) => IPromise): void; - } +declare namespace OfficeExtension { + export class EventHandlers { + constructor(context: ClientRequestContext, parentObject: ClientObject, name: string, eventInfo: EventInfo); + add(handler: (args: T) => IPromise): EventHandlerResult; + remove(handler: (args: T) => IPromise): void; + } - export class EventHandlerResult { - constructor(context: ClientRequestContext, handlers: EventHandlers, handler: (args: T) => IPromise); - remove(): void; - } + export class EventHandlerResult { + constructor(context: ClientRequestContext, handlers: EventHandlers, handler: (args: T) => IPromise); + remove(): void; + } - export interface EventInfo { - registerFunc: (callback: (args: any) => void) => IPromise; - unregisterFunc: (callback: (args: any) => void) => IPromise; - eventArgsTransformFunc: (args: any) => IPromise; - } + export interface EventInfo { + registerFunc: (callback: (args: any) => void) => IPromise; + unregisterFunc: (callback: (args: any) => void) => IPromise; + eventArgsTransformFunc: (args: any) => IPromise; + } } -declare module OfficeExtension { +declare namespace OfficeExtension { + /** + * Request URL and headers + */ + interface RequestUrlAndHeaderInfo { + /** Request URL */ + url: string; + /** Request headers */ + headers?: { + [name: string]: string; + }; + } +} + + + +declare namespace OfficeCore { /** - * Request URL and headers - */ - interface RequestUrlAndHeaderInfo { - /** Request URL */ - url: string; - /** Request headers */ - headers?: { - [name: string]: string; + * [Api set: Experiment 1.1 (PREVIEW)] + */ + class FlightingService extends OfficeExtension.ClientObject { + getFeature(featureName: string, type: string, defaultValue: number | boolean | string, possibleValues?: Array | Array | Array | Array): OfficeCore.ABType; + getFeatureGate(featureName: string, scope?: string): OfficeCore.ABType; + resetOverride(featureName: string): void; + setOverride(featureName: string, type: string, value: number | boolean | string): void; + /** + * Create a new instance of OfficeCore.FlightingService object + */ + static newObject(context: OfficeExtension.ClientRequestContext): OfficeCore.FlightingService; + toJSON(): {}; + } + /** + * + * Provides information about the scoped value. + * + * [Api set: Experiment 1.1 (PREVIEW)] + */ + interface ScopedValue { + /** + * + * Gets the scope. + * + * [Api set: Experiment 1.1 (PREVIEW)] + */ + scope: string; + /** + * + * Gets the value. + * + * [Api set: Experiment 1.1 (PREVIEW)] + */ + value: string | number | boolean; + } + /** + * [Api set: Experiment 1.1 (PREVIEW)] + */ + class ABType extends OfficeExtension.ClientObject { + readonly value: string | number | boolean; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + */ + load(option?: string | string[] | OfficeExtension.LoadOption): OfficeCore.ABType; + toJSON(): { + "value": string | number | boolean; }; } + /** + * [Api set: Experiment 1.1 (PREVIEW)] + */ + namespace FeatureType { + var boolean: string; + var integer: string; + var string: string; + } + namespace ExperimentErrorCodes { + var generalException: string; + } + module Interfaces { + } +} +declare namespace OfficeCore { + class RequestContext extends OfficeExtension.ClientRequestContext { + constructor(url?: string | OfficeExtension.RequestUrlAndHeaderInfo | any); + readonly flightingService: FlightingService; + } } - //////////////////////////////////////////////////////////////// -////////////////// End OfficeExtension runtime ///////////////// +///////////////// End OfficeExtension runtime ////////////////// //////////////////////////////////////////////////////////////// @@ -2631,7 +2722,7 @@ declare namespace Excel { /** * The RequestContext object facilitates requests to the Excel application. Since the Office add-in and the Excel application run in two different processes, the request context is required to get access to the Excel object model from the add-in. */ - class RequestContext extends OfficeExtension.ClientRequestContext { + class RequestContext extends OfficeCore.RequestContext { constructor(url?: string | Session); readonly workbook: Workbook; readonly application: Application; @@ -2788,7 +2879,7 @@ declare namespace Excel { * * Suspends calculation until the next "context.sync()" is called. Once set, it is the developer's responsibility to re-calc the workbook, to ensure that any dependencies are propagated. * - * [Api set: ExcelApi 1.7 (PREVIEW)] + * [Api set: ExcelApi 1.6 (PREVIEW)] */ suspendApiCalculationUntilNextSync(): void; /** @@ -12804,6 +12895,7 @@ declare namespace Excel { var itemNotFound: string; var notImplemented: string; var unsupportedOperation: string; + var invalidOperationInCellEditMode: string; } module Interfaces { /** An interface for updating data on the Worksheet object, for use in "worksheet.set({ ... })". */ @@ -21794,4 +21886,4 @@ declare namespace OneNote { //////////////////////////////////////////////////////////////// /////////////////////// End OneNote APIs /////////////////////// -//////////////////////////////////////////////////////////////// \ No newline at end of file +//////////////////////////////////////////////////////////////// From 1041051cf3df843461428e2b6f49beebf366d968 Mon Sep 17 00:00:00 2001 From: Leonard Thieu Date: Thu, 1 Jun 2017 02:27:46 -0400 Subject: [PATCH 0183/1105] Add type definitions for electron-settings v2. (#16854) --- .../v2/electron-settings-tests.ts | 102 ++++++++ types/electron-settings/v2/index.d.ts | 241 ++++++++++++++++++ types/electron-settings/v2/tsconfig.json | 27 ++ types/electron-settings/v2/tslint.json | 6 + 4 files changed, 376 insertions(+) create mode 100644 types/electron-settings/v2/electron-settings-tests.ts create mode 100644 types/electron-settings/v2/index.d.ts create mode 100644 types/electron-settings/v2/tsconfig.json create mode 100644 types/electron-settings/v2/tslint.json diff --git a/types/electron-settings/v2/electron-settings-tests.ts b/types/electron-settings/v2/electron-settings-tests.ts new file mode 100644 index 0000000000..38e37e6ba0 --- /dev/null +++ b/types/electron-settings/v2/electron-settings-tests.ts @@ -0,0 +1,102 @@ +import * as settings from 'electron-settings'; + +function test_configure() { + settings.configure({ + atomicSaving: false, + prettify: true + }) === undefined; +} + +function test_defaults() { + settings.defaults({ + a: 1, + b: '', + c: false, + d: { + d1: 'd1', + d2: true + }, + e: ['e1', 'e2'] + }) === undefined; +} + +async function test_has() { + await settings.has('a') === true; +} + +function test_hasSync() { + settings.hasSync('a') === true; +} + +async function test_get() { + await settings.get('b') === ''; +} + +function test_getSync() { + settings.getSync('b') === ''; +} + +async function test_set() { + await settings.set('c', true) === undefined; +} + +function test_setSync() { + settings.setSync('c', true) === undefined; +} + +async function test_delete() { + await settings.delete('d') === undefined; +} + +function test_deleteSync() { + settings.deleteSync('d') === undefined; +} + +async function test_clear() { + await settings.clear() === undefined; +} + +function test_clearSync() { + settings.clearSync() === undefined; +} +async function test_applyDefaults() { + await settings.applyDefaults({ overwrite: true }) === undefined; +} + +function test_applyDefaultsSync() { + settings.applyDefaultsSync({ overwrite: true }) === undefined; +} + +async function test_resetToDefaults() { + await settings.resetToDefaults() === undefined; +} + +function test_resetToDefaultsSync() { + settings.resetToDefaultsSync() === undefined; +} + +function test_observe() { + const observer = settings.observe('b', evt => { + if (evt.oldValue !== evt.newValue) { + console.log(evt.newValue); + } + }); + + observer.dispose(); +} + +function test_getSettingsFilePath() { + settings.getSettingsFilePath() === __filename; +} + +function test_on_create() { + settings.on('create', pathToSettings => { + pathToSettings === __dirname; + }) === settings; +} + +function test_on_write() { + settings.on('write', () => { + console.log(); + }) === settings; +} diff --git a/types/electron-settings/v2/index.d.ts b/types/electron-settings/v2/index.d.ts new file mode 100644 index 0000000000..ead5250015 --- /dev/null +++ b/types/electron-settings/v2/index.d.ts @@ -0,0 +1,241 @@ +// Type definitions for electron-settings 2.2 +// Project: https://github.com/nathanbuchar/electron-settings +// Definitions by: Leonard Thieu +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +/// + +import * as EventEmitter from 'events'; + +/** + * The Settings class. + */ +declare class Settings extends EventEmitter { + /** + * Globally configures default options. + * + * @throws if options is not an object. + */ + configure(options: ElectronSettings.Options | object): void; + + /** + * Globally configures default settings. + * + * If the settings file has not been created yet, these defaults will be applied, + * but only if settings.defaults is called before making any other calls that + * interact with the file system, such as has(), get(), or set(). + * + * @param defaults The defaults object. + * @throws if defaults is not an object. + */ + defaults(defaults: any): void; + + /** + * Returns a promise whose first argument is a boolean indicating if the key path exists within the settings object. + * For synchronous operation, use hasSync(). + * + * @param keyPath The path to the key that we wish to check exists within the settings object. + * @throws if key path is not a string. + * @see hasSync + */ + has(keyPath: string): Promise; + + /** + * The synchronous version of has(). + * + * @see has + */ + hasSync(keyPath: string): boolean; + + /** + * Returns a promise whose first argument is the value at the chosen key path. + * If no key path is chosen, the entire settings object will be returned instead. + * For synchronous operation, use getSync(). + * + * @param keyPath The path to the key that we wish to get the value of. + * @see getSync + */ + get(keyPath?: string): Promise; + + /** + * The synchronous version of get(). + * + * @see get + */ + getSync(keyPath?: string): any; + + /** + * Sets the value of the key at the chosen key path. + * For synchronous operation, use setSync(). + * + * @param keyPath The path to the key whose value we wish to set. This key need not already exist. + * @param value The value to set the key at the chosen key path to. This must be a data type supported by JSON: object, array, string, number, boolean, or null. + * @param options + * @throws if key path is not a string. + * @throws if options is not an object. + * @see setSync + */ + set(keyPath: string, value: any, options?: ElectronSettings.Options | object): Promise; + + /** + * The synchronous version of set(). + * + * @see set + */ + setSync(keyPath: string, value: any, options?: ElectronSettings.Options | object): void; + + /** + * Deletes the key and value at the chosen key path. + * + * @param keyPath The path to the key we wish to unset. + * @param options + * @throws if keyPath is not a string. + * @throws if options is not an object. + * @see deleteSync + */ + delete(keyPath: string, options?: ElectronSettings.Options | object): Promise; + + /** + * The synchronous version of delete(). + * + * @see delete + */ + deleteSync(keyPath: string, options?: ElectronSettings.Options | object): void; + + /** + * Clears the entire settings object. + * For synchronous operation, use clearSync(). + * + * @throws if options is not an object. + * @see clearSync + */ + clear(options?: ElectronSettings.Options | object): Promise; + + /** + * The synchronous version of clear(). + * + * @see clear + */ + clearSync(options?: ElectronSettings.Options | object): void; + + /** + * Applies defaults to the current settings object (deep). + * Settings that already exist will not be overwritten, but keys that exist within the defaults + * that don't exist within the setting object will be added. + * To configure defaults, use defaults(). + * For synchronous operation, use applyDefaultsSync(). + * + * @throws if options is not an object. + * @see defaults + * @see applyDefaultsSync + */ + applyDefaults(options?: ElectronSettings.ApplyDefaultsOptions | object): Promise; + + /** + * The synchronous version of applyDefaults(). + * + * @see applyDefaults + */ + applyDefaultsSync(options?: ElectronSettings.ApplyDefaultsOptions | object): void; + + /** + * Resets all settings to defaults. + * To configure defaults, use defaults(). + * For synchronous operation, use resetToDefaultsSync(). + * + * @throws if options is not an object. + * @see defaults + * @see resetToDefaultsSync + */ + resetToDefaults(options?: ElectronSettings.Options | object): Promise; + + /** + * The synchronous version of resetToDefaults(). + * + * @see resetToDefaults + */ + resetToDefaultsSync(options?: ElectronSettings.Options | object): void; + + /** + * Observes the chosen key path for changes and calls the handler if the value changes. + * Returns an Observer instance which has a dispose method. + * To unsubscribe, simply call dispose() on the returned key path observer. + * + * @param keyPath The path to the key that we wish to observe. + * @param handler The callback that will be invoked if the value at the chosen key path changes. + * @throws if key path is not a string. + * @throws if handler is not a function. + */ + observe(keyPath: string, handler: (evt: ElectronSettings.ChangeEvent) => void): ElectronSettings.Observer; + + /** + * Returns the path to the config file. Typically found in your application's user data directory: + * ~/Library/Application Support/YourApp on MacOS. + * %APPDATA%/YourApp on Windows. + * $XDG_CONFIG_HOME/YourApp or ~/.config/YourApp on Linux. + */ + getSettingsFilePath(): string; + + /** + * Emitted when the settings file has been created. + */ + on(event: 'create', listener: (pathToSettings: string) => void): this; + /** + * Emitted when the settings have been written to disk. + */ + on(event: 'write', listener: () => void): this; +} + +declare const SettingsInstance: Settings; +export = SettingsInstance; + +declare namespace ElectronSettings { + /** + * The Observer class. + */ + class Observer { + /** + * Disposes of the key path observer by unbinding the event listener and + * nullifying all internal references. + */ + dispose(): void; + } + + interface Options extends Pick { } + + namespace Options { + interface _Impl { + /** + * Whether electron-settings should create a tmp file during save to ensure data-write consistency. + * + * @default true + */ + atomicSaving: boolean; + /** + * Prettify the JSON output. + * + * @default false + */ + prettify: boolean; + } + } + + interface ApplyDefaultsOptions extends Pick { } + + namespace ApplyDefaultsOptions { + interface _Impl extends Options._Impl { + /** + * Overwrite pre-existing settings with their respective default values. + * + * @default false + */ + overwrite: boolean; + } + } + + interface ChangeEvent { + oldValue: any; + newValue: any; + } +} diff --git a/types/electron-settings/v2/tsconfig.json b/types/electron-settings/v2/tsconfig.json new file mode 100644 index 0000000000..3a5b7b152c --- /dev/null +++ b/types/electron-settings/v2/tsconfig.json @@ -0,0 +1,27 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "paths": { + "electron-settings": [ + "electron-settings/v2" + ] + }, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "electron-settings-tests.ts" + ] +} diff --git a/types/electron-settings/v2/tslint.json b/types/electron-settings/v2/tslint.json new file mode 100644 index 0000000000..4f44991c3c --- /dev/null +++ b/types/electron-settings/v2/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "no-empty-interface": false + } +} From a6d85e88c12320648588812c2d4bafb3e2e6ffcd Mon Sep 17 00:00:00 2001 From: Montago Date: Thu, 1 Jun 2017 08:38:54 +0200 Subject: [PATCH 0184/1105] add GeoJSONReader defintion (#16808) GeoJSONReader is / was missing from the definition. --- types/jsts/index.d.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/types/jsts/index.d.ts b/types/jsts/index.d.ts index 661a3dd17c..0d7f182e77 100644 --- a/types/jsts/index.d.ts +++ b/types/jsts/index.d.ts @@ -1602,6 +1602,18 @@ declare namespace jsts { } namespace io { + export class GeoJSONReader { + constructor(); + + /** + * Converts a GeoJSON to its Geometry representation. + * + * @param {Object} The GeoJSON representation of the Geometry. + * @return {jsts.geom.Geometry} + * geometry a Geometry to process. + */ + read(geometry: Object): geom.Geometry; + } export class GeoJSONWriter { /** * Writes the GeoJSON representation of a {@link Geometry}. The From d82cb802198eefe80ca4f64330a726909dfc2196 Mon Sep 17 00:00:00 2001 From: makoto abe Date: Thu, 1 Jun 2017 15:39:55 +0900 Subject: [PATCH 0185/1105] Add type definitions for `react-lazyload` package. (#16807) * Add type definitions for `react-lazyload` package. * fix lint error. * fix TypeScript Version --- types/react-lazyload/index.d.ts | 26 +++++++++++++++ types/react-lazyload/react-lazyload-tests.tsx | 32 +++++++++++++++++++ types/react-lazyload/tsconfig.json | 24 ++++++++++++++ types/react-lazyload/tslint.json | 1 + 4 files changed, 83 insertions(+) create mode 100644 types/react-lazyload/index.d.ts create mode 100644 types/react-lazyload/react-lazyload-tests.tsx create mode 100644 types/react-lazyload/tsconfig.json create mode 100644 types/react-lazyload/tslint.json diff --git a/types/react-lazyload/index.d.ts b/types/react-lazyload/index.d.ts new file mode 100644 index 0000000000..fae8d78a83 --- /dev/null +++ b/types/react-lazyload/index.d.ts @@ -0,0 +1,26 @@ +// Type definitions for react-lazyload ver 2.2 +// Project: https://github.com/jasonslyvia/react-lazyload +// Definitions by: m0a +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +import {Component} from 'react'; + +export interface LazyLoadProps { + once?: boolean; + height?: number | string; + offset?: number | string; + overflow?: boolean; + scroll?: boolean; + children?: JSX.Element; + throttle?: number | boolean; + debounce?: number | boolean; + placeholder?: Node; + unmountIfInvisible?: boolean; +} + +export default class LazyLoad extends Component { + constructor(props: LazyLoad); +} + +export function lazyload(option: {}): LazyLoad; diff --git a/types/react-lazyload/react-lazyload-tests.tsx b/types/react-lazyload/react-lazyload-tests.tsx new file mode 100644 index 0000000000..37b928a99c --- /dev/null +++ b/types/react-lazyload/react-lazyload-tests.tsx @@ -0,0 +1,32 @@ +import * as React from "react"; +import LazyLoad from "react-lazyload"; + +interface State { + arr: string[]; +} + +class Normal extends React.Component<{}, State> { + constructor() { + super(); + let arr: string[] = []; + for (let i = 0; i < 200; i++) { + arr.push(`${i}`); + } + this.state = { arr }; + } + render() { + return ( +
+ {this.state.arr.map((el, index) => { + return ( + +

+ count={index + 1} +

+
+ ); + })} +
+ ); + } +} diff --git a/types/react-lazyload/tsconfig.json b/types/react-lazyload/tsconfig.json new file mode 100644 index 0000000000..d77160e99c --- /dev/null +++ b/types/react-lazyload/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react" + }, + "files": [ + "index.d.ts", + "react-lazyload-tests.tsx" + ] +} diff --git a/types/react-lazyload/tslint.json b/types/react-lazyload/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-lazyload/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 225bc1a2e732e497d7223e87c1b0e2a931a6f9a1 Mon Sep 17 00:00:00 2001 From: Jonathan Torley Date: Thu, 1 Jun 2017 17:21:20 +1000 Subject: [PATCH 0186/1105] Added windows as a platform With the use of the react-native-windows library it is possible to write UWP applications, for which the PlatformOS returns 'windows' --- types/react-native/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index 8f0af54667..9d4c8bdf94 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -5307,7 +5307,7 @@ export interface PixelRatioStatic { /** * @see https://facebook.github.io/react-native/docs/platform-specific-code.html#content */ -export type PlatformOSType = 'ios' | 'android' +export type PlatformOSType = 'ios' | 'android' | 'windows' interface PlatformStatic { OS: PlatformOSType From 0ceebb9dd2e45f5cbe7b995d7b2534677b7c899e Mon Sep 17 00:00:00 2001 From: Marc Fallows Date: Thu, 1 Jun 2017 21:51:10 +1000 Subject: [PATCH 0187/1105] react-motion fix merge I believe there was an error when merging: https://github.com/DefinitelyTyped/DefinitelyTyped/commit/b488f3cb5f70ea62c66a3ecaef4e38baadf3727c#diff-3b3fa3639f39b82eca3e15e4ef0f54eeR125 You can see the originally merge PR matches my change: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/9965/files#diff-1ad63a2a56d869f9cc5e998febe8e52eR128 --- types/react-motion/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-motion/index.d.ts b/types/react-motion/index.d.ts index 8254ad78aa..733daa071b 100644 --- a/types/react-motion/index.d.ts +++ b/types/react-motion/index.d.ts @@ -123,7 +123,7 @@ interface TransitionProps { */ willLeave?: (styleThatLeft: TransitionStyle) => Style | void; } -export class TransitionMotion extends Component { } +export class TransitionMotion extends Component { } interface StaggeredMotionProps { From c0b269b6eed1fcb6615e337d6a8511828de2d22e Mon Sep 17 00:00:00 2001 From: Marc Fallows Date: Thu, 1 Jun 2017 22:04:46 +1000 Subject: [PATCH 0188/1105] children optional as per https://github.com/DefinitelyTyped/DefinitelyTyped/pull/9965/files#diff-1ad63a2a56d869f9cc5e998febe8e52eR116 --- types/react-motion/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-motion/index.d.ts b/types/react-motion/index.d.ts index 733daa071b..abdfd27048 100644 --- a/types/react-motion/index.d.ts +++ b/types/react-motion/index.d.ts @@ -111,7 +111,7 @@ interface TransitionProps { * */ styles: Array | InterpolateFunction; - children: (interpolatedStyles: Array) => ReactElement; + children?: (interpolatedStyles: Array) => ReactElement; /** * Triggers when new elements appears * @param styleThatEntered From 644f9e560d3c3c89917fd11740cac3d17732ed5e Mon Sep 17 00:00:00 2001 From: Eric Date: Thu, 1 Jun 2017 14:42:15 +0200 Subject: [PATCH 0189/1105] Update index.d.ts fixed curry right --- types/lodash/index.d.ts | 40 +++++++++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/types/lodash/index.d.ts b/types/lodash/index.d.ts index b8ae248190..198bc528fd 100644 --- a/types/lodash/index.d.ts +++ b/types/lodash/index.d.ts @@ -10331,6 +10331,36 @@ declare namespace _ { (t1: T1, t2: T2, t3: T3, t4: T4): CurriedFunction1; (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5): R; } + interface RightCurriedFunction1{ + ():RightCurriedFunction1 + (t1:T1):R + } + interface RightCurriedFunction2{ + ():RightCurriedFunction2 + (t2:T2):RightCurriedFunction1 + (t1:T1,t2:T2):R + } + interface RightCurriedFunction3{ + ():RightCurriedFunction3 + (t3:T3):RightCurriedFunction2 + (t2:T2,t3:T3):RightCurriedFunction1 + (t1:T1,t2:T2,t3:T3):R + } + interface RightCurriedFunction4{ + ():RightCurriedFunction4 + (t4:T4):RightCurriedFunction3 + (t3:T3,t4:T4):RightCurriedFunction2 + (t2:T2,t3:T3,t4:T4):RightCurriedFunction1 + (t1:T1,t2:T2,t3:T3,t4:T4):R + } + interface RightCurriedFunction5{ + ():RightCurriedFunction5 + (t5:T5):RightCurriedFunction4 + (t4:T4,t5:T5):RightCurriedFunction3 + (t3:T3,t4:T4,t5:T5):RightCurriedFunction2 + (t2:T2,t3:T3,t4:T4,t5:T5):RightCurriedFunction1 + (t1:T1,t2:T2,t3:T3,t4:T4,t5:T5):R + } interface LoDashImplicitObjectWrapper { /** @@ -10348,7 +10378,7 @@ declare namespace _ { * @return Returns the new curried function. */ curryRight(func: (t1: T1) => R): - CurriedFunction1; + RightCurriedFunction1; /** * This method is like _.curry except that arguments are applied to func in the manner of _.partialRight * instead of _.partial. @@ -10356,7 +10386,7 @@ declare namespace _ { * @return Returns the new curried function. */ curryRight(func: (t1: T1, t2: T2) => R): - CurriedFunction2; + RightCurriedFunction2; /** * This method is like _.curry except that arguments are applied to func in the manner of _.partialRight * instead of _.partial. @@ -10364,7 +10394,7 @@ declare namespace _ { * @return Returns the new curried function. */ curryRight(func: (t1: T1, t2: T2, t3: T3) => R): - CurriedFunction3; + RightCurriedFunction3; /** * This method is like _.curry except that arguments are applied to func in the manner of _.partialRight * instead of _.partial. @@ -10372,7 +10402,7 @@ declare namespace _ { * @return Returns the new curried function. */ curryRight(func: (t1: T1, t2: T2, t3: T3, t4: T4) => R): - CurriedFunction4; + RightCurriedFunction4; /** * This method is like _.curry except that arguments are applied to func in the manner of _.partialRight * instead of _.partial. @@ -10380,7 +10410,7 @@ declare namespace _ { * @return Returns the new curried function. */ curryRight(func: (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => R): - CurriedFunction5; + RightCurriedFunction5; /** * This method is like _.curry except that arguments are applied to func in the manner of _.partialRight * instead of _.partial. From 55c559b2ca5afefb97bb42d31295703fe118b8fb Mon Sep 17 00:00:00 2001 From: kkpoon Date: Thu, 1 Jun 2017 21:32:55 +0800 Subject: [PATCH 0190/1105] Fix d3-scale TS2304: Cannot find name 'Range' (#16815) * Fix d3-scale TS2304: Cannot find name 'Range' - fix `range` function in `ScaleIdentity` use generic Range but not declared * fixup! Fix d3-scale TS2304: Cannot find name 'Range' --- types/d3-scale/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/d3-scale/index.d.ts b/types/d3-scale/index.d.ts index 55ec29a89b..38e204a6ea 100644 --- a/types/d3-scale/index.d.ts +++ b/types/d3-scale/index.d.ts @@ -626,7 +626,7 @@ export interface ScaleIdentity { * * @param range Array of range values. */ - range(range: Array): this; + range(range: Array): this; /** * Returns approximately count representative values from the scale’s domain. @@ -1297,7 +1297,7 @@ export interface ScaleQuantile { * * @param domain Array of domain values. */ - domain(domain: Array): this; + domain(domain: Array): this; /** * Returns the current range. From 48c753a7b2737ee18d84e55d33c960f8511247da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iker=20P=C3=A9rez=20Brunelli?= Date: Thu, 1 Jun 2017 15:44:53 +0200 Subject: [PATCH 0191/1105] universal-analytics: Update typings to v0.4.13 (#15672) * Update typings * Add tslint.json * Fix linting errors --- types/universal-analytics/index.d.ts | 262 ++++++++++++------ types/universal-analytics/tslint.json | 3 + .../universal-analytics-tests.ts | 153 +++++----- 3 files changed, 261 insertions(+), 157 deletions(-) create mode 100644 types/universal-analytics/tslint.json diff --git a/types/universal-analytics/index.d.ts b/types/universal-analytics/index.d.ts index 3642d1558d..462348f332 100644 --- a/types/universal-analytics/index.d.ts +++ b/types/universal-analytics/index.d.ts @@ -1,92 +1,182 @@ -// Type definitions for universal-analytics v0.3.2 +// Type definitions for universal-analytics v0.4.13 // Project: https://github.com/peaksandpies/universal-analytics -// Definitions by: Bart van der Schoor +// Definitions by: Bart van der Schoor , Iker Pérez Brunelli // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -interface UniversalAnalytics { - (accountID:string, uuid?:string, opts?:Object):UniversalAnalytics.Client; -} +declare namespace ua { + type Callback = (error: Error | null, count: number) => void; -export = UniversalAnalytics; - -declare namespace UniversalAnalytics { - - interface Client { - debug():UniversalAnalytics.Client; - - send():void; - - pageview(path:string):Client; - pageview(path:string, callback?:(err:any) => void):void; - pageview(params:Object):Client; - pageview(params:Object, callback?:(err:any) => void):void; - pageview(path:string, hostname:string):Client; - pageview(path:string, hostname:string, callback?:(err:any) => void):void; - pageview(path:string, title:string, hostname:string):Client; - pageview(path:string, title:string, hostname:string, callback?:(err:any) => void):void; - - - event(category:string, action:string):Client; - event(category:string, action:string, callback?:(err:any) => void):void; - event(category:string, action:string, label:string):Client; - event(category:string, action:string, label:string, callback?:(err:any) => void):void; - event(category:string, action:string, label:string, value:any):Client; - event(category:string, action:string, label:string, value:any, callback?:(err:any) => void):void; - event(category:string, action:string, label:string, value:any, params:Object, callback?:(err:any) => void):void; - event(params:Object):Client; - event(params:Object, callback:(err:any) => void):void; - - - transaction(id:string):Client; - transaction(id:string, callback:(err:any) => void):void; - transaction(id:string, revenue:number):Client; - transaction(id:string, revenue:number, callback:(err:any) => void):void; - transaction(id:string, revenue:number, shipping:number):Client; - transaction(id:string, revenue:number, shipping:number, callback:(err:any) => void):void; - transaction(id:string, revenue:number, shipping:number, taxping:number):Client; - transaction(id:string, revenue:number, shipping:number, taxping:number, callback:(err:any) => void):void; - transaction(id:string, revenue:number, shipping:number, taxping:number, affiliation:string):Client; - transaction(id:string, revenue:number, shipping:number, taxping:number, affiliation:string, callback:(err:any) => void):void; - transaction(params:Object):Client; - transaction(params:Object, callback:(err:any) => void):void; - - - item(price:number):Client; - item(price:number, callback:(err:any) => void):void; - item(price:number, quantity:number):Client; - item(price:number, quantity:number, callback:(err:any) => void):void; - item(price:number, quantity:number, sku:number):Client; - item(price:number, quantity:number, sku:number, callback:(err:any) => void):void; - item(price:number, quantity:number, sku:number, name:string):Client; - item(price:number, quantity:number, sku:number, name:string, callback:(err:any) => void):void; - item(price:number, quantity:number, sku:number, name:string, variation:string):Client; - item(price:number, quantity:number, sku:number, name:string, variation:string, callback:(err:any) => void):void; - item(price:number, quantity:number, sku:number, name:string, variation:string, params:Object):Client; - item(price:number, quantity:number, sku:number, name:string, variation:string, params:Object, callback:(err:any) => void):void; - item(params:Object):Client; - item(params:Object, callback:(err:any) => void):void; - - - exception(description:string):Client; - exception(description:string, callback:(err:any) => void):void; - exception(description:string, fatal:boolean):Client; - exception(description:string, fatal:boolean, callback:(err:any) => void):void; - exception(params:Object):Client; - exception(params:Object, callback:(err:any) => void):void; - - - timing(category:string):Client; - timing(category:string, callback:(err:any) => void):void; - timing(category:string, variable:string):Client; - timing(category:string, variable:string, callback:(err:any) => void):void; - timing(category:string, variable:string, time:number):Client; - timing(category:string, variable:string, time:number, callback:(err:any) => void):void; - timing(category:string, variable:string, time:number, label:string):Client; - timing(category:string, variable:string, time:number, label:string, callback:(err:any) => void):void; - timing(params:Object):Client; - timing(params:Object, callback:(err:any) => void):void; - - - middleware(accountID:string, options?:any):any; + interface VisitorOptions { + hostname?: string; + path?: string; + https?: boolean; + enableBatching?: boolean; + batchSize?: number; + tid?: string; + cid?: string; + uid?: string; + debug?: boolean; + strictCidFormat?: boolean; + requestOptions?: { [key: string]: any }; + headers?: { [key: string]: string }; } + + interface MiddlewareOptions extends VisitorOptions { + cookieName?: string; + } + + interface PageviewParams { + dp?: string; + dh?: string; + dt?: string; + dl?: string; + [key: string]: any; + } + + interface ScreenviewParams { + cd?: string; + an?: string; + av?: string; + aid?: string; + aiid?: string; + [key: string]: any; + } + + interface EventParams { + ec?: string; + ea?: string; + el?: string; + ev?: string | number; + p?: string; + dp?: string; + [key: string]: any; + } + + interface TransactionParams { + ti?: string; + tr?: string | number; + ts?: string | number; + tt?: string | number; + ta?: string; + p?: string; + [key: string]: any; + } + + interface ItemParams { + ip?: string | number; + iq?: string | number; + ic?: string; + in?: string; + iv?: string; + p?: string; + ti?: string; + [key: string]: any; + } + + interface ExceptionParams { + exd?: string; + exf?: boolean; + [key: string]: any; + } + + interface TimingParams { + utc?: string; + utv?: string; + utt?: string | number; + utl?: string; + [key: string]: any; + } + + interface Session { + cid?: string; + } + + class Visitor { + constructor(accountID: VisitorOptions | string); + constructor(accountID: string, uuid: VisitorOptions | string, context?: { [key: string]: any }, persistentParams?: { [key: string]: any }); + + debug(debug?: boolean): Visitor; + + reset(): Visitor; + + set(key: string | number, value: any): void; + + pageview(path: PageviewParams | string, callback?: Callback): Visitor; + pageview(path: string, hostname: string, callback?: Callback): Visitor; + pageview(path: string, hostname: string, title: string, callback?: Callback): Visitor; + pageview(path: string, hostname: string, title: string, params: PageviewParams, callback?: Callback): Visitor; + + pv(path: PageviewParams | string, callback?: Callback): Visitor; + pv(path: string, hostname: string, callback?: Callback): Visitor; + pv(path: string, hostname: string, title: string, callback?: Callback): Visitor; + pv(path: string, hostname: string, title: string, params: PageviewParams, callback?: Callback): Visitor; + + screenview(params: ScreenviewParams, callback?: Callback): Visitor; + screenview(screenName: string, appName: string, callback?: Callback): Visitor; + screenview(screenName: string, appName: string, appVersion: string, callback?: Callback): Visitor; + screenview(screenName: string, appName: string, appVersion: string, appId: string, callback?: Callback): Visitor; + screenview(screenName: string, appName: string, appVersion: string, appId: string, appInstallerId: string, callback?: Callback): Visitor; + screenview(screenName: string, appName: string, appVersion: string, appId: string, appInstallerId: string, params: ScreenviewParams, callback?: Callback): Visitor; + + event(params: EventParams, callback?: Callback): Visitor; + event(category: string, action: string, callback?: Callback): Visitor; + event(category: string, action: string, label: string, callback?: Callback): Visitor; + event(category: string, action: string, label: string, value: string | number, callback?: Callback): Visitor; + event(category: string, action: string, label: string, value: string | number, params: EventParams, callback?: Callback): Visitor; + + e(params: EventParams, callback?: Callback): Visitor; + e(category: string, action: string, callback?: Callback): Visitor; + e(category: string, action: string, label: string, callback?: Callback): Visitor; + e(category: string, action: string, label: string, value: string | number, callback?: Callback): Visitor; + e(category: string, action: string, label: string, value: string | number, params: EventParams, callback?: Callback): Visitor; + + transaction(id: TransactionParams | string, callback?: Callback): Visitor; + transaction(id: string, revenue: string | number, callback?: Callback): Visitor; + transaction(id: string, revenue: string | number, shipping: string | number, callback?: Callback): Visitor; + transaction(id: string, revenue: string | number, shipping: string | number, tax: string | number, callback?: Callback): Visitor; + transaction(id: string, revenue: string | number, shipping: string | number, tax: string | number, affiliation: string, callback?: Callback): Visitor; + transaction(id: string, revenue: string | number, shipping: string | number, tax: string | number, affiliation: string, params: TransactionParams, callback?: Callback): Visitor; + + t(id: TransactionParams | string, callback?: Callback): Visitor; + t(id: string, revenue: string | number, callback?: Callback): Visitor; + t(id: string, revenue: string | number, shipping: string | number, callback?: Callback): Visitor; + t(id: string, revenue: string | number, shipping: string | number, tax: string | number, callback?: Callback): Visitor; + t(id: string, revenue: string | number, shipping: string | number, tax: string | number, affiliation: string, callback?: Callback): Visitor; + t(id: string, revenue: string | number, shipping: string | number, tax: string | number, affiliation: string, params: TransactionParams, callback?: Callback): Visitor; + + item(price: ItemParams | string | number, callback?: Callback): Visitor; + item(price: string | number, quantity: string | number, callback?: Callback): Visitor; + item(price: string | number, quantity: string | number, sku: string, callback?: Callback): Visitor; + item(price: string | number, quantity: string | number, sku: string, name: string, callback?: Callback): Visitor; + item(price: string | number, quantity: string | number, sku: string, name: string, variation: string, callback?: Callback): Visitor; + item(price: string | number, quantity: string | number, sku: string, name: string, variation: string, params: ItemParams, callback?: Callback): Visitor; + + i(price: ItemParams | string | number, callback?: Callback): Visitor; + i(price: string | number, quantity: string | number, callback?: Callback): Visitor; + i(price: string | number, quantity: string | number, sku: string, callback?: Callback): Visitor; + i(price: string | number, quantity: string | number, sku: string, name: string, callback?: Callback): Visitor; + i(price: string | number, quantity: string | number, sku: string, name: string, variation: string, callback?: Callback): Visitor; + i(price: string | number, quantity: string | number, sku: string, name: string, variation: string, params: ItemParams, callback?: Callback): Visitor; + + exception(description: ExceptionParams | string, callback?: Callback): Visitor; + exception(description: string, fatal: boolean, callback?: Callback): Visitor; + exception(description: string, fatal: boolean, params: ExceptionParams, callback?: Callback): Visitor; + + timing(category: TimingParams | string, callback?: Callback): Visitor; + timing(category: string, variable: string, callback?: Callback): Visitor; + timing(category: string, variable: string, time: string | number, callback?: Callback): Visitor; + timing(category: string, variable: string, time: string | number, label: string, callback?: Callback): Visitor; + timing(category: string, variable: string, time: string | number, label: string, params: TimingParams, callback?: Callback): Visitor; + + send(fn?: (error: any, response: any, body: any) => void): void; + } + + function createFromSession(session?: Session): Visitor; + + function middleware(tid: string, options?: ua.MiddlewareOptions): (req: any, res: any, next: (err: any) => void) => void; } + +declare function ua(accountID: ua.VisitorOptions | string): ua.Visitor; +declare function ua(accountID: string, uuid: ua.VisitorOptions | string): ua.Visitor; +declare function ua(accountID: string, uuid: string, options: ua.VisitorOptions): ua.Visitor; +export = ua; diff --git a/types/universal-analytics/tslint.json b/types/universal-analytics/tslint.json new file mode 100644 index 0000000000..232c31409b --- /dev/null +++ b/types/universal-analytics/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "../tslint.json" +} diff --git a/types/universal-analytics/universal-analytics-tests.ts b/types/universal-analytics/universal-analytics-tests.ts index 1f37e27a66..a81f728179 100644 --- a/types/universal-analytics/universal-analytics-tests.ts +++ b/types/universal-analytics/universal-analytics-tests.ts @@ -1,87 +1,98 @@ -import UniversalAnalytics = require("universal-analytics"); +import * as ua from 'universal-analytics'; -var ui:UniversalAnalytics; +import * as express from 'express'; -var str:string; -var num:number; -var value:any; -var bool:boolean; -var params:Object; -var x:any; +const app = express(); +let visitor = ua('UA-XXXX-XX'); -var client:UniversalAnalytics.Client = ui('UA-123-00'); -client = client.debug(); -client.send(); +visitor = ua('UA-XXXX-XX', '6a14abda-6b12-4578-bf66-43c754eaeda9'); +visitor = ua('UA-XXXX-XX', 'CUSTOM_USERID_1', { strictCidFormat: false }); +visitor = ua('UA-XXXX-XX', { https: true }); -client = client.pageview(str); -client.pageview(str, (err:any) => {}); -client = client.pageview(params); -client.pageview(params, (err:any) => {}); -client = client.pageview(str, str); -client.pageview(str, str, (err:any) => {}); -client = client.pageview(str, str, str); -client.pageview(str, str, str, (err:any) => {}); +visitor.pageview('/', 'http://peaksandpies.com', 'Welcome').send(); +visitor.pageview('/', 'http://peaksandpies.com', 'Welcome', err => { }); +visitor.pageview({ dp: '/', dt: 'Welcome', dh: 'http://peaksandpies.com' }).send(); +visitor.pageview(null, err => { }); +visitor.pv('/', 'http://peaksandpies.com', 'Welcome').send(); +visitor.pv('/', 'http://peaksandpies.com', 'Welcome', err => { }); +visitor.pv({ dp: '/', dt: 'Welcome', dh: 'http://peaksandpies.com' }).send(); +visitor.pv(null, err => { }); -client = client.event(str, str); -client.event(str, str, (err:any) => {}); -client = client.event(str, str, str); -client.event(str, str, str, (err:any) => {}); -client = client.event(str, str, str, value); -client.event(str, str, str, value, (err:any) => {}); -client.event(str, str, str, value, params, (err:any) => {}); -client = client.event(params); -client.event(params, (err:any) => {}); +visitor.screenview('Home Screen', 'App Name').send(); +visitor.screenview('Home Screen', 'App Name', err => { }).send(); +visitor.screenview({ cd: 'Home Screen', an: 'App Name' }).send(); +visitor.screenview(null, err => { }); +visitor.event('Event Category', 'Event Action').send(); +visitor.event('Event Category', 'Event Action', '…and a label', 42).send(); +visitor.event('Event Category', 'Event Action', '…and a label', 42, err => { }); +visitor.event('Event Category', 'Event Action', '…and a label', 42, { p: '/contact' }, err => { }); +visitor.event({ ec: 'Event Category', ea: 'Event Action', el: '…and a label', ev: 42, dp: '/contact' }).send(); +visitor.event('Navigation clicks', null, err => { }); -client = client.transaction(str); -client.transaction(str, (err:any) => {}); -client = client.transaction(str, num); -client.transaction(str, num, (err:any) => {}); -client = client.transaction(str, num, num); -client.transaction(str, num, num, (err:any) => {}); -client = client.transaction(str, num, num, num); -client.transaction(str, num, num, num, (err:any) => {}); -client = client.transaction(str, num, num, num, str); -client.transaction(str, num, num, num, str, (err:any) => {}); -client = client.transaction(params); -client.transaction(params, (err:any) => {}); +visitor.e('Event Category', 'Event Action').send(); +visitor.e('Event Category', 'Event Action', '…and a label', 42).send(); +visitor.e('Event Category', 'Event Action', '…and a label', 42, err => { }); +visitor.e('Event Category', 'Event Action', '…and a label', 42, { p: '/contact' }, err => { }); +visitor.e({ ec: 'Event Category', ea: 'Event Action', el: '…and a label', ev: 42, dp: '/contact' }).send(); +visitor.e('Navigation clicks', null, err => { }); +visitor + .transaction('trans-12345', 500) + .item(300, 1, 'item-54321') + .item(200, 2, 'item-41325') + .send(); -client = client.item(num); -client.item(num, (err:any) => {}); -client = client.item(num, num); -client.item(num, num, (err:any) => {}); -client = client.item(num, num, num); -client.item(num, num, num, (err:any) => {}); -client = client.item(num, num, num, str); -client.item(num, num, num, str, (err:any) => {}); -client = client.item(num, num, num, str, str); -client.item(num, num, num, str, str, (err:any) => {}); -client = client.item(num, num, num, str, str, params); -client.item(num, num, num, str, str, params, (err:any) => {}); -client = client.item(params); -client.item(params, (err:any) => {}); +visitor + .transaction({ ti: 'trans-12345', tr: 500, ts: 50, tt: 100, ta: 'Partner 13' }) + .item({ ip: 300, iq: 1, ic: 'item-54321', in: 'Item 54321', iv: 'Blue' }) + .item({ ip: 200, iq: 2, ic: 'item-41325', in: 'Item 41325', iv: 'XXL' }) + .send(); +visitor + .t('trans-12345', 500) + .i(300, 1, 'item-54321') + .i(200, 2, 'item-41325') + .send(); -client = client.exception(str); -client.exception(str, (err:any) => {}); -client = client.exception(str, bool); -client.exception(str, bool, (err:any) => {}); -client = client.exception(params); -client.exception(params, (err:any) => {}); +visitor + .t({ ti: 'trans-12345', tr: 500, ts: 50, tt: 100, ta: 'Partner 13' }) + .i({ ip: 300, iq: 1, ic: 'item-54321', in: 'Item 54321', iv: 'Blue' }) + .i({ ip: 200, iq: 2, ic: 'item-41325', in: 'Item 41325', iv: 'XXL' }) + .send(); +visitor.transaction(null, err => { }); -client = client.timing(str); -client.timing(str, (err:any) => {}); -client = client.timing(str, str); -client.timing(str, str, (err:any) => {}); -client = client.timing(str, str, num); -client.timing(str, str, num, (err:any) => {}); -client = client.timing(str, str, num, str); -client.timing(str, str, num, str, (err:any) => {}); -client = client.timing(params); -client.timing(params, (err:any) => {}); +visitor.exception('StackOverflow Error').send(); +visitor.exception('StackOverflow Error', true, () => { }); +visitor.timing('User interaction', 'Time to open login overlay', 12547).send(); -x = client.middleware(str, {}); +visitor.transaction('123456', '449.99').send(); +visitor.item(449.99, 1, 'ID54321', 'T-Shirt', 'Blue', { ti: '123456' }).send(); + +visitor.pageview('/').send(); +visitor.pageview('/').pageview('/contact').send(); +visitor.pageview('/landing-page-1').event('Testing', 'Button color', 'Blue').send(); +visitor.pageview('/landing-page-1').send(); +visitor.event('Testing', 'Button color', 'Blue', 42, { p: '/landing-page-1' }).send(); + +visitor + .event({ ec: 'Mail Server', ea: 'New Team Member Notification sent' }) + .event({ ea: 'Invitation sent' }) + .send(); + +visitor.set('uid', '123456789'); + +app.use(ua.middleware('UA-XXXX-Y', { cookieName: '_ga' })); + +ua.createFromSession({ cid: 'some-string' }); + +ua('UA-XXXX-XX').debug(); + +ua('UA-XXXX-XX', { + requestOptions: { + proxy: '…', + }, +}); From 702a5fa4b992cb0475080758c1715531477b761a Mon Sep 17 00:00:00 2001 From: noveyak Date: Thu, 1 Jun 2017 06:56:56 -0700 Subject: [PATCH 0192/1105] Make data texture constructor consistent with other textures (#15928) --- types/three/three-core.d.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/types/three/three-core.d.ts b/types/three/three-core.d.ts index f396e6b2c7..fc04417e7c 100644 --- a/types/three/three-core.d.ts +++ b/types/three/three-core.d.ts @@ -5886,13 +5886,13 @@ export class DataTexture extends Texture { data: ArrayBuffer | Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array, width: number, height: number, - format: PixelFormat, - type: TextureDataType, - mapping: Mapping, - wrapS: Wrapping, - wrapT: Wrapping, - magFilter: TextureFilter, - minFilter: TextureFilter, + format?: PixelFormat, + type?: TextureDataType, + mapping?: Mapping, + wrapS?: Wrapping, + wrapT?: Wrapping, + magFilter?: TextureFilter, + minFilter?: TextureFilter, anisotropy?: number, encoding?: TextureEncoding ); From 5c3422e82d10d60865b9ca8a1050a9d6c1ba463a Mon Sep 17 00:00:00 2001 From: Richard Wilburn Date: Thu, 1 Jun 2017 14:05:09 +0000 Subject: [PATCH 0193/1105] Adding ability to provide own picture for facebook share dialogs (#16059) * Adding ability to provide own picture for facebook share dialogs @types/facebook-js-sdk Adding support for custom thumbnail images for using the facebook share dialog. Facebook will provide default images for your dialog if you don't specify your own. This allows you to override this. It works but it isn't documented under facebook documentation unfortunately. Adding fix for #15908 in the master repo. * Fixing picture property to be optional Fixing picture property to be optional as it may not always be required. --- types/facebook-js-sdk/facebook-js-sdk-tests.ts | 1 + types/facebook-js-sdk/index.d.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/types/facebook-js-sdk/facebook-js-sdk-tests.ts b/types/facebook-js-sdk/facebook-js-sdk-tests.ts index 56fc91cd02..f919e3290f 100644 --- a/types/facebook-js-sdk/facebook-js-sdk-tests.ts +++ b/types/facebook-js-sdk/facebook-js-sdk-tests.ts @@ -107,4 +107,5 @@ FB.ui({ method: 'share', mobile_iframe: true, href: 'https://developers.facebook.com/docs/', + picture: 'https://upload.wikimedia.org/wikipedia/commons/thumb/2/2f/Google_2015_logo.svg/2000px-Google_2015_logo.svg.png', }, response => {}); diff --git a/types/facebook-js-sdk/index.d.ts b/types/facebook-js-sdk/index.d.ts index cb1981580a..300eeb3ec0 100644 --- a/types/facebook-js-sdk/index.d.ts +++ b/types/facebook-js-sdk/index.d.ts @@ -113,6 +113,7 @@ declare namespace facebook { interface ShareDialogParams extends DialogParams { method: 'share'; href: string; + picture?: string; hashtag?: string; quote?: string; mobile_iframe?: boolean; From a713269029018d949de1342499d9833ccba19620 Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Thu, 1 Jun 2017 16:07:07 +0200 Subject: [PATCH 0194/1105] fix(commander): issue with namespace not found (#16060) * fix(commader): issue with namespace not found * remove `new` and add test case * fix typo * add `ExportedCommander` * rename to `StaticCommander` * commander: extend StaticCommander with commander.Command * commander typings re add `new` * commander: change `Option` and `Command` to `classes` * rename `CommanderStatic` * comander: add documentation * remove breakline * chnage `object` to `any` * commander test: add breakline * commander: update `CommanderStatic` to use `typeof` --- types/commander/commander-tests.ts | 11 +- types/commander/index.d.ts | 527 +++++++++++++++-------------- 2 files changed, 276 insertions(+), 262 deletions(-) diff --git a/types/commander/commander-tests.ts b/types/commander/commander-tests.ts index fe09be7b34..259b107bbf 100644 --- a/types/commander/commander-tests.ts +++ b/types/commander/commander-tests.ts @@ -1,5 +1,11 @@ -// NOTE: import statement can not use in TypeScript 1.0.1 -import program = require('commander'); +import * as program from "commander"; + +interface ExtendedOptions extends program.CommandOptions { + isNew: any; +} + +const commandInstance = new program.Command("-f"); +const optionsInstance = new program.Option("-f"); program .version('0.0.1') @@ -54,7 +60,6 @@ console.log(' collect: %j', program['collect']); console.log(' verbosity: %j', program['verbose']); console.log(' args: %j', program['args']); - program .version('0.0.1') .option('-f, --foo', 'enable some foo') diff --git a/types/commander/index.d.ts b/types/commander/index.d.ts index 675ece0417..017495784a 100644 --- a/types/commander/index.d.ts +++ b/types/commander/index.d.ts @@ -5,6 +5,267 @@ /// +declare class Option { + flags: string; + required: boolean; + optional: boolean; + bool: boolean; + short?: string; + long: string; + description: string; + + /** + * Initialize a new `Option` with the given `flags` and `description`. + * + * @param {string} flags + * @param {string} [description] + */ + constructor(flags: string, description?: string); +} + +declare class Command extends NodeJS.EventEmitter { + [key: string]: any; + + args: string[]; + + /** + * Initialize a new `Command`. + * + * @param {string} [name] + */ + constructor(name?: string); + + /** + * Set the program version to `str`. + * + * This method auto-registers the "-V, --version" flag + * which will print the version number when passed. + * + * @param {string} str + * @param {string} [flags] + * @returns {Command} for chaining + */ + version(str: string, flags?: string): Command; + + /** + * Add command `name`. + * + * The `.action()` callback is invoked when the + * command `name` is specified via __ARGV__, + * and the remaining arguments are applied to the + * function for access. + * + * When the `name` is "*" an un-matched command + * will be passed as the first arg, followed by + * the rest of __ARGV__ remaining. + * + * @example + * program + * .version('0.0.1') + * .option('-C, --chdir ', 'change the working directory') + * .option('-c, --config ', 'set config path. defaults to ./deploy.conf') + * .option('-T, --no-tests', 'ignore test hook') + * + * program + * .command('setup') + * .description('run remote setup commands') + * .action(function() { + * console.log('setup'); + * }); + * + * program + * .command('exec ') + * .description('run the given remote command') + * .action(function(cmd) { + * console.log('exec "%s"', cmd); + * }); + * + * program + * .command('teardown [otherDirs...]') + * .description('run teardown commands') + * .action(function(dir, otherDirs) { + * console.log('dir "%s"', dir); + * if (otherDirs) { + * otherDirs.forEach(function (oDir) { + * console.log('dir "%s"', oDir); + * }); + * } + * }); + * + * program + * .command('*') + * .description('deploy the given env') + * .action(function(env) { + * console.log('deploying "%s"', env); + * }); + * + * program.parse(process.argv); + * + * @param {string} name + * @param {string} [desc] for git-style sub-commands + * @param {CommandOptions} [opts] command options + * @returns {Command} the new command + */ + command(name: string, desc?: string, opts?: commander.CommandOptions): Command; + + /** + * Define argument syntax for the top-level command. + * + * @param {string} desc + * @returns {Command} for chaining + */ + arguments(desc: string): Command; + + /** + * Parse expected `args`. + * + * For example `["[type]"]` becomes `[{ required: false, name: 'type' }]`. + * + * @param {string[]} args + * @returns {Command} for chaining + */ + parseExpectedArgs(args: string[]): Command; + /** + * Register callback `fn` for the command. + * + * @example + * program + * .command('help') + * .description('display verbose help') + * .action(function() { + * // output help here + * }); + * + * @param {(...args: any[]) => void} fn + * @returns {Command} for chaining + */ + action(fn: (...args: any[]) => void): Command; + + /** + * Define option with `flags`, `description` and optional + * coercion `fn`. + * + * The `flags` string should contain both the short and long flags, + * separated by comma, a pipe or space. The following are all valid + * all will output this way when `--help` is used. + * + * "-p, --pepper" + * "-p|--pepper" + * "-p --pepper" + * + * @example + * // simple boolean defaulting to false + * program.option('-p, --pepper', 'add pepper'); + * + * --pepper + * program.pepper + * // => Boolean + * + * // simple boolean defaulting to true + * program.option('-C, --no-cheese', 'remove cheese'); + * + * program.cheese + * // => true + * + * --no-cheese + * program.cheese + * // => false + * + * // required argument + * program.option('-C, --chdir ', 'change the working directory'); + * + * --chdir /tmp + * program.chdir + * // => "/tmp" + * + * // optional argument + * program.option('-c, --cheese [type]', 'add cheese [marble]'); + * + * @param {string} flags + * @param {string} [description] + * @param {((arg1: any, arg2: any) => void) | RegExp} [fn] function or default + * @param {*} [defaultValue] + * @returns {Command} for chaining + */ + option(flags: string, description?: string, fn?: ((arg1: any, arg2: any) => void) | RegExp, defaultValue?: any): Command; + option(flags: string, description?: string, defaultValue?: any): Command; + + /** + * Allow unknown options on the command line. + * + * @param {boolean} [arg] if `true` or omitted, no error will be thrown for unknown options. + * @returns {Command} for chaining + */ + allowUnknownOption(arg?: boolean): Command; + + /** + * Parse `argv`, settings options and invoking commands when defined. + * + * @param {string[]} argv + * @returns {Command} for chaining + */ + parse(argv: string[]): Command; + + /** + * Parse options from `argv` returning `argv` void of these options. + * + * @param {string[]} argv + * @returns {ParseOptionsResult} + */ + parseOptions(argv: string[]): commander.ParseOptionsResult; + + /** + * Return an object containing options as key-value pairs + * + * @returns {{[key: string]: string}} + */ + opts(): { [key: string]: string }; + + /** + * Set the description to `str`. + * + * @param {string} str + * @return {(Command | string)} + */ + description(str: string): Command; + description(): string; + + /** + * Set an alias for the command. + * + * @param {string} alias + * @return {(Command | string)} + */ + alias(alias: string): Command; + alias(): string; + + /** + * Set or get the command usage. + * + * @param {string} str + * @return {(Command | string)} + */ + usage(str: string): Command; + usage(): string; + + /** + * Get the name of the command. + * + * @return {string} + */ + name(): string; + + /** + * Output help information for this command. + * + * @param {() => void} [cb] Callback method + */ + outputHelp(cb?: () => void): void; + + /** Output help information and exit. */ + help(): void; +} + declare namespace commander { interface CommandOptions { @@ -17,266 +278,14 @@ declare namespace commander { unknown: string[]; } - class Option { - flags: string; - required: boolean; - optional: boolean; - bool: boolean; - short?: string; - long: string; - description: string; - - /** - * Initialize a new `Option` with the given `flags` and `description`. - * - * @param {string} flags - * @param {string} [description] - */ - constructor(flags: string, description?: string); + interface CommanderStatic extends Command { + Command: typeof Command; + Option: typeof Option; + CommandOptions: CommandOptions; + ParseOptionsResult: ParseOptionsResult; } - class Command extends NodeJS.EventEmitter { - args: string[]; - - /** - * Initialize a new `Command`. - * - * @param {string} [name] - */ - constructor(name?: string); - - /** - * Set the program version to `str`. - * - * This method auto-registers the "-V, --version" flag - * which will print the version number when passed. - * - * @param {string} str - * @param {string} [flags] - * @returns {Command} for chaining - */ - version(str: string, flags?: string): Command; - - /** - * Add command `name`. - * - * The `.action()` callback is invoked when the - * command `name` is specified via __ARGV__, - * and the remaining arguments are applied to the - * function for access. - * - * When the `name` is "*" an un-matched command - * will be passed as the first arg, followed by - * the rest of __ARGV__ remaining. - * - * @example - * program - * .version('0.0.1') - * .option('-C, --chdir ', 'change the working directory') - * .option('-c, --config ', 'set config path. defaults to ./deploy.conf') - * .option('-T, --no-tests', 'ignore test hook') - * - * program - * .command('setup') - * .description('run remote setup commands') - * .action(function() { - * console.log('setup'); - * }); - * - * program - * .command('exec ') - * .description('run the given remote command') - * .action(function(cmd) { - * console.log('exec "%s"', cmd); - * }); - * - * program - * .command('teardown [otherDirs...]') - * .description('run teardown commands') - * .action(function(dir, otherDirs) { - * console.log('dir "%s"', dir); - * if (otherDirs) { - * otherDirs.forEach(function (oDir) { - * console.log('dir "%s"', oDir); - * }); - * } - * }); - * - * program - * .command('*') - * .description('deploy the given env') - * .action(function(env) { - * console.log('deploying "%s"', env); - * }); - * - * program.parse(process.argv); - * - * @param {string} name - * @param {string} [desc] for git-style sub-commands - * @param {CommandOptions} [opts] command options - * @returns {Command} the new command - */ - command(name: string, desc?: string, opts?: CommandOptions): Command; - - - /** - * Define argument syntax for the top-level command. - * - * @param {string} desc - * @returns {Command} for chaining - */ - arguments(desc: string): Command; - - /** - * Parse expected `args`. - * - * For example `["[type]"]` becomes `[{ required: false, name: 'type' }]`. - * - * @param {string[]} args - * @returns {Command} for chaining - */ - parseExpectedArgs(args: string[]): Command; - /** - * Register callback `fn` for the command. - * - * @example - * program - * .command('help') - * .description('display verbose help') - * .action(function() { - * // output help here - * }); - * - * @param {(...args: any[]) => void} fn - * @returns {Command} for chaining - */ - action(fn: (...args: any[]) => void): Command; - - /** - * Define option with `flags`, `description` and optional - * coercion `fn`. - * - * The `flags` string should contain both the short and long flags, - * separated by comma, a pipe or space. The following are all valid - * all will output this way when `--help` is used. - * - * "-p, --pepper" - * "-p|--pepper" - * "-p --pepper" - * - *@example - * // simple boolean defaulting to false - * program.option('-p, --pepper', 'add pepper'); - * - * --pepper - * program.pepper - * // => Boolean - * - * // simple boolean defaulting to true - * program.option('-C, --no-cheese', 'remove cheese'); - * - * program.cheese - * // => true - * - * --no-cheese - * program.cheese - * // => false - * - * // required argument - * program.option('-C, --chdir ', 'change the working directory'); - * - * --chdir /tmp - * program.chdir - * // => "/tmp" - * - * // optional argument - * program.option('-c, --cheese [type]', 'add cheese [marble]'); - * - * @param {string} flags - * @param {string} [description] - * @param {((arg1: any, arg2: any) => void) | RegExp} [fn] function or default - * @param {*} [defaultValue] - * @returns {Command} for chaining - */ - option(flags: string, description?: string, fn?: ((arg1: any, arg2: any) => void) | RegExp, defaultValue?: any): Command; - option(flags: string, description?: string, defaultValue?: any): Command; - - /** - * Allow unknown options on the command line. - * - * @param {boolean} [arg] if `true` or omitted, no error will be thrown for unknown options. - * @returns {Command} for chaining - */ - allowUnknownOption(arg?: boolean): Command; - - /** - * Parse `argv`, settings options and invoking commands when defined. - * - * @param {string[]} argv - * @returns {Command} for chaining - */ - parse(argv: string[]): Command; - - /** - * Parse options from `argv` returning `argv` void of these options. - * - * @param {string[]} argv - * @returns {ParseOptionsResult} - */ - parseOptions(argv: string[]): ParseOptionsResult; - - /** - * Return an object containing options as key-value pairs - * - * @returns {{[key: string]: string}} - */ - opts(): { [key: string]: string }; - - /** - * Set the description to `str`. - * - * @param {string} str - * @return {(Command | string)} - */ - description(str: string): Command; - description(): string; - - /** - * Set an alias for the command. - * - * @param {string} alias - * @return {(Command | string)} - */ - alias(alias: string): Command; - alias(): string; - - /** - * Set or get the command usage. - * - * @param {string} str - * @return {(Command | string)} - */ - usage(str: string): Command; - usage(): string; - - /** - * Get the name of the command. - * - * @return {string} - */ - name(): string; - - /** - * Output help information for this command. - * - * @param {() => void} [cb] Callback method - */ - outputHelp(cb?: () => void): void; - - /** Output help information and exit. */ - help(): void; - } } -declare var command: commander.Command & commander.Option & { [key: string]: any }; -export = command; +declare const commander: commander.CommanderStatic; +export = commander; From a306138098c65bc87e5a0f059cb1b3caf9793ef7 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Thu, 1 Jun 2017 07:09:27 -0700 Subject: [PATCH 0195/1105] Fix lint --- types/loopback/index.d.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/types/loopback/index.d.ts b/types/loopback/index.d.ts index e17b6f368e..e4c31c7f8d 100644 --- a/types/loopback/index.d.ts +++ b/types/loopback/index.d.ts @@ -11,7 +11,7 @@ ************************************************/ import * as core from "express-serve-static-core"; -import {NextFunction} from "../express/index"; +import { NextFunction } from "express"; declare function l(): l.LoopBackApplication; declare namespace l { @@ -894,11 +894,9 @@ declare namespace l { * @param method * @param backback */ - beforeRemote(method: string, callback: (ctx: Context, modelInstanceOrNext: Model - | NextFunction, next?: NextFunction)=>void): void; + beforeRemote(method: string, callback: (ctx: Context, modelInstanceOrNext: Model | NextFunction, next?: NextFunction) => void): void; - afterRemote(method: string, callback: (ctx: Context, modelInstanceOrNext: Model - | NextFunction, next?: NextFunction) => void): void; + afterRemote(method: string, callback: (ctx: Context, modelInstanceOrNext: Model | NextFunction, next?: NextFunction) => void): void; afterRemoteError(method: string, callback: NextFunction): void; } From e00b175536dc5c561b3c2b76ad0267147b390c81 Mon Sep 17 00:00:00 2001 From: Giedrius Grabauskas Date: Thu, 1 Jun 2017 17:12:48 +0300 Subject: [PATCH 0196/1105] Update Undertaker to 1.1 (#16296) * Created tslint.json for undertaker * Updated to 1.1 version. * Fixed contributor link. * flatten contributes' list * Added param array of task in series and parallel methods. * Updated jsdoc comments. * Extended EventEmitter in Undertaker class. Added test for EventEmitter. --- types/undertaker/index.d.ts | 169 +++++++++++++++------------ types/undertaker/tslint.json | 1 + types/undertaker/undertaker-tests.ts | 46 ++++---- 3 files changed, 121 insertions(+), 95 deletions(-) create mode 100644 types/undertaker/tslint.json diff --git a/types/undertaker/index.d.ts b/types/undertaker/index.d.ts index 3c5da5dd99..bcd8b0b885 100644 --- a/types/undertaker/index.d.ts +++ b/types/undertaker/index.d.ts @@ -1,16 +1,67 @@ -// Type definitions for undertaker 0.12.0 +// Type definitions for undertaker 1.1 // Project: https://github.com/phated/undertaker -// Definitions by: Qubo +// Definitions by: Qubo , Giedrius Grabauskas // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +import * as Registry from "undertaker-registry"; +import { Duplex } from "stream"; +import { EventEmitter } from "events"; +declare namespace Undertaker { + interface TaskFunctionParams { + name?: string; + displayName?: string; + } -export interface UndertakerStatic { - new (registry?: Registry): Undertaker; + interface TaskFunction extends TaskFunctionParams { + (done?: (error?: any) => void): void | Duplex | NodeJS.Process | Promise | any; + } + + type Task = string | TaskFunction; + + interface TreeOptions { + /** + * Whether or not the whole tree should be returned. + * Default: false + */ + deep?: boolean; + } + + interface TreeResult { + label: "Tasks"; + nodes: Node[]; + } + + interface Node { + label: string; + nodes: Node[]; + type?: string; + branch?: boolean; + } } -export interface Undertaker { - task: TaskMethod; +declare class Undertaker extends EventEmitter { + constructor(registry?: Registry); + + /** + * Returns the registered function. + * @param {string} taskName - Task name. + */ + task(taskName: string): Undertaker.TaskFunction; + + /** + * Register the task by the taskName. + * @param {string} taskName - Task name. + * @param {TaskFunction} fn - Task function. + */ + task(taskName: string, fn: Undertaker.TaskFunction): void; + + /** + * Register the task by the name property of the function. + * @param {TaskFunction} fn - Task function. + */ + task(fn: Undertaker.TaskFunction): void; + /** * Takes a variable amount of strings (taskName) and/or functions (fn) * and returns a function of the composed tasks or functions. @@ -18,9 +69,21 @@ export interface Undertaker { * * When the returned function is executed, the tasks or functions will be executed in series, * each waiting for the prior to finish. If an error occurs, execution will stop. - * @param task + * @param {...Undertaker.Task[]} tasks - List of tasks. */ - series(...tasks: (string | Task)[]): Task; + series(...tasks: Undertaker.Task[]): Undertaker.TaskFunction; + + /** + * Takes a variable amount of strings (taskName) and/or functions (fn) + * and returns a function of the composed tasks or functions. + * Any taskNames are retrieved from the registry using the get method. + * + * When the returned function is executed, the tasks or functions will be executed in series, + * each waiting for the prior to finish. If an error occurs, execution will stop. + * @param {Undertaker.Task[]} tasks - List of tasks. + */ + series(tasks: Undertaker.Task[]): Undertaker.TaskFunction; + /** * Takes a variable amount of strings (taskName) and/or functions (fn) * and returns a function of the composed tasks or functions. @@ -28,88 +91,46 @@ export interface Undertaker { * * When the returned function is executed, the tasks or functions will be executed in parallel, * all being executed at the same time. If an error occurs, all execution will complete. - * @param tasks + * @param {...Undertaker.Task[]} tasks - list of tasks. */ - parallel(...tasks: (string | Task)[]): Task; + parallel(...tasks: Undertaker.Task[]): Undertaker.TaskFunction; + + /** + * Takes a variable amount of strings (taskName) and/or functions (fn) + * and returns a function of the composed tasks or functions. + * Any taskNames are retrieved from the registry using the get method. + * + * When the returned function is executed, the tasks or functions will be executed in parallel, + * all being executed at the same time. If an error occurs, all execution will complete. + * @param {Undertaker.Task[]} tasks - list of tasks. + */ + parallel(tasks: Undertaker.Task[]): Undertaker.TaskFunction; + /** * Returns the current registry object. */ registry(): Registry; + /** * The tasks from the current registry will be transferred to it * and the current registry will be replaced with the new registry. - * @param registry + * @param {Registry} registry - Instance of registry. */ registry(registry: Registry): void; + /** * Optionally takes an object (options) and returns an object representing the tree of registered tasks. - * @param options + * @param {Undertaker.TreeOptions} options - Tree options. */ - tree(options?: { deep?: boolean }): Node[] | string[]; + tree(options?: Undertaker.TreeOptions): Undertaker.TreeResult; + /** * Takes a string or function (task) and returns a timestamp of the last time the task was run successfully. * The time will be the time the task started. Returns undefined if the task has not been run. - * @param task - * @param timeResolution + * @param {Undertaker.Task} task - Task. + * @param {number} [timeResolution] - Time resolution. */ - lastRun(task: string, timeResolution?: number): number; + lastRun(task: Undertaker.Task, timeResolution?: number): number; } -export interface Task { - (cb?: Function): any; -} - -export interface TaskMethod { - /** - * Returns the registered function. - * @param taskName - */ - (taskName: string): Task; - /** - * Register the task by the taskName. - * @param taskName - * @param fn - */ - (taskName: string, fn: Task): void; - /** - * Register the task by the name property of the function. - * @param fn - */ - (fn: Task): void; - /** - * Register the task by the displayName property of the function. - * @param fn - */ - (fn: Task & { displayName: string }): void; -} - -export interface Registry { - /** - * receives the undertaker instance to set pre-defined tasks using the task(taskName, fn) method. - * @param taker - */ - init(taker: Undertaker): void; - /** - * returns the task with that name or undefined if no task is registered with that name. - * @param taskName - */ - get(taskName: string): Task; - /** - * add task to the registry. If set modifies a task, it should return the new task. - * @param taskName - * @param fn - */ - set(taskName: string, fn: Task): void; - /** - * returns an object listing all tasks in the registry. - */ - tasks(): { [taskName: string]: Task }; -} - -export interface Node { - label: string; - type: string; - nodes: Node[]; -} - -export default UndertakerStatic; +export = Undertaker; diff --git a/types/undertaker/tslint.json b/types/undertaker/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/undertaker/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/undertaker/undertaker-tests.ts b/types/undertaker/undertaker-tests.ts index c8dc8dd4f5..c7969a3c52 100644 --- a/types/undertaker/undertaker-tests.ts +++ b/types/undertaker/undertaker-tests.ts @@ -1,43 +1,47 @@ - /// +import * as fs from "fs"; +import * as Undertaker from "undertaker"; +import * as Registry from "undertaker-registry"; -var fs = require('fs'); -var Undertaker = require('undertaker'); -import { Registry } from 'undertaker'; +const taker = new Undertaker(); -var taker = new Undertaker(); - -taker.task('task1', function(cb: () => void){ +taker.task("task1", (cb: () => void) => { // do things - cb(); // when everything is done }); -taker.task('task2', function(){ - return fs.createReadStream('./myFile.js') - .pipe(fs.createWriteStream('./myFile.copy.js')); +taker.task("task2", () => { + return fs.createReadStream("./myFile.js") + .pipe(fs.createWriteStream("./myFile.copy.js")); }); -taker.task('task3', function(){ - return new Promise(function(resolve, reject){ +taker.task("task3", () => { + return new Promise((resolve, reject) => { // do things - resolve(); // when everything is done }); }); -taker.task('combined', taker.series('task1', 'task2')); +taker.task("combined", taker.series("task1", "task2")); -taker.task('all', taker.parallel('combined', 'task3')); +taker.task("all", taker.parallel("combined", "task3")); -var registry: Registry; -function CommonRegistry(options: { buildDir: string }): Registry { +taker.task("all-parallel-array", taker.parallel(["combined", "task3"])); + +taker.task("all-series-array", taker.series(["combined", "task3"])); + +const registry = new Registry(); +const CommonRegistry = (options: { buildDir: string }): Registry => { return registry; -} +}; -var taker = new Undertaker(CommonRegistry({ buildDir: '/dist' })); +const taker2 = new Undertaker(CommonRegistry({ buildDir: "/dist" })); -taker.task('build', taker.series('clean', function build(cb: () => void) { +taker2.task("build", taker2.series("clean", (cb: () => void) => { // do things cb(); })); + +taker2.addListener("event", () => { + // Checking for extended EventEmitter +}); From ee4176f232b4d0bac2b5598feda5dde5c5207778 Mon Sep 17 00:00:00 2001 From: Xiadong Zhu Date: Thu, 1 Jun 2017 22:17:43 +0800 Subject: [PATCH 0197/1105] Extend VerifyClientCallbackAsync to support code and message fields when reject (#16145) --- types/ws/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/ws/index.d.ts b/types/ws/index.d.ts index 9fce6f9dc3..ac78738a0f 100644 --- a/types/ws/index.d.ts +++ b/types/ws/index.d.ts @@ -83,7 +83,7 @@ declare namespace WebSocket { type VerifyClientCallbackSync = (info: { origin: string; secure: boolean; req: http.IncomingMessage }) => boolean; type VerifyClientCallbackAsync = (info: { origin: string; secure: boolean; req: http.IncomingMessage } - , callback: (res: boolean) => void) => void; + , callback: (res: boolean, code?: number, message?: string) => void) => void; export interface IClientOptions { protocol?: string; From c9925f3be5584ebcbd30d52d502a9535e9032145 Mon Sep 17 00:00:00 2001 From: Keith Dahlby Date: Thu, 1 Jun 2017 09:21:53 -0500 Subject: [PATCH 0198/1105] FullCalendar: Callback Fixes (#16184) * FullCalendar render callbacks use JQuery element * FullCalendar: selectHelper is boolean only since 2.1.0 https://github.com/fullcalendar/fullcalendar/releases/tag/v2.1.0 --- types/fullcalendar/fullcalendar-tests.ts | 6 +++--- types/fullcalendar/index.d.ts | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/types/fullcalendar/fullcalendar-tests.ts b/types/fullcalendar/fullcalendar-tests.ts index ca456013af..1e9e241ce8 100644 --- a/types/fullcalendar/fullcalendar-tests.ts +++ b/types/fullcalendar/fullcalendar-tests.ts @@ -625,8 +625,8 @@ $('#calendar').fullCalendar({ interface EventWithDescription extends FullCalendar.EventObject { description: string; } -interface JQuery { - qtip: any; // dummy plugin interface +interface JQueryQTip extends JQuery { + qtip(options: Object): JQuery; // dummy plugin interface } $('#calendar').fullCalendar({ @@ -638,7 +638,7 @@ $('#calendar').fullCalendar({ } // more events here ], - eventRender(event: EventWithDescription, element: any, view: any) { + eventRender(event: EventWithDescription, element: JQueryQTip, view: FullCalendar.ViewObject) { element.qtip({ content: event.description }); diff --git a/types/fullcalendar/index.d.ts b/types/fullcalendar/index.d.ts index 2fedd216c6..05ac6076e6 100644 --- a/types/fullcalendar/index.d.ts +++ b/types/fullcalendar/index.d.ts @@ -57,7 +57,7 @@ export interface Options extends AgendaOptions, EventDraggingResizingOptions, Dr views?: ViewSpecificOptions; viewRender?(view: ViewObject, element: JQuery): void; viewDestroy?(view: ViewObject, element: JQuery): void; - dayRender?(date: Date, cell: HTMLTableDataCellElement): void; + dayRender?(date: Date, cell: JQuery): void; windowResize?(view: ViewObject): void; // Timezone @@ -130,8 +130,8 @@ export interface Options extends AgendaOptions, EventDraggingResizingOptions, Dr eventBackgroundColor?: string; eventBorderColor?: string; eventTextColor?: string; - eventRender?(event: EventObject, element: HTMLDivElement, view: ViewObject): void; - eventAfterRender?(event: EventObject, element: HTMLDivElement, view: ViewObject): void; + eventRender?(event: EventObject, element: JQuery, view: ViewObject): void; + eventAfterRender?(event: EventObject, element: JQuery, view: ViewObject): void; eventAfterAllRender?(view: ViewObject): void; eventDestroy?(event: EventObject, element: JQuery, view: ViewObject): void; @@ -184,7 +184,7 @@ export interface EventDraggingResizingOptions { */ export interface SelectionOptions { selectable?: boolean; - selectHelper?: boolean | ((start: moment.Moment, end: moment.Moment) => HTMLElement); + selectHelper?: boolean; unselectAuto?: boolean; unselectCancel?: string; selectOverlap?: boolean | ((event: EventObject) => boolean); From 8f7d2171e948ac56c565b03b48c1725e9aaff28f Mon Sep 17 00:00:00 2001 From: Michael Haan Date: Thu, 1 Jun 2017 07:22:23 -0700 Subject: [PATCH 0199/1105] kafka-node: add "client: Client" to HighLevelConsumer (#16188) * added client to ConsumerGroup * added client to HighLevelConsumer (CG inherits from) --- types/kafka-node/index.d.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/types/kafka-node/index.d.ts b/types/kafka-node/index.d.ts index 7523f88c6f..46de85286d 100644 --- a/types/kafka-node/index.d.ts +++ b/types/kafka-node/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for kafka-node 1.3.3 // Project: https://github.com/SOHU-Co/kafka-node/ -// Definitions by: Daniel Imrie-Situnayake , Bill +// Definitions by: Daniel Imrie-Situnayake , Bill , Michael Haan // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -33,6 +33,7 @@ export declare class HighLevelProducer { export declare class Consumer { constructor(client: Client, fetchRequests: Array, options: ConsumerOptions); + client: Client; on(eventName: string, cb: (message: string) => any): void; on(eventName: string, cb: (error: any) => any): void; addTopics(topics: Array, cb: (error: any, added: boolean) => any): void; @@ -49,6 +50,7 @@ export declare class Consumer { export declare class HighLevelConsumer { constructor(client: Client, payloads: Array, options: ConsumerOptions); + client: Client; on(eventName: string, cb: (message: string) => any): void; on(eventName: string, cb: (error: any) => any): void; addTopics(topics: Array, cb: (error: any, added: boolean) => any): void; @@ -146,7 +148,7 @@ export interface ConsumerGroupOptions { retries?: number; retryFactor?: number; retryMinTimeout?: number; - connectOnReady?: boolean; + connectOnReady?: boolean; } export interface Topic { From d317d338f71d646e098c00157c59edddaae06167 Mon Sep 17 00:00:00 2001 From: Ragg Date: Thu, 1 Jun 2017 23:25:26 +0900 Subject: [PATCH 0200/1105] Fix failed lint --- types/koa-generic-session/index.d.ts | 1 + types/koa-generic-session/koa-generic-session-tests.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/types/koa-generic-session/index.d.ts b/types/koa-generic-session/index.d.ts index d5a616b248..0a80131d93 100644 --- a/types/koa-generic-session/index.d.ts +++ b/types/koa-generic-session/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/koajs/generic-session // Definitions by: Nick Simmons , Ragg // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version:2.3 import * as Koa from "koa"; diff --git a/types/koa-generic-session/koa-generic-session-tests.ts b/types/koa-generic-session/koa-generic-session-tests.ts index a00e7f5384..e9a4f94232 100644 --- a/types/koa-generic-session/koa-generic-session-tests.ts +++ b/types/koa-generic-session/koa-generic-session-tests.ts @@ -40,7 +40,7 @@ app.use((context: Koa.Context) => { context.regenerateSession(); context.sessionSave = true; context.session.cookie; - context.session.key = 'value'; + context.session['key'] = 'value'; context.session = null; }); From 68221a8e5c52eab3f90b0758d28021261cb161c8 Mon Sep 17 00:00:00 2001 From: Travis Schettler Date: Thu, 1 Jun 2017 09:39:56 -0500 Subject: [PATCH 0201/1105] Fixed breeze DataType and DataTypeSymbol (#16210) --- types/breeze/breeze-tests.ts | 5 +++ types/breeze/index.d.ts | 62 +++++++++++++++++++++--------------- 2 files changed, 41 insertions(+), 26 deletions(-) diff --git a/types/breeze/breeze-tests.ts b/types/breeze/breeze-tests.ts index 17653706ad..7f46780828 100644 --- a/types/breeze/breeze-tests.ts +++ b/types/breeze/breeze-tests.ts @@ -7,6 +7,11 @@ function test_dataType() { var typ = breeze.DataType.DateTime; var nm = typ.getName(); var dv = typ.defaultValue; + var isDate = typ.isDate; + var isFloat = typ.isFloat; + var isInteger = typ.isInteger; + var isNumeric = typ.isNumeric; + var qjod = typ.quoteJsonOData; var symbs = breeze.DataType.getSymbols(); var x = typ.parentEnum === breeze.DataType; var isFalse = breeze.DataType.contains(breeze.DataType.Double); diff --git a/types/breeze/index.d.ts b/types/breeze/index.d.ts index 323e9a8f87..bfd3479d3c 100644 --- a/types/breeze/index.d.ts +++ b/types/breeze/index.d.ts @@ -16,7 +16,7 @@ // Updated Jul 15 2016 - Added methods to JsonResultsAdapter - Steve Schmitt // Updated Sep 23 2016 - Added core methods // Updated March 5 2017 - Eliminate promises.IPromise and replace with Promise - +// Updated Apr 28 2017 - Fixed DataType declare namespace breeze.core { export interface ErrorCallback { @@ -266,9 +266,33 @@ declare namespace breeze { export class DataTypeSymbol extends breeze.core.EnumSymbol { defaultValue: any; - isNumeric: boolean; - isDate: boolean; + isDate?: boolean; + isFloat?: boolean; + isInteger?: boolean; + isNumeric?: boolean; + quoteJsonOData?: boolean; + + validatorCtor: (context: any) => Validator; + + /** Function to convert a value from string to this DataType. Note that this will be called each time a property is changed, so make it fast. */ + parse?: (val: any, sourceTypeName?: string) => any; + + /** Function to format this DataType for OData queries. */ + fmtOData: (val: any) => any; + + /** Optional function to get the next value for key generation, if this datatype is used as a key. Uses an internal table of previous values. */ + getNext?: () => any; + + /** Optional function to normalize a data value for comparison, if its value cannot be used directly. Note that this will be called each time a property is changed, so make it fast. */ + normalize?: (val: any) => any; + + /** Optional function to get the next value when the datatype is used as a concurrency property. */ + getConcurrencyValue?: (val: any) => any; + + /** Optional function to convert a raw (server) value from string to this DataType. */ + parseRawValue?: (val: any) => any; } + export interface DataType extends breeze.core.IEnum { Binary: DataTypeSymbol; Boolean: DataTypeSymbol; @@ -285,30 +309,16 @@ declare namespace breeze { String: DataTypeSymbol; Time: DataTypeSymbol; Undefined: DataTypeSymbol; - - toDataType(typeName: string): DataTypeSymbol; + + constants: { nextNumber: number, nextNumberIncrement: number, stringPrefix: string }; + + fromEdmDataType(typeName: string): DataTypeSymbol; + fromValue(val: any): DataTypeSymbol; + getComparableFn(dataType: DataTypeSymbol): (value: any) => any; + parseDateAsUTC(source: any): Date; parseDateFromServer(date: any): Date; - defaultValue: any; - isNumeric: boolean; - isInteger: boolean; - - /** Function to convert a value from string to this DataType. Note that this will be called each time a property is changed, so make it fast. */ - parse: (val: any, sourceTypeName: string) => any; - - /** Function to format this DataType for OData queries. */ - fmtOData: (val: any) => any; - - /** Optional function to get the next value for key generation, if this datatype is used as a key. Uses an internal table of previous values. */ - getNext?: () => any; - - /** Optional function to normalize a data value for comparison, if its value cannot be used directly. Note that this will be called each time a property is changed, so make it fast. */ - normalize?: (val: any) => any; - - /** Optional function to get the next value when the datatype is used as a concurrency property. */ - getConcurrencyValue?: (val: any) => any; - - /** Optional function to convert a raw (server) value from string to this DataType. */ - parseRawValue?: (val: any) => any; + parseRawValue(val: any, dataType?: DataTypeSymbol): any; + parseTimeFromServer(source: any): string; } export var DataType: DataType; From 7437e70f27945ba6697656a7200bcc4f81fa30f4 Mon Sep 17 00:00:00 2001 From: Blake Embrey Date: Thu, 1 Jun 2017 10:41:59 -0400 Subject: [PATCH 0202/1105] Import `redis` definitions from @types (#16215) --- types/redis/index.d.ts | 1838 +++++++++++++++++++++++------------- types/redis/redis-tests.ts | 12 +- 2 files changed, 1207 insertions(+), 643 deletions(-) diff --git a/types/redis/index.d.ts b/types/redis/index.d.ts index c20e4f1277..8ce138cd95 100644 --- a/types/redis/index.d.ts +++ b/types/redis/index.d.ts @@ -1,37 +1,14 @@ -// Type definitions for redis 0.12.2 +// Type definitions for redis 2.6.0 // Project: https://github.com/mranney/node_redis // Definitions by: Carlos Ballesteros Velasco , Peter Harris , TANAKA Koichi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// Imported from: https://github.com/soywiz/typescript-node-definitions/redis.d.ts +// Imported from: https://github.com/types/npm-redis /// -export declare function createClient(port_arg: number, host_arg?: string, options?: ClientOpts): RedisClient; -export declare function createClient(unix_socket: string, options?: ClientOpts): RedisClient; -export declare function createClient(options?: ClientOpts): RedisClient; - -export declare function print(err: Error, reply: any): void; - -export declare var debug_mode: boolean; - -export interface MessageHandler { - (channel: string, message: M): void; -} - -export interface CommandT { //This is a placeholder to be used eventually, to not have to define each command twice, or four times if all caps versions are to be implemented. - (args: any[], callback?: ResCallbackT): void; - (...args: any[]): void; -} - -export interface ResCallbackT { - (err: Error, res: R): void; -} - -export interface ServerInfo { - redis_version: string; - versions: number[]; -} +import { EventEmitter } from 'events'; +import { Duplex } from 'stream'; export interface RetryStrategyOptions { error: Error; @@ -45,641 +22,1228 @@ export interface RetryStrategy { } export interface ClientOpts { - auth_pass?: string; - command_queue_high_water?: number; - command_queue_low_water?: number; - connect_timeout?: number; - db?: string; - detect_buffers?: boolean; - disable_resubscribing?: boolean; - enable_offline_queue?: boolean; - family?: string; host?: string; - max_attempts?: number; - no_ready_check?: boolean; - parser?: string; - password?: string; - path?: string; port?: number; - prefix?: string; - rename_commands?: any; - retry_max_delay?: number; - retry_strategy?: RetryStrategy; - retry_unfulfilled_commands?: boolean; - return_buffers?: boolean; - socket_keepalive?: boolean; - socket_nodelay?: boolean; - string_numbers?: boolean; - tls?: any; + path?: string; url?: string; + parser?: string; + string_numbers?: boolean; + return_buffers?: boolean; + detect_buffers?: boolean; + socket_keepalive?: boolean; + no_ready_check?: boolean; + enable_offline_queue?: boolean; + retry_max_delay?: number; + connect_timeout?: number; + max_attempts?: number; + retry_unfulfilled_commands?: boolean; + auth_pass?: string; + password?: string; + db?: string; + family?: string; + rename_commands?: { [command: string]: string }; + tls?: any; + prefix?: string; + retry_strategy?: RetryStrategy; } -export interface RedisClient extends NodeJS.EventEmitter { - // event: connect - // event: error - // event: message - // event: pmessage - // event: subscribe - // event: psubscribe - // event: unsubscribe - // event: punsubscribe +export interface Callback { + (err: Error | null, reply: T): void; +} +export interface ServerInfo { + redis_version: string; + versions: number[]; +} + +export interface OverloadedCommand { + (args: T[], cb?: Callback): R; + (arg: T, args: T[], cb?: Callback): R; + + (arg1: T, arg2: T, arg3: T, arg4: T, arg5: T, arg6: T, cb?: Callback): R; + (arg1: T, arg2: T, arg3: T, arg4: T, arg5: T, cb?: Callback): R; + (arg1: T, arg2: T, arg3: T, arg4: T, cb?: Callback): R; + (arg1: T, arg2: T, arg3: T, cb?: Callback): R; + (arg1: T, arg2: T, cb?: Callback): R; + (arg1: T, cb?: Callback): R; + (...args: (T | Callback)[]): R; +} + +export interface OverloadedKeyCommand { + (key: string, args: T[], cb?: Callback): R; + + (key: string, arg1: T, arg2: T, arg3: T, arg4: T, arg5: T, arg6: T, cb?: Callback): R; + (key: string, arg1: T, arg2: T, arg3: T, arg4: T, arg5: T, cb?: Callback): R; + (key: string, arg1: T, arg2: T, arg3: T, arg4: T, cb?: Callback): R; + (key: string, arg1: T, arg2: T, arg3: T, cb?: Callback): R; + (key: string, arg1: T, arg2: T, cb?: Callback): R; + (key: string, arg1: T, cb?: Callback): R; + (key: string, ...args: (T | Callback)[]): R; + (...args: (string | T | Callback)[]): R; +} + +export interface OverloadedListCommand { + (args: T[], cb?: Callback): R; + + (arg1: T, arg2: T, arg3: T, arg4: T, arg5: T, arg6: T, cb?: Callback): R; + (arg1: T, arg2: T, arg3: T, arg4: T, arg5: T, cb?: Callback): R; + (arg1: T, arg2: T, arg3: T, arg4: T, cb?: Callback): R; + (arg1: T, arg2: T, arg3: T, cb?: Callback): R; + (arg1: T, arg2: T, cb?: Callback): R; + (arg1: T, cb?: Callback): R; + (...args: (T | Callback)[]): R; +} + +export interface OverloadedSetCommand { + (key: string, args: { [key: string]: T } | T[], cb?: Callback): R; + + (key: string, arg1: T, arg2: T, arg3: T, arg4: T, arg5: T, arg6: T, cb?: Callback): R; + (key: string, arg1: T, arg2: T, arg3: T, arg4: T, arg5: T, cb?: Callback): R; + (key: string, arg1: T, arg2: T, arg3: T, arg4: T, cb?: Callback): R; + (key: string, arg1: T, arg2: T, arg3: T, cb?: Callback): R; + (key: string, arg1: T, arg2: T, cb?: Callback): R; + (key: string, arg1: T, cb?: Callback): R; + (key: string, ...args: (T | Callback)[]): R; +} + +export interface OverloadedLastCommand { + (args: (T1 | T2)[], cb?: Callback): R; + (arg: T1, args: (T1 | T2)[], cb?: Callback): R; + + (arg1: T1, arg2: T1, arg3: T1, arg4: T1, arg5: T1, arg6: T2, cb?: Callback): R; + (arg1: T1, arg2: T1, arg3: T1, arg4: T1, arg5: T2, cb?: Callback): R; + (arg1: T1, arg2: T1, arg3: T1, arg4: T2, cb?: Callback): R; + (arg1: T1, arg2: T1, arg3: T2, cb?: Callback): R; + (arg1: T1, arg2: T2, cb?: Callback): R; + (...args: (T1 | T2 | Callback)[]): R; +} + +export interface Commands { + /** + * Listen for all requests received by the server in real time. + */ + monitor(cb?: Callback): R; + MONITOR(cb?: Callback): R; + + /** + * Get information and statistics about the server. + */ + info(cb?: Callback): R; + info(section?: string | string[], cb?: Callback): R; + INFO(cb?: Callback): R; + INFO(section?: string | string[], cb?: Callback): R; + + /** + * Ping the server. + */ + ping(callback?: Callback): R; + ping(message: string, callback?: Callback): R; + + /** + * Post a message to a channel. + */ + publish(channel: string, value: string, cb?: Callback): R; + + /** + * Authenticate to the server. + */ + auth(password: string, callback?: Callback): R; + AUTH(password: string, callback?: Callback): R; + + /** + * KILL - Kill the connection of a client. + * LIST - Get the list of client connections. + * GETNAME - Get the current connection name. + * PAUSE - Stop processing commands from clients for some time. + * REPLY - Instruct the server whether to reply to commands. + * SETNAME - Set the current connection name. + */ + client: OverloadedCommand; + CLIENT: OverloadedCommand; + + /** + * Set multiple hash fields to multiple values. + */ + hmset: OverloadedSetCommand; + HMSET: OverloadedSetCommand; + + /** + * Listen for messages published to the given channels. + */ + subscribe: OverloadedListCommand; + SUBSCRIBE: OverloadedListCommand; + + /** + * Stop listening for messages posted to the given channels. + */ + unsubscribe: OverloadedListCommand; + UNSUBSCRIBE: OverloadedListCommand; + + /** + * Listen for messages published to channels matching the given patterns. + */ + psubscribe: OverloadedListCommand; + PSUBSCRIBE: OverloadedListCommand; + + /** + * Stop listening for messages posted to channels matching the given patterns. + */ + punsubscribe: OverloadedListCommand; + PUNSUBSCRIBE: OverloadedListCommand; + + /** + * Append a value to a key. + */ + append(key: string, value: string, cb?: Callback): R; + APPEND(key: string, value: string, cb?: Callback): R; + + /** + * Asynchronously rewrite the append-only file. + */ + bgrewriteaof(cb?: Callback<'OK'>): R; + BGREWRITEAOF(cb?: Callback<'OK'>): R; + + /** + * Asynchronously save the dataset to disk. + */ + bgsave(cb?: Callback): R; + BGSAVE(cb?: Callback): R; + + /** + * Count set bits in a string. + */ + bitcount(key: string, cb?: Callback): R; + bitcount(key: string, start: number, end: number, cb?: Callback): R; + BITCOUNT(key: string, cb?: Callback): R; + BITCOUNT(key: string, start: number, end: number, cb?: Callback): R; + + /** + * Perform arbitrary bitfield integer operations on strings. + */ + bitfield: OverloadedKeyCommand; + BITFIELD: OverloadedKeyCommand; + + /** + * Perform bitwise operations between strings. + */ + bitop(operation: string, destkey: string, key1: string, key2: string, key3: string, cb?: Callback): R; + bitop(operation: string, destkey: string, key1: string, key2: string, cb?: Callback): R; + bitop(operation: string, destkey: string, key: string, cb?: Callback): R; + bitop(operation: string, destkey: string, ...args: (string | Callback)[]): R; + BITOP(operation: string, destkey: string, key1: string, key2: string, key3: string, cb?: Callback): R; + BITOP(operation: string, destkey: string, key1: string, key2: string, cb?: Callback): R; + BITOP(operation: string, destkey: string, key: string, cb?: Callback): R; + BITOP(operation: string, destkey: string, ...args: (string | Callback)[]): R; + + /** + * Find first bit set or clear in a string. + */ + bitpos(key: string, bit: number, start: number, end: number, cb?: Callback): R; + bitpos(key: string, bit: number, start: number, cb?: Callback): R; + bitpos(key: string, bit: number, cb?: Callback): R; + BITPOS(key: string, bit: number, start: number, end: number, cb?: Callback): R; + BITPOS(key: string, bit: number, start: number, cb?: Callback): R; + BITPOS(key: string, bit: number, cb?: Callback): R; + + /** + * Remove and get the first element in a list, or block until one is available. + */ + blpop: OverloadedLastCommand; + BLPOP: OverloadedLastCommand; + + /** + * Remove and get the last element in a list, or block until one is available. + */ + brpop: OverloadedLastCommand; + BRPOP: OverloadedLastCommand; + + /** + * Pop a value from a list, push it to another list and return it; or block until one is available. + */ + brpoplpush(source: string, destination: string, timeout: number, cb?: Callback<[string, string]>): R; + BRPOPLPUSH(source: string, destination: string, timeout: number, cb?: Callback<[string, string]>): R; + + /** + * ADDSLOTS - Assign new hash slots to receiving node. + * COUNT-FAILURE-REPORTS - Return the number of failure reports active for a given node. + * COUNTKEYSINSLOT - Return the number of local keys in the specified hash slot. + * DELSLOTS - Set hash slots as unbound in receiving node. + * FAILOVER - Forces a slave to perform a manual failover of its master. + * FORGET - Remove a node from the nodes table. + * GETKEYSINSLOT - Return local key names in the specified hash slot. + * INFO - Provides info about Redis Cluster node state. + * KEYSLOT - Returns the hash slot of the specified key. + * MEET - Force a node cluster to handshake with another node. + * NODES - Get cluster config for the node. + * REPLICATE - Reconfigure a node as a slave of the specified master node. + * RESET - Reset a Redis Cluster node. + * SAVECONFIG - Forces the node to save cluster state on disk. + * SET-CONFIG-EPOCH - Set the configuration epoch in a new node. + * SETSLOT - Bind a hash slot to a specified node. + * SLAVES - List slave nodes of the specified master node. + * SLOTS - Get array of Cluster slot to node mappings. + */ + cluster: OverloadedCommand; + CLUSTER: OverloadedCommand; + + /** + * Get array of Redis command details. + * + * COUNT - Get total number of Redis commands. + * GETKEYS - Extract keys given a full Redis command. + * INFO - Get array of specific REdis command details. + */ + command(cb?: Callback>): R; + COMMAND(cb?: Callback>): R; + + /** + * Get array of Redis command details. + * + * COUNT - Get array of Redis command details. + * GETKEYS - Extract keys given a full Redis command. + * INFO - Get array of specific Redis command details. + * GET - Get the value of a configuration parameter. + * REWRITE - Rewrite the configuration file with the in memory configuration. + * SET - Set a configuration parameter to the given value. + * RESETSTAT - Reset the stats returned by INFO. + */ + config: OverloadedCommand; + CONFIG: OverloadedCommand; + + /** + * Return the number of keys in the selected database. + */ + dbsize(cb?: Callback): R; + DBSIZE(cb?: Callback): R; + + /** + * OBJECT - Get debugging information about a key. + * SEGFAULT - Make the server crash. + */ + debug: OverloadedCommand; + DEBUG: OverloadedCommand; + + /** + * Decrement the integer value of a key by one. + */ + decr(key: string, cb?: Callback): R; + DECR(key: string, cb?: Callback): R; + + /** + * Decrement the integer value of a key by the given number. + */ + decrby(key: string, decrement: number, cb?: Callback): R; + DECRBY(key: string, decrement: number, cb?: Callback): R; + + /** + * Delete a key. + */ + del: OverloadedCommand; + DEL: OverloadedCommand; + + /** + * Discard all commands issued after MULTI. + */ + discard(cb?: Callback<'OK'>): R; + DISCARD(cb?: Callback<'OK'>): R; + + /** + * Return a serialized version of the value stored at the specified key. + */ + dump(key: string, cb?: Callback): R; + DUMP(key: string, cb?: Callback): R; + + /** + * Echo the given string. + */ + echo(message: T, cb?: Callback): R; + ECHO(message: T, cb?: Callback): R; + + /** + * Execute a Lua script server side. + */ + eval: OverloadedCommand; + EVAL: OverloadedCommand; + + /** + * Execute a Lue script server side. + */ + evalsha: OverloadedCommand; + EVALSHA: OverloadedCommand; + + /** + * Determine if a key exists. + */ + exists: OverloadedCommand; + EXISTS: OverloadedCommand; + + /** + * Set a key's time to live in seconds. + */ + expire(key: string, seconds: number, cb?: Callback): R; + EXPIRE(key: string, seconds: number, cb?: Callback): R; + + /** + * Set the expiration for a key as a UNIX timestamp. + */ + expireat(key: string, timestamp: number, cb?: Callback): R; + EXPIREAT(key: string, timestamp: number, cb?: Callback): R; + + /** + * Remove all keys from all databases. + */ + flushall(cb?: Callback): R; + FLUSHALL(cb?: Callback): R; + + /** + * Remove all keys from the current database. + */ + flushdb(cb?: Callback): R; + FLUSHDB(cb?: Callback): R; + + /** + * Add one or more geospatial items in the geospatial index represented using a sorted set. + */ + geoadd: OverloadedKeyCommand; + GEOADD: OverloadedKeyCommand; + + /** + * Returns members of a geospatial index as standard geohash strings. + */ + geohash: OverloadedKeyCommand; + GEOHASH: OverloadedKeyCommand; + + /** + * Returns longitude and latitude of members of a geospatial index. + */ + geopos: OverloadedKeyCommand, R>; + GEOPOS: OverloadedKeyCommand, R>; + + /** + * Returns the distance between two members of a geospatial index. + */ + geodist: OverloadedKeyCommand; + GEODIST: OverloadedKeyCommand; + + /** + * Query a sorted set representing a geospatial index to fetch members matching a given maximum distance from a point. + */ + georadius: OverloadedKeyCommand, R>; + GEORADIUS: OverloadedKeyCommand, R>; + + /** + * Query a sorted set representing a geospatial index to fetch members matching a given maximum distance from a member. + */ + georadiusbymember: OverloadedKeyCommand, R>; + GEORADIUSBYMEMBER: OverloadedKeyCommand, R>; + + /** + * Get the value of a key. + */ + get(key: string, cb?: Callback): R; + GET(key: string, cb?: Callback): R; + + /** + * Returns the bit value at offset in the string value stored at key. + */ + getbit(key: string, offset: number, cb?: Callback): R; + GETBIT(key: string, offset: number, cb?: Callback): R; + + /** + * Get a substring of the string stored at a key. + */ + getrange(key: string, start: number, end: number, cb?: Callback): R; + GETRANGE(key: string, start: number, end: number, cb?: Callback): R; + + /** + * Set the string value of a key and return its old value. + */ + getset(key: string, value: string, cb?: Callback): R; + GETSET(key: string, value: string, cb?: Callback): R; + + /** + * Delete on or more hash fields. + */ + hdel: OverloadedKeyCommand; + HDEL: OverloadedKeyCommand; + + /** + * Determine if a hash field exists. + */ + hexists(key: string, field: string, cb?: Callback): R; + HEXISTS(key: string, field: string, cb?: Callback): R; + + /** + * Get the value of a hash field. + */ + hget(key: string, field: string, cb?: Callback): R; + HGET(key: string, field: string, cb?: Callback): R; + + /** + * Get all fields and values in a hash. + */ + hgetall(key: string, cb: Callback<{ [key: string]: string }>): R; + HGETALL(key: string, cb: Callback<{ [key: string]: string }>): R; + + /** + * Increment the integer value of a hash field by the given number. + */ + hincrby(key: string, field: string, increment: number, cb?: Callback): R; + HINCRBY(key: string, field: string, increment: number, cb?: Callback): R; + + /** + * Increment the float value of a hash field by the given amount. + */ + hincrbyfloat(key: string, field: string, increment: number, cb?: Callback): R; + HINCRBYFLOAT(key: string, field: string, increment: number, cb?: Callback): R; + + /** + * Get all the fields of a hash. + */ + hkeys(key: string, cb?: Callback): R; + HKEYS(key: string, cb?: Callback): R; + + /** + * Get the number of fields in a hash. + */ + hlen(key: string, cb?: Callback): R; + HLEN(key: string, cb?: Callback): R; + + /** + * Get the values of all the given hash fields. + */ + hmget: OverloadedKeyCommand; + HMGET: OverloadedKeyCommand; + + /** + * Set the string value of a hash field. + */ + hset(key: string, field: string, value: string, cb?: Callback): R; + HSET(key: string, field: string, value: string, cb?: Callback): R; + + /** + * Set the value of a hash field, only if the field does not exist. + */ + hsetnx(key: string, field: string, value: string, cb?: Callback): R; + HSETNX(key: string, field: string, value: string, cb?: Callback): R; + + /** + * Get the length of the value of a hash field. + */ + hstrlen(key: string, field: string, cb?: Callback): R; + HSTRLEN(key: string, field: string, cb?: Callback): R; + + /** + * Get all the values of a hash. + */ + hvals(key: string, cb?: Callback): R; + HVALS(key: string, cb?: Callback): R; + + /** + * Increment the integer value of a key by one. + */ + incr(key: string, cb?: Callback): R; + INCR(key: string, cb?: Callback): R; + + /** + * Increment the integer value of a key by the given amount. + */ + incrby(key: string, increment: number, cb?: Callback): R; + INCRBY(key: string, increment: number, cb?: Callback): R; + + /** + * Increment the float value of a key by the given amount. + */ + incrbyfloat(key: string, increment: number, cb?: Callback): R; + INCRBYFLOAT(key: string, increment: number, cb?: Callback): R; + + /** + * Find all keys matching the given pattern. + */ + keys(pattern: string, cb?: Callback): R; + KEYS(pattern: string, cb?: Callback): R; + + /** + * Get the UNIX time stamp of the last successful save to disk. + */ + lastsave(cb?: Callback): R; + LASTSAVE(cb?: Callback): R; + + /** + * Get an element from a list by its index. + */ + lindex(key: string, index: number, cb?: Callback): R; + LINDEX(key: string, index: number, cb?: Callback): R; + + /** + * Insert an element before or after another element in a list. + */ + linsert(key: string, dir: 'BEFORE' | 'AFTER', pivot: string, value: string, cb?: Callback): R; + LINSERT(key: string, dir: 'BEFORE' | 'AFTER', pivot: string, value: string, cb?: Callback): R; + + /** + * Get the length of a list. + */ + llen(key: string, cb?: Callback): R; + LLEN(key: string, cb?: Callback): R; + + /** + * Remove and get the first element in a list. + */ + lpop(key: string, cb?: Callback): R; + LPOP(key: string, cb?: Callback): R; + + /** + * Prepend one or multiple values to a list. + */ + lpush: OverloadedKeyCommand; + LPUSH: OverloadedKeyCommand; + + /** + * Prepend a value to a list, only if the list exists. + */ + lpushx(key: string, value: string, cb?: Callback): R; + LPUSHX(key: string, value: string, cb?: Callback): R; + + /** + * Get a range of elements from a list. + */ + lrange(key: string, start: number, stop: number, cb?: Callback): R; + LRANGE(key: string, start: number, stop: number, cb?: Callback): R; + + /** + * Remove elements from a list. + */ + lrem(key: string, count: number, value: string, cb?: Callback): R; + LREM(key: string, count: number, value: string, cb?: Callback): R; + + /** + * Set the value of an element in a list by its index. + */ + lset(key: string, index: number, value: string, cb?: Callback<'OK'>): R; + LSET(key: string, index: number, value: string, cb?: Callback<'OK'>): R; + + /** + * Trim a list to the specified range. + */ + ltrim(key: string, start: number, stop: number, cb?: Callback<'OK'>): R; + LTRIM(key: string, start: number, stop: number, cb?: Callback<'OK'>): R; + + /** + * Get the values of all given keys. + */ + mget: OverloadedCommand; + MGET: OverloadedCommand; + + /** + * Atomically tranfer a key from a Redis instance to another one. + */ + migrate: OverloadedCommand; + MIGRATE: OverloadedCommand; + + /** + * Move a key to another database. + */ + move(key: string, db: string | number): R; + MOVE(key: string, db: string | number): R; + + /** + * Set multiple keys to multiple values. + */ + mset: OverloadedCommand; + MSET: OverloadedCommand; + + /** + * Set multiple keys to multiple values, only if none of the keys exist. + */ + msetnx: OverloadedCommand; + MSETNX: OverloadedCommand; + + /** + * Inspect the internals of Redis objects. + */ + object: OverloadedCommand; + OBJECT: OverloadedCommand; + + /** + * Remove the expiration from a key. + */ + persist(key: string, cb?: Callback): R; + PERSIST(key: string, cb?: Callback): R; + + /** + * Remove a key's time to live in milliseconds. + */ + pexpire(key: string, milliseconds: number, cb?: Callback): R; + PEXPIRE(key: string, milliseconds: number, cb?: Callback): R; + + /** + * Set the expiration for a key as a UNIX timestamp specified in milliseconds. + */ + pexpireat(key: string, millisecondsTimestamp: number, cb?: Callback): R; + PEXPIREAT(key: string, millisecondsTimestamp: number, cb?: Callback): R; + + /** + * Adds the specified elements to the specified HyperLogLog. + */ + pfadd: OverloadedKeyCommand; + PFADD: OverloadedKeyCommand; + + /** + * Return the approximated cardinality of the set(s) observed by the HyperLogLog at key(s). + */ + pfcount: OverloadedCommand; + PFCOUNT: OverloadedCommand; + + /** + * Merge N different HyperLogLogs into a single one. + */ + pfmerge: OverloadedCommand; + PFMERGE: OverloadedCommand; + + /** + * Set the value and expiration in milliseconds of a key. + */ + psetex(key: string, milliseconds: number, value: string, cb?: Callback<'OK'>): R; + PSETEX(key: string, milliseconds: number, value: string, cb?: Callback<'OK'>): R; + + /** + * Inspect the state of the Pub/Sub subsytem. + */ + pubsub: OverloadedCommand; + PUBSUB: OverloadedCommand; + + /** + * Get the time to live for a key in milliseconds. + */ + pttl(key: string, cb?: Callback): R; + PTTL(key: string, cb?: Callback): R; + + /** + * Close the connection. + */ + quit(cb?: Callback<'OK'>): R; + QUIT(cb?: Callback<'OK'>): R; + + /** + * Return a random key from the keyspace. + */ + randomkey(cb?: Callback): R; + RANDOMKEY(cb?: Callback): R; + + /** + * Enables read queries for a connection to a cluster slave node. + */ + readonly(cb?: Callback): R; + READONLY(cb?: Callback): R; + + /** + * Disables read queries for a connection to cluster slave node. + */ + readwrite(cb?: Callback): R; + READWRITE(cb?: Callback): R; + + /** + * Rename a key. + */ + rename(key: string, newkey: string, cb?: Callback<'OK'>): R; + RENAME(key: string, newkey: string, cb?: Callback<'OK'>): R; + + /** + * Rename a key, only if the new key does not exist. + */ + renamenx(key: string, newkey: string, cb?: Callback): R; + RENAMENX(key: string, newkey: string, cb?: Callback): R; + + /** + * Create a key using the provided serialized value, previously obtained using DUMP. + */ + restore(key: string, ttl: number, serializedValue: string, cb?: Callback<'OK'>): R; + RESTORE(key: string, ttl: number, serializedValue: string, cb?: Callback<'OK'>): R; + + /** + * Return the role of the instance in the context of replication. + */ + role(cb?: Callback<[string, number, Array<[string, string, string]>]>): R; + ROLE(cb?: Callback<[string, number, Array<[string, string, string]>]>): R; + + /** + * Remove and get the last element in a list. + */ + rpop(key: string, cb?: Callback): R; + RPOP(key: string, cb?: Callback): R; + + /** + * Remove the last element in a list, prepend it to another list and return it. + */ + rpoplpush(source: string, destination: string, cb?: Callback): R; + RPOPLPUSH(source: string, destination: string, cb?: Callback): R; + + /** + * Append one or multiple values to a list. + */ + rpush: OverloadedKeyCommand; + RPUSH: OverloadedKeyCommand; + + /** + * Append a value to a list, only if the list exists. + */ + rpushx(key: string, value: string, cb?: Callback): R; + RPUSHX(key: string, value: string, cb?: Callback): R; + + /** + * Append one or multiple members to a set. + */ + sadd: OverloadedKeyCommand; + SADD: OverloadedKeyCommand; + + /** + * Synchronously save the dataset to disk. + */ + save(cb?: Callback): R; + SAVE(cb?: Callback): R; + + /** + * Get the number of members in a set. + */ + scard(key: string, cb?: Callback): R; + SCARD(key: string, cb?: Callback): R; + + /** + * DEBUG - Set the debug mode for executed scripts. + * EXISTS - Check existence of scripts in the script cache. + * FLUSH - Remove all scripts from the script cache. + * KILL - Kill the script currently in execution. + * LOAD - Load the specified Lua script into the script cache. + */ + script: OverloadedCommand; + SCRIPT: OverloadedCommand; + + /** + * Subtract multiple sets. + */ + sdiff: OverloadedCommand; + SDIFF: OverloadedCommand; + + /** + * Subtract multiple sets and store the resulting set in a key. + */ + sdiffstore: OverloadedKeyCommand; + SDIFFSTORE: OverloadedKeyCommand; + + /** + * Change the selected database for the current connection. + */ + select(index: number | string, cb?: Callback): R; + SELECT(index: number | string, cb?: Callback): R; + + /** + * Set the string value of a key. + */ + set(key: string, value: string, cb?: Callback<'OK'>): R; + set(key: string, value: string, flag: string, cb?: Callback<'OK'>): R; + set(key: string, value: string, mode: string, duration: number, cb?: Callback<'OK' | undefined>): R; + set(key: string, value: string, mode: string, duration: number, flag: string, cb?: Callback<'OK' | undefined>): R; + SET(key: string, value: string, cb?: Callback<'OK'>): R; + SET(key: string, value: string, flag: string, cb?: Callback<'OK'>): R; + SET(key: string, value: string, mode: string, duration: number, cb?: Callback<'OK' | undefined>): R; + SET(key: string, value: string, mode: string, duration: number, flag: string, cb?: Callback<'OK' | undefined>): R; + + /** + * Sets or clears the bit at offset in the string value stored at key. + */ + setbit(key: string, offset: number, value: string, cb?: Callback): R; + SETBIT(key: string, offset: number, value: string, cb?: Callback): R; + + /** + * Set the value and expiration of a key. + */ + setex(key: string, seconds: number, value: string, cb?: Callback): R; + SETEX(key: string, seconds: number, value: string, cb?: Callback): R; + + /** + * Set the value of a key, only if the key does not exist. + */ + setnx(key: string, value: string, cb?: Callback): R; + SETNX(key: string, value: string, cb?: Callback): R; + + /** + * Overwrite part of a string at key starting at the specified offset. + */ + setrange(key: string, offset: number, value: string, cb?: Callback): R; + SETRANGE(key: string, offset: number, value: string, cb?: Callback): R; + + /** + * Synchronously save the dataset to disk and then shut down the server. + */ + shutdown: OverloadedCommand; + SHUTDOWN: OverloadedCommand; + + /** + * Intersect multiple sets. + */ + sinter: OverloadedKeyCommand; + SINTER: OverloadedKeyCommand; + + /** + * Intersect multiple sets and store the resulting set in a key. + */ + sinterstore: OverloadedCommand; + SINTERSTORE: OverloadedCommand; + + /** + * Determine if a given value is a member of a set. + */ + sismember(key: string, member: string, cb?: Callback): R; + SISMEMBER(key: string, member: string, cb?: Callback): R; + + /** + * Make the server a slave of another instance, or promote it as master. + */ + slaveof(host: string, port: string | number, cb?: Callback): R; + SLAVEOF(host: string, port: string | number, cb?: Callback): R; + + /** + * Manages the Redis slow queries log. + */ + slowlog: OverloadedCommand, R>; + SLOWLOG: OverloadedCommand, R>; + + /** + * Get all the members in a set. + */ + smembers(key: string, cb?: Callback): R; + SMEMBERS(key: string, cb?: Callback): R; + + /** + * Move a member from one set to another. + */ + smove(source: string, destination: string, member: string, cb?: Callback): R; + SMOVE(source: string, destination: string, member: string, cb?: Callback): R; + + /** + * Sort the elements in a list, set or sorted set. + */ + sort: OverloadedCommand; + SORT: OverloadedCommand; + + /** + * Remove and return one or multiple random members from a set. + */ + spop(key: string, cb?: Callback): R; + spop(key: string, count: number, cb?: Callback): R; + SPOP(key: string, cb?: Callback): R; + SPOP(key: string, count: number, cb?: Callback): R; + + /** + * Get one or multiple random members from a set. + */ + srandmember(key: string, cb?: Callback): R; + srandmember(key: string, count: number, cb?: Callback): R; + SRANDMEMBER(key: string, cb?: Callback): R; + SRANDMEMBER(key: string, count: number, cb?: Callback): R; + + /** + * Remove one or more members from a set. + */ + srem: OverloadedKeyCommand; + SREM: OverloadedKeyCommand; + + /** + * Get the length of the value stored in a key. + */ + strlen(key: string, cb?: Callback): R; + STRLEN(key: string, cb?: Callback): R; + + /** + * Add multiple sets. + */ + sunion: OverloadedCommand; + SUNION: OverloadedCommand; + + /** + * Add multiple sets and store the resulting set in a key. + */ + sunionstore: OverloadedCommand; + SUNIONSTORE: OverloadedCommand; + + /** + * Internal command used for replication. + */ + sync(cb?: Callback): R; + SYNC(cb?: Callback): R; + + /** + * Return the current server time. + */ + time(cb?: Callback<[string, string]>): R; + TIME(cb?: Callback<[string, string]>): R; + + /** + * Get the time to live for a key. + */ + ttl(key: string, cb?: Callback): R; + TTL(key: string, cb?: Callback): R; + + /** + * Determine the type stored at key. + */ + type(key: string, cb?: Callback): R; + TYPE(key: string, cb?: Callback): R; + + /** + * Forget about all watched keys. + */ + unwatch(cb?: Callback<'OK'>): R; + UNWATCH(cb?: Callback<'OK'>): R; + + /** + * Wait for the synchronous replication of all the write commands sent in the context of the current connection. + */ + wait(numslaves: number, timeout: number, cb?: Callback): R; + WAIT(numslaves: number, timeout: number, cb?: Callback): R; + + /** + * Watch the given keys to determine execution of the MULTI/EXEC block. + */ + watch: OverloadedCommand; + WATCH: OverloadedCommand; + + /** + * Add one or more members to a sorted set, or update its score if it already exists. + */ + zadd: OverloadedKeyCommand; + ZADD: OverloadedKeyCommand; + + /** + * Get the number of members in a sorted set. + */ + zcard(key: string, cb?: Callback): R; + ZCARD(key: string, cb?: Callback): R; + + /** + * Count the members in a sorted set with scores between the given values. + */ + zcount(key: string, min: number | string, max: number | string, cb?: Callback): R; + ZCOUNT(key: string, min: number | string, max: number | string, cb?: Callback): R; + + /** + * Increment the score of a member in a sorted set. + */ + zincrby(key: string, increment: number, member: string, cb?: Callback): R; + ZINCRBY(key: string, increment: number, member: string, cb?: Callback): R; + + /** + * Intersect multiple sorted sets and store the resulting sorted set in a new key. + */ + zinterstore: OverloadedCommand; + ZINTERSTORE: OverloadedCommand; + + /** + * Count the number of members in a sorted set between a given lexicographic range. + */ + zlexcount(key: string, min: string, max: string, cb?: Callback): R; + ZLEXCOUNT(key: string, min: string, max: string, cb?: Callback): R; + + /** + * Return a range of members in a sorted set, by index. + */ + zrange(key: string, start: number, stop: number, cb?: Callback): R; + zrange(key: string, start: number, stop: number, withscores: string, cb?: Callback): R; + ZRANGE(key: string, start: number, stop: number, cb?: Callback): R; + ZRANGE(key: string, start: number, stop: number, withscores: string, cb?: Callback): R; + + /** + * Return a range of members in a sorted set, by lexicographical range. + */ + zrangebylex(key: string, min: string, max: string, cb?: Callback): R; + zrangebylex(key: string, min: string, max: string, limit: string, offset: number, count: number, cb?: Callback): R; + ZRANGEBYLEX(key: string, min: string, max: string, cb?: Callback): R; + ZRANGEBYLEX(key: string, min: string, max: string, limit: string, offset: number, count: number, cb?: Callback): R; + + /** + * Return a range of members in a sorted set, by lexicographical range, ordered from higher to lower strings. + */ + zrevrangebylex(key: string, min: string, max: string, cb?: Callback): R; + zrevrangebylex(key: string, min: string, max: string, limit: string, offset: number, count: number, cb?: Callback): R; + ZREVRANGEBYLEX(key: string, min: string, max: string, cb?: Callback): R; + ZREVRANGEBYLEX(key: string, min: string, max: string, limit: string, offset: number, count: number, cb?: Callback): R; + + /** + * Return a range of members in a sorted set, by score. + */ + zrangebyscore(key: string, min: number | string, max: number | string, cb?: Callback): R; + zrangebyscore(key: string, min: number | string, max: number | string, withscores: string, cb?: Callback): R; + zrangebyscore(key: string, min: number | string, max: number | string, limit: string, offset: number, count: number, cb?: Callback): R; + zrangebyscore(key: string, min: number | string, max: number | string, withscores: string, limit: string, offset: number, count: number, cb?: Callback): R; + ZRANGEBYSCORE(key: string, min: number | string, max: number | string, cb?: Callback): R; + ZRANGEBYSCORE(key: string, min: number | string, max: number | string, withscores: string, cb?: Callback): R; + ZRANGEBYSCORE(key: string, min: number | string, max: number | string, limit: string, offset: number, count: number, cb?: Callback): R; + ZRANGEBYSCORE(key: string, min: number | string, max: number | string, withscores: string, limit: string, offset: number, count: number, cb?: Callback): R; + + /** + * Determine the index of a member in a sorted set. + */ + zrank(key: string, member: string, cb?: Callback): R; + ZRANK(key: string, member: string, cb?: Callback): R; + + /** + * Remove one or more members from a sorted set. + */ + zrem: OverloadedKeyCommand; + ZREM: OverloadedKeyCommand; + + /** + * Remove all members in a sorted set between the given lexicographical range. + */ + zremrangebylex(key: string, min: string, max: string, cb?: Callback): R; + ZREMRANGEBYLEX(key: string, min: string, max: string, cb?: Callback): R; + + /** + * Remove all members in a sorted set within the given indexes. + */ + zremrangebyrank(key: string, start: number, stop: number, cb?: Callback): R; + ZREMRANGEBYRANK(key: string, start: number, stop: number, cb?: Callback): R; + + /** + * Remove all members in a sorted set within the given indexes. + */ + zremrangebyscore(key: string, min: string | number, max: string | number, cb?: Callback): R; + ZREMRANGEBYSCORE(key: string, min: string | number, max: string | number, cb?: Callback): R; + + /** + * Return a range of members in a sorted set, by index, with scores ordered from high to low. + */ + zrevrange(key: string, start: number, stop: number, cb?: Callback): R; + zrevrange(key: string, start: number, stop: number, withscores: string, cb?: Callback): R; + ZREVRANGE(key: string, start: number, stop: number, cb?: Callback): R; + ZREVRANGE(key: string, start: number, stop: number, withscores: string, cb?: Callback): R; + + /** + * Return a range of members in a sorted set, by score, with scores ordered from high to low. + */ + zrevrangebyscore(key: string, min: number | string, max: number | string, cb?: Callback): R; + zrevrangebyscore(key: string, min: number | string, max: number | string, withscores: string, cb?: Callback): R; + zrevrangebyscore(key: string, min: number | string, max: number | string, limit: string, offset: number, count: number, cb?: Callback): R; + zrevrangebyscore(key: string, min: number | string, max: number | string, withscores: string, limit: string, offset: number, count: number, cb?: Callback): R; + ZREVRANGEBYSCORE(key: string, min: number | string, max: number | string, cb?: Callback): R; + ZREVRANGEBYSCORE(key: string, min: number | string, max: number | string, withscores: string, cb?: Callback): R; + ZREVRANGEBYSCORE(key: string, min: number | string, max: number | string, limit: string, offset: number, count: number, cb?: Callback): R; + ZREVRANGEBYSCORE(key: string, min: number | string, max: number | string, withscores: string, limit: string, offset: number, count: number, cb?: Callback): R; + + /** + * Determine the index of a member in a sorted set, with scores ordered from high to low. + */ + zrevrank(key: string, member: string, cb?: Callback): R; + ZREVRANK(key: string, member: string, cb?: Callback): R; + + /** + * Get the score associated with the given member in a sorted set. + */ + zscore(key: string, member: string, cb?: Callback): R; + ZSCORE(key: string, member: string, cb?: Callback): R; + + /** + * Add multiple sorted sets and store the resulting sorted set in a new key. + */ + zunionstore: OverloadedCommand; + ZUNIONSTORE: OverloadedCommand; + + /** + * Incrementally iterate the keys space. + */ + scan: OverloadedCommand; + SCAN: OverloadedCommand; + + /** + * Incrementally iterate Set elements. + */ + sscan: OverloadedKeyCommand; + SSCAN: OverloadedKeyCommand; + + /** + * Incrementally iterate hash fields and associated values. + */ + hscan: OverloadedKeyCommand; + HSCAN: OverloadedKeyCommand; + + /** + * Incrementally iterate sorted sets elements and associated scores. + */ + zscan: OverloadedKeyCommand; + ZSCAN: OverloadedKeyCommand; +} + +export const RedisClient: { + new (options: ClientOpts): RedisClient; +}; + +export interface RedisClient extends Commands, EventEmitter { connected: boolean; + command_queue_length: number; + offline_queue_length: number; retry_delay: number; retry_backoff: number; command_queue: any[]; offline_queue: any[]; + connection_id: number; server_info: ServerInfo; + stream: Duplex; + + on(event: 'message', listener: (channel: string, message: string) => void): this; + on(event: 'pmessage', listener: (pattern: string, channel: string, message: string) => void): this; + on(event: 'message_buffer', listener: (channel: string, message: string) => void): this; + on(event: 'pmessage_buffer', listener: (pattern: string, channel: string, message: string) => void): this; + on(event: 'subscribe', listener: (channel: string, count: number) => void): this; + on(event: 'psubscribe', listener: (pattern: string, count: number) => void): this; + on(event: 'unsubscribe', listener: (channel: string, count: number) => void): this; + on(event: 'punsubscribe', listener: (pattern: string, count: number) => void): this; + on(event: string, listener: (...args: any[]) => void): this; /** - * Forcibly close the connection to the Redis server. Note that this does not wait until all replies have been parsed. If you want to exit cleanly, call client.quit() - * - * @param {boolean} flush You should set flush to true, if you are not absolutely sure you do not care about any other commands. If you set flush to false all still running commands will silently fail. + * Client methods. */ - end(flush: boolean): void; + + end(flush?: boolean): void; unref(): void; - /** - * Stop sending commands and queue the commands. - */ cork(): void; - - /** - * Resume and send the queued commands at once. - */ uncork(): void; - // Low level command execution - send_command(command: string, ...args: any[]): boolean; + duplicate(options?: ClientOpts, cb?: Callback): RedisClient; - // Connection (http://redis.io/commands#connection) - auth(password: string, callback?: ResCallbackT): boolean; - ping(callback?: ResCallbackT): boolean; + sendCommand(command: string, cb?: Callback): boolean; + sendCommand(command: string, args?: any[], cb?: Callback): boolean; + send_command(command: string, cb?: Callback): boolean; + send_command(command: string, args?: any[], cb?: Callback): boolean; - // Strings (http://redis.io/commands#strings) - append(key: string, value: string, callback?: ResCallbackT): boolean; - bitcount(key: string, callback?: ResCallbackT): boolean; - bitcount(key: string, start: number, end: number, callback?: ResCallbackT): boolean; - set(key: string, value: string, callback?: ResCallbackT): boolean; - get(key: string, callback?: ResCallbackT): boolean; - exists(key: string, value: string, callback?: ResCallbackT): boolean; - - publish(channel: string, value: any): boolean; - subscribe(channel: string): boolean; - - /* - commands = set_union([ - "get", "set", "setnx", "setex", "append", "strlen", "del", "exists", "setbit", "getbit", "setrange", "getrange", "substr", - "incr", "decr", "mget", "rpush", "lpush", "rpushx", "lpushx", "linsert", "rpop", "lpop", "brpop", "brpoplpush", "blpop", "llen", "lindex", - "lset", "lrange", "ltrim", "lrem", "rpoplpush", "sadd", "srem", "smove", "sismember", "scard", "spop", "srandmember", "sinter", "sinterstore", - "sunion", "sunionstore", "sdiff", "sdiffstore", "smembers", "zadd", "zincrby", "zrem", "zremrangebyscore", "zremrangebyrank", "zunionstore", - "zinterstore", "zrange", "zrangebyscore", "zrevrangebyscore", "zcount", "zrevrange", "zcard", "zscore", "zrank", "zrevrank", "hset", "hsetnx", - "hget", "hmset", "hmget", "hincrby", "hincrbyfloat", "hdel", "hlen", "hkeys", "hvals", "hgetall", "hexists", "incrby", "decrby", "getset", "mset", "msetnx", - "randomkey", "select", "move", "rename", "renamenx", "expire", "expireat", "keys", "dbsize", "auth", "ping", "echo", "save", "bgsave", - "bgrewriteaof", "shutdown", "lastsave", "type", "multi", "exec", "discard", "sync", "flushdb", "flushall", "sort", "info", "monitor", "ttl", - "persist", "slaveof", "debug", "config", "subscribe", "unsubscribe", "psubscribe", "punsubscribe", "publish", "watch", "unwatch", "cluster", - "restore", "migrate", "dump", "object", "client", "eval", "evalsha"], require("./lib/commands")); + /** + * Mark the start of a transaction block. */ + multi(args?: Array>>): Multi; + MULTI(args?: Array>>): Multi; - get(args: any[], callback?: ResCallbackT): boolean; - get(...args: any[]): boolean; - set(args: any[], callback?: ResCallbackT): boolean; - set(...args: any[]): boolean; - setnx(args: any[], callback?: ResCallbackT): boolean; - setnx(...args: any[]): boolean; - setex(args: any[], callback?: ResCallbackT): boolean; - setex(...args: any[]): boolean; - append(args: any[], callback?: ResCallbackT): boolean; - append(...args: any[]): boolean; - strlen(args: any[], callback?: ResCallbackT): boolean; - strlen(...args: any[]): boolean; - del(args: any[], callback?: ResCallbackT): boolean; - del(...args: any[]): boolean; - exists(args: any[], callback?: ResCallbackT): boolean; - exists(...args: any[]): boolean; - setbit(args: any[], callback?: ResCallbackT): boolean; - setbit(...args: any[]): boolean; - getbit(args: any[], callback?: ResCallbackT): boolean; - getbit(...args: any[]): boolean; - setrange(args: any[], callback?: ResCallbackT): boolean; - setrange(...args: any[]): boolean; - getrange(args: any[], callback?: ResCallbackT): boolean; - getrange(...args: any[]): boolean; - substr(args: any[], callback?: ResCallbackT): boolean; - substr(...args: any[]): boolean; - incr(args: any[], callback?: ResCallbackT): boolean; - incr(...args: any[]): boolean; - decr(args: any[], callback?: ResCallbackT): boolean; - decr(...args: any[]): boolean; - mget(args: any[], callback?: ResCallbackT): boolean; - mget(...args: any[]): boolean; - rpush(...args: any[]): boolean; - lpush(args: any[], callback?: ResCallbackT): boolean; - lpush(...args: any[]): boolean; - rpushx(args: any[], callback?: ResCallbackT): boolean; - rpushx(...args: any[]): boolean; - lpushx(args: any[], callback?: ResCallbackT): boolean; - lpushx(...args: any[]): boolean; - linsert(args: any[], callback?: ResCallbackT): boolean; - linsert(...args: any[]): boolean; - rpop(args: any[], callback?: ResCallbackT): boolean; - rpop(...args: any[]): boolean; - lpop(args: any[], callback?: ResCallbackT): boolean; - lpop(...args: any[]): boolean; - brpop(args: any[], callback?: ResCallbackT): boolean; - brpop(...args: any[]): boolean; - brpoplpush(args: any[], callback?: ResCallbackT): boolean; - brpoplpush(...args: any[]): boolean; - blpop(args: any[], callback?: ResCallbackT): boolean; - blpop(...args: any[]): boolean; - llen(args: any[], callback?: ResCallbackT): boolean; - llen(...args: any[]): boolean; - lindex(args: any[], callback?: ResCallbackT): boolean; - lindex(...args: any[]): boolean; - lset(args: any[], callback?: ResCallbackT): boolean; - lset(...args: any[]): boolean; - lrange(args: any[], callback?: ResCallbackT): boolean; - lrange(...args: any[]): boolean; - ltrim(args: any[], callback?: ResCallbackT): boolean; - ltrim(...args: any[]): boolean; - lrem(args: any[], callback?: ResCallbackT): boolean; - lrem(...args: any[]): boolean; - rpoplpush(args: any[], callback?: ResCallbackT): boolean; - rpoplpush(...args: any[]): boolean; - sadd(args: any[], callback?: ResCallbackT): boolean; - sadd(...args: any[]): boolean; - srem(args: any[], callback?: ResCallbackT): boolean; - srem(...args: any[]): boolean; - smove(args: any[], callback?: ResCallbackT): boolean; - smove(...args: any[]): boolean; - sismember(args: any[], callback?: ResCallbackT): boolean; - sismember(...args: any[]): boolean; - scard(args: any[], callback?: ResCallbackT): boolean; - scard(...args: any[]): boolean; - spop(args: any[], callback?: ResCallbackT): boolean; - spop(...args: any[]): boolean; - srandmember(args: any[], callback?: ResCallbackT): boolean; - srandmember(...args: any[]): boolean; - sinter(args: any[], callback?: ResCallbackT): boolean; - sinter(...args: any[]): boolean; - sinterstore(args: any[], callback?: ResCallbackT): boolean; - sinterstore(...args: any[]): boolean; - sunion(args: any[], callback?: ResCallbackT): boolean; - sunion(...args: any[]): boolean; - sunionstore(args: any[], callback?: ResCallbackT): boolean; - sunionstore(...args: any[]): boolean; - sdiff(args: any[], callback?: ResCallbackT): boolean; - sdiff(...args: any[]): boolean; - sdiffstore(args: any[], callback?: ResCallbackT): boolean; - sdiffstore(...args: any[]): boolean; - smembers(args: any[], callback?: ResCallbackT): boolean; - smembers(...args: any[]): boolean; - zadd(args: any[], callback?: ResCallbackT): boolean; - zadd(...args: any[]): boolean; - zincrby(args: any[], callback?: ResCallbackT): boolean; - zincrby(...args: any[]): boolean; - zrem(args: any[], callback?: ResCallbackT): boolean; - zrem(...args: any[]): boolean; - zremrangebyscore(args: any[], callback?: ResCallbackT): boolean; - zremrangebyscore(...args: any[]): boolean; - zremrangebyrank(args: any[], callback?: ResCallbackT): boolean; - zremrangebyrank(...args: any[]): boolean; - zunionstore(args: any[], callback?: ResCallbackT): boolean; - zunionstore(...args: any[]): boolean; - zinterstore(args: any[], callback?: ResCallbackT): boolean; - zinterstore(...args: any[]): boolean; - zrange(args: any[], callback?: ResCallbackT): boolean; - zrange(...args: any[]): boolean; - zrangebyscore(args: any[], callback?: ResCallbackT): boolean; - zrangebyscore(...args: any[]): boolean; - zrevrangebyscore(args: any[], callback?: ResCallbackT): boolean; - zrevrangebyscore(...args: any[]): boolean; - zcount(args: any[], callback?: ResCallbackT): boolean; - zcount(...args: any[]): boolean; - zrevrange(args: any[], callback?: ResCallbackT): boolean; - zrevrange(...args: any[]): boolean; - zcard(args: any[], callback?: ResCallbackT): boolean; - zcard(...args: any[]): boolean; - zscore(args: any[], callback?: ResCallbackT): boolean; - zscore(...args: any[]): boolean; - zrank(args: any[], callback?: ResCallbackT): boolean; - zrank(...args: any[]): boolean; - zrevrank(args: any[], callback?: ResCallbackT): boolean; - zrevrank(...args: any[]): boolean; - hset(args: any[], callback?: ResCallbackT): boolean; - hset(...args: any[]): boolean; - hsetnx(args: any[], callback?: ResCallbackT): boolean; - hsetnx(...args: any[]): boolean; - hget(args: any[], callback?: ResCallbackT): boolean; - hget(...args: any[]): boolean; - hmset(args: any[], callback?: ResCallbackT): boolean; - hmset(key: string, hash: any, callback?: ResCallbackT): boolean; - hmset(...args: any[]): boolean; - hmget(args: any[], callback?: ResCallbackT): boolean; - hmget(...args: any[]): boolean; - hincrby(args: any[], callback?: ResCallbackT): boolean; - hincrby(...args: any[]): boolean; - hincrbyfloat(args: any[], callback?: ResCallbackT): boolean; - hincrbyfloat(...args: any[]): boolean; - hdel(args: any[], callback?: ResCallbackT): boolean; - hdel(...args: any[]): boolean; - hlen(args: any[], callback?: ResCallbackT): boolean; - hlen(...args: any[]): boolean; - hkeys(args: any[], callback?: ResCallbackT): boolean; - hkeys(...args: any[]): boolean; - hvals(args: any[], callback?: ResCallbackT): boolean; - hvals(...args: any[]): boolean; - hgetall(args: any[], callback?: ResCallbackT): boolean; - hgetall(...args: any[]): boolean; - hgetall(key: string, callback?: ResCallbackT): boolean; - hexists(args: any[], callback?: ResCallbackT): boolean; - hexists(...args: any[]): boolean; - incrby(args: any[], callback?: ResCallbackT): boolean; - incrby(...args: any[]): boolean; - decrby(args: any[], callback?: ResCallbackT): boolean; - decrby(...args: any[]): boolean; - getset(args: any[], callback?: ResCallbackT): boolean; - getset(...args: any[]): boolean; - mset(args: any[], callback?: ResCallbackT): boolean; - mset(...args: any[]): boolean; - msetnx(args: any[], callback?: ResCallbackT): boolean; - msetnx(...args: any[]): boolean; - randomkey(args: any[], callback?: ResCallbackT): boolean; - randomkey(...args: any[]): boolean; - select(args: any[], callback?: ResCallbackT): void; - select(...args: any[]): void; - move(args: any[], callback?: ResCallbackT): boolean; - move(...args: any[]): boolean; - rename(args: any[], callback?: ResCallbackT): boolean; - rename(...args: any[]): boolean; - renamenx(args: any[], callback?: ResCallbackT): boolean; - renamenx(...args: any[]): boolean; - expire(args: any[], callback?: ResCallbackT): boolean; - expire(...args: any[]): boolean; - expireat(args: any[], callback?: ResCallbackT): boolean; - expireat(...args: any[]): boolean; - keys(args: any[], callback?: ResCallbackT): boolean; - keys(...args: any[]): boolean; - dbsize(args: any[], callback?: ResCallbackT): boolean; - dbsize(...args: any[]): boolean; - auth(args: any[], callback?: ResCallbackT): void; - auth(...args: any[]): void; - ping(args: any[], callback?: ResCallbackT): boolean; - ping(...args: any[]): boolean; - echo(args: any[], callback?: ResCallbackT): boolean; - echo(...args: any[]): boolean; - save(args: any[], callback?: ResCallbackT): boolean; - save(...args: any[]): boolean; - bgsave(args: any[], callback?: ResCallbackT): boolean; - bgsave(...args: any[]): boolean; - bgrewriteaof(args: any[], callback?: ResCallbackT): boolean; - bgrewriteaof(...args: any[]): boolean; - shutdown(args: any[], callback?: ResCallbackT): boolean; - shutdown(...args: any[]): boolean; - lastsave(args: any[], callback?: ResCallbackT): boolean; - lastsave(...args: any[]): boolean; - type(args: any[], callback?: ResCallbackT): boolean; - type(...args: any[]): boolean; - multi(args: any[], callback?: ResCallbackT): Multi; - multi(...args: any[]): Multi; - exec(args: any[], callback?: ResCallbackT): boolean; - exec(...args: any[]): boolean; - discard(args: any[], callback?: ResCallbackT): boolean; - discard(...args: any[]): boolean; - sync(args: any[], callback?: ResCallbackT): boolean; - sync(...args: any[]): boolean; - flushdb(args: any[], callback?: ResCallbackT): boolean; - flushdb(...args: any[]): boolean; - flushall(args: any[], callback?: ResCallbackT): boolean; - flushall(...args: any[]): boolean; - sort(args: any[], callback?: ResCallbackT): boolean; - sort(...args: any[]): boolean; - info(args: any[], callback?: ResCallbackT): boolean; - info(...args: any[]): boolean; - monitor(args: any[], callback?: ResCallbackT): boolean; - monitor(...args: any[]): boolean; - ttl(args: any[], callback?: ResCallbackT): boolean; - ttl(...args: any[]): boolean; - persist(args: any[], callback?: ResCallbackT): boolean; - persist(...args: any[]): boolean; - slaveof(args: any[], callback?: ResCallbackT): boolean; - slaveof(...args: any[]): boolean; - debug(args: any[], callback?: ResCallbackT): boolean; - debug(...args: any[]): boolean; - config(args: any[], callback?: ResCallbackT): boolean; - config(...args: any[]): boolean; - subscribe(args: any[], callback?: ResCallbackT): boolean; - subscribe(...args: any[]): boolean; - unsubscribe(args: any[], callback?: ResCallbackT): boolean; - unsubscribe(...args: any[]): boolean; - psubscribe(args: any[], callback?: ResCallbackT): boolean; - psubscribe(...args: any[]): boolean; - punsubscribe(args: any[], callback?: ResCallbackT): boolean; - punsubscribe(...args: any[]): boolean; - publish(args: any[], callback?: ResCallbackT): boolean; - publish(...args: any[]): boolean; - watch(args: any[], callback?: ResCallbackT): boolean; - watch(...args: any[]): boolean; - unwatch(args: any[], callback?: ResCallbackT): boolean; - unwatch(...args: any[]): boolean; - cluster(args: any[], callback?: ResCallbackT): boolean; - cluster(...args: any[]): boolean; - restore(args: any[], callback?: ResCallbackT): boolean; - restore(...args: any[]): boolean; - migrate(args: any[], callback?: ResCallbackT): boolean; - migrate(...args: any[]): boolean; - dump(args: any[], callback?: ResCallbackT): boolean; - dump(...args: any[]): boolean; - object(args: any[], callback?: ResCallbackT): boolean; - object(...args: any[]): boolean; - client(args: any[], callback?: ResCallbackT): boolean; - client(...args: any[]): boolean; - eval(args: any[], callback?: ResCallbackT): boolean; - eval(...args: any[]): boolean; - evalsha(args: any[], callback?: ResCallbackT): boolean; - evalsha(...args: any[]): boolean; - script(args: any[], callback?: ResCallbackT): boolean; - script(...args: any[]): boolean; - script(key: string, callback?: ResCallbackT): boolean; - quit(args: any[], callback?: ResCallbackT): boolean; - quit(...args: any[]): boolean; - sscan(...args: any[]): boolean; - sscan(args: any[], callback?: ResCallbackT): boolean; - scan(...args: any[]): boolean; - scan(args: any[], callback?: ResCallbackT): boolean; - hscan(...args: any[]): boolean; - hscan(args: any[], callback?: ResCallbackT): boolean; - zscan(...args: any[]): boolean; - zscan(args: any[], callback?: ResCallbackT): boolean; - - // Extras - duplicate(options?: any[], callback?: ResCallbackT): RedisClient; + batch(args?: Array>>): Multi; + BATCH(args?: Array>>): Multi; } -export interface Multi { - exec(callback?: ResCallbackT): boolean; +export const Multi: { + new (): Multi; +}; - get(args: any[], callback?: ResCallbackT): Multi; - get(...args: any[]): Multi; - set(args: any[], callback?: ResCallbackT): Multi; - set(...args: any[]): Multi; - setnx(args: any[], callback?: ResCallbackT): Multi; - setnx(...args: any[]): Multi; - setex(args: any[], callback?: ResCallbackT): Multi; - setex(...args: any[]): Multi; - append(args: any[], callback?: ResCallbackT): Multi; - append(...args: any[]): Multi; - strlen(args: any[], callback?: ResCallbackT): Multi; - strlen(...args: any[]): Multi; - del(args: any[], callback?: ResCallbackT): Multi; - del(...args: any[]): Multi; - exists(args: any[], callback?: ResCallbackT): Multi; - exists(...args: any[]): Multi; - setbit(args: any[], callback?: ResCallbackT): Multi; - setbit(...args: any[]): Multi; - getbit(args: any[], callback?: ResCallbackT): Multi; - getbit(...args: any[]): Multi; - setrange(args: any[], callback?: ResCallbackT): Multi; - setrange(...args: any[]): Multi; - getrange(args: any[], callback?: ResCallbackT): Multi; - getrange(...args: any[]): Multi; - substr(args: any[], callback?: ResCallbackT): Multi; - substr(...args: any[]): Multi; - incr(args: any[], callback?: ResCallbackT): Multi; - incr(...args: any[]): Multi; - decr(args: any[], callback?: ResCallbackT): Multi; - decr(...args: any[]): Multi; - mget(args: any[], callback?: ResCallbackT): Multi; - mget(...args: any[]): Multi; - rpush(...args: any[]): Multi; - lpush(args: any[], callback?: ResCallbackT): Multi; - lpush(...args: any[]): Multi; - rpushx(args: any[], callback?: ResCallbackT): Multi; - rpushx(...args: any[]): Multi; - lpushx(args: any[], callback?: ResCallbackT): Multi; - lpushx(...args: any[]): Multi; - linsert(args: any[], callback?: ResCallbackT): Multi; - linsert(...args: any[]): Multi; - rpop(args: any[], callback?: ResCallbackT): Multi; - rpop(...args: any[]): Multi; - lpop(args: any[], callback?: ResCallbackT): Multi; - lpop(...args: any[]): Multi; - brpop(args: any[], callback?: ResCallbackT): Multi; - brpop(...args: any[]): Multi; - brpoplpush(args: any[], callback?: ResCallbackT): Multi; - brpoplpush(...args: any[]): Multi; - blpop(args: any[], callback?: ResCallbackT): Multi; - blpop(...args: any[]): Multi; - llen(args: any[], callback?: ResCallbackT): Multi; - llen(...args: any[]): Multi; - lindex(args: any[], callback?: ResCallbackT): Multi; - lindex(...args: any[]): Multi; - lset(args: any[], callback?: ResCallbackT): Multi; - lset(...args: any[]): Multi; - lrange(args: any[], callback?: ResCallbackT): Multi; - lrange(...args: any[]): Multi; - ltrim(args: any[], callback?: ResCallbackT): Multi; - ltrim(...args: any[]): Multi; - lrem(args: any[], callback?: ResCallbackT): Multi; - lrem(...args: any[]): Multi; - rpoplpush(args: any[], callback?: ResCallbackT): Multi; - rpoplpush(...args: any[]): Multi; - sadd(args: any[], callback?: ResCallbackT): Multi; - sadd(...args: any[]): Multi; - srem(args: any[], callback?: ResCallbackT): Multi; - srem(...args: any[]): Multi; - smove(args: any[], callback?: ResCallbackT): Multi; - smove(...args: any[]): Multi; - sismember(args: any[], callback?: ResCallbackT): Multi; - sismember(...args: any[]): Multi; - scard(args: any[], callback?: ResCallbackT): Multi; - scard(...args: any[]): Multi; - spop(args: any[], callback?: ResCallbackT): Multi; - spop(...args: any[]): Multi; - srandmember(args: any[], callback?: ResCallbackT): Multi; - srandmember(...args: any[]): Multi; - sinter(args: any[], callback?: ResCallbackT): Multi; - sinter(...args: any[]): Multi; - sinterstore(args: any[], callback?: ResCallbackT): Multi; - sinterstore(...args: any[]): Multi; - sunion(args: any[], callback?: ResCallbackT): Multi; - sunion(...args: any[]): Multi; - sunionstore(args: any[], callback?: ResCallbackT): Multi; - sunionstore(...args: any[]): Multi; - sdiff(args: any[], callback?: ResCallbackT): Multi; - sdiff(...args: any[]): Multi; - sdiffstore(args: any[], callback?: ResCallbackT): Multi; - sdiffstore(...args: any[]): Multi; - smembers(args: any[], callback?: ResCallbackT): Multi; - smembers(...args: any[]): Multi; - zadd(args: any[], callback?: ResCallbackT): Multi; - zadd(...args: any[]): Multi; - zincrby(args: any[], callback?: ResCallbackT): Multi; - zincrby(...args: any[]): Multi; - zrem(args: any[], callback?: ResCallbackT): Multi; - zrem(...args: any[]): Multi; - zremrangebyscore(args: any[], callback?: ResCallbackT): Multi; - zremrangebyscore(...args: any[]): Multi; - zremrangebyrank(args: any[], callback?: ResCallbackT): Multi; - zremrangebyrank(...args: any[]): Multi; - zunionstore(args: any[], callback?: ResCallbackT): Multi; - zunionstore(...args: any[]): Multi; - zinterstore(args: any[], callback?: ResCallbackT): Multi; - zinterstore(...args: any[]): Multi; - zrange(args: any[], callback?: ResCallbackT): Multi; - zrange(...args: any[]): Multi; - zrangebyscore(args: any[], callback?: ResCallbackT): Multi; - zrangebyscore(...args: any[]): Multi; - zrevrangebyscore(args: any[], callback?: ResCallbackT): Multi; - zrevrangebyscore(...args: any[]): Multi; - zcount(args: any[], callback?: ResCallbackT): Multi; - zcount(...args: any[]): Multi; - zrevrange(args: any[], callback?: ResCallbackT): Multi; - zrevrange(...args: any[]): Multi; - zcard(args: any[], callback?: ResCallbackT): Multi; - zcard(...args: any[]): Multi; - zscore(args: any[], callback?: ResCallbackT): Multi; - zscore(...args: any[]): Multi; - zrank(args: any[], callback?: ResCallbackT): Multi; - zrank(...args: any[]): Multi; - zrevrank(args: any[], callback?: ResCallbackT): Multi; - zrevrank(...args: any[]): Multi; - hset(args: any[], callback?: ResCallbackT): Multi; - hset(...args: any[]): Multi; - hsetnx(args: any[], callback?: ResCallbackT): Multi; - hsetnx(...args: any[]): Multi; - hget(args: any[], callback?: ResCallbackT): Multi; - hget(...args: any[]): Multi; - hmset(args: any[], callback?: ResCallbackT): Multi; - hmset(key: string, hash: any, callback?: ResCallbackT): Multi; - hmset(...args: any[]): Multi; - hmget(args: any[], callback?: ResCallbackT): Multi; - hmget(...args: any[]): Multi; - hincrby(args: any[], callback?: ResCallbackT): Multi; - hincrby(...args: any[]): Multi; - hdel(args: any[], callback?: ResCallbackT): Multi; - hdel(...args: any[]): Multi; - hlen(args: any[], callback?: ResCallbackT): Multi; - hlen(...args: any[]): Multi; - hkeys(args: any[], callback?: ResCallbackT): Multi; - hkeys(...args: any[]): Multi; - hvals(args: any[], callback?: ResCallbackT): Multi; - hvals(...args: any[]): Multi; - hgetall(args: any[], callback?: ResCallbackT): Multi; - hgetall(...args: any[]): Multi; - hgetall(key: string, callback?: ResCallbackT): Multi; - hexists(args: any[], callback?: ResCallbackT): Multi; - hexists(...args: any[]): Multi; - incrby(args: any[], callback?: ResCallbackT): Multi; - incrby(...args: any[]): Multi; - decrby(args: any[], callback?: ResCallbackT): Multi; - decrby(...args: any[]): Multi; - getset(args: any[], callback?: ResCallbackT): Multi; - getset(...args: any[]): Multi; - mset(args: any[], callback?: ResCallbackT): Multi; - mset(...args: any[]): Multi; - msetnx(args: any[], callback?: ResCallbackT): Multi; - msetnx(...args: any[]): Multi; - randomkey(args: any[], callback?: ResCallbackT): Multi; - randomkey(...args: any[]): Multi; - select(args: any[], callback?: ResCallbackT): void; - select(...args: any[]): Multi; - move(args: any[], callback?: ResCallbackT): Multi; - move(...args: any[]): Multi; - rename(args: any[], callback?: ResCallbackT): Multi; - rename(...args: any[]): Multi; - renamenx(args: any[], callback?: ResCallbackT): Multi; - renamenx(...args: any[]): Multi; - expire(args: any[], callback?: ResCallbackT): Multi; - expire(...args: any[]): Multi; - expireat(args: any[], callback?: ResCallbackT): Multi; - expireat(...args: any[]): Multi; - keys(args: any[], callback?: ResCallbackT): Multi; - keys(...args: any[]): Multi; - dbsize(args: any[], callback?: ResCallbackT): Multi; - dbsize(...args: any[]): Multi; - auth(args: any[], callback?: ResCallbackT): void; - auth(...args: any[]): void; - ping(args: any[], callback?: ResCallbackT): Multi; - ping(...args: any[]): Multi; - echo(args: any[], callback?: ResCallbackT): Multi; - echo(...args: any[]): Multi; - save(args: any[], callback?: ResCallbackT): Multi; - save(...args: any[]): Multi; - bgsave(args: any[], callback?: ResCallbackT): Multi; - bgsave(...args: any[]): Multi; - bgrewriteaof(args: any[], callback?: ResCallbackT): Multi; - bgrewriteaof(...args: any[]): Multi; - shutdown(args: any[], callback?: ResCallbackT): Multi; - shutdown(...args: any[]): Multi; - lastsave(args: any[], callback?: ResCallbackT): Multi; - lastsave(...args: any[]): Multi; - type(args: any[], callback?: ResCallbackT): Multi; - type(...args: any[]): Multi; - multi(args: any[], callback?: ResCallbackT): Multi; - multi(...args: any[]): Multi; - exec(args: any[], callback?: ResCallbackT): Multi; - exec(...args: any[]): Multi; - discard(args: any[], callback?: ResCallbackT): Multi; - discard(...args: any[]): Multi; - sync(args: any[], callback?: ResCallbackT): Multi; - sync(...args: any[]): Multi; - flushdb(args: any[], callback?: ResCallbackT): Multi; - flushdb(...args: any[]): Multi; - flushall(args: any[], callback?: ResCallbackT): Multi; - flushall(...args: any[]): Multi; - sort(args: any[], callback?: ResCallbackT): Multi; - sort(...args: any[]): Multi; - info(args: any[], callback?: ResCallbackT): Multi; - info(...args: any[]): Multi; - monitor(args: any[], callback?: ResCallbackT): Multi; - monitor(...args: any[]): Multi; - ttl(args: any[], callback?: ResCallbackT): Multi; - ttl(...args: any[]): Multi; - persist(args: any[], callback?: ResCallbackT): Multi; - persist(...args: any[]): Multi; - slaveof(args: any[], callback?: ResCallbackT): Multi; - slaveof(...args: any[]): Multi; - debug(args: any[], callback?: ResCallbackT): Multi; - debug(...args: any[]): Multi; - config(args: any[], callback?: ResCallbackT): Multi; - config(...args: any[]): Multi; - subscribe(args: any[], callback?: ResCallbackT): Multi; - subscribe(...args: any[]): Multi; - unsubscribe(args: any[], callback?: ResCallbackT): Multi; - unsubscribe(...args: any[]): Multi; - psubscribe(args: any[], callback?: ResCallbackT): Multi; - psubscribe(...args: any[]): Multi; - punsubscribe(args: any[], callback?: ResCallbackT): Multi; - punsubscribe(...args: any[]): Multi; - publish(args: any[], callback?: ResCallbackT): Multi; - publish(...args: any[]): Multi; - watch(args: any[], callback?: ResCallbackT): Multi; - watch(...args: any[]): Multi; - unwatch(args: any[], callback?: ResCallbackT): Multi; - unwatch(...args: any[]): Multi; - cluster(args: any[], callback?: ResCallbackT): Multi; - cluster(...args: any[]): Multi; - restore(args: any[], callback?: ResCallbackT): Multi; - restore(...args: any[]): Multi; - migrate(args: any[], callback?: ResCallbackT): Multi; - migrate(...args: any[]): Multi; - dump(args: any[], callback?: ResCallbackT): Multi; - dump(...args: any[]): Multi; - object(args: any[], callback?: ResCallbackT): Multi; - object(...args: any[]): Multi; - client(args: any[], callback?: ResCallbackT): Multi; - client(...args: any[]): Multi; - eval(args: any[], callback?: ResCallbackT): Multi; - eval(...args: any[]): Multi; - evalsha(args: any[], callback?: ResCallbackT): Multi; - evalsha(...args: any[]): Multi; - quit(args: any[], callback?: ResCallbackT): Multi; - quit(...args: any[]): Multi; - scan(...args: any[]): Multi; - scan(args: any[], callback?: ResCallbackT): Multi; - hscan(...args: any[]): Multi; - hscan(args: any[], callback?: ResCallbackT): Multi; - zscan(...args: any[]): Multi; - zscan(args: any[], callback?: ResCallbackT): Multi; +export interface Multi extends Commands { + exec(cb?: Callback): boolean; + EXEC(cb?: Callback): boolean; + + exec_atomic(cb?: Callback): boolean; + EXEC_ATOMIC(cb?: Callback): boolean; } + +export let debug_mode: boolean; + +export function createClient(port: number, host?: string, options?: ClientOpts): RedisClient; +export function createClient(unix_socket: string, options?: ClientOpts): RedisClient; +export function createClient(redis_url: string, options?: ClientOpts): RedisClient; +export function createClient(options?: ClientOpts): RedisClient; + +export function print(err: Error | void, reply: any): void; diff --git a/types/redis/redis-tests.ts b/types/redis/redis-tests.ts index c1908e1089..ae389d9a06 100644 --- a/types/redis/redis-tests.ts +++ b/types/redis/redis-tests.ts @@ -61,7 +61,7 @@ client.end(true); // Connection (http://redis.io/commands#connection) client.auth(str, resCallback); -client.ping(numCallback); +client.ping(strCallback); client.unref(); // Strings (http://redis.io/commands#strings) @@ -79,10 +79,10 @@ client.once(str, messageHandler); // ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- // some of the bulk methods -client.get(args); -client.get(args, resCallback); -client.set(args); -client.set(args, resCallback); +client.get('test'); +client.get('test', resCallback); +client.set('test', 'test'); +client.set('test', 'test', resCallback); client.mset(args, resCallback); client.incr(str, resCallback); @@ -104,7 +104,7 @@ client.multi() .dbsize() .exec(resCallback); -client.multi(commandArr).exec(); +client.multi([['get', 'test']]).exec(); // Monitor mode client.monitor(resCallback); From 7bb204fdb56581fda358657ea9f8fb377b255b1b Mon Sep 17 00:00:00 2001 From: Felipe Date: Thu, 1 Jun 2017 16:53:41 +0200 Subject: [PATCH 0203/1105] update uuid to v3 (#16264) * update uuid to v3 - remove the parse/unparse functions - allow importing 'uuid/v1' and 'uuid/v4' directly - keep v2 typings as 'uuid-v2' * Fix v2 folder naming --- types/uuid/index.d.ts | 37 +++++++++------------------------- types/uuid/interfaces.d.ts | 21 +++++++++++++++++++ types/uuid/tsconfig.json | 9 +++++++-- types/uuid/tslint.json | 1 + types/uuid/uuid-tests.ts | 40 ++++++++++++++++++++++++------------- types/uuid/v1.d.ts | 5 +++++ types/uuid/v2/index.d.ts | 35 ++++++++++++++++++++++++++++++++ types/uuid/v2/tsconfig.json | 25 +++++++++++++++++++++++ types/uuid/v2/uuid-tests.ts | 31 ++++++++++++++++++++++++++++ types/uuid/v4.d.ts | 5 +++++ 10 files changed, 165 insertions(+), 44 deletions(-) create mode 100644 types/uuid/interfaces.d.ts create mode 100644 types/uuid/tslint.json create mode 100644 types/uuid/v1.d.ts create mode 100644 types/uuid/v2/index.d.ts create mode 100644 types/uuid/v2/tsconfig.json create mode 100644 types/uuid/v2/uuid-tests.ts create mode 100644 types/uuid/v4.d.ts diff --git a/types/uuid/index.d.ts b/types/uuid/index.d.ts index 2fd5467e3e..cc16cc830d 100644 --- a/types/uuid/index.d.ts +++ b/types/uuid/index.d.ts @@ -1,35 +1,16 @@ -// Type definitions for uuid v2.0.3 +// Type definitions for uuid 3.0 // Project: https://github.com/defunctzombie/node-uuid // Definitions by: Oliver Hoffmann +// Felipe Ochoa // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 -/// +import { v1, v4 } from './interfaces'; -declare namespace uuid { - interface V1Options { - node?: number[]; - clockseq?: number; - msecs?: number | Date; - nsecs?: number; - } - - type V4Options = { random: number[] } | { rng: () => number[]; } - - interface UuidStatic { - (options?: V4Options): string; - (options: V4Options | null, buffer: number[], offset?: number): number[]; - (options: V4Options | null, buffer: Buffer, offset?: number): Buffer; - - v1(options?: V1Options): string; - v1(options: V1Options | null, buffer: number[], offset?: number): number[]; - v1(options: V1Options | null, buffer: Buffer, offset?: number): Buffer; - v4: UuidStatic; - parse(id: string): number[]; - parse(id: string, buffer: number[], offset?: number): number[]; - parse(id: string, buffer: Buffer, offset?: number): Buffer; - unparse(buffer: number[] | Buffer, offset?: number): string; - } +interface UuidStatic { + v1: v1; + v4: v4; } -declare const uuid: uuid.UuidStatic -export = uuid +declare const uuid: UuidStatic & v4; +export = uuid; diff --git a/types/uuid/interfaces.d.ts b/types/uuid/interfaces.d.ts new file mode 100644 index 0000000000..65ff0d4819 --- /dev/null +++ b/types/uuid/interfaces.d.ts @@ -0,0 +1,21 @@ +/// + +// Uses ArrayLike to admit Unit8 and co. +export type OutputBuffer = ArrayLike | Buffer; + +export interface V1Options { + node?: number[]; + clockseq?: number; + msecs?: number | Date; + nsecs?: number; +} + +export type V4Options = {random: number[]} | {rng(): number[]}; + +export type v1String = (options?: V1Options) => string; +export type v1Buffer = (options: V1Options | null | undefined, buffer: T, offset?: number) => T; +export type v1 = v1String & v1Buffer; + +export type v4String = (options?: V4Options) => string; +export type v4Buffer = (options: V4Options | null | undefined, buffer: T, offset?: number) => T; +export type v4 = v4String & v4Buffer; diff --git a/types/uuid/tsconfig.json b/types/uuid/tsconfig.json index 13ef9e9cca..688d9add4b 100644 --- a/types/uuid/tsconfig.json +++ b/types/uuid/tsconfig.json @@ -6,7 +6,9 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, + "alwaysStrict": true, + "strict": true, "baseUrl": "../", "typeRoots": [ "../" @@ -17,6 +19,9 @@ }, "files": [ "index.d.ts", + "v1.d.ts", + "v4.d.ts", + "interfaces.d.ts", "uuid-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/uuid/tslint.json b/types/uuid/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/uuid/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/uuid/uuid-tests.ts b/types/uuid/uuid-tests.ts index 2dd5ea7f46..73dedec6c5 100644 --- a/types/uuid/uuid-tests.ts +++ b/types/uuid/uuid-tests.ts @@ -1,31 +1,43 @@ import uuid = require('uuid'); +import v1 = require('uuid/v1'); +import v4 = require('uuid/v4'); let uuidv1: string = uuid.v1(); uuidv1 = uuid.v1({ - node: [0x01, 0x23, 0x45, 0x67, 0x89, 0xab], - clockseq: 0x1234, - msecs: new Date('2011-11-01').getTime(), - nsecs: 5678 + node: [0x01, 0x23, 0x45, 0x67, 0x89, 0xab], + clockseq: 0x1234, + msecs: new Date('2011-11-01').getTime(), + nsecs: 5678 }); -let bufferv1: number[] = new Array(32); +uuidv1 = v1(); +uuidv1 = v1({ + node: [0x01, 0x23, 0x45, 0x67, 0x89, 0xab], + clockseq: 0x1234, + msecs: new Date('2011-11-01').getTime(), + nsecs: 5678 +}); + +let bufferv1 = new Uint8Array(32); bufferv1 = uuid.v1(null, bufferv1); -bufferv1 = uuid.v1(null, bufferv1, 16); +bufferv1 = uuid.v1(undefined, bufferv1, 16); +bufferv1 = v1(undefined, bufferv1); +bufferv1 = v1(null, bufferv1, 16); let uuidv4: string = uuid.v4(); const randoms = [ - 0x10, 0x91, 0x56, 0xbe, 0xc4, 0xfb, 0xc1, 0xea, - 0x71, 0xb4, 0xef, 0xe1, 0x67, 0x1c, 0x58, 0x36 + 0x10, 0x91, 0x56, 0xbe, 0xc4, 0xfb, 0xc1, 0xea, + 0x71, 0xb4, 0xef, 0xe1, 0x67, 0x1c, 0x58, 0x36 ]; uuidv4 = uuid({ random: randoms }); -uuidv4 = uuid({ rng: () => randoms }) +uuidv4 = uuid({ rng: () => randoms }); +uuidv4 = v4({ random: randoms }); +uuidv4 = v4({ rng: () => randoms }); let bufferv4: number[] = new Array(32); -bufferv4 = uuid(null, bufferv4); +bufferv4 = uuid(undefined, bufferv4); bufferv4 = uuid(null, bufferv4, 16); - -let nodeBufferv4 = Buffer.alloc(32); -nodeBufferv4 = uuid.v4(null, nodeBufferv4); -nodeBufferv4 = uuid.v4(null, nodeBufferv4, 16); +bufferv4 = v4(null, bufferv4); +bufferv4 = v4(undefined, bufferv4, 16); diff --git a/types/uuid/v1.d.ts b/types/uuid/v1.d.ts new file mode 100644 index 0000000000..b5fa0f6c61 --- /dev/null +++ b/types/uuid/v1.d.ts @@ -0,0 +1,5 @@ +import { v1 } from './interfaces'; + +declare const v1: v1; + +export = v1; diff --git a/types/uuid/v2/index.d.ts b/types/uuid/v2/index.d.ts new file mode 100644 index 0000000000..2fd5467e3e --- /dev/null +++ b/types/uuid/v2/index.d.ts @@ -0,0 +1,35 @@ +// Type definitions for uuid v2.0.3 +// Project: https://github.com/defunctzombie/node-uuid +// Definitions by: Oliver Hoffmann +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare namespace uuid { + interface V1Options { + node?: number[]; + clockseq?: number; + msecs?: number | Date; + nsecs?: number; + } + + type V4Options = { random: number[] } | { rng: () => number[]; } + + interface UuidStatic { + (options?: V4Options): string; + (options: V4Options | null, buffer: number[], offset?: number): number[]; + (options: V4Options | null, buffer: Buffer, offset?: number): Buffer; + + v1(options?: V1Options): string; + v1(options: V1Options | null, buffer: number[], offset?: number): number[]; + v1(options: V1Options | null, buffer: Buffer, offset?: number): Buffer; + v4: UuidStatic; + parse(id: string): number[]; + parse(id: string, buffer: number[], offset?: number): number[]; + parse(id: string, buffer: Buffer, offset?: number): Buffer; + unparse(buffer: number[] | Buffer, offset?: number): string; + } +} + +declare const uuid: uuid.UuidStatic +export = uuid diff --git a/types/uuid/v2/tsconfig.json b/types/uuid/v2/tsconfig.json new file mode 100644 index 0000000000..62f4072351 --- /dev/null +++ b/types/uuid/v2/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../..", + "typeRoots": [ + "../.." + ], + "paths": { + "uuid": ["uuid/v2"] + }, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "uuid-tests.ts" + ] +} diff --git a/types/uuid/v2/uuid-tests.ts b/types/uuid/v2/uuid-tests.ts new file mode 100644 index 0000000000..2dd5ea7f46 --- /dev/null +++ b/types/uuid/v2/uuid-tests.ts @@ -0,0 +1,31 @@ +import uuid = require('uuid'); + +let uuidv1: string = uuid.v1(); + +uuidv1 = uuid.v1({ + node: [0x01, 0x23, 0x45, 0x67, 0x89, 0xab], + clockseq: 0x1234, + msecs: new Date('2011-11-01').getTime(), + nsecs: 5678 +}); + +let bufferv1: number[] = new Array(32); +bufferv1 = uuid.v1(null, bufferv1); +bufferv1 = uuid.v1(null, bufferv1, 16); + +let uuidv4: string = uuid.v4(); + +const randoms = [ + 0x10, 0x91, 0x56, 0xbe, 0xc4, 0xfb, 0xc1, 0xea, + 0x71, 0xb4, 0xef, 0xe1, 0x67, 0x1c, 0x58, 0x36 +]; +uuidv4 = uuid({ random: randoms }); +uuidv4 = uuid({ rng: () => randoms }) + +let bufferv4: number[] = new Array(32); +bufferv4 = uuid(null, bufferv4); +bufferv4 = uuid(null, bufferv4, 16); + +let nodeBufferv4 = Buffer.alloc(32); +nodeBufferv4 = uuid.v4(null, nodeBufferv4); +nodeBufferv4 = uuid.v4(null, nodeBufferv4, 16); diff --git a/types/uuid/v4.d.ts b/types/uuid/v4.d.ts new file mode 100644 index 0000000000..62b0bc5d04 --- /dev/null +++ b/types/uuid/v4.d.ts @@ -0,0 +1,5 @@ +import { v4 } from './interfaces'; + +declare const v4: v4; + +export = v4; From a39e51dceddc66d365da610e18da75e851058c98 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Thu, 1 Jun 2017 07:55:17 -0700 Subject: [PATCH 0204/1105] Fix lint --- types/react-native/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index 2cca4ed77c..c049c2aa5f 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -234,7 +234,7 @@ interface EventEmitter extends EventEmitterListener { * * emitter.emit('someEvent', 'abc'); // logs 'abc' */ - emit(eventType: string,...param:any[]): void + emit(eventType: string, ...params: any[]): void /** * Removes the given listener for event of specific type. From 3b14b0a3a3a9e12115211eb862aa634a34f53119 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Elsd=C3=B6rfer?= Date: Thu, 1 Jun 2017 19:34:49 +0430 Subject: [PATCH 0205/1105] Add role and tabIndex back to SVGAttributes. (#16289) Was removed as a part of https://github.com/DefinitelyTyped/DefinitelyTyped/pull/14618. --- types/react/index.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/types/react/index.d.ts b/types/react/index.d.ts index b52c4b6aa6..979870febb 100644 --- a/types/react/index.d.ts +++ b/types/react/index.d.ts @@ -2260,6 +2260,10 @@ declare namespace React { target?: string; type?: string; width?: number | string; + + // Other HTML properties supported by SVG elements in browsers + role?: string; + tabIndex?: number; // SVG Specific attributes accentHeight?: number | string; From 7ea24685454eba0e62f68b74e490c64f715f6312 Mon Sep 17 00:00:00 2001 From: Gabe Moothart Date: Thu, 1 Jun 2017 08:08:18 -0700 Subject: [PATCH 0206/1105] Add SpyObj typing for createSpyObj. (#16321) * Add SpyObj typing for createSpyObj. Adding a mapped type SpyObj, and make it the return value of createSpyObj. * simplify type --- types/jasmine/index.d.ts | 8 ++++++-- types/jasmine/jasmine-tests.ts | 7 ++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/types/jasmine/index.d.ts b/types/jasmine/index.d.ts index c4ad8841c0..84e5eac4c8 100644 --- a/types/jasmine/index.d.ts +++ b/types/jasmine/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for Jasmine 2.5.2 // Project: http://jasmine.github.io/ -// Definitions by: Boris Yankov , Theodore Brown , David Pärsson +// Definitions by: Boris Yankov , Theodore Brown , David Pärsson , Gabe Moothart // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 @@ -59,7 +59,7 @@ declare namespace jasmine { function createSpy(name: string, originalFn?: Function): Spy; function createSpyObj(baseName: string, methodNames: any[]): any; - function createSpyObj(baseName: string, methodNames: any[]): T; + function createSpyObj(baseName: string, methodNames: any[]): SpyObj; function createSpyObj(baseName: string, methodNames: any): any; function createSpyObj(methodNames: any[]): any; @@ -518,6 +518,10 @@ declare namespace jasmine { argsForCall: any[]; } + type SpyObj = T & { + [k in keyof T]: Spy; + } + interface SpyAnd { /** By chaining the spy with and.callThrough, the spy will still track all calls to it but in addition it will delegate to the actual implementation. */ callThrough(): Spy; diff --git a/types/jasmine/jasmine-tests.ts b/types/jasmine/jasmine-tests.ts index 8cf892e17a..79ac4f4220 100644 --- a/types/jasmine/jasmine-tests.ts +++ b/types/jasmine/jasmine-tests.ts @@ -616,9 +616,14 @@ describe("A spy, when created manually", () => { describe("Multiple spies, when created manually", () => { var tape: any; + var el: jasmine.SpyObj; beforeEach(() => { tape = jasmine.createSpyObj('tape', ['play', 'pause', 'stop', 'rewind']); + el = jasmine.createSpyObj('Element', ['hasAttribute']); + + el.hasAttribute.and.returnValue(false); + el.hasAttribute("href"); tape.play(); tape.pause(); @@ -1055,4 +1060,4 @@ describe("createSpyObj", function () { })(); jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000; -jasmine.MAX_PRETTY_PRINT_DEPTH = 40; \ No newline at end of file +jasmine.MAX_PRETTY_PRINT_DEPTH = 40; From 0608dfc474d6decd4204ebaa2edd8015d6ff5b7b Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Thu, 1 Jun 2017 08:09:45 -0700 Subject: [PATCH 0207/1105] Fix lint --- types/react-recaptcha/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-recaptcha/index.d.ts b/types/react-recaptcha/index.d.ts index 873882c433..d605551cdf 100644 --- a/types/react-recaptcha/index.d.ts +++ b/types/react-recaptcha/index.d.ts @@ -19,7 +19,7 @@ interface RecaptchaProps { tabindex?: string; theme?: "dark" | "light"; type?: string; - verifyCallback?(response:string): any; + verifyCallback?(response: string): any; verifyCallbackName?: string; sitekey?: string; } From da66e73945b5494ba8a589d9e5bc22ef6856dc87 Mon Sep 17 00:00:00 2001 From: eug48 Date: Fri, 2 Jun 2017 01:11:18 +1000 Subject: [PATCH 0208/1105] jest: added addSnapshotSerializer (#16334) based on flow typings at https://github.com/facebook/jest/blob/e56103cf142d2e87542ddfb6bd892bcee262c0e6/types/PrettyFormat.js --- types/jest/index.d.ts | 40 ++++++++++++++++++++++++++++++++++++++++ types/jest/jest-tests.ts | 24 ++++++++++++++++++++++++ 2 files changed, 64 insertions(+) diff --git a/types/jest/index.d.ts b/types/jest/index.d.ts index 36011e67a7..9297ebfced 100644 --- a/types/jest/index.d.ts +++ b/types/jest/index.d.ts @@ -152,6 +152,44 @@ declare namespace jest { [key: string]: (this: MatcherUtils, received: any, actual: any) => { message: () => string, pass: boolean }; } + interface SnapshotSerializerOptions { + callToJSON?: boolean; + edgeSpacing?: string; + spacing?: string; + escapeRegex?: boolean; + highlight?: boolean; + indent?: number; + maxDepth?: number; + min?: boolean; + plugins?: Array + printFunctionName?: boolean; + theme?: SnapshotSerializerOptionsTheme; + + // see https://github.com/facebook/jest/blob/e56103cf142d2e87542ddfb6bd892bcee262c0e6/types/PrettyFormat.js + } + interface SnapshotSerializerOptionsTheme { + comment?: string; + content?: string; + prop?: string; + tag?: string; + value?: string; + } + interface SnapshotSerializerColor { + close: string; + open: string; + } + interface SnapshotSerializerColors { + comment: SnapshotSerializerColor; + content: SnapshotSerializerColor; + prop: SnapshotSerializerColor; + tag: SnapshotSerializerColor; + value: SnapshotSerializerColor; + } + interface SnapshotSerializerPlugin { + print(val:any, serialize:((val:any) => string), indent:((str:string) => string), opts:SnapshotSerializerOptions, colors: SnapshotSerializerColors) : string; + test(val:any) : boolean; + } + /** The `expect` function is used every time you want to test a value. You will rarely call `expect` by itself. */ interface Expect { /** @@ -169,6 +207,8 @@ declare namespace jest { assertions(num: number): void; /** You can use `expect.extend` to add your own matchers to Jest. */ extend(obj: ExpectExtendMap): void; + /** Adds a module to format application-specific data structures for serialization. */ + addSnapshotSerializer(serializer: SnapshotSerializerPlugin) : void; /** Matches any object that recursively matches the provided keys. This is often handy in conjunction with other asymmetric matchers. */ objectContaining(obj: {}): any; /** Matches any string that contains the exact provided string */ diff --git a/types/jest/jest-tests.ts b/types/jest/jest-tests.ts index d951153842..d8f6d54dfd 100644 --- a/types/jest/jest-tests.ts +++ b/types/jest/jest-tests.ts @@ -335,6 +335,30 @@ describe('toThrowErrorMatchingSnapshot', function () { }); }); +const testSerializerPluginString = "set by testSerializerPlugin"; +let testSerializerPluginCallCount = 0; +expect.addSnapshotSerializer({ + print(val, serialize, indent, opts, colors) { + val.willOverwrite = testSerializerPluginString; + testSerializerPluginCallCount += 1; + return 'plugin called: ' + serialize(val.willOverwrite); + }, + test(val) { + return val && val.willOverwrite && val.willOverwrite !== testSerializerPluginString; + }, +}); +describe('addSnapshotSerializer', function () { + it('the plugin does its work', function () { + testSerializerPluginCallCount = 0; + expect({ willOverwrite: { x: 1, y: 2, } }).toMatchSnapshot(); + expect({ willOverwrite: "this will get overwritten by testSerializerPlugin" }).toMatchSnapshot(); + expect({ willOverwrite: "so will this" }).toMatchSnapshot(); + expect({ foo: "this will not" }).toMatchSnapshot(); + expect(testSerializerPluginCallCount).toBe(3); + }); +}); + + function testInstances() { var mockFn = jest.fn(); var a = new mockFn(); From 519b3e46dae497e6b7f5054c6126b536e8604b50 Mon Sep 17 00:00:00 2001 From: AJ Richardson Date: Thu, 1 Jun 2017 11:27:33 -0400 Subject: [PATCH 0209/1105] lodash: allow null and undefined parameters (#16364) * lodash: allow null and undefined parameters (#15883) * lodash: fix requested changes (#15883) * Better way of handling array wrappers * lodash: allow more null or undefined inputs --- types/lodash/index.d.ts | 2303 ++++++++++++++++++---------------- types/lodash/lodash-tests.ts | 951 +++++++++----- 2 files changed, 1906 insertions(+), 1348 deletions(-) diff --git a/types/lodash/index.d.ts b/types/lodash/index.d.ts index b8ae248190..4a91e89781 100644 --- a/types/lodash/index.d.ts +++ b/types/lodash/index.d.ts @@ -280,9 +280,12 @@ declare namespace _ { (value: number): LoDashImplicitWrapper; (value: string): LoDashImplicitStringWrapper; (value: boolean): LoDashImplicitWrapper; + (value: null | undefined): LoDashImplicitWrapper; (value: number[]): LoDashImplicitNumberArrayWrapper; (value: T[]): LoDashImplicitArrayWrapper; + (value: T[] | null | undefined): LoDashImplicitNillableArrayWrapper; (value: T): LoDashImplicitObjectWrapper; + (value: T | null | undefined): LoDashImplicitNillableObjectWrapper; (value: any): LoDashImplicitWrapper; /** @@ -379,32 +382,50 @@ declare namespace _ { interface LoDashExplicitStringWrapper extends LoDashExplicitWrapper { } - interface LoDashImplicitObjectWrapper extends LoDashImplicitWrapperBase> { } + interface LoDashImplicitObjectWrapperBase extends LoDashImplicitWrapperBase { } - interface LoDashExplicitObjectWrapper extends LoDashExplicitWrapperBase> { } + interface LoDashImplicitObjectWrapper extends LoDashImplicitObjectWrapperBase> { } + + interface LoDashImplicitNillableObjectWrapper extends LoDashImplicitObjectWrapperBase> { } - interface LoDashImplicitArrayWrapper extends LoDashImplicitWrapperBase> { - pop(): T; - push(...items: T[]): LoDashImplicitArrayWrapper; - shift(): T; - sort(compareFn?: (a: T, b: T) => number): LoDashImplicitArrayWrapper; - splice(start: number): LoDashImplicitArrayWrapper; - splice(start: number, deleteCount: number, ...items: any[]): LoDashImplicitArrayWrapper; - unshift(...items: T[]): LoDashImplicitArrayWrapper; + interface LoDashExplicitObjectWrapperBase extends LoDashExplicitWrapperBase { } + + interface LoDashExplicitObjectWrapper extends LoDashExplicitObjectWrapperBase> { } + + interface LoDashExplicitNillableObjectWrapper extends LoDashExplicitObjectWrapperBase> { } + + interface LoDashImplicitArrayWrapperBase extends LoDashImplicitWrapperBase { + pop(): T | undefined; + push(...items: T[]): TWrapper; + shift(): T | undefined; + sort(compareFn?: (a: T, b: T) => number): TWrapper; + splice(start: number): TWrapper; + splice(start: number, deleteCount: number, ...items: T[]): TWrapper; + unshift(...items: T[]): TWrapper; } - interface LoDashExplicitArrayWrapper extends LoDashExplicitWrapperBase> { - pop(): LoDashExplicitObjectWrapper; - push(...items: T[]): LoDashExplicitArrayWrapper; - shift(): LoDashExplicitObjectWrapper; - sort(compareFn?: (a: T, b: T) => number): LoDashExplicitArrayWrapper; - splice(start: number): LoDashExplicitArrayWrapper; - splice(start: number, deleteCount: number, ...items: any[]): LoDashExplicitArrayWrapper; - unshift(...items: T[]): LoDashExplicitArrayWrapper; - } + interface LoDashImplicitArrayWrapper extends LoDashImplicitArrayWrapperBase> { } + + interface LoDashImplicitNillableArrayWrapper extends LoDashImplicitArrayWrapperBase> { } + + interface LoDashImplicitNumberArrayWrapperBase extends LoDashImplicitArrayWrapperBase { } interface LoDashImplicitNumberArrayWrapper extends LoDashImplicitArrayWrapper { } + interface LoDashExplicitArrayWrapperBase extends LoDashExplicitWrapperBase { + pop(): LoDashExplicitObjectWrapper; + push(...items: T[]): TWrapper; + shift(): LoDashExplicitObjectWrapper; + sort(compareFn?: (a: T, b: T) => number): TWrapper; + splice(start: number): TWrapper; + splice(start: number, deleteCount: number, ...items: T[]): TWrapper; + unshift(...items: T[]): TWrapper; + } + + interface LoDashExplicitArrayWrapper extends LoDashExplicitArrayWrapperBase> { } + + interface LoDashExplicitNillableArrayWrapper extends LoDashExplicitArrayWrapperBase> { } + interface LoDashExplicitNumberArrayWrapper extends LoDashExplicitArrayWrapper { } /********* @@ -422,33 +443,33 @@ declare namespace _ { * @return Returns the new array containing chunks. */ chunk( - array: List, + array: List | null | undefined, size?: number ): T[][]; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.chunk */ chunk(size?: number): LoDashImplicitArrayWrapper; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.chunk */ chunk(size?: number): LoDashImplicitArrayWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.chunk */ chunk(size?: number): LoDashExplicitArrayWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.chunk */ @@ -464,31 +485,31 @@ declare namespace _ { * @param array The array to compact. * @return (Array) Returns the new array of filtered values. */ - compact(array?: List): T[]; + compact(array?: List | null | undefined): T[]; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.compact */ compact(): LoDashImplicitArrayWrapper; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.compact */ compact(): LoDashImplicitArrayWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.compact */ compact(): LoDashExplicitArrayWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.compact */ @@ -532,33 +553,33 @@ declare namespace _ { * @return Returns the new array of filtered values. */ difference( - array: List, + array: List | null | undefined, ...values: Array> ): T[]; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.difference */ difference(...values: Array>): LoDashImplicitArrayWrapper; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.difference */ difference(...values: Array>): LoDashImplicitArrayWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.difference */ difference(...values: Array>): LoDashExplicitArrayWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.difference */ @@ -578,7 +599,7 @@ declare namespace _ { * @returns Returns the new array of filtered values. */ differenceBy( - array: List, + array: List | null | undefined, values?: List, iteratee?: ((value: T) => any)|string ): T[]; @@ -587,7 +608,7 @@ declare namespace _ { * @see _.differenceBy */ differenceBy( - array: List, + array: List | null | undefined, values?: List, iteratee?: W ): T[]; @@ -596,7 +617,7 @@ declare namespace _ { * @see _.differenceBy */ differenceBy( - array: List, + array: List | null | undefined, values1?: List, values2?: List, iteratee?: ((value: T) => any)|string @@ -606,7 +627,7 @@ declare namespace _ { * @see _.differenceBy */ differenceBy( - array: List, + array: List | null | undefined, values1?: List, values2?: List, iteratee?: W @@ -616,7 +637,7 @@ declare namespace _ { * @see _.differenceBy */ differenceBy( - array: List, + array: List | null | undefined, values1?: List, values2?: List, values3?: List, @@ -627,7 +648,7 @@ declare namespace _ { * @see _.differenceBy */ differenceBy( - array: List, + array: List | null | undefined, values1?: List, values2?: List, values3?: List, @@ -638,7 +659,7 @@ declare namespace _ { * @see _.differenceBy */ differenceBy( - array: List, + array: List | null | undefined, values1?: List, values2?: List, values3?: List, @@ -650,7 +671,7 @@ declare namespace _ { * @see _.differenceBy */ differenceBy( - array: List, + array: List | null | undefined, values1?: List, values2?: List, values3?: List, @@ -662,7 +683,7 @@ declare namespace _ { * @see _.differenceBy */ differenceBy( - array: List, + array: List | null | undefined, values1?: List, values2?: List, values3?: List, @@ -675,7 +696,7 @@ declare namespace _ { * @see _.differenceBy */ differenceBy( - array: List, + array: List | null | undefined, values1?: List, values2?: List, values3?: List, @@ -688,12 +709,12 @@ declare namespace _ { * @see _.differenceBy */ differenceBy( - array: List, + array: List | null | undefined, ...values: any[] ): T[]; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.differenceBy */ @@ -802,7 +823,7 @@ declare namespace _ { ): LoDashImplicitArrayWrapper; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.differenceBy */ @@ -911,7 +932,7 @@ declare namespace _ { ): LoDashImplicitArrayWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.differenceBy */ @@ -1020,7 +1041,7 @@ declare namespace _ { ): LoDashExplicitArrayWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.differenceBy */ @@ -1162,31 +1183,31 @@ declare namespace _ { * @param n The number of elements to drop. * @return Returns the slice of array. */ - drop(array: List, n?: number): T[]; + drop(array: List | null | undefined, n?: number): T[]; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.drop */ drop(n?: number): LoDashImplicitArrayWrapper; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.drop */ drop(n?: number): LoDashImplicitArrayWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.drop */ drop(n?: number): LoDashExplicitArrayWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.drop */ @@ -1203,33 +1224,33 @@ declare namespace _ { * @return Returns the slice of array. */ dropRight( - array: List, + array: List | null | undefined, n?: number ): T[]; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.dropRight */ dropRight(n?: number): LoDashImplicitArrayWrapper; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.dropRight */ dropRight(n?: number): LoDashImplicitArrayWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.dropRight */ dropRight(n?: number): LoDashExplicitArrayWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.dropRight */ @@ -1257,7 +1278,7 @@ declare namespace _ { * @return Returns the slice of array. */ dropRightWhile( - array: List, + array: List | null | undefined, predicate?: ListIterator ): TValue[]; @@ -1265,7 +1286,7 @@ declare namespace _ { * @see _.dropRightWhile */ dropRightWhile( - array: List, + array: List | null | undefined, predicate?: string ): TValue[]; @@ -1273,12 +1294,12 @@ declare namespace _ { * @see _.dropRightWhile */ dropRightWhile( - array: List, + array: List | null | undefined, predicate?: TWhere ): TValue[]; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.dropRightWhile */ @@ -1301,7 +1322,7 @@ declare namespace _ { ): LoDashImplicitArrayWrapper; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.dropRightWhile */ @@ -1324,7 +1345,7 @@ declare namespace _ { ): LoDashImplicitArrayWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.dropRightWhile */ @@ -1347,7 +1368,7 @@ declare namespace _ { ): LoDashExplicitArrayWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.dropRightWhile */ @@ -1391,7 +1412,7 @@ declare namespace _ { * @return Returns the slice of array. */ dropWhile( - array: List, + array: List | null | undefined, predicate?: ListIterator ): TValue[]; @@ -1399,7 +1420,7 @@ declare namespace _ { * @see _.dropWhile */ dropWhile( - array: List, + array: List | null | undefined, predicate?: string ): TValue[]; @@ -1407,12 +1428,12 @@ declare namespace _ { * @see _.dropWhile */ dropWhile( - array: List, + array: List | null | undefined, predicate?: TWhere ): TValue[]; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.dropWhile */ @@ -1435,7 +1456,7 @@ declare namespace _ { ): LoDashImplicitArrayWrapper; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.dropWhile */ @@ -1458,7 +1479,7 @@ declare namespace _ { ): LoDashImplicitArrayWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.dropWhile */ @@ -1481,7 +1502,7 @@ declare namespace _ { ): LoDashExplicitArrayWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.dropWhile */ @@ -1518,7 +1539,7 @@ declare namespace _ { * @return Returns array. */ fill( - array: any[], + array: any[] | null | undefined, value: T, start?: number, end?: number @@ -1528,14 +1549,14 @@ declare namespace _ { * @see _.fill */ fill( - array: List, + array: List | null | undefined, value: T, start?: number, end?: number ): List; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.fill */ @@ -1546,7 +1567,7 @@ declare namespace _ { ): LoDashImplicitArrayWrapper; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.fill */ @@ -1557,7 +1578,7 @@ declare namespace _ { ): LoDashImplicitObjectWrapper>; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.fill */ @@ -1568,7 +1589,7 @@ declare namespace _ { ): LoDashExplicitArrayWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.fill */ @@ -1600,7 +1621,7 @@ declare namespace _ { * @return Returns the index of the found element, else -1. */ findIndex( - array: List, + array: List | null | undefined, predicate?: ListIterator, fromIndex?: number ): number; @@ -1609,7 +1630,7 @@ declare namespace _ { * @see _.findIndex */ findIndex( - array: List, + array: List | null | undefined, predicate?: string, fromIndex?: number ): number; @@ -1618,13 +1639,13 @@ declare namespace _ { * @see _.findIndex */ findIndex( - array: List, + array: List | null | undefined, predicate?: W, fromIndex?: number ): number; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.findIndex */ @@ -1650,7 +1671,7 @@ declare namespace _ { ): number; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.findIndex */ @@ -1676,7 +1697,7 @@ declare namespace _ { ): number; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.findIndex */ @@ -1702,7 +1723,7 @@ declare namespace _ { ): LoDashExplicitWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.findIndex */ @@ -1748,7 +1769,7 @@ declare namespace _ { * @return Returns the index of the found element, else -1. */ findLastIndex( - array: List, + array: List | null | undefined, predicate?: ListIterator, fromIndex?: number ): number; @@ -1757,7 +1778,7 @@ declare namespace _ { * @see _.findLastIndex */ findLastIndex( - array: List, + array: List | null | undefined, predicate?: string, fromIndex?: number ): number; @@ -1766,13 +1787,13 @@ declare namespace _ { * @see _.findLastIndex */ findLastIndex( - array: List, + array: List | null | undefined, predicate?: W, fromIndex?: number ): number; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.findLastIndex */ @@ -1798,7 +1819,7 @@ declare namespace _ { ): number; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.findLastIndex */ @@ -1824,7 +1845,7 @@ declare namespace _ { ): number; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.findLastIndex */ @@ -1850,7 +1871,7 @@ declare namespace _ { ): LoDashExplicitWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.findLastIndex */ @@ -1881,28 +1902,28 @@ declare namespace _ { /** * @see _.head */ - first(array: List): T; + first(array: List | null | undefined): T | undefined; } interface LoDashImplicitWrapper { /** * @see _.head */ - first(): string; + first(): string | undefined; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.head */ - first(): T; + first(): T | undefined; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.head */ - first(): T; + first(): T | undefined; } interface LoDashExplicitWrapper { @@ -1912,14 +1933,14 @@ declare namespace _ { first(): LoDashExplicitWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.head */ first(): T; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.head */ @@ -1939,17 +1960,17 @@ declare namespace _ { * @param isDeep Specify a deep flatten. * @return Returns the new flattened array. */ - flatten(array: ListOfRecursiveArraysOrValues, isDeep: boolean): T[]; + flatten(array: ListOfRecursiveArraysOrValues | null | undefined, isDeep: boolean): T[]; /** * @see _.flatten */ - flatten(array: List>): T[]; + flatten(array: List> | null | undefined): T[]; /** * @see _.flatten */ - flatten(array: ListOfRecursiveArraysOrValues): RecursiveArray; + flatten(array: ListOfRecursiveArraysOrValues | null | undefined): RecursiveArray; } interface LoDashImplicitWrapper { @@ -1959,14 +1980,14 @@ declare namespace _ { flatten(): LoDashImplicitArrayWrapper; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.flatten */ flatten(isDeep?: boolean): LoDashImplicitArrayWrapper; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.flatten */ @@ -1980,14 +2001,14 @@ declare namespace _ { flatten(): LoDashExplicitArrayWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.flatten */ flatten(isDeep?: boolean): LoDashExplicitArrayWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.flatten */ @@ -2002,7 +2023,7 @@ declare namespace _ { * @param array The array to recursively flatten. * @return Returns the new flattened array. */ - flattenDeep(array: ListOfRecursiveArraysOrValues): T[]; + flattenDeep(array: ListOfRecursiveArraysOrValues | null | undefined): T[]; } interface LoDashImplicitWrapper { @@ -2012,14 +2033,14 @@ declare namespace _ { flattenDeep(): LoDashImplicitArrayWrapper; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.flattenDeep */ flattenDeep(): LoDashImplicitArrayWrapper; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.flattenDeep */ @@ -2033,14 +2054,14 @@ declare namespace _ { flattenDeep(): LoDashExplicitArrayWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.flattenDeep */ flattenDeep(): LoDashExplicitArrayWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.flattenDeep */ @@ -2056,7 +2077,7 @@ declare namespace _ { * @param number The maximum recursion depth. * @return Returns the new flattened array. */ - flattenDepth(array: ListOfRecursiveArraysOrValues, depth?: number): T[]; + flattenDepth(array: ListOfRecursiveArraysOrValues | null | undefined, depth?: number): T[]; } //_.fromPairs @@ -2076,19 +2097,19 @@ declare namespace _ { * // => { 'fred': 30, 'barney': 40 } */ fromPairs( - array: List<[_.StringRepresentable, T]> + array: List<[_.StringRepresentable, T]> | null | undefined ): Dictionary; /** @see _.fromPairs */ fromPairs( - array: List + array: List | null | undefined ): Dictionary; } //_.fromPairs DUMMY - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.fromPairs */ @@ -2096,7 +2117,7 @@ declare namespace _ { } //_.fromPairs DUMMY - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.fromPairs */ @@ -2113,28 +2134,28 @@ declare namespace _ { * @param array The array to query. * @return Returns the first element of array. */ - head(array: List): T; + head(array: List | null | undefined): T | undefined; } interface LoDashImplicitWrapper { /** * @see _.head */ - head(): string; + head(): string | undefined; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.head */ - head(): T; + head(): T | undefined; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.head */ - head(): T; + head(): T | undefined; } interface LoDashExplicitWrapper { @@ -2144,14 +2165,14 @@ declare namespace _ { head(): LoDashExplicitWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.head */ head(): T; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.head */ @@ -2184,13 +2205,13 @@ declare namespace _ { * // => 3 */ indexOf( - array: List, + array: List | null | undefined, value: T, fromIndex?: boolean|number ): number; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.indexOf */ @@ -2200,7 +2221,7 @@ declare namespace _ { ): number; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.indexOf */ @@ -2210,7 +2231,7 @@ declare namespace _ { ): number; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.indexOf */ @@ -2220,7 +2241,7 @@ declare namespace _ { ): LoDashExplicitWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.indexOf */ @@ -2295,7 +2316,7 @@ declare namespace _ { * @returns Returns the joined string. */ join( - array: List, + array: List | null | undefined, separator?: string ): string; } @@ -2307,14 +2328,14 @@ declare namespace _ { join(separator?: string): string; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.join */ join(separator?: string): string; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.join */ @@ -2328,14 +2349,14 @@ declare namespace _ { join(separator?: string): LoDashExplicitWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.join */ join(separator?: string): LoDashExplicitWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.join */ @@ -2445,12 +2466,12 @@ declare namespace _ { * // => 2 */ sortedIndexOf( - array: List, + array: List | null | undefined, value: T ): number; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.sortedIndexOf */ @@ -2459,7 +2480,7 @@ declare namespace _ { ): number; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.sortedIndexOf */ @@ -2468,7 +2489,7 @@ declare namespace _ { ): number; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.sortedIndexOf */ @@ -2477,7 +2498,7 @@ declare namespace _ { ): LoDashExplicitWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.sortedIndexOf */ @@ -2494,31 +2515,31 @@ declare namespace _ { * @param array The array to query. * @return Returns the slice of array. */ - initial(array: List): T[]; + initial(array: List | null | undefined): T[]; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.initial */ initial(): LoDashImplicitArrayWrapper; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.initial */ initial(): LoDashImplicitArrayWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.initial */ initial(): LoDashExplicitArrayWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.initial */ @@ -2534,31 +2555,31 @@ declare namespace _ { * @param arrays The arrays to inspect. * @return Returns the new array of shared values. */ - intersection(...arrays: Array>): T[]; + intersection(...arrays: Array | null | undefined>): T[]; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.intersection */ intersection(...arrays: Array>): LoDashImplicitArrayWrapper; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.intersection */ intersection(...arrays: Array>): LoDashImplicitArrayWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.intersection */ intersection(...arrays: Array>): LoDashExplicitArrayWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.intersection */ @@ -2573,28 +2594,28 @@ declare namespace _ { * @param array The array to query. * @return Returns the last element of array. */ - last(array: List): T; + last(array: List | null | undefined): T | undefined; } interface LoDashImplicitWrapper { /** * @see _.last */ - last(): string; + last(): string | undefined; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.last */ - last(): T; + last(): T | undefined; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.last */ - last(): T; + last(): T | undefined; } interface LoDashExplicitWrapper { @@ -2604,14 +2625,14 @@ declare namespace _ { last(): LoDashExplicitWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.last */ last(): T; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.last */ @@ -2629,13 +2650,13 @@ declare namespace _ { * @return Returns the index of the matched value, else -1. */ lastIndexOf( - array: List, + array: List | null | undefined, value: T, fromIndex?: boolean|number ): number; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.lastIndexOf */ @@ -2645,7 +2666,7 @@ declare namespace _ { ): number; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.lastIndexOf */ @@ -2655,7 +2676,7 @@ declare namespace _ { ): number; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.lastIndexOf */ @@ -2665,7 +2686,7 @@ declare namespace _ { ): LoDashExplicitWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.lastIndexOf */ @@ -2685,30 +2706,30 @@ declare namespace _ { * @return Returns the nth element of `array`. */ nth( - array: List, + array: List | null | undefined, n?: number - ): T; + ): T | undefined; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.nth */ nth( n?: number - ): T; + ): T | undefined; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.nth */ nth( n?:number - ): TResult; + ): TResult | undefined; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.nth */ @@ -2717,7 +2738,7 @@ declare namespace _ { ): LoDashExplicitWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.nth */ @@ -2971,31 +2992,31 @@ declare namespace _ { * @param array The array to query. * @return Returns the slice of array. */ - tail(array: List): T[]; + tail(array: List | null | undefined): T[]; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.tail */ tail(): LoDashImplicitArrayWrapper; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.tail */ tail(): LoDashImplicitArrayWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.tail */ tail(): LoDashExplicitArrayWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.tail */ @@ -3013,13 +3034,13 @@ declare namespace _ { * @return Returns the slice of array. */ slice( - array: T[], + array: T[] | null | undefined, start?: number, end?: number ): T[]; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.slice */ @@ -3029,7 +3050,7 @@ declare namespace _ { ): LoDashImplicitArrayWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.slice */ @@ -3059,40 +3080,8 @@ declare namespace _ { * _.sortedIndex([4, 5], 4); * // => 0 */ - sortedIndex( - array: List, - value: T - ): number; - - /** - * @see _.sortedIndex - */ sortedIndex( - array: List, - value: T - ): number; - - /** - * @see _.sortedIndex - */ - sortedIndex( - array: List, - value: T - ): number; - - /** - * @see _.sortedIndex - */ - sortedIndex( - array: List, - value: T - ): number; - - /** - * @see _.sortedIndex - */ - sortedIndex( - array: List, + array: List | null | undefined, value: T ): number; } @@ -3106,14 +3095,7 @@ declare namespace _ { ): number; } - interface LoDashImplicitArrayWrapper { - /** - * @see _.sortedIndex - */ - sortedIndex( - value: T - ): number; - + interface LoDashImplicitArrayWrapperBase { /** * @see _.sortedIndex */ @@ -3122,27 +3104,13 @@ declare namespace _ { ): number; } - interface LoDashImplicitObjectWrapper { - /** - * @see _.sortedIndex - */ - sortedIndex( - value: T - ): number; - + interface LoDashImplicitObjectWrapperBase { /** * @see _.sortedIndex */ sortedIndex( value: T ): number; - - /** - * @see _.sortedIndex - */ - sortedIndex( - value: T - ): number; } interface LoDashExplicitWrapper { @@ -3154,50 +3122,22 @@ declare namespace _ { ): LoDashExplicitWrapper; } - interface LoDashExplicitArrayWrapper { - /** - * @see _.sortedIndex - */ - sortedIndex( - value: T - ): LoDashExplicitWrapper; - + interface LoDashExplicitArrayWrapperBase { /** * @see _.sortedIndex */ sortedIndex( value: T ): LoDashExplicitWrapper; - - /** - * @see _.sortedIndex - */ - sortedIndex( - value: T - ): LoDashExplicitWrapper; } - interface LoDashExplicitObjectWrapper { - /** - * @see _.sortedIndex - */ - sortedIndex( - value: T - ): LoDashExplicitWrapper; - + interface LoDashExplicitObjectWrapperBase { /** * @see _.sortedIndex */ sortedIndex( value: T ): LoDashExplicitWrapper; - - /** - * @see _.sortedIndex - */ - sortedIndex( - value: T - ): LoDashExplicitWrapper; } // _.sortedIndexBy @@ -3226,7 +3166,7 @@ declare namespace _ { * // => 0 */ sortedIndexBy( - array: List, + array: List | null | undefined, value: T, iteratee: (x: T) => TSort ): number; @@ -3235,7 +3175,7 @@ declare namespace _ { * @see _.sortedIndexBy */ sortedIndexBy( - array: List, + array: List | null | undefined, value: T, iteratee: (x: T) => any ): number; @@ -3244,7 +3184,7 @@ declare namespace _ { * @see _.sortedIndexBy */ sortedIndexBy( - array: List, + array: List | null | undefined, value: T, iteratee: string ): number; @@ -3253,7 +3193,7 @@ declare namespace _ { * @see _.sortedIndexBy */ sortedIndexBy( - array: List, + array: List | null | undefined, value: T, iteratee: W ): number; @@ -3262,7 +3202,7 @@ declare namespace _ { * @see _.sortedIndexBy */ sortedIndexBy( - array: List, + array: List | null | undefined, value: T, iteratee: Object ): number; @@ -3278,7 +3218,7 @@ declare namespace _ { ): number; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.sortedIndexBy */ @@ -3304,7 +3244,7 @@ declare namespace _ { ): number; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.sortedIndexBy */ @@ -3356,7 +3296,7 @@ declare namespace _ { ): LoDashExplicitWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.sortedIndexBy */ @@ -3382,7 +3322,7 @@ declare namespace _ { ): LoDashExplicitWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.sortedIndexBy */ @@ -3442,40 +3382,8 @@ declare namespace _ { * _.sortedLastIndex([4, 5], 4); * // => 1 */ - sortedLastIndex( - array: List, - value: T - ): number; - - /** - * @see _.sortedLastIndex - */ sortedLastIndex( - array: List, - value: T - ): number; - - /** - * @see _.sortedLastIndex - */ - sortedLastIndex( - array: List, - value: T - ): number; - - /** - * @see _.sortedLastIndex - */ - sortedLastIndex( - array: List, - value: T - ): number; - - /** - * @see _.sortedLastIndex - */ - sortedLastIndex( - array: List, + array: List | null | undefined, value: T ): number; } @@ -3484,74 +3392,39 @@ declare namespace _ { /** * @see _.sortedLastIndex */ - sortedLastIndex( + sortedLastIndex( value: string ): number; } - interface LoDashImplicitArrayWrapper { - /** - * @see _.sortedLastIndex - */ - sortedLastIndex( - value: T - ): number; - + interface LoDashImplicitArrayWrapperBase { /** * @see _.sortedLastIndex */ sortedLastIndex( value: T ): number; - - /** - * @see _.sortedLastIndex - */ - sortedLastIndex( - value: T - ): number; } - interface LoDashImplicitObjectWrapper { - /** - * @see _.sortedLastIndex - */ - sortedLastIndex( - value: T - ): number; - + interface LoDashImplicitObjectWrapperBase { /** * @see _.sortedLastIndex */ sortedLastIndex( value: T ): number; - - /** - * @see _.sortedLastIndex - */ - sortedLastIndex( - value: T - ): number; } interface LoDashExplicitWrapper { /** * @see _.sortedLastIndex */ - sortedLastIndex( + sortedLastIndex( value: string ): LoDashExplicitWrapper; } - interface LoDashExplicitArrayWrapper { - /** - * @see _.sortedLastIndex - */ - sortedLastIndex( - value: T - ): LoDashExplicitWrapper; - + interface LoDashExplicitArrayWrapperBase { /** * @see _.sortedLastIndex */ @@ -3560,27 +3433,13 @@ declare namespace _ { ): LoDashExplicitWrapper; } - interface LoDashExplicitObjectWrapper { - /** - * @see _.sortedLastIndex - */ - sortedLastIndex( - value: T - ): LoDashExplicitWrapper; - + interface LoDashExplicitObjectWrapperBase { /** * @see _.sortedLastIndex */ sortedLastIndex( value: T ): LoDashExplicitWrapper; - - /** - * @see _.sortedLastIndex - */ - sortedLastIndex( - value: T - ): LoDashExplicitWrapper; } //_.sortedLastIndexBy @@ -3604,7 +3463,7 @@ declare namespace _ { * // => 1 */ sortedLastIndexBy( - array: List, + array: List | null | undefined, value: T, iteratee: (x: T) => TSort ): number; @@ -3613,7 +3472,7 @@ declare namespace _ { * @see _.sortedLastIndexBy */ sortedLastIndexBy( - array: List, + array: List | null | undefined, value: T, iteratee: (x: T) => any ): number; @@ -3622,7 +3481,7 @@ declare namespace _ { * @see _.sortedLastIndexBy */ sortedLastIndexBy( - array: List, + array: List | null | undefined, value: T, iteratee: string ): number; @@ -3631,7 +3490,7 @@ declare namespace _ { * @see _.sortedLastIndexBy */ sortedLastIndexBy( - array: List, + array: List | null | undefined, value: T, iteratee: W ): number; @@ -3640,7 +3499,7 @@ declare namespace _ { * @see _.sortedLastIndexBy */ sortedLastIndexBy( - array: List, + array: List | null | undefined, value: T, iteratee: Object ): number; @@ -3656,7 +3515,7 @@ declare namespace _ { ): number; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.sortedLastIndexBy */ @@ -3682,7 +3541,7 @@ declare namespace _ { ): number; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.sortedLastIndexBy */ @@ -3734,7 +3593,7 @@ declare namespace _ { ): LoDashExplicitWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.sortedLastIndexBy */ @@ -3760,7 +3619,7 @@ declare namespace _ { ): LoDashExplicitWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.sortedLastIndexBy */ @@ -3819,10 +3678,10 @@ declare namespace _ { * _.sortedLastIndexOf([1, 1, 2, 2], 2); * // => 3 */ - sortedLastIndexOf( - array: List, - ...values: any[] - ): any[]; + sortedLastIndexOf( + array: List | null | undefined, + value: T + ): number; } //_.tail @@ -3830,31 +3689,31 @@ declare namespace _ { /** * @see _.rest */ - tail(array: List): T[]; + tail(array: List | null | undefined): T[]; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.rest */ tail(): LoDashImplicitArrayWrapper; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.rest */ tail(): LoDashImplicitArrayWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.rest */ tail(): LoDashExplicitArrayWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.rest */ @@ -3871,33 +3730,33 @@ declare namespace _ { * @return Returns the slice of array. */ take( - array: List, + array: List | null | undefined, n?: number ): T[]; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.take */ take(n?: number): LoDashImplicitArrayWrapper; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.take */ take(n?: number): LoDashImplicitArrayWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.take */ take(n?: number): LoDashExplicitArrayWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.take */ @@ -3914,33 +3773,33 @@ declare namespace _ { * @return Returns the slice of array. */ takeRight( - array: List, + array: List | null | undefined, n?: number ): T[]; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.takeRight */ takeRight(n?: number): LoDashImplicitArrayWrapper; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.takeRight */ takeRight(n?: number): LoDashImplicitArrayWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.takeRight */ takeRight(n?: number): LoDashExplicitArrayWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.takeRight */ @@ -3968,7 +3827,7 @@ declare namespace _ { * @return Returns the slice of array. */ takeRightWhile( - array: List, + array: List | null | undefined, predicate?: ListIterator ): TValue[]; @@ -3976,7 +3835,7 @@ declare namespace _ { * @see _.takeRightWhile */ takeRightWhile( - array: List, + array: List | null | undefined, predicate?: string ): TValue[]; @@ -3984,12 +3843,12 @@ declare namespace _ { * @see _.takeRightWhile */ takeRightWhile( - array: List, + array: List | null | undefined, predicate?: TWhere ): TValue[]; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.takeRightWhile */ @@ -4012,7 +3871,7 @@ declare namespace _ { ): LoDashImplicitArrayWrapper; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.takeRightWhile */ @@ -4035,7 +3894,7 @@ declare namespace _ { ): LoDashImplicitArrayWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.takeRightWhile */ @@ -4058,7 +3917,7 @@ declare namespace _ { ): LoDashExplicitArrayWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.takeRightWhile */ @@ -4102,7 +3961,7 @@ declare namespace _ { * @return Returns the slice of array. */ takeWhile( - array: List, + array: List | null | undefined, predicate?: ListIterator ): TValue[]; @@ -4110,7 +3969,7 @@ declare namespace _ { * @see _.takeWhile */ takeWhile( - array: List, + array: List | null | undefined, predicate?: string ): TValue[]; @@ -4118,12 +3977,12 @@ declare namespace _ { * @see _.takeWhile */ takeWhile( - array: List, + array: List | null | undefined, predicate?: TWhere ): TValue[]; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.takeWhile */ @@ -4146,7 +4005,7 @@ declare namespace _ { ): LoDashImplicitArrayWrapper; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.takeWhile */ @@ -4169,7 +4028,7 @@ declare namespace _ { ): LoDashImplicitArrayWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.takeWhile */ @@ -4192,7 +4051,7 @@ declare namespace _ { ): LoDashExplicitArrayWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.takeWhile */ @@ -4224,45 +4083,45 @@ declare namespace _ { * @param arrays The arrays to inspect. * @return Returns the new array of combined values. */ - union(...arrays: Array>): T[]; + union(...arrays: Array | null | undefined>): T[]; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.union */ - union(...arrays: Array>): LoDashImplicitArrayWrapper; + union(...arrays: Array | null | undefined>): LoDashImplicitArrayWrapper; /** * @see _.union */ - union(...arrays: Array>): LoDashImplicitArrayWrapper; + union(...arrays: Array | null | undefined>): LoDashImplicitArrayWrapper; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.union */ - union(...arrays: Array>): LoDashImplicitArrayWrapper; + union(...arrays: Array | null | undefined>): LoDashImplicitArrayWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.union */ - union(...arrays: Array>): LoDashExplicitArrayWrapper; + union(...arrays: Array | null | undefined>): LoDashExplicitArrayWrapper; /** * @see _.union */ - union(...arrays: Array>): LoDashExplicitArrayWrapper; + union(...arrays: Array | null | undefined>): LoDashExplicitArrayWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.union */ - union(...arrays: Array>): LoDashExplicitArrayWrapper; + union(...arrays: Array | null | undefined>): LoDashExplicitArrayWrapper; } //_.unionBy @@ -4277,7 +4136,7 @@ declare namespace _ { * @return Returns the new array of combined values. */ unionBy( - arrays: List, + arrays: List | null | undefined, iteratee?: (value: T) => any ): T[]; @@ -4285,7 +4144,7 @@ declare namespace _ { * @see _.unionBy */ unionBy( - arrays: List, + arrays: List | null | undefined, iteratee?: W ): T[]; @@ -4293,8 +4152,8 @@ declare namespace _ { * @see _.unionBy */ unionBy( - arrays1: List, - arrays2: List, + arrays1: List | null | undefined, + arrays2: List | null | undefined, iteratee?: (value: T) => any ): T[]; @@ -4302,8 +4161,8 @@ declare namespace _ { * @see _.unionBy */ unionBy( - arrays1: List, - arrays2: List, + arrays1: List | null | undefined, + arrays2: List | null | undefined, iteratee?: W ): T[]; @@ -4311,9 +4170,9 @@ declare namespace _ { * @see _.unionBy */ unionBy( - arrays1: List, - arrays2: List, - arrays3: List, + arrays1: List | null | undefined, + arrays2: List | null | undefined, + arrays3: List | null | undefined, iteratee?: (value: T) => any ): T[]; @@ -4321,9 +4180,9 @@ declare namespace _ { * @see _.unionBy */ unionBy( - arrays1: List, - arrays2: List, - arrays3: List, + arrays1: List | null | undefined, + arrays2: List | null | undefined, + arrays3: List | null | undefined, iteratee?: W ): T[]; @@ -4331,10 +4190,10 @@ declare namespace _ { * @see _.unionBy */ unionBy( - arrays1: List, - arrays2: List, - arrays3: List, - arrays4: List, + arrays1: List | null | undefined, + arrays2: List | null | undefined, + arrays3: List | null | undefined, + arrays4: List | null | undefined, iteratee?: (value: T) => any ): T[]; @@ -4342,10 +4201,10 @@ declare namespace _ { * @see _.unionBy */ unionBy( - arrays1: List, - arrays2: List, - arrays3: List, - arrays4: List, + arrays1: List | null | undefined, + arrays2: List | null | undefined, + arrays3: List | null | undefined, + arrays4: List | null | undefined, iteratee?: W ): T[]; @@ -4353,11 +4212,11 @@ declare namespace _ { * @see _.unionBy */ unionBy( - arrays1: List, - arrays2: List, - arrays3: List, - arrays4: List, - arrays5: List, + arrays1: List | null | undefined, + arrays2: List | null | undefined, + arrays3: List | null | undefined, + arrays4: List | null | undefined, + arrays5: List | null | undefined, iteratee?: (value: T) => any ): T[]; @@ -4365,11 +4224,11 @@ declare namespace _ { * @see _.unionBy */ unionBy( - arrays1: List, - arrays2: List, - arrays3: List, - arrays4: List, - arrays5: List, + arrays1: List | null | undefined, + arrays2: List | null | undefined, + arrays3: List | null | undefined, + arrays4: List | null | undefined, + arrays5: List | null | undefined, iteratee?: W ): T[]; @@ -4377,12 +4236,12 @@ declare namespace _ { * @see _.unionBy */ unionBy( - arrays: List, + arrays: List | null | undefined, ...iteratee: any[] ): T[]; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.unionBy */ @@ -4401,7 +4260,7 @@ declare namespace _ { * @see _.unionBy */ unionBy( - arrays2: List, + arrays2: List | null | undefined, iteratee?: (value: T) => any ): LoDashImplicitArrayWrapper; @@ -4409,7 +4268,7 @@ declare namespace _ { * @see _.unionBy */ unionBy( - arrays2: List, + arrays2: List | null | undefined, iteratee?: W ): LoDashImplicitArrayWrapper; @@ -4417,8 +4276,8 @@ declare namespace _ { * @see _.unionBy */ unionBy( - arrays2: List, - arrays3: List, + arrays2: List | null | undefined, + arrays3: List | null | undefined, iteratee?: (value: T) => any ): LoDashImplicitArrayWrapper; @@ -4426,8 +4285,8 @@ declare namespace _ { * @see _.unionBy */ unionBy( - arrays2: List, - arrays3: List, + arrays2: List | null | undefined, + arrays3: List | null | undefined, iteratee?: W ): LoDashImplicitArrayWrapper; @@ -4435,9 +4294,9 @@ declare namespace _ { * @see _.unionBy */ unionBy( - arrays2: List, - arrays3: List, - arrays4: List, + arrays2: List | null | undefined, + arrays3: List | null | undefined, + arrays4: List | null | undefined, iteratee?: (value: T) => any ): LoDashImplicitArrayWrapper; @@ -4445,9 +4304,9 @@ declare namespace _ { * @see _.unionBy */ unionBy( - arrays2: List, - arrays3: List, - arrays4: List, + arrays2: List | null | undefined, + arrays3: List | null | undefined, + arrays4: List | null | undefined, iteratee?: W ): LoDashImplicitArrayWrapper; @@ -4455,10 +4314,10 @@ declare namespace _ { * @see _.unionBy */ unionBy( - arrays2: List, - arrays3: List, - arrays4: List, - arrays5: List, + arrays2: List | null | undefined, + arrays3: List | null | undefined, + arrays4: List | null | undefined, + arrays5: List | null | undefined, iteratee?: (value: T) => any ): LoDashImplicitArrayWrapper; @@ -4466,10 +4325,10 @@ declare namespace _ { * @see _.unionBy */ unionBy( - arrays2: List, - arrays3: List, - arrays4: List, - arrays5: List, + arrays2: List | null | undefined, + arrays3: List | null | undefined, + arrays4: List | null | undefined, + arrays5: List | null | undefined, iteratee?: W ): LoDashImplicitArrayWrapper; @@ -4481,7 +4340,7 @@ declare namespace _ { ): LoDashImplicitArrayWrapper; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.unionBy */ @@ -4500,7 +4359,7 @@ declare namespace _ { * @see _.unionBy */ unionBy( - arrays2: List, + arrays2: List | null | undefined, iteratee?: (value: T) => any ): LoDashImplicitArrayWrapper; @@ -4508,7 +4367,7 @@ declare namespace _ { * @see _.unionBy */ unionBy( - arrays2: List, + arrays2: List | null | undefined, iteratee?: W ): LoDashImplicitArrayWrapper; @@ -4516,8 +4375,8 @@ declare namespace _ { * @see _.unionBy */ unionBy( - arrays2: List, - arrays3: List, + arrays2: List | null | undefined, + arrays3: List | null | undefined, iteratee?: (value: T) => any ): LoDashImplicitArrayWrapper; @@ -4525,8 +4384,8 @@ declare namespace _ { * @see _.unionBy */ unionBy( - arrays2: List, - arrays3: List, + arrays2: List | null | undefined, + arrays3: List | null | undefined, iteratee?: W ): LoDashImplicitArrayWrapper; @@ -4534,9 +4393,9 @@ declare namespace _ { * @see _.unionBy */ unionBy( - arrays2: List, - arrays3: List, - arrays4: List, + arrays2: List | null | undefined, + arrays3: List | null | undefined, + arrays4: List | null | undefined, iteratee?: (value: T) => any ): LoDashImplicitArrayWrapper; @@ -4544,9 +4403,9 @@ declare namespace _ { * @see _.unionBy */ unionBy( - arrays2: List, - arrays3: List, - arrays4: List, + arrays2: List | null | undefined, + arrays3: List | null | undefined, + arrays4: List | null | undefined, iteratee?: W ): LoDashImplicitArrayWrapper; @@ -4554,10 +4413,10 @@ declare namespace _ { * @see _.unionBy */ unionBy( - arrays2: List, - arrays3: List, - arrays4: List, - arrays5: List, + arrays2: List | null | undefined, + arrays3: List | null | undefined, + arrays4: List | null | undefined, + arrays5: List | null | undefined, iteratee?: (value: T) => any ): LoDashImplicitArrayWrapper; @@ -4565,10 +4424,10 @@ declare namespace _ { * @see _.unionBy */ unionBy( - arrays2: List, - arrays3: List, - arrays4: List, - arrays5: List, + arrays2: List | null | undefined, + arrays3: List | null | undefined, + arrays4: List | null | undefined, + arrays5: List | null | undefined, iteratee?: W ): LoDashImplicitArrayWrapper; @@ -4580,7 +4439,7 @@ declare namespace _ { ): LoDashImplicitArrayWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.unionBy */ @@ -4599,7 +4458,7 @@ declare namespace _ { * @see _.unionBy */ unionBy( - arrays2: List, + arrays2: List | null | undefined, iteratee?: (value: T) => any ): LoDashExplicitArrayWrapper; @@ -4607,7 +4466,7 @@ declare namespace _ { * @see _.unionBy */ unionBy( - arrays2: List, + arrays2: List | null | undefined, iteratee?: W ): LoDashExplicitArrayWrapper; @@ -4615,8 +4474,8 @@ declare namespace _ { * @see _.unionBy */ unionBy( - arrays2: List, - arrays3: List, + arrays2: List | null | undefined, + arrays3: List | null | undefined, iteratee?: (value: T) => any ): LoDashExplicitArrayWrapper; @@ -4624,8 +4483,8 @@ declare namespace _ { * @see _.unionBy */ unionBy( - arrays2: List, - arrays3: List, + arrays2: List | null | undefined, + arrays3: List | null | undefined, iteratee?: W ): LoDashExplicitArrayWrapper; @@ -4633,9 +4492,9 @@ declare namespace _ { * @see _.unionBy */ unionBy( - arrays2: List, - arrays3: List, - arrays4: List, + arrays2: List | null | undefined, + arrays3: List | null | undefined, + arrays4: List | null | undefined, iteratee?: (value: T) => any ): LoDashExplicitArrayWrapper; @@ -4643,9 +4502,9 @@ declare namespace _ { * @see _.unionBy */ unionBy( - arrays2: List, - arrays3: List, - arrays4: List, + arrays2: List | null | undefined, + arrays3: List | null | undefined, + arrays4: List | null | undefined, iteratee?: W ): LoDashExplicitArrayWrapper; @@ -4653,10 +4512,10 @@ declare namespace _ { * @see _.unionBy */ unionBy( - arrays2: List, - arrays3: List, - arrays4: List, - arrays5: List, + arrays2: List | null | undefined, + arrays3: List | null | undefined, + arrays4: List | null | undefined, + arrays5: List | null | undefined, iteratee?: (value: T) => any ): LoDashExplicitArrayWrapper; @@ -4664,10 +4523,10 @@ declare namespace _ { * @see _.unionBy */ unionBy( - arrays2: List, - arrays3: List, - arrays4: List, - arrays5: List, + arrays2: List | null | undefined, + arrays3: List | null | undefined, + arrays4: List | null | undefined, + arrays5: List | null | undefined, iteratee?: W ): LoDashExplicitArrayWrapper; @@ -4679,7 +4538,7 @@ declare namespace _ { ): LoDashExplicitArrayWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.unionBy */ @@ -4698,7 +4557,7 @@ declare namespace _ { * @see _.unionBy */ unionBy( - arrays2: List, + arrays2: List | null | undefined, iteratee?: (value: T) => any ): LoDashExplicitArrayWrapper; @@ -4706,7 +4565,7 @@ declare namespace _ { * @see _.unionBy */ unionBy( - arrays2: List, + arrays2: List | null | undefined, iteratee?: W ): LoDashExplicitArrayWrapper; @@ -4714,8 +4573,8 @@ declare namespace _ { * @see _.unionBy */ unionBy( - arrays2: List, - arrays3: List, + arrays2: List | null | undefined, + arrays3: List | null | undefined, iteratee?: (value: T) => any ): LoDashExplicitArrayWrapper; @@ -4723,8 +4582,8 @@ declare namespace _ { * @see _.unionBy */ unionBy( - arrays2: List, - arrays3: List, + arrays2: List | null | undefined, + arrays3: List | null | undefined, iteratee?: W ): LoDashExplicitArrayWrapper; @@ -4732,9 +4591,9 @@ declare namespace _ { * @see _.unionBy */ unionBy( - arrays2: List, - arrays3: List, - arrays4: List, + arrays2: List | null | undefined, + arrays3: List | null | undefined, + arrays4: List | null | undefined, iteratee?: (value: T) => any ): LoDashExplicitArrayWrapper; @@ -4742,9 +4601,9 @@ declare namespace _ { * @see _.unionBy */ unionBy( - arrays2: List, - arrays3: List, - arrays4: List, + arrays2: List | null | undefined, + arrays3: List | null | undefined, + arrays4: List | null | undefined, iteratee?: W ): LoDashExplicitArrayWrapper; @@ -4752,10 +4611,10 @@ declare namespace _ { * @see _.unionBy */ unionBy( - arrays2: List, - arrays3: List, - arrays4: List, - arrays5: List, + arrays2: List | null | undefined, + arrays3: List | null | undefined, + arrays4: List | null | undefined, + arrays5: List | null | undefined, iteratee?: (value: T) => any ): LoDashExplicitArrayWrapper; @@ -4763,10 +4622,10 @@ declare namespace _ { * @see _.unionBy */ unionBy( - arrays2: List, - arrays3: List, - arrays4: List, - arrays5: List, + arrays2: List | null | undefined, + arrays3: List | null | undefined, + arrays4: List | null | undefined, + arrays5: List | null | undefined, iteratee?: W ): LoDashExplicitArrayWrapper; @@ -4797,14 +4656,14 @@ declare namespace _ { * // => [2, 1] */ uniq( - array: List + array: List | null | undefined ): T[]; /** * @see _.uniq */ uniq( - array: List + array: List | null | undefined ): T[]; } @@ -4815,7 +4674,7 @@ declare namespace _ { uniq(): LoDashImplicitArrayWrapper; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.uniq */ @@ -4827,7 +4686,7 @@ declare namespace _ { uniq(): LoDashImplicitArrayWrapper; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { uniq(): LoDashImplicitArrayWrapper; /** @@ -4843,7 +4702,7 @@ declare namespace _ { uniq(): LoDashExplicitArrayWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.uniq */ @@ -4855,7 +4714,7 @@ declare namespace _ { uniq(): LoDashExplicitArrayWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.uniq */ @@ -4890,7 +4749,7 @@ declare namespace _ { * // => [{ 'x': 1 }, { 'x': 2 }] */ uniqBy( - array: List, + array: List | null | undefined, iteratee: ListIterator ): T[]; @@ -4898,7 +4757,7 @@ declare namespace _ { * @see _.uniqBy */ uniqBy( - array: List, + array: List | null | undefined, iteratee: ListIterator ): T[]; @@ -4906,7 +4765,7 @@ declare namespace _ { * @see _.uniqBy */ uniqBy( - array: List, + array: List | null | undefined, iteratee: string ): T[]; @@ -4914,7 +4773,7 @@ declare namespace _ { * @see _.uniqBy */ uniqBy( - array: List, + array: List | null | undefined, iteratee: Object ): T[]; @@ -4922,7 +4781,7 @@ declare namespace _ { * @see _.uniqBy */ uniqBy( - array: List, + array: List | null | undefined, iteratee: TWhere ): T[]; } @@ -4936,7 +4795,7 @@ declare namespace _ { ): LoDashImplicitArrayWrapper; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.uniqBy */ @@ -4959,7 +4818,7 @@ declare namespace _ { ): LoDashImplicitArrayWrapper; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.uniqBy */ @@ -5005,7 +4864,7 @@ declare namespace _ { ): LoDashExplicitArrayWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.uniqBy */ @@ -5028,7 +4887,7 @@ declare namespace _ { ): LoDashExplicitArrayWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.uniqBy */ @@ -5082,14 +4941,14 @@ declare namespace _ { * // => [1, 2] */ sortedUniq( - array: List + array: List | null | undefined ): T[]; /** * @see _.sortedUniq */ sortedUniq( - array: List + array: List | null | undefined ): T[]; } @@ -5100,7 +4959,7 @@ declare namespace _ { sortedUniq(): LoDashImplicitArrayWrapper; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.sortedUniq */ @@ -5112,7 +4971,7 @@ declare namespace _ { sortedUniq(): LoDashImplicitArrayWrapper; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { sortedUniq(): LoDashImplicitArrayWrapper; /** @@ -5128,7 +4987,7 @@ declare namespace _ { sortedUniq(): LoDashExplicitArrayWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.sortedUniq */ @@ -5140,7 +4999,7 @@ declare namespace _ { sortedUniq(): LoDashExplicitArrayWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.sortedUniq */ @@ -5170,7 +5029,7 @@ declare namespace _ { * // => [1.1, 2.2] */ sortedUniqBy( - array: List, + array: List | null | undefined, iteratee: ListIterator ): T[]; @@ -5178,7 +5037,7 @@ declare namespace _ { * @see _.sortedUniqBy */ sortedUniqBy( - array: List, + array: List | null | undefined, iteratee: ListIterator ): T[]; @@ -5186,7 +5045,7 @@ declare namespace _ { * @see _.sortedUniqBy */ sortedUniqBy( - array: List, + array: List | null | undefined, iteratee: string ): T[]; @@ -5194,7 +5053,7 @@ declare namespace _ { * @see _.sortedUniqBy */ sortedUniqBy( - array: List, + array: List | null | undefined, iteratee: Object ): T[]; @@ -5202,7 +5061,7 @@ declare namespace _ { * @see _.sortedUniqBy */ sortedUniqBy( - array: List, + array: List | null | undefined, iteratee: TWhere ): T[]; } @@ -5216,7 +5075,7 @@ declare namespace _ { ): LoDashImplicitArrayWrapper; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.sortedUniqBy */ @@ -5239,7 +5098,7 @@ declare namespace _ { ): LoDashImplicitArrayWrapper; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.sortedUniqBy */ @@ -5285,7 +5144,7 @@ declare namespace _ { ): LoDashExplicitArrayWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.sortedUniqBy */ @@ -5308,7 +5167,7 @@ declare namespace _ { ): LoDashExplicitArrayWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.sortedUniqBy */ @@ -5407,31 +5266,31 @@ declare namespace _ { * @param array The array of grouped elements to process. * @return Returns the new array of regrouped elements. */ - unzip(array: List>): T[][]; + unzip(array: List> | null | undefined): T[][]; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.unzip */ unzip(): LoDashImplicitArrayWrapper; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.unzip */ unzip(): LoDashImplicitArrayWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.unzip */ unzip(): LoDashExplicitArrayWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.unzip */ @@ -5451,12 +5310,12 @@ declare namespace _ { * @return Returns the new array of regrouped elements. */ unzipWith( - array: List>, + array: List> | null | undefined, iteratee?: MemoIterator ): TResult[]; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.unzipWith */ @@ -5465,7 +5324,7 @@ declare namespace _ { ): LoDashImplicitArrayWrapper; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.unzipWith */ @@ -5484,33 +5343,33 @@ declare namespace _ { * @return Returns the new array of filtered values. */ without( - array: List, + array: List | null | undefined, ...values: T[] ): T[]; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.without */ without(...values: T[]): LoDashImplicitArrayWrapper; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.without */ without(...values: T[]): LoDashImplicitArrayWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.without */ without(...values: T[]): LoDashExplicitArrayWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.without */ @@ -5525,35 +5384,35 @@ declare namespace _ { * @param arrays The arrays to inspect. * @return Returns the new array of values. */ - xor(...arrays: Array>): T[]; + xor(...arrays: Array | null | undefined>): T[]; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.xor */ - xor(...arrays: Array>): LoDashImplicitArrayWrapper; + xor(...arrays: Array | null | undefined>): LoDashImplicitArrayWrapper; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.xor */ - xor(...arrays: Array>): LoDashImplicitArrayWrapper; + xor(...arrays: Array | null | undefined>): LoDashImplicitArrayWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.xor */ - xor(...arrays: Array>): LoDashExplicitArrayWrapper; + xor(...arrays: Array | null | undefined>): LoDashExplicitArrayWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.xor */ - xor(...arrays: Array>): LoDashExplicitArrayWrapper; + xor(...arrays: Array | null | undefined>): LoDashExplicitArrayWrapper; } //_.xorBy DUMMY @@ -5620,35 +5479,35 @@ declare namespace _ { * @param arrays The arrays to process. * @return Returns the new array of grouped elements. */ - zip(...arrays: Array>): T[][]; + zip(...arrays: Array | null | undefined>): T[][]; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.zip */ - zip(...arrays: Array>): _.LoDashImplicitArrayWrapper; + zip(...arrays: Array | null | undefined>): _.LoDashImplicitArrayWrapper; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.zip */ - zip(...arrays: Array>): _.LoDashImplicitArrayWrapper; + zip(...arrays: Array | null | undefined>): _.LoDashImplicitArrayWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.zip */ - zip(...arrays: Array>): _.LoDashExplicitArrayWrapper; + zip(...arrays: Array | null | undefined>): _.LoDashExplicitArrayWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.zip */ - zip(...arrays: Array>): _.LoDashExplicitArrayWrapper; + zip(...arrays: Array | null | undefined>): _.LoDashExplicitArrayWrapper; } //_.zipObject @@ -5908,9 +5767,13 @@ declare namespace _ { chain(value: number): LoDashExplicitWrapper; chain(value: string): LoDashExplicitWrapper; chain(value: boolean): LoDashExplicitWrapper; + chain(value: null | undefined): LoDashExplicitWrapper; chain(value: T[]): LoDashExplicitArrayWrapper; chain(value: ReadonlyArray): LoDashExplicitArrayWrapper; + chain(value: T[] | null | undefined): LoDashExplicitNillableArrayWrapper; + chain(value: ReadonlyArray | null | undefined): LoDashExplicitNillableArrayWrapper; chain(value: T): LoDashExplicitObjectWrapper; + chain(value: T | null | undefined): LoDashExplicitObjectWrapper; chain(value: any): LoDashExplicitWrapper; } @@ -5928,6 +5791,13 @@ declare namespace _ { chain(): LoDashExplicitArrayWrapper; } + interface LoDashImplicitNillableArrayWrapper { + /** + * @see _.chain + */ + chain(): LoDashExplicitNillableArrayWrapper; + } + interface LoDashImplicitObjectWrapper { /** * @see _.chain @@ -5935,6 +5805,13 @@ declare namespace _ { chain(): LoDashExplicitObjectWrapper; } + interface LoDashImplicitNillableObjectWrapper { + /** + * @see _.chain + */ + chain(): LoDashExplicitNillableObjectWrapper; + } + interface LoDashExplicitWrapperBase { /** * @see _.chain @@ -6268,33 +6145,33 @@ declare namespace _ { * @return Returns the new array of picked elements. */ at( - collection: List|Dictionary, + collection: List|Dictionary | null | undefined, ...props: Array> ): T[]; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.at */ at(...props: Array>): LoDashImplicitArrayWrapper; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.at */ at(...props: Array>): LoDashImplicitArrayWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.at */ at(...props: Array>): LoDashExplicitArrayWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.at */ @@ -6324,7 +6201,7 @@ declare namespace _ { * @return Returns the composed aggregate object. */ countBy( - collection: List, + collection: List | null | undefined, iteratee?: ListIterator ): Dictionary; @@ -6332,7 +6209,7 @@ declare namespace _ { * @see _.countBy */ countBy( - collection: Dictionary, + collection: Dictionary | null | undefined, iteratee?: DictionaryIterator ): Dictionary; @@ -6340,7 +6217,7 @@ declare namespace _ { * @see _.countBy */ countBy( - collection: NumericDictionary, + collection: NumericDictionary | null | undefined, iteratee?: NumericDictionaryIterator ): Dictionary; @@ -6348,7 +6225,7 @@ declare namespace _ { * @see _.countBy */ countBy( - collection: List|Dictionary|NumericDictionary, + collection: List|Dictionary|NumericDictionary | null | undefined, iteratee?: string ): Dictionary; @@ -6356,7 +6233,7 @@ declare namespace _ { * @see _.countBy */ countBy( - collection: List|Dictionary|NumericDictionary, + collection: List|Dictionary|NumericDictionary | null | undefined, iteratee?: W ): Dictionary; @@ -6364,7 +6241,7 @@ declare namespace _ { * @see _.countBy */ countBy( - collection: List|Dictionary|NumericDictionary, + collection: List|Dictionary|NumericDictionary | null | undefined, iteratee?: Object ): Dictionary; } @@ -6378,7 +6255,7 @@ declare namespace _ { ): LoDashImplicitObjectWrapper>; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.countBy */ @@ -6401,7 +6278,7 @@ declare namespace _ { ): LoDashImplicitObjectWrapper>; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.countBy */ @@ -6433,7 +6310,7 @@ declare namespace _ { ): LoDashExplicitObjectWrapper>; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.countBy */ @@ -6456,7 +6333,7 @@ declare namespace _ { ): LoDashExplicitObjectWrapper>; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.countBy */ @@ -6489,6 +6366,14 @@ declare namespace _ { iteratee?: ListIterator ): T[]; + /** + * @see _.forEach + */ + each( + collection: string, + iteratee?: ListIterator + ): string; + /** * @see _.forEach */ @@ -6520,6 +6405,54 @@ declare namespace _ { collection: T, iteratee?: ObjectIterator ): T; + + /** + * @see _.forEach + */ + each( + collection: T[] | null | undefined, + iteratee?: ListIterator + ): T[] | null | undefined; + + /** + * @see _.forEach + */ + each( + collection: string | null | undefined, + iteratee?: ListIterator + ): string | null | undefined; + + /** + * @see _.forEach + */ + each( + collection: List | null | undefined, + iteratee?: ListIterator + ): List | null | undefined; + + /** + * @see _.forEach + */ + each( + collection: Dictionary | null | undefined, + iteratee?: DictionaryIterator + ): Dictionary | null | undefined; + + /** + * @see _.forEach + */ + each( + collection: T | null | undefined, + iteratee?: ObjectIterator + ): T | null | undefined; + + /** + * @see _.forEach + */ + each( + collection: T | null | undefined, + iteratee?: ObjectIterator + ): T | null | undefined; } interface LoDashImplicitWrapper { @@ -6531,22 +6464,22 @@ declare namespace _ { ): LoDashImplicitWrapper; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.forEach */ each( iteratee: ListIterator - ): LoDashImplicitArrayWrapper; + ): TWrapper; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.forEach */ each( iteratee?: ListIterator|DictionaryIterator - ): LoDashImplicitObjectWrapper; + ): TWrapper; } interface LoDashExplicitWrapper { @@ -6558,26 +6491,34 @@ declare namespace _ { ): LoDashExplicitWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.forEach */ each( iteratee: ListIterator - ): LoDashExplicitArrayWrapper; + ): TWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.forEach */ each( iteratee?: ListIterator|DictionaryIterator - ): LoDashExplicitObjectWrapper; + ): TWrapper; } //_.eachRight interface LoDashStatic { + /** + * @see _.forEachRight + */ + eachRight( + collection: string, + iteratee?: ListIterator + ): string; + /** * @see _.forEachRight */ @@ -6617,6 +6558,54 @@ declare namespace _ { collection: T, iteratee?: ObjectIterator ): T; + + /** + * @see _.forEachRight + */ + eachRight( + collection: string | null | undefined, + iteratee?: ListIterator + ): string | null | undefined; + + /** + * @see _.forEachRight + */ + eachRight( + collection: T[] | null | undefined, + iteratee?: ListIterator + ): T[] | null | undefined; + + /** + * @see _.forEachRight + */ + eachRight( + collection: List | null | undefined, + iteratee?: ListIterator + ): List | null | undefined; + + /** + * @see _.forEachRight + */ + eachRight( + collection: Dictionary | null | undefined, + iteratee?: DictionaryIterator + ): Dictionary | null | undefined; + + /** + * @see _.forEachRight + */ + eachRight( + collection: T | null | undefined, + iteratee?: ObjectIterator + ): T | null | undefined; + + /** + * @see _.forEachRight + */ + eachRight( + collection: T | null | undefined, + iteratee?: ObjectIterator + ): T | null | undefined; } interface LoDashImplicitWrapper { @@ -6628,22 +6617,22 @@ declare namespace _ { ): LoDashImplicitWrapper; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.forEachRight */ eachRight( iteratee: ListIterator - ): LoDashImplicitArrayWrapper; + ): TWrapper; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.forEachRight */ eachRight( iteratee?: ListIterator|DictionaryIterator - ): LoDashImplicitObjectWrapper; + ): TWrapper; } interface LoDashExplicitWrapper { @@ -6655,22 +6644,22 @@ declare namespace _ { ): LoDashExplicitWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.forEachRight */ eachRight( iteratee: ListIterator - ): LoDashExplicitArrayWrapper; + ): TWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.forEachRight */ eachRight( iteratee?: ListIterator|DictionaryIterator - ): LoDashExplicitObjectWrapper; + ): TWrapper; } //_.every @@ -6684,7 +6673,7 @@ declare namespace _ { * @return Returns true if all elements pass the predicate check, else false. */ every( - collection: List, + collection: List | null | undefined, predicate?: ListIterator ): boolean; @@ -6692,7 +6681,7 @@ declare namespace _ { * @see _.every */ every( - collection: Dictionary, + collection: Dictionary | null | undefined, predicate?: DictionaryIterator ): boolean; @@ -6700,7 +6689,7 @@ declare namespace _ { * @see _.every */ every( - collection: NumericDictionary, + collection: NumericDictionary | null | undefined, predicate?: NumericDictionaryIterator ): boolean; @@ -6708,7 +6697,7 @@ declare namespace _ { * @see _.every */ every( - collection: List|Dictionary|NumericDictionary, + collection: List|Dictionary|NumericDictionary | null | undefined, predicate?: string|any[] ): boolean; @@ -6716,12 +6705,12 @@ declare namespace _ { * @see _.every */ every( - collection: List|Dictionary|NumericDictionary, + collection: List|Dictionary|NumericDictionary | null | undefined, predicate?: PartialObject ): boolean; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.every */ @@ -6744,7 +6733,7 @@ declare namespace _ { ): boolean; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.every */ @@ -6767,7 +6756,7 @@ declare namespace _ { ): boolean; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.every */ @@ -6790,7 +6779,7 @@ declare namespace _ { ): LoDashExplicitWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.every */ @@ -6834,7 +6823,7 @@ declare namespace _ { * @return Returns the new filtered array. */ filter( - collection: List, + collection: List | null | undefined, predicate?: ListIterator ): T[]; @@ -6842,7 +6831,7 @@ declare namespace _ { * @see _.filter */ filter( - collection: Dictionary, + collection: Dictionary | null | undefined, predicate?: DictionaryIterator ): T[]; @@ -6850,7 +6839,7 @@ declare namespace _ { * @see _.filter */ filter( - collection: string, + collection: string | null | undefined, predicate?: StringIterator ): string[]; @@ -6858,7 +6847,7 @@ declare namespace _ { * @see _.filter */ filter( - collection: List|Dictionary, + collection: List|Dictionary | null | undefined, predicate: string|RegExp ): T[]; @@ -6866,7 +6855,7 @@ declare namespace _ { * @see _.filter */ filter( - collection: List|Dictionary, + collection: List|Dictionary | null | undefined, predicate: PartialObject ): T[]; } @@ -6880,7 +6869,7 @@ declare namespace _ { ): LoDashImplicitArrayWrapper; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.filter */ @@ -6901,7 +6890,7 @@ declare namespace _ { filter(predicate: PartialObject): LoDashImplicitArrayWrapper; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.filter */ @@ -6931,7 +6920,7 @@ declare namespace _ { ): LoDashExplicitArrayWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.filter */ @@ -6952,7 +6941,7 @@ declare namespace _ { filter(predicate: PartialObject): LoDashExplicitArrayWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.filter */ @@ -6994,7 +6983,7 @@ declare namespace _ { * @return Returns the matched element, else undefined. */ find( - collection: List, + collection: List | null | undefined, predicate?: ListIterator, fromIndex?: number ): T|undefined; @@ -7003,7 +6992,7 @@ declare namespace _ { * @see _.find */ find( - collection: Dictionary, + collection: Dictionary | null | undefined, predicate?: DictionaryIterator, fromIndex?: number ): T|undefined; @@ -7012,7 +7001,7 @@ declare namespace _ { * @see _.find */ find( - collection: List|Dictionary, + collection: List|Dictionary | null | undefined, predicate?: string, fromIndex?: number ): T|undefined; @@ -7021,13 +7010,13 @@ declare namespace _ { * @see _.find */ find( - collection: List|Dictionary, + collection: List|Dictionary | null | undefined, predicate?: PartialObject, fromIndex?: number ): T|undefined; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.find */ @@ -7053,7 +7042,7 @@ declare namespace _ { ): T|undefined; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.find */ @@ -7079,6 +7068,32 @@ declare namespace _ { ): TResult|undefined; } + interface LoDashExplicitWrapperBase { + /** + * @see _.find + */ + find( + predicate?: ListIterator, + fromIndex?: number + ): any; + + /** + * @see _.find + */ + find( + predicate?: string, + fromIndex?: number + ): any; + + /** + * @see _.find + */ + find( + predicate?: PartialObject, + fromIndex?: number + ): any; + } + //_.findLast interface LoDashStatic { /** @@ -7090,7 +7105,7 @@ declare namespace _ { * @return The found element, else undefined. **/ findLast( - collection: T[], + collection: T[] | null | undefined, callback: ListIterator, fromIndex?: number ): T|undefined; @@ -7099,7 +7114,7 @@ declare namespace _ { * @see _.find **/ findLast( - collection: List, + collection: List | null | undefined, callback: ListIterator, fromIndex?: number ): T|undefined; @@ -7108,7 +7123,7 @@ declare namespace _ { * @see _.find **/ findLast( - collection: Dictionary, + collection: Dictionary | null | undefined, callback: DictionaryIterator, fromIndex?: number ): T|undefined; @@ -7118,7 +7133,7 @@ declare namespace _ { * @param _.pluck style callback **/ findLast( - collection: T[], + collection: T[] | null | undefined, whereValue: W, fromIndex?: number ): T|undefined; @@ -7128,7 +7143,7 @@ declare namespace _ { * @param _.pluck style callback **/ findLast( - collection: List, + collection: List | null | undefined, whereValue: W, fromIndex?: number ): T|undefined; @@ -7138,7 +7153,7 @@ declare namespace _ { * @param _.pluck style callback **/ findLast( - collection: Dictionary, + collection: Dictionary | null | undefined, whereValue: W, fromIndex?: number ): T|undefined; @@ -7148,7 +7163,7 @@ declare namespace _ { * @param _.where style callback **/ findLast( - collection: T[], + collection: T[] | null | undefined, pluckValue: string, fromIndex?: number ): T|undefined; @@ -7158,7 +7173,7 @@ declare namespace _ { * @param _.where style callback **/ findLast( - collection: List, + collection: List | null | undefined, pluckValue: string, fromIndex?: number ): T|undefined; @@ -7168,13 +7183,13 @@ declare namespace _ { * @param _.where style callback **/ findLast( - collection: Dictionary, + collection: Dictionary | null | undefined, pluckValue: string, fromIndex?: number ): T|undefined; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.findLast */ @@ -7201,6 +7216,32 @@ declare namespace _ { ): T|undefined; } + interface LoDashExplicitWrapperBase { + /** + * @see _.findLast + */ + findLast( + predicate?: ListIterator, + fromIndex?: number + ): any; + + /** + * @see _.findLast + */ + findLast( + predicate?: string, + fromIndex?: number + ): any; + + /** + * @see _.findLast + */ + findLast( + predicate?: PartialObject, + fromIndex?: number + ): any; + } + //_.flatMap interface LoDashStatic { /** @@ -7213,7 +7254,7 @@ declare namespace _ { * @return Returns the new flattened array. */ flatMap( - collection: List, + collection: List | null | undefined, iteratee?: ListIterator> ): TResult[]; @@ -7221,7 +7262,7 @@ declare namespace _ { * @see _.flatMap */ flatMap( - collection: List, + collection: List | null | undefined, iteratee?: ListIterator> ): TResult[]; @@ -7229,7 +7270,7 @@ declare namespace _ { * @see _.flatMap */ flatMap( - collection: Dictionary, + collection: Dictionary | null | undefined, iteratee?: DictionaryIterator> ): TResult[]; @@ -7237,7 +7278,7 @@ declare namespace _ { * @see _.flatMap */ flatMap( - collection: Dictionary, + collection: Dictionary | null | undefined, iteratee?: DictionaryIterator> ): TResult[]; @@ -7245,7 +7286,7 @@ declare namespace _ { * @see _.flatMap */ flatMap( - collection: NumericDictionary, + collection: NumericDictionary | null | undefined, iteratee?: NumericDictionaryIterator> ): TResult[]; @@ -7253,7 +7294,7 @@ declare namespace _ { * @see _.flatMap */ flatMap( - collection: NumericDictionary, + collection: NumericDictionary | null | undefined, iteratee?: NumericDictionaryIterator> ): TResult[]; @@ -7261,7 +7302,7 @@ declare namespace _ { * @see _.flatMap */ flatMap( - collection: TObject, + collection: TObject | null | undefined, iteratee?: ObjectIterator> ): TResult[]; @@ -7269,7 +7310,7 @@ declare namespace _ { * @see _.flatMap */ flatMap( - collection: Object, + collection: Object | null | undefined, iteratee?: ObjectIterator> ): TResult[]; @@ -7277,7 +7318,7 @@ declare namespace _ { * @see _.flatMap */ flatMap( - collection: TObject, + collection: TObject | null | undefined, iteratee: TWhere ): boolean[]; @@ -7285,7 +7326,7 @@ declare namespace _ { * @see _.flatMap */ flatMap( - collection: TObject, + collection: TObject | null | undefined, iteratee: Object|string ): TResult[]; @@ -7293,7 +7334,7 @@ declare namespace _ { * @see _.flatMap */ flatMap( - collection: TObject, + collection: TObject | null | undefined, iteratee: [string, any] ): boolean[]; @@ -7301,14 +7342,14 @@ declare namespace _ { * @see _.flatMap */ flatMap( - collection: string + collection: string | null | undefined ): string[]; /** * @see _.flatMap */ flatMap( - collection: Object, + collection: Object | null | undefined, iteratee?: Object|string ): TResult[]; } @@ -7327,7 +7368,7 @@ declare namespace _ { flatMap(): LoDashImplicitArrayWrapper; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.flatMap */ @@ -7355,7 +7396,7 @@ declare namespace _ { flatMap(): LoDashImplicitArrayWrapper; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.flatMap */ @@ -7404,7 +7445,7 @@ declare namespace _ { flatMap(): LoDashExplicitArrayWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.flatMap */ @@ -7432,7 +7473,7 @@ declare namespace _ { flatMap(): LoDashExplicitArrayWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.flatMap */ @@ -7488,6 +7529,14 @@ declare namespace _ { iteratee?: ListIterator ): T[]; + /** + * @see _.forEach + */ + forEach( + collection: string, + iteratee?: ListIterator + ): string; + /** * @see _.forEach */ @@ -7519,6 +7568,54 @@ declare namespace _ { collection: T, iteratee?: ObjectIterator ): T; + + /** + * @see _.forEach + */ + forEach( + collection: T[] | null | undefined, + iteratee?: ListIterator + ): T[] | null | undefined; + + /** + * @see _.forEach + */ + forEach( + collection: string | null | undefined, + iteratee?: ListIterator + ): string | null | undefined; + + /** + * @see _.forEach + */ + forEach( + collection: List | null | undefined, + iteratee?: ListIterator + ): List | null | undefined; + + /** + * @see _.forEach + */ + forEach( + collection: Dictionary | null | undefined, + iteratee?: DictionaryIterator + ): Dictionary | null | undefined; + + /** + * @see _.forEach + */ + forEach( + collection: T | null | undefined, + iteratee?: ObjectIterator + ): T | null | undefined; + + /** + * @see _.forEach + */ + forEach( + collection: T | null | undefined, + iteratee?: ObjectIterator + ): T | null | undefined; } interface LoDashImplicitWrapper { @@ -7530,22 +7627,22 @@ declare namespace _ { ): LoDashImplicitWrapper; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.forEach */ forEach( iteratee: ListIterator - ): LoDashImplicitArrayWrapper; + ): TWrapper; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.forEach */ forEach( iteratee?: ListIterator|DictionaryIterator - ): LoDashImplicitObjectWrapper; + ): TWrapper; } interface LoDashExplicitWrapper { @@ -7557,22 +7654,22 @@ declare namespace _ { ): LoDashExplicitWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.forEach */ forEach( iteratee: ListIterator - ): LoDashExplicitArrayWrapper; + ): TWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.forEach */ forEach( iteratee?: ListIterator|DictionaryIterator - ): LoDashExplicitObjectWrapper; + ): TWrapper; } //_.forEachRight @@ -7591,6 +7688,14 @@ declare namespace _ { iteratee?: ListIterator ): T[]; + /** + * @see _.forEachRight + */ + forEachRight( + collection: string, + iteratee?: ListIterator + ): string; + /** * @see _.forEachRight */ @@ -7622,6 +7727,54 @@ declare namespace _ { collection: T, iteratee?: ObjectIterator ): T; + + /** + * @see _.forEachRight + */ + forEachRight( + collection: T[] | null | undefined, + iteratee?: ListIterator + ): T[] | null | undefined; + + /** + * @see _.forEachRight + */ + forEachRight( + collection: string | null | undefined, + iteratee?: ListIterator + ): string | null | undefined; + + /** + * @see _.forEachRight + */ + forEachRight( + collection: List | null | undefined, + iteratee?: ListIterator + ): List | null | undefined; + + /** + * @see _.forEachRight + */ + forEachRight( + collection: Dictionary | null | undefined, + iteratee?: DictionaryIterator + ): Dictionary | null | undefined; + + /** + * @see _.forEachRight + */ + forEachRight( + collection: T | null | undefined, + iteratee?: ObjectIterator + ): T | null | undefined; + + /** + * @see _.forEachRight + */ + forEachRight( + collection: T | null | undefined, + iteratee?: ObjectIterator + ): T | null | undefined; } interface LoDashImplicitWrapper { @@ -7633,22 +7786,22 @@ declare namespace _ { ): LoDashImplicitWrapper; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.forEachRight */ forEachRight( iteratee: ListIterator - ): LoDashImplicitArrayWrapper; + ): TWrapper; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.forEachRight */ forEachRight( iteratee?: ListIterator|DictionaryIterator - ): LoDashImplicitObjectWrapper; + ): TWrapper; } interface LoDashExplicitWrapper { @@ -7660,22 +7813,22 @@ declare namespace _ { ): LoDashExplicitWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.forEachRight */ forEachRight( iteratee: ListIterator - ): LoDashExplicitArrayWrapper; + ): TWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.forEachRight */ forEachRight( iteratee?: ListIterator|DictionaryIterator - ): LoDashExplicitObjectWrapper; + ): TWrapper; } //_.groupBy @@ -7701,7 +7854,7 @@ declare namespace _ { * @return Returns the composed aggregate object. */ groupBy( - collection: List, + collection: List | null | undefined, iteratee?: ListIterator ): Dictionary; @@ -7709,7 +7862,7 @@ declare namespace _ { * @see _.groupBy */ groupBy( - collection: List, + collection: List | null | undefined, iteratee?: ListIterator ): Dictionary; @@ -7717,7 +7870,7 @@ declare namespace _ { * @see _.groupBy */ groupBy( - collection: Dictionary, + collection: Dictionary | null | undefined, iteratee?: DictionaryIterator ): Dictionary; @@ -7725,7 +7878,7 @@ declare namespace _ { * @see _.groupBy */ groupBy( - collection: Dictionary, + collection: Dictionary | null | undefined, iteratee?: DictionaryIterator ): Dictionary; @@ -7733,7 +7886,7 @@ declare namespace _ { * @see _.groupBy */ groupBy( - collection: List|Dictionary, + collection: List|Dictionary | null | undefined, iteratee?: string ): Dictionary; @@ -7741,7 +7894,7 @@ declare namespace _ { * @see _.groupBy */ groupBy( - collection: List|Dictionary, + collection: List|Dictionary | null | undefined, iteratee?: string ): Dictionary; @@ -7749,7 +7902,7 @@ declare namespace _ { * @see _.groupBy */ groupBy( - collection: List|Dictionary, + collection: List|Dictionary | null | undefined, iteratee?: TWhere ): Dictionary; @@ -7757,7 +7910,7 @@ declare namespace _ { * @see _.groupBy */ groupBy( - collection: List|Dictionary, + collection: List|Dictionary | null | undefined, iteratee?: Object ): Dictionary; } @@ -7771,7 +7924,7 @@ declare namespace _ { ): LoDashImplicitObjectWrapper>; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.groupBy */ @@ -7794,7 +7947,7 @@ declare namespace _ { ): LoDashImplicitObjectWrapper>; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.groupBy */ @@ -7847,7 +8000,7 @@ declare namespace _ { ): LoDashExplicitObjectWrapper>; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.groupBy */ @@ -7870,7 +8023,7 @@ declare namespace _ { ): LoDashExplicitObjectWrapper>; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.groupBy */ @@ -7926,7 +8079,7 @@ declare namespace _ { * @return True if the target element is found, else false. */ includes( - collection: List|Dictionary, + collection: List|Dictionary | null | undefined, target: T, fromIndex?: number ): boolean; @@ -7935,13 +8088,13 @@ declare namespace _ { * @see _.includes */ includes( - collection: string, + collection: string | null | undefined, target: string, fromIndex?: number ): boolean; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.includes */ @@ -7951,7 +8104,7 @@ declare namespace _ { ): boolean; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.includes */ @@ -7971,7 +8124,7 @@ declare namespace _ { ): boolean; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.includes */ @@ -7981,7 +8134,7 @@ declare namespace _ { ): LoDashExplicitWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.includes */ @@ -8024,7 +8177,7 @@ declare namespace _ { * @return Returns the composed aggregate object. */ keyBy( - collection: List, + collection: List | null | undefined, iteratee?: ListIterator ): Dictionary; @@ -8032,7 +8185,7 @@ declare namespace _ { * @see _.keyBy */ keyBy( - collection: NumericDictionary, + collection: NumericDictionary | null | undefined, iteratee?: NumericDictionaryIterator ): Dictionary; @@ -8040,7 +8193,7 @@ declare namespace _ { * @see _.keyBy */ keyBy( - collection: Dictionary, + collection: Dictionary | null | undefined, iteratee?: DictionaryIterator ): Dictionary; @@ -8048,7 +8201,7 @@ declare namespace _ { * @see _.keyBy */ keyBy( - collection: List|NumericDictionary|Dictionary, + collection: List|NumericDictionary|Dictionary | null | undefined, iteratee?: string ): Dictionary; @@ -8056,7 +8209,7 @@ declare namespace _ { * @see _.keyBy */ keyBy( - collection: List|NumericDictionary|Dictionary, + collection: List|NumericDictionary|Dictionary | null | undefined, iteratee?: W ): Dictionary; @@ -8064,7 +8217,7 @@ declare namespace _ { * @see _.keyBy */ keyBy( - collection: List|NumericDictionary|Dictionary, + collection: List|NumericDictionary|Dictionary | null | undefined, iteratee?: Object ): Dictionary; } @@ -8078,7 +8231,7 @@ declare namespace _ { ): LoDashImplicitObjectWrapper>; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.keyBy */ @@ -8101,7 +8254,7 @@ declare namespace _ { ): LoDashImplicitObjectWrapper>; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.keyBy */ @@ -8140,7 +8293,7 @@ declare namespace _ { ): LoDashExplicitObjectWrapper>; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.keyBy */ @@ -8163,7 +8316,7 @@ declare namespace _ { ): LoDashExplicitObjectWrapper>; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.keyBy */ @@ -8271,7 +8424,7 @@ declare namespace _ { * @param args Arguments to invoke the method with. **/ invokeMap( - collection: TValue[], + collection: TValue[] | null | undefined, methodName: string, ...args: any[]): TResult[]; @@ -8279,7 +8432,7 @@ declare namespace _ { * @see _.invokeMap **/ invokeMap( - collection: Dictionary, + collection: Dictionary | null | undefined, methodName: string, ...args: any[]): TResult[]; @@ -8287,7 +8440,7 @@ declare namespace _ { * @see _.invokeMap **/ invokeMap( - collection: Array<{}>, + collection: Array<{}> | null | undefined, methodName: string, ...args: any[]): TResult[]; @@ -8295,7 +8448,7 @@ declare namespace _ { * @see _.invokeMap **/ invokeMap( - collection: Dictionary<{}>, + collection: Dictionary<{}> | null | undefined, methodName: string, ...args: any[]): TResult[]; @@ -8303,7 +8456,7 @@ declare namespace _ { * @see _.invokeMap **/ invokeMap( - collection: TValue[], + collection: TValue[] | null | undefined, method: (...args: any[]) => TResult, ...args: any[]): TResult[]; @@ -8311,7 +8464,7 @@ declare namespace _ { * @see _.invokeMap **/ invokeMap( - collection: Dictionary, + collection: Dictionary | null | undefined, method: (...args: any[]) => TResult, ...args: any[]): TResult[]; @@ -8319,7 +8472,7 @@ declare namespace _ { * @see _.invokeMap **/ invokeMap( - collection: Array<{}>, + collection: Array<{}> | null | undefined, method: (...args: any[]) => TResult, ...args: any[]): TResult[]; @@ -8327,12 +8480,12 @@ declare namespace _ { * @see _.invokeMap **/ invokeMap( - collection: Dictionary<{}>, + collection: Dictionary<{}> | null | undefined, method: (...args: any[]) => TResult, ...args: any[]): TResult[]; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.invokeMap **/ @@ -8348,7 +8501,7 @@ declare namespace _ { ...args: any[]): LoDashImplicitArrayWrapper; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.invokeMap **/ @@ -8364,7 +8517,7 @@ declare namespace _ { ...args: any[]): LoDashImplicitArrayWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.invokeMap **/ @@ -8380,7 +8533,7 @@ declare namespace _ { ...args: any[]): LoDashExplicitArrayWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.invokeMap **/ @@ -8425,45 +8578,45 @@ declare namespace _ { * @return Returns the new mapped array. */ map( - collection: List, + collection: List | null | undefined, iteratee: ListIterator ): TResult[]; /** * @see _.map */ - map(collection: List): T[]; + map(collection: List | null | undefined): T[]; /** * @see _.map */ map( - collection: Dictionary, + collection: Dictionary | null | undefined, iteratee: DictionaryIterator ): TResult[]; /** @see _.map */ map( - collection: Dictionary, + collection: Dictionary | null | undefined, iteratee: K ): T[K][]; /** @see _.map */ - map(collection: Dictionary): T[]; + map(collection: Dictionary | null | undefined): T[]; map( - collection: NumericDictionary, + collection: NumericDictionary | null | undefined, iteratee?: NumericDictionaryIterator ): TResult[]; /** @see _.map */ - map(collection: List, iteratee: K): T[K][]; + map(collection: List | null | undefined, iteratee: K): T[K][]; /** * @see _.map */ map( - collection: List|Dictionary|NumericDictionary, + collection: List|Dictionary|NumericDictionary | null | undefined, iteratee?: string ): TResult[]; @@ -8471,12 +8624,12 @@ declare namespace _ { * @see _.map */ map( - collection: List|Dictionary|NumericDictionary, + collection: List|Dictionary|NumericDictionary | null | undefined, iteratee?: TObject ): boolean[]; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.map */ @@ -8507,7 +8660,7 @@ declare namespace _ { ): LoDashImplicitArrayWrapper; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.map */ @@ -8536,7 +8689,7 @@ declare namespace _ { ): LoDashImplicitArrayWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.map */ @@ -8565,7 +8718,7 @@ declare namespace _ { ): LoDashExplicitArrayWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.map */ @@ -8613,35 +8766,35 @@ declare namespace _ { * @return Returns the array of grouped elements. **/ partition( - collection: List, + collection: List | null | undefined, callback: ListIterator): T[][]; /** * @see _.partition **/ partition( - collection: Dictionary, + collection: Dictionary | null | undefined, callback: DictionaryIterator): T[][]; /** * @see _.partition **/ partition( - collection: List, + collection: List | null | undefined, whereValue: W): T[][]; /** * @see _.partition **/ partition( - collection: Dictionary, + collection: Dictionary | null | undefined, whereValue: W): T[][]; /** * @see _.partition **/ partition( - collection: List, + collection: List | null | undefined, path: string, srcValue: any): T[][]; @@ -8649,7 +8802,7 @@ declare namespace _ { * @see _.partition **/ partition( - collection: Dictionary, + collection: Dictionary | null | undefined, path: string, srcValue: any): T[][]; @@ -8657,14 +8810,14 @@ declare namespace _ { * @see _.partition **/ partition( - collection: List, + collection: List | null | undefined, pluckValue: string): T[][]; /** * @see _.partition **/ partition( - collection: Dictionary, + collection: Dictionary | null | undefined, pluckValue: string): T[][]; } @@ -8676,7 +8829,7 @@ declare namespace _ { callback: ListIterator): LoDashImplicitArrayWrapper; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.partition */ @@ -8700,7 +8853,7 @@ declare namespace _ { pluckValue: string): LoDashImplicitArrayWrapper; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.partition */ @@ -8748,7 +8901,7 @@ declare namespace _ { * @return Returns the accumulated value. **/ reduce( - collection: T[], + collection: T[] | null | undefined, callback: MemoIterator, accumulator: TResult): TResult; @@ -8756,7 +8909,7 @@ declare namespace _ { * @see _.reduce **/ reduce( - collection: List, + collection: List | null | undefined, callback: MemoIterator, accumulator: TResult): TResult; @@ -8764,7 +8917,7 @@ declare namespace _ { * @see _.reduce **/ reduce( - collection: Dictionary, + collection: Dictionary | null | undefined, callback: MemoIterator, accumulator: TResult): TResult; @@ -8772,7 +8925,7 @@ declare namespace _ { * @see _.reduce **/ reduce( - collection: NumericDictionary, + collection: NumericDictionary | null | undefined, callback: MemoIterator, accumulator: TResult): TResult; @@ -8780,32 +8933,32 @@ declare namespace _ { * @see _.reduce **/ reduce( - collection: T[], - callback: MemoIterator): TResult; + collection: T[] | null | undefined, + callback: MemoIterator): TResult | undefined; /** * @see _.reduce **/ reduce( - collection: List, - callback: MemoIterator): TResult; + collection: List | null | undefined, + callback: MemoIterator): TResult | undefined; /** * @see _.reduce **/ reduce( - collection: Dictionary, - callback: MemoIterator): TResult; + collection: Dictionary | null | undefined, + callback: MemoIterator): TResult | undefined; /** * @see _.reduce **/ reduce( - collection: NumericDictionary, - callback: MemoIterator): TResult; + collection: NumericDictionary | null | undefined, + callback: MemoIterator): TResult | undefined; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.reduce **/ @@ -8817,10 +8970,10 @@ declare namespace _ { * @see _.reduce **/ reduce( - callback: MemoIterator): TResult; + callback: MemoIterator): TResult | undefined; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.reduce **/ @@ -8832,10 +8985,10 @@ declare namespace _ { * @see _.reduce **/ reduce( - callback: MemoIterator): TResult; + callback: MemoIterator): TResult | undefined; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.reduce **/ @@ -8850,7 +9003,7 @@ declare namespace _ { callback: MemoIterator): LoDashExplicitObjectWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /**LoDashExplicitWrapper * @see _.reduce */ @@ -8877,7 +9030,7 @@ declare namespace _ { * @return The accumulated value. **/ reduceRight( - collection: T[], + collection: T[] | null | undefined, callback: MemoIterator, accumulator: TResult): TResult; @@ -8885,7 +9038,7 @@ declare namespace _ { * @see _.reduceRight **/ reduceRight( - collection: List, + collection: List | null | undefined, callback: MemoIterator, accumulator: TResult): TResult; @@ -8893,7 +9046,7 @@ declare namespace _ { * @see _.reduceRight **/ reduceRight( - collection: Dictionary, + collection: Dictionary | null | undefined, callback: MemoIterator, accumulator: TResult): TResult; @@ -8901,22 +9054,22 @@ declare namespace _ { * @see _.reduceRight **/ reduceRight( - collection: T[], - callback: MemoIterator): TResult; + collection: T[] | null | undefined, + callback: MemoIterator): TResult | undefined; /** * @see _.reduceRight **/ reduceRight( - collection: List, - callback: MemoIterator): TResult; + collection: List | null | undefined, + callback: MemoIterator): TResult | undefined; /** * @see _.reduceRight **/ reduceRight( - collection: Dictionary, - callback: MemoIterator): TResult; + collection: Dictionary | null | undefined, + callback: MemoIterator): TResult | undefined; } //_.reject @@ -8931,7 +9084,7 @@ declare namespace _ { * @return Returns the new filtered array. */ reject( - collection: List, + collection: List | null | undefined, predicate?: ListIterator ): T[]; @@ -8939,7 +9092,7 @@ declare namespace _ { * @see _.reject */ reject( - collection: Dictionary, + collection: Dictionary | null | undefined, predicate?: DictionaryIterator ): T[]; @@ -8947,7 +9100,7 @@ declare namespace _ { * @see _.reject */ reject( - collection: string, + collection: string | null | undefined, predicate?: StringIterator ): string[]; @@ -8955,7 +9108,7 @@ declare namespace _ { * @see _.reject */ reject( - collection: List|Dictionary, + collection: List|Dictionary | null | undefined, predicate: string ): T[]; @@ -8963,7 +9116,7 @@ declare namespace _ { * @see _.reject */ reject( - collection: List|Dictionary, + collection: List|Dictionary | null | undefined, predicate: W ): T[]; } @@ -8977,7 +9130,7 @@ declare namespace _ { ): LoDashImplicitArrayWrapper; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.reject */ @@ -8998,7 +9151,7 @@ declare namespace _ { reject(predicate: W): LoDashImplicitArrayWrapper; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.reject */ @@ -9028,7 +9181,7 @@ declare namespace _ { ): LoDashExplicitArrayWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.reject */ @@ -9049,7 +9202,7 @@ declare namespace _ { reject(predicate: W): LoDashExplicitArrayWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.reject */ @@ -9079,43 +9232,43 @@ declare namespace _ { * @return Returns the random element. */ sample( - collection: List|Dictionary|NumericDictionary - ): T; + collection: List|Dictionary|NumericDictionary | null | undefined + ): T | undefined; /** * @see _.sample */ sample( - collection: O - ): T; + collection: O | null | undefined + ): T | undefined; /** * @see _.sample */ sample( - collection: Object - ): T; + collection: Object | null | undefined + ): T | undefined; } interface LoDashImplicitWrapper { /** * @see _.sample */ - sample(): string; + sample(): string | undefined; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.sample */ - sample(): T; + sample(): T | undefined; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.sample */ - sample(): T; + sample(): T | undefined; } interface LoDashExplicitWrapper { @@ -9125,14 +9278,14 @@ declare namespace _ { sample(): LoDashExplicitWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.sample */ sample(): TWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.sample */ @@ -9149,7 +9302,7 @@ declare namespace _ { * @return Returns the random elements. */ sampleSize( - collection: List|Dictionary|NumericDictionary, + collection: List|Dictionary|NumericDictionary | null | undefined, n?: number ): T[]; @@ -9157,7 +9310,7 @@ declare namespace _ { * @see _.sampleSize */ sampleSize( - collection: O, + collection: O | null | undefined, n?: number ): T[]; @@ -9165,7 +9318,7 @@ declare namespace _ { * @see _.sampleSize */ sampleSize( - collection: Object, + collection: Object | null | undefined, n?: number ): T[]; } @@ -9179,7 +9332,7 @@ declare namespace _ { ): LoDashImplicitArrayWrapper; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.sampleSize */ @@ -9188,7 +9341,7 @@ declare namespace _ { ): LoDashImplicitArrayWrapper; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.sampleSize */ @@ -9206,7 +9359,7 @@ declare namespace _ { ): LoDashExplicitArrayWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.sampleSize */ @@ -9215,7 +9368,7 @@ declare namespace _ { ): LoDashExplicitArrayWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.sampleSize */ @@ -9232,12 +9385,12 @@ declare namespace _ { * @param collection The collection to shuffle. * @return Returns the new shuffled array. */ - shuffle(collection: List|Dictionary): T[]; + shuffle(collection: List|Dictionary | null | undefined): T[]; /** * @see _.shuffle */ - shuffle(collection: string): string[]; + shuffle(collection: string | null | undefined): string[]; } interface LoDashImplicitWrapper { @@ -9247,14 +9400,14 @@ declare namespace _ { shuffle(): LoDashImplicitArrayWrapper; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.shuffle */ shuffle(): LoDashImplicitArrayWrapper; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.shuffle */ @@ -9268,14 +9421,14 @@ declare namespace _ { shuffle(): LoDashExplicitArrayWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.shuffle */ shuffle(): LoDashExplicitArrayWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.shuffle */ @@ -9291,12 +9444,12 @@ declare namespace _ { * @param collection The collection to inspect. * @return Returns the size of collection. */ - size(collection: List|Dictionary): number; + size(collection: List|Dictionary | null | undefined): number; /** * @see _.size */ - size(collection: string): number; + size(collection: string | null | undefined): number; } interface LoDashImplicitWrapper { @@ -9306,14 +9459,14 @@ declare namespace _ { size(): number; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.size */ size(): number; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.size */ @@ -9327,14 +9480,14 @@ declare namespace _ { size(): LoDashExplicitWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.size */ size(): LoDashExplicitWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.size */ @@ -9352,7 +9505,7 @@ declare namespace _ { * @return Returns true if any element passes the predicate check, else false. */ some( - collection: List, + collection: List | null | undefined, predicate?: ListIterator ): boolean; @@ -9360,7 +9513,7 @@ declare namespace _ { * @see _.some */ some( - collection: Dictionary, + collection: Dictionary | null | undefined, predicate?: DictionaryIterator ): boolean; @@ -9368,7 +9521,7 @@ declare namespace _ { * @see _.some */ some( - collection: NumericDictionary, + collection: NumericDictionary | null | undefined, predicate?: NumericDictionaryIterator ): boolean; @@ -9376,7 +9529,7 @@ declare namespace _ { * @see _.some */ some( - collection: Object, + collection: Object | null | undefined, predicate?: ObjectIterator ): boolean; @@ -9384,7 +9537,7 @@ declare namespace _ { * @see _.some */ some( - collection: List|Dictionary|NumericDictionary, + collection: List|Dictionary|NumericDictionary | null | undefined, predicate?: string|[string, any] ): boolean; @@ -9392,7 +9545,7 @@ declare namespace _ { * @see _.some */ some( - collection: Object, + collection: Object | null | undefined, predicate?: string|[string, any] ): boolean; @@ -9400,7 +9553,7 @@ declare namespace _ { * @see _.some */ some( - collection: List|Dictionary|NumericDictionary, + collection: List|Dictionary|NumericDictionary | null | undefined, predicate?: PartialObject ): boolean; @@ -9408,7 +9561,7 @@ declare namespace _ { * @see _.some */ some( - collection: List|Dictionary|NumericDictionary, + collection: List|Dictionary|NumericDictionary | null | undefined, predicate?: PartialObject ): boolean; @@ -9416,12 +9569,12 @@ declare namespace _ { * @see _.some */ some( - collection: Object, + collection: Object | null | undefined, predicate?: PartialObject ): boolean; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.some */ @@ -9444,7 +9597,7 @@ declare namespace _ { ): boolean; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.some */ @@ -9467,7 +9620,7 @@ declare namespace _ { ): boolean; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.some */ @@ -9490,7 +9643,7 @@ declare namespace _ { ): LoDashExplicitWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.some */ @@ -9549,7 +9702,7 @@ declare namespace _ { * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] */ sortBy( - collection: List, + collection: List | null | undefined, iteratee?: ListIterator ): T[]; @@ -9557,7 +9710,7 @@ declare namespace _ { * @see _.sortBy */ sortBy( - collection: Dictionary, + collection: Dictionary | null | undefined, iteratee?: DictionaryIterator ): T[]; @@ -9565,7 +9718,7 @@ declare namespace _ { * @see _.sortBy */ sortBy( - collection: List|Dictionary, + collection: List|Dictionary | null | undefined, iteratee: string ): T[]; @@ -9573,7 +9726,7 @@ declare namespace _ { * @see _.sortBy */ sortBy( - collection: List|Dictionary, + collection: List|Dictionary | null | undefined, whereValue: W ): T[]; @@ -9581,25 +9734,27 @@ declare namespace _ { * @see _.sortBy */ sortBy( - collection: List|Dictionary + collection: List|Dictionary | null | undefined ): T[]; /** * @see _.sortBy */ sortBy( - collection: List, - iteratees: Array|string|Object>): T[]; + collection: List | null | undefined, + iteratees: Array|string|Object> + ): T[]; /** * @see _.sortBy */ sortBy( - collection: List, - ...iteratees: Array|Object|string>): T[]; + collection: List | null | undefined, + ...iteratees: Array|Object|string> + ): T[]; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.sortBy */ @@ -9633,7 +9788,7 @@ declare namespace _ { sortBy(iteratees: Array|string|Object>): LoDashImplicitArrayWrapper; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.sortBy */ @@ -9657,7 +9812,7 @@ declare namespace _ { sortBy(): LoDashImplicitArrayWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.sortBy */ @@ -9681,7 +9836,7 @@ declare namespace _ { sortBy(): LoDashExplicitArrayWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.sortBy */ @@ -9735,7 +9890,7 @@ declare namespace _ { * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] */ orderBy( - collection: List, + collection: List | null | undefined, iteratees: Many|string|W>, orders?: Many ): T[]; @@ -9744,7 +9899,7 @@ declare namespace _ { * @see _.orderBy */ orderBy( - collection: List, + collection: List | null | undefined, iteratees: Many|string|Object>, orders?: Many ): T[]; @@ -9753,7 +9908,7 @@ declare namespace _ { * @see _.orderBy */ orderBy( - collection: NumericDictionary, + collection: NumericDictionary | null | undefined, iteratees: Many|string|W>, orders?: Many ): T[]; @@ -9762,7 +9917,7 @@ declare namespace _ { * @see _.orderBy */ orderBy( - collection: NumericDictionary, + collection: NumericDictionary | null | undefined, iteratees: Many|string|Object>, orders?: Many ): T[]; @@ -9771,7 +9926,7 @@ declare namespace _ { * @see _.orderBy */ orderBy( - collection: Dictionary, + collection: Dictionary | null | undefined, iteratees: Many|string|W>, orders?: Many ): T[]; @@ -9780,7 +9935,7 @@ declare namespace _ { * @see _.orderBy */ orderBy( - collection: Dictionary, + collection: Dictionary | null | undefined, iteratees: Many|string|Object>, orders?: Many ): T[]; @@ -9796,7 +9951,7 @@ declare namespace _ { ): LoDashImplicitArrayWrapper; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.orderBy */ @@ -9806,7 +9961,7 @@ declare namespace _ { ): LoDashImplicitArrayWrapper; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.orderBy */ @@ -9866,7 +10021,7 @@ declare namespace _ { ): LoDashExplicitArrayWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.orderBy */ @@ -9876,7 +10031,7 @@ declare namespace _ { ): LoDashExplicitArrayWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.orderBy */ @@ -11160,7 +11315,7 @@ declare namespace _ { wrap(wrapper: Function): LoDashImplicitObjectWrapper; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.wrap */ @@ -11172,7 +11327,7 @@ declare namespace _ { wrap(wrapper: Function): LoDashImplicitObjectWrapper; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.wrap */ @@ -11196,7 +11351,7 @@ declare namespace _ { wrap(wrapper: Function): LoDashExplicitObjectWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.wrap */ @@ -11208,7 +11363,7 @@ declare namespace _ { wrap(wrapper: Function): LoDashExplicitObjectWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.wrap */ @@ -11242,18 +11397,18 @@ declare namespace _ { castArray(): LoDashImplicitArrayWrapper; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.castArray */ - castArray(): LoDashImplicitArrayWrapper; + castArray(): TWrapper; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.castArray */ - castArray(): LoDashImplicitArrayWrapper; + castArray(): LoDashImplicitArrayWrapper; } interface LoDashExplicitWrapper { @@ -11263,18 +11418,18 @@ declare namespace _ { castArray(): LoDashExplicitArrayWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.castArray */ - castArray(): LoDashExplicitArrayWrapper; + castArray(): TWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.castArray */ - castArray(): LoDashExplicitArrayWrapper; + castArray(): LoDashExplicitArrayWrapper; } //_.clone @@ -11300,18 +11455,18 @@ declare namespace _ { clone(): T; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.clone */ - clone(): T[]; + clone(): TArray; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.clone */ - clone(): T; + clone(): TObject; } interface LoDashExplicitWrapper { @@ -11321,18 +11476,18 @@ declare namespace _ { clone(): LoDashExplicitWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.clone */ - clone(): LoDashExplicitArrayWrapper; + clone(): TWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.clone */ - clone(): LoDashExplicitObjectWrapper; + clone(): TWrapper; } //_.cloneDeep @@ -11353,18 +11508,18 @@ declare namespace _ { cloneDeep(): T; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.cloneDeep */ - cloneDeep(): T[]; + cloneDeep(): TArray; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.cloneDeep */ - cloneDeep(): T; + cloneDeep(): TObject; } interface LoDashExplicitWrapper { @@ -11374,18 +11529,18 @@ declare namespace _ { cloneDeep(): LoDashExplicitWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.cloneDeep */ - cloneDeep(): LoDashExplicitArrayWrapper; + cloneDeep(): TWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.cloneDeep */ - cloneDeep(): LoDashExplicitObjectWrapper; + cloneDeep(): TWrapper; } //_.cloneDeepWith @@ -11422,21 +11577,21 @@ declare namespace _ { ): TResult; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.cloneDeepWith */ cloneDeepWith( - customizer?: CloneDeepWithCustomizer + customizer?: CloneDeepWithCustomizer ): TResult; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.cloneDeepWith */ cloneDeepWith( - customizer?: CloneDeepWithCustomizer + customizer?: CloneDeepWithCustomizer ): TResult; } @@ -11463,12 +11618,12 @@ declare namespace _ { ): LoDashExplicitObjectWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.cloneDeepWith */ cloneDeepWith( - customizer?: CloneDeepWithCustomizer + customizer?: CloneDeepWithCustomizer ): LoDashExplicitWrapper; /** @@ -11486,7 +11641,7 @@ declare namespace _ { ): LoDashExplicitObjectWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.cloneDeepWith */ @@ -11544,21 +11699,21 @@ declare namespace _ { ): TResult; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.cloneWith */ cloneWith( - customizer?: CloneWithCustomizer + customizer?: CloneWithCustomizer ): TResult; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.cloneWith */ cloneWith( - customizer?: CloneWithCustomizer + customizer?: CloneWithCustomizer ): TResult; } @@ -11585,12 +11740,12 @@ declare namespace _ { ): LoDashExplicitObjectWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.cloneWith */ cloneWith( - customizer?: CloneWithCustomizer + customizer?: CloneWithCustomizer ): LoDashExplicitWrapper; /** @@ -11608,7 +11763,7 @@ declare namespace _ { ): LoDashExplicitObjectWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.cloneWith */ @@ -12114,7 +12269,7 @@ declare namespace _ { } // _.isEqualWith - type IsEqualCustomizer = (value: any, other: any, indexOrKey?: number|string) => boolean; + type IsEqualCustomizer = (value: any, other: any, indexOrKey: number|string|undefined, parent: any, otherParent: any, stack: any) => boolean|undefined; interface LoDashStatic { /** @@ -12151,7 +12306,7 @@ declare namespace _ { isEqualWith( value: any, other: any, - customizer: IsEqualCustomizer + customizer?: IsEqualCustomizer ): boolean; } @@ -12161,7 +12316,7 @@ declare namespace _ { */ isEqualWith( other: any, - customizer: IsEqualCustomizer + customizer?: IsEqualCustomizer ): boolean; } @@ -12171,7 +12326,7 @@ declare namespace _ { */ isEqualWith( other: any, - customizer: IsEqualCustomizer + customizer?: IsEqualCustomizer ): LoDashExplicitWrapper; } @@ -13023,14 +13178,14 @@ declare namespace _ { toArray(): LoDashImplicitArrayWrapper; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.toArray */ toArray(): LoDashImplicitArrayWrapper; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.toArray */ @@ -13044,14 +13199,14 @@ declare namespace _ { toArray(): LoDashExplicitArrayWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.toArray */ toArray(): LoDashExplicitArrayWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.toArray */ @@ -13376,22 +13531,22 @@ declare namespace _ { * @returns {*} Returns the maximum value. */ max( - collection: List - ): T; + collection: List | null | undefined + ): T | undefined; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.max */ - max(): T; + max(): T | undefined; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.max */ - max(): T; + max(): T | undefined; } //_.maxBy @@ -13419,79 +13574,79 @@ declare namespace _ { * // => { 'n': 2 } */ maxBy( - collection: List, + collection: List | null | undefined, iteratee?: ListIterator - ): T; + ): T | undefined; /** * @see _.maxBy */ maxBy( - collection: Dictionary, + collection: Dictionary | null | undefined, iteratee?: DictionaryIterator - ): T; + ): T | undefined; /** * @see _.maxBy */ maxBy( - collection: List|Dictionary, + collection: List|Dictionary | null | undefined, iteratee?: string - ): T; + ): T | undefined; /** * @see _.maxBy */ maxBy( - collection: List|Dictionary, + collection: List|Dictionary | null | undefined, whereValue?: TObject - ): T; + ): T | undefined; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.maxBy */ maxBy( iteratee?: ListIterator - ): T; + ): T | undefined; /** * @see _.maxBy */ maxBy( iteratee?: string - ): T; + ): T | undefined; /** * @see _.maxBy */ maxBy( whereValue?: TObject - ): T; + ): T | undefined; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.maxBy */ maxBy( iteratee?: ListIterator|DictionaryIterator - ): T; + ): T | undefined; /** * @see _.maxBy */ maxBy( iteratee?: string - ): T; + ): T | undefined; /** * @see _.maxBy */ maxBy( whereValue?: TObject - ): T; + ): T | undefined; } //_.mean @@ -13510,7 +13665,7 @@ declare namespace _ { * // => 5 */ mean( - collection: List + collection: List | null | undefined ): number; } @@ -13531,12 +13686,12 @@ declare namespace _ { * // => 5 */ meanBy( - collection: List, + collection: List | null | undefined, iteratee?: DictionaryIterator ): number; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.mean */ @@ -13561,22 +13716,22 @@ declare namespace _ { * @returns {*} Returns the minimum value. */ min( - collection: List - ): T; + collection: List | null | undefined + ): T | undefined; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.min */ - min(): T; + min(): T | undefined; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.min */ - min(): T; + min(): T | undefined; } //_.minBy @@ -13604,79 +13759,79 @@ declare namespace _ { * // => { 'n': 1 } */ minBy( - collection: List, + collection: List | null | undefined, iteratee?: ListIterator - ): T; + ): T | undefined; /** * @see _.minBy */ minBy( - collection: Dictionary, + collection: Dictionary | null | undefined, iteratee?: DictionaryIterator - ): T; + ): T | undefined; /** * @see _.minBy */ minBy( - collection: List|Dictionary, + collection: List|Dictionary | null | undefined, iteratee?: string - ): T; + ): T | undefined; /** * @see _.minBy */ minBy( - collection: List|Dictionary, + collection: List|Dictionary | null | undefined, whereValue?: TObject - ): T; + ): T | undefined; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.minBy */ minBy( iteratee?: ListIterator - ): T; + ): T | undefined; /** * @see _.minBy */ minBy( iteratee?: string - ): T; + ): T | undefined; /** * @see _.minBy */ minBy( whereValue?: TObject - ): T; + ): T | undefined; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.minBy */ minBy( iteratee?: ListIterator|DictionaryIterator - ): T; + ): T | undefined; /** * @see _.minBy */ minBy( iteratee?: string - ): T; + ): T | undefined; /** * @see _.minBy */ minBy( whereValue?: TObject - ): T; + ): T | undefined; } //_.round @@ -13723,22 +13878,22 @@ declare namespace _ { * _.sum([4, 2, 8, 6]); * // => 20 */ - sum(collection: List): number; + sum(collection: List | null | undefined): number; /** * @see _.sum */ - sum(collection: List|Dictionary): number; + sum(collection: List|Dictionary | null | undefined): number; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.sum */ sum(): number; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.sum **/ @@ -13750,14 +13905,14 @@ declare namespace _ { sum(): number; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.sum */ sum(): LoDashExplicitWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.sum */ @@ -13794,7 +13949,7 @@ declare namespace _ { * // => 20 */ sumBy( - collection: List, + collection: List | null | undefined, iteratee: ListIterator ): number; @@ -13802,7 +13957,7 @@ declare namespace _ { * @see _.sumBy */ sumBy( - collection: List<{}>, + collection: List<{}> | null | undefined, iteratee: string ): number; @@ -13810,19 +13965,19 @@ declare namespace _ { * @see _.sumBy */ sumBy( - collection: List + collection: List | null | undefined ): number; /** * @see _.sumBy */ sumBy( - collection: List<{}>, + collection: List<{}> | null | undefined, iteratee: Dictionary<{}> ): number; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.sumBy */ @@ -13841,7 +13996,7 @@ declare namespace _ { sumBy(iteratee: Dictionary<{}>): number; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.sumBy */ @@ -13860,7 +14015,7 @@ declare namespace _ { sumBy(iteratee: Dictionary<{}>): number; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.sumBy */ @@ -13884,7 +14039,7 @@ declare namespace _ { sumBy(iteratee: Dictionary<{}>): LoDashExplicitWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.sumBy */ @@ -15355,7 +15510,7 @@ declare namespace _ { findKey( object: TObject, predicate?: DictionaryIterator - ): string; + ): string | undefined; /** * @see _.findKey @@ -15363,7 +15518,7 @@ declare namespace _ { findKey( object: TObject, predicate?: ObjectIterator - ): string; + ): string | undefined; /** * @see _.findKey @@ -15371,7 +15526,7 @@ declare namespace _ { findKey( object: TObject, predicate?: string - ): string; + ): string | undefined; /** * @see _.findKey @@ -15379,67 +15534,67 @@ declare namespace _ { findKey, TObject>( object: TObject, predicate?: TWhere - ): string; + ): string | undefined; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.findKey */ findKey( predicate?: DictionaryIterator - ): string; + ): string | undefined; /** * @see _.findKey */ findKey( predicate?: ObjectIterator - ): string; + ): string | undefined; /** * @see _.findKey */ findKey( predicate?: string - ): string; + ): string | undefined; /** * @see _.findKey */ findKey>( predicate?: TWhere - ): string; + ): string | undefined; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.findKey */ findKey( predicate?: DictionaryIterator - ): LoDashExplicitWrapper; + ): LoDashExplicitWrapper; /** * @see _.findKey */ findKey( predicate?: ObjectIterator - ): LoDashExplicitWrapper; + ): LoDashExplicitWrapper; /** * @see _.findKey */ findKey( predicate?: string - ): LoDashExplicitWrapper; + ): LoDashExplicitWrapper; /** * @see _.findKey */ findKey>( predicate?: TWhere - ): LoDashExplicitWrapper; + ): LoDashExplicitWrapper; } //_.findLastKey @@ -15464,7 +15619,7 @@ declare namespace _ { findLastKey( object: TObject, predicate?: DictionaryIterator - ): string; + ): string | undefined; /** * @see _.findLastKey @@ -15472,7 +15627,7 @@ declare namespace _ { findLastKey( object: TObject, predicate?: ObjectIterator - ): string; + ): string | undefined; /** * @see _.findLastKey @@ -15488,10 +15643,10 @@ declare namespace _ { findLastKey, TObject>( object: TObject, predicate?: TWhere - ): string; + ): string | undefined; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.findLastKey */ @@ -15504,51 +15659,51 @@ declare namespace _ { */ findLastKey( predicate?: ObjectIterator - ): string; + ): string | undefined; /** * @see _.findLastKey */ findLastKey( predicate?: string - ): string; + ): string | undefined; /** * @see _.findLastKey */ findLastKey>( predicate?: TWhere - ): string; + ): string | undefined; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.findLastKey */ findLastKey( predicate?: DictionaryIterator - ): LoDashExplicitWrapper; + ): LoDashExplicitWrapper; /** * @see _.findLastKey */ findLastKey( predicate?: ObjectIterator - ): LoDashExplicitWrapper; + ): LoDashExplicitWrapper; /** * @see _.findLastKey */ findLastKey( predicate?: string - ): LoDashExplicitWrapper; + ): LoDashExplicitWrapper; /** * @see _.findLastKey */ findLastKey>( predicate?: TWhere - ): LoDashExplicitWrapper; + ): LoDashExplicitWrapper; } //_.forIn @@ -15571,28 +15726,36 @@ declare namespace _ { /** * @see _.forIn */ - forIn( + forIn( + object: Dictionary | null | undefined, + iteratee?: DictionaryIterator + ): Dictionary | null | undefined; + + /** + * @see _.forIn + */ + forIn( object: T, iteratee?: ObjectIterator ): T; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.forIn */ forIn( iteratee?: DictionaryIterator - ): _.LoDashImplicitObjectWrapper; + ): TWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.forIn */ forIn( iteratee?: DictionaryIterator - ): _.LoDashExplicitObjectWrapper; + ): TWrapper; } //_.forInRight @@ -15613,28 +15776,36 @@ declare namespace _ { /** * @see _.forInRight */ - forInRight( + forInRight( + object: Dictionary | null | undefined, + iteratee?: DictionaryIterator + ): Dictionary | null | undefined; + + /** + * @see _.forInRight + */ + forInRight( object: T, iteratee?: ObjectIterator ): T; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.forInRight */ forInRight( iteratee?: DictionaryIterator - ): _.LoDashImplicitObjectWrapper; + ): TWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.forInRight */ forInRight( iteratee?: DictionaryIterator - ): _.LoDashExplicitObjectWrapper; + ): TWrapper; } //_.forOwn @@ -15657,28 +15828,36 @@ declare namespace _ { /** * @see _.forOwn */ - forOwn( + forOwn( + object: Dictionary | null | undefined, + iteratee?: DictionaryIterator + ): Dictionary | null | undefined; + + /** + * @see _.forOwn + */ + forOwn( object: T, iteratee?: ObjectIterator ): T; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.forOwn */ forOwn( iteratee?: DictionaryIterator - ): _.LoDashImplicitObjectWrapper; + ): TWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.forOwn */ forOwn( iteratee?: DictionaryIterator - ): _.LoDashExplicitObjectWrapper; + ): TWrapper; } //_.forOwnRight @@ -15699,28 +15878,36 @@ declare namespace _ { /** * @see _.forOwnRight */ - forOwnRight( + forOwnRight( + object: Dictionary | null | undefined, + iteratee?: DictionaryIterator + ): Dictionary | null | undefined; + + /** + * @see _.forOwnRight + */ + forOwnRight( object: T, iteratee?: ObjectIterator ): T; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.forOwnRight */ forOwnRight( iteratee?: DictionaryIterator - ): _.LoDashImplicitObjectWrapper; + ): TWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.forOwnRight */ forOwnRight( iteratee?: DictionaryIterator - ): _.LoDashExplicitObjectWrapper; + ): TWrapper; } //_.functions @@ -15840,7 +16027,7 @@ declare namespace _ { ): TResult; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.get */ @@ -15850,7 +16037,7 @@ declare namespace _ { ): TResult; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.get */ @@ -15870,7 +16057,7 @@ declare namespace _ { ): TResultWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.get */ @@ -15880,7 +16067,7 @@ declare namespace _ { ): TResultWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.get */ @@ -15924,14 +16111,14 @@ declare namespace _ { ): boolean; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.has */ has(path: Many): boolean; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.has */ @@ -15971,14 +16158,14 @@ declare namespace _ { ): boolean; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.hasIn */ hasIn(path: Many): boolean; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.hasIn */ @@ -16161,14 +16348,14 @@ declare namespace _ { keys(object?: any): string[]; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.keys */ keys(): LoDashImplicitArrayWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.keys */ @@ -16188,14 +16375,14 @@ declare namespace _ { keysIn(object?: any): string[]; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.keysIn */ keysIn(): LoDashImplicitArrayWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.keysIn */ @@ -16214,7 +16401,7 @@ declare namespace _ { * @return Returns the new mapped object. */ mapKeys( - object: List, + object: List | null | undefined, iteratee?: ListIterator ): Dictionary; @@ -16222,7 +16409,7 @@ declare namespace _ { * @see _.mapKeys */ mapKeys( - object: Dictionary, + object: Dictionary | null | undefined, iteratee?: DictionaryIterator ): Dictionary; @@ -16230,7 +16417,7 @@ declare namespace _ { * @see _.mapKeys */ mapKeys( - object: List|Dictionary, + object: List|Dictionary | null | undefined, iteratee?: TObject ): Dictionary; @@ -16238,12 +16425,12 @@ declare namespace _ { * @see _.mapKeys */ mapKeys( - object: List|Dictionary, + object: List|Dictionary | null | undefined, iteratee?: string ): Dictionary; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.mapKeys */ @@ -16266,7 +16453,7 @@ declare namespace _ { ): LoDashImplicitObjectWrapper>; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.mapKeys */ @@ -16289,7 +16476,7 @@ declare namespace _ { ): LoDashImplicitObjectWrapper>; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.mapKeys */ @@ -16312,7 +16499,7 @@ declare namespace _ { ): LoDashExplicitObjectWrapper>; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.mapKeys */ @@ -16356,13 +16543,13 @@ declare namespace _ { * @param {Object} [thisArg] The `this` binding of `iteratee`. * @return {Object} Returns the new mapped object. */ - mapValues(obj: Dictionary, callback: ObjectIterator): Dictionary; - mapValues(obj: Dictionary, where: Dictionary): Dictionary; - mapValues(obj: T, pluck: string): TMapped; - mapValues(obj: T, callback: ObjectIterator): T; + mapValues(obj: Dictionary | null | undefined, callback: ObjectIterator): Dictionary; + mapValues(obj: Dictionary | null | undefined, where: Dictionary): Dictionary; + mapValues(obj: T | null | undefined, pluck: string): TMapped; + mapValues(obj: T | null | undefined, callback: ObjectIterator): T; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.mapValues * TValue is the type of the property values of T. @@ -16385,7 +16572,7 @@ declare namespace _ { mapValues(where: Dictionary): LoDashImplicitArrayWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.mapValues * TValue is the type of the property values of T. @@ -16911,7 +17098,7 @@ declare namespace _ { ): TResult; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.result */ @@ -16921,7 +17108,7 @@ declare namespace _ { ): TResult; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.result */ @@ -16941,7 +17128,7 @@ declare namespace _ { ): TResultWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.result */ @@ -17375,7 +17562,7 @@ declare namespace _ { * @param object The object to query. * @return Returns an array of property values. */ - values(object?: Dictionary|NumericDictionary|List): T[]; + values(object?: Dictionary|NumericDictionary|List | null | undefined): T[]; /** * @see _.values @@ -17397,14 +17584,14 @@ declare namespace _ { values(): LoDashImplicitArrayWrapper; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.values */ values(): LoDashImplicitArrayWrapper; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.values */ @@ -17418,14 +17605,14 @@ declare namespace _ { values(): LoDashExplicitArrayWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.values */ values(): LoDashExplicitArrayWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.values */ @@ -17448,14 +17635,14 @@ declare namespace _ { valuesIn(object?: any): T[]; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.valuesIn */ valuesIn(): LoDashImplicitArrayWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.valuesIn */ @@ -18557,18 +18744,18 @@ declare namespace _ { identity(): T; } - interface LoDashImplicitArrayWrapper { + interface LoDashImplicitArrayWrapperBase { /** * @see _.identity */ - identity(): T[]; + identity(): TArray; } - interface LoDashImplicitObjectWrapper { + interface LoDashImplicitObjectWrapperBase { /** * @see _.identity */ - identity(): T; + identity(): TObject; } interface LoDashExplicitWrapper { @@ -18578,18 +18765,18 @@ declare namespace _ { identity(): LoDashExplicitWrapper; } - interface LoDashExplicitArrayWrapper { + interface LoDashExplicitArrayWrapperBase { /** * @see _.identity */ - identity(): LoDashExplicitArrayWrapper; + identity(): TWrapper; } - interface LoDashExplicitObjectWrapper { + interface LoDashExplicitObjectWrapperBase { /** * @see _.identity */ - identity(): LoDashExplicitObjectWrapper; + identity(): TWrapper; } //_.iteratee diff --git a/types/lodash/lodash-tests.ts b/types/lodash/lodash-tests.ts index 4f479eab83..c1b907af09 100644 --- a/types/lodash/lodash-tests.ts +++ b/types/lodash/lodash-tests.ts @@ -133,6 +133,16 @@ namespace TestWrapper { let result: _.LoDashImplicitObjectWrapper<{a: string}>; result = _<{a: string}>({a: ''}); } + + { + let a: TResult[] = []; + _(a) // $ExpectType LoDashImplicitArrayWrapper + } + + { + let a: TResult[] | null | undefined = any; + _(a) // $ExpectType LoDashImplicitNillableArrayWrapper + } } //Wrapped array shortcut methods @@ -158,8 +168,8 @@ result = <_.LoDashExplicitArrayWrapper>_.chain([1, 2, 3, 4]).unshift(5, // _.chunk namespace TestChunk { - let array: TResult[] = []; - let list: _.List = []; + let array: TResult[] | null | undefined = [] as any; + let list: _.List | null | undefined = [] as any; { let result: TResult[][]; @@ -184,6 +194,7 @@ namespace TestChunk { { let result: _.LoDashExplicitArrayWrapper; + result = _.chain(array).chunk(); result = _(array).chain().chunk(); result = _(array).chain().chunk(42); @@ -194,8 +205,8 @@ namespace TestChunk { // _.compact namespace TestCompact { - let array: TResult[] = []; - let list: _.List = []; + let array: TResult[] | null | undefined = [] as any; + let list: _.List | null | undefined = [] as any; { let result: TResult[]; @@ -222,56 +233,60 @@ namespace TestCompact { // _.difference namespace TestDifference { - let array: TResult[] = []; - let list: _.List = []; + let array: TResult[] | null | undefined = [] as any; + let list: _.List | null | undefined = [] as any; + let arrayParam: TResult[] = []; + let listParam: _.List = []; { let result: TResult[]; result = _.difference(array); - result = _.difference(array, array); - result = _.difference(array, list, array); - result = _.difference(array, array, list, array); + result = _.difference(array, arrayParam); + result = _.difference(array, listParam, arrayParam); + result = _.difference(array, listParam, listParam, arrayParam); result = _.difference(list); - result = _.difference(list, list); - result = _.difference(list, array, list); - result = _.difference(list, list, array, list); + result = _.difference(list, listParam); + result = _.difference(list, arrayParam, listParam); + result = _.difference(list, listParam, arrayParam, listParam); } { let result: _.LoDashImplicitArrayWrapper; result = _(array).difference(); - result = _(array).difference(array); - result = _(array).difference(list, array); - result = _(array).difference(array, list, array); + result = _(array).difference(arrayParam); + result = _(array).difference(listParam, arrayParam); + result = _(array).difference(arrayParam, listParam, arrayParam); result = _(list).difference(); - result = _(list).difference(list); - result = _(list).difference(array, list); - result = _(list).difference(list, array, list); + result = _(list).difference(listParam); + result = _(list).difference(arrayParam, listParam); + result = _(list).difference(listParam, arrayParam, listParam); } { let result: _.LoDashExplicitArrayWrapper; result = _(array).chain().difference(); - result = _(array).chain().difference(array); - result = _(array).chain().difference(list, array); - result = _(array).chain().difference(array, list, array); + result = _(array).chain().difference(arrayParam); + result = _(array).chain().difference(listParam, arrayParam); + result = _(array).chain().difference(arrayParam, listParam, arrayParam); result = _(list).chain().difference(); - result = _(list).chain().difference(list); - result = _(list).chain().difference(array, list); - result = _(list).chain().difference(list, array, list); + result = _(list).chain().difference(listParam); + result = _(list).chain().difference(arrayParam, listParam); + result = _(list).chain().difference(listParam, arrayParam, listParam); } } // _.differenceBy namespace TestDifferenceBy { - let array: TResult[] = []; - let list: _.List = []; + let array: TResult[] | null | undefined = [] as any; + let list: _.List | null | undefined = [] as any; + let arrayParam: TResult[] = []; + let listParam: _.List = []; let iteratee: (value: TResult) => any = (value: TResult) => 1; { @@ -298,11 +313,11 @@ namespace TestDifferenceBy { result = _.differenceBy(array, array, list, array, list, array, 'a'); result = _.differenceBy(array, list, array, list, array, list, array, 'a'); - result = _.differenceBy(array, array, {a: 1}); - result = _.differenceBy(array, list, array, {a: 1}); - result = _.differenceBy(array, array, list, array, {a: 1}); - result = _.differenceBy(array, list, array, list, array, {a: 1}); - result = _.differenceBy(array, array, list, array, list, array, {a: 1}); + result = _.differenceBy(array, arrayParam, {a: 1}); + result = _.differenceBy(array, listParam, arrayParam, {a: 1}); + result = _.differenceBy(array, arrayParam, listParam, arrayParam, {a: 1}); + result = _.differenceBy(array, listParam, arrayParam, listParam, arrayParam, {a: 1}); + result = _.differenceBy(array, arrayParam, listParam, arrayParam, listParam, arrayParam, {a: 1}); result = _.differenceBy(array, list, array, list, array, list, array, {a: 1}); result = _.differenceBy(list, list); @@ -326,11 +341,11 @@ namespace TestDifferenceBy { result = _.differenceBy(list, list, array, list, array, list, 'a'); result = _.differenceBy(list, array, list, array, list, array, list, 'a'); - result = _.differenceBy(list, list, {a: 1}); - result = _.differenceBy(list, array, list, {a: 1}); - result = _.differenceBy(list, list, array, list, {a: 1}); - result = _.differenceBy(list, array, list, array, list, {a: 1}); - result = _.differenceBy(list, list, array, list, array, list, {a: 1}); + result = _.differenceBy(list, listParam, {a: 1}); + result = _.differenceBy(list, arrayParam, listParam, {a: 1}); + result = _.differenceBy(list, listParam, arrayParam, listParam, {a: 1}); + result = _.differenceBy(list, arrayParam, listParam, arrayParam, listParam, {a: 1}); + result = _.differenceBy(list, listParam, arrayParam, listParam, arrayParam, listParam, {a: 1}); result = _.differenceBy(list, array, list, array, list, array, list, {a: 1}); } @@ -358,11 +373,11 @@ namespace TestDifferenceBy { result = _(array).differenceBy(array, list, array, list, array, 'a'); result = _(array).differenceBy(list, array, list, array, list, array, 'a'); - result = _(array).differenceBy(array, {a: 1}); - result = _(array).differenceBy(list, array, {a: 1}); - result = _(array).differenceBy(array, list, array, {a: 1}); - result = _(array).differenceBy(list, array, list, array, {a: 1}); - result = _(array).differenceBy(array, list, array, list, array, {a: 1}); + result = _(array).differenceBy(arrayParam, {a: 1}); + result = _(array).differenceBy(listParam, arrayParam, {a: 1}); + result = _(array).differenceBy(arrayParam, listParam, arrayParam, {a: 1}); + result = _(array).differenceBy(listParam, arrayParam, listParam, arrayParam, {a: 1}); + result = _(array).differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, {a: 1}); result = _(array).differenceBy(list, array, list, array, list, array, {a: 1}); result = _(list).differenceBy(list); @@ -386,11 +401,11 @@ namespace TestDifferenceBy { result = _(list).differenceBy(list, array, list, array, list, 'a'); result = _(list).differenceBy(array, list, array, list, array, list, 'a'); - result = _(list).differenceBy(list, {a: 1}); - result = _(list).differenceBy(array, list, {a: 1}); - result = _(list).differenceBy(list, array, list, {a: 1}); - result = _(list).differenceBy(array, list, array, list, {a: 1}); - result = _(list).differenceBy(list, array, list, array, list, {a: 1}); + result = _(list).differenceBy(listParam, {a: 1}); + result = _(list).differenceBy(arrayParam, listParam, {a: 1}); + result = _(list).differenceBy(listParam, arrayParam, listParam, {a: 1}); + result = _(list).differenceBy(arrayParam, listParam, arrayParam, listParam, {a: 1}); + result = _(list).differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, {a: 1}); result = _(list).differenceBy(array, list, array, list, array, list, {a: 1}); } @@ -418,11 +433,11 @@ namespace TestDifferenceBy { result = _(array).chain().differenceBy(array, list, array, list, array, 'a'); result = _(array).chain().differenceBy(list, array, list, array, list, array, 'a'); - result = _(array).chain().differenceBy(array, {a: 1}); - result = _(array).chain().differenceBy(list, array, {a: 1}); - result = _(array).chain().differenceBy(array, list, array, {a: 1}); - result = _(array).chain().differenceBy(list, array, list, array, {a: 1}); - result = _(array).chain().differenceBy(array, list, array, list, array, {a: 1}); + result = _(array).chain().differenceBy(arrayParam, {a: 1}); + result = _(array).chain().differenceBy(listParam, arrayParam, {a: 1}); + result = _(array).chain().differenceBy(arrayParam, listParam, arrayParam, {a: 1}); + result = _(array).chain().differenceBy(listParam, arrayParam, listParam, arrayParam, {a: 1}); + result = _(array).chain().differenceBy(arrayParam, listParam, arrayParam, listParam, arrayParam, {a: 1}); result = _(array).chain().differenceBy(list, array, list, array, list, array, {a: 1}); result = _(list).chain().differenceBy(list); @@ -446,19 +461,19 @@ namespace TestDifferenceBy { result = _(list).chain().differenceBy(list, array, list, array, list, 'a'); result = _(list).chain().differenceBy(array, list, array, list, array, list, 'a'); - result = _(list).chain().differenceBy(list, {a: 1}); - result = _(list).chain().differenceBy(array, list, {a: 1}); - result = _(list).chain().differenceBy(list, array, list, {a: 1}); - result = _(list).chain().differenceBy(array, list, array, list, {a: 1}); - result = _(list).chain().differenceBy(list, array, list, array, list, {a: 1}); + result = _(list).chain().differenceBy(listParam, {a: 1}); + result = _(list).chain().differenceBy(arrayParam, listParam, {a: 1}); + result = _(list).chain().differenceBy(listParam, arrayParam, listParam, {a: 1}); + result = _(list).chain().differenceBy(arrayParam, listParam, arrayParam, listParam, {a: 1}); + result = _(list).chain().differenceBy(listParam, arrayParam, listParam, arrayParam, listParam, {a: 1}); result = _(list).chain().differenceBy(array, list, array, list, array, list, {a: 1}); } } // _.drop { - let array: TResult[] = []; - let list: _.List = []; + let array: TResult[] | null | undefined = [] as any; + let list: _.List | null | undefined = [] as any; { let result: TResult[]; @@ -492,8 +507,8 @@ namespace TestDifferenceBy { // _.dropRight namespace TestDropRight { - let array: TResult[] = []; - let list: _.List = []; + let array: TResult[] | null | undefined = [] as any; + let list: _.List | null | undefined = [] as any; { let result: TResult[]; @@ -528,8 +543,8 @@ namespace TestDropRight { // _.dropRightWhile namespace TestDropRightWhile { - let array: TResult[] = []; - let list: _.List = []; + let array: TResult[] | null | undefined = [] as any; + let list: _.List | null | undefined = [] as any; let predicateFn = (value: TResult, index: number, collection: _.List) => true; { @@ -577,8 +592,8 @@ namespace TestDropRightWhile { // _.dropWhile namespace TestDropWhile { - let array: TResult[] = []; - let list: _.List = []; + let array: TResult[] | null | undefined = [] as any; + let list: _.List | null | undefined = [] as any; let predicateFn = (value: TResult, index: number, collection: _.List) => true; { @@ -626,8 +641,8 @@ namespace TestDropWhile { // _.fill namespace TestFill { - let array: number[] = []; - let list: _.List = []; + let array: TResult[] | null | undefined = [] as any; + let list: _.List | null | undefined = [] as any; { let result: number[]; @@ -680,8 +695,8 @@ namespace TestFill { // _.findIndex namespace TestFindIndex { - let array: TResult[] = []; - let list: _.List = []; + let array: TResult[] | null | undefined = [] as any; + let list: _.List | null | undefined = [] as any; let predicateFn = (value: TResult, index: number, collection: _.List) => true; let fromIndex: number = 0; @@ -732,8 +747,8 @@ namespace TestFindIndex { // _.findLastIndex namespace TestFindLastIndex { - let array: TResult[] = []; - let list: _.List = []; + let array: TResult[] | null | undefined = [] as any; + let list: _.List | null | undefined = [] as any; let predicateFn = (value: TResult, index: number, collection: _.List) => true; let fromIndex: number = 0; @@ -785,18 +800,18 @@ namespace TestFindLastIndex { // _.first namespace TestFirst { - let array: TResult[] = []; - let list: _.List = []; + let array: TResult[] | null | undefined = [] as any; + let list: _.List | null | undefined = [] as any; { - let result: string; + let result: string | undefined; result = _.first('abc'); result = _('abc').first(); } { - let result: TResult; + let result: TResult | undefined; result = _.first(array); result = _.first(list); @@ -821,6 +836,9 @@ namespace TestFirst { // _.flatten namespace TestFlatten { + let array: number[][] | null | undefined = [] as any; + let list: _.List | null | undefined = [] as any; + { let result: string[]; @@ -830,6 +848,10 @@ namespace TestFlatten { { let result: number[]; + result = _.flatten(array); + result = _.flatten(list); + result = _.flatten([1, 2, 3]); + result = _.flatten([1, 2, 3]); result = _.flatten([1, 2, 3]); result = _.flatten([1, [2, 3]]); result = _.flatten([1, [2, [3]]], true); @@ -914,6 +936,9 @@ namespace TestFlatten { // _.flattenDeep namespace TestFlattenDeep { + let array: number[][] | null | undefined = [] as any; + let list: _.List | null | undefined = [] as any; + { let result: string[]; @@ -923,6 +948,8 @@ namespace TestFlattenDeep { { let result: number[]; + result = _.flattenDeep(array); + result = _.flattenDeep(list); result = _.flattenDeep([1, 2, 3]); result = _.flattenDeep([1, [2, 3]]); result = _.flattenDeep([1, [2, [3]]]); @@ -997,8 +1024,8 @@ namespace TestFlattenDeep { // _.fromPairs namespace TestFromPairs { - let twoDimensionalArray: string[][] = []; - let numberTupleArray: [string, number][] = []; + let twoDimensionalArray: string[][] | null | undefined = [] as any; + let numberTupleArray: [string, number][] | null | undefined = [] as any; let stringDict: _.Dictionary; let numberDict: _.Dictionary; @@ -1022,18 +1049,18 @@ namespace TestFromPairs { // _.head namespace TestHead { - let array: TResult[] = []; - let list: _.List = []; + let array: TResult[] | null | undefined = [] as any; + let list: _.List | null | undefined = [] as any; { - let result: string; + let result: string | undefined; result = _.head('abc'); result = _('abc').head(); } { - let result: TResult; + let result: TResult | undefined; result = _.head(array); result = _.head(list); @@ -1058,8 +1085,8 @@ namespace TestHead { // _.indexOf namespace TestIndexOf { - let array: TResult[] = []; - let list: _.List = []; + let array: TResult[] | null | undefined = [] as any; + let list: _.List | null | undefined = [] as any; let value: TResult = { a: 1, b: "", c: true }; { @@ -1097,8 +1124,8 @@ namespace TestIndexOf { // _.sortedIndexOf namespace TestIndexOf { - let array: TResult[] = []; - let list: _.List = []; + let array: TResult[] | null | undefined = [] as any; + let list: _.List | null | undefined = [] as any; let value: TResult = { a: 1, b: "", c: true }; { @@ -1120,8 +1147,8 @@ namespace TestIndexOf { //_.initial namespace TestInitial { - let array: TResult[] = []; - let list: _.List = []; + let array: TResult[] | null | undefined = [] as any; + let list: _.List | null | undefined = [] as any; { let result: TResult[]; @@ -1147,8 +1174,10 @@ namespace TestInitial { // _.intersection namespace TestIntersection { - let array: TResult[] = []; - let list: _.List = []; + let array: TResult[] | null | undefined = [] as any; + let list: _.List | null | undefined = [] as any; + let arrayParam: TResult[] = [] as any; + let listParam: _.List = [] as any; { let result: TResult[]; @@ -1160,21 +1189,21 @@ namespace TestIntersection { { let result: _.LoDashImplicitArrayWrapper; - result = _(array).intersection(array); - result = _(array).intersection(list, array); + result = _(array).intersection(arrayParam); + result = _(array).intersection(listParam, arrayParam); - result = _(list).intersection(array); - result = _(list).intersection(list, array); + result = _(list).intersection(arrayParam); + result = _(list).intersection(listParam, arrayParam); } { let result: _.LoDashExplicitArrayWrapper; - result = _(array).chain().intersection(array); - result = _(array).chain().intersection(list, array); + result = _(array).chain().intersection(arrayParam); + result = _(array).chain().intersection(listParam, arrayParam); - result = _(list).chain().intersection(array); - result = _(list).chain().intersection(list, array); + result = _(list).chain().intersection(arrayParam); + result = _(list).chain().intersection(listParam, arrayParam); } } @@ -1182,6 +1211,8 @@ namespace TestIntersection { namespace TestJoin { let array = [1, 2]; let list = {0: 1, 1: 2, length: 2}; + let nilArray: string[] | null | undefined = undefined as any; + let nilList: _.List | null | undefined = undefined as any; { let result: string; @@ -1192,6 +1223,10 @@ namespace TestJoin { result = _.join(array, '_'); result = _.join(list); result = _.join(list, '_'); + result = _.join(nilArray); + result = _.join(nilArray, '_'); + result = _.join(nilList); + result = _.join(nilList, '_'); result = _('abc').join(); result = _('abc').join('_'); @@ -1215,18 +1250,18 @@ namespace TestJoin { // _.last namespace TestLast { - let array: TResult[] = []; - let list: _.List = []; + let array: TResult[] | null | undefined = [] as any; + let list: _.List | null | undefined = [] as any; { - let result: string; + let result: string | undefined; result = _.last('abc'); result = _('abc').last(); } { - let result: TResult; + let result: TResult | undefined; result = _.last(array); result = _.last(list); @@ -1256,8 +1291,8 @@ namespace TestLast { // _.lastIndexOf namespace TestLastIndexOf { - let array: TResult[] = []; - let list: _.List = []; + let array: TResult[] | null | undefined = [] as any; + let list: _.List | null | undefined = [] as any; let value: TResult = { a: 1, b: "", c: true }; { @@ -1295,12 +1330,12 @@ namespace TestLastIndexOf { // _.nth namespace TestNth { - let array: TResult[] = []; - let list: _.List = []; + let array: TResult[] | null | undefined = [] as any; + let list: _.List | null | undefined = [] as any; let value: number = 0; { - let result: TResult; + let result: TResult | undefined; result = _.nth(array); @@ -1484,8 +1519,8 @@ namespace TestRemove { // _.tail namespace TestTail { - let array: TResult[] = []; - let list: _.List = []; + let array: TResult[] | null | undefined = [] as any; + let list: _.List | null | undefined = [] as any; { let result: TResult[]; @@ -1511,12 +1546,12 @@ namespace TestTail { // _.slice namespace TestSlice { - let array: TResult[] = []; + let array: TResult[] | null | undefined = [] as any; { let result: TResult[]; - result = _.slice(array); + result = _.slice(array); result = _.slice(array, 42); result = _.slice(array, 42, 42); } @@ -1742,8 +1777,8 @@ namespace TestSortedLastIndexBy { // _.tail namespace TestTail { - let array: TResult[] = []; - let list: _.List = []; + let array: TResult[] | null | undefined = [] as any; + let list: _.List | null | undefined = [] as any; { let result: TResult[]; @@ -1769,8 +1804,8 @@ namespace TestTail { // _.take namespace TestTake { - let array: TResult[] = []; - let list: _.List = []; + let array: TResult[] | null | undefined = [] as any; + let list: _.List | null | undefined = [] as any; { let result: TResult[]; @@ -1805,8 +1840,8 @@ namespace TestTake { // _.takeRight namespace TestTakeRight { - let array: TResult[] = []; - let list: _.List = []; + let array: TResult[] | null | undefined = [] as any; + let list: _.List | null | undefined = [] as any; { let result: TResult[]; @@ -1841,8 +1876,8 @@ namespace TestTakeRight { // _.takeRightWhile namespace TestTakeRightWhile { - let array: TResult[] = []; - let list: _.List = []; + let array: TResult[] | null | undefined = [] as any; + let list: _.List | null | undefined = [] as any; let predicateFn = (value: TResult, index: number, collection: _.List) => true; { @@ -1890,8 +1925,8 @@ namespace TestTakeRightWhile { // _.takeWhile namespace TestTakeWhile { - let array: TResult[] = []; - let list: _.List = []; + let array: TResult[] | null | undefined = [] as any; + let list: _.List | null | undefined = [] as any; let predicateFn = (value: TResult, index: number, collection: _.List) => true; { @@ -1939,8 +1974,8 @@ namespace TestTakeWhile { // _.union namespace TestUnion { - let array: TResult[] = []; - let list: _.List = []; + let array: TResult[] | null | undefined = [] as any; + let list: _.List | null | undefined = [] as any; { let result: TResult[]; @@ -1991,8 +2026,8 @@ namespace TestUnion { // _.unionBy namespace TestUnionBy { - let array: TResult[] = []; - let list: _.List = []; + let array: TResult[] | null | undefined = [] as any; + let list: _.List | null | undefined = [] as any; let iteratee: (value: TResult) => any = (value: TResult) => 1; { @@ -2156,8 +2191,8 @@ namespace TestUnionBy { namespace TestUniq { type SampleObject = {a: number; b: string; c: boolean}; - let array: SampleObject[] = []; - let list: _.List = []; + let array: SampleObject[] | null | undefined = [] as any; + let list: _.List | null | undefined = [] as any; { let result: string[]; @@ -2201,8 +2236,8 @@ namespace TestUniq { namespace TestUniqBy { type SampleObject = {a: number; b: string; c: boolean}; - let array: SampleObject[] = []; - let list: _.List = []; + let array: SampleObject[] | null | undefined = [] as any; + let list: _.List | null | undefined = [] as any; let stringIterator = (value: string, index: number, collection: string) => ""; let listIterator = (value: SampleObject, index: number, collection: _.List) => 0; @@ -2275,8 +2310,8 @@ namespace TestUniqBy { namespace TestSortedUniq { type SampleObject = {a: number; b: string; c: boolean}; - let array: SampleObject[] = []; - let list: _.List = []; + let array: SampleObject[] | null | undefined = [] as any; + let list: _.List | null | undefined = [] as any; { let result: string[]; @@ -2316,8 +2351,8 @@ namespace TestSortedUniq { namespace TestSortedUniqBy { type SampleObject = {a: number; b: string; c: boolean}; - let array: SampleObject[] = []; - let list: _.List = []; + let array: SampleObject[] | null | undefined = [] as any; + let list: _.List | null | undefined = [] as any; let stringIterator = (value: string, index: number, collection: string) => ""; let listIterator = (value: SampleObject, index: number, collection: _.List) => 0; @@ -2386,7 +2421,7 @@ namespace TestSortedUniqBy { } } -// _.upzip +// _.unzip namespace TestUnzip { let array = [['a', 'b'], [1, 2], [true, false]]; @@ -2396,6 +2431,15 @@ namespace TestUnzip { 2: {0: true, 1: false, length: 2}, length: 3 }; + let nilArray: TResult[][] | null | undefined = [] as any; + let nilList: _.List<_.List> | null | undefined = [] as any; + + { + let result: TResult[][]; + + result = _.unzip(nilArray); + result = _.unzip(nilList); + } { let result: (string|number|boolean)[][]; @@ -2421,8 +2465,8 @@ namespace TestUnzip { // _.unzipWith { - let testUnzipWithArray: (number[]|_.List)[] = []; - let testUnzipWithList: _.List> = []; + let testUnzipWithArray: (number[]|_.List)[] | null | undefined = [] as any; + let testUnzipWithList: _.List> | null | undefined = [] as any; let testUnzipWithIterator: {(prev: TResult, curr: number, index?: number, list?: number[]): TResult} = (prev: TResult, curr: number, index?: number, list?: number[]) => ({ a: 1, b: "", c: true }); let result: TResult[]; result = _.unzipWith(testUnzipWithArray); @@ -2435,8 +2479,8 @@ namespace TestUnzip { // _.without namespace TestWithout { - let array: number[] = []; - let list: _.List = []; + let array: number[] | null | undefined = [] as any; + let list: _.List | null | undefined = [] as any; { let result: number[]; @@ -2482,8 +2526,8 @@ namespace TestWithout { // _.xor namespace TestXor { - let array: TResult[] = []; - let list: _.List = []; + let array: TResult[] | null | undefined = [] as any; + let list: _.List | null | undefined = [] as any; { let result: TResult[]; @@ -2526,8 +2570,8 @@ namespace TestXor { // _.zip namespace TestZip { - let array: TResult[] = []; - let list: _.List = []; + let array: TResult[] | null | undefined = [] as any; + let list: _.List | null | undefined = [] as any; { let result: TResult[][]; @@ -3254,9 +3298,9 @@ namespace TestValueOf { // _.at namespace TestAt { - let array: TResult[] = []; - let list: _.List = []; - let dictionary: _.Dictionary = {}; + let array: TResult[] | null | undefined = [] as any; + let list: _.List | null | undefined = [] as any; + let dictionary: _.Dictionary | null | undefined = any; { let result: TResult[]; @@ -3285,10 +3329,11 @@ namespace TestAt { // _.countBy namespace TestCountBy { - let array: TResult[] = []; - let list: _.List = []; - let dictionary: _.Dictionary = {}; - let numericDictionary: _.NumericDictionary = {}; + let array: TResult[] | null | undefined = [] as any; + let list: _.List | null | undefined = [] as any; + let obj: any = {}; + let dictionary: _.Dictionary | null | undefined = obj; + let numericDictionary: _.NumericDictionary | null | undefined = obj; let stringIterator: (value: string, index: number, collection: string) => any = (value: string, index: number, collection: string) => 1; let listIterator: (value: TResult, index: number, collection: _.List) => any = (value: TResult, index: number, collection: _.List) => 1; @@ -3394,6 +3439,10 @@ namespace TestEach { let array: TResult[] = []; let list: _.List = []; let dictionary: _.Dictionary = {}; + let nilArray: TResult[] | null | undefined = [] as any; + let nilList: _.List | null | undefined = [] as any; + let obj: any = {}; + let nilDictionary: _.Dictionary | null | undefined = obj; let stringIterator: (char: string, index: number, string: string) => any = (char: string, index: number, string: string) => 1; let listIterator: (value: TResult, index: number, collection: _.List) => any = (value: TResult, index: number, collection: _.List) => 1; @@ -3402,73 +3451,97 @@ namespace TestEach { { let result: string; - _.each('', stringIterator); + result = _.each('', stringIterator); + } + + { + let result: string | null | undefined; + + result = _.each('' as (string | null | undefined), stringIterator); } { let result: TResult[]; - _.each(array, listIterator); + result = _.each(array, listIterator); + } + + { + let result: TResult[] | null | undefined; + + result = _.each(nilArray, listIterator); } { let result: _.List; - _.each(list, listIterator); + result = _.each(list, listIterator); } { - let result: _.Dictionary; + let result: _.List | null | undefined; - _.each(dictionary, dictionaryIterator); + result = _.each(nilList, listIterator); + } + + { + let result: _.Dictionary; + + result = _.each(dictionary, dictionaryIterator); + } + + { + let result: _.Dictionary | null | undefined; + + result = _.each(nilDictionary, dictionaryIterator); } { let result: _.LoDashImplicitWrapper; - _('').each(stringIterator); + result = _('').each(stringIterator); } { let result: _.LoDashImplicitArrayWrapper; - _(array).each(listIterator); + result = _(array).each(listIterator); } { let result: _.LoDashImplicitObjectWrapper<_.List>; - _(list).each(listIterator); + result = _(list).each(listIterator); } { let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; - _(dictionary).each(dictionaryIterator); + result = _(dictionary).each(dictionaryIterator); } { let result: _.LoDashExplicitWrapper; - _('').chain().each(stringIterator); + result = _('').chain().each(stringIterator); } { let result: _.LoDashExplicitArrayWrapper; - _(array).chain().each(listIterator); + result = _(array).chain().each(listIterator); } { let result: _.LoDashExplicitObjectWrapper<_.List>; - _(list).chain().each(listIterator); + result = _(list).chain().each(listIterator); } { let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; - _(dictionary).chain().each(dictionaryIterator); + result = _(dictionary).chain().each(dictionaryIterator); } } @@ -3477,6 +3550,10 @@ namespace TestEachRight { let array: TResult[] = []; let list: _.List = []; let dictionary: _.Dictionary = {}; + let nilArray: TResult[] | null | undefined = [] as any; + let nilList: _.List | null | undefined = [] as any; + let obj: any = {}; + let nilDictionary: _.Dictionary | null | undefined = obj; let stringIterator: (char: string, index: number, string: string) => any = (char: string, index: number, string: string) => 1; let listIterator: (value: TResult, index: number, collection: _.List) => any = (value: TResult, index: number, collection: _.List) => 1; @@ -3485,73 +3562,97 @@ namespace TestEachRight { { let result: string; - _.eachRight('', stringIterator); + result = _.eachRight('', stringIterator); + } + + { + let result: string | null | undefined; + + result = _.eachRight('' as (string | null | undefined), stringIterator); } { let result: TResult[]; - _.eachRight(array, listIterator); + result = _.eachRight(array, listIterator); + } + + { + let result: TResult[] | null | undefined; + + result = _.eachRight(nilArray, listIterator); } { let result: _.List; - _.eachRight(list, listIterator); + result = _.eachRight(list, listIterator); } { - let result: _.Dictionary; + let result: _.List | null | undefined; - _.eachRight(dictionary, dictionaryIterator); + result = _.eachRight(nilList, listIterator); + } + + { + let result: _.Dictionary; + + result = _.eachRight(dictionary, dictionaryIterator); + } + + { + let result: _.Dictionary | null | undefined; + + result = _.eachRight(nilDictionary, dictionaryIterator); } { let result: _.LoDashImplicitWrapper; - _('').eachRight(stringIterator); + result = _('').eachRight(stringIterator); } { let result: _.LoDashImplicitArrayWrapper; - _(array).eachRight(listIterator); + result = _(array).eachRight(listIterator); } { let result: _.LoDashImplicitObjectWrapper<_.List>; - _(list).eachRight(listIterator); + result = _(list).eachRight(listIterator); } { let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; - _(dictionary).eachRight(dictionaryIterator); + result = _(dictionary).eachRight(dictionaryIterator); } { let result: _.LoDashExplicitWrapper; - _('').chain().eachRight(stringIterator); + result = _('').chain().eachRight(stringIterator); } { let result: _.LoDashExplicitArrayWrapper; - _(array).chain().eachRight(listIterator); + result = _(array).chain().eachRight(listIterator); } { let result: _.LoDashExplicitObjectWrapper<_.List>; - _(list).chain().eachRight(listIterator); + result = _(list).chain().eachRight(listIterator); } { let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; - _(dictionary).chain().eachRight(dictionaryIterator); + result = _(dictionary).chain().eachRight(dictionaryIterator); } } @@ -3559,10 +3660,11 @@ namespace TestEachRight { namespace TestEvery { type SampleObject = {a: number; b: string; c: boolean;}; - let array: SampleObject[] = []; - let list: _.List = []; - let dictionary: _.Dictionary = {}; - let numericDictionary: _.NumericDictionary = {}; + let array: SampleObject[] | null | undefined = [] as any; + let list: _.List | null | undefined = [] as any; + let obj: any = {}; + let dictionary: _.Dictionary | null | undefined = obj; + let numericDictionary: _.NumericDictionary | null | undefined = obj; let listIterator = (value: SampleObject, index: number, collection: _.List) => true; let dictionaryIterator = (value: SampleObject, key: string, collection: _.Dictionary) => true; @@ -3651,9 +3753,10 @@ namespace TestEvery { // _.filter namespace TestFilter { - let array: TResult[] = []; - let list: _.List = []; - let dictionary: _.Dictionary = {}; + let array: TResult[] | null | undefined = [] as any; + let list: _.List | null | undefined = [] as any; + let obj: any = {}; + let dictionary: _.Dictionary | null | undefined = obj; let stringIterator: (char: string, index: number, string: string) => any = (char: string, index: number, string: string) => 1; let listIterator: (value: TResult, index: number, collection: _.List) => any = (value: TResult, index: number, collection: _.List) => 1; @@ -3737,9 +3840,10 @@ namespace TestFilter { // _.find namespace TestFind { - let array: TResult[] = []; - let list: _.List = []; - let dictionary: _.Dictionary = {}; + let array: TResult[] | null | undefined = [] as any; + let list: _.List | null | undefined = [] as any; + let obj: any = {}; + let dictionary: _.Dictionary | null | undefined = obj; let listIterator = (value: TResult, index: number, collection: _.List) => true; let dictionaryIterator = (value: TResult, key: string, collection: _.Dictionary) => true; @@ -3809,17 +3913,18 @@ result = _(foodsCombined).findLast('organic', 1); // _.flatMap namespace TestFlatMap { - let numArray: (number|number[])[] = [1, [2, 3]]; - let objArray: ({a: number}|{a: number}[])[] = [{a: 1}, [{a: 2}, {a: 3}]]; + let numArray: (number|number[])[] | null | undefined = [1, [2, 3]] as any; + let objArray: ({a: number}|{a: number}[])[] | null | undefined = [{a: 1}, [{a: 2}, {a: 3}]] as any; - let numList: _.List = {0: 1, 1: [2, 3], length: 2}; - let objList: _.List<{a: number}|{a: number}[]> = {0: {a: 1}, 1: [{a: 2}, {a: 3}], length: 2}; + let obj: any = {}; + let numList: _.List | null | undefined = obj; + let objList: _.List<{a: number}|{a: number}[]> | null | undefined = obj; - let numDictionary: _.Dictionary = {a: 1, b: [2, 3]}; - let objDictionary: _.Dictionary<{a: number}|{a: number}[]> = {a: {a: 1}, b: [{a: 2}, {a: 3}]}; + let numDictionary: _.Dictionary | null | undefined = obj; + let objDictionary: _.Dictionary<{a: number}|{a: number}[]> | null | undefined = obj; - let numNumericDictionary: _.NumericDictionary = {0: 1, 1: [2, 3]}; - let objNumericDictionary: _.NumericDictionary<{a: number}|{a: number}[]> = {0: {a: 1}, 1: [{a: 2}, {a: 3}]}; + let numNumericDictionary: _.NumericDictionary | null | undefined = obj; + let objNumericDictionary: _.NumericDictionary<{a: number}|{a: number}[]> | null | undefined = obj; let stringIterator: (value: string, index: number, collection: _.List) => string|string[] = (a, b, c) => ""; @@ -4003,6 +4108,10 @@ namespace TestForEach { let array: TResult[] = []; let list: _.List = []; let dictionary: _.Dictionary = {}; + let nilArray: TResult[] | null | undefined = [] as any; + let nilList: _.List | null | undefined = [] as any; + let obj: any = {}; + let nilDictionary: _.Dictionary | null | undefined = obj; let stringIterator: (char: string, index: number, string: string) => any = (char: string, index: number, string: string) => 1; let listIterator: (value: TResult, index: number, collection: _.List) => any = (value: TResult, index: number, collection: _.List) => 1; @@ -4011,73 +4120,133 @@ namespace TestForEach { { let result: string; - _.forEach('', stringIterator); + result = _.forEach('', stringIterator); + } + + { + let result: string | null | undefined; + + result = _.forEach('' as (string | null | undefined), stringIterator); } { let result: TResult[]; - _.forEach(array, listIterator); + result = _.forEach(array, listIterator); + } + + { + let result: TResult[] | null | undefined; + + result = _.forEach(nilArray, listIterator); } { let result: _.List; - _.forEach(list, listIterator); + result = _.forEach(list, listIterator); } { - let result: _.Dictionary; + let result: _.List | null | undefined; - _.forEach(dictionary, dictionaryIterator); + result = _.forEach(nilList, listIterator); + } + + { + let result: _.Dictionary; + + result = _.forEach(dictionary, dictionaryIterator); + } + + { + let result: _.Dictionary | null | undefined; + + result = _.forEach(nilDictionary, dictionaryIterator); } { let result: _.LoDashImplicitWrapper; - _('').forEach(stringIterator); + result = _('').forEach(stringIterator); } { let result: _.LoDashImplicitArrayWrapper; - _(array).forEach(listIterator); + result = _(array).forEach(listIterator); + } + + { + let result: _.LoDashImplicitNillableArrayWrapper; + + result = _(nilArray).forEach(listIterator); } { let result: _.LoDashImplicitObjectWrapper<_.List>; - _(list).forEach(listIterator); + result = _(list).forEach(listIterator); + } + + { + let result: _.LoDashImplicitNillableObjectWrapper<_.List>; + + result = _(nilList).forEach(listIterator); } { let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; - _(dictionary).forEach(dictionaryIterator); + result = _(dictionary).forEach(dictionaryIterator); + } + + { + let result: _.LoDashImplicitNillableObjectWrapper<_.Dictionary>; + + result = _(nilDictionary).forEach(dictionaryIterator); } { let result: _.LoDashExplicitWrapper; - _('').chain().forEach(stringIterator); + result = _('').chain().forEach(stringIterator); } { let result: _.LoDashExplicitArrayWrapper; - _(array).chain().forEach(listIterator); + result = _(array).chain().forEach(listIterator); + } + + { + let result: _.LoDashExplicitNillableArrayWrapper; + + result = _(nilArray).chain().forEach(listIterator); } { let result: _.LoDashExplicitObjectWrapper<_.List>; - _(list).chain().forEach(listIterator); + result = _(list).chain().forEach(listIterator); + } + + { + let result: _.LoDashExplicitNillableObjectWrapper<_.List>; + + result = _(nilList).chain().forEach(listIterator); } { let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; - _(dictionary).chain().forEach(dictionaryIterator); + result = _(dictionary).chain().forEach(dictionaryIterator); + } + + { + let result: _.LoDashExplicitNillableObjectWrapper<_.Dictionary>; + + result = _(nilDictionary).chain().forEach(dictionaryIterator); } } @@ -4086,6 +4255,10 @@ namespace TestForEachRight { let array: TResult[] = []; let list: _.List = []; let dictionary: _.Dictionary = {}; + let nilArray: TResult[] | null | undefined = [] as any; + let nilList: _.List | null | undefined = [] as any; + let obj: any = {}; + let nilDictionary: _.Dictionary | null | undefined = obj; let stringIterator: (char: string, index: number, string: string) => any = (char: string, index: number, string: string) => 1; let listIterator: (value: TResult, index: number, collection: _.List) => any = (value: TResult, index: number, collection: _.List) => 1; @@ -4094,73 +4267,133 @@ namespace TestForEachRight { { let result: string; - _.forEachRight('', stringIterator); + result = _.forEachRight('', stringIterator); + } + + { + let result: string | null | undefined; + + result = _.forEachRight('' as (string | null | undefined), stringIterator); } { let result: TResult[]; - _.forEachRight(array, listIterator); + result = _.forEachRight(array, listIterator); + } + + { + let result: TResult[] | null | undefined; + + result = _.forEachRight(nilArray, listIterator); } { let result: _.List; - _.forEachRight(list, listIterator); + result = _.forEachRight(list, listIterator); } { - let result: _.Dictionary; + let result: _.List | null | undefined; - _.forEachRight(dictionary, dictionaryIterator); + result = _.forEachRight(nilList, listIterator); + } + + { + let result: _.Dictionary; + + result = _.forEachRight(dictionary, dictionaryIterator); + } + + { + let result: _.Dictionary | null | undefined; + + result = _.forEachRight(nilDictionary, dictionaryIterator); } { let result: _.LoDashImplicitWrapper; - _('').forEachRight(stringIterator); + result = _('').forEachRight(stringIterator); } { let result: _.LoDashImplicitArrayWrapper; - _(array).forEachRight(listIterator); + result = _(array).forEachRight(listIterator); + } + + { + let result: _.LoDashImplicitNillableArrayWrapper; + + result = _(nilArray).forEachRight(listIterator); } { let result: _.LoDashImplicitObjectWrapper<_.List>; - _(list).forEachRight(listIterator); + result = _(list).forEachRight(listIterator); + } + + { + let result: _.LoDashImplicitNillableObjectWrapper<_.List>; + + result = _(nilList).forEachRight(listIterator); } { let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; - _(dictionary).forEachRight(dictionaryIterator); + result = _(dictionary).forEachRight(dictionaryIterator); + } + + { + let result: _.LoDashImplicitNillableObjectWrapper<_.Dictionary>; + + result = _(nilDictionary).forEachRight(dictionaryIterator); } { let result: _.LoDashExplicitWrapper; - _('').chain().forEachRight(stringIterator); + result = _('').chain().forEachRight(stringIterator); } { let result: _.LoDashExplicitArrayWrapper; - _(array).chain().forEachRight(listIterator); + result = _(array).chain().forEachRight(listIterator); + } + + { + let result: _.LoDashExplicitNillableArrayWrapper; + + result = _(nilArray).chain().forEachRight(listIterator); } { let result: _.LoDashExplicitObjectWrapper<_.List>; - _(list).chain().forEachRight(listIterator); + result = _(list).chain().forEachRight(listIterator); + } + + { + let result: _.LoDashExplicitNillableObjectWrapper<_.List>; + + result = _(nilList).chain().forEachRight(listIterator); } { let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; - _(dictionary).chain().forEachRight(dictionaryIterator); + result = _(dictionary).chain().forEachRight(dictionaryIterator); + } + + { + let result: _.LoDashExplicitNillableObjectWrapper<_.Dictionary>; + + result = _(nilDictionary).chain().forEachRight(dictionaryIterator); } } @@ -4168,9 +4401,10 @@ namespace TestForEachRight { namespace TestGroupBy { type SampleType = {a: number; b: string; c: boolean;}; - let array: SampleType[] = []; - let list: _.List = []; - let dictionary: _.Dictionary = {}; + let array: SampleType[] | null | undefined = [] as any; + let list: _.List | null | undefined = [] as any; + let obj: any = {}; + let dictionary: _.Dictionary | null | undefined = obj; let stringIterator = (char: string, index: number, string: string) => 0; let listIterator = (value: SampleType, index: number, collection: _.List) => 0; @@ -4290,9 +4524,10 @@ namespace TestGroupBy { namespace TestIncludes { type SampleType = {a: string; b: number; c: boolean;}; - let array: SampleType[] = []; - let list: _.List = []; - let dictionary: _.Dictionary = {}; + let array: SampleType[] | null | undefined = [] as any; + let list: _.List | null | undefined = [] as any; + let obj: any = {}; + let dictionary: _.Dictionary | null | undefined = obj; let target: SampleType = { a: "", b: 1, c: true }; @@ -4336,10 +4571,11 @@ namespace TestIncludes { namespace TestKeyBy { type SampleObject = {a: number; b: string; c: boolean;}; - let array: SampleObject[] = []; - let list: _.List = []; - let dictionary: _.Dictionary = {}; - let numericDictionary: _.NumericDictionary = {}; + let array: SampleObject[] | null | undefined = [] as any; + let list: _.List | null | undefined = [] as any; + let obj: any = {}; + let dictionary: _.Dictionary | null | undefined = obj; + let numericDictionary: _.NumericDictionary | null | undefined = obj; let stringIterator: (value: string, index: number, collection: string) => any = (value: string, index: number, collection: string) => 1; let listIterator: (value: SampleObject, index: number, collection: _.List) => any = (value: SampleObject, index: number, collection: _.List) => 1; @@ -4534,13 +4770,14 @@ namespace TestInvoke { //_.invokeMap namespace TestInvokeMap { - let numArray = [4, 2, 1, 3] - let numDict: _.Dictionary = { + let numArray: number[] | null | undefined = [4, 2, 1, 3] as any; + let obj: _.Dictionary = { a: 1, b: 2, c: 3, d: 4 - } + }; + let numDict: _.Dictionary | null | undefined = obj as any; let result: string[]; result = _.invokeMap(numArray, 'toString'); @@ -4582,9 +4819,10 @@ namespace TestInvokeMap { // _.map namespace TestMap { - let array: number[] = []; - let list: _.List = []; - let dictionary: _.Dictionary = {}; + let array: number[] | null | undefined = [] as any; + let list: _.List | null | undefined = [] as any; + let obj: any = {}; + let dictionary: _.Dictionary | null | undefined = obj; let listIterator: (value: number, index: number, collection: _.List) => TResult = (value: number, index: number, collection: _.List) => ({ a: 1, b: "", c: true }); let dictionaryIterator: (value: number, key: string, collection: _.Dictionary) => TResult = (value: number, key: string, collection: _.Dictionary) => ({ a: 1, b: "", c: true }); @@ -4677,6 +4915,7 @@ result = <{a: number}[][]>_.partition<{a: number}>({0: {a: 1}, 1: {a: 2}, length result = <{a: number}[][]>_.partition<{a: number}>({0: {a: 1}, 1: {a: 2}, length: 2}, 'a', 2); result = <{a: number}[][]>_.partition<{a: number}>({0: {a: 1}, 1: {a: 2}}, 'a'); result = <{a: number}[][]>_.partition<{a: number}>({0: {a: 1}, 1: {a: 2}}, 'a', 2); +result = <{a: number}[][]>_.partition<{a: number}>(null, 'a'); result = _('abcd').partition((n) => n < 'c').value(); result = _(['a', 'b', 'c', 'd']).partition((n) => n < 'c').value(); result = _([1, 2, 3, 4]).partition((n) => n < 3).value(); @@ -4762,8 +5001,10 @@ namespace TestReduce { } result = _.reduce([1, 2, 3], (sum: number, num: number) => sum + num); + result = _.reduce(null, (sum: number, num: number) => sum + num); // chained + result = _([1, 2 ,3]).reduce((sum: number, num: number) => sum + num); result = _.chain([1, 2 ,3]).reduce((sum: number, num: number) => sum + num).value(); result = _.reduce({ 'a': 1, 'b': 2, 'c': 3 }, (r: ABC, num: number, key: string) => { @@ -4781,9 +5022,10 @@ namespace TestReduce { } // _.reject namespace TestReject { - let array: TResult[] = []; - let list: _.List = []; - let dictionary: _.Dictionary = {}; + let array: TResult[] | null | undefined = [] as any; + let list: _.List | null | undefined = [] as any; + let obj: any = {}; + let dictionary: _.Dictionary | null | undefined = obj; let stringIterator: (char: string, index: number, string: string) => any = (char: string, index: number, string: string) => 1; let listIterator: (value: TResult, index: number, collection: _.List) => any = (value: TResult, index: number, collection: _.List) => 1; @@ -4858,13 +5100,14 @@ namespace TestReject { // _.sample namespace TestSample { - let array: string[] = []; - let list: _.List = []; - let dictionary: _.Dictionary = {}; - let numericDictionary: _.NumericDictionary = {}; + let array: string[] | null | undefined = [] as any; + let list: _.List | null | undefined = [] as any; + let obj: any = {}; + let dictionary: _.Dictionary | null | undefined = obj; + let numericDictionary: _.NumericDictionary | null | undefined= obj; { - let result: string; + let result: string | undefined; result = _.sample('abc'); result = _.sample(array); @@ -4896,10 +5139,11 @@ namespace TestSample { // _.sampleSize namespace TestSampleSize { - let array: string[] = []; - let list: _.List = []; - let dictionary: _.Dictionary = {}; - let numericDictionary: _.NumericDictionary = {}; + let array: string[] | null | undefined = [] as any; + let list: _.List | null | undefined = [] as any; + let obj: any = {}; + let dictionary: _.Dictionary | null | undefined = obj; + let numericDictionary: _.NumericDictionary | null | undefined = obj; { let result: string[]; @@ -4957,9 +5201,10 @@ namespace TestSampleSize { // _.shuffle namespace TestShuffle { - let array: TResult[] = []; - let list: _.List = []; - let dictionary: _.Dictionary = {}; + let array: TResult[] | null | undefined = [] as any; + let list: _.List | null | undefined = [] as any; + let obj: any = {}; + let dictionary: _.Dictionary | null | undefined = obj; { let result: string[]; @@ -5008,9 +5253,10 @@ namespace TestShuffle { namespace TestSize { type SampleType = {a: string; b: number; c: boolean;}; - let array: SampleType[] = []; - let list: _.List = []; - let dictionary: _.Dictionary = {}; + let array: SampleType[] | null | undefined = [] as any; + let list: _.List | null | undefined = [] as any; + let obj: any = {}; + let dictionary: _.Dictionary | null | undefined = obj; { let result: number; @@ -5040,11 +5286,12 @@ namespace TestSize { namespace TestSome { type SampleObject = {a: number; b: string; c: boolean;}; - let array: SampleObject[] = []; - let list: _.List = []; - let dictionary: _.Dictionary = {}; - let numericDictionary: _.NumericDictionary = {}; - let sampleObject: SampleObject = { a: 1, b: "", c: true }; + let array: SampleObject[] | null | undefined = [] as any; + let list: _.List | null | undefined = [] as any; + let obj: any = {}; + let dictionary: _.Dictionary | null | undefined = obj; + let numericDictionary: _.NumericDictionary | null | undefined = obj; + let sampleObject: SampleObject | null | undefined = obj; let listIterator = (value: SampleObject, index: number, collection: _.List) => true; let dictionaryIterator = (value: SampleObject, key: string, collection: _.Dictionary) => true; @@ -5158,9 +5405,10 @@ namespace TestSome { // _.sortBy namespace TestSortBy { - let array: TResult[] = []; - let list: _.List = []; - let dictionary: _.Dictionary = {}; + let array: TResult[] | null | undefined = [] as any; + let list: _.List | null | undefined = [] as any; + let obj: any = {}; + let dictionary: _.Dictionary | null | undefined = obj; let listIterator = (value: TResult, index: number, collection: _.List) => 0; let dictionaryIterator = (value: TResult, key: string, collection: _.Dictionary) => 0; @@ -5233,10 +5481,11 @@ result = _(foodsOrganic).sortBy('organic', (food) => food.name, namespace TestorderBy { type SampleObject = {a: number; b: string; c: boolean}; - let array: SampleObject[] = []; - let list: _.List = []; - let numericDictionary: _.NumericDictionary = {}; - let dictionary: _.Dictionary = {}; + let array: SampleObject[] | null | undefined = [] as any; + let list: _.List | null | undefined = [] as any; + let obj: any = {}; + let numericDictionary: _.NumericDictionary | null | undefined = obj; + let dictionary: _.Dictionary | null | undefined = obj; let orders: boolean|string|(boolean|string)[] = true as any; { @@ -6926,7 +7175,9 @@ namespace TestIsEqual { // _.isEqualWith namespace TestIsEqualWith { - let customizer = (value: any, other: any, indexOrKey?: number|string) => true; + let customizer = (value: any, other: any, indexOrKey: number|string|undefined, parent: any, otherParent: any, stack: any) => { + return value ? undefined : true; + }; { let result: boolean; @@ -7836,7 +8087,7 @@ namespace TestMax { let array: number[] = []; let list: _.List = []; - let result: number; + let result: number | undefined; result = _.max(array); result = _.max(list); @@ -7854,7 +8105,7 @@ namespace TestMaxBy { let listIterator = (value: number, index: number, collection: _.List) => 0; let dictionaryIterator = (value: number, key: string, collection: _.Dictionary) => 0; - let result: number; + let result: number | undefined; result = _.maxBy(array); result = _.maxBy(array, listIterator); @@ -7903,7 +8154,7 @@ namespace TestMin { let array: number[] = []; let list: _.List = []; - let result: number; + let result: number | undefined; result = _.min(array); result = _.min(list); @@ -7921,7 +8172,7 @@ namespace TestMinBy { let listIterator = (value: number, index: number, collection: _.List) => 0; let dictionaryIterator = (value: number, key: string, collection: _.Dictionary) => 0; - let result: number; + let result: number | undefined; result = _.minBy(array); result = _.minBy(array, listIterator); @@ -7976,9 +8227,10 @@ namespace TestRound { // _.sum namespace TestSum { - let array: number[] = []; - let list: _.List = []; - let dictionary: _.Dictionary = {}; + let array: number[] | null | undefined = [] as any; + let list: _.List | null | undefined = [] as any; + let obj: any = {}; + let dictionary: _.Dictionary | null | undefined = obj; let listIterator = (value: number, index: number, collection: _.List) => 0; let dictionaryIterator = (value: number, key: string, collection: _.Dictionary) => 0; @@ -8012,11 +8264,11 @@ namespace TestSum { // _.sumBy namespace TestSumBy { - let array: number[] = []; - let objectArray: { 'age': number }[] = []; + let array: number[] | null | undefined = [] as any; + let objectArray: { 'age': number }[] | null | undefined = [] as any; - let list: _.List = []; - let objectList: _.List<{ 'age': number }> = []; + let list: _.List | null | undefined = [] as any; + let objectList: _.List<{ 'age': number }> | null | undefined = [] as any; let listIterator = (value: number, index: number, collection: _.List) => 0; @@ -9043,8 +9295,9 @@ namespace TestExtendWith { // _.findKey namespace TestFindKey { { + let a: keyof undefined; let predicateFn = (value: any, key: string, object: {}) => true; - let result: string; + let result: string | undefined; result = _.findKey<{a: string;}>({a: ''}); @@ -9065,7 +9318,7 @@ namespace TestFindKey { { let predicateFn = (value: string, key: string, collection: _.Dictionary) => true; - let result: string; + let result: string | undefined; result = _.findKey({a: ''}, predicateFn); @@ -9074,7 +9327,7 @@ namespace TestFindKey { { let predicateFn = (value: any, key: string, object: {}) => true; - let result: _.LoDashExplicitWrapper; + let result: _.LoDashExplicitWrapper; result = _<{a: string;}>({a: ''}).chain().findKey(); @@ -9087,7 +9340,7 @@ namespace TestFindKey { { let predicateFn = (value: string, key: string, collection: _.Dictionary) => true; - let result: _.LoDashExplicitWrapper; + let result: _.LoDashExplicitWrapper; result = _<{a: string;}>({a: ''}).chain().findKey(predicateFn); } @@ -9097,7 +9350,7 @@ namespace TestFindKey { namespace TestFindLastKey { { let predicateFn = (value: any, key: string, object: {}) => true; - let result: string; + let result: string | undefined; result = _.findLastKey<{a: string;}>({a: ''}); @@ -9118,7 +9371,7 @@ namespace TestFindLastKey { { let predicateFn = (value: string, key: string, collection: _.Dictionary) => true; - let result: string; + let result: string | undefined; result = _.findLastKey({a: ''}, predicateFn); @@ -9127,7 +9380,7 @@ namespace TestFindLastKey { { let predicateFn = (value: any, key: string, object: {}) => true; - let result: _.LoDashExplicitWrapper; + let result: _.LoDashExplicitWrapper; result = _<{a: string;}>({a: ''}).chain().findLastKey(); @@ -9140,7 +9393,7 @@ namespace TestFindLastKey { { let predicateFn = (value: string, key: string, collection: _.Dictionary) => true; - let result: _.LoDashExplicitWrapper; + let result: _.LoDashExplicitWrapper; result = _<{a: string;}>({a: ''}).chain().findLastKey(predicateFn); } @@ -9151,9 +9404,11 @@ namespace TestForIn { type SampleObject = {a: number; b: string; c: boolean;}; let dictionary: _.Dictionary = {}; + let nilDictionary: _.Dictionary | null | undefined = any; let dictionaryIterator: (value: number, key: string, collection: _.Dictionary) => any = (value: number, key: string, collection: _.Dictionary) => 1; let object: SampleObject = { a: 1, b: "", c: true }; + let nilObject: SampleObject | null | undefined = any; let objectIterator: (element: any, key?: string, collection?: any) => any = (element: any, key?: string, collection?: any) => 1; { @@ -9163,6 +9418,13 @@ namespace TestForIn { result = _.forIn(dictionary, dictionaryIterator); } + { + let result: _.Dictionary | null | undefined; + + result = _.forIn(nilDictionary); + result = _.forIn(nilDictionary, dictionaryIterator); + } + { let result: SampleObject; @@ -9170,6 +9432,13 @@ namespace TestForIn { result = _.forIn(object, objectIterator); } + { + let result: SampleObject | null | undefined; + + result = _.forIn(nilObject); + result = _.forIn(nilObject, objectIterator); + } + { let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; @@ -9177,12 +9446,26 @@ namespace TestForIn { result = _(dictionary).forIn(dictionaryIterator); } + { + let result: _.LoDashImplicitNillableObjectWrapper<_.Dictionary>; + + result = _(nilDictionary).forIn(); + result = _(nilDictionary).forIn(dictionaryIterator); + } + { let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; result = _(dictionary).chain().forIn(); result = _(dictionary).chain().forIn(dictionaryIterator); } + + { + let result: _.LoDashExplicitNillableObjectWrapper<_.Dictionary>; + + result = _(nilDictionary).chain().forIn(); + result = _(nilDictionary).chain().forIn(dictionaryIterator); + } } // _.forInRight @@ -9190,9 +9473,11 @@ namespace TestForInRight { type SampleObject = {a: number; b: string; c: boolean;}; let dictionary: _.Dictionary = {}; + let nilDictionary: _.Dictionary | null | undefined = any; let dictionaryIterator: (value: number, key: string, collection: _.Dictionary) => any = (value: number, key: string, collection: _.Dictionary) => 1; let object: SampleObject = { a: 1, b: "", c: true }; + let nilObject: SampleObject | null | undefined = any; let objectIterator: (element: any, key?: string, collection?: any) => any = (element: any, key?: string, collection?: any) => 1; { @@ -9202,6 +9487,13 @@ namespace TestForInRight { result = _.forInRight(dictionary, dictionaryIterator); } + { + let result: _.Dictionary | null | undefined; + + result = _.forInRight(nilDictionary); + result = _.forInRight(nilDictionary, dictionaryIterator); + } + { let result: SampleObject; @@ -9209,6 +9501,13 @@ namespace TestForInRight { result = _.forInRight(object, objectIterator); } + { + let result: SampleObject | null | undefined; + + result = _.forInRight(nilObject); + result = _.forInRight(nilObject, objectIterator); + } + { let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; @@ -9216,12 +9515,26 @@ namespace TestForInRight { result = _(dictionary).forInRight(dictionaryIterator); } + { + let result: _.LoDashImplicitNillableObjectWrapper<_.Dictionary>; + + result = _(nilDictionary).forInRight(); + result = _(nilDictionary).forInRight(dictionaryIterator); + } + { let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; result = _(dictionary).chain().forInRight(); result = _(dictionary).chain().forInRight(dictionaryIterator); } + + { + let result: _.LoDashExplicitNillableObjectWrapper<_.Dictionary>; + + result = _(nilDictionary).chain().forInRight(); + result = _(nilDictionary).chain().forInRight(dictionaryIterator); + } } // _.forOwn @@ -9229,9 +9542,11 @@ namespace TestForOwn { type SampleObject = {a: number; b: string; c: boolean;}; let dictionary: _.Dictionary = {}; + let nilDictionary: _.Dictionary | null | undefined = any; let dictionaryIterator: (value: number, key: string, collection: _.Dictionary) => any = (value: number, key: string, collection: _.Dictionary) => 1; let object: SampleObject = { a: 1, b: "", c: true }; + let nilObject: SampleObject | null | undefined = any; let objectIterator: (element: any, key?: string, collection?: any) => any = (element: any, key?: string, collection?: any) => 1; { @@ -9241,6 +9556,13 @@ namespace TestForOwn { result = _.forOwn(dictionary, dictionaryIterator); } + { + let result: _.Dictionary | null | undefined; + + result = _.forOwn(nilDictionary); + result = _.forOwn(nilDictionary, dictionaryIterator); + } + { let result: SampleObject; @@ -9248,6 +9570,13 @@ namespace TestForOwn { result = _.forOwn(object, objectIterator); } + { + let result: SampleObject | null | undefined; + + result = _.forOwn(nilObject); + result = _.forOwn(nilObject, objectIterator); + } + { let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; @@ -9255,12 +9584,26 @@ namespace TestForOwn { result = _(dictionary).forOwn(dictionaryIterator); } + { + let result: _.LoDashImplicitNillableObjectWrapper<_.Dictionary>; + + result = _(nilDictionary).forOwn(); + result = _(nilDictionary).forOwn(dictionaryIterator); + } + { let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; result = _(dictionary).chain().forOwn(); result = _(dictionary).chain().forOwn(dictionaryIterator); } + + { + let result: _.LoDashExplicitNillableObjectWrapper<_.Dictionary>; + + result = _(nilDictionary).chain().forOwn(); + result = _(nilDictionary).chain().forOwn(dictionaryIterator); + } } // _.forOwnRight @@ -9268,9 +9611,11 @@ namespace TestForOwnRight { type SampleObject = {a: number; b: string; c: boolean;}; let dictionary: _.Dictionary = {}; + let nilDictionary: _.Dictionary | null | undefined = any; let dictionaryIterator: (value: number, key: string, collection: _.Dictionary) => any = (value: number, key: string, collection: _.Dictionary) => 1; let object: SampleObject = { a: 1, b: "", c: true }; + let nilObject: SampleObject | null | undefined = any; let objectIterator: (element: any, key?: string, collection?: any) => any = (element: any, key?: string, collection?: any) => 1; { @@ -9280,6 +9625,13 @@ namespace TestForOwnRight { result = _.forOwnRight(dictionary, dictionaryIterator); } + { + let result: _.Dictionary | null | undefined; + + result = _.forOwnRight(nilDictionary); + result = _.forOwnRight(nilDictionary, dictionaryIterator); + } + { let result: SampleObject; @@ -9287,6 +9639,13 @@ namespace TestForOwnRight { result = _.forOwnRight(object, objectIterator); } + { + let result: SampleObject | null | undefined; + + result = _.forOwnRight(nilObject); + result = _.forOwnRight(nilObject, objectIterator); + } + { let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; @@ -9294,12 +9653,26 @@ namespace TestForOwnRight { result = _(dictionary).forOwnRight(dictionaryIterator); } + { + let result: _.LoDashImplicitNillableObjectWrapper<_.Dictionary>; + + result = _(nilDictionary).forOwnRight(); + result = _(nilDictionary).forOwnRight(dictionaryIterator); + } + { let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; result = _(dictionary).chain().forOwnRight(); result = _(dictionary).chain().forOwnRight(dictionaryIterator); } + + { + let result: _.LoDashExplicitNillableObjectWrapper<_.Dictionary>; + + result = _(nilDictionary).chain().forOwnRight(); + result = _(nilDictionary).chain().forOwnRight(dictionaryIterator); + } } // _.functions @@ -9623,7 +9996,7 @@ namespace TestInvertBy { // _.keys namespace TestKeys { - let object: _.Dictionary = {}; + let object: _.Dictionary | null | undefined = any; { let result: string[]; @@ -9646,7 +10019,7 @@ namespace TestKeys { // _.keysIn namespace TestKeysIn { - let object: _.Dictionary = {}; + let object: _.Dictionary | null | undefined = any; { let result: string[]; @@ -9669,9 +10042,9 @@ namespace TestKeysIn { // _.mapKeys namespace TestMapKeys { - let array: TResult[] = []; - let list: _.List = []; - let dictionary: _.Dictionary = {}; + let array: TResult[] | null | undefined = [] as any; + let list: _.List| null | undefined = [] as any; + let dictionary: _.Dictionary | null | undefined = any; let listIterator = (value: TResult, index: number, collection: _.List) => ""; let dictionaryIterator = (value: TResult, key: string, collection: _.Dictionary) => ""; @@ -9913,8 +10286,6 @@ namespace TestOmitBy { // _.pick namespace TestPick { - let predicate: (element: any, key: string, collection: any) => boolean; - { let result: TResult; From 86f8d59e5a721b1785f1ab6ccec72e8ae68f3ffb Mon Sep 17 00:00:00 2001 From: Ronan Date: Thu, 1 Jun 2017 16:30:30 +0100 Subject: [PATCH 0210/1105] Added single type option to AutocompleteOptions in googlemaps types (#16376) * added single type option to AutocompleteOptions interface * Made type in autocompleteoptions optional --- types/googlemaps/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/googlemaps/index.d.ts b/types/googlemaps/index.d.ts index 0e12a8e643..6a5e1286ae 100644 --- a/types/googlemaps/index.d.ts +++ b/types/googlemaps/index.d.ts @@ -2464,6 +2464,7 @@ declare namespace google.maps { placeIdOnly?: boolean; strictBounds?: boolean; types?: string[]; + type?: string; } export interface AutocompletePrediction { From 423676a9f818d24ad8f69dfd7ee2e8be8af08465 Mon Sep 17 00:00:00 2001 From: Matthias Lochbrunner Date: Thu, 1 Jun 2017 17:31:05 +0200 Subject: [PATCH 0211/1105] Add openStdin() (#16378) --- types/node/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index a331173657..72b1e1765c 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -370,6 +370,7 @@ declare namespace NodeJS { stdout: Socket; stderr: Socket; stdin: Socket; + openStdin(): Socket; argv: string[]; argv0: string; execArgv: string[]; From 24c67b0a093776895eb52c7a14d48fbe722b69bd Mon Sep 17 00:00:00 2001 From: Jens Duttke Date: Thu, 1 Jun 2017 17:31:34 +0200 Subject: [PATCH 0212/1105] Add React.ReactInstance to OverlayProps.target (#16379) OverlayProps.target can be either a function or a React.ReactInstance. See: https://github.com/react-bootstrap/react-overlays/blob/master/src/Position.js Line: 82 and 83 --- types/react-bootstrap/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-bootstrap/index.d.ts b/types/react-bootstrap/index.d.ts index a11abcd38d..2aeccc490d 100644 --- a/types/react-bootstrap/index.d.ts +++ b/types/react-bootstrap/index.d.ts @@ -442,7 +442,7 @@ declare namespace ReactBootstrap { placement?: string; rootClose?: boolean; show?: boolean; - target?: Function; + target?: Function | React.ReactInstance; shouldUpdatePosition?: boolean; } class Overlay extends React.Component { From 9bdf41ae8cae554ccb01ddc893d0296ef74c377a Mon Sep 17 00:00:00 2001 From: Steve Hipwell Date: Thu, 1 Jun 2017 16:34:24 +0100 Subject: [PATCH 0213/1105] Update restify-errors typings to support defined errors (#16382) * Update restify-errors to correctly type predefined * Fixed linting errors * Fixed linting issue * Fixed defined types for restify-errors * Fixed restify-errors tests * Updated restify-errors ts version * Update correct definition * Remove unwanted file --- types/restify-errors/index.d.ts | 140 +++++++++++-------- types/restify-errors/restify-errors-tests.ts | 105 +++++++------- types/restify/index.d.ts | 1 + 3 files changed, 136 insertions(+), 110 deletions(-) diff --git a/types/restify-errors/index.d.ts b/types/restify-errors/index.d.ts index c22b4339a8..ea857233dd 100644 --- a/types/restify-errors/index.d.ts +++ b/types/restify-errors/index.d.ts @@ -2,6 +2,7 @@ // Project: http://www.restify.com // Definitions by: Steve Hipwell // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { VError, Options as vErrorOptions } from "verror"; @@ -36,6 +37,21 @@ export class HttpError extends VError { displayName: string; } +export class DefinedHttpError extends HttpError { + constructor(); + + // tslint:disable-next-line unified-signatures + constructor(printf: string, ...args: any[]); + + // tslint:disable-next-line unified-signatures + constructor(options: RestifyHttpErrorOptions, printf?: string, ...args: any[]); + + // tslint:disable-next-line unified-signatures + constructor(priorErr: any, printf?: string, ...args: any[]); + + constructor(priorErr: any, options: RestifyHttpErrorOptions, printf?: string, ...args: any[]); +} + export interface RestifyRestErrorOptions extends RestifyHttpErrorOptions { restCode?: string; } @@ -53,67 +69,77 @@ export class RestError extends HttpError { restCode: string; } +export class DefinedRestError extends RestError { + constructor(); + + // tslint:disable-next-line unified-signatures + constructor(printf: string, ...args: any[]); + + // tslint:disable-next-line unified-signatures + constructor(options: RestifyHttpErrorOptions, printf?: string, ...args: any[]); + + // tslint:disable-next-line unified-signatures + constructor(priorErr: any, printf?: string, ...args: any[]); + + constructor(priorErr: any, options: RestifyHttpErrorOptions, printf?: string, ...args: any[]); +} + export function makeConstructor(name: string, defaults?: any): void; export function makeErrFromCode(statusCode: number, ...args: any[]): HttpError; export function bunyanSerializer(err: any): any; -export const HttpErrors: { - BadRequestError: HttpError; - UnauthorizedError: HttpError; - PaymentRequiredError: HttpError; - ForbiddenError: HttpError; - NotFoundError: HttpError; - MethodNotAllowedError: HttpError; - NotAcceptableError: HttpError; - ProxyAuthenticationRequiredError: HttpError; - RequestTimeoutError: HttpError; - ConflictError: HttpError; - GoneError: HttpError; - LengthRequiredError: HttpError; - PreconditionFailedError: HttpError; - RequestEntityTooLargeError: HttpError; - RequesturiTooLargeError: HttpError; - UnsupportedMediaTypeError: HttpError; - RangeNotSatisfiableError: HttpError; - ExpectationFailedError: HttpError; - ImATeapotError: HttpError; - UnprocessableEntityError: HttpError; - LockedError: HttpError; - FailedDependencyError: HttpError; - UnorderedCollectionError: HttpError; - UpgradeRequiredError: HttpError; - PreconditionRequiredError: HttpError; - TooManyRequestsError: HttpError; - RequestHeaderFieldsTooLargeError: HttpError; - InternalServerError: HttpError; - NotImplementedError: HttpError; - BadGatewayError: HttpError; - ServiceUnavailableError: HttpError; - GatewayTimeoutError: HttpError; - HttpVersionNotSupportedError: HttpError; - VariantAlsoNegotiatesError: HttpError; - InsufficientStorageError: HttpError; - BandwidthLimitExceededError: HttpError; - NotExtendedError: HttpError; - NetworkAuthenticationRequiredError: HttpError; -}; +export class BadRequestError extends DefinedHttpError { } +export class UnauthorizedError extends DefinedHttpError { } +export class PaymentRequiredError extends DefinedHttpError { } +export class ForbiddenError extends DefinedHttpError { } +export class NotFoundError extends DefinedHttpError { } +export class MethodNotAllowedError extends DefinedHttpError { } +export class NotAcceptableError extends DefinedHttpError { } +export class ProxyAuthenticationRequiredError extends DefinedHttpError { } +export class RequestTimeoutError extends DefinedHttpError { } +export class ConflictError extends DefinedHttpError { } +export class GoneError extends DefinedHttpError { } +export class LengthRequiredError extends DefinedHttpError { } +export class PreconditionFailedError extends DefinedHttpError { } +export class RequestEntityTooLargeError extends DefinedHttpError { } +export class RequesturiTooLargeError extends DefinedHttpError { } +export class UnsupportedMediaTypeError extends DefinedHttpError { } +export class RangeNotSatisfiableError extends DefinedHttpError { } +export class ExpectationFailedError extends DefinedHttpError { } +export class ImATeapotError extends DefinedHttpError { } +export class UnprocessableEntityError extends DefinedHttpError { } +export class LockedError extends DefinedHttpError { } +export class FailedDependencyError extends DefinedHttpError { } +export class UnorderedCollectionError extends DefinedHttpError { } +export class UpgradeRequiredError extends DefinedHttpError { } +export class PreconditionRequiredError extends DefinedHttpError { } +export class TooManyRequestsError extends DefinedHttpError { } +export class RequestHeaderFieldsTooLargeError extends DefinedHttpError { } +export class InternalServerError extends DefinedHttpError { } +export class NotImplementedError extends DefinedHttpError { } +export class BadGatewayError extends DefinedHttpError { } +export class ServiceUnavailableError extends DefinedHttpError { } +export class GatewayTimeoutError extends DefinedHttpError { } +export class HttpVersionNotSupportedError extends DefinedHttpError { } +export class VariantAlsoNegotiatesError extends DefinedHttpError { } +export class InsufficientStorageError extends DefinedHttpError { } +export class BandwidthLimitExceededError extends DefinedHttpError { } +export class NotExtendedError extends DefinedHttpError { } +export class NetworkAuthenticationRequiredError extends DefinedHttpError { } -export const RestErrors: { - BadDigestError: RestError; - BadMethodError: RestError; - InternalError: RestError; - InvalidArgumentError: RestError; - InvalidContentError: RestError; - InvalidCredentialsError: RestError; - InvalidHeaderError: RestError; - InvalidVersionError: RestError; - MissingParameterError: RestError; - NotAuthorizedError: RestError; - PreconditionFailedError: RestError; - RequestExpiredError: RestError; - RequestThrottledError: RestError; - ResourceNotFoundError: RestError; - WrongAcceptError: RestError; -}; +export class BadDigestError extends DefinedRestError { } +export class BadMethodError extends DefinedRestError { } +export class InternalError extends DefinedRestError { } +export class InvalidArgumentError extends DefinedRestError { } +export class InvalidContentError extends DefinedRestError { } +export class InvalidCredentialsError extends DefinedRestError { } +export class InvalidHeaderError extends DefinedRestError { } +export class InvalidVersionError extends DefinedRestError { } +export class MissingParameterError extends DefinedRestError { } +export class NotAuthorizedError extends DefinedRestError { } +export class RequestExpiredError extends DefinedRestError { } +export class RequestThrottledError extends DefinedRestError { } +export class ResourceNotFoundError extends DefinedRestError { } +export class WrongAcceptError extends DefinedRestError { } diff --git a/types/restify-errors/restify-errors-tests.ts b/types/restify-errors/restify-errors-tests.ts index a48044fd92..600a0545fb 100644 --- a/types/restify-errors/restify-errors-tests.ts +++ b/types/restify-errors/restify-errors-tests.ts @@ -24,58 +24,57 @@ const customError = restifyErrors.makeErrFromCode(500, "Testing...."); const bunyanSerializer = restifyErrors.bunyanSerializer; // HttpErrors -let httpError = restifyErrors.HttpErrors.BadRequestError; -httpError = restifyErrors.HttpErrors.UnauthorizedError; -httpError = restifyErrors.HttpErrors.PaymentRequiredError; -httpError = restifyErrors.HttpErrors.ForbiddenError; -httpError = restifyErrors.HttpErrors.NotFoundError; -httpError = restifyErrors.HttpErrors.MethodNotAllowedError; -httpError = restifyErrors.HttpErrors.NotAcceptableError; -httpError = restifyErrors.HttpErrors.ProxyAuthenticationRequiredError; -httpError = restifyErrors.HttpErrors.RequestTimeoutError; -httpError = restifyErrors.HttpErrors.ConflictError; -httpError = restifyErrors.HttpErrors.GoneError; -httpError = restifyErrors.HttpErrors.LengthRequiredError; -httpError = restifyErrors.HttpErrors.PreconditionFailedError; -httpError = restifyErrors.HttpErrors.RequestEntityTooLargeError; -httpError = restifyErrors.HttpErrors.RequesturiTooLargeError; -httpError = restifyErrors.HttpErrors.UnsupportedMediaTypeError; -httpError = restifyErrors.HttpErrors.RangeNotSatisfiableError; -httpError = restifyErrors.HttpErrors.ExpectationFailedError; -httpError = restifyErrors.HttpErrors.ImATeapotError; -httpError = restifyErrors.HttpErrors.UnprocessableEntityError; -httpError = restifyErrors.HttpErrors.LockedError; -httpError = restifyErrors.HttpErrors.FailedDependencyError; -httpError = restifyErrors.HttpErrors.UnorderedCollectionError; -httpError = restifyErrors.HttpErrors.UpgradeRequiredError; -httpError = restifyErrors.HttpErrors.PreconditionRequiredError; -httpError = restifyErrors.HttpErrors.TooManyRequestsError; -httpError = restifyErrors.HttpErrors.RequestHeaderFieldsTooLargeError; -httpError = restifyErrors.HttpErrors.InternalServerError; -httpError = restifyErrors.HttpErrors.NotImplementedError; -httpError = restifyErrors.HttpErrors.BadGatewayError; -httpError = restifyErrors.HttpErrors.ServiceUnavailableError; -httpError = restifyErrors.HttpErrors.GatewayTimeoutError; -httpError = restifyErrors.HttpErrors.HttpVersionNotSupportedError; -httpError = restifyErrors.HttpErrors.VariantAlsoNegotiatesError; -httpError = restifyErrors.HttpErrors.InsufficientStorageError; -httpError = restifyErrors.HttpErrors.BandwidthLimitExceededError; -httpError = restifyErrors.HttpErrors.NotExtendedError; -httpError = restifyErrors.HttpErrors.NetworkAuthenticationRequiredError; +let httpError = new restifyErrors.BadRequestError(); +httpError = new restifyErrors.UnauthorizedError(); +httpError = new restifyErrors.PaymentRequiredError(); +httpError = new restifyErrors.ForbiddenError(); +httpError = new restifyErrors.NotFoundError(); +httpError = new restifyErrors.MethodNotAllowedError(); +httpError = new restifyErrors.NotAcceptableError(); +httpError = new restifyErrors.ProxyAuthenticationRequiredError(); +httpError = new restifyErrors.RequestTimeoutError(); +httpError = new restifyErrors.ConflictError(); +httpError = new restifyErrors.GoneError(); +httpError = new restifyErrors.LengthRequiredError(); +httpError = new restifyErrors.PreconditionFailedError(); +httpError = new restifyErrors.RequestEntityTooLargeError(); +httpError = new restifyErrors.RequesturiTooLargeError(); +httpError = new restifyErrors.UnsupportedMediaTypeError(); +httpError = new restifyErrors.RangeNotSatisfiableError(); +httpError = new restifyErrors.ExpectationFailedError(); +httpError = new restifyErrors.ImATeapotError(); +httpError = new restifyErrors.UnprocessableEntityError(); +httpError = new restifyErrors.LockedError(); +httpError = new restifyErrors.FailedDependencyError(); +httpError = new restifyErrors.UnorderedCollectionError(); +httpError = new restifyErrors.UpgradeRequiredError(); +httpError = new restifyErrors.PreconditionRequiredError(); +httpError = new restifyErrors.TooManyRequestsError(); +httpError = new restifyErrors.RequestHeaderFieldsTooLargeError(); +httpError = new restifyErrors.InternalServerError(); +httpError = new restifyErrors.NotImplementedError(); +httpError = new restifyErrors.BadGatewayError(); +httpError = new restifyErrors.ServiceUnavailableError(); +httpError = new restifyErrors.GatewayTimeoutError(); +httpError = new restifyErrors.HttpVersionNotSupportedError(); +httpError = new restifyErrors.VariantAlsoNegotiatesError(); +httpError = new restifyErrors.InsufficientStorageError(); +httpError = new restifyErrors.BandwidthLimitExceededError(); +httpError = new restifyErrors.NotExtendedError(); +httpError = new restifyErrors.NetworkAuthenticationRequiredError(); // RestErrors -let restError = restifyErrors.RestErrors.BadDigestError; -restError = restifyErrors.RestErrors.BadMethodError; -restError = restifyErrors.RestErrors.InternalError; -restError = restifyErrors.RestErrors.InvalidArgumentError; -restError = restifyErrors.RestErrors.InvalidContentError; -restError = restifyErrors.RestErrors.InvalidCredentialsError; -restError = restifyErrors.RestErrors.InvalidHeaderError; -restError = restifyErrors.RestErrors.InvalidVersionError; -restError = restifyErrors.RestErrors.MissingParameterError; -restError = restifyErrors.RestErrors.NotAuthorizedError; -restError = restifyErrors.RestErrors.PreconditionFailedError; -restError = restifyErrors.RestErrors.RequestExpiredError; -restError = restifyErrors.RestErrors.RequestThrottledError; -restError = restifyErrors.RestErrors.ResourceNotFoundError; -restError = restifyErrors.RestErrors.WrongAcceptError; +let restError = new restifyErrors.BadDigestError(); +restError = new restifyErrors.BadMethodError(); +restError = new restifyErrors.InternalError(); +restError = new restifyErrors.InvalidArgumentError(); +restError = new restifyErrors.InvalidContentError(); +restError = new restifyErrors.InvalidCredentialsError(); +restError = new restifyErrors.InvalidHeaderError(); +restError = new restifyErrors.InvalidVersionError(); +restError = new restifyErrors.MissingParameterError(); +restError = new restifyErrors.NotAuthorizedError(); +restError = new restifyErrors.RequestExpiredError(); +restError = new restifyErrors.RequestThrottledError(); +restError = new restifyErrors.ResourceNotFoundError(); +restError = new restifyErrors.WrongAcceptError(); diff --git a/types/restify/index.d.ts b/types/restify/index.d.ts index 6074ce8284..5f7e0ccb21 100644 --- a/types/restify/index.d.ts +++ b/types/restify/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/mcavage/node-restify // Definitions by: Bret Little , Steve Hipwell // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// From c9c78dff6450f4eca97d28867010bdea0819e1ff Mon Sep 17 00:00:00 2001 From: Harry Date: Thu, 1 Jun 2017 16:42:38 +0100 Subject: [PATCH 0214/1105] Add funding property to StripeCard (#16384) --- types/stripe/index.d.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/types/stripe/index.d.ts b/types/stripe/index.d.ts index 3e5d902060..cc486b5d5b 100644 --- a/types/stripe/index.d.ts +++ b/types/stripe/index.d.ts @@ -61,6 +61,8 @@ interface StripeError { type StripeCardDataBrand = 'Visa' | 'American Express' | 'MasterCard' | 'Discover' | 'JCB' | 'Diners Club' | 'Unknown'; +type StripeCardDataFunding = 'credit' | 'debit' | 'prepaid' | 'unknown'; + interface StripeCard { object: string; last4: string; @@ -75,6 +77,7 @@ interface StripeCard { address_zip?: string; address_country?: string; brand?: StripeCardDataBrand; + funding?: StripeCardDataFunding; createToken(data: StripeCardTokenData, responseHandler: (status: number, response: StripeCardTokenResponse) => void): void; validateCardNumber(cardNumber: string): boolean; validateExpiry(month: string, year: string): boolean; From 8a7e78869ec89ebc99ad7920d93d7e2a87b216ad Mon Sep 17 00:00:00 2001 From: Stephen Ierodiaconou Date: Thu, 1 Jun 2017 16:43:32 +0100 Subject: [PATCH 0215/1105] doT.js API allows modification of the exported templateSettings property. Change from const (#16385) --- types/dot/dot-tests.ts | 2 ++ types/dot/index.d.ts | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/types/dot/dot-tests.ts b/types/dot/dot-tests.ts index 507f63e81d..43ff610d91 100644 --- a/types/dot/dot-tests.ts +++ b/types/dot/dot-tests.ts @@ -23,6 +23,8 @@ const data = { name: "My name" }; +doT.templateSettings.varname = 'test'; + let pagefn = doT.template(pagetmpl, undefined, def); const content = pagefn(data); diff --git a/types/dot/index.d.ts b/types/dot/index.d.ts index 9ecd61b7ab..3594381fff 100644 --- a/types/dot/index.d.ts +++ b/types/dot/index.d.ts @@ -8,8 +8,8 @@ export as namespace doT; /** Version number */ export const version: string; -/** Default template settings */ -export const templateSettings: TemplateSettings; +/** Template settings */ +export let templateSettings: TemplateSettings; export type RenderFunction = (...args: any[]) => string; From 9d55adc25b42f235c11e5b9ff0bfbb60c9a1a666 Mon Sep 17 00:00:00 2001 From: Krzysztof Cebula Date: Thu, 1 Jun 2017 17:43:56 +0200 Subject: [PATCH 0216/1105] victory: Add missing labelRadius property for VictoryPie (#16388) * Add missing labelRadius property for VictoryPie * Add test * Increase package version * Add tickLabels on VictoryStyleInterface --- types/victory/index.d.ts | 12 ++++++++++-- types/victory/victory-tests.tsx | 1 + 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/types/victory/index.d.ts b/types/victory/index.d.ts index d1d241354d..437523f465 100644 --- a/types/victory/index.d.ts +++ b/types/victory/index.d.ts @@ -1,6 +1,8 @@ -// Type definitions for Victory 0.9.0 +// Type definitions for Victory 0.9.1 // Project: https://github.com/FormidableLabs/victory -// Definitions by: Alexey Svetliakov , snerks +// Definitions by: Alexey Svetliakov +// snerks +// Krzysztof Cebula // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 @@ -34,6 +36,7 @@ declare module "victory" { parent?: React.CSSProperties; data?: React.CSSProperties; labels?: React.CSSProperties; + tickLabels?: React.CSSProperties; } export interface VictoryAnimationProps { @@ -1390,6 +1393,11 @@ declare module "victory" { * If a dataComponent is not provided, VictoryPie's Slice component will be used. */ dataComponent?: React.ReactElement; + /** + * The labelRadius prop defines the radius of the arc that will be used for positioning each slice label. + * If this prop is not set, the label radius will default to the radius of the pie + label padding. + */ + labelRadius?: number; /** * The overall end angle of the pie in degrees. This prop is used in conjunction with * startAngle to create a pie that spans only a segment of a circle. diff --git a/types/victory/victory-tests.tsx b/types/victory/victory-tests.tsx index 601780ffaf..c6e7fb24b9 100644 --- a/types/victory/victory-tests.tsx +++ b/types/victory/victory-tests.tsx @@ -600,6 +600,7 @@ test = ( ({y: datum.y, label: "NEW"}) } }} + labelRadius={20} /> ); From 8579ea24a690b8f7016a61b9795a39f3cc9b821b Mon Sep 17 00:00:00 2001 From: Joel Eriksson Date: Thu, 1 Jun 2017 17:45:42 +0200 Subject: [PATCH 0217/1105] Update i18n with new methods (#16392) - Added methods introduced in newer versions - Improved documentation - Added tslint.json --- types/i18n/i18n-tests.ts | 115 +++++++++++-- types/i18n/index.d.ts | 337 +++++++++++++++++++++++++-------------- types/i18n/tslint.json | 7 + 3 files changed, 328 insertions(+), 131 deletions(-) create mode 100644 types/i18n/tslint.json diff --git a/types/i18n/i18n-tests.ts b/types/i18n/i18n-tests.ts index dc87c60a28..76e733d778 100644 --- a/types/i18n/i18n-tests.ts +++ b/types/i18n/i18n-tests.ts @@ -1,18 +1,17 @@ /** * Test suite created by Maxime LUCE + * Updated by FindQ for version 0.8 of i18n-node * * Created by using code samples from https://github.com/mashpie/i18n-node. */ /// - - import express = require("express"); import i18n = require("i18n"); -var app = express(); -var req: express.Request; +const app = express(); +let req: express.Request; /** * Configuration @@ -25,20 +24,35 @@ i18n.configure({ i18n.configure({ // setup some locales - other locales default to en silently - locales: ['en', 'de'], + locales: [ 'en', 'de' ], + + // fall back from Dutch to German + fallbacks: { nl: 'de' }, // you may alter a site wide default locale defaultLocale: 'de', - // sets a custom cookie name to parse locale settings from - defaults to NULL + // sets a custom cookie name to parse locale settings from - defaults to NULL cookie: 'yourcookiename', + // query parameter to switch locale (ie. /home?lang=ch) - defaults to NULL + queryParameter: 'lang', + // where to store json files - defaults to './locales' relative to modules directory directory: './mylocales', + // controll mode on directory creation - defaults to NULL which defaults to umask of process user. Setting has no effect on win. + directoryPermissions: '755', + + // watch for changes in json files to reload locale on updates - defaults to false + autoReload: true, + // whether to write new locale information to disk - defaults to true updateFiles: false, + // sync locale information accros all files - defaults to false + syncFiles: false, + // what to use as the indentation unit - defaults to "\t" indent: "\t", @@ -49,27 +63,57 @@ i18n.configure({ prefix: 'webapp-', // enable object notation - objectNotation: false + objectNotation: false, + + // setting of log level DEBUG - default to require('debug')('i18n:debug') + logDebugFn: (msg) => { + console.log('debug', msg); + }, + + // setting of log level WARN - default to require('debug')('i18n:warn') + logWarnFn: (msg) => { + console.log('warn', msg); + }, + + // setting of log level ERROR - default to require('debug')('i18n:error') + logErrorFn: (msg) => { + console.log('error', msg); + }, + + // object or [obj1, obj2] to bind the i18n api and current locale to - defaults to null + register: global, + + // hash to specify different aliases for i18n's internal methods to apply on the request/response objects (method -> alias). + // note that this will *not* overwrite existing properties with the same name + api: { + __: 't', // now req.__ becomes req.t + __n: 'tn' // and req.__n can be called as req.tn + }, + + // Downcase locale when passed on queryParam; e.g. lang=en-US becomes + // en-us. When set to false, the queryParam value will be used as passed; + // e.g. lang=en-US remains en-US. + preserveLegacyCase: true }); /** * Usage in global scope * https://github.com/mashpie/i18n-node#example-usage-in-global-scope */ -var greeting = i18n.__('Hello'); +let greeting = i18n.__('Hello'); /** * Usage in Express * https://github.com/mashpie/i18n-node#example-usage-in-expressjs */ // Configuration -app.configure(function () { +app.configure(() => { // default: using 'accept-language' header to guess language settings app.use(i18n.init); }); -app.get('/de', function (_req, res) { - var greeting = res.__('Hello'); +app.get('/de', (_req: Express.Request, res: Express.Response) => { + let greeting = res.__('Hello'); }); /** @@ -109,6 +153,39 @@ i18n.__n({ singular: "%s cat", plural: "%s cats", locale: "fr" }, 3); // 3 chat i18n.__n({ singular: "%s cat", plural: "%s cats", locale: "fr", count: 1 }); // 1 chat i18n.__n({ singular: "%s cat", plural: "%s cats", locale: "fr", count: 3 }); // 3 chat +/** + * __mf() + * https://github.com/mashpie/i18n-node#i18n__mf + */ +app.get('/de', (_req: Express.Request, res: Express.Response) => { + // assume res is set to german + res.setLocale('de'); + + // start simple + res.__mf('Hello'); // --> Hallo + + // can replace too + res.__mf('Hello {name}', { name: 'Marcus' }); // --> Hallo Marcus + + // and combines with sprintf + res.__mf('Hello {name}, how was your %s?', 'test', { name: 'Marcus' }); // --> Hallo Marcus, wie war dein test? + + // now check out a plural rule + res.__mf('{N, plural, one{# cat} few{# cats} many{# cats} others{# cats}}', {N: 1}); +}); + +/** + * __l() + * https://github.com/mashpie/i18n-node#i18n__l + */ +i18n.__l('Hello'); // --> [ 'Hallo', 'Hello' ] + +/** + * __h() + * https://github.com/mashpie/i18n-node#i18n__h + */ +i18n.__h('Hello'); // --> [ { de: 'Hallo' }, { en: 'Hello' } ] + /** * setLocale() * https://github.com/mashpie/i18n-node#setlocale @@ -117,6 +194,15 @@ i18n.setLocale('de'); i18n.setLocale(req, 'de'); req.setLocale('de'); +app.get('/ar', (_req: Express.Request, res: Express.Response) => { + i18n.setLocale(req, 'ar'); + i18n.setLocale(res, 'ar'); + i18n.setLocale(res.locals, 'ar'); + + i18n.setLocale([req, res.locals], req.params.lang); + i18n.setLocale(res, 'ar', true); +}); + /** * getLocale() * https://github.com/mashpie/i18n-node#getlocale @@ -125,6 +211,12 @@ i18n.getLocale(); // --> de i18n.getLocale(req); // --> de req.getLocale(); // --> de +/** + * getLocales() + * https://github.com/mashpie/i18n-node#i18ngetlocales + */ +i18n.getLocales(); // --> ['en', 'de', 'en-GB'] + /** * getCatalog() * https://github.com/mashpie/i18n-node#getcatalog @@ -137,4 +229,3 @@ i18n.getCatalog(req, 'de'); // returns just 'de' req.getCatalog(); // returns all locales req.getCatalog('de'); // returns just 'de' - diff --git a/types/i18n/index.d.ts b/types/i18n/index.d.ts index 7c7697cc22..534b46b186 100644 --- a/types/i18n/index.d.ts +++ b/types/i18n/index.d.ts @@ -1,14 +1,29 @@ -// Type definitions for i18n-node 0.5.0 +// Type definitions for i18n-node 0.8 // Project: https://github.com/mashpie/i18n-node // Definitions by: Maxime LUCE +// FindQ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - declare namespace i18n { - export interface ConfigurationOptions { - /** Setup some locales - other locales default to en silently */ + interface ConfigurationOptions { + /** + * Setup some locales - other locales default to en silently + * @default [] + */ locales?: string[]; - /** Alter a site wide default locale */ + + /** + * Language fallback map + * @default {} + */ + fallbacks?: { + [locale: string]: string; + }; + + /** + * Alter a site wide default locale + * @default "en" + */ defaultLocale?: string; /** @@ -16,6 +31,13 @@ declare namespace i18n { * @default null */ cookie?: string; + + /** + * Query parameter to switch locale (ie. /home?lang=ch) + * @default null + */ + queryParameter?: string; + /** * Where to store json files, relative to modules directory * @default "./locales" @@ -23,11 +45,29 @@ declare namespace i18n { directory?: string; /** - * whether to write new locale information to disk + * Control mode on directory creation. Setting has no effect on win. + * @default null + */ + directoryPermissions?: string; + + /** + * Watch for changes in json files to reload locale on updates + * @default false + */ + autoReload?: boolean; + + /** + * Whether to write new locale information to disk * @default true */ updateFiles?: boolean; + /** + * Sync locale information across all files + * @default false + */ + syncFiles?: boolean; + /** * What to use as the indentation unit * @default "\t" @@ -40,6 +80,12 @@ declare namespace i18n { */ extension?: string; + /** + * Setting prefix of json files name (in case you use different locale files naming scheme (webapp-en.json), rather then just en.json) + * @default "" + */ + prefix?: string; + /** * Enable object notation * @default false @@ -47,36 +93,70 @@ declare namespace i18n { objectNotation?: boolean; /** - * json files prefix + * Setting of log level DEBUG + * @default require("debug")("i18n:debug") */ - prefix?: string; - + logDebugFn?: (msg: string) => void; + /** - * object or [obj1, obj2] to bind the i18n api and current locale to - defaults to null + * Setting of log level WARN + * @default require("debug")("i18n:warn") + */ + logWarnFn?: (msg: string) => void; + + /** + * Setting of log level ERROR + * @default require("debug")("i18n:error") + */ + logErrorFn?: (msg: string) => void; + + /** + * object or [obj1, obj2] to bind the i18n api and current locale to + * @default null */ register?: any; + + /** + * Hash to specify different aliases for i18n's internal methods to apply on the request/response objects (method -> alias). + * Note that this will *not* overwrite existing properties with the same name. + * @default undefined + */ + api?: { + [method: string]: string; + }; + + /** + * Downcase locale when passed on queryParam; e.g. lang=en-US becomes en-us. + * When set to false, the queryParam value will be used as passed; e.g. lang=en-US remains en-US. + * @default true + */ + preserveLegacyCase?: boolean; } - export interface TranslateOptions { + interface TranslateOptions { phrase: string; locale?: string; } - export interface PluralOptions { + interface PluralOptions { singular: string; plural: string; count?: number; locale?: string; } - export interface Replacements { + interface Replacements { [key: string]: string; } - export interface LocaleCatalog { + interface LocaleCatalog { [key: string]: string; } - export interface GlobalCatalog { + interface GlobalCatalog { [key: string]: LocaleCatalog; } + interface HashedList { + [key: string]: string; + } + /** * Configure current i18n instance * @param {ConfigurationOptions} options - configuration options for i18n @@ -89,42 +169,23 @@ declare namespace i18n { * @param {Express.Response} response - Current express response * @param {Function} next - Callback to continue process */ - function init(request: Express.Request, response: Express.Response, next?: Function): void; + function init(request: Express.Request, response: Express.Response, next?: () => void): void; //#region __() /** * Translate the given phrase using locale configuration - * @param {string} phrase - The phrase to translate + * @param {string | TranslateOptions} phraseOrOptions - The phrase to translate or options for translation * @returns {string} The translated phrase */ - function __(phrase: string, ...replace: string[]): string; + function __(phraseOrOptions: string | TranslateOptions, ...replace: string[]): string; /** * Translate the given phrase using locale configuration - * @param {string} phrase - The phrase to translate - * @param {Object} replacements - An object containing replacements + * @param {string | TranslateOptions} phraseOrOptions - The phrase to translate or options for translation + * @param {Replacements} replacements - An object containing replacements * @returns {string} The translated phrase */ - function __(phrase: string, replacements: Replacements): string; - /** - * Translate the given phrase using locale configuration - * @param {TranslateOptions} options - Options for translation - * @returns {string} The translated phrase - */ - function __(options: TranslateOptions): string; - /** - * Translate the given phrase using locale configuration - * @param {TranslateOptions} options - Options for translation - * @returns {string} The translated phrase - */ - function __(options: TranslateOptions, ...replace: string[]): string; - /** - * Translate the given phrase using locale configuration - * @param {TranslateOptions} options - Options for translation - * @param {Object} replacements - An object containing replacements - * @returns {string} The translated phrase - */ - function __(options: TranslateOptions, replacements: Replacements): string; + function __(phraseOrOptions: string | TranslateOptions, replacements: Replacements): string; //#endregion @@ -133,33 +194,58 @@ declare namespace i18n { /** * Translate with plural condition the given phrase and count using locale configuration * @param {PluralOptions} options - Options for plural translate + * @param {number} [count] - The number which allow to select from plural to singular * @returns {string} The translated phrase */ - function __n(options: PluralOptions): string; + function __n(options: PluralOptions, count?: number): string; + /** + * Translate with plural condition the given phrase and count using locale configuration + * @param {string} singular - The singular phrase to translate if count is <= 1 + * @param {string} plural - The plural phrase to translate if count is > 1 + * @param {number | string} count - The number which allow to select from plural to singular + * @returns {string} The translated phrase + */ + function __n(singular: string, plural: string, count: number | string): string; + + //#endregion + + //#region __mf() /** - * Translate with plural condition the given phrase and count using locale configuration - * @param {PluralOptions} options - Options for plural translate - * @param {number} count - The number which allow to select from plural to singular + * Translate the given phrase using locale configuration and MessageFormat + * @param {string | TranslateOptions} phraseOrOptions - The phrase to translate or options for translation * @returns {string} The translated phrase */ - function __n(options: PluralOptions, count: number): string; + function __mf(phraseOrOptions: string | TranslateOptions, ...replace: any[]): string; /** - * Translate with plural condition the given phrase and count using locale configuration - * @param {string} singular - The singular pharse to translate if count is <= 1 - * @param {string} plural - The plural pharse to translate if count is > 1 - * @param {number} count - The number which allow to select from plural to singular + * Translate the given phrase using locale configuration and MessageFormat + * @param {string | TranslateOptions} phraseOrOptions - The phrase to translate or options for translation + * @param {Replacements} replacements - An object containing replacements * @returns {string} The translated phrase */ - function __n(singular: string, plural: string, count: number): string; + function __mf(phraseOrOptions: string | TranslateOptions, replacements: Replacements): string; + + //#endregion + + //#region __l() + /** - * Translate with plural condition the given phrase and count using locale configuration - * @param {string} singular - The singular pharse to translate if count is <= 1 - * @param {string} plural - The plural pharse to translate if count is > 1 - * @param {number} count - The number which allow to select from plural to singular - * @returns {string} The translated phrase + * Returns a list of translations for a given phrase in each language. + * @param {string} phrase - The phrase to get translations in each language + * @returns {string[]} The phrase in each language */ - function __n(singular: string, plural: string, count: string): string; + function __l(phrase: string): string[]; + + //#endregion + + //#region __h() + + /** + * Returns a hashed list of translations for a given phrase in each language. + * @param {string} phrase - The phrase to get translations in each language + * @returns {HashedList[]} The phrase in each language + */ + function __h(phrase: string): HashedList[]; //#endregion @@ -171,23 +257,34 @@ declare namespace i18n { */ function setLocale(locale: string): void; /** - * Change the current active locale for specified request - * @param {Express.Request} request - The request to change locale on + * Change the current active locale for specified response + * @param {Express.Request | Express.Response} response - The request or response to change locale on * @param {string} locale - The locale to set as default + * @param {boolean} [inheritance=false] - Disables inheritance if true */ - function setLocale(request: Express.Request, locale: string): void; + // tslint:disable-next-line:unified-signatures + function setLocale(requestOrResponse: Express.Request | Express.Response, locale: string, inheritance?: boolean): void; + /** + * Change the current active locale for specified response + * @param {any | any[]} objects - The object(s) to change locale on + * @param {string} locale - The locale to set as default + * @param {boolean} [inheritance=false] - Disables inheritance if true + */ + // tslint:disable-next-line:unified-signatures + function setLocale(objects: any | any[], locale: string, inheritance?: boolean): void; - /** - * Get the current active locale - * @returns {string} The current locale in request - */ - function getLocale(): string; /** * Get the current active locale for specified request - * @param {Express.Request} request - The request to get locale for + * @param {Express.Request} [request] - The request to get locale for * @returns {string} The current locale in request */ - function getLocale(request: Express.Request): string; + function getLocale(request?: Express.Request): string; + + /** + * Get a list with all configured locales + * @returns {string[]} + */ + function getLocales(): string[]; //#endregion @@ -207,16 +304,10 @@ declare namespace i18n { /** * Get the current active locale catalog for specified request * @param {Express.Request} request - The request to get locale catalog for + * @param {string} [locale] - The locale to get catalog for * @returns {LocaleCatalog} The current locale catalog for the specified request */ - function getCatalog(request: Express.Request): LocaleCatalog; - /** - * Get the current locale catalog for specified request and specified locale - * @param {Express.Request} request - The request to get locale catalog for - * @param {string} locale - The locale to get catalog for - * @returns {LocaleCatalog} The specified locale catalog - */ - function getCatalog(request: Express.Request, locale: string): LocaleCatalog; + function getCatalog(request: Express.Request, locale?: string): LocaleCatalog; //#endregion @@ -230,7 +321,7 @@ declare namespace i18n { * Get current i18n-node version * @member {string} */ - var version: string; + const version: string; } interface i18nAPI { @@ -240,36 +331,17 @@ interface i18nAPI { /** * Translate the given phrase using locale configuration - * @param {string} phrase - The phrase to translate + * @param {string | TranslateOptions} phraseOrOptions - The phrase to translate or options for translation * @returns {string} The translated phrase */ - __(phrase: string, ...replace: string[]): string; + __(phraseOrOptions: string | i18n.TranslateOptions, ...replace: string[]): string; /** * Translate the given phrase using locale configuration - * @param {string} phrase - The phrase to translate - * @param {Object} replacements - An object containing replacements + * @param {string | TranslateOptions} phraseOrOptions - The phrase to translate or options for translation + * @param {i18n.Replacements} replacements - An object containing replacements * @returns {string} The translated phrase */ - __(phrase: string, replacements: i18n.Replacements): string; - /** - * Translate the given phrase using locale configuration - * @param {TranslateOptions} options - Options for translation - * @returns {string} The translated phrase - */ - __(options: i18n.TranslateOptions): string; - /** - * Translate the given phrase using locale configuration - * @param {TranslateOptions} options - Options for translation - * @returns {string} The translated phrase - */ - __(options: i18n.TranslateOptions, ...replace: string[]): string; - /** - * Translate the given phrase using locale configuration - * @param {TranslateOptions} options - Options for translation - * @param {Object} replacements - An object containing replacements - * @returns {string} The translated phrase - */ - __(options: i18n.TranslateOptions, replacements: i18n.Replacements): string; + __(phraseOrOptions: string | i18n.TranslateOptions, replacements: i18n.Replacements): string; //#endregion @@ -278,33 +350,58 @@ interface i18nAPI { /** * Translate with plural condition the given phrase and count using locale configuration * @param {PluralOptions} options - Options for plural translate + * @param {number} [count] - The number which allow to select from plural to singular * @returns {string} The translated phrase */ - __n(options: i18n.PluralOptions): string; + __n(options: i18n.PluralOptions, count?: number): string; + /** + * Translate with plural condition the given phrase and count using locale configuration + * @param {string} singular - The singular phrase to translate if count is <= 1 + * @param {string} plural - The plural phrase to translate if count is > 1 + * @param {number | string} count - The number which allow to select from plural to singular + * @returns {string} The translated phrase + */ + __n(singular: string, plural: string, count: number | string): string; + + //#endregion + + //#region __mf() /** - * Translate with plural condition the given phrase and count using locale configuration - * @param {PluralOptions} options - Options for plural translate - * @param {number} count - The number which allow to select from plural to singular + * Translate the given phrase using locale configuration and MessageFormat + * @param {string | TranslateOptions} phraseOrOptions - The phrase to translate or options for translation * @returns {string} The translated phrase */ - __n(options: i18n.PluralOptions, count: number): string; + __mf(phraseOrOptions: string | i18n.TranslateOptions, ...replace: any[]): string; /** - * Translate with plural condition the given phrase and count using locale configuration - * @param {string} singular - The singular pharse to translate if count is <= 1 - * @param {string} plural - The plural pharse to translate if count is > 1 - * @param {number} count - The number which allow to select from plural to singular + * Translate the given phrase using locale configuration and MessageFormat + * @param {string | TranslateOptions} phraseOrOptions - The phrase to translate or options for translation + * @param {i18n.Replacements} replacements - An object containing replacements * @returns {string} The translated phrase */ - __n(singular: string, plural: string, count: number): string; + __mf(phraseOrOptions: string | i18n.TranslateOptions, replacements: i18n.Replacements): string; + + //#endregion + + //#region __l() + /** - * Translate with plural condition the given phrase and count using locale configuration - * @param {string} singular - The singular pharse to translate if count is <= 1 - * @param {string} plural - The plural pharse to translate if count is > 1 - * @param {number} count - The number which allow to select from plural to singular - * @returns {string} The translated phrase + * Returns a list of translations for a given phrase in each language. + * @param {string} phrase - The phrase to get translations in each language + * @returns {string[]} The phrase in each language */ - __n(singular: string, plural: string, count: string): string; + __l(phrase: string): string[]; + + //#endregion + + //#region __h() + + /** + * Returns a hashed list of translations for a given phrase in each language. + * @param {string} phrase - The phrase to get translations in each language + * @returns {HashedList[]} The phrase in each language + */ + __h(phrase: string): i18n.HashedList[]; //#endregion @@ -313,6 +410,7 @@ interface i18nAPI { * @returns {string} The current locale in request */ getLocale(): string; + /** * Change the current active locale * @param {string} locale - The locale to set as default @@ -329,7 +427,7 @@ interface i18nAPI { * @param {string} locale - The locale to get catalog for * @returns {LocaleCatalog} The specified locale catalog */ - getCatalog(locale: string): i18n.LocaleCatalog; + getCatalog(locale?: string): i18n.LocaleCatalog; } declare module "i18n" { @@ -337,13 +435,14 @@ declare module "i18n" { } declare namespace Express { - export interface Request extends i18nAPI { + interface Request extends i18nAPI { languages: string[]; regions: string[]; language: string; region: string; } - export interface Response extends i18nAPI { - locals: i18nAPI + + interface Response extends i18nAPI { + locals: i18nAPI; } } diff --git a/types/i18n/tslint.json b/types/i18n/tslint.json new file mode 100644 index 0000000000..bd50eb1958 --- /dev/null +++ b/types/i18n/tslint.json @@ -0,0 +1,7 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "prefer-method-signature": false, + "no-single-declare-module": false + } +} From 8772d17b0f3e3bf010c0a3e17cd89aec1ba18fa5 Mon Sep 17 00:00:00 2001 From: Andy Date: Thu, 1 Jun 2017 08:46:03 -0700 Subject: [PATCH 0218/1105] flatbuffers: Make importable as a module (#16394) --- types/flatbuffers/flatbuffers-tests.ts | 6 +- types/flatbuffers/index.d.ts | 1178 ++++++++++++------------ types/flatbuffers/tslint.json | 7 +- 3 files changed, 596 insertions(+), 595 deletions(-) diff --git a/types/flatbuffers/flatbuffers-tests.ts b/types/flatbuffers/flatbuffers-tests.ts index 87593106c7..cdcabac25b 100644 --- a/types/flatbuffers/flatbuffers-tests.ts +++ b/types/flatbuffers/flatbuffers-tests.ts @@ -1,3 +1,5 @@ +import { flatbuffers } from "flatbuffers"; + enum Color { Red= 1, Green= 2, @@ -303,9 +305,9 @@ class Stat { } class Monster { - bb: flatbuffers.ByteBuffer= null; + bb: flatbuffers.ByteBuffer= null; - bb_pos: number = 0; + bb_pos: number = 0; __init(i: number, bb: flatbuffers.ByteBuffer): Monster { this.bb_pos = i; diff --git a/types/flatbuffers/index.d.ts b/types/flatbuffers/index.d.ts index 1342acdf15..4f75a7cc30 100644 --- a/types/flatbuffers/index.d.ts +++ b/types/flatbuffers/index.d.ts @@ -3,625 +3,629 @@ // Definitions by: Kamil Rojewski // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare namespace flatbuffers { - /** - * @typedef {number} - */ - type Offset = number; +export { flatbuffers }; - /** - * @typedef {{ - * bb: flatbuffers.ByteBuffer, - * bb_pos: number - * }} - */ - interface Table { - bb: ByteBuffer; - bb_pos: number; - } - - /** - * @type {number} - * @const - */ - const SIZEOF_SHORT: number; - - /** - * @type {number} - * @const - */ - const SIZEOF_INT: number; - - /** - * @type {number} - * @const - */ - const FILE_IDENTIFIER_LENGTH: number; - - /** - * @enum {number} - */ - enum Encoding { UTF8_BYTES, UTF16_STRING } - - /** - * @type {Int32Array} - * @const - */ - const int32: Int32Array; - - /** - * @type {Float32Array} - * @const - */ - const float32: Float32Array; - - /** - * @type {Float64Array} - * @const - */ - const float64: Float64Array; - - /** - * @type {boolean} - * @const - */ - const isLittleEndian: boolean; - - //////////////////////////////////////////////////////////////////////////////// - - class Long { +declare global { + namespace flatbuffers { /** - * @type {number} - * @const + * @typedef {number} */ - low: number; + type Offset = number; + + /** + * @typedef {{ + * bb: flatbuffers.ByteBuffer, + * bb_pos: number + * }} + */ + interface Table { + bb: ByteBuffer; + bb_pos: number; + } /** * @type {number} * @const */ - high: number; + const SIZEOF_SHORT: number; /** - * @type {flatbuffers.Long} + * @type {number} * @const */ - static ZERO: Long; + const SIZEOF_INT: number; /** - * @constructor - * @param {number} high - * @param {number} low + * @type {number} + * @const */ - constructor(low: number, high: number); + const FILE_IDENTIFIER_LENGTH: number; /** - * @returns {number} + * @enum {number} */ - toFloat64(): number; + enum Encoding { UTF8_BYTES, UTF16_STRING } /** - * @param {flatbuffers.Long} other - * @returns {boolean} + * @type {Int32Array} + * @const */ - equals(other: any): boolean; + const int32: Int32Array; /** - * @param {number} low - * @param {number} high + * @type {Float32Array} + * @const */ - static create(low: number, high: number): Long; - } - - //////////////////////////////////////////////////////////////////////////////// - - class Builder { - /** - * @constructor - * @param {number=} initial_size - */ - constructor(initial_size?: number); - - /** - * In order to save space, fields that are set to their default value - * don't get serialized into the buffer. Forcing defaults provides a - * way to manually disable this optimization. - * - * @param {boolean} forceDefaults true always serializes default values - */ - forceDefaults(forceDefaults: boolean): void; - - /** - * Get the ByteBuffer representing the FlatBuffer. Only call this after you've - * called finish(). The actual data starts at the ByteBuffer's current position, - * not necessarily at 0. - * - * @returns {flatbuffers.ByteBuffer} - */ - dataBuffer(): ByteBuffer; - - /** - * Get the ByteBuffer representing the FlatBuffer. Only call this after you've - * called finish(). The actual data starts at the ByteBuffer's current position, - * not necessarily at 0. - * - * @returns {Uint8Array} - */ - asUint8Array(): Uint8Array; - - /** - * Prepare to write an element of `size` after `additional_bytes` have been - * written, e.g. if you write a string, you need to align such the int length - * field is aligned to 4 bytes, and the string data follows it directly. If all - * you need to do is alignment, `additional_bytes` will be 0. - * - * @param {number} size This is the of the new element to write - * @param {number} additional_bytes The padding size - */ - prep(size: number, additional_bytes: number): void; - - /** - * @param {number} byte_size - */ - pad(byte_size: number): void; - - /** - * @param {number} value - */ - writeInt8(value: number): void; - - /** - * @param {number} value - */ - writeInt16(value: number): void; - - /** - * @param {number} value - */ - writeInt32(value: number): void; - - /** - * @param {flatbuffers.Long} value - */ - writeInt64(value: Long): void; - - /** - * @param {number} value - */ - writeFloat32(value: number): void; - - /** - * @param {number} value - */ - writeFloat64(value: number): void; - - /** - * @param {number} value - */ - addInt8(value: number): void; - - /** - * @param {number} value - */ - addInt16(value: number): void; - - /** - * @param {number} value - */ - addInt32(value: number): void; - - /** - * @param {flatbuffers.Long} value - */ - addInt64(value: Long): void; - - /** - * @param {number} value - */ - addFloat32(value: number): void; - - /** - * @param {number} value - */ - addFloat64(value: number): void; - - /** - * @param {number} voffset - * @param {number} value - * @param {number} defaultValue - */ - addFieldInt8(voffset: number, value: number, defaultValue: number): void; - - /** - * @param {number} voffset - * @param {number} value - * @param {number} defaultValue - */ - addFieldInt16(voffset: number, value: number, defaultValue: number): void; - - /** - * @param {number} voffset - * @param {number} value - * @param {number} defaultValue - */ - addFieldInt32(voffset: number, value: number, defaultValue: number): void; - - /** - * @param {number} voffset - * @param {flatbuffers.Long} value - * @param {flatbuffers.Long} defaultValue - */ - addFieldInt64(voffset: number, value: Long, defaultValue: Long): void; - - /** - * @param {number} voffset - * @param {number} value - * @param {number} defaultValue - */ - addFieldFloat32(voffset: number, value: number, defaultValue: number): void; - - /** - * @param {number} voffset - * @param {number} value - * @param {number} defaultValue - */ - addFieldFloat64(voffset: number, value: number, defaultValue: number): void; - - /** - * @param {number} voffset - * @param {flatbuffers.Offset} value - * @param {flatbuffers.Offset} defaultValue - */ - addFieldOffset(voffset: number, value: Offset, defaultValue: Offset): void; - - /** - * Structs are stored inline, so nothing additional is being added. `d` is always 0. - * - * @param {number} voffset - * @param {flatbuffers.Offset} value - * @param {flatbuffers.Offset} defaultValue - */ - addFieldStruct(voffset: number, value: Offset, defaultValue: Offset): void; - - /** - * Structures are always stored inline, they need to be created right - * where they're used. You'll get this assertion failure if you - * created it elsewhere. - * - * @param {flatbuffers.Offset} obj The offset of the created object - */ - nested(obj: Offset): void; - - /** - * Should not be creating any other object, string or vector - * while an object is being constructed - */ - notNested(): void; - - /** - * Set the current vtable at `voffset` to the current location in the buffer. - * - * @param {number} voffset - */ - slot(voffset: number): void; + const float32: Float32Array; /** - * @returns {flatbuffers.Offset} Offset relative to the end of the buffer. + * @type {Float64Array} + * @const */ - offset(): Offset; + const float64: Float64Array; /** - * Doubles the size of the backing ByteBuffer and copies the old data towards - * the end of the new buffer (since we build the buffer backwards). - * - * @param {flatbuffers.ByteBuffer} bb The current buffer with the existing data - * @returns {flatbuffers.ByteBuffer} A new byte buffer with the old data copied - * to it. The data is located at the end of the buffer. + * @type {boolean} + * @const */ - static growByteBuffer(bb: ByteBuffer): ByteBuffer; + const isLittleEndian: boolean; - /** - * Adds on offset, relative to where it will be written. - * - * @param {flatbuffers.Offset} offset The offset to add - */ - addOffset(offset: Offset): void; + //////////////////////////////////////////////////////////////////////////////// - /** - * Start encoding a new object in the buffer. Users will not usually need to - * call this directly. The FlatBuffers compiler will generate helper methods - * that call this method internally. - * - * @param {number} numfields - */ - startObject(numfields: number): void; - - /** - * Finish off writing the object that is under construction. - * - * @returns {flatbuffers.Offset} The offset to the object inside `dataBuffer` - */ - endObject(): Offset; + class Long { + /** + * @type {number} + * @const + */ + low: number; - /** - * @param {flatbuffers.Offset} root_table - * @param {string=} file_identifier - */ - finish(root_table: Offset, file_identifier?: string): void; - - /** - * This checks a required field has been set in a given table that has - * just been constructed. - * - * @param {flatbuffers.Offset} table - * @param {number} field - */ - requiredField(table: Offset, field: number): void; - - /** - * Start a new array/vector of objects. Users usually will not call - * this directly. The FlatBuffers compiler will create a start/end - * method for vector types in generated code. - * - * @param {number} elem_size The size of each element in the array - * @param {number} num_elems The number of elements in the array - * @param {number} alignment The alignment of the array - */ - startVector(elem_size: number, num_elems: number, alignment: number): void; - - /** - * Finish off the creation of an array and all its elements. The array must be - * created with `startVector`. - * - * @returns {flatbuffers.Offset} The offset at which the newly created array - * starts. - */ - endVector(): Offset; - - /** - * Encode the string `s` in the buffer using UTF-8. If a Uint8Array is passed - * instead of a string, it is assumed to contain valid UTF-8 encoded data. - * - * @param {string|Uint8Array} s The string to encode - * @return {flatbuffers.Offset} The offset in the buffer where the encoded string starts - */ - createString(s: string|Uint8Array): Offset; - - /** - * Conveniance function for creating Long objects. - * - * @param {number} low - * @param {number} high - * @returns {Long} - */ - createLong(low: number, high: number): Long; - } - - //////////////////////////////////////////////////////////////////////////////// - - class ByteBuffer { - /** - * @constructor - * @param {Uint8Array} bytes - */ - constructor(bytes: Uint8Array); - - /** - * @param {number} byte_size - * @returns {flatbuffers.ByteBuffer} - */ - static allocate(byte_size: number): ByteBuffer; - - /** - * @returns {Uint8Array} - */ - bytes(): Uint8Array; - - /** - * @returns {number} - */ - position(): number; - - /** - * @param {number} position - */ - setPosition(position: number): void; - - /** - * @returns {number} - */ - capacity(): number; - - /** - * @param {number} offset - * @returns {number} - */ - readInt8(offset: number): number; - - /** - * @param {number} offset - * @returns {number} - */ - readUint8(offset: number): number; - - /** - * @param {number} offset - * @returns {number} - */ - readInt16(offset: number): number; - - /** - * @param {number} offset - * @returns {number} - */ - readUint16(offset: number): number; - - /** - * @param {number} offset - * @returns {number} - */ - readInt32(offset: number): number; - - /** - * @param {number} offset - * @returns {number} - */ - readUint32(offset: number): number; - - /** - * @param {number} offset - * @returns {flatbuffers.Long} - */ - readInt64(offset: number): Long; - - /** - * @param {number} offset - * @returns {flatbuffers.Long} - */ - readUint64(offset: number): Long; - - /** - * @param {number} offset - * @returns {number} - */ - readFloat32(offset: number): number; - - /** - * @param {number} offset - * @returns {number} - */ - readFloat64(offset: number): number; - - /** - * @param {number} offset - * @param {number} value - */ - writeInt8(offset: number, value: number): void; - - /** - * @param {number} offset - * @param {number} value - */ - writeUint8(offset: number, value: number): void; - - /** - * @param {number} offset - * @param {number} value - */ - writeInt16(offset: number, value: number): void; - - /** - * @param {number} offset - * @param {number} value - */ - writeUint16(offset: number, value: number): void; - - /** - * @param {number} offset - * @param {number} value - */ - writeInt32(offset: number, value: number): void; - - /** - * @param {number} offset - * @param {number} value - */ - writeUint32(offset: number, value: number): void; - - /** - * @param {number} offset - * @param {flatbuffers.Long} value - */ - writeInt64(offset: number, value: Long): void; - - /** - * @param {number} offset - * @param {flatbuffers.Long} value - */ - writeUint64(offset: number, value: Long): void; - - /** - * @param {number} offset - * @param {number} value - */ - writeFloat32(offset: number, value: number): void; - - /** - * @param {number} offset - * @param {number} value - */ - writeFloat64(offset: number, value: number): void; - - /** - * Look up a field in the vtable, return an offset into the object, or 0 if the - * field is not present. - * - * @param {number} bb_pos - * @param {number} vtable_offset - * @returns {number} - */ - __offset(bb_pos: number, vtable_offset: number): number; - - /** - * Initialize any Table-derived type to point to the union at the given offset. - * - * @param {flatbuffers.Table} t - * @param {number} offset - * @returns {flatbuffers.Table} - */ - __union(t: T, offset: number): T; - - /** - * Create a JavaScript string from UTF-8 data stored inside the FlatBuffer. - * This allocates a new string and converts to wide chars upon each access. - * - * To avoid the conversion to UTF-16, pass flatbuffers.Encoding.UTF8_BYTES as - * the "optionalEncoding" argument. This is useful for avoiding conversion to - * and from UTF-16 when the data will just be packaged back up in another - * FlatBuffer later on. - * - * @param {number} offset - * @param {flatbuffers.Encoding=} optionalEncoding Defaults to UTF16_STRING - * @returns {string|Uint8Array} - */ - __string(offset: number, optionalEncoding?: Encoding): string|Uint8Array; - - /** - * Retrieve the relative offset stored at "offset" - * @param {number} offset - * @returns {number} - */ - __indirect(offset: number): number; - - /** - * Get the start of data of a vector whose offset is stored at "offset" in this object. - * - * @param {number} offset - * @returns {number} - */ - __vector(offset: number): number; - - /** - * Get the length of a vector whose offset is stored at "offset" in this object. - * - * @param {number} offset - * @returns {number} - */ - __vector_len(offset: number): number; - - /** - * @param {string} ident - * @returns {boolean} - */ - __has_identifier(ident: string): boolean; - - /** - * Conveniance function for creating Long objects. - * - * @param {number} low - * @param {number} high - * @returns {Long} - */ - createLong(low: number, high: number): Long; + /** + * @type {number} + * @const + */ + high: number; + + /** + * @type {flatbuffers.Long} + * @const + */ + static ZERO: Long; + + /** + * @constructor + * @param {number} high + * @param {number} low + */ + constructor(low: number, high: number); + + /** + * @returns {number} + */ + toFloat64(): number; + + /** + * @param {flatbuffers.Long} other + * @returns {boolean} + */ + equals(other: any): boolean; + + /** + * @param {number} low + * @param {number} high + */ + static create(low: number, high: number): Long; + } + + //////////////////////////////////////////////////////////////////////////////// + + class Builder { + /** + * @constructor + * @param {number=} initial_size + */ + constructor(initial_size?: number); + + /** + * In order to save space, fields that are set to their default value + * don't get serialized into the buffer. Forcing defaults provides a + * way to manually disable this optimization. + * + * @param {boolean} forceDefaults true always serializes default values + */ + forceDefaults(forceDefaults: boolean): void; + + /** + * Get the ByteBuffer representing the FlatBuffer. Only call this after you've + * called finish(). The actual data starts at the ByteBuffer's current position, + * not necessarily at 0. + * + * @returns {flatbuffers.ByteBuffer} + */ + dataBuffer(): ByteBuffer; + + /** + * Get the ByteBuffer representing the FlatBuffer. Only call this after you've + * called finish(). The actual data starts at the ByteBuffer's current position, + * not necessarily at 0. + * + * @returns {Uint8Array} + */ + asUint8Array(): Uint8Array; + + /** + * Prepare to write an element of `size` after `additional_bytes` have been + * written, e.g. if you write a string, you need to align such the int length + * field is aligned to 4 bytes, and the string data follows it directly. If all + * you need to do is alignment, `additional_bytes` will be 0. + * + * @param {number} size This is the of the new element to write + * @param {number} additional_bytes The padding size + */ + prep(size: number, additional_bytes: number): void; + + /** + * @param {number} byte_size + */ + pad(byte_size: number): void; + + /** + * @param {number} value + */ + writeInt8(value: number): void; + + /** + * @param {number} value + */ + writeInt16(value: number): void; + + /** + * @param {number} value + */ + writeInt32(value: number): void; + + /** + * @param {flatbuffers.Long} value + */ + writeInt64(value: Long): void; + + /** + * @param {number} value + */ + writeFloat32(value: number): void; + + /** + * @param {number} value + */ + writeFloat64(value: number): void; + + /** + * @param {number} value + */ + addInt8(value: number): void; + + /** + * @param {number} value + */ + addInt16(value: number): void; + + /** + * @param {number} value + */ + addInt32(value: number): void; + + /** + * @param {flatbuffers.Long} value + */ + addInt64(value: Long): void; + + /** + * @param {number} value + */ + addFloat32(value: number): void; + + /** + * @param {number} value + */ + addFloat64(value: number): void; + + /** + * @param {number} voffset + * @param {number} value + * @param {number} defaultValue + */ + addFieldInt8(voffset: number, value: number, defaultValue: number): void; + + /** + * @param {number} voffset + * @param {number} value + * @param {number} defaultValue + */ + addFieldInt16(voffset: number, value: number, defaultValue: number): void; + + /** + * @param {number} voffset + * @param {number} value + * @param {number} defaultValue + */ + addFieldInt32(voffset: number, value: number, defaultValue: number): void; + + /** + * @param {number} voffset + * @param {flatbuffers.Long} value + * @param {flatbuffers.Long} defaultValue + */ + addFieldInt64(voffset: number, value: Long, defaultValue: Long): void; + + /** + * @param {number} voffset + * @param {number} value + * @param {number} defaultValue + */ + addFieldFloat32(voffset: number, value: number, defaultValue: number): void; + + /** + * @param {number} voffset + * @param {number} value + * @param {number} defaultValue + */ + addFieldFloat64(voffset: number, value: number, defaultValue: number): void; + + /** + * @param {number} voffset + * @param {flatbuffers.Offset} value + * @param {flatbuffers.Offset} defaultValue + */ + addFieldOffset(voffset: number, value: Offset, defaultValue: Offset): void; + + /** + * Structs are stored inline, so nothing additional is being added. `d` is always 0. + * + * @param {number} voffset + * @param {flatbuffers.Offset} value + * @param {flatbuffers.Offset} defaultValue + */ + addFieldStruct(voffset: number, value: Offset, defaultValue: Offset): void; + + /** + * Structures are always stored inline, they need to be created right + * where they're used. You'll get this assertion failure if you + * created it elsewhere. + * + * @param {flatbuffers.Offset} obj The offset of the created object + */ + nested(obj: Offset): void; + + /** + * Should not be creating any other object, string or vector + * while an object is being constructed + */ + notNested(): void; + + /** + * Set the current vtable at `voffset` to the current location in the buffer. + * + * @param {number} voffset + */ + slot(voffset: number): void; + + /** + * @returns {flatbuffers.Offset} Offset relative to the end of the buffer. + */ + offset(): Offset; + + /** + * Doubles the size of the backing ByteBuffer and copies the old data towards + * the end of the new buffer (since we build the buffer backwards). + * + * @param {flatbuffers.ByteBuffer} bb The current buffer with the existing data + * @returns {flatbuffers.ByteBuffer} A new byte buffer with the old data copied + * to it. The data is located at the end of the buffer. + */ + static growByteBuffer(bb: ByteBuffer): ByteBuffer; + + /** + * Adds on offset, relative to where it will be written. + * + * @param {flatbuffers.Offset} offset The offset to add + */ + addOffset(offset: Offset): void; + + /** + * Start encoding a new object in the buffer. Users will not usually need to + * call this directly. The FlatBuffers compiler will generate helper methods + * that call this method internally. + * + * @param {number} numfields + */ + startObject(numfields: number): void; + + /** + * Finish off writing the object that is under construction. + * + * @returns {flatbuffers.Offset} The offset to the object inside `dataBuffer` + */ + endObject(): Offset; + + /** + * @param {flatbuffers.Offset} root_table + * @param {string=} file_identifier + */ + finish(root_table: Offset, file_identifier?: string): void; + + /** + * This checks a required field has been set in a given table that has + * just been constructed. + * + * @param {flatbuffers.Offset} table + * @param {number} field + */ + requiredField(table: Offset, field: number): void; + + /** + * Start a new array/vector of objects. Users usually will not call + * this directly. The FlatBuffers compiler will create a start/end + * method for vector types in generated code. + * + * @param {number} elem_size The size of each element in the array + * @param {number} num_elems The number of elements in the array + * @param {number} alignment The alignment of the array + */ + startVector(elem_size: number, num_elems: number, alignment: number): void; + + /** + * Finish off the creation of an array and all its elements. The array must be + * created with `startVector`. + * + * @returns {flatbuffers.Offset} The offset at which the newly created array + * starts. + */ + endVector(): Offset; + + /** + * Encode the string `s` in the buffer using UTF-8. If a Uint8Array is passed + * instead of a string, it is assumed to contain valid UTF-8 encoded data. + * + * @param {string|Uint8Array} s The string to encode + * @return {flatbuffers.Offset} The offset in the buffer where the encoded string starts + */ + createString(s: string|Uint8Array): Offset; + + /** + * Conveniance function for creating Long objects. + * + * @param {number} low + * @param {number} high + * @returns {Long} + */ + createLong(low: number, high: number): Long; + } + + //////////////////////////////////////////////////////////////////////////////// + + class ByteBuffer { + /** + * @constructor + * @param {Uint8Array} bytes + */ + constructor(bytes: Uint8Array); + + /** + * @param {number} byte_size + * @returns {flatbuffers.ByteBuffer} + */ + static allocate(byte_size: number): ByteBuffer; + + /** + * @returns {Uint8Array} + */ + bytes(): Uint8Array; + + /** + * @returns {number} + */ + position(): number; + + /** + * @param {number} position + */ + setPosition(position: number): void; + + /** + * @returns {number} + */ + capacity(): number; + + /** + * @param {number} offset + * @returns {number} + */ + readInt8(offset: number): number; + + /** + * @param {number} offset + * @returns {number} + */ + readUint8(offset: number): number; + + /** + * @param {number} offset + * @returns {number} + */ + readInt16(offset: number): number; + + /** + * @param {number} offset + * @returns {number} + */ + readUint16(offset: number): number; + + /** + * @param {number} offset + * @returns {number} + */ + readInt32(offset: number): number; + + /** + * @param {number} offset + * @returns {number} + */ + readUint32(offset: number): number; + + /** + * @param {number} offset + * @returns {flatbuffers.Long} + */ + readInt64(offset: number): Long; + + /** + * @param {number} offset + * @returns {flatbuffers.Long} + */ + readUint64(offset: number): Long; + + /** + * @param {number} offset + * @returns {number} + */ + readFloat32(offset: number): number; + + /** + * @param {number} offset + * @returns {number} + */ + readFloat64(offset: number): number; + + /** + * @param {number} offset + * @param {number} value + */ + writeInt8(offset: number, value: number): void; + + /** + * @param {number} offset + * @param {number} value + */ + writeUint8(offset: number, value: number): void; + + /** + * @param {number} offset + * @param {number} value + */ + writeInt16(offset: number, value: number): void; + + /** + * @param {number} offset + * @param {number} value + */ + writeUint16(offset: number, value: number): void; + + /** + * @param {number} offset + * @param {number} value + */ + writeInt32(offset: number, value: number): void; + + /** + * @param {number} offset + * @param {number} value + */ + writeUint32(offset: number, value: number): void; + + /** + * @param {number} offset + * @param {flatbuffers.Long} value + */ + writeInt64(offset: number, value: Long): void; + + /** + * @param {number} offset + * @param {flatbuffers.Long} value + */ + writeUint64(offset: number, value: Long): void; + + /** + * @param {number} offset + * @param {number} value + */ + writeFloat32(offset: number, value: number): void; + + /** + * @param {number} offset + * @param {number} value + */ + writeFloat64(offset: number, value: number): void; + + /** + * Look up a field in the vtable, return an offset into the object, or 0 if the + * field is not present. + * + * @param {number} bb_pos + * @param {number} vtable_offset + * @returns {number} + */ + __offset(bb_pos: number, vtable_offset: number): number; + + /** + * Initialize any Table-derived type to point to the union at the given offset. + * + * @param {flatbuffers.Table} t + * @param {number} offset + * @returns {flatbuffers.Table} + */ + __union(t: T, offset: number): T; + + /** + * Create a JavaScript string from UTF-8 data stored inside the FlatBuffer. + * This allocates a new string and converts to wide chars upon each access. + * + * To avoid the conversion to UTF-16, pass flatbuffers.Encoding.UTF8_BYTES as + * the "optionalEncoding" argument. This is useful for avoiding conversion to + * and from UTF-16 when the data will just be packaged back up in another + * FlatBuffer later on. + * + * @param {number} offset + * @param {flatbuffers.Encoding=} optionalEncoding Defaults to UTF16_STRING + * @returns {string|Uint8Array} + */ + __string(offset: number, optionalEncoding?: Encoding): string|Uint8Array; + + /** + * Retrieve the relative offset stored at "offset" + * @param {number} offset + * @returns {number} + */ + __indirect(offset: number): number; + + /** + * Get the start of data of a vector whose offset is stored at "offset" in this object. + * + * @param {number} offset + * @returns {number} + */ + __vector(offset: number): number; + + /** + * Get the length of a vector whose offset is stored at "offset" in this object. + * + * @param {number} offset + * @returns {number} + */ + __vector_len(offset: number): number; + + /** + * @param {string} ident + * @returns {boolean} + */ + __has_identifier(ident: string): boolean; + + /** + * Conveniance function for creating Long objects. + * + * @param {number} low + * @param {number} high + * @returns {Long} + */ + createLong(low: number, high: number): Long; + } } } diff --git a/types/flatbuffers/tslint.json b/types/flatbuffers/tslint.json index e013b93508..3db14f85ea 100644 --- a/types/flatbuffers/tslint.json +++ b/types/flatbuffers/tslint.json @@ -1,6 +1 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "align": false - } -} +{ "extends": "dtslint/dt.json" } From f345a6fca5b2be956c55528bbfb8a4e63a2b8069 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=B6nthal?= Date: Thu, 1 Jun 2017 17:46:41 +0200 Subject: [PATCH 0219/1105] Update index.d.ts (#16396) --- types/alexa-sdk/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/alexa-sdk/index.d.ts b/types/alexa-sdk/index.d.ts index 9f99b14995..3c74c3d026 100644 --- a/types/alexa-sdk/index.d.ts +++ b/types/alexa-sdk/index.d.ts @@ -7,7 +7,7 @@ export function handler(event: RequestBody, context: Context, callback?: Functio export function CreateStateHandler(state: string, obj: any): any; export var StateString: string; -interface AlexaObject { +interface AlexaObject extends Handler { _event: any; _context: any; _callback: any; From c5ba0a96642b24fc41e29e8baa50f3f9135b77dc Mon Sep 17 00:00:00 2001 From: Jerry Zou Date: Thu, 1 Jun 2017 23:47:36 +0800 Subject: [PATCH 0220/1105] Update version of react-textarea-autosize -> 4.3.0 (#16402) * Update version of react-textarea-autosize -> 4.3.0 * Fix a composing problem --- types/react-textarea-autosize/index.d.ts | 8 ++++++-- .../react-textarea-autosize-tests.tsx | 12 +++++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/types/react-textarea-autosize/index.d.ts b/types/react-textarea-autosize/index.d.ts index 2d07898200..ee3e5aaf44 100644 --- a/types/react-textarea-autosize/index.d.ts +++ b/types/react-textarea-autosize/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for react-textarea-autosize 4.0.3 +// Type definitions for react-textarea-autosize 4.3.0 // Project: https://github.com/andreypopp/react-textarea-autosize -// Definitions by: Alexey Svetliakov +// Definitions by: Alexey Svetliakov , Jerry Zou // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 @@ -46,6 +46,10 @@ declare module "react-textarea-autosize" { * Maximum number of rows to show. */ maxRows?: number; + /** + * Allows an owner to retrieve the DOM node. + */ + inputRef?: (node: HTMLTextAreaElement) => void; } /** diff --git a/types/react-textarea-autosize/react-textarea-autosize-tests.tsx b/types/react-textarea-autosize/react-textarea-autosize-tests.tsx index b10f92bc6f..2812f06f71 100644 --- a/types/react-textarea-autosize/react-textarea-autosize-tests.tsx +++ b/types/react-textarea-autosize/react-textarea-autosize-tests.tsx @@ -2,12 +2,22 @@ import * as React from "react"; import Textarea from "react-textarea-autosize"; class Test extends React.Component<{}, {}> { + public ref: HTMLTextAreaElement + + public inputRef = (ref: HTMLTextAreaElement) => { + this.ref = ref + } + public render() { return ( -