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 001/529] 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 002/529] 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 003/529] (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 004/529] =?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 005/529] 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 006/529] 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 007/529] 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 008/529] 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 009/529] 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 010/529] 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 011/529] 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 012/529] 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 013/529] 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 014/529] 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 015/529] 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 016/529] 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 017/529] 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 018/529] 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 019/529] 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 020/529] 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 021/529] 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 022/529] 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 5003a0b902d344440424a5875d6b308686668303 Mon Sep 17 00:00:00 2001 From: Michael Aird Date: Sun, 7 May 2017 08:36:53 -0400 Subject: [PATCH 023/529] Instead of adding overload, fix the return type I had mistakenly added an overload. The correct fix is to add the return type to the existing method. --- types/kendo-ui/index.d.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/types/kendo-ui/index.d.ts b/types/kendo-ui/index.d.ts index 9848335e49..256398125c 100644 --- a/types/kendo-ui/index.d.ts +++ b/types/kendo-ui/index.d.ts @@ -5408,8 +5408,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): kendo.ui.SchedulerView; viewName(): string; } From 958fad8fcfd8a48bd6f4a530e76046aec6127e22 Mon Sep 17 00:00:00 2001 From: nat1130NS Date: Tue, 9 May 2017 09:06:30 -0700 Subject: [PATCH 024/529] 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 025/529] * 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 026/529] 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 027/529] 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 028/529] 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 029/529] _.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 030/529] 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 031/529] 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 032/529] 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 033/529] 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 034/529] 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 035/529] 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 036/529] [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 037/529] 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 038/529] [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 039/529] 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 040/529] 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 041/529] 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 042/529] 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 043/529] 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 044/529] 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 045/529] 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 046/529] 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 047/529] [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 048/529] 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 049/529] 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 050/529] 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 051/529] 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 052/529] 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 053/529] 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 054/529] 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 055/529] 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 056/529] 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 057/529] 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 058/529] 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 059/529] 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 060/529] 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 061/529] 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 062/529] 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 063/529] 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 064/529] 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 065/529] 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 ac0e8900bf2f27cab1fc3eec9c1a9e3e6512f50b Mon Sep 17 00:00:00 2001 From: jacobbogers Date: Thu, 18 May 2017 18:23:17 +0200 Subject: [PATCH 066/529] (de) Serialized Sessions and Cookies dont have methods, only data-propeties, express-session middleware will add methods through "instantiation" before use. Introduced SessionData and SessionCookieData interfaces to reflect proper usage of Store. --- types/express-session/index.d.ts | 46 +++++++++++++++++++------------- 1 file changed, 28 insertions(+), 18 deletions(-) diff --git a/types/express-session/index.d.ts b/types/express-session/index.d.ts index 6d2585d3f9..f97eff8f75 100644 --- a/types/express-session/index.d.ts +++ b/types/express-session/index.d.ts @@ -1,5 +1,6 @@ // Type definitions for express-session // Project: https://www.npmjs.org/package/express-session +// Definitions by: Jacob Bogers // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -14,8 +15,26 @@ declare namespace Express { sessionID?: string; } - export interface Session { + export interface SessionData { [key: string]: any; + cookie: Express.SessionCookieData; + } + + export interface SessionCookieData { + originalMaxAge: number; + path: string; + maxAge: number; + secure?: boolean; + httpOnly: boolean; + domain?: string; + expires: Date | boolean; + } + + export interface SessionCookie extends SessionCookieData { + serialize: (name: string, value: string) => string; + } + + export interface Session extends SessionData { id: string; regenerate: (callback: (err: any) => void) => void; @@ -26,16 +45,7 @@ declare namespace Express { cookie: SessionCookie; } - export interface SessionCookie { - originalMaxAge: number; - path: string; - maxAge: number; - secure?: boolean; - httpOnly: boolean; - domain?: string; - expires: Date | boolean; - serialize: (name: string, value: string) => string; - } + } declare module "express-session" { @@ -58,7 +68,7 @@ declare module "express-session" { unset?: string; } - export interface BaseMemoryStore { + export interface BaseMemoryStore { get: (sid: string, callback: (err: any, session: Express.Session) => void) => void; set: (sid: string, session: Express.Session, callback: (err: any) => void) => void; destroy: (sid: string, callback: (err: any) => void) => void; @@ -67,16 +77,16 @@ declare module "express-session" { } export abstract class Store extends node.EventEmitter { - constructor(config?: any); + constructor(config?: any); + + regenerate(req: express.Request, fn: (err: any) => any): void; + load(sid: string, fn: (err: any, session: Express.Session) => any): void; + createSession(req: express.Request, sess: Express.SessionData): void; - regenerate (req: express.Request, fn: (err: any) => any): void; - load (sid: string, fn: (err: any, session: Express.Session) => any): void; - createSession (req: express.Request, sess: Express.Session): void; - get: (sid: string, callback: (err: any, session: Express.Session) => void) => void; set: (sid: string, session: Express.Session, callback: (err: any) => void) => void; destroy: (sid: string, callback: (err: any) => void) => void; - all: (callback: (err: any, obj: { [sid: string]: Express.Session; }) => void) => void; + all: (callback: (err: any, obj: { [sid: string]: Express.SessionData; }) => void) => void; length: (callback: (err: any, length: number) => void) => void; clear: (callback: (err: any) => void) => void; } 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 067/529] {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 068/529] 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 069/529] 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 070/529] 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 afdadfe885dfe01e6c929cc4a6ef668113ca8f67 Mon Sep 17 00:00:00 2001 From: jacobbogers Date: Fri, 19 May 2017 06:11:06 +0200 Subject: [PATCH 071/529] added recommeded changes from tslint --- .../express-session/express-session-tests.ts | 27 +++---- types/express-session/index.d.ts | 76 +++++++++---------- types/express-session/tslint.json | 2 + 3 files changed, 48 insertions(+), 57 deletions(-) create mode 100644 types/express-session/tslint.json diff --git a/types/express-session/express-session-tests.ts b/types/express-session/express-session-tests.ts index 83748b8b1e..fd3af28824 100644 --- a/types/express-session/express-session-tests.ts +++ b/types/express-session/express-session-tests.ts @@ -1,9 +1,7 @@ - - import express = require('express'); import session = require('express-session'); -var app = express(); +let app = express(); app.use(session({ secret: 'keyboard cat', @@ -14,7 +12,7 @@ app.use(session({ name: 'connect.sid', store: new session.MemoryStore(), cookie: { path: '/', httpOnly: true, secure: false, maxAge: null }, - genid: (req: express.Request): string => { return ''; }, + genid: (req: express.Request): string => '', rolling: false, resave: true, proxy: true, @@ -22,21 +20,20 @@ app.use(session({ unset: 'keep' })); - interface MySession extends Express.Session { views: number; } -app.use(function(req, res, next) { - var sess = req.session; + +app.use((req, res, next) => { + let sess = req.session; if (sess.views) { - sess.views++ - res.setHeader('Content-Type', 'text/html') - res.write('

views: ' + sess.views + '

') - res.write('

expires in: ' + (sess.cookie.maxAge / 1000) + 's

') - res.end() + sess.views++; + res.setHeader('Content-Type', 'text/html'); + res.write('

views: ' + sess.views + '

'); + res.write('

expires in: ' + (sess.cookie.maxAge / 1000) + 's

'); + res.end(); } else { - sess.views = 1 - res.end('welcome to the session demo. refresh!') + sess.views = 1; + res.end('welcome to the session demo. refresh!'); } }); - diff --git a/types/express-session/index.d.ts b/types/express-session/index.d.ts index f97eff8f75..0cc391b2e9 100644 --- a/types/express-session/index.d.ts +++ b/types/express-session/index.d.ts @@ -1,26 +1,22 @@ // Type definitions for express-session // Project: https://www.npmjs.org/package/express-session -// Definitions by: Jacob Bogers // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - +// Definitions by: Jacob Bogers -/// declare namespace Express { - - export interface Request { + interface Request { session?: Session; sessionID?: string; } - - export interface SessionData { + interface SessionData { [key: string]: any; cookie: Express.SessionCookieData; } - export interface SessionCookieData { + interface SessionCookieData { originalMaxAge: number; path: string; maxAge: number; @@ -30,22 +26,19 @@ declare namespace Express { expires: Date | boolean; } - export interface SessionCookie extends SessionCookieData { - serialize: (name: string, value: string) => string; + interface SessionCookie extends SessionCookieData { + serialize(name: string, value: string): string; } - export interface Session extends SessionData { + interface Session extends SessionData { id: string; - - regenerate: (callback: (err: any) => void) => void; - destroy: (callback: (err: any) => void) => void; - reload: (callback: (err: any) => void) => void; - save: (callback: (err: any) => void) => void; - touch: (callback: (err: any) => void) => void; - + regenerate(callback: (err: any) => void): void; + destroy(callback: (err: any) => void): void; + reload(callback: (err: any) => void): void; + save(callback: (err: any) => void): void; + touch(callback: (err: any) => void): void; cookie: SessionCookie; } - } declare module "express-session" { @@ -55,12 +48,12 @@ declare module "express-session" { function session(options?: session.SessionOptions): express.RequestHandler; namespace session { - export interface SessionOptions { + interface SessionOptions { secret: string; name?: string; store?: Store | MemoryStore; cookie?: express.CookieOptions; - genid?: (req: express.Request) => string; + genid?(req: express.Request): string; rolling?: boolean; resave?: boolean; proxy?: boolean; @@ -68,39 +61,38 @@ declare module "express-session" { unset?: string; } - export interface BaseMemoryStore { - get: (sid: string, callback: (err: any, session: Express.Session) => void) => void; - set: (sid: string, session: Express.Session, callback: (err: any) => void) => void; - destroy: (sid: string, callback: (err: any) => void) => void; - length?: (callback: (err: any, length: number) => void) => void; - clear?: (callback: (err: any) => void) => void; + interface BaseMemoryStore { + get(sid: string, callback: (err: any, session: Express.Session) => void): void; + set(sid: string, session: Express.Session, callback: (err: any) => void): void; + destroy(sid: string, callback: (err: any) => void): void; + length?(callback: (err: any, length: number) => void): void; + clear?(callback: (err: any) => void): void; } - export abstract class Store extends node.EventEmitter { + abstract class Store extends node.EventEmitter { constructor(config?: any); regenerate(req: express.Request, fn: (err: any) => any): void; load(sid: string, fn: (err: any, session: Express.Session) => any): void; createSession(req: express.Request, sess: Express.SessionData): void; - get: (sid: string, callback: (err: any, session: Express.Session) => void) => void; - set: (sid: string, session: Express.Session, callback: (err: any) => void) => void; - destroy: (sid: string, callback: (err: any) => void) => void; - all: (callback: (err: any, obj: { [sid: string]: Express.SessionData; }) => void) => void; - length: (callback: (err: any, length: number) => void) => void; - clear: (callback: (err: any) => void) => void; + get(sid: string, callback: (err: any, session: Express.Session) => void): void; + set(sid: string, session: Express.Session, callback: (err: any) => void): void; + destroy(sid: string, callback: (err: any) => void): void; + all(callback: (err: any, obj: { [sid: string]: Express.SessionData; }) => void): void; + length(callback: (err: any, length: number) => void): void; + clear(callback: (err: any) => void): void; } - export class MemoryStore implements BaseMemoryStore { - get: (sid: string, callback: (err: any, session: Express.Session) => void) => void; - set: (sid: string, session: Express.Session, callback: (err: any) => void) => void; - destroy: (sid: string, callback: (err: any) => void) => void; - all: (callback: (err: any, obj: { [sid: string]: Express.Session; }) => void) => void; - length: (callback: (err: any, length: number) => void) => void; - clear: (callback: (err: any) => void) => void; + class MemoryStore implements BaseMemoryStore { + get(sid: string, callback: (err: any, session: Express.Session) => void): void; + set(sid: string, session: Express.Session, callback: (err: any) => void): void; + destroy(sid: string, callback: (err: any) => void): void; + all(callback: (err: any, obj: { [sid: string]: Express.Session; }) => void): void; + length(callback: (err: any, length: number) => void): void; + clear(callback: (err: any) => void): void; } } export = session; } - diff --git a/types/express-session/tslint.json b/types/express-session/tslint.json new file mode 100644 index 0000000000..fcb6733be3 --- /dev/null +++ b/types/express-session/tslint.json @@ -0,0 +1,2 @@ +{ + "extends": "dtslint/dt.json" } \ No newline at end of file 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 072/529] 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 475646bd8aca539fe9d454a4a796611cc1f74de3 Mon Sep 17 00:00:00 2001 From: jacobbogers Date: Fri, 19 May 2017 11:35:35 +0200 Subject: [PATCH 073/529] tslint is happy now --- .../express-session/express-session-tests.ts | 2 +- types/express-session/index.d.ts | 163 +++++++++--------- 2 files changed, 83 insertions(+), 82 deletions(-) diff --git a/types/express-session/express-session-tests.ts b/types/express-session/express-session-tests.ts index fd3af28824..4ee9a76a6e 100644 --- a/types/express-session/express-session-tests.ts +++ b/types/express-session/express-session-tests.ts @@ -25,7 +25,7 @@ interface MySession extends Express.Session { } app.use((req, res, next) => { - let sess = req.session; + let sess = req.session as MySession; if (sess.views) { sess.views++; res.setHeader('Content-Type', 'text/html'); diff --git a/types/express-session/index.d.ts b/types/express-session/index.d.ts index 0cc391b2e9..e3f5b25a08 100644 --- a/types/express-session/index.d.ts +++ b/types/express-session/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for express-session +// Type definitions for express-session 1.15 // Project: https://www.npmjs.org/package/express-session // Definitions by: Hiroki Horiuchi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -6,93 +6,94 @@ /// -declare namespace Express { - interface Request { - session?: Session; - sessionID?: string; - } - interface SessionData { - [key: string]: any; - cookie: Express.SessionCookieData; - } +import express = require('express'); +import node = require('events'); - interface SessionCookieData { - originalMaxAge: number; - path: string; - maxAge: number; - secure?: boolean; - httpOnly: boolean; - domain?: string; - expires: Date | boolean; - } +declare global { + namespace Express { + interface Request { + session?: Session; + sessionID?: string; + } - interface SessionCookie extends SessionCookieData { - serialize(name: string, value: string): string; - } + interface SessionData { + [key: string]: any; + cookie: Express.SessionCookieData; + } - interface Session extends SessionData { - id: string; - regenerate(callback: (err: any) => void): void; - destroy(callback: (err: any) => void): void; - reload(callback: (err: any) => void): void; - save(callback: (err: any) => void): void; - touch(callback: (err: any) => void): void; - cookie: SessionCookie; + interface SessionCookieData { + originalMaxAge: number; + path: string; + maxAge: number; + secure?: boolean; + httpOnly: boolean; + domain?: string; + expires: Date | boolean; + } + + interface SessionCookie extends SessionCookieData { + serialize(name: string, value: string): string; + } + + interface Session extends SessionData { + id: string; + regenerate(callback: (err: any) => void): void; + destroy(callback: (err: any) => void): void; + reload(callback: (err: any) => void): void; + save(callback: (err: any) => void): void; + touch(callback: (err: any) => void): void; + cookie: SessionCookie; + } } } -declare module "express-session" { - import express = require('express'); - import node = require('events'); +declare function session(options?: session.SessionOptions): express.RequestHandler; - function session(options?: session.SessionOptions): express.RequestHandler; - - namespace session { - interface SessionOptions { - secret: string; - name?: string; - store?: Store | MemoryStore; - cookie?: express.CookieOptions; - genid?(req: express.Request): string; - rolling?: boolean; - resave?: boolean; - proxy?: boolean; - saveUninitialized?: boolean; - unset?: string; - } - - interface BaseMemoryStore { - get(sid: string, callback: (err: any, session: Express.Session) => void): void; - set(sid: string, session: Express.Session, callback: (err: any) => void): void; - destroy(sid: string, callback: (err: any) => void): void; - length?(callback: (err: any, length: number) => void): void; - clear?(callback: (err: any) => void): void; - } - - abstract class Store extends node.EventEmitter { - constructor(config?: any); - - regenerate(req: express.Request, fn: (err: any) => any): void; - load(sid: string, fn: (err: any, session: Express.Session) => any): void; - createSession(req: express.Request, sess: Express.SessionData): void; - - get(sid: string, callback: (err: any, session: Express.Session) => void): void; - set(sid: string, session: Express.Session, callback: (err: any) => void): void; - destroy(sid: string, callback: (err: any) => void): void; - all(callback: (err: any, obj: { [sid: string]: Express.SessionData; }) => void): void; - length(callback: (err: any, length: number) => void): void; - clear(callback: (err: any) => void): void; - } - - class MemoryStore implements BaseMemoryStore { - get(sid: string, callback: (err: any, session: Express.Session) => void): void; - set(sid: string, session: Express.Session, callback: (err: any) => void): void; - destroy(sid: string, callback: (err: any) => void): void; - all(callback: (err: any, obj: { [sid: string]: Express.Session; }) => void): void; - length(callback: (err: any, length: number) => void): void; - clear(callback: (err: any) => void): void; - } +declare namespace session { + interface SessionOptions { + secret: string; + name?: string; + store?: Store | MemoryStore; + cookie?: express.CookieOptions; + genid?(req: express.Request): string; + rolling?: boolean; + resave?: boolean; + proxy?: boolean; + saveUninitialized?: boolean; + unset?: string; } - export = session; + interface BaseMemoryStore { + get(sid: string, callback: (err: any, session: Express.Session) => void): void; + set(sid: string, session: Express.Session, callback: (err: any) => void): void; + destroy(sid: string, callback: (err: any) => void): void; + length?(callback: (err: any, length: number) => void): void; + clear?(callback: (err: any) => void): void; + } + + abstract class Store extends node.EventEmitter { + constructor(config?: any); + + regenerate(req: express.Request, fn: (err: any) => any): void; + load(sid: string, fn: (err: any, session: Express.Session) => any): void; + createSession(req: express.Request, sess: Express.SessionData): void; + + get(sid: string, callback: (err: any, session: Express.Session) => void): void; + set(sid: string, session: Express.Session, callback: (err: any) => void): void; + destroy(sid: string, callback: (err: any) => void): void; + all(callback: (err: any, obj: { [sid: string]: Express.SessionData; }) => void): void; + length(callback: (err: any, length: number) => void): void; + clear(callback: (err: any) => void): void; + } + + class MemoryStore implements BaseMemoryStore { + get(sid: string, callback: (err: any, session: Express.Session) => void): void; + set(sid: string, session: Express.Session, callback: (err: any) => void): void; + destroy(sid: string, callback: (err: any) => void): void; + all(callback: (err: any, obj: { [sid: string]: Express.Session; }) => void): void; + length(callback: (err: any, length: number) => void): void; + clear(callback: (err: any) => void): void; + } } + +export = session; From 1a4cd672060bea20eacbbc2f2aee1016667a3f04 Mon Sep 17 00:00:00 2001 From: jacobbogers Date: Fri, 19 May 2017 12:10:09 +0200 Subject: [PATCH 074/529] strictNullChecks set to true --- types/express-session/tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/express-session/tsconfig.json b/types/express-session/tsconfig.json index 674aaf8385..cabddf0621 100644 --- a/types/express-session/tsconfig.json +++ b/types/express-session/tsconfig.json @@ -6,7 +6,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" From 2b902bfe59c6dfd3b597f8518ffcb2ccda1787af Mon Sep 17 00:00:00 2001 From: jacobbogers Date: Fri, 19 May 2017 12:25:25 +0200 Subject: [PATCH 075/529] changed recommended by tslint break other projects (mongo-store) depending on this declaration, so reverted --- types/express-session/index.d.ts | 42 ++++++++++++++--------------- types/express-session/tsconfig.json | 2 +- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/types/express-session/index.d.ts b/types/express-session/index.d.ts index e3f5b25a08..60dedea20a 100644 --- a/types/express-session/index.d.ts +++ b/types/express-session/index.d.ts @@ -24,7 +24,7 @@ declare global { interface SessionCookieData { originalMaxAge: number; path: string; - maxAge: number; + maxAge: number | null; secure?: boolean; httpOnly: boolean; domain?: string; @@ -64,35 +64,35 @@ declare namespace session { } interface BaseMemoryStore { - get(sid: string, callback: (err: any, session: Express.Session) => void): void; - set(sid: string, session: Express.Session, callback: (err: any) => void): void; - destroy(sid: string, callback: (err: any) => void): void; - length?(callback: (err: any, length: number) => void): void; - clear?(callback: (err: any) => void): void; + get: (sid: string, callback: (err: any, session: Express.Session) => void) => void; + set: (sid: string, session: Express.Session, callback: (err: any) => void) => void; + destroy: (sid: string, callback: (err: any) => void) => void; + length?: (callback: (err: any, length: number) => void) => void; + clear?: (callback: (err: any) => void) => void; } abstract class Store extends node.EventEmitter { constructor(config?: any); - regenerate(req: express.Request, fn: (err: any) => any): void; - load(sid: string, fn: (err: any, session: Express.Session) => any): void; - createSession(req: express.Request, sess: Express.SessionData): void; + regenerate: (req: express.Request, fn: (err: any) => any) => void; + load: (sid: string, fn: (err: any, session: Express.Session) => any) => void; + createSession: (req: express.Request, sess: Express.SessionData) => void; - get(sid: string, callback: (err: any, session: Express.Session) => void): void; - set(sid: string, session: Express.Session, callback: (err: any) => void): void; - destroy(sid: string, callback: (err: any) => void): void; - all(callback: (err: any, obj: { [sid: string]: Express.SessionData; }) => void): void; - length(callback: (err: any, length: number) => void): void; - clear(callback: (err: any) => void): void; + get: (sid: string, callback: (err: any, session: Express.Session) => void) => void; + set: (sid: string, session: Express.Session, callback: (err: any) => void) => void; + destroy: (sid: string, callback: (err: any) => void) => void; + all: (callback: (err: any, obj: { [sid: string]: Express.SessionData; }) => void) => void; + length: (callback: (err: any, length: number) => void) => void; + clear: (callback: (err: any) => void) => void; } class MemoryStore implements BaseMemoryStore { - get(sid: string, callback: (err: any, session: Express.Session) => void): void; - set(sid: string, session: Express.Session, callback: (err: any) => void): void; - destroy(sid: string, callback: (err: any) => void): void; - all(callback: (err: any, obj: { [sid: string]: Express.Session; }) => void): void; - length(callback: (err: any, length: number) => void): void; - clear(callback: (err: any) => void): void; + get: (sid: string, callback: (err: any, session: Express.Session) => void) => void; + set: (sid: string, session: Express.Session, callback: (err: any) => void) => void; + destroy: (sid: string, callback: (err: any) => void) => void; + all: (callback: (err: any, obj: { [sid: string]: Express.Session; }) => void) => void; + length: (callback: (err: any, length: number) => void) => void; + clear: (callback: (err: any) => void) => void; } } diff --git a/types/express-session/tsconfig.json b/types/express-session/tsconfig.json index cabddf0621..674aaf8385 100644 --- a/types/express-session/tsconfig.json +++ b/types/express-session/tsconfig.json @@ -6,7 +6,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": true, + "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ "../" From 95b57305ee7be2e87b235c337e82bc6590c8eaac Mon Sep 17 00:00:00 2001 From: jacobbogers Date: Fri, 19 May 2017 12:47:34 +0200 Subject: [PATCH 076/529] rule prefer-method-signature=false, to accept legacy ts --- types/express-session/tslint.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/types/express-session/tslint.json b/types/express-session/tslint.json index fcb6733be3..907305050c 100644 --- a/types/express-session/tslint.json +++ b/types/express-session/tslint.json @@ -1,2 +1,6 @@ { - "extends": "dtslint/dt.json" } \ No newline at end of file + "extends": "dtslint/dt.json", + "rules": { + "prefer-method-signature": false + } +} \ No newline at end of file From 1c09309c27547cd5fc5162f5047f1d05d8d5ca6f Mon Sep 17 00:00:00 2001 From: Dolan Date: Fri, 19 May 2017 12:26:21 +0100 Subject: [PATCH 077/529] 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 078/529] 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 079/529] 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 080/529] 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 081/529] 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 082/529] 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 6246d0d62bc14a1297e2d8ab5f300daf50949937 Mon Sep 17 00:00:00 2001 From: Aluan Haddad Date: Sat, 20 May 2017 10:12:03 -0400 Subject: [PATCH 083/529] 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 084/529] 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 085/529] 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 086/529] 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 087/529] 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 088/529] [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 ce0c8389af31fdd110c8cbe9f2a05a9c98e08d55 Mon Sep 17 00:00:00 2001 From: huhuanming Date: Mon, 22 May 2017 00:44:27 +0800 Subject: [PATCH 089/529] Add Action Types --- types/react-navigation/index.d.ts | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/types/react-navigation/index.d.ts b/types/react-navigation/index.d.ts index 40b83778e0..b3372c5990 100644 --- a/types/react-navigation/index.d.ts +++ b/types/react-navigation/index.d.ts @@ -320,10 +320,10 @@ export type NavigationAction = | NavigationTabAction export namespace NavigationActions { - function navigate(options: NavigationNavigateAction): any; - function reset(options: NavigationResetAction): any; - function back(options?: NavigationBackAction): any; - function setParams(options: NavigationSetParamsAction): any; + function navigate(options: NavigationNavigateAction): NavigationNavigateAction; + function reset(options: NavigationResetAction): NavigationResetAction; + function back(options?: NavigationBackAction): NavigationBackAction; + function setParams(options: NavigationSetParamsAction): NavigationSetParamsAction; } export type NavigationRouteConfig = T & { @@ -602,3 +602,17 @@ export interface DrawerNavigatorScreenOptions { | ((options: {focused: boolean, tintColor: string}) => React.ReactElement) ; } + +export interface NavgationComponentProps { + navigation: { + state: { + key: string + params: T, + }, + } +} + +export type NavigationNavigateActionCreator = (options: NavigationNavigateAction) => NavigationNavigateAction; +export type NavigationResetActionCreator = (options: NavigationResetAction) => NavigationResetAction; +export type NavigationBackActionCreator = (options: NavigationBackAction) => NavigationBackAction; +export type NavigationSetParamsActionCreator = (options: NavigationSetParamsAction) => NavigationSetParamsAction; From 1a19f3cd5c04726d1826526435e7bd14f8929e28 Mon Sep 17 00:00:00 2001 From: Chad Auld Date: Sun, 21 May 2017 12:05:29 -0600 Subject: [PATCH 090/529] 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 091/529] 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 092/529] 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 093/529] 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 094/529] 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 095/529] 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 d926bbe9f0b70e571cf988e1975053f2f8c8c865 Mon Sep 17 00:00:00 2001 From: mariajplmiranda Date: Mon, 22 May 2017 18:05:07 +0100 Subject: [PATCH 096/529] Adds `prompt` to grantOfflineAccess method --- types/gapi.auth2/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/gapi.auth2/index.d.ts b/types/gapi.auth2/index.d.ts index de75d26ca2..a053b385cc 100644 --- a/types/gapi.auth2/index.d.ts +++ b/types/gapi.auth2/index.d.ts @@ -48,6 +48,7 @@ declare namespace gapi.auth2 { */ grantOfflineAccess(options: { scope?: string; + prompt?: string; redirect_uri?: string; }): any; From 9f0275c3931a773debcd2357fe56333493db8444 Mon Sep 17 00:00:00 2001 From: Huw McNamara Date: Mon, 22 May 2017 20:30:14 +0100 Subject: [PATCH 097/529] 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 098/529] 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 099/529] 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 100/529] 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 6ca038a08fe6969ea14308faed8df8f67a987b8e Mon Sep 17 00:00:00 2001 From: Ashish Shubham Date: Mon, 22 May 2017 23:31:00 -0700 Subject: [PATCH 101/529] update rangy definitions Update type definitions for the Rangy Module. --- types/rangy/index.d.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/types/rangy/index.d.ts b/types/rangy/index.d.ts index 1edb9c3c23..ea784d9b7e 100644 --- a/types/rangy/index.d.ts +++ b/types/rangy/index.d.ts @@ -39,6 +39,7 @@ interface RangySelection extends Selection { refresh(checkForChanges?:boolean):any; toHtml():string; getAllRanges():RangyRange[]; + getRangeAt(idx:number):RangyRange; getNativeTextRange():any; setSingleRange(range:RangyRange):any; setRanges(ranges:RangyRange[]):any; @@ -46,6 +47,8 @@ interface RangySelection extends Selection { moveToBookmark(bookmark:Object):any; saveRanges():Object; restoreRanges(saved:Object):any; + saveCharacterRanges(containerNode:Node): Object; + restoreCharacterRanges(containerNode:Node, characterRanges:Object); detach():any; inspect():string; } @@ -62,5 +65,7 @@ interface RangyStatic { initialized:boolean; supported:boolean; } - +declare module 'rangy' { + export = rangy; +} declare var rangy:RangyStatic; From 96d0e4a113d417653efc56eb58fa534f25e5ed86 Mon Sep 17 00:00:00 2001 From: Fedor Nezhivoi Date: Tue, 23 May 2017 09:41:01 +0300 Subject: [PATCH 102/529] @types/react-native update Slider props --- types/react-native/index.d.ts | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index a7e922e1b1..07f2dd1741 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -2908,6 +2908,13 @@ export interface RecyclerViewBackedScrollViewStatic extends ScrollResponderMixin getScrollResponder(): JSX.Element; } +export interface SliderPropertiesAndroid extends ViewProperties { + /** + * Color of the foreground switch grip. + */ + thumbTintColor?: string, +} + export interface SliderPropertiesIOS extends ViewProperties { /** @@ -2916,24 +2923,12 @@ export interface SliderPropertiesIOS extends ViewProperties { */ maximumTrackImage?: ImageURISource - /** - * The color used for the track to the right of the button. - * Overrides the default blue gradient image. - */ - maximumTrackTintColor?: string - /** * Assigns a minimum track image. Only static images are supported. * The rightmost pixel of the image will be stretched to fill the track. */ minimumTrackImage?: ImageURISource - /** - * The color used for the track to the left of the button. - * Overrides the default blue gradient image. - */ - minimumTrackTintColor?: string - /** * Sets an image for the thumb. Only static images are supported. */ @@ -2947,7 +2942,7 @@ export interface SliderPropertiesIOS extends ViewProperties { trackImage?: ImageURISource } -export interface SliderProperties extends SliderPropertiesIOS { +export interface SliderProperties extends SliderPropertiesIOS, SliderPropertiesAndroid { /** * If true the user won't be able to move the slider. @@ -2955,11 +2950,23 @@ export interface SliderProperties extends SliderPropertiesIOS { */ disabled?: boolean + /** + * The color used for the track to the right of the button. + * Overrides the default blue gradient image. + */ + maximumTrackTintColor?: string + /** * Initial maximum value of the slider. Default value is 1. */ maximumValue?: number + /** + * The color used for the track to the left of the button. + * Overrides the default blue gradient image. + */ + minimumTrackTintColor?: string + /** * Initial minimum value of the slider. Default value is 0. */ From 9f5ae6ecfbedc55ef8f060bdc559126a3c8be580 Mon Sep 17 00:00:00 2001 From: huhuanming Date: Tue, 23 May 2017 14:55:52 +0800 Subject: [PATCH 103/529] Add NavgationComponentProps --- types/react-navigation/index.d.ts | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/types/react-navigation/index.d.ts b/types/react-navigation/index.d.ts index b3372c5990..ffa936f6d0 100644 --- a/types/react-navigation/index.d.ts +++ b/types/react-navigation/index.d.ts @@ -1,7 +1,6 @@ // Type definitions for react-navigation 1.0 // Project: https://github.com/react-community/react-navigation -// Definitions by: Huhuanming -// mhcgrq +// Definitions by: Huhuanming , mhcgrq // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped import * as React from 'react' @@ -603,16 +602,22 @@ export interface DrawerNavigatorScreenOptions { ; } +export type NavigationNavigateActionCreator = (options: NavigationNavigateAction) => boolean; +export type NavigationResetActionCreator = (options: NavigationResetAction) => boolean; +export type NavigationBackActionCreator = (options?: NavigationBackAction) => boolean; +export type NavigationSetParamsActionCreator = (options: NavigationSetParamsAction) => boolean; + export interface NavgationComponentProps { + screenProps: any navigation: { + dispatch: any + goBack: NavigationBackActionCreator + navigate: NavigationNavigateActionCreator + setParams: NavigationSetParamsActionCreator state: { key: string + routeName: string, params: T, }, } } - -export type NavigationNavigateActionCreator = (options: NavigationNavigateAction) => NavigationNavigateAction; -export type NavigationResetActionCreator = (options: NavigationResetAction) => NavigationResetAction; -export type NavigationBackActionCreator = (options: NavigationBackAction) => NavigationBackAction; -export type NavigationSetParamsActionCreator = (options: NavigationSetParamsAction) => NavigationSetParamsAction; From 688ba5fea60ae72bda6cb6aa1cb7875f1d942def Mon Sep 17 00:00:00 2001 From: Ashish Shubham Date: Tue, 23 May 2017 01:22:35 -0700 Subject: [PATCH 104/529] Update rangy definitions --- types/rangy/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/rangy/index.d.ts b/types/rangy/index.d.ts index ea784d9b7e..84dcd88320 100644 --- a/types/rangy/index.d.ts +++ b/types/rangy/index.d.ts @@ -48,7 +48,7 @@ interface RangySelection extends Selection { saveRanges():Object; restoreRanges(saved:Object):any; saveCharacterRanges(containerNode:Node): Object; - restoreCharacterRanges(containerNode:Node, characterRanges:Object); + restoreCharacterRanges(containerNode:Node, characterRanges:Object):any; detach():any; inspect():string; } From 7f3bf5d32e7b8f8ba2b11cb500283eaf6247deaf Mon Sep 17 00:00:00 2001 From: mariajplmiranda Date: Tue, 23 May 2017 10:06:04 +0100 Subject: [PATCH 105/529] Changes grantOfflineAccess options Specifies prompt options, adds app_package_name property and removes redirect URI --- types/gapi.auth2/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/gapi.auth2/index.d.ts b/types/gapi.auth2/index.d.ts index a053b385cc..830abe3b0c 100644 --- a/types/gapi.auth2/index.d.ts +++ b/types/gapi.auth2/index.d.ts @@ -48,8 +48,8 @@ declare namespace gapi.auth2 { */ grantOfflineAccess(options: { scope?: string; - prompt?: string; - redirect_uri?: string; + prompt?: "select_account" | "consent"; + app_package_name?: string; }): any; /** From bcc2eec9227882c077f3c2c60717b563bb5130da Mon Sep 17 00:00:00 2001 From: Ashish Shubham Date: Tue, 23 May 2017 02:07:40 -0700 Subject: [PATCH 106/529] Update rangy-tests.ts --- types/rangy/rangy-tests.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/types/rangy/rangy-tests.ts b/types/rangy/rangy-tests.ts index fac44c868c..5febe59cf0 100644 --- a/types/rangy/rangy-tests.ts +++ b/types/rangy/rangy-tests.ts @@ -94,4 +94,8 @@ function testSelection() { selection.setRanges(ranges); selection.setSingleRange(getRangyRange()); assertString(selection.toHtml()); + var node:Node = new Node(); + object = selection.saveCharacterRanges(node); + selection.restoreCharacterRanges(node, object); + assertString(selection.toHtml()); } From dceac2d5c127626f0e24344546b518a9fd91fe37 Mon Sep 17 00:00:00 2001 From: Ashish Shubham Date: Tue, 23 May 2017 03:04:26 -0700 Subject: [PATCH 107/529] Update rangy-tests.ts --- types/rangy/rangy-tests.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/rangy/rangy-tests.ts b/types/rangy/rangy-tests.ts index 5febe59cf0..de2ec468f0 100644 --- a/types/rangy/rangy-tests.ts +++ b/types/rangy/rangy-tests.ts @@ -81,6 +81,7 @@ function testSelection() { selection.detach(); let ranges:RangyRange[] = selection.getAllRanges(); + let range:RangyRange = selection.getRangeAt(0); selection.getBookmark(new Node); let nativeTextRange:TextRange = selection.getNativeTextRange(); assertString(selection.inspect()); From e657a632ad7d6bd2b9d4761fe222f8ad7f6af135 Mon Sep 17 00:00:00 2001 From: Ashish Shubham Date: Tue, 23 May 2017 03:05:24 -0700 Subject: [PATCH 108/529] Update index.d.ts --- types/rangy/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/rangy/index.d.ts b/types/rangy/index.d.ts index 84dcd88320..b6615b9aad 100644 --- a/types/rangy/index.d.ts +++ b/types/rangy/index.d.ts @@ -47,7 +47,7 @@ interface RangySelection extends Selection { moveToBookmark(bookmark:Object):any; saveRanges():Object; restoreRanges(saved:Object):any; - saveCharacterRanges(containerNode:Node): Object; + saveCharacterRanges(containerNode:Node):Object; restoreCharacterRanges(containerNode:Node, characterRanges:Object):any; detach():any; inspect():string; From 80e0d7f7744522328a5433f41b0ac98ae3f25128 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vesa=20Poikaj=C3=A4rvi?= Date: Tue, 23 May 2017 13:23:53 +0300 Subject: [PATCH 109/529] [convict] 3.0.0 deprecated option strict and added option allowed --- types/convict/convict-tests.ts | 2 ++ types/convict/index.d.ts | 26 +++++++++++++++++++++++--- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/types/convict/convict-tests.ts b/types/convict/convict-tests.ts index a61c27bdad..667652b829 100644 --- a/types/convict/convict-tests.ts +++ b/types/convict/convict-tests.ts @@ -105,6 +105,8 @@ conf.loadFile(['./configs/always.json', './configs/sometimes.json']); // perform validation conf.validate({ strict: true }); +conf.validate({ allowed: 'strict' }); +conf.validate({ allowed: 'warn' }); var port: number = conf.default('port'); diff --git a/types/convict/index.d.ts b/types/convict/index.d.ts index 981bc8148b..d9f12c29dd 100644 --- a/types/convict/index.d.ts +++ b/types/convict/index.d.ts @@ -1,11 +1,26 @@ -// Type definitions for node-convict v0.6.0 +// Type definitions for node-convict v3.0.0 // Project: https://github.com/mozilla/node-convict -// Definitions by: Wim Looman +// Definitions by: Wim Looman , Vesa Poikajärvi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace convict { + type ValidationMethod = 'strict' | 'warn'; + + interface ValidateOptions { + /** + * If set to warn, any properties specified in config files that are not declared in + * the schema will print a warning. This is the default behavior. If set to strict, + * any properties specified in config files that are not declared in the schema will + * throw errors. This is to ensure that the schema and the config files are in sync. + */ + allowed?: ValidationMethod; + + /** @deprecated use allowed instead */ + strict?: boolean; + } + interface Format { name?: string; validate?: (val: any) => void; @@ -41,7 +56,12 @@ declare namespace convict { load(conf: Object): void; loadFile(file: string): void; loadFile(files: string[]): void; - validate(options?: { strict?: boolean }): void; + /** + * Validates config against the schema used to initialize it + * + * @param options + */ + validate(options?: ValidateOptions): void; /** * Exports all the properties (that is the keys and their current values) as a {JSON} {Object} * @returns {Object} A {JSON} compliant {Object} From b475ab8f372511eaf5d97bf03021c7f5bbe48ab2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vesa=20Poikaj=C3=A4rvi?= Date: Tue, 23 May 2017 13:36:46 +0300 Subject: [PATCH 110/529] [convict] Many Config methods are chainable --- types/convict/convict-tests.ts | 10 ++++++++ types/convict/index.d.ts | 43 ++++++++++++++++++++++++++++++---- 2 files changed, 48 insertions(+), 5 deletions(-) diff --git a/types/convict/convict-tests.ts b/types/convict/convict-tests.ts index 667652b829..10f5813185 100644 --- a/types/convict/convict-tests.ts +++ b/types/convict/convict-tests.ts @@ -108,6 +108,16 @@ conf.validate({ strict: true }); conf.validate({ allowed: 'strict' }); conf.validate({ allowed: 'warn' }); +// Chaining + +conf + .loadFile(['./configs/always.json', './configs/sometimes.json']) + .loadFile('./config/' + env + '.json') + .load({ jsonKey: 'jsonValue' }) + .set('key', 'value') + .validate( {allowed: 'warn'} ) + .toString(); + var port: number = conf.default('port'); if (conf.has('key')) { diff --git a/types/convict/index.d.ts b/types/convict/index.d.ts index d9f12c29dd..ebe5d21490 100644 --- a/types/convict/index.d.ts +++ b/types/convict/index.d.ts @@ -49,19 +49,52 @@ declare namespace convict { } interface Config { + /** + * @returns the current value of the name property. name can use dot + * notation to reference nested values + */ get(name: string): any; + /** + * @returns the default value of the name property. name can use dot + * notation to reference nested values + */ default(name: string): any; + /** + * @returns true if the property name is defined, or false otherwise + */ has(name: string): boolean; - set(name: string, value: any): void; - load(conf: Object): void; - loadFile(file: string): void; - loadFile(files: string[]): void; + /** + * Sets the value of name to value. name can use dot notation to reference + * nested values, e.g. "database.port". If objects in the chain don't yet + * exist, they will be initialized to empty objects + * + * @return {Config} instance + */ + set(name: string, value: any): Config; + /** + * Loads and merges a JavaScript object into config + * + * @return {Config} instance + */ + load(conf: Object): Config; + /** + * Loads and merges one JSON configuration file into config + * + * @return {Config} instance + */ + loadFile(file: string): Config; + /** + * Loads and merges multiple JSON configuration files into config + * + * @return {Config} instance + */ + loadFile(files: string[]): Config; /** * Validates config against the schema used to initialize it * * @param options */ - validate(options?: ValidateOptions): void; + validate(options?: ValidateOptions): Config; /** * Exports all the properties (that is the keys and their current values) as a {JSON} {Object} * @returns {Object} A {JSON} compliant {Object} From df2c87326f2d6cafd2f201c0ea038e1e3744404b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vesa=20Poikaj=C3=A4rvi?= Date: Tue, 23 May 2017 13:55:29 +0300 Subject: [PATCH 111/529] [convict] incorrect whitespace fixed from test --- types/convict/convict-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/convict/convict-tests.ts b/types/convict/convict-tests.ts index 10f5813185..0451954ca1 100644 --- a/types/convict/convict-tests.ts +++ b/types/convict/convict-tests.ts @@ -115,7 +115,7 @@ conf .loadFile('./config/' + env + '.json') .load({ jsonKey: 'jsonValue' }) .set('key', 'value') - .validate( {allowed: 'warn'} ) + .validate({ allowed: 'warn' }) .toString(); var port: number = conf.default('port'); 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 112/529] 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 113/529] 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 114/529] 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 115/529] 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 116/529] 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 117/529] 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 f7f271b82001c01616a8f8cc4863d915df17ffde Mon Sep 17 00:00:00 2001 From: Michael Aird Date: Tue, 23 May 2017 11:23:13 -0400 Subject: [PATCH 118/529] Fixed the method signature Thanks to @DanielRosenwasser for pointing out the mistake in my change. This should now be correct. --- types/kendo-ui/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/kendo-ui/index.d.ts b/types/kendo-ui/index.d.ts index 256398125c..bc7cd464c7 100644 --- a/types/kendo-ui/index.d.ts +++ b/types/kendo-ui/index.d.ts @@ -5408,7 +5408,8 @@ declare namespace kendo.ui { slotByPosition(xPosition: number, yPosition: number): any; slotByElement(element: Element): any; slotByElement(element: JQuery): any; - view(type?: string): kendo.ui.SchedulerView; + view(): kendo.ui.SchedulerView; + view(name: string): void; viewName(): string; } From c1a65853d41ebd7f385ac01f8a0543ed4df730a4 Mon Sep 17 00:00:00 2001 From: Spectral Radius Systems Date: Tue, 23 May 2017 11:24:14 -0400 Subject: [PATCH 119/529] 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 120/529] 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 121/529] 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 122/529] 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 e85e05d0b2f99fd2597ebeb7081e6607f453e7a0 Mon Sep 17 00:00:00 2001 From: Peter Burns Date: Tue, 23 May 2017 12:03:17 -0700 Subject: [PATCH 123/529] 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 124/529] [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 125/529] 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 3c74c9177ae449efe328eabd7aa3a429aa32b863 Mon Sep 17 00:00:00 2001 From: LKay Date: Wed, 24 May 2017 14:48:34 +0900 Subject: [PATCH 126/529] 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 127/529] 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 128/529] 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 129/529] 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 130/529] 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 131/529] 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 132/529] 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 133/529] improve types of qrcode@0.8.2 --- types/qrcode/index.d.ts | 218 +++++++++++++++++++++++++++++++---- types/qrcode/qrcode-tests.ts | 54 ++++++++- 2 files changed, 241 insertions(+), 31 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(); +QRCode.toDataURL('some text', { errorCorrectionLevel: 'H' }, function (err, url) { + console.log(url); +}); -qrcodedraw.draw(document.getElementById('test') as HTMLCanvasElement, "this text will be in the code!", function (error, canvas) { - if (error) { - return console.log('Error =( ', error); +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 } - console.log('success!'); +}, 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 134/529] 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 135/529] 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 dde2a7a3ba61cdb8ec4bb29f3dc4fd45694911fa Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Wed, 24 May 2017 07:46:27 -0700 Subject: [PATCH 136/529] Change react's ComponentLifecycle to class ComponentLifecycle is intended to provide some methods to Component subclasses and enforce that overrides of those methods are correct in those same subclasses. However, it does neither of these things as an interface that Component `implements`. It just checks that Component has all the required methods of ComponentLifecycle. Since there are no required methods, the `implements` check passes. And since Component doesn't actually *implement* any of the methods, its subclasses don't get them by default, and their 'overrides' are not checked for correctness. Changing ComponentLifecycle to a class fixes both of these problems. --- types/react/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/react/index.d.ts b/types/react/index.d.ts index f2df9c3f69..cdea0f674f 100644 --- a/types/react/index.d.ts +++ b/types/react/index.d.ts @@ -178,7 +178,7 @@ declare namespace React { type ReactInstance = Component | Element; // Base component for plain JS classes - class Component implements ComponentLifecycle { + class Component extends ComponentLifecycle { constructor(props?: P, context?: any); setState(f: (prevState: S, props: P) => Pick, callback?: () => any): void; setState(state: Pick, callback?: () => any): void; @@ -251,7 +251,7 @@ declare namespace React { // Component Specs and Lifecycle // ---------------------------------------------------------------------- - interface ComponentLifecycle { + class ComponentLifecycle { componentWillMount?(): void; componentDidMount?(): void; componentWillReceiveProps?(nextProps: Readonly

, nextContext: any): void; From a1d65618d82a65983b06168bbc42d3cc3753fbb0 Mon Sep 17 00:00:00 2001 From: Andrea Briganti Date: Wed, 24 May 2017 17:22:24 +0200 Subject: [PATCH 137/529] 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 9853ed4e216e8c49cf75d690ba504ad038230bb4 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Wed, 24 May 2017 08:44:31 -0700 Subject: [PATCH 138/529] Make ComponentLifecycle inherited methods public --- .../react-native-scrollable-tab-view-tests.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/react-native-scrollable-tab-view/react-native-scrollable-tab-view-tests.tsx b/types/react-native-scrollable-tab-view/react-native-scrollable-tab-view-tests.tsx index 0fb10a4ffb..7953a4bbae 100644 --- a/types/react-native-scrollable-tab-view/react-native-scrollable-tab-view-tests.tsx +++ b/types/react-native-scrollable-tab-view/react-native-scrollable-tab-view-tests.tsx @@ -36,9 +36,9 @@ class ScrollableTabViewDemo extends React.Component<{}, {}> { ); } - protected componentWillMount?(): void { + componentWillMount?(): void { } - protected componentWillUnmount?(): void { + componentWillUnmount?(): void { } } From 43d74e2dfe215afb1124281bea13969e7082f997 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Wed, 24 May 2017 09:15:22 -0700 Subject: [PATCH 139/529] Add a Component interface that merges w/the class The Component interface extends ComponentLifecycle. ComponentLifecycle goes back to being an interface. Also fix some lint in react-virtualized --- types/react-virtualized/react-virtualized-tests.tsx | 12 ++---------- types/react/index.d.ts | 5 +++-- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/types/react-virtualized/react-virtualized-tests.tsx b/types/react-virtualized/react-virtualized-tests.tsx index 504a6e2c17..5a816a7e1d 100644 --- a/types/react-virtualized/react-virtualized-tests.tsx +++ b/types/react-virtualized/react-virtualized-tests.tsx @@ -405,11 +405,7 @@ export class ColumnSizerExample extends PureComponent { _noColumnMaxWidthChange(event) { let columnMaxWidth = parseInt(event.target.value, 10) - if (isNaN(columnMaxWidth)) { - columnMaxWidth = undefined - } else { - columnMaxWidth = Math.min(1000, columnMaxWidth) - } + columnMaxWidth = isNaN(columnMaxWidth) ? undefined : Math.min(1000, columnMaxWidth) this.setState({ columnMaxWidth }) } @@ -417,11 +413,7 @@ export class ColumnSizerExample extends PureComponent { _noColumnMinWidthChange(event) { let columnMinWidth = parseInt(event.target.value, 10) - if (isNaN(columnMinWidth)) { - columnMinWidth = undefined - } else { - columnMinWidth = Math.max(1, columnMinWidth) - } + columnMinWidth = isNaN(columnMinWidth) ? undefined : Math.max(1, columnMinWidth) this.setState({ columnMinWidth }) } diff --git a/types/react/index.d.ts b/types/react/index.d.ts index cdea0f674f..e9aa299934 100644 --- a/types/react/index.d.ts +++ b/types/react/index.d.ts @@ -178,7 +178,8 @@ declare namespace React { type ReactInstance = Component | Element; // Base component for plain JS classes - class Component extends ComponentLifecycle { + interface Component extends ComponentLifecycle { } + class Component { constructor(props?: P, context?: any); setState(f: (prevState: S, props: P) => Pick, callback?: () => any): void; setState(state: Pick, callback?: () => any): void; @@ -251,7 +252,7 @@ declare namespace React { // Component Specs and Lifecycle // ---------------------------------------------------------------------- - class ComponentLifecycle { + interface ComponentLifecycle { componentWillMount?(): void; componentDidMount?(): void; componentWillReceiveProps?(nextProps: Readonly

, nextContext: any): void; From a524192bf5fe8472feea0dbee5c5100ce94512df Mon Sep 17 00:00:00 2001 From: Cameron Little Date: Wed, 24 May 2017 09:34:25 -0700 Subject: [PATCH 140/529] 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 141/529] 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 142/529] 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 143/529] 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 144/529] 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 145/529] 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 146/529] 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 147/529] 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 148/529] 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 149/529] 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 150/529] 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 151/529] 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 145dd9bdb71136da6ceada135622f1023bdf0587 Mon Sep 17 00:00:00 2001 From: Bhargav Krishna Date: Fri, 26 May 2017 18:07:56 -0700 Subject: [PATCH 152/529] Adding types for Microsoft Teams Library (#16741) * adding microsoft teams * Update index.d.ts * disabling prefer-method-signature --- types/microsoftteams/index.d.ts | 340 +++++++++++++++++++ types/microsoftteams/microsoftteams-tests.ts | 36 ++ types/microsoftteams/tsconfig.json | 22 ++ types/microsoftteams/tslint.json | 3 + 4 files changed, 401 insertions(+) create mode 100644 types/microsoftteams/index.d.ts create mode 100644 types/microsoftteams/microsoftteams-tests.ts create mode 100644 types/microsoftteams/tsconfig.json create mode 100644 types/microsoftteams/tslint.json diff --git a/types/microsoftteams/index.d.ts b/types/microsoftteams/index.d.ts new file mode 100644 index 0000000000..f598a09b06 --- /dev/null +++ b/types/microsoftteams/index.d.ts @@ -0,0 +1,340 @@ +// Type definitions for microsoftteams 1.0 +// Project: https://github.com/OfficeDev/microsoft-teams-library-js +// Definitions by: OfficeDev +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped/types/microsoftteams +// TypeScript Version: 2.1 +// tslint:disable:prefer-method-signature + +interface MessageEvent { + originalEvent: MessageEvent; +} +/** + * This is the root namespace for the JavaScript SDK. + */ +declare namespace microsoftTeams { + /** + * Initializes the library. This must be called before any other SDK calls. + * The caller should only call this once the frame is loaded successfully. + */ + function initialize(): void; + /** + * Retrieves the current context the frame is running in. + * @param callback The callback to invoke when the {@link Context} object is retrieved. + */ + function getContext(callback: (context: Context) => void): void; + /** + * Registers a handler for when the user changes their theme. + * Only one handler may be registered at a time. Subsequent registrations will override the first. + * @param handler The handler to invoke when the user changes their theme. + */ + function registerOnThemeChangeHandler(handler: (theme: string) => void): void; + /** + * Navigates the frame to a new cross-domain URL. The domain of this URL must match at least one of the + * valid domains specified in the tab manifest; otherwise, an exception will be thrown. This function only + * needs to be used when navigating the frame to a URL in a different domain than the current one in + * a way that keeps the app informed of the change and allows the SDK to continue working. + * @param url The url to navigate the frame to. + */ + function navigateCrossDomain(url: string): void; + /** + * Shares a deep link a user can use to navigate back to a specific state in this page. + */ + function shareDeepLink(deepLinkParameters: DeepLinkParameters): void; + /** + * Namespace to interact with the settings-specific part of the SDK. + * This object is only usable on the settings frame. + */ + namespace settings { + /** + * Sets the validity state for the settings. + * The inital value is false so the user will not be able to save the settings until this is called with true. + * @param validityState A value indicating whether the save or remove button is enabled for the user. + */ + function setValidityState(validityState: boolean): void; + /** + * Gets the settings for the current instance. + * @param callback The callback to invoke when the {@link Settings} object is retrieved. + */ + function getSettings(callback: (settings: Settings) => void): void; + /** + * Sets the settings for the current instance. + * Note that this is an asynchronous operation so there are no guarentees as to when calls + * to getSettings will reflect the changed state. + * @param settings The desired settings for this current instance. + */ + function setSettings(settings: Settings): void; + /** + * Registers a handler for when the user attempts to save the settings. This handler should be used + * to create or update the underlying resource powering the content. + * The object passed to the handler must be used to notify whether to proceed with the save. + * Only one handler may be registered at a time. Subsequent registrations will override the first. + * @param handler The handler to invoke when the user selects the save button. + */ + function registerOnSaveHandler(handler: (evt: SaveEvent) => void): void; + /** + * Registers a handler for when the user attempts to remove the content. This handler should be used + * to remove the underlying resource powering the content. + * The object passed to the handler must be used to notify whether to proceed with the remove + * Only one handler may be registered at a time. Subsequent registrations will override the first. + * @param handler The handler to invoke when the user selects the remove button. + */ + function registerOnRemoveHandler(handler: (evt: RemoveEvent) => void): void; + interface Settings { + /** + * A suggested display name for the new content. + * In the settings for an existing instance being updated, this call has no effect. + */ + suggestedDisplayName?: string; + /** + * Sets the url to use for the content of this instance. + */ + contentUrl: string; + /** + * Sets the remove URL for the remove config experience + */ + removeUrl?: string; + /** + * Sets the url to use for the external link to view the underlying resource in a browser. + */ + websiteUrl?: string; + /** + * The developer-defined unique id for the entity this content points to. + */ + entityId: string; + } + interface SaveEvent { + /** + * Notifies that the underlying resource has been created and the settings may be saved. + */ + notifySuccess(): void; + /** + * Notifies that the underlying resource creation failed and that the settings may not be saved. + * @param reason Specifies a reason for the failure. If provided, this string is displayed to the user. Otherwise a generic error is displayed. + */ + notifyFailure(reason?: string): void; + } + interface RemoveEvent { + /** + * Notifies that the underlying resource has been removed and the content may be removed. + */ + notifySuccess(): void; + /** + * Notifies that the underlying resource removal failed and that the content may not be removed. + * @param reason Specifies a reason for the failure. If provided, this string is displayed to the user. Otherwise a generic error is displayed. + */ + notifyFailure(reason?: string): void; + } + } + /** + * Namespace to interact with the authentication-specific part of the SDK. + * This object is used for starting or completing authentication flows. + */ + namespace authentication { + /** + * Initiates an authentication request which pops up a new windows with the specified settings. + * @param authenticateParameters A set of values that configure the authentication popup. + */ + function authenticate(authenticateParameters: AuthenticateParameters): void; + /** + * Requests an AAD token to be issued on behalf of the app. The token is acquired from the cache + * if it is not expired. Otherwise a request will be sent to AAD to obtain a new token. + * @param authTokenRequest A set of values that configure the token request. + */ + function getAuthToken(authTokenRequest: AuthTokenRequest): void; + /** + * Requests the decoded AAD user identity on behalf of the app. + */ + function getUser(userRequest: UserRequest): void; + /** + * Notifies the frame that initiated this authentication request that the request was successful. + * This function is only usable on the authentication window. + * This call causes the authentication window to be closed. + * @param result Specifies a result for the authentication. If specified, the frame which initiated the authentication popup will recieve this value in their callback. + */ + function notifySuccess(result?: string): void; + /** + * Notifies the frame that initiated this authentication request that the request failed. + * This function is only usable on the authentication window. + * This call causes the authentication window to be closed. + * @param reason Specifies a reason for the authentication failure. If specified, the frame which initiated the authentication popup will recieve this value in their callback. + */ + function notifyFailure(reason?: string): void; + interface AuthenticateParameters { + /** + * The url for the authentication popup + */ + url: string; + /** + * The preferred width for the popup. Note that this value may be ignored if outside the acceptable bounds. + */ + width?: number; + /** + * The preferred height for the popup. Note that this value may be ignored if outside the acceptable bounds. + */ + height?: number; + /** + * A function which is called if the authentication succeeds with the result returned from the authentication popup. + */ + successCallback?: (result?: string) => void; + /** + * A function which is called if the authentication fails with the reason for the failure returned from the authentication popup. + */ + failureCallback?: (reason?: string) => void; + } + interface AuthTokenRequest { + /** + * An array of resource URIs identifying the target resources for which the token should be requested. + */ + resources: string[]; + /** + * A function which is called if the token request succeeds with the resulting token. + */ + successCallback?: (token: string) => void; + /** + * A function which is called if the token request fails with the reason for the failure. + */ + failureCallback?: (reason: string) => void; + } + interface UserRequest { + /** + * A function which is called if the token request succeeds with the resulting token. + */ + successCallback?: (user: UserProfile) => void; + /** + * A function which is called if the token request fails with the reason for the failure. + */ + failureCallback?: (reason: string) => void; + } + interface UserProfile { + /** + * The intended recipient of the token. The application that receives the token must verify that the audience + * value is correct and reject any tokens intended for a different audience. + */ + aud: string; + /** + * Identifies how the subject of the token was authenticated. + */ + amr: string[]; + /** + * Stores the time at which the token was issued. It is often used to measure token freshness. + */ + iat: number; + /** + * Identifies the security token service (STS) that constructs and returns the token. In the tokens that Azure AD + * returns, the issuer is sts.windows.net. The GUID in the Issuer claim value is the tenant ID of the Azure AD + * directory. The tenant ID is an immutable and reliable identifier of the directory. + */ + iss: string; + /** + * Provides the last name, surname, or family name of the user as defined in the Azure AD user object. + */ + family_name: string; + /** + * Provides the first or "given" name of the user, as set on the Azure AD user object. + */ + given_name: string; + /** + * Provides a human readable value that identifies the subject of the token. This value is not guaranteed to + * be unique within a tenant and is designed to be used only for display purposes. + */ + unique_name: string; + /** + * Contains a unique identifier of an object in Azure AD. This value is immutable and cannot be reassigned or + * reused. Use the object ID to identify an object in queries to Azure AD. + */ + oid: string; + /** + * Identifies the principal about which the token asserts information, such as the user of an application. + * This value is immutable and cannot be reassigned or reused, so it can be used to perform authorization + * checks safely. Because the subject is always present in the tokens the Azure AD issues, we recommended + * using this value in a general purpose authorization system. + */ + sub: string; + /** + * An immutable, non-reusable identifier that identifies the directory tenant that issued the token. You can + * use this value to access tenant-specific directory resources in a multi-tenant application. For example, + * you can use this value to identify the tenant in a call to the Graph API. + */ + tid: string; + /** + * Defines the time interval within which a token is valid. The service that validates the token should verify + * that the current date is within the token lifetime, else it should reject the token. The service might allow + * for up to five minutes beyond the token lifetime range to account for any differences in clock time ("time + * skew") between Azure AD and the service. + */ + exp: number; + nbf: number; + /** + * Stores the user name of the user principal. + */ + upn: string; + /** + * Stores the version number of the token. + */ + ver: string; + } + } + interface Context { + /** + * The O365 group id for the team with which the content is associated. + * This field is only available when the identity permission is requested in the manifest. + */ + groupId?: string; + /** + * The Microsoft Teams id for the team with which the content is associated. + */ + teamId?: string; + /** + * The Microsoft Teams id for the channel with which the content is associated. + */ + channelId?: string; + /** + * The developer-defined unique id for the entity this content points to. + */ + entityId: string; + /** + * The developer-defined unique id for the sub-entity this content points to. + * This field should be used to restore to a specific state within an entity, for example scrolling to or activating a specific piece of content. + */ + subEntityId?: string; + /** + * The current locale that the user has configured for the app formatted as + * languageId-countryId (e.g. en-us). + */ + locale: string; + /** + * The current user's upn. + * As a malicious party can host content in a malicious browser, this value should only + * be used as a hint as to who the user is and never as proof of identity. + * This field is only available when the identity permission is requested in the manifest. + */ + upn?: string; + /** + * The current user's AAD tenant id. + * As a malicious party can host content in a malicious browser, this value should only + * be used as a hint as to who the user is and never as proof of identity. + * This field is only available when the identity permission is requested in the manifest. + */ + tid?: string; + /** + * The current UI theme the user is using. + */ + theme?: string; + } + interface DeepLinkParameters { + /** + * The developer-defined unique id for the sub-entity this deep link points to within the current entity. + * This field should be used to restore to a specific state within an entity, for example scrolling to or activating a specific piece of content. + */ + subEntityId: string; + /** + * The label for the sub-entity which should be displayed when the deep link is rendered in a client. + */ + subEntityLabel: string; + /** + * The fallback url to navigate the user to if there is no support for rendering the page inside the client. + * This url should lead directly to the sub-entity. + */ + subEntityWebUrl?: string; + } +} diff --git a/types/microsoftteams/microsoftteams-tests.ts b/types/microsoftteams/microsoftteams-tests.ts new file mode 100644 index 0000000000..727b8b6f66 --- /dev/null +++ b/types/microsoftteams/microsoftteams-tests.ts @@ -0,0 +1,36 @@ +// Microsoft Teams tests +// Project: https://github.com/OfficeDev/microsoft-teams-library-js + +/** + * Sample code for TypeChecking + * [Not an example] + */ +(() => { + microsoftTeams.getContext(context => { + const { upn, channelId } = context; + }); + + microsoftTeams.settings.getSettings(settings => { + const { contentUrl, entityId } = settings; + }); + + microsoftTeams.initialize(); + + microsoftTeams.navigateCrossDomain('https://bing.com'); + + microsoftTeams.registerOnThemeChangeHandler(theme => { + microsoftTeams.shareDeepLink({ + subEntityId: '', + subEntityLabel: theme, + subEntityWebUrl: '' + }); + }); + + microsoftTeams.authentication.authenticate({ + failureCallback: () => { }, + height: 200, + width: 200, + url: '', + successCallback: done => { } + }); +})(); diff --git a/types/microsoftteams/tsconfig.json b/types/microsoftteams/tsconfig.json new file mode 100644 index 0000000000..3b414b787b --- /dev/null +++ b/types/microsoftteams/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", + "microsoftteams-tests.ts" + ] +} \ No newline at end of file diff --git a/types/microsoftteams/tslint.json b/types/microsoftteams/tslint.json new file mode 100644 index 0000000000..30a1bdde2e --- /dev/null +++ b/types/microsoftteams/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file From 8ac5e5b4ecb93c70ce14eeec1baea412171f272f Mon Sep 17 00:00:00 2001 From: Leonard Thieu Date: Fri, 26 May 2017 20:06:57 -0400 Subject: [PATCH 153/529] 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 154/529] 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 5332c59958bcdf3220c211ce21530b12b7144dcc Mon Sep 17 00:00:00 2001 From: Geert Jansen Date: Mon, 29 May 2017 09:04:45 +0200 Subject: [PATCH 155/529] 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 c350fb666dacdcff9def2543c7d256ca8fc9905c Mon Sep 17 00:00:00 2001 From: Jeremi Stadler Date: Sun, 28 May 2017 14:30:26 +0200 Subject: [PATCH 156/529] [React-Native] Add global ErrorUtils & __BUNDLE_START_TIME__ Source: https://github.com/facebook/react-native/blob/master/packager/src/Resolver/polyfills/error-guard.js https://github.com/facebook/react-native/blob/master/packager/src/Resolver/polyfills/prelude.js --- types/react-native/index.d.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index 07f2dd1741..490c27dcff 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -8822,6 +8822,13 @@ export function processColor(color: any): number; export function __spread(target: any, ...sources: any[]): any; +type ErrorHandlerCallback = (error: any, isFatal?: boolean) => void; + +export interface ErrorUtils { + setGlobalHandler: (callback: ErrorHandlerCallback) => void; + getGlobalHandler: () => ErrorHandlerCallback; +} + export interface GlobalStatic { /** @@ -8842,6 +8849,9 @@ export interface GlobalStatic { */ originalXMLHttpRequest: Object; XMLHttpRequest: Object; + + __BUNDLE_START_TIME__: number; + ErrorUtils: ErrorUtils; } // From 72b17113979a5a2905cad123fee8349f3358a9bf Mon Sep 17 00:00:00 2001 From: Jeremi Stadler Date: Mon, 29 May 2017 11:34:18 +0200 Subject: [PATCH 157/529] [React-Navigation] Add TabBarTop & TabBarBottom types --- types/react-navigation/index.d.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/types/react-navigation/index.d.ts b/types/react-navigation/index.d.ts index ffa936f6d0..083139a165 100644 --- a/types/react-navigation/index.d.ts +++ b/types/react-navigation/index.d.ts @@ -621,3 +621,6 @@ export interface NavgationComponentProps { }, } } + +export const TabBarTop: React.ReactElement; +export const TabBarBottom: React.ReactElement; From f113c7a5e76e35076c93a808d96950146a6044b4 Mon Sep 17 00:00:00 2001 From: Jeremi Stadler Date: Mon, 29 May 2017 14:34:58 +0200 Subject: [PATCH 158/529] [React-Navigation] Add tabConfig tests Specifically to test the tabBarComponent property --- types/react-navigation/react-navigation-tests.tsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/types/react-navigation/react-navigation-tests.tsx b/types/react-navigation/react-navigation-tests.tsx index a88a5d3a0b..2493d92f84 100644 --- a/types/react-navigation/react-navigation-tests.tsx +++ b/types/react-navigation/react-navigation-tests.tsx @@ -3,7 +3,10 @@ import { View } from 'react-native'; import { addNavigationHelpers, StackNavigator, - TabNavigatorScreenOptions + TabNavigatorScreenOptions, + TabNavigatorConfig, + TabBarTop, + TabBarBottom, } from 'react-navigation'; const Start = ( @@ -34,5 +37,10 @@ const tabNavigatorScreenOptions: TabNavigatorScreenOptions = { title: 'title', tabBarVisible: true, tabBarIcon: , - tabBarLabel: 'label' + tabBarLabel: 'label', +} + +const tabNavigatorConfig: TabNavigatorConfig = { + lazy: true, + tabBarComponent: TabBarTop, } From 11e05d59480ddddd7bfe3370d5afe4feddb98e2f Mon Sep 17 00:00:00 2001 From: Jeremi Stadler Date: Mon, 29 May 2017 15:08:56 +0200 Subject: [PATCH 159/529] [React-Native] Add missing props for `Text` & `TextInput` https://facebook.github.io/react-native/docs/text.html#selectioncolor https://facebook.github.io/react-native/docs/text.html#textbreakstrategy https://facebook.github.io/react-native/docs/textinput.html#spellcheck --- types/react-native/index.d.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index 490c27dcff..135d6e7a4d 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -804,6 +804,17 @@ export interface TextPropertiesAndroid { * Lets the user select text, to use the native copy and paste functionality. */ selectable?: boolean + + /** + * The highlight color of the text. + */ + selectionColor?: string + + /** + * Set text break strategy on Android API Level 23+ + * default is `highQuality`. + */ + textBreakStrategy?: "simple" | "highQuality" | "balanced" } // https://facebook.github.io/react-native/docs/text.html#props @@ -993,7 +1004,10 @@ export interface TextInputIOSProperties { */ selectionState?: DocumentSelectionState - + /** + * If false, disables spell-check style (i.e. red underlines). The default value is inherited from autoCorrect + */ + spellCheck?: boolean } /** From 8a8bb937ea4ff4a70cf2ffe4ee49514d75f5d1e2 Mon Sep 17 00:00:00 2001 From: Jeremi Stadler Date: Mon, 29 May 2017 15:12:33 +0200 Subject: [PATCH 160/529] [React-Native] Add myself to maintainers list --- 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 135d6e7a4d..4db13a47e0 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for react-native 0.44 // Project: https://github.com/facebook/react-native -// Definitions by: Eloy Durán , Fedor Nezhivoi , HuHuanming +// Definitions by: Eloy Durán , Fedor Nezhivoi , HuHuanming , Jeremi Stadler // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 From 4e4890ccc88561afcd2064dab10195db58e65929 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Tue, 30 May 2017 00:53:43 -0700 Subject: [PATCH 161/529] Added tests for 'children' set to both elements and functions to elements in 'react-router'. --- types/react-router/test/Children.tsx | 22 ++++++++++++++++++++++ types/react-router/tsconfig.json | 1 + 2 files changed, 23 insertions(+) create mode 100644 types/react-router/test/Children.tsx diff --git a/types/react-router/test/Children.tsx b/types/react-router/test/Children.tsx new file mode 100644 index 0000000000..8e4faad089 --- /dev/null +++ b/types/react-router/test/Children.tsx @@ -0,0 +1,22 @@ +import * as React from 'react'; +import { Route } from 'react-router'; + +function RouteWithFunctionChildrenAttribute() { + return

Hello!
} /> +} + +function RouteWithFunctionJsxChildren() { + return + {() =>
Hello!
} +
+} + +function RouteWithElementChildrenAttribute() { + return Hello!} /> +} + +function RouteWithElementJsxChildren() { + return + {
Hello!
} +
+} \ No newline at end of file diff --git a/types/react-router/tsconfig.json b/types/react-router/tsconfig.json index df074843df..f3a225ece1 100644 --- a/types/react-router/tsconfig.json +++ b/types/react-router/tsconfig.json @@ -18,6 +18,7 @@ "test/Animation.tsx", "test/Auth.tsx", "test/Basic.tsx", + "test/Children.tsx", "test/CustomLink.tsx", "test/ModalGallery.tsx", "test/NavigateWithContext.tsx", From 65cfdaef9429d61b2d6a65581980946fdaac45eb Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Tue, 30 May 2017 01:01:22 -0700 Subject: [PATCH 162/529] Fixed the type of 'children' for 'Route' in 'react-router'. --- types/react-router/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-router/index.d.ts b/types/react-router/index.d.ts index d5bc7240c7..384cb2289e 100644 --- a/types/react-router/index.d.ts +++ b/types/react-router/index.d.ts @@ -65,7 +65,7 @@ export interface RouteProps { location?: H.Location; component?: React.SFC | undefined> | React.ComponentClass | undefined>; render?: ((props: RouteComponentProps) => React.ReactNode); - children?: ((props: RouteComponentProps) => React.ReactNode | React.ReactNode); + children?: ((props: RouteComponentProps) => React.ReactNode) | React.ReactNode; path?: string; exact?: boolean; strict?: boolean; From 3b8b7625b71efa6cfcd06787ef37c848a28fa508 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Tue, 30 May 2017 01:17:26 -0700 Subject: [PATCH 163/529] Lints. --- types/react-router/test/Children.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/types/react-router/test/Children.tsx b/types/react-router/test/Children.tsx index 8e4faad089..c3dea4f482 100644 --- a/types/react-router/test/Children.tsx +++ b/types/react-router/test/Children.tsx @@ -2,21 +2,21 @@ import * as React from 'react'; import { Route } from 'react-router'; function RouteWithFunctionChildrenAttribute() { - return
Hello!
} /> + return
Hello!
} />; } function RouteWithFunctionJsxChildren() { return {() =>
Hello!
} -
+
; } function RouteWithElementChildrenAttribute() { - return Hello!} /> + return Hello!} />; } function RouteWithElementJsxChildren() { return {
Hello!
} -
-} \ No newline at end of file +
; +} From 357b6211e56b080a06106f6f0856f75086068078 Mon Sep 17 00:00:00 2001 From: Nick Mertens Date: Tue, 30 May 2017 20:36:04 +1200 Subject: [PATCH 164/529] 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 165/529] [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 166/529] 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 2effdbca8c5eff888cd3dccba4124be1c9cfbffb Mon Sep 17 00:00:00 2001 From: dinzo Date: Tue, 30 May 2017 18:06:18 -0400 Subject: [PATCH 167/529] [React Native] Improved typings for FlatList and SectionList --- types/react-native/index.d.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index 4db13a47e0..2e22ad489b 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -3428,7 +3428,7 @@ export interface ViewabilityConfig { /** * @see https://facebook.github.io/react-native/docs/flatlist.html#props */ -export interface FlatListProperties { +export interface FlatListProperties extends ScrollViewProperties { /** * Rendered in between each item, but not at the top or bottom @@ -3436,14 +3436,14 @@ export interface FlatListProperties { ItemSeparatorComponent?: React.ComponentClass | null /** - * Rendered at the bottom of all the items. + * Rendered at the very end of the list. */ - ListFooterComponent?: React.ComponentClass | null + ListFooterComponent?: React.ComponentClass | (() => React.ReactElement) | null /** - * Rendered at the top of all the items. + * Rendered at the very beginning of the list. */ - ListHeaderComponent?: React.ComponentClass | null + ListHeaderComponent?: React.ComponentClass | (() => React.ReactElement) | null /** * Optional custom style for multi-item rows generated when numColumns > 1 @@ -3621,12 +3621,12 @@ export interface SectionListProperties extends ScrollViewProperties { /** * Rendered at the very end of the list. */ - ListFooterComponent?: React.ComponentClass | null + ListFooterComponent?: React.ComponentClass | (() => React.ReactElement) | null /** * Rendered at the very beginning of the list. */ - ListHeaderComponent?: React.ComponentClass | null + ListHeaderComponent?: React.ComponentClass | (() => React.ReactElement) | null /** * Rendered in between each section. From 5f2d685e7beacdff66692804471b7c5b9dff41d7 Mon Sep 17 00:00:00 2001 From: Herrington Darkholme Date: Wed, 31 May 2017 17:13:37 +0800 Subject: [PATCH 168/529] 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 169/529] 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 b8ddc2e70c708ec299919a1f9a63032067165551 Mon Sep 17 00:00:00 2001 From: huhuanming Date: Wed, 31 May 2017 23:43:29 +0800 Subject: [PATCH 170/529] Add react-native-video --- types/react-native-video/index.d.ts | 77 +++++++++++++++++++ .../react-native-video-tests.tsx | 26 +++++++ types/react-native-video/tsconfig.json | 24 ++++++ types/react-native-video/tslint.json | 3 + 4 files changed, 130 insertions(+) create mode 100644 types/react-native-video/index.d.ts create mode 100644 types/react-native-video/react-native-video-tests.tsx create mode 100644 types/react-native-video/tsconfig.json create mode 100644 types/react-native-video/tslint.json diff --git a/types/react-native-video/index.d.ts b/types/react-native-video/index.d.ts new file mode 100644 index 0000000000..72c3ea186d --- /dev/null +++ b/types/react-native-video/index.d.ts @@ -0,0 +1,77 @@ +// Type definitions for react-native-video 1.0 +// Project: https://github.com/react-native-community/react-native-video +// Definitions by: HuHuanming +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +import * as React from 'react'; +import { + ViewProperties +} from 'react-native'; + +export interface VideoProperties extends ViewProperties { + /* Native only */ + src?: any; + seek?: number; + fullscreen?: boolean; + onVideoLoadStart?(): void; + onVideoLoad?(): void; + onVideoBuffer?(): void; + onVideoError?(): void; + onVideoProgress?(): void; + onVideoSeek?(): void; + onVideoEnd?(): void; + onTimedMetadata?(): void; + onVideoFullscreenPlayerWillPresent?(): void; + onVideoFullscreenPlayerDidPresent?(): void; + onVideoFullscreenPlayerWillDismiss?(): void; + onVideoFullscreenPlayerDidDismiss?(): void; + + /* Wrapper component */ + // Opaque type returned by require('./video.mp4') + source: { uri?: string } | number; + resizeMode?: string; + poster?: string; + repeat?: boolean; + paused?: boolean; + muted?: boolean; + volume?: number; + rate?: number; + playInBackground?: boolean; + playWhenInactive?: boolean; + ignoreSilentSwitch?: 'ignore' | 'obey'; + disableFocus?: boolean; + controls?: boolean; + currentTime?: number; + progressUpdateInterval?: number; + onLoadStart?(): void; + onLoad?(): void; + onBuffer?(): void; + onError?(): void; + onProgress?(): void; + onSeek?(): void; + onEnd?(): void; + onFullscreenPlayerWillPresent?(): void; + onFullscreenPlayerDidPresent?(): void; + onFullscreenPlayerWillDismiss?(): void; + onFullscreenPlayerDidDismiss?(): void; + onReadyForDisplay?(): void; + onPlaybackStalled?(): void; + onPlaybackResume?(): void; + onPlaybackRateChange?(): void; + onAudioFocusChanged?(): void; + onAudioBecomingNoisy?(): void; + + /* Required by react-native */ + scaleX?: number; + scaleY?: number; + translateX?: number; + translateY?: number; + rotation?: number; +} + +export default class Video extends React.Component { + seek(time: number): void; + presentFullscreenPlayer(): void; + dismissFullscreenPlayer(): void; +} diff --git a/types/react-native-video/react-native-video-tests.tsx b/types/react-native-video/react-native-video-tests.tsx new file mode 100644 index 0000000000..bc240853f5 --- /dev/null +++ b/types/react-native-video/react-native-video-tests.tsx @@ -0,0 +1,26 @@ +import * as React from 'react'; +import { + StyleSheet, + Text, + View, + ViewStyle +} from 'react-native'; +import Video from 'react-native-video'; + +class SwiperTest extends React.Component<{}, {}> { + constructor(props: {}) { + super(props); + } + + render(): React.ReactElement { + return ( +