From 869f7f406ee84525ebd32ea6b9b059a5f36b4e26 Mon Sep 17 00:00:00 2001 From: Shchaurouski Sviataslau Date: Thu, 20 Apr 2017 17:02:38 +0300 Subject: [PATCH 0001/1072] 16023: creates second types folder for those, who uses npm package cookie_js --- types/cookie_js/cookie_js-tests.ts | 35 +++++++++++++++++++ types/cookie_js/index.d.ts | 55 ++++++++++++++++++++++++++++++ types/cookie_js/tsconfig.json | 22 ++++++++++++ 3 files changed, 112 insertions(+) create mode 100644 types/cookie_js/cookie_js-tests.ts create mode 100644 types/cookie_js/index.d.ts create mode 100644 types/cookie_js/tsconfig.json diff --git a/types/cookie_js/cookie_js-tests.ts b/types/cookie_js/cookie_js-tests.ts new file mode 100644 index 0000000000..43047f4fb6 --- /dev/null +++ b/types/cookie_js/cookie_js-tests.ts @@ -0,0 +1,35 @@ + + +// Based on https://github.com/js-coder/cookie.js/blob/gh-pages/tests/spec.js + +import cookie = require("cookiejs"); + +cookie.set({a: '1', b: '2', c: '3'}); + +cookie; +cookie.enabled(); + +cookie.set('n', '5'); + +cookie.get('a'); +cookie.get('__undef__'); +cookie.get('__undef__', 'fallback'); +cookie.get(['a', 'b']); +cookie.get(['a', '__undef__'], 'fallback'); + +cookie('a'); +cookie('__undef__'); +cookie('__undef__', 'fallback'); +cookie(['a', 'b']); +cookie(['a', '__undef__'], 'fallback'); + +cookie.remove('a'); +cookie.remove('a', 'b'); +cookie.remove(['a', 'b']); + +cookie.removeSpecific('a', {path: '/search'}); +cookie.removeSpecific(['a', 'b'], {path: '/search'}); + +cookie.empty(); + +cookie.all(); diff --git a/types/cookie_js/index.d.ts b/types/cookie_js/index.d.ts new file mode 100644 index 0000000000..6ccc9db401 --- /dev/null +++ b/types/cookie_js/index.d.ts @@ -0,0 +1,55 @@ +// Type definitions for cookie_js v1.2.2 +// Project: https://github.com/florian/cookie.js +// Definitions by: slawiko +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +/** + * Shortcut for cookie.get() + */ + +export = cookie; +export as namespace cookie; + +declare function cookie(key : string, fallback?: string) : string; +declare function cookie(keys : string[], fallback?: string) : string; + +declare namespace cookie { + /** + * Create a cookie. The value will automatically be escaped. + */ + export function set(key : string, value : string, options? : any) : void; + /** + * Set several cookies at once + */ + export function set(obj : any, options? : any) : void; + /** + * Remove cookies + */ + export function remove(key : string) : void; + export function remove(keys : string[]) : void; + export function remove(...args : string[]) : void; + /** + * Remove cookies that were set with custom options (e.g. specifing domain or path) + */ + export function removeSpecific(key : string, options?: any) : void; + export function removeSpecific(keys : string[], options?: any): void; + /** + * Remove all cookies + */ + export function empty() : void; + /** + * Retrieve the value of the cookie + */ + export function get(key : string, fallback?: string) : string; + /** + * Retrieve values of several cookies + */ + export function get(keys : string[], fallback?: string) : any; + /** + * Get all currently saved cookies + */ + export function all() : any; + /** + * Test if cookies are enabled + */ + export function enabled() : boolean; +} diff --git a/types/cookie_js/tsconfig.json b/types/cookie_js/tsconfig.json new file mode 100644 index 0000000000..98e46b222a --- /dev/null +++ b/types/cookie_js/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "cookie_js-tests.ts" + ] +} From 9585e94617f3d008ee697fc5d80ace194026f16e Mon Sep 17 00:00:00 2001 From: Shchaurouski Sviataslau Date: Thu, 20 Apr 2017 17:05:49 +0300 Subject: [PATCH 0002/1072] 16023: fixes wrong tsconfig and wrong import --- types/cookie_js/cookie_js-tests.ts | 2 +- types/cookie_js/tsconfig.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/types/cookie_js/cookie_js-tests.ts b/types/cookie_js/cookie_js-tests.ts index 43047f4fb6..7ae076dcfc 100644 --- a/types/cookie_js/cookie_js-tests.ts +++ b/types/cookie_js/cookie_js-tests.ts @@ -2,7 +2,7 @@ // Based on https://github.com/js-coder/cookie.js/blob/gh-pages/tests/spec.js -import cookie = require("cookiejs"); +import cookie = require("cookie_js"); cookie.set({a: '1', b: '2', c: '3'}); diff --git a/types/cookie_js/tsconfig.json b/types/cookie_js/tsconfig.json index 98e46b222a..146b1adc25 100644 --- a/types/cookie_js/tsconfig.json +++ b/types/cookie_js/tsconfig.json @@ -6,7 +6,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" From b4a563ee4040b602a5cf59582f58bd3f6e5412a6 Mon Sep 17 00:00:00 2001 From: slawiko Date: Thu, 20 Apr 2017 18:39:51 +0300 Subject: [PATCH 0003/1072] 16023: includes small refactoring --- types/cookie_js/cookie_js-tests.ts | 4 ---- types/cookie_js/index.d.ts | 3 --- 2 files changed, 7 deletions(-) diff --git a/types/cookie_js/cookie_js-tests.ts b/types/cookie_js/cookie_js-tests.ts index 7ae076dcfc..51a71f4bab 100644 --- a/types/cookie_js/cookie_js-tests.ts +++ b/types/cookie_js/cookie_js-tests.ts @@ -1,7 +1,3 @@ - - -// Based on https://github.com/js-coder/cookie.js/blob/gh-pages/tests/spec.js - import cookie = require("cookie_js"); cookie.set({a: '1', b: '2', c: '3'}); diff --git a/types/cookie_js/index.d.ts b/types/cookie_js/index.d.ts index 6ccc9db401..503557899d 100644 --- a/types/cookie_js/index.d.ts +++ b/types/cookie_js/index.d.ts @@ -2,9 +2,6 @@ // Project: https://github.com/florian/cookie.js // Definitions by: slawiko // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/** - * Shortcut for cookie.get() - */ export = cookie; export as namespace cookie; From 1cb14bc59fe8747e2687569fe84340ebcb26a1fa Mon Sep 17 00:00:00 2001 From: slawiko Date: Thu, 20 Apr 2017 19:02:30 +0300 Subject: [PATCH 0004/1072] 16023: removes deprecated package --- types/cookie_js/index.d.ts | 12 +++++-- types/cookiejs/cookiejs-tests.ts | 35 -------------------- types/cookiejs/index.d.ts | 55 -------------------------------- types/cookiejs/tsconfig.json | 22 ------------- 4 files changed, 10 insertions(+), 114 deletions(-) delete mode 100644 types/cookiejs/cookiejs-tests.ts delete mode 100644 types/cookiejs/index.d.ts delete mode 100644 types/cookiejs/tsconfig.json diff --git a/types/cookie_js/index.d.ts b/types/cookie_js/index.d.ts index 503557899d..6e5a0813b6 100644 --- a/types/cookie_js/index.d.ts +++ b/types/cookie_js/index.d.ts @@ -3,8 +3,16 @@ // Definitions by: slawiko // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -export = cookie; -export as namespace cookie; +declare module 'cookie_js' { + export = cookie; +} + +/** + * https://github.com/DefinitelyTyped/DefinitelyTyped/pull/16025#issuecomment-295784660 + */ +declare module 'cookiejs' { + export = cookie; +} declare function cookie(key : string, fallback?: string) : string; declare function cookie(keys : string[], fallback?: string) : string; diff --git a/types/cookiejs/cookiejs-tests.ts b/types/cookiejs/cookiejs-tests.ts deleted file mode 100644 index 43047f4fb6..0000000000 --- a/types/cookiejs/cookiejs-tests.ts +++ /dev/null @@ -1,35 +0,0 @@ - - -// Based on https://github.com/js-coder/cookie.js/blob/gh-pages/tests/spec.js - -import cookie = require("cookiejs"); - -cookie.set({a: '1', b: '2', c: '3'}); - -cookie; -cookie.enabled(); - -cookie.set('n', '5'); - -cookie.get('a'); -cookie.get('__undef__'); -cookie.get('__undef__', 'fallback'); -cookie.get(['a', 'b']); -cookie.get(['a', '__undef__'], 'fallback'); - -cookie('a'); -cookie('__undef__'); -cookie('__undef__', 'fallback'); -cookie(['a', 'b']); -cookie(['a', '__undef__'], 'fallback'); - -cookie.remove('a'); -cookie.remove('a', 'b'); -cookie.remove(['a', 'b']); - -cookie.removeSpecific('a', {path: '/search'}); -cookie.removeSpecific(['a', 'b'], {path: '/search'}); - -cookie.empty(); - -cookie.all(); diff --git a/types/cookiejs/index.d.ts b/types/cookiejs/index.d.ts deleted file mode 100644 index ad769bcb0e..0000000000 --- a/types/cookiejs/index.d.ts +++ /dev/null @@ -1,55 +0,0 @@ -// Type definitions for cookie.js v1.2.2 -// Project: https://github.com/florian/cookie.js -// Definitions by: Boltmade -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/** - * Shortcut for cookie.get() - */ - -export = cookie; -export as namespace cookie; - -declare function cookie(key : string, fallback?: string) : string; -declare function cookie(keys : string[], fallback?: string) : string; - -declare namespace cookie { - /** - * Create a cookie. The value will automatically be escaped. - */ - export function set(key : string, value : string, options? : any) : void; - /** - * Set several cookies at once - */ - export function set(obj : any, options? : any) : void; - /** - * Remove cookies - */ - export function remove(key : string) : void; - export function remove(keys : string[]) : void; - export function remove(...args : string[]) : void; - /** - * Remove cookies that were set with custom options (e.g. specifing domain or path) - */ - export function removeSpecific(key : string, options?: any) : void; - export function removeSpecific(keys : string[], options?: any): void; - /** - * Remove all cookies - */ - export function empty() : void; - /** - * Retrieve the value of the cookie - */ - export function get(key : string, fallback?: string) : string; - /** - * Retrieve values of several cookies - */ - export function get(keys : string[], fallback?: string) : any; - /** - * Get all currently saved cookies - */ - export function all() : any; - /** - * Test if cookies are enabled - */ - export function enabled() : boolean; -} diff --git a/types/cookiejs/tsconfig.json b/types/cookiejs/tsconfig.json deleted file mode 100644 index 310990fba6..0000000000 --- a/types/cookiejs/tsconfig.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "cookiejs-tests.ts" - ] -} \ No newline at end of file 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 0005/1072] 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 0006/1072] 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 0007/1072] (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 0008/1072] =?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 0009/1072] 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 0010/1072] 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 ca7130dfb120b8db9edcbf29979fd3133e24ff70 Mon Sep 17 00:00:00 2001 From: Jan Wolf Date: Sun, 23 Apr 2017 22:39:49 +0200 Subject: [PATCH 0011/1072] no message --- types/ably/auto-sni/auto-sni-tests.ts | 4 ++++ types/ably/auto-sni/index.d.ts | 10 ++++++++++ types/ably/auto-sni/tsconfig.json | 22 ++++++++++++++++++++++ types/ably/auto-sni/tslint.json | 3 +++ 4 files changed, 39 insertions(+) create mode 100644 types/ably/auto-sni/auto-sni-tests.ts create mode 100644 types/ably/auto-sni/index.d.ts create mode 100644 types/ably/auto-sni/tsconfig.json create mode 100644 types/ably/auto-sni/tslint.json diff --git a/types/ably/auto-sni/auto-sni-tests.ts b/types/ably/auto-sni/auto-sni-tests.ts new file mode 100644 index 0000000000..6dbf962ec4 --- /dev/null +++ b/types/ably/auto-sni/auto-sni-tests.ts @@ -0,0 +1,4 @@ +import * as autosni from "auto-sni"; +let a = autosni({ + test: 0 +}); diff --git a/types/ably/auto-sni/index.d.ts b/types/ably/auto-sni/index.d.ts new file mode 100644 index 0000000000..3d679e303e --- /dev/null +++ b/types/ably/auto-sni/index.d.ts @@ -0,0 +1,10 @@ +// Type definitions for auto-sni v2.1.1 +// Project: https://www.npmjs.com/package/auto-sni +// Definitions by: Jan Wolf +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare namespace createServer { + +} +declare function createServer(opts: any, app?: any): any; +export = createServer; diff --git a/types/ably/auto-sni/tsconfig.json b/types/ably/auto-sni/tsconfig.json new file mode 100644 index 0000000000..715f315867 --- /dev/null +++ b/types/ably/auto-sni/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", + "auto-sni-tests.ts" + ] +} diff --git a/types/ably/auto-sni/tslint.json b/types/ably/auto-sni/tslint.json new file mode 100644 index 0000000000..d88586e5bd --- /dev/null +++ b/types/ably/auto-sni/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} 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 0012/1072] 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 0013/1072] 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 0014/1072] 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 0015/1072] 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 408fb4d5aa31e6ffa9de83ee7272b841e95de1ed Mon Sep 17 00:00:00 2001 From: Jan Wolf Date: Tue, 25 Apr 2017 18:41:16 +0200 Subject: [PATCH 0016/1072] Added more specific types --- types/{ably => }/auto-sni/auto-sni-tests.ts | 4 +++- types/{ably => }/auto-sni/index.d.ts | 17 ++++++++++++++++- types/{ably => }/auto-sni/tsconfig.json | 0 types/{ably => }/auto-sni/tslint.json | 0 4 files changed, 19 insertions(+), 2 deletions(-) rename types/{ably => }/auto-sni/auto-sni-tests.ts (57%) rename types/{ably => }/auto-sni/index.d.ts (51%) rename types/{ably => }/auto-sni/tsconfig.json (100%) rename types/{ably => }/auto-sni/tslint.json (100%) diff --git a/types/ably/auto-sni/auto-sni-tests.ts b/types/auto-sni/auto-sni-tests.ts similarity index 57% rename from types/ably/auto-sni/auto-sni-tests.ts rename to types/auto-sni/auto-sni-tests.ts index 6dbf962ec4..a271a1a1ad 100644 --- a/types/ably/auto-sni/auto-sni-tests.ts +++ b/types/auto-sni/auto-sni-tests.ts @@ -1,4 +1,6 @@ import * as autosni from "auto-sni"; let a = autosni({ - test: 0 + agreeTos: true, + email: '', + domains: [''] }); diff --git a/types/ably/auto-sni/index.d.ts b/types/auto-sni/index.d.ts similarity index 51% rename from types/ably/auto-sni/index.d.ts rename to types/auto-sni/index.d.ts index 3d679e303e..075f093f0b 100644 --- a/types/ably/auto-sni/index.d.ts +++ b/types/auto-sni/index.d.ts @@ -3,8 +3,23 @@ // Definitions by: Jan Wolf // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +/// + +import {Server} from "https"; + declare namespace createServer { } -declare function createServer(opts: any, app?: any): any; + +declare function createServer(opts: { + email: string, + agreeTos: boolean, + domains: Array, + ports?: { + http?: number, + https?: number + }, + debug?: boolean +}, app?: any): Server; + export = createServer; diff --git a/types/ably/auto-sni/tsconfig.json b/types/auto-sni/tsconfig.json similarity index 100% rename from types/ably/auto-sni/tsconfig.json rename to types/auto-sni/tsconfig.json diff --git a/types/ably/auto-sni/tslint.json b/types/auto-sni/tslint.json similarity index 100% rename from types/ably/auto-sni/tslint.json rename to types/auto-sni/tslint.json From 4b2e86f8b532432648ce6d64a9abbad531ef12d5 Mon Sep 17 00:00:00 2001 From: Larry Bahr Date: Tue, 25 Apr 2017 15:14:13 -0500 Subject: [PATCH 0017/1072] Added hasPermission Method to PushNotificationStatic Added hasPermission Method to PushNotificationStatic. Removed new key in PushNotificationStatic because it is no longer supported. Added ; where needed --- types/phonegap-plugin-push/index.d.ts | 121 ++++++++++++++------------ 1 file changed, 67 insertions(+), 54 deletions(-) diff --git a/types/phonegap-plugin-push/index.d.ts b/types/phonegap-plugin-push/index.d.ts index 01280759a0..ffe8f21f02 100644 --- a/types/phonegap-plugin-push/index.d.ts +++ b/types/phonegap-plugin-push/index.d.ts @@ -1,10 +1,10 @@ // Type definitions for phonegap-plugin-push // Project: https://github.com/phonegap/phonegap-plugin-push -// Definitions by: Frederico Galvão +// Definitions by: Frederico Galvão , Larry Bahr // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace PhonegapPluginPush { - type EventResponse = RegistrationEventResponse | NotificationEventResponse | Error + type EventResponse = RegistrationEventResponse | NotificationEventResponse | Error; interface PushNotification { /** @@ -12,19 +12,19 @@ declare namespace PhonegapPluginPush { * @param event * @param callback */ - on(event: "registration", callback: (response: RegistrationEventResponse) => any): void + on(event: "registration", callback: (response: RegistrationEventResponse) => any): void; /** * The event notification will be triggered each time a push notification is received by a 3rd party push service on the device. * @param event * @param callback */ - on(event: "notification", callback: (response: NotificationEventResponse) => any): void + on(event: "notification", callback: (response: NotificationEventResponse) => any): void; /** * The event error will trigger when an internal error occurs and the cache is aborted. * @param event * @param callback */ - on(event: "error", callback: (response: Error) => any): void + on(event: "error", callback: (response: Error) => any): void; /** * * @param event Name of the event to listen to. See below(above) for all the event names. @@ -32,11 +32,11 @@ declare namespace PhonegapPluginPush { * @param event * @param callback */ - on(event: string, callback: (response: EventResponse) => any): void + on(event: string, callback: (response: EventResponse) => any): void; - off(event: "registration", callback: (response: RegistrationEventResponse) => any): void - off(event: "notification", callback: (response: NotificationEventResponse) => any): void - off(event: "error", callback: (response: Error) => any): void + off(event: "registration", callback: (response: RegistrationEventResponse) => any): void; + off(event: "notification", callback: (response: NotificationEventResponse) => any): void; + off(event: "error", callback: (response: Error) => any): void; /** * As stated in the example, you will have to store your event handler if you are planning to remove it. * @param event Name of the event type. The possible event names are the same as for the push.on function. @@ -44,7 +44,7 @@ declare namespace PhonegapPluginPush { * @param event * @param callback */ - off(event: string, callback: (response: EventResponse) => any): void + off(event: string, callback: (response: EventResponse) => any): void; /** * The unregister method is used when the application no longer wants to receive push notifications. @@ -54,7 +54,7 @@ declare namespace PhonegapPluginPush { * @param errorHandler * @param topics */ - unregister(successHandler: () => any, errorHandler?: () => any, topics?: string[]): void + unregister(successHandler: () => any, errorHandler?: () => any, topics?: string[]): void; /** * The subscribe method is used when the application wants to subscribe a new topic to receive push notifications. @@ -84,7 +84,7 @@ declare namespace PhonegapPluginPush { * @param errorHandler * @param count */ - setApplicationIconBadgeNumber(successHandler: () => any, errorHandler: () => any, count: number): void + setApplicationIconBadgeNumber(successHandler: () => any, errorHandler: () => any, count: number): void; /** * Get the current badge count visible when the app is not running @@ -92,7 +92,7 @@ declare namespace PhonegapPluginPush { * @param successHandler * @param errorHandler */ - getApplicationIconBadgeNumber(successHandler: (count: number) => any, errorHandler: () => any): void + getApplicationIconBadgeNumber(successHandler: (count: number) => any, errorHandler: () => any): void; /** * iOS only @@ -102,7 +102,7 @@ declare namespace PhonegapPluginPush { * @param errorHandler * @param id */ - finish(successHandler?: () => any, errorHandler?: () => any, id?: string): void + finish(successHandler?: () => any, errorHandler?: () => any, id?: string): void; } /** @@ -116,36 +116,36 @@ declare namespace PhonegapPluginPush { /** * Maps to the project number in the Google Developer Console. */ - senderID: string + senderID: string; /** * The name of a drawable resource to use as the small-icon. The name should not include the extension. */ - icon?: string + icon?: string; /** * Sets the background color of the small icon on Android 5.0 and greater. * Supported Formats - http://developer.android.com/reference/android/graphics/Color.html#parseColor(java.lang.String) */ - iconColor?: string + iconColor?: string; /** * If true it plays the sound specified in the push data or the default system sound. Default is true. */ - sound?: boolean + sound?: boolean; /** * If true the device vibrates on receipt of notification. Default is true. */ - vibrate?: boolean + vibrate?: boolean; /** * If true the app clears all pending notifications when it is closed. Default is true. */ - clearNotifications?: boolean + clearNotifications?: boolean; /** * If true will always show a notification, even when the app is on the foreground. Default is false. */ - forceShow?: boolean + forceShow?: boolean; /** * If the array contains one or more strings each string will be used to subscribe to a GcmPubSub topic. */ - topics?: string[] + topics?: string[]; } /** @@ -159,7 +159,7 @@ declare namespace PhonegapPluginPush { * Once this is set programmatically in the init method it can only be changed manually by the user in Settings>Notifications>App Name. * This is normal iOS behaviour. */ - badge?: boolean | string + badge?: boolean | string; /** * If true|"true" the device plays a sound on receipt of notification. * Default is false|"false". @@ -167,7 +167,7 @@ declare namespace PhonegapPluginPush { * Once this is set programmatically in the init method it can only be changed manually by the user in Settings>Notifications>App Name. * This is normal iOS behaviour. */ - sound?: boolean | string + sound?: boolean | string; /** * If true|"true" the device shows an alert on receipt of notification. * Default is false|"false". @@ -175,28 +175,28 @@ declare namespace PhonegapPluginPush { * Once this is set programmatically in the init method it can only be changed manually by the user in Settings>Notifications>App Name. * This is normal iOS behaviour. */ - alert?: boolean | string + alert?: boolean | string; /** * If true|"true" the badge will be cleared on app startup. Default is false|"false". */ - clearBadge?: boolean | string + clearBadge?: boolean | string; /** * The data required in order to enable Action Buttons for iOS. * Action Buttons on iOS - https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/PAYLOAD.md#action-buttons-1 */ - categories?: CategoryArray + categories?: CategoryArray; /** * Maps to the project number in the Google Developer Console. Setting this uses GCM for notifications instead of native */ - senderID?: string + senderID?: string; /** * Whether to use prod or sandbox GCM setting. Defaults to false. */ - gcmSandbox?: boolean + gcmSandbox?: boolean; /** * If the array contains one or more strings each string will be used to subscribe to a GcmPubSub topic. Note: only usable in conjunction with senderID */ - topics?: string[] + topics?: string[]; } /** @@ -208,55 +208,59 @@ declare namespace PhonegapPluginPush { } interface CategoryArray { - [name: string]: CategoryAction + [name: string]: CategoryAction; } interface CategoryAction { - yes?: CategoryActionData - no?: CategoryActionData - maybe?: CategoryActionData + yes?: CategoryActionData; + no?: CategoryActionData; + maybe?: CategoryActionData; } interface CategoryActionData { - callback: string - title: string - foreground: boolean - destructive: boolean + callback: string; + title: string; + foreground: boolean; + destructive: boolean; + } + + interface HasPermissionCallbackParameters { + isEnabled: boolean; /** Whether the permission for push notifications has been granted. */ } interface RegistrationEventResponse { /** * The registration ID provided by the 3rd party remote push service. */ - registrationId: string + registrationId: string; } interface NotificationEventResponse { /** * The text of the push message sent from the 3rd party service. */ - message: string + message: string; /** * The optional title of the push message sent from the 3rd party service. */ - title?: string + title?: string; /** * The number of messages to be displayed in the badge iOS or message count in the notification shade in Android. * For windows, it represents the value in the badge notification which could be a number or a status glyph. */ - count: string + count: string; /** * The name of the sound file to be played upon receipt of the notification. */ - sound: string + sound: string; /** * The path of the image file to be displayed in the notification. */ - image: string + image: string; /** * An optional collection of data sent by the 3rd party push service that does not fit in the above properties. */ - additionalData: NotificationEventAdditionalData + additionalData: NotificationEventAdditionalData; } /** @@ -268,28 +272,37 @@ declare namespace PhonegapPluginPush { * so that he could specify any custom code without having to use array notation (map['prop']) for all of them. */ interface NotificationEventAdditionalData { - [name: string]: any + [name: string]: any; /** * Whether the notification was received while the app was in the foreground */ - foreground?: boolean + foreground?: boolean; /** * Will be true if the application is started by clicking on the push notification, false if the app is already started. (Android/iOS only) */ - coldstart?: boolean - collapse_key?: string - from?: string - notId?: string + coldstart?: boolean; + collapse_key?: string; + from?: string; + notId?: string; } interface PushNotificationStatic { - init(options: InitOptions): PushNotification - new (options: InitOptions): PushNotification + init(options: InitOptions): PushNotification; + + /** + * Android & iOS only + * Checks whether the push notification permission has been granted. + * @param successHandler - Is called when the api successfully retrieves the details on the permission. + * @param errorHandler + * @param id + */ + hasPermission(successhandler: (data: HasPermissionCallbackParameters) => any): void; } } interface Window { - PushNotification: PhonegapPluginPush.PushNotificationStatic + PushNotification: PhonegapPluginPush.PushNotificationStatic; } + declare var PushNotification: PhonegapPluginPush.PushNotificationStatic; From 28861b3603d67c5f05b05575cda8a5f1481d7665 Mon Sep 17 00:00:00 2001 From: Larry Bahr Date: Tue, 25 Apr 2017 15:32:19 -0500 Subject: [PATCH 0018/1072] Updated test Updated test --- .../phonegap-plugin-push-tests.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/types/phonegap-plugin-push/phonegap-plugin-push-tests.ts b/types/phonegap-plugin-push/phonegap-plugin-push-tests.ts index 93c4249f8b..81a35e8774 100644 --- a/types/phonegap-plugin-push/phonegap-plugin-push-tests.ts +++ b/types/phonegap-plugin-push/phonegap-plugin-push-tests.ts @@ -56,10 +56,6 @@ function test() { let push: PhonegapPluginPush.PushNotification; - /*from constructor*/ - push = new PushNotification(options); - push = new window.PushNotification(options); - push.unregister(() => { console.log('did unregister'); }, () => { @@ -69,6 +65,13 @@ function test() { /*from init*/ push = PushNotification.init(options); push = window.PushNotification.init(options); + + /*hasPermission test*/ + PushNotification.hasPermission(function(data) { + if (data.isEnabled) { + console.log('isEnabled'); + } + }); let registrationHandler = (data: PhonegapPluginPush.RegistrationEventResponse) => { console.log(data.registrationId); From eb6f248a2aa2719b52be7bec4bb57b8111704293 Mon Sep 17 00:00:00 2001 From: Giedrius Grabauskas Date: Thu, 27 Apr 2017 16:37:58 +0300 Subject: [PATCH 0019/1072] Created tslint.json for react-scroll. Recreated react-scroll types. --- types/react-scroll/index.d.ts | 70 +-------- .../modules/components/Button.d.ts | 6 + .../modules/components/Element.d.ts | 8 + .../react-scroll/modules/components/Link.d.ts | 22 +++ types/react-scroll/modules/index.d.ts | 14 ++ .../react-scroll/modules/mixins/Helpers.d.ts | 4 + .../modules/mixins/animate-scroll.d.ts | 6 + .../modules/mixins/scroll-events.d.ts | 11 ++ .../modules/mixins/scroll-spy.d.ts | 17 +++ .../react-scroll/modules/mixins/scroller.d.ts | 7 + types/react-scroll/react-scroll-tests.tsx | 7 - .../react-scroll/test/react-scroll-tests.tsx | 138 ++++++++++++++++++ types/react-scroll/tsconfig.json | 16 +- types/react-scroll/tslint.json | 1 + 14 files changed, 252 insertions(+), 75 deletions(-) create mode 100644 types/react-scroll/modules/components/Button.d.ts create mode 100644 types/react-scroll/modules/components/Element.d.ts create mode 100644 types/react-scroll/modules/components/Link.d.ts create mode 100644 types/react-scroll/modules/index.d.ts create mode 100644 types/react-scroll/modules/mixins/Helpers.d.ts create mode 100644 types/react-scroll/modules/mixins/animate-scroll.d.ts create mode 100644 types/react-scroll/modules/mixins/scroll-events.d.ts create mode 100644 types/react-scroll/modules/mixins/scroll-spy.d.ts create mode 100644 types/react-scroll/modules/mixins/scroller.d.ts delete mode 100644 types/react-scroll/react-scroll-tests.tsx create mode 100644 types/react-scroll/test/react-scroll-tests.tsx create mode 100644 types/react-scroll/tslint.json diff --git a/types/react-scroll/index.d.ts b/types/react-scroll/index.d.ts index 1f31f5f4c3..f4e6aa45d7 100644 --- a/types/react-scroll/index.d.ts +++ b/types/react-scroll/index.d.ts @@ -1,67 +1,9 @@ -// Type definitions for react-scroll +// Type definitions for react-scroll 1.5 // Project: https://github.com/fisshy/react-scroll -// Definitions by: Ioannis Kokkinidis +// Definitions by: Ioannis Kokkinidis +// Giedrius Grabauskas // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.1 +// TypeScript Version: 2.2 -import * as React from 'react'; - -interface Link extends React.ClassicComponentClass { } -interface Element extends React.ClassicComponentClass { } -interface Button extends React.ClassicComponentClass {} -interface DirectLink extends React.ClassicComponentClass {} - -interface scrollEvnt { - register(evtName: string, callback: Function): void, - remove(evtName: string): void -} - -interface Events { - scrollEvent: scrollEvnt -} - -interface scroller { - scrollTo(to: any, animate?: any, duration?: any, offset?: any): void -} - -interface scrollSpy { - update() : void -} - -interface animateScroll { - scrollToTop(options?: any) : void, - scrollToBottom(options?: any) : void, - scrollTo(toY: number, options?: any) : void, - scrollMore(toY: number, options?: any) : void, -} - -interface directScroller { - get() : any -} - -interface Helpers { -} - -declare const Link: Link; -declare const Element: Element; -declare const Events: Events; -declare const scroller: scroller; -declare const DirectLink: DirectLink; -declare const Button: Button; -declare const scrollSpy: scrollSpy; -declare const directScroller: directScroller; -declare const Helpers: Helpers; -declare const animateScroll: animateScroll; - -export { - Link, - Element, - Events, - scroller, - scrollSpy, - directScroller, - DirectLink, - Button, - Helpers, - animateScroll -} +import * as ReactScroll from "./modules/index"; +export = ReactScroll; diff --git a/types/react-scroll/modules/components/Button.d.ts b/types/react-scroll/modules/components/Button.d.ts new file mode 100644 index 0000000000..831ccfb49a --- /dev/null +++ b/types/react-scroll/modules/components/Button.d.ts @@ -0,0 +1,6 @@ +import * as React from "react"; +import { ReactScrollLinkProps } from "./Link"; + +export type ButtonProps = ReactScrollLinkProps & React.HTMLProps; + +export default class Button extends React.Component { } diff --git a/types/react-scroll/modules/components/Element.d.ts b/types/react-scroll/modules/components/Element.d.ts new file mode 100644 index 0000000000..53dae7ef66 --- /dev/null +++ b/types/react-scroll/modules/components/Element.d.ts @@ -0,0 +1,8 @@ +import * as React from "react"; + +export interface ElementProps extends React.HTMLProps { + name: string; + id?: string; +} + +export default class Element extends React.Component { } diff --git a/types/react-scroll/modules/components/Link.d.ts b/types/react-scroll/modules/components/Link.d.ts new file mode 100644 index 0000000000..a1333c35ca --- /dev/null +++ b/types/react-scroll/modules/components/Link.d.ts @@ -0,0 +1,22 @@ +import * as React from "react"; + +export interface ReactScrollLinkProps { + to: string; + containerId?: string; + activeClass?: string; + spy?: boolean; + smooth?: boolean | string; + offset?: number; + delay?: number; + isDynamic?: boolean; + onClick?(): void; + duration?: number | string; + absolute?: boolean; + onSetActive?(to: string): void; + onSetInactive?(): void; + ignoreCancelEvents?: boolean; +} + +export type LinkProps = ReactScrollLinkProps & React.HTMLProps; + +export default class Link extends React.Component { } diff --git a/types/react-scroll/modules/index.d.ts b/types/react-scroll/modules/index.d.ts new file mode 100644 index 0000000000..cf8aa4f454 --- /dev/null +++ b/types/react-scroll/modules/index.d.ts @@ -0,0 +1,14 @@ +export { default as Button } from "./components/Button"; +export { default as Element } from "./components/Element"; +export { default as Link } from "./components/Link"; +export { Helpers } from "./mixins/Helpers"; +export { default as Events } from "./mixins/scroll-events"; +export { default as scrollSpy } from "./mixins/scroll-spy"; + +import * as scroller from "./mixins/scroller"; +import * as animateScroll from "./mixins/animate-scroll"; + +export { + animateScroll, + scroller +}; diff --git a/types/react-scroll/modules/mixins/Helpers.d.ts b/types/react-scroll/modules/mixins/Helpers.d.ts new file mode 100644 index 0000000000..a32adf2954 --- /dev/null +++ b/types/react-scroll/modules/mixins/Helpers.d.ts @@ -0,0 +1,4 @@ +export namespace Helpers { + function Scroll(component: any, customScroller?: any): any; + function Element(component: any): any; +} diff --git a/types/react-scroll/modules/mixins/animate-scroll.d.ts b/types/react-scroll/modules/mixins/animate-scroll.d.ts new file mode 100644 index 0000000000..049e961e96 --- /dev/null +++ b/types/react-scroll/modules/mixins/animate-scroll.d.ts @@ -0,0 +1,6 @@ +export function animateTopScroll(y: number, options: any, to: string, target: any): void; +export function getAnimationType(options: { smooth: boolean | string }): (x: number) => number; +export function scrollToTop(options?: any): void; +export function scrollToBottom(options?: any): void; +export function scrollTo(toY: number, options?: any): void; +export function scrollMore(toY: number, options?: any): void; diff --git a/types/react-scroll/modules/mixins/scroll-events.d.ts b/types/react-scroll/modules/mixins/scroll-events.d.ts new file mode 100644 index 0000000000..e52a22ae1a --- /dev/null +++ b/types/react-scroll/modules/mixins/scroll-events.d.ts @@ -0,0 +1,11 @@ +declare namespace Events { + interface ScrollEvent { + register(eventName: string, callback: (to: string, element: any) => void): void; + remove(eventName: string): void; + } + + const registered: {}; + const scrollEvent: ScrollEvent; +} + +export default Events; diff --git a/types/react-scroll/modules/mixins/scroll-spy.d.ts b/types/react-scroll/modules/mixins/scroll-spy.d.ts new file mode 100644 index 0000000000..2e738744f2 --- /dev/null +++ b/types/react-scroll/modules/mixins/scroll-spy.d.ts @@ -0,0 +1,17 @@ +interface ScrollSpy { + update(): void; + unmount(stateHandler: any, spyHandler: any): void; + updateStates(): void; + addSpyHandler(handler: any, scrollSpyContainer: any): void; + addStateHandler(handler: any): void; + scrollHandler(scrollSpyContainer: any): void; + currentPositionY(scrollSpyContainer: any): number; + isMounted(scrollSpyContainer: any): boolean; + mount(scrollSpyContainer: any): void; + spyCallbacks: any[]; + spySetState: any[]; + scrollSpyContainers: any[]; +} + +declare const scrollSpy: ScrollSpy; +export default scrollSpy; diff --git a/types/react-scroll/modules/mixins/scroller.d.ts b/types/react-scroll/modules/mixins/scroller.d.ts new file mode 100644 index 0000000000..a729070a96 --- /dev/null +++ b/types/react-scroll/modules/mixins/scroller.d.ts @@ -0,0 +1,7 @@ +export function unmount(): void; +export function register(name: string, element: any): void; +export function unregister(name: string): void; +export function get(name: string): any; +export function setActiveLink(link: string): void; +export function getActiveLink(): string; +export function scrollTo(to: string, props: any): void; diff --git a/types/react-scroll/react-scroll-tests.tsx b/types/react-scroll/react-scroll-tests.tsx deleted file mode 100644 index 63db573722..0000000000 --- a/types/react-scroll/react-scroll-tests.tsx +++ /dev/null @@ -1,7 +0,0 @@ -import * as React from 'react'; -import { Link, Element, scroller } from 'react-scroll'; - -let link = ; -let element = ; - -scroller.scrollTo("test"); \ No newline at end of file diff --git a/types/react-scroll/test/react-scroll-tests.tsx b/types/react-scroll/test/react-scroll-tests.tsx new file mode 100644 index 0000000000..f341b4d241 --- /dev/null +++ b/types/react-scroll/test/react-scroll-tests.tsx @@ -0,0 +1,138 @@ +import * as React from "react"; +import { Link, Button, animateScroll, Helpers, Events, Element, scrollSpy, scroller } from "react-scroll"; + +Events.scrollEvent.register('begin', (to, element) => { + console.log("begin"); +}); + +Events.scrollEvent.register('end', (to, element) => { + console.log("end"); +}); + +scrollSpy.update(); + +Events.scrollEvent.remove('begin'); +Events.scrollEvent.remove('end'); + +const smothOptions = { + a: "", + smooth: false +}; +animateScroll.getAnimationType(smothOptions); +animateScroll.scrollToTop(); +animateScroll.scrollTo(100); +animateScroll.scrollMore(100); + +const linkTest1 = { console.log(to); }} +> + Test 1 +; + +const LinkTest2 = + Test 2 (delay) +; + +const linkTest3 = + Test 6 (anchor) +; + +const buttonTest = ; + +const elementTest = + test 1 +; + +const linkTest4 = + Go to first element inside container +; + +const linkTest5 = { console.log(to); }} + onSetInactive={() => { }} + ignoreCancelEvents={false} +> + Your name +; + +const options = {} as any; +animateScroll.scrollToTop(options); +animateScroll.scrollToBottom(options); +animateScroll.scrollTo(100, options); + +scroller.scrollTo('myScrollToElement', { + duration: 1500, + delay: 100, + smooth: true, + containerId: 'ContainerElementID' +}); + +animateScroll.scrollMore(10, options); + +Events.scrollEvent.register('begin', (to, element) => { + console.log("begin", to, element); +}); + +Events.scrollEvent.register('end', (to, element) => { + console.log("end", to, element); +}); + +Events.scrollEvent.remove('begin'); +Events.scrollEvent.remove('end'); + +class CustomComponent extends React.Component<{}, {}> { + render() { + return
+ {this.props.children} +
; + } +} + +const CustomElement = Helpers.Element(CustomComponent); +const CustomLink = Helpers.Scroll(CustomComponent); + +scroller.scrollTo('myScrollToElement', { + duration: 1500, + delay: 100, + smooth: "easeInOutQuint", + containerId: 'ContainerElementID' +}); diff --git a/types/react-scroll/tsconfig.json b/types/react-scroll/tsconfig.json index 82e3ee3f92..a03808d867 100644 --- a/types/react-scroll/tsconfig.json +++ b/types/react-scroll/tsconfig.json @@ -7,7 +7,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "jsx": "react", "typeRoots": [ @@ -18,7 +18,15 @@ "forceConsistentCasingInFileNames": true }, "files": [ - "index.d.ts", - "react-scroll-tests.tsx" + "modules/index.d.ts", + "modules/components/Button.d.ts", + "modules/components/Element.d.ts", + "modules/components/Link.d.ts", + "modules/mixins/animate-scroll.d.ts", + "modules/mixins/Helpers.d.ts", + "modules/mixins/scroll-events.d.ts", + "modules/mixins/scroll-spy.d.ts", + "modules/mixins/scroller.d.ts", + "test/react-scroll-tests.tsx" ] -} \ No newline at end of file +} diff --git a/types/react-scroll/tslint.json b/types/react-scroll/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-scroll/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From cee06a479454df529062677fc79690dce32736ce Mon Sep 17 00:00:00 2001 From: Giedrius Grabauskas Date: Thu, 27 Apr 2017 18:45:46 +0300 Subject: [PATCH 0020/1072] Added main file. --- types/react-scroll/tsconfig.json | 1 + 1 file changed, 1 insertion(+) diff --git a/types/react-scroll/tsconfig.json b/types/react-scroll/tsconfig.json index a03808d867..a4f8e54e6c 100644 --- a/types/react-scroll/tsconfig.json +++ b/types/react-scroll/tsconfig.json @@ -18,6 +18,7 @@ "forceConsistentCasingInFileNames": true }, "files": [ + "index.d.ts", "modules/index.d.ts", "modules/components/Button.d.ts", "modules/components/Element.d.ts", From 9d3a210b057ccb0217f44475c95c9664d139f5a6 Mon Sep 17 00:00:00 2001 From: shane Date: Fri, 28 Apr 2017 16:20:06 +1000 Subject: [PATCH 0021/1072] 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 0022/1072] 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 dadb79cc315dc999f9b200e34a8e766c884f36a4 Mon Sep 17 00:00:00 2001 From: Sohail Nasir Date: Fri, 28 Apr 2017 21:08:00 +0100 Subject: [PATCH 0023/1072] data term is innaccessable using typescript The data term might have been declared wrong, rather than it being a string, it could be a Select2QueryOptions than in that case the term is accessible when loading via Ajax. --- types/select2/index.d.ts | 1 - types/select2/select2-tests.ts | 6 ------ 2 files changed, 7 deletions(-) diff --git a/types/select2/index.d.ts b/types/select2/index.d.ts index f3492b6bb1..ad67108906 100644 --- a/types/select2/index.d.ts +++ b/types/select2/index.d.ts @@ -26,7 +26,6 @@ interface Select2AjaxOptions { dataType?: string; delay?: number; cache?: boolean; - data?: (term: string, page: number, context: any) => any; results?: (term: any, page: number, context: any) => any; processResults?:(data: any, params: any) => any; } diff --git a/types/select2/select2-tests.ts b/types/select2/select2-tests.ts index 5d794e64e0..9fd6be0a93 100644 --- a/types/select2/select2-tests.ts +++ b/types/select2/select2-tests.ts @@ -58,9 +58,7 @@ $("#e6").select2({ url: "http://api.rottentomatoes.com/api/public/v1.0/movies.json", dataType: 'jsonp', cache: false, - data: function (term, page) { return { - q: term, page_limit: 10, apikey: "ju6z9mjyajq2djue3gbvv26t" }; @@ -79,9 +77,7 @@ $("#e6").select2({ ajax: { url: () => { return "http://api.rottentomatoes.com/api/public/v1.0/movies.json"; }, dataType: 'jsonp', - data: function (term, page) { return { - q: term, page_limit: 10, apikey: "ju6z9mjyajq2djue3gbvv26t" }; @@ -101,9 +97,7 @@ $("#e7").select2({ url: "http://api.rottentomatoes.com/api/public/v1.0/movies.json", dataType: 'jsonp', delay: 100, - data: function (term, page) { return { - q: term, page_limit: 10, page: page, apikey: "ju6z9mjyajq2djue3gbvv26t" From f76db61364f8a292197b6ee2bf9685b1c8dc2b0b Mon Sep 17 00:00:00 2001 From: Sohail Nasir Date: Fri, 28 Apr 2017 21:16:33 +0100 Subject: [PATCH 0024/1072] unable to access params term when loading via Ajax When trying to use Select2 v4, I was unable to get the term from the search box as the params was declared as a string --- types/select2/index.d.ts | 1 + types/select2/select2-tests.ts | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/types/select2/index.d.ts b/types/select2/index.d.ts index ad67108906..5828dba2e9 100644 --- a/types/select2/index.d.ts +++ b/types/select2/index.d.ts @@ -26,6 +26,7 @@ interface Select2AjaxOptions { dataType?: string; delay?: number; cache?: boolean; + data?: (params: Select2QueryOptions, page: number, context: any) => any; results?: (term: any, page: number, context: any) => any; processResults?:(data: any, params: any) => any; } diff --git a/types/select2/select2-tests.ts b/types/select2/select2-tests.ts index 9fd6be0a93..9f9f8f3732 100644 --- a/types/select2/select2-tests.ts +++ b/types/select2/select2-tests.ts @@ -58,7 +58,9 @@ $("#e6").select2({ url: "http://api.rottentomatoes.com/api/public/v1.0/movies.json", dataType: 'jsonp', cache: false, + data: function (params, page) { return { + q: params.term, page_limit: 10, apikey: "ju6z9mjyajq2djue3gbvv26t" }; @@ -77,7 +79,9 @@ $("#e6").select2({ ajax: { url: () => { return "http://api.rottentomatoes.com/api/public/v1.0/movies.json"; }, dataType: 'jsonp', + data: function (params, page) { return { + q: params.term, page_limit: 10, apikey: "ju6z9mjyajq2djue3gbvv26t" }; @@ -97,7 +101,9 @@ $("#e7").select2({ url: "http://api.rottentomatoes.com/api/public/v1.0/movies.json", dataType: 'jsonp', delay: 100, + data: function (params, page) { return { + q: params.term, page_limit: 10, page: page, apikey: "ju6z9mjyajq2djue3gbvv26t" From 4fa7ad037973585de568cd6f09665e3a438db380 Mon Sep 17 00:00:00 2001 From: Danilo Barros Date: Mon, 1 May 2017 14:55:50 -0300 Subject: [PATCH 0025/1072] feat(Nav): add vertical prop --- types/reactstrap/lib/Nav.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/reactstrap/lib/Nav.d.ts b/types/reactstrap/lib/Nav.d.ts index 660c2a401c..d0fe8bf03a 100644 --- a/types/reactstrap/lib/Nav.d.ts +++ b/types/reactstrap/lib/Nav.d.ts @@ -7,7 +7,8 @@ interface Props { navbar?: boolean; tag?: React.ReactType; className?: string; + vertical?: boolean; } declare var Nav: React.StatelessComponent; -export default Nav; \ No newline at end of file +export default Nav; From becc456bdf54b9654c8f605731b5f626a77d00a4 Mon Sep 17 00:00:00 2001 From: Danilo Barros Date: Mon, 1 May 2017 15:00:22 -0300 Subject: [PATCH 0026/1072] feat(NavLink): extending props from anchor element --- types/reactstrap/lib/NavLink.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/reactstrap/lib/NavLink.d.ts b/types/reactstrap/lib/NavLink.d.ts index 35da161a1e..f0117c387c 100644 --- a/types/reactstrap/lib/NavLink.d.ts +++ b/types/reactstrap/lib/NavLink.d.ts @@ -1,4 +1,4 @@ -interface Props { +interface Props extends React.HTMLProps { tag?: React.ReactType; disabled?: boolean; active?: boolean; @@ -8,4 +8,4 @@ interface Props { } declare var NavLink: React.StatelessComponent; -export default NavLink; \ No newline at end of file +export default NavLink; From c1bcc024d7823974bf5e3066a37d25d9f2cf2c0e Mon Sep 17 00:00:00 2001 From: Danilo Barros Date: Mon, 1 May 2017 15:04:04 -0300 Subject: [PATCH 0027/1072] fix(FormGroup): fix className prop type from boolean to string --- types/reactstrap/lib/FormGroup.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/reactstrap/lib/FormGroup.d.ts b/types/reactstrap/lib/FormGroup.d.ts index fd2390cdfa..c9293626cd 100644 --- a/types/reactstrap/lib/FormGroup.d.ts +++ b/types/reactstrap/lib/FormGroup.d.ts @@ -4,8 +4,8 @@ interface Props { disabled?: boolean; tag?: React.ReactType; color?: string; - className?: boolean; + className?: string; } declare var FormGroup: React.StatelessComponent; -export default FormGroup; \ No newline at end of file +export default FormGroup; From 2a740f7beee88211bae4a9473387f65cbf53af06 Mon Sep 17 00:00:00 2001 From: Danilo Barros Date: Mon, 1 May 2017 15:06:05 -0300 Subject: [PATCH 0028/1072] feat(Col): adding className prop --- types/reactstrap/lib/Col.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/reactstrap/lib/Col.d.ts b/types/reactstrap/lib/Col.d.ts index 33a207d329..ca93541104 100644 --- a/types/reactstrap/lib/Col.d.ts +++ b/types/reactstrap/lib/Col.d.ts @@ -10,6 +10,8 @@ export type ColumnProps }; interface Props { + className?: string; + xs?: ColumnProps; sm?: ColumnProps; md?: ColumnProps; From a642ce2ed8d69552a97781419cdd3604a97b7fea Mon Sep 17 00:00:00 2001 From: Danilo Barros Date: Mon, 1 May 2017 15:23:33 -0300 Subject: [PATCH 0029/1072] refactor(lib): extending some components from HTMLProps --- types/reactstrap/lib/Col.d.ts | 4 +--- types/reactstrap/lib/FormGroup.d.ts | 2 +- types/reactstrap/lib/Nav.d.ts | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/types/reactstrap/lib/Col.d.ts b/types/reactstrap/lib/Col.d.ts index ca93541104..a2ea76d607 100644 --- a/types/reactstrap/lib/Col.d.ts +++ b/types/reactstrap/lib/Col.d.ts @@ -9,9 +9,7 @@ export type ColumnProps offset?: string | number }; -interface Props { - className?: string; - +interface Props extends React.HTMLProps { xs?: ColumnProps; sm?: ColumnProps; md?: ColumnProps; diff --git a/types/reactstrap/lib/FormGroup.d.ts b/types/reactstrap/lib/FormGroup.d.ts index c9293626cd..0bf94a82a2 100644 --- a/types/reactstrap/lib/FormGroup.d.ts +++ b/types/reactstrap/lib/FormGroup.d.ts @@ -1,4 +1,4 @@ -interface Props { +interface Props extends React.HTMLProps { row?: boolean; check?: boolean; disabled?: boolean; diff --git a/types/reactstrap/lib/Nav.d.ts b/types/reactstrap/lib/Nav.d.ts index d0fe8bf03a..981d5087b8 100644 --- a/types/reactstrap/lib/Nav.d.ts +++ b/types/reactstrap/lib/Nav.d.ts @@ -1,4 +1,4 @@ -interface Props { +interface Props extends React.HTMLProps { inline?: boolean; disabled?: boolean; tabs?: boolean; From 9d6c0c12f4b2846790db5e5a42f300176721bc19 Mon Sep 17 00:00:00 2001 From: Kanchalai Tanglertsampan Date: Mon, 1 May 2017 11:56:54 -0700 Subject: [PATCH 0030/1072] 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 1fd7f20c32225f0780b4e69e2bab4edf68dc9c1c Mon Sep 17 00:00:00 2001 From: Danilo Barros Date: Mon, 1 May 2017 15:57:18 -0300 Subject: [PATCH 0031/1072] feat(Label): fixing size prop and extending HTMLLabelElement --- types/reactstrap/lib/Label.d.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/types/reactstrap/lib/Label.d.ts b/types/reactstrap/lib/Label.d.ts index 0c7ba166ba..04cf76e3a0 100644 --- a/types/reactstrap/lib/Label.d.ts +++ b/types/reactstrap/lib/Label.d.ts @@ -1,6 +1,10 @@ import { ColumnProps } from './Col'; -interface Props { +interface Intermediate extends React.ChangeTargetHTMLProps { + size?: any; +} + +interface Props extends Intermediate { hidden?: boolean; check?: boolean; inline?: boolean; @@ -17,4 +21,4 @@ interface Props { } declare var Label: React.StatelessComponent; -export default Label; \ No newline at end of file +export default Label; From 961c6fd498ff45e382525d4d10fa39a09d6ad1b9 Mon Sep 17 00:00:00 2001 From: Danilo Barros Date: Mon, 1 May 2017 15:57:34 -0300 Subject: [PATCH 0032/1072] feat(reactstrap): writing some tests --- types/reactstrap/reactstrap-tests.tsx | 63 +++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/types/reactstrap/reactstrap-tests.tsx b/types/reactstrap/reactstrap-tests.tsx index d4320246b7..faee0deafe 100644 --- a/types/reactstrap/reactstrap-tests.tsx +++ b/types/reactstrap/reactstrap-tests.tsx @@ -3221,3 +3221,66 @@ function Example() {
); } + +function Example104() { + const props = { + className: 'my-input', + style: { + borderColor: 'black', + } + }; + + return ( + + + + + + + + ); +} + +function Example105() { + return ( + + + + +
+ Item +
+
+
+ ); +} + +function Example106() { + return ( + + ); +} From 990eb2f63d56d9379fe86ee167cd72f5cca2fce9 Mon Sep 17 00:00:00 2001 From: Danilo Barros Date: Mon, 1 May 2017 16:26:34 -0300 Subject: [PATCH 0033/1072] chore(index-file): including author name --- types/reactstrap/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/reactstrap/index.d.ts b/types/reactstrap/index.d.ts index 6dadd6d284..166a009e21 100644 --- a/types/reactstrap/index.d.ts +++ b/types/reactstrap/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for reactstrap 4.3 // Project: https://github.com/reactstrap/reactstrap#readme -// Definitions by: Ali Hammad Baig , Marco Falkenberg +// Definitions by: Ali Hammad Baig , Marco Falkenberg , Danilo Barros // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 From 7c85a623b550df791034197cefab72b3fa572412 Mon Sep 17 00:00:00 2001 From: Lapanti Date: Tue, 2 May 2017 05:55:50 +0300 Subject: [PATCH 0034/1072] (#16189): Add LocationChangeAction to react-router-redux --- types/react-router-redux/index.d.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/types/react-router-redux/index.d.ts b/types/react-router-redux/index.d.ts index bebaab7562..e224f92530 100644 --- a/types/react-router-redux/index.d.ts +++ b/types/react-router-redux/index.d.ts @@ -59,4 +59,20 @@ export interface RouterAction extends Action { payload: LocationActionPayload; } +export interface LocationChangeAction extends Action { + type: typeof LOCATION_CHANGE; + payload: Location & { + props?: { + match: { + path: string; + url: string; + params: any; + isExact: boolean; + }, + location: Location; + history: History; + } + }; +} + export function routerMiddleware(history: History): Middleware; From 488ab0050dd26e9fa780a3f3acc0e2ac1d85dad8 Mon Sep 17 00:00:00 2001 From: liudongpu Date: Tue, 2 May 2017 22:25:32 +0800 Subject: [PATCH 0035/1072] 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 0036/1072] 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 0037/1072] 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 0038/1072] 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 0039/1072] 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 0040/1072] 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 0041/1072] 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 0042/1072] 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 70d5b32179e12119108bf43b575e9b37fe19f9e2 Mon Sep 17 00:00:00 2001 From: Donald Pipowitch Date: Fri, 5 May 2017 08:57:02 +0200 Subject: [PATCH 0043/1072] added simpleParser to mailparser --- types/mailparser/index.d.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/types/mailparser/index.d.ts b/types/mailparser/index.d.ts index ee488d0691..0bb84e9940 100644 --- a/types/mailparser/index.d.ts +++ b/types/mailparser/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for mailparser v0.5.2 +// Type definitions for mailparser v2.0.0 // Project: https://www.npmjs.com/package/mailparser // Definitions by: Peter Snider // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -82,3 +82,7 @@ export class MailParser extends StreamModule.Writable { emit(event: string, ...args: any[]): boolean; listenerCount(type: string): number; } + +export type Source = Buffer | Stream | string; +export function simpleParser(source: Source, callback: (err: any, mail: ParsedMail) => void): void; +export function simpleParser(source: Source): Promise; From 2c5321dfbe880c748067f8a2007185a92f38e851 Mon Sep 17 00:00:00 2001 From: Donald Pipowitch Date: Fri, 5 May 2017 12:56:09 +0200 Subject: [PATCH 0044/1072] Update index.d.ts --- types/selenium-webdriver/index.d.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/types/selenium-webdriver/index.d.ts b/types/selenium-webdriver/index.d.ts index c8d0c9b2de..f7c92508a8 100644 --- a/types/selenium-webdriver/index.d.ts +++ b/types/selenium-webdriver/index.d.ts @@ -556,6 +556,13 @@ export namespace logging { export namespace promise { // region Functions + + /** + * Set `USE_PROMISE_MANAGER` to `false` to disable the promise manager. + * This is useful, if you use async/await (see https://github.com/SeleniumHQ/selenium/issues/2969 + * and https://github.com/SeleniumHQ/selenium/issues/3037). + */ + let USE_PROMISE_MANAGER: boolean; /** * Given an array of promises, will return a promise that will be fulfilled From f4e3eeec7d16c3bd90725ebc2c89b6b8acadb709 Mon Sep 17 00:00:00 2001 From: Donald Pipowitch Date: Fri, 5 May 2017 13:17:07 +0200 Subject: [PATCH 0045/1072] remove whitespace --- types/selenium-webdriver/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/selenium-webdriver/index.d.ts b/types/selenium-webdriver/index.d.ts index f7c92508a8..2ec8f533ff 100644 --- a/types/selenium-webdriver/index.d.ts +++ b/types/selenium-webdriver/index.d.ts @@ -556,7 +556,7 @@ export namespace logging { export namespace promise { // region Functions - + /** * Set `USE_PROMISE_MANAGER` to `false` to disable the promise manager. * This is useful, if you use async/await (see https://github.com/SeleniumHQ/selenium/issues/2969 From 348824ec702d040c2b44c8da3ae528fe4533b1d3 Mon Sep 17 00:00:00 2001 From: Daryl LaBar Date: Fri, 5 May 2017 10:18:35 -0400 Subject: [PATCH 0046/1072] Updated XrmStatic Properties Page, Utility, and Panel to match the pattern that Mobil was doing, and be defined as interfaces. This also makes allows for variables to easily be tyepd i.e. var p: Xrm.Page. Also retyped getInitalValue for booleans and OptionsetValues to be their correct respective types. --- types/xrm/index.d.ts | 423 +++++++++++++++++++++++-------------------- 1 file changed, 224 insertions(+), 199 deletions(-) diff --git a/types/xrm/index.d.ts b/types/xrm/index.d.ts index 956dc969a2..27029961bd 100644 --- a/types/xrm/index.d.ts +++ b/types/xrm/index.d.ts @@ -24,198 +24,12 @@ declare namespace Xrm { /** * Provides a namespace container for the context, data and ui objects. */ - Page: { - /** - * Provides methods to retrieve information specific to an organization, a user, or parameters passed to a page. - */ - context: Context; - - /** - * Provides methods to work with the form. - */ - data: Data; - - /** - * Contains properties and methods to retrieve information about the user interface as well as collections for several subcomponents of the form. - */ - ui: Ui; - - /** - * Gets all attributes. - * - * @return An array of attributes. - */ - getAttribute(): Page.Attribute[]; - - /** - * Gets an attribute matching attributeName. - * - * @tparam T An Attribute type. - * @param {string} attributeName Name of the attribute. - * - * @return The attribute. - */ - getAttribute(attributeName: string): T; - - /** - * Gets an attribute matching attributeName. - * - * @param {string} attributeName Name of the attribute. - * - * @return The attribute. - */ - getAttribute(attributeName: string): Page.Attribute; - - /** - * Gets an attribute by index. - * - * @param {number} index The attribute index. - * - * @return The attribute. - */ - getAttribute(index: number): Page.Attribute; - - /** - * Gets an attribute. - * - * @param {Collection.MatchingDelegate{Attribute}} delegateFunction A matching delegate function - * - * @return An array of attribute. - */ - getAttribute(delegateFunction: Collection.MatchingDelegate): Page.Attribute[]; - - /** - * Gets all controls. - * - * @return An array of controls. - */ - getControl(): Page.Control[]; - - /** - * Gets a control matching controlName. - * - * @tparam T A Control type - * @param {string} controlName Name of the control. - * - * @return The control. - */ - getControl(controlName: string): T; - - /** - * Gets a control matching controlName. - * - * @param {string} controlName Name of the control. - * - * @return The control. - */ - getControl(controlName: string): Page.Control; - - /** - * Gets a control by index. - * - * @tparam T A Control type - * @param {number} index The control index. - * - * @return The control. - */ - getControl(index: number): T; - - /** - * Gets a control by index. - * - * @param {number} index The control index. - * - * @return The control. - */ - getControl(index: number): Page.Control; - - /** - * Gets a control. - * - * @param {Collection.MatchingDelegate{Control}} delegateFunction A matching delegate function. - * - * @return An array of control. - */ - getControl(delegateFunction: Collection.MatchingDelegate): Page.Control[]; - }; + Page: Page; /** * Provides a container for useful functions not directly related to the current page. */ - Utility: { - /** - * Displays an alert dialog, with an "OK" button. - * - * @param {string} message The message. - * @param {function()} onCloseCallback The "OK" callback. - */ - alertDialog(message: string, onCloseCallback: () => void): void; - - /** - * Displays a confirmation dialog, with "OK" and "Cancel" buttons. - * - * @param {string} message The message. - * @param {function()} yesCloseCallback The "OK" callback. - * @param {function()} noCloseCallback The "Cancel" callback. - */ - confirmDialog(message: string, yesCloseCallback: () => void, noCloseCallback: () => void): void; - - /** - * Query if 'entityType' is an Activity entity. - * - * @param {string} entityType Type of the entity. - * - * @return true if the entity is an Activity, false if not. - */ - isActivityType(entityType: string): boolean; - - /** - * Opens quick create. - * - * @param {string} entityLogicalName The logical name of the entity to create. - * @param {Page.LookupValue} createFromEntity (Optional) Designates a record that will provide default values - * based on mapped attribute values. - * @param {OpenParameters} parameters (Optional) A dictionary object that passes extra query string - * parameters to the form. Invalid query string parameters will cause an - * error. - * @return {Async.XrmPromise} Returns an asynchronous promise. - */ - openQuickCreate(entityLogicalName: string, createFromEntity?: Page.LookupValue, parameters?: Utility.OpenParameters): - Async.XrmPromise; - - /** - * Opens an entity form. - * - * @param {string} name The entity's logical name. - * @param {string} id (Optional) The unique identifier for the record. - * @param {FormParameters} parameters (Optional) A dictionary object that passes extra query string parameters to the form. - * @param {WindowOptions} windowOptions (Optional) Options for controlling the window. - */ - openEntityForm(name: string, id?: string, parameters?: Utility.FormOpenParameters, windowOptions?: Utility.WindowOptions): void; - - /** - * Opens an HTML Web Resource in a new browser window. - * - * @param {string} webResourceName Name of the HTML web resource. Can be used to pass URL - * parameters. See Remarks. - * @param {string} webResourceData (Optional) Data to pass into the Web Resource's data parameter. - * It is advised to use encodeURIcomponent() to encode the value. - * @param {number} width (Optional) The width of the new window. - * @param {number} height (Optional) The height of the new window. - * - * @return A Window reference, containing the opened Web Resource. - * - * @remarks This function will not work with Microsoft Dynamics CRM for tablets. - * Valid WebResource URL Parameters: typename - * type - * id - * orgname - * userlcid - * data (identical to this method's webResourceData parameter) - * formid - */ - openWebResource(webResourceName: string, webResourceData?: string, width?: number, height?: number): Window; - }; + Utility: Utility; /** * Provides methods to create and manage records in the mobile clients (for phones tablets). @@ -227,17 +41,7 @@ declare namespace Xrm { * * @see {@link https://msdn.microsoft.com/en-us/library/mt790281.aspx} for details. */ - Panel: { - /** - * Displays the web page represented by a URL in the static area in the side pane, which appears on all pages in the web client. - * - * @param {string} url URL of the page to be loaded in the side pane static area. - * @param {string} url Title of the side pane static area. - * - * @remarks This method is only supported for the web client. - */ - LoadPanel(url: string, title: string): void; - }; + Panel: Panel; } /** @@ -443,6 +247,122 @@ declare namespace Xrm { process: Page.data.ProcessManager; } + interface Page { + /** + * Provides methods to retrieve information specific to an organization, a user, or parameters passed to a page. + */ + context: Context; + + /** + * Provides methods to work with the form. + */ + data: Data; + + /** + * Contains properties and methods to retrieve information about the user interface as well as collections for several subcomponents of the form. + */ + ui: Ui; + + /** + * Gets all attributes. + * + * @return An array of attributes. + */ + getAttribute(): Page.Attribute[]; + + /** + * Gets an attribute matching attributeName. + * + * @tparam T An Attribute type. + * @param {string} attributeName Name of the attribute. + * + * @return The attribute. + */ + getAttribute(attributeName: string): T; + + /** + * Gets an attribute matching attributeName. + * + * @param {string} attributeName Name of the attribute. + * + * @return The attribute. + */ + getAttribute(attributeName: string): Page.Attribute; + + /** + * Gets an attribute by index. + * + * @param {number} index The attribute index. + * + * @return The attribute. + */ + getAttribute(index: number): Page.Attribute; + + /** + * Gets an attribute. + * + * @param {Collection.MatchingDelegate{Attribute}} delegateFunction A matching delegate function + * + * @return An array of attribute. + */ + getAttribute(delegateFunction: Collection.MatchingDelegate): Page.Attribute[]; + + /** + * Gets all controls. + * + * @return An array of controls. + */ + getControl(): Page.Control[]; + + /** + * Gets a control matching controlName. + * + * @tparam T A Control type + * @param {string} controlName Name of the control. + * + * @return The control. + */ + getControl(controlName: string): T; + + /** + * Gets a control matching controlName. + * + * @param {string} controlName Name of the control. + * + * @return The control. + */ + getControl(controlName: string): Page.Control; + + /** + * Gets a control by index. + * + * @tparam T A Control type + * @param {number} index The control index. + * + * @return The control. + */ + getControl(index: number): T; + + /** + * Gets a control by index. + * + * @param {number} index The control index. + * + * @return The control. + */ + getControl(index: number): Page.Control; + + /** + * Gets a control. + * + * @param {Collection.MatchingDelegate{Control}} delegateFunction A matching delegate function. + * + * @return An array of control. + */ + getControl(delegateFunction: Collection.MatchingDelegate): Page.Control[]; + + } + /** * Interface for the Xrm.Page.ui object. */ @@ -552,6 +472,81 @@ declare namespace Xrm { quickForms: Collection.ItemCollection; } + export interface Utility { + /** + * Displays an alert dialog, with an "OK" button. + * + * @param {string} message The message. + * @param {function()} onCloseCallback The "OK" callback. + */ + alertDialog(message: string, onCloseCallback: () => void): void; + + /** + * Displays a confirmation dialog, with "OK" and "Cancel" buttons. + * + * @param {string} message The message. + * @param {function()} yesCloseCallback The "OK" callback. + * @param {function()} noCloseCallback The "Cancel" callback. + */ + confirmDialog(message: string, yesCloseCallback: () => void, noCloseCallback: () => void): void; + + /** + * Query if 'entityType' is an Activity entity. + * + * @param {string} entityType Type of the entity. + * + * @return true if the entity is an Activity, false if not. + */ + isActivityType(entityType: string): boolean; + + /** + * Opens quick create. + * + * @param {string} entityLogicalName The logical name of the entity to create. + * @param {Page.LookupValue} createFromEntity (Optional) Designates a record that will provide default values + * based on mapped attribute values. + * @param {OpenParameters} parameters (Optional) A dictionary object that passes extra query string + * parameters to the form. Invalid query string parameters will cause an + * error. + * @return {Async.XrmPromise} Returns an asynchronous promise. + */ + openQuickCreate(entityLogicalName: string, createFromEntity?: Page.LookupValue, parameters?: Utility.OpenParameters): + Async.XrmPromise; + + /** + * Opens an entity form. + * + * @param {string} name The entity's logical name. + * @param {string} id (Optional) The unique identifier for the record. + * @param {FormParameters} parameters (Optional) A dictionary object that passes extra query string parameters to the form. + * @param {WindowOptions} windowOptions (Optional) Options for controlling the window. + */ + openEntityForm(name: string, id?: string, parameters?: Utility.FormOpenParameters, windowOptions?: Utility.WindowOptions): void; + + /** + * Opens an HTML Web Resource in a new browser window. + * + * @param {string} webResourceName Name of the HTML web resource. Can be used to pass URL + * parameters. See Remarks. + * @param {string} webResourceData (Optional) Data to pass into the Web Resource's data parameter. + * It is advised to use encodeURIcomponent() to encode the value. + * @param {number} width (Optional) The width of the new window. + * @param {number} height (Optional) The height of the new window. + * + * @return A Window reference, containing the opened Web Resource. + * + * @remarks This function will not work with Microsoft Dynamics CRM for tablets. + * Valid WebResource URL Parameters: typename + * type + * id + * orgname + * userlcid + * data (identical to this method's webResourceData parameter) + * formid + */ + openWebResource(webResourceName: string, webResourceData?: string, width?: number, height?: number): Window; + } + /** * Interface for methods to create and manage records in the mobile clients (for phones tablets). */ @@ -666,6 +661,18 @@ declare namespace Xrm { deleteRecord(entityType: string, id: string): Async.XrmPromise; } + export interface Panel { + /** + * Displays the web page represented by a URL in the static area in the side pane, which appears on all pages in the web client. + * + * @param {string} url URL of the page to be loaded in the side pane static area. + * @param {string} url Title of the side pane static area. + * + * @remarks This method is only supported for the web client. + */ + LoadPanel(url: string, title: string): void; + } + /** * A definition module for asynchronous interface declarations. */ @@ -1595,6 +1602,15 @@ declare namespace Xrm { * @sa EnumAttribute */ interface BooleanAttribute extends EnumAttribute { + /** + * Gets the initial value of the attribute. + * + * @return The initial value. + * + * @remarks Valid for OptionSet and boolean attribute types + */ + getInitialValue(): boolean; + /** * Gets the value. * @@ -1666,6 +1682,15 @@ declare namespace Xrm { */ getFormat(): OptionSetAttributeFormat; + /** + * Gets the initial value of the attribute. + * + * @return The initial value. + * + * @remarks Valid for OptionSet and boolean attribute types + */ + getInitialValue(): number; + /** * Gets the option matching a value. * From a863ce1cce555f312f65a1c1e7f00e4d21e642b5 Mon Sep 17 00:00:00 2001 From: Daryl LaBar Date: Fri, 5 May 2017 11:28:08 -0400 Subject: [PATCH 0047/1072] Fixed Linitng issues and fixed header so it could be parsed by the DT Bot --- types/xrm/index.d.ts | 11 +++-------- types/xrm/xrm-tests.ts | 2 +- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/types/xrm/index.d.ts b/types/xrm/index.d.ts index 27029961bd..81d35cfe9b 100644 --- a/types/xrm/index.d.ts +++ b/types/xrm/index.d.ts @@ -1,10 +1,6 @@ // Type definitions for Microsoft Dynamics xRM API 8.2 // Project: http://www.microsoft.com/en-us/download/details.aspx?id=44567 -// Definitions by: David Berry -// Matt Ngan -// Markus Mauch -// Daryl LaBar -// Tully H +// Definitions by: David Berry , Matt Ngan , Markus Mauch , Daryl LaBar , Tully H // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 @@ -360,7 +356,6 @@ declare namespace Xrm { * @return An array of control. */ getControl(delegateFunction: Collection.MatchingDelegate): Page.Control[]; - } /** @@ -472,7 +467,7 @@ declare namespace Xrm { quickForms: Collection.ItemCollection; } - export interface Utility { + interface Utility { /** * Displays an alert dialog, with an "OK" button. * @@ -661,7 +656,7 @@ declare namespace Xrm { deleteRecord(entityType: string, id: string): Async.XrmPromise; } - export interface Panel { + interface Panel { /** * Displays the web page represented by a URL in the static area in the side pane, which appears on all pages in the web client. * diff --git a/types/xrm/xrm-tests.ts b/types/xrm/xrm-tests.ts index 5d9d99b644..5b5b12c333 100644 --- a/types/xrm/xrm-tests.ts +++ b/types/xrm/xrm-tests.ts @@ -143,7 +143,7 @@ const resultSet: Xrm.Page.AutoCompleteResultSet = { // accounts in CRM. window.open("http://www.microsoft.com/en-us/dynamics/crm-customer-center/create-or-edit-an-account.aspx"); } - } as Xrm.Page.AutoCompleteCommand + } }; resultSet.results.push({ id: 0, From a2ff92c6b32e767f7dfe9d458021688fc5a10d2a Mon Sep 17 00:00:00 2001 From: Ryan Taylor Date: Fri, 5 May 2017 13:31:29 -0400 Subject: [PATCH 0048/1072] [highcharts] Add ScrollbarOptions type to the x/y axes (#16328) --- types/highcharts/highstock.d.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/types/highcharts/highstock.d.ts b/types/highcharts/highstock.d.ts index 4541e5d715..3ec90ec6a1 100644 --- a/types/highcharts/highstock.d.ts +++ b/types/highcharts/highstock.d.ts @@ -81,10 +81,16 @@ declare namespace Highstock { trackBorderWidth?: number; } + interface AxisOptions extends Highcharts.AxisOptions { + scrollbar?: ScrollbarOptions; + } + interface Options extends Highcharts.Options { navigator?: NavigatorOptions; rangeSelector?: RangeSelectorOptions; scrollbar?: ScrollbarOptions; + xAxis?: AxisOptions[] | AxisOptions; + yAxis?: AxisOptions[] | AxisOptions; } interface Chart { From 09672a53567d73e59859d84d87d3b337ddbd87f5 Mon Sep 17 00:00:00 2001 From: Ryan Taylor Date: Fri, 5 May 2017 13:32:24 -0400 Subject: [PATCH 0049/1072] [highcharts] Update test with axis ScrollbarOptions (#16328) --- types/highcharts/test/highstock.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/types/highcharts/test/highstock.ts b/types/highcharts/test/highstock.ts index 7fde17d3ce..2021e65b68 100644 --- a/types/highcharts/test/highstock.ts +++ b/types/highcharts/test/highstock.ts @@ -9,6 +9,10 @@ $(() => { type: "arearange" }, + xAxis: { + scrollbar: { enabled: true } + }, + navigator: { height: 80, maskFill: 'rgba(255, 198, 220, 0.75)', From d9052e486600818de742c51766747d327428764a Mon Sep 17 00:00:00 2001 From: Daryl LaBar Date: Fri, 5 May 2017 13:59:31 -0400 Subject: [PATCH 0050/1072] Fixed Other Lint-ing Issues. Not sure what to do about the header being unparsable. Added commas, maybe that will help? --- types/xrm/index.d.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/types/xrm/index.d.ts b/types/xrm/index.d.ts index 81d35cfe9b..6e6a1d5117 100644 --- a/types/xrm/index.d.ts +++ b/types/xrm/index.d.ts @@ -1,6 +1,10 @@ // Type definitions for Microsoft Dynamics xRM API 8.2 // Project: http://www.microsoft.com/en-us/download/details.aspx?id=44567 -// Definitions by: David Berry , Matt Ngan , Markus Mauch , Daryl LaBar , Tully H +// Definitions by: David Berry , +// Matt Ngan , +// Markus Mauch , +// Daryl LaBar , +// Tully H // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 @@ -656,7 +660,7 @@ declare namespace Xrm { deleteRecord(entityType: string, id: string): Async.XrmPromise; } - interface Panel { + interface Panel { /** * Displays the web page represented by a URL in the static area in the side pane, which appears on all pages in the web client. * From 21759a16dcb258845c4adb09c4655a8d071b1f61 Mon Sep 17 00:00:00 2001 From: Ryan Taylor Date: Fri, 5 May 2017 21:12:30 -0400 Subject: [PATCH 0051/1072] Fix no-object-literal-type-assertion error (#13628) --- types/highcharts/tslint.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/highcharts/tslint.json b/types/highcharts/tslint.json index a0b35dc4d9..d8b67d5d1f 100644 --- a/types/highcharts/tslint.json +++ b/types/highcharts/tslint.json @@ -4,6 +4,7 @@ "ban-types": false, "unified-signatures": false, "no-empty-interface": false, - "dt-header": false + "dt-header": false, + "no-object-literal-type-assertion": false } } From b5a7468b94b44ba8894a4fb12d077b5dab1a0ccb Mon Sep 17 00:00:00 2001 From: delphinus Date: Sat, 6 May 2017 11:33:04 +0900 Subject: [PATCH 0052/1072] Add factory function for mCustomScrollbar --- types/mcustomscrollbar/index.d.ts | 10 ++++++++++ types/mcustomscrollbar/mcustomscrollbar-tests.ts | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/types/mcustomscrollbar/index.d.ts b/types/mcustomscrollbar/index.d.ts index 0b6939e544..8952222642 100644 --- a/types/mcustomscrollbar/index.d.ts +++ b/types/mcustomscrollbar/index.d.ts @@ -6,6 +6,9 @@ /// declare namespace MCustomScrollbar { + + type Factory = (jQuery: JQueryStatic) => void; + interface CustomScrollbarOptions { /** * Set the width of your content (overwrites CSS width), value in pixels (integer) or percentage (string) @@ -375,3 +378,10 @@ interface JQuery { */ mCustomScrollbar(options?: MCustomScrollbar.CustomScrollbarOptions): JQuery; } + +declare module "malihu-custom-scrollbar-plugin" { + + var factory: MCustomScrollbar.Factory; + + export = factory; +} diff --git a/types/mcustomscrollbar/mcustomscrollbar-tests.ts b/types/mcustomscrollbar/mcustomscrollbar-tests.ts index f00cd5a491..faee449aea 100644 --- a/types/mcustomscrollbar/mcustomscrollbar-tests.ts +++ b/types/mcustomscrollbar/mcustomscrollbar-tests.ts @@ -1,3 +1,7 @@ +import * as factory from "malihu-custom-scrollbar-plugin"; + +factory($); + class SimpleTest { element: JQuery; From 4958a19ea2961ac784c7a4ec0bd41bbedd43e5f4 Mon Sep 17 00:00:00 2001 From: Nico Jansen Date: Sat, 6 May 2017 10:34:21 +0200 Subject: [PATCH 0053/1072] sinon: Add array matcher, set matcher and map matcher The matchers are documented here: http://sinonjs.org/releases/v2.2.0/matchers/ --- types/sinon/index.d.ts | 58 ++++++++++++++++++++++++++++++++++++-- types/sinon/sinon-tests.ts | 57 ++++++++++++++++++++++++++++--------- types/sinon/tsconfig.json | 6 ++-- 3 files changed, 101 insertions(+), 20 deletions(-) diff --git a/types/sinon/index.d.ts b/types/sinon/index.d.ts index a2a4b32c8d..b3caa38657 100644 --- a/types/sinon/index.d.ts +++ b/types/sinon/index.d.ts @@ -1,9 +1,9 @@ // Type definitions for Sinon 2.2 // Project: http://sinonjs.org/ -// Definitions by: William Sears , Jonathan Little , Lukas Spieß +// Definitions by: William Sears , Jonathan Little , Lukas Spieß , Nico Jansen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// sinon uses DOM dependencies which are absent in browserless envoronment like node.js +// sinon uses DOM dependencies which are absent in browser-less environment like node.js // to avoid compiler errors this monkey patch is used // see more details in https://github.com/DefinitelyTyped/DefinitelyTyped/issues/11351 // tslint:disable no-empty-interface @@ -363,6 +363,47 @@ declare namespace Sinon { or(expr: SinonMatcher): SinonMatcher; } + interface SinonArrayMatcher extends SinonMatcher { + /** + * Requires an Array to be deep equal another one. + */ + deepEquals(expected: any[]): SinonMatcher; + /** + * Requires an Array to start with the same values as another one. + */ + startsWith(expected: any[]): SinonMatcher; + /** + * Requires an Array to end with the same values as another one. + */ + endsWith(expected: any[]): SinonMatcher; + /** + * Requires an Array to contain each one of the values the given array has. + */ + contains(expected: any[]): SinonMatcher; + } + + interface SinonMapMatcher extends SinonMatcher { + /** + * Requires a Map to be deep equal another one. + */ + deepEquals(expected: Map): SinonMatcher; + /** + * Requires a Map to contain each one of the items the given map has. + */ + contains(expected: Map): SinonMatcher; + } + + interface SinonSetMatcher extends SinonMatcher { + /** + * Requires a Set to be deep equal another one. + */ + deepEquals(expected: Set): SinonMatcher; + /** + * Requires a Set to contain each one of the items the given set has. + */ + contains(expected: Set): SinonMatcher; + } + interface SinonMatch { (value: number): SinonMatcher; (value: string): SinonMatcher; @@ -378,7 +419,18 @@ declare namespace Sinon { string: SinonMatcher; object: SinonMatcher; func: SinonMatcher; - array: SinonMatcher; + /** + * Requires the value to be a Map. + */ + map: SinonMapMatcher; + /** + * Requires the value to be a Set. + */ + set: SinonSetMatcher; + /** + * Requires the value to be an Array. + */ + array: SinonArrayMatcher; regexp: SinonMatcher; date: SinonMatcher; symbol: SinonMatcher; diff --git a/types/sinon/sinon-tests.ts b/types/sinon/sinon-tests.ts index 5304e04360..fd2af880f3 100644 --- a/types/sinon/sinon-tests.ts +++ b/types/sinon/sinon-tests.ts @@ -4,7 +4,7 @@ function once(fn: Function) { let called = false; let returnValue: any; - return function() { + return function(this: any) { if (!called) { called = true; returnValue = fn.apply(this, arguments); @@ -21,7 +21,7 @@ function testOne() { } function testTwo() { - let callback = sinon.spy(() => {}); + let callback = sinon.spy(() => { }); let proxy = once(callback); proxy(); proxy(); @@ -68,7 +68,7 @@ function testSix() { } function testSeven() { - let obj = { functionToTest : () => { } }; + let obj = { functionToTest: () => { } }; let mockObj = sinon.mock(obj); obj.functionToTest(); mockObj.expects('functionToTest').once(); @@ -79,15 +79,15 @@ function testEight() { } function testNine() { - let callback = sinon.stub().returns(42); - callback({ x: 5, y: 5 }); - callback.calledWithMatch({ x: 5 }); - callback.alwaysCalledWithMatch({ y: 5 }); - callback.neverCalledWithMatch({ x: 6 }); - callback.notCalledWithMatch({ x: 6 }); - sinon.assert.calledWithMatch(callback, { x: 5 }); - sinon.assert.alwaysCalledWithMatch(callback, { y: 5 }); - sinon.assert.neverCalledWithMatch(callback, { x: 6 }); + let callback = sinon.stub().returns(42); + callback({ x: 5, y: 5 }); + callback.calledWithMatch({ x: 5 }); + callback.alwaysCalledWithMatch({ y: 5 }); + callback.neverCalledWithMatch({ x: 6 }); + callback.notCalledWithMatch({ x: 6 }); + sinon.assert.calledWithMatch(callback, { x: 5 }); + sinon.assert.alwaysCalledWithMatch(callback, { y: 5 }); + sinon.assert.neverCalledWithMatch(callback, { x: 6 }); } function testSandbox() { @@ -133,6 +133,32 @@ function testUsingPromises() { const stub: sinon.SinonStub = sinon.stub().usingPromise(Promise); } +function testArrayMatchers() { + const stub = sinon.stub(); + stub([{ a: 'b' }]); + stub.calledWithMatch(sinon.match.array); + stub.calledWithMatch(sinon.match.array.deepEquals([{ a: 'b' }])); + stub.calledWithMatch(sinon.match.array.startsWith([{ a: 'b' }])); + stub.calledWithMatch(sinon.match.array.deepEquals([{ a: 'b' }])); + stub.calledWithMatch(sinon.match.array.contains([{ a: 'b' }])); +} + +function testMapMatcher() { + const stub = sinon.stub(); + stub(new Map([['a', true], ['b', false]])); + stub.calledWithMatch(sinon.match.map); + stub.calledWithMatch(sinon.match.map.deepEquals(new Map([['a', true], ['b', false]]))); + stub.calledWithMatch(sinon.match.map.contains(new Map([['a', true]]))); +} + +function testSetMatcher() { + const stub = sinon.stub(); + stub(new Set(['a', true])); + stub.calledWithMatch(sinon.match.set); + stub.calledWithMatch(sinon.match.set.deepEquals(new Set(['a', true]))); + stub.calledWithMatch(sinon.match.set.contains(new Set([true]))); +} + function testSpy() { const otherSpy = sinon.spy(); sinon.spy().calledAfter(otherSpy); @@ -162,7 +188,7 @@ clock.setSystemTime(1000); clock.setSystemTime(new Date()); class TestCreateStubInstance { - someTestMethod(testArg: string) {} + someTestMethod(testArg: string) { } } sinon.createStubInstance(TestCreateStubInstance).someTestMethod('some argument'); @@ -172,5 +198,8 @@ function testGetCalls() { double(2); double(4); double.getCall(0).args.length === 1; - double.getCalls().find(call => call.args[0] === 4).returnValue === 8; + const secondCall = double.getCalls().find(call => call.args[0] === 4); + if (secondCall) { + secondCall.returnValue === 8; + } } diff --git a/types/sinon/tsconfig.json b/types/sinon/tsconfig.json index 339ad66d1f..714a6cd480 100644 --- a/types/sinon/tsconfig.json +++ b/types/sinon/tsconfig.json @@ -6,8 +6,8 @@ "dom" ], "noImplicitAny": true, - "noImplicitThis": false, - "strictNullChecks": false, + "noImplicitThis": true, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" @@ -20,4 +20,4 @@ "index.d.ts", "sinon-tests.ts" ] -} \ No newline at end of file +} 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 0054/1072] 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 fb551661334ffc98930615a032c66aef65b68211 Mon Sep 17 00:00:00 2001 From: Jan Wolf Date: Sat, 6 May 2017 11:20:49 +0200 Subject: [PATCH 0055/1072] Added possibility to inject array into constructor and start function --- types/forever-monitor/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/forever-monitor/index.d.ts b/types/forever-monitor/index.d.ts index cd5869f6d3..caa921fa1a 100644 --- a/types/forever-monitor/index.d.ts +++ b/types/forever-monitor/index.d.ts @@ -35,7 +35,7 @@ export interface Options { parser?(command: string, args: string[]): { command: string, args: string[] }; } -export function start(script: string, options?: Options): Monitor; +export function start(script: string | string[], options?: Options): Monitor; export function kill(pid: number, killTree?: boolean, signal?: string, callback?: () => any): void; export function checkProcess(pid: number): boolean; export const version: string; @@ -45,7 +45,7 @@ export class Monitor extends NodeJS.EventEmitter { * @param script - Location of the target script to run. * @param [options] - Configuration for this instance. */ - constructor(script: string, options?: Options); + constructor(script: string | string[], options?: Options); /** * @description Start the process that this instance is configured for From 1f7ed0eaf6b79ab73609bbc313092302eb903d11 Mon Sep 17 00:00:00 2001 From: Jan Wolf Date: Sat, 6 May 2017 11:30:55 +0200 Subject: [PATCH 0056/1072] Revert --- types/auto-sni/index.d.ts | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/types/auto-sni/index.d.ts b/types/auto-sni/index.d.ts index 075f093f0b..bc252831ca 100644 --- a/types/auto-sni/index.d.ts +++ b/types/auto-sni/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for auto-sni v2.1.1 +// Type definitions for auto-sni 2.1 // Project: https://www.npmjs.com/package/auto-sni // Definitions by: Jan Wolf // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -8,18 +8,18 @@ import {Server} from "https"; declare namespace createServer { - + interface Options { + email: string; + agreeTos: boolean; + domains: Array; + ports?: { + http?: number, + https?: number + }; + debug?: boolean; + } } -declare function createServer(opts: { - email: string, - agreeTos: boolean, - domains: Array, - ports?: { - http?: number, - https?: number - }, - debug?: boolean -}, app?: any): Server; +declare function createServer(opts: createServer.Options, app?: any): Server; export = createServer; From 1784dd6bc66d3e97e96f9dee5fd82738a219121a Mon Sep 17 00:00:00 2001 From: Karoline Date: Sun, 7 May 2017 01:29:56 +0200 Subject: [PATCH 0057/1072] Added declarations for Joigoose --- types/joigoose/index.d.ts | 19 +++++++++++++++++++ types/joigoose/joigoose-tests.ts | 9 +++++++++ types/joigoose/tsconfig.json | 22 ++++++++++++++++++++++ types/joigoose/tslint.json | 1 + 4 files changed, 51 insertions(+) create mode 100644 types/joigoose/index.d.ts create mode 100644 types/joigoose/joigoose-tests.ts create mode 100644 types/joigoose/tsconfig.json create mode 100644 types/joigoose/tslint.json diff --git a/types/joigoose/index.d.ts b/types/joigoose/index.d.ts new file mode 100644 index 0000000000..3955f40c60 --- /dev/null +++ b/types/joigoose/index.d.ts @@ -0,0 +1,19 @@ +// Type definitions for joigoose 2.0 +// Project: https://github.com/yoitsro/joigoose +// Definitions by: Karoline +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import * as Mongoose from "mongoose"; +import * as Joi from "joi"; + +declare namespace Joigoose +{ + interface Joigoose + { + convert(schema: Joi.Schema): Mongoose.Schema; + } +} + +declare function Joigoose(mongoose: Mongoose.Mongoose, joiOptions?: Joi.ValidationOptions): Joigoose.Joigoose; + +export = Joigoose; diff --git a/types/joigoose/joigoose-tests.ts b/types/joigoose/joigoose-tests.ts new file mode 100644 index 0000000000..791a24ff4b --- /dev/null +++ b/types/joigoose/joigoose-tests.ts @@ -0,0 +1,9 @@ +import * as Joigoose from "joigoose"; +import * as Mongoose from "mongoose"; +import * as Joi from "joi"; + +let joigoose = Joigoose(Mongoose); +let options: Joi.ValidationOptions = {abortEarly: true}; +joigoose = Joigoose(Mongoose, options); + +let schema: Mongoose.Schema = joigoose.convert(Joi.object({aString: Joi.string()})); diff --git a/types/joigoose/tsconfig.json b/types/joigoose/tsconfig.json new file mode 100644 index 0000000000..0add07f5d7 --- /dev/null +++ b/types/joigoose/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", + "joigoose-tests.ts" + ] +} diff --git a/types/joigoose/tslint.json b/types/joigoose/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/joigoose/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 09faa3ad4c98ddf46b829a5a82de903a58b8e4f3 Mon Sep 17 00:00:00 2001 From: Karoline Date: Sun, 7 May 2017 01:42:37 +0200 Subject: [PATCH 0058/1072] Fixed linting --- types/joigoose/index.d.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/types/joigoose/index.d.ts b/types/joigoose/index.d.ts index 3955f40c60..e1d0fe9919 100644 --- a/types/joigoose/index.d.ts +++ b/types/joigoose/index.d.ts @@ -6,10 +6,8 @@ import * as Mongoose from "mongoose"; import * as Joi from "joi"; -declare namespace Joigoose -{ - interface Joigoose - { +declare namespace Joigoose { + interface Joigoose { convert(schema: Joi.Schema): Mongoose.Schema; } } From 1bbe9e3b140d0b6cebf72675be424e55918718fd Mon Sep 17 00:00:00 2001 From: Lars Hvam Date: Sun, 7 May 2017 11:07:53 +0200 Subject: [PATCH 0059/1072] update to node-progress v2.0.0 --- types/progress/index.d.ts | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/types/progress/index.d.ts b/types/progress/index.d.ts index c42f819469..1989ebbed8 100644 --- a/types/progress/index.d.ts +++ b/types/progress/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for node-progress v1.1.8 +// Type definitions for node-progress v2.0.0 // Project: https://github.com/tj/node-progress // Definitions by: Sebastian Lenz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -15,12 +15,27 @@ interface ProgressBarOptions { * Total number of ticks to complete. */ total: number; - + + /** + * current completed index + */ + curr?: number; + + /** + * head character defaulting to complete character + */ + head?: string; + /** * The displayed width of the progress bar defaulting to total. */ width?: number; + /** + * minimum time between updates in milliseconds defaulting to 16 + */ + renderThrottle?: number; + /** * The output stream defaulting to stderr. */ From 5003a0b902d344440424a5875d6b308686668303 Mon Sep 17 00:00:00 2001 From: Michael Aird Date: Sun, 7 May 2017 08:36:53 -0400 Subject: [PATCH 0060/1072] 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 56f05fb35d0279656b724dfaadd09f1cad45786e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halasi=20Tam=C3=A1s?= Date: Sun, 7 May 2017 20:41:05 +0200 Subject: [PATCH 0061/1072] process.exit() should never return process.exit() should never return, so never is the correct return type --- types/node/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 67f275c7b6..497fcf521f 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -378,7 +378,7 @@ declare namespace NodeJS { chdir(directory: string): void; cwd(): string; env: any; - exit(code?: number): void; + exit(code?: number): never; exitCode: number; getgid(): number; setgid(id: number): void; From c41e404b389015e92ce33acc1b75fd976ab491d5 Mon Sep 17 00:00:00 2001 From: Philipp Zins Date: Mon, 8 May 2017 12:23:28 +0200 Subject: [PATCH 0062/1072] added test --- types/mailparser/mailparser-tests.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/types/mailparser/mailparser-tests.ts b/types/mailparser/mailparser-tests.ts index 30338b7fb6..30a6e7bf5c 100644 --- a/types/mailparser/mailparser-tests.ts +++ b/types/mailparser/mailparser-tests.ts @@ -2,6 +2,7 @@ import mailparser_mod = require("mailparser"); import MailParser = mailparser_mod.MailParser; import ParsedMail = mailparser_mod.ParsedMail; import Attachment = mailparser_mod.Attachment; +import simpleParser = mailparser_mod.simpleParser; var mailparser = new MailParser(); @@ -62,3 +63,16 @@ mp.on("attachment", function(attachment : Attachment, mail : ParsedMail){ var output = fs.createWriteStream(attachment.generatedFileName); attachment.stream.pipe(output); }); + +// check different sources and promise/callback api for simpleParser +var sourceString = ""; +var sourceBuffer = new Buffer(""); +var sourceStream = fs.createReadStream("foo.eml"); + +simpleParser(sourceString, (err, mail) => err ? err : mail.html); +simpleParser(sourceBuffer, (err, mail) => err ? err : mail.html); +simpleParser(sourceStream, (err, mail) => err ? err : mail.html); + +simpleParser(sourceString).then(mail => mail.html).catch(err => err); +simpleParser(sourceBuffer).then(mail => mail.html).catch(err => err); +simpleParser(sourceStream).then(mail => mail.html).catch(err => err); From 69f1cbd819a3872005b17108ddb6cda9c41175e5 Mon Sep 17 00:00:00 2001 From: Philipp Zins Date: Mon, 8 May 2017 12:28:59 +0200 Subject: [PATCH 0063/1072] added test --- types/selenium-webdriver/test/index.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/types/selenium-webdriver/test/index.ts b/types/selenium-webdriver/test/index.ts index f325fe6604..68cdd14fda 100644 --- a/types/selenium-webdriver/test/index.ts +++ b/types/selenium-webdriver/test/index.ts @@ -961,3 +961,7 @@ async function TestAsyncAwaitable() { let thenable: webdriver.promise.Promise = new webdriver.promise.Promise((resolve, reject) => resolve('foo')); let str: string = await thenable; } + +function TestPromiseManagerFlag() { + webdriver.promise.USE_PROMISE_MANAGER = false; +} From 3dd7e9e4cae1b4a8ec06507eed99f6b6e5cb9788 Mon Sep 17 00:00:00 2001 From: Thomas Deinhamer Date: Mon, 8 May 2017 23:50:48 +0200 Subject: [PATCH 0064/1072] Add `cors` option --- types/browser-sync/index.d.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/types/browser-sync/index.d.ts b/types/browser-sync/index.d.ts index 84b604c993..a122a00653 100644 --- a/types/browser-sync/index.d.ts +++ b/types/browser-sync/index.d.ts @@ -134,6 +134,12 @@ declare namespace browserSync { * Default: default */ browser?: string | string[]; + /** + * Add HTTP access control (CORS) headers to assets served by Browsersync. + * Default: false + * Note: requires at least version 2.16.0 + */ + cors?: boolean; /** * Requires an internet connection - useful for services such as Typekit as it allows you to configure * domains such as *.xip.io in your kit settings From e3536dddfaf572c9e2bb034d01fbd4e9811568eb Mon Sep 17 00:00:00 2001 From: Thomas Deinhamer Date: Mon, 8 May 2017 23:55:55 +0200 Subject: [PATCH 0065/1072] Update definitions header for browser-sync --- types/browser-sync/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/browser-sync/index.d.ts b/types/browser-sync/index.d.ts index a122a00653..449063192d 100644 --- a/types/browser-sync/index.d.ts +++ b/types/browser-sync/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for browser-sync // Project: http://www.browsersync.io/ // Definitions by: Asana , Joe Skeen +// Thomas "Thasmo" Deinhamer // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// From 41df2ed0f79ce72b4bc9d1cbcf5725703484dff2 Mon Sep 17 00:00:00 2001 From: Steve Hipwell Date: Tue, 9 May 2017 09:48:18 +0100 Subject: [PATCH 0066/1072] Added types for mongoose-unique-validator --- types/mongoose-unique-validator/index.d.ts | 13 +++++++++++ .../mongoose-unique-validator-tests.ts | 8 +++++++ types/mongoose-unique-validator/tsconfig.json | 22 +++++++++++++++++++ types/mongoose-unique-validator/tslint.json | 1 + 4 files changed, 44 insertions(+) create mode 100644 types/mongoose-unique-validator/index.d.ts create mode 100644 types/mongoose-unique-validator/mongoose-unique-validator-tests.ts create mode 100644 types/mongoose-unique-validator/tsconfig.json create mode 100644 types/mongoose-unique-validator/tslint.json diff --git a/types/mongoose-unique-validator/index.d.ts b/types/mongoose-unique-validator/index.d.ts new file mode 100644 index 0000000000..3cc2a13d80 --- /dev/null +++ b/types/mongoose-unique-validator/index.d.ts @@ -0,0 +1,13 @@ +// Type definitions for mongoose-unique-validator 1.0 +// Project: https://github.com/blakehaswell/mongoose-unique-validator#readme +// Definitions by: Steve Hipwell +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import { Schema } from "mongoose"; + +export = mongooseUniqueValidator; + +declare function mongooseUniqueValidator(schema: Schema, options?: any): void; + +declare namespace mongooseUniqueValidator { +} diff --git a/types/mongoose-unique-validator/mongoose-unique-validator-tests.ts b/types/mongoose-unique-validator/mongoose-unique-validator-tests.ts new file mode 100644 index 0000000000..59ada92a3c --- /dev/null +++ b/types/mongoose-unique-validator/mongoose-unique-validator-tests.ts @@ -0,0 +1,8 @@ +import { Schema } from "mongoose"; +import * as uniqueValidator from "mongoose-unique-validator"; + +const schema = new Schema({ + test: { type: String } +}); + +schema.plugin(uniqueValidator); diff --git a/types/mongoose-unique-validator/tsconfig.json b/types/mongoose-unique-validator/tsconfig.json new file mode 100644 index 0000000000..069b7515ff --- /dev/null +++ b/types/mongoose-unique-validator/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", + "mongoose-unique-validator-tests.ts" + ] +} diff --git a/types/mongoose-unique-validator/tslint.json b/types/mongoose-unique-validator/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/mongoose-unique-validator/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 8f143dcd96207fb1ecf8e274c0ef9c8cb2a65acb Mon Sep 17 00:00:00 2001 From: Ulrich Fischer Date: Tue, 9 May 2017 10:53:00 +0200 Subject: [PATCH 0067/1072] Update index.d.ts Added two missing conversion methods --- types/leaflet/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/leaflet/index.d.ts b/types/leaflet/index.d.ts index 41da11d362..3208733869 100644 --- a/types/leaflet/index.d.ts +++ b/types/leaflet/index.d.ts @@ -1372,9 +1372,11 @@ declare namespace L { layerPointToLatLng(point: PointExpression): LatLng; latLngToLayerPoint(latlng: LatLngExpression): Point; wrapLatLng(latlng: LatLngExpression): LatLng; + wrapLatLngBounds(bounds: LatLngBounds): LatLngBounds; distance(latlng1: LatLngExpression, latlng2: LatLngExpression): number; containerPointToLayerPoint(point: PointExpression): Point; layerPointToContainerPoint(point: PointExpression): Point; + containerPointToLatLng(point: PointExpression): LatLng; latLngToContainerPoint(latlng: LatLngExpression): Point; mouseEventToContainerPoint(ev: MouseEvent): Point; mouseEventToLayerPoint(ev: MouseEvent): Point; From 96fce1045b77851763303abfaa37372d8aeff5c0 Mon Sep 17 00:00:00 2001 From: Philipp A Date: Tue, 9 May 2017 10:43:17 +0200 Subject: [PATCH 0068/1072] added typings for rollup --- types/rollup/index.d.ts | 154 +++++++++++++++++++++++++++++++++++ types/rollup/rollup-tests.ts | 23 ++++++ types/rollup/tsconfig.json | 19 +++++ types/rollup/tslint.json | 6 ++ 4 files changed, 202 insertions(+) create mode 100644 types/rollup/index.d.ts create mode 100644 types/rollup/rollup-tests.ts create mode 100644 types/rollup/tsconfig.json create mode 100644 types/rollup/tslint.json diff --git a/types/rollup/index.d.ts b/types/rollup/index.d.ts new file mode 100644 index 0000000000..35cd523e2c --- /dev/null +++ b/types/rollup/index.d.ts @@ -0,0 +1,154 @@ +// Type definitions for rollup 0.41 +// Project: https://github.com/rollup/rollup +// Definitions by: Philipp A. +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import { RawSourceMap } from 'source-map' +import * as acorn from 'acorn' + +export type Format = 'amd' | 'cjs' | 'es' | 'iife' | 'umd' + +export interface SourceMap extends RawSourceMap { + toString(): string + toUrl(): string +} + +// https://github.com/rollup/rollup/wiki/JavaScript-API +export interface Warning { + code: string + message: string + loc?: { file: string, line: number, column: number } + frame?: string +} + +export interface BundleOptions { + /** The format of the generated bundle. */ + format?: Format + /** What export mode to use. Defaults to auto, which guesses your intentions based on what the `entry` module exports. */ + exports?: 'auto' | 'default' | 'named' | 'none' + /** An ID to use for AMD/UMD bundles. */ + moduleId?: string + /** The name to use for the module for UMD/IIFE bundles (required for bundles with exports). */ + moduleName?: string + /** Mapping of IDs → global variable names. Used for UMD/IIFE bundles. */ + globals?: { [id: string]: string } + /** + * The indent string to use, for formats that require code to be indented (AMD, IIFE, UMD). + * Can also be false (no indent), or true (the default – auto-indent) + */ + indent?: string | boolean + /** + * Whether or not to add an 'interop block'. By default (interop: true). + * For safety's sake, Rollup will assign any external dependencies' default exports to a separate variable if it's necessary to distinguish between default and named exports. + * This generally only applies if your external dependencies were transpiled (for example with Babel) – if you're sure you don't need it, you can save a few bytes with interop: false. + */ + interop?: boolean + /** A string to prepend to the bundle. */ + banner?: string + /** A string to append to the bundle. */ + footer?: string + /** A string prepended to the code inside of the format-specific wrapper */ + intro?: string + /** A string appended to the code inside of the format-specific wrapper */ + outro?: string + /** + * Whether to include the 'use strict' pragma at the top of generated non-ES6 bundles. + * Strictly-speaking (geddit?), ES6 modules are always in strict mode, so you shouldn't disable this without good reason. + */ + useStrict?: boolean +} + +export interface GenerateOptions extends BundleOptions { + /** Whether to generate a sourcemap. If true, the return value from `bundle.generate(...)` will include a map property */ + sourceMap?: boolean + /** + * The location of the generated bundle. If this is an absolute path, all the sources paths in the sourcemap will be relative to it. + * The map.file property is the basename of sourceMapFile, as the location of the sourcemap is assumed to be adjacent to the bundle. + */ + sourceMapFile?: string +} + +export interface WriteOptions extends BundleOptions { + /** The file to write to. If `options.sourceMap === true`, two files will be created – `dest` and `dest + '.map`. */ + dest: string + /** If `true`, a separate sourcemap file will be created. If `'inline'`, the sourcemap will be appended to the resulting dest file as a data URI. */ + sourceMap?: boolean | 'inline' + /** This option is unnecessary, as it defaults to the value of dest. */ + sourceMapFile?: string +} + +export interface Bundle { + /** Generate bundled code as an object */ + generate(options: GenerateOptions): { code: string, map: SourceMap } + /** writes the file (and accompanying sourcemap file, if appropriate) to the file system. */ + write(options: WriteOptions): Promise +} + +export interface Options { + /** The bundle's entry point (e.g. your `main.js` or `app.js` or `index.js`) */ + entry: string + /** A previous bundle. Use it to speed up subsequent bundles :) */ + cache?: Bundle + /** + * Function that returns if an ID is external or array of IDs of modules that should remain external to the bundle. + * The IDs should be either the name of an external dependency or a resolved ID (like an absolute path to a file) + */ + external?: ((id: string) => boolean) | string[] + /** + * Function that takes an ID and returns a path, or Object of id: path pairs. + * Where supplied, these paths will be used in the generated bundle instead of the module ID, allowing you to (for example) load dependencies from a CDN. + */ + paths?: ((id: string) => string) | { [id: string]: string } + /** Function that will intercept warning messages. If not supplied, warnings will be deduplicated and printed to the console. */ + onwarn?(warning: Warning): void + /** Array of plugin objects or a single plugin object */ + plugins?: Plugin | Plugin[] + /** + * Whether or not to apply tree-shaking. (Default: true) + * It's recommended that you omit this option, unless you discover a bug caused by the tree-shaking algorithm in which case use treeshake: false once you've filed an issue! + */ + treeshake?: boolean + /** Any options that should be passed through to Acorn. */ + acorn?: acorn.Options + /** By default, the context of a module – i.e., the value of `this` at the top level – is `undefined`. In rare cases you might need to change this to something else, like `'window'`. */ + context?: any + /** Same as `options.context`, but per-module. */ + moduleContext?: ((id: string) => any) | { [id: string]: any } + /** Adds support for very old environments like IE8, at the cost of some extra code. */ + legacy?: boolean +} + +// https://github.com/rollup/rollup/wiki/Plugins#creating-plugins +export interface Plugin { + /** The name of the plugin, for use in error messages and warnings */ + name?: string + /** A function that replaces or manipulates the options object passed to rollup.rollup */ + options?(options: Options): Options + /** A custom loader. Returning null or undefined defers to other load functions (and eventually the default behavior of loading from the file system). */ + load?(id: string): string | null | undefined + /** + * Custom resolver (useful for e.g. locating third-party dependencies). + * Returning null or undefined defers to other resolveId functions (and eventually the default resolution behavior); + * returning any other falsy value signals that importee should be treated as an external module and not included in the bundle. + */ + resolveId?(importee: string, importer: string): string | null | undefined | false | 0 | '' + /** A module transformer function */ + transform?(source: string, id: string): string | { code: string, map: SourceMap } + /** A bundle transformer function */ + transformBundle?(source: string, options: { format: Format }): string | { code: string, map: SourceMap } + /** Function hook called when bundle.generate() is being executed. */ + ongenerate?(options: GenerateOptions, bundle: Bundle): void + /** Function hook called when bundle.write() is being executed, after the file has been written to disk. */ + onwrite?(options: WriteOptions, bundle: Bundle): void + /** A function for generating intro text */ + intro?(): string + /** A function for generating outro text */ + outro?(): string + /** Prepend to the bundle. */ + banner?: string | (() => string) + /** Apppend to the bundle. */ + footer?: string | (() => string) +} + +/** Returns a Promise that resolves with a bundle */ +export function rollup(options: Options): Promise diff --git a/types/rollup/rollup-tests.ts b/types/rollup/rollup-tests.ts new file mode 100644 index 0000000000..b600fe25ee --- /dev/null +++ b/types/rollup/rollup-tests.ts @@ -0,0 +1,23 @@ +import { rollup, Bundle } from 'rollup' + +let cache: Bundle | undefined + +async function main() { + const bundle = await rollup({ + entry: 'main.js', + cache, + }) + + const result = bundle.generate({ + format: 'cjs', + }) + + cache = bundle + + await bundle.write({ + format: 'cjs', + dest: 'bundle.js', + }) +} + +main() diff --git a/types/rollup/tsconfig.json b/types/rollup/tsconfig.json new file mode 100644 index 0000000000..7c7b4dd5c5 --- /dev/null +++ b/types/rollup/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "rollup-tests.ts" + ] +} diff --git a/types/rollup/tslint.json b/types/rollup/tslint.json new file mode 100644 index 0000000000..ba7f6bc7ae --- /dev/null +++ b/types/rollup/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "semicolon": [true, "never"] + } +} From 1780de287002be8f9a322a66ead21863b79c1a47 Mon Sep 17 00:00:00 2001 From: Steve Hipwell Date: Tue, 9 May 2017 12:05:25 +0100 Subject: [PATCH 0069/1072] Added types for bunyan-winston-adapter --- .../bunyan-winston-adapter-tests.ts | 9 ++++++++ types/bunyan-winston-adapter/index.d.ts | 9 ++++++++ types/bunyan-winston-adapter/tsconfig.json | 22 +++++++++++++++++++ types/bunyan-winston-adapter/tslint.json | 1 + 4 files changed, 41 insertions(+) create mode 100644 types/bunyan-winston-adapter/bunyan-winston-adapter-tests.ts create mode 100644 types/bunyan-winston-adapter/index.d.ts create mode 100644 types/bunyan-winston-adapter/tsconfig.json create mode 100644 types/bunyan-winston-adapter/tslint.json diff --git a/types/bunyan-winston-adapter/bunyan-winston-adapter-tests.ts b/types/bunyan-winston-adapter/bunyan-winston-adapter-tests.ts new file mode 100644 index 0000000000..fc4518fa29 --- /dev/null +++ b/types/bunyan-winston-adapter/bunyan-winston-adapter-tests.ts @@ -0,0 +1,9 @@ +import { createAdapter } from "bunyan-winston-adapter"; +import { Logger, LoggerInstance, transports } from "winston"; + +const logger = new Logger(); +const mapping = { + trace: 'silly' +}; +const adapterA = createAdapter(logger); +const adapterB = createAdapter(logger, mapping); diff --git a/types/bunyan-winston-adapter/index.d.ts b/types/bunyan-winston-adapter/index.d.ts new file mode 100644 index 0000000000..e0c4f835d9 --- /dev/null +++ b/types/bunyan-winston-adapter/index.d.ts @@ -0,0 +1,9 @@ +// Type definitions for bunyan-winston-adapter 0.2 +// Project: https://github.com/gluwer/bunyan-winston-adapter +// Definitions by: Steve Hipwell +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import * as bunyan from "bunyan"; +import { LoggerInstance } from "winston"; + +export function createAdapter(logger: LoggerInstance, mapping?: any): bunyan; diff --git a/types/bunyan-winston-adapter/tsconfig.json b/types/bunyan-winston-adapter/tsconfig.json new file mode 100644 index 0000000000..7185731caf --- /dev/null +++ b/types/bunyan-winston-adapter/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", + "bunyan-winston-adapter-tests.ts" + ] +} diff --git a/types/bunyan-winston-adapter/tslint.json b/types/bunyan-winston-adapter/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/bunyan-winston-adapter/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 97ba49c9d107d54fa01dc2bbd475e2868bab1b2c Mon Sep 17 00:00:00 2001 From: Flarna Date: Tue, 9 May 2017 17:56:56 +0200 Subject: [PATCH 0070/1072] Add crypto.randomFillSync() and crypto.randomFill() --- types/node/index.d.ts | 7 +++++ types/node/node-tests.ts | 62 ++++++++++++++++++++++++++-------------- 2 files changed, 48 insertions(+), 21 deletions(-) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 67f275c7b6..39e5eb4506 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -3478,6 +3478,13 @@ declare module "crypto" { export function randomBytes(size: number, callback: (err: Error, buf: Buffer) => void): void; export function pseudoRandomBytes(size: number): Buffer; export function pseudoRandomBytes(size: number, callback: (err: Error, buf: Buffer) => void): void; + export function randomFillSync(buffer: Buffer | Uint8Array, offset?: number, size?: number): Buffer; + export function randomFill(buffer: Buffer, callback: (err: Error, buf: Buffer) => void): void; + export function randomFill(buffer: Uint8Array, callback: (err: Error, buf: Uint8Array) => void): void; + export function randomFill(buffer: Buffer, offset: number, callback: (err: Error, buf: Buffer) => void): void; + export function randomFill(buffer: Uint8Array, offset: number, callback: (err: Error, buf: Uint8Array) => void): void; + export function randomFill(buffer: Buffer, offset: number, size: number, callback: (err: Error, buf: Buffer) => void): void; + export function randomFill(buffer: Uint8Array, offset: number, size: number, callback: (err: Error, buf: Uint8Array) => void): void; export interface RsaPublicKey { key: string; padding?: number; diff --git a/types/node/node-tests.ts b/types/node/node-tests.ts index 7cac17144e..e3ceca3354 100644 --- a/types/node/node-tests.ts +++ b/types/node/node-tests.ts @@ -632,10 +632,10 @@ namespace crypto_tests { } { - let hmac: crypto.Hmac; - (hmac = crypto.createHmac('md5', 'hello')).end('world', 'utf8', () => { + let hmac: crypto.Hmac; + (hmac = crypto.createHmac('md5', 'hello')).end('world', 'utf8', () => { let hash: Buffer | string = hmac.read(); - }); + }); } { @@ -644,13 +644,13 @@ namespace crypto_tests { let clearText: string = "This is the clear text."; let cipher: crypto.Cipher = crypto.createCipher("aes-128-ecb", key); let cipherText: string = cipher.update(clearText, "utf8", "hex"); - cipherText += cipher.final("hex"); + cipherText += cipher.final("hex"); let decipher: crypto.Decipher = crypto.createDecipher("aes-128-ecb", key); let clearText2: string = decipher.update(cipherText, "hex", "utf8"); - clearText2 += decipher.final("utf8"); + clearText2 += decipher.final("utf8"); - assert.equal(clearText2, clearText); + assert.equal(clearText2, clearText); } { @@ -659,19 +659,19 @@ namespace crypto_tests { let clearText: Buffer = new Buffer([1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4]); let cipher: crypto.Cipher = crypto.createCipher("aes-128-ecb", key); let cipherBuffers: Buffer[] = []; - cipherBuffers.push(cipher.update(clearText)); - cipherBuffers.push(cipher.final()); + cipherBuffers.push(cipher.update(clearText)); + cipherBuffers.push(cipher.final()); let cipherText: Buffer = Buffer.concat(cipherBuffers); let decipher: crypto.Decipher = crypto.createDecipher("aes-128-ecb", key); let decipherBuffers: Buffer[] = []; - decipherBuffers.push(decipher.update(cipherText)); - decipherBuffers.push(decipher.final()); + decipherBuffers.push(decipher.update(cipherText)); + decipherBuffers.push(decipher.final()); let clearText2: Buffer = Buffer.concat(decipherBuffers); - assert.deepEqual(clearText2, clearText); + assert.deepEqual(clearText2, clearText); } { @@ -682,6 +682,26 @@ namespace crypto_tests { assert(crypto.timingSafeEqual(buffer1, buffer2)) assert(!crypto.timingSafeEqual(buffer1, buffer3)) } + + { + let buffer: Buffer = new Buffer(10); + crypto.randomFillSync(buffer); + crypto.randomFillSync(buffer, 2); + crypto.randomFillSync(buffer, 2, 3); + + crypto.randomFill(buffer, (err: Error, buf: Buffer) => void {}); + crypto.randomFill(buffer, 2, (err: Error, buf: Buffer) => void {}); + crypto.randomFill(buffer, 2, 3, (err: Error, buf: Buffer) => void {}); + + let arr: Uint8Array = new Uint8Array(10); + crypto.randomFillSync(arr); + crypto.randomFillSync(arr, 2); + crypto.randomFillSync(arr, 2, 3); + + crypto.randomFill(arr, (err: Error, buf: Uint8Array) => void {}); + crypto.randomFill(arr, 2, (err: Error, buf: Uint8Array) => void {}); + crypto.randomFill(arr, 2, 3, (err: Error, buf: Uint8Array) => void {}); + } } ////////////////////////////////////////////////// @@ -690,17 +710,17 @@ namespace crypto_tests { namespace tls_tests { { - var ctx: tls.SecureContext = tls.createSecureContext({ - key: "NOT REALLY A KEY", - cert: "SOME CERTIFICATE", - }); - var blah = ctx.context; + var ctx: tls.SecureContext = tls.createSecureContext({ + key: "NOT REALLY A KEY", + cert: "SOME CERTIFICATE", + }); + var blah = ctx.context; - var connOpts: tls.ConnectionOptions = { - host: "127.0.0.1", - port: 55 - }; - var tlsSocket = tls.connect(connOpts); + var connOpts: tls.ConnectionOptions = { + host: "127.0.0.1", + port: 55 + }; + var tlsSocket = tls.connect(connOpts); } { From 958fad8fcfd8a48bd6f4a530e76046aec6127e22 Mon Sep 17 00:00:00 2001 From: nat1130NS Date: Tue, 9 May 2017 09:06:30 -0700 Subject: [PATCH 0071/1072] 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 6bc6bae5aee45034ce8c687015702b691a9477c3 Mon Sep 17 00:00:00 2001 From: Philip Bulley Date: Tue, 9 May 2017 17:16:49 +0100 Subject: [PATCH 0072/1072] Adds v2.2.1 methods and option properties --- types/lory.js/index.d.ts | 44 +++++++++++++++++++++++++++++++++- types/lory.js/lory.js-tests.ts | 8 ++++++- 2 files changed, 50 insertions(+), 2 deletions(-) diff --git a/types/lory.js/index.d.ts b/types/lory.js/index.d.ts index 75c07f9eed..6404ae14f8 100644 --- a/types/lory.js/index.d.ts +++ b/types/lory.js/index.d.ts @@ -1,6 +1,7 @@ -// Type definitions for lory 0.4.3 +// Type definitions for lory 2.2.1 // Project: https://github.com/meandmax/lory/ // Definitions by: kubosho +// milkisevil // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare var lory: LoryStatic; @@ -23,6 +24,11 @@ interface LoryStatic { */ slideTo(index: number): void; + /** + * returns the index of the current slide element + */ + returnIndex(): number; + /** * binds eventlisteners, merging default and user options, setup the slides based on DOM (called once during initialisation). Call setup if DOM or user options have changed or eventlisteners needs to be rebinded. */ @@ -32,6 +38,11 @@ interface LoryStatic { * sets the slider back to the starting position and resets the current index (called on resize event). */ reset(): void; + + /** + * unmount/destroy the instance of lory + */ + destroy(): void; } interface LoryOptions { @@ -44,6 +55,12 @@ interface LoryOptions { */ slidesToScroll?: number; + /** + * enabled mouse events + * default: false + */ + enableMouseEvents?: boolean; + /** * time in milliseconds for the animation of a valid slide attempt (default: 300). */ @@ -74,6 +91,31 @@ interface LoryOptions { */ infinite?: boolean | number; + /** + * class name for slider frame + * default: 'js_frame' + */ + classNameFrame?: string; + + /** + * class name for slides container + * default: 'js_slides' + */ + classNameSlideContainer?: string; + + /** + * class name for slider previous control + * default: 'js_prev' + */ + classNamePrevCtrl?: string; + + /** + * class name for slider next control + * default: 'js_next' + */ + classNameNextCtrl?: string; + + ////////////////////////////////////////////////// // Callbacks ////////////////////////////////////////////////// diff --git a/types/lory.js/lory.js-tests.ts b/types/lory.js/lory.js-tests.ts index f67c724e6e..bad97dadf3 100644 --- a/types/lory.js/lory.js-tests.ts +++ b/types/lory.js/lory.js-tests.ts @@ -20,7 +20,11 @@ snapBackSpeed: 200, ease: 'ease', rewind: true, - infinite: false + infinite: false, + classNameFrame: 'js_frame', + classNameSlideContainer: 'js_slides', + classNamePrevCtrl: 'js_prev', + classNameNextCtrl: 'js_next' }); // with callbacks @@ -57,6 +61,8 @@ lory.setup(); lory.prev(); lory.next(); + lory.returnIndex(); lory.reset(); lory.slideTo(1); + lory.destroy(); }()); From 7b9caf31b37c64c6403d57e4edc92fad8fa8ce01 Mon Sep 17 00:00:00 2001 From: Philip Bulley Date: Tue, 9 May 2017 17:40:14 +0100 Subject: [PATCH 0073/1072] Unified indenting with spaces as per before --- types/lory.js/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/lory.js/index.d.ts b/types/lory.js/index.d.ts index 6404ae14f8..6da87b70b8 100644 --- a/types/lory.js/index.d.ts +++ b/types/lory.js/index.d.ts @@ -1,7 +1,7 @@ // Type definitions for lory 2.2.1 // Project: https://github.com/meandmax/lory/ // Definitions by: kubosho -// milkisevil +// philip bulley // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare var lory: LoryStatic; From de601567dcf0bfaa6deb623cff99a974eb9f5af3 Mon Sep 17 00:00:00 2001 From: Dolan Date: Tue, 9 May 2017 18:09:04 +0100 Subject: [PATCH 0074/1072] initial commit --- types/jsforce/index.d.ts | 198 +++++++++++++++++++++++++++++++++ types/jsforce/jsforce-tests.ts | 1 + types/jsforce/tsconfig.json | 22 ++++ types/jsforce/tslint.json | 6 + 4 files changed, 227 insertions(+) create mode 100644 types/jsforce/index.d.ts create mode 100644 types/jsforce/jsforce-tests.ts create mode 100644 types/jsforce/tsconfig.json create mode 100644 types/jsforce/tslint.json diff --git a/types/jsforce/index.d.ts b/types/jsforce/index.d.ts new file mode 100644 index 0000000000..4b7dedc2e4 --- /dev/null +++ b/types/jsforce/index.d.ts @@ -0,0 +1,198 @@ +// Type definitions for archiver 1.8 +// Project: https://github.com/jsforce/jsforce +// Definitions by: Dolan Miu +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import * as fs from 'fs'; +import * as stream from 'stream'; +import * as express from 'express'; +import * as glob from 'glob'; + +declare namespace jsforce { + type ConnectionEvent = "refresh"; + class Connection { + constructor(params: ConnectionOptions) + + sobject(resource: string): SObject; + on(eventName: ConnectionEvent, callback: Function): void; + } + + class SObject { + create(options: any, callback?: (err: Error, ret: RecordResult) => void): void; + record(options: any, callback?: (err: Error, ret: any) => void): void; + update(options: SObjectCreateOptions, callback?: (err: Error, ret: any) => void): void; + retrieve(objectId: string | string[], callback?: (err: Error, ret: any) => void): void; + del(objectId: string | string[], callback?: (err: Error, ret: any) => void): void; + destroy(objectId: string | string[], callback?: (err: Error, ret: any) => void): void; + delete(objectId: string | string[], callback?: (err: Error, ret: any) => void): void; + // upsert(options: SObjectOptions): void; + describe(callback: (err: Error, ret: Meta) => void): void; + describeGlobal(callback: (err: Error, res: any) => void): void; + describe$(callback: (err: Error, ret: Meta) => void): void; + describeGlobal$(callback: (err: Error, res: any) => void): void; + + find(query?: any, callback?: (err: Error, ret: T[]) => void): Query; + find(query?: any, fields?: Object | string[] | string, callback?: (err: Error, ret: T[]) => void): Query; + find(query?: any, fields?: Object | string[] | string, options?: Object, callback?: (err: Error, ret: T[]) => void): Query; + + findOne(query?: any, callback?: (err: Error, ret: T) => void): void; + findOne(query?: any, fields?: Object | string[] | string, callback?: (err: Error, ret: T) => void): void; + findOne(query?: any, fields?: Object | string[] | string, options?: Object, callback?: (err: Error, ret: T) => void): void; + } + + interface ConnectionOptions { + instanceUrl?: string; + accessToken?: string; + refreshToken?: string; + oauth2?: { + clientId: string, + clientSecret: string, + redirectUri?: string, + }; + sessionId?: string; + serverUrl?: string; + redirectUri?: string; + } + + interface SObjectOptions { + Id?: SalesforceId; + Name?: string; + ExtId__c?: string; + } + + class SalesforceId extends String { + } + + interface SObjectCreateOptions extends SObjectOptions { + IsDeleted?: boolean, + MasterRecordId?: SalesforceId, + Name?: string, + Type?: string, + ParentId?: SalesforceId, + BillingStreet?: string, + BillingCity?: string, + BillingState?: string, + BillingPostalCode?: string, + BillingCountry?: string, + BillingLatitude?: number, + BillingLongitude?: number, + ShippingStreet?: string, + ShippingCity?: string, + ShippingState?: string, + ShippingPostalCode?: string, + ShippingCountry?: string, + ShippingLatitude?: number, + ShippingLongitude?: number, + Phone?: string, + Website?: string, + Industry?: string, + NumberOfEmployees?: number, + Description?: string, + OwnerId?: SalesforceId, + CreatedDate?: Date, + CreatedById?: SalesforceId, + LastModifiedDate?: Date, + LastModifiedById?: SalesforceId, + SystemModstamp?: Date, + LastActivityDate?: Date, + LastViewedDate?: Date, + LastReferencedDate?: Date, + Jigsaw?: string; + JigsawCompanyId?: string; + AccountSource?: string; + SicDesc?: string; + } + + interface Meta { + label: string; + fields: string[]; + } + + enum Date { + YESTERDAY + } + + class Query { + filter(filter: Object): Query; + hint(hint: Object): Query; + limit(value: number): Query; + maxFetch(value: number): Query; + offset(value: number): Query; + skip(value: number): Query; + sort(keyOrList: string | Object[] | Object, direction?: "ASC" | "DESC" | number): Query; + run(options?: ExecuteOptions, callback?: (err: Error, records: T[]) => void): Query; + execute(options?: ExecuteOptions, callback?: (err: Error, records: T[]) => void): Query; + exec(options?: ExecuteOptions, callback?: (err: Error, records: T[]) => void): Query; + del(callback?: (err: Error, ret: RecordResult) => void): any; + delete(callback?: (err: Error, ret: RecordResult) => void): any; + destroy(callback?: (err: Error, ret: RecordResult) => void): Promise; + explain(callback?: (err: Error, info: ExplainInfo) => void): Promise; + scanAll(value: boolean): Query; + select(fields: Object | string[] | string): Query; + then(onSuccess?: Function, onRejected?: Function): Promise; + thenCall(callback?: (err: Error, records: T) => void): Query; + toSOQL(callback: (err: Error, soql: string) => void): Promise; + update(mapping: any, type: string, callback: (err: Error, records: RecordResult[]) => void): Promise; + where(conditions: Object | string): Query; + } + + interface ExecuteOptions { + autoFetch?: boolean; + maxFetch?: number; + scanAll?: number; + } + + interface RecordResult { id: SalesforceId, success: boolean, anys: Object[] } + interface ExplainInfo { } + + interface SalesforceContentVersionDocument { + attributes: + { + type: string, + url: string, + }; + Id: SalesforceId, + ContentDocumentId: SalesforceId, + IsLatest: boolean, + ContentUrl: string, + VersionNumber: string, + Title: string, + Description: string, + ReasonForChange: string, + SharingOption: string, + PathOnClient: string, + RatingCount: number, + IsDeleted: boolean, + ContentModifiedDate: Date, + ContentModifiedById: SalesforceId, + PositiveRatingCount: number, + NegativeRatingCount: number, + FeaturedContentBoost: Date, + FeaturedContentDate: Date, + OwnerId: SalesforceId, + CreatedById: SalesforceId, + CreatedDate: Date, + LastModifiedById: SalesforceId, + LastModifiedDate: Date, + SystemModstamp: Date, + TagCsv: string, + FileType: string, + PublishStatus: string, + VersionData: string, + ContentSize: number, + FileExtension: string, + FirstPublishLocationId: SalesforceId, + Origin: string, + ContentLocation: string, + TextPreview: string, + ExternalDocumentInfo1: string, + ExternalDocumentInfo2: string, + ExternalDataSourceId: string, + Checksum: string, + IsMajorVersion: boolean, + IsAssetEnabled: boolean, + User__c: string + } +} + +export = jsforce; diff --git a/types/jsforce/jsforce-tests.ts b/types/jsforce/jsforce-tests.ts new file mode 100644 index 0000000000..334116ee23 --- /dev/null +++ b/types/jsforce/jsforce-tests.ts @@ -0,0 +1 @@ +import * as jsforce from 'jsforce'; diff --git a/types/jsforce/tsconfig.json b/types/jsforce/tsconfig.json new file mode 100644 index 0000000000..a7acac4d84 --- /dev/null +++ b/types/jsforce/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "jsforce-tests.ts" + ] +} \ No newline at end of file diff --git a/types/jsforce/tslint.json b/types/jsforce/tslint.json new file mode 100644 index 0000000000..a62d0d4e68 --- /dev/null +++ b/types/jsforce/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "ban-types": false + } +} From e821bc121bef99ed3d7bd2ac80f4314d96bb2735 Mon Sep 17 00:00:00 2001 From: Dolan Date: Tue, 9 May 2017 18:35:42 +0100 Subject: [PATCH 0075/1072] added more typings --- types/jsforce/index.d.ts | 78 ++++++++++------------------------ types/jsforce/jsforce-tests.ts | 46 +++++++++++++++++++- 2 files changed, 67 insertions(+), 57 deletions(-) diff --git a/types/jsforce/index.d.ts b/types/jsforce/index.d.ts index 4b7dedc2e4..67d0fcdda2 100644 --- a/types/jsforce/index.d.ts +++ b/types/jsforce/index.d.ts @@ -18,17 +18,12 @@ declare namespace jsforce { } class SObject { - create(options: any, callback?: (err: Error, ret: RecordResult) => void): void; record(options: any, callback?: (err: Error, ret: any) => void): void; update(options: SObjectCreateOptions, callback?: (err: Error, ret: any) => void): void; retrieve(objectId: string | string[], callback?: (err: Error, ret: any) => void): void; - del(objectId: string | string[], callback?: (err: Error, ret: any) => void): void; - destroy(objectId: string | string[], callback?: (err: Error, ret: any) => void): void; - delete(objectId: string | string[], callback?: (err: Error, ret: any) => void): void; // upsert(options: SObjectOptions): void; - describe(callback: (err: Error, ret: Meta) => void): void; describeGlobal(callback: (err: Error, res: any) => void): void; - describe$(callback: (err: Error, ret: Meta) => void): void; + describe$(callback: (err: Error, ret: DescribeSObjectResult) => void): void; describeGlobal$(callback: (err: Error, res: any) => void): void; find(query?: any, callback?: (err: Error, ret: T[]) => void): Query; @@ -38,6 +33,20 @@ declare namespace jsforce { findOne(query?: any, callback?: (err: Error, ret: T) => void): void; findOne(query?: any, fields?: Object | string[] | string, callback?: (err: Error, ret: T) => void): void; findOne(query?: any, fields?: Object | string[] | string, options?: Object, callback?: (err: Error, ret: T) => void): void; + + approvalLayouts(callback?: (layoutInfo: ApprovalLayoutInfo) => void): Promise; + bulkload(operation: string, options?: { extIdField?: string }, input?: Record[] | stream.Stream[] | string[], callback?: (err: Error, ret: RecordResult) => void): Batch; + 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; + 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; + 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; + describe(callback?: (err: Error, ret: DescribeSObjectResult) => void): Promise; } interface ConnectionOptions { @@ -103,7 +112,7 @@ declare namespace jsforce { SicDesc?: string; } - interface Meta { + interface DescribeSObjectResult { label: string; fields: string[]; } @@ -143,56 +152,13 @@ declare namespace jsforce { } interface RecordResult { id: SalesforceId, success: boolean, anys: Object[] } - interface ExplainInfo { } - interface SalesforceContentVersionDocument { - attributes: - { - type: string, - url: string, - }; - Id: SalesforceId, - ContentDocumentId: SalesforceId, - IsLatest: boolean, - ContentUrl: string, - VersionNumber: string, - Title: string, - Description: string, - ReasonForChange: string, - SharingOption: string, - PathOnClient: string, - RatingCount: number, - IsDeleted: boolean, - ContentModifiedDate: Date, - ContentModifiedById: SalesforceId, - PositiveRatingCount: number, - NegativeRatingCount: number, - FeaturedContentBoost: Date, - FeaturedContentDate: Date, - OwnerId: SalesforceId, - CreatedById: SalesforceId, - CreatedDate: Date, - LastModifiedById: SalesforceId, - LastModifiedDate: Date, - SystemModstamp: Date, - TagCsv: string, - FileType: string, - PublishStatus: string, - VersionData: string, - ContentSize: number, - FileExtension: string, - FirstPublishLocationId: SalesforceId, - Origin: string, - ContentLocation: string, - TextPreview: string, - ExternalDocumentInfo1: string, - ExternalDocumentInfo2: string, - ExternalDataSourceId: string, - Checksum: string, - IsMajorVersion: boolean, - IsAssetEnabled: boolean, - User__c: string - } + interface ExplainInfo { } + interface ApprovalLayoutInfo { } + interface Record { } + interface Batch { } + interface CompactLayoutInfo { } + interface DeletedRecordsInfo { } } export = jsforce; diff --git a/types/jsforce/jsforce-tests.ts b/types/jsforce/jsforce-tests.ts index 334116ee23..cf25cd4a6b 100644 --- a/types/jsforce/jsforce-tests.ts +++ b/types/jsforce/jsforce-tests.ts @@ -1 +1,45 @@ -import * as jsforce from 'jsforce'; +import * as sf from 'jsforce'; + +const salesforceConnection: sf.Connection = new sf.Connection({ + instanceUrl: '', + refreshToken: '', + oauth2: { + clientId: '', + clientSecret: '', + }, +}); + +salesforceConnection.sobject("Account").create({ + Name: "Test Acc 2", + BillingStreet: "Maplestory street", + BillingPostalCode: "ME4 666" +}, (err, ret: sf.RecordResult) => { + if (err || !ret.success) { + return; + } +}); + +salesforceConnection.sobject("ContentVersion").create({ + OwnerId: '', + Title: 'hello', + PathOnClient: './hello-world.jpg', + VersionData: '{ Test: Data }' +}, (err, ret: sf.RecordResult) => { + if (err || !ret.success) { + return; + } +}); + +salesforceConnection.sobject("ContentVersion").findOne({ Id: '' }, (err, contentVersion) => { + +}); + +salesforceConnection.sobject("ContentDocumentLink").create({ + ContentDocumentId: '', + LinkedEntityId: '', + ShareType: "I" +}, (err, ret: sf.RecordResult) => { + if (err || !ret.success) { + return; + } +}); \ No newline at end of file From 7c947f742ce8ebe1b5567e9851c0041ba1dcdee2 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Tue, 9 May 2017 12:06:17 -0700 Subject: [PATCH 0076/1072] Fix typo in PR template --- .github/PULL_REQUEST_TEMPLATE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 4338219f31..979a8311e0 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -17,7 +17,7 @@ If adding a new definition: If changing an existing definition: - [ ] Provide a URL to documentation or source code which provides context for the suggested changes: <> - [ ] Increase the version number in the header if appropriate. -- [ ] If you are making substantial changes, consider adding a `tslint.json` containing `{ "extends": "dslint/dt.json" }`. +- [ ] If you are making substantial changes, consider adding a `tslint.json` containing `{ "extends": "dtslint/dt.json" }`. If removing a declaration: - [ ] If a package was never on DefinitelyTyped, you don't need to do anything. (If you wrote a package and provided types, you don't need to register it with us.) From 5de9566dada34d79c0f8e749787f78b00efd13bb Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Wed, 10 May 2017 08:51:47 +0200 Subject: [PATCH 0077/1072] material-ui: Expose tabTemplateStyle on TabsProps --- types/material-ui/index.d.ts | 1 + types/material-ui/material-ui-tests.tsx | 37 +++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/types/material-ui/index.d.ts b/types/material-ui/index.d.ts index 47c124595e..832cdd04dd 100644 --- a/types/material-ui/index.d.ts +++ b/types/material-ui/index.d.ts @@ -1767,6 +1767,7 @@ declare namespace __MaterialUI { style?: React.CSSProperties; tabItemContainerStyle?: React.CSSProperties; tabTemplate?: React.ComponentClass; + tabTemplateStyle?: React.CSSProperties; value?: any; } export class Tabs extends React.Component { diff --git a/types/material-ui/material-ui-tests.tsx b/types/material-ui/material-ui-tests.tsx index a0d8d32d92..dfa669f306 100644 --- a/types/material-ui/material-ui-tests.tsx +++ b/types/material-ui/material-ui-tests.tsx @@ -4733,6 +4733,43 @@ const TabsExampleSimple = () => ( ); +const TabsExampleTeamplateStyle = () => ( + + +

+

Tab One

+

+ This is an example tab. +

+

+ You can put any sort of HTML or react component in here. It even keeps the component state! +

+ +
+ + +
+

Tab Two

+

+ This is another example tab. +

+
+
+ +
+

Tab Three

+

+ This is a third example tab. +

+
+
+ +); + class TabsExampleControlled extends React.Component<{}, {value?: string}> { constructor(props) { From de2bdd9e6668fb526be2d4a4ebab34e2ae43f898 Mon Sep 17 00:00:00 2001 From: Kalle Ott Date: Wed, 10 May 2017 10:09:11 +0200 Subject: [PATCH 0078/1072] added type definitions for the micro library --- types/micro/index.d.ts | 26 ++++++++++++++++ types/micro/micro-tests.ts | 62 ++++++++++++++++++++++++++++++++++++++ types/micro/tsconfig.json | 22 ++++++++++++++ types/micro/tslint.json | 9 ++++++ 4 files changed, 119 insertions(+) create mode 100644 types/micro/index.d.ts create mode 100644 types/micro/micro-tests.ts create mode 100644 types/micro/tsconfig.json create mode 100644 types/micro/tslint.json diff --git a/types/micro/index.d.ts b/types/micro/index.d.ts new file mode 100644 index 0000000000..b2ad7c5460 --- /dev/null +++ b/types/micro/index.d.ts @@ -0,0 +1,26 @@ +// Type definitions for micro 7.3 +// Project: https://github.com/zeit/micro +// Definitions by: Kalle Ott +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +import { IncomingMessage, ServerResponse, Server } from 'http'; + +export type RequestHandler = (req: IncomingMessage, res: ServerResponse) => any + +export const run: (req: IncomingMessage, res: ServerResponse, fn: RequestHandler) => Promise + +declare const serve: (fn: RequestHandler) => Server +export default serve; + +export const send: (res: ServerResponse, code: number, obj?: object) => Promise + +export const sendError: (req: IncomingMessage, res: ServerResponse, info: { statusCode?: number, status?: number, message?: string, stack?: string }) => Promise + +export function createError(code: number, msg: string, orig?: Error): Error & { statusCode: number, originalError?: Error } + +export const buffer: (req: IncomingMessage, info?: { limit?: string, encoding?: string }) => Promise + +export const text: (req: IncomingMessage, info?: { limit?: string, encoding?: string }) => Promise + +export const json: (req: IncomingMessage, info?: { limit?: string, encoding?: string }) => Promise diff --git a/types/micro/micro-tests.ts b/types/micro/micro-tests.ts new file mode 100644 index 0000000000..d3f8743f27 --- /dev/null +++ b/types/micro/micro-tests.ts @@ -0,0 +1,62 @@ +import { json, RequestHandler, buffer, text, send, createError } from 'micro' +import micro from 'micro' + +// Json sample + +export const jsonHandler: RequestHandler = async (req, res) => { + const data = await json(req) + console.log(data) + + return 'Data logged to your console' +} + +// socket.io chat app sample + +const html = '
some html stuff
' + +const server = micro(async (req, res) => { + console.log('Serving index.html'); + res.end(html); +}); + +import * as socketIO from 'socket.io' + +const io = socketIO(server); + +server.listen(4000); + +// Micro expects a function to be exported +module.exports = () => console.log('YOLO'); + +// body parsing sample + +const bodyParsingHandler: RequestHandler = async (req, res) => { + const buf = await buffer(req) + console.log(buf) + // + const txt = await text(req) + // '{"price": 9.99}' + const js: any = await json(req) + // { price: 9.99 } + console.log(js.price) + return '' +} + +// send different status code sample + +const statusHandler: RequestHandler = async (req, res) => { + const statusCode = 400 + const data = { error: 'Custom error message' } + + send(res, statusCode, data) +} + +// createError sample + +const errorHandler: RequestHandler = async (req, res) => { + const data = { error: 'Custom error message' } + + if (data.error) { + throw createError(429, 'Rate limit exceeded') + } +} diff --git a/types/micro/tsconfig.json b/types/micro/tsconfig.json new file mode 100644 index 0000000000..7975056600 --- /dev/null +++ b/types/micro/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es2017" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "micro-tests.ts" + ] +} \ No newline at end of file diff --git a/types/micro/tslint.json b/types/micro/tslint.json new file mode 100644 index 0000000000..9750934ff2 --- /dev/null +++ b/types/micro/tslint.json @@ -0,0 +1,9 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "semicolon": [ + false + ], + "prefer-declare-function": false + } +} \ No newline at end of file From 02b62e98b02a27ea6431fa763f5c44fa0441198b Mon Sep 17 00:00:00 2001 From: Jonas Thiel Date: Wed, 10 May 2017 11:03:27 +0200 Subject: [PATCH 0079/1072] Update react-native-snap-carousel to v2.1.2 A new property `carouselHorizontalPadding ` was introduced in version 2.1.2. https://github.com/archriss/react-native-snap-carousel/blob/master/CHANGELOG.md#v212 --- types/react-native-snap-carousel/index.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/types/react-native-snap-carousel/index.d.ts b/types/react-native-snap-carousel/index.d.ts index ff77486831..7a80378514 100644 --- a/types/react-native-snap-carousel/index.d.ts +++ b/types/react-native-snap-carousel/index.d.ts @@ -82,6 +82,11 @@ export interface CarouselProps extends React.Props { * Animation options to be merged with the default ones. Can be used w/ animationFunc */ animationOptions?: Animated.DecayAnimationConfig | Animated.TimingAnimationConfig | Animated.SpringAnimationConfig; + /** + * Override container's inner padding (needed for slides's centering). + * Warning: be aware that overriding the default value can mess with carousel's behavior. + */ + carouselHorizontalPadding?: number; /** * Optional styles for Scrollview's global wrapper */ From 96120b1093d1dd696cda9c363bef2fd287987400 Mon Sep 17 00:00:00 2001 From: newraina Date: Wed, 10 May 2017 17:43:52 +0800 Subject: [PATCH 0080/1072] fix fetch.io --- types/fetch.io/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/fetch.io/index.d.ts b/types/fetch.io/index.d.ts index ab949d4880..8258cbf8da 100644 --- a/types/fetch.io/index.d.ts +++ b/types/fetch.io/index.d.ts @@ -23,7 +23,7 @@ export interface Options extends RequestInit { header?: Header; - beforeRequest?(url: TUrl, body: BodyInit): boolean; + beforeRequest?(url: TUrl, body: BodyInit): boolean | void; afterResponse?(res: Response): void; From 4e245f5fdbbfbbce10f54013fde3ea78aa064837 Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Wed, 10 May 2017 12:16:08 +0200 Subject: [PATCH 0081/1072] Move the test code --- types/material-ui/material-ui-tests.tsx | 37 ------------------------- 1 file changed, 37 deletions(-) diff --git a/types/material-ui/material-ui-tests.tsx b/types/material-ui/material-ui-tests.tsx index dfa669f306..d81155dfcc 100644 --- a/types/material-ui/material-ui-tests.tsx +++ b/types/material-ui/material-ui-tests.tsx @@ -4697,43 +4697,6 @@ function handleActive(tab) { } const TabsExampleSimple = () => ( - - -
-

Tab One

-

- This is an example tab. -

-

- You can put any sort of HTML or react component in here. It even keeps the component state! -

- -
-
- -
-

Tab Two

-

- This is another example tab. -

-
-
- -
-

Tab Three

-

- This is a third example tab. -

-
-
-
-); - -const TabsExampleTeamplateStyle = () => (
From 4abd596e3c83a9fe07b593e4a787baa06f932fd4 Mon Sep 17 00:00:00 2001 From: Flarna Date: Wed, 10 May 2017 13:09:25 +0200 Subject: [PATCH 0082/1072] [node] Add more constructor options to url.URLSearchParams --- types/node/index.d.ts | 2 +- types/node/node-tests.ts | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 67f275c7b6..52daf81a78 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -1857,7 +1857,7 @@ declare module "url" { export function resolve(from: string, to: string): string; export class URLSearchParams implements Iterable { - constructor(init?: URLSearchParams | string); + constructor(init?: URLSearchParams | string | { [key: string]: string | string[] } | Iterable ); append(name: string, value: string): void; delete(name: string): void; entries(): Iterator; diff --git a/types/node/node-tests.ts b/types/node/node-tests.ts index 7cac17144e..1b028c93d0 100644 --- a/types/node/node-tests.ts +++ b/types/node/node-tests.ts @@ -494,6 +494,26 @@ namespace url_tests { searchParams.sort(); } + + { + const searchParams = new url.URLSearchParams({ + user: 'abc', + query: ['first', 'second'] + }); + + assert.equal(searchParams.toString(), 'user=abc&query=first%2Csecond'); + assert.deepEqual(searchParams.getAll('query'), ['first,second']); + } + + { + // Using an array + let params = new url.URLSearchParams([ + ['user', 'abc'], + ['query', 'first'], + ['query', 'second'] + ]); + assert.equal(params.toString(), 'user=abc&query=first&query=second'); + } } ///////////////////////////////////////////////////// From d5a5da8e7fa4bebdb9e86aee99db26c788c026a3 Mon Sep 17 00:00:00 2001 From: Botik Date: Wed, 10 May 2017 14:43:02 +0300 Subject: [PATCH 0083/1072] [sequelize] add where option to DefineIndexesOptions for v4 --- types/sequelize/index.d.ts | 9 +++++++-- types/sequelize/sequelize-tests.ts | 5 ++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/types/sequelize/index.d.ts b/types/sequelize/index.d.ts index a7f5b0afe5..503c319768 100644 --- a/types/sequelize/index.d.ts +++ b/types/sequelize/index.d.ts @@ -3247,8 +3247,8 @@ declare namespace sequelize { * https://github.com/sequelize/sequelize/blob/master/docs/docs/models-usage.md#user-content-manipulating-the-dataset-with-limit-offset-order-and-group */ group?: string | string[] | Object; - - + + /** * Apply DISTINCT(col) for FindAndCount(all) */ @@ -4784,6 +4784,11 @@ declare namespace sequelize { */ operator?: string; + /** + * Condition for partioal index + */ + where?: WhereOptions; + } /** diff --git a/types/sequelize/sequelize-tests.ts b/types/sequelize/sequelize-tests.ts index cc4462fa86..de24440f72 100644 --- a/types/sequelize/sequelize-tests.ts +++ b/types/sequelize/sequelize-tests.ts @@ -1285,7 +1285,10 @@ s.define( 'UserWithUniqueUsername', { name : 'user_and_email_index', unique : true, method : 'BTREE', - fields : ['user_id', { attribute : 'email', collate : 'en_US', order : 'DESC', length : 5 }] + fields : ['user_id', { attribute : 'email', collate : 'en_US', order : 'DESC', length : 5 }], + where : { + user_id : { $not: null } + } }, { fields: ['data'], From 2a766c7cc57a99d190f59208c06a4f954c4b60cd Mon Sep 17 00:00:00 2001 From: Botik Date: Wed, 10 May 2017 14:47:08 +0300 Subject: [PATCH 0084/1072] [sequelize] add force option to TruncateOptions for v4 --- types/sequelize/index.d.ts | 12 ++++++++++-- types/sequelize/sequelize-tests.ts | 3 +++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/types/sequelize/index.d.ts b/types/sequelize/index.d.ts index a7f5b0afe5..002aba2f7a 100644 --- a/types/sequelize/index.d.ts +++ b/types/sequelize/index.d.ts @@ -3247,8 +3247,8 @@ declare namespace sequelize { * https://github.com/sequelize/sequelize/blob/master/docs/docs/models-usage.md#user-content-manipulating-the-dataset-with-limit-offset-order-and-group */ group?: string | string[] | Object; - - + + /** * Apply DISTINCT(col) for FindAndCount(all) */ @@ -3395,6 +3395,14 @@ declare namespace sequelize { * Defaults to false; */ cascade?: boolean; + + /** + * Delete instead of setting deletedAt to current timestamp (only applicable if paranoid is enabled) + * + * Defaults to false; + */ + force?: boolean; + } /** diff --git a/types/sequelize/sequelize-tests.ts b/types/sequelize/sequelize-tests.ts index cc4462fa86..b5507e777e 100644 --- a/types/sequelize/sequelize-tests.ts +++ b/types/sequelize/sequelize-tests.ts @@ -1009,6 +1009,9 @@ User.bulkCreate( [{ name : 'foo', code : '123' }, { code : '1234' }], { fields : User.bulkCreate( [{ name : 'a', c : 'b' }, { name : 'e', c : 'f' }], { fields : ['e', 'f'], ignoreDuplicates : true } ); User.truncate(); +User.truncate( { cascade : true } ); +User.truncate( { force : true } ); +User.truncate( { cascade: true, force : true } ); User.destroy( { where : { client_id : 13 } } ).then( ( a ) => a.toFixed() ); User.destroy( { force : true } ); From 64a0c4da910ce79ce018a621060704cf9ea92d96 Mon Sep 17 00:00:00 2001 From: Justin Firth Date: Wed, 10 May 2017 12:28:43 -0400 Subject: [PATCH 0085/1072] Definitions for react-native-drawer-layout@1.3 --- types/react-native-drawer-layout/index.d.ts | 105 ++++++++++++++++++ .../react-native-drawer-layout-tests.tsx | 39 +++++++ .../react-native-drawer-layout/tsconfig.json | 24 ++++ types/react-native-drawer-layout/tslint.json | 1 + 4 files changed, 169 insertions(+) create mode 100644 types/react-native-drawer-layout/index.d.ts create mode 100644 types/react-native-drawer-layout/react-native-drawer-layout-tests.tsx create mode 100644 types/react-native-drawer-layout/tsconfig.json create mode 100644 types/react-native-drawer-layout/tslint.json diff --git a/types/react-native-drawer-layout/index.d.ts b/types/react-native-drawer-layout/index.d.ts new file mode 100644 index 0000000000..300119bf00 --- /dev/null +++ b/types/react-native-drawer-layout/index.d.ts @@ -0,0 +1,105 @@ +// Type definitions for react-native-drawer-layout 1.3 +// Project: https://github.com/react-native-community/react-native-drawer-layout +// Definitions by: Justin Firth +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +import * as React from 'react'; +import { ViewProperties } from 'react-native'; + +export type DrawerLayoutOpenEventHandler = () => void; + +export type DrawerLayoutCloseEventHandler = () => void; + +export interface DrawerLayoutSlideEvent { + nativeEvent: { + offset: number; + }; +} + +export type DrawerLayoutSlideEventHandler = (event: DrawerLayoutSlideEvent) => void; + +export type DrawerLayoutStateChangeEventHandler = (state: string) => void; + +export interface DrawerLayoutProperties extends ViewProperties { + /** + * Child content. + */ + children?: React.ReactNode; + /** + * Specifies the background color of the drawer. The default value is white. If you want to set + * the opacity of the drawer, use rgba. + */ + drawerBackgroundColor?: string; + /** + * Specifies the lock mode of the drawer. The drawer can be locked in 3 states: + * + * - unlocked (default), meaning that the drawer will respond (open/close) to touch gestures. + * - locked-closed, meaning that the drawer will stay closed and not respond to gestures. + * - locked-open, meaning that the drawer will stay opened and not respond to gestures. + * + * The drawer may still be opened and closed programmatically (`openDrawer`/`closeDrawer`). + */ + drawerLockMode?: 'unlocked' | 'locked-closed' | 'locked-open'; + /** + * Specifies the side of the screen from which the drawer will slide in. + */ + drawerPosition: 'left' | 'right'; + /** + * Specifies the width of the drawer, more precisely the width of the view that be pulled in from + * the edge of the window. + */ + drawerWidth: number; + /** + * Determines whether the keyboard gets dismissed in response to a drag. + * + * - 'none' (the default), drags do not dismiss the keyboard. + * - 'on-drag', the keyboard is dismissed when a drag begins. + */ + keyboardDismissMode?: 'none' | 'on-drag'; + /** + * Function called whenever the navigation view has been closed. + */ + onDrawerClose?: DrawerLayoutCloseEventHandler; + /** + * Function called whenever the navigation view has been opened. + */ + onDrawerOpen?: DrawerLayoutOpenEventHandler; + /** + * Function called whenever there is an interaction with the navigation view. + */ + onDrawerSlide?: DrawerLayoutSlideEventHandler; + /** + * Function called when the drawer state has changed. The drawer can be in 3 states: + * + * - idle, meaning there is no interaction with the navigation view happening at the time + * - dragging, meaning there is currently an interaction with the navigation view + * - settling, meaning that there was an interaction with the navigation view, and the navigation + * view is now finishing its closing or opening animation + */ + onDrawerStateChanged?: DrawerLayoutStateChangeEventHandler; + /** + * The navigation view that will be rendered to the side of the screen and can be pulled in. + */ + renderNavigationView: React.ReactNode; + /** + * Make the drawer take the entire screen and draw the background of the status bar to allow it + * to open over the status bar. It will only have an effect on API 21+. + */ + statusBarBackgroundColor?: string; + /** + * Use native driver animations. + */ + useNativeAnimations?: boolean; +} + +export default class DrawerLayout extends React.Component { + /** + * Opens the drawer. + */ + openDrawer(): void; + /** + * Closes the drawer. + */ + closeDrawer(): void; +} diff --git a/types/react-native-drawer-layout/react-native-drawer-layout-tests.tsx b/types/react-native-drawer-layout/react-native-drawer-layout-tests.tsx new file mode 100644 index 0000000000..d1a8c31168 --- /dev/null +++ b/types/react-native-drawer-layout/react-native-drawer-layout-tests.tsx @@ -0,0 +1,39 @@ +import * as React from 'react'; +import { Text, View } from 'react-native'; +import DrawerLayout from 'react-native-drawer-layout'; + +interface DrawerTestState { + open: boolean; +} + +class DrawerTest extends React.Component<{}, DrawerTestState> { + state: DrawerTestState = { + open: false + }; + + private onOpen = () => this.setState({ open: true }); + + private onClose = () => this.setState({ open: false }); + + private renderNavigationView = () => ( + + Drawer content + + ) + + render() { + return ( + + + Screen content + + + ); + } +} diff --git a/types/react-native-drawer-layout/tsconfig.json b/types/react-native-drawer-layout/tsconfig.json new file mode 100644 index 0000000000..e70b67aac5 --- /dev/null +++ b/types/react-native-drawer-layout/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react" + }, + "files": [ + "index.d.ts", + "react-native-drawer-layout-tests.tsx" + ] +} diff --git a/types/react-native-drawer-layout/tslint.json b/types/react-native-drawer-layout/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-native-drawer-layout/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 2068ad8dd07c7456feff181e048cb9a8be07faed Mon Sep 17 00:00:00 2001 From: Endel Dreyer Date: Wed, 10 May 2017 21:42:38 +0200 Subject: [PATCH 0086/1072] node: add 'stdio' to ForkOptions Documentation: https://nodejs.org/api/child_process.html#child_process_child_process_fork_modulepath_args_options See `stdio` in `options` parameter. --- types/node/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 67f275c7b6..d9efcc3d1c 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -1744,6 +1744,7 @@ declare module "child_process" { execPath?: string; execArgv?: string[]; silent?: boolean; + stdio?: any[]; uid?: number; gid?: number; } From e235463cdba408797d7dbb6cefe4d2f9557cf923 Mon Sep 17 00:00:00 2001 From: Brian Love Date: Wed, 10 May 2017 15:00:43 -0600 Subject: [PATCH 0087/1072] * 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 0088/1072] 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 0089/1072] 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 bb536b6bf25336ebe405a0c9774bdc0c3ffaa810 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kov=C3=A1cs=20Vince?= Date: Thu, 11 May 2017 13:22:34 +0200 Subject: [PATCH 0090/1072] Type definitions for microtime@2.1 --- types/microtime/index.d.ts | 14 ++++++++++++++ types/microtime/microtime-tests.ts | 7 +++++++ types/microtime/tsconfig.json | 22 ++++++++++++++++++++++ types/microtime/tslint.json | 1 + 4 files changed, 44 insertions(+) create mode 100644 types/microtime/index.d.ts create mode 100644 types/microtime/microtime-tests.ts create mode 100644 types/microtime/tsconfig.json create mode 100644 types/microtime/tslint.json diff --git a/types/microtime/index.d.ts b/types/microtime/index.d.ts new file mode 100644 index 0000000000..bb2ac3e675 --- /dev/null +++ b/types/microtime/index.d.ts @@ -0,0 +1,14 @@ +// Type definitions for microtime 2.1 +// Project: https://github.com/wadey/node-microtime +// Definitions by: Kovács Vince +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare namespace microtime { + function now (): number + + function nowDouble (): number + + function nowStruct (): number[] +} + +export = microtime; \ No newline at end of file diff --git a/types/microtime/microtime-tests.ts b/types/microtime/microtime-tests.ts new file mode 100644 index 0000000000..6793171d36 --- /dev/null +++ b/types/microtime/microtime-tests.ts @@ -0,0 +1,7 @@ +import * as microtime from "microtime" + +const nowInteger: number = microtime.now() + +const nowDouble: number = microtime.nowDouble() + +const nowStruct: number[] = microtime.nowStruct() \ No newline at end of file diff --git a/types/microtime/tsconfig.json b/types/microtime/tsconfig.json new file mode 100644 index 0000000000..3bcc951906 --- /dev/null +++ b/types/microtime/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", + "microtime-tests.ts" + ] +} diff --git a/types/microtime/tslint.json b/types/microtime/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/microtime/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From be9f4c36c05f83d57b2cf07f0f142edd8141d8f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kov=C3=A1cs=20Vince?= Date: Thu, 11 May 2017 13:46:16 +0200 Subject: [PATCH 0091/1072] Fixed tslint errors --- types/microtime/index.d.ts | 10 ++++------ types/microtime/microtime-tests.ts | 8 ++++---- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/types/microtime/index.d.ts b/types/microtime/index.d.ts index bb2ac3e675..72c1d09d63 100644 --- a/types/microtime/index.d.ts +++ b/types/microtime/index.d.ts @@ -3,12 +3,10 @@ // Definitions by: Kovács Vince // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare namespace microtime { - function now (): number +export as namespace microtime; - function nowDouble (): number +export function now(): number; - function nowStruct (): number[] -} +export function nowDouble(): number; -export = microtime; \ No newline at end of file +export function nowStruct(): number[]; diff --git a/types/microtime/microtime-tests.ts b/types/microtime/microtime-tests.ts index 6793171d36..81bce7c3a3 100644 --- a/types/microtime/microtime-tests.ts +++ b/types/microtime/microtime-tests.ts @@ -1,7 +1,7 @@ -import * as microtime from "microtime" +import * as microtime from "microtime"; -const nowInteger: number = microtime.now() +const nowInteger: number = microtime.now(); -const nowDouble: number = microtime.nowDouble() +const nowDouble: number = microtime.nowDouble(); -const nowStruct: number[] = microtime.nowStruct() \ No newline at end of file +const nowStruct: number[] = microtime.nowStruct(); From 703cb64c3c8d6205a80cc270cd1afba9a18881af Mon Sep 17 00:00:00 2001 From: Alexander Lunyov Date: Thu, 11 May 2017 19:31:32 +0700 Subject: [PATCH 0092/1072] Add some new options for webpack-dev-server config --- types/webpack-dev-server/index.d.ts | 4 +++- types/webpack-dev-server/webpack-dev-server-tests.ts | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/types/webpack-dev-server/index.d.ts b/types/webpack-dev-server/index.d.ts index f794bd62d0..0e84e67eab 100644 --- a/types/webpack-dev-server/index.d.ts +++ b/types/webpack-dev-server/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for webpack-dev-server 1.12.1 +// Type definitions for webpack-dev-server 2.4.5 // Project: https://github.com/webpack/webpack-dev-server // Definitions by: maestroh // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -26,6 +26,8 @@ declare module "webpack-dev-server" { publicPath: string; headers?: any; stats?: webpack.compiler.StatsOptions| webpack.compiler.StatsToStringOptions; + public?: string; + disableHostCheck?: boolean; setup?(app: core.Express): void; } diff --git a/types/webpack-dev-server/webpack-dev-server-tests.ts b/types/webpack-dev-server/webpack-dev-server-tests.ts index 21af59885a..f4f81542a1 100644 --- a/types/webpack-dev-server/webpack-dev-server-tests.ts +++ b/types/webpack-dev-server/webpack-dev-server-tests.ts @@ -14,6 +14,12 @@ server = new WebpackDevServer(compiler, { contentBase: "/path/to/directory", // or: contentBase: "http://localhost/", + public: 'public-host.ru', + // Public host for server + + disableHostCheck: true, + // Disable public host check, use it carefully + hot: true, // Enable special support for Hot Module Replacement // Page is no longer updated, but a "webpackHotUpdate" message is send to the content From e6fa0b8211cbec40a35e2b18bf001b04fb8c2fcf Mon Sep 17 00:00:00 2001 From: Simon Schick Date: Thu, 11 May 2017 17:11:34 +0200 Subject: [PATCH 0093/1072] Correct return type for no parameters in return method in bluebird --- types/bluebird/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/bluebird/index.d.ts b/types/bluebird/index.d.ts index cceb0ebc54..49cd47d7bd 100644 --- a/types/bluebird/index.d.ts +++ b/types/bluebird/index.d.ts @@ -228,8 +228,8 @@ declare class Bluebird implements Bluebird.Thenable, Bluebird.Inspection; - thenReturn(): Bluebird; + return(): Bluebird; + thenReturn(): Bluebird; return(value: U): Bluebird; thenReturn(value: U): Bluebird; From 1817e7beb61b3a577b703a7c95fe46f98b4152aa Mon Sep 17 00:00:00 2001 From: Francis Filion Date: Thu, 11 May 2017 11:16:14 -0400 Subject: [PATCH 0094/1072] [pouchdb-core] Added support for CouchDB 2.0 on ChangesResponse object. --- types/pouchdb-core/index.d.ts | 4 ++-- types/pouchdb-core/pouchdb-core-tests.ts | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/types/pouchdb-core/index.d.ts b/types/pouchdb-core/index.d.ts index eccc2e00fb..556fa71b5b 100644 --- a/types/pouchdb-core/index.d.ts +++ b/types/pouchdb-core/index.d.ts @@ -298,7 +298,7 @@ declare namespace PouchDB { interface ChangesResponseChange { id: string; - seq: number; + seq: number | string; changes: { rev: string }[]; deleted?: boolean; doc?: ExistingDocument; @@ -306,7 +306,7 @@ declare namespace PouchDB { interface ChangesResponse { status: string; - last_seq: number; + last_seq: number | string; results: ChangesResponseChange[]; } diff --git a/types/pouchdb-core/pouchdb-core-tests.ts b/types/pouchdb-core/pouchdb-core-tests.ts index a2593ce291..ba06de7608 100644 --- a/types/pouchdb-core/pouchdb-core-tests.ts +++ b/types/pouchdb-core/pouchdb-core-tests.ts @@ -162,7 +162,8 @@ function testChanges() { }) .on('change', (change) => { let _id: string = change.id; - let _seq: number = change.seq; + let _seq: number = change.seq as number; + let _seq_couch20: string = change.seq as string; let _changes: { rev: string }[] = change.changes; let _foo: string = change.doc!.foo; let _deleted: boolean | undefined = change.doc!._deleted; @@ -170,11 +171,13 @@ function testChanges() { }) .on('complete', (info) => { let _status: string = info.status; - let _last_req: number = info.last_seq; + let _last_req: number = info.last_seq as number; + let _last_seq_couch20: string = info.last_seq as string; let change = info.results[0]; let _id: string = change.id; - let _seq: number = change.seq; + let _seq: number = change.seq as number; + let _seq_couch20: string = change.seq as string; let _changes: { rev: string }[] = change.changes; let _deleted: boolean | undefined = change.doc!._deleted; let _attachments: PouchDB.Core.Attachments | undefined = change.doc!._attachments; From 949f77f0dd1575dc05f658949a5da0d7c6a9c5f2 Mon Sep 17 00:00:00 2001 From: "webix.io" Date: Thu, 11 May 2017 19:57:18 +0300 Subject: [PATCH 0095/1072] [update] Webix 4.3 --- types/webix/index.d.ts | 371 ++++++++++++++++++++++++++++++++++--- types/webix/webix-tests.ts | 6 +- 2 files changed, 347 insertions(+), 30 deletions(-) mode change 100644 => 100755 types/webix/index.d.ts mode change 100644 => 100755 types/webix/webix-tests.ts diff --git a/types/webix/index.d.ts b/types/webix/index.d.ts old mode 100644 new mode 100755 index 4ab2039fc9..11f2be71e8 --- a/types/webix/index.d.ts +++ b/types/webix/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Webix UI 4.2 +// Type definitions for Webix UI 4.3 // Project: http://webix.com // Definitions by: Maksim Kozhukh // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -104,6 +104,7 @@ interface html{ remove(node:HTMLElement|HTMLElement[]):void; removeCss(node:HTMLElement, name:string):void; stopEvent(ev:Event):boolean; + getTextSize(text:(string|string[]), css?:string, width?:number):number; } interface i18n{ dateFormatDate(date:string):any; @@ -219,6 +220,7 @@ function remote():void; function require(url:string):void; function send(url:string, values:any, method:string, target:string):void; function single(source:WebixCallback):WebixCallback; +function stringify(obj:any):string; function template(template:string):WebixCallback; function toArray(array:any[]):any[]; function toCSV(id:any, options:any):void; @@ -278,7 +280,7 @@ interface BindSource{ addBind(source:any, rule:string, format:string):void; getBindData(key:string|number, update:boolean):void; removeBind(source:any):void; - saveBatch(func:WebixCallback):void; + saveBatch(handler:WebixCallback):void; setBindData(data:any, key:string|number):void; } var BindSource:BindSource; @@ -360,7 +362,7 @@ interface DataCollection{ refreshCursor():void; remove(id:string|number):void; removeBind(source:any):void; - saveBatch(func:WebixCallback):void; + saveBatch(handler:WebixCallback):void; serialize():any; setBindData(data:any, key:string|number):void; setCursor(cursor:string|number):void; @@ -372,6 +374,7 @@ interface DataCollection{ validate(id?:string):boolean; config: { [key: string]: any; }; name: string; + data:DataStore; waitData: webix.promise; } @@ -807,7 +810,7 @@ interface TreeCollection{ clearAll():void; clearValidation():void; copy(sid:string|number, tindex:number, tobj?:any, details?:any):void; - count():number; + count():number; define(property:string, value:any):void; destructor():void; detachEvent(id:string):void; @@ -843,7 +846,7 @@ interface TreeCollection{ refreshCursor():void; remove(id:string|number):void; removeBind(source:any):void; - saveBatch(func:WebixCallback):void; + saveBatch(handler:WebixCallback):void; serialize():any; setBindData(data:any, key:string|number):void; setCursor(cursor:string|number):void; @@ -855,6 +858,7 @@ interface TreeCollection{ validate(id?:string):boolean; config: { [key: string]: any; }; name: string; + data:DataStore; waitData: webix.promise; } var TreeCollection:TreeCollection; @@ -1055,7 +1059,7 @@ interface baselayoutConfig{ } type baselayoutEventName ='onBindRequest'|'onDestruct'; class baselayout implements webix.ui.baseview{ - addView(view:any, index?:number):webix.ui.baseview; + addView(view:any, index?:number):string|number; adjust():void; attachEvent(type:baselayoutEventName, functor:WebixCallback, id?:string):string|number; bind(target:any, rule?:WebixCallback, format?:string):void; @@ -1156,6 +1160,7 @@ interface protoConfig{ height?: number; hidden?: boolean; id?: string|number; + item?: any; maxHeight?: number; maxWidth?: number; minHeight?: number; @@ -1247,6 +1252,7 @@ class proto implements webix.ui.baseview{ name: string; type: { [key: string]: any; }; types: { [key: string]: any; }; + data:DataStore; waitData: webix.promise; } interface resizeareaConfig{ @@ -1389,7 +1395,7 @@ interface accordionConfig{ } type accordionEventName ='onAfterCollapse'|'onAfterExpand'|'onBindRequest'|'onDestruct'; class accordion implements webix.ui.baseview{ - addView(view:any, index?:number):webix.ui.baseview; + addView(view:any, index?:number):string|number; adjust():void; attachEvent(type:accordionEventName, functor:WebixCallback, id?:string):string|number; bind(target:any, rule?:WebixCallback, format?:string):void; @@ -1560,6 +1566,79 @@ class barcode implements webix.ui.baseview{ name: string; types: any[]; } +interface bulletConfig{ + view?: string; + animate?: any; + bands?: any[]; + barWidth?: number; + borderless?: boolean; + color?: string; + container?: string|HTMLElement; + css?: string; + disabled?: boolean; + flowTime?: number; + gravity?: number; + height?: number; + hidden?: boolean; + id?: string|number; + label?: string; + labelHeight?: number; + labelWidth?: number; + layout?: string; + marker?: number|boolean; + maxHeight?: number; + maxRange?: number; + maxWidth?: number; + minHeight?: number; + minRange?: number; + minWidth?: number; + on?: EventHash; + placeholder?: string; + scale?: any; + smoothFlow?: boolean; + stroke?: number; + value?: number; + width?: number; +} +type bulletEventName ='onAfterScroll'|'onBindRequest'|'onBlur'|'onDestruct'|'onFocus'|'onKeyPress'|'onLongTouch'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onViewResize'; +class bullet implements webix.ui.baseview{ + adjust():void; + attachEvent(type:bulletEventName, functor:WebixCallback, id?:string):string|number; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + callEvent(name:string, params:any[]):boolean; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + disable():void; + enable():void; + getChildViews():any[]; + getFormView():webix.ui.baseview; + getNode():any; + getParentView():any; + getTopParentView():webix.ui.baseview; + getValue():number; + hasEvent(name:string):boolean; + hide():void; + isEnabled():boolean; + isVisible():boolean; + mapEvent(map:any):void; + resize():void; + setValue(new_value:number):void; + show(force?:boolean, animation?:boolean):void; + unbind():void; + unblockEvent():void; + + $getSize():any[]; + $height: number; + $scope: any; + $setSize(x:number, y:number):boolean; + $skin: any; + $view: HTMLElement; + $width: number; + config: bulletConfig; + name: string; +} interface buttonConfig{ view?: string; align?: string; @@ -1629,9 +1708,11 @@ class button implements webix.ui.baseview{ unbind():void; unblockEvent():void; + $compareValue: WebixCallback; $getSize():any[]; $getValue():string; $height: number; + $prepareValue: WebixCallback; $renderInput(config:any):HTMLElement; $scope: any; $setSize(x:number, y:number):boolean; @@ -1955,6 +2036,7 @@ class chart implements webix.ui.baseview{ on_dblclick: WebixCallback; on_mouse_move: WebixCallback; presets: { [key: string]: any; }; + data:DataStore; waitData: webix.promise; } interface checkboxConfig{ @@ -2043,9 +2125,11 @@ class checkbox implements webix.ui.baseview{ unblockEvent():void; validate():boolean; + $compareValue: WebixCallback; $getSize():any[]; $getValue():string; $height: number; + $prepareValue: WebixCallback; $render: WebixCallback; $renderIcon: WebixCallback; $renderInput(obj:any, html:string, id:string|number):string; @@ -2321,9 +2405,11 @@ class colorpicker implements webix.ui.baseview{ unblockEvent():void; validate():boolean; + $compareValue: WebixCallback; $getSize():any[]; $getValue():string; $height: number; + $prepareValue: WebixCallback; $render: WebixCallback; $renderIcon: WebixCallback; $renderInput(obj:any, html:string, id:string|number):string; @@ -2352,6 +2438,7 @@ interface comboConfig{ container?: string|HTMLElement; css?: string; disabled?: boolean; + editable?: boolean; gravity?: number; height?: number; hidden?: boolean; @@ -2430,9 +2517,11 @@ class combo implements webix.ui.baseview{ unblockEvent():void; validate():boolean; + $compareValue: WebixCallback; $getSize():any[]; $getValue():string; $height: number; + $prepareValue: WebixCallback; $render: WebixCallback; $renderIcon: WebixCallback; $renderInput(obj:any, html:string, id:string|number):string; @@ -2554,6 +2643,7 @@ interface contextmenuConfig{ height?: number; hidden?: boolean; id?: string|number; + item?: any; layout?: string; left?: number; master?: string; @@ -2717,6 +2807,7 @@ class contextmenu implements webix.ui.baseview{ on_mouse_move: WebixCallback; type: { [key: string]: any; }; types: { [key: string]: any; }; + data:DataStore; waitData: webix.promise; } interface counterConfig{ @@ -2806,9 +2897,11 @@ class counter implements webix.ui.baseview{ unblockEvent():void; validate():boolean; + $compareValue: WebixCallback; $getSize():any[]; $getValue():string; $height: number; + $prepareValue: WebixCallback; $render: WebixCallback; $renderIcon: WebixCallback; $renderInput(obj:any, html:string, id:string|number):string; @@ -3174,6 +3267,7 @@ class datatable implements webix.ui.baseview{ on_context: { [key: string]: any; }; on_dblclick: WebixCallback; on_mouse_move: WebixCallback; + data:DataStore; waitData: webix.promise; } interface dataviewConfig{ @@ -3185,7 +3279,6 @@ interface dataviewConfig{ container?: string|HTMLElement; css?: string; data?: string|any[]; - dataFeed?: string|WebixCallback; datafetch?: number; datathrottle?: number; datatype?: string; @@ -3197,6 +3290,7 @@ interface dataviewConfig{ height?: number; hidden?: boolean; id?: string|number; + item?: any; loadahead?: number; maxHeight?: number; maxWidth?: number; @@ -3328,6 +3422,7 @@ class dataview implements webix.ui.baseview{ on_mouse_move: WebixCallback; type: { [key: string]: any; }; types: { [key: string]: any; }; + data:DataStore; waitData: webix.promise; } interface daterangeConfig{ @@ -3344,7 +3439,7 @@ interface daterangeConfig{ gravity?: number; height?: number; hidden?: boolean; - icons?: any; + icons?: boolean|object; id?: string|number; isolate?: boolean; margin?: number; @@ -3366,7 +3461,8 @@ interface daterangeConfig{ } type daterangeEventName ='onAfterDateSelect'|'onBeforeDateSelect'|'onBindRequest'|'onAfterDateSelect'|'onDateClear'|'onDestruct'|'onTodaySet'; class daterange implements webix.ui.baseview{ - addView(view:any, index?:number):webix.ui.baseview; + addToRange():void; + addView(view:any, index?:number):string|number; adjust():void; attachEvent(type:daterangeEventName, functor:WebixCallback, id?:string):string|number; bind(target:any, rule?:WebixCallback, format?:string):void; @@ -3504,10 +3600,12 @@ class daterangepicker implements webix.ui.baseview{ unblockEvent():void; validate():boolean; + $compareValue: WebixCallback; $cssName: string; $getSize():any[]; $getValue():string; $height: number; + $prepareValue: WebixCallback; $render: WebixCallback; $renderIcon: WebixCallback; $renderInput(config:any):HTMLElement; @@ -3713,9 +3811,11 @@ class datepicker implements webix.ui.baseview{ unblockEvent():void; validate():boolean; + $compareValue: WebixCallback; $getSize():any[]; $getValue():string; $height: number; + $prepareValue: WebixCallback; $render: WebixCallback; $renderIcon: WebixCallback; $renderInput(obj:any, html:string, id:string|number):string; @@ -3731,8 +3831,100 @@ class datepicker implements webix.ui.baseview{ on_click: WebixCallback; touchable: boolean; } +interface dbllistConfig{ + view?: string; + animate?: any; + borderless?: boolean; + buttons?: string|boolean; + cols?: any[]; + container?: string|HTMLElement; + css?: string; + data?: string|any[]; + dataFeed?: string|WebixCallback; + datatype?: string; + disabled?: boolean; + gravity?: number; + height?: number; + hidden?: boolean; + id?: string|number; + isolate?: boolean; + labelBottomLeft?: string; + labelBottomRight?: string; + labelLeft?: string; + labelRight?: string; + list?: any; + margin?: number; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + on?: EventHash; + padding?: number; + paddingX?: number; + paddingY?: number; + responsive?: string; + rows?: any[]; + type?: string; + url?: string; + value?: string|any[]; + visibleBatch?: string; + width?: number; +} +type dbllistEventName ='onAfterLoad'|'onBeforeLoad'|'onBindRequest'|'onChange'|'onDestruct'|'onLoadError'; +class dbllist implements webix.ui.baseview{ + addView(view:any, index?:number):string|number; + adjust():void; + attachEvent(type:dbllistEventName, functor:WebixCallback, id?:string):string|number; + bind(target:any, rule?:WebixCallback, format?:string):void; + blockEvent():void; + callEvent(name:string, params:any[]):boolean; + define(property:string, value:any):void; + destructor():void; + detachEvent(id:string):void; + disable():void; + enable():void; + focus():void; + getChildViews():any[]; + getFormView():webix.ui.baseview; + getNode():any; + getParentView():any; + getTopParentView():webix.ui.baseview; + getValue():string; + hasEvent(name:string):boolean; + hide():void; + index(obj:any):number; + innerId(id:number|string):number|string; + isEnabled():boolean; + isVisible():boolean; + load(url:string, type?:string, callback?:WebixCallback):webix.promise; + mapEvent(map:any):void; + parse(data:any, type:string):void; + reconstruct():void; + removeView(id:string|number):void; + resize():void; + resizeChildren():void; + select(id:string|any[], mode:boolean):void; + setValue(ids:string|any[]):void; + show(force?:boolean, animation?:boolean):void; + showBatch(name:string):void; + ui(view:any):webix.ui.baseview; + unbind():void; + unblockEvent():void; + + $$: any; + $getSize():any[]; + $height: number; + $onLoad: WebixCallback; + $setSize(x:number, y:number):boolean; + $skin: any; + $view: HTMLElement; + $width: number; + config: dbllistConfig; + name: string; +} interface fieldsetConfig{ view?: string; + $cssName?: string; animate?: any; body?: webix.ui.baseview; borderless?: boolean; @@ -3748,6 +3940,8 @@ interface fieldsetConfig{ maxWidth?: number; minHeight?: number; minWidth?: number; + paddingX?: number; + paddingY?: number; width?: number; } type fieldsetEventName ='onAfterScroll'|'onBindRequest'|'onBlur'|'onDestruct'|'onFocus'|'onKeyPress'|'onLongTouch'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onViewResize'; @@ -3768,6 +3962,7 @@ class fieldset implements webix.ui.baseview{ isEnabled():boolean; isVisible():boolean; resize():void; + resizeChildren():void; show(force?:boolean, animation?:boolean):void; unbind():void; @@ -3833,10 +4028,10 @@ interface filemanagerConfig{ visibleBatch?: string; width?: number; } -type filemanagerEventName ='onAfterAdd'|'onAfterBack'|'onAfterDelete'|'onAfterDrop'|'onAfterDynParse'|'onAfterEditStop'|'onAfterHideTree'|'onAfterLevelDown'|'onAfterLevelUp'|'onAfterLoad'|'onAfterMenu'|'onAfterModeChange'|'onAfterPathClick'|'onAfterRun'|'onAfterSearch'|'onAfterShowTree'|'onAfterSort'|'onBeforeAdd'|'onBeforeBack'|'onBeforeCreateFolder'|'onBeforeDelete'|'onBeforeDeleteFile'|'onBeforeDrag'|'onBeforeDragIn'|'onBeforeDrop'|'onBeforeDynLoad'|'onBeforeDynParse'|'onBeforeEditFile'|'onBeforeEditStop'|'onBeforeFileUpload'|'onBeforeHideTree'|'onBeforeLevelDown'|'onBeforeLevelUp'|'onBeforeLoad'|'onBeforeMarkCopy'|'onBeforeMarkCut'|'onBeforeMenu'|'onBeforeModeChange'|'onBeforePasteFile'|'onBeforeRequest'|'onBeforeRun'|'onBeforeSearch'|'onBeforeSearchRequest'|'onBeforeShowTree'|'onBeforeSort'|'onBindRequest'|'onComponentInit'|'onCopyError'|'onDataRequest'|'onDataUpdate'|'onDestruct'|'onDynLoadError'|'onErrorResponse'|'onFolderSelect'|'onHideSearchResults'|'onHistoryChange'|'onItemRename'|'onItemSelect'|'onLoadError'|'onMoveError'|'onPathComplete'|'onPathLevel'|'onShowSearchResults'|'onSuccessResponse'|'onViewInit'; +type filemanagerEventName ='onAfterAdd'|'onAfterBack'|'onAfterCreateFolder'|'onAfterDelete'|'onAfterDeleteFile'|'onAfterDrop'|'onAfterDynParse'|'onAfterEditFile'|'onAfterEditStop'|'onAfterFileUpload'|'onAfterHideTree'|'onAfterLevelDown'|'onAfterLevelUp'|'onAfterLoad'|'onAfterMarkCopy'|'onAfterMarkCut'|'onAfterMenu'|'onAfterModeChange'|'onAfterPasteFile'|'onAfterPathClick'|'onAfterRun'|'onAfterSearch'|'onAfterShowTree'|'onAfterSort'|'onAfterUploadDialog'|'onBeforeAdd'|'onBeforeBack'|'onBeforeCreateFolder'|'onBeforeDelete'|'onBeforeDeleteFile'|'onBeforeDrag'|'onBeforeDragIn'|'onBeforeDrop'|'onBeforeDynLoad'|'onBeforeDynParse'|'onBeforeEditFile'|'onBeforeEditStop'|'onBeforeFileUpload'|'onBeforeHideTree'|'onBeforeLevelDown'|'onBeforeLevelUp'|'onBeforeLoad'|'onBeforeMarkCopy'|'onBeforeMarkCut'|'onBeforeMenu'|'onBeforeModeChange'|'onBeforePasteFile'|'onBeforeRequest'|'onBeforeRun'|'onBeforeSearch'|'onBeforeSearchRequest'|'onBeforeShowTree'|'onBeforeSort'|'onBeforeUploadDialog'|'onBindRequest'|'onComponentInit'|'onCopyError'|'onDataRequest'|'onDataUpdate'|'onDestruct'|'onDynLoadError'|'onErrorResponse'|'onFolderSelect'|'onHideSearchResults'|'onHistoryChange'|'onItemRename'|'onItemSelect'|'onLoadError'|'onMoveError'|'onPathComplete'|'onPathLevel'|'onShowSearchResults'|'onSuccessResponse'|'onViewInit'; class filemanager implements webix.ui.baseview{ add(obj:any, index?:number):string|number; - addView(view:any, index?:number):webix.ui.baseview; + addView(view:any, index?:number):string|number; adjust():void; attachEvent(type:filemanagerEventName, functor:WebixCallback, id?:string):string|number; bind(target:any, rule?:WebixCallback, format?:string):void; @@ -3940,6 +4135,7 @@ class filemanager implements webix.ui.baseview{ $width: number; config: filemanagerConfig; name: string; + data:DataStore; waitData: webix.promise; } interface formConfig{ @@ -3983,7 +4179,7 @@ interface formConfig{ } type formEventName ='onAfterLoad'|'onAfterScroll'|'onAfterValidation'|'onBeforeLoad'|'onBeforeValidate'|'onBindRequest'|'onChange'|'onDestruct'|'onLoadError'|'onSubmit'|'onValidationError'|'onValidationSuccess'|'onValues'; class form implements webix.ui.baseview{ - addView(view:any, index?:number):webix.ui.baseview; + addView(view:any, index?:number):string|number; adjust():void; attachEvent(type:formEventName, functor:WebixCallback, id?:string):string|number; bind(target:any, rule?:WebixCallback, format?:string):void; @@ -4040,6 +4236,64 @@ class form implements webix.ui.baseview{ config: formConfig; name: string; } +interface forminputConfig{ + view?: string; + $cssName?: string; + animate?: any; + body?: webix.ui.baseview; + borderless?: boolean; + container?: string|HTMLElement; + css?: string; + disabled?: boolean; + gravity?: number; + height?: number; + hidden?: boolean; + id?: string|number; + label?: string; + labelAlign?: string; + labelWidth?: number; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + value?: any; + width?: number; +} +type forminputEventName ='onAfterScroll'|'onBindRequest'|'onBlur'|'onDestruct'|'onFocus'|'onKeyPress'|'onLongTouch'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onViewResize'; +class forminput implements webix.ui.baseview{ + adjust():void; + bind(target:any, rule?:WebixCallback, format?:string):void; + define(property:string, value:any):void; + destructor():void; + disable():void; + enable():void; + focus():void; + getBody():any; + getChildViews():any[]; + getFormView():webix.ui.baseview; + getNode():any; + getParentView():any; + getTopParentView():webix.ui.baseview; + getValue():string; + hide():void; + isEnabled():boolean; + isVisible():boolean; + resize():void; + resizeChildren():void; + setValue(value:any):void; + show(force?:boolean, animation?:boolean):void; + unbind():void; + + $getSize():any[]; + $height: number; + $scope: any; + $setSize(x:number, y:number):boolean; + $skin: any; + $view: HTMLElement; + $width: number; + config: forminputConfig; + name: string; +} interface gageConfig{ view?: string; animate?: any; @@ -4162,7 +4416,7 @@ class googleMap implements webix.ui.baseview{ getIndexById(id:string|number):number; getItem(id:string|number):any; getLastId():string|number; - getMap():void; + getMap():any; getNextId(id:string|number, step:number):string|number; getNode():any; getParentView():any; @@ -4198,6 +4452,7 @@ class googleMap implements webix.ui.baseview{ $width: number; config: googleMapConfig; name: string; + data:DataStore; waitData: webix.promise; } interface gridsuggestConfig{ @@ -4316,6 +4571,7 @@ interface grouplistConfig{ height?: number; hidden?: boolean; id?: string|number; + item?: any; layout?: string; maxHeight?: number; maxWidth?: number; @@ -4455,6 +4711,7 @@ class grouplist implements webix.ui.baseview{ on_mouse_move: WebixCallback; type: { [key: string]: any; }; types: { [key: string]: any; }; + data:DataStore; waitData: webix.promise; } interface headerlayoutConfig{ @@ -4490,7 +4747,7 @@ interface headerlayoutConfig{ } type headerlayoutEventName ='onAfterCollapse'|'onAfterExpand'|'onBindRequest'|'onDestruct'; class headerlayout implements webix.ui.baseview{ - addView(view:any, index?:number):webix.ui.baseview; + addView(view:any, index?:number):string|number; adjust():void; attachEvent(type:headerlayoutEventName, functor:WebixCallback, id?:string):string|number; bind(target:any, rule?:WebixCallback, format?:string):void; @@ -4679,9 +4936,11 @@ class icon implements webix.ui.baseview{ unbind():void; unblockEvent():void; + $compareValue: WebixCallback; $getSize():any[]; $getValue():string; $height: number; + $prepareValue: WebixCallback; $renderInput(config:any):HTMLElement; $scope: any; $setSize(x:number, y:number):boolean; @@ -4797,7 +5056,7 @@ interface kanbanConfig{ type kanbanEventName ='onAfterAdd'|'onAfterCollapse'|'onAfterDelete'|'onAfterExpand'|'onAfterLoad'|'onAfterSort'|'onAfterStatusChange'|'onAvatarClick'|'onBeforeAdd'|'onBeforeDelete'|'onBeforeLoad'|'onBeforeSort'|'onBeforeStatusChange'|'onBindRequest'|'onDataRequest'|'onDataUpdate'|'onDestruct'|'onListAfterContextMenu'|'onListAfterDrop'|'onListAfterSelect'|'onListBeforeContextMenu'|'onListBeforeDrag'|'onListBeforeDragIn'|'onListBeforeDrop'|'onListBeforeSelect'|'onListIconClick'|'onListItemClick'|'onListItemDblClick'|'onLoadError'; class kanban implements webix.ui.baseview{ add(obj:any, index?:number):string|number; - addView(view:any, index?:number):webix.ui.baseview; + addView(view:any, index?:number):string|number; adjust():void; attachEvent(type:kanbanEventName, functor:WebixCallback, id?:string):string|number; bind(target:any, rule?:WebixCallback, format?:string):void; @@ -4845,7 +5104,7 @@ class kanban implements webix.ui.baseview{ resizeChildren():void; select(id:string|number):void; serialize():any; - setIndex():void; + setIndex(id:string|number, index:number):void; show(force?:boolean, animation?:boolean):void; showBatch(name:string):void; sort(by:string, dir?:string, as?:string):void; @@ -4862,6 +5121,7 @@ class kanban implements webix.ui.baseview{ $width: number; config: kanbanConfig; name: string; + data:DataStore; waitData: webix.promise; } interface labelConfig{ @@ -4930,9 +5190,11 @@ class label implements webix.ui.baseview{ unbind():void; unblockEvent():void; + $compareValue: WebixCallback; $getSize():any[]; $getValue():string; $height: number; + $prepareValue: WebixCallback; $renderInput(config:any):HTMLElement; $scope: any; $setSize(x:number, y:number):boolean; @@ -4975,7 +5237,7 @@ interface layoutConfig{ } type layoutEventName ='onBindRequest'|'onDestruct'; class layout implements webix.ui.baseview{ - addView(view:any, index?:number):webix.ui.baseview; + addView(view:any, index?:number):string|number; adjust():void; attachEvent(type:layoutEventName, functor:WebixCallback, id?:string):string|number; bind(target:any, rule?:WebixCallback, format?:string):void; @@ -5037,6 +5299,7 @@ interface listConfig{ height?: number; hidden?: boolean; id?: string|number; + item?: any; layout?: string; maxHeight?: number; maxWidth?: number; @@ -5170,6 +5433,7 @@ class list implements webix.ui.baseview{ on_mouse_move: WebixCallback; type: { [key: string]: any; }; types: { [key: string]: any; }; + data:DataStore; waitData: webix.promise; } interface menuConfig{ @@ -5194,6 +5458,7 @@ interface menuConfig{ height?: number; hidden?: boolean; id?: string|number; + item?: any; layout?: string; maxHeight?: number; maxWidth?: number; @@ -5338,6 +5603,7 @@ class menu implements webix.ui.baseview{ on_mouse_move: WebixCallback; type: { [key: string]: any; }; types: { [key: string]: any; }; + data:DataStore; waitData: webix.promise; } interface multicomboConfig{ @@ -5436,10 +5702,12 @@ class multicombo implements webix.ui.baseview{ unblockEvent():void; validate():boolean; + $compareValue: WebixCallback; $cssName: string; $getSize():any[]; $getValue():string; $height: number; + $prepareValue: WebixCallback; $render: WebixCallback; $renderInput(obj:any, html:string, id:string|number):string; $renderLabel(config:any, id:string|number):string; @@ -5546,10 +5814,12 @@ class multiselect implements webix.ui.baseview{ unblockEvent():void; validate():boolean; + $compareValue: WebixCallback; $cssName: string; $getSize():any[]; $getValue():string; $height: number; + $prepareValue: WebixCallback; $render: WebixCallback; $renderIcon: WebixCallback; $renderInput(obj:any, html:string, id:string|number):string; @@ -5756,10 +6026,12 @@ class multitext implements webix.ui.baseview{ unblockEvent():void; validate():boolean; + $compareValue: WebixCallback; $cssName: string; $getSize():any[]; $getValue():string; $height: number; + $prepareValue: WebixCallback; $render: WebixCallback; $renderIcon: WebixCallback; $renderInput(obj:any, html:string, id:string|number):string; @@ -5802,7 +6074,7 @@ interface multiviewConfig{ } type multiviewEventName ='onBeforeBack'|'onBindRequest'|'onDestruct'|'onViewChange'; class multiview implements webix.ui.baseview{ - addView(view:any, index?:number):webix.ui.baseview; + addView(view:any, index?:number):string|number; adjust():void; attachEvent(type:multiviewEventName, functor:WebixCallback, id?:string):string|number; back(step:number):void; @@ -5866,6 +6138,7 @@ interface organogramConfig{ height?: number; hidden?: boolean; id?: string|number; + item?: any; maxHeight?: number; maxWidth?: number; minHeight?: number; @@ -5990,6 +6263,7 @@ class organogram implements webix.ui.baseview{ on_mouse_move: WebixCallback; type: { [key: string]: any; }; types: { [key: string]: any; }; + data:DataStore; waitData: webix.promise; } interface pagerConfig{ @@ -6162,7 +6436,7 @@ interface pivotConfig{ filterLabelWidth?: number; filterMap?: any; filterMinWidth?: number; - filterPlaceholder?: any; + filterPlaceholder?: boolean|string; filterWidth?: number; footer?: string; format?: WebixCallback; @@ -6182,6 +6456,7 @@ interface pivotConfig{ padding?: number; paddingX?: number; paddingY?: number; + ping?: WebixCallback; popup?: any; profile?: boolean; readonly?: boolean; @@ -6191,19 +6466,21 @@ interface pivotConfig{ responsive?: string; rows?: any[]; scheme?: any; + stableRowId?: boolean; structure?: any; totalColumn?: string; type?: string; url?: string; visibleBatch?: string; + webWorker?: string; width?: number; yScaleWidth?: number; } -type pivotEventName ='onAfterAdd'|'onAfterDelete'|'onAfterLoad'|'onAfterSort'|'onBeforeAdd'|'onBeforeApply'|'onBeforeDelete'|'onBeforeLoad'|'onBeforeRender'|'onBeforeSort'|'onBindRequest'|'onDataRequest'|'onDataUpdate'|'onDestruct'|'onHeaderInit'|'onLoadError'|'onPopup'|'onViewInit'; +type pivotEventName ='onAfterAdd'|'onAfterDelete'|'onAfterLoad'|'onAfterSort'|'onApply'|'onBeforeAdd'|'onBeforeApply'|'onBeforeCancel'|'onBeforeDelete'|'onBeforeLoad'|'onBeforeRender'|'onBeforeSort'|'onBindRequest'|'onCancel'|'onDataRequest'|'onDataUpdate'|'onDestruct'|'onFilterChange'|'onFilterCreate'|'onHeaderInit'|'onItemClick'|'onLoadError'|'onPopup'|'onViewInit'|'onWebWorkerEnd'|'onWebWorkerStart'; class pivot implements webix.ui.baseview{ add(obj:any, index?:number):string|number; addOperation(name:string, functor:WebixCallback, options:any):void; - addView(view:any, index?:number):webix.ui.baseview; + addView(view:any, index?:number):string|number; adjust():void; attachEvent(type:pivotEventName, functor:WebixCallback, id?:string):string|number; bind(target:any, rule?:WebixCallback, format?:string):void; @@ -6274,6 +6551,7 @@ class pivot implements webix.ui.baseview{ config: pivotConfig; name: string; operations: any; + data:DataStore; waitData: webix.promise; } interface popupConfig{ @@ -6384,7 +6662,7 @@ interface portletConfig{ } type portletEventName ='onAfterPortletMove'|'onBeforePortletMove'|'onBindRequest'|'onDestruct'; class portlet implements webix.ui.baseview{ - addView(view:any, index?:number):webix.ui.baseview; + addView(view:any, index?:number):string|number; adjust():void; attachEvent(type:portletEventName, functor:WebixCallback, id?:string):string|number; bind(target:any, rule?:WebixCallback, format?:string):void; @@ -6568,6 +6846,7 @@ interface radioConfig{ minHeight?: number; minWidth?: number; name?: string; + newline?: boolean; on?: EventHash; optionHeight?: number; options?: any[]; @@ -6620,9 +6899,11 @@ class radio implements webix.ui.baseview{ unblockEvent():void; validate():boolean; + $compareValue: WebixCallback; $getSize():any[]; $getValue():string; $height: number; + $prepareValue: WebixCallback; $render: WebixCallback; $renderIcon: WebixCallback; $renderInput(obj:any, html:string, id:string|number):string; @@ -6784,6 +7065,7 @@ class rangechart implements webix.ui.baseview{ on_dblclick: WebixCallback; on_mouse_move: WebixCallback; presets: { [key: string]: any; }; + data:DataStore; waitData: webix.promise; } interface rangesliderConfig{ @@ -6873,10 +7155,12 @@ class rangeslider implements webix.ui.baseview{ unblockEvent():void; validate():boolean; + $compareValue: WebixCallback; $cssName: string; $getSize():any[]; $getValue():string; $height: number; + $prepareValue: WebixCallback; $render: WebixCallback; $renderIcon: WebixCallback; $renderInput(obj:any, html:string, id:string|number):string; @@ -7036,9 +7320,11 @@ class richselect implements webix.ui.baseview{ unblockEvent():void; validate():boolean; + $compareValue: WebixCallback; $getSize():any[]; $getValue():string; $height: number; + $prepareValue: WebixCallback; $render: WebixCallback; $renderIcon: WebixCallback; $renderInput(obj:any, html:string, id:string|number):string; @@ -7088,7 +7374,7 @@ interface richtextConfig{ } type richtextEventName ='onBindRequest'|'onChange'|'onDestruct'; class richtext implements webix.ui.baseview{ - addView(view:any, index?:number):webix.ui.baseview; + addView(view:any, index?:number):string|number; adjust():void; attachEvent(type:richtextEventName, functor:WebixCallback, id?:string):string|number; bind(target:any, rule?:WebixCallback, format?:string):void; @@ -7286,9 +7572,11 @@ class search implements webix.ui.baseview{ unblockEvent():void; validate():boolean; + $compareValue: WebixCallback; $getSize():any[]; $getValue():string; $height: number; + $prepareValue: WebixCallback; $render: WebixCallback; $renderIcon: WebixCallback; $renderInput(obj:any, html:string, id:string|number):string; @@ -7392,9 +7680,11 @@ class segmented implements webix.ui.baseview{ unblockEvent():void; validate():boolean; + $compareValue: WebixCallback; $getSize():any[]; $getValue():string; $height: number; + $prepareValue: WebixCallback; $render: WebixCallback; $renderIcon: WebixCallback; $renderInput(obj:any, html:string, id:string|number):string; @@ -7494,9 +7784,11 @@ class select implements webix.ui.baseview{ unblockEvent():void; validate():boolean; + $compareValue: WebixCallback; $getSize():any[]; $getValue():string; $height: number; + $prepareValue: WebixCallback; $render: WebixCallback; $renderIcon: WebixCallback; $renderInput(obj:any, html:string, id:string|number):string; @@ -7676,9 +7968,11 @@ class slider implements webix.ui.baseview{ unblockEvent():void; validate():boolean; + $compareValue: WebixCallback; $getSize():any[]; $getValue():string; $height: number; + $prepareValue: WebixCallback; $render: WebixCallback; $renderIcon: WebixCallback; $renderInput(obj:any, html:string, id:string|number):string; @@ -7792,7 +8086,7 @@ class spreadsheet implements webix.ui.baseview{ addSheet(content:any):void; addSparkline(rowId:number, columnId:number, config:any):void; addStyle(styleProps:any, baseStyle:any):void; - addView(view:any, index?:number):webix.ui.baseview; + addView(view:any, index?:number):string|number; adjust():void; alert(config:any):HTMLElement; attachEvent(type:spreadsheetEventName, functor:WebixCallback, id?:string):string|number; @@ -7917,6 +8211,7 @@ interface submenuConfig{ height?: number; hidden?: boolean; id?: string|number; + item?: any; layout?: string; left?: number; maxHeight?: number; @@ -8076,6 +8371,7 @@ class submenu implements webix.ui.baseview{ on_mouse_move: WebixCallback; type: { [key: string]: any; }; types: { [key: string]: any; }; + data:DataStore; waitData: webix.promise; } interface suggestConfig{ @@ -8276,9 +8572,11 @@ class tabbar implements webix.ui.baseview{ unblockEvent():void; validate():boolean; + $compareValue: WebixCallback; $getSize():any[]; $getValue():string; $height: number; + $prepareValue: WebixCallback; $render: WebixCallback; $renderIcon: WebixCallback; $renderInput(obj:any, html:string, id:string|number):string; @@ -8327,7 +8625,7 @@ interface tabviewConfig{ } type tabviewEventName ='onBindRequest'|'onDestruct'; class tabview implements webix.ui.baseview{ - addView(view:any):webix.ui.baseview; + addView(view:any):string|number; adjust():void; attachEvent(type:tabviewEventName, functor:WebixCallback, id?:string):string|number; bind(target:any, rule?:WebixCallback, format?:string):void; @@ -8536,9 +8834,11 @@ class text implements webix.ui.baseview{ unblockEvent():void; validate():boolean; + $compareValue: WebixCallback; $getSize():any[]; $getValue():string; $height: number; + $prepareValue: WebixCallback; $render: WebixCallback; $renderIcon: WebixCallback; $renderInput(config:any):HTMLElement; @@ -8639,9 +8939,11 @@ class textarea implements webix.ui.baseview{ unblockEvent():void; validate():boolean; + $compareValue: WebixCallback; $getSize():any[]; $getValue():string; $height: number; + $prepareValue: WebixCallback; $render: WebixCallback; $renderIcon: WebixCallback; $renderInput(obj:any, html:string, id:string|number):string; @@ -8727,9 +9029,11 @@ class toggle implements webix.ui.baseview{ unbind():void; unblockEvent():void; + $compareValue: WebixCallback; $getSize():any[]; $getValue():string; $height: number; + $prepareValue: WebixCallback; $renderInput(config:any):HTMLElement; $scope: any; $setSize(x:number, y:number):boolean; @@ -8782,7 +9086,7 @@ interface toolbarConfig{ } type toolbarEventName ='onAfterLoad'|'onAfterScroll'|'onAfterValidation'|'onBeforeLoad'|'onBeforeValidate'|'onBindRequest'|'onChange'|'onDestruct'|'onLoadError'|'onValidationError'|'onValidationSuccess'|'onValues'; class toolbar implements webix.ui.baseview{ - addView(view:any, index?:number):webix.ui.baseview; + addView(view:any, index?:number):string|number; adjust():void; attachEvent(type:toolbarEventName, functor:WebixCallback, id?:string):string|number; bind(target:any, rule?:WebixCallback, format?:string):void; @@ -8917,6 +9221,7 @@ interface treeConfig{ height?: number; hidden?: boolean; id?: string|number; + item?: any; maxHeight?: number; maxWidth?: number; minHeight?: number; @@ -9063,6 +9368,7 @@ class tree implements webix.ui.baseview{ on_mouse_move: WebixCallback; type: { [key: string]: any; }; types: { [key: string]: any; }; + data:DataStore; waitData: webix.promise; } interface treemapConfig{ @@ -9088,6 +9394,7 @@ interface treemapConfig{ height?: number; hidden?: boolean; id?: string|number; + item?: any; maxHeight?: number; maxWidth?: number; minHeight?: number; @@ -9225,6 +9532,7 @@ class treemap implements webix.ui.baseview{ on_mouse_move: WebixCallback; type: { [key: string]: any; }; types: { [key: string]: any; }; + data:DataStore; waitData: webix.promise; } interface treetableConfig{ @@ -9316,7 +9624,7 @@ interface treetableConfig{ width?: number; yCount?: number; } -type treetableEventName ='onAfterAdd'|'onAfterAreaAdd'|'onAfterAreaRemove'|'onAfterBlockSelect'|'onAfterClose'|'onAfterColumnDrop'|'onAfterColumnDropOrder'|'onAfterColumnHide'|'onAfterColumnShow'|'onAfterContextMenu'|'onAfterDelete'|'onAfterDrop'|''|'onAfterEditStart'|'onAfterEditStop'|'onAfterFilter'|'onAfterLoad'|'onAfterOpen'|'onAfterRender'|'onAfterScroll'|'onAfterSelect'|'onAfterSort'|'onAfterUnSelect'|'onAreaDrag'|'onBeforeAdd'|'onBeforeAreaAdd'|'onBeforeAreaRemove'|'onBeforeBlockSelect'|'onBeforeClose'|'onBeforeColumnDrag'|'onBeforeColumnDrop'|'onBeforeColumnDropOrder'|'onBeforeColumnHide'|'onBeforeColumnShow'|'onBeforeContextMenu'|'onBeforeDelete'|'onBeforeDrag'|'onBeforeDragIn'|'onBeforeDrop'|''|'onBeforeDropOut'|'onBeforeEditStart'|'onBeforeEditStop'|'onBeforeFilter'|'onBeforeLoad'|'onBeforeOpen'|'onBeforeRender'|'onBeforeSelect'|'onBeforeSort'|'onBeforeUnSelect'|'onBindRequest'|'onBlur'|'onCheck'|'onCollectValues'|'onColumnResize'|'onDataRequest'|'onDataUpdate'|'onDestruct'|'onDragOut'|'onEditorChange'|'onFocus'|'onHeaderClick'|'onItemCheck'|'onItemClick'|'onItemDblClick'|'onKeyPress'|'onLiveEdit'|'onLoadError'|'onLongTouch'|'onMouseMove'|'onMouseMoving'|'onMouseOut'|'onResize'|'onRowResize'|'onScrollX'|'onScrollY'|'onSelectChange'|'onStructureLoad'|'onStructureUpdate'|'onSubViewClose'|'onSubViewCreate'|'onSubViewOpen'|'onSubViewRender'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onValidationError'|'onValidationSuccess'|'onViewResize'; +type treetableEventName ='onAfterAdd'|'onAfterAreaAdd'|'onAfterAreaRemove'|'onAfterBlockSelect'|'onAfterClose'|'onAfterColumnDrop'|'onAfterColumnDropOrder'|'onAfterColumnHide'|'onAfterColumnShow'|'onAfterContextMenu'|'onAfterDelete'|'onAfterDrop'|'onAfterDropOrder'|'onAfterEditStart'|'onAfterEditStop'|'onAfterFilter'|'onAfterLoad'|'onAfterOpen'|'onAfterRender'|'onAfterScroll'|'onAfterSelect'|'onAfterSort'|'onAfterUnSelect'|'onAreaDrag'|'onBeforeAdd'|'onBeforeAreaAdd'|'onBeforeAreaRemove'|'onBeforeBlockSelect'|'onBeforeClose'|'onBeforeColumnDrag'|'onBeforeColumnDrop'|'onBeforeColumnDropOrder'|'onBeforeColumnHide'|'onBeforeColumnShow'|'onBeforeContextMenu'|'onBeforeDelete'|'onBeforeDrag'|'onBeforeDragIn'|'onBeforeDrop'|'onBeforeDropOrder'|'onBeforeDropOut'|'onBeforeEditStart'|'onBeforeEditStop'|'onBeforeFilter'|'onBeforeLoad'|'onBeforeOpen'|'onBeforeRender'|'onBeforeSelect'|'onBeforeSort'|'onBeforeUnSelect'|'onBindRequest'|'onBlur'|'onCheck'|'onCollectValues'|'onColumnResize'|'onDataRequest'|'onDataUpdate'|'onDestruct'|'onDragOut'|'onEditorChange'|'onFocus'|'onHeaderClick'|'onItemCheck'|'onItemClick'|'onItemDblClick'|'onKeyPress'|'onLiveEdit'|'onLoadError'|'onLongTouch'|'onMouseMove'|'onMouseMoving'|'onMouseOut'|'onResize'|'onRowResize'|'onScrollX'|'onScrollY'|'onSelectChange'|'onStructureLoad'|'onStructureUpdate'|'onSubViewClose'|'onSubViewCreate'|'onSubViewOpen'|'onSubViewRender'|'onSwipeX'|'onSwipeY'|'onTimedKeyPress'|'onTouchEnd'|'onTouchMove'|'onTouchStart'|'onValidationError'|'onValidationSuccess'|'onViewResize'; class treetable implements webix.ui.baseview{ add(obj:any, index?:number, parentId?:string):string; addCellCss(id:string, name:string, css:string):void; @@ -9482,6 +9790,7 @@ class treetable implements webix.ui.baseview{ on_context: { [key: string]: any; }; on_dblclick: WebixCallback; on_mouse_move: WebixCallback; + data:DataStore; waitData: webix.promise; } interface unitlistConfig{ @@ -9505,6 +9814,7 @@ interface unitlistConfig{ height?: number; hidden?: boolean; id?: string|number; + item?: any; layout?: string; maxHeight?: number; maxWidth?: number; @@ -9640,6 +9950,7 @@ class unitlist implements webix.ui.baseview{ on_mouse_move: WebixCallback; type: { [key: string]: any; }; types: { [key: string]: any; }; + data:DataStore; waitData: webix.promise; } interface uploaderConfig{ @@ -9654,7 +9965,7 @@ interface uploaderConfig{ container?: string|HTMLElement; css?: string; datatype?: string; - directory?: boolean; + directory?: string; disabled?: boolean; formData?: { [key: string]: any; }; gravity?: number; @@ -9723,11 +10034,13 @@ class uploader implements webix.ui.baseview{ unbind():void; unblockEvent():void; + $compareValue: WebixCallback; $cssName: string; $getSize():any[]; $getValue():string; $height: number; $onUploadComplete: WebixCallback; + $prepareValue: WebixCallback; $renderInput(config:any):HTMLElement; $scope: any; $setSize(x:number, y:number):boolean; diff --git a/types/webix/webix-tests.ts b/types/webix/webix-tests.ts old mode 100644 new mode 100755 index bf2c6872c6..1c1e9c9b02 --- a/types/webix/webix-tests.ts +++ b/types/webix/webix-tests.ts @@ -102,10 +102,14 @@ var my = webix.ui({ }); var tn:number = my.customApi(); +//datastore +var t = my.data.getItem(1) +var mSize = webix.html.getTextSize( [].concat(my.data.order).map((a) => a.value )) + //filters namespace webix.ui.datafilter{ var avgColumn = webix.extend({ refresh:function(){ } }, webix.ui.datafilter.summColumn) -} \ No newline at end of file +} From 642fcee49610d499a96fe3383cbe170b57e2fc2c Mon Sep 17 00:00:00 2001 From: boHoffi Date: Thu, 11 May 2017 19:26:04 +0200 Subject: [PATCH 0096/1072] vexflow: fixed type of stem_direction in TabNote --- types/vexflow/index.d.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/types/vexflow/index.d.ts b/types/vexflow/index.d.ts index 2975951738..3c3aa2365a 100644 --- a/types/vexflow/index.d.ts +++ b/types/vexflow/index.d.ts @@ -1,6 +1,8 @@ // Type definitions for VexFlow v1.2.83 // Project: http://vexflow.com -// Definitions by: Roman Quiring , Sebastian Haas +// Definitions by: Roman Quiring +// Sebastian Haas +// Basti Hoffmann // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped //inconsistent namespace: this is a helper funtion from tables.js and should not pollute the global namespace! @@ -1174,7 +1176,7 @@ declare namespace Vex { setStave(stave : Stave) : Note; getModifierStartXY() : {x : number, y : number}; - constructor(tab_struct : {positions : {str : number, fret : number}[], type? : string, dots? : number, duration : string, stem_direction? : boolean}, draw_stem? : boolean); + constructor(tab_struct : {positions : {str : number, fret : number}[], type? : string, dots? : number, duration : string, stem_direction? : number}, draw_stem? : boolean); getCategory() : string; setGhost(ghost : boolean) : TabNote; hasStem() : boolean; From 97b0e34f691759fdfc84e8cd78d6cf7172a734d0 Mon Sep 17 00:00:00 2001 From: boHoffi Date: Thu, 11 May 2017 19:45:21 +0200 Subject: [PATCH 0097/1072] chore: modified README to show fork's build status badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9f3c4fe78f..129576c1ec 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# DefinitelyTyped [![Build Status](https://travis-ci.org/DefinitelyTyped/DefinitelyTyped.png?branch=master)](https://travis-ci.org/DefinitelyTyped/DefinitelyTyped) +# DefinitelyTyped [![Build Status](https://travis-ci.org/bohoffi/DefinitelyTyped.png?branch=master)](https://travis-ci.org/bohoffi/DefinitelyTyped) [![Join the chat at https://gitter.im/borisyankov/DefinitelyTyped](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/borisyankov/DefinitelyTyped?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) From d07131d9edf09d1e60e90cb57cb798a170246b76 Mon Sep 17 00:00:00 2001 From: boHoffi Date: Thu, 11 May 2017 19:47:53 +0200 Subject: [PATCH 0098/1072] reverted changes to README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 129576c1ec..9f3c4fe78f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# DefinitelyTyped [![Build Status](https://travis-ci.org/bohoffi/DefinitelyTyped.png?branch=master)](https://travis-ci.org/bohoffi/DefinitelyTyped) +# DefinitelyTyped [![Build Status](https://travis-ci.org/DefinitelyTyped/DefinitelyTyped.png?branch=master)](https://travis-ci.org/DefinitelyTyped/DefinitelyTyped) [![Join the chat at https://gitter.im/borisyankov/DefinitelyTyped](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/borisyankov/DefinitelyTyped?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) From 3fae2213bbb704c65a0a48da0e88ea0645924304 Mon Sep 17 00:00:00 2001 From: Gregory Karpinsky Date: Thu, 11 May 2017 15:59:32 -0400 Subject: [PATCH 0099/1072] vex-js: added `defaultOptions` To support ```js vex.defaultOptions.className = 'vex-theme-os'; ``` --- types/vex-js/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/vex-js/index.d.ts b/types/vex-js/index.d.ts index ffd1d04dbf..0635b0708a 100644 --- a/types/vex-js/index.d.ts +++ b/types/vex-js/index.d.ts @@ -37,6 +37,7 @@ declare namespace vex { close(id?: number): boolean; closeAll(): boolean; closeByID(id: number): boolean; + defaultOptions?: IVexOptions; } } From 00251fcd7546c56e43db6d7042ddade0eeda7e49 Mon Sep 17 00:00:00 2001 From: motemen Date: Fri, 12 May 2017 11:02:46 +0900 Subject: [PATCH 0100/1072] 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 7ecb5efeaed1a46cffd42f9e1b48d5472d3bbb3e Mon Sep 17 00:00:00 2001 From: Mike Woudenberg Date: Thu, 11 May 2017 21:13:48 +0200 Subject: [PATCH 0101/1072] Adds type definitions for cypress.io --- types/cypress/cypress-tests.ts | 13 + types/cypress/index.d.ts | 543 +++++++++++++++++++++++++++++++++ types/cypress/tsconfig.json | 22 ++ types/cypress/tslint.json | 1 + 4 files changed, 579 insertions(+) create mode 100644 types/cypress/cypress-tests.ts create mode 100644 types/cypress/index.d.ts create mode 100644 types/cypress/tsconfig.json create mode 100644 types/cypress/tslint.json diff --git a/types/cypress/cypress-tests.ts b/types/cypress/cypress-tests.ts new file mode 100644 index 0000000000..2a6b70b2a6 --- /dev/null +++ b/types/cypress/cypress-tests.ts @@ -0,0 +1,13 @@ +// Samples taken from the cypress kitchen sink example (https://github.com/cypress-io/cypress-example-kitchensink) +cy.title().should('include', 'Kitchen Sink'); + +cy + .get('.query-list') + .contains('bananas').should('have.class', 'third') + .contains(/^b\w+/).should('have.class', 'third') + .get('.query-list') + .contains('apples').should('have.class', 'first') + .get('#querying') + .contains('ul', 'oranges').should('have.class', 'query-list') + .get('.query-button') + .contains('Save Form').should('have.class', 'btn'); diff --git a/types/cypress/index.d.ts b/types/cypress/index.d.ts new file mode 100644 index 0000000000..a32c84b25d --- /dev/null +++ b/types/cypress/index.d.ts @@ -0,0 +1,543 @@ +// Type definitions for cypress 0.1 +// Project: https://cypress.io +// Definitions by: Gert Hengeveld +// Mike Woudenberg +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +declare namespace Cypress { + type FileContents = string | any[] | object; + type HistoryDirection = "back" | "forward"; + type HttpMethod = "GET" | "POST" | "PUT" | "DELETE" | "OPTIONS" | "HEAD" | "TRACE" | "CONNECT"; + type RequestBody = string | object; + type ViewportOrientation = "portrait" | "landscape"; + + interface Core { + /** + * @see https://on.cypress.io/api/config + */ + config(): object; + config(key: string): any; + config(key: string, value: any): void; + config(Object: object): void; + + /** + * @see https://on.cypress.io/api/env + */ + env(): object; + env(key: string): any; + env(key: string, value: any): void; + env(Object: object): void; + + /** + * @see https://on.cypress.io/api/commands + */ + addChildCommand(name: string, fn: (args: any[]) => void): void; + addDualCommand(name: string, fn: (args: any[]) => void): void; + addParentCommand(name: string, fn: (args: any[]) => void): void; + + _: any; + $: any; + minimatch: any; + moment: any; + Blob: any; + Promise: any; + + /** + * @see https://on.cypress.io/api/cookies + */ + Cookies: { + debug(enabled: boolean, options?: DebugOptions): void; + preserveOnce(...names: string[]): void; + defaults(options: CookieDefaults): void; + }; + + /** + * @see https://on.cypress.io/api/dom + */ + Dom: { + isHidden(element: object): boolean; + }; + + /** + * @see https://on.cypress.io/api/api-server + */ + Server: { + defaults(options: ServerOptions): void; + }; + } + + interface Chainable { + /** + * @see https://on.cypress.io/api/and + */ + and(chainers: string, value?: any): Chainable; + and(chainers: string, method: string, value: any): Chainable; + and(fn: (args: any[]) => void): Chainable; + + /** + * @see https://on.cypress.io/api/as + */ + as(alias: string): Chainable; + + /** + * @see https://on.cypress.io/api/blur + */ + blur(options?: BlurOptions): Chainable; + + /** + * @see https://on.cypress.io/api/check + */ + check(options?: CheckOptions): Chainable; + check(value: string|string[]): Chainable; // no options + + /** + * @see https://on.cypress.io/api/children + */ + children(options?: LoggableTimeoutable): Chainable; + children(selector: string, options?: LoggableTimeoutable): Chainable; + + /** + * @see https://on.cypress.io/api/clear + */ + clear(options?: ClearOptions): Chainable; + + /** + * @see https://on.cypress.io/api/clearcookie + */ + clearCookie(name: string, options?: LoggableTimeoutable): Chainable; + + /** + * @see https://on.cypress.io/api/clearcookies + */ + clearCookies(options?: LoggableTimeoutable): Chainable; + + /** + * @see https://on.cypress.io/api/clearlocalstorage + */ + clearLocalStorage(key?: string): Chainable; + clearLocalStorage(re: RegExp): Chainable; + + /** + * @see https://on.cypress.io/api/click + */ + click(options?: ClickOptions): Chainable; + click(position: string, options?: ClickOptions): Chainable; + click(x: number, y: number, options?: ClickOptions): Chainable; + + /** + * @see https://on.cypress.io/api/closest + */ + closest(selector: string, options?: LoggableTimeoutable): Chainable; + + /** + * @see https://on.cypress.io/api/contains + */ + contains(text: string, options?: LoggableTimeoutable): Chainable; + contains(num: number|RegExp): Chainable; + contains(selector: string, text: string, options?: LoggableTimeoutable): Chainable; + + /** + * @see https://on.cypress.io/api/dblclick + */ + dblclick(options?: Loggable): Chainable; + + /** + * @see https://on.cypress.io/api/debug + */ + debug(options?: Loggable): Chainable; + + /** + * @see https://on.cypress.io/api/document + */ + document(options?: Loggable): Chainable; + + /** + * @see https://on.cypress.io/api/each + */ + each(fn: (args: any[]) => void): Chainable; + + /** + * @see https://on.cypress.io/api/end + */ + end(): Chainable; + + /** + * @see https://on.cypress.io/api/eq + */ + eq(index: number, options?: LoggableTimeoutable): Chainable; + + /** + * @see https://on.cypress.io/api/exec + */ + exec(command: string, options?: ExecOptions): Chainable; + + /** + * @see https://on.cypress.io/api/filter + */ + filter(selector: string, options?: LoggableTimeoutable): Chainable; + + /** + * @see https://on.cypress.io/api/find + */ + find(selector: string, options?: LoggableTimeoutable): Chainable; + + /** + * @see https://on.cypress.io/api/first + */ + first(options?: LoggableTimeoutable): Chainable; + + /** + * @see https://on.cypress.io/api/fixture + */ + fixture(path: string, options?: Timeoutable): Chainable; // no log? + fixture(path: string, encoding: string, options?: Timeoutable): Chainable; // no log? + + /** + * @see https://on.cypress.io/api/focus + */ + focus(options?: Loggable): Chainable; + + /** + * @see https://on.cypress.io/api/focused + */ + focused(options?: Loggable): Chainable; + + /** + * @see https://on.cypress.io/api/get + */ + get(selector: string, options?: LoggableTimeoutable): Chainable; + get(alias: string, options?: LoggableTimeoutable): Chainable; + + /** + * @see https://on.cypress.io/api/getcookie + */ + getCookie(name: string, options?: LoggableTimeoutable): Chainable; + + /** + * @see https://on.cypress.io/api/getcookies + */ + getCookies(options?: LoggableTimeoutable): Chainable; + + /** + * @see https://on.cypress.io/api/go + */ + go(direction: HistoryDirection|number, options?: LoggableTimeoutable): Chainable; + + /** + * @see https://on.cypress.io/api/hash + */ + hash(options?: Loggable): Chainable; + + /** + * @see https://on.cypress.io/api/invoke + */ + invoke(functionName: string, args: any[]): Chainable; + + /** + * @see https://on.cypress.io/api/its + */ + its(propertyName: string): Chainable; + + /** + * @see https://on.cypress.io/api/last + */ + last(options?: LoggableTimeoutable): Chainable; + + /** + * @see https://on.cypress.io/api/location + */ + location(options?: Loggable): Chainable; + + /** + * @see https://on.cypress.io/api/log + */ + log(message: string, args: any): Chainable; + + /** + * @see https://on.cypress.io/api/next + */ + next(options?: LoggableTimeoutable): Chainable; + next(selector: string, options?: LoggableTimeoutable): Chainable; + + /** + * @see https://on.cypress.io/api/not + */ + not(selector: string, options?: LoggableTimeoutable): Chainable; + + /** + * @see https://on.cypress.io/api/parent + */ + parent(options?: LoggableTimeoutable): Chainable; + parent(selector: string, options?: LoggableTimeoutable): Chainable; + + /** + * @see https://on.cypress.io/api/parents + */ + parents(options?: LoggableTimeoutable): Chainable; + parents(selector: string, options?: LoggableTimeoutable): Chainable; + + /** + * @see https://on.cypress.io/api/pause + */ + pause(options?: Loggable): Chainable; + + /** + * @see https://on.cypress.io/api/prev + */ + prev(options?: LoggableTimeoutable): Chainable; + prev(selector: string, options?: LoggableTimeoutable): Chainable; + + /** + * @see https://on.cypress.io/api/readfile + */ + readFile(filePath: string, options?: Timeoutable): Chainable; // no log? + readFile(filePath: string, encoding: string, options?: Timeoutable): Chainable; // no log? + + /** + * @see https://on.cypress.io/api/reload + */ + reload(options?: LoggableTimeoutable): Chainable; + reload(forceReload: boolean): Chainable; // no options? + + /** + * @see https://on.cypress.io/api/request + */ + request(url: string, body?: RequestBody): Chainable; + request(method: HttpMethod, url: string, body?: RequestBody): Chainable; + request(options: RequestOptions): Chainable; + + /** + * @see https://on.cypress.io/api/root + */ + root(options?: Loggable): Chainable; + + /** + * @see https://on.cypress.io/api/route + */ + route(url: string, response?: any): Chainable; + route(method: string, url: string, response?: any): Chainable; + route(fn: (args: any[]) => void | RouteOptions): Chainable; + + /** + * @see https://on.cypress.io/api/screenshot + */ + screenshot(options?: LoggableTimeoutable): Chainable; + screenshot(fileName: string, options?: LoggableTimeoutable): Chainable; + + /** + * @see https://on.cypress.io/api/select + */ + select(text: string|string[], options?: SelectOptions): Chainable; + select(value: string|string[], options?: SelectOptions): Chainable; + + /** + * @see https://on.cypress.io/api/server + */ + server(options?: ServerOptions): Chainable; + + /** + * @see https://on.cypress.io/api/setcookie + */ + setCookie(name: string, value: string, options?: SetCookieOptions): Chainable; + + /** + * @see https://on.cypress.io/api/should + */ + should(chainers: string, value?: any): Chainable; + should(chainers: string, method: string, value: any): Chainable; + should(fn: (args: any[]) => void): Chainable; + + /** + * @see https://on.cypress.io/api/siblings + */ + siblings(options?: LoggableTimeoutable): Chainable; + siblings(selector: string, options?: LoggableTimeoutable): Chainable; + + /** + * @see https://on.cypress.io/api/spread + */ + spread(fn: (args: any[]) => void): Chainable; + + /** + * @see https://on.cypress.io/api/submit + */ + submit(options?: Loggable): Chainable; + + /** + * @see https://on.cypress.io/api/then + */ + then(fn: (args: any[]) => void): Chainable; + + /** + * @see https://on.cypress.io/api/title + */ + title(options?: Loggable): Chainable; + + /** + * @see https://on.cypress.io/api/type + */ + type(text: string, options?: TypeOptions): Chainable; + + /** + * @see https://on.cypress.io/api/uncheck + */ + uncheck(options?: CheckOptions): Chainable; + uncheck(values: string[]): Chainable; // no options? missing single value variant + + /** + * @see https://on.cypress.io/api/url + */ + url(options?: Loggable): Chainable; + + /** + * @see https://on.cypress.io/api/viewport + */ + viewport(width: number, height: number, options?: Loggable): Chainable; + viewport(preset: string, orientation: ViewportOrientation, options?: Loggable): Chainable; + + /** + * @see https://on.cypress.io/api/visit + */ + visit(url: string, options?: VisitOptions): Chainable; + + /** + * @see https://on.cypress.io/api/wait + */ + wait(ms: number|string[]): Chainable; // no options? + wait(alias: string, options?: LoggableTimeoutable): Chainable; + + /** + * @see https://on.cypress.io/api/window + */ + window(options?: Loggable): Chainable; + + /** + * @see https://on.cypress.io/api/within + */ + within(fn: (args: any[]) => void): Chainable; + within(options: Loggable, fn: (args: any[]) => void): Chainable; // inconsistent argument order + + /** + * @see https://on.cypress.io/api/wrap + */ + wrap(Object: object, options?: Loggable): Chainable; + + /** + * @see https://on.cypress.io/api/writefile + */ + writeFile(filePath: string, contents: FileContents, options?: Timeoutable): Chainable; + writeFile(filePath: string, contents: FileContents, encoding: string, options?: Timeoutable): Chainable; + } + + interface DebugOptions { + verbose?: boolean; + } + + interface CookieDefaults { + whitelist?: string | string[] | RegExp | ((args: any[]) => void); + } + + interface Loggable { + log?: boolean; + } + + interface Timeoutable { + timeout?: number; + } + + interface LoggableTimeoutable extends Loggable, Timeoutable {} + + interface BlurOptions extends Loggable { + force?: boolean; + } + + interface CheckOptions extends Loggable, Timeoutable { + interval?: number; + force?: boolean; + } + + interface ClearOptions extends Loggable, Timeoutable { + force?: boolean; + interval?: number; + } + + interface ClickOptions extends Loggable, Timeoutable { + force?: boolean; + multiple?: boolean; + interval?: number; + } + + interface ExecOptions extends Loggable, Timeoutable { + failOnNonZeroExit?: boolean; + env?: object; + } + + interface RequestOptions extends Loggable, Timeoutable { + auth?: object; + body?: RequestBody; + failOnStatusCode?: boolean; + followRedirect?: boolean; + form?: boolean; + gzip?: boolean; + headers?: object; + method?: HttpMethod; + qs?: string; + url: string; + } + + interface RouteOptions { + method?: HttpMethod; + url?: string | RegExp; + response?: any; + status?: number; + delay?: number; + headers?: object; + force404?: boolean; + onRequest?(args: any[]): void; + onResponse?(args: any[]): void; + onAbort?(args: any[]): void; + } + + interface SelectOptions extends Loggable, Timeoutable { + force?: boolean; + interval?: number; + } + + interface ServerOptions { + delay?: number; + method?: HttpMethod; + status?: number; + headers?: object; + response?: any; + onRequest?(args: any[]): void; + onResponse?(args: any[]): void; + onAbort?(args: any[]): void; + enable?: boolean; + force404?: boolean; + urlMatchingOptions?: object; + whitelist?(args: any[]): void; + } + + interface SetCookieOptions extends Loggable, Timeoutable { + path?: string; + domain?: string; + secure?: boolean; + httpOnly?: boolean; + expiry?: number; + } + + interface TypeOptions extends Loggable, Timeoutable { + delay?: number; + force?: boolean; + release?: boolean; + interval?: number; + } + + interface VisitOptions extends Loggable, Timeoutable { + onBeforeLoad?(args: any[]): void; + onLoad?(args: any[]): void; + } +} + +declare const cy: Cypress.Chainable; diff --git a/types/cypress/tsconfig.json b/types/cypress/tsconfig.json new file mode 100644 index 0000000000..6e61b09e60 --- /dev/null +++ b/types/cypress/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", + "cypress-tests.ts" + ] +} diff --git a/types/cypress/tslint.json b/types/cypress/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/cypress/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From a30c7a0e2024f17d25bf17904c5b9d027c3ffdab Mon Sep 17 00:00:00 2001 From: shtifanov Date: Fri, 12 May 2017 10:54:20 +0200 Subject: [PATCH 0102/1072] correct wrong summary by ASPxClientTreeListContextMenuEventArgs.cancel field --- types/devexpress-web/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/devexpress-web/index.d.ts b/types/devexpress-web/index.d.ts index b52c31759d..0da78411ac 100644 --- a/types/devexpress-web/index.d.ts +++ b/types/devexpress-web/index.d.ts @@ -15374,7 +15374,7 @@ interface ASPxClientTreeListContextMenuEventArgs extends ASPxClientEventArgs { htmlEvent: Object; /** * Gets or sets whether to invoke the browser's context menu. - * Value: true to hide the browser's context menu; otherwise, false. + * Value: true to show the browser's context menu; otherwise, false. */ cancel: boolean; } From b4dc0dce63a307bfae959ff2b6713846a5b3edb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joona=20Heikkil=C3=A4?= Date: Fri, 12 May 2017 16:23:47 +0300 Subject: [PATCH 0103/1072] Add types for stale-lru-cache --- types/stale-lru-cache/index.d.ts | 43 ++++++++++++++++++ .../stale-lru-cache/stale-lru-cache-tests.ts | 44 +++++++++++++++++++ types/stale-lru-cache/tsconfig.json | 22 ++++++++++ types/stale-lru-cache/tslint.json | 1 + 4 files changed, 110 insertions(+) create mode 100644 types/stale-lru-cache/index.d.ts create mode 100644 types/stale-lru-cache/stale-lru-cache-tests.ts create mode 100644 types/stale-lru-cache/tsconfig.json create mode 100644 types/stale-lru-cache/tslint.json diff --git a/types/stale-lru-cache/index.d.ts b/types/stale-lru-cache/index.d.ts new file mode 100644 index 0000000000..f5ab3733b3 --- /dev/null +++ b/types/stale-lru-cache/index.d.ts @@ -0,0 +1,43 @@ +// Type definitions for stale-lru-cache 5.1 +// Project: https://github.com/cyberthom/stale-lru-cache +// Definitions by: Joona Heikkilä +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare class Cache { + constructor(options?: Cache.CacheOptions); + delete(key: K): boolean; + get(key: K): V | undefined; + set(key: K, value: V, options?: string | Cache.SetOptions): boolean; + has(key: K): boolean; + isStale(key: K): boolean; + keys(): K[]; + reset(): void; + size(): number; + values(): V[]; + wrap( + key: K, + revalidate: Cache.RevalidationCallback, + callback: Cache.OptionsCallback + ): void; +} + +declare namespace Cache { + type OptionsCallback = (error: any, value: V, options?: string | SetOptions) => void; + type RevalidationCallback = (key: K, callback: OptionsCallback) => void; + + interface CacheOptions { + maxAge?: number; + staleWhileRevalidate?: number; + revalidate?: RevalidationCallback; + maxSize?: number; + getSize?(value: V, key: K): number; + } + + interface SetOptions { + maxAge?: number; + staleWhileRevalidate?: number; + revalidate?: RevalidationCallback; + } +} + +export = Cache; diff --git a/types/stale-lru-cache/stale-lru-cache-tests.ts b/types/stale-lru-cache/stale-lru-cache-tests.ts new file mode 100644 index 0000000000..c1364baa83 --- /dev/null +++ b/types/stale-lru-cache/stale-lru-cache-tests.ts @@ -0,0 +1,44 @@ +import * as Cache from 'stale-lru-cache'; + +const cache = new Cache({ + maxSize: 100, + maxAge: 600, + staleWhileRevalidate: 86400, + revalidate: (key, callback) => { + callback(null, 'Value of ' + key); + } +}); + +const success: boolean = cache.set('key', 'value'); // true +const value: string = cache.get('key') || 'backup'; // 'value' +const deleteSuccess: boolean = cache.delete('key'); +const has: boolean = cache.has('key'); +const isStale: boolean = cache.isStale('key'); +const keys: string[] = cache.keys(); +cache.reset(); + +cache.set('foo', 'bar'); + +// Get response from cache +const revalidate = (url: string, callback: (error: any, value?: string, options?: string) => any) => { + request(url, (error, response, html) => { + if (error) return callback(error); + callback(null, html, response.headers['cache-control']); + }); +}; + +let request: (url: string, cb: (error: any, response: any, html: string) => any) => any; +cache.wrap('http://www.google.com', revalidate, (error, html) => { + // Do something with cached response +}); + +cache.set('key', 'value'); // true + +cache.set('key', 'value', { maxAge: 600, staleWhileRevalidate: 86400 }); // true +cache.set('key', 'value', { maxAge: 0 }); // false + +cache.set('key', 'value', 'max-age=600, stale-while-revalidate=86400'); // true +cache.set('key', 'value', 'no-cache, no-store, must-revalidate'); // false + +const size: number = cache.size(); +const values: string[] = cache.values(); diff --git a/types/stale-lru-cache/tsconfig.json b/types/stale-lru-cache/tsconfig.json new file mode 100644 index 0000000000..ccd4edb516 --- /dev/null +++ b/types/stale-lru-cache/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", + "stale-lru-cache-tests.ts" + ] +} diff --git a/types/stale-lru-cache/tslint.json b/types/stale-lru-cache/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/stale-lru-cache/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 11c5e219384bf4f68a008e1e4bf6f89bc803be2f Mon Sep 17 00:00:00 2001 From: TeamworkGuy2 Date: Fri, 12 May 2017 13:26:27 +0000 Subject: [PATCH 0104/1072] [through2] Add 'this' type to callbacks and fix through2.ctor() signature for optional 'options' parameter --- types/through2/index.d.ts | 19 +++++++++---------- types/through2/through2-tests.ts | 30 +++++++++++++++++++----------- types/through2/tslint.json | 3 +++ 3 files changed, 31 insertions(+), 21 deletions(-) create mode 100644 types/through2/tslint.json diff --git a/types/through2/index.d.ts b/types/through2/index.d.ts index 711eafeaed..3ff12ff86d 100644 --- a/types/through2/index.d.ts +++ b/types/through2/index.d.ts @@ -1,24 +1,22 @@ -// Type definitions for through2 v 2.0.0 +// Type definitions for through2 v 2.0 // Project: https://github.com/rvagg/through2 -// Definitions by: Bart van der Schoor , jedmao , Georgios Valotasios , Ben Chauvette +// Definitions by: Bart van der Schoor , jedmao , Georgios Valotasios +// Ben Chauvette < https://github.com/bdchauvette>, TeamworkGuy2 // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// - - import stream = require('stream'); type TransformCallback = (err?: any, data?: any) => void; -type TransformFunction = (chunk: any, enc: string, callback: TransformCallback) => void; -type FlushCallback = (flushCallback: () => void) => void; +type TransformFunction = (this: stream.Transform, chunk: any, enc: string, callback: TransformCallback) => void; +type FlushCallback = (this: stream.Transform, flushCallback: () => void) => void; declare function through2(transform?: TransformFunction, flush?: FlushCallback): stream.Transform; - declare function through2(opts?: stream.DuplexOptions, transform?: TransformFunction, flush?: FlushCallback): stream.Transform; declare namespace through2 { - export interface Through2Constructor extends stream.Transform { + interface Through2Constructor extends stream.Transform { new (opts?: stream.DuplexOptions): stream.Transform; (opts?: stream.DuplexOptions): stream.Transform; } @@ -26,13 +24,14 @@ declare namespace through2 { /** * Convenvience method for creating object streams */ - export function obj(transform?: TransformFunction, flush?: FlushCallback): stream.Transform; + function obj(transform?: TransformFunction, flush?: FlushCallback): stream.Transform; /** * Creates a constructor for a custom Transform. This is useful when you * want to use the same transform logic in multiple instances. */ - export function ctor(opts?: stream.DuplexOptions, transfrom?: TransformFunction, flush?: FlushCallback): Through2Constructor; + function ctor(transform?: TransformFunction, flush?: FlushCallback): Through2Constructor; + function ctor(opts?: stream.DuplexOptions, transform?: TransformFunction, flush?: FlushCallback): Through2Constructor; } export = through2; diff --git a/types/through2/through2-tests.ts b/types/through2/through2-tests.ts index 70a66e4b0e..e1de34f3a9 100644 --- a/types/through2/through2-tests.ts +++ b/types/through2/through2-tests.ts @@ -4,6 +4,8 @@ import through2 = require('through2'); var rws: stream.Transform; var Rws: through2.Through2Constructor; +rws = through2(); + rws = through2({ objectMode: true, allowHalfOpen: true @@ -21,6 +23,14 @@ rws = through2(function (entry: any, enc: string, callback: () => void) { }); +rws = through2(function (entry, enc, callback) { + var str: string = enc; + this.push(entry, str); + callback(null, 'continue'); +}, () => { + +}); + rws = through2(function (entry: any, enc: string, callback: (error: any, data?: any) => void) { callback(null, 'foo'); }, (flushCallback: () => void) => { @@ -30,10 +40,10 @@ rws = through2(function (entry: any, enc: string, callback: (error: any, data?: rws = through2(function (entry: any, enc: string, callback: () => void) { this.push('foo'); callback(); +}, (flushCallback) => { + flushCallback(); }); -rws = through2(); - // obj rws = through2.obj(function (entry: any, enc: string, callback: () => void) { this.push('foo'); @@ -42,9 +52,10 @@ rws = through2.obj(function (entry: any, enc: string, callback: () => void) { }); -rws = through2.obj(function (entry: any, enc: string, callback: () => void) { - this.push('foo'); - callback(); +rws = through2.obj(function (entry, enc, callback) { + var str: string = enc; + this.push('foo', enc); + callback(null, entry); }); rws = through2.obj(function (entry: any, enc: string, callback: (err: any) => void) { @@ -68,7 +79,7 @@ rws = Rws(); rws = new Rws(); rws = new Rws({ objectMode: true, allowHalfOpen: true }); -Rws = through2.ctor(function (entry: any, enc: string, callback: () => void) { +Rws = through2.ctor(function (entry, enc, callback) { this.push('foo'); callback(); }, () => { @@ -80,8 +91,9 @@ rws = new Rws(); rws = new Rws({ objectMode: true, allowHalfOpen: true }); Rws = through2.ctor(function (entry: any, enc: string, callback: (error: any, data?: any) => void) { + this.emit("data", "more data"); callback(null, 'foo'); -}, (flushCallback: () => void) => { +}, (flushCallback) => { flushCallback(); }); @@ -93,7 +105,3 @@ Rws = through2.ctor(function (entry: any, enc: string, callback: () => void) { this.push('foo'); callback(); }); - -rws = Rws(); -rws = new Rws(); -rws = new Rws({ objectMode: true, allowHalfOpen: true }); diff --git a/types/through2/tslint.json b/types/through2/tslint.json new file mode 100644 index 0000000000..e60c15844f --- /dev/null +++ b/types/through2/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file From 9e9a249600dc561a3645118304bfeb63a038e637 Mon Sep 17 00:00:00 2001 From: TeamworkGuy2 Date: Fri, 12 May 2017 13:54:45 +0000 Subject: [PATCH 0105/1072] [through2] remove tslint to fix test file build errors --- types/through2/tslint.json | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 types/through2/tslint.json diff --git a/types/through2/tslint.json b/types/through2/tslint.json deleted file mode 100644 index e60c15844f..0000000000 --- a/types/through2/tslint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "dtslint/dt.json" -} \ No newline at end of file From 88b5e8747b100e295508f06595edb81f49125681 Mon Sep 17 00:00:00 2001 From: olamothe Date: Fri, 12 May 2017 11:02:04 -0400 Subject: [PATCH 0106/1072] _.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 0107/1072] 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 0108/1072] 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 2dddf787b698b141c9449074f3122338216d47cf Mon Sep 17 00:00:00 2001 From: Pavel Ivanov Date: Fri, 12 May 2017 19:38:19 +0300 Subject: [PATCH 0109/1072] Add type definitions for graphql-type-json package --- .../graphql-type-json-tests.ts | 20 +++++++++++++++++ types/graphql-type-json/index.d.ts | 8 +++++++ types/graphql-type-json/tsconfig.json | 22 +++++++++++++++++++ types/graphql-type-json/tslint.json | 1 + 4 files changed, 51 insertions(+) create mode 100644 types/graphql-type-json/graphql-type-json-tests.ts create mode 100644 types/graphql-type-json/index.d.ts create mode 100644 types/graphql-type-json/tsconfig.json create mode 100644 types/graphql-type-json/tslint.json diff --git a/types/graphql-type-json/graphql-type-json-tests.ts b/types/graphql-type-json/graphql-type-json-tests.ts new file mode 100644 index 0000000000..3282681845 --- /dev/null +++ b/types/graphql-type-json/graphql-type-json-tests.ts @@ -0,0 +1,20 @@ +import {GraphQLObjectType, GraphQLInputObjectType} from "graphql"; +import * as GraphQLJSON from "graphql-type-json"; + +const TestType = new GraphQLObjectType({ + name: "TestType", + fields: { + test: { + type: GraphQLJSON + } + } +}); + +const TestInputType = new GraphQLInputObjectType({ + name: "TestInputType", + fields: { + test: { + type: GraphQLJSON + } + } +}); diff --git a/types/graphql-type-json/index.d.ts b/types/graphql-type-json/index.d.ts new file mode 100644 index 0000000000..7d41b83013 --- /dev/null +++ b/types/graphql-type-json/index.d.ts @@ -0,0 +1,8 @@ +// Type definitions for graphql-type-json 0.1 +// Project: https://github.com/taion/graphql-type-json#readme +// Definitions by: Pavel Ivanov +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +import {GraphQLScalarType} from "graphql"; + +declare const GraphQLJSON: GraphQLScalarType; +export = GraphQLJSON; diff --git a/types/graphql-type-json/tsconfig.json b/types/graphql-type-json/tsconfig.json new file mode 100644 index 0000000000..4120681b12 --- /dev/null +++ b/types/graphql-type-json/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", + "graphql-type-json-tests.ts" + ] +} diff --git a/types/graphql-type-json/tslint.json b/types/graphql-type-json/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/graphql-type-json/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 6c58ed7669837fdd50b893a035916c6170355324 Mon Sep 17 00:00:00 2001 From: TeamworkGuy2 Date: Fri, 12 May 2017 17:04:40 +0000 Subject: [PATCH 0110/1072] [orchestrator] Improved types based on orchestrator 0.3.8 source code --- types/orchestrator/index.d.ts | 173 ++++++++++++++--------- types/orchestrator/orchestrator-tests.ts | 54 ++++--- 2 files changed, 133 insertions(+), 94 deletions(-) diff --git a/types/orchestrator/index.d.ts b/types/orchestrator/index.d.ts index c1eae16416..7f8a6ed80e 100644 --- a/types/orchestrator/index.d.ts +++ b/types/orchestrator/index.d.ts @@ -1,107 +1,135 @@ -// Type definitions for Orchestrator +// Type definitions for Orchestrator 0.3 // Project: https://github.com/orchestrator/orchestrator -// Definitions by: Qubo +// Definitions by: Qubo , TeamworkGuy2 // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +/// + +import * as events from "events"; +import * as stream from "stream"; import * as Q from "q"; -declare type Strings = string|string[]; +type _Sequencify = (tasks: Array<{ dep: string[]; }>, names: string[]) => { sequence: string[]; missingTasks: string[]; recursiveDependencies: string[]; }; -declare class Orchestrator { +type _runTask = (task: Orchestrator.TaskMethod, done: (err: any, meta: Orchestrator.Meta) => void) => void; + +type Strings = string|string[]; + +/** A module for sequencing and executing tasks and dependencies in maximum concurrency + */ +declare class Orchestrator extends events.EventEmitter { + doneCallback?: (error?: any) => any; + isRunning: boolean; + seq: any[]; + tasks: { [name: string]: Orchestrator.Task }; + + reset(): Orchestrator; + + /** Define a task + * @param name The name of the task. + * @param deps An array of task names to be executed and completed before your task will run. + * @param fn The function that performs the task's operations. For asynchronous tasks, you need to provide a hint when the task is complete: + * - Take in a callback + * - Return a stream or a promise + */ add: Orchestrator.AddMethod; - /** - * Have you defined a task with this name? + + task(name: string): Orchestrator.Task; + task(name: string, fn: Orchestrator.TaskMethod): void; + task(name: string, dep: string[], fn: Orchestrator.TaskMethod): void; + task(name: string, dep?: string[] | Orchestrator.TaskMethod, fn?: Orchestrator.TaskMethod): void; + + /** Have you defined a task with this name? * @param name The task name to query */ hasTask(name: string): boolean; - start: Orchestrator.StartMethod; - stop(): void; - /** - * Listen to orchestrator internals + start: Orchestrator.StartMethod; + + stop(err?: any, successfulFinish?: boolean): void; + + sequence: _Sequencify; + + allDone(): boolean; + + /** Listen to orchestrator internals * @param event Event name to listen to: - *
    - *
  • start: from start() method, shows you the task sequence - *
  • stop: from stop() method, the queue finished successfully - *
  • err: from stop() method, the queue was aborted due to a task error - *
  • task_start: from _runTask() method, task was started - *
  • task_stop: from _runTask() method, task completed successfully - *
  • task_err: from _runTask() method, task errored - *
  • task_not_found: from start() method, you're trying to start a task that doesn't exist - *
  • task_recursion: from start() method, there are recursive dependencies in your task list - *
+ * - start: from start() method, shows you the task sequence + * - stop: from stop() method, the queue finished successfully + * - err: from stop() method, the queue was aborted due to a task error + * - task_start: from _runTask() method, task was started + * - task_stop: from _runTask() method, task completed successfully + * - task_err: from _runTask() method, task errored + * - task_not_found: from start() method, you're trying to start a task that doesn't exist + * - task_recursion: from start() method, there are recursive dependencies in your task list * @param cb Passes single argument: e: event details */ - on(event: string, cb: (e: Orchestrator.OnCallbackEvent) => any): Orchestrator; + on(event: Orchestrator.EventNames, cb: (e: Orchestrator.OnCallbackEvent) => any): this; - /** - * Listen to all orchestrator events from one callback + /** Listen to all orchestrator events from one callback * @param cb Passes single argument: e: event details */ onAll(cb: (e: Orchestrator.OnAllCallbackEvent) => any): void; + + // probably supposed to be private methods, but still available on Orchestrator prototype + _resetTask(task: Orchestrator.Task): void; + + _resetAllTasks(): void; + + _resetSpecificTasks(names: string[]): void; + + _runStep(): void; + + _readyToRunTask(task: Orchestrator.Task): boolean; + + _stopTask(task: Orchestrator.Task, meta: Orchestrator.Meta): void; + + _emitTaskDone(task: Orchestrator.Task, message: string, err?: any): void; + + _runTask(task: Orchestrator.Task): void; } declare namespace Orchestrator { - interface AddMethodCallback { - /** - * Accept a callback - * @param callback - */ - (callback?: Function): any; - /** - * Return a promise - */ - (): Q.Promise; - /** - * Return a stream: (task is marked complete when stream ends) - */ - (): any; //TODO: stream type should be here e.g. map-stream - } + type runTask = _runTask; - /** - * Define a task + type Sequencify = _Sequencify; + + /** A task, can either call a callback to indicate task completion or return a promise or a stream: (task is marked complete when promise.then() resolves/fails or stream ends) */ + type TaskMethod = (callback: (err?: any) => void) => Q.Promise | stream.Stream | any; + interface AddMethod { - /** - * Define a task + /** Define a task + * @param name The name of the task. + * @param fn The function that performs the task's operations. For asynchronous tasks, you need to provide a hint when the task is complete: + * - Take in a callback + * - Return a stream or a promise + */ + (name: string, fn?: TaskMethod): Orchestrator; + /** Define a task * @param name The name of the task. * @param deps An array of task names to be executed and completed before your task will run. * @param fn The function that performs the task's operations. For asynchronous tasks, you need to provide a hint when the task is complete: - *
    - *
  • Take in a callback
  • - *
  • Return a stream or a promise
  • - *
+ * - Take in a callback + * - Return a stream or a promise */ - (name: string, deps?: string[], fn?: AddMethodCallback|Function): Orchestrator; - /** - * Define a task - * @param name The name of the task. - * @param fn The function that performs the task's operations. For asynchronous tasks, you need to provide a hint when the task is complete: - *
    - *
  • Take in a callback
  • - *
  • Return a stream or a promise
  • - *
- */ - (name: string, fn?: AddMethodCallback|Function): Orchestrator; + (name: string, deps?: string[], fn?: TaskMethod): Orchestrator; } - /** - * Start running the tasks + /** Start running the tasks */ interface StartMethod { - /** - * Start running the tasks + /** Start running the tasks * @param tasks Tasks to be executed. You may pass any number of tasks as individual arguments. * @param cb Callback to call after run completed. */ (tasks: Strings, cb?: (error?: any) => any): Orchestrator; - /** - * Start running the tasks + /** Start running the tasks * @param tasks Tasks to be executed. You may pass any number of tasks as individual arguments. * @param cb Callback to call after run completed. */ (...tasks: Strings[]/*, cb?: (error: any) => any */): Orchestrator; - //TODO: TypeScript 1.5.3 cannot express varargs followed by callback as a last argument... + // TODO: TypeScript 2.1.5 cannot express varargs followed by callback as a last argument... (task1: Strings, task2: Strings, cb?: (error?: any) => any): Orchestrator; (task1: Strings, task2: Strings, task3: Strings, cb?: (error?: any) => any): Orchestrator; (task1: Strings, task2: Strings, task3: Strings, task4: Strings, cb?: (error?: any) => any): Orchestrator; @@ -120,6 +148,23 @@ declare namespace Orchestrator { src: string; } + interface Task { + fn: TaskMethod; + dep: string[]; + name: string; + done?: boolean; + duration?: number; + hrDuration?: [number, number]; + running?: boolean; + } + + interface Meta { + duration: number; + hrDuration: [number, number]; + runMethod: ("callback" | "catch" | "promise" | "stream" | "sync"); + } + + type EventNames = ("start" | "stop" | "err" | "task_start" | "task_stop" | "task_err" | "task_not_found" | "task_recursion"); } export = Orchestrator; diff --git a/types/orchestrator/orchestrator-tests.ts b/types/orchestrator/orchestrator-tests.ts index 4897a875e6..e25f12fb48 100644 --- a/types/orchestrator/orchestrator-tests.ts +++ b/types/orchestrator/orchestrator-tests.ts @@ -1,10 +1,11 @@ 'use strict'; +import stream = require("stream"); +import Q = require('q'); import Orchestrator = require('orchestrator'); var orchestrator = new Orchestrator(); - // API: // @@ -13,60 +14,50 @@ var orchestrator = new Orchestrator(); orchestrator.add('thing1', function() { // do stuff -}); -orchestrator.add('thing2', function() { +}).add('thing2', function() { // do stuff }); orchestrator.add('mytask', ['array', 'of', 'task', 'names'], function() { // Do stuff }); -orchestrator.add('thing2', function(callback: any){ +orchestrator.add('thing2', function(callback){ var err: any = null; // do stuff callback(err); }); - -import Q = require('q'); - orchestrator.add('thing3', function(){ - var deferred = Q.defer(); + var deferred = Q.defer(); // do async stuff - setTimeout(function () { + setTimeout(function() { deferred.resolve(); }, 1); return deferred.promise; }); - -//TODO: map-stream currently not on DefinitelyTyped -//var map = require('map-stream'); -// -//orchestrator.add('thing4', function(){ -// var stream = map(function (args, cb) { -// cb(null, args); -// }); -// // do stream stuff -// return stream; -//}); +orchestrator.add('thing4', function(){ + var stm = new stream.Stream(); + // do stream stuff + return stm; +}); // // orchestrator.hasTask(name); // -orchestrator.hasTask('thing1'); +var hasThing1: boolean = orchestrator.hasTask('thing1'); // // orchestrator.start(tasks...[, cb]); // -orchestrator.start('thing1', 'thing2', 'thing3', 'thing4', function (err: any) { +orchestrator.start('thing1', 'thing2', 'thing3', 'thing4', function(err: any) { // all done +}).start(['thing1', 'thing2'], ['thing3', 'thing4'], "thing5", function(err) { + var res: any = err; }); -orchestrator.start(['thing1','thing2'], ['thing3','thing4']); - // // orchestrator.stop() @@ -74,16 +65,22 @@ orchestrator.start(['thing1','thing2'], ['thing3','thing4']); orchestrator.stop(); +// +// orchestrator.reset() +// + +orchestrator.reset(); + // // orchestrator.on(event, cb); // -orchestrator.on('task_start', function (e) { +orchestrator.on('task_start', function(e) { var message: string = e.message; var task: string = e.task; var err: any = e.err; }); -orchestrator.on('task_stop', function (e) { +orchestrator.on('task_stop', function(e) { var message: string = e.message; var task: string = e.task; var duration: number = e.duration; @@ -93,12 +90,9 @@ orchestrator.on('task_stop', function (e) { // orchestrator.onAll(cb); // -orchestrator.onAll(function (e) { +orchestrator.onAll(function(e) { var message: string = e.message; var task: string = e.task; var err: any = e.err; var src: string = e.src; }); - - - From 0637230a55cdca02954d7bb7b9ca32c876ac29b5 Mon Sep 17 00:00:00 2001 From: "webix.io" Date: Fri, 12 May 2017 20:59:19 +0300 Subject: [PATCH 0111/1072] Typescript 2.2 header added --- types/webix/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/webix/index.d.ts b/types/webix/index.d.ts index 11f2be71e8..f5d2954d7a 100755 --- a/types/webix/index.d.ts +++ b/types/webix/index.d.ts @@ -2,6 +2,7 @@ // Project: http://webix.com // Definitions by: Maksim Kozhukh // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 declare namespace webix { @@ -10183,4 +10184,4 @@ class window implements webix.ui.baseview{ }} -declare function $$(id: string | Event | HTMLElement): webix.ui.baseview; \ No newline at end of file +declare function $$(id: string | Event | HTMLElement): webix.ui.baseview; From 758a15dca5ae95d5ec9e112db2022cca0487d337 Mon Sep 17 00:00:00 2001 From: TeamworkGuy2 Date: Fri, 12 May 2017 18:34:53 +0000 Subject: [PATCH 0112/1072] gulp & orchestrator type fixes (gulp extends orchestartor) --- types/gulp/gulp-tests.ts | 3 +++ types/gulp/index.d.ts | 15 ++++++++++++++- types/orchestrator/index.d.ts | 24 +++++++++++++++--------- types/orchestrator/orchestrator-tests.ts | 14 ++++++++++++++ 4 files changed, 46 insertions(+), 10 deletions(-) diff --git a/types/gulp/gulp-tests.ts b/types/gulp/gulp-tests.ts index 9660b0658a..809ffed350 100644 --- a/types/gulp/gulp-tests.ts +++ b/types/gulp/gulp-tests.ts @@ -27,6 +27,9 @@ gulp.task('test', ['compile', 'compile2'], function() gulp.task('default', ['compile', 'test']); +gulp.task('another', ['with1', 'with2']) + .task('some', ['other1', 'other2'], function(cb) { cb(null); }) + .task('last', function() { }); var opts = {}; diff --git a/types/gulp/index.d.ts b/types/gulp/index.d.ts index fefd5b0fda..2a7579ec1f 100644 --- a/types/gulp/index.d.ts +++ b/types/gulp/index.d.ts @@ -14,6 +14,7 @@ declare type Strings = string|string[]; declare namespace gulp { interface Gulp extends Orchestrator { + task(name: string): never; /** * Define a task * @param name The name of the task. @@ -24,7 +25,19 @@ declare namespace gulp { *
  • Return a stream or a promise
  • * */ - task: Orchestrator.AddMethod; + task(name: string, fn?: Orchestrator.TaskFunc): Gulp; + /** + * Define a task + * @param name The name of the task. + * @param deps An array of task names to be executed and completed before your task will run. + * @param fn The function that performs the task's operations. For asynchronous tasks, you need to provide a hint when the task is complete: + *
      + *
    • Take in a callback
    • + *
    • Return a stream or a promise
    • + *
    + */ + task(name: string, deps?: string[], fn?: Orchestrator.TaskFunc): Gulp; + /** * Takes a number of task names or functions and returns a function of the composed tasks or functions * When the returned function is executed, the tasks or functions will be executed in series, diff --git a/types/orchestrator/index.d.ts b/types/orchestrator/index.d.ts index 7f8a6ed80e..52ceacf429 100644 --- a/types/orchestrator/index.d.ts +++ b/types/orchestrator/index.d.ts @@ -11,7 +11,7 @@ import * as Q from "q"; type _Sequencify = (tasks: Array<{ dep: string[]; }>, names: string[]) => { sequence: string[]; missingTasks: string[]; recursiveDependencies: string[]; }; -type _runTask = (task: Orchestrator.TaskMethod, done: (err: any, meta: Orchestrator.Meta) => void) => void; +type _runTask = (task: Orchestrator.TaskFunc, done: (err: any, meta: Orchestrator.Meta) => void) => void; type Strings = string|string[]; @@ -25,6 +25,13 @@ declare class Orchestrator extends events.EventEmitter { reset(): Orchestrator; + /** Define a task + * @param name The name of the task. + * @param fn The function that performs the task's operations. For asynchronous tasks, you need to provide a hint when the task is complete: + * - Take in a callback + * - Return a stream or a promise + */ + add(name: string, fn?: Orchestrator.TaskFunc): Orchestrator; /** Define a task * @param name The name of the task. * @param deps An array of task names to be executed and completed before your task will run. @@ -32,12 +39,11 @@ declare class Orchestrator extends events.EventEmitter { * - Take in a callback * - Return a stream or a promise */ - add: Orchestrator.AddMethod; + add(name: string, deps?: string[], fn?: Orchestrator.TaskFunc): Orchestrator; task(name: string): Orchestrator.Task; - task(name: string, fn: Orchestrator.TaskMethod): void; - task(name: string, dep: string[], fn: Orchestrator.TaskMethod): void; - task(name: string, dep?: string[] | Orchestrator.TaskMethod, fn?: Orchestrator.TaskMethod): void; + task(name: string, fn: Orchestrator.TaskFunc): void; + task(name: string, dep: string[], fn: Orchestrator.TaskFunc): void; /** Have you defined a task with this name? * @param name The task name to query @@ -96,7 +102,7 @@ declare namespace Orchestrator { /** A task, can either call a callback to indicate task completion or return a promise or a stream: (task is marked complete when promise.then() resolves/fails or stream ends) */ - type TaskMethod = (callback: (err?: any) => void) => Q.Promise | stream.Stream | any; + type TaskFunc = (callback: (err?: any) => void) => Q.Promise | stream.Stream | any; interface AddMethod { /** Define a task @@ -105,7 +111,7 @@ declare namespace Orchestrator { * - Take in a callback * - Return a stream or a promise */ - (name: string, fn?: TaskMethod): Orchestrator; + (name: string, fn?: TaskFunc): Orchestrator; /** Define a task * @param name The name of the task. * @param deps An array of task names to be executed and completed before your task will run. @@ -113,7 +119,7 @@ declare namespace Orchestrator { * - Take in a callback * - Return a stream or a promise */ - (name: string, deps?: string[], fn?: TaskMethod): Orchestrator; + (name: string, deps?: string[], fn?: TaskFunc): Orchestrator; } /** Start running the tasks @@ -149,7 +155,7 @@ declare namespace Orchestrator { } interface Task { - fn: TaskMethod; + fn: TaskFunc; dep: string[]; name: string; done?: boolean; diff --git a/types/orchestrator/orchestrator-tests.ts b/types/orchestrator/orchestrator-tests.ts index e25f12fb48..13e9bb19e0 100644 --- a/types/orchestrator/orchestrator-tests.ts +++ b/types/orchestrator/orchestrator-tests.ts @@ -43,6 +43,20 @@ orchestrator.add('thing4', function(){ return stm; }); +// +// orchestrator.task(name[, deps][, function]); +// + +orchestrator.task('task1'); + +orchestrator.task('task2', function(cb) { + cb(null); +}); + +orchestrator.task('task3', ['task1', 'task2'], function() { + // do stuff +}); + // // orchestrator.hasTask(name); // From a06e0abe58d11a2eaad6abd4ebfe7e31e47d9f80 Mon Sep 17 00:00:00 2001 From: fretje Date: Fri, 12 May 2017 22:13:47 +0200 Subject: [PATCH 0113/1072] 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 0114/1072] 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 0115/1072] 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 0116/1072] 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 e714be814c9c36657f287409a39a1b66db06d66d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20=5BDesktop=5D?= Date: Sat, 13 May 2017 12:54:34 +0200 Subject: [PATCH 0117/1072] Fix Request.range function return type --- types/express-serve-static-core/index.d.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/types/express-serve-static-core/index.d.ts b/types/express-serve-static-core/index.d.ts index a54481027d..8e1f075f03 100644 --- a/types/express-serve-static-core/index.d.ts +++ b/types/express-serve-static-core/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for Express 4.x // Project: http://expressjs.com -// Definitions by: Boris Yankov +// Definitions by: Boris Yankov , Michał Lytek // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // This extracts the core definitions from express to prevent a circular dependency between express and serve-static /// @@ -168,6 +168,10 @@ interface CookieOptions { sameSite?: boolean | string; } +interface ByteRange { start: number; end: number; } + +interface RequestRanges extends Array { type: string; } + interface Errback { (err: Error): void; } interface Request extends http.IncomingMessage, Express.Request { @@ -298,7 +302,7 @@ interface Request extends http.IncomingMessage, Express.Request { * * @param size */ - range(size: number): any[]; + range(size: number): RequestRanges|null|-1|-2; /** * Return an array of Accepted media types From d92a1e9b394fda0bda54422667b6404b154b6f5e Mon Sep 17 00:00:00 2001 From: Tom Wanzek Date: Sat, 13 May 2017 13:33:11 -0400 Subject: [PATCH 0118/1072] [d3-shape] * [Feature] Add stackOffsetDiverging(...) * [Chore] Update version numbers * [Chore] Fix typos in JSDoc comments. --- types/d3-shape/d3-shape-tests.ts | 1 + types/d3-shape/index.d.ts | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/types/d3-shape/d3-shape-tests.ts b/types/d3-shape/d3-shape-tests.ts index 3ac854df2b..7625230b9f 100644 --- a/types/d3-shape/d3-shape-tests.ts +++ b/types/d3-shape/d3-shape-tests.ts @@ -1181,6 +1181,7 @@ order = d3Shape.stackOrderReverse(seriesAnyAny); // Test stack offsets =============================================================== d3Shape.stackOffsetExpand(seriesAnyAny, order); +d3Shape.stackOffsetDiverging(seriesAnyAny, order); d3Shape.stackOffsetNone(seriesAnyAny, order); d3Shape.stackOffsetSilhouette(seriesAnyAny, order); d3Shape.stackOffsetWiggle(seriesAnyAny, order); diff --git a/types/d3-shape/index.d.ts b/types/d3-shape/index.d.ts index 517f84e501..9a69f64530 100644 --- a/types/d3-shape/index.d.ts +++ b/types/d3-shape/index.d.ts @@ -1,9 +1,9 @@ -// Type definitions for D3JS d3-shape module 1.0 +// Type definitions for D3JS d3-shape module 1.1 // Project: https://github.com/d3/d3-shape/ // Definitions by: Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// Last module patch version validated against: 1.0.4 +// Last module patch version validated against: 1.1.0 import { Path } from 'd3-path'; @@ -1872,7 +1872,7 @@ export const curveStepBefore: CurveFactory; * A Symbol Type. * * Symbol types are typically not used directly, instead being passed to symbol.type. - * However, you can define your own sumbol type implementation should none of the built-in types satisfy your needs using the following interface. + * However, you can define your own symbol type implementation should none of the built-in types satisfy your needs using the following interface. * You can also use this low-level interface with a built-in symbol type as an alternative to the symbol generator */ export interface SymbolType { @@ -2269,7 +2269,7 @@ export function stackOrderDescending(series: Series): number[]; /** * Returns a series order such that the larger series (according to the sum of values) are on the inside and the smaller series are on the outside. - * This order is recommended for streamgraphs in conjunction with the wiggle offset. See Stacked Graphs—Geometry & Aesthetics by Bryon & Wattenberg for more information. + * This order is recommended for streamgraphs in conjunction with the wiggle offset. See Stacked Graphs—Geometry & Aesthetics by Byron & Wattenberg for more information. * * @param series A series generated by a stack generator */ @@ -2297,6 +2297,14 @@ export function stackOrderReverse(series: Series): number[]; */ export function stackOffsetExpand(series: Series, order: number[]): void; +/** + * Positive values are stacked above zero, while negative values are stacked below zero. + * + * @param series A series generated by a stack generator + * @param order An array of numeric indexes representing the stack order. + */ +export function stackOffsetDiverging(series: Series, order: number[]): void; + /** * Applies a zero baseline. * From dd03dfb3c426dc5919126103eecf4583a41c80b5 Mon Sep 17 00:00:00 2001 From: Tom Wanzek Date: Sat, 13 May 2017 15:16:45 -0400 Subject: [PATCH 0119/1072] [d3-shape]: * [Feature] Add definition support for horizontal, vertical and radial link shape generator. --- types/d3-shape/index.d.ts | 357 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 357 insertions(+) diff --git a/types/d3-shape/index.d.ts b/types/d3-shape/index.d.ts index 9a69f64530..00d37fa4ae 100644 --- a/types/d3-shape/index.d.ts +++ b/types/d3-shape/index.d.ts @@ -1864,6 +1864,363 @@ export const curveStepAfter: CurveFactory; */ export const curveStepBefore: CurveFactory; +// ----------------------------------------------------------------------------------- +// LINKS +// ----------------------------------------------------------------------------------- + +/** + * An interface describing the default Link Data structure expected + * by the Link and RadialLink generators + */ +export interface DefaultLinkObject { + /** + * Source node of the link. + * + * For a link in a Cartesian coordinate system, the two element array contains + * the coordinates [x, y]. + * + * For a radial link, the two element array contains + * the coordinates [angle, radius]. The angle is stated in radians, with 0 at -y (12 o’clock). + * The radius measures the distance from the origin ⟨0,0⟩. + */ + source: [number, number]; + /** + * Target node of the link. + * + * For a link in a Cartesian coordinate system, the two element array contains + * the coordinates [x, y]. + * + * For a radial link, the two element array contains + * the coordinates [angle, radius]. The angle is stated in radians, with 0 at -y (12 o’clock). + * The radius measures the distance from the origin ⟨0,0⟩. + */ + target: [number, number]; +} + +/** + * A link generator for a Cartesian coordinate system. The link shape generates a smooth cubic Bézier curve from a + * source point to a target point. The tangents of the curve at the start and end are either vertical, horizontal. + * + * The first generic corresponds to the type of the "this" context within which the link generator and its accessor functions will be invoked. + * + * The second generic corresponds to the datum type of the link object for which the link is to be generated. + * + * The third generic corresponds to the datum type of the source/target node contained in the link object. + */ +export interface Link { + /** + * Generates a link for the given arguments. + * + * IMPORTANT: If the rendering context of the link generator is null, + * then the link is returned as a path data string. + * + * The "this" context within which this function is invoked, will be the context within which the accessor methods of the generator are invoked. + * All arguments passed into this function, will be passed to the accessor functions of the generator. + * + * @param d The datum for which the link is to be generated. + */ + (this: This, d: LinkDatum, ...args: any[]): string | null; + /** + * Generates an link for the given arguments. + * + * IMPORTANT: If the link generator has been configured with a rendering context, + * then the link is rendered to this context as a sequence of path method calls and this function returns void. + * + * The "this" context within which this function is invoked, will be the context within which the accessor methods of the generator are invoked. + * All arguments passed into this function, will be passed to the accessor functions of the generator. + * + * @param d The datum for which the link is to be generated. + */ + (this: This, d: LinkDatum, ...args: any[]): void; + + /** + * Returns the current source node accessor function. + * The default source accessor function returns a two element array [x, y]. + */ + source(): (this: This, d: LinkDatum, ...args: any[]) => NodeDatum; + /** + * Sets the source accessor to the specified function and returns this link generator. + * + * @param source Source node accessor function. The accessor function is invoked in the same "this" context as the generator was invoked in and + * receives the same arguments that were passed into the link generator. The default target accessor function returns a two element array [x, y]. + */ + source(source: (this: This, d: LinkDatum, ...args: any[]) => NodeDatum): this; + + /** + * Returns the current target node accessor function. + * The default target accessor function returns a two element array [x, y]. + */ + target(): (this: This, d: LinkDatum, ...args: any[]) => NodeDatum; + /** + * Sets the target accessor to the specified function and returns this link generator. + * + * @param target Target node accessor function. The accessor function is invoked in the same "this" context as the generator was invoked in and + * receives the same arguments that were passed into the link generator. The default target accessor function returns a two element array [x, y]. + */ + target(target: (this: This, d: LinkDatum, ...args: any[]) => NodeDatum): this; + + /** + * Returns the current x-accessor, which defaults to a function accepting an number array + * as its argument an returning the first element of the array. + */ + x(): (this: This, node: NodeDatum, ...args: any[]) => number; + /** + * Sets the x-accessor to the specified function and returns this link generator. + * + * @param x x-coordinate accessor function. The accessor function is invoked in the same "this" context as the generator was invoked in and + * receives as its first argument a node object followed by all additional arguments that were passed into the link generator. + */ + x(x: (this: This, node: NodeDatum, ...args: any[]) => number): this; + + /** + * Returns the current y-accessor, which defaults to a function accepting an number array + * as its argument an returning the second element of the array. + */ + y(): (this: This, node: NodeDatum, ...args: any[]) => number; + /** + * Sets the y-accessor to the specified function and returns this link generator. + * + * @param y y-coordinate accessor function. The accessor function is invoked in the same "this" context as the generator was invoked in and + * receives as its first argument a node object followed by all additional arguments that were passed into the link generator. + */ + y(y: (this: This, node: NodeDatum, ...args: any[]) => number): this; + + /** + * Returns the current rendering context, which defaults to null. + */ + context(): CanvasRenderingContext2D | null; + /** + * Sets the rendering context and returns this link generator. + * + * If the context is not null, then the generated link is rendered to this context as a sequence of path method calls. + * + * @param context The rendering context. + */ + context(context: CanvasRenderingContext2D): this; + /** + * Sets the rendering context to null and returns this link generator. + * + * A path data string representing the generated link will be returned when the generator is invoked with data. + * + * @param context null, to remove rendering context. + */ + context(context: null): this; +} + +/** + * Constructs a new default link generator with horizontal tangents, for example, to visualize links in a tree diagram + * rooted on the left edge of the display. + * + * With the default settings the link generator accepts a link object conforming to the DefaultLinkObject interface. + */ +export function linkHorizontal(): Link; +/** + * Constructs a new link generator with horizontal tangents, for example, to visualize links in a tree diagram + * rooted on the left edge of the display. + * + * Important: Ensure that the accessor functions are configured to work with the link and node datum types + * specified in the generics. + * + * The first generic corresponds to the datum type of the link object for which the link is to be generated. + * + * The second generic corresponds to the datum type of the source/target node contained in the link object + */ +export function linkHorizontal(): Link; +/** + * Constructs a new link generator with horizontal tangents, for example, to visualize links in a tree diagram + * rooted on the left edge of the display. + * + * Important: Ensure that the accessor functions are configured to work with the link and node datum types + * specified in the generics. + * + * The first generic corresponds to the type of the "this" context within which the link generator and its accessor functions will be invoked. + * + * The second generic corresponds to the datum type of the link object for which the link is to be generated. + * + * The third generic corresponds to the datum type of the source/target node contained in the link object + */ +export function linkHorizontal(): Link; + +/** + * Constructs a new default link generator with vertical tangents, for example, to visualize links in a tree diagram + * rooted on the top edge of the display. + * + * With the default settings the link generator accepts a link object conforming to the DefaultLinkObject interface. + */ +export function linkVertical(): Link; +/** + * Constructs a new link generator with vertical tangents, for example, to visualize links in a tree diagram + * rooted on the top edge of the display. + * + * Important: Ensure that the accessor functions are configured to work with the link and node datum types + * specified in the generics. + * + * The first generic corresponds to the datum type of the link object for which the link is to be generated. + * + * The second generic corresponds to the datum type of the source/target node contained in the link object + */ +export function linkVertical(): Link; +/** + * Constructs a new link generator with vertical tangents, for example, to visualize links in a tree diagram + * rooted on the top edge of the display. + * + * Important: Ensure that the accessor functions are configured to work with the link and node datum types + * specified in the generics. + * + * The first generic corresponds to the type of the "this" context within which the link generator and its accessor functions will be invoked. + * + * The second generic corresponds to the datum type of the link object for which the link is to be generated. + * + * The third generic corresponds to the datum type of the source/target node contained in the link object + */ +export function linkVertical(): Link; + +/** + * A link generator for a radial coordinate system. The link shape generates a smooth cubic Bézier curve from a + * source point to a target point. The tangents of the curve at the start and end are radial. + * + * The first generic corresponds to the type of the "this" context within which the radial link generator and its accessor functions will be invoked. + * + * The second generic corresponds to the datum type of the link object for which the link is to be generated. + * + * The third generic corresponds to the datum type of the source/target node contained in the link object. + */ +export interface RadialLink { + /** + * Generates a radial link for the given arguments. + * + * IMPORTANT: If the rendering context of the radial link generator is null, + * then the link is returned as a path data string. + * + * The "this" context within which this function is invoked, will be the context within which the accessor methods of the generator are invoked. + * All arguments passed into this function, will be passed to the accessor functions of the generator. + * + * @param d The datum for which the link is to be generated. + */ + (this: This, d: LinkDatum, ...args: any[]): string | null; + /** + * Generates an link for the given arguments. + * + * IMPORTANT: If the radial link generator has been configured with a rendering context, + * then the link is rendered to this context as a sequence of path method calls and this function returns void. + * + * The "this" context within which this function is invoked, will be the context within which the accessor methods of the generator are invoked. + * All arguments passed into this function, will be passed to the accessor functions of the generator. + * + * @param d The datum for which the link is to be generated. + */ + (this: This, d: LinkDatum, ...args: any[]): void; + + /** + * Returns the current source node accessor function. + * The default source accessor function returns a two element array [x, y]. + */ + source(): (this: This, d: LinkDatum, ...args: any[]) => NodeDatum; + /** + * Sets the source accessor to the specified function and returns this radial link generator. + * + * @param source Source node accessor function. The accessor function is invoked in the same "this" context as the generator was invoked in and + * receives the same arguments that were passed into the radial link generator. The default target accessor function returns a two element array [x, y]. + */ + source(source: (this: This, d: LinkDatum, ...args: any[]) => NodeDatum): this; + + /** + * Returns the current target node accessor function. + * The default target accessor function returns a two element array [x, y]. + */ + target(): (this: This, d: LinkDatum, ...args: any[]) => NodeDatum; + /** + * Sets the target accessor to the specified function and returns this radial link generator. + * + * @param target Target node accessor function. The accessor function is invoked in the same "this" context as the generator was invoked in and + * receives the same arguments that were passed into the radial link generator. The default target accessor function returns a two element array [x, y]. + */ + target(target: (this: This, d: LinkDatum, ...args: any[]) => NodeDatum): this; + + /** + * Returns the current angle accessor, which defaults to a function accepting an number array + * as its argument an returning the first element of the array. + */ + angle(): (this: This, node: NodeDatum, ...args: any[]) => number; + /** + * Sets the angle accessor to the specified function and returns this radial link generator. + * The angle is stated in radians, with 0 at -y (12 o’clock). + * + * @param angle Angle accessor function. The accessor function is invoked in the same "this" context as the generator was invoked in and + * receives as its first argument a node object followed by all additional arguments that were passed into the radial link generator. + */ + angle(angle: (this: This, node: NodeDatum, ...args: any[]) => number): this; + + /** + * Returns the current radius accessor, which defaults to a function accepting an number array + * as its argument an returning the second element of the array. + */ + radius(): (this: This, node: NodeDatum, ...args: any[]) => number; + /** + * Sets the radius accessor to the specified function and returns this radial link generator. + * The radius is measured as the distance from the origin ⟨0,0⟩. + * + * @param radius Radius accessor function. The accessor function is invoked in the same "this" context as the generator was invoked in and + * receives as its first argument a node object followed by all additional arguments that were passed into the radial link generator. + */ + radius(radius: (this: This, node: NodeDatum, ...args: any[]) => number): this; + + /** + * Returns the current rendering context, which defaults to null. + */ + context(): CanvasRenderingContext2D | null; + /** + * Sets the rendering context and returns this radial link generator. + * + * If the context is not null, then the generated radial area is rendered to this context as a sequence of path method calls. + * + * @param context The rendering context. + */ + context(context: CanvasRenderingContext2D): this; + /** + * Sets the rendering context to null and returns this radial link generator. + * + * A path data string representing the generated radial link will be returned when the generator is invoked with data. + * + * @param context null, to remove rendering context. + */ + context(context: null): this; +} + +/** + * Constructs a new default link generator with radial tangents, for example, to visualize links in a tree diagram + * rooted in the center of the display. + * + * With the default settings the link generator accepts a link object conforming to the DefaultLinkObject interface. + */ +export function linkRadial(): RadialLink; +/** + * Constructs a new link generator with radial tangents, for example, to visualize links in a tree diagram + * rooted in the center of the display. + * + * Important: Ensure that the accessor functions are configured to work with the link and node datum types + * specified in the generics. + * + * The first generic corresponds to the datum type of the link object for which the link is to be generated. + * + * The second generic corresponds to the datum type of the source/target node contained in the link object + */ +export function linkRadial(): RadialLink; +/** + * Constructs a new link generator with radial tangents, for example, to visualize links in a tree diagram + * rooted in the center of the display. + * + * Important: Ensure that the accessor functions are configured to work with the link and node datum types + * specified in the generics. + * + * The first generic corresponds to the type of the "this" context within which the link generator and its accessor functions will be invoked. + * + * The second generic corresponds to the datum type of the link object for which the link is to be generated. + * + * The third generic corresponds to the datum type of the source/target node contained in the link object + */ +export function linkRadial(): RadialLink; + // ----------------------------------------------------------------------------------- // SYMBOLS // ----------------------------------------------------------------------------------- From 0bafa64757fbbc3850eb9e73a61b88fdbf8c6931 Mon Sep 17 00:00:00 2001 From: Tom Wanzek Date: Sat, 13 May 2017 17:25:11 -0400 Subject: [PATCH 0120/1072] [d3-shape] Add Link/RadialLink tests --- types/d3-shape/d3-shape-tests.ts | 251 ++++++++++++++++++++++++++++++- 1 file changed, 248 insertions(+), 3 deletions(-) diff --git a/types/d3-shape/d3-shape-tests.ts b/types/d3-shape/d3-shape-tests.ts index 7625230b9f..5d3b9fa5a1 100644 --- a/types/d3-shape/d3-shape-tests.ts +++ b/types/d3-shape/d3-shape-tests.ts @@ -7,8 +7,9 @@ */ import * as d3Shape from 'd3-shape'; -import { select, Selection } from 'd3-selection'; +import { select, Selection } from 'd3-selection'; import { path } from 'd3-path'; +import { HierarchyPointLink, HierarchyPointNode } from 'd3-hierarchy'; // ----------------------------------------------------------------------------------- // Preparatory Steps (General) @@ -900,6 +901,250 @@ curveFactory = d3Shape.curveStepAfter; curveFactory = d3Shape.curveStepBefore; +// ----------------------------------------------------------------------------------- +// Test Link/RadialLink Generators +// ----------------------------------------------------------------------------------- + +// Preparatory steps ================================================================= + +interface TreeNodeDatum { + whatever: any; +} + +declare const linkDatum: HierarchyPointLink; + +declare const defaultLinkDatum: d3Shape.DefaultLinkObject; + +const pLink: Selection, any, any> = + select>('.link-paths'); // mock +const wrongLink1: Selection, any, any> = + select>('.link-paths'); // mock +const wrongLink2: Selection = + select('.link-paths'); // mock + +// Test DefaultLinkObject Interface ================================================== + +let coordinates: [number, number]; + +coordinates = defaultLinkDatum.source; +coordinates = defaultLinkDatum.target; + +// Test generator factories ========================================================== + +let defaultLink: d3Shape.Link; + +defaultLink = d3Shape.linkHorizontal(); +defaultLink = d3Shape.linkVertical(); + +let link: d3Shape.Link, HierarchyPointNode>; + +link = d3Shape.linkHorizontal, HierarchyPointNode>(); +link = d3Shape.linkVertical, HierarchyPointNode>(); + +let svgLink: d3Shape.Link, HierarchyPointNode>; + +svgLink = d3Shape.linkHorizontal, HierarchyPointNode>(); +svgLink = d3Shape.linkVertical, HierarchyPointNode>(); + +let defaultRadialLink: d3Shape.RadialLink; + +defaultRadialLink = d3Shape.linkRadial(); + +let radialLink: d3Shape.RadialLink, HierarchyPointNode>; + +radialLink = d3Shape.linkRadial, HierarchyPointNode>(); + +let svgRadialLink: d3Shape.RadialLink, HierarchyPointNode>; + +svgRadialLink = d3Shape.linkRadial, HierarchyPointNode>(); + +// Configure link generators ======================================================== + +let defaultNodeAccessor: (d: d3Shape.DefaultLinkObject, ...args: any[]) => [number, number]; +let svgTreeNodeAccessor: (this: SVGPathElement, d: HierarchyPointLink, ...args: any[]) => HierarchyPointNode; + +let defaultCoordinateAccessor: (d: [number, number], ...args: any[]) => number; +let svgCoordinateAccessor: (this: SVGPathElement, d: HierarchyPointNode, ...args: any[]) => number; + +// source(...) ----------------------------------------------------------------------- + +// vertical/horizontal + +defaultLink = defaultLink.source(d => { + const datum: d3Shape.DefaultLinkObject = d; + return d.source; +}); + +defaultNodeAccessor = defaultLink.source(); + +svgLink = svgLink.source(function (d) { + const that: SVGPathElement = this; + const datum: HierarchyPointLink = d; + return d.source; +}); + +svgTreeNodeAccessor = svgLink.source(); + +// radial + +defaultRadialLink = defaultRadialLink.source(d => { + const datum: d3Shape.DefaultLinkObject = d; + return d.source; +}); + +defaultNodeAccessor = defaultRadialLink.source(); + +svgRadialLink = svgRadialLink.source(function (d) { + const that: SVGPathElement = this; + const datum: HierarchyPointLink = d; + return d.source; +}); + +svgTreeNodeAccessor = svgRadialLink.source(); + +// target(...) ----------------------------------------------------------------------- + +// vertical/horizontal + +defaultLink = defaultLink.target(d => { + const datum: d3Shape.DefaultLinkObject = d; + return d.target; +}); + +defaultNodeAccessor = defaultLink.target(); + +svgLink = svgLink.target(function (d) { + const that: SVGPathElement = this; + const datum: HierarchyPointLink = d; + return d.target; +}); + +svgTreeNodeAccessor = svgLink.target(); + +// radial + +defaultRadialLink = defaultRadialLink.target(d => { + const datum: d3Shape.DefaultLinkObject = d; + return d.target; +}); + +defaultNodeAccessor = defaultRadialLink.target(); + +svgRadialLink = svgRadialLink.target(function (d) { + const that: SVGPathElement = this; + const datum: HierarchyPointLink = d; + return d.target; +}); + +svgTreeNodeAccessor = svgRadialLink.target(); + +// x(...) ---------------------------------------------------------------------------- + +defaultLink = defaultLink.x(d => { + const datum: [number, number] = d; + return datum[0]; +}); + +defaultCoordinateAccessor = defaultLink.x(); + +svgLink = svgLink.x(function (d) { + const that: SVGPathElement = this; + const datum: HierarchyPointNode = d; + return datum.x; +}); + +svgCoordinateAccessor = svgLink.x(); + +// y(...) ---------------------------------------------------------------------------- + +defaultLink = defaultLink.y(d => { + const datum: [number, number] = d; + return datum[1]; +}); + +defaultCoordinateAccessor = defaultLink.y(); + +svgLink = svgLink.y(function (d) { + const that: SVGPathElement = this; + const datum: HierarchyPointNode = d; + return datum.y; +}); + +svgCoordinateAccessor = svgLink.y(); + +// angle(...) ------------------------------------------------------------------------ + +defaultRadialLink = defaultRadialLink.angle(d => { + const datum: [number, number] = d; + return datum[0]; +}); + +defaultCoordinateAccessor = defaultRadialLink.angle(); + +svgRadialLink = svgRadialLink.angle(function (d) { + const that: SVGPathElement = this; + const datum: HierarchyPointNode = d; + return datum.x; +}); + +svgCoordinateAccessor = svgRadialLink.angle(); + +// radius(...) ------------------------------------------------------------------------ + +defaultRadialLink = defaultRadialLink.radius(d => { + const datum: [number, number] = d; + return datum[1]; +}); + +defaultCoordinateAccessor = defaultRadialLink.radius(); + +svgRadialLink = svgRadialLink.radius(function (d) { + const that: SVGPathElement = this; + const datum: HierarchyPointNode = d; + return datum.y; +}); + +svgCoordinateAccessor = svgRadialLink.radius(); + +// context(...) ---------------------------------------------------------------------- + +if (context !== null) { + defaultArea = defaultArea.context(context); // draw to canvas +} +context = defaultArea.context(); + +area = area.context(null); // use as path string generator for SVG + +// Use link generators =============================================================== + +// Render to canvas ------------------------------------------------------------------ + +defaultLink(defaultLinkDatum); + +defaultRadialLink(defaultLinkDatum); + +// Render to svg --------------------------------------------------------------------- + +// vertical/horizontal + +pLink.attr('d', svgLink); +// wrongLink1.attr('d', svgLink); // fails, incompatible this contexts +// wrongLink2.attr('d', svgLink); // fails, incompatible datum types + +pathStringMaybe = link(linkDatum); + +// pathStringMaybe = svgLink(linkDatum); // fails, wrong this type for invocation + +// radial + +pLink.attr('d', svgRadialLink); +// wrongLink1.attr('d', svgRadialLink); // fails, incompatible this contexts +// wrongLink2.attr('d', svgRadialLink); // fails, incompatible datum types + +pathStringMaybe = radialLink(linkDatum); + +// pathStringMaybe = svgRadialLink(linkDatum); // fails, wrong this type for invocation + // ----------------------------------------------------------------------------------- // Test Symbols // ----------------------------------------------------------------------------------- @@ -1011,10 +1256,10 @@ class Symbolizer { break; } this.symbol = d3Shape.symbol() - .size(function(this: Symbolizer, d?: SymbolDatum) { + .size(function (this: Symbolizer, d?: SymbolDatum) { return d ? d.size : this.size; }) - .type(function(this: Symbolizer, d?: SymbolDatum) { + .type(function (this: Symbolizer, d?: SymbolDatum) { let type = this.type; if (d && d.type) { switch (d.type) { From 94d91dd4cf3244b8a8405610236039feb63202c5 Mon Sep 17 00:00:00 2001 From: Tom Wanzek Date: Sat, 13 May 2017 17:35:18 -0400 Subject: [PATCH 0121/1072] [d3-shape] Linting * [Fix] Added `"callable-types": false` to `tslint.json` as the two line-level disablers in `index.d.ts` seemed to be ignored. * [Chore] Fixed some linting errors in text file --- types/d3-shape/d3-shape-tests.ts | 20 ++++++++++---------- types/d3-shape/tslint.json | 3 ++- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/types/d3-shape/d3-shape-tests.ts b/types/d3-shape/d3-shape-tests.ts index 5d3b9fa5a1..5b322772b6 100644 --- a/types/d3-shape/d3-shape-tests.ts +++ b/types/d3-shape/d3-shape-tests.ts @@ -977,7 +977,7 @@ defaultLink = defaultLink.source(d => { defaultNodeAccessor = defaultLink.source(); -svgLink = svgLink.source(function (d) { +svgLink = svgLink.source(function(d) { const that: SVGPathElement = this; const datum: HierarchyPointLink = d; return d.source; @@ -994,7 +994,7 @@ defaultRadialLink = defaultRadialLink.source(d => { defaultNodeAccessor = defaultRadialLink.source(); -svgRadialLink = svgRadialLink.source(function (d) { +svgRadialLink = svgRadialLink.source(function(d) { const that: SVGPathElement = this; const datum: HierarchyPointLink = d; return d.source; @@ -1013,7 +1013,7 @@ defaultLink = defaultLink.target(d => { defaultNodeAccessor = defaultLink.target(); -svgLink = svgLink.target(function (d) { +svgLink = svgLink.target(function(d) { const that: SVGPathElement = this; const datum: HierarchyPointLink = d; return d.target; @@ -1030,7 +1030,7 @@ defaultRadialLink = defaultRadialLink.target(d => { defaultNodeAccessor = defaultRadialLink.target(); -svgRadialLink = svgRadialLink.target(function (d) { +svgRadialLink = svgRadialLink.target(function(d) { const that: SVGPathElement = this; const datum: HierarchyPointLink = d; return d.target; @@ -1047,7 +1047,7 @@ defaultLink = defaultLink.x(d => { defaultCoordinateAccessor = defaultLink.x(); -svgLink = svgLink.x(function (d) { +svgLink = svgLink.x(function(d) { const that: SVGPathElement = this; const datum: HierarchyPointNode = d; return datum.x; @@ -1064,7 +1064,7 @@ defaultLink = defaultLink.y(d => { defaultCoordinateAccessor = defaultLink.y(); -svgLink = svgLink.y(function (d) { +svgLink = svgLink.y(function(d) { const that: SVGPathElement = this; const datum: HierarchyPointNode = d; return datum.y; @@ -1081,7 +1081,7 @@ defaultRadialLink = defaultRadialLink.angle(d => { defaultCoordinateAccessor = defaultRadialLink.angle(); -svgRadialLink = svgRadialLink.angle(function (d) { +svgRadialLink = svgRadialLink.angle(function(d) { const that: SVGPathElement = this; const datum: HierarchyPointNode = d; return datum.x; @@ -1098,7 +1098,7 @@ defaultRadialLink = defaultRadialLink.radius(d => { defaultCoordinateAccessor = defaultRadialLink.radius(); -svgRadialLink = svgRadialLink.radius(function (d) { +svgRadialLink = svgRadialLink.radius(function(d) { const that: SVGPathElement = this; const datum: HierarchyPointNode = d; return datum.y; @@ -1256,10 +1256,10 @@ class Symbolizer { break; } this.symbol = d3Shape.symbol() - .size(function (this: Symbolizer, d?: SymbolDatum) { + .size(function(this: Symbolizer, d?: SymbolDatum) { return d ? d.size : this.size; }) - .type(function (this: Symbolizer, d?: SymbolDatum) { + .type(function(this: Symbolizer, d?: SymbolDatum) { let type = this.type; if (d && d.type) { switch (d.type) { diff --git a/types/d3-shape/tslint.json b/types/d3-shape/tslint.json index 08b1465cd6..604d5950cf 100644 --- a/types/d3-shape/tslint.json +++ b/types/d3-shape/tslint.json @@ -1,6 +1,7 @@ { "extends": "dtslint/dt.json", "rules": { - "unified-signatures": false + "unified-signatures": false, + "callable-types": false } } From 5ea24bf9e13bb6157475ec2e374c27f172b52602 Mon Sep 17 00:00:00 2001 From: Roberto Desideri Date: Sun, 14 May 2017 08:10:21 +0200 Subject: [PATCH 0122/1072] [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 a0d4ebcb7472ecb25e9e0d87dd717f4be7e08475 Mon Sep 17 00:00:00 2001 From: Ali Taheri Moghaddar Date: Sun, 14 May 2017 13:42:16 +0430 Subject: [PATCH 0123/1072] Improve typings for react-file-reader-input --- types/react-file-reader-input/index.d.ts | 54 ++++++++++++++----- .../react-file-reader-input-tests.tsx | 8 +-- types/react-file-reader-input/tslint.json | 1 + 3 files changed, 46 insertions(+), 17 deletions(-) create mode 100644 types/react-file-reader-input/tslint.json diff --git a/types/react-file-reader-input/index.d.ts b/types/react-file-reader-input/index.d.ts index 37f9357f5c..fc172a425d 100644 --- a/types/react-file-reader-input/index.d.ts +++ b/types/react-file-reader-input/index.d.ts @@ -1,19 +1,47 @@ -// Type definitions for react-file-reader-input +// Type definitions for react-file-reader-input 1.1 // Project: https://www.npmjs.com/package/react-file-reader-input -// Definitions by: Dmitry Rogozhny +// Definitions by: Dmitry Rogozhny , Ali Taheri // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 -/// +import * as React from 'react'; -declare module "react-file-reader-input" { - interface FileInputProps { - as?: string; - onChange?: (event: React.SyntheticEvent, results: any) => void; - } - - class FileInput extends React.Component { - } - - export = FileInput; +declare class FileInput extends React.Component { } + +declare namespace FileInput { + type Format = 'buffer' | 'binary' | 'url' | 'text'; + type Result = [ProgressEvent, File]; + + interface Props { + /** + * what format the `FileReader` should read the file as + * (i.e., `'buffer'`, `'binary'`, `'url'`, `'text'`). + * + * Defaults to `'url'`. + */ + as?: Format; + + /** + * Callback function called when the files are choosen by the user. + * + * Results will be an array of arrays, the size of which depending + * on how many files were selected. + * + * Each result will be an array of two items: + * + * `progressEvent`: `result[0]` is a `ProgressEvent` object. + * You can retrieve the raw results at `progressEvent.target.result` + * among other things. + * + * `file`: `result[1]` is a `File` object. You can retrieve the file name + * at file.name among other things. + * + * @param event The event that triggered file changes + * @param results The array of files + */ + onChange: (event: React.SyntheticEvent, results: Result[]) => void; + } +} + +export = FileInput; diff --git a/types/react-file-reader-input/react-file-reader-input-tests.tsx b/types/react-file-reader-input/react-file-reader-input-tests.tsx index 0b21edfd71..1ee4f2f699 100644 --- a/types/react-file-reader-input/react-file-reader-input-tests.tsx +++ b/types/react-file-reader-input/react-file-reader-input-tests.tsx @@ -1,9 +1,9 @@ -import * as React from "react"; -import FileReaderInput = require("react-file-reader-input"); +import * as React from 'react'; +import * as FileReaderInput from 'react-file-reader-input'; class MyComponent extends React.Component<{}, {}> { - handleChange = (event: React.SyntheticEvent, results: any) => { - results.forEach((result: any) => { + handleChange = (event: React.SyntheticEvent, results: FileReaderInput.Result[]) => { + results.forEach(result => { const [event, file] = result; console.log(`Selected file ${file.name}!`); }); diff --git a/types/react-file-reader-input/tslint.json b/types/react-file-reader-input/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-file-reader-input/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 38c47c7e190d4bbd06992ee2d56f5348452b4e7a Mon Sep 17 00:00:00 2001 From: Ali Taheri Moghaddar Date: Sun, 14 May 2017 14:37:39 +0430 Subject: [PATCH 0124/1072] Fix lint errors --- types/react-file-reader-input/index.d.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/types/react-file-reader-input/index.d.ts b/types/react-file-reader-input/index.d.ts index fc172a425d..3caed3dc67 100644 --- a/types/react-file-reader-input/index.d.ts +++ b/types/react-file-reader-input/index.d.ts @@ -17,30 +17,30 @@ declare namespace FileInput { /** * what format the `FileReader` should read the file as * (i.e., `'buffer'`, `'binary'`, `'url'`, `'text'`). - * + * * Defaults to `'url'`. */ as?: Format; /** * Callback function called when the files are choosen by the user. - * + * * Results will be an array of arrays, the size of which depending * on how many files were selected. - * + * * Each result will be an array of two items: - * + * * `progressEvent`: `result[0]` is a `ProgressEvent` object. * You can retrieve the raw results at `progressEvent.target.result` * among other things. - * + * * `file`: `result[1]` is a `File` object. You can retrieve the file name * at file.name among other things. - * + * * @param event The event that triggered file changes * @param results The array of files */ - onChange: (event: React.SyntheticEvent, results: Result[]) => void; + onChange(event: React.SyntheticEvent, results: Result[]): void; } } From afa576a536152531eba4565e67d21f319418fdb0 Mon Sep 17 00:00:00 2001 From: Juan Jimenez-Anca Date: Sun, 14 May 2017 14:18:08 +0200 Subject: [PATCH 0125/1072] added type definitions for node-feedparser --- node-feedparser/index.d.ts | 166 +++++++++++++++++++++++ node-feedparser/node-feedparser-tests.ts | 32 +++++ node-feedparser/tsconfig.json | 22 +++ node-feedparser/tslint.json | 5 + 4 files changed, 225 insertions(+) create mode 100644 node-feedparser/index.d.ts create mode 100644 node-feedparser/node-feedparser-tests.ts create mode 100644 node-feedparser/tsconfig.json create mode 100644 node-feedparser/tslint.json diff --git a/node-feedparser/index.d.ts b/node-feedparser/index.d.ts new file mode 100644 index 0000000000..bed830265c --- /dev/null +++ b/node-feedparser/index.d.ts @@ -0,0 +1,166 @@ +// Type definitions for feedparser 2.2 +// Project: http://github.com/danmactough/node-feedparser +// Definitions by: Juan J. Jimenez-Anca +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +/** Declaration file generated by dts-gen */ + +/// + +import stream = require('stream'); +import { SAXStream } from 'sax'; +export = FeedParser; + +declare class FeedParser extends stream.Duplex { + constructor(options: FeedParser.Options); + options: FeedParser.Options; + stream: SAXStream; + meta: object; + _emitted_meta: boolean; + stack: any[]; + xmlbase: any[]; + in_xhtml: boolean; + xhtml: object; + errors: Error[]; + + addListener(ev: any, fn: any): any; + + cork(): void; + + eventNames(): any; + + getMaxListeners(): any; + + handleAttributes(attrs: FeedParser.Attrs, el: string): any; + + handleCloseTag(el: string): void; + + handleEnd(): any; + + handleError(e: Error): void; + + handleItem(node: FeedParser.Node, type: FeedParser.Type, options: FeedParser.Options): FeedParser.Item; + + handleMeta(node: FeedParser.Node, type: FeedParser.Type, options: FeedParser.Options): FeedParser.Meta; + + handleOpenTag(node: FeedParser.Node): void; + + handleProcessingInstruction(node: FeedParser.Node): void; + + handleSaxError(e: Error): void; + + handleText(text: string): void; + + init(): void; + + isPaused(): any; + + listenerCount(type: FeedParser.Type): any; + + listeners(type: FeedParser.Type): any; + + on(ev: any, fn: any): any; + + pause(): any; + + pipe(dest: any, pipeOpts: any): any; + + push(chunk: any, encoding: any): any; + + read(n?: number): FeedParser.Item; + + removeAllListeners(type: FeedParser.Type, ...args: any[]): any; + + resume(): any; + + resumeSaxError(): void; + + setDefaultEncoding(encoding: any): any; + + setEncoding(enc: any): any; + + setMaxListeners(n: any): any; + + uncork(): void; + + unpipe(dest: any): any; + + unshift(chunk: any): any; + + wrap(stream: SAXStream, ...args: any[]): any; + + private _transform(data: any, encoding: string, done: Function): void; + private _flush(done: Function): void; + +} + +declare namespace FeedParser { + type Type = "atom" | "rss" | "rdf"; + + interface Options { + normalize?: boolean; + addmeta?: boolean; + feedurl?: string; + resume_saxerror?: boolean; + MAX_BUFFER_LENGTH?: number; + } + + + interface Node { + [key: string]: any; + } + + interface Attrs { + name: string; + value: any; + prefix: string; + local: string; + uri: string; + } + + interface NS { + [key: string]: string; + } + + interface Image { + url: string; + title: string; + } + + interface Meta { + "#ns": NS[]; + "#type": Type; + "#version": string; + title: string; + description: string; + date: Date | null; + pubdate: Date | null; + link: string; + xmlurl: string; + author: string; + language: string; + image: Image; + favicon: string; + copyright: string; + generator: string; + categories: string[]; + } + + interface Item { + title: string; + description: string; + summary: string; + date: Date | null; + pubdate: Date | null; + link: string; + origlink: string; + author: string; + guid: string; + comments: string; + image: Image; + categories: string[]; + enclosures: string[]; + meta: Meta; + } + +} + diff --git a/node-feedparser/node-feedparser-tests.ts b/node-feedparser/node-feedparser-tests.ts new file mode 100644 index 0000000000..25d652de8c --- /dev/null +++ b/node-feedparser/node-feedparser-tests.ts @@ -0,0 +1,32 @@ +import request = require('request'); +import * as FeedParser from "feedparser"; + +const req = request('https://news.google.com/news?cf=all&hl=en&pz=1&ned=us&output=rss'); +const feedparser = new FeedParser({}); + +req.on("error", error => { + // handle any request errors +}); + +req.on("response", res => { + if (res.statusCode !== 200) { + req.emit('error', new Error('Bad status code')); + } else { + req.pipe(feedparser); + } +}); + +feedparser.on('error', (error: Error) => { + // always handle errors +}); + +feedparser.on('readable', () => { + // This is where the action is! + const stream = feedparser; + const meta = feedparser.meta; // **NOTE** the "meta" is always available in the context of the feedparser instance + let item: FeedParser.Item; + + while (item = stream.read()) { + console.log(item); + } +}); diff --git a/node-feedparser/tsconfig.json b/node-feedparser/tsconfig.json new file mode 100644 index 0000000000..31cb0cd3b7 --- /dev/null +++ b/node-feedparser/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "node-feedparser-tests.ts" + ] +} diff --git a/node-feedparser/tslint.json b/node-feedparser/tslint.json new file mode 100644 index 0000000000..5d0b359e47 --- /dev/null +++ b/node-feedparser/tslint.json @@ -0,0 +1,5 @@ +{ "extends": "dtslint/dt.json", + "rules": { + "no-conditional-assignment": false + } +} From 43fd13d225bf4e97d5d2d38fdb893cf3b8d5441a Mon Sep 17 00:00:00 2001 From: Vinicius Fortuna Date: Sun, 14 May 2017 17:41:23 -0400 Subject: [PATCH 0126/1072] Make CORS a variable again This fixes the 'Property 'CORS' does not exist' problem. --- types/restify/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/restify/index.d.ts b/types/restify/index.d.ts index bb0db64140..5a6b692570 100644 --- a/types/restify/index.d.ts +++ b/types/restify/index.d.ts @@ -595,7 +595,7 @@ export function auditLogger(options: { log: any }): (req: Request, res: Response export function fullResponse(): RequestHandler; // tslint:disable-next-line no-var export var defaultResponseHeaders: any; -export interface CORS { +export const CORS: { (cors?: { origins?: string[]; credentials?: boolean; @@ -604,7 +604,7 @@ export interface CORS { origins: string[]; ALLOW_HEADERS: string[]; credentials: boolean; -} +}; export const pre: { pause(): RequestHandler; From c3110c9321f07b02de8dc41fb9ffea1a1f230ad1 Mon Sep 17 00:00:00 2001 From: kao Date: Sun, 14 May 2017 23:55:06 +0200 Subject: [PATCH 0127/1072] updated types to version 9.7 and moved comments to the types --- .../react-virtualized/dist/es/AutoSizer.d.ts | 22 +- .../dist/es/CellMeasurer.d.ts | 10 +- .../react-virtualized/dist/es/Collection.d.ts | 49 +- .../dist/es/ColumnSizer.d.ts | 31 +- types/react-virtualized/dist/es/Grid.d.ts | 332 ++-- .../dist/es/InfiniteLoader.d.ts | 67 +- types/react-virtualized/dist/es/List.d.ts | 107 +- .../react-virtualized/dist/es/ScrollSync.d.ts | 10 +- types/react-virtualized/dist/es/Table.d.ts | 355 ++-- .../dist/es/WindowScroller.d.ts | 19 +- types/react-virtualized/index.d.ts | 2 + .../react-virtualized-tests.tsx | 1749 +++++++++++++++++ 12 files changed, 2220 insertions(+), 533 deletions(-) diff --git a/types/react-virtualized/dist/es/AutoSizer.d.ts b/types/react-virtualized/dist/es/AutoSizer.d.ts index ea72c43c1e..1da48c8120 100644 --- a/types/react-virtualized/dist/es/AutoSizer.d.ts +++ b/types/react-virtualized/dist/es/AutoSizer.d.ts @@ -6,9 +6,19 @@ export type Dimensions = { } export type AutoSizerProps = { + /** Disable dynamic :height property */ disableHeight?: boolean; + /** Disable dynamic :width property */ disableWidth?: boolean; + /** Nonce of the inlined stylesheet for Content Security Policy */ + nonce?: string; + /** Callback to be invoked on-resize: ({ height, width }) */ onResize?: (info: { height: number, width: number }) => any; + /** + * Function responsible for rendering children. + * This function should implement the following signature: + * ({ height, width }) => PropTypes.element + */ children?: (props: Dimensions) => React.ReactNode }; /** @@ -18,20 +28,10 @@ export type AutoSizerProps = { */ export class AutoSizer extends PureComponent { static propTypes: { - /** - * Function responsible for rendering children. - * This function should implement the following signature: - * ({ height, width }) => PropTypes.element - */ children: Validator<(props: Dimensions) => React.ReactNode>, - - /** Disable dynamic :height property */ disableHeight: Requireable, - - /** Disable dynamic :width property */ disableWidth: Requireable, - - /** Callback to be invoked on-resize: ({ height, width }) */ + nonce: Validator, onResize: Validator<(props: Dimensions) => any> }; diff --git a/types/react-virtualized/dist/es/CellMeasurer.d.ts b/types/react-virtualized/dist/es/CellMeasurer.d.ts index 5e1e0db3fb..1f7d2de8b3 100644 --- a/types/react-virtualized/dist/es/CellMeasurer.d.ts +++ b/types/react-virtualized/dist/es/CellMeasurer.d.ts @@ -45,17 +45,9 @@ export class CellMeasurerCache { ): void; } -export type CellMeasurerChildProps = { - getColumnWidth: () => number, - getRowHeight: () => number, - resetMeasurements: () => any, - resetMeasurementsForColumn: (index: number) => any, - resetMeasurementsForRow: (index: number) => any, -} - export type CellMeasurerProps = { cache?: CellMeasurerCache; - children?: (props: CellMeasurerChildProps) => React.ReactNode; + children?: ((props: {measure: () => void}) => React.ReactNode) | JSX.Element; columnIndex?: number; index?: number; parent?: React.ReactType; diff --git a/types/react-virtualized/dist/es/Collection.d.ts b/types/react-virtualized/dist/es/Collection.d.ts index 404d329222..9f37eea8f6 100644 --- a/types/react-virtualized/dist/es/Collection.d.ts +++ b/types/react-virtualized/dist/es/Collection.d.ts @@ -23,10 +23,32 @@ export type CollectionCellRendererParams = { export type CollectionCellRenderer = (params: CollectionCellRendererParams) => React.ReactNode; export type CollectionProps = { 'aria-label'?: string; + /** + * Number of cells in Collection. + */ cellCount: number; + /** + * Responsible for rendering a group of cells given their indices. + * Should implement the following interface: ({ + * cellSizeAndPositionGetter:Function, + * indices: Array, + * cellRenderer: Function + * }): Array + */ cellGroupRenderer?: CollectionCellGroupRenderer, + /** + * Responsible for rendering a cell given an row and column index. + * Should implement the following interface: ({ index: number, key: string, style: object }): PropTypes.element + */ cellRenderer: CollectionCellRenderer, + /** + * Callback responsible for returning size and offset/position information for a given cell (index). + * ({ index: number }): { height: number, width: number, x: number, y: number } + */ cellSizeAndPositionGetter: CollectionCellSizeAndPositionGetter, + /** + * Optionally override the size of the sections a Collection's cells are split into. + */ sectionSize?: number; className?: string; height: number; @@ -44,37 +66,10 @@ export type CollectionProps = { export class Collection extends PureComponent { static propTypes: { 'aria-label': Requireable, - - /** - * Number of cells in Collection. - */ cellCount: Validator, - - /** - * Responsible for rendering a group of cells given their indices. - * Should implement the following interface: ({ - * cellSizeAndPositionGetter:Function, - * indices: Array, - * cellRenderer: Function - * }): Array - */ cellGroupRenderer: Validator, - - /** - * Responsible for rendering a cell given an row and column index. - * Should implement the following interface: ({ index: number, key: string, style: object }): PropTypes.element - */ cellRenderer: Validator, - - /** - * Callback responsible for returning size and offset/position information for a given cell (index). - * ({ index: number }): { height: number, width: number, x: number, y: number } - */ cellSizeAndPositionGetter: Validator, - - /** - * Optionally override the size of the sections a Collection's cells are split into. - */ sectionSize: Requireable }; diff --git a/types/react-virtualized/dist/es/ColumnSizer.d.ts b/types/react-virtualized/dist/es/ColumnSizer.d.ts index 6efcf8c044..fa6788ca02 100644 --- a/types/react-virtualized/dist/es/ColumnSizer.d.ts +++ b/types/react-virtualized/dist/es/ColumnSizer.d.ts @@ -2,15 +2,29 @@ import { PureComponent, Validator, Requireable } from 'react' export type SizedColumnProps = { adjustedWidth: number, + columnWidth: number, getColumnWidth: () => number, registerChild: any } export type ColumnSizerProps = { + /** + * Function responsible for rendering a virtualized Grid. + * This function should implement the following signature: + * ({ adjustedWidth, getColumnWidth, registerChild }) => PropTypes.element + * + * The specified :getColumnWidth function should be passed to the Grid's :columnWidth property. + * The :registerChild should be passed to the Grid's :ref property. + * The :adjustedWidth property is optional; it reflects the lesser of the overall width or the width of all columns. + */ children?: (props: SizedColumnProps) => React.ReactNode; + /** Optional maximum allowed column width */ columnMaxWidth?: number; + /** Optional minimum allowed column width */ columnMinWidth?: number; + /** Number of columns in Grid or Table child */ columnCount?: number; + /** Width of Grid or Table child */ width: number; } /** @@ -18,27 +32,10 @@ export type ColumnSizerProps = { */ export class ColumnSizer extends PureComponent { static propTypes: { - /** - * Function responsible for rendering a virtualized Grid. - * This function should implement the following signature: - * ({ adjustedWidth, getColumnWidth, registerChild }) => PropTypes.element - * - * The specified :getColumnWidth function should be passed to the Grid's :columnWidth property. - * The :registerChild should be passed to the Grid's :ref property. - * The :adjustedWidth property is optional; it reflects the lesser of the overall width or the width of all columns. - */ children: Validator<(props: SizedColumnProps) => React.ReactNode>, - - /** Optional maximum allowed column width */ columnMaxWidth: Requireable, - - /** Optional minimum allowed column width */ columnMinWidth: Requireable, - - /** Number of columns in Grid or Table child */ columnCount: Validator, - - /** Width of Grid or Table child */ width: Validator }; diff --git a/types/react-virtualized/dist/es/Grid.d.ts b/types/react-virtualized/dist/es/Grid.d.ts index c0856f1de7..d8280de004 100644 --- a/types/react-virtualized/dist/es/Grid.d.ts +++ b/types/react-virtualized/dist/es/Grid.d.ts @@ -49,17 +49,26 @@ export type SectionRenderedParams = { rowStartIndex: number, rowStopIndex: number }; +export type SCROLL_DIRECTION_HORIZONTAL = 'horizontal'; +export type SCROLL_DIRECTION_VERTICAL = 'vertical'; export type OverscanIndicesGetterParams = { - cellCount: number, - overscanCellsCount: number, - scrollDirection: number, - startIndex: number, - stopIndex: number + direction?: SCROLL_DIRECTION_HORIZONTAL | SCROLL_DIRECTION_VERTICAL; + cellCount: number; + overscanCellsCount: number; + scrollDirection: SCROLL_DIRECTION_HORIZONTAL | SCROLL_DIRECTION_VERTICAL; + startIndex: number; + stopIndex: number; }; export type OverscanIndices = { overscanStartIndex: number, overscanStopIndex: number }; +export type OverscanIndicesGetter = (params: OverscanIndicesGetterParams) => OverscanIndices; + +export type ScrollOffset = { + scrollLeft: number, + scrollTop: number +} export type CellSizeAndPositionManager = { areOffsetsAdjusted(): boolean; @@ -123,40 +132,170 @@ export type GridCellRangeRenderer = (params: GridCellRangeProps) => React.ReactN export type GridCoreProps = { 'aria-label'?: string; + /** + * Set the width of the inner scrollable container to 'auto'. + * This is useful for single-column Grids to ensure that the column doesn't extend below a vertical scrollbar. + */ autoContainerWidth?: boolean; + /** + * Removes fixed height from the scrollingContainer so that the total height of rows can stretch the window. + * Intended for use with WindowScroller + */ autoHeight?: boolean; + /** + * Removes fixed width from the scrollingContainer so that the total width of rows can stretch the window. + * Intended for use with WindowScroller + */ + autoWidth?: boolean; + /** + * Responsible for rendering a group of cells given their index ranges. + * Should implement the following interface: ({ + * cellCache: Map, + * cellRenderer: Function, + * columnSizeAndPositionManager: CellSizeAndPositionManager, + * columnStartIndex: number, + * columnStopIndex: number, + * isScrolling: boolean, + * rowSizeAndPositionManager: CellSizeAndPositionManager, + * rowStartIndex: number, + * rowStopIndex: number, + * scrollLeft: number, + * scrollTop: number + * }): Array + */ cellRangeRenderer?: GridCellRangeRenderer; + /** + * Optional custom CSS class name to attach to root Grid element. + */ className?: string; + /** Optional inline style applied to inner cell-container */ containerStyle?: React.CSSProperties; + /** + * If CellMeasurer is used to measure this Grid's children, this should be a pointer to its CellMeasurerCache. + * A shared CellMeasurerCache reference enables Grid and CellMeasurer to share measurement data. + */ deferredMeasurementCache?: CellMeasurerCache; + /** + * Used to estimate the total width of a Grid before all of its columns have actually been measured. + * The estimated total width is adjusted as columns are rendered. + */ estimatedColumnSize?: number; + /** + * Used to estimate the total height of a Grid before all of its rows have actually been measured. + * The estimated total height is adjusted as rows are rendered. + */ estimatedRowSize?: number; + /** + * Exposed for testing purposes only. + */ getScrollbarSize?: () => number; + /** + * Height of Grid; this property determines the number of visible (vs virtualized) rows. + */ height: number; + /** + * Optional custom id to attach to root Grid element. + */ id?: string; + /** + * Override internal is-scrolling state tracking. + * This property is primarily intended for use with the WindowScroller component. + */ isScrolling?: boolean, + /** + * Optional renderer to be used in place of rows when either :rowCount or :columnCount is 0. + */ noContentRenderer?: () => React.ReactNode; + /** + * Callback invoked whenever the scroll offset changes within the inner scrollable region. + * This callback can be used to sync scrolling between lists, tables, or grids. + * ({ clientHeight, clientWidth, scrollHeight, scrollLeft, scrollTop, scrollWidth }): void + */ onScroll?: (params: ScrollParams) => any; + /** + * Callback invoked with information about the section of the Grid that was just rendered. + * ({ columnStartIndex, columnStopIndex, rowStartIndex, rowStopIndex }): void + */ onSectionRendered?: (params: SectionRenderedParams) => any; + /** + * Number of columns to render before/after the visible section of the grid. + * These columns can help for smoother scrolling on touch devices or browsers that send scroll events infrequently. + */ overscanColumnCount?: number; - overscanIndicesGetter?: (params: OverscanIndicesGetterParams) => OverscanIndices; + /** + * Calculates the number of cells to overscan before and after a specified range. + * This function ensures that overscanning doesn't exceed the available cells. + * Should implement the following interface: ({ + * cellCount: number, + * overscanCellsCount: number, + * scrollDirection: number, + * startIndex: number, + * stopIndex: number + * }): {overscanStartIndex: number, overscanStopIndex: number} + */ + overscanIndicesGetter?: OverscanIndicesGetter; + /** + * Number of rows to render above/below the visible section of the grid. + * These rows can help for smoother scrolling on touch devices or browsers that send scroll events infrequently. + */ overscanRowCount?: number; + /** + * ARIA role for the grid element. + */ + role?: string; + /** + * Either a fixed row height (number) or a function that returns the height of a row given its index. + * Should implement the following interface: ({ index: number }): number + */ rowHeight: number | ((params: Index) => number); + /** + * Number of rows in grid. + */ rowCount: number; + /** Wait this amount of time after the last scroll event before resetting Grid `pointer-events`. */ scrollingResetTimeInterval?: number; + /** Horizontal offset. */ scrollLeft?: number; + /** + * Controls scroll-to-cell behavior of the Grid. + * The default ("auto") scrolls the least amount possible to ensure that the specified cell is fully visible. + * Use "start" to align cells to the top/left of the Grid and "end" to align bottom/right. + */ scrollToAlignment?: Alignment; + /** + * Column index to ensure visible (by forcefully scrolling if necessary) + */ scrollToColumn?: number; + /** Vertical offset. */ scrollTop?: number; + /** + * Row index to ensure visible (by forcefully scrolling if necessary) + */ scrollToRow?: number; + /** Optional inline style */ style?: React.CSSProperties; + /** Tab index for focus */ tabIndex?: number; + /** + * Width of Grid; this property determines the number of visible (vs virtualized) columns. + */ width: number; } export type GridProps = GridCoreProps & { + /** + * Responsible for rendering a cell given an row and column index. + * Should implement the following interface: ({ columnIndex: number, rowIndex: number }): PropTypes.node + */ cellRenderer: GridCellRenderer; + /** + * Number of columns in grid. + */ columnCount: number; + /** + * Either a fixed column width (number) or a function that returns the width of a column given its index. + * Should implement the following interface: (index: number): number + */ columnWidth: number | ((params: Index) => number); }; @@ -183,195 +322,38 @@ export const DEFAULT_SCROLLING_RESET_TIME_INTERVAL = 150 export class Grid extends PureComponent { static propTypes: { 'aria-label': Requireable, - - /** - * Set the width of the inner scrollable container to 'auto'. - * This is useful for single-column Grids to ensure that the column doesn't extend below a vertical scrollbar. - */ autoContainerWidth: Requireable, - - /** - * Removes fixed height from the scrollingContainer so that the total height - * of rows can stretch the window. Intended for use with WindowScroller - */ autoHeight: Requireable, - - /** - * Responsible for rendering a cell given an row and column index. - * Should implement the following interface: ({ columnIndex: number, rowIndex: number }): PropTypes.node - */ cellRenderer: Validator<(props: GridCellProps) => React.ReactNode>, - - /** - * Responsible for rendering a group of cells given their index ranges. - * Should implement the following interface: ({ - * cellCache: Map, - * cellRenderer: Function, - * columnSizeAndPositionManager: CellSizeAndPositionManager, - * columnStartIndex: number, - * columnStopIndex: number, - * isScrolling: boolean, - * rowSizeAndPositionManager: CellSizeAndPositionManager, - * rowStartIndex: number, - * rowStopIndex: number, - * scrollLeft: number, - * scrollTop: number - * }): Array - */ cellRangeRenderer: Validator<(params: GridCellRangeProps) => React.ReactNode[]>, - - /** - * Optional custom CSS class name to attach to root Grid element. - */ className: Requireable, - - /** - * Number of columns in grid. - */ columnCount: Validator, - - /** - * Either a fixed column width (number) or a function that returns the width of a column given its index. - * Should implement the following interface: (index: number): number - */ columnWidth: Validator number)>, - - /** Optional inline style applied to inner cell-container */ containerStyle: Requireable, - - /** - * If CellMeasurer is used to measure this Grid's children, this should be a pointer to its CellMeasurerCache. - * A shared CellMeasurerCache reference enables Grid and CellMeasurer to share measurement data. - */ deferredMeasurementCache: Requireable, - - /** - * Used to estimate the total width of a Grid before all of its columns have actually been measured. - * The estimated total width is adjusted as columns are rendered. - */ estimatedColumnSize: Validator, - - /** - * Used to estimate the total height of a Grid before all of its rows have actually been measured. - * The estimated total height is adjusted as rows are rendered. - */ estimatedRowSize: Validator, - - /** - * Exposed for testing purposes only. - */ getScrollbarSize: Validator<() => number>, - - /** - * Height of Grid; this property determines the number of visible (vs virtualized) rows. - */ height: Validator, - - /** - * Optional custom id to attach to root Grid element. - */ id: Requireable, - - /** - * Override internal is-scrolling state tracking. - * This property is primarily intended for use with the WindowScroller component. - */ isScrolling: Requireable, - - /** - * Optional renderer to be used in place of rows when either :rowCount or :columnCount is 0. - */ noContentRenderer: Requireable<() => JSX.Element>, - - /** - * Callback invoked whenever the scroll offset changes within the inner scrollable region. - * This callback can be used to sync scrolling between lists, tables, or grids. - * ({ clientHeight, clientWidth, scrollHeight, scrollLeft, scrollTop, scrollWidth }): void - */ onScroll: Validator<(params: ScrollParams) => void>, - - /** - * Callback invoked with information about the section of the Grid that was just rendered. - * ({ columnStartIndex, columnStopIndex, rowStartIndex, rowStopIndex }): void - */ onSectionRendered: Validator<(params: SectionRenderedParams) => void>, - - /** - * Number of columns to render before/after the visible section of the grid. - * These columns can help for smoother scrolling on touch devices or browsers that send scroll events infrequently. - */ overscanColumnCount: Validator, - - /** - * Calculates the number of cells to overscan before and after a specified range. - * This function ensures that overscanning doesn't exceed the available cells. - * Should implement the following interface: ({ - * cellCount: number, - * overscanCellsCount: number, - * scrollDirection: number, - * startIndex: number, - * stopIndex: number - * }): {overscanStartIndex: number, overscanStopIndex: number} - */ - overscanIndicesGetter: Validator<(params: OverscanIndicesGetterParams) => OverscanIndices>, - - /** - * Number of rows to render above/below the visible section of the grid. - * These rows can help for smoother scrolling on touch devices or browsers that send scroll events infrequently. - */ + overscanIndicesGetter: Validator, overscanRowCount: Validator, - - /** - * ARIA role for the grid element. - */ role: Requireable, - - /** - * Either a fixed row height (number) or a function that returns the height of a row given its index. - * Should implement the following interface: ({ index: number }): number - */ rowHeight: Validator number)>, - - /** - * Number of rows in grid. - */ rowCount: Validator, - - /** Wait this amount of time after the last scroll event before resetting Grid `pointer-events`. */ scrollingResetTimeInterval: Requireable, - - /** Horizontal offset. */ scrollLeft: Requireable, - - /** - * Controls scroll-to-cell behavior of the Grid. - * The default ("auto") scrolls the least amount possible to ensure that the specified cell is fully visible. - * Use "start" to align cells to the top/left of the Grid and "end" to align bottom/right. - */ scrollToAlignment: Validator, - - /** - * Column index to ensure visible (by forcefully scrolling if necessary) - */ scrollToColumn: Validator, - - /** Vertical offset. */ scrollTop: Requireable, - - /** - * Row index to ensure visible (by forcefully scrolling if necessary) - */ scrollToRow: Validator, - - /** Optional inline style */ style: Requireable, - - /** Tab index for focus */ tabIndex: Requireable, - - /** - * Width of Grid; this property determines the number of visible (vs virtualized) columns. - */ width: Validator }; @@ -398,6 +380,15 @@ export class Grid extends PureComponent { constructor(props: GridProps, context: any); + /** + * Gets offsets for a given cell and alignment. + */ + getOffsetForCell(params?: { + alignment?: Alignment, + columnIndex?: number, + rowIndex?: number + }): ScrollOffset + /** * Invalidate Grid size and recompute visible cells. * This is a deferred wrapper for recomputeGridSize(). @@ -435,6 +426,15 @@ export class Grid extends PureComponent { rowIndex: number }): void; + /** + * Scroll to the specified offset(s). + * Useful for animating position changes. + */ + scrollToPosition(params?: { + scrollLeft: number, + scrollTop: number + }): void; + componentDidMount(): void; /** @@ -463,3 +463,7 @@ export class Grid extends PureComponent { } export const defaultCellRangeRenderer: GridCellRangeRenderer; + +export const accessibilityOverscanIndicesGetter: OverscanIndicesGetter + +export const defaultOverscanIndicesGetter: OverscanIndicesGetter; diff --git a/types/react-virtualized/dist/es/InfiniteLoader.d.ts b/types/react-virtualized/dist/es/InfiniteLoader.d.ts index e16359adca..f26afd3f90 100644 --- a/types/react-virtualized/dist/es/InfiniteLoader.d.ts +++ b/types/react-virtualized/dist/es/InfiniteLoader.d.ts @@ -7,11 +7,42 @@ export type InfiniteLoaderChildProps = { } export type InfiniteLoaderProps = { + /** + * Function responsible for rendering a virtualized component. + * This function should implement the following signature: + * ({ onRowsRendered, registerChild }) => PropTypes.element + * + * The specified :onRowsRendered function should be passed through to the child's :onRowsRendered property. + * The :registerChild callback should be set as the virtualized component's :ref. + */ children?: (props: InfiniteLoaderChildProps) => React.ReactNode; + /** + * Function responsible for tracking the loaded state of each row. + * It should implement the following signature: ({ index: number }): boolean + */ isRowLoaded: (params: Index) => boolean; + /** + * Callback to be invoked when more rows must be loaded. + * It should implement the following signature: ({ startIndex, stopIndex }): Promise + * The returned Promise should be resolved once row data has finished loading. + * It will be used to determine when to refresh the list with the newly-loaded data. + * This callback may be called multiple times in reaction to a single scroll event. + */ loadMoreRows: (params: IndexRange) => Promise; + /** + * Minimum number of rows to be loaded at a time. + * This property can be used to batch requests to reduce HTTP requests. + */ minimumBatchSize?: number; + /** + * Number of rows in list; can be arbitrary high number if actual number is unknown. + */ rowCount?: number; + /** + * Threshold at which to pre-fetch data. + * A threshold X means that data will start loading when a user scrolls within X rows. + * This value defaults to 15. + */ threshold?: number; }; @@ -22,47 +53,11 @@ export type InfiniteLoaderProps = { */ export class InfiniteLoader extends PureComponent { static propTypes: { - /** - * Function responsible for rendering a virtualized component. - * This function should implement the following signature: - * ({ onRowsRendered, registerChild }) => PropTypes.element - * - * The specified :onRowsRendered function should be passed through to the child's :onRowsRendered property. - * The :registerChild callback should be set as the virtualized component's :ref. - */ children: Validator<(props: InfiniteLoaderChildProps) => React.ReactNode>, - - /** - * Function responsible for tracking the loaded state of each row. - * It should implement the following signature: ({ index: number }): boolean - */ isRowLoaded: Validator<(params: Index) => boolean>, - - /** - * Callback to be invoked when more rows must be loaded. - * It should implement the following signature: ({ startIndex, stopIndex }): Promise - * The returned Promise should be resolved once row data has finished loading. - * It will be used to determine when to refresh the list with the newly-loaded data. - * This callback may be called multiple times in reaction to a single scroll event. - */ loadMoreRows: Validator<(params: IndexRange) => Promise>, - - /** - * Minimum number of rows to be loaded at a time. - * This property can be used to batch requests to reduce HTTP requests. - */ minimumBatchSize: Validator, - - /** - * Number of rows in list; can be arbitrary high number if actual number is unknown. - */ rowCount: Validator, - - /** - * Threshold at which to pre-fetch data. - * A threshold X means that data will start loading when a user scrolls within X rows. - * This value defaults to 15. - */ threshold: Validator }; diff --git a/types/react-virtualized/dist/es/List.d.ts b/types/react-virtualized/dist/es/List.d.ts index 49fb618ad4..c38a20c182 100644 --- a/types/react-virtualized/dist/es/List.d.ts +++ b/types/react-virtualized/dist/es/List.d.ts @@ -1,5 +1,5 @@ import { PureComponent, Validator, Requireable } from 'react' -import { Grid, GridCoreProps, GridCellProps } from './Grid' +import { Grid, GridCoreProps, GridCellProps, OverscanIndicesGetter } from './Grid' import { Index, IndexRange, Alignment } from '../../index' import { CellMeasurerCache } from './CellMeasurer' @@ -8,22 +8,60 @@ export type ListRowProps = GridCellProps & { index: number, style: React.CSSProp export type ListRowRenderer = (props: ListRowProps) => React.ReactNode; export type ListProps = GridCoreProps & { deferredMeasurementCache?: CellMeasurerCache; - className?: string; + /** + * Removes fixed height from the scrollingContainer so that the total height + * of rows can stretch the window. Intended for use with WindowScroller + */ autoHeight?: boolean; + /** Optional CSS class name */ + className?: string; + /** + * Used to estimate the total height of a List before all of its rows have actually been measured. + * The estimated total height is adjusted as rows are rendered. + */ estimatedRowSize?: number; + /** Height constraint for list (determines how many actual rows are rendered) */ height: number; + /** Optional renderer to be used in place of rows when rowCount is 0 */ noRowsRenderer?: () => JSX.Element; + /** + * Callback invoked with information about the slice of rows that were just rendered. + * ({ startIndex, stopIndex }): void + */ onRowsRendered?: (info: { overscanStartIndex: number, overscanStopIndex: number, startIndex: number, stopIndex: number }) => void; - onScroll?: (info: { clientHeight: number, scrollHeight: number, scrollTop: number }) => void; + /** + * Number of rows to render above/below the visible bounds of the list. + * These rows can help for smoother scrolling on touch devices. + */ overscanRowCount?: number; + /** + * Callback invoked whenever the scroll offset changes within the inner scrollable region. + * This callback can be used to sync scrolling between lists, tables, or grids. + * ({ clientHeight, scrollHeight, scrollTop }): void + */ + onScroll?: (info: { clientHeight: number, scrollHeight: number, scrollTop: number }) => void; + /** See Grid#overscanIndicesGetter */ + overscanIndicesGetter?: OverscanIndicesGetter, + /** + * Either a fixed row height (number) or a function that returns the height of a row given its index. + * ({ index: number }): number + */ rowHeight: number | ((info: Index) => number); + /** Responsible for rendering a row given an index; ({ index: number }): node */ rowRenderer: ListRowRenderer; + /** Number of rows in list. */ rowCount: number; + /** See Grid#scrollToAlignment */ scrollToAlignment?: string; + /** Row index to ensure visible (by forcefully scrolling if necessary) */ scrollToIndex?: number; + /** Vertical offset. */ scrollTop?: number; + /** Optional inline style */ style?: React.CSSProperties; + /** Tab index for focus */ tabIndex?: number; + /** Width of list */ width: number; } /** @@ -37,75 +75,23 @@ export type ListProps = GridCoreProps & { export class List extends PureComponent { static propTypes: { 'aria-label': Requireable, - - /** - * Removes fixed height from the scrollingContainer so that the total height - * of rows can stretch the window. Intended for use with WindowScroller - */ autoHeight: Requireable, - - /** Optional CSS class name */ className: Requireable, - - /** - * Used to estimate the total height of a List before all of its rows have actually been measured. - * The estimated total height is adjusted as rows are rendered. - */ estimatedRowSize: Validator, - - /** Height constraint for list (determines how many actual rows are rendered) */ height: Validator, - - /** Optional renderer to be used in place of rows when rowCount is 0 */ noRowsRenderer: Validator<() => JSX.Element>, - - /** - * Callback invoked with information about the slice of rows that were just rendered. - * ({ startIndex, stopIndex }): void - */ onRowsRendered: Validator<(params: IndexRange) => void>, - - /** - * Number of rows to render above/below the visible bounds of the list. - * These rows can help for smoother scrolling on touch devices. - */ overscanRowCount: Validator, - - /** - * Callback invoked whenever the scroll offset changes within the inner scrollable region. - * This callback can be used to sync scrolling between lists, tables, or grids. - * ({ clientHeight, scrollHeight, scrollTop }): void - */ onScroll: Validator<(params: { clientHeight: number, scrollHeight: number, scrollTop: number }) => void>, - - /** - * Either a fixed row height (number) or a function that returns the height of a row given its index. - * ({ index: number }): number - */ + overscanIndicesGetter: Validator, rowHeight: Validator number)>, - - /** Responsible for rendering a row given an index; ({ index: number }): node */ rowRenderer: Validator, - - /** Number of rows in list. */ rowCount: Validator, - - /** See Grid#scrollToAlignment */ scrollToAlignment: Validator, - - /** Row index to ensure visible (by forcefully scrolling if necessary) */ scrollToIndex: Validator, - - /** Vertical offset. */ scrollTop: Requireable, - - /** Optional inline style */ style: Validator, - - /** Tab index for focus */ tabIndex: Requireable, - - /** Width of list */ width: Validator }; @@ -130,6 +116,15 @@ export class List extends PureComponent { /** See Grid#recomputeGridSize */ recomputeRowHeights(index?: number): void; + /** See Grid#getOffsetForCell */ + getOffsetForRow(params: { + alignment?: Alignment, + index?: number + }): number; + + /** See Grid#scrollToPosition */ + scrollToPosition(scrollTop?: number): void; + /** See Grid#scrollToCell */ scrollToRow(index?: number): void; diff --git a/types/react-virtualized/dist/es/ScrollSync.d.ts b/types/react-virtualized/dist/es/ScrollSync.d.ts index d244262d25..2d49bee5d0 100644 --- a/types/react-virtualized/dist/es/ScrollSync.d.ts +++ b/types/react-virtualized/dist/es/ScrollSync.d.ts @@ -20,6 +20,11 @@ export type ScrollSyncChildProps = { } export type ScrollSyncProps = { + /** + * Function responsible for rendering 2 or more virtualized components. + * This function should implement the following signature: + * ({ onScroll, scrollLeft, scrollTop }) => PropTypes.element + */ children?: (props: ScrollSyncChildProps) => React.ReactNode }; @@ -37,11 +42,6 @@ export type ScrollSyncState = { */ export class ScrollSync extends PureComponent { static propTypes: { - /** - * Function responsible for rendering 2 or more virtualized components. - * This function should implement the following signature: - * ({ onScroll, scrollLeft, scrollTop }) => PropTypes.element - */ children: Validator<(props: ScrollSyncChildProps) => React.ReactNode> }; diff --git a/types/react-virtualized/dist/es/Table.d.ts b/types/react-virtualized/dist/es/Table.d.ts index 6f1e27df5f..8e0f6c4464 100644 --- a/types/react-virtualized/dist/es/Table.d.ts +++ b/types/react-virtualized/dist/es/Table.d.ts @@ -11,7 +11,9 @@ export type TableCellDataGetterParams = { export type TableCellProps = { cellData?: any, columnData?: any, + columnIndex: number, dataKey: string, + isScrolling: boolean, rowData: any, rowIndex: number }; @@ -52,79 +54,65 @@ export type TableRowRenderer = (props: TableRowProps) => React.ReactNode; // https://github.com/bvaughn/react-virtualized/blob/master/docs/Column.md export type ColumnProps = { + /** Optional aria-label value to set on the column header */ + 'aria-label'?: string, + /** + * Callback responsible for returning a cell's data, given its :dataKey + * ({ columnData: any, dataKey: string, rowData: any }): any + */ cellDataGetter?: TableCellDataGetter; + /** + * Callback responsible for rendering a cell's contents. + * ({ cellData: any, columnData: any, dataKey: string, rowData: any, rowIndex: number }): node + */ cellRenderer?: TableCellRenderer; + /** Optional CSS class to apply to cell */ className?: string; + /** Optional additional data passed to this column's :cellDataGetter */ columnData?: any; + /** Uniquely identifies the row-data attribute correspnding to this cell */ dataKey: any; + /** If sort is enabled for the table at large, disable it for this column */ disableSort?: boolean; + /** Flex grow style; defaults to 0 */ flexGrow?: number; + /** Flex shrink style; defaults to 1 */ flexShrink?: number; + /** Optional CSS class to apply to this column's header */ headerClassName?: string; + /** + * Optional callback responsible for rendering a column header contents. + * ({ columnData: object, dataKey: string, disableSort: boolean, label: string, sortBy: string, sortDirection: string }): PropTypes.node + */ headerRenderer?: TableHeaderRenderer; + /** Header label for this column */ label?: string; + /** Maximum width of column; this property will only be used if :flexGrow is > 0. */ maxWidth?: number; + /** Minimum width of column. */ minWidth?: number; + /** Optional inline style to apply to cell */ style?: React.CSSProperties; + /** Flex basis (width) for this column; This value can grow or shrink based on :flexGrow and :flexShrink properties. */ width: number; } export class Column extends Component { static propTypes: { - /** Optional aria-label value to set on the column header */ 'aria-label': Requireable, - - /** - * Callback responsible for returning a cell's data, given its :dataKey - * ({ columnData: any, dataKey: string, rowData: any }): any - */ cellDataGetter: Requireable, - - /** - * Callback responsible for rendering a cell's contents. - * ({ cellData: any, columnData: any, dataKey: string, rowData: any, rowIndex: number }): node - */ cellRenderer: Requireable, - - /** Optional CSS class to apply to cell */ className: Requireable, - - /** Optional additional data passed to this column's :cellDataGetter */ columnData: Requireable, - - /** Uniquely identifies the row-data attribute correspnding to this cell */ dataKey: Validator, - - /** If sort is enabled for the table at large, disable it for this column */ disableSort: Requireable, - - /** Flex grow style; defaults to 0 */ flexGrow: Requireable, - - /** Flex shrink style; defaults to 1 */ flexShrink: Requireable, - - /** Optional CSS class to apply to this column's header */ headerClassName: Requireable, - - /** - * Optional callback responsible for rendering a column header contents. - * ({ columnData: object, dataKey: string, disableSort: boolean, label: string, sortBy: string, sortDirection: string }): PropTypes.node - */ headerRenderer: Validator, - - /** Header label for this column */ label: Requireable, - - /** Maximum width of column; this property will only be used if :flexGrow is > 0. */ maxWidth: Requireable, - - /** Minimum width of column. */ minWidth: Requireable, - - /** Optional inline style to apply to cell */ style: Requireable, - - /** Flex basis (width) for this column; This value can grow or shrink based on :flexGrow and :flexShrink properties. */ width: Validator }; @@ -156,43 +144,146 @@ export type HeaderMouseEventHandlerParams = { // ref: https://github.com/bvaughn/react-virtualized/blob/master/docs/Table.md export type TableProps = GridCoreProps & { + 'aria-label'?: string, deferredMeasurementCache?: CellMeasurerCache; + /** + * Removes fixed height from the scrollingContainer so that the total height + * of rows can stretch the window. Intended for use with WindowScroller + */ autoHeight?: boolean; - children?: React.ReactChildren; + /** One or more Columns describing the data displayed in this row */ + children?: React.ReactElement[] | React.ReactElement; + /** Optional CSS class name */ className?: string; + /** Disable rendering the header at all */ disableHeader?: boolean; + /** + * Used to estimate the total height of a Table before all of its rows have actually been measured. + * The estimated total height is adjusted as rows are rendered. + */ estimatedRowSize?: number; + /** Optional custom CSS class name to attach to inner Grid element. */ gridClassName?: string; + /** Optional inline style to attach to inner Grid element. */ gridStyle?: any; + /** Optional CSS class to apply to all column headers */ headerClassName?: string; + /** Fixed height of header row */ headerHeight: number; - headerStyle?: any; - height?: number; - id?: string; - noRowsRenderer?: () => void; - onHeaderClick?: (params: HeaderMouseEventHandlerParams) => void; - onRowClick?: (info: RowMouseEventHandlerParams) => void; - onRowDoubleClick?: (info: RowMouseEventHandlerParams) => void; - onRowMouseOut?: (info: RowMouseEventHandlerParams) => void; - onRowMouseOver?: (info: RowMouseEventHandlerParams) => void; - onRowsRendered?: (info: IndexRange & OverscanIndexRange) => void; - overscanRowCount?: number; - onScroll?: (info: ScrollEventData) => void; - rowClassName?: string | ((info: Index) => string); - rowCount: number; - rowGetter?: (info: Index) => any; - rowHeight: number | ((info: Index) => number); - rowRenderer?: TableRowRenderer; + /** + * Responsible for rendering a table row given an array of columns: + * Should implement the following interface: ({ + * className: string, + * columns: any[], + * style: any + * }): PropTypes.node + */ headerRowRenderer?: TableHeaderRowRenderer; + /** Optional custom inline style to attach to table header columns. */ + headerStyle?: any; + /** Fixed/available height for out DOM element */ + height?: number; + /** Optional id */ + id?: string; + /** Optional renderer to be used in place of table body rows when rowCount is 0 */ + noRowsRenderer?: () => void; + /** + * Optional callback when a column's header is clicked. + * ({ columnData: any, dataKey: string }): void + */ + onHeaderClick?: (params: HeaderMouseEventHandlerParams) => void; + /** + * Callback invoked when a user clicks on a table row. + * ({ index: number }): void + */ + onRowClick?: (info: RowMouseEventHandlerParams) => void; + /** + * Callback invoked when a user double-clicks on a table row. + * ({ index: number }): void + */ + onRowDoubleClick?: (info: RowMouseEventHandlerParams) => void; + /** + * Callback invoked when the mouse leaves a table row. + * ({ index: number }): void + */ + onRowMouseOut?: (info: RowMouseEventHandlerParams) => void; + /** + * Callback invoked when a user moves the mouse over a table row. + * ({ index: number }): void + */ + onRowMouseOver?: (info: RowMouseEventHandlerParams) => void; + /** + * Callback invoked with information about the slice of rows that were just rendered. + * ({ startIndex, stopIndex }): void + */ + onRowsRendered?: (info: IndexRange & OverscanIndexRange) => void; + /** + * Callback invoked whenever the scroll offset changes within the inner scrollable region. + * This callback can be used to sync scrolling between lists, tables, or grids. + * ({ clientHeight, scrollHeight, scrollTop }): void + */ + onScroll?: (info: ScrollEventData) => void; + /** + * Number of rows to render above/below the visible bounds of the list. + * These rows can help for smoother scrolling on touch devices. + */ + overscanRowCount?: number; + /** + * Optional CSS class to apply to all table rows (including the header row). + * This property can be a CSS class name (string) or a function that returns a class name. + * If a function is provided its signature should be: ({ index: number }): string + */ + rowClassName?: string | ((info: Index) => string); + /** + * Callback responsible for returning a data row given an index. + * ({ index: number }): any + */ + rowGetter?: (info: Index) => any; + /** + * Either a fixed row height (number) or a function that returns the height of a row given its index. + * ({ index: number }): number + */ + rowHeight: number | ((info: Index) => number); + /** Number of rows in table. */ + rowCount: number; + /** + * Responsible for rendering a table row given an array of columns: + * Should implement the following interface: ({ + * className: string, + * columns: Array, + * index: number, + * isScrolling: boolean, + * onRowClick: ?Function, + * onRowDoubleClick: ?Function, + * onRowMouseOver: ?Function, + * onRowMouseOut: ?Function, + * rowData: any, + * style: any + * }): PropTypes.node + */ + rowRenderer?: TableRowRenderer; + /** Optional custom inline style to attach to table rows. */ rowStyle?: React.CSSProperties | ((info: Index) => React.CSSProperties); + /** See Grid#scrollToAlignment */ scrollToAlignment?: string; + /** Row index to ensure visible (by forcefully scrolling if necessary) */ scrollToIndex?: number; + /** Vertical offset. */ scrollTop?: number; + /** + * Sort function to be called if a sortable header is clicked. + * ({ sortBy: string, sortDirection: SortDirection }): void + */ sort?: (info: { sortBy: string, sortDirection: SortDirectionType }) => void; + /** Table data is currently sorted by this :dataKey (if it is sorted at all) */ sortBy?: string; + /** Table data is currently sorted in this direction (if it is sorted at all) */ sortDirection?: SortDirectionType; + /** Optional inline style */ style?: React.CSSProperties; + /** Tab index for focus */ tabIndex?: number; + /** Width of list */ width?: number; } @@ -229,181 +320,42 @@ export const SortIndicator: React.StatelessComponent<{ sortDirection: SortDirect export class Table extends PureComponent { static propTypes: { 'aria-label': Requireable, - - /** - * Removes fixed height from the scrollingContainer so that the total height - * of rows can stretch the window. Intended for use with WindowScroller - */ autoHeight: Requireable, - - /** One or more Columns describing the data displayed in this row */ children: Validator, - - /** Optional CSS class name */ className: Requireable, - - /** Disable rendering the header at all */ disableHeader: Requireable, - - /** - * Used to estimate the total height of a Table before all of its rows have actually been measured. - * The estimated total height is adjusted as rows are rendered. - */ estimatedRowSize: Validator, - - /** Optional custom CSS class name to attach to inner Grid element. */ gridClassName: Requireable, - - /** Optional inline style to attach to inner Grid element. */ gridStyle: Requireable, - - /** Optional CSS class to apply to all column headers */ headerClassName: Requireable, - - /** Fixed height of header row */ headerHeight: Validator, - - /** - * Responsible for rendering a table row given an array of columns: - * Should implement the following interface: ({ - * className: string, - * columns: any[], - * style: any - * }): PropTypes.node - */ headerRowRenderer: Requireable, - - /** Optional custom inline style to attach to table header columns. */ headerStyle: Requireable, - - /** Fixed/available height for out DOM element */ height: Validator, - - /** Optional id */ id: Requireable, - - /** Optional renderer to be used in place of table body rows when rowCount is 0 */ noRowsRenderer: Requireable<() => JSX.Element>, - - /** - * Optional callback when a column's header is clicked. - * ({ columnData: any, dataKey: string }): void - */ onHeaderClick: Requireable<(params: HeaderMouseEventHandlerParams) => void>, - - /** - * Callback invoked when a user clicks on a table row. - * ({ index: number }): void - */ onRowClick: Requireable<(params: RowMouseEventHandlerParams) => void>, - - /** - * Callback invoked when a user double-clicks on a table row. - * ({ index: number }): void - */ onRowDoubleClick: Requireable<(params: RowMouseEventHandlerParams) => void>, - - /** - * Callback invoked when the mouse leaves a table row. - * ({ index: number }): void - */ onRowMouseOut: Requireable<(params: RowMouseEventHandlerParams) => void>, - - /** - * Callback invoked when a user moves the mouse over a table row. - * ({ index: number }): void - */ onRowMouseOver: Requireable<(params: RowMouseEventHandlerParams) => void>, - - /** - * Callback invoked with information about the slice of rows that were just rendered. - * ({ startIndex, stopIndex }): void - */ onRowsRendered: Requireable<(params: RowMouseEventHandlerParams) => void>, - - /** - * Callback invoked whenever the scroll offset changes within the inner scrollable region. - * This callback can be used to sync scrolling between lists, tables, or grids. - * ({ clientHeight, scrollHeight, scrollTop }): void - */ onScroll: Requireable<(params: ScrollEventData) => void>, - - /** - * Number of rows to render above/below the visible bounds of the list. - * These rows can help for smoother scrolling on touch devices. - */ overscanRowCount: Validator, - - /** - * Optional CSS class to apply to all table rows (including the header row). - * This property can be a CSS class name (string) or a function that returns a class name. - * If a function is provided its signature should be: ({ index: number }): string - */ rowClassName: Requireable string)>, - - /** - * Callback responsible for returning a data row given an index. - * ({ index: number }): any - */ rowGetter: Validator<(params: Index) => any>, - - /** - * Either a fixed row height (number) or a function that returns the height of a row given its index. - * ({ index: number }): number - */ rowHeight: Validator number)>, - - /** Number of rows in table. */ rowCount: Validator, - - /** - * Responsible for rendering a table row given an array of columns: - * Should implement the following interface: ({ - * className: string, - * columns: Array, - * index: number, - * isScrolling: boolean, - * onRowClick: ?Function, - * onRowDoubleClick: ?Function, - * onRowMouseOver: ?Function, - * onRowMouseOut: ?Function, - * rowData: any, - * style: any - * }): PropTypes.node - */ rowRenderer: Requireable<(props: TableRowProps) => React.ReactNode>, - - /** Optional custom inline style to attach to table rows. */ rowStyle: Validator React.CSSProperties)>, - - /** See Grid#scrollToAlignment */ scrollToAlignment: Validator, - - /** Row index to ensure visible (by forcefully scrolling if necessary) */ scrollToIndex: Validator, - - /** Vertical offset. */ scrollTop: Requireable, - - /** - * Sort function to be called if a sortable header is clicked. - * ({ sortBy: string, sortDirection: SortDirection }): void - */ sort: Requireable<(params: { sortBy: string, sortDirection: SortDirectionType }) => void>, - - /** Table data is currently sorted by this :dataKey (if it is sorted at all) */ sortBy: Requireable, - - /** Table data is currently sorted in this direction (if it is sorted at all) */ sortDirection: Validator, - - /** Optional inline style */ style: Requireable, - - /** Tab index for focus */ tabIndex: Requireable, - - /** Width of list */ width: Validator }; @@ -430,6 +382,15 @@ export class Table extends PureComponent { forceUpdateGrid(): void; + /** See Grid#getOffsetForCell */ + getOffsetForRow(params: { + alignment?: Alignment, + index?: number + }): number; + + /** See Grid#scrollToPosition */ + scrollToPosition(scrollTop?: number): void; + /** See Grid#measureAllCells */ measureAllRows(): void; diff --git a/types/react-virtualized/dist/es/WindowScroller.d.ts b/types/react-virtualized/dist/es/WindowScroller.d.ts index 7e0a09379e..16be9f8e1a 100644 --- a/types/react-virtualized/dist/es/WindowScroller.d.ts +++ b/types/react-virtualized/dist/es/WindowScroller.d.ts @@ -7,9 +7,17 @@ export type WindowScrollerChildProps = { }; export type WindowScrollerProps = { + /** + * Function responsible for rendering children. + * This function should implement the following signature: + * ({ height, isScrolling, scrollTop }) => PropTypes.element + */ children?: (props: WindowScrollerChildProps) => React.ReactNode; + /** Callback to be invoked on-resize: ({ height }) */ onResize?: (prams: { height: number }) => void; + /** Callback to be invoked on-scroll: ({ scrollTop }) */ onScroll?: (params: { scrollTop: number }) => void; + /** Element to attach scroll event listeners. Defaults to window. */ scrollElement?: HTMLElement; } export type WindowScrollerState = { @@ -20,20 +28,9 @@ export type WindowScrollerState = { export class WindowScroller extends PureComponent { static propTypes: { - /** - * Function responsible for rendering children. - * This function should implement the following signature: - * ({ height, isScrolling, scrollTop }) => PropTypes.element - */ children: Validator<(props: WindowScrollerChildProps) => React.ReactNode>, - - /** Callback to be invoked on-resize: ({ height }) */ onResize: Validator<(params: { height: number }) => void>, - - /** Callback to be invoked on-scroll: ({ scrollTop }) */ onScroll: Validator<(params: { scrollTop: number }) => void>, - - /** Element to attach scroll event listeners. Defaults to window. */ scrollElement: HTMLElement }; diff --git a/types/react-virtualized/index.d.ts b/types/react-virtualized/index.d.ts index 82fb2a3daf..8b017687f0 100644 --- a/types/react-virtualized/index.d.ts +++ b/types/react-virtualized/index.d.ts @@ -37,6 +37,8 @@ export { SizedColumnProps } from './dist/es/ColumnSizer' export { + accessibilityOverscanIndicesGetter, + defaultOverscanIndicesGetter, defaultCellRangeRenderer, Grid, CellSizeAndPositionManager, diff --git a/types/react-virtualized/react-virtualized-tests.tsx b/types/react-virtualized/react-virtualized-tests.tsx index aa44909cdf..ad413978ee 100644 --- a/types/react-virtualized/react-virtualized-tests.tsx +++ b/types/react-virtualized/react-virtualized-tests.tsx @@ -1,2 +1,1751 @@ +import * as React from 'react'; +import { PureComponent } from 'react' +import { ArrowKeyStepper, AutoSizer, Grid } from 'react-virtualized' + +export class ArrowKeyStepperExample extends PureComponent { + constructor(props) { + super(props) + + this._getColumnWidth = this._getColumnWidth.bind(this) + this._getRowHeight = this._getRowHeight.bind(this) + this._cellRenderer = this._cellRenderer.bind(this) + } + + render() { + const { mode } = this.state + + return ( + + + {({ onSectionRendered, scrollToColumn, scrollToRow }) => ( +
    + + + {({ width }) => ( + this._cellRenderer({ columnIndex, key, rowIndex, scrollToColumn, scrollToRow, style })} + rowHeight={this._getRowHeight} + rowCount={100} + scrollToColumn={scrollToColumn} + scrollToRow={scrollToRow} + width={width} + /> + )} + +
    + )} +
    + ) + } + + _getColumnWidth({ index }) { + return (1 + (index % 3)) * 60 + } + + _getRowHeight({ index }) { + return (1 + (index % 3)) * 30 + } + + _cellRenderer({ columnIndex, key, rowIndex, scrollToColumn, scrollToRow, style }) { + + return ( +
    + {`r:${rowIndex}, c:${columnIndex}`} +
    + ) + } +} + +import { List } from 'react-virtualized' + +export class AutoSizerExample extends PureComponent { + constructor(props) { + super(props) + + this._rowRenderer = this._rowRenderer.bind(this) + } + + render() { + const { list } = this.context + const { hideDescription } = this.state + + return ( + + {({ width, height }) => ( + + )} + + ) + } + + _rowRenderer({ index, key, style }) { + const { list } = this.context + const row = list.get(index) + + return ( +
    + {row.name} +
    + ) + } +} import { } from 'react' import { CellMeasurer, CellMeasurerCache } from 'react-virtualized' + +export class DynamicHeightList extends PureComponent { + + _cache: CellMeasurerCache + + constructor(props, context) { + super(props, context) + + this._cache = new CellMeasurerCache({ + fixedWidth: true, + minHeight: 50 + }) + + this._rowRenderer = this._rowRenderer.bind(this) + } + + render() { + const { width } = this.props + + return ( + + ) + } + + _rowRenderer({ index, isScrolling, key, parent, style }) { + const { getClassName, list } = this.props + + const datum = list.get(index % list.size) + const classNames = getClassName({ columnIndex: 0, rowIndex: index }) + + const imageWidth = 300 + const imageHeight = datum.size * 2 + + const source = `http://fillmurray.com/${imageWidth}/${imageHeight}` + + return ( + + {({ measure }) => ( +
    + +
    + )} +
    + ) + } +} + +import { Collection } from 'react-virtualized' + +// Defines a pattern of sizes and positions for a range of 10 rotating cells +// These cells cover an area of 600 (wide) x 400 (tall) +const GUTTER_SIZE = 3 +const CELL_WIDTH = 75 + +export class CollectionExample extends PureComponent { + _columnYMap: any; + + constructor(props, context) { + super(props, context) + + this.context = context; + + this.state = { + cellCount: context.list.size, + columnCount: this._getColumnCount(context.list.size), + height: 300, + horizontalOverscanSize: 0, + scrollToCell: undefined, + showScrollingPlaceholder: false, + verticalOverscanSize: 0 + } + + this._columnYMap = [] + + this._cellRenderer = this._cellRenderer.bind(this) + this._cellSizeAndPositionGetter = this._cellSizeAndPositionGetter.bind(this) + this._noContentRenderer = this._noContentRenderer.bind(this) + this._onCellCountChange = this._onCellCountChange.bind(this) + this._onHeightChange = this._onHeightChange.bind(this) + this._onHorizontalOverscanSizeChange = this._onHorizontalOverscanSizeChange.bind(this) + this._onScrollToCellChange = this._onScrollToCellChange.bind(this) + this._onVerticalOverscanSizeChange = this._onVerticalOverscanSizeChange.bind(this) + } + + render() { + const { cellCount, height, horizontalOverscanSize, scrollToCell, showScrollingPlaceholder, verticalOverscanSize } = this.state + + return ( + + {({ width }) => ( + + )} + + ) + } + + _cellRenderer({ index, isScrolling, key, style }) { + const { list } = this.context + const { showScrollingPlaceholder } = this.state + + const datum = list.get(index % list.size) + + // Customize style + style.backgroundColor = datum.color + + return ( +
    + {showScrollingPlaceholder && isScrolling ? '...' : index} +
    + ) + } + + _cellSizeAndPositionGetter({ index }) { + const { list } = this.context + const { columnCount } = this.state + + const columnPosition = index % (columnCount || 1) + const datum = list.get(index % list.size) + + // Poor man's Masonry layout; columns won't all line up equally with the bottom. + const height = datum.size + const width = CELL_WIDTH + const x = columnPosition * (GUTTER_SIZE + width) + const y = this._columnYMap[columnPosition] || 0 + + this._columnYMap[columnPosition] = y + height + GUTTER_SIZE + + return { + height, + width, + x, + y + } + } + + _getColumnCount(cellCount) { + return Math.round(Math.sqrt(cellCount)) + } + + _onHorizontalOverscanSizeChange(event) { + const horizontalOverscanSize = parseInt(event.target.value, 10) || 0 + + this.setState({ horizontalOverscanSize }) + } + + _noContentRenderer() { + return ( +
    + No cells +
    + ) + } + + _onCellCountChange(event) { + const cellCount = parseInt(event.target.value, 10) || 0 + + this._columnYMap = [] + + this.setState({ + cellCount, + columnCount: this._getColumnCount(cellCount) + }) + } + + _onHeightChange(event) { + const height = parseInt(event.target.value, 10) || 0 + + this.setState({ height }) + } + + _onScrollToCellChange(event) { + const { cellCount } = this.state + + let scrollToCell = Math.min(cellCount - 1, parseInt(event.target.value, 10)) + + if (isNaN(scrollToCell)) { + scrollToCell = undefined + } + + this.setState({ scrollToCell }) + } + + _onVerticalOverscanSizeChange(event) { + const verticalOverscanSize = parseInt(event.target.value, 10) || 0 + + this.setState({ verticalOverscanSize }) + } +} + +import { ColumnSizer } from 'react-virtualized' + +export class ColumnSizerExample extends PureComponent { + constructor(props) { + super(props) + + this._noColumnMaxWidthChange = this._noColumnMaxWidthChange.bind(this) + this._noColumnMinWidthChange = this._noColumnMinWidthChange.bind(this) + this._onColumnCountChange = this._onColumnCountChange.bind(this) + this._noContentRenderer = this._noContentRenderer.bind(this) + this._cellRenderer = this._cellRenderer.bind(this) + } + + render() { + const { + columnMaxWidth, + columnMinWidth, + columnCount + } = this.state + + return ( +
    + + {({ width }) => ( + + {({ adjustedWidth, getColumnWidth, registerChild }) => ( +
    + +
    + )} +
    + )} +
    +
    + ) + } + + _noColumnMaxWidthChange(event) { + let columnMaxWidth = parseInt(event.target.value, 10) + + if (isNaN(columnMaxWidth)) { + columnMaxWidth = undefined + } else { + columnMaxWidth = Math.min(1000, columnMaxWidth) + } + + this.setState({ columnMaxWidth }) + } + + _noColumnMinWidthChange(event) { + let columnMinWidth = parseInt(event.target.value, 10) + + if (isNaN(columnMinWidth)) { + columnMinWidth = undefined + } else { + columnMinWidth = Math.max(1, columnMinWidth) + } + + this.setState({ columnMinWidth }) + } + + _onColumnCountChange(event) { + this.setState({ columnCount: parseInt(event.target.value, 10) || 0 }) + } + + _noContentRenderer() { + return ( +
    + No cells +
    + ) + } + + _cellRenderer({ columnIndex, key, rowIndex, style }) { + const className = columnIndex === 0 + ? 'styles.firstCell' + : 'styles.cell' + + return ( +
    + {`R:${rowIndex}, C:${columnIndex}`} +
    + ) + } +} + +export class GridExample extends PureComponent { + constructor(props, context) { + super(props, context) + + this.state = { + columnCount: 1000, + height: 300, + overscanColumnCount: 0, + overscanRowCount: 10, + rowHeight: 40, + rowCount: 1000, + scrollToColumn: undefined, + scrollToRow: undefined, + useDynamicRowHeight: false + } + + this._cellRenderer = this._cellRenderer.bind(this) + this._getColumnWidth = this._getColumnWidth.bind(this) + this._getRowClassName = this._getRowClassName.bind(this) + this._getRowHeight = this._getRowHeight.bind(this) + this._noContentRenderer = this._noContentRenderer.bind(this) + this._onColumnCountChange = this._onColumnCountChange.bind(this) + this._onRowCountChange = this._onRowCountChange.bind(this) + this._onScrollToColumnChange = this._onScrollToColumnChange.bind(this) + this._onScrollToRowChange = this._onScrollToRowChange.bind(this) + this._renderBodyCell = this._renderBodyCell.bind(this) + this._renderLeftSideCell = this._renderLeftSideCell.bind(this) + } + + render() { + const { + columnCount, + height, + overscanColumnCount, + overscanRowCount, + rowHeight, + rowCount, + scrollToColumn, + scrollToRow, + useDynamicRowHeight + } = this.state + + return ( + + + {({ width }) => ( + + )} + + ) + } + + _cellRenderer({ columnIndex, key, rowIndex, style }) { + if (columnIndex === 0) { + return this._renderLeftSideCell({ key, rowIndex, style }) + } else { + return this._renderBodyCell({ columnIndex, key, rowIndex, style }) + } + } + + _getColumnWidth({ index }) { + switch (index) { + case 0: + return 50 + case 1: + return 100 + case 2: + return 300 + default: + return 80 + } + } + + _getDatum(index) { + const { list } = this.context + + return list.get(index % list.size) + } + + _getRowClassName(row) { + return row % 2 === 0 ? 'styles.evenRow' : 'styles.oddRow' + } + + _getRowHeight({ index }) { + return this._getDatum(index).size + } + + _noContentRenderer() { + return ( +
    + No cells +
    + ) + } + + _renderBodyCell({ columnIndex, key, rowIndex, style }) { + const rowClass = this._getRowClassName(rowIndex) + const datum = this._getDatum(rowIndex) + + let content + + switch (columnIndex) { + case 1: + content = datum.name + break + case 2: + content = datum.random + break + default: + content = `r:${rowIndex}, c:${columnIndex}` + break + } + + return ( +
    + {content} +
    + ) + } + + _renderLeftSideCell({ key, rowIndex, style }) { + const datum = this._getDatum(rowIndex) + + // Don't modify styles. + // These are frozen by React now (as of 16.0.0). + // Since Grid caches and re-uses them, they aren't safe to modify. + style = { + ...style, + backgroundColor: datum.color + } + + return ( +
    + {datum.name.charAt(0)} +
    + ) + } + + _updateUseDynamicRowHeights(value) { + this.setState({ + useDynamicRowHeight: value + }) + } + + _onColumnCountChange(event) { + const columnCount = parseInt(event.target.value, 10) || 0 + + this.setState({ columnCount }) + } + + _onRowCountChange(event) { + const rowCount = parseInt(event.target.value, 10) || 0 + + this.setState({ rowCount }) + } + + _onScrollToColumnChange(event) { + const { columnCount } = this.state + let scrollToColumn = Math.min(columnCount - 1, parseInt(event.target.value, 10)) + + if (isNaN(scrollToColumn)) { + scrollToColumn = undefined + } + + this.setState({ scrollToColumn }) + } + + _onScrollToRowChange(event) { + const { rowCount } = this.state + let scrollToRow = Math.min(rowCount - 1, parseInt(event.target.value, 10)) + + if (isNaN(scrollToRow)) { + scrollToRow = undefined + } + + this.setState({ scrollToRow }) + } +} + +import { InfiniteLoader } from 'react-virtualized' + +const STATUS_LOADING = 1 +const STATUS_LOADED = 2 + +export class InfiniteLoaderExample extends PureComponent { + _timeoutIdMap: any; + + constructor(props) { + super(props) + + this._timeoutIdMap = {} + + this._clearData = this._clearData.bind(this) + this._isRowLoaded = this._isRowLoaded.bind(this) + this._loadMoreRows = this._loadMoreRows.bind(this) + this._rowRenderer = this._rowRenderer.bind(this) + } + + componentWillUnmount() { + Object.keys(this._timeoutIdMap).forEach(timeoutId => { + clearTimeout(timeoutId as any) + }) + } + + render() { + const { list } = this.context + const { loadedRowCount, loadingRowCount } = this.state + + return ( + + {({ onRowsRendered, registerChild }) => ( + + {({ width }) => ( + + )} + + )} + + ) + } + + _clearData() { + this.setState({ + loadedRowCount: 0, + loadedRowsMap: {}, + loadingRowCount: 0 + }) + } + + _isRowLoaded({ index }) { + const { loadedRowsMap } = this.state + return !!loadedRowsMap[index] // STATUS_LOADING or STATUS_LOADED + } + + _loadMoreRows({ startIndex, stopIndex }) { + const { loadedRowsMap, loadingRowCount } = this.state + const increment = stopIndex - startIndex + 1 + + for (let i = startIndex; i <= stopIndex; i++) { + loadedRowsMap[i] = STATUS_LOADING + } + + this.setState({ + loadingRowCount: loadingRowCount + increment + }) + + const timeoutId = setTimeout(() => { + const { loadedRowCount, loadingRowCount } = this.state + + delete this._timeoutIdMap[timeoutId] + + for (let i = startIndex; i <= stopIndex; i++) { + loadedRowsMap[i] = STATUS_LOADED + } + + this.setState({ + loadingRowCount: loadingRowCount - increment, + loadedRowCount: loadedRowCount + increment + }) + + promiseResolver() + }, 1000 + Math.round(Math.random() * 2000)) + + this._timeoutIdMap[timeoutId] = true + + let promiseResolver + + return new Promise(resolve => { + promiseResolver = resolve + }) + } + + _rowRenderer({ index, key, style }) { + const { list } = this.context + const { loadedRowsMap } = this.state + + const row = list.get(index) + let content + + if (loadedRowsMap[index] === STATUS_LOADED) { + content = row.name + } else { + content = ( +
    + ) + } + + return ( +
    + {content} +
    + ) + } +} + +export class ListExample extends PureComponent { + + constructor(props, context) { + super(props, context) + + this.state = { + listHeight: 300, + listRowHeight: 50, + overscanRowCount: 10, + rowCount: context.list.size, + scrollToIndex: undefined, + showScrollingPlaceholder: false, + useDynamicRowHeight: false + } + + this._getRowHeight = this._getRowHeight.bind(this) + this._noRowsRenderer = this._noRowsRenderer.bind(this) + this._onRowCountChange = this._onRowCountChange.bind(this) + this._onScrollToRowChange = this._onScrollToRowChange.bind(this) + this._rowRenderer = this._rowRenderer.bind(this) + } + + render() { + const { + listHeight, + listRowHeight, + overscanRowCount, + rowCount, + scrollToIndex, + showScrollingPlaceholder, + useDynamicRowHeight + } = this.state + + return ( + + {({ width }) => ( + + )} + + ) + } + + _getDatum(index) { + const { list } = this.context + + return list.get(index % list.size) + } + + _getRowHeight({ index }) { + return this._getDatum(index).size + } + + _noRowsRenderer() { + return ( +
    + No rows +
    + ) + } + + _onRowCountChange(event) { + const rowCount = parseInt(event.target.value, 10) || 0 + + this.setState({ rowCount }) + } + + _onScrollToRowChange(event) { + const { rowCount } = this.state + let scrollToIndex = Math.min(rowCount - 1, parseInt(event.target.value, 10)) + + if (isNaN(scrollToIndex)) { + scrollToIndex = undefined + } + + this.setState({ scrollToIndex }) + } + + _rowRenderer({ index, isScrolling, key, style }) { + const { + showScrollingPlaceholder, + useDynamicRowHeight + } = this.state + + if ( + showScrollingPlaceholder && + isScrolling + ) { + return ( +
    + Scrolling... +
    + ) + } + + const datum = this._getDatum(index) + + let additionalContent + + if (useDynamicRowHeight) { + switch (datum.size) { + case 75: + additionalContent =
    It is medium-sized.
    + break + case 100: + additionalContent =
    It is large-sized.
    It has a 3rd row.
    + break + } + } + + return ( +
    +
    + {datum.name.charAt(0)} +
    +
    +
    + {datum.name} +
    +
    + This is row {index} +
    + {additionalContent} +
    + {useDynamicRowHeight && + + {datum.size}px + + } +
    + ) + } +} + +import { + WindowScroller, + createMasonryCellPositioner as createCellPositioner, + Positioner, + Masonry, + MasonryCellProps +} from 'react-virtualized' + +export class GridExample2 extends PureComponent { + _columnCount: number; + _cache: CellMeasurerCache; + _columnHeights: any; + _width: number; + _height: number; + _scrollTop: number; + _cellPositioner?: Positioner; + _masonry: Masonry; + + constructor(props, context) { + super(props, context) + + this._columnCount = 0 + + this._cache = new CellMeasurerCache({ + defaultHeight: 250, + defaultWidth: 200, + fixedWidth: true + }) + + this._columnHeights = {} + + this.state = { + columnWidth: 200, + height: 300, + gutterSize: 10, + windowScrollerEnabled: false + } + + this._cellRenderer = this._cellRenderer.bind(this) + this._onResize = this._onResize.bind(this) + this._renderAutoSizer = this._renderAutoSizer.bind(this) + this._renderMasonry = this._renderMasonry.bind(this) + this._setMasonryRef = this._setMasonryRef.bind(this) + } + + render() { + const { + columnWidth, + height, + gutterSize, + windowScrollerEnabled + } = this.state + + let child + + if (windowScrollerEnabled) { + child = ( + + {this._renderAutoSizer} + + ) + } else { + child = this._renderAutoSizer({ height }) + } + + return ( +
    + {child} +
    + ) + } + + _calculateColumnCount() { + const { + columnWidth, + gutterSize + } = this.state + + this._columnCount = Math.floor(this._width / (columnWidth + gutterSize)) + } + + _cellRenderer({ index, key, parent, style }: MasonryCellProps) { + const { list } = this.context + const { columnWidth } = this.state + + const datum = list.get(index % list.size) + + return ( + +
    +
    + {datum.random} +
    + + ) + } + + _initCellPositioner() { + if (typeof this._cellPositioner === 'undefined') { + const { + columnWidth, + gutterSize + } = this.state + + this._cellPositioner = createCellPositioner({ + cellMeasurerCache: this._cache, + columnCount: this._columnCount, + columnWidth, + spacer: gutterSize + }) + } + } + + _onResize({ height, width }) { + this._width = width + + this._columnHeights = {} + this._calculateColumnCount() + this._resetCellPositioner() + this._masonry.recomputeCellPositions() + } + + _renderAutoSizer({ height, scrollTop }: { height: number, scrollTop?: number }) { + this._height = height + this._scrollTop = scrollTop + + return ( + + {this._renderMasonry} + + ) + } + + _renderMasonry({ width }) { + this._width = width + + this._calculateColumnCount() + this._initCellPositioner() + + const { height, windowScrollerEnabled } = this.state + + return ( + + ) + } + + _resetCellPositioner() { + const { + columnWidth, + gutterSize + } = this.state + + this._cellPositioner.reset({ + columnCount: this._columnCount, + columnWidth, + spacer: gutterSize + }) + } + + _setMasonryRef(ref) { + this._masonry = ref + } +} + +import { MultiGrid } from 'react-virtualized' + +const STYLE: React.CSSProperties = { + border: '1px solid #ddd', + overflow: 'hidden' +} +const STYLE_BOTTOM_LEFT_GRID: React.CSSProperties = { + borderRight: '2px solid #aaa', + backgroundColor: '#f7f7f7' +} +const STYLE_TOP_LEFT_GRID: React.CSSProperties = { + borderBottom: '2px solid #aaa', + borderRight: '2px solid #aaa', + fontWeight: 'bold' +} +const STYLE_TOP_RIGHT_GRID: React.CSSProperties = { + borderBottom: '2px solid #aaa', + fontWeight: 'bold' +} + +export class MultiGridExample extends PureComponent { + state + _onFixedColumnCountChange + _onFixedRowCountChange + _onScrollToColumnChange + _onScrollToRowChange + + constructor(props, context) { + super(props, context) + + this.state = { + fixedColumnCount: 2, + fixedRowCount: 1, + scrollToColumn: 0, + scrollToRow: 0 + } + + this._cellRenderer = this._cellRenderer.bind(this) + this._onFixedColumnCountChange = this._createEventHandler('fixedColumnCount') + this._onFixedRowCountChange = this._createEventHandler('fixedRowCount') + this._onScrollToColumnChange = this._createEventHandler('scrollToColumn') + this._onScrollToRowChange = this._createEventHandler('scrollToRow') + } + + render() { + return ( + + {({ width }) => ( + + )} + + ) + } + + _cellRenderer({ columnIndex, key, rowIndex, style }) { + return ( +
    + {columnIndex}, {rowIndex} +
    + ) + } + + _createEventHandler(property) { + return (event) => { + const value = parseInt(event.target.value, 10) || 0 + + this.setState({ + [property]: value + }) + } + } + + _createLabeledInput(property, eventHandler) { + const value = this.state[property] + + return ( + `` + ) + } +} + +import { ScrollSync } from 'react-virtualized' + +const LEFT_COLOR_FROM = hexToRgb('#471061') +const LEFT_COLOR_TO = hexToRgb('#BC3959') +const TOP_COLOR_FROM = hexToRgb('#000000') +const TOP_COLOR_TO = hexToRgb('#333333') + +function scrollbarSize() { return 42; } +export class GridExample3 extends PureComponent { + state + constructor(props, context) { + super(props, context) + + this.state = { + columnWidth: 75, + columnCount: 50, + height: 300, + overscanColumnCount: 0, + overscanRowCount: 5, + rowHeight: 40, + rowCount: 100 + } + + this._renderBodyCell = this._renderBodyCell.bind(this) + this._renderHeaderCell = this._renderHeaderCell.bind(this) + this._renderLeftSideCell = this._renderLeftSideCell.bind(this) + } + + render() { + const { + columnCount, + columnWidth, + height, + overscanColumnCount, + overscanRowCount, + rowHeight, + rowCount + } = this.state + + return ( + + + {({ clientHeight, clientWidth, onScroll, scrollHeight, scrollLeft, scrollTop, scrollWidth }) => { + const x = scrollLeft / (scrollWidth - clientWidth) + const y = scrollTop / (scrollHeight - clientHeight) + + const leftBackgroundColor = mixColors(LEFT_COLOR_FROM, LEFT_COLOR_TO, y) + const leftColor = '#ffffff' + const topBackgroundColor = mixColors(TOP_COLOR_FROM, TOP_COLOR_TO, x) + const topColor = '#ffffff' + const middleBackgroundColor = mixColors(leftBackgroundColor, topBackgroundColor, 0.5) + const middleColor = '#ffffff' + + return ( +
    +
    + +
    +
    + +
    +
    + + {({ width }) => ( +
    +
    + +
    +
    + +
    +
    + )} +
    +
    +
    + ) + }} +
    + ) + } + + _renderBodyCell({ columnIndex, key, rowIndex, style }) { + if (columnIndex < 1) { + return + } + + return this._renderLeftSideCell({ columnIndex, key, rowIndex, style }) + } + + _renderHeaderCell({ columnIndex, key, rowIndex, style }) { + if (columnIndex < 1) { + return + } + + return this._renderLeftHeaderCell({ columnIndex, key, rowIndex, style }) + } + + _renderLeftHeaderCell({ columnIndex, key, rowIndex, style }) { + return ( +
    + {`C${columnIndex}`} +
    + ) + } + + _renderLeftSideCell({ columnIndex, key, rowIndex, style }) { + return ( +
    + {`R${rowIndex}, C${columnIndex}`} +
    + ) + } +} + +function hexToRgb(hex) { + const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex) + return result ? { + r: parseInt(result[1], 16), + g: parseInt(result[2], 16), + b: parseInt(result[3], 16) + } : null +} + +/** + * Ported from sass implementation in C + * https://github.com/sass/libsass/blob/0e6b4a2850092356aa3ece07c6b249f0221caced/functions.cpp#L209 + */ +function mixColors(color1, color2, amount) { + const weight1 = amount + const weight2 = 1 - amount + + const r = Math.round(weight1 * color1.r + weight2 * color2.r) + const g = Math.round(weight1 * color1.g + weight2 * color2.g) + const b = Math.round(weight1 * color1.b + weight2 * color2.b) + + return { r, g, b } +} + +import { Column, Table, SortDirection, SortIndicator } from 'react-virtualized' + +export class TableExample extends PureComponent { + state; + context; + constructor(props, context) { + super(props, context) + + this.state = { + disableHeader: false, + headerHeight: 30, + height: 270, + hideIndexRow: false, + overscanRowCount: 10, + rowHeight: 40, + rowCount: 1000, + scrollToIndex: undefined, + sortBy: 'index', + sortDirection: SortDirection.ASC, + useDynamicRowHeight: false + } + + this._getRowHeight = this._getRowHeight.bind(this) + this._headerRenderer = this._headerRenderer.bind(this) + this._noRowsRenderer = this._noRowsRenderer.bind(this) + this._onRowCountChange = this._onRowCountChange.bind(this) + this._onScrollToRowChange = this._onScrollToRowChange.bind(this) + this._rowClassName = this._rowClassName.bind(this) + this._sort = this._sort.bind(this) + } + + render() { + const { + disableHeader, + headerHeight, + height, + hideIndexRow, + overscanRowCount, + rowHeight, + rowCount, + scrollToIndex, + sortBy, + sortDirection, + useDynamicRowHeight + } = this.state + + const { list } = this.context + const sortedList = this._isSortEnabled() + ? list + .sortBy(item => item[sortBy]) + .update(list => + sortDirection === SortDirection.DESC + ? list.reverse() + : list + ) + : list + + const rowGetter = ({ index }) => this._getDatum(sortedList, index) + + return ( +
    + + {({ width }) => ( + + {!hideIndexRow && + rowData.index + } + dataKey='index' + disableSort={!this._isSortEnabled()} + width={60} + /> + } + + cellData + } + flexGrow={1} + /> +
    + )} +
    +
    + ) + } + + _getDatum(list, index) { + return list.get(index % list.size) + } + + _getRowHeight({ index }) { + const { list } = this.context + + return this._getDatum(list, index).size + } + + _headerRenderer({ + columnData, + dataKey, + disableSort, + label, + sortBy, + sortDirection + }) { + return ( +
    + Full Name + {sortBy === dataKey && + + } +
    + ) + } + + _isSortEnabled() { + const { list } = this.context + const { rowCount } = this.state + + return rowCount <= list.size + } + + _noRowsRenderer() { + return ( +
    + No rows +
    + ) + } + + _onRowCountChange(event) { + const rowCount = parseInt(event.target.value, 10) || 0 + + this.setState({ rowCount }) + } + + _onScrollToRowChange(event) { + const { rowCount } = this.state + let scrollToIndex = Math.min(rowCount - 1, parseInt(event.target.value, 10)) + + if (isNaN(scrollToIndex)) { + scrollToIndex = undefined + } + + this.setState({ scrollToIndex }) + } + + _rowClassName({ index }) { + if (index < 0) { + return 'styles.headerRow' + } else { + return index % 2 === 0 ? 'styles.evenRow' : 'styles.oddRow' + } + } + + _sort({ sortBy, sortDirection }) { + this.setState({ sortBy, sortDirection }) + } + + _updateUseDynamicRowHeight(value) { + this.setState({ + useDynamicRowHeight: value + }) + } +} + +export class WindowScrollerExample extends PureComponent { + state; + context; + _windowScroller: WindowScroller; + + constructor(props) { + super(props) + + this.state = { + showHeaderText: true + } + + this._hideHeader = this._hideHeader.bind(this) + this._rowRenderer = this._rowRenderer.bind(this) + this._onCheckboxChange = this._onCheckboxChange.bind(this) + this._setRef = this._setRef.bind(this) + } + + render() { + const { list, isScrollingCustomElement, customElement } = this.context + const { showHeaderText } = this.state + + return ( + +
    + + {({ height, isScrolling, scrollTop }) => ( + + {({ width }) => ( + this._rowRenderer({ index, isScrolling, isVisible, key, style })} + scrollTop={scrollTop} + width={width} + /> + )} + + )} + +
    + ) + } + + _hideHeader() { + const { showHeaderText } = this.state + + this.setState({ + showHeaderText: !showHeaderText + }, () => { + this._windowScroller.updatePosition() + }) + } + + _rowRenderer({ index, isScrolling, isVisible, key, style }) { + const { list } = this.context + const row = list.get(index) + + return ( +
    + {row.name} +
    + ) + } + + _setRef(windowScroller) { + this._windowScroller = windowScroller + } + + _onCheckboxChange(event) { + this.context.setScrollingCustomElement(event.target.checked) + } +} From cdf5c838139547d8e6c83b1f5506c84dbf568681 Mon Sep 17 00:00:00 2001 From: kao Date: Sun, 14 May 2017 23:57:50 +0200 Subject: [PATCH 0128/1072] bumped version number --- types/react-virtualized/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-virtualized/index.d.ts b/types/react-virtualized/index.d.ts index 8b017687f0..c1586de906 100644 --- a/types/react-virtualized/index.d.ts +++ b/types/react-virtualized/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-virtualized 9.5 +// Type definitions for react-virtualized 9.7 // Project: https://github.com/bvaughn/react-virtualized // Definitions by: Kalle Ott // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 65546a38d589500655d978f0d5697129ea864973 Mon Sep 17 00:00:00 2001 From: kao Date: Mon, 15 May 2017 00:15:15 +0200 Subject: [PATCH 0129/1072] fixed linting errors --- types/react-virtualized/dist/es/Grid.d.ts | 4 +-- types/react-virtualized/dist/es/Table.d.ts | 2 +- .../react-virtualized-tests.tsx | 34 +++++++++---------- types/react-virtualized/tslint.json | 3 +- 4 files changed, 22 insertions(+), 21 deletions(-) diff --git a/types/react-virtualized/dist/es/Grid.d.ts b/types/react-virtualized/dist/es/Grid.d.ts index d8280de004..66801c4592 100644 --- a/types/react-virtualized/dist/es/Grid.d.ts +++ b/types/react-virtualized/dist/es/Grid.d.ts @@ -249,8 +249,8 @@ export type GridCoreProps = { */ rowHeight: number | ((params: Index) => number); /** - * Number of rows in grid. - */ + * Number of rows in grid. + */ rowCount: number; /** Wait this amount of time after the last scroll event before resetting Grid `pointer-events`. */ scrollingResetTimeInterval?: number; diff --git a/types/react-virtualized/dist/es/Table.d.ts b/types/react-virtualized/dist/es/Table.d.ts index 8e0f6c4464..7e23446fc4 100644 --- a/types/react-virtualized/dist/es/Table.d.ts +++ b/types/react-virtualized/dist/es/Table.d.ts @@ -289,7 +289,7 @@ export type TableProps = GridCoreProps & { export const defaultTableCellDataGetter: TableCellDataGetter; export const defaultTableCellRenderer: TableCellRenderer; -export const defaultTableHeaderRenderer: () => Array>; +export const defaultTableHeaderRenderer: () => React.ReactElement[]; export const defaultTableHeaderRowRenderer: TableHeaderRowRenderer; export const defaultTableRowRenderer: TableRowRenderer; diff --git a/types/react-virtualized/react-virtualized-tests.tsx b/types/react-virtualized/react-virtualized-tests.tsx index ad413978ee..8fc22e1cb7 100644 --- a/types/react-virtualized/react-virtualized-tests.tsx +++ b/types/react-virtualized/react-virtualized-tests.tsx @@ -358,7 +358,7 @@ export class ColumnSizerExample extends PureComponent { render() { const { - columnMaxWidth, + columnMaxWidth, columnMinWidth, columnCount } = this.state @@ -486,7 +486,7 @@ export class GridExample extends PureComponent { render() { const { - columnCount, + columnCount, height, overscanColumnCount, overscanRowCount, @@ -816,7 +816,7 @@ export class ListExample extends PureComponent { render() { const { - listHeight, + listHeight, listRowHeight, overscanRowCount, rowCount, @@ -882,9 +882,9 @@ export class ListExample extends PureComponent { _rowRenderer({ index, isScrolling, key, style }) { const { - showScrollingPlaceholder, + showScrollingPlaceholder, useDynamicRowHeight - } = this.state + } = this.state if ( showScrollingPlaceholder && @@ -996,11 +996,11 @@ export class GridExample2 extends PureComponent { render() { const { - columnWidth, + columnWidth, height, gutterSize, windowScrollerEnabled - } = this.state + } = this.state let child @@ -1023,9 +1023,9 @@ export class GridExample2 extends PureComponent { _calculateColumnCount() { const { - columnWidth, + columnWidth, gutterSize - } = this.state + } = this.state this._columnCount = Math.floor(this._width / (columnWidth + gutterSize)) } @@ -1129,9 +1129,9 @@ export class GridExample2 extends PureComponent { _resetCellPositioner() { const { - columnWidth, + columnWidth, gutterSize - } = this.state + } = this.state this._cellPositioner.reset({ columnCount: this._columnCount, @@ -1278,14 +1278,14 @@ export class GridExample3 extends PureComponent { render() { const { - columnCount, + columnCount, columnWidth, height, overscanColumnCount, overscanRowCount, rowHeight, rowCount - } = this.state + } = this.state return ( @@ -1502,7 +1502,7 @@ export class TableExample extends PureComponent { render() { const { - disableHeader, + disableHeader, headerHeight, height, hideIndexRow, @@ -1513,7 +1513,7 @@ export class TableExample extends PureComponent { sortBy, sortDirection, useDynamicRowHeight - } = this.state + } = this.state const { list } = this.context const sortedList = this._isSortEnabled() @@ -1596,13 +1596,13 @@ export class TableExample extends PureComponent { } _headerRenderer({ - columnData, + columnData, dataKey, disableSort, label, sortBy, sortDirection - }) { + }) { return (
    Full Name diff --git a/types/react-virtualized/tslint.json b/types/react-virtualized/tslint.json index a28671ebce..1b94f68dea 100644 --- a/types/react-virtualized/tslint.json +++ b/types/react-virtualized/tslint.json @@ -7,6 +7,7 @@ ], "prefer-method-signature": false, "prefer-declare-function": false, - "no-padding": false + "no-padding": false, + "array-type": [true, "array"] } } From 92c71c210a87f1f585456a086f367deedeced0b1 Mon Sep 17 00:00:00 2001 From: kao Date: Mon, 15 May 2017 00:18:43 +0200 Subject: [PATCH 0130/1072] fixed another indentation error --- types/react-virtualized/react-virtualized-tests.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/react-virtualized/react-virtualized-tests.tsx b/types/react-virtualized/react-virtualized-tests.tsx index 8fc22e1cb7..504a6e2c17 100644 --- a/types/react-virtualized/react-virtualized-tests.tsx +++ b/types/react-virtualized/react-virtualized-tests.tsx @@ -1068,9 +1068,9 @@ export class GridExample2 extends PureComponent { _initCellPositioner() { if (typeof this._cellPositioner === 'undefined') { const { - columnWidth, + columnWidth, gutterSize - } = this.state + } = this.state this._cellPositioner = createCellPositioner({ cellMeasurerCache: this._cache, From 5fa869b36c7de1516706554594d3b6b58c3a717f Mon Sep 17 00:00:00 2001 From: kao Date: Mon, 15 May 2017 00:25:22 +0200 Subject: [PATCH 0131/1072] fixed type of send data --- types/micro/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/micro/index.d.ts b/types/micro/index.d.ts index b2ad7c5460..de528167c2 100644 --- a/types/micro/index.d.ts +++ b/types/micro/index.d.ts @@ -13,7 +13,7 @@ export const run: (req: IncomingMessage, res: ServerResponse, fn: RequestHandler declare const serve: (fn: RequestHandler) => Server export default serve; -export const send: (res: ServerResponse, code: number, obj?: object) => Promise +export const send: (res: ServerResponse, code: number, data?: any) => Promise export const sendError: (req: IncomingMessage, res: ServerResponse, info: { statusCode?: number, status?: number, message?: string, stack?: string }) => Promise From 580597113e19bb5c4d67a9824836f49b13b5a305 Mon Sep 17 00:00:00 2001 From: Vinicius Fortuna Date: Sun, 14 May 2017 21:20:17 -0400 Subject: [PATCH 0132/1072] Add test for restify.CORS() --- types/restify/restify-tests.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/types/restify/restify-tests.ts b/types/restify/restify-tests.ts index 34db48ba0a..15eb8eb868 100644 --- a/types/restify/restify-tests.ts +++ b/types/restify/restify-tests.ts @@ -254,6 +254,11 @@ server.use(restify.queryParser()); server.use(restify.jsonp()); server.use(restify.gzipResponse()); server.use(restify.bodyParser()); +server.use(restify.CORS({ + origins: ['https://foo.com', 'http://bar.com', 'http://baz.com:8081'], + credentials: true, + headers: ['x-foo'] +})); server.use(restify.throttle({ burst: 100, rate: 50, From 5cf5e83b797e841dbcf0c9da4994b4dded98483e Mon Sep 17 00:00:00 2001 From: Konrad Mattheis Date: Mon, 15 May 2017 03:45:57 +0200 Subject: [PATCH 0133/1072] add qlik-engineapi as typescript definition Signed-off-by: Konrad Mattheis --- qlik-engineapi/index.d.ts | 2293 ++++++++++++++++++++++++ qlik-engineapi/qlik-engineapi-tests.ts | 0 qlik-engineapi/tsconfig.json | 23 + qlik-engineapi/tslint.json | 8 + 4 files changed, 2324 insertions(+) create mode 100644 qlik-engineapi/index.d.ts create mode 100644 qlik-engineapi/qlik-engineapi-tests.ts create mode 100644 qlik-engineapi/tsconfig.json create mode 100644 qlik-engineapi/tslint.json diff --git a/qlik-engineapi/index.d.ts b/qlik-engineapi/index.d.ts new file mode 100644 index 0000000000..4baf80e8fe --- /dev/null +++ b/qlik-engineapi/index.d.ts @@ -0,0 +1,2293 @@ +// Type definitions for qlik-engineapi 3.2 +// Project: http://help.qlik.com/en-US/sense-developer/3.2/Subsystems/EngineAPI/Content/introducing-engine-API.htm +// Definitions by: Konrad Mattheis +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare namespace EngineAPI { + type CommandType = "JsonRequest" | "GetCustomCaption" | "IsConnected" | "DisableQlikViewSelectButton" | "HaveStarField"; + type LogonType = "LOG_ON_SERVICE_USER" | "LOG_ON_CURRENT_USER"; + type NxGrpType = "N" | "H" | "C" | string; + type FieldAttributesType = "U" | "A" | "I" | "R" | "F" | "M" | "D" | "T" | "TS" | "IV"; + type FileDataFormatType = "CSV" | "FIX" | "DIF" | "EXCEL_BIFF" | "EXCEL_OOXML" | "HTML" | "XML" | "QVX" | "JSON" | "KML"; + type TableRecordKeyType = "NOT_KEY" | "ANY_KEY" | "PRIMARY_KEY" | "PERFECT_KEY"; + type ContextType = "Cleared" | "LockedFieldsOnly" | "CurrentSelections"; + type SearchObjectsGroupType = "DatasetType" | "GenericObjectsType"; + type SearchObjectsItemType = "0" | "1"; + type NxPatchOpType = "Add" | "Remove" | "Replace"; + type FileType = "CSV_C" | "CSV_T" | "OOXML"; + type ExportStateType = "P" | "A"; + type ReductionModeType = "N" | "D1" | "S" | "C" | "ST"; + type FieldDefExType = "0" | "1" | "2"; + type FolderItemType = "FOLDER" | "FILE" | "OTHER"; + type NxCellStateType = "L" | "S" | "O" | "D" | "A" | "X" | "XS" | "XL"; + type NxCellType = "V" | "E" | "N" | "T" | "P" | "R" | "U"; + type NxSelectionCellType = "D" | "T" | "L"; + type SortIndicatorType = "N" | "A" | "D"; + type OtherModeType = "OTHER_OFF" | "OTHER_COUNTED" | "OTHER_ABS_LIMITED" | "OTHER_ABS_ACC_TARGET" | "OTHER_REL_LIMITED" | "OTHER_REL_ACC_TARGET"; + type OtherLimitModeType = "OTHER_GE_LIMIT" | "OTHER_LE_LIMIT" | "OTHER_GT_LIMIT" | "OTHER_LT_LIMIT"; + type OtherSortModeType = "OTHER_SORT_DEFAULT" | "OTHER_SORT_DESCENDING" | "OTHER_SORT_ASCENDING"; + type TotalModeType = "TOTAL_OFF" | "TOTAL_EXPR"; + type BnfType = "S" | "E"; + type MTType = "N" | "D" | "R"; + type MachineModeType = "CONNECT_DEFAULT" | "CONNECT_64" | "CONNECT_32"; + type InteractionType = "IT_SCRIPTLINE" | "IT_MSGBOX" | "IT_BREAK" | "IT_END"; + type ErrorDataCodeType = "0" | "1" | "2"; + type FunctionGroupType = "ALL" | "U" | "NONE" | "AGGR" | "NUM" | "RNG" | "EXP" | "TRIG" | "FIN" | "MATH" | "COUNT" | "STR" | "MAPP" | + "RCRD" | "CND" | "LOG" | "NULL" | "SYS" | "FILE" | "TBL" | "DATE" | "NUMI" | "FRMT" | "CLR" | "RNK"; + type DimensionType = "D" | "N" | "T"; + type NxHypercubeMode = "P" | "K" | "S" | string; + type FrequencyModeType = "NX_FREQUENCY_NONE" | "NX_FREQUENCY_VALUE" | "NX_FREQUENCY_PERCENT" | "NX_FREQUENCY_RELATIVE"; + + type TypeSortDirection = "1" | "-1" | "0"; + + interface INxRange { + qCount: number; + qFrom: number; + } + + interface IExpressionResult { + qBadFieldNames: INxRange[]; + } + + interface ICheckExpressionResult extends IExpressionResult { + qDangerousFieldNames: INxRange[]; + qErrorMsg: string; + } + + interface ICheckNumberOrExpressionResult extends IExpressionResult { + qErrorMsg: string; + } + + interface IScriptSyntaxError { + qErrLen: number; + qTabIx: number; + qLineInTab: number; + qColInLine: number; + qTextPos: number; + qSecondaryFailure: boolean; + } + + interface INxMeta { + qName?: string; + } + + interface INxMetaTitleDescription extends INxMeta { + title: string; + description: string; + } + + interface INxMetaTitleDescriptionTag extends INxMetaTitleDescription { + tags: string[]; + } + + interface IConnection { + qId: string; + qName: string; + qConnectionString: string; + qType: string; + qUserName: string; + qPassword: string; + qModifiedDate: string; + qMeta: INxMeta; + qLogOn: LogonType; + } + + interface INxLibraryDimensionDef { + qGrouping: NxGrpType; + qFieldDefs: string[]; + qFieldLabels: string[]; + } + + interface IGenericProperties { + qInfo: INxInfo; + + //?Dynamic properties? + [qMetaDef: string]: any; + } + + interface IGenericBookmarkProperties extends IGenericProperties { + } + + interface IGenericDimensionProperties extends IGenericProperties { + qDim: INxLibraryDimensionDef; + } + + interface IGenericMeasureProperties extends IGenericProperties { + qMeasure: INxLibraryMeasureDef; + } + + interface IGenericObjectProperties extends IGenericProperties { + qExtendsId?: string; + } + + interface IGenericVariableProperties extends IGenericProperties { + qName: string; + qComment: string; + qNumberPresentation: IFieldAttributes; + qIncludeInBookmark: boolean; + qDefinition: string; + } + + interface IFieldAttributes { + qType: FieldAttributesType; + qnDec: number; + qUseThou: boolean; + qFmt: string; + qDec: string; + qThou: string; + qSAFEARRAY: any[]; + } + + interface INxInfo { + qId?: string; + qType: string; + } + + interface IDoReloadExParams { + qMode: number; + qPartial: boolean; + qDebug: boolean; + } + + interface IDoReloadExResult { + qSuccess: boolean; + qScriptLogFile: string; + } + + interface IFieldValue { + qText: string; + qIsNumeric: boolean; + qNumber: number; + } + + interface INxMatchingFieldInfo { + qName: string; + qTags: string[]; + } + + interface INxAppLayout { + qTitle: string; + qFileName: string; + qLastReloadTime: string; + qModified: boolean; + qHasScript: boolean; + qStateNames: string[]; + qMeta: INxMeta; + qLocaleInfo: ILocaleInfo; + qHasData: boolean; + qReadOnly: boolean; + qIsOpenedWithoutData: boolean; + qThumbnail: IStaticContentUrl; + } + + interface INxAppProperties { + qTitle: string; + qLastReloadTime: string; + qThumbnail: IStaticContentUrlDef; + qMigrationHash: string; + qSavedInProductVersion: string; + } + + interface IAssociationScore { + qFieldPairName: string; + qScoreSummary: number; + qField1Scores: IFieldScores; + qField2Scores: IFieldScores; + } + + interface IFieldScores { + qFieldName: string; + qCardinalRatio: number; + qSymbolScore: number; + qRowScore: number; + } + + interface IContentLibraryListItem { + qName: string; + qAppSpecific: boolean; + qMeta: INxMeta; + } + + interface IContentLibraryList { + qItems: IContentLibraryListItem; + } + + interface IDatabaseInfo { + qDBMSName: string; + qDBUsage: boolean; + qOwnerUsage: boolean; + qDBSeparator: string; + qOwnerSeparator: string; + qDBFirst: boolean; + qQuotePreffix: string; + qQuoteSuffix: string; + qSpecialChars: string; + qDefaultDatabase: string; + qKeywords: string[]; + } + + interface IDatabaseOwner { + qName: string; + } + + interface IDatabase { + qName: string; + qIsDefault: boolean; + } + + interface IDataField { + qName: string; + qIsKey: boolean; + qOriginalFieldName: string; + } + + interface IDataRecord { + qValues: string[]; + } + + interface IDataTable { + qName: string; + qType: string; + } + + interface IFieldDescription { + qInternalNumber: number; + qName: string; + qSrcTables: string[]; + qIsSystem?: boolean; + qIsHidden?: boolean; + qIsSemantic?: boolean; + qDistinctOnly?: boolean; + qCardinal: number; + qTotalCount: number; + qIsLocked?: boolean; + qAlwaysOneSelected?: boolean; + qAndMode?: boolean; + qIsNumeric?: boolean; + qComment: string; + qTags: string[]; + qIsDefinitionOnly?: boolean; + } + + interface IDelimiterInfo { + qName: string; + qScriptCode: string; + qNumber: number; + qIsMultiple: boolean; + } + + interface IFileDataFormat { + qType: FileDataFormatType; + qLabel: string; + qQuote: string; + qComment: string; + qDelimiter: IDelimiterInfo; + qCodePage: number; + qHeaderSize: number; + qRecordSize: number; + qTabSize: number; + qIgnoreEOF: boolean; + qFixedWidthDelimiters: string; + } + + interface IDataTableEx { + qName: string; + qFields: IDataField[]; + qFormatSpec: string; + } + + interface IFolderItem { + qName: string; + qType: FolderItemType; + } + + interface IStaticContentList { + qItems: IStaticContentListItem; + } + + interface IStaticContentListItem { + qUrlDef: string; + qUrl: string; + } + + interface IStaticContentUrl { + qUrl: string; + } + + interface IStaticContentUrlDef { + qUrl: string; + } + + interface ICalenderStrings { + qDayNames: string[]; + qMonthNames: string[]; + qLongDayNames: string[]; + qLongMonthNames: string[]; + } + + interface ILocaleInfo { + qDecimalSep: string; + qThousandSep: string; + qListSep: string; + qMoneyDecimalSep: string; + qMoneyThousandSep: string; + qCurrentYear: number; + qMoneyFmt: string; + qTimeFmt: string; + qDateFmt: string; + qTimestampFmt: string; + qCalendarStrings: ICalenderStrings; + qFirstWeekDay: boolean; + qBrokenWeeks: number; + qReferenceDay: number; + qFirstMonthOfYear: number; + qCollation: string; + } + + interface IMediaListItem { + qUrlDef: string; + qUrl: string; + } + + interface IMediaList { + qItems: IMediaListItem[]; + } + + interface IEditorBreakpoint { + qbufferName: string; + qlineIx: number; + qEnabled: boolean; + } + + interface ITableRow { + vqValue: IFieldValue[]; + } + + interface ISize { + qcx: number; + qcy: number; + } + + interface IDerivedFieldsInTableData { + qDefinitionName: string; + qTags: string[]; + qActive: boolean; + } + + interface IFieldInTableData { + qName: string; + qOriginalFields: string[]; + qPresent: boolean; + qHasNull: boolean; + qHasWild: boolean; + qHasDuplicates: boolean; + qIsSynthetic: boolean; + qInformationDensity: number; + qnNonNulls: number; + qnRows: number; + qSubsetRatio: number; + qnTotalDistinctValues: number; + qnPresentDistinctValues: number; + qKeyType: TableRecordKeyType; + qComment: string; + qTags: string[]; + qDerivedFields: IDerivedFieldsInTableData; + } + + interface IPoint { + qx: number; + qy: number; + } + + interface ITableRecord { + qName: string; + qLoose: boolean; + qNoOfRows: number; + qFields: IFieldInTableData[]; + qPos: IPoint; + qComment: string; + qIsDirectDiscovery: boolean; + qIsSynthetic: boolean; + } + + interface ISourceKeyRecord { + qKeyFields: string[]; + qTables: string[]; + } + + interface ITextMacro { + qTag: string; + qRefSeqNo: number; + qSetSeqNo: number; + qDisplayString: string; + qIsSystem: boolean; + qIsReserved: boolean; + } + + interface IRect { + qLeft: number; + qTop: number; + qWidth: number; + qHeight: number; + } + + interface ITableViewTableWinSaveInfo { + qPos: IRect; + qCaption: string; + } + + interface ITableViewBroomPointSaveInfo { + qPos: IPoint; + qTable: string; + qFields: string[]; + } + + interface ITableViewConnectionPointSaveInfo { + qPos: IPoint; + qFields: string[]; + } + + interface ITableViewSaveInfo { + qTables: ITableViewTableWinSaveInfo[]; + qBroomPoints: ITableViewBroomPointSaveInfo[]; + qConnectionPoints: ITableViewConnectionPointSaveInfo[]; + qZoomFactor: number; + } + + interface ITableViewCtlSaveInfo { + qInternalView: ITableViewSaveInfo; + qSourceView: ITableViewSaveInfo; + } + + interface ITableViewDlgSaveInfo { + qPos: IRect; + qCtlInfo: ITableViewCtlSaveInfo; + qMode: number; + } + + interface ISearchCombinationOptions { + qSearchFields: string[]; + qContext: ContextType; + } + + interface ISearchGroupOptions { + qGroupType: any; + qOffset: number; + qCount: number; + } + + interface ISearchGroupItemOptions { + qGroupItemType: IGenericObject; + qOffset: number; + qCount: number; + } + + interface ISearchPage { + qOffset: number; + qCount: number; + qMaxNbrFieldMatches: number; + qGroupOptions: ISearchGroupOptions[]; + qGroupItemOptions: ISearchGroupItemOptions[]; + } + + interface ISearchFieldDictionary { + qField: number; + qResult: ISearchTermResult[]; + } + + interface ISearchCharRange { + qCharPos: number; + qCharCount: number; + qTerm: number; + } + + interface ISearchTermResult { + qText: string; + qElemNumber: number; + qRanges: ISearchCharRange[]; + } + + interface ISearchMatchCombinations { + qSearchMatchCombinations: ISerachMatchCombination[]; + } + + interface ISerachMatchCombination { + qId: number; + qFieldMatches: ISerachFieldMatch[]; + } + + interface ISerachFieldMatch { + qField: number; + qValues: number[]; + qTerms: number[]; + qNoOfMatches: number; + } + + interface ISearchAssociationResult { + qFieldNames: string[]; + qSearchTerms: string[]; + qFieldDictionaries: ISearchFieldDictionary[]; + qSearchTermsMatched: ISearchMatchCombinations[]; + qTotalSearchResults: number; + } + + interface ISearchObjectOptions { + qAttributes: string[]; + } + + interface ISearchAttribute { + qKey: string; + qValue: string; + } + + interface ISearchGroupItemMatch { + qText: string; + qAttributes: ISearchAttribute[]; + qRanges: ISearchCharRange[]; + } + + interface ISearchGroupItem { + qItemType: SearchObjectsItemType; + qTotalNumberOfMatches: number; + qIdentifier: string; + qItemMatches: ISearchGroupItemMatch[]; + qSearchTermsMatched: number[]; + } + + interface ISearchGroup { + qId: number; + qGroupType: SearchObjectsGroupType; + qSearchTermsMatched: number[]; + qTotalNumberOfItems: number; + qItems: ISearchGroupItem[]; + } + + interface ISearchResult { + qSearchTerms: string[]; + qTotalNumberOfGroups: number; + qSearchGroupArray: ISearchGroup; + } + + interface ISearchSuggestItem { + qValue: string; + qTerm: number; + } + + interface ISearchSuggestionResult { + qSuggestions: ISearchSuggestItem[]; + qFieldNames: string[]; + } + + interface IApp { + global: IGlobal; + + abortModal(qAccept: boolean): Promise; + addAlternateState(qStateName: string): Promise; + addFieldFromExpression(qName: string, qExpr: string): Promise; + applyBookmark(qId: string): Promise; + backCount(): Promise; + back(): Promise; + checkExpression(qExpr: string, qLabels?: string[]): Promise; + checkNumberOrExpression(qExpr: string): Promise; + checkScriptSyntax(): Promise; + clearAll(qLockedAlso: boolean, qStateName?: string): Promise; + clearUndoBuffer(): Promise; + cloneBookmark(qId: string): Promise; + cloneDimension(qId: string): Promise; + cloneMeasure(qId: string): Promise; + cloneObject(qId: string): Promise; + commitDraft(qId: string): Promise; + createBookmark(qProp: IGenericBookmarkProperties): Promise; + createConnection(qConnection: IConnection): Promise; + createDimension(qProp: IGenericDimensionProperties): Promise; + createDraft(qId: string): Promise; + createMeasure(qProp: IGenericMeasureProperties): Promise; + createObject(qProp: IGenericObjectProperties): Promise; + createSessionObject(qProp: IGenericObjectProperties): Promise; + createSessionVariable(qProp: IGenericVariableProperties): Promise; + createVariable(qName: string): Promise; + createVariableEx(qProp: IGenericVariableProperties): Promise; + deleteConnection(qConnectionId: string): Promise; + destroyBookmark(qId: string): Promise; + destroyDimension(qId: string): Promise; + destroyDraft(qId: string, qSourceId: string): Promise; + destroyMeasure(qId: string): Promise; + destroyObject(qId: string): Promise; + destroySessionObject(qId: string): Promise; + destroySessionVariable(qId: string): Promise; + destroyVariableById(qId: string): Promise; + destroyVariableByName(qName: string): Promise; + doReload(qMode?: number, qPartial?: boolean, qDebug?: boolean): Promise; + doReloadEx(qParams?: IDoReloadExParams): Promise; + doSave(qFileName?: string): Promise; + evaluate(qExpression: string): Promise; + evaluateEx(qExpression: string): Promise; + findMatchingFields(qFieldName: string, qTags: string[]): Promise; + forward(): Promise; + forwardCount(): Promise; + getAllInfos(): Promise; + getAppLayout(): Promise; + getAppProperties(): Promise; + getAssociationScores(qTable1: string, qTable2: string): Promise; + getBookmark(qId: string): Promise; + getConnection(qConnectionId: string): Promise; + getConnections(): Promise; + getContentLibraries(): Promise; + getDatabaseInfo(qConnectionId: string): Promise; + getDatabaseOwners(qConnectionId: string, qDatabase?: string): Promise; + getDatabases(qConnectionId: string): Promise; + getDatabaseTableFields(qConnectionId: string, qTable: string, qDatabase?: string, qOwner?: string): Promise; + getDatabaseTablePreview(qConnectionId: string, qTable: string, qDatabase?: string, qOwner?: string): Promise; + getDatabaseTables(qConnectionId: string, qDatabase?: string, qOwner?: string): Promise; + getDimension(qId: string): Promise; + getEmptyScript(qLocalizedMainSection?: string): Promise; + getFavoriteVariables(): Promise; + getFieldDescription(qFieldName: string): Promise; + getField(qFieldName: string, qStateName?: string): Promise; + getFileTableFields(qConnectionId: string, qDataFormat: IFileDataFormat, qTable: string, qRelativePath?: string): Promise | Promise; + getFileTablePreview(qConnectionId: string, qRelativePath: string, qDataFormat: IFileDataFormat, qTable: string): Promise | Promise; + getFileTablesEx(qConnectionId: string, qRelativePath: string, qDataFormat: IFileDataFormat): Promise; + getFileTables(qConnectionId: string, qRelativePath: string, qDataFormat: IFileDataFormat): Promise; + getFolderItemsForConnection(qConnectionId: string, qRelativePath: string): Promise; + getIncludeFileContent(qLibPath: string): Promise; + getLibraryContent(qName: string): Promise; + getLocaleInfo(): Promise; + getLooselyCoupledVector(): Promise; + getMatchingFields(qTags: string[], qMatchingFieldMode?: boolean): Promise; + getMediaList(): Promise | Promise; + getMeasure(qId: string): Promise; + getObject(qId: string): Promise; + getProperties(): Promise; + getScriptBreakpoints(): Promise; + getScript(): Promise; + getTableData(qOffset: number, qRows: number, qSyntheticMode: boolean, qTableName: string): Promise; + getTablesAndKeys(qWindowSize: ISize, qNullSize: ISize, qCellHeight: number, qSyntheticMode: boolean, qIncludeSysVars: boolean): Promise | Promise; + getTextMacros(): Promise; + getVariable(qName: string): Promise; + getVariableById(qId: string): Promise; + getVariableByName(qName: string): Promise; + getViewDlgSaveInfo(): Promise; + guessFileType(qConnectionId: string, qRelativePath: string): Promise; + lockAll(qStateName: string): Promise; + modifyConnection(qConnectionId: string, qConnection: IConnection, qOverrideCredentials: boolean): Promise; + publish(qStreamId: string, qName: string): Promise; + redo(): Promise; + removeAlternateState(qStateName: string): Promise; + removeVariable(qName: string): Promise; + resume(): Promise; + saveObjects(): Promise; + searchAssociations(qOptions: ISearchCombinationOptions, qTerms: string[], qPage: ISearchPage): Promise; + searchObjects(qOptions: ISearchObjectOptions, qTerms: string[], qPage: ISearchPage): Promise; + searchResults(qOptions: ISearchCombinationOptions, qTerms: string[], qPage: ISearchPage): Promise; + searchSuggest(qOptions: ISearchCombinationOptions, qTerms: string[]): Promise; + selectAssociations(qOptions: ISearchCombinationOptions, qTerms: string[], qMatchIx: number, qSoftLock: boolean): Promise; + sendGenericCommandToCustomConnector(qProvider: string, qCommand: CommandType, qMethod: string, qParameters: string[], qAppendConnection: string[]): Promise; + /** + * Sets properties to an app. + * @param {Number} qProp - Information about the properties of an app. / NxAppProperties + * @return {Promise} + */ + setAppProperties(qProp: INxAppProperties): Promise; + setFavoriteVariables(qNames: string[]): Promise; + setFetchLimit(qLimit: number): Promise; + setLooselyCoupledVector(qv: number[]): Promise; + setScriptBreakpoints(qBreakpoints: IEditorBreakpoint[]): Promise; + setScript(qScript: string): Promise; + setViewDlgSaveInfo(qInfo: ITableViewDlgSaveInfo): Promise; + undo(): Promise; + unlockAll(qStateName: string): Promise; + unPublish(): Promise; + } + + interface INxFieldProperties { + qOneAndOnlyOne: boolean; + } + + interface IField { + clearAllButThis(qSoftLock?: boolean): Promise; + clear(): Promise; + getAndMode(): Promise; + getCardinal(): Promise; + getNxProperties(): Promise; + lock(): Promise; + lowLevelSelect(qValues: number[], qToggleMode: boolean, qSoftLock?: boolean): Promise; + selectAll(qSoftLock?: boolean): Promise; + selectAlternative(qSoftLock?: boolean): Promise; + selectExcluded(qSoftLock?: boolean): Promise; + select(qMatch: string, qSoftLock?: boolean, qExcludedValuesMode?: number): Promise; + selectPossible(qSoftLock?: boolean): Promise; + selectValues(qFieldValues: IFieldValue[], qToggleMode?: boolean, qSoftLock?: boolean): Promise; + setAndMode(qAndMode: boolean): Promise; + setNxProperties(qProperties: INxFieldProperties): Promise; + toggleSelect(qMatch: string, qSoftLock?: boolean, qExcludedValuesMode?: number): Promise; + unlock(): Promise; + } + + interface INxPatch { + qOp: NxPatchOpType; + qPath: string; + qValue: string; + } + + interface IAlternateStateData { + qStateName: string; + qFieldItems: IBookmarkFieldItem[]; + } + + interface IBookmarkVariableItem { + qName: string; + qValue: IFieldValue; + } + + interface IBookmarkFieldItem { + qDef: IFieldDefEx; + qLocked: boolean; + qSelectInfo: ISelectInfo; + qValues: IFieldValue[]; + qExcludedValues: IFieldValue[]; + qAndMode: boolean; + qOneAndOnlyOne: boolean; + } + + interface IFieldDefEx { + qName: string; + qType: FieldDefExType; + } + + interface ISelectInfo { + qTextSearch: string; + qRangeLo: number; + qRangeHi: number; + qNumberFormat: IFieldAttributes; + qRangeInfo: INxRangeSelectInfo[]; + qContinuousRangeInfo: IRange[]; + } + + interface INxBookmark { + qStateData: IAlternateStateData[]; + qUtcModifyTime: number; + qVariableItems: IBookmarkVariableItem[]; + } + + interface IGenericBaseLayout { + qInfo: INxInfo; + qMeta: INxMeta; + } + + interface IGenericBookmarkLayout extends IGenericBaseLayout { + qMeta: INxMetaTitleDescription; + qBookmark: INxBookmark; + } + + interface IGenericBookmark { + apply(): Promise; + applyPatches(qPatches: INxPatch[]): Promise; + getInfo(): Promise; + getLayout(): Promise; + getProperties(): Promise; + publish(): Promise; + setProperties(qProp: IGenericBookmarkProperties): Promise; + unPublish(): Promise; + } + + interface IGenericBookmarkEntry { + qProperties: IGenericBookmarkProperties; + qBookmark: INxBookmark; + } + + interface IGenericDimensionInfo { + qApprMaxGlyphCount: number; + qCardinal: number; + qTags: string[]; + qIsSemantic: boolean; + qAndMode: boolean; + } + + interface IGenericDimensionLayout extends IGenericBaseLayout { + qDim: INxLibraryMeasureDef; + qDimInfos: IGenericDimensionInfo[]; + } + + interface INxLinkedObjectInfo { + qRootId: string; + qInfo: INxInfo; + } + + interface IGenericDimension { + applyPatches(qPatches: INxPatch[]): Promise; + getDimension(): Promise; + getInfo(): Promise; + getLayout(): Promise; + getLinkedObjects(): Promise; + getProperties(): Promise; + publish(): Promise; + setProperties(): Promise; + unPublish(): Promise; + } + + interface IGenericObjectEntry { + qProperty: IGenericObjectProperties; + qChildren: IGenericObjectEntry[]; + qEmbeddedSnapshotRef: IGenericBookmarkEntry; + } + + interface INxPage { + qLeft: number; + qTop: number; + qWidth: number; + qHeight: number; + } + + interface INxViewPort { + qWidth: number; + qHeight: number; + qZoomLevel: number; + } + + interface INxDataAreaPage { + qLeft: number; + qTop: number; + qWidth: number; + qHeight: number; + } + + interface INxHighlightRanges { + qRanges: ICharRange[]; + } + + interface ICharRange { + qCharPos: number; + qCharCount: number; + } + + interface INxAttributeExpressionValues { + qValues: INxSimpleValue[]; + } + + interface INxSimpleValue { + qText: string; + qNum: number; + } + + interface INxCell { + qText: string; + qNum: number; + qElemNumber: number; + qState: NxCellStateType; + qIsEmpty: boolean; + qIsTotalCell: boolean; + qIsOtherCell: boolean; + qFrequency: string; + qHighlightRanges: INxHighlightRanges; + qAttrExps: INxAttributeExpressionValues; + qIsNull: boolean; + qAttrDims: INxAttributeExpressionValues; + } + + interface INxCellRows { + NxCellRows: INxCell[]; + } + + interface INxDataPage { + qMatrix: INxCellRows[]; + qTails: INxGroupTail[]; + qArea: IRect; + qIsReduced: boolean; + } + + interface INxGroupTail { + qUp: number; + qDown: number; + } + + interface IContinuousDataOptions { + qStart: number; + qEnd: number; + qNbrPoints: number; + qMaxNbrTicks: number; + } + + interface INxAxisTicks { + qName: string; + qTicks: INxTickCell[]; + qTags: string[]; + } + + interface INxTickCell { + qText: string; + qStart: number; + qEnd: number; + } + + interface INxAxisData { + qAxis: INxAxisTicks[]; + } + + interface INxAttributeDimValues { + qValues: INxSimpleDimValue[]; + } + + interface INxSimpleDimValue { + qText: string; + qElemNo: number; + } + + interface INxPivotDimensionCell { + qText: string; + qElemNo: number; + qValue: number; + qCanExpand: boolean; + qCanCollapse: boolean; + qType: NxCellType; + qUp: number; + qDown: number; + qSubNodes: INxPivotDimensionCell[]; + qAttrExps: INxAttributeExpressionValues[]; + qAttrDims: INxAttributeDimValues[]; + } + + interface INxPivotPage { + qLeft: INxPivotDimensionCell[]; + qTop: INxPivotDimensionCell[]; + qData: INxPivotValuePoint[]; + qArea: IRect; + } + + interface INxStackedPivotCell { + qText: string; + qElemNo: number; + qValue: number; + qCanExpand: boolean; + qCanCollapse: boolean; + qType: NxCellType; + qMaxPos: number; + qMinNeg: number; + qUp: number; + qDown: number; + qRow: number; + qSubNodes: INxStackedPivotCell[]; + qAttrExps: INxAttributeExpressionValues; + qAttrDims: INxAttributeDimValues; + } + + interface INxStackPage { + qData: INxStackedPivotCell[]; + qArea: IRect; + } + + interface IGenericObjectLayout extends IGenericBaseLayout { + qExtendsId: string; + qHasSoftPatches: boolean; + qError: INxLayoutErrors; + qSelectionInfo: INxSelectionInfo; + } + + interface INxLayoutErrors { + ErrorCode: number; + } + + interface INxSelectionInfo { + qInSelections: boolean; + qMadeSelections: boolean; + } + + interface IRangeSelectInfo { + qRange: IRange; + } + + interface INxMultiRangeSelectInfo extends IRangeSelectInfo { + qColumnsToSelect: number; + } + + interface INxRangeSelectInfo extends IRangeSelectInfo { + qMeasureIx: number; + } + + interface INxContinuousRangeSelectInfo extends IRangeSelectInfo { + qDimIx: number; + } + + interface IRange { + qMin: number; + qMax: number; + qMinInclEq: boolean; + qMaxInclEq: boolean; + } + + interface INxSelectionCell { + qType: NxSelectionCellType; + qCol: number; + qRow: number; + } + + interface IImplementOn { + //? nicht in der docu + on(event: "changed" | "closed", func: () => void); + + //? not in Docu + id: string; + } + + interface IGenericObject extends IImplementOn { + app: IApp; + + abortListObjectSearch(qPath: string): Promise; + acceptListObjectSearch(qPath: string, qToggleMode: boolean, qSoftLock?: boolean): Promise; + applyPatches(qPatches: INxPatch[], qSoftPatch?: boolean): Promise; + beginSelections(qPaths: string[]): Promise; + clearSelections(qPath: string, qColIndices?: number[]): Promise; + clearSoftPatches(): Promise; + collapseLeft(qPath: string, qRow: number, qCol: number, qAll: boolean): Promise; + collapseTop(qPath: string, qRow: number, qCol: number, qAll: boolean): Promise; + copyFrom(qFromId: IGenericObjectProperties): Promise; + createChild(qProp: IGenericObjectProperties, qPropForThis?: IGenericObjectProperties): Promise; + destroyAllChildren(qPropForThis?: IGenericObjectProperties): Promise; + destroyChild(qid: string, qPropForThis?: IGenericObjectProperties): Promise; + drillUp(qPath: string, qDimNo: number, qNbrSteps: number): Promise; + embedSnapshotObject(qId: string): Promise; + endSelections(qAccept: boolean): Promise; + expandLeft(qPath: string, qRow: number, qCol: number, qAll: boolean): Promise; + expandTop(qPath: string, qRow: number, qCol: number, qAll: boolean): Promise; + exportData(qFileType: FileType, qPath: string, qFileName?: string, qExportState?: ExportStateType): Promise; + getChildInfos(): Promise; + getChild(qId: string): Promise; + getEffectiveProperties(): Promise; + getFullPropertyTree(): Promise; + getHyperCubeBinnedData(qPath: string, qPages: INxPage[], qViewport: INxViewPort, qDataRanges: INxDataAreaPage, qMaxNbrCells: number, qQueryLevel: number, qBinningMethod: number): Promise; + getHyperCubeContinuousData(qPath: string, qOptions: IContinuousDataOptions[]): Promise | Promise | Promise; + getHyperCubeData(qPath: string, qPages: INxPage[]): Promise; + getHyperCubePivotData(qPath: string, qPages: INxPage[]): Promise; + getHyperCubeReducedData(qPath: string, qPages: INxPage[], qZoomFactor: number, qReductionMode: ReductionModeType): Promise; + getHyperCubeStackData(qPath: string, qPages: INxPage[], qMaxNbrCells?: number): Promise; + getInfo(): Promise; + getLayout(): Promise; + getLinkedObjects(): Promise; + getListObjectContinuousData(qPath: string, qOptions: IContinuousDataOptions): Promise | Promise; + getListObjectData(qPath: string, qPages: INxPage[]): Promise; + getProperties(): Promise; + getSnapshotObject(): Promise; + lock(qPath: string, qColIndices: number[]): Promise; + publish(): Promise; + multiRangeSelectHyperCubeValues(qPath: string, qRanges: INxMultiRangeSelectInfo, qDeselectOnlyOneSelected: boolean, qColumnsToSelect?: number[], qOrMode?: boolean): Promise; + rangeSelectHyperCubeValues(qPath: string, qRanges: INxRangeSelectInfo[], qDeselectOnlyOneSelected: boolean, qColumnsToSelect?: number[], qOrMode?: boolean): Promise; + resetMadeSelections(): Promise; + searchListObjectFor(qPath: string, qMatch: string): Promise; + selectHyperCubeCells(qPath: string, qRowIndices: number[], qColIndices: number[], qSoftLock: boolean, qDeselectOnlyOneSelected: boolean): Promise; + selectHyperCubeContinuousRange(qPath: string, qRanges: INxContinuousRangeSelectInfo[], qSoftLock: boolean): Promise; + selectHyperCubeValues(qPath: string, qDimNo: number, qValues: number[], qToggleMode: boolean): Promise; + selectListObjectAll(qPath: string, qSoftLock?: boolean): Promise; + selectListObjectAlternative(qPath: string, qSoftLock?: boolean): Promise; + selectListObjectContinuousRange(qPath: string, qRanges: Range[], qSoftLock?: boolean): Promise; + selectListObjectExcluded(qPath: string, qSoftLock?: boolean): Promise; + selectListObjectPossible(qPath: string, qSoftLock?: boolean): Promise; + selectListObjectValues(qPath: string, qValues: number[], qToggleMode: boolean, qSoftLock?: boolean): Promise; + selectPivotCells(qPath: string, qSelections: INxSelectionCell[], qDeselectOnlyOneSelected: boolean, qSoftLock?: boolean): Promise; + setChildArrayOrder(qIds: string[]): Promise; + setFullPropertyTree(qPropEntry: IGenericObjectEntry): Promise; + setProperties(qProp: IGenericObjectProperties): Promise; + unlock(qPath: string, qColIndices: number[]): Promise; + unPublish(): Promise; + } + + interface IGenericMeasureLayout extends IGenericBaseLayout { + qMeasure: INxLibraryMeasureDef; + } + + interface IGenericVariableLayout extends IGenericBaseLayout { + qText: string; + qNum: number; + qIsScriptCreated: boolean; + } + + interface INxLibraryMeasureDef { + qLabel: string; + qDef: string; + qGrouping: NxGrpType; + qExpressions: string[]; + qActiveExpression: number; + } + + interface IGenericMeasure extends IImplementOn { + applyPatches(qPatches: INxPatch[]): Promise; + getInfo(): Promise; + getLayout(): Promise; + getLinkedObjects(): Promise; + getMeasure(): Promise; + getProperties(): Promise; + publish(): Promise; + setProperties(qProp: IGenericMeasureProperties): Promise; + unPublish(): Promise; + } + + interface IGenericVariable extends IImplementOn { + applyPatches(qPatches: INxPatch[]): Promise; + getInfo(): Promise; + getLayout(): Promise; + getProperties(): Promise; + publish(): Promise; + setDualValue(qText: string, qNum: number): Promise; + setNumValue(qVal: number): Promise; + setProperties(qProp: IGenericVariableProperties): Promise; + setStringValue(qVal: string): Promise; + unPublish(): Promise; + } + + interface IAlfaNumString { + qString: string; + qIsNum: boolean; + } + + interface INxVariableProperties { + qName: string; + qNumberPresentation: IFieldAttributes; + qIncludeInBookmark: boolean; + qUsePredefListedValues: boolean; + qPreDefinedList: string[]; + } + + interface IVariable extends IImplementOn { + forceContent(qs: string, qd: number): Promise; + getContent(): Promise; + getNxProperties(): Promise; + getRawContent(): string; + setContent(qContent: string, qUpdateMRU: boolean): Promise; + setNxProperties(qProperties: INxVariableProperties): Promise; + } + + interface IAppEntry { + qID: string; + qTitle: string; + qPath: string; + qLastReloadTime: string; + qReadOnly: boolean; + qMeta: INxMeta; + qThumbnail: IStaticContentUrl; + } + + interface IBNFDef { + qBnf: number[]; + qNbr: number; + qPNbr: number; + qHelpId: number; + qName: string; + qStr: string; + qIsBnfRule?: boolean; + qScriptStatement?: boolean; + qControlStatement?: boolean; + qBnfLiteral?: boolean; + qQvFunc?: boolean; + qAggrFunc?: boolean; + qFG: FunctionGroupType; + qFieldFlag?: boolean; + qMT: MTType; + qDepr?: boolean; + } + + interface ICustomConnector { + qProvider: string; + qParent: string; + qDisplayName: string; + qMachineMode: MachineModeType; + } + + interface IDocListEntry { + qDocName: string; + qConnectedUsers: number; + qFileTime: number; + qFileSize: number; + qDocId: string; + qMeta: INxMeta; + qLastReloadTime: string; + qReadOnly: boolean; + qTitle: string; + qThumbnail: IStaticContentUrl; + } + + interface IInteractDef { + qType?: InteractionType; + qTitle?: string; + qMsg?: string; + qButtons?: number; + qLine?: string; + qOldLineNr?: number; + qNewLineNr?: number; + qPath?: string; + qHidden?: boolean; + qResult: number; + qInput?: string; + } + + interface IDriveInfo { + qDrive: string; + qType: string; + qName: string; + } + + interface IOdbcDsn { + qName: string; + qDescription: string; + qBit32: boolean; + qUserOnly: boolean; + } + + interface IOleDbProvider { + qName: string; + qDescription: string; + qBit32: boolean; + } + + interface IErrorData { + qErrorString: string; + qLineEnd: string; + qLine: string; + qErrorDataCode: ErrorDataCodeType; + } + + interface IProgressMessage { + qMessageCode: number; + qMessageParameters: string[]; + } + + interface IProgressData { + qStarted: boolean; + qFinished: boolean; + qCompleted: number; + qTotal: number; + qKB: number; + qMillisecs: number; + qUserInteractionWanted: boolean; + qPersistentProgress: string; + qTransientProgress: string; + qErrorData: IErrorData[]; + qPersistentProgressMessages: IProgressMessage[]; + qTransientProgressMessage: IProgressMessage; + } + + interface INxStreamListEntry { + qName: string; + qId: string; + } + + interface ICodePage { + qNumber: number; + qName: string; + qDescription: string; + } + + interface IFunction { + qName: string; + qGroup: FunctionGroupType; + qSignature: string; + } + + interface IGlobal { + abortAll(): Promise; + allowCreateApp(): Promise; + cancelReload(): Promise; + cancelRequest(qRequestId: number): Promise; + configureReload(qCancelOnScriptError: boolean, qUseErrorData: boolean, qInteractOnError: boolean): Promise; + copyApp(qTargetAppId: string, qSrcAppId: string, qIds: string[]): Promise; + createApp(qAppName: string, qLocalizedScriptMainSection: string): Promise; //?Result + createDocEx(qDocName: string, qUserName?: string, qPassword?: string, qSerial?: string, qLocalizedScriptMainSection?: string): Promise; + createSessionApp(): Promise; + createSessionAppFromApp(qSrcAppId: string): Promise; + deleteApp(qAppId: string): Promise; + exportApp(qTargetPath: string, qSrcAppId: string, qIds: string[]): Promise; + getActiveDoc(): Promise; //?Result + getAppEntry(qAppID: string): Promise; + getAuthenticatedUser(): Promise; + getBNF(qBnfType: BnfType): Promise; + getCustomConnectors(qReloadList: boolean): Promise; + getDatabasesFromConnectionString(qConnection: IConnection): Promise; + getDefaultAppFolder(): Promise; + getDocList(): Promise; + getFolderItemsForPath(qPath: string): Promise; + getFunctions(qGroup?: FunctionGroupType): Promise; + getInteract(qRequestId: number): Promise; + getLogicalDriveStrings(): Promise; + getOdbcDsns(): Promise; + getOleDbProviders(): Promise; + getProgress(qRequestId: number): Promise; + getStreamList(): Promise; + getSupportedCodePages(): Promise; + getUniqueID(): Promise; + interactDone(qRequestId: number, qDef: IInteractDef): Promise; + isDesktopMode(): Promise; + isPersonalMode(): Promise; + isValidConnectionString(qConnection: IConnection): Promise; + openDoc(qDocName: string, qUserName?: string, qPassword?: string, qSerial?: string, qNoData?: boolean): Promise; + oSName(): Promise; + oSVersion(): Promise; + productVersion(): Promise; + qTProduct(): Promise; + qvVersion(): Promise; + reloadExtensionList(): Promise; + replaceAppFromID(qTargetAppId: string, qSrcAppID: string, qIds: string[]): Promise; + shutdownProcess(): Promise; + } + + interface INxAttrExprInfo { + /** + * Minimum value. + */ + qMin: number; + + /** + * Maximum value. + */ + qMax: number; + + /** + * Is continuous axis used. + */ + qContinuousAxes: boolean; + + /** + * Is a cyclic dimension used. + */ + qIsCyclic: boolean; + + /** + * Corresponds to the label of the dimension that is selected. + */ + qFallbackTitle: string; + } + + interface INxStateCounts { + /** + * Number of values in locked state. + * Integer + */ + qLocked: number; + + /** + * Number of values in selected state. + * Integer + */ + qSelected: number; + + /** + * Number of values in optional state. + * Integer + */ + qOption: number; + + /** + * Number of values in deselected state. + * Integer + */ + qDeselected: number; + + /** + * Number of values in alternative state. + * Integer + */ + qAlternative: number; + + /** + * Number of values in excluded state + * Integer + */ + qExcluded: number; + + /** + * Number of values in selected excluded state. + * Integer + */ + qSelectedExcluded: number; + + /** + * Number of values in locked excluded state. + * Integer + */ + qLockedExcluded: number; + } + + interface INxDimensionInfo { + /** + * Corresponds to the label of the dimension that is selected. + * If the label is not defined then the field name is used. + * String + */ + qFallbackTitle: string; + + /** + * Length of the longest value in the field. + * Integer + */ + qApprMaxGlyphCount: number; + + /** + * Number of distinct field values. + * Integer + */ + qCardinal: number; + + /** + * Is set to true if the field is locked. + * Boolean + */ + qLocked: boolean; + + /** + * Sort indicator. + * This parameter is optional. + * The default value is no sorting. + * One of: + * # N for no sorting + * # A for sorting ascending + * # D for sorting descending + */ + qSortIndicator: SortIndicatorType; + + /** + * Array of dimension labels. + * Contains the labels of all dimensions in a hierarchy group (for example the labels of all dimensions in a drill down group). + * Array of String + */ + qGroupFallbackTitles: string[]; + + /** + * Index of the dimension that is currently in use. + * qGroupPos is set to 0 if there are no hierarchical groups (drill-down groups) or cycle groups. + * Integer + */ + qGroupPos: number; + + /** + * Number of values in a particular state. + * NxStateCounts + */ + qStateCounts: INxStateCounts; + + /** + * Gives information on a field. For example, it can return the type of the field. + * Examples: key, text, ASCII + * Array of String + */ + qTags: string[]; + + /** + * This parameter is optional. + * Gives information on the error. + * Null or NxValidationError + */ + qError: INxValidationError; + + /** + * Binary format of the field. + * One of: + * # D for discrete (String) + * # N for numeric (Double) + * # T for Time (Timestamp) + */ + qDimensionType: DimensionType; + + /** + * If set to true, it inverts the sort criteria in the field. + * Boolean + */ + qReverseSort: boolean; + + /** + * Defines the grouping. + * One of: + * # N for no grouping + * # H for drill-down + * # C for cyclic + */ + qGrouping: NxGrpType; + + /** + * If set to true, it means that the field is a semantic. + * Boolean + */ + qIsSemantic: boolean; + + /** + * Format of the field. + * This parameter is optional. + * FieldAttributes + */ + qNumFormat: FieldAttributesType; + + /** + * This parameter is set to true if qNumFormat is set to U (unknown). The engine guesses the type of the field based on the field's definition. + * Boolean + */ + qIsAutoFormat: boolean; + + /** + * Array of field names. + * Array of String + */ + qGroupFieldDefs: string[]; + + /** + * Array of attribute expressions. + * Array of NxAttrExprInfo + */ + qAttrExprInfo: INxAttrExprInfo; + + /** + * Minimum value. + * Double + */ + qMin: number; + + /** + * Maximum value. + * Double + */ + qMax: number; + + /** + * Is continuous axis used. + * Boolean + */ + qContinuousAxes: boolean; + + /** + * Is a cyclic dimension used. + * Boolean + */ + qIsCyclic: boolean; + + /** + * Is derived field is used as a dimension. + * Boolean + */ + qDerivedField: boolean; + + /** + * Array of attribute dimensions. + * Array of NxAttrDimInfo + */ + qAttrDimInfo: INxAttrDimInfo; + } + + interface INxAttrDimInfo { + /** + * Cardinality of the attribute expression. + * Integer + */ + qCardinal: number; + + /** + * Number of rows. + * Size + */ + qSize: number; + + /** + * The title for the attribute dimension. + * String + */ + qFallbackTitle: string; + + /** + * The Locked value of the dimension. + * Boolean + */ + qLocked: boolean; + + /** + * Validation error. + * REF(NxValidationError) + */ + //?Type = REF(NxValidationError)? + qError: INxValidationError; + } + + interface INxValidationError { + /** + * Error code. + * This parameter is always displayed in case of error. + * Integer + */ + qErrorCode: number; + + /** + * Context related to the error, from the user app domain. + * It can be the identifier of an object, a field name, a table name. + * This parameter is optional. + * String + */ + qContext: string; + + /** + * Internal information from the server. + * This parameter is optional. + * String + */ + qExtendedMessage: string; + } + + interface INxMeasureInfo { + /** + * Corresponds to the label of the measure. If the label is not defined then the measure name is used. + * String + */ + qFallbackTitle: string; + + /** + * Length of the longest value in the field. + * Integer + */ + qApprMaxGlyphCount: number; + + /** + * Number of distinct field values. + * Integer + */ + qCardinal: number; + + /** + * Sort indicator. This parameter is optional. The default value is no sorting. + */ + qSortIndicator: SortIndicatorType; + + /** + * Format of the field. This parameter is optional. + * One of: N for no sorting, A for sorting ascending, D for sorting descending + */ + qNumFormat: IFieldAttributes; + + /** + * This parameter is set to true if qNumFormat is set to U (unknown). The engine guesses the type of the field based on the field's expression. + */ + qIsAutoFormat: boolean; + + /** + * Lowest value in the range. + */ + qMin: number; + + /** + * Highest value in the range. + */ + qMax: number; + + /** + * This parameter is optional. Gives information on the error. + */ + qError: INxValidationError; + + /** + * If set to true, it inverts the sort criteria in the field. + */ + qReverseSort: boolean; + + /** + * List of attribute expressions. + */ + qAttrExprInfo: INxAttrExprInfo[]; + + /** + * List of attribute dimensions. + */ + qAttrDimInfo: INxMeasureInfo[]; + } + + interface INxInlineDimensionDef { + qGrouping?: NxGrpType; + qFieldDefs?: string[]; + qFieldLabels?: string[]; + qSortCriterias?: ISortCriteria; + qNumberPresentations?: IFieldAttributes[]; + qReverseSort?: boolean; + qActiveField?: number; + } + + interface IHyperCubeDimensionqDef extends INxInlineDimensionDef { + autoSort?: boolean; + cId?: string; + othersLabel?: IStringExpressionContainer; + } + + interface IOtherTotalSpecProp { + qOtherMode: OtherModeType; + qOtherCounted: string; + qOtherLimit: string; + qOtherLimitMode: OtherLimitModeType; + qSuppressOther: boolean; + qForceBadValueKeeping: boolean; + qApplyEvenWhenPossiblyWrongResult: boolean; + qGlobalOtherGrouping: boolean; + qOtherCollapseInnerDimensions: boolean; + qOtherSortMode: OtherSortModeType; + qTotalMode: TotalModeType; + qReferencedExpression: string; + } + + interface INxAttrExprDef { + qExpression: string; + qLibraryId_: string; + } + + interface INxAttrDimDef { + qDef: string; + qLibraryId: string; + qSortBy: ISortCriteria; + } + + interface INxDimension { + qLibraryId?: string; + qDef: INxInlineDimensionDef; + qNullSuppression?: boolean; + qOtherTotalSpec?: IOtherTotalSpecProp; + qShowAll?: boolean; + qOtherLabel?: IStringExpressionContainer; + qTotalLabel?: IStringExpressionContainer; + qCalcCond?: IValueExpr; + qAttributeExpressions?: INxAttrExprDef[]; + qAttributeDimensions?: INxAttrDimDef[]; + + qIncludeElemValue?: boolean; //?Nicht in Doku + qShowTotal?: boolean; //?Nicht in Doku + } + + interface INxCellPosition { + qx: number; + qy: number; + } + + interface IValueExpr { + qv: string; + } + + interface ISortCriteria { + qSortByState?: TypeSortDirection; + qSortByFrequency?: TypeSortDirection; + qSortByNumeric?: TypeSortDirection; + qSortByAscii?: TypeSortDirection; + qSortByLoadOrder?: TypeSortDirection; + qSortByExpression?: TypeSortDirection; + qExpression?: IValueExpr; + + qSortByGreyness?: TypeSortDirection; //?Nicht in Doku + } + + interface IStringExpressionContainer { + qStringExpression: string; + } + + interface ICustomErrorMessage { + calcCond: string; + } + + interface INxMeasure { + qLibraryId?: string; + qDef: INxInlineMeasureDef; + qSortBy?: ISortCriteria; + qAttributeExpressions?: INxAttrExprDef[]; + qCalcCond?: IValueExpr; + qAttributeDimensions?: INxAttrDimDef[]; + } + + interface INxInlineMeasureDef { + qLabel?: string; + qDescription?: string; + qTags?: string[]; + qGrouping: NxGrpType; + qDef: string; + qNumFormat?: IFieldAttributes; + qRelative?: boolean; + qBrutalSum?: boolean; + qAggrFunc?: string; + qAccumulate?: number; + qReverseSort?: boolean; + qActiveExpression?: number; + qExpressions?: string[]; + } + + interface IHyperCubeMeasureqDef extends INxInlineMeasureDef { + autoSort?: boolean; + cId?: string; + numFormatFromTemplate?: boolean; + } + + interface IHyperCubeMeasureDef extends INxMeasure { + qDef: IHyperCubeMeasureqDef; + } + + interface INxPivotValuePoint { + qLabel: string; + qText: string; + qNum: number; + qType: NxCellType; + qAttrExps: INxAttributeExpressionValues; + } + + interface INxContainerEntry { + qInfo: INxInfo; + qMeta: INxMeta; + qData: T; + } + + //public enum NxHypercubeMode { + // [QixName("P: + // DATA_MODE_PIVOT = 1, + // [QixName("K: + // DATA_MODE_PIVOT_STACK = 2, + // [QixName("S: + // DATA_MODE_STRAIGHT = 0 + //} + + //public enum SortDirection { + // Ascending = 1, + // Descending = -1, + // None = 0 + //} +} + +//#region Prototype Interfaces for Class definitions +declare namespace EngineAPI { + interface IGenericObjectPrototype

    extends IGenericObject { + getLayout(): Promise; + getProperties(): Promise

    ; + setProperties(properties: P): Promise; + } + + interface IAppObjectPrototype

    { + createObject(qProp: P): Promise; + createSessionObject(qProp: P): Promise; + } +} +//#endregion + +//#region ListObject +declare namespace EngineAPI { + interface IListObject { + qStateName: string; + qSize: ISize; + qError: INxValidationError; + qDimensionInfo: INxDimensionInfo; + qExpressions: INxListObjectExpression[]; + qDataPages: INxDataPage[]; + } + + interface INxListObjectExpression { + qExpr: string; + qError: INxLayoutErrors; + } + + interface IGenericListLayout extends IGenericBaseLayout { + qListObject: IListObject; + } + + interface INxAutoSortByStateDef { + qDisplayNumberOfRows: number; + } + + interface INxListObjectExpressionDef { + qExpr: string; + qLibraryId: string; + } + + interface IListObjectDef { + qStateName: string; + qLibraryId: string; + qDef: INxInlineDimensionDef; + qAutoSortByState: INxAutoSortByStateDef; + qFrequencyMode: FrequencyModeType; + qShowAlternatives: boolean; + qInitialDataFetch: INxPage[]; + qExpressions?: INxListObjectExpressionDef[]; + } + + interface IGenericListProperties extends IGenericProperties { + qListObjectDef: IListObjectDef; + } + + interface IGenericList extends IGenericObjectPrototype { + } + + interface IApp extends IAppObjectPrototype { + createObject(qProp: IGenericListProperties): Promise; + createSessionObject(qProp: IGenericListProperties): Promise; + clearSelections(qPath: "/qListObjectDef", qColIndices?: number[]): Promise; + } +} +//#endregion + +//#region HyperCubeObject +declare namespace EngineAPI { + interface IHyperCubeDimensionDef extends INxDimension { + qDef: IHyperCubeDimensionqDef; + } + + interface IHyperCube { + qStateName: string; + qSize: ISize; + qError: INxValidationError; + qDimensionInfo: INxDimensionInfo[]; + qMeasureInfo: INxMeasureInfo; + qEffectiveInterColumnSortOrder: number[]; + qGrandTotalRow: INxCell[]; + qDataPages: INxDataPage[]; + qPivotDataPages: INxPivotPage[]; + qStackedDataPages: INxStackPage[]; + qMode: NxHypercubeMode; + qNoOfLeftDims: number; + qIndentMode: boolean; + qLastExpandedPos: INxCellPosition; + qHasOtherValues: boolean; + } + + interface IGenericHyperCubeLayout extends IGenericObjectLayout { + qHyperCube: IHyperCube; + } + + interface IHyperCubeDef { + qStateName: string; + qDimensions: INxDimension[]; + qMeasures: INxMeasure[]; + qInterColumnSortOrder: number[]; + qSuppressZero: boolean; + qSuppressMissing: boolean; + qInitialDataFetch: INxPage[]; + qMode: NxHypercubeMode; + qNoOfLeftDims: number; + qAlwaysFullyExpanded: boolean; + qMaxStackedCells: number; + qPopulateMissing: boolean; + qShowTotalsAbove: boolean; + qIndentMode: boolean; + qCalcCond: IValueExpr; + qSortbyYValue: string; + + qPseudoDimPos: number; //?Dokufehler + qReductionMode: ReductionModeType; //?Dokufehler + } + + interface IVisualizationHyperCubeDef extends IHyperCubeDef { + customErrorMessage: ICustomErrorMessage; + qDimensions: IHyperCubeDimensionDef[]; + qMeasures: IHyperCubeMeasureDef[]; + qLayoutExclude: any; + } + + interface IGenericHyperCubeProperties extends IGenericObjectProperties { + qHyperCubeDef: IVisualizationHyperCubeDef; + } + + interface IHyperCubeObject extends IGenericObjectPrototype { + } + + interface IApp { + createObject(qProp: IGenericHyperCubeProperties): Promise; + createSessionObject(qProp: IGenericHyperCubeProperties): Promise; + } +} +//#endregion + +//#region SelectionListObject +declare namespace EngineAPI { + type FieldSelectionModeType = "NORMAL" | "AND" | "NOT"; + + interface INxCurrentSelectionItem { + qTotal: number; + qIsNum: boolean; + qField: string; + qLocked: boolean; + qOneAndOnlyOne: boolean; + qTextSearch: string; + qSelectedCount: number; + qSelected: string; + qRangeInfo: IRangeSelectInfo[]; + qSortIndex: number; + qStateCounts: INxStateCounts; + qSelectedFieldSelectionInfo: INxFieldSelectionInfo[]; + qNotSelectedFieldSelectionInfo: INxFieldSelectionInfo[]; + qSelectionThreshold: number; + } + + interface INxFieldSelectionInfo { + qName: string; + qFieldSelectionMode: FieldSelectionModeType; + } + + interface IGenericSelectionNxInfo extends INxInfo { + qType: "CurrentSelection"; + } + + interface IGenericSelectionListProperties extends IGenericObjectProperties { + qInfo: IGenericSelectionNxInfo; + qSelectionObjectDef: any; + } + + interface ISelectionListObject { + qBackCount: number; + qForwardCount: number; + qSelections: INxCurrentSelectionItem[]; + } + + interface IGenericSelectionListLayout extends IGenericObjectLayout { + qSelectionObject: ISelectionListObject; + } + + interface ISelectionListObject extends IGenericObject { + getLayout(): Promise; + } + + interface IApp { + createObject(qProp: IGenericSelectionListProperties): Promise; + createSessionObject(qProp: IGenericSelectionListProperties): Promise; + } +} +//#endregion + +//#region BookmarkListObject +declare namespace EngineAPI { + interface IBookmarkList { + qItems: IGenericBookmarkLayout[]; + } + + interface IGenericBookmarkListLayout extends IGenericBaseLayout { + qBookmarkList: IBookmarkList; + } + + interface IGenericBookmarkListNxInfo extends INxInfo { + qType: "BookmarkList"; + } + + interface IGenericBookmarkListProperties extends IGenericProperties { + qInfo: IGenericBookmarkListNxInfo; + qBookmarkListDef: IBookmarkListDef; + } + + interface IBookmarkListDef { + qType: "bookmark"; + // qData: //?nicht dokumentiert + // example from websocket + // qData: { title: "/qMetaDef/title", description: "/qMetaDef/description", sheetId: "/sheetId", title: "/qMetaDef/title" } + } + + interface IBookmarkListObject extends IGenericObject { + getLayout(): Promise; + } + + interface IApp { + createObject(qProp: IGenericBookmarkListProperties): Promise; + createSessionObject(qProp: IGenericBookmarkListProperties): Promise; + } +} +//#endregion + +//#region MeassureListObject +declare namespace EngineAPI { + interface IMeassureListItemLayout extends IGenericBaseLayout { + qMeta: INxMetaTitleDescriptionTag; + qData: null; + } + + interface IMeassureList { + qItems: IMeassureListItemLayout[]; + } + + interface IGenericMeasureListLayout extends IGenericBaseLayout { + qMeassureListObject: IMeassureList; + } + + interface IGenericMeassureListNxInfo extends INxInfo { + qType: "MeasureList"; + } + + interface IGenericMeasureListProperties extends IGenericProperties { + qInfo: IGenericMeassureListNxInfo; + qMeasureListDef: IMeasureListDef; + } + + interface IMeasureListDef { + qType: "measure"; + // qData: INxMeasure[]; //?nicht dokumentiert + // example from websocket + // qData : { title: "/qMetaDef/title", tags: "/qMetaDef/tags" } + } + + interface IMeassureListObject extends IGenericObject { + getLayout(): Promise; + } + + interface IApp { + createObject(qProp: IGenericMeasureListProperties): Promise; + createSessionObject(qProp: IGenericMeasureListProperties): Promise; + } +} +//#endregion + +//#region DimensionsListObject +declare namespace EngineAPI { + interface IDimensionItemLayout { + qMeta: INxMetaTitleDescriptionTag; + qData: null; + } + + interface IDimensionList { + qItems: IDimensionItemLayout[]; + } + + interface IGenericDimensionListLayout extends IGenericBaseLayout { + qDimensionsListObject: IDimensionList; + } + + interface IGenericDimensionListNxInfo extends INxInfo { + qType: "DimensionList"; + } + + interface IGenericDimensionsListProperties extends IGenericProperties { + qInfo: IGenericMeassureListNxInfo; + qDimensionListDef: IDimensionListDef; + } + + interface IDimensionListDef { + qType: "dimension"; + //qData: INxDimension[]; //?nicht dokumentiert + } + + interface IDimensionListObject extends IGenericObject { + getLayout(): Promise; + } + + interface IApp { + createObject(qProp: IGenericDimensionsListProperties): Promise; + createSessionObject(qProp: IGenericDimensionsListProperties): Promise; + } +} +//#endregion + +//#region VariableListObject +declare namespace EngineAPI { + interface INxVariableListItem { + qName: string; + qDescription: string; + qDefinition: string; + qIsConfig?: boolean; + qIsReserved?: boolean; + qMeta?: INxMeta; + qInfo: INxInfo; + qData: any; //?nicht dokumentiert + qIsScriptCreated: boolean; + } + + interface IVariableListObject { + qItems: INxVariableListItem[]; + } + + interface IGenericVariableLayout extends IGenericObjectLayout { + qVariableListObject: IVariableListObject; + } + + interface IGenericVariableListProperties extends IGenericProperties { + qVariableListDef: IVariableListDef; + } + + interface IVariableListDef { + qType: string; + qShowReserved: boolean; + qShowConfig: boolean; + qData: any; //?nicht dokumentiert + } + + interface IVariableListObject extends IGenericObject { + getLayout(): Promise; + } + + interface IApp { + createObject(qProp: IGenericVariableListProperties): Promise; + createSessionObject(qProp: IGenericVariableListProperties): Promise; + } +} +//#endregion + +//#region FieldListObject +declare namespace EngineAPI { + interface IFieldListObject { + qItems: INxFieldDescription[]; + } + + interface IGenericFieldLayout extends IGenericObjectLayout { + qFieldListObject: IFieldListObject; + } + + interface IGenericFieldListProperties extends IGenericProperties { + qFieldListDef: IFieldListDef; + } + + interface INxFieldDescription { + qIsSemantic: boolean; + qIsHidden: boolean; + qIsSystem: boolean; + qAndMode?: boolean; + qName: string; + qCardinal: number; + qTags: string[]; + qIsDefinitionOnly: boolean; + qDerivedFieldData: INxDerivedFieldDescriptionList; + qIsDetail: boolean; + qIsImplicit: boolean; + } + + interface INxDerivedFieldDescriptionList { + qDerivedFieldLists: INxDerivedFieldsData[]; + } + + interface INxDerivedField { + qId: string; + qName: string; + qMethod: string; + qExpr: string; + qTags: string[]; + } + + interface INxDerivedGroup { + qId: string; + qName: string; + qGrouping: NxGrpType; + qFieldDefs: string[]; + } + + interface INxDerivedFieldsData { + qDerivedDefinitionName: string; + qFieldDefs: INxDerivedField[]; + qGroupDefs: INxDerivedGroup[]; + qTags: string[]; + } + + interface IFieldListDef { + qShowSystem?: boolean; + qShowHidden?: boolean; + qShowSemantic?: boolean; + qShowSrcTables?: boolean; + qShowDefinitionOnly?: boolean; + qShowDerivedFields?: boolean; + qShowImplicit?: boolean; + } + + interface IApp { + createObject(qProp: IGenericFieldListProperties): Promise; + createSessionObject(qProp: IGenericFieldListProperties): Promise; + } +} +//#endregion + +// extens the AppAPI Namespace with the access of the EnigmaModel + +declare namespace AppAPI { + interface IApp { + model: IModel; + } + + interface IModel { + enigmaModel: Enigma.IApp; + } +} + +declare namespace ExtensionAPI { + + interface IExtensionModel { + enigmaModel: Enigma.IGenericObject; + } + +} \ No newline at end of file diff --git a/qlik-engineapi/qlik-engineapi-tests.ts b/qlik-engineapi/qlik-engineapi-tests.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/qlik-engineapi/tsconfig.json b/qlik-engineapi/tsconfig.json new file mode 100644 index 0000000000..96c1d84c5d --- /dev/null +++ b/qlik-engineapi/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "qlik-engineapi-tests.ts" + ] +} \ No newline at end of file diff --git a/qlik-engineapi/tslint.json b/qlik-engineapi/tslint.json new file mode 100644 index 0000000000..cae1bdf2ad --- /dev/null +++ b/qlik-engineapi/tslint.json @@ -0,0 +1,8 @@ +{ + "extends": "../tslint.json", + "rules": { + "forbidden-types": false, + "no-empty-interface": false, + "interface-name": false + } +} \ No newline at end of file From 4553459c048896c63b6a6091e79fa5e50108a1b1 Mon Sep 17 00:00:00 2001 From: Kenneth Ceyer Date: Mon, 15 May 2017 17:08:23 +0900 Subject: [PATCH 0134/1072] add homeworks as type definition. --- types/homeworks/homeworks-tests.ts | 93 +++++++++++++ types/homeworks/index.d.ts | 212 +++++++++++++++++++++++++++++ types/homeworks/tsconfig.json | 22 +++ types/homeworks/tslint.json | 9 ++ 4 files changed, 336 insertions(+) create mode 100644 types/homeworks/homeworks-tests.ts create mode 100644 types/homeworks/index.d.ts create mode 100644 types/homeworks/tsconfig.json create mode 100644 types/homeworks/tslint.json diff --git a/types/homeworks/homeworks-tests.ts b/types/homeworks/homeworks-tests.ts new file mode 100644 index 0000000000..16bce6d106 --- /dev/null +++ b/types/homeworks/homeworks-tests.ts @@ -0,0 +1,93 @@ +const element: JQuery = $('#element'); +const target: JQuery = $('#target'); + +element.checkbox({ + /* Empty options */ +}).bind('change', (event: HomeWorksEventObject) => { + /* HomeWorks native event */ +}); + +element.converter({ + /* Empty options */ +}); + +element.dropdown({ + /* Empty options */ +}); + +const dropdownHandlerTarget: JQuery = element.addHandler(target); + +element.input({ + /* Empty options */ +}).bind('change', (event: HomeWorksEventObject) => { + /* HomeWorks native event */ +}); + +element.modal({ + /* Any options */ +}).each(() => { + /* Chaining */ +}); +element.modal('show'); +element.modal('hide'); +element.modal('open'); +element.modal('close'); + +notification('title', 'content', 'url', 'success'); + +element.ripple({ + /* Object options */ +}); +element.start({ + x: 1, + y: 2 +}); + +element.spinner({ + type: 'any', + empty: 'any' +}).bind('change', (event: HomeWorksEventObject) => { + /* HomeWorks native event */ +}); + +element.step('method'); +element.step({ + active: 0 +}).bind('move', (event: HomeWorksStepEventObject) => { + /* HomeWorks step event */ +}); + +element.tab('method'); +element.tab({ + active: 0 +}).bind('move', (event: HomeWorksTabEventObject) => { + /* HomeWorks step event */ +}); + +toast('hello homeworks'); +toast({ + message: 'hello homeworks' +}); + +element.toggle({ + placeholder: 'placeholder' +}).bind('change', (event: HomeWorksEventObject) => { + /* HomeWorks native event */ +}); + +element.upload({ + url: 'url', + type: 'type', + data: {}, + dest: 'dest', + isBtn: true, + beforeStart() { + }, + complete(data: any) { + }, + success(data?: any, state?: any, xhr?: any) { + }, + error(xhr?: any, state?: any, error?: any) { + }, + extensions: 'any' +}); diff --git a/types/homeworks/index.d.ts b/types/homeworks/index.d.ts new file mode 100644 index 0000000000..87affa65e5 --- /dev/null +++ b/types/homeworks/index.d.ts @@ -0,0 +1,212 @@ +// Type definitions for homeworks 1.0 +// Project: https://github.com/IGAWorksDev/homeworks/ +// Definitions by: Kenneth Ceyer +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +/** + * * [MAIN] + * @ EVENT + * + */ + +declare interface HomeWorksEventObject { + element: JQuery; + value: string; + checked?: boolean; +} + +declare interface JQuery { + bind(eventType: string, handler: (...parameters: any[]) => void): JQuery; + knock(): JQuery; +} + +/** + * * [COMPONENT] + * @ CHECKBOX + * + */ +interface CheckboxOptions { +} + +declare interface JQuery { + checkbox(options?: CheckboxOptions): JQuery; +} + +/** + * * [COMPONENT] + * @ CONVERTER + * + */ + +interface ConverterOptions { +} + +declare interface JQuery { + converter(options?: ConverterOptions): JQuery; +} + +/** + * * [COMPONENT] + * @ DROPDOIWN + * + */ + +interface DropdownOptions { +} + +declare interface JQuery { + dropdown(options?: DropdownOptions): JQuery; + addHandler(target: JQuery): JQuery; +} + +/** + * * [COMPONENT] + * @ INPUT + * + */ + +interface InputOptions { +} + +declare interface JQuery { + input(options?: InputOptions): JQuery; +} + +/** + * * [COMPONENT] + * @ MODAL + * + */ + +declare interface JQuery { + modal(options?: any): JQuery; + modal(method?: string, options?: any): JQuery; +} + +/** + * * [COMPONENT] + * @ NOTIFICATION + * + */ + +declare function notification(title: string, content: string, url: string, status?: string): void; + +/** + * * [COMPONENT] + * @ RIPPLE + * + */ + +interface RippleStartOptions { + x: number; + y: number; +} + +declare interface JQuery { + ripple(options?: any): JQuery; + start(options?: RippleStartOptions): JQuery; +} + +/** + * * [COMPONENT] + * @ SPINNER + * + */ + +interface SpinnerOptions { + type?: any; + empty?: any; +} + +declare interface JQuery { + spinner(options?: SpinnerOptions): JQuery; +} + +/** + * * [COMPONENT] + * @ STEP + * + */ + +interface StepOptions { + active?: number; +} + +declare interface JQuery { + step(method?: string): JQuery; + step(options?: StepOptions): JQuery; +} + +declare interface HomeWorksStepEventObject { + header: JQuery[]; + index: number; + length: number; +} + +/** + * * [COMPONENT] + * @ TAB + * + */ + +interface TabOptions { + active?: number; +} + +declare interface JQuery { + tab(method?: string): JQuery; + tab(options?: TabOptions): JQuery; +} + +declare interface HomeWorksTabEventObject { + header: JQuery[]; + index: number; + length: number; +} + +/** + * * [COMPONENT] + * @ TOAST + * + */ + +declare function toast(message: any): void; + +/** + * * [COMPONENT] + * @ TOGGLE + * + */ + +interface ToggleOptions { + placeholder?: string; +} + +declare interface JQuery { + toggle(options: ToggleOptions): JQuery; +} + +/** + * * [COMPONENT] + * @ UPLOAD + * + */ + +interface UploadOptions { + url: string; + type?: string; + data?: any; + dest?: string; + isBtn?: boolean; + beforeStart?: () => void; + complete?: (data?: any) => void; + success?: (data?: any, state?: any, xhr?: any) => void; + error?: (xhr?: any, state?: any, error?: any) => void; + extensions?: any; +} + +declare interface JQuery { + upload(options?: UploadOptions): JQuery; +} diff --git a/types/homeworks/tsconfig.json b/types/homeworks/tsconfig.json new file mode 100644 index 0000000000..65f6fc4f01 --- /dev/null +++ b/types/homeworks/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", + "homeworks-tests.ts" + ] +} \ No newline at end of file diff --git a/types/homeworks/tslint.json b/types/homeworks/tslint.json new file mode 100644 index 0000000000..626d0c5922 --- /dev/null +++ b/types/homeworks/tslint.json @@ -0,0 +1,9 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "no-empty-interface": false, + "strict-export-declare-modifiers": false, + "prefer-method-signature": false, + "unified-signatures": false + } +} From 57df82422e299148490fc194d298e262aba17efb Mon Sep 17 00:00:00 2001 From: Mark Bouwman Date: Mon, 15 May 2017 13:14:22 +0200 Subject: [PATCH 0135/1072] added getRequestedUrl to IElement and ICollection --- types/restangular/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/restangular/index.d.ts b/types/restangular/index.d.ts index 811fdf8894..132475a2b9 100644 --- a/types/restangular/index.d.ts +++ b/types/restangular/index.d.ts @@ -134,6 +134,7 @@ declare namespace restangular { withHttpConfig(httpConfig: angular.IRequestShortcutConfig): IElement; save(queryParams?: any, headers?: any): IPromise; getRestangularUrl(): string; + getRequestedUrl(): string; route?: string; id?: string; reqParams?: any; @@ -154,5 +155,6 @@ declare namespace restangular { plain(): any; plain(): T[]; getRestangularUrl(): string; + getRequestedUrl(): string; } } From 5dcda0ca0b73e2eb3ee06ba20c56e4b507b687f4 Mon Sep 17 00:00:00 2001 From: Hugo Wood Date: Mon, 15 May 2017 14:13:32 +0200 Subject: [PATCH 0136/1072] 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 8d0e48f4850eedd5730cd6fb20d869032c1fd335 Mon Sep 17 00:00:00 2001 From: Odd Eirik Nes Date: Mon, 15 May 2017 14:24:49 +0200 Subject: [PATCH 0137/1072] Add definitions for vertx3-eventbus-client --- types/vertx3-eventbus-client/index.d.ts | 26 +++++++++++++++++++ types/vertx3-eventbus-client/tsconfig.json | 22 ++++++++++++++++ types/vertx3-eventbus-client/tslint.json | 1 + .../vertx3-eventbus-client-tests.ts | 3 +++ 4 files changed, 52 insertions(+) create mode 100644 types/vertx3-eventbus-client/index.d.ts create mode 100644 types/vertx3-eventbus-client/tsconfig.json create mode 100644 types/vertx3-eventbus-client/tslint.json create mode 100644 types/vertx3-eventbus-client/vertx3-eventbus-client-tests.ts diff --git a/types/vertx3-eventbus-client/index.d.ts b/types/vertx3-eventbus-client/index.d.ts new file mode 100644 index 0000000000..96c74a66e6 --- /dev/null +++ b/types/vertx3-eventbus-client/index.d.ts @@ -0,0 +1,26 @@ +// Type definitions for vertx3-eventbus-client 3.4 +// Project: http://vertx.io +// Definitions by: Odd Eirik Nes +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare namespace EventBus { + interface EventBusStatic { + new(url: string, options?: any): EventBus; + } + + interface EventBus { + url: string; + options?: any; + onopen(): any; + onerror(error: Error): any; + onclose(): any; + registerHandler(address: string, headers: any, callback: (error: Error, message: any) => any): any; + unregisterHandler(address: string, headers: any, callback: (error: Error, message: any) => any): any; + send(address: string, message: any, headers: any, callback?: (error: Error, message: any) => any): any; + publish(address: string, message: any, headers?: any): any; + close(): any; + } +} + +declare var EventBus: EventBus.EventBusStatic; +export = EventBus; diff --git a/types/vertx3-eventbus-client/tsconfig.json b/types/vertx3-eventbus-client/tsconfig.json new file mode 100644 index 0000000000..07390b013d --- /dev/null +++ b/types/vertx3-eventbus-client/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", + "vertx3-eventbus-client-tests.ts" + ] +} diff --git a/types/vertx3-eventbus-client/tslint.json b/types/vertx3-eventbus-client/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/vertx3-eventbus-client/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/vertx3-eventbus-client/vertx3-eventbus-client-tests.ts b/types/vertx3-eventbus-client/vertx3-eventbus-client-tests.ts new file mode 100644 index 0000000000..e4b7ed7e67 --- /dev/null +++ b/types/vertx3-eventbus-client/vertx3-eventbus-client-tests.ts @@ -0,0 +1,3 @@ +import * as EventBus from "vertx3-eventbus-client"; + +const eb = new EventBus("http://localhost:9999"); From f07524f928d2949d129b10c121c30393711da07d Mon Sep 17 00:00:00 2001 From: Ahto Jussila Date: Mon, 15 May 2017 16:00:06 +0300 Subject: [PATCH 0138/1072] Fix wrong signature for Kue testMode.enter(). The function look like this module.exports.enter = function(process) { processQueue = process || false; Job.prototype.save = testJobSave; Job.prototype.update = testJobUpdate; }; --- types/kue/index.d.ts | 2 +- types/kue/kue-tests.ts | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/types/kue/index.d.ts b/types/kue/index.d.ts index 13f2c667fc..4fc964b118 100644 --- a/types/kue/index.d.ts +++ b/types/kue/index.d.ts @@ -133,7 +133,7 @@ interface Redis { interface TestMode { jobs: Job[]; - enter(): void; + enter(process?: Boolean): void; exit(): void; clear(): void; } diff --git a/types/kue/kue-tests.ts b/types/kue/kue-tests.ts index aa61ff2f6a..d69f6eaead 100644 --- a/types/kue/kue-tests.ts +++ b/types/kue/kue-tests.ts @@ -4,6 +4,18 @@ import kue = require('kue'); var jobs = kue.createQueue(); +// do quick test with testmode enabled + +// testMode enabled where the jobs are not processed +jobs.testMode.enter(); +jobs.testMode.clear(); +jobs.testMode.exit(); + +// testMode enabled where the jobs are processed +jobs.testMode.enter(true); +jobs.testMode.clear(); +jobs.testMode.exit(); + // start redis with $ redis-server // create some jobs at random, 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 0139/1072] [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 597b4debe83f4bdc6752f7c9a9d58456e9fe1aea Mon Sep 17 00:00:00 2001 From: Daryl LaBar Date: Mon, 15 May 2017 11:05:23 -0400 Subject: [PATCH 0140/1072] Fix for @types/xrm missing context.getVersion #16528. Also fixed TD bot parsing of Definitions by making one line, and updating TsLint to allow for the long line. --- types/xrm/index.d.ts | 7 +++++++ types/xrm/tslint.json | 1 + 2 files changed, 8 insertions(+) diff --git a/types/xrm/index.d.ts b/types/xrm/index.d.ts index 6e6a1d5117..f09765442b 100644 --- a/types/xrm/index.d.ts +++ b/types/xrm/index.d.ts @@ -180,6 +180,13 @@ declare namespace Xrm { */ getUserRoles(): string[]; + /** + * Returns the version number of the Dynamics 365 server. + * + * @return The version number + */ + getVersion(): string; + /** * Prefixes the current organization's unique name to a string; typically a URL path. * diff --git a/types/xrm/tslint.json b/types/xrm/tslint.json index 380672b073..29835e4ef0 100644 --- a/types/xrm/tslint.json +++ b/types/xrm/tslint.json @@ -8,6 +8,7 @@ true, "spaces" ], + "max-line-length": [true, 250], "quotemark": [ true, "double" From cc734ec96062496cf09edcf3c09406edd1567e41 Mon Sep 17 00:00:00 2001 From: Daryl LaBar Date: Mon, 15 May 2017 11:05:54 -0400 Subject: [PATCH 0141/1072] Moved to one line. --- types/xrm/index.d.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/types/xrm/index.d.ts b/types/xrm/index.d.ts index f09765442b..56239ba907 100644 --- a/types/xrm/index.d.ts +++ b/types/xrm/index.d.ts @@ -1,10 +1,6 @@ // Type definitions for Microsoft Dynamics xRM API 8.2 // Project: http://www.microsoft.com/en-us/download/details.aspx?id=44567 -// Definitions by: David Berry , -// Matt Ngan , -// Markus Mauch , -// Daryl LaBar , -// Tully H +// Definitions by: David Berry , Matt Ngan , Markus Mauch , Daryl LaBar , Tully H // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 From 12c0225f5ebf2f436bb7c14e81a373a3ee163c7d Mon Sep 17 00:00:00 2001 From: Takeshi YAEDA Date: Tue, 16 May 2017 01:14:52 +0900 Subject: [PATCH 0142/1072] 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 0143/1072] 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 0144/1072] 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 0145/1072] 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 6e78cc48a4bc0ef13cc443ca3291e441fa561b33 Mon Sep 17 00:00:00 2001 From: Adi Dahiya Date: Mon, 15 May 2017 13:23:49 -0400 Subject: [PATCH 0146/1072] Remove react-day-picker typings --- notNeededPackages.json | 6 + types/react-day-picker/index.d.ts | 165 ------------------ .../react-day-picker-tests.tsx | 52 ------ types/react-day-picker/tsconfig.json | 24 --- types/react-day-picker/tslint.json | 3 - 5 files changed, 6 insertions(+), 244 deletions(-) delete mode 100644 types/react-day-picker/index.d.ts delete mode 100644 types/react-day-picker/react-day-picker-tests.tsx delete mode 100644 types/react-day-picker/tsconfig.json delete mode 100644 types/react-day-picker/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index ca42f4d9f5..25205b3c04 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -402,6 +402,12 @@ "sourceRepoURL": "https://github.com/getsentry/raven-js", "asOfVersion": "3.10.0" }, + { + "libraryName": "react-day-picker", + "typingsPackageName": "react-day-picker", + "sourceRepoURL": "https://github.com/gpbl/react-day-picker", + "asOfVersion": "5.3.0" + }, { "libraryName": "Redux", "typingsPackageName": "redux", diff --git a/types/react-day-picker/index.d.ts b/types/react-day-picker/index.d.ts deleted file mode 100644 index 8dc5fcd12e..0000000000 --- a/types/react-day-picker/index.d.ts +++ /dev/null @@ -1,165 +0,0 @@ -// Type definitions for react-day-picker 5.2 -// Project: https://github.com/gpbl/react-day-picker -// Definitions by: Giampaolo Bellavite , Jason Killian -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.1 - -import * as React from 'react'; - -declare namespace DayPicker { - interface LocaleUtils { - formatDay(day: Date, locale: string): string; - formatMonthTitle(month: Date, locale: string): string; - formatWeekdayLong(weekday: number, locale: string): string; - formatWeekdayShort(weekday: number, locale: string): string; - getFirstDayOfWeek(locale: string): number; - getMonths(locale: string): [string, string, string, string, string, string, string, string, string, string, string, string]; - } - - interface DateUtils { - addMonths(d: Date, n: number): Date; - clone(d: Date): Date; - isSameDay(d1: Date, d2: Date): Date; - isPastDay(d: Date): boolean; - isFutureDay(d: Date): boolean; - isDayBetween(day: Date, begin: Date, end: Date): boolean; - addDayToRange(day: Date, range: RangeModifier): RangeModifier; - isDayInRange(day: Date, range: RangeModifier): boolean; - } - - interface CaptionElementProps { - date: Date; - classNames: ClassNames; - localeUtils: LocaleUtils; - locale: string; - months: undefined; - onClick?: React.MouseEventHandler; - } - - interface NavbarElementProps { - className: string; - classNames: ClassNames; - previousMonth: Date; - nextMonth: Date; - showPreviousButton: boolean; - showNextButton: boolean; - onPreviousClick(callback?: () => void): void; - onNextClick(callback?: () => void): void; - dir?: string; - labels: { previousMonth: string; nextMonth: string; }; - localeUtils: LocaleUtils; - locale: string; - } - - interface WeekdayElementProps { - weekday: number; - className: string; - localeUtils: LocaleUtils; - locale: string; - } - - interface ClassNames { - container: string; - interactionDisabled: string; - navBar: string; - navButtonPrev: string; - navButtonNext: string; - - month: string; - caption: string; - weekdays: string; - weekdaysRow: string; - weekday: string; - body: string; - week: string; - day: string; - - today: string; - selected: string; - disabled: string; - outside: string; - } - - interface RangeModifier { - from: Date; - to: Date; - } - interface BeforeModifier { - before: Date; - } - interface AfterModifier { - after: Date; - } - type FunctionModifier = (date: Date) => boolean; - type Modifier = Date | RangeModifier | BeforeModifier | AfterModifier | FunctionModifier; - - interface Modifiers { - today: Modifier | Modifier[]; - outside: Modifier | Modifier[]; - [other: string]: Modifier | Modifier[] | undefined; - } - - interface Props { - canChangeMonth?: boolean; - captionElement?: React.ReactElement> | - React.ComponentClass | - React.SFC; - className?: string; - classNames?: ClassNames; - containerProps?: React.HTMLAttributes; - disabledDays?: Modifier | Modifier[]; - enableOutsideDays?: boolean; - firstDayOfWeek?: number; - fixedWeeks?: boolean; - fromMonth?: Date; - initialMonth?: Date; - labels?: { previousMonth: string; nextMonth: string; }; - locale?: string; - localeUtils?: LocaleUtils; - modifiers?: Partial; - month?: Date; - months?: [string, string, string, string, string, string, string, string, string, string, string, string]; - navbarElement?: React.ReactElement> | - React.ComponentClass | - React.SFC; - numberOfMonths?: number; - onBlur?(e: React.FocusEvent): void; - onCaptionClick?(month: Date, e: React.MouseEvent): void; - onDayClick?(day: Date, modifiers: Modifiers, e: React.MouseEvent): void; - onDayKeyDown?(day: Date, modifiers: Modifiers, e: React.KeyboardEvent): void; - onDayMouseEnter?(day: Date, modifiers: Modifiers, e: React.MouseEvent): void; - onDayMouseLeave?(day: Date, modifiers: Modifiers, e: React.MouseEvent): void; - onDayTouchEnd?(day: Date, modifiers: Modifiers, e: React.TouchEvent): void; - onDayTouchStart?(day: Date, modifiers: Modifiers, e: React.TouchEvent): void; - onFocus?(e: React.FocusEvent): void; - onKeyDown?(e: React.KeyboardEvent): void; - onMonthChange?(month: Date): void; - pagedNavigation?: boolean; - renderDay?(date: Date, modifiers: Modifiers): React.ReactNode; - reverseMonths?: boolean; - selectedDays?: Modifier | Modifier[]; - toMonth?: Date; - weekdayElement?: React.ReactElement> | - React.ComponentClass | - React.SFC; - weekdaysLong?: [string, string, string, string, string, string, string]; - weekdaysShort?: [string, string, string, string, string, string, string]; - } - const VERSION: string; - const LocaleUtils: DayPicker.LocaleUtils; - const DateUtils: DayPicker.DateUtils; -} - -declare class DayPicker extends React.Component { - showMonth(month: Date): void; - - showPreviousMonth(): void; - - showNextMonth(): void; - - showPreviousYear(): void; - - showNextYear(): void; -} - -export = DayPicker; diff --git a/types/react-day-picker/react-day-picker-tests.tsx b/types/react-day-picker/react-day-picker-tests.tsx deleted file mode 100644 index 1733b713dd..0000000000 --- a/types/react-day-picker/react-day-picker-tests.tsx +++ /dev/null @@ -1,52 +0,0 @@ -import * as React from 'react'; -import DayPicker = require('react-day-picker'); - -function isSunday(day: Date) { - return day.getDay() === 0; -} - -function MyComponent() { - return ( - - ); -} -DayPicker.DateUtils.clone(new Date()); -DayPicker.DateUtils.isDayInRange(new Date(), { from: new Date(), to: new Date(2050) }); - -interface MyCaptionProps extends DayPicker.CaptionElementProps { - myProp: number; -} -class Caption extends React.Component { - render() { - const { date, locale, localeUtils, onClick } = this.props; - - if (!date || !localeUtils || !onClick || typeof locale === 'undefined') { - return null; - } - - return ( -

    - { localeUtils.formatMonthTitle(date, locale) } -
    - ); - } -} -; - -type CaptionElementProps = Partial; -class CaptionElement extends React.Component { - render() { - const { date, locale, localeUtils, onClick } = this.props; - if (!date || !locale || !localeUtils || !onClick) { - return
    ; - } - return ( -
    - { localeUtils.formatMonthTitle(date, locale) } -
    - ); - } -} - }/>; diff --git a/types/react-day-picker/tsconfig.json b/types/react-day-picker/tsconfig.json deleted file mode 100644 index 823be84e03..0000000000 --- a/types/react-day-picker/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "baseUrl": "../", - "jsx": "react", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "react-day-picker-tests.tsx" - ] -} diff --git a/types/react-day-picker/tslint.json b/types/react-day-picker/tslint.json deleted file mode 100644 index d88586e5bd..0000000000 --- a/types/react-day-picker/tslint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "dtslint/dt.json" -} From 87156fde6b23db3d1cb7c37316807fc80f440776 Mon Sep 17 00:00:00 2001 From: Simon Schick Date: Tue, 16 May 2017 04:19:15 +0200 Subject: [PATCH 0147/1072] fixed `ext` option and narrowed the type, fixed `compression` being mandatory --- types/hapi/index.d.ts | 50 ++++++++++++++++----- types/hapi/test/route/additional-options.ts | 29 ++++++++++++ types/hapi/test/route/config.ts | 2 + types/hapi/test/server/ext.ts | 4 +- 4 files changed, 73 insertions(+), 12 deletions(-) diff --git a/types/hapi/index.d.ts b/types/hapi/index.d.ts index 3567e50c34..2d5ee18785 100644 --- a/types/hapi/index.d.ts +++ b/types/hapi/index.d.ts @@ -262,8 +262,10 @@ export class Server extends Podium { * [See docs](https://hapijs.com/api/16.1.1#serverextevents) * @param events see @ServerExtConfigurationObject */ - ext(events: ServerExtConfigurationObject[]): void; - ext(events: ServerExtConfigurationObject): void; + ext(events: ServerStartExtConfigurationObject): void; + ext(events: ServerStartExtConfigurationObject[]): void; + ext(events: ServerRequestExtConfigurationObjectWithRequest): void; + ext(events: ServerRequestExtConfigurationObjectWithRequest[]): void; /** * Registers a single extension event using the same properties as used in server.ext(events), but passed as arguments. * [See docs](https://hapijs.com/api/16.1.1#serverextevent-method-options) @@ -271,8 +273,10 @@ export class Server extends Podium { * @param method a function or an array of functions to be executed at a specified point during request processing. * @param options */ - ext(event: ServerExtPoints, method: ServerExtMethod[], options?: ServerExtOptions): void; - ext(event: ServerExtPoints, method: ServerExtMethod, options?: ServerExtOptions): void; + ext(event: ServerStartExtPoints, method: ServerExtFunction[], options?: ServerExtOptions): void; + ext(event: ServerStartExtPoints, method: ServerExtFunction, options?: ServerExtOptions): void; + ext(event: ServerRequestExtPoints, method: ServerExtRequestHandler[], options?: ServerExtOptions): void; + ext(event: ServerRequestExtPoints, method: ServerExtRequestHandler, options?: ServerExtOptions): void; /** * Registers a new handler type to be used in routes * The method function can have a defaults object or function property. If the property is set to an object, that object is used as the default route config for routes using this handler. If the property is set to a function, the function uses the signature function(method) and returns the route default configuration. @@ -880,16 +884,40 @@ export interface CorsConfigurationObject { * [See docs](https://hapijs.com/api/16.1.1#serverextevents) * For context see RouteAdditionalConfigurationOptions > ext */ -export interface ServerExtConfigurationObject { + +// STUFF +export interface ServerStartExtConfigurationObject { /** the extension point event name. */ - type: ServerExtPoints; + type: ServerStartExtPoints; /** * a function or an array of functions to be executed at a specified point during request processing. The required extension function signature is see ServerExtFunction or see ServerExtRequestHandler */ - method: ServerExtMethod | ServerExtMethod[]; + method: ServerExtFunction options?: ServerExtOptions; } +export interface ServerRequestExtConfigurationObject { + /** the extension point event name. */ + type: ServerRequestExtPointsBase; + /** + * a function or an array of functions to be executed at a specified point during request processing. The required extension function signature is see ServerExtFunction or see ServerExtRequestHandler + */ + method: ServerExtRequestHandler + options?: ServerExtOptions; +} + +export interface ServerRequestExtConfigurationObjectWithRequest { + /** the extension point event name. */ + type: ServerRequestExtPoints; + /** + * a function or an array of functions to be executed at a specified point during request processing. The required extension function signature is see ServerExtFunction or see ServerExtRequestHandler + */ + method: ServerExtRequestHandler + options?: ServerExtOptions; +} + +export type RouteExtConfigurationObject = ServerStartExtConfigurationObject | ServerRequestExtConfigurationObject; + /** * [See docs](https://hapijs.com/api/16.1.1#serverextevents) > events > method */ @@ -918,7 +946,9 @@ export interface ServerExtOptions { * * 'onPostStop' - called after the connection listeners are stopped. * [See docs](https://hapijs.com/api/16.1.1#serverextevents) > events > type */ -export type ServerExtPoints = 'onRequest' | 'onPreResponse' | 'onPreAuth' | 'onPostAuth' | 'onPreHandler' | 'onPostHandler' | 'onPreResponse' | 'onPreStart' | 'onPostStart' | 'onPreStop' | 'onPostStop'; +export type ServerStartExtPoints = 'onPreStart' | 'onPostStart' | 'onPreStop' | 'onPostStop'; +export type ServerRequestExtPointsBase = 'onPreResponse' | 'onPreAuth' | 'onPostAuth' | 'onPreHandler' | 'onPostHandler' | 'onPreResponse'; +export type ServerRequestExtPoints = ServerRequestExtPointsBase | 'onRequest'; /** * Server extension function registered an one of the server extension points @@ -985,7 +1015,7 @@ export interface RoutePayloadConfigurationObject { /** the default 'Content-Type' HTTP header value is not present. Defaults to 'application/json'. */ defaultContentType?: string; /** an object where each key is a content-encoding name and each value is an object with the desired decoder settings. Note that encoder settings are set in the root option compression. */ - compression: Dictionary; + compression?: Dictionary; } export type PayLoadOutputOption = 'data' | 'stream' | 'file'; @@ -1079,7 +1109,7 @@ export interface RouteAdditionalConfigurationOptions { /** the Cross-Origin Resource Sharing protocol allows browsers to make cross-origin API calls. CORS is required by web applications running inside a browser which are loaded from a different domain than the API server. CORS headers are disabled by default (false). To enable, set cors to true, or to an object */ cors?: boolean | CorsConfigurationObject; /** defined a route-level request extension points by setting the option to an object with a key for each of the desired extension points ('onRequest' is not allowed), and the value is the same as the [server.ext(events)](https://hapijs.com/api/16.1.1#serverextevents) event argument. */ - ext?: Dictionary; + ext?: RouteExtConfigurationObject | RouteExtConfigurationObject[]; /** defines the behavior for accessing files: */ files?: { /** determines the folder relative paths are resolved against. */ diff --git a/types/hapi/test/route/additional-options.ts b/types/hapi/test/route/additional-options.ts index 99e818d08a..074b9cc155 100644 --- a/types/hapi/test/route/additional-options.ts +++ b/types/hapi/test/route/additional-options.ts @@ -6,6 +6,29 @@ var authConfig: Hapi.RouteAdditionalConfigurationOptions = { app: {} }; +var extConfigSingle: Hapi.RouteAdditionalConfigurationOptions = { + ext: { + type: 'onPreAuth', + method: function (request, reply) { + reply('ok'); + } + } +} + +var extConfigMulti: Hapi.RouteAdditionalConfigurationOptions = { + ext: [{ + type: 'onPreAuth', + method: function (request, reply) { + reply('ok'); + } + }, { + type: 'onPostAuth', + method: function (request, reply) { + reply('ok'); + } + }] +} + // Handler in config const user: Hapi.RouteAdditionalConfigurationOptions = { cache: { expiresIn: 5000, statuses: [200, 201] }, @@ -37,3 +60,9 @@ var cache: Hapi.RouteCacheOptions = { expiresAt: '22:44', }; */ + +var payloadOptions: Hapi.RoutePayloadConfigurationObject = { + allow: 'multipart/form-data', + maxBytes: 123, + output: 'file', +}; diff --git a/types/hapi/test/route/config.ts b/types/hapi/test/route/config.ts index 16457395f8..562534b650 100644 --- a/types/hapi/test/route/config.ts +++ b/types/hapi/test/route/config.ts @@ -43,4 +43,6 @@ const user: Hapi.RouteAdditionalConfigurationOptions = { } }; + + server.route({method: 'GET', path: '/user', config: user }); diff --git a/types/hapi/test/server/ext.ts b/types/hapi/test/server/ext.ts index 410c913c41..500ac1d4af 100644 --- a/types/hapi/test/server/ext.ts +++ b/types/hapi/test/server/ext.ts @@ -7,7 +7,7 @@ server.connection({ port: 80 }); server.ext({ type: 'onRequest', - method: function (request, reply) { + method: function (request, reply) { // Change all requests to '/test' request.setUrl('/test'); @@ -28,7 +28,7 @@ server.start((err) => { }); // Example 2 -server.ext('onRequest', function (request, reply) { +server.ext('onRequest', function (request, reply) { // Change all requests to '/test' request.setUrl('/test'); From 2d2f11dd8d31bcee5a923f87559c4045d92729fb Mon Sep 17 00:00:00 2001 From: Simon Schick Date: Tue, 16 May 2017 04:24:20 +0200 Subject: [PATCH 0148/1072] rm additional whitespace --- types/hapi/test/route/config.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/types/hapi/test/route/config.ts b/types/hapi/test/route/config.ts index 562534b650..16457395f8 100644 --- a/types/hapi/test/route/config.ts +++ b/types/hapi/test/route/config.ts @@ -43,6 +43,4 @@ const user: Hapi.RouteAdditionalConfigurationOptions = { } }; - - server.route({method: 'GET', path: '/user', config: user }); From 8b328fa9ab3bf6a56351058a21633080eec6ff09 Mon Sep 17 00:00:00 2001 From: Simon Schick Date: Tue, 16 May 2017 04:53:30 +0200 Subject: [PATCH 0149/1072] amend route plugins --- types/hapi/index.d.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/types/hapi/index.d.ts b/types/hapi/index.d.ts index 2d5ee18785..9bc1807623 100644 --- a/types/hapi/index.d.ts +++ b/types/hapi/index.d.ts @@ -477,6 +477,8 @@ export class Server extends Podium { table(host?: string): RoutingTableEntry[]; } +export interface RoutePlugins {} + /** * Server Options * Note that the options object is deeply cloned and cannot contain any values that are unsafe to perform deep copy on. @@ -509,7 +511,7 @@ export interface ServerOptions { /** options passed to the mimos module (https://github.com/hapijs/mimos) when generating the mime database used by the server and accessed via server.mime. */ mime?: MimosOptions; /** plugin-specific configuration which can later be accessed via server.settings.plugins. plugins is an object where each key is a plugin name and the value is the configuration. Note the difference between server.settings.plugins which is used to store static configuration values and server.plugins which is meant for storing run-time state. Defaults to {}. */ - plugins?: Object; + plugins?: RoutePlugins; /** if false, will not use node domains to protect against exceptions thrown in handlers and other external code. Defaults to true. */ useDomains?: boolean; } From 3bd056f15eb0a0e9dec0fdce91f747c76e008ad5 Mon Sep 17 00:00:00 2001 From: Lapanti Date: Tue, 16 May 2017 11:26:25 +0300 Subject: [PATCH 0150/1072] Add type definitions for react-infinite-scroller --- types/react-infinite-scroller/index.d.ts | 63 ++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 types/react-infinite-scroller/index.d.ts diff --git a/types/react-infinite-scroller/index.d.ts b/types/react-infinite-scroller/index.d.ts new file mode 100644 index 0000000000..972aa14c4e --- /dev/null +++ b/types/react-infinite-scroller/index.d.ts @@ -0,0 +1,63 @@ +// Type definitions for react-infinite-scroller 1.0.12 +// Project: https://github.com/CassetteRocks/react-infinite-scroller +// Definitions by: Lauri Lavanti +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +declare module 'react-infinite-scroller' { + import * as React from 'react'; + + /** + * properties. + */ + interface InfiniteScrollProps extends React.HTMLProps { + /** + * Name of the element that the component should render as. + * Defaults to 'div'. + */ + element?: string; + /** + * Whether there are more items to be loaded. Event listeners are removed if false. + * Defaults to false. + */ + hasMore?: boolean; + /** + * Whether the component should load the first set of items. + * Defaults to false. + */ + initialLoad?: boolean; + /** + * Whether new items should be loaded when user scrolls to the top of the scrollable area. + * Default to false. + */ + isReverse?: boolean; + /** + * A callback for when more items are requested by the user. + */ + loadMore(): void; + /** + * The number of the first page to load, with the default of 0, the first page is 1. + * Defaults to 0. + */ + pageStart?: number; + /** + * The distance in pixels before the end of the items that will trigger a call to loadMore. + * Defaults to 250. + */ + threshold?: number; + /** + * Proxy to the useCapture option of the added event listeners. + * Defaults to false. + */ + useCapture?: boolean; + /** + * Add scroll listeners to the window, or else, the component's parentNode. + * Defaults to true. + */ + useWindow?: boolean; + } + + export default class InfiniteScroll extends React.Component { } +} + + From 28fcfd7877707c5249ee2f42f492ad25bf7d4c7c Mon Sep 17 00:00:00 2001 From: Lapanti Date: Tue, 16 May 2017 11:31:13 +0300 Subject: [PATCH 0151/1072] Add tsconfig.json for react-infinite-scroller --- types/react-infinite-scroller/tsconfig.json | 22 +++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 types/react-infinite-scroller/tsconfig.json diff --git a/types/react-infinite-scroller/tsconfig.json b/types/react-infinite-scroller/tsconfig.json new file mode 100644 index 0000000000..cb169471f2 --- /dev/null +++ b/types/react-infinite-scroller/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts" + ] +} From 52524f6ad7b48f65642b80b1fba47c0c96937c06 Mon Sep 17 00:00:00 2001 From: Lapanti Date: Tue, 16 May 2017 11:36:48 +0300 Subject: [PATCH 0152/1072] Add tests for react-infinite-scroller --- types/react-infinite-scroller/index.d.ts | 2 +- .../react-infinite-scroller.tsx | 34 +++++++++++++++++++ types/react-infinite-scroller/tsconfig.json | 6 ++-- 3 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 types/react-infinite-scroller/react-infinite-scroller.tsx diff --git a/types/react-infinite-scroller/index.d.ts b/types/react-infinite-scroller/index.d.ts index 972aa14c4e..9d18446b13 100644 --- a/types/react-infinite-scroller/index.d.ts +++ b/types/react-infinite-scroller/index.d.ts @@ -23,7 +23,7 @@ declare module 'react-infinite-scroller' { hasMore?: boolean; /** * Whether the component should load the first set of items. - * Defaults to false. + * Defaults to true. */ initialLoad?: boolean; /** diff --git a/types/react-infinite-scroller/react-infinite-scroller.tsx b/types/react-infinite-scroller/react-infinite-scroller.tsx new file mode 100644 index 0000000000..e98f1dc7f8 --- /dev/null +++ b/types/react-infinite-scroller/react-infinite-scroller.tsx @@ -0,0 +1,34 @@ +import * as React from 'react'; +import InfiniteScroll from 'react-infinite-scroller'; + +class Test1 extends React.Component<{}, {}> { + public render() { + return ( + {}} + > +
    Test 1
    +
    + ); + } +} + +class Test2 extends React.Component<{}, {}> { + public render() { + return ( + {}} + element='section' + hasMore + initialLoad={false} + isReverse + pageStart={2} + threshold={500} + useCapture + useWindow={false} + > +
    Test 1
    +
    + ); + } +} diff --git a/types/react-infinite-scroller/tsconfig.json b/types/react-infinite-scroller/tsconfig.json index cb169471f2..e4dc7b4342 100644 --- a/types/react-infinite-scroller/tsconfig.json +++ b/types/react-infinite-scroller/tsconfig.json @@ -6,9 +6,10 @@ "dom" ], "noImplicitAny": true, - "noImplicitThis": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", + "jsx": "react", "typeRoots": [ "../" ], @@ -17,6 +18,7 @@ "forceConsistentCasingInFileNames": true }, "files": [ - "index.d.ts" + "index.d.ts", + "react-infinite-scroller-tests.tsx" ] } From e18abed9f27e30765c3b78fd1dadc615b9948404 Mon Sep 17 00:00:00 2001 From: Lapanti Date: Tue, 16 May 2017 11:52:51 +0300 Subject: [PATCH 0153/1072] Rename test file to correct one in react-infinite-scroller --- ...ct-infinite-scroller.tsx => react-infinite-scroller-tests.tsx} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename types/react-infinite-scroller/{react-infinite-scroller.tsx => react-infinite-scroller-tests.tsx} (100%) diff --git a/types/react-infinite-scroller/react-infinite-scroller.tsx b/types/react-infinite-scroller/react-infinite-scroller-tests.tsx similarity index 100% rename from types/react-infinite-scroller/react-infinite-scroller.tsx rename to types/react-infinite-scroller/react-infinite-scroller-tests.tsx From aec8542e5f521857860238467a88dde280e5e752 Mon Sep 17 00:00:00 2001 From: Lapanti Date: Tue, 16 May 2017 11:59:19 +0300 Subject: [PATCH 0154/1072] Remove unnecessary newlines in react-infinite-scroller --- types/react-infinite-scroller/index.d.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/types/react-infinite-scroller/index.d.ts b/types/react-infinite-scroller/index.d.ts index 9d18446b13..a563b88966 100644 --- a/types/react-infinite-scroller/index.d.ts +++ b/types/react-infinite-scroller/index.d.ts @@ -59,5 +59,3 @@ declare module 'react-infinite-scroller' { export default class InfiniteScroll extends React.Component { } } - - From 9211be1b8d449634f44b96818e6f0204d2d057ba Mon Sep 17 00:00:00 2001 From: Giedrius Grabauskas Date: Tue, 16 May 2017 12:48:33 +0300 Subject: [PATCH 0155/1072] 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 0156/1072] 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 ac46bea13a0a41bdcc8f5fe50f563c3df354389a Mon Sep 17 00:00:00 2001 From: Simon Schick Date: Tue, 16 May 2017 13:47:24 +0200 Subject: [PATCH 0157/1072] address comments --- types/hapi/index.d.ts | 34 +++++++++++----- types/hapi/test/route/additional-options.ts | 44 ++++++++++++--------- types/hapi/test/route/plugins.ts | 18 +++++++++ types/hapi/tsconfig.json | 3 +- 4 files changed, 69 insertions(+), 30 deletions(-) create mode 100644 types/hapi/test/route/plugins.ts diff --git a/types/hapi/index.d.ts b/types/hapi/index.d.ts index 9bc1807623..4e855f4540 100644 --- a/types/hapi/index.d.ts +++ b/types/hapi/index.d.ts @@ -886,8 +886,6 @@ export interface CorsConfigurationObject { * [See docs](https://hapijs.com/api/16.1.1#serverextevents) * For context see RouteAdditionalConfigurationOptions > ext */ - -// STUFF export interface ServerStartExtConfigurationObject { /** the extension point event name. */ type: ServerStartExtPoints; @@ -898,26 +896,39 @@ export interface ServerStartExtConfigurationObject { options?: ServerExtOptions; } +/** + * An object describing the extension function used whilst registering the extension function in one of the available extension points + * [See docs](https://hapijs.com/api/16.1.1#serverextevents) + * For context see RouteAdditionalConfigurationOptions > ext + */ export interface ServerRequestExtConfigurationObject { /** the extension point event name. */ type: ServerRequestExtPointsBase; /** * a function or an array of functions to be executed at a specified point during request processing. The required extension function signature is see ServerExtFunction or see ServerExtRequestHandler */ - method: ServerExtRequestHandler + method: ServerExtRequestHandler | ServerExtRequestHandler[] options?: ServerExtOptions; } +/** + * An object describing the extension function used whilst registering the extension function in one of the available extension points + * [See docs](https://hapijs.com/api/16.1.1#serverextevents) + * For context see RouteAdditionalConfigurationOptions > ext + */ export interface ServerRequestExtConfigurationObjectWithRequest { /** the extension point event name. */ type: ServerRequestExtPoints; /** * a function or an array of functions to be executed at a specified point during request processing. The required extension function signature is see ServerExtFunction or see ServerExtRequestHandler */ - method: ServerExtRequestHandler + method: ServerExtRequestHandler | ServerExtRequestHandler[]; options?: ServerExtOptions; } +/** + * [See docs](https://hapijs.com/api/16.1.1#route-configuration) > ext + */ export type RouteExtConfigurationObject = ServerStartExtConfigurationObject | ServerRequestExtConfigurationObject; /** @@ -940,16 +951,19 @@ export interface ServerExtOptions { } /** - * [See docs](https://hapijs.com/api/16.1.1#request-lifecycle) - * The available extension points include the request extension points as well as the following server extension points: + * [See docs](https://hapijs.com/api/16.1.1#serverextevents) > events > type * * 'onPreStart' - called before the connection listeners are started. * * 'onPostStart' - called after the connection listeners are started. * * 'onPreStop' - called before the connection listeners are stopped. * * 'onPostStop' - called after the connection listeners are stopped. - * [See docs](https://hapijs.com/api/16.1.1#serverextevents) > events > type */ export type ServerStartExtPoints = 'onPreStart' | 'onPostStart' | 'onPreStop' | 'onPostStop'; +/** + * [See docs](https://hapijs.com/api/16.1.1#request-lifecycle) + * * The available extension points include the request extension points as well as the following server extension points: + */ export type ServerRequestExtPointsBase = 'onPreResponse' | 'onPreAuth' | 'onPostAuth' | 'onPreHandler' | 'onPostHandler' | 'onPreResponse'; + export type ServerRequestExtPoints = ServerRequestExtPointsBase | 'onRequest'; /** @@ -2033,11 +2047,11 @@ export interface RequestHandler { /** * Used by server extension points * err can be BoomError or Error that will be wrapped as a BoomError - * For source [See docs](https://github.com/hapijs/hapi/blob/v16.1.1/lib/reply.js#L109-L118) - * For source [See docs](https://github.com/hapijs/hapi/blob/v16.1.1/lib/response.js#L60-L65) + * For source [See code](https://github.com/hapijs/hapi/blob/v16.1.1/lib/reply.js#L109-L118) + * For source [See code](https://github.com/hapijs/hapi/blob/v16.1.1/lib/response.js#L60-L65) */ export interface ContinuationFunction { - (err: Boom.BoomError): void; + (err?: Boom.BoomError): void; } /** * For source [See docs](https://github.com/hapijs/hapi/blob/v16.1.1/lib/response.js#L60-L65) diff --git a/types/hapi/test/route/additional-options.ts b/types/hapi/test/route/additional-options.ts index 074b9cc155..124766c721 100644 --- a/types/hapi/test/route/additional-options.ts +++ b/types/hapi/test/route/additional-options.ts @@ -3,29 +3,35 @@ import * as Hapi from 'hapi'; var authConfig: Hapi.RouteAdditionalConfigurationOptions = { - app: {} + app: {}, + payload: {}, }; var extConfigSingle: Hapi.RouteAdditionalConfigurationOptions = { - ext: { - type: 'onPreAuth', - method: function (request, reply) { - reply('ok'); + ext: { + type: 'onPreAuth', + method: function (request, reply) { + reply('ok'); + } } - } } var extConfigMulti: Hapi.RouteAdditionalConfigurationOptions = { - ext: [{ - type: 'onPreAuth', - method: function (request, reply) { - reply('ok'); - } - }, { - type: 'onPostAuth', - method: function (request, reply) { - reply('ok'); - } + ext: [{ + type: 'onPreAuth', + method: function (request, reply) { + reply('ok'); + } + }, { + type: 'onPostAuth', + method: function (request, reply) { + reply('ok'); + } + }, { + type: 'onPostStart', + method: function (server, next) { + next(); + } }] } @@ -62,7 +68,7 @@ var cache: Hapi.RouteCacheOptions = { */ var payloadOptions: Hapi.RoutePayloadConfigurationObject = { - allow: 'multipart/form-data', - maxBytes: 123, - output: 'file', + allow: 'multipart/form-data', + maxBytes: 123, + output: 'file', }; diff --git a/types/hapi/test/route/plugins.ts b/types/hapi/test/route/plugins.ts new file mode 100644 index 0000000000..94245238ee --- /dev/null +++ b/types/hapi/test/route/plugins.ts @@ -0,0 +1,18 @@ +// from https://hapijs.com/api#route-configuration > plugins + +import * as Hapi from 'hapi'; + +declare module 'hapi' { + interface RoutePlugins { + coolPlugin: { + optionA: string; + optionB?: boolean; + } + } +} + +var pluginsConfig: Hapi.RouteAdditionalConfigurationOptions = { + plugins: { + coolPlugin: 'test', + } +}; diff --git a/types/hapi/tsconfig.json b/types/hapi/tsconfig.json index f8d5b055e2..5338f169d3 100644 --- a/types/hapi/tsconfig.json +++ b/types/hapi/tsconfig.json @@ -45,6 +45,7 @@ "test/route/auth.ts", "test/route/config.ts", "test/route/handler.ts", + "test/route/plugins.ts", "test/route/prerequisites.ts", "test/route/public-interface.ts", "test/server/app.ts", @@ -89,4 +90,4 @@ "test/server/table.ts", "test/server/version.ts" ] -} \ No newline at end of file +} From a7a58d2e555c7e53a3f22e9bbb4c87586dd73faf Mon Sep 17 00:00:00 2001 From: Klaus Kopruch Date: Tue, 16 May 2017 15:25:55 +0200 Subject: [PATCH 0158/1072] Added missing menu item roles (windowMenu, editMenu, forcereload) --- types/electron/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/electron/index.d.ts b/types/electron/index.d.ts index 782a509305..6905671344 100644 --- a/types/electron/index.d.ts +++ b/types/electron/index.d.ts @@ -2509,7 +2509,7 @@ declare namespace Electron { } type MenuItemType = 'normal' | 'separator' | 'submenu' | 'checkbox' | 'radio'; - type MenuItemRole = 'undo' | 'redo' | 'cut' | 'copy' | 'paste' | 'pasteandmatchstyle' | 'selectall' | 'delete' | 'minimize' | 'close' | 'quit' | 'togglefullscreen' | 'resetzoom' | 'zoomin' | 'zoomout' | 'reload' | 'toggledevtools'; + type MenuItemRole = 'undo' | 'redo' | 'cut' | 'copy' | 'paste' | 'pasteandmatchstyle' | 'selectall' | 'delete' | 'minimize' | 'close' | 'quit' | 'togglefullscreen' | 'resetzoom' | 'zoomin' | 'zoomout' | 'editMenu' | 'windowMenu' | 'reload' | 'forcereload' | 'toggledevtools'; type MenuItemRoleMac = 'about' | 'hide' | 'hideothers' | 'unhide' | 'startspeaking' | 'stopspeaking' | 'front' | 'zoom' | 'window' | 'help' | 'services'; interface MenuItemOptions { @@ -2834,7 +2834,7 @@ declare namespace Electron { */ class ClientRequest extends NodeJS.EventEmitter { /** - * Emitted when an HTTP response is received for the request. + * Emitted when an HTTP response is received for the request. */ on(event: 'response', listener: (response: IncomingMessage) => void): this; /** From d6b34eaa9421afc43fc9ff6d9ee07f62ef87592e Mon Sep 17 00:00:00 2001 From: Steffen Eckardt Date: Tue, 16 May 2017 16:08:39 +0200 Subject: [PATCH 0159/1072] popper.js: Update `PopperOptions.offset.offset` definition --- types/popper.js/index.d.ts | 22 +++++++++++----------- types/popper.js/popper.js-tests.ts | 1 - types/popper.js/tsconfig.json | 2 +- types/popper.js/tslint.json | 8 ++++++++ 4 files changed, 20 insertions(+), 13 deletions(-) create mode 100644 types/popper.js/tslint.json diff --git a/types/popper.js/index.d.ts b/types/popper.js/index.d.ts index 0f8f06a7ba..96f93b3192 100644 --- a/types/popper.js/index.d.ts +++ b/types/popper.js/index.d.ts @@ -1,10 +1,10 @@ -// Type definitions for popper.js v1.8.5 +// Type definitions for popper.js 1.8 // Project: https://github.com/FezVrasta/popper.js/ -// Definitions by: rhysd , joscha +// Definitions by: rhysd , joscha , seckardt // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace Popper { - export interface PopperOptions { + interface PopperOptions { placement?: string; boundariesPadding?: number; modifiers?: { @@ -14,18 +14,18 @@ declare namespace Popper { 'function'?: Function, onLoad?: Function, applyStyle?: { - gpuAcceleration?: boolean, + gpuAcceleration?: boolean }, preventOverflow?: { boundariesElement?: string | Element, - priority?: ('left' | 'right' | 'top' | 'bottom')[], + priority?: Array<'left' | 'right' | 'top' | 'bottom'> }, offset?: { - offset?: number, + offset?: number | string }, flip?: { behavior?: string | string[], - boundariesElement?: string | Element, + boundariesElement?: string | Element }, }; modifiersIgnored?: string[]; @@ -34,7 +34,7 @@ declare namespace Popper { onCreate?(data: Popper.Data): void; onUpdate?(data: Popper.Data): void; } - export class Modifiers { + class Modifiers { applyStyle(data: Object): Object; shift(data: Object): Object; preventOverflow(data: Object): Object; @@ -43,7 +43,7 @@ declare namespace Popper { offset(data: Object): Object; arrow(data: Object): Object; } - export interface Data { + interface Data { placement: string; offsets: { popper: { @@ -56,8 +56,8 @@ declare namespace Popper { } declare class Popper { - public modifiers: Popper.Modifiers; - public placement: string; + modifiers: Popper.Modifiers; + placement: string; constructor(reference: Element, popper: Element | Object, options?: Popper.PopperOptions); diff --git a/types/popper.js/popper.js-tests.ts b/types/popper.js/popper.js-tests.ts index 326a23206c..143de99ccc 100644 --- a/types/popper.js/popper.js-tests.ts +++ b/types/popper.js/popper.js-tests.ts @@ -1,4 +1,3 @@ - import Popper from 'popper.js'; var reference = document.querySelector('.my-button'); diff --git a/types/popper.js/tsconfig.json b/types/popper.js/tsconfig.json index 9c055568cf..d459943eff 100644 --- a/types/popper.js/tsconfig.json +++ b/types/popper.js/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "popper.js-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/popper.js/tslint.json b/types/popper.js/tslint.json new file mode 100644 index 0000000000..107ac2cd42 --- /dev/null +++ b/types/popper.js/tslint.json @@ -0,0 +1,8 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "ban-types": false, + "no-single-declare-module": false, + "no-var": false + } +} From 312f48adc73cee79cf17cae2b3708bf5b84bc31b Mon Sep 17 00:00:00 2001 From: Francis Filion Date: Tue, 16 May 2017 11:57:40 -0400 Subject: [PATCH 0160/1072] [pouchdb-replication] Fixed Sync options to match documentation. --- types/pouchdb-replication/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/pouchdb-replication/index.d.ts b/types/pouchdb-replication/index.d.ts index 057653bada..c88ebd4e23 100644 --- a/types/pouchdb-replication/index.d.ts +++ b/types/pouchdb-replication/index.d.ts @@ -113,8 +113,8 @@ declare namespace PouchDB { } interface SyncOptions extends ReplicateOptions { - push?: boolean; - pull?: boolean; + push?: ReplicateOptions; + pull?: ReplicateOptions; } interface Sync From dc28f3d89c59dc3c16135b56282d14876b9de2aa Mon Sep 17 00:00:00 2001 From: Tom Wanzek Date: Tue, 16 May 2017 12:43:26 -0400 Subject: [PATCH 0161/1072] [d3-selection] Update comments * captures comment updates from patch releases 1.0.3 to 1.0.6 --- types/d3-selection/index.d.ts | 69 ++++++++++++++++++----------------- 1 file changed, 36 insertions(+), 33 deletions(-) diff --git a/types/d3-selection/index.d.ts b/types/d3-selection/index.d.ts index ef164164cf..08daf8b0c5 100644 --- a/types/d3-selection/index.d.ts +++ b/types/d3-selection/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for D3JS d3-selection module 1.0 +// Type definitions for D3JS d3-selection module 1.1 // Project: https://github.com/d3/d3-selection/ // Definitions by: Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -194,7 +194,7 @@ export interface Selection(selector: ValueFn): Selection; @@ -241,7 +241,7 @@ export interface Selection(selector: ValueFn>): Selection; @@ -276,7 +276,7 @@ export interface Selection): this; @@ -304,7 +304,7 @@ export interface Selection): this; @@ -340,7 +340,7 @@ export interface Selection, priority?: null | 'important'): this; @@ -367,7 +367,7 @@ export interface Selection): this; /** @@ -423,7 +423,7 @@ export interface Selection): this; @@ -449,16 +449,17 @@ export interface Selection): this; /** - * Appends a new element of the specified type (tag name) as the last child of each selected element, or the next - * following sibling in the update selection if this is an enter selection. - * (The enter behavior allows you to insert elements into the DOM in an order consistent with bound data; - * however, the slower selection.order may still be required if updating elements change order.) + * Appends a new element of this type (tag name) as the last child of each selected element, + * or before the next following sibling in the update selection if this is an enter selection. + * The latter behavior for enter selections allows you to insert elements into the DOM in an order consistent with the new bound data; + * however, note that selection.order may still be required if updating elements change order + * (i.e., if the order of new data is inconsistent with old data). * * This method returns a new selection containing the appended elements. * Each new element inherits the data of the current elements, if any. @@ -472,10 +473,11 @@ export interface Selection(type: string): Selection; /** - * Appends a new element of the type provided by the element creator function as the last child of each selected element, - * or the next following sibling in the update selection if this is an enter selection. - * (The enter behavior allows you to insert elements into the DOM in an order consistent with bound data; - * however, the slower selection.order may still be required if updating elements change order.) + * Appends a new element of the type provided by the element creator functionas the last child of each selected element, + * or before the next following sibling in the update selection if this is an enter selection. + * The latter behavior for enter selections allows you to insert elements into the DOM in an order consistent with the new bound data; + * however, note that selection.order may still be required if updating elements change order + * (i.e., if the order of new data is inconsistent with old data). * * This method returns a new selection containing the appended elements. * Each new element inherits the data of the current elements, if any. @@ -483,14 +485,15 @@ export interface Selection(type: ValueFn): Selection; /** - * Inserts a new element of the specified type (tag name) before the element matching the specified "before" - * selector string for each selected element. + * Inserts a new element of the specified type (tag name) before the first element matching the specified + * before selector for each selected element. For example, a before selector :first-child will prepend nodes before the first child. + * If before is not specified, it defaults to null. (To append elements in an order consistent with bound data, use selection.append.) * * This method returns a new selection containing the appended elements. * Each new element inherits the data of the current elements, if any. @@ -503,12 +506,12 @@ export interface Selection( @@ -572,7 +575,7 @@ export interface Selection): Selection; @@ -584,7 +587,7 @@ export interface Selection(selector: ValueFn): Selection; @@ -639,7 +642,7 @@ export interface Selection(value: ValueFn): Selection; @@ -659,7 +662,7 @@ export interface Selection): this; @@ -810,11 +813,11 @@ export interface Selection): this; From 91db150773e48a2bc84cdee42e69af0fe4027060 Mon Sep 17 00:00:00 2001 From: Jason Cheatham Date: Tue, 16 May 2017 13:43:56 -0400 Subject: [PATCH 0162/1072] 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 6f8ca80377216a8691b2630cd2b119f06da1b8b3 Mon Sep 17 00:00:00 2001 From: Humberto Rocha Date: Tue, 16 May 2017 15:06:31 -0300 Subject: [PATCH 0163/1072] adding country-select-js typings --- .../country-select-js-tests.ts | 1 + types/country-select-js/index.d.ts | 55 +++++++++++++++++++ types/country-select-js/tsconfig.json | 23 ++++++++ types/country-select-js/tslint.json | 1 + 4 files changed, 80 insertions(+) create mode 100644 types/country-select-js/country-select-js-tests.ts create mode 100644 types/country-select-js/index.d.ts create mode 100644 types/country-select-js/tsconfig.json create mode 100644 types/country-select-js/tslint.json diff --git a/types/country-select-js/country-select-js-tests.ts b/types/country-select-js/country-select-js-tests.ts new file mode 100644 index 0000000000..145dda23b2 --- /dev/null +++ b/types/country-select-js/country-select-js-tests.ts @@ -0,0 +1 @@ +$('#country').countrySelect(); diff --git a/types/country-select-js/index.d.ts b/types/country-select-js/index.d.ts new file mode 100644 index 0000000000..6aea963e0d --- /dev/null +++ b/types/country-select-js/index.d.ts @@ -0,0 +1,55 @@ +// Type definitions for country-select-js 1.0 +// Project: https://github.com/mrmarkfrench/country-select-js +// Definitions by: Humberto Rocha +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare namespace CountrySelectJs { + interface Options { + /** + * Set the default country by it's country code. Otherwise it will just be + * the first country in the list. + */ + defaultCountry?: string; + + /** + * Display only the countries you specify. Takes an array of country codes. + */ + onlyCountries?: string[]; + + /** + * Specify the countries to appear at the top of the list. Defaults to + * ["us", "gb"] + */ + preferredCountries?: string[]; + + /** + * Set the dropdown's width to be the same as the input. This is + * automatically enabled for small screens. + */ + responsiveDropdown?: boolean; + } + + interface CountryData { + name: string; + iso2: string; + } +} + +interface JQuery { + /** + * Remove the plugin from the input, and unbind any event listeners. + */ + countrySelect(method: 'destroy'): void; + + /** + * Get the country data for the currently selected flag. + */ + countrySelect(method: 'getSelectedCountryData'): CountrySelectJs.CountryData; + + countrySelect(method: string, value: string): void; + + /** + * initialize the plugin with optional options. + */ + countrySelect(options?: CountrySelectJs.Options): JQueryDeferred; +} diff --git a/types/country-select-js/tsconfig.json b/types/country-select-js/tsconfig.json new file mode 100644 index 0000000000..807376d634 --- /dev/null +++ b/types/country-select-js/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", + "country-select-js-tests.ts" + ] +} diff --git a/types/country-select-js/tslint.json b/types/country-select-js/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/country-select-js/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From c886bcf40e7c457633fff3a84ad76a6782b891ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Paulo?= Date: Tue, 16 May 2017 15:43:39 -0300 Subject: [PATCH 0164/1072] Update three-core.d.ts please change the return type of the load method of CubeTextureLoader to reflect the behaviour of the library. --- types/three/three-core.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/three/three-core.d.ts b/types/three/three-core.d.ts index 8f3cc5ce7f..f396e6b2c7 100644 --- a/types/three/three-core.d.ts +++ b/types/three/three-core.d.ts @@ -2243,7 +2243,7 @@ export class CubeTextureLoader { corssOrigin: string; path: string; - load(urls: Array, onLoad?: (texture: CubeTexture) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void; + load(urls: Array, onLoad?: (texture: CubeTexture) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): CubeTexture; setCrossOrigin(crossOrigin: string): CubeTextureLoader; setPath(path: string): CubeTextureLoader; } 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 0165/1072] 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 deccd7e7e8d89564088205634ff9cc92f969c581 Mon Sep 17 00:00:00 2001 From: Humberto Rocha Date: Tue, 16 May 2017 16:46:54 -0300 Subject: [PATCH 0166/1072] add more tests for country-select-js --- types/country-select-js/country-select-js-tests.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/types/country-select-js/country-select-js-tests.ts b/types/country-select-js/country-select-js-tests.ts index 145dda23b2..066ff53500 100644 --- a/types/country-select-js/country-select-js-tests.ts +++ b/types/country-select-js/country-select-js-tests.ts @@ -1 +1,7 @@ $('#country').countrySelect(); + +$('#country').countrySelect({ + 'defaultCountry': 'gb' +}); + +$('#country').countrySelect('destroy'); From 19147d0035d54100483fab88825acbe0102f4305 Mon Sep 17 00:00:00 2001 From: Humberto Rocha Date: Tue, 16 May 2017 16:50:47 -0300 Subject: [PATCH 0167/1072] add missing reference to jquery --- types/country-select-js/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/country-select-js/index.d.ts b/types/country-select-js/index.d.ts index 6aea963e0d..72c33489c2 100644 --- a/types/country-select-js/index.d.ts +++ b/types/country-select-js/index.d.ts @@ -3,6 +3,8 @@ // Definitions by: Humberto Rocha // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +/// + declare namespace CountrySelectJs { interface Options { /** From dbde7c423fadbd49b21efa09e62408901c595974 Mon Sep 17 00:00:00 2001 From: Humberto Rocha Date: Tue, 16 May 2017 16:52:37 -0300 Subject: [PATCH 0168/1072] remove unnecessary property quotes --- types/country-select-js/country-select-js-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/country-select-js/country-select-js-tests.ts b/types/country-select-js/country-select-js-tests.ts index 066ff53500..a3bf640b69 100644 --- a/types/country-select-js/country-select-js-tests.ts +++ b/types/country-select-js/country-select-js-tests.ts @@ -1,7 +1,7 @@ $('#country').countrySelect(); $('#country').countrySelect({ - 'defaultCountry': 'gb' + defaultCountry: 'gb' }); $('#country').countrySelect('destroy'); From 9d6acd7df2acea9e5ead95b5b8261a0f7197364c Mon Sep 17 00:00:00 2001 From: Humberto Rocha Date: Tue, 16 May 2017 17:09:40 -0300 Subject: [PATCH 0169/1072] set strictNullChecks to true --- types/country-select-js/tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/country-select-js/tsconfig.json b/types/country-select-js/tsconfig.json index 807376d634..749b1b3af1 100644 --- a/types/country-select-js/tsconfig.json +++ b/types/country-select-js/tsconfig.json @@ -7,7 +7,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" From 3b36e391a7fa6afc79e894ae1a5ab567f0d4126b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kov=C3=A1cs=20Vince?= Date: Tue, 16 May 2017 22:53:49 +0200 Subject: [PATCH 0170/1072] Type definitions for get-node-dimensions 1.2 --- .../get-node-dimensions-tests.ts | 3 +++ types/get-node-dimensions/index.d.ts | 17 ++++++++++++++ types/get-node-dimensions/tsconfig.json | 22 +++++++++++++++++++ types/get-node-dimensions/tslint.json | 1 + 4 files changed, 43 insertions(+) create mode 100644 types/get-node-dimensions/get-node-dimensions-tests.ts create mode 100644 types/get-node-dimensions/index.d.ts create mode 100644 types/get-node-dimensions/tsconfig.json create mode 100644 types/get-node-dimensions/tslint.json diff --git a/types/get-node-dimensions/get-node-dimensions-tests.ts b/types/get-node-dimensions/get-node-dimensions-tests.ts new file mode 100644 index 0000000000..224d9608e0 --- /dev/null +++ b/types/get-node-dimensions/get-node-dimensions-tests.ts @@ -0,0 +1,3 @@ +import * as NodeDimensions from 'get-node-dimensions'; + +const dimensions: NodeDimensions.NodeDimensions = NodeDimensions.getNodeDimension(); diff --git a/types/get-node-dimensions/index.d.ts b/types/get-node-dimensions/index.d.ts new file mode 100644 index 0000000000..cea8944943 --- /dev/null +++ b/types/get-node-dimensions/index.d.ts @@ -0,0 +1,17 @@ +// Type definitions for get-node-dimensions 1.2 +// Project: https://github.com/souporserious/get-node-dimensions +// Definitions by: Kovács Vince +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export as namespace getNodeDimensions; + +export interface NodeDimensions { + width: number, + height: number, + top: number, + right: number, + bottom: number, + left: number +} + +export function getNodeDimension (): NodeDimensions; diff --git a/types/get-node-dimensions/tsconfig.json b/types/get-node-dimensions/tsconfig.json new file mode 100644 index 0000000000..f8eec26e74 --- /dev/null +++ b/types/get-node-dimensions/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", + "get-node-dimensions-tests.ts" + ] +} diff --git a/types/get-node-dimensions/tslint.json b/types/get-node-dimensions/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/get-node-dimensions/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From d28f34da926464e031d8f57cdf8d9be166c776b5 Mon Sep 17 00:00:00 2001 From: Ryan Schwers Date: Tue, 16 May 2017 14:39:14 -0700 Subject: [PATCH 0171/1072] [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 04100cd5cebf0cef7d481fcd88da2a6078d74662 Mon Sep 17 00:00:00 2001 From: Dolan Date: Tue, 16 May 2017 23:46:36 +0100 Subject: [PATCH 0172/1072] Added more methods --- types/jsforce/index.d.ts | 18 +++++++++++++++++- types/jsforce/jsforce-tests.ts | 8 ++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/types/jsforce/index.d.ts b/types/jsforce/index.d.ts index 67d0fcdda2..36858776d0 100644 --- a/types/jsforce/index.d.ts +++ b/types/jsforce/index.d.ts @@ -20,7 +20,8 @@ declare namespace jsforce { class SObject { record(options: any, callback?: (err: Error, ret: any) => void): void; update(options: SObjectCreateOptions, callback?: (err: Error, ret: any) => void): void; - retrieve(objectId: string | string[], 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; describeGlobal(callback: (err: Error, res: any) => void): void; describe$(callback: (err: Error, ret: DescribeSObjectResult) => void): void; @@ -44,9 +45,20 @@ declare namespace jsforce { 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; 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; 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; + layouts(layoutName?: string, callback?: (err: Error, info: LayoutInfo) => void): Promise; + listview(id: string): ListView; + listviews(callback?: (err: Error, info: ListViewsInfo) => void): Promise; + quickAction(actionName: string): QuickAction; + quickActions(callback?: (err: Error, info: any) => void): Promise; + recent(callback?: (err: Error, ret: RecordResult) => void): Promise; + select(field?: Object | string[] | string, callback?: (err: Error, ret: T[]) => void): Query; } interface ConnectionOptions { @@ -159,6 +171,10 @@ declare namespace jsforce { interface Batch { } interface CompactLayoutInfo { } interface DeletedRecordsInfo { } + interface LayoutInfo { } + interface ListView { } + interface ListViewsInfo { } + interface QuickAction { } } export = jsforce; diff --git a/types/jsforce/jsforce-tests.ts b/types/jsforce/jsforce-tests.ts index cf25cd4a6b..bd9738bee9 100644 --- a/types/jsforce/jsforce-tests.ts +++ b/types/jsforce/jsforce-tests.ts @@ -30,6 +30,14 @@ salesforceConnection.sobject("ContentVersion").create({ } }); +salesforceConnection.sobject("ContentVersion").retrieve("world", { + test: "test" +}, (err, ret: sf.RecordResult) => { + if (err || !ret.success) { + return; + } +}); + salesforceConnection.sobject("ContentVersion").findOne({ Id: '' }, (err, contentVersion) => { }); From f2cf1da49cc4a647dee9f7a4a5c6bbb7a6f39ab7 Mon Sep 17 00:00:00 2001 From: Simon Schick Date: Wed, 17 May 2017 01:22:34 +0200 Subject: [PATCH 0173/1072] address comments #2 --- types/hapi/index.d.ts | 2 +- types/hapi/test/route/additional-options.ts | 21 ++++++++++----------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/types/hapi/index.d.ts b/types/hapi/index.d.ts index 4e855f4540..59e7748bc6 100644 --- a/types/hapi/index.d.ts +++ b/types/hapi/index.d.ts @@ -892,7 +892,7 @@ export interface ServerStartExtConfigurationObject { /** * a function or an array of functions to be executed at a specified point during request processing. The required extension function signature is see ServerExtFunction or see ServerExtRequestHandler */ - method: ServerExtFunction + method: ServerExtFunction | ServerExtFunction[]; options?: ServerExtOptions; } diff --git a/types/hapi/test/route/additional-options.ts b/types/hapi/test/route/additional-options.ts index 124766c721..aaf5a33066 100644 --- a/types/hapi/test/route/additional-options.ts +++ b/types/hapi/test/route/additional-options.ts @@ -20,18 +20,18 @@ var extConfigMulti: Hapi.RouteAdditionalConfigurationOptions = { ext: [{ type: 'onPreAuth', method: function (request, reply) { - reply('ok'); - } - }, { - type: 'onPostAuth', - method: function (request, reply) { - reply('ok'); + reply('ok'); } }, { - type: 'onPostStart', - method: function (server, next) { - next(); - } + type: 'onPostAuth', + method: function (request, reply) { + reply('ok'); + } + }, { + type: 'onPostStart', + method: function (server, next) { + next(); + } }] } @@ -39,7 +39,6 @@ var extConfigMulti: Hapi.RouteAdditionalConfigurationOptions = { const user: Hapi.RouteAdditionalConfigurationOptions = { cache: { expiresIn: 5000, statuses: [200, 201] }, handler: function (request, reply) { - return reply({ name: 'John' }); } }; From 305b1690610a07f25f79a74bb87c6e13adb7770d Mon Sep 17 00:00:00 2001 From: Dolan Date: Wed, 17 May 2017 00:52:31 +0100 Subject: [PATCH 0174/1072] Split up the file into multiple, more manageable files --- types/jsforce/connection.ts | 28 ++++ types/jsforce/create-options.ts | 42 +++++ types/jsforce/date-enum.ts | 3 + types/jsforce/describe-result.ts | 4 + types/jsforce/index.d.ts | 174 +-------------------- types/jsforce/jsforce-tests.ts | 13 +- types/jsforce/query.ts | 34 ++++ types/jsforce/record-result.ts | 7 + types/jsforce/salesforce-id.ts | 2 + types/jsforce/salesforce-object-options.ts | 7 + types/jsforce/salesforce-object.ts | 60 +++++++ types/jsforce/tsconfig.json | 8 + 12 files changed, 206 insertions(+), 176 deletions(-) create mode 100644 types/jsforce/connection.ts create mode 100644 types/jsforce/create-options.ts create mode 100644 types/jsforce/date-enum.ts create mode 100644 types/jsforce/describe-result.ts create mode 100644 types/jsforce/query.ts create mode 100644 types/jsforce/record-result.ts create mode 100644 types/jsforce/salesforce-id.ts create mode 100644 types/jsforce/salesforce-object-options.ts create mode 100644 types/jsforce/salesforce-object.ts diff --git a/types/jsforce/connection.ts b/types/jsforce/connection.ts new file mode 100644 index 0000000000..a1f4f6f809 --- /dev/null +++ b/types/jsforce/connection.ts @@ -0,0 +1,28 @@ +import { SObjectCreateOptions } from './create-options'; +import { DescribeSObjectResult } from './describe-result'; +import { Query } from './query'; +import { RecordResult } from './record-result'; +import { SObject } from './salesforce-object'; + +export interface ConnectionOptions { + instanceUrl?: string; + accessToken?: string; + refreshToken?: string; + oauth2?: { + clientId: string, + clientSecret: string, + redirectUri?: string, + }; + sessionId?: string; + serverUrl?: string; + redirectUri?: string; +} + +export type ConnectionEvent = "refresh"; + +export declare class Connection { + constructor(params: ConnectionOptions) + + sobject(resource: string): SObject; + on(eventName: ConnectionEvent, callback: Function): void; +} diff --git a/types/jsforce/create-options.ts b/types/jsforce/create-options.ts new file mode 100644 index 0000000000..e72de859c7 --- /dev/null +++ b/types/jsforce/create-options.ts @@ -0,0 +1,42 @@ +import { SalesforceId } from './salesforce-id'; +import { SObjectOptions } from './salesforce-object-options'; + +export interface SObjectCreateOptions extends SObjectOptions { + IsDeleted?: boolean; + MasterRecordId?: SalesforceId; + Name?: string; + Type?: string; + ParentId?: SalesforceId; + BillingStreet?: string; + BillingCity?: string; + BillingState?: string; + BillingPostalCode?: string; + BillingCountry?: string; + BillingLatitude?: number; + BillingLongitude?: number; + ShippingStreet?: string; + ShippingCity?: string; + ShippingState?: string; + ShippingPostalCode?: string; + ShippingCountry?: string; + ShippingLatitude?: number; + ShippingLongitude?: number; + Phone?: string; + Website?: string; + Industry?: string; + NumberOfEmployees?: number; + Description?: string; + OwnerId?: SalesforceId; + CreatedDate?: Date; + CreatedById?: SalesforceId; + LastModifiedDate?: Date; + LastModifiedById?: SalesforceId; + SystemModstamp?: Date; + LastActivityDate?: Date; + LastViewedDate?: Date; + LastReferencedDate?: Date; + Jigsaw?: string; + JigsawCompanyId?: string; + AccountSource?: string; + SicDesc?: string; +} diff --git a/types/jsforce/date-enum.ts b/types/jsforce/date-enum.ts new file mode 100644 index 0000000000..0f5d9b6408 --- /dev/null +++ b/types/jsforce/date-enum.ts @@ -0,0 +1,3 @@ +export enum Date { + YESTERDAY +} diff --git a/types/jsforce/describe-result.ts b/types/jsforce/describe-result.ts new file mode 100644 index 0000000000..584a62d3bf --- /dev/null +++ b/types/jsforce/describe-result.ts @@ -0,0 +1,4 @@ +export interface DescribeSObjectResult { + label: string; + fields: string[]; +} diff --git a/types/jsforce/index.d.ts b/types/jsforce/index.d.ts index 36858776d0..4c0f82b626 100644 --- a/types/jsforce/index.d.ts +++ b/types/jsforce/index.d.ts @@ -8,173 +8,7 @@ import * as stream from 'stream'; import * as express from 'express'; import * as glob from 'glob'; -declare namespace jsforce { - type ConnectionEvent = "refresh"; - class Connection { - constructor(params: ConnectionOptions) - - sobject(resource: string): SObject; - on(eventName: ConnectionEvent, callback: Function): void; - } - - class SObject { - record(options: any, callback?: (err: Error, ret: any) => void): void; - 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; - describeGlobal(callback: (err: Error, res: any) => void): void; - describe$(callback: (err: Error, ret: DescribeSObjectResult) => void): void; - describeGlobal$(callback: (err: Error, res: any) => void): void; - - find(query?: any, callback?: (err: Error, ret: T[]) => void): Query; - find(query?: any, fields?: Object | string[] | string, callback?: (err: Error, ret: T[]) => void): Query; - find(query?: any, fields?: Object | string[] | string, options?: Object, callback?: (err: Error, ret: T[]) => void): Query; - - findOne(query?: any, callback?: (err: Error, ret: T) => void): void; - findOne(query?: any, fields?: Object | string[] | string, callback?: (err: Error, ret: T) => void): void; - findOne(query?: any, fields?: Object | string[] | string, options?: Object, callback?: (err: Error, ret: T) => void): void; - - approvalLayouts(callback?: (layoutInfo: ApprovalLayoutInfo) => void): Promise; - bulkload(operation: string, options?: { extIdField?: string }, input?: Record[] | stream.Stream[] | string[], callback?: (err: Error, ret: RecordResult) => void): Batch; - 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; - 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; - 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; - 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; - layouts(layoutName?: string, callback?: (err: Error, info: LayoutInfo) => void): Promise; - listview(id: string): ListView; - listviews(callback?: (err: Error, info: ListViewsInfo) => void): Promise; - quickAction(actionName: string): QuickAction; - quickActions(callback?: (err: Error, info: any) => void): Promise; - recent(callback?: (err: Error, ret: RecordResult) => void): Promise; - select(field?: Object | string[] | string, callback?: (err: Error, ret: T[]) => void): Query; - } - - interface ConnectionOptions { - instanceUrl?: string; - accessToken?: string; - refreshToken?: string; - oauth2?: { - clientId: string, - clientSecret: string, - redirectUri?: string, - }; - sessionId?: string; - serverUrl?: string; - redirectUri?: string; - } - - interface SObjectOptions { - Id?: SalesforceId; - Name?: string; - ExtId__c?: string; - } - - class SalesforceId extends String { - } - - interface SObjectCreateOptions extends SObjectOptions { - IsDeleted?: boolean, - MasterRecordId?: SalesforceId, - Name?: string, - Type?: string, - ParentId?: SalesforceId, - BillingStreet?: string, - BillingCity?: string, - BillingState?: string, - BillingPostalCode?: string, - BillingCountry?: string, - BillingLatitude?: number, - BillingLongitude?: number, - ShippingStreet?: string, - ShippingCity?: string, - ShippingState?: string, - ShippingPostalCode?: string, - ShippingCountry?: string, - ShippingLatitude?: number, - ShippingLongitude?: number, - Phone?: string, - Website?: string, - Industry?: string, - NumberOfEmployees?: number, - Description?: string, - OwnerId?: SalesforceId, - CreatedDate?: Date, - CreatedById?: SalesforceId, - LastModifiedDate?: Date, - LastModifiedById?: SalesforceId, - SystemModstamp?: Date, - LastActivityDate?: Date, - LastViewedDate?: Date, - LastReferencedDate?: Date, - Jigsaw?: string; - JigsawCompanyId?: string; - AccountSource?: string; - SicDesc?: string; - } - - interface DescribeSObjectResult { - label: string; - fields: string[]; - } - - enum Date { - YESTERDAY - } - - class Query { - filter(filter: Object): Query; - hint(hint: Object): Query; - limit(value: number): Query; - maxFetch(value: number): Query; - offset(value: number): Query; - skip(value: number): Query; - sort(keyOrList: string | Object[] | Object, direction?: "ASC" | "DESC" | number): Query; - run(options?: ExecuteOptions, callback?: (err: Error, records: T[]) => void): Query; - execute(options?: ExecuteOptions, callback?: (err: Error, records: T[]) => void): Query; - exec(options?: ExecuteOptions, callback?: (err: Error, records: T[]) => void): Query; - del(callback?: (err: Error, ret: RecordResult) => void): any; - delete(callback?: (err: Error, ret: RecordResult) => void): any; - destroy(callback?: (err: Error, ret: RecordResult) => void): Promise; - explain(callback?: (err: Error, info: ExplainInfo) => void): Promise; - scanAll(value: boolean): Query; - select(fields: Object | string[] | string): Query; - then(onSuccess?: Function, onRejected?: Function): Promise; - thenCall(callback?: (err: Error, records: T) => void): Query; - toSOQL(callback: (err: Error, soql: string) => void): Promise; - update(mapping: any, type: string, callback: (err: Error, records: RecordResult[]) => void): Promise; - where(conditions: Object | string): Query; - } - - interface ExecuteOptions { - autoFetch?: boolean; - maxFetch?: number; - scanAll?: number; - } - - interface RecordResult { id: SalesforceId, success: boolean, anys: Object[] } - - interface ExplainInfo { } - interface ApprovalLayoutInfo { } - interface Record { } - interface Batch { } - interface CompactLayoutInfo { } - interface DeletedRecordsInfo { } - interface LayoutInfo { } - interface ListView { } - interface ListViewsInfo { } - interface QuickAction { } -} - -export = jsforce; +export { Date } from './date-enum'; +export { RecordResult } from './record-result'; +export { Connection } from './connection'; +export { SObject } from './salesforce-object'; diff --git a/types/jsforce/jsforce-tests.ts b/types/jsforce/jsforce-tests.ts index bd9738bee9..70a41ec934 100644 --- a/types/jsforce/jsforce-tests.ts +++ b/types/jsforce/jsforce-tests.ts @@ -13,7 +13,7 @@ salesforceConnection.sobject("Account").create({ Name: "Test Acc 2", BillingStreet: "Maplestory street", BillingPostalCode: "ME4 666" -}, (err, ret: sf.RecordResult) => { +}, (err: Error, ret: sf.RecordResult) => { if (err || !ret.success) { return; } @@ -24,7 +24,7 @@ salesforceConnection.sobject("ContentVersion").create({ Title: 'hello', PathOnClient: './hello-world.jpg', VersionData: '{ Test: Data }' -}, (err, ret: sf.RecordResult) => { +}, (err: Error, ret: sf.RecordResult) => { if (err || !ret.success) { return; } @@ -32,22 +32,23 @@ salesforceConnection.sobject("ContentVersion").create({ salesforceConnection.sobject("ContentVersion").retrieve("world", { test: "test" -}, (err, ret: sf.RecordResult) => { +}, (err: Error, ret: sf.RecordResult) => { if (err || !ret.success) { return; } }); salesforceConnection.sobject("ContentVersion").findOne({ Id: '' }, (err, contentVersion) => { - }); salesforceConnection.sobject("ContentDocumentLink").create({ ContentDocumentId: '', LinkedEntityId: '', ShareType: "I" -}, (err, ret: sf.RecordResult) => { +}, (err: Error, ret: sf.RecordResult) => { if (err || !ret.success) { return; } -}); \ No newline at end of file +}); + +sf.Date.YESTERDAY; diff --git a/types/jsforce/query.ts b/types/jsforce/query.ts new file mode 100644 index 0000000000..d5beec791f --- /dev/null +++ b/types/jsforce/query.ts @@ -0,0 +1,34 @@ +import { SalesforceId } from './salesforce-id'; +import { RecordResult } from './record-result'; + +export interface ExecuteOptions { + autoFetch?: boolean; + maxFetch?: number; + scanAll?: number; +} + +export declare class Query { + filter(filter: Object): Query; + hint(hint: Object): Query; + limit(value: number): Query; + maxFetch(value: number): Query; + offset(value: number): Query; + skip(value: number): Query; + sort(keyOrList: string | Object[] | Object, direction?: "ASC" | "DESC" | number): Query; + run(options?: ExecuteOptions, callback?: (err: Error, records: T[]) => void): Query; + execute(options?: ExecuteOptions, callback?: (err: Error, records: T[]) => void): Query; + exec(options?: ExecuteOptions, callback?: (err: Error, records: T[]) => void): Query; + del(callback?: (err: Error, ret: RecordResult) => void): any; + delete(callback?: (err: Error, ret: RecordResult) => void): any; + destroy(callback?: (err: Error, ret: RecordResult) => void): Promise; + explain(callback?: (err: Error, info: ExplainInfo) => void): Promise; + scanAll(value: boolean): Query; + select(fields: Object | string[] | string): Query; + then(onSuccess?: Function, onRejected?: Function): Promise; + thenCall(callback?: (err: Error, records: T) => void): Query; + toSOQL(callback: (err: Error, soql: string) => void): Promise; + update(mapping: any, type: string, callback: (err: Error, records: RecordResult[]) => void): Promise; + where(conditions: Object | string): Query; +} + +export interface ExplainInfo { } diff --git a/types/jsforce/record-result.ts b/types/jsforce/record-result.ts new file mode 100644 index 0000000000..bf53a5bf98 --- /dev/null +++ b/types/jsforce/record-result.ts @@ -0,0 +1,7 @@ +import { SalesforceId } from './salesforce-id'; + +export interface RecordResult { + id: SalesforceId; + success: boolean; + anys: Object[]; +} diff --git a/types/jsforce/salesforce-id.ts b/types/jsforce/salesforce-id.ts new file mode 100644 index 0000000000..87d086880f --- /dev/null +++ b/types/jsforce/salesforce-id.ts @@ -0,0 +1,2 @@ +export class SalesforceId extends String { +} diff --git a/types/jsforce/salesforce-object-options.ts b/types/jsforce/salesforce-object-options.ts new file mode 100644 index 0000000000..2cc6e46f39 --- /dev/null +++ b/types/jsforce/salesforce-object-options.ts @@ -0,0 +1,7 @@ +import { SalesforceId } from './salesforce-id'; + +export interface SObjectOptions { + Id?: SalesforceId; + Name?: string; + ExtId__c?: string; +} diff --git a/types/jsforce/salesforce-object.ts b/types/jsforce/salesforce-object.ts new file mode 100644 index 0000000000..2ec340d1c8 --- /dev/null +++ b/types/jsforce/salesforce-object.ts @@ -0,0 +1,60 @@ +import * as stream from 'stream'; + +import { SObjectCreateOptions } from './create-options'; +import { DescribeSObjectResult } from './describe-result'; +import { Query } from './query'; +import { RecordResult } from './record-result'; + +export declare class SObject { + record(options: any, callback?: (err: Error, ret: any) => void): void; + 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; + describeGlobal(callback: (err: Error, res: any) => void): void; + describe$(callback: (err: Error, ret: DescribeSObjectResult) => void): void; + describeGlobal$(callback: (err: Error, res: any) => void): void; + + find(query?: any, callback?: (err: Error, ret: T[]) => void): Query; + find(query?: any, fields?: Object | string[] | string, callback?: (err: Error, ret: T[]) => void): Query; + find(query?: any, fields?: Object | string[] | string, options?: Object, callback?: (err: Error, ret: T[]) => void): Query; + + findOne(query?: any, callback?: (err: Error, ret: T) => void): void; + findOne(query?: any, fields?: Object | string[] | string, callback?: (err: Error, ret: T) => void): void; + findOne(query?: any, fields?: Object | string[] | string, options?: Object, callback?: (err: Error, ret: T) => void): void; + + approvalLayouts(callback?: (layoutInfo: ApprovalLayoutInfo) => void): Promise; + bulkload(operation: string, options?: { extIdField?: string }, input?: Record[] | stream.Stream[] | string[], callback?: (err: Error, ret: RecordResult) => void): Batch; + 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; + 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; + 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; + 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; + layouts(layoutName?: string, callback?: (err: Error, info: LayoutInfo) => void): Promise; + listview(id: string): ListView; + listviews(callback?: (err: Error, info: ListViewsInfo) => void): Promise; + quickAction(actionName: string): QuickAction; + quickActions(callback?: (err: Error, info: any) => void): Promise; + recent(callback?: (err: Error, ret: RecordResult) => void): Promise; + select(field?: Object | string[] | string, callback?: (err: Error, ret: T[]) => void): Query; +} + +export interface ApprovalLayoutInfo { } +export interface Record { } +export interface Batch { } +export interface CompactLayoutInfo { } +export interface DeletedRecordsInfo { } +export interface LayoutInfo { } +export interface ListView { } +export interface ListViewsInfo { } +export interface QuickAction { } diff --git a/types/jsforce/tsconfig.json b/types/jsforce/tsconfig.json index a7acac4d84..c7987cf4b9 100644 --- a/types/jsforce/tsconfig.json +++ b/types/jsforce/tsconfig.json @@ -17,6 +17,14 @@ }, "files": [ "index.d.ts", + "connection.ts", + "create-options.ts", + "date-enum.ts", + "salesforce-object-options.ts", + "salesforce-object.ts", + "salesforce-id.ts", + "query.ts", + "describe-result.ts", "jsforce-tests.ts" ] } \ No newline at end of file From 0cf0d087859c5ae68a2cf574414c908883872784 Mon Sep 17 00:00:00 2001 From: Dolan Date: Wed, 17 May 2017 01:41:33 +0100 Subject: [PATCH 0175/1072] Added more methods and enum types --- types/jsforce/date-enum.ts | 38 ++++++++++++++++++++++- types/jsforce/query.ts | 2 +- types/jsforce/salesforce-object.ts | 48 ++++++++++++++++++++++++------ 3 files changed, 77 insertions(+), 11 deletions(-) diff --git a/types/jsforce/date-enum.ts b/types/jsforce/date-enum.ts index 0f5d9b6408..0833be0f98 100644 --- a/types/jsforce/date-enum.ts +++ b/types/jsforce/date-enum.ts @@ -1,3 +1,39 @@ export enum Date { - YESTERDAY + YESTERDAY, + TODAY, + TOMORROW, + LAST_WEEK, + THIS_WEEK, + NEXT_WEEK, + LAST_MONTH, + THIS_MONTH, + NEXT_MONTH, + LAST_90_DAYS, + NEXT_90_DAYS, + LAST_N_DAYS, + NEXT_N_DAYS, + NEXT_N_WEEKS, + LAST_N_WEEKS, + NEXT_N_MONTHS, + LAST_N_MONTHS, + THIS_QUARTER, + LAST_QUARTER, + NEXT_QUARTER, + NEXT_N_QUARTERS, + LAST_N_QUARTERS, + THIS_YEAR, + LAST_YEAR, + NEXT_YEAR, + NEXT_N_YEARS, + LAST_N_YEARS, + THIS_FISCAL_QUARTER, + LAST_FISCAL_QUARTER, + NEXT_FISCAL_QUARTER, + NEXT_N_FISCAL_QUARTERS, + LAST_N_FISCAL_QUARTERS, + THIS_FISCAL_YEAR, + LAST_FISCAL_YEAR, + NEXT_FISCAL_YEAR, + NEXT_N_FISCAL_YEARS, + LAST_N_FISCAL_YEARS } diff --git a/types/jsforce/query.ts b/types/jsforce/query.ts index d5beec791f..bd9f968798 100644 --- a/types/jsforce/query.ts +++ b/types/jsforce/query.ts @@ -31,4 +31,4 @@ export declare class Query { where(conditions: Object | string): Query; } -export interface ExplainInfo { } +export class ExplainInfo { } diff --git a/types/jsforce/salesforce-object.ts b/types/jsforce/salesforce-object.ts index 2ec340d1c8..3e0e1b38a5 100644 --- a/types/jsforce/salesforce-object.ts +++ b/types/jsforce/salesforce-object.ts @@ -4,6 +4,8 @@ import { SObjectCreateOptions } from './create-options'; import { DescribeSObjectResult } from './describe-result'; import { Query } from './query'; import { RecordResult } from './record-result'; +import { Connection } from './connection'; +import { SalesforceId } from './salesforce-id'; export declare class SObject { record(options: any, callback?: (err: Error, ret: any) => void): void; @@ -49,12 +51,40 @@ export declare class SObject { select(field?: Object | string[] | string, callback?: (err: Error, ret: T[]) => void): Query; } -export interface ApprovalLayoutInfo { } -export interface Record { } -export interface Batch { } -export interface CompactLayoutInfo { } -export interface DeletedRecordsInfo { } -export interface LayoutInfo { } -export interface ListView { } -export interface ListViewsInfo { } -export interface QuickAction { } +export interface ApprovalLayoutInfo { + approvalLayouts: Object[]; +} + +export declare class Record extends Object { + constructor(connection: Connection, type: SObject, id: SalesforceId) +} + +export class Batch extends stream.Writable { +} + +export interface CompactLayoutInfo { + compactLayouts: Object[]; + defaultCompactLayoutId: string; + recordTypeCompactLayoutMappings: Object[]; +} + +export interface DeletedRecordsInfo { + earliestDateAvailable: string; + latestDateCovered: string; + deletedRecords: { + id: string, + deletedDate: string, + }; +} + +export interface LayoutInfo { + layouts: Object[]; + recordTypeMappings: Object[]; +} + +export declare class ListView { + constructor(connection: Connection, type: SObject, id: SalesforceId) +} + +export class ListViewsInfo { } +export class QuickAction { } From 621cf88db53de571251d356289124ae3233e9af8 Mon Sep 17 00:00:00 2001 From: huhuanming Date: Wed, 17 May 2017 11:23:28 +0800 Subject: [PATCH 0176/1072] Add testID To TouchableWithoutFeedbackProperties --- types/react-native/index.d.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index eed16db158..ee306f8545 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 +// Definitions by: Eloy Durán , Fedor Nezhivoi , HuHuanming // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 @@ -4226,6 +4226,11 @@ export interface TouchableWithoutFeedbackProperties extends TouchableWithoutFeed * to reduce memory allocations. */ pressRetentionOffset?: Insets + + /** + * Used to locate this view in end-to-end tests. + */ + testID?: string } From 9f5deb7171daf738d38708ea20d2483b2b8aed8d Mon Sep 17 00:00:00 2001 From: Wolfgang Faust Date: Tue, 16 May 2017 23:35:04 -0400 Subject: [PATCH 0177/1072] Add type definitions for url-assembler library. --- types/url-assembler/index.d.ts | 28 ++++++++++++++++++++++ types/url-assembler/tsconfig.json | 22 +++++++++++++++++ types/url-assembler/tslint.json | 1 + types/url-assembler/url-assembler-tests.ts | 7 ++++++ 4 files changed, 58 insertions(+) create mode 100644 types/url-assembler/index.d.ts create mode 100644 types/url-assembler/tsconfig.json create mode 100644 types/url-assembler/tslint.json create mode 100644 types/url-assembler/url-assembler-tests.ts diff --git a/types/url-assembler/index.d.ts b/types/url-assembler/index.d.ts new file mode 100644 index 0000000000..3f33bf921a --- /dev/null +++ b/types/url-assembler/index.d.ts @@ -0,0 +1,28 @@ +// Type definitions for url-assembler 1.2 +// Project: https://github.com/Floby/node-url-assembler +// Definitions by: Wolfgang Faust +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +interface UrlAssembler { + template(template: string): UrlAssembler; + prefix(subPath: string): UrlAssembler; + segment(subPathTemplate: string): UrlAssembler; + param(key: string, value: string, strict: boolean): UrlAssembler; + param(params: {[s: string]: any}, strict: boolean): UrlAssembler; + query(key: string, value: any): UrlAssembler; + query(params: {[s: string]: any}): UrlAssembler; + toString(): string; + valueOf(): string; + toJSON(): string; +} + +interface UrlAssemblerConstructor { + (baseUrl?: string): UrlAssembler; + (urlAssembler: UrlAssembler): UrlAssembler; + new (baseUrl?: string): UrlAssembler; + new (urlAssembler: UrlAssembler): UrlAssembler; +} + +declare const UrlAssembler: UrlAssemblerConstructor; + +export = UrlAssembler; diff --git a/types/url-assembler/tsconfig.json b/types/url-assembler/tsconfig.json new file mode 100644 index 0000000000..ae213e8bc0 --- /dev/null +++ b/types/url-assembler/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", + "url-assembler-tests.ts" + ] +} diff --git a/types/url-assembler/tslint.json b/types/url-assembler/tslint.json new file mode 100644 index 0000000000..4e88071852 --- /dev/null +++ b/types/url-assembler/tslint.json @@ -0,0 +1 @@ +{"extends": "dtslint/dt.json"} diff --git a/types/url-assembler/url-assembler-tests.ts b/types/url-assembler/url-assembler-tests.ts new file mode 100644 index 0000000000..997c619218 --- /dev/null +++ b/types/url-assembler/url-assembler-tests.ts @@ -0,0 +1,7 @@ +import UrlAssembler = require('url-assembler'); +UrlAssembler('http://goggle.com').segment('string'); +const f = new UrlAssembler('https://foo/bar/'); + +function printUrl(u: UrlAssembler) { + return u.toJSON(); +} From aebadcfc8e4d46af49a354cdf7ffa54ddf391fe5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kov=C3=A1cs=20Vince?= Date: Wed, 17 May 2017 08:16:40 +0200 Subject: [PATCH 0178/1072] Commit fixed tslint errors --- types/get-node-dimensions/index.d.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/types/get-node-dimensions/index.d.ts b/types/get-node-dimensions/index.d.ts index cea8944943..5e9d4b393d 100644 --- a/types/get-node-dimensions/index.d.ts +++ b/types/get-node-dimensions/index.d.ts @@ -6,12 +6,12 @@ export as namespace getNodeDimensions; export interface NodeDimensions { - width: number, - height: number, - top: number, - right: number, - bottom: number, - left: number + width: number; + height: number; + top: number; + right: number; + bottom: number; + left: number; } -export function getNodeDimension (): NodeDimensions; +export function getNodeDimension(): NodeDimensions; From e33354e4c044bce0c285843ad7d695592b8916ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kov=C3=A1cs=20Vince?= Date: Wed, 17 May 2017 09:07:18 +0200 Subject: [PATCH 0179/1072] Added missing parameters --- types/get-node-dimensions/get-node-dimensions-tests.ts | 4 +++- types/get-node-dimensions/index.d.ts | 10 +++++++++- types/get-node-dimensions/tsconfig.json | 3 ++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/types/get-node-dimensions/get-node-dimensions-tests.ts b/types/get-node-dimensions/get-node-dimensions-tests.ts index 224d9608e0..dcc9ce36ff 100644 --- a/types/get-node-dimensions/get-node-dimensions-tests.ts +++ b/types/get-node-dimensions/get-node-dimensions-tests.ts @@ -1,3 +1,5 @@ import * as NodeDimensions from 'get-node-dimensions'; -const dimensions: NodeDimensions.NodeDimensions = NodeDimensions.getNodeDimension(); +const div = document.getElementById('div-to-measure'); + +const dimensions: NodeDimensions.NodeDimensions = NodeDimensions.getNodeDimension(div); diff --git a/types/get-node-dimensions/index.d.ts b/types/get-node-dimensions/index.d.ts index 5e9d4b393d..4fbd7aca19 100644 --- a/types/get-node-dimensions/index.d.ts +++ b/types/get-node-dimensions/index.d.ts @@ -14,4 +14,12 @@ export interface NodeDimensions { left: number; } -export function getNodeDimension(): NodeDimensions; +export interface NodeDimensionsOptions { + margin: boolean; + clone: boolean; + display: string; + width: string; + height: string; +} + +export function getNodeDimension (element: HTMLElement, options?: NodeDimensionsOptions): NodeDimensions; diff --git a/types/get-node-dimensions/tsconfig.json b/types/get-node-dimensions/tsconfig.json index f8eec26e74..74d9b030bf 100644 --- a/types/get-node-dimensions/tsconfig.json +++ b/types/get-node-dimensions/tsconfig.json @@ -2,7 +2,8 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6" + "es6", + "dom" ], "noImplicitAny": true, "noImplicitThis": true, From f7b4886a6ddcb7cd03efc3b47d5390a336c8e94a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kov=C3=A1cs=20Vince?= Date: Wed, 17 May 2017 09:13:50 +0200 Subject: [PATCH 0180/1072] Fixed method name --- types/get-node-dimensions/get-node-dimensions-tests.ts | 4 +++- types/get-node-dimensions/index.d.ts | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/types/get-node-dimensions/get-node-dimensions-tests.ts b/types/get-node-dimensions/get-node-dimensions-tests.ts index dcc9ce36ff..9c85e69534 100644 --- a/types/get-node-dimensions/get-node-dimensions-tests.ts +++ b/types/get-node-dimensions/get-node-dimensions-tests.ts @@ -2,4 +2,6 @@ import * as NodeDimensions from 'get-node-dimensions'; const div = document.getElementById('div-to-measure'); -const dimensions: NodeDimensions.NodeDimensions = NodeDimensions.getNodeDimension(div); +if (div !== null) { + const dimensions: NodeDimensions.NodeDimensions = NodeDimensions.getNodeDimensions(div); +} diff --git a/types/get-node-dimensions/index.d.ts b/types/get-node-dimensions/index.d.ts index 4fbd7aca19..3bcb292d66 100644 --- a/types/get-node-dimensions/index.d.ts +++ b/types/get-node-dimensions/index.d.ts @@ -22,4 +22,4 @@ export interface NodeDimensionsOptions { height: string; } -export function getNodeDimension (element: HTMLElement, options?: NodeDimensionsOptions): NodeDimensions; +export function getNodeDimensions(element: HTMLElement, options?: NodeDimensionsOptions): NodeDimensions; From 63a2f5eefb1e805cdbb99261f5d5d8978226572b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kov=C3=A1cs=20Vince?= Date: Wed, 17 May 2017 10:06:49 +0200 Subject: [PATCH 0181/1072] Export getNodeDimensions function as default --- types/get-node-dimensions/get-node-dimensions-tests.ts | 4 ++-- types/get-node-dimensions/index.d.ts | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/types/get-node-dimensions/get-node-dimensions-tests.ts b/types/get-node-dimensions/get-node-dimensions-tests.ts index 9c85e69534..69d49e6fc6 100644 --- a/types/get-node-dimensions/get-node-dimensions-tests.ts +++ b/types/get-node-dimensions/get-node-dimensions-tests.ts @@ -1,7 +1,7 @@ -import * as NodeDimensions from 'get-node-dimensions'; +import getNodeDimensions, {NodeDimensions} from 'get-node-dimensions'; const div = document.getElementById('div-to-measure'); if (div !== null) { - const dimensions: NodeDimensions.NodeDimensions = NodeDimensions.getNodeDimensions(div); + const dimensions: NodeDimensions = getNodeDimensions(div); } diff --git a/types/get-node-dimensions/index.d.ts b/types/get-node-dimensions/index.d.ts index 3bcb292d66..96c2ec466f 100644 --- a/types/get-node-dimensions/index.d.ts +++ b/types/get-node-dimensions/index.d.ts @@ -3,8 +3,6 @@ // Definitions by: Kovács Vince // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -export as namespace getNodeDimensions; - export interface NodeDimensions { width: number; height: number; @@ -22,4 +20,6 @@ export interface NodeDimensionsOptions { height: string; } -export function getNodeDimensions(element: HTMLElement, options?: NodeDimensionsOptions): NodeDimensions; +declare function getNodeDimensions(element: HTMLElement, options?: NodeDimensionsOptions): NodeDimensions; + +export default getNodeDimensions From c26e18bef14520717f4248a652ae632e538f3501 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kov=C3=A1cs=20Vince?= Date: Wed, 17 May 2017 10:19:04 +0200 Subject: [PATCH 0182/1072] Add missing semicolon --- types/get-node-dimensions/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/get-node-dimensions/index.d.ts b/types/get-node-dimensions/index.d.ts index 96c2ec466f..105557e39a 100644 --- a/types/get-node-dimensions/index.d.ts +++ b/types/get-node-dimensions/index.d.ts @@ -22,4 +22,4 @@ export interface NodeDimensionsOptions { declare function getNodeDimensions(element: HTMLElement, options?: NodeDimensionsOptions): NodeDimensions; -export default getNodeDimensions +export default getNodeDimensions; From 969a261382d37452c3f473b3dee249c42f701d62 Mon Sep 17 00:00:00 2001 From: huhuanming Date: Wed, 17 May 2017 16:44:53 +0800 Subject: [PATCH 0183/1072] Fix callback Value Type In setBage Func --- types/jpush-react-native/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/jpush-react-native/index.d.ts b/types/jpush-react-native/index.d.ts index d8b27e0b2c..fa604f3174 100644 --- a/types/jpush-react-native/index.d.ts +++ b/types/jpush-react-native/index.d.ts @@ -118,5 +118,5 @@ export default class JPush { /** * iOS */ - static setBadge(badge: number, callback: (badges: number[]) => void): void; + static setBadge(badge: number, callback: (isSuccess: boolean) => void): void; } From 3fc4d30f76269a600969e7dab58601ffc4274ff7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kov=C3=A1cs=20Vince?= Date: Wed, 17 May 2017 10:50:54 +0200 Subject: [PATCH 0184/1072] Working type definitions for get-node-dimensions --- .../get-node-dimensions-tests.ts | 4 +- types/get-node-dimensions/index.d.ts | 40 ++++++++++--------- 2 files changed, 23 insertions(+), 21 deletions(-) diff --git a/types/get-node-dimensions/get-node-dimensions-tests.ts b/types/get-node-dimensions/get-node-dimensions-tests.ts index 69d49e6fc6..211eb39ca2 100644 --- a/types/get-node-dimensions/get-node-dimensions-tests.ts +++ b/types/get-node-dimensions/get-node-dimensions-tests.ts @@ -1,7 +1,7 @@ -import getNodeDimensions, {NodeDimensions} from 'get-node-dimensions'; +import getNodeDimensions = require('get-node-dimensions'); const div = document.getElementById('div-to-measure'); if (div !== null) { - const dimensions: NodeDimensions = getNodeDimensions(div); + const dimensions = getNodeDimensions(div); } diff --git a/types/get-node-dimensions/index.d.ts b/types/get-node-dimensions/index.d.ts index 105557e39a..5397f55e67 100644 --- a/types/get-node-dimensions/index.d.ts +++ b/types/get-node-dimensions/index.d.ts @@ -3,23 +3,25 @@ // Definitions by: Kovács Vince // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -export interface NodeDimensions { - width: number; - height: number; - top: number; - right: number; - bottom: number; - left: number; +declare module 'get-node-dimensions' { + interface NodeDimensions { + width: number; + height: number; + top: number; + right: number; + bottom: number; + left: number; + } + + interface NodeDimensionsOptions { + margin: boolean; + clone: boolean; + display: string; + width: string; + height: string; + } + + function getNodeDimensions(element: HTMLElement, options?: NodeDimensionsOptions): NodeDimensions; + + export = getNodeDimensions; } - -export interface NodeDimensionsOptions { - margin: boolean; - clone: boolean; - display: string; - width: string; - height: string; -} - -declare function getNodeDimensions(element: HTMLElement, options?: NodeDimensionsOptions): NodeDimensions; - -export default getNodeDimensions; From 5fcc2eb15a4e4ee9685d0b24a0fd2e867524bc2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kov=C3=A1cs=20Vince?= Date: Wed, 17 May 2017 11:28:08 +0200 Subject: [PATCH 0185/1072] Make option key as optional --- types/get-node-dimensions/get-node-dimensions-tests.ts | 4 ++++ types/get-node-dimensions/index.d.ts | 10 +++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/types/get-node-dimensions/get-node-dimensions-tests.ts b/types/get-node-dimensions/get-node-dimensions-tests.ts index 211eb39ca2..b83f6d7b6a 100644 --- a/types/get-node-dimensions/get-node-dimensions-tests.ts +++ b/types/get-node-dimensions/get-node-dimensions-tests.ts @@ -5,3 +5,7 @@ const div = document.getElementById('div-to-measure'); if (div !== null) { const dimensions = getNodeDimensions(div); } + +if (div !== null) { + const dimensionsWithMargin = getNodeDimensions(div, {margin: true}); +} diff --git a/types/get-node-dimensions/index.d.ts b/types/get-node-dimensions/index.d.ts index 5397f55e67..88780bc105 100644 --- a/types/get-node-dimensions/index.d.ts +++ b/types/get-node-dimensions/index.d.ts @@ -14,11 +14,11 @@ declare module 'get-node-dimensions' { } interface NodeDimensionsOptions { - margin: boolean; - clone: boolean; - display: string; - width: string; - height: string; + margin?: boolean; + clone?: boolean; + display?: string; + width?: string; + height?: string; } function getNodeDimensions(element: HTMLElement, options?: NodeDimensionsOptions): NodeDimensions; From 442a87ca4fdc225216942ea3bdab0c06afe439b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kov=C3=A1cs=20Vince?= Date: Wed, 17 May 2017 11:34:13 +0200 Subject: [PATCH 0186/1072] Remove module wrap --- types/get-node-dimensions/index.d.ts | 40 +++++++++++++--------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/types/get-node-dimensions/index.d.ts b/types/get-node-dimensions/index.d.ts index 88780bc105..e15d08bb21 100644 --- a/types/get-node-dimensions/index.d.ts +++ b/types/get-node-dimensions/index.d.ts @@ -3,25 +3,23 @@ // Definitions by: Kovács Vince // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare module 'get-node-dimensions' { - interface NodeDimensions { - width: number; - height: number; - top: number; - right: number; - bottom: number; - left: number; - } - - interface NodeDimensionsOptions { - margin?: boolean; - clone?: boolean; - display?: string; - width?: string; - height?: string; - } - - function getNodeDimensions(element: HTMLElement, options?: NodeDimensionsOptions): NodeDimensions; - - export = getNodeDimensions; +interface NodeDimensions { + width: number; + height: number; + top: number; + right: number; + bottom: number; + left: number; } + +interface NodeDimensionsOptions { + margin?: boolean; + clone?: boolean; + display?: string; + width?: string; + height?: string; +} + +declare function getNodeDimensions(element: HTMLElement, options?: NodeDimensionsOptions): NodeDimensions; + +export = getNodeDimensions; From 09b956231b4dd42e1cb04f5b2b8ecea4906623b7 Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Wed, 17 May 2017 13:20:13 +0200 Subject: [PATCH 0187/1072] 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 95144bb2479d24bb1a39c74d7411f575adf29038 Mon Sep 17 00:00:00 2001 From: Alexander James Phillips Date: Tue, 16 May 2017 23:27:51 +0100 Subject: [PATCH 0188/1072] Include Plugin specific config for route server and connection level --- types/hapi/index.d.ts | 8 ++++---- types/hapi/test/route/plugins.ts | 28 ++++++++++++++++++++++++---- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/types/hapi/index.d.ts b/types/hapi/index.d.ts index 59e7748bc6..0abdf534e9 100644 --- a/types/hapi/index.d.ts +++ b/types/hapi/index.d.ts @@ -477,7 +477,7 @@ export class Server extends Podium { table(host?: string): RoutingTableEntry[]; } -export interface RoutePlugins {} +export interface PluginSpecificConfiguration {} /** * Server Options @@ -511,7 +511,7 @@ export interface ServerOptions { /** options passed to the mimos module (https://github.com/hapijs/mimos) when generating the mime database used by the server and accessed via server.mime. */ mime?: MimosOptions; /** plugin-specific configuration which can later be accessed via server.settings.plugins. plugins is an object where each key is a plugin name and the value is the configuration. Note the difference between server.settings.plugins which is used to store static configuration values and server.plugins which is meant for storing run-time state. Defaults to {}. */ - plugins?: RoutePlugins; + plugins?: PluginSpecificConfiguration; /** if false, will not use node domains to protect against exceptions thrown in handlers and other external code. Defaults to true. */ useDomains?: boolean; } @@ -724,7 +724,7 @@ export interface ConnectionConfigurationServerDefaults { maxEventLoopDelay: number; }; /** plugin-specific configuration which can later be accessed via connection.settings.plugins. Provides a place to store and pass connection-specific plugin configuration. plugins is an object where each key is a plugin name and the value is the configuration. Note the difference between connection.settings.plugins which is used to store configuration values and connection.plugins which is meant for storing run-time state. */ - plugins?: any; + plugins?: PluginSpecificConfiguration; /** controls how incoming request URIs are matched against the routing table: */ router?: { /** determines whether the paths '/example' and '/EXAMPLE' are considered different resources. Defaults to true. */ @@ -1152,7 +1152,7 @@ export interface RouteAdditionalConfigurationOptions { */ payload?: RoutePayloadConfigurationObject; /** plugin-specific configuration. plugins is an object where each key is a plugin name and the value is the plugin configuration. */ - plugins?: Object; + plugins?: PluginSpecificConfiguration; /** an array with [route prerequisites](https://hapijs.com/api/16.1.1#route-prerequisites) methods which are executed in serial or in parallel before the handler is called. */ pre?: RoutePrerequisitesArray; /** processing rules for the outgoing response */ diff --git a/types/hapi/test/route/plugins.ts b/types/hapi/test/route/plugins.ts index 94245238ee..2449fc84c0 100644 --- a/types/hapi/test/route/plugins.ts +++ b/types/hapi/test/route/plugins.ts @@ -1,9 +1,10 @@ -// from https://hapijs.com/api#route-configuration > plugins +// Added in addition to code from https://hapijs.com/api/16.1.1#route-options > plugins import * as Hapi from 'hapi'; +// In the plugin code declare module 'hapi' { - interface RoutePlugins { + interface PluginSpecificConfiguration { coolPlugin: { optionA: string; optionB?: boolean; @@ -11,8 +12,27 @@ declare module 'hapi' { } } -var pluginsConfig: Hapi.RouteAdditionalConfigurationOptions = { +// In the consumer code +const pluginsServerConfig: Hapi.ServerOptions = { plugins: { - coolPlugin: 'test', + coolPlugin: { + optionA: "test", + } + } +}; + +const pluginsConnectionConfig: Hapi.ConnectionConfigurationServerDefaults = { + plugins: { + coolPlugin: { + optionA: "test", + } + } +}; + +const pluginsRouteConfig: Hapi.RouteAdditionalConfigurationOptions = { + plugins: { + coolPlugin: { + optionA: "test", + } } }; From 5669de27d9e0dd81d3fe427f8b7769f7beb55d9e Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Wed, 17 May 2017 13:42:44 +0200 Subject: [PATCH 0189/1072] 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 0190/1072] Revert "fix headers" This reverts commit 752e09694aa56e4a4ca5e4ae2c5e744c7a7a5618. From cbda0a036b27b0955d34b0b60971c23742c5baef Mon Sep 17 00:00:00 2001 From: Alexander James Phillips Date: Wed, 17 May 2017 12:48:26 +0100 Subject: [PATCH 0191/1072] Fix tests for pluginSpecificConfiguration --- types/hapi/test/server/new.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/types/hapi/test/server/new.ts b/types/hapi/test/server/new.ts index 24ac654ecd..95f1ce9006 100644 --- a/types/hapi/test/server/new.ts +++ b/types/hapi/test/server/new.ts @@ -44,6 +44,15 @@ new Hapi.Server({ }] }); +//+ Code added in addition to docs +declare module 'hapi' { + interface PluginSpecificConfiguration { + // Set this to non optional if plugin config is non optional + 'some-plugin-name'?: {options: string;}; + } +} +//- Code added in addition to docs + new Hapi.Server({ connections: { app: {}, @@ -54,7 +63,8 @@ new Hapi.Server({ maxEventLoopDelay: 10, }, plugins: { - 'some-plugin-name': {options: 'here'} + 'some-plugin-name': {options: 'here'}, + coolPlugin: {optionA: ""}, }, router: { isCaseSensitive: false, From 2175c7d3f9b5812f554a780e0e45f4ed75c5f4ee Mon Sep 17 00:00:00 2001 From: Tim Schumacher Date: Wed, 17 May 2017 14:20:23 +0200 Subject: [PATCH 0192/1072] 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 0193/1072] 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 0194/1072] 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 0195/1072] 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 0196/1072] 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 f823abb6a49cc32904a2cb079d305781e3849346 Mon Sep 17 00:00:00 2001 From: Dolan Date: Wed, 17 May 2017 15:04:50 +0100 Subject: [PATCH 0197/1072] Made all of the files .d.ts --- types/jsforce/{connection.ts => connection.d.ts} | 2 +- .../{create-options.ts => create-options.d.ts} | 0 types/jsforce/{date-enum.ts => date-enum.d.ts} | 0 .../{describe-result.ts => describe-result.d.ts} | 0 types/jsforce/{query.ts => query.d.ts} | 2 +- .../{record-result.ts => record-result.d.ts} | 0 .../{salesforce-id.ts => salesforce-id.d.ts} | 0 ...options.ts => salesforce-object-options.d.ts} | 0 ...lesforce-object.ts => salesforce-object.d.ts} | 6 +++--- types/jsforce/tsconfig.json | 16 ++++++++-------- 10 files changed, 13 insertions(+), 13 deletions(-) rename types/jsforce/{connection.ts => connection.d.ts} (95%) rename types/jsforce/{create-options.ts => create-options.d.ts} (100%) rename types/jsforce/{date-enum.ts => date-enum.d.ts} (100%) rename types/jsforce/{describe-result.ts => describe-result.d.ts} (100%) rename types/jsforce/{query.ts => query.d.ts} (98%) rename types/jsforce/{record-result.ts => record-result.d.ts} (100%) rename types/jsforce/{salesforce-id.ts => salesforce-id.d.ts} (100%) rename types/jsforce/{salesforce-object-options.ts => salesforce-object-options.d.ts} (100%) rename types/jsforce/{salesforce-object.ts => salesforce-object.d.ts} (97%) diff --git a/types/jsforce/connection.ts b/types/jsforce/connection.d.ts similarity index 95% rename from types/jsforce/connection.ts rename to types/jsforce/connection.d.ts index a1f4f6f809..f3864eb5d8 100644 --- a/types/jsforce/connection.ts +++ b/types/jsforce/connection.d.ts @@ -20,7 +20,7 @@ export interface ConnectionOptions { export type ConnectionEvent = "refresh"; -export declare class Connection { +export class Connection { constructor(params: ConnectionOptions) sobject(resource: string): SObject; diff --git a/types/jsforce/create-options.ts b/types/jsforce/create-options.d.ts similarity index 100% rename from types/jsforce/create-options.ts rename to types/jsforce/create-options.d.ts diff --git a/types/jsforce/date-enum.ts b/types/jsforce/date-enum.d.ts similarity index 100% rename from types/jsforce/date-enum.ts rename to types/jsforce/date-enum.d.ts diff --git a/types/jsforce/describe-result.ts b/types/jsforce/describe-result.d.ts similarity index 100% rename from types/jsforce/describe-result.ts rename to types/jsforce/describe-result.d.ts diff --git a/types/jsforce/query.ts b/types/jsforce/query.d.ts similarity index 98% rename from types/jsforce/query.ts rename to types/jsforce/query.d.ts index bd9f968798..0d716c28da 100644 --- a/types/jsforce/query.ts +++ b/types/jsforce/query.d.ts @@ -7,7 +7,7 @@ export interface ExecuteOptions { scanAll?: number; } -export declare class Query { +export class Query { filter(filter: Object): Query; hint(hint: Object): Query; limit(value: number): Query; diff --git a/types/jsforce/record-result.ts b/types/jsforce/record-result.d.ts similarity index 100% rename from types/jsforce/record-result.ts rename to types/jsforce/record-result.d.ts diff --git a/types/jsforce/salesforce-id.ts b/types/jsforce/salesforce-id.d.ts similarity index 100% rename from types/jsforce/salesforce-id.ts rename to types/jsforce/salesforce-id.d.ts diff --git a/types/jsforce/salesforce-object-options.ts b/types/jsforce/salesforce-object-options.d.ts similarity index 100% rename from types/jsforce/salesforce-object-options.ts rename to types/jsforce/salesforce-object-options.d.ts diff --git a/types/jsforce/salesforce-object.ts b/types/jsforce/salesforce-object.d.ts similarity index 97% rename from types/jsforce/salesforce-object.ts rename to types/jsforce/salesforce-object.d.ts index 3e0e1b38a5..ac2288fe33 100644 --- a/types/jsforce/salesforce-object.ts +++ b/types/jsforce/salesforce-object.d.ts @@ -7,7 +7,7 @@ import { RecordResult } from './record-result'; import { Connection } from './connection'; import { SalesforceId } from './salesforce-id'; -export declare class SObject { +export class SObject { record(options: any, callback?: (err: Error, ret: any) => void): void; update(options: SObjectCreateOptions, callback?: (err: Error, ret: any) => void): void; retrieve(ids: string | string[], callback?: (err: Error, ret: any) => void): void; @@ -55,7 +55,7 @@ export interface ApprovalLayoutInfo { approvalLayouts: Object[]; } -export declare class Record extends Object { +export class Record extends Object { constructor(connection: Connection, type: SObject, id: SalesforceId) } @@ -82,7 +82,7 @@ export interface LayoutInfo { recordTypeMappings: Object[]; } -export declare class ListView { +export class ListView { constructor(connection: Connection, type: SObject, id: SalesforceId) } diff --git a/types/jsforce/tsconfig.json b/types/jsforce/tsconfig.json index c7987cf4b9..63812424be 100644 --- a/types/jsforce/tsconfig.json +++ b/types/jsforce/tsconfig.json @@ -17,14 +17,14 @@ }, "files": [ "index.d.ts", - "connection.ts", - "create-options.ts", - "date-enum.ts", - "salesforce-object-options.ts", - "salesforce-object.ts", - "salesforce-id.ts", - "query.ts", - "describe-result.ts", + "connection.d.ts", + "create-options.d.ts", + "date-enum.d.ts", + "salesforce-object-options.d.ts", + "salesforce-object.d.ts", + "salesforce-id.d.ts", + "query.d.ts", + "describe-result.d.ts", "jsforce-tests.ts" ] } \ No newline at end of file From 65d2259cfae48b321e22389f103737184a11bffb Mon Sep 17 00:00:00 2001 From: Jan Karres Date: Wed, 17 May 2017 16:18:57 +0200 Subject: [PATCH 0198/1072] Update react-facebook-login fir v3.6.0 --- types/react-facebook-login/index.d.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/types/react-facebook-login/index.d.ts b/types/react-facebook-login/index.d.ts index 9f83d7ae8b..44fa9d40ae 100644 --- a/types/react-facebook-login/index.d.ts +++ b/types/react-facebook-login/index.d.ts @@ -1,8 +1,8 @@ -// Type definitions for react-facebook-login 3.4 +// Type definitions for react-facebook-login 3.6 // Project: https://github.com/keppelen/react-facebook-login -// Definitions by: Alexandre Paré +// Definitions by: Alexandre Paré , Jan Karres // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.1 +// TypeScript Version: 2.3 import * as React from "react"; @@ -30,6 +30,8 @@ declare namespace ReactFacebookLogin { typeButton?: string; version?: string; xfbml?: boolean; + isMobile?: boolean; + tag?: Node | Function; } interface ReactFacebookLoginInfo { @@ -43,6 +45,6 @@ declare namespace ReactFacebookLogin { } } -declare class ReactFacebookLogin extends React.Component {} +declare class ReactFacebookLogin extends React.Component { } -export = ReactFacebookLogin; +export default ReactFacebookLogin; From 256816065c2b38714bd3f2da20c85081d6cff53a Mon Sep 17 00:00:00 2001 From: Tom Wanzek Date: Wed, 17 May 2017 12:01:39 -0400 Subject: [PATCH 0199/1072] [d3-selection] Update to 1.1 * [FEATURE] Update JSDoc comments for `Selection.style(...)` to reflecgt new behavior * [FEATURE] Add `d3.style(...)` standalone function. --- types/d3-selection/d3-selection-tests.ts | 7 +++++++ types/d3-selection/index.d.ts | 21 +++++++++++++++++---- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/types/d3-selection/d3-selection-tests.ts b/types/d3-selection/d3-selection-tests.ts index 0b2dec77c2..baae76bad2 100644 --- a/types/d3-selection/d3-selection-tests.ts +++ b/types/d3-selection/d3-selection-tests.ts @@ -1036,6 +1036,13 @@ positions = d3Selection.touches(svg, changedTouches); positions = d3Selection.touches(g, changedTouches); positions = d3Selection.touches(h, changedTouches); +// --------------------------------------------------------------------------------------- +// Tests of style +// --------------------------------------------------------------------------------------- + +declare let n: Element; +str = d3Selection.style(n, 'opacity'); + // --------------------------------------------------------------------------------------- // Tests of Local // --------------------------------------------------------------------------------------- diff --git a/types/d3-selection/index.d.ts b/types/d3-selection/index.d.ts index 08daf8b0c5..2b61695abd 100644 --- a/types/d3-selection/index.d.ts +++ b/types/d3-selection/index.d.ts @@ -310,10 +310,9 @@ export interface Selection): this; /** - * Returns the current computed value of the specified style for the first (non-null) element in the selection. - * This is generally useful only if you know that the selection contains exactly one element. - * The computed value may be different than the previously-set value, particularly if it was set using a - * shorthand property (such as the font style, which is shorthand for font-size, font-face, etc.). + * Returns the current value of the specified style property for the first (non-null) element in the selection. + * The current value is defined as the element’s inline value, if present, and otherwise its computed value. + * Accessing the current style value is generally useful only if you know the selection contains exactly one element. * * @param name Name of the style */ @@ -973,6 +972,20 @@ export function touch(container: ContainerElement, touches: TouchList, identifie */ export function touches(container: ContainerElement, touches?: TouchList): Array<[number, number]>; +// --------------------------------------------------------------------------- +// style +// --------------------------------------------------------------------------- + +/** + * Returns the value of the style property with the specified name for the specified node. + * If the node has an inline style with the specified name, its value is returned; otherwise, the computed property value is returned. + * See also selection.style. + * + * @param node A DOM node (e.g. HTMLElement, SVGElement) for which to retrieve the style property. + * @param name Style property name. + */ +export function style(node: Element, name: string): string; + // --------------------------------------------------------------------------- // local.js related // --------------------------------------------------------------------------- From a870cb6d5f2bb38525b889efd7342617d0d2a08e Mon Sep 17 00:00:00 2001 From: Tom Wanzek Date: Wed, 17 May 2017 12:02:54 -0400 Subject: [PATCH 0200/1072] [d3-selection] * [Chore] Update last validated version comment --- types/d3-selection/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/d3-selection/index.d.ts b/types/d3-selection/index.d.ts index 2b61695abd..abbb14db0f 100644 --- a/types/d3-selection/index.d.ts +++ b/types/d3-selection/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// Last module patch version validated against: 1.0.2 +// Last module patch version validated against: 1.1 // -------------------------------------------------------------------------- // Shared Type Definitions and Interfaces From 739fe57f0bac39b5a018ae95683c6177373142a9 Mon Sep 17 00:00:00 2001 From: Tom Wanzek Date: Wed, 17 May 2017 12:17:18 -0400 Subject: [PATCH 0201/1072] [d3-transition] Update to 1.1 * [FEATURE] Update JSDoc comments to reflect new style transition behavior. * [CHORE] Clarify some JSDoc comments --- types/d3-transition/index.d.ts | 44 ++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/types/d3-transition/index.d.ts b/types/d3-transition/index.d.ts index 58c8fd4063..1ff8d46d04 100644 --- a/types/d3-transition/index.d.ts +++ b/types/d3-transition/index.d.ts @@ -1,9 +1,9 @@ -// Type definitions for D3JS d3-transition module 1.0 +// Type definitions for D3JS d3-transition module 1.1 // Project: https://github.com/d3/d3-transition/ // Definitions by: Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// Last module patch version validated against: 1.0.3 +// Last module patch version validated against: 1.1 import { ArrayLike, BaseType, Selection, ValueFn } from 'd3-selection'; @@ -110,7 +110,7 @@ export interface Transition(selector: ValueFn): Transition; @@ -135,7 +135,7 @@ export interface Transition(selector: ValueFn>): Transition; @@ -194,7 +194,7 @@ export interface Transition): this; @@ -221,7 +221,7 @@ export interface Transition string>): this; @@ -234,8 +234,9 @@ export interface Transition): this; @@ -348,7 +350,7 @@ export interface Transition void>): this; @@ -397,7 +399,7 @@ export interface Transition): Transition; @@ -411,7 +413,7 @@ export interface Transition(filter: ValueFn): Transition; @@ -448,7 +450,7 @@ export interface Transition): this; @@ -457,11 +459,11 @@ export interface Transition): this; @@ -513,7 +515,7 @@ export interface Transition): this; @@ -535,7 +537,7 @@ export interface Transition): this; From 373a3b98e31a2c4af7b1960ddc471dc0695c466d Mon Sep 17 00:00:00 2001 From: Tom Wanzek Date: Wed, 17 May 2017 12:20:54 -0400 Subject: [PATCH 0202/1072] [d3] Bump to version 4.9 --- types/d3/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/d3/index.d.ts b/types/d3/index.d.ts index 29d4a7c861..8bb0ae6bd8 100644 --- a/types/d3/index.d.ts +++ b/types/d3/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for D3JS d3 standard bundle 4.8 +// Type definitions for D3JS d3 standard bundle 4.9 // Project: https://github.com/d3/d3 // Definitions by: Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 5d8d94d7bcb56a9206dcd4b305aaa4632b66b8e3 Mon Sep 17 00:00:00 2001 From: Santtu Keskinen Date: Wed, 17 May 2017 19:21:57 +0300 Subject: [PATCH 0203/1072] Move interface definitions to namespace. --- types/gulp-inject/gulp-inject-tests.ts | 6 ++++ types/gulp-inject/index.d.ts | 50 +++++++++++++------------- 2 files changed, 31 insertions(+), 25 deletions(-) diff --git a/types/gulp-inject/gulp-inject-tests.ts b/types/gulp-inject/gulp-inject-tests.ts index 4cba6ccc4a..ef29ebc343 100644 --- a/types/gulp-inject/gulp-inject-tests.ts +++ b/types/gulp-inject/gulp-inject-tests.ts @@ -39,3 +39,9 @@ gulp.task("inject:transform", () => { })) .pipe(gulp.dest("build")); }); + +function createOptions(starttag: inject.ITagFunction): inject.IOptions { + return { + starttag: starttag + }; +} diff --git a/types/gulp-inject/index.d.ts b/types/gulp-inject/index.d.ts index a0c99efe78..ac6ec0172c 100644 --- a/types/gulp-inject/index.d.ts +++ b/types/gulp-inject/index.d.ts @@ -8,31 +8,31 @@ import File = require("vinyl"); -interface ITagFunction { - (targetExt: string, sourceExt: string): string; +declare function inject(sources: NodeJS.ReadableStream, options?: inject.IOptions): NodeJS.ReadWriteStream; + +declare namespace inject { + interface ITagFunction { + (targetExt: string, sourceExt: string): string; + } + + interface ITransformFunction { + (filepath: string, file?: File, index?: number, length?: number, targetFile?: File): string; + } + + interface IOptions { + ignorePath?: string | string[]; + relative?: boolean; + addPrefix?: string; + addSuffix?: string; + addRootSlash?: boolean; + name?: string; + removeTags?: boolean; + empty?: boolean; + starttag?: string | ITagFunction; + endtag?: string | ITagFunction; + transform?: ITransformFunction; + selfClosingTag?: boolean; + } } -interface ITransformFunction { - (filepath: string, file?: File, index?: number, length?: number, targetFile?: File): string; -} - -interface IOptions { - ignorePath?: string | string[]; - relative?: boolean; - addPrefix?: string; - addSuffix?: string; - addRootSlash?: boolean; - name?: string; - removeTags?: boolean; - empty?: boolean; - starttag?: string | ITagFunction; - endtag?: string | ITagFunction; - transform?: ITransformFunction; - selfClosingTag?: boolean; -} - -declare function inject(sources: NodeJS.ReadableStream, options?: IOptions): NodeJS.ReadWriteStream; - -declare namespace inject { } - export = inject; From dcab77774c502fbb326e62833d234e76555f9f75 Mon Sep 17 00:00:00 2001 From: Jan Karres Date: Wed, 17 May 2017 19:03:06 +0200 Subject: [PATCH 0204/1072] Update react-facebook-login for v3.6.0 fix lint tests --- types/react-facebook-login/index.d.ts | 73 +++++++++++++-------------- 1 file changed, 35 insertions(+), 38 deletions(-) diff --git a/types/react-facebook-login/index.d.ts b/types/react-facebook-login/index.d.ts index 44fa9d40ae..b5bfebac5d 100644 --- a/types/react-facebook-login/index.d.ts +++ b/types/react-facebook-login/index.d.ts @@ -2,49 +2,46 @@ // Project: https://github.com/keppelen/react-facebook-login // Definitions by: Alexandre Paré , Jan Karres // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 import * as React from "react"; -declare namespace ReactFacebookLogin { - interface ReactFacebookLoginProps { - appId: string; - callback(userInfo: ReactFacebookLoginInfo): void; +interface ReactFacebookLoginProps { + appId: string; + callback(userInfo: ReactFacebookLoginInfo): void; - autoLoad?: boolean; - buttonStyle?: React.CSSProperties; - containerStyle?: React.CSSProperties; - cookie?: boolean; - cssClass?: string; - disableMobileRedirect?: boolean; - fields?: string; - icon?: string | React.ReactNode; - isDisabled?: boolean; - language?: string; - onClick?(): void; - reAuthenticate?: boolean; - redirectUri?: string; - scope?: string; - size?: "small" | "medium" | "metro"; - textButton?: string; - typeButton?: string; - version?: string; - xfbml?: boolean; - isMobile?: boolean; - tag?: Node | Function; - } - - interface ReactFacebookLoginInfo { - id: string; - name: string; - } - - interface ReactFacebookLoginState { - isSdkLoaded?: boolean; - isProcessing?: boolean; - } + autoLoad?: boolean; + buttonStyle?: React.CSSProperties; + containerStyle?: React.CSSProperties; + cookie?: boolean; + cssClass?: string; + disableMobileRedirect?: boolean; + fields?: string; + icon?: string | React.ReactNode; + isDisabled?: boolean; + language?: string; + onClick?(): void; + reAuthenticate?: boolean; + redirectUri?: string; + scope?: string; + size?: "small" | "medium" | "metro"; + textButton?: string; + typeButton?: string; + version?: string; + xfbml?: boolean; + isMobile?: boolean; + tag?: Node | React.Component; } -declare class ReactFacebookLogin extends React.Component { } +export interface ReactFacebookLoginInfo { + id: string; + name: string; +} + +interface ReactFacebookLoginState { + isSdkLoaded?: boolean; + isProcessing?: boolean; +} + +declare class ReactFacebookLogin extends React.Component { } export default ReactFacebookLogin; From c2de1a8ad8d1b6f83be483e2b062296eb24a20c1 Mon Sep 17 00:00:00 2001 From: Michael Dodge Date: Wed, 17 May 2017 11:14:39 -0600 Subject: [PATCH 0205/1072] Add missing on/off functions --- types/signature_pad/index.d.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/types/signature_pad/index.d.ts b/types/signature_pad/index.d.ts index 87fd9c6a57..e6b3f79690 100644 --- a/types/signature_pad/index.d.ts +++ b/types/signature_pad/index.d.ts @@ -103,6 +103,14 @@ declare class SignaturePad { * Returns signature image as data URL */ toDataURL(): string; + /** + * Unbinds all event handlers + */ + off(): void; + /** + * Rebinds all event handlers + */ + on(): void; _strokeBegin(event: Event): void; _strokeUpdate(event: Event): void; From d31294e091cc71b52dfcfc673ae38334107364fa Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Wed, 17 May 2017 22:57:47 +0200 Subject: [PATCH 0206/1072] 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 0207/1072] 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 0208/1072] 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 0209/1072] 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 0210/1072] 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 98f0e4b428b547ebd397efee8ec07c2f911c772b Mon Sep 17 00:00:00 2001 From: TeamworkGuy2 Date: Wed, 17 May 2017 21:56:13 +0000 Subject: [PATCH 0211/1072] Cleanup orchestrator types --- types/gulp/gulp-tests.ts | 13 ++++--------- types/orchestrator/index.d.ts | 20 +++++++++++--------- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/types/gulp/gulp-tests.ts b/types/gulp/gulp-tests.ts index 809ffed350..09aad27a7a 100644 --- a/types/gulp/gulp-tests.ts +++ b/types/gulp/gulp-tests.ts @@ -1,26 +1,22 @@ import gulp = require("gulp"); -import browserSync = require("browser-sync"); var typescript: gulp.GulpPlugin = null; // this would be the TypeScript compiler var jasmine: gulp.GulpPlugin = null; // this would be the jasmine test runner -gulp.task('compile', function() -{ +gulp.task('compile', function() { gulp.src("**/*.ts") .pipe(typescript()) .pipe(gulp.dest('out')) }); -gulp.task('compile2', function(callback: (err?: any) => void) -{ +gulp.task('compile2', function(callback: (err?: any) => void) { gulp.src("**/*.ts") .pipe(typescript()) .pipe(gulp.dest('out')) .on('end', callback); }); -gulp.task('test', ['compile', 'compile2'], function() -{ +gulp.task('test', ['compile', 'compile2'], function() { gulp.src("out/test/**/*.js") .pipe(jasmine()); }); @@ -64,8 +60,7 @@ var watcher = gulp.watch('*.html', event => { }); gulp.task('serve', ['compile'], () => { - var browser = browserSync.create(); - gulp.watch(['*.html', '*.ts'], ['compile', browser.reload]); + gulp.watch(['*.html', '*.ts'], ['compile', () => { return "data"; }]); }); gulp.start('test', 'compile'); diff --git a/types/orchestrator/index.d.ts b/types/orchestrator/index.d.ts index 52ceacf429..fcb1a16120 100644 --- a/types/orchestrator/index.d.ts +++ b/types/orchestrator/index.d.ts @@ -9,12 +9,6 @@ import * as events from "events"; import * as stream from "stream"; import * as Q from "q"; -type _Sequencify = (tasks: Array<{ dep: string[]; }>, names: string[]) => { sequence: string[]; missingTasks: string[]; recursiveDependencies: string[]; }; - -type _runTask = (task: Orchestrator.TaskFunc, done: (err: any, meta: Orchestrator.Meta) => void) => void; - -type Strings = string|string[]; - /** A module for sequencing and executing tasks and dependencies in maximum concurrency */ declare class Orchestrator extends events.EventEmitter { @@ -54,7 +48,7 @@ declare class Orchestrator extends events.EventEmitter { stop(err?: any, successfulFinish?: boolean): void; - sequence: _Sequencify; + sequence: Orchestrator.Sequencify; allDone(): boolean; @@ -96,9 +90,17 @@ declare class Orchestrator extends events.EventEmitter { } declare namespace Orchestrator { - type runTask = _runTask; + type Strings = string | string[]; - type Sequencify = _Sequencify; + /** The method export generated by orchestrator/lib/runTask.js */ + type RunTask = (task: Orchestrator.TaskFunc, done: (err: any, meta: Orchestrator.Meta) => void) => void; + + /** The module export of the sequencify package: https://www.npmjs.com/package/sequencify */ + type Sequencify = (tasks: Array<{ dep: string[]; }>, names: string[]) => { + sequence: string[]; + missingTasks: string[]; + recursiveDependencies: string[]; + }; /** A task, can either call a callback to indicate task completion or return a promise or a stream: (task is marked complete when promise.then() resolves/fails or stream ends) */ From 678cc80ff5bcf9f660d4784e810134c60a0d7b03 Mon Sep 17 00:00:00 2001 From: Alexander James Phillips Date: Wed, 17 May 2017 23:50:18 +0100 Subject: [PATCH 0212/1072] Attempt to fix correct JoiValidationObject for hapi route validate option --- types/hapi/index.d.ts | 9 +++++---- types/hapi/test/route/validate.ts | 19 +++++++++++++++++++ types/hapi/tsconfig.json | 1 + 3 files changed, 25 insertions(+), 4 deletions(-) create mode 100644 types/hapi/test/route/validate.ts diff --git a/types/hapi/index.d.ts b/types/hapi/index.d.ts index 3567e50c34..644237f817 100644 --- a/types/hapi/index.d.ts +++ b/types/hapi/index.d.ts @@ -35,7 +35,8 @@ import domain = require("domain"); import * as Boom from 'boom'; import { ValidationOptions as JoiValidationOptions, - Schema as JoiValidationObject, + // TODO check JoiValidationObject is correct for "a Joi validation object" + SchemaMap as JoiValidationObject, } from 'joi'; import * as Catbox from 'catbox'; @@ -1304,7 +1305,7 @@ export interface RouteResponseConfigurationObject { * and * For context see RouteAdditionalConfigurationOptions > response > status */ -export type RouteResponseConfigurationScheme = boolean | JoiValidationObject | ValidationFunctionForRouteReponse; +export type RouteResponseConfigurationScheme = boolean | JoiValidationObject | ValidationFunctionForRouteResponse; /** * see RouteResponseConfigurationScheme @@ -1313,7 +1314,7 @@ export type RouteResponseConfigurationScheme = boolean | JoiValidationObject | V * TODO check `options: JoiValidationOptions` is correct * Also see ValidationFunctionForRouteValidate */ -export interface ValidationFunctionForRouteReponse { +export interface ValidationFunctionForRouteResponse { (value: Response, options: JoiValidationOptions, next: ContinuationFunction): void; } @@ -1399,7 +1400,7 @@ export interface RouteValidationConfigurationObject { * TODO check `value: Response` is correct as it says "**the object containing** the response object." not just "the response object". * TODO check `options: JoiValidationOptions` is correct * TODO type of the returned value? - * Also see ValidationFunctionForRouteReponse + * Also see ValidationFunctionForRouteResponse * @param value - the object containing the request headers. * @param options - the server validation options. * @param next(err, value) - the callback function called when validation is completed. diff --git a/types/hapi/test/route/validate.ts b/types/hapi/test/route/validate.ts new file mode 100644 index 0000000000..47abc77a96 --- /dev/null +++ b/types/hapi/test/route/validate.ts @@ -0,0 +1,19 @@ + +// Added from: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/16065#issuecomment-302216131 + +import * as Hapi from 'hapi'; +import * as Joi from 'joi'; + +const validate: Hapi.RouteValidationConfigurationObject = { + headers: true, + params: { + id: Joi.string(), + }, + query: { + providerId: Joi.string(), + }, +} + +const config: Hapi.RouteAdditionalConfigurationOptions = { + validate, +}; diff --git a/types/hapi/tsconfig.json b/types/hapi/tsconfig.json index f8d5b055e2..f811a2f8fb 100644 --- a/types/hapi/tsconfig.json +++ b/types/hapi/tsconfig.json @@ -47,6 +47,7 @@ "test/route/handler.ts", "test/route/prerequisites.ts", "test/route/public-interface.ts", + "test/route/validate.ts", "test/server/app.ts", "test/server/auth.ts", "test/server/bind.ts", From 869397339e9681e901f8b4ebf933aa0da12462f4 Mon Sep 17 00:00:00 2001 From: John Pinkster Date: Wed, 17 May 2017 21:11:35 -0400 Subject: [PATCH 0213/1072] Sequelize - FIX/Paranoid in IncludeOptions In the `IncludeOptions` there is an optional property missing from the definition file that allows you to turn on and off the paranoid functionality from the search. Documentation of functionality: http://docs.sequelizejs.com/manual/tutorial/models-usage.html#including-soft-deleted-records Please fill in this template. - [ ] Use a meaningful title for the pull request. Include the name of the package modified. - [ ] Test the change in your own code. (Compile and run.) - [ ] Follow the advice from the [readme](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.md#make-a-pull-request). - [ ] Avoid [common mistakes](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.md#common-mistakes). - [ ] Run `npm run lint package-name` (or `tsc` if no `tslint.json` is present). Select one of these and delete the others: If adding a new definition: - [ ] The package does not provide its own types, and you can not add them. - [ ] If this is for an NPM package, match the name. If not, do not conflict with the name of an NPM package. - [ ] Create it with `dts-gen --dt`, not by basing it on an existing project. - [ ] `tslint.json` should be present, and `tsconfig.json` should have `noImplicitAny`, `noImplicitThis`, and `strictNullChecks` set to `true`. If changing an existing definition: - [ ] Provide a URL to documentation or source code which provides context for the suggested changes: <> - [ ] Increase the version number in the header if appropriate. - [ ] If you are making substantial changes, consider adding a `tslint.json` containing `{ "extends": "../tslint.json" }`. If removing a declaration: - [ ] If a package was never on DefinitelyTyped, you don't need to do anything. (If you wrote a package and provided types, you don't need to register it with us.) - [ ] Delete the package's directory. - [ ] Add it to `notNeededPackages.json`. --- types/sequelize/index.d.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/types/sequelize/index.d.ts b/types/sequelize/index.d.ts index c5974a56d2..c227e13d55 100644 --- a/types/sequelize/index.d.ts +++ b/types/sequelize/index.d.ts @@ -3165,6 +3165,12 @@ declare namespace sequelize { * Load further nested related models */ include?: Array | IncludeOptions>; + + /** + * If true, only non-deleted records will be returned. If false, both deleted and non-deleted records will + * be returned. Only applies if `options.paranoid` is true for the model. + */ + paranoid?: boolean; } From d7ea6529f63b22def063be0cfc01ac64bab9f01c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=20G=C3=A1mez=20Franco?= Date: Thu, 18 May 2017 03:56:44 +0200 Subject: [PATCH 0214/1072] Add `discriminatorKey` to `SchemaOptions` interface. --- types/mongoose/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/mongoose/index.d.ts b/types/mongoose/index.d.ts index 5a2a0abfe1..42e3ca3742 100644 --- a/types/mongoose/index.d.ts +++ b/types/mongoose/index.d.ts @@ -696,6 +696,8 @@ declare module "mongoose" { capped?: boolean; /** no default */ collection?: string; + /** defaults to "__t" */ + discriminatorKey?: string; /** defaults to false. */ emitIndexErrors?: boolean; /** defaults to true */ From fb3db44a1e2c748d2fa7a18482fe83018dbafac0 Mon Sep 17 00:00:00 2001 From: Basti Hoffmann Date: Thu, 18 May 2017 08:42:04 +0200 Subject: [PATCH 0215/1072] chore: Updated README (Travis link) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9f3c4fe78f..129576c1ec 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# DefinitelyTyped [![Build Status](https://travis-ci.org/DefinitelyTyped/DefinitelyTyped.png?branch=master)](https://travis-ci.org/DefinitelyTyped/DefinitelyTyped) +# DefinitelyTyped [![Build Status](https://travis-ci.org/bohoffi/DefinitelyTyped.png?branch=master)](https://travis-ci.org/bohoffi/DefinitelyTyped) [![Join the chat at https://gitter.im/borisyankov/DefinitelyTyped](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/borisyankov/DefinitelyTyped?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) From f0295138249462e8e1731c0abbd0bb812f713e86 Mon Sep 17 00:00:00 2001 From: Basti Hoffmann Date: Thu, 18 May 2017 08:45:11 +0200 Subject: [PATCH 0216/1072] chore: Reverted README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 129576c1ec..9f3c4fe78f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# DefinitelyTyped [![Build Status](https://travis-ci.org/bohoffi/DefinitelyTyped.png?branch=master)](https://travis-ci.org/bohoffi/DefinitelyTyped) +# DefinitelyTyped [![Build Status](https://travis-ci.org/DefinitelyTyped/DefinitelyTyped.png?branch=master)](https://travis-ci.org/DefinitelyTyped/DefinitelyTyped) [![Join the chat at https://gitter.im/borisyankov/DefinitelyTyped](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/borisyankov/DefinitelyTyped?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) From 88233b2212f3b6b668f1ebd35c1c20b7d41f248d Mon Sep 17 00:00:00 2001 From: Nicholas Merritt Date: Thu, 18 May 2017 09:35:46 +0200 Subject: [PATCH 0217/1072] fix security property type See https://github.com/OAI/OpenAPI-Specification/blob/ae9322eb2df1555acf3163e30cd84779d98afec5/schemas/v2.0/schema.json#L1177 for the original JSON-schema definition of the security field. --- types/swagger-schema-official/index.d.ts | 4 ++-- .../swagger-schema-official-tests.ts | 13 +++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/types/swagger-schema-official/index.d.ts b/types/swagger-schema-official/index.d.ts index 3a70e456a7..f08bba922f 100644 --- a/types/swagger-schema-official/index.d.ts +++ b/types/swagger-schema-official/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for swagger-schema-official 2.0 // Project: http://swagger.io/specification/ -// Definitions by: Mohsen Azimi , Ben Southgate +// Definitions by: Mohsen Azimi , Ben Southgate , Nicholas Merritt // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export interface Info { @@ -224,7 +224,7 @@ export interface Spec { definitions?: {[definitionsName: string]: Schema }; parameters?: {[parameterName: string]: BodyParameter|QueryParameter}; responses?: {[responseName: string]: Response }; - security?: Security[]; + security?: Array<{[securityDefinitionName: string]: string[]}>; securityDefinitions?: { [securityDefinitionName: string]: Security}; tags?: Tag[]; } diff --git a/types/swagger-schema-official/swagger-schema-official-tests.ts b/types/swagger-schema-official/swagger-schema-official-tests.ts index 42e35483ea..72fce17176 100644 --- a/types/swagger-schema-official/swagger-schema-official-tests.ts +++ b/types/swagger-schema-official/swagger-schema-official-tests.ts @@ -1324,3 +1324,16 @@ const uber: swagger.Spec = { } } }; + +const basic_auth: swagger.Spec = { + "swagger": "2.0", + "info": { "version": "1.0.0", "title": "Minimal example with basic auth"}, + "schemes": [ + "https" + ], + "paths": {}, + "securityDefinitions": { + basicAuth: { type: 'basic' }, + }, + "security": [{basicAuth: []}] +}; From e724b60c9227e8629653c89269471d0742a8eef1 Mon Sep 17 00:00:00 2001 From: andraaspar Date: Thu, 18 May 2017 11:43:55 +0200 Subject: [PATCH 0218/1072] 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 bbcb50a4e160d9f72ce8aa2d0cf21b40062a78ea Mon Sep 17 00:00:00 2001 From: Alexander James Phillips Date: Thu, 18 May 2017 10:49:57 +0100 Subject: [PATCH 0219/1072] Update hapi route validate to allow joi Schema SchemaMap or array of those --- types/hapi/index.d.ts | 6 ++++-- types/hapi/test/route/validate.ts | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/types/hapi/index.d.ts b/types/hapi/index.d.ts index 644237f817..26b54b0ace 100644 --- a/types/hapi/index.d.ts +++ b/types/hapi/index.d.ts @@ -35,9 +35,11 @@ import domain = require("domain"); import * as Boom from 'boom'; import { ValidationOptions as JoiValidationOptions, - // TODO check JoiValidationObject is correct for "a Joi validation object" - SchemaMap as JoiValidationObject, + SchemaMap as JoiSchemaMap, + Schema as JoiSchema, } from 'joi'; +// TODO check JoiValidationObject is correct for "a Joi validation object" +type JoiValidationObject = JoiSchema | JoiSchemaMap | (JoiSchema | JoiSchemaMap)[]; import * as Catbox from 'catbox'; import {MimosOptions} from 'mimos'; diff --git a/types/hapi/test/route/validate.ts b/types/hapi/test/route/validate.ts index 47abc77a96..f160641016 100644 --- a/types/hapi/test/route/validate.ts +++ b/types/hapi/test/route/validate.ts @@ -9,10 +9,11 @@ const validate: Hapi.RouteValidationConfigurationObject = { params: { id: Joi.string(), }, + payload: Joi.object().required(), query: { providerId: Joi.string(), }, -} +}; const config: Hapi.RouteAdditionalConfigurationOptions = { validate, From 82307e4d26404f476758a8fcf6889867de5a3cc8 Mon Sep 17 00:00:00 2001 From: John Pinkster Date: Thu, 18 May 2017 07:11:38 -0400 Subject: [PATCH 0220/1072] Adding a test for include.paranoid --- types/sequelize/sequelize-tests.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/sequelize/sequelize-tests.ts b/types/sequelize/sequelize-tests.ts index a7dde618af..7aef602a68 100644 --- a/types/sequelize/sequelize-tests.ts +++ b/types/sequelize/sequelize-tests.ts @@ -874,6 +874,7 @@ User.findAll( { s.or( { deletedAt : null }, { deletedAt : { gt : new Date( 0 ) } } ) )] } ); User.findAll( { paranoid : false, where : [' IS NOT NULL '], include : [{ model : User }] } ); +User.findAll( { include : [{ model : Task, paranoid: false }] } ); User.findAll( { transaction : t } ); User.findAll( { where : { data : { name : { last : 's' }, employment : { $ne : 'a' } } }, order : [['id', 'ASC']] } ); User.findAll( { where : { username : ['boo', 'boo2'] } } ); From a82323abc9b1208421f41647c5c3cef1b128e39f Mon Sep 17 00:00:00 2001 From: Simon Schick Date: Thu, 18 May 2017 13:38:10 +0200 Subject: [PATCH 0221/1072] fix typo --- types/hapi/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/hapi/index.d.ts b/types/hapi/index.d.ts index 0abdf534e9..40fae44148 100644 --- a/types/hapi/index.d.ts +++ b/types/hapi/index.d.ts @@ -2198,7 +2198,7 @@ export type AnyAuthenticationResponseAction = any; /** [See docs](https://hapijs.com/api/16.1.1#serverauthschemename-scheme) */ export interface AuthenticationResult { credentials?: AuthenticatedCredentials; - artefacts?: any; + artifacts?: any; } export interface AuthenticatedCredentials { // Disabled to allow typing within a project From 6e46f5cb5426bf436a049e1049dc13220bf31370 Mon Sep 17 00:00:00 2001 From: edvinv Date: Thu, 18 May 2017 14:26:53 +0200 Subject: [PATCH 0222/1072] [knex] Add function queryBuilder. --- types/knex/index.d.ts | 1 + types/knex/knex-tests.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/types/knex/index.d.ts b/types/knex/index.d.ts index 16330b4e3a..51f438c5d8 100644 --- a/types/knex/index.d.ts +++ b/types/knex/index.d.ts @@ -27,6 +27,7 @@ interface Knex extends Knex.QueryInterface { destroy(): Promise; batchInsert(tableName : TableName, data: any[], chunkSize : number) : Knex.QueryBuilder; schema: Knex.SchemaBuilder; + queryBuilder(): Knex.QueryBuilder; client: any; migrate: Knex.Migrator; diff --git a/types/knex/knex-tests.ts b/types/knex/knex-tests.ts index 920b347a70..050479367c 100644 --- a/types/knex/knex-tests.ts +++ b/types/knex/knex-tests.ts @@ -299,6 +299,7 @@ knex('books') .insert([{title: 'Great Gatsby'}, {title: 'Fahrenheit 451'}]); knex.batchInsert('books', [{title:'Great Gatsby'}, {title: 'Fahrenheit 451'}], 200); +knex.queryBuilder().table('books'); knex('books').where('published_date', '<', 2000).update({status: 'archived'}); knex('books').where('published_date', '<', 2000).update({status: 'archived'}, 'id'); From 0249359fe12157f849f59475d3f2a66cfcb01b0e Mon Sep 17 00:00:00 2001 From: Michael Zugelder Date: Thu, 18 May 2017 14:36:55 +0200 Subject: [PATCH 0223/1072] 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 e5ce007af582343ca9d207145a1b0732f0d0ee7f Mon Sep 17 00:00:00 2001 From: Vinicius Fortuna Date: Thu, 18 May 2017 09:26:36 -0400 Subject: [PATCH 0224/1072] Hide static fields and make CORS a pure function --- types/restify/index.d.ts | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/types/restify/index.d.ts b/types/restify/index.d.ts index 5a6b692570..6074ce8284 100644 --- a/types/restify/index.d.ts +++ b/types/restify/index.d.ts @@ -595,16 +595,13 @@ export function auditLogger(options: { log: any }): (req: Request, res: Response export function fullResponse(): RequestHandler; // tslint:disable-next-line no-var export var defaultResponseHeaders: any; -export const CORS: { - (cors?: { - origins?: string[]; - credentials?: boolean; - headers?: string[]; - }): RequestHandler; - origins: string[]; - ALLOW_HEADERS: string[]; - credentials: boolean; -}; + +export function CORS(options?: CORSOptions): RequestHandler; +export interface CORSOptions { + origins?: string[]; + credentials?: boolean; + headers?: string[]; +} export const pre: { pause(): RequestHandler; From 8d227a304596ee2b71351057bc4d04e5821b349e Mon Sep 17 00:00:00 2001 From: Spectral Radius Systems Date: Thu, 18 May 2017 10:01:03 -0400 Subject: [PATCH 0225/1072] 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 0226/1072] 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 5dfa23810d940fb98d883451c82ff236ab0a481d Mon Sep 17 00:00:00 2001 From: huhuanming Date: Thu, 18 May 2017 23:29:42 +0800 Subject: [PATCH 0227/1072] Add removeClippedSubviews To SectionList & FlatList --- types/react-native/index.d.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index ee306f8545..a7e922e1b1 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -3524,6 +3524,13 @@ export interface FlatListProperties { * See `ViewabilityHelper` for flow type and further documentation. */ viewabilityConfig?: any + + /** + * Note: may have bugs (missing content) in some circumstances - use at your own risk. + * + * This may improve scroll performance for large lists. + */ + removeClippedSubviews?: boolean } export interface FlatListStatic extends React.ComponentClass> { @@ -3649,6 +3656,13 @@ export interface SectionListProperties extends ScrollViewProperties { * Render a custom scroll component, e.g. with a differently styled `RefreshControl`. */ renderScrollComponent?: (props: ScrollViewProperties) => React.ReactElement + + /** + * Note: may have bugs (missing content) in some circumstances - use at your own risk. + * + * This may improve scroll performance for large lists. + */ + removeClippedSubviews?: boolean } export interface SectionListStatic extends React.ComponentClass> { From 6ab6d781770a1e87a86c75865c37ec50d05b04b3 Mon Sep 17 00:00:00 2001 From: Giedrius Grabauskas Date: Thu, 18 May 2017 18:31:22 +0300 Subject: [PATCH 0228/1072] 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 0229/1072] (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 cdca61035a709b4c022b91c52ac65061e29d43f2 Mon Sep 17 00:00:00 2001 From: Mike Dvorscak Date: Thu, 18 May 2017 11:40:32 -0500 Subject: [PATCH 0230/1072] Add JQueryCssProperties interface for $.css(properties: object) Adding JQueryCssProperties interface and changing the signature for $.css(properties: object) to $.css(properties: JQueryCssProperties) --- types/jquery/index.d.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/types/jquery/index.d.ts b/types/jquery/index.d.ts index ca799f21e5..9dc1bf466e 100644 --- a/types/jquery/index.d.ts +++ b/types/jquery/index.d.ts @@ -679,6 +679,13 @@ interface JQueryCoordinates { top: number; } +/** + * The interface used to specify the properties parameter in css() + */ +interface JQueryCssProperties { + [propertyName: string]: string | number | Function; +} + /** * Elements in the array returned by serializeArray() */ @@ -1687,7 +1694,7 @@ interface JQuery { * @param properties An object of property-value pairs to set. * @see {@link https://api.jquery.com/css/#css-properties} */ - css(properties: Object): JQuery; + css(properties: JQueryCssProperties): JQuery; /** * Get the current computed height for the first element in the set of matched elements. From 5c7ab838d70d950b6d1768cbdd6b68b9983963c4 Mon Sep 17 00:00:00 2001 From: Paul Sachs Date: Thu, 18 May 2017 12:49:50 -0400 Subject: [PATCH 0231/1072] Update to match webpack-chain@3.3.0 Added noParse (a TypedChainedSet of RegExp) to module --- types/webpack-chain/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/webpack-chain/index.d.ts b/types/webpack-chain/index.d.ts index dd7b0b0d63..fc9e2e158c 100644 --- a/types/webpack-chain/index.d.ts +++ b/types/webpack-chain/index.d.ts @@ -83,6 +83,7 @@ declare namespace Config { class Module extends ChainedMap { rules: TypedChainedMap; rule(name: string): Rule; + noParse: TypedChainedSet; } class Output extends ChainedMap { From e5e2ddfe5996c574adb901f9a7479d6dee85ba93 Mon Sep 17 00:00:00 2001 From: Paul Sachs Date: Thu, 18 May 2017 12:53:04 -0400 Subject: [PATCH 0232/1072] Added test for noParse --- types/webpack-chain/webpack-chain-tests.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/webpack-chain/webpack-chain-tests.ts b/types/webpack-chain/webpack-chain-tests.ts index f955decd38..466efc4db7 100644 --- a/types/webpack-chain/webpack-chain-tests.ts +++ b/types/webpack-chain/webpack-chain-tests.ts @@ -83,6 +83,7 @@ config .end() .module + .noParse.add(/.min.js$/).end() .rule('compile') .test(/.js$/) .include From 3c07249e97fb11180da9891b756ca69e897b4fd2 Mon Sep 17 00:00:00 2001 From: Paul Sachs Date: Thu, 18 May 2017 12:54:27 -0400 Subject: [PATCH 0233/1072] Update webpack-chain-tests.ts --- types/webpack-chain/webpack-chain-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/webpack-chain/webpack-chain-tests.ts b/types/webpack-chain/webpack-chain-tests.ts index 466efc4db7..ac40e70624 100644 --- a/types/webpack-chain/webpack-chain-tests.ts +++ b/types/webpack-chain/webpack-chain-tests.ts @@ -83,7 +83,7 @@ config .end() .module - .noParse.add(/.min.js$/).end() + .noParse.add(/.min.js$/).end() .rule('compile') .test(/.js$/) .include From cd4d27c57d53b3e3ab69d61c10eba5cd75e9acfa Mon Sep 17 00:00:00 2001 From: "Michael R. Maletich" Date: Thu, 18 May 2017 12:21:13 -0500 Subject: [PATCH 0234/1072] ramda: Add support for curry on view definition --- types/ramda/index.d.ts | 1 + types/ramda/ramda-tests.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index 7fde62feee..d74b8b3e14 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -1728,6 +1728,7 @@ declare namespace R { * portion of the data structure is visible. */ view(lens: Lens, obj: T): U; + view(lens: Lens): (obj: T) => U; /** * Tests the final argument by passing it to the given predicate function. If the predicate is satisfied, the function diff --git a/types/ramda/ramda-tests.ts b/types/ramda/ramda-tests.ts index 5c5948b047..9afa47ba04 100644 --- a/types/ramda/ramda-tests.ts +++ b/types/ramda/ramda-tests.ts @@ -1161,6 +1161,7 @@ class Rectangle { () => { var xLens = R.lens(R.prop('x'), R.assoc('x')); R.view(xLens, {x: 1, y: 2}); //=> 1 + R.view(xLens)({x: 1, y: 2}); //=> 1 R.set(xLens, 4, {x: 1, y: 2}); //=> {x: 4, y: 2} R.set(xLens)(4, {x: 1, y: 2}); //=> {x: 4, y: 2} R.set(xLens, 4)({x: 1, y: 2}); //=> {x: 4, y: 2} 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 0235/1072] {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 0236/1072] 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 0237/1072] 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 cec538087c579d5281c233c03613e9e93f200512 Mon Sep 17 00:00:00 2001 From: Alexander James Phillips Date: Thu, 18 May 2017 23:26:54 +0100 Subject: [PATCH 0238/1072] Correct inject result type --- types/hapi/index.d.ts | 2 +- types/hapi/test/server/inject.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/types/hapi/index.d.ts b/types/hapi/index.d.ts index 26b54b0ace..0249d343cb 100644 --- a/types/hapi/index.d.ts +++ b/types/hapi/index.d.ts @@ -698,7 +698,7 @@ export interface InjectedRequestOptions extends Shot.RequestOptions { */ export interface InjectedResponseObject extends Shot.ResponseObject { /** the raw handler response (e.g. when not a stream or a view) before it is serialized for transmission. If not available, the value is set to payload. Useful for inspection and reuse of the internal objects returned (instead of parsing the response string). */ - result: Shot.ResponseObject | string; + result: Object | string; /** the request object. */ request: InjectedRequestOptions; } diff --git a/types/hapi/test/server/inject.ts b/types/hapi/test/server/inject.ts index 130af7489b..7010faa3dc 100644 --- a/types/hapi/test/server/inject.ts +++ b/types/hapi/test/server/inject.ts @@ -13,6 +13,7 @@ const handler: Hapi.RouteHandler = function (request, reply) { server.route({ method: 'GET', path: '/', handler: handler }); server.inject('/', (res) => { - + const num: number = res.statusCode; + const result = res.result as {aField: string}; console.log(res.result); }); From 09d36cb59e3c8317e03539625ba6721bcd084a4d Mon Sep 17 00:00:00 2001 From: Takeshi YAEDA Date: Fri, 19 May 2017 09:03:08 +0900 Subject: [PATCH 0239/1072] 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 dc646cb5e2342e7c13c1c9ea81d6d0f3f588a3e7 Mon Sep 17 00:00:00 2001 From: Nathan Hardy Date: Fri, 19 May 2017 10:21:05 +1000 Subject: [PATCH 0240/1072] extract-text-webpack-plugin: Update .extract return type As per https://github.com/webpack-contrib/extract-text-webpack-plugin/pull/343 the .extract() method of ExtractTextPlugin has a return type of 'Loader[]' --- types/extract-text-webpack-plugin/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/extract-text-webpack-plugin/index.d.ts b/types/extract-text-webpack-plugin/index.d.ts index 6da0c183c3..fa1c79d812 100644 --- a/types/extract-text-webpack-plugin/index.d.ts +++ b/types/extract-text-webpack-plugin/index.d.ts @@ -42,7 +42,7 @@ interface ExtractTextPlugin extends Plugin { * Creates an extracting loader from an existing loader. * Use the resulting loader in `module.rules`/`module.loaders`. */ - extract: (loader: Loader | Loader[] | ExtractOptions) => Loader + extract: (loader: Loader | Loader[] | ExtractOptions) => Loader[] } declare const extractTextPlugin: ExtractTextPlugin From 8f6f50fccfadff7865d88e1a6f448286aa90fd5d Mon Sep 17 00:00:00 2001 From: Nathan Hardy Date: Fri, 19 May 2017 10:27:11 +1000 Subject: [PATCH 0241/1072] extract-text-webpack-plugin: Bump version to 2.1.0 --- types/extract-text-webpack-plugin/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/extract-text-webpack-plugin/index.d.ts b/types/extract-text-webpack-plugin/index.d.ts index fa1c79d812..0897d7b594 100644 --- a/types/extract-text-webpack-plugin/index.d.ts +++ b/types/extract-text-webpack-plugin/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for extract-text-webpack-plugin 2.0.0 +// Type definitions for extract-text-webpack-plugin 2.1.0 // Project: https://github.com/webpack-contrib/extract-text-webpack-plugin // Definitions by: flying-sheep , kayo // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 263377ba1c9e4780be631ebcdfec91138adc88da Mon Sep 17 00:00:00 2001 From: Alex Frieder Date: Thu, 18 May 2017 23:13:44 -0400 Subject: [PATCH 0242/1072] Fix optional parameter for when.js done --- types/when/index.d.ts | 2 +- types/when/when-tests.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/types/when/index.d.ts b/types/when/index.d.ts index a04411981b..a459e031a1 100644 --- a/types/when/index.d.ts +++ b/types/when/index.d.ts @@ -278,7 +278,7 @@ declare namespace When { spread(onFulfilled: _.Fn4 | T>): Promise; spread(onFulfilled: _.Fn5 | T>): Promise; - done(onFulfilled: (value: T) => void, onRejected?: (reason: any) => void): void; + done(onFulfilled?: (value: T) => void, onRejected?: (reason: any) => void): void; fold(combine: (value1: T, value2: V) => U | Promise, value2: V | Promise): Promise; } diff --git a/types/when/when-tests.ts b/types/when/when-tests.ts index ab2bd7e5d3..57523b00ac 100644 --- a/types/when/when-tests.ts +++ b/types/when/when-tests.ts @@ -172,6 +172,7 @@ deferred.reject(error); /* promise.done(handleResult, handleError) */ +when(1).done(); when(1).done((val: number) => console.log(val)); when(1).done((val: number) => console.log(val), (err: any) => console.log(err)); From afdadfe885dfe01e6c929cc4a6ef668113ca8f67 Mon Sep 17 00:00:00 2001 From: jacobbogers Date: Fri, 19 May 2017 06:11:06 +0200 Subject: [PATCH 0243/1072] 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 0244/1072] 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 0245/1072] 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 0246/1072] 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 0247/1072] 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 0248/1072] 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 0249/1072] 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 0250/1072] 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 0251/1072] 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 0252/1072] 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 0253/1072] 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 8743365b2e49d5494d384658ac0acf3899fb74ad Mon Sep 17 00:00:00 2001 From: Tom Wanzek Date: Fri, 19 May 2017 10:13:29 -0400 Subject: [PATCH 0254/1072] [d3-shape] Update to 1.2 (#16618) * [FEATURE] Add `pointRadial(...)` * [DEPRECATION/FEATURE]: Deprecate `radialLine/RadialLine` in favour of `lineRadial/LineRadial` * [DEPRECATION/FEATURE]: Deprecate `radialArea/RadialArea` in favour of `areaRadial/AreaRadial` * [DEPRECATION/FEATURE] Deprecate `LinkRadial` in favour of `RadialLink` * [CHORE] Bump Minor version --- types/d3-shape/d3-shape-tests.ts | 260 +++++++++++++++++-------------- types/d3-shape/index.d.ts | 71 +++++++-- 2 files changed, 197 insertions(+), 134 deletions(-) diff --git a/types/d3-shape/d3-shape-tests.ts b/types/d3-shape/d3-shape-tests.ts index 5b322772b6..6e0fa97d96 100644 --- a/types/d3-shape/d3-shape-tests.ts +++ b/types/d3-shape/d3-shape-tests.ts @@ -358,14 +358,14 @@ interface LineDatum { let lineXYAccessorFn: (d: LineDatum, index?: number, data?: LineDatum[]) => number; let lineDefAccessorFn: (d: LineDatum, index?: number, data?: LineDatum[]) => boolean; -interface RadialLineDatum { +interface LineRadialDatum { angle: number; radius: number; missing: boolean; } -let radialLineAngRAccessorFn: (d: RadialLineDatum, index?: number, data?: RadialLineDatum[]) => number; -let radialLineDefAccessorFn: (d: RadialLineDatum, index?: number, data?: RadialLineDatum[]) => boolean; +let lineRadialAngRAccessorFn: (d: LineRadialDatum, index?: number, data?: LineRadialDatum[]) => number; +let lineRadialDefAccessorFn: (d: LineRadialDatum, index?: number, data?: LineRadialDatum[]) => boolean; // line(...) create Line generator ===================================================== @@ -440,77 +440,85 @@ const lineData: LineDatum[] = [ const linePathStringMaybe: string | null = line(lineData); -// radialLine(...) create Line generator ===================================================== +// lineRadial(...) create Line generator ===================================================== -let defaultRadialLine: d3Shape.RadialLine<[number, number]> = d3Shape.radialLine(); -let radialLine: d3Shape.RadialLine = d3Shape.radialLine(); +let defaultLineRadial: d3Shape.LineRadial<[number, number]> = d3Shape.lineRadial(); +let lineRadial: d3Shape.LineRadial = d3Shape.lineRadial(); -// configure RadialLine(...) generator ====================================================== +// DEPRECATED Naming conventions test (cross-testing with new naming conventions) + +let defaultRadialLine: d3Shape.RadialLine<[number, number]> = defaultLineRadial; +let radialLine: d3Shape.RadialLine = lineRadial; + +defaultLineRadial = d3Shape.radialLine(); +lineRadial = d3Shape.radialLine(); + +// configure LineRadial(...) generator ====================================================== // context(...) ---------------------------------------------------------------------- if (context !== null) { - defaultRadialLine = defaultRadialLine.context(context); // draw to canvas + defaultLineRadial = defaultLineRadial.context(context); // draw to canvas } -context = defaultRadialLine.context(); +context = defaultLineRadial.context(); -radialLine = radialLine.context(null); // use as path string generator for SVG +lineRadial = lineRadial.context(null); // use as path string generator for SVG // angle(...) ---------------------------------------------------------------------------- -defaultRadialLine = defaultRadialLine.angle(Math.PI); +defaultLineRadial = defaultLineRadial.angle(Math.PI); -radialLine = radialLine.angle((d, t, data) => { +lineRadial = lineRadial.angle((d, t, data) => { console.log('Number of Points: ', data.length); - console.log('Angle of first point: ', data[0].angle); // data type is Array - return d.angle; // d type is RadialLineDatum + console.log('Angle of first point: ', data[0].angle); // data type is Array + return d.angle; // d type is LineRadialDatum }); -radialLineAngRAccessorFn = radialLine.angle(); +lineRadialAngRAccessorFn = lineRadial.angle(); // radius(...) ---------------------------------------------------------------------------- -defaultRadialLine = defaultRadialLine.radius(30); +defaultLineRadial = defaultLineRadial.radius(30); -radialLine = radialLine.radius((d, t, data) => { +lineRadial = lineRadial.radius((d, t, data) => { console.log('Number of Points: ', data.length); - console.log('Angle of first point: ', data[0].angle); // data type is Array - return d.radius; // d type is RadialLineDatum + console.log('Angle of first point: ', data[0].angle); // data type is Array + return d.radius; // d type is LineRadialDatum }); -radialLineAngRAccessorFn = radialLine.radius(); +lineRadialAngRAccessorFn = lineRadial.radius(); // defined(...) ---------------------------------------------------------------------- -defaultRadialLine = defaultRadialLine.defined(true); +defaultLineRadial = defaultLineRadial.defined(true); -radialLine = radialLine.defined((d, t, data) => { +lineRadial = lineRadial.defined((d, t, data) => { console.log('Number of Points: ', data.length); - console.log('Angle of first point: ', data[0].angle); // data type is Array - return !d.missing; // d type is RadialLineDatum + console.log('Angle of first point: ', data[0].angle); // data type is Array + return !d.missing; // d type is LineRadialDatum }); -radialLineDefAccessorFn = radialLine.defined(); +lineRadialDefAccessorFn = lineRadial.defined(); // curve(...) ------------------------------------------------------------------------ -defaultRadialLine = defaultRadialLine.curve(d3Shape.curveLinear); +defaultLineRadial = defaultLineRadial.curve(d3Shape.curveLinear); -radialLine = radialLine.curve(d3Shape.curveBundle.beta(0.5)); +lineRadial = lineRadial.curve(d3Shape.curveBundle.beta(0.5)); -currentCurveFactory = radialLine.curve(); +currentCurveFactory = lineRadial.curve(); -// use RadialLine generator =============================================================== +// use LineRadial generator =============================================================== -defaultRadialLine([[10, 10], [20, 10], [20, 20]]); +defaultLineRadial([[10, 10], [20, 10], [20, 20]]); -const radialLineData: RadialLineDatum[] = [ +const lineRadialData: LineRadialDatum[] = [ { angle: 0, radius: 10, missing: false }, { angle: Math.PI / 2, radius: 20, missing: false }, { angle: 2 * Math.PI, radius: 10, missing: false } ]; -const radialLinePathStringMaybe: string | null = radialLine(radialLineData); +const lineRadialPathStringMaybe: string | null = lineRadial(lineRadialData); // ----------------------------------------------------------------------------------- // Test Area Generators @@ -528,7 +536,7 @@ let areaXYAccessorFn: (d: AreaDatum, index?: number, data?: AreaDatum[]) => numb let areaXYAccessorFnMaybe: null | ((d: AreaDatum, index?: number, data?: AreaDatum[]) => number); let areaDefAccessorFn: (d: AreaDatum, index?: number, data?: AreaDatum[]) => boolean; -interface RadialAreaDatum { +interface AreaRadialDatum { startAngle: number; endAngle: number; innerRadius: number; @@ -536,9 +544,9 @@ interface RadialAreaDatum { missing: boolean; } -let radialAreaAngRAccessorFn: (d: RadialAreaDatum, index?: number, data?: RadialAreaDatum[]) => number; -let radialAreaAngRAccessorFnMaybe: null | ((d: RadialAreaDatum, index?: number, data?: RadialAreaDatum[]) => number); -let radialAreaDefAccessorFn: (d: RadialAreaDatum, index?: number, data?: RadialAreaDatum[]) => boolean; +let areaRadialAngRAccessorFn: (d: AreaRadialDatum, index?: number, data?: AreaRadialDatum[]) => number; +let areaRadialAngRAccessorFnMaybe: null | ((d: AreaRadialDatum, index?: number, data?: AreaRadialDatum[]) => number); +let areaRadialDefAccessorFn: (d: AreaRadialDatum, index?: number, data?: AreaRadialDatum[]) => boolean; // area(...) create Area generator ===================================================== @@ -670,135 +678,143 @@ areaLineGenerator = area.lineY0(); areaLineGenerator = area.lineX1(); areaLineGenerator = area.lineY1(); -// radialArea(...) create RadialArea generator ===================================================== +// areaRadial(...) create AreaRadial generator ===================================================== -let defaultRadialArea: d3Shape.RadialArea<[number, number]> = d3Shape.radialArea(); -let radialArea: d3Shape.RadialArea = d3Shape.radialArea(); +let defaultAreaRadial: d3Shape.AreaRadial<[number, number]> = d3Shape.areaRadial(); +let areaRadial: d3Shape.AreaRadial = d3Shape.areaRadial(); -// configure RadialArea(...) generator ====================================================== +// DEPRECATED Naming conventions test (cross-testing with new naming conventions) + +let defaultRadialArea: d3Shape.RadialArea<[number, number]> = defaultAreaRadial; +let radialArea: d3Shape.RadialArea = areaRadial; + +defaultAreaRadial = d3Shape.radialArea(); +areaRadial = d3Shape.radialArea(); + +// configure AreaRadial(...) generator ====================================================== // context(...) ---------------------------------------------------------------------- if (context !== null) { - defaultRadialArea = defaultRadialArea.context(context); // draw to canvas + defaultAreaRadial = defaultAreaRadial.context(context); // draw to canvas } -context = defaultRadialArea.context(); +context = defaultAreaRadial.context(); -radialArea = radialArea.context(null); // use as path string generator for SVG +areaRadial = areaRadial.context(null); // use as path string generator for SVG // angle(...) ---------------------------------------------------------------------------- -defaultRadialArea = defaultRadialArea.angle(Math.PI); +defaultAreaRadial = defaultAreaRadial.angle(Math.PI); -radialArea = radialArea.angle((d, t, data) => { +areaRadial = areaRadial.angle((d, t, data) => { console.log('Number of Points: ', data.length); - console.log('Start angle of first point: ', data[0].startAngle); // data type is Array - return d.startAngle; // d type is RadialAreaDatum + console.log('Start angle of first point: ', data[0].startAngle); // data type is Array + return d.startAngle; // d type is AreaRadialDatum }); -radialAreaAngRAccessorFn = radialArea.angle(); +areaRadialAngRAccessorFn = areaRadial.angle(); // startAngle(...) ---------------------------------------------------------------------------- -defaultRadialArea = defaultRadialArea.startAngle(Math.PI); +defaultAreaRadial = defaultAreaRadial.startAngle(Math.PI); -radialArea = radialArea.startAngle((d, t, data) => { +areaRadial = areaRadial.startAngle((d, t, data) => { console.log('Number of Points: ', data.length); - console.log('Start angle of first point: ', data[0].startAngle); // data type is Array - return d.startAngle; // d type is RadialAreaDatum + console.log('Start angle of first point: ', data[0].startAngle); // data type is Array + return d.startAngle; // d type is AreaRadialDatum }); -radialAreaAngRAccessorFn = radialArea.startAngle(); +areaRadialAngRAccessorFn = areaRadial.startAngle(); // endAngle(...) ---------------------------------------------------------------------------- -defaultRadialArea = defaultRadialArea.endAngle(Math.PI); +defaultAreaRadial = defaultAreaRadial.endAngle(Math.PI); -radialArea = radialArea.endAngle((d, t, data) => { +areaRadial = areaRadial.endAngle((d, t, data) => { console.log('Number of Points: ', data.length); - console.log('End angle of first point: ', data[0].endAngle); // data type is Array - return d.endAngle; // d type is RadialAreaDatum + console.log('End angle of first point: ', data[0].endAngle); // data type is Array + return d.endAngle; // d type is AreaRadialDatum }); -radialAreaAngRAccessorFnMaybe = radialArea.endAngle(); +areaRadialAngRAccessorFnMaybe = areaRadial.endAngle(); // radius(...) ---------------------------------------------------------------------------- -defaultRadialArea = defaultRadialArea.radius(10); +defaultAreaRadial = defaultAreaRadial.radius(10); -radialArea = radialArea.radius((d, t, data) => { +areaRadial = areaRadial.radius((d, t, data) => { console.log('Number of Points: ', data.length); - console.log('Inner radius of first point: ', data[0].innerRadius); // data type is Array - return d.innerRadius; // d type is RadialAreaDatum + console.log('Inner radius of first point: ', data[0].innerRadius); // data type is Array + return d.innerRadius; // d type is AreaRadialDatum }); -radialAreaAngRAccessorFn = radialArea.radius(); +areaRadialAngRAccessorFn = areaRadial.radius(); // innerRadius(...) ---------------------------------------------------------------------------- -defaultRadialArea = defaultRadialArea.innerRadius(10); +defaultAreaRadial = defaultAreaRadial.innerRadius(10); -radialArea = radialArea.innerRadius((d, t, data) => { +areaRadial = areaRadial.innerRadius((d, t, data) => { console.log('Number of Points: ', data.length); - console.log('Inner radius of first point: ', data[0].innerRadius); // data type is Array - return d.innerRadius; // d type is RadialAreaDatum + console.log('Inner radius of first point: ', data[0].innerRadius); // data type is Array + return d.innerRadius; // d type is AreaRadialDatum }); -radialAreaAngRAccessorFn = radialArea.innerRadius(); +areaRadialAngRAccessorFn = areaRadial.innerRadius(); // outerRadius(...) ---------------------------------------------------------------------------- -defaultRadialArea = defaultRadialArea.outerRadius(20); +defaultAreaRadial = defaultAreaRadial.outerRadius(20); -radialArea = radialArea.outerRadius((d, t, data) => { +areaRadial = areaRadial.outerRadius((d, t, data) => { console.log('Number of Points: ', data.length); - console.log('Outer radius of first point: ', data[0].outerRadius); // data type is Array - return d.outerRadius; // d type is RadialAreaDatum + console.log('Outer radius of first point: ', data[0].outerRadius); // data type is Array + return d.outerRadius; // d type is AreaRadialDatum }); -radialAreaAngRAccessorFnMaybe = radialArea.outerRadius(); +areaRadialAngRAccessorFnMaybe = areaRadial.outerRadius(); // defined(...) ---------------------------------------------------------------------- -defaultRadialArea = defaultRadialArea.defined(true); +defaultAreaRadial = defaultAreaRadial.defined(true); -radialArea = radialArea.defined((d, t, data) => { +areaRadial = areaRadial.defined((d, t, data) => { console.log('Number of Points: ', data.length); - console.log('Inner radius of first point: ', data[0].innerRadius); // data type is Array - return !d.missing; // d type is RadialAreaDatum + console.log('Inner radius of first point: ', data[0].innerRadius); // data type is Array + return !d.missing; // d type is AreaRadialDatum }); -radialAreaDefAccessorFn = radialArea.defined(); +areaRadialDefAccessorFn = areaRadial.defined(); // curve(...) ------------------------------------------------------------------------ -defaultRadialArea = defaultRadialArea.curve(d3Shape.curveLinear); +defaultAreaRadial = defaultAreaRadial.curve(d3Shape.curveLinear); -radialArea = radialArea.curve(d3Shape.curveCardinal.tension(0.5)); -// radialArea = radialArea.curve(d3Shape.curveBundle.beta(0.5)); // fails, as curveBundle-based line generator does not support area-related methods +areaRadial = areaRadial.curve(d3Shape.curveCardinal.tension(0.5)); +// areaRadial = areaRadial.curve(d3Shape.curveBundle.beta(0.5)); // fails, as curveBundle-based line generator does not support area-related methods -currentCurveFactory = radialArea.curve(); +currentCurveFactory = areaRadial.curve(); -// use RadialArea generator =============================================================== +// use AreaRadial generator =============================================================== -defaultRadialArea([[10, 10], [20, 10], [20, 20]]); +defaultAreaRadial([[10, 10], [20, 10], [20, 20]]); -const radialAreaData: RadialAreaDatum[] = [ +const areaRadialData: AreaRadialDatum[] = [ { startAngle: 0, innerRadius: 10, endAngle: 0, outerRadius: 30, missing: false }, { startAngle: Math.PI / 2, innerRadius: 20, endAngle: Math.PI / 2, outerRadius: 40, missing: false }, { startAngle: Math.PI, innerRadius: 30, endAngle: Math.PI, outerRadius: 30, missing: false } ]; -const radialAreaPathStringMaybe: string | null = radialArea(radialAreaData); +const areaRadialPathStringMaybe: string | null = areaRadial(areaRadialData); -// Get RadialLine Generators from RadialArea generator ======================================================== +// Get LineRadial Generators from AreaRadial generator ======================================================== -let areaRadialLineGenerator: d3Shape.RadialLine; +let areaLineRadialGenerator: d3Shape.LineRadial; -areaRadialLineGenerator = radialArea.lineStartAngle(); -areaRadialLineGenerator = radialArea.lineInnerRadius(); -areaRadialLineGenerator = radialArea.lineEndAngle(); -areaRadialLineGenerator = radialArea.lineOuterRadius(); +areaLineRadialGenerator = areaRadial.lineStartAngle(); +areaLineRadialGenerator = areaRadial.lineInnerRadius(); +areaLineRadialGenerator = areaRadial.lineEndAngle(); +areaLineRadialGenerator = areaRadial.lineOuterRadius(); // ----------------------------------------------------------------------------------- // Test Curve Factories @@ -902,7 +918,7 @@ curveFactory = d3Shape.curveStepAfter; curveFactory = d3Shape.curveStepBefore; // ----------------------------------------------------------------------------------- -// Test Link/RadialLink Generators +// Test Link/LinkRadial Generators // ----------------------------------------------------------------------------------- // Preparatory steps ================================================================= @@ -946,17 +962,17 @@ let svgLink: d3Shape.Link, Hie svgLink = d3Shape.linkHorizontal, HierarchyPointNode>(); svgLink = d3Shape.linkVertical, HierarchyPointNode>(); -let defaultRadialLink: d3Shape.RadialLink; +let defaultLinkRadial: d3Shape.LinkRadial; -defaultRadialLink = d3Shape.linkRadial(); +defaultLinkRadial = d3Shape.linkRadial(); -let radialLink: d3Shape.RadialLink, HierarchyPointNode>; +let radialLink: d3Shape.LinkRadial, HierarchyPointNode>; radialLink = d3Shape.linkRadial, HierarchyPointNode>(); -let svgRadialLink: d3Shape.RadialLink, HierarchyPointNode>; +let svgLinkRadial: d3Shape.LinkRadial, HierarchyPointNode>; -svgRadialLink = d3Shape.linkRadial, HierarchyPointNode>(); +svgLinkRadial = d3Shape.linkRadial, HierarchyPointNode>(); // Configure link generators ======================================================== @@ -987,20 +1003,20 @@ svgTreeNodeAccessor = svgLink.source(); // radial -defaultRadialLink = defaultRadialLink.source(d => { +defaultLinkRadial = defaultLinkRadial.source(d => { const datum: d3Shape.DefaultLinkObject = d; return d.source; }); -defaultNodeAccessor = defaultRadialLink.source(); +defaultNodeAccessor = defaultLinkRadial.source(); -svgRadialLink = svgRadialLink.source(function(d) { +svgLinkRadial = svgLinkRadial.source(function(d) { const that: SVGPathElement = this; const datum: HierarchyPointLink = d; return d.source; }); -svgTreeNodeAccessor = svgRadialLink.source(); +svgTreeNodeAccessor = svgLinkRadial.source(); // target(...) ----------------------------------------------------------------------- @@ -1023,20 +1039,20 @@ svgTreeNodeAccessor = svgLink.target(); // radial -defaultRadialLink = defaultRadialLink.target(d => { +defaultLinkRadial = defaultLinkRadial.target(d => { const datum: d3Shape.DefaultLinkObject = d; return d.target; }); -defaultNodeAccessor = defaultRadialLink.target(); +defaultNodeAccessor = defaultLinkRadial.target(); -svgRadialLink = svgRadialLink.target(function(d) { +svgLinkRadial = svgLinkRadial.target(function(d) { const that: SVGPathElement = this; const datum: HierarchyPointLink = d; return d.target; }); -svgTreeNodeAccessor = svgRadialLink.target(); +svgTreeNodeAccessor = svgLinkRadial.target(); // x(...) ---------------------------------------------------------------------------- @@ -1074,37 +1090,37 @@ svgCoordinateAccessor = svgLink.y(); // angle(...) ------------------------------------------------------------------------ -defaultRadialLink = defaultRadialLink.angle(d => { +defaultLinkRadial = defaultLinkRadial.angle(d => { const datum: [number, number] = d; return datum[0]; }); -defaultCoordinateAccessor = defaultRadialLink.angle(); +defaultCoordinateAccessor = defaultLinkRadial.angle(); -svgRadialLink = svgRadialLink.angle(function(d) { +svgLinkRadial = svgLinkRadial.angle(function(d) { const that: SVGPathElement = this; const datum: HierarchyPointNode = d; return datum.x; }); -svgCoordinateAccessor = svgRadialLink.angle(); +svgCoordinateAccessor = svgLinkRadial.angle(); // radius(...) ------------------------------------------------------------------------ -defaultRadialLink = defaultRadialLink.radius(d => { +defaultLinkRadial = defaultLinkRadial.radius(d => { const datum: [number, number] = d; return datum[1]; }); -defaultCoordinateAccessor = defaultRadialLink.radius(); +defaultCoordinateAccessor = defaultLinkRadial.radius(); -svgRadialLink = svgRadialLink.radius(function(d) { +svgLinkRadial = svgLinkRadial.radius(function(d) { const that: SVGPathElement = this; const datum: HierarchyPointNode = d; return datum.y; }); -svgCoordinateAccessor = svgRadialLink.radius(); +svgCoordinateAccessor = svgLinkRadial.radius(); // context(...) ---------------------------------------------------------------------- @@ -1121,7 +1137,7 @@ area = area.context(null); // use as path string generator for SVG defaultLink(defaultLinkDatum); -defaultRadialLink(defaultLinkDatum); +defaultLinkRadial(defaultLinkDatum); // Render to svg --------------------------------------------------------------------- @@ -1137,13 +1153,13 @@ pathStringMaybe = link(linkDatum); // radial -pLink.attr('d', svgRadialLink); -// wrongLink1.attr('d', svgRadialLink); // fails, incompatible this contexts -// wrongLink2.attr('d', svgRadialLink); // fails, incompatible datum types +pLink.attr('d', svgLinkRadial); +// wrongLink1.attr('d', svgLinkRadial); // fails, incompatible this contexts +// wrongLink2.attr('d', svgLinkRadial); // fails, incompatible datum types pathStringMaybe = radialLink(linkDatum); -// pathStringMaybe = svgRadialLink(linkDatum); // fails, wrong this type for invocation +// pathStringMaybe = svgLinkRadial(linkDatum); // fails, wrong this type for invocation // ----------------------------------------------------------------------------------- // Test Symbols @@ -1302,6 +1318,12 @@ customSymbol = d3Shape.symbolStar; customSymbol = d3Shape.symbolTriangle; customSymbol = d3Shape.symbolWye; +// ----------------------------------------------------------------------------------- +// Test pointRadius +// ----------------------------------------------------------------------------------- + +let coordinatates: [number, number] = d3Shape.pointRadius(0, 12); + // ----------------------------------------------------------------------------------- // Test Stacks // ----------------------------------------------------------------------------------- diff --git a/types/d3-shape/index.d.ts b/types/d3-shape/index.d.ts index 00d37fa4ae..010c2108e9 100644 --- a/types/d3-shape/index.d.ts +++ b/types/d3-shape/index.d.ts @@ -1,9 +1,9 @@ -// Type definitions for D3JS d3-shape module 1.1 +// Type definitions for D3JS d3-shape module 1.2 // Project: https://github.com/d3/d3-shape/ // Definitions by: Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// Last module patch version validated against: 1.1.0 +// Last module patch version validated against: 1.2.0 import { Path } from 'd3-path'; @@ -799,7 +799,7 @@ export function line(): Line; * * The generic refers to the data type of an element in the input array passed into the line generator. */ -export interface RadialLine { +export interface LineRadial { /** * Generates a radial line for the given array of data. Depending on this radial line generator’s associated curve, * the given input data may need to be sorted by x-value before being passed to the line generator. @@ -957,7 +957,7 @@ export interface RadialLine { * Ensure that the accessors used with the radial line generator correspond to the arguments passed into them, * or set them to constants as appropriate. */ -export function radialLine(): RadialLine<[number, number]>; +export function lineRadial(): LineRadial<[number, number]>; /** * Constructs a new radial line generator with the default settings. * @@ -966,6 +966,17 @@ export function radialLine(): RadialLine<[number, number]>; * * The generic refers to the data type of an element in the input array passed into the radial line generator. */ +export function lineRadial(): LineRadial; + +export type RadialLine = LineRadial; + +/** + * DEPRECATED: Use lineRadial() + */ +export function radialLine(): RadialLine<[number, number]>; +/** + * DEPRECATED: Use lineRadial() + */ export function radialLine(): RadialLine; // ----------------------------------------------------------------------------------- @@ -1283,7 +1294,7 @@ export function area(): Area; * * The generic refers to the data type of an element in the input array passed into the area generator. */ -export interface RadialArea { +export interface AreaRadial { /** * Generates a radial area for the given array of data. * @@ -1544,25 +1555,25 @@ export interface RadialArea { * Returns a new radial line generator that has this radial area generator’s current defined accessor, curve and context. * The line’s angle accessor is this area’s start angle accessor, and the line’s radius accessor is this area’s inner radius accessor. */ - lineStartAngle(): RadialLine; + lineStartAngle(): LineRadial; /** * Returns a new radial line generator that has this radial area generator’s current defined accessor, curve and context. * The line’s angle accessor is this area’s start angle accessor, and the line’s radius accessor is this area’s inner radius accessor. */ - lineInnerRadius(): RadialLine; + lineInnerRadius(): LineRadial; /** * Returns a new radial line generator that has this radial area generator’s current defined accessor, curve and context. * The line’s angle accessor is this area’s end angle accessor, and the line’s radius accessor is this area’s inner radius accessor. */ - lineEndAngle(): RadialLine; + lineEndAngle(): LineRadial; /** * Returns a new radial line generator that has this radial area generator’s current defined accessor, curve and context. * The line’s angle accessor is this area’s start angle accessor, and the line’s radius accessor is this area’s outer radius accessor. */ - lineOuterRadius(): RadialLine; + lineOuterRadius(): LineRadial; } /** @@ -1571,7 +1582,7 @@ export interface RadialArea { * Ensure that the accessors used with the area generator correspond to the arguments passed into them, * or set them to constants as appropriate. */ -export function radialArea(): RadialArea<[number, number]>; +export function areaRadial(): AreaRadial<[number, number]>; /** * Constructs a new radial area generator with the default settings. * @@ -1580,6 +1591,20 @@ export function radialArea(): RadialArea<[number, number]>; * * The generic refers to the data type of an element in the input array passed into the radial area generator. */ +export function areaRadial(): AreaRadial; + +/** + * DEPRECATED: Use AreaRadial interface + */ +export type RadialArea = AreaRadial; + +/** + * DEPRECATED: Use areaRadial() + */ +export function radialArea(): RadialArea<[number, number]>; +/** + * DEPRECATED: Use areaRadial() + */ export function radialArea(): RadialArea; // ----------------------------------------------------------------------------------- @@ -1870,7 +1895,7 @@ export const curveStepBefore: CurveFactory; /** * An interface describing the default Link Data structure expected - * by the Link and RadialLink generators + * by the Link and LinkRadial generators */ export interface DefaultLinkObject { /** @@ -2085,7 +2110,7 @@ export function linkVertical(): Link { +export interface LinkRadial { /** * Generates a radial link for the given arguments. * @@ -2187,13 +2212,18 @@ export interface RadialLink { context(context: null): this; } +/** + * DEPRECATED: Use LinkRadial interface + */ +export type RadialLink = LinkRadial; + /** * Constructs a new default link generator with radial tangents, for example, to visualize links in a tree diagram * rooted in the center of the display. * * With the default settings the link generator accepts a link object conforming to the DefaultLinkObject interface. */ -export function linkRadial(): RadialLink; +export function linkRadial(): LinkRadial; /** * Constructs a new link generator with radial tangents, for example, to visualize links in a tree diagram * rooted in the center of the display. @@ -2205,7 +2235,7 @@ export function linkRadial(): RadialLink(): RadialLink; +export function linkRadial(): LinkRadial; /** * Constructs a new link generator with radial tangents, for example, to visualize links in a tree diagram * rooted in the center of the display. @@ -2219,7 +2249,7 @@ export function linkRadial(): RadialLink(): RadialLink; +export function linkRadial(): LinkRadial; // ----------------------------------------------------------------------------------- // SYMBOLS @@ -2405,6 +2435,17 @@ export const symbolTriangle: SymbolType; */ export const symbolWye: SymbolType; +// ----------------------------------------------------------------------------------- +// pointRadius +// ----------------------------------------------------------------------------------- + +/** + * Returns the point [x, y] for the given angle and the given radius. + * @param angle Angle in radians, with 0 at -y (12 o’clock) and positive angles proceeding clockwise. + * @param radius Radius. + */ +export function pointRadius(angle: number, radius: number): [number, number]; + // ----------------------------------------------------------------------------------- // STACKS // ----------------------------------------------------------------------------------- From 8ae97451d57d987c16031938a1987b03567be701 Mon Sep 17 00:00:00 2001 From: Tom Wanzek Date: Fri, 19 May 2017 10:13:46 -0400 Subject: [PATCH 0255/1072] D3 Modules Linting (#16536) * [d3-collection] Linted * Added and completed linting * Replaced `Object` with `any` adding TODO to change to proper `object` type when publishing the definitions to use TS 2.2+ * [d3-color] Linted * [d3-dispatch] Linted * [d3-hsv] Linted * [d3-interpolate] Linted. `Object` to `any` * Replace use of `Object` as extension basis with `any` for now. Added TODO to change it to use the `object` type, when updating the definitions to formally use TS2.2+ * [d3-path] Linted. * [d3-polygon] Linted. * [d3-quadtree] Linted. * [d3-queue] Linted. * [d3-request] Linted. * [d3-scale-chromatic] Linted. * [d3-time-format] Linted. * [d3-time] Linted. * [d3-timer] Linted. * [d3-voronoi] Linted. * [d3-scale] Move callable-type lint deactivation to tslint.json * line level deactivation was ignored. --- types/d3-collection/d3-collection-tests.ts | 52 ++--- types/d3-collection/index.d.ts | 48 +++-- types/d3-collection/tslint.json | 6 + types/d3-color/d3-color-tests.ts | 12 +- types/d3-color/index.d.ts | 16 +- types/d3-color/tslint.json | 6 + types/d3-dispatch/d3-dispatch-tests.ts | 11 +- types/d3-dispatch/index.d.ts | 4 +- types/d3-dispatch/tslint.json | 6 + types/d3-hsv/d3-hsv-tests.ts | 8 +- types/d3-hsv/index.d.ts | 8 +- types/d3-hsv/tslint.json | 6 + types/d3-interpolate/d3-interpolate-tests.ts | 55 +++-- types/d3-interpolate/index.d.ts | 30 ++- types/d3-interpolate/tslint.json | 7 + types/d3-path/d3-path-tests.ts | 3 - types/d3-path/tslint.json | 7 + types/d3-polygon/index.d.ts | 4 +- types/d3-polygon/tslint.json | 7 + types/d3-quadtree/d3-quadtree-tests.ts | 31 +-- types/d3-quadtree/index.d.ts | 15 +- types/d3-quadtree/tslint.json | 7 + types/d3-queue/d3-queue-tests.ts | 16 +- types/d3-queue/index.d.ts | 10 +- types/d3-queue/tslint.json | 6 + types/d3-request/d3-request-tests.ts | 72 +++---- types/d3-request/index.d.ts | 18 +- types/d3-request/tslint.json | 7 + types/d3-scale-chromatic/index.d.ts | 214 +++++++++++++++---- types/d3-scale-chromatic/tslint.json | 6 + types/d3-scale/index.d.ts | 2 - types/d3-scale/tslint.json | 3 +- types/d3-time-format/index.d.ts | 7 +- types/d3-time-format/tslint.json | 6 + types/d3-time/d3-time-tests.ts | 22 +- types/d3-time/index.d.ts | 124 ++++++----- types/d3-time/tslint.json | 6 + types/d3-timer/index.d.ts | 5 +- types/d3-timer/tslint.json | 6 + types/d3-voronoi/d3-voronoi-tests.ts | 18 +- types/d3-voronoi/index.d.ts | 19 +- types/d3-voronoi/tslint.json | 6 + 42 files changed, 560 insertions(+), 362 deletions(-) create mode 100644 types/d3-collection/tslint.json create mode 100644 types/d3-color/tslint.json create mode 100644 types/d3-dispatch/tslint.json create mode 100644 types/d3-hsv/tslint.json create mode 100644 types/d3-interpolate/tslint.json create mode 100644 types/d3-path/tslint.json create mode 100644 types/d3-polygon/tslint.json create mode 100644 types/d3-quadtree/tslint.json create mode 100644 types/d3-queue/tslint.json create mode 100644 types/d3-request/tslint.json create mode 100644 types/d3-scale-chromatic/tslint.json create mode 100644 types/d3-time-format/tslint.json create mode 100644 types/d3-time/tslint.json create mode 100644 types/d3-timer/tslint.json create mode 100644 types/d3-voronoi/tslint.json diff --git a/types/d3-collection/d3-collection-tests.ts b/types/d3-collection/d3-collection-tests.ts index e862f9e601..af9bf8d075 100644 --- a/types/d3-collection/d3-collection-tests.ts +++ b/types/d3-collection/d3-collection-tests.ts @@ -23,11 +23,10 @@ let keyValueObj2 = { c: 'type' }; -let stringArray: string[], - anyArray: any[], - stringKVArray: Array<{ key: string, value: string }>, - anyKVArray: Array<{ key: string, value: any }>; - +let stringArray: string[]; +let anyArray: any[]; +let stringKVArray: Array<{ key: string, value: string }>; +let anyKVArray: Array<{ key: string, value: any }>; let num: number; let str: string; @@ -37,7 +36,6 @@ let booleanFlag: boolean; // Test Objects // --------------------------------------------------------------------- - // test keys(...) signatures ------------------------------------------------------ stringArray = d3Collection.keys(keyValueObj); @@ -74,7 +72,7 @@ interface TestObject { } let testObject: TestObject; -let testObjArray: Array; +let testObjArray: TestObject[]; let testObjKVArray: Array<{ key: string, value: TestObject }>; // Create Map ======================================================== @@ -87,7 +85,7 @@ basicMap = d3Collection.map(['foo', 'bar']); // map with key-value pairs { '0': // from array with accessor let testObjMap: d3Collection.Map; -testObjMap = d3Collection.map([{ name: 'foo', val: 10 }, { name: 'bar', val: 42 }], function (value, i, array) { +testObjMap = d3Collection.map([{ name: 'foo', val: 10 }, { name: 'bar', val: 42 }], (value, i, array) => { return value.name; }); @@ -102,7 +100,6 @@ objectMap = d3Collection.map(keyValueObj); let objectMap2: d3Collection.Map; objectMap2 = d3Collection.map(keyValueObj2); - // Use Map =========================================================== // has(...) ------------------------------------------------------------ @@ -133,14 +130,13 @@ stringArray = testObjMap.keys(); testObjArray = testObjMap.values(); - // entries() ----------------------------------------------------------- testObjKVArray = testObjMap.entries(); // each() -------------------------------------------------------------- -testObjMap.each(function (value, key, map) { +testObjMap.each((value, key, map) => { let v: TestObject = value; let k: string = key; let m: d3Collection.Map = map; @@ -172,10 +168,10 @@ basicSet = d3Collection.set(); // empty set basicSet = d3Collection.set(['foo', 'bar', 42]); // last element is coerced // from array without accessor -basicSet = d3Collection.set(testObjArray, function (value, index, array) { +basicSet = d3Collection.set(testObjArray, (value, index, array) => { let v: TestObject = value; let i: number = index; - let a: Array = array; + let a: TestObject[] = array; return v.name; }); @@ -211,7 +207,7 @@ stringArray = basicSet.values(); // each() -------------------------------------------------------------- -basicSet.each(function (value, valueRepeat, set) { +basicSet.each((value, valueRepeat, set) => { let v: string = value; let vr: string = valueRepeat; let s: d3Collection.Set = set; @@ -226,7 +222,6 @@ booleanFlag = basicSet.empty(); num = basicSet.size(); - // --------------------------------------------------------------------- // nest / Nest // --------------------------------------------------------------------- @@ -238,7 +233,7 @@ interface Yield { site: string; } -let raw: Array = [ +let raw: Yield[] = [ { yield: 27.00, variety: 'Manchuria', year: 1931, site: 'University Farm' }, { yield: 48.87, variety: 'Manchuria', year: 1931, site: 'Waseca' }, { yield: 27.43, variety: 'Manchuria', year: 1931, site: 'Morris' }, @@ -259,52 +254,49 @@ nestL2 = d3Collection.nest(); let nestL1Rollup: d3Collection.Nest; nestL1Rollup = d3Collection.nest(); - // Configure Nest ===================================================== // key(...) and sortKeys(...) ----------------------------------------- nestL2 = nestL2 - .key(function (d) { + .key(d => { return d.year.toString(); }); // with 2nd key with sortkey(...) nestL2 = nestL2 - .key(function (d) { + .key(d => { return d.variety; }) .sortKeys(ascending); nestL1Rollup = nestL1Rollup - .key(function (d) { + .key(d => { return d.year.toString(); }); // sortValues(...) ---------------------------------------------------- nestL2 = nestL2 - .sortValues(function (a, b) { + .sortValues((a, b) => { let val1: Yield = a; // data type Yield let val2: Yield = b; // data type Yield return a.yield - b.yield; }); - // rollup(...) -------------------------------------------------------- nestL1Rollup = nestL1Rollup - .rollup(function (values) { - let vs: Array = values; // correct data array type + .rollup(values => { + let vs: Yield[] = values; // correct data array type return vs.length; }); // Use Nest =========================================================== - // map(...) ----------------------------------------------------------- -type TestL2NestedMap = d3Collection.Map>>; +type TestL2NestedMap = d3Collection.Map>; type TestL1NestedMapRollup = d3Collection.Map; @@ -323,7 +315,7 @@ num = testL1NestedMapRollup.get('1931'); // get rollup value interface TestL2NestedObject { [keyL1: string]: { - [keyL2: string]: Array; + [keyL2: string]: Yield[]; }; } @@ -348,14 +340,14 @@ type TestL2NestedArray = Array<{ key: string; values: Array<{ key: string; - values: Array; + values: Yield[]; }> -}> +}>; type TestL1NestedArrayRollup = Array<{ key: string; value: number; -}> +}>; let testL2NestedArray: TestL2NestedArray; let testL1NestedArrayRollup: TestL1NestedArrayRollup; diff --git a/types/d3-collection/index.d.ts b/types/d3-collection/index.d.ts index 396d871767..e389862394 100644 --- a/types/d3-collection/index.d.ts +++ b/types/d3-collection/index.d.ts @@ -1,41 +1,45 @@ -// Type definitions for D3JS d3-collection module v1.0.1 +// Type definitions for D3JS d3-collection module 1.0 // Project: https://github.com/d3/d3-collection/ // Definitions by: Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// Last module patch version validated against: 1.0.1 + /** * Reference type things that can be coerced to string implicitely */ -type Stringifiable = { +export interface Stringifiable { toString(): string; -}; +} // --------------------------------------------------------------------- // Objects // --------------------------------------------------------------------- -export function keys(object: { [key: string]: any }): Array; -export function keys(object: Object): Array; +export function keys(object: { [key: string]: any }): string[]; +// TODO: When upgrading definitions to use TS 2.2+, use "object" data type in next line +export function keys(object: any): string[]; -export function values(object: { [key: string]: T }): Array; -export function values(object: Object): Array; +export function values(object: { [key: string]: T }): T[]; +// TODO: When upgrading definitions to use TS 2.2+, use "object" data type in next line +export function values(object: any): any[]; export function entries(object: { [key: string]: T }): Array<{ key: string, value: T }>; -export function entries(object: Object): Array<{ key: string, value: any }>; +// TODO: When upgrading definitions to use TS 2.2+, use "object" data type in next line +export function entries(object: any): Array<{ key: string, value: any }>; // --------------------------------------------------------------------- // map / Map // --------------------------------------------------------------------- - export interface Map { has(key: string): boolean; get(key: string): T | undefined; set(key: string, value: T): this; remove(key: string): boolean; clear(): void; - keys(): Array; - values(): Array; + keys(): string[]; + values(): T[]; entries(): Array<{ key: string, value: T }>; each(func: (value: T, key: string, map: Map) => void): void; empty(): boolean; @@ -46,20 +50,19 @@ export function map(): Map; export function map(d3Map: Map): Map; export function map(object: { [key: string]: T }): Map; export function map(object: { [key: number]: T }): Map; -export function map(array: Array, key?: (value: T, i?: number, array?: Array) => string): Map; -export function map(object: Object): Map; +export function map(array: T[], key?: (value: T, i?: number, array?: T[]) => string): Map; +export function map(object: any): Map; // TODO: When upgrading definitions to use TS 2.2+, use "object" data type for argument // --------------------------------------------------------------------- // set / Set // --------------------------------------------------------------------- - export interface Set { has(value: string | Stringifiable): boolean; add(value: string | Stringifiable): this; remove(value: string | Stringifiable): boolean; clear(): void; - values(): Array; + values(): string[]; /** * The first and second parameter of the function are both passed * the 'value' of the set entry for consistency with map.each(...) @@ -70,11 +73,10 @@ export interface Set { size(): number; } - export function set(): Set; export function set(d3Set: Set): Set; export function set(array: Array): Set; -export function set(array: Array, key: (value: T, index?: number, array?: Array) => string): Set; +export function set(array: T[], key: (value: T, index?: number, array?: T[]) => string): Set; // --------------------------------------------------------------------- // nest / Nest @@ -93,17 +95,19 @@ export function set(array: Array, key: (value: T, index?: number, array?: // Also note, that the below return types for Nest.entries(...), Nest.map(...) and Nest.object(...) strictly only work, // if AT LEAST ONE KEY was set. This seems a reasonable constraint in practice, given the intent of the nest operator. -// Otherwise, an additional '| Array | RollupType` would have to be added to the union type. This would cover +// Otherwise, an additional '| Datum[] | RollupType` would have to be added to the union type. This would cover // cases (a) without key or rollup (b) without key but with rollup. However, again, the union types make it cumbersome // without much gain. -export interface NestedArray extends Array<{ key: string, values: NestedArray | Array | undefined, value: RollupType | undefined }> { } -export interface NestedMap extends Map | Array | RollupType> { } +// tslint:disable-next-line:no-empty-interface +export interface NestedArray extends Array<{ key: string, values: NestedArray | Datum[] | undefined, value: RollupType | undefined }> { } +// tslint:disable-next-line:no-empty-interface +export interface NestedMap extends Map | Datum[] | RollupType> { } export interface NestedObject { - [key: string]: NestedObject | Array | RollupType; + [key: string]: NestedObject | Datum[] | RollupType; } -interface Nest { +export interface Nest { key(func: (datum: Datum) => string): this; sortKeys(comparator: (a: string, b: string) => number): this; sortValues(comparator: (a: Datum, b: Datum) => number): this; diff --git a/types/d3-collection/tslint.json b/types/d3-collection/tslint.json new file mode 100644 index 0000000000..08b1465cd6 --- /dev/null +++ b/types/d3-collection/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "unified-signatures": false + } +} diff --git a/types/d3-color/d3-color-tests.ts b/types/d3-color/d3-color-tests.ts index 29b9303a2b..c001080d36 100644 --- a/types/d3-color/d3-color-tests.ts +++ b/types/d3-color/d3-color-tests.ts @@ -20,11 +20,11 @@ function isHSL(color: d3Color.RGBColor | d3Color.HSLColor): color is d3Color.HSL // Signature tests for 'color', rgb and hsl -let c: d3Color.RGBColor | d3Color.HSLColor, - cRGB: d3Color.RGBColor, - cHSL: d3Color.HSLColor, - displayable: boolean, - cString: string; +let c: d3Color.RGBColor | d3Color.HSLColor; +let cRGB: d3Color.RGBColor; +let cHSL: d3Color.HSLColor; +let displayable: boolean; +let cString: string; // string signature c = d3Color.color('steelblue'); @@ -40,7 +40,6 @@ c = d3Color.color(cRGB); cRGB = d3Color.color('hsl(60, 100%, 20%, 0.5)').rgb(); - cRGB = d3Color.rgb(20, 100, 200); cRGB = d3Color.rgb(20, 100, 200, 0.5); cRGB = d3Color.rgb('steelblue'); @@ -90,7 +89,6 @@ cString = cLab.toString(); console.log('Channels = (l : %d, a: %d, b: %d)', cLab.l, cLab.a, cLab.b); console.log('Opacity = %d', cLab.opacity); - // Signature tests for HCL let cHcl: d3Color.HCLColor; diff --git a/types/d3-color/index.d.ts b/types/d3-color/index.d.ts index ed9c706667..96b24fd09e 100644 --- a/types/d3-color/index.d.ts +++ b/types/d3-color/index.d.ts @@ -1,8 +1,10 @@ -// Type definitions for D3JS d3-color module v1.0.1 +// Type definitions for D3JS d3-color module 1.0 // Project: https://github.com/d3/d3-color/ // Definitions by: Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// Last module patch version validated against: 1.0.1 + // --------------------------------------------------------------------------- // Shared Type Definitions and Interfaces // --------------------------------------------------------------------------- @@ -127,14 +129,14 @@ export interface CubehelixColorFactory extends Function { // Color object factories // -------------------------------------------------------------------------- -export var color: ColorFactory; +export const color: ColorFactory; -export var rgb: RGBColorFactory; +export const rgb: RGBColorFactory; -export var hsl: HSLColorFactory; +export const hsl: HSLColorFactory; -export var lab: LabColorFactory; +export const lab: LabColorFactory; -export var hcl: HCLColorFactory; +export const hcl: HCLColorFactory; -export var cubehelix: CubehelixColorFactory; +export const cubehelix: CubehelixColorFactory; diff --git a/types/d3-color/tslint.json b/types/d3-color/tslint.json new file mode 100644 index 0000000000..08b1465cd6 --- /dev/null +++ b/types/d3-color/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "unified-signatures": false + } +} diff --git a/types/d3-dispatch/d3-dispatch-tests.ts b/types/d3-dispatch/d3-dispatch-tests.ts index 6f358587f3..436bc3d6d4 100644 --- a/types/d3-dispatch/d3-dispatch-tests.ts +++ b/types/d3-dispatch/d3-dispatch-tests.ts @@ -15,25 +15,24 @@ interface Datum { b: string; } -let dispatch: d3Dispatch.Dispatch, - copy: d3Dispatch.Dispatch, - copy2: d3Dispatch.Dispatch; +let dispatch: d3Dispatch.Dispatch; +let copy: d3Dispatch.Dispatch; +let copy2: d3Dispatch.Dispatch; // Signature Tests ---------------------------------------- // create new dispatch object dispatch = d3Dispatch.dispatch('foo', 'bar'); - function cbFn(this: HTMLElement, d: Datum, i: number) { console.log(this.baseURI ? this.baseURI : 'nada'); console.log(d ? d.a : 'nada'); -}; +} function cbFn2(this: SVGElement, d: Datum, i: number) { console.log(this.baseURI ? this.baseURI : 'nada'); console.log(d ? d.a : 'nada'); -}; +} dispatch.on('foo', cbFn); // dispatch.on('foo', cbFn2); // test fails as 'this' context type is mismatched between dispatch and callback function diff --git a/types/d3-dispatch/index.d.ts b/types/d3-dispatch/index.d.ts index 71d77da9f7..1e6e82e06f 100644 --- a/types/d3-dispatch/index.d.ts +++ b/types/d3-dispatch/index.d.ts @@ -1,8 +1,10 @@ -// Type definitions for D3JS d3-dispatch module v1.0.1 +// Type definitions for D3JS d3-dispatch module 1.0 // Project: https://github.com/d3/d3-dispatch/ // Definitions by: Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// Last module patch version validated against: 1.0.1 + export interface Dispatch { apply(type: string, that?: T, args?: any[]): void; call(type: string, that?: T, ...args: any[]): void; diff --git a/types/d3-dispatch/tslint.json b/types/d3-dispatch/tslint.json new file mode 100644 index 0000000000..08b1465cd6 --- /dev/null +++ b/types/d3-dispatch/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "unified-signatures": false + } +} diff --git a/types/d3-hsv/d3-hsv-tests.ts b/types/d3-hsv/d3-hsv-tests.ts index fff2e55935..72e18145e6 100644 --- a/types/d3-hsv/d3-hsv-tests.ts +++ b/types/d3-hsv/d3-hsv-tests.ts @@ -9,10 +9,10 @@ import {hsv, HSVColor} from 'd3-hsv'; import {rgb, RGBColor} from 'd3-color'; -let c: RGBColor, - cHSV: HSVColor, - displayable: boolean, - cString: string; +let c: RGBColor; +let cHSV: HSVColor; +let displayable: boolean; +let cString: string; // hsv signature cHSV = hsv(120, 0.4, 0.5); diff --git a/types/d3-hsv/index.d.ts b/types/d3-hsv/index.d.ts index a7501b60c7..c10fa6ee44 100644 --- a/types/d3-hsv/index.d.ts +++ b/types/d3-hsv/index.d.ts @@ -1,11 +1,13 @@ -// Type definitions for D3JS d3-hsv module v0.0.3 +// Type definitions for D3JS d3-hsv module 0.0 // Project: https://github.com/d3/d3-hsv/ // Definitions by: Yuri Feldman // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// Last module patch version validated against: 0.0.3 + import {Color, RGBColor, ColorSpaceObject, ColorCommonInstance} from 'd3-color'; -type ColorSpaceObjectWithHSV = ColorSpaceObject | HSVColor; +export type ColorSpaceObjectWithHSV = ColorSpaceObject | HSVColor; export interface HSVColorFactory extends Function { (h: number, s: number, v: number, opacity?: number): HSVColor; @@ -23,4 +25,4 @@ export interface HSVColor extends Color { rgb(): RGBColor; } -export var hsv: HSVColorFactory; +export const hsv: HSVColorFactory; diff --git a/types/d3-hsv/tslint.json b/types/d3-hsv/tslint.json new file mode 100644 index 0000000000..08b1465cd6 --- /dev/null +++ b/types/d3-hsv/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "unified-signatures": false + } +} diff --git a/types/d3-interpolate/d3-interpolate-tests.ts b/types/d3-interpolate/d3-interpolate-tests.ts index 2ada5864cd..5cbb6fe3a0 100644 --- a/types/d3-interpolate/d3-interpolate-tests.ts +++ b/types/d3-interpolate/d3-interpolate-tests.ts @@ -17,54 +17,52 @@ interface Interpolator { } class NumCoercible { - public a: number; + a: number; constructor(a: number) { this.a = a; } - public valueOf() { + valueOf() { return this.a; } } class StringCoercible { - public a: string; + a: string; constructor(a: string) { this.a = a; } - public toString() { + toString() { return this.a; } } +let iNum: Interpolator; +let iString: Interpolator; +let iDate: Interpolator; +let iArrayNum: Interpolator; +let iArrayStr: Interpolator; +let iArrayDate: Interpolator; +let iArrayMixed: Interpolator<[Date, string]>; +let iKeyVal: Interpolator<{ [key: string]: any }>; +let iRGBColorObj: Interpolator; +let iZoom: d3Interpolate.ZoomInterpolator; -let iNum: Interpolator, - iString: Interpolator, - iDate: Interpolator, - iArrayNum: Interpolator>, - iArrayStr: Interpolator>, - iArrayDate: Interpolator>, - iArrayMixed: Interpolator<[Date, string]>, - iKeyVal: Interpolator<{ [key: string]: any }>, - iRGBColorObj: Interpolator, - iZoom: d3Interpolate.ZoomInterpolator; - -let num: number, - str: string, - arrNum: number[], - arrStr: string[], - objKeyVal: { [key: string]: any }, - objRGBColor: d3Color.RGBColor, - objHSVColor: d3Hsv.HSVColor, - zoom: [number, number, number]; +let num: number; +let str: string; +let arrNum: number[]; +let arrStr: string[]; +let objKeyVal: { [key: string]: any }; +let objRGBColor: d3Color.RGBColor; +let objHSVColor: d3Hsv.HSVColor; +let zoom: [number, number, number]; // test interpolate(a, b) signature ---------------------------------------------------- iNum = d3Interpolate.interpolate('1', 5); - // color interpolator returning a color string iString = d3Interpolate.interpolate('seagreen', d3Color.rgb(100, 100, 100)); iString = d3Interpolate.interpolate('seagreen', d3Hsv.hsv(60, 1, 0.2, 0.4)); @@ -118,13 +116,13 @@ iDate = d3Interpolate.interpolateDate(new Date(2016, 6, 1), new Date(2016, 6, 31 // test interpolateArray(a, b) signature ---------------------------------------------------- -iArrayNum = d3Interpolate.interpolateArray>([1, 2], [4, 8]); // explicit typing +iArrayNum = d3Interpolate.interpolateArray([1, 2], [4, 8]); // explicit typing arrNum = iArrayNum(0.5); iArrayNum = d3Interpolate.interpolateArray<[number, number]>(['1', '2'], [4, 8]); // explicit typing arrNum = iArrayNum(0.5); -iArrayStr = d3Interpolate.interpolateArray>(['1', '2'], ['4', '8']); // explicit typing +iArrayStr = d3Interpolate.interpolateArray(['1', '2'], ['4', '8']); // explicit typing arrStr = iArrayStr(0.5); iArrayStr = d3Interpolate.interpolateArray([1, 2], ['4', '8']); // infered typing @@ -151,7 +149,6 @@ str = iString(0.5); iString = d3Interpolate.interpolateTransformSvg('rotate(0)', 'rotate(60)'); str = iString(0.5); - // test interpolateZoom(a, b) signature ---------------------------------------------------- iZoom = d3Interpolate.interpolateZoom([50, 50, 300], [100, 100, 500]); @@ -229,9 +226,7 @@ str = iString(0.5); // with gamma correction iString = d3Interpolate.interpolateCubehelixLong.gamma(2.2)('purple', 'orange'); - - -// test interpolateBasis(splineNodes) and interpolateBasisClosed(splineNodes: Array) ---------------------------- +// test interpolateBasis(splineNodes) and interpolateBasisClosed(splineNodes: number[]) ---------------------------- iNum = d3Interpolate.interpolateBasis([1, 50, 30, 10]); diff --git a/types/d3-interpolate/index.d.ts b/types/d3-interpolate/index.d.ts index a4d145d2b8..e3fcfa21d8 100644 --- a/types/d3-interpolate/index.d.ts +++ b/types/d3-interpolate/index.d.ts @@ -1,16 +1,16 @@ -// Type definitions for D3JS d3-interpolate module v1.1.1 +// Type definitions for D3JS d3-interpolate module 1.1 // Project: https://github.com/d3/d3-interpolate/ // Definitions by: Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -import { ColorCommonInstance } from 'd3-color'; +// Last module patch version validated against: 1.1.1 +import { ColorCommonInstance } from 'd3-color'; // -------------------------------------------------------------------------- // Shared Type Definitions and Interfaces // -------------------------------------------------------------------------- - export interface ZoomInterpolator extends Function { (t: number): ZoomView; /** @@ -42,12 +42,11 @@ export function interpolate(a: number | { valueOf(): number }, b: number): ((t: export function interpolate(a: any, b: ColorCommonInstance): ((t: number) => string); export function interpolate(a: Date, b: Date): ((t: number) => Date); export function interpolate(a: string | { toString(): string }, b: string): ((t: number) => string); -export function interpolate>(a: Array, b: U): ((t: number) => U); +export function interpolate(a: any[], b: U): ((t: number) => U); export function interpolate(a: number | { valueOf(): number }, b: { valueOf(): number }): ((t: number) => number); -export function interpolate(a: any, b: U): ((t: number) => U); +export function interpolate(a: any, b: U): ((t: number) => U); // TODO: extends 'any' should become 'object' with TS 2.2+ definitions export function interpolate(a: any, b: { [key: string]: any }): ((t: number) => { [key: string]: any }); - export function interpolateNumber(a: number | { valueOf(): number }, b: number | { valueOf(): number }): ((t: number) => number); export function interpolateRound(a: number | { valueOf(): number }, b: number | { valueOf(): number }): ((t: number) => number); @@ -56,13 +55,11 @@ export function interpolateString(a: string | { toString(): string }, b: string export function interpolateDate(a: Date, b: Date): ((t: number) => Date); -export function interpolateArray>(a: Array, b: A): ((t: number) => A); +export function interpolateArray(a: any[], b: A): ((t: number) => A); -export function interpolateObject(a: any, b: U): ((t: number) => U); +export function interpolateObject(a: any, b: U): ((t: number) => U); // TODO: extends 'any' should become 'object' with TS 2.2+ definitions export function interpolateObject(a: { [key: string]: any }, b: { [key: string]: any }): ((t: number) => { [key: string]: any }); - - export function interpolateTransformCss(a: string, b: string): ((t: number) => string); export function interpolateTransformSvg(a: string, b: string): ((t: number) => string); @@ -71,12 +68,11 @@ export function interpolateTransformSvg(a: string, b: string): ((t: number) => s */ export function interpolateZoom(a: ZoomView, b: ZoomView): ZoomInterpolator; - -export function quantize(interpolator: ((t: number) => T), n: number): Array; +export function quantize(interpolator: ((t: number) => T), n: number): T[]; // Color interpolation related -export var interpolateRgb: ColorGammaInterpolationFactory; +export const interpolateRgb: ColorGammaInterpolationFactory; export function interpolateRgbBasis(colors: Array): ((t: number) => string); export function interpolateRgbBasisClosed(colors: Array): ((t: number) => string); @@ -86,10 +82,10 @@ export function interpolateHslLong(a: string | ColorCommonInstance, b: string | export function interpolateLab(a: string | ColorCommonInstance, b: string | ColorCommonInstance): ((t: number) => string); export function interpolateHcl(a: string | ColorCommonInstance, b: string | ColorCommonInstance): ((t: number) => string); export function interpolateHclLong(a: string | ColorCommonInstance, b: string | ColorCommonInstance): ((t: number) => string); -export var interpolateCubehelix: ColorGammaInterpolationFactory; -export var interpolateCubehelixLong: ColorGammaInterpolationFactory; +export const interpolateCubehelix: ColorGammaInterpolationFactory; +export const interpolateCubehelixLong: ColorGammaInterpolationFactory; // Spline related -export function interpolateBasis(splineNodes: Array): ((t: number) => number); -export function interpolateBasisClosed(splineNodes: Array): ((t: number) => number); +export function interpolateBasis(splineNodes: number[]): ((t: number) => number); +export function interpolateBasisClosed(splineNodes: number[]): ((t: number) => number); diff --git a/types/d3-interpolate/tslint.json b/types/d3-interpolate/tslint.json new file mode 100644 index 0000000000..604d5950cf --- /dev/null +++ b/types/d3-interpolate/tslint.json @@ -0,0 +1,7 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "unified-signatures": false, + "callable-types": false + } +} diff --git a/types/d3-path/d3-path-tests.ts b/types/d3-path/d3-path-tests.ts index 4240a8f7be..b11a3405e3 100644 --- a/types/d3-path/d3-path-tests.ts +++ b/types/d3-path/d3-path-tests.ts @@ -8,19 +8,16 @@ import * as d3Path from 'd3-path'; - // ----------------------------------------------------------------------------------------- // Test create new path serializer // ----------------------------------------------------------------------------------------- let context: d3Path.Path = d3Path.path(); - // ----------------------------------------------------------------------------------------- // Test path serializer methods // ----------------------------------------------------------------------------------------- - context.moveTo(50, 50); context.lineTo(100, 100); diff --git a/types/d3-path/tslint.json b/types/d3-path/tslint.json new file mode 100644 index 0000000000..604d5950cf --- /dev/null +++ b/types/d3-path/tslint.json @@ -0,0 +1,7 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "unified-signatures": false, + "callable-types": false + } +} diff --git a/types/d3-polygon/index.d.ts b/types/d3-polygon/index.d.ts index 40dbaa4f4f..64e1d2c9b9 100644 --- a/types/d3-polygon/index.d.ts +++ b/types/d3-polygon/index.d.ts @@ -1,8 +1,10 @@ -// Type definitions for D3JS d3-polygon module v1.0.1 +// Type definitions for D3JS d3-polygon module 1.0 // Project: https://github.com/d3/d3-polygon/ // Definitions by: Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// Last module patch version validated against: 1.0.1 + /** * Returns the signed area of the specified polygon. If the vertices of the polygon are in counterclockwise order ( * assuming a coordinate system where the origin ⟨0,0⟩ is in the top-left corner), the returned area is positive; diff --git a/types/d3-polygon/tslint.json b/types/d3-polygon/tslint.json new file mode 100644 index 0000000000..604d5950cf --- /dev/null +++ b/types/d3-polygon/tslint.json @@ -0,0 +1,7 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "unified-signatures": false, + "callable-types": false + } +} diff --git a/types/d3-quadtree/d3-quadtree-tests.ts b/types/d3-quadtree/d3-quadtree-tests.ts index 9a285dc204..5fabc66961 100644 --- a/types/d3-quadtree/d3-quadtree-tests.ts +++ b/types/d3-quadtree/d3-quadtree-tests.ts @@ -27,7 +27,7 @@ interface TestDatum { let testDatum: TestDatum; -let testData: Array = [ +let testData: TestDatum[] = [ { x: 10, y: 20 }, { x: 30, y: 10 }, { x: 15, y: 80 }, @@ -39,7 +39,6 @@ let testData: Array = [ let node: d3Quadtree.QuadtreeInternalNode | d3Quadtree.QuadtreeLeaf; let numberAccessor: (d: TestDatum) => number; - let simpleTestData: Array<[number, number]> = [ [10, 20], [30, 10], @@ -76,8 +75,8 @@ quadtree = d3Quadtree.quadtree(testData); // explicitly typed to Test // test with data AND accessors passed in right away quadtree = d3Quadtree.quadtree( testData, // data type Array - function (d) { return d.x; }, // x accessor with d of type TestDatum - function (d) { return d.y; } // y accessor with d of type TestDatum + d => d.x, // x accessor with d of type TestDatum + d => d.y // y accessor with d of type TestDatum ); // inferred type underlying quadtree TestDatum quadtree = d3Quadtree.quadtree(testData); // explicitly typed to TestDatum @@ -86,26 +85,20 @@ quadtree = d3Quadtree.quadtree(testData); // explicitly typed to Test quadtree = d3Quadtree.quadtree(); // quadtree = d3Quadtree.quadtree(); fails, wrong underlying data type - // Configure Quadtree ======================================================== // x(...) -------------------------------------------------------------------- -quadtree = quadtree.x(function (d) { - return d.x; // d of type TestDatum -}); +quadtree = quadtree.x(d => d.x); // d of type TestDatum numberAccessor = quadtree.x(); // y(...) -------------------------------------------------------------------- -quadtree = quadtree.y(function (d) { - return d.y; // d of type TestDatum -}); +quadtree = quadtree.y(d => d.y); // d of type TestDatum numberAccessor = quadtree.y(); - // extent(...) --------------------------------------------------------------- quadtree = quadtree.extent([[0, 0], [80, 80]]); @@ -125,7 +118,6 @@ quadtree = quadtree.add({ x: 35, y: 35 }); quadtree = quadtree.addAll(testData); // quadtree = quadtree.addAll([{x: 35}, {x: 55, y: 13}]); // fails, incompatible data type - // remove(...) --------------------------------------------------------------- quadtree = quadtree.remove({ x: 35, y: 35 }); @@ -164,7 +156,7 @@ testDatum = quadtree.find(20, 30, 10); // visit() -------------------------------------------------------------------- -quadtree = quadtree.visit(function (node, x0, y0, x1, y1) { +quadtree = quadtree.visit((node, x0, y0, x1, y1) => { let bound: number; bound = x0; // number bound = y0; // number @@ -182,7 +174,7 @@ quadtree = quadtree.visit(function (node, x0, y0, x1, y1) { // void -> undefined return treated as falsey }); -quadtree = quadtree.visit(function (node, x0, y0, x1, y1) { +quadtree = quadtree.visit((node, x0, y0, x1, y1) => { let bound: number; bound = x0; // number bound = y0; // number @@ -203,10 +195,9 @@ quadtree = quadtree.visit(function (node, x0, y0, x1, y1) { // return 10; // fails wrong return type // }); - // visitAfter() --------------------------------------------------------------- -quadtree = quadtree.visitAfter(function (node, x0, y0, x1, y1) { +quadtree = quadtree.visitAfter((node, x0, y0, x1, y1) => { let bound: number; bound = x0; // number bound = y0; // number @@ -221,19 +212,17 @@ quadtree = quadtree.visitAfter(function (node, x0, y0, x1, y1) { } else { console.log('Top-Right Quadrant: ', node[0]); } - }); // Test QuadtreeLeaf ========================================================= -let leaf: d3Quadtree.QuadtreeLeaf, - nextLeaf: d3Quadtree.QuadtreeLeaf | undefined; +let leaf: d3Quadtree.QuadtreeLeaf; +let nextLeaf: d3Quadtree.QuadtreeLeaf | undefined; testDatum = leaf.data; nextLeaf = leaf.next ? leaf.next : undefined; - // Test QuadtreeInternalNode ================================================= let internalNode: d3Quadtree.QuadtreeInternalNode; diff --git a/types/d3-quadtree/index.d.ts b/types/d3-quadtree/index.d.ts index 5607060fd5..8128c9e306 100644 --- a/types/d3-quadtree/index.d.ts +++ b/types/d3-quadtree/index.d.ts @@ -1,8 +1,10 @@ -// Type definitions for D3JS d3-quadtree module v1.0.1 +// Type definitions for D3JS d3-quadtree module 1.0 // Project: https://github.com/d3/d3-quadtree/ // Definitions by: Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// Last module patch version validated against: 1.0.1 + /** * Leaf node of the quadtree. */ @@ -31,20 +33,21 @@ export interface Quadtree { extent(extend: [[number, number], [number, number]]): this; cover(x: number, y: number): this; add(datum: T): this; - addAll(data: Array): this; + addAll(data: T[]): this; remove(datum: T): this; - removeAll(data: Array): this; + removeAll(data: T[]): this; copy(): Quadtree; root(): QuadtreeInternalNode | QuadtreeLeaf; - data(): Array; + data(): T[]; size(): number; find(x: number, y: number, radius?: number): T | undefined; + // TODO: Review below, when validating to strictNullChecks. + // tslint:disable-next-line:void-return visit(callback: (node: QuadtreeInternalNode | QuadtreeLeaf, x0: number, y0: number, x1: number, y1: number) => (void | boolean)): this; visitAfter(callback: (node: QuadtreeInternalNode | QuadtreeLeaf, x0: number, y0: number, x1: number, y1: number) => void): this; } - export function quadtree(): Quadtree<[number, number]>; export function quadtree(data: Array<[number, number]>): Quadtree<[number, number]>; export function quadtree(): Quadtree; -export function quadtree(data: Array, x?: (d: T) => number, y?: (d: T) => number): Quadtree; +export function quadtree(data: T[], x?: (d: T) => number, y?: (d: T) => number): Quadtree; diff --git a/types/d3-quadtree/tslint.json b/types/d3-quadtree/tslint.json new file mode 100644 index 0000000000..38aa3fb5b3 --- /dev/null +++ b/types/d3-quadtree/tslint.json @@ -0,0 +1,7 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "unified-signatures": false, + "no-empty-interface": false + } +} diff --git a/types/d3-queue/d3-queue-tests.ts b/types/d3-queue/d3-queue-tests.ts index 223978b355..312bb0c358 100644 --- a/types/d3-queue/d3-queue-tests.ts +++ b/types/d3-queue/d3-queue-tests.ts @@ -28,13 +28,12 @@ qWithResults = d3Queue.queue(3); // No Results Task --------------------------------------------------- function delayedHello(name: string, delay: number, callback: (error: any | null) => void) { - setTimeout(function () { + setTimeout(() => { console.log('Hello, ' + name + '!'); callback(null); }, delay); } - qNoResult = qNoResult.defer(delayedHello, 'Alice', 250); qNoResult.defer(delayedHello, 'Bob', 500); @@ -53,7 +52,7 @@ qWithResults // No Results Task --------------------------------------------------- -qNoResult = qNoResult.await(function (error) { +qNoResult = qNoResult.await((error) => { if (error) throw error; console.log('Goodbye!'); }); @@ -62,7 +61,7 @@ qNoResult = qNoResult.await(function (error) { // await qWithResults - .await(function (error, file1Stat, file2Stat) { + .await((error, file1Stat, file2Stat) => { if (error) throw error; console.log(file1Stat, file2Stat); }); @@ -72,12 +71,11 @@ qWithResults qWithResults = d3Queue.queue() .defer(getFileStats, './workingpath/file1.json') .defer(getFileStats, './yetanotherworkingpath/file2.json') - .awaitAll(function (error, fileStats) { + .awaitAll((error, fileStats) => { if (error) throw error; - console.log(fileStats[0], fileStats[1]); + console.log(fileStats[0], fileStats[1]); }); - // Abort Deferred Tasks ============================================== function requestDataFromInterWeb(url: string, callback: (error: any | null, data?: any) => void) { @@ -87,9 +85,9 @@ function requestDataFromInterWeb(url: string, callback: (error: any | null, data qWithResults = d3Queue.queue() .defer(requestDataFromInterWeb, 'http://www.google.com:81') .defer(requestDataFromInterWeb, 'http://www.google.com:81') - .awaitAll(function (error, results) { + .awaitAll((error, results) => { if (error) throw error; - console.log(results[0], results[1]); + console.log(results[0], results[1]); }); qWithResults.abort(); diff --git a/types/d3-queue/index.d.ts b/types/d3-queue/index.d.ts index 0ca41b698f..d672849622 100644 --- a/types/d3-queue/index.d.ts +++ b/types/d3-queue/index.d.ts @@ -1,8 +1,10 @@ -// Type definitions for D3JS d3-queue module v3.0.2 +// Type definitions for D3JS d3-queue module 3.0 // Project: https://github.com/d3/d3-queue/ // Definitions by: Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// Last module patch version validated against: 3.0.2 + /** * A d3-queue queue object as returned by queue(...) */ @@ -17,7 +19,7 @@ export interface Queue { * To return multiple results from a single callback, wrap the results in an object or array. * @param args Additional, optional arguments to be passed into deferred task on invocation */ - defer(task: (...args: Array) => void, ...args: any[]): this; + defer(task: (...args: any[]) => void, ...args: any[]): this; /** * Aborts any active tasks, invoking each active task’s task.abort function, if any. * Also prevents any new tasks from starting, and immediately invokes the queue.await or @@ -32,7 +34,7 @@ export interface Queue { * If an error occurred, there are no additional arguments to the callback. Otherwise, * the callback is passed each result as an additional argument. */ - await(callback: (error: any | null, ...results: Array) => void): this; + await(callback: (error: any | null, ...results: any[]) => void): this; /** * Sets the callback to be invoked when all deferred tasks have finished (results array). * @@ -41,7 +43,7 @@ export interface Queue { * or null if no error occurred. If an error occurred, there are no additional arguments to the callback. * Otherwise, the callback is also passed an array of results as the second argument. */ - awaitAll(callback: (error: any | null, results?: Array) => void): this; + awaitAll(callback: (error: any | null, results?: any[]) => void): this; } /** diff --git a/types/d3-queue/tslint.json b/types/d3-queue/tslint.json new file mode 100644 index 0000000000..08b1465cd6 --- /dev/null +++ b/types/d3-queue/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "unified-signatures": false + } +} diff --git a/types/d3-request/d3-request-tests.ts b/types/d3-request/d3-request-tests.ts index 798d200bd5..8d8061d76a 100644 --- a/types/d3-request/d3-request-tests.ts +++ b/types/d3-request/d3-request-tests.ts @@ -52,7 +52,7 @@ let listenerResult: (this: d3Request.Request, result: ResponseDatumGET[]) => voi let request: d3Request.Request = d3Request.request(url); // GET-request with callback, immediately sent -let requestWithCallback: d3Request.Request = d3Request.request(url, function (error, xhr) { +let requestWithCallback: d3Request.Request = d3Request.request(url, (error, xhr) => { let x: XMLHttpRequest; if (!error) { x = xhr; @@ -60,7 +60,6 @@ let requestWithCallback: d3Request.Request = d3Request.request(url, function (er } }); - // ------------------------------------------------------------------------------- // Request interface // ------------------------------------------------------------------------------- @@ -81,7 +80,7 @@ let r3: d3Request.Request = d3Request.request(url) // with callback for response handling let r4: d3Request.Request = d3Request.request(url) .response(xhr2Listing) - .get(function (error, response) { + .get((error, response) => { let r: ResponseDatumGET[]; if (!error) { r = response; @@ -92,7 +91,7 @@ let r4: d3Request.Request = d3Request.request(url) // with request datum and callback for response handling let r5: d3Request.Request = d3Request.request(url) .response(xhr2Listing) - .get({ kind: 'Listing' }, function (error, response) { + .get({ kind: 'Listing' }, (error, response) => { let r: ResponseDatumGET[]; if (!error) { r = response; @@ -124,54 +123,49 @@ let r10: d3Request.Request = d3Request.request(url); // beforesent -r10 = r10.on('beforesend', function (xhr) { +r10 = r10.on('beforesend', function(xhr) { let that: d3Request.Request = this; let x: XMLHttpRequest = xhr; // do something; }); - listenerXhr = r10.on('beforesend'); - // progress -r10 = r10.on('progress', function (progEvent) { +r10 = r10.on('progress', function(progEvent) { let that: d3Request.Request = this; let e: ProgressEvent = progEvent; // do something; }); - listenerProgress = r10.on('progress'); - // error -r10 = r10.on('error', function (error) { +r10 = r10.on('error', function(error) { let that: d3Request.Request = this; let err: any = error; // do something; }); - listenerError = r10.on('error'); // load -r10 = r10.on('load', function (result) { +r10 = r10.on('load', function(result) { let that: d3Request.Request = this; let res: ResponseDatumGET[] = result; // do something; }); -r10 = r10.on('load', function (result: ResponseDatumGET[]) { +r10 = r10.on('load', function(result: ResponseDatumGET[]) { let that: d3Request.Request = this; let res: ResponseDatumGET[] = result; // do something; }); -// r10 = r10.on('load', function (result: number) { // fails, wrong argument type for callback +// r10 = r10.on('load', function(result: number) { // fails, wrong argument type for callback // let that: d3Request.Request = this; // let res: number = result; // // do something; @@ -181,22 +175,20 @@ listenerResult = r10.on('load'); // general (for unknown type additional event listener e.g. 'beforesent.custom' or 'load.custom') -r10 = r10.on('progress.foo', function (progEvent: ProgressEvent) { +r10 = r10.on('progress.foo', function(progEvent: ProgressEvent) { let that: d3Request.Request = this; let e: any = ProgressEvent; // do something; }); - listenerProgress = r10.on('progress.foo'); -r10 = r10.on('error.foo', function (error) { +r10 = r10.on('error.foo', function(error) { let that: d3Request.Request = this; let err: any = error; // do something; }); - listenerError = r10.on('error.foo'); // Password --------------------------------------------------------------------- @@ -226,7 +218,7 @@ let r13: d3Request.Request = d3Request.request(url) // with callback for response handling let r14: d3Request.Request = d3Request.request(url).response(xhr2Success) - .post(function (error, response) { + .post(function(error, response) { let that: d3Request.Request = this; let err: any = error; let res: ResponseDatumPOST = response; @@ -234,7 +226,7 @@ let r14: d3Request.Request = d3Request.request(url).response(xhr2Success) }); let r15: d3Request.Request = d3Request.request(url).response(xhr2Success) - .post({ test: 'NewValue', value: 10 }, function (error, response) { + .post({ test: 'NewValue', value: 10 }, function(error, response) { let that: d3Request.Request = this; let err: any = error; let res: ResponseDatumPOST = response; @@ -252,7 +244,7 @@ function xhr2Listing(xhr: XMLHttpRequest): ResponseDatumGET[] { } let r16: d3Request.Request = d3Request.request(url) - .response>(xhr2Listing); + .response(xhr2Listing); // ResponseType ----------------------------------------------------------------- @@ -276,7 +268,7 @@ let r19: d3Request.Request = d3Request.request(url) // method and callback for response handling let r20: d3Request.Request = d3Request.request(url) .response(xhr2Listing) - .send('GET', function (error, response) { + .send('GET', (error, response) => { let r: ResponseDatumGET[]; if (!error) { r = response; @@ -287,7 +279,7 @@ let r20: d3Request.Request = d3Request.request(url) // method,request datum and callback for response handling let r21: d3Request.Request = d3Request.request(url) .response(xhr2Listing) - .send('GET', { kind: 'Listing' }, function (error, response) { + .send('GET', { kind: 'Listing' }, (error, response) => { let r: ResponseDatumGET[]; if (!error) { r = response; @@ -295,7 +287,6 @@ let r21: d3Request.Request = d3Request.request(url) } }); - // Timeout ----------------------------------------------------------------------- // get @@ -312,42 +303,36 @@ let user: string = request.user(); // set let r23: d3Request.Request = request.user('User'); - // ------------------------------------------------------------------------------- // HTML Request // ------------------------------------------------------------------------------- - let html: d3Request.Request = d3Request.html(url); -let htmlWithCallback: d3Request.Request = d3Request.html(url, function (error, data) { +let htmlWithCallback: d3Request.Request = d3Request.html(url, function(error, data) { let that: d3Request.Request = this; let err: any = error; let d: DocumentFragment = data; console.log(d); }); - // ------------------------------------------------------------------------------- // JSON Request // ------------------------------------------------------------------------------- - let json: d3Request.Request = d3Request.json(url); -let jsonWithCallback: d3Request.Request = d3Request.json(url, function (error, data) { +let jsonWithCallback: d3Request.Request = d3Request.json(url, function(error, data) { let that: d3Request.Request = this; let err: any = error; let d: ResponseDatumGET[] = data; console.log(d); }); - - // ------------------------------------------------------------------------------- // Text Request // ------------------------------------------------------------------------------- let text: d3Request.Request = d3Request.text(url); -let textWithCallback: d3Request.Request = d3Request.text(url, function (error, data) { +let textWithCallback: d3Request.Request = d3Request.text(url, function(error, data) { let that: d3Request.Request = this; let err: any = error; let d: string = data; @@ -359,15 +344,13 @@ let textWithCallback: d3Request.Request = d3Request.text(url, function (error, d // ------------------------------------------------------------------------------- let xml: d3Request.Request = d3Request.xml(url); -let xmlWithCallback: d3Request.Request = d3Request.xml(url, function (error, data) { +let xmlWithCallback: d3Request.Request = d3Request.xml(url, function(error, data) { let that: d3Request.Request = this; let err: any = error; let d: any = data; console.log(d); }); - - // ------------------------------------------------------------------------------- // CSV Request // ------------------------------------------------------------------------------- @@ -376,7 +359,7 @@ let xmlWithCallback: d3Request.Request = d3Request.xml(url, function (error, dat let csvRequest: d3Request.DsvRequest = d3Request.csv(url); // url and callback for response handling -let csvRequestWithCallback: d3Request.DsvRequest = d3Request.csv(url, function (error, data) { +let csvRequestWithCallback: d3Request.DsvRequest = d3Request.csv(url, function(error, data) { let that: d3Request.Request = this; let err: any = error; let d: DSVParsedArray = data; @@ -385,7 +368,7 @@ let csvRequestWithCallback: d3Request.DsvRequest = d3Request.csv(url, function ( // url, row mapping function and callback for response handling let csvRequestWithRowWithCallback: d3Request.DsvRequest = d3Request.csv(url, - function (rawRow, index, columns) { + (rawRow, index, columns) => { let rr: DSVRowString = rawRow; let i: number = index; let cols: string[] = columns; @@ -398,7 +381,7 @@ let csvRequestWithRowWithCallback: d3Request.DsvRequest = d3Request.csv = data; @@ -409,12 +392,11 @@ let csvRequestWithRowWithCallback: d3Request.DsvRequest = d3Request.csv = data; @@ -423,7 +405,7 @@ let tsvRequestWithCallback: d3Request.DsvRequest = d3Request.tsv(url, function ( // url, row mapping function and callback for response handling let tsvRequestWithRowWithCallback: d3Request.DsvRequest = d3Request.tsv(url, - function (rawRow, index, columns) { + (rawRow, index, columns) => { let rr: DSVRowString = rawRow; let i: number = index; let cols: string[] = columns; @@ -436,7 +418,7 @@ let tsvRequestWithRowWithCallback: d3Request.DsvRequest = d3Request.tsv = data; @@ -450,7 +432,7 @@ let tsvRequestWithRowWithCallback: d3Request.DsvRequest = d3Request.tsv(function (rawRow, index, columns) { + .row((rawRow, index, columns) => { let rr: DSVRowString = rawRow; let i: number = index; let cols: string[] = columns; diff --git a/types/d3-request/index.d.ts b/types/d3-request/index.d.ts index 2a0251a726..3b5ce96148 100644 --- a/types/d3-request/index.d.ts +++ b/types/d3-request/index.d.ts @@ -1,8 +1,10 @@ -// Type definitions for D3JS d3-request module v1.0.2 +// Type definitions for D3JS d3-request module 1.0 // Project: https://github.com/d3/d3-request/ // Definitions by: Hugues Stefanski , Alex Ford , Boris Yankov , Tom Wanzek // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// Last module patch version validated against: 1.0.2 + import { DSVParsedArray, DSVRowString, DSVRowAny } from 'd3-dsv'; export interface Request { @@ -57,12 +59,16 @@ export interface Request { } export interface DsvRequest extends Request { - row(value: (rawRow: DSVRowString, index: number, columns: Array) => ParsedRow): DsvRequest; + row(value: (rawRow: DSVRowString, index: number, columns: string[]) => ParsedRow): DsvRequest; } export function csv(url: string): DsvRequest; export function csv(url: string, callback: (this: DsvRequest, error: any, d: DSVParsedArray) => void): DsvRequest; -export function csv(url: string, row: (rawRow: DSVRowString, index: number, columns: Array) => ParsedRow, callback: (this: DsvRequest, error: any, d: DSVParsedArray) => void): DsvRequest; +export function csv( + url: string, + row: (rawRow: DSVRowString, index: number, columns: string[]) => ParsedRow, + callback: (this: DsvRequest, error: any, d: DSVParsedArray) => void +): DsvRequest; export function html(url: string): Request; export function html(url: string, callback: (this: Request, error: any, d: DocumentFragment) => void): Request; @@ -78,7 +84,11 @@ export function text(url: string, callback: (this: Request, error: any, d: strin export function tsv(url: string): DsvRequest; export function tsv(url: string, callback: (this: DsvRequest, error: any, d: DSVParsedArray) => void): DsvRequest; -export function tsv(url: string, row: (rawRow: DSVRowString, index: number, columns: Array) => ParsedRow, callback: (this: DsvRequest, error: any, d: DSVParsedArray) => void): DsvRequest; +export function tsv( + url: string, + row: (rawRow: DSVRowString, index: number, columns: string[]) => ParsedRow, + callback: (this: DsvRequest, error: any, d: DSVParsedArray) => void +): DsvRequest; export function xml(url: string): Request; export function xml(url: string, callback: (this: Request, error: any, d: any) => void): Request; diff --git a/types/d3-request/tslint.json b/types/d3-request/tslint.json new file mode 100644 index 0000000000..da66196eee --- /dev/null +++ b/types/d3-request/tslint.json @@ -0,0 +1,7 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "unified-signatures": false, + "max-line-length": [false, 145] + } +} diff --git a/types/d3-scale-chromatic/index.d.ts b/types/d3-scale-chromatic/index.d.ts index 8550b3b55c..450d103259 100644 --- a/types/d3-scale-chromatic/index.d.ts +++ b/types/d3-scale-chromatic/index.d.ts @@ -1,91 +1,217 @@ -// Type definitions for D3JS d3-scale-chromatic module v1.0.2 +// Type definitions for D3JS d3-scale-chromatic module 1.0 // Project: https://github.com/d3/d3-scale-chromatic/ // Definitions by: Hugues Stefanski , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// Last module patch version validated against: 1.0.2 + // ----------------------------------------------------------------------- // Categorical // ----------------------------------------------------------------------- -/**An array of eight categorical colors represented as RGB hexadecimal strings. */ -export const schemeAccent: Array; -/**An array of eight categorical colors represented as RGB hexadecimal strings. */ -export const schemeDark2: Array; -/**An array of twelve categorical colors represented as RGB hexadecimal strings. */ -export const schemePaired: Array; -/**An array of nine categorical colors represented as RGB hexadecimal strings. */ -export const schemePastel1: Array; -/**An array of eight categorical colors represented as RGB hexadecimal strings. */ -export const schemePastel2: Array; -/**An array of nine categorical colors represented as RGB hexadecimal strings. */ -export const schemeSet1: Array; -/**An array of eight categorical colors represented as RGB hexadecimal strings. */ -export const schemeSet2: Array; -/**An array of twelve categorical colors represented as RGB hexadecimal strings. */ -export const schemeSet3: Array; +/** + * An array of eight categorical colors represented as RGB hexadecimal strings. + */ +export const schemeAccent: string[]; +/** + * An array of eight categorical colors represented as RGB hexadecimal strings. + */ +export const schemeDark2: string[]; +/** + * An array of twelve categorical colors represented as RGB hexadecimal strings. + */ +export const schemePaired: string[]; +/** + * An array of nine categorical colors represented as RGB hexadecimal strings. + */ +export const schemePastel1: string[]; +/** + * An array of eight categorical colors represented as RGB hexadecimal strings. + */ +export const schemePastel2: string[]; +/** + * An array of nine categorical colors represented as RGB hexadecimal strings. + */ +export const schemeSet1: string[]; +/** + * An array of eight categorical colors represented as RGB hexadecimal strings. + */ +export const schemeSet2: string[]; +/** + * An array of twelve categorical colors represented as RGB hexadecimal strings. + */ +export const schemeSet3: string[]; // ----------------------------------------------------------------------- // Diverging // ----------------------------------------------------------------------- -/**Given a number value in the range [0,1], returns the corresponding color from the “BrBG” diverging color scheme represented as an RGB string. */ +/** + * Given a number value in the range [0,1], returns the corresponding color from the “BrBG” diverging color scheme represented as an RGB string. + * + * @param value Number in the range [0, 1]. + */ export function interpolateBrBG(value: number): string; -/** Given a number t in the range [0,1], returns the corresponding color from the “PRGn” diverging color scheme represented as an RGB string.*/ +/** + * Given a number t in the range [0,1], returns the corresponding color from the “PRGn” diverging color scheme represented as an RGB string. + * + * @param value Number in the range [0, 1]. + */ export function interpolatePRGn(value: number): string; -/** Given a number t in the range [0,1], returns the corresponding color from the “PiYG” diverging color scheme represented as an RGB string.*/ +/** + * Given a number t in the range [0,1], returns the corresponding color from the “PiYG” diverging color scheme represented as an RGB string. + * + * @param value Number in the range [0, 1]. + */ export function interpolatePiYG(value: number): string; -/** Given a number t in the range [0,1], returns the corresponding color from the “PuOr” diverging color scheme represented as an RGB string.*/ +/** + * Given a number t in the range [0,1], returns the corresponding color from the “PuOr” diverging color scheme represented as an RGB string. + * + * @param value Number in the range [0, 1]. + */ export function interpolatePuOr(value: number): string; -/** Given a number t in the range [0,1], returns the corresponding color from the “RdBu” diverging color scheme represented as an RGB string.*/ +/** + * Given a number t in the range [0,1], returns the corresponding color from the “RdBu” diverging color scheme represented as an RGB string. + * + * @param value Number in the range [0, 1]. + */ export function interpolateRdBu(value: number): string; -/** Given a number t in the range [0,1], returns the corresponding color from the “RdGy” diverging color scheme represented as an RGB string.*/ +/** + * Given a number t in the range [0,1], returns the corresponding color from the “RdGy” diverging color scheme represented as an RGB string. + * + * @param value Number in the range [0, 1]. + */ export function interpolateRdGy(value: number): string; -/** Given a number t in the range [0,1], returns the corresponding color from the “RdYlBu” diverging color scheme represented as an RGB string.*/ +/** + * Given a number t in the range [0,1], returns the corresponding color from the “RdYlBu” diverging color scheme represented as an RGB string. + * + * @param value Number in the range [0, 1]. + */ export function interpolateRdYlBu(value: number): string; -/** Given a number t in the range [0,1], returns the corresponding color from the “RdYlGn” diverging color scheme represented as an RGB string.*/ +/** + * Given a number t in the range [0,1], returns the corresponding color from the “RdYlGn” diverging color scheme represented as an RGB string. + * + * @param value Number in the range [0, 1]. + */ export function interpolateRdYlGn(value: number): string; -/** Given a number t in the range [0,1], returns the corresponding color from the “Spectral” diverging color scheme represented as an RGB string.*/ +/** + * Given a number t in the range [0,1], returns the corresponding color from the “Spectral” diverging color scheme represented as an RGB string. + * + * @param value Number in the range [0, 1]. + */ export function interpolateSpectral(value: number): string; // ----------------------------------------------------------------------- // Sequential // ----------------------------------------------------------------------- -/**Given a number t in the range [0,1], returns the corresponding color from the “Blues” sequential color scheme represented as an RGB string. */ +/** + * Given a number t in the range [0,1], returns the corresponding color from the “Blues” sequential color scheme represented as an RGB string. + * + * @param value Number in the range [0, 1]. + */ export function interpolateBlues(value: number): string; -/**Given a number t in the range [0,1], returns the corresponding color from the “Greens” sequential color scheme represented as an RGB string. */ +/** + * Given a number t in the range [0,1], returns the corresponding color from the “Greens” sequential color scheme represented as an RGB string. + * + * @param value Number in the range [0, 1]. + */ export function interpolateGreens(value: number): string; -/**Given a number t in the range [0,1], returns the corresponding color from the “Greys” sequential color scheme represented as an RGB string. */ +/** + * Given a number t in the range [0,1], returns the corresponding color from the “Greys” sequential color scheme represented as an RGB string. + * + * @param value Number in the range [0, 1]. + */ export function interpolateGreys(value: number): string; -/**Given a number t in the range [0,1], returns the corresponding color from the “Oranges” sequential color scheme represented as an RGB string. */ +/** + * Given a number t in the range [0,1], returns the corresponding color from the “Oranges” sequential color scheme represented as an RGB string. + * + * @param value Number in the range [0, 1]. + */ export function interpolateOranges(value: number): string; -/**Given a number t in the range [0,1], returns the corresponding color from the “Purples” sequential color scheme represented as an RGB string. */ +/** + * Given a number t in the range [0,1], returns the corresponding color from the “Purples” sequential color scheme represented as an RGB string. + * + * @param value Number in the range [0, 1]. + */ export function interpolatePurples(value: number): string; -/**Given a number t in the range [0,1], returns the corresponding color from the “Reds” sequential color scheme represented as an RGB string. */ +/** + * Given a number t in the range [0,1], returns the corresponding color from the “Reds” sequential color scheme represented as an RGB string. + * + * @param value Number in the range [0, 1]. + */ export function interpolateReds(value: number): string; // ----------------------------------------------------------------------- // Sequential(Multi-Hue) // ----------------------------------------------------------------------- -/**Given a number t in the range [0,1], returns the corresponding color from the “BuGn” sequential color scheme represented as an RGB string. */ +/** + * Given a number t in the range [0,1], returns the corresponding color from the “BuGn” sequential color scheme represented as an RGB string. + * + * @param value Number in the range [0, 1]. + */ export function interpolateBuGn(value: number): string; -/**Given a number t in the range [0,1], returns the corresponding color from the “BuPu” sequential color scheme represented as an RGB string. */ +/** + * Given a number t in the range [0,1], returns the corresponding color from the “BuPu” sequential color scheme represented as an RGB string. + * + * @param value Number in the range [0, 1]. + */ export function interpolateBuPu(value: number): string; -/**Given a number t in the range [0,1], returns the corresponding color from the “GnBu” sequential color scheme represented as an RGB string. */ +/** + * Given a number t in the range [0,1], returns the corresponding color from the “GnBu” sequential color scheme represented as an RGB string. + * + * @param value Number in the range [0, 1]. + */ export function interpolateGnBu(value: number): string; -/**Given a number t in the range [0,1], returns the corresponding color from the “OrRd” sequential color scheme represented as an RGB string. */ +/** + * Given a number t in the range [0,1], returns the corresponding color from the “OrRd” sequential color scheme represented as an RGB string. + * + * @param value Number in the range [0, 1]. + */ export function interpolateOrRd(value: number): string; -/**Given a number t in the range [0,1], returns the corresponding color from the “PuBuGn” sequential color scheme represented as an RGB string. */ +/** + * Given a number t in the range [0,1], returns the corresponding color from the “PuBuGn” sequential color scheme represented as an RGB string. + * + * @param value Number in the range [0, 1]. + */ export function interpolatePuBuGn(value: number): string; -/**Given a number t in the range [0,1], returns the corresponding color from the “PuBu” sequential color scheme represented as an RGB string. */ +/** + * Given a number t in the range [0,1], returns the corresponding color from the “PuBu” sequential color scheme represented as an RGB string. + * + * @param value Number in the range [0, 1]. + */ export function interpolatePuBu(value: number): string; -/**Given a number t in the range [0,1], returns the corresponding color from the “PuRd” sequential color scheme represented as an RGB string. */ +/** + * Given a number t in the range [0,1], returns the corresponding color from the “PuRd” sequential color scheme represented as an RGB string. + * + * @param value Number in the range [0, 1]. + */ export function interpolatePuRd(value: number): string; -/**Given a number t in the range [0,1], returns the corresponding color from the “RdPu” sequential color scheme represented as an RGB string. */ +/** + * Given a number t in the range [0,1], returns the corresponding color from the “RdPu” sequential color scheme represented as an RGB string. + * + * @param value Number in the range [0, 1]. + */ export function interpolateRdPu(value: number): string; -/**Given a number t in the range [0,1], returns the corresponding color from the “YlGnBu” sequential color scheme represented as an RGB string. */ +/** + * Given a number t in the range [0,1], returns the corresponding color from the “YlGnBu” sequential color scheme represented as an RGB string. + * + * @param value Number in the range [0, 1]. + */ export function interpolateYlGnBu(value: number): string; -/**Given a number t in the range [0,1], returns the corresponding color from the “YlGn” sequential color scheme represented as an RGB string. */ +/** + * Given a number t in the range [0,1], returns the corresponding color from the “YlGn” sequential color scheme represented as an RGB string. + * + * @param value Number in the range [0, 1]. + */ export function interpolateYlGn(value: number): string; -/**Given a number t in the range [0,1], returns the corresponding color from the “YlOrBr” sequential color scheme represented as an RGB string. */ +/** + * Given a number t in the range [0,1], returns the corresponding color from the “YlOrBr” sequential color scheme represented as an RGB string. + * + * @param value Number in the range [0, 1]. + */ export function interpolateYlOrBr(value: number): string; -/**Given a number t in the range [0,1], returns the corresponding color from the “YlOrRd” sequential color scheme represented as an RGB string. */ +/** + * Given a number t in the range [0,1], returns the corresponding color from the “YlOrRd” sequential color scheme represented as an RGB string. + * + * @param value Number in the range [0, 1]. + */ export function interpolateYlOrRd(value: number): string; diff --git a/types/d3-scale-chromatic/tslint.json b/types/d3-scale-chromatic/tslint.json new file mode 100644 index 0000000000..08b1465cd6 --- /dev/null +++ b/types/d3-scale-chromatic/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "unified-signatures": false + } +} diff --git a/types/d3-scale/index.d.ts b/types/d3-scale/index.d.ts index 8a114d90e1..55ec29a89b 100644 --- a/types/d3-scale/index.d.ts +++ b/types/d3-scale/index.d.ts @@ -17,8 +17,6 @@ import { CountableTimeInterval, TimeInterval } from 'd3-time'; * The first generic correponds to the data type of the interpolation boundaries. * The second generic corresponds to the data type of the return type of the interpolator. */ -// This is a base interface to be extended, hence the suppression of the warning -// tslint:disable-next-line:callable-types export interface InterpolatorFactory { /** * Construct a new interpolator function, based on the provided interpolation boundaries. diff --git a/types/d3-scale/tslint.json b/types/d3-scale/tslint.json index 08b1465cd6..604d5950cf 100644 --- a/types/d3-scale/tslint.json +++ b/types/d3-scale/tslint.json @@ -1,6 +1,7 @@ { "extends": "dtslint/dt.json", "rules": { - "unified-signatures": false + "unified-signatures": false, + "callable-types": false } } diff --git a/types/d3-time-format/index.d.ts b/types/d3-time-format/index.d.ts index 4533d69dbb..3d1cecf221 100644 --- a/types/d3-time-format/index.d.ts +++ b/types/d3-time-format/index.d.ts @@ -1,8 +1,10 @@ -// Type definitions for d3JS d3-time-format module v2.0.2 +// Type definitions for d3JS d3-time-format module 2.0 // Project: https://github.com/d3/d3-time-format/ // Definitions by: Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// Last module patch version validated against: 2.0.2 + /** * Specification of time locale to use when creating a new TimeLocaleObject */ @@ -41,7 +43,6 @@ export interface TimeLocaleDefinition { shortMonths: [string, string, string, string, string, string, string, string, string, string, string, string]; } - export interface TimeLocaleObject { format(specifier: string): (date: Date) => string; parse(specifier: string): (dateString: string) => (Date | null); @@ -70,8 +71,6 @@ export function utcFormat(specifier: string): (date: Date) => string; export function utcParse(specifier: string): (dateString: string) => (Date | null); - - export function isoFormat(date: Date): string; export function isoParse(dateString: string): Date; diff --git a/types/d3-time-format/tslint.json b/types/d3-time-format/tslint.json new file mode 100644 index 0000000000..08b1465cd6 --- /dev/null +++ b/types/d3-time-format/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "unified-signatures": false + } +} diff --git a/types/d3-time/d3-time-tests.ts b/types/d3-time/d3-time-tests.ts index b16c3e40ea..a99cd818a0 100644 --- a/types/d3-time/d3-time-tests.ts +++ b/types/d3-time/d3-time-tests.ts @@ -8,14 +8,13 @@ import * as d3Time from 'd3-time'; - let countableI: d3Time.CountableTimeInterval; let simpleI: d3Time.TimeInterval; -let dateArray: Array; -let start: Date = new Date(2014, 1, 1, 6, 0, 0, 0), - end: Date = new Date(2016, 6, 13, 1, 25, 15, 500), - inBetween: Date = new Date(2015, 6, 13, 1, 30, 5, 700), - resultDate: Date; +let dateArray: Date[]; +let start: Date = new Date(2014, 1, 1, 6, 0, 0, 0); +let end: Date = new Date(2016, 6, 13, 1, 25, 15, 500); +let inBetween: Date = new Date(2015, 6, 13, 1, 30, 5, 700); +let resultDate: Date; let count: number; // Test custom factories' definitions ------------------------------------------ @@ -41,7 +40,7 @@ countableI = d3Time.timeInterval( // offset function (d: Date, step: number) => { d.setUTCHours(d.getUTCHours() + step); }, // count function - (start: Date, end: Date) => { return (end.valueOf() - start.valueOf()) / 36e5; } + (start: Date, end: Date) => (end.valueOf() - start.valueOf()) / 36e5 ); countableI = d3Time.timeInterval( @@ -50,9 +49,9 @@ countableI = d3Time.timeInterval( // offset function (d: Date, step: number) => { d.setUTCHours(d.getUTCHours() + step); }, // count function - (start: Date, end: Date) => { return (end.valueOf() - start.valueOf()) / 36e5; }, + (start: Date, end: Date) => (end.valueOf() - start.valueOf()) / 36e5, // field function - (d: Date) => { return d.valueOf() / 36e5; } + (d: Date) => d.valueOf() / 36e5 ); // Test signatures of (Countable)Interval methods ------------------------------ @@ -71,7 +70,7 @@ dateArray = countableI.range(new Date(), new Date()); // TODO: specify dates dateArray = countableI.range(new Date(), new Date(), 2); // TODO: specify dates // countableI = countableI.filter((d: Date)=>{ return d.getMonth() === 2;}); // Test fails, since .filter(...) return Interval and not CountableInterval -simpleI = countableI.filter((d: Date) => { return d.getMonth() === 2; }); +simpleI = countableI.filter((d: Date) => d.getMonth() === 2); count = countableI.count(start, end); @@ -84,7 +83,7 @@ resultDate = simpleI.ceil(inBetween); resultDate = simpleI.ceil(inBetween); resultDate = simpleI.offset(inBetween); resultDate = simpleI.offset(inBetween, 3); -simpleI = simpleI.filter((d: Date) => { return d.getMonth() === 2; }); +simpleI = simpleI.filter((d: Date) => d.getMonth() === 2); // count = simpleI.count(start, end); // Test fails, since .count(...) is not defined on Interval // simpleI = simpleI.every(10); // Test fails, since .every(...) is not defined on Interval @@ -151,7 +150,6 @@ countableI = d3Time.timeYear; dateArray = d3Time.timeYears(start, end); dateArray = d3Time.timeYears(start, end, 2); - countableI = d3Time.utcMillisecond; dateArray = d3Time.utcMilliseconds(start, end); dateArray = d3Time.utcMilliseconds(start, end, 60000); diff --git a/types/d3-time/index.d.ts b/types/d3-time/index.d.ts index 912d999ce4..5e2b66718f 100644 --- a/types/d3-time/index.d.ts +++ b/types/d3-time/index.d.ts @@ -19,10 +19,14 @@ export interface TimeInterval { * * For example, timeDay(date) typically returns 12:00 AM local time on the given date. * - * This function is idempotent: if the specified date is already floored to the current interval, a new date with an identical time is returned. - * Furthermore, the returned date is the minimum expressible value of the associated interval, such that interval.floor(interval.floor(date) - 1) returns the preceeding interval boundary date. + * This function is idempotent: if the specified date is already floored to the current interval, + * a new date with an identical time is returned. + * Furthermore, the returned date is the minimum expressible value of the associated interval, + * such that interval.floor(interval.floor(date) - 1) returns the preceeding interval boundary date. * - * Note that the == and === operators do not compare by value with Date objects, and thus you cannot use them to tell whether the specified date has already been floored. Instead, coerce to a number and then compare. + * Note that the == and === operators do not compare by value with Date objects, + * and thus you cannot use them to tell whether the specified date has already been floored. + * Instead, coerce to a number and then compare. * * This is more reliable than testing whether the time is 12:00 AM, as in some time zones midnight may not exist due to daylight saving. * @@ -35,10 +39,14 @@ export interface TimeInterval { * * For example, timeDay.floor(date) typically returns 12:00 AM local time on the given date. * - * This method is idempotent: if the specified date is already floored to the current interval, a new date with an identical time is returned. - * Furthermore, the returned date is the minimum expressible value of the associated interval, such that interval.floor(interval.floor(date) - 1) returns the preceeding interval boundary date. + * This method is idempotent: if the specified date is already floored to the current interval, + * a new date with an identical time is returned. + * Furthermore, the returned date is the minimum expressible value of the associated interval, + * such that interval.floor(interval.floor(date) - 1) returns the preceeding interval boundary date. * - * Note that the == and === operators do not compare by value with Date objects, and thus you cannot use them to tell whether the specified date has already been floored. Instead, coerce to a number and then compare. + * Note that the == and === operators do not compare by value with Date objects, + * and thus you cannot use them to tell whether the specified date has already been floored. + * Instead, coerce to a number and then compare. * * This is more reliable than testing whether the time is 12:00 AM, as in some time zones midnight may not exist due to daylight saving. * @@ -63,8 +71,10 @@ export interface TimeInterval { * * For example, timeDay.ceil(date) typically returns 12:00 AM local time on the date following the given date. * - * This method is idempotent: if the specified date is already ceilinged to the current interval, a new date with an identical time is returned. Furthermore, - * the returned date is the maximum expressible value of the associated interval, such that interval.ceil(interval.ceil(date) + 1) returns the following interval boundary date. + * This method is idempotent: if the specified date is already ceilinged to the current interval, + * a new date with an identical time is returned. Furthermore, + * the returned date is the maximum expressible value of the associated interval, + * such that interval.ceil(interval.ceil(date) + 1) returns the following interval boundary date. * * @param date A date object. */ @@ -79,7 +89,8 @@ export interface TimeInterval { * then timeDay.offset(date, 1) returns 5:34 PM tomorrow (even if daylight saving changes!). * * @param date A date object. - * @param step An optional number of steps to apply when calculating the offset date. If step is negative, then the returned date will be before the specified date; + * @param step An optional number of steps to apply when calculating the offset date. + * If step is negative, then the returned date will be before the specified date; * if step is zero, then a copy of the specified date is returned; if step is not an integer, it is floored. */ offset(date: Date, step?: number): Date; @@ -87,10 +98,12 @@ export interface TimeInterval { /** * Returns an array of dates representing every interval boundary after or equal to start (inclusive) and before stop (exclusive). * - * If step is specified, then every step-th boundary will be returned; for example, for the timeDay interval a step of 2 will return every other day. + * If step is specified, then every step-th boundary will be returned; for example, + * for the timeDay interval a step of 2 will return every other day. * If step is not an integer, it is floored. * - * The first date in the returned array is the earliest boundary after or equal to start; subsequent dates are offset by step intervals and floored. + * The first date in the returned array is the earliest boundary after or equal to start; + * subsequent dates are offset by step intervals and floored. * Thus, two overlapping ranges may be inconsistent. * * To make ranges consistent when a step is specified, use CountableInterval.every instead. @@ -104,7 +117,8 @@ export interface TimeInterval { /** * Returns a new interval that is a filtered subset of this interval using the specified test function. * - * @param test A test function which is passed a date and should return true if and only if the specified date should be considered part of the interval. + * @param test A test function which is passed a date and should return true if and only if + * the specified date should be considered part of the interval. */ filter(test: (date: Date) => boolean): TimeInterval; } @@ -129,7 +143,8 @@ export interface CountableTimeInterval extends TimeInterval { * The meaning of step is dependent on this interval’s parent interval as defined by the field function. * * For example, timeMinute.every(15) returns an interval representing every fifteen minutes, - * starting on the hour: :00, :15, :30, :45, etc. Note that for some intervals, the resulting dates may not be uniformly-spaced; + * starting on the hour: :00, :15, :30, :45, etc. Note that for some intervals, + * the resulting dates may not be uniformly-spaced; * timeDay’s parent interval is timeMonth, and thus the interval number resets at the start of each month. * * If step is not valid, returns null. If step is one, returns this interval. @@ -151,7 +166,8 @@ export interface CountableTimeInterval extends TimeInterval { * The returned custom interval is not countable, i.e. does not exposee the methods "count(..)" and "every(...)". * * @param floor A floor function which takes a single date as an argument and rounds it down to the nearest interval boundary. - * @param offset An offset function which takes a date and an integer step as arguments and advances the specified date by the specified number of boundaries; the step may be positive, negative or zero. + * @param offset An offset function which takes a date and an integer step as arguments and advances + * the specified date by the specified number of boundaries; the step may be positive, negative or zero. */ export function timeInterval( floor: (date: Date) => void, @@ -165,13 +181,17 @@ export function timeInterval( * Note: due to an internal optimization, the specified count function must not invoke interval.count on other time intervals. * * @param floor A floor function which takes a single date as an argument and rounds it down to the nearest interval boundary. - * @param offset An offset function which takes a date and an integer step as arguments and advances the specified date by the specified number of boundaries; the step may be positive, negative or zero. - * @param count A count function which takes a start date and an end date, already floored to the current interval, and returns the number of boundaries between the start (exclusive) and end (inclusive). + * @param offset An offset function which takes a date and an integer step as arguments and advances + * the specified date by the specified number of boundaries; the step may be positive, negative or zero. + * @param count A count function which takes a start date and an end date, already floored to the current interval, + * and returns the number of boundaries between the start (exclusive) and end (inclusive). * Note: due to an internal optimization, the specified count function must not invoke interval.count on other time intervals. - * @param field An optional field function which takes a date, already floored to the current interval, and returns the field value of the specified date, + * @param field An optional field function which takes a date, already floored to the current interval, + * and returns the field value of the specified date, * corresponding to the number of boundaries between this date (exclusive) and the latest previous parent boundary. - * For example, for the timeDay interval, this returns the number of days since the start of the month. If a field function is not specified, - * it defaults to counting the number of interval boundaries since the UNIX epoch of January 1, 1970 UTC. The field function defines the behavior of interval.every. + * For example, for the timeDay interval, this returns the number of days since the start of the month. + * If a field function is not specified, it defaults to counting the number of interval boundaries since + * the UNIX epoch of January 1, 1970 UTC. The field function defines the behavior of interval.every. */ export function timeInterval( floor: (date: Date) => void, @@ -184,13 +204,12 @@ export function timeInterval( // Built-In Factories and Date Array Creators // --------------------------------------------------------------- - // local time ---------------------------------------------------------- /** * Milliseconds Interval in Local Time; the shortest available time unit. */ -export var timeMillisecond: CountableTimeInterval; +export const timeMillisecond: CountableTimeInterval; /** * This is a convenience alias for timeMillisecond.range(...). @@ -204,7 +223,7 @@ export function timeMilliseconds(start: Date, stop: Date, step?: number): Date[] /** * Seconds Interval in Local Time; seconds (e.g., 01:23:45.0000 AM); 1,000 milliseconds. */ -export var timeSecond: CountableTimeInterval; +export const timeSecond: CountableTimeInterval; /** * This is a convenience alias for timeSecond.range(...). @@ -218,7 +237,7 @@ export function timeSeconds(start: Date, stop: Date, step?: number): Date[]; /** * Minutes Interval in Local Time; minutes (e.g., 01:02:00 AM); 60 seconds. Note that ECMAScript ignores leap seconds. */ -export var timeMinute: CountableTimeInterval; +export const timeMinute: CountableTimeInterval; /** * This is a convenience alias for timeMinute.range(...). @@ -234,7 +253,7 @@ export function timeMinutes(start: Date, stop: Date, step?: number): Date[]; * * Note that advancing time by one hour in local time can return the same hour or skip an hour due to daylight saving. */ -export var timeHour: CountableTimeInterval; +export const timeHour: CountableTimeInterval; /** * This is a convenience alias for timeHour.range(...). @@ -249,7 +268,7 @@ export function timeHours(start: Date, stop: Date, step?: number): Date[]; * Days Interval in Local Time; days (e.g., February 7, 2012 at 12:00 AM); typically 24 hours. * Days in local time may range from 23 to 25 hours due to daylight saving. */ -export var timeDay: CountableTimeInterval; +export const timeDay: CountableTimeInterval; /** * This is a convenience alias for timeDay.range(...). @@ -265,7 +284,7 @@ export function timeDays(start: Date, stop: Date, step?: number): Date[]; * * Weeks in local time may range from 167 to 169 hours due on daylight saving. */ -export var timeWeek: CountableTimeInterval; +export const timeWeek: CountableTimeInterval; /** * This is a convenience alias for timeWeek.range(...). @@ -282,7 +301,7 @@ export function timeWeeks(start: Date, stop: Date, step?: number): Date[]; * * Weeks in local time may range from 167 to 169 hours due on daylight saving. */ -export var timeSunday: CountableTimeInterval; +export const timeSunday: CountableTimeInterval; /** * This is a convenience alias for timeSunday.range(...). @@ -299,7 +318,7 @@ export function timeSundays(start: Date, stop: Date, step?: number): Date[]; * * Weeks in local time may range from 167 to 169 hours due on daylight saving. */ -export var timeMonday: CountableTimeInterval; +export const timeMonday: CountableTimeInterval; /** * This is a convenience alias for timeMonday.range(...). @@ -316,7 +335,7 @@ export function timeMondays(start: Date, stop: Date, step?: number): Date[]; * * Weeks in local time may range from 167 to 169 hours due on daylight saving. */ -export var timeTuesday: CountableTimeInterval; +export const timeTuesday: CountableTimeInterval; /** * This is a convenience alias for timeTuesday.range(...). @@ -333,7 +352,7 @@ export function timeTuesdays(start: Date, stop: Date, step?: number): Date[]; * * Weeks in local time may range from 167 to 169 hours due on daylight saving. */ -export var timeWednesday: CountableTimeInterval; +export const timeWednesday: CountableTimeInterval; /** * This is a convenience alias for timeWednesday.range(...). @@ -350,7 +369,7 @@ export function timeWednesdays(start: Date, stop: Date, step?: number): Date[]; * * Weeks in local time may range from 167 to 169 hours due on daylight saving. */ -export var timeThursday: CountableTimeInterval; +export const timeThursday: CountableTimeInterval; /** * This is a convenience alias for timeThursday.range(...). @@ -367,8 +386,7 @@ export function timeThursdays(start: Date, stop: Date, step?: number): Date[]; * * Weeks in local time may range from 167 to 169 hours due on daylight saving. */ -export var timeFriday: CountableTimeInterval; - +export const timeFriday: CountableTimeInterval; /** * This is a convenience alias for timeFriday.range(...). @@ -385,7 +403,7 @@ export function timeFridays(start: Date, stop: Date, step?: number): Date[]; * * Weeks in local time may range from 167 to 169 hours due on daylight saving. */ -export var timeSaturday: CountableTimeInterval; +export const timeSaturday: CountableTimeInterval; /** * This is a convenience alias for timeSaturday.range(...). @@ -399,7 +417,7 @@ export function timeSaturdays(start: Date, stop: Date, step?: number): Date[]; /** * Month Interval in Local Time; months (e.g., February 1, 2012 at 12:00 AM); ranges from 28 to 31 days. */ -export var timeMonth: CountableTimeInterval; +export const timeMonth: CountableTimeInterval; /** * This is a convenience alias for timeMonth.range(...). @@ -413,7 +431,7 @@ export function timeMonths(start: Date, stop: Date, step?: number): Date[]; /** * Year Interval in Local Time; years (e.g., January 1, 2012 at 12:00 AM); ranges from 365 to 366 days. */ -export var timeYear: CountableTimeInterval; +export const timeYear: CountableTimeInterval; /** * This is a convenience alias for timeYear.range(...). @@ -424,13 +442,12 @@ export var timeYear: CountableTimeInterval; */ export function timeYears(start: Date, stop: Date, step?: number): Date[]; - // utc Universal Coordinated Time ---------------------------------------------------------- /** * Milliseconds Interval in Univarsal Coordinated Time (UTC); the shortest available time unit. */ -export var utcMillisecond: CountableTimeInterval; +export const utcMillisecond: CountableTimeInterval; /** * This is a convenience alias for utcMilliesecond.range(...). @@ -444,7 +461,7 @@ export function utcMilliseconds(start: Date, stop: Date, step?: number): Date[]; /** * Seconds Interval in Univarsal Coordinated Time (UTC); seconds (e.g., 01:23:45.0000 AM); 1,000 milliseconds. */ -export var utcSecond: CountableTimeInterval; +export const utcSecond: CountableTimeInterval; /** * This is a convenience alias for utcSecond.range(...). @@ -456,9 +473,10 @@ export var utcSecond: CountableTimeInterval; export function utcSeconds(start: Date, stop: Date, step?: number): Date[]; /** - * Minutes Interval in Univarsal Coordinated Time (UTC); minutes (e.g., 01:02:00 AM); 60 seconds. Note that ECMAScript ignores leap seconds. + * Minutes Interval in Univarsal Coordinated Time (UTC); minutes (e.g., 01:02:00 AM); 60 seconds. + * Note that ECMAScript ignores leap seconds. */ -export var utcMinute: CountableTimeInterval; +export const utcMinute: CountableTimeInterval; /** * This is a convenience alias for utcMinute.range(...). @@ -472,7 +490,7 @@ export function utcMinutes(start: Date, stop: Date, step?: number): Date[]; /** * Hours Interval in Univarsal Coordinated Time (UTC); Hours (e.g., 01:00 AM); 60 minutes. */ -export var utcHour: CountableTimeInterval; +export const utcHour: CountableTimeInterval; /** * This is a convenience alias for utcHour.range(...). @@ -486,7 +504,7 @@ export function utcHours(start: Date, stop: Date, step?: number): Date[]; /** * Days Interval in Univarsal Coordinated Time (UTC); days (e.g., February 7, 2012 at 12:00 AM); 24 hours. */ -export var utcDay: CountableTimeInterval; +export const utcDay: CountableTimeInterval; /** * This is a convenience alias for utcDay.range(...). @@ -501,7 +519,7 @@ export function utcDays(start: Date, stop: Date, step?: number): Date[]; * Week Interval in Local Time. Alias for sunday; 7 days and 168 hours. * */ -export var utcWeek: CountableTimeInterval; +export const utcWeek: CountableTimeInterval; /** * This is a convenience alias for utcWeek.range(...). @@ -516,7 +534,7 @@ export function utcWeeks(start: Date, stop: Date, step?: number): Date[]; * Week Interval for Sunday-based weeks in Univarsal Coordinated Time (UTC) (e.g., February 5, 2012 at 12:00 AM). * 7 days and 168 hours. */ -export var utcSunday: CountableTimeInterval; +export const utcSunday: CountableTimeInterval; /** * This is a convenience alias for utcSunday.range(...). @@ -531,7 +549,7 @@ export function utcSundays(start: Date, stop: Date, step?: number): Date[]; * Week Interval for Monday-based weeks in Univarsal Coordinated Time (UTC) (e.g., February 6, 2012 at 12:00 AM). * 7 days and 168 hours. */ -export var utcMonday: CountableTimeInterval; +export const utcMonday: CountableTimeInterval; /** * This is a convenience alias for utcMonday.range(...). @@ -546,7 +564,7 @@ export function utcMondays(start: Date, stop: Date, step?: number): Date[]; * Week Interval for Tuesday-based weeks in Univarsal Coordinated Time (UTC) (e.g., February 7, 2012 at 12:00 AM). * 7 days and 168 hours. */ -export var utcTuesday: CountableTimeInterval; +export const utcTuesday: CountableTimeInterval; /** * This is a convenience alias for utcTuesday.range(...). @@ -561,7 +579,7 @@ export function utcTuesdays(start: Date, stop: Date, step?: number): Date[]; * Week Interval for Wednesday-based weeks in Univarsal Coordinated Time (UTC) (e.g., February 8, 2012 at 12:00 AM). * 7 days and 168 hours. */ -export var utcWednesday: CountableTimeInterval; +export const utcWednesday: CountableTimeInterval; /** * This is a convenience alias for utcWednesday.range(...). @@ -576,7 +594,7 @@ export function utcWednesdays(start: Date, stop: Date, step?: number): Date[]; * Week Interval for Thursday-based weeks in Univarsal Coordinated Time (UTC) (e.g., February 9, 2012 at 12:00 AM). * 7 days and 168 hours. */ -export var utcThursday: CountableTimeInterval; +export const utcThursday: CountableTimeInterval; /** * This is a convenience alias for utcThursday.range(...). @@ -591,7 +609,7 @@ export function utcThursdays(start: Date, stop: Date, step?: number): Date[]; * Week Interval for Friday-based weeks in Univarsal Coordinated Time (UTC) (e.g., February 10, 2012 at 12:00 AM). * 7 days and 168 hours. */ -export var utcFriday: CountableTimeInterval; +export const utcFriday: CountableTimeInterval; /** * This is a convenience alias for utcFriday.range(...). @@ -606,7 +624,7 @@ export function utcFridays(start: Date, stop: Date, step?: number): Date[]; * Week Interval for Saturday-based weeks in Univarsal Coordinated Time (UTC) (e.g., February 11, 2012 at 12:00 AM). * 7 days and 168 hours. */ -export var utcSaturday: CountableTimeInterval; +export const utcSaturday: CountableTimeInterval; /** * This is a convenience alias for utcSaturday.range(...). @@ -620,7 +638,7 @@ export function utcSaturdays(start: Date, stop: Date, step?: number): Date[]; /** * Month Interval in Univarsal Coordinated Time (UTC); months (e.g., February 1, 2012 at 12:00 AM); ranges from 28 to 31 days. */ -export var utcMonth: CountableTimeInterval; +export const utcMonth: CountableTimeInterval; /** * This is a convenience alias for utcMonth.range(...). @@ -634,7 +652,7 @@ export function utcMonths(start: Date, stop: Date, step?: number): Date[]; /** * Year Interval in Univarsal Coordinated Time (UTC); years (e.g., January 1, 2012 at 12:00 AM); ranges from 365 to 366 days. */ -export var utcYear: CountableTimeInterval; +export const utcYear: CountableTimeInterval; /** * This is a convenience alias for utcYear.range(...). diff --git a/types/d3-time/tslint.json b/types/d3-time/tslint.json new file mode 100644 index 0000000000..08b1465cd6 --- /dev/null +++ b/types/d3-time/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "unified-signatures": false + } +} diff --git a/types/d3-timer/index.d.ts b/types/d3-timer/index.d.ts index ecb62c7610..08fee97696 100644 --- a/types/d3-timer/index.d.ts +++ b/types/d3-timer/index.d.ts @@ -1,8 +1,10 @@ -// Type definitions for d3JS d3-timer module v1.0.2 +// Type definitions for d3JS d3-timer module 1.0 // Project: https://github.com/d3/d3-timer/ // Definitions by: Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// Last module patch version validated against: 1.0.2 + /** * Returns the current time as defined by performance.now if available, and Date.now if not. * The current time is updated at the start of a frame; it is thus consistent during the frame, and any timers scheduled during the same frame will be synchronized. @@ -11,7 +13,6 @@ */ export function now(): number; - export interface Timer { /** * Restart a timer with the specified callback and optional delay and time. diff --git a/types/d3-timer/tslint.json b/types/d3-timer/tslint.json new file mode 100644 index 0000000000..08b1465cd6 --- /dev/null +++ b/types/d3-timer/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "unified-signatures": false + } +} diff --git a/types/d3-voronoi/d3-voronoi-tests.ts b/types/d3-voronoi/d3-voronoi-tests.ts index 966ab622ec..7dea86241e 100644 --- a/types/d3-voronoi/d3-voronoi-tests.ts +++ b/types/d3-voronoi/d3-voronoi-tests.ts @@ -8,7 +8,6 @@ import * as d3Voronoi from 'd3-voronoi'; - // --------------------------------------------------------------------- // Preparatory Steps // --------------------------------------------------------------------- @@ -18,15 +17,14 @@ let size: [number, number]; let coordinates: [number, number]; let num: number; -let numArray: Array; - +let numArray: number[]; interface VoronoiTestDatum { x: number; y: number; } -let testData: Array = [ +let testData: VoronoiTestDatum[] = [ { x: 10, y: 10 }, { x: 20, y: 10 }, { x: 10, y: 20 }, @@ -44,7 +42,6 @@ let cells: Array>; let cell: d3Voronoi.VoronoiCell; let site: d3Voronoi.VoronoiSite; - let polygons: Array>; let polygon: d3Voronoi.VoronoiPolygon; @@ -116,17 +113,13 @@ voronoiLayout = d3Voronoi.voronoi(); // x(...) ------------------------------------------------------------- -voronoiLayout = voronoiLayout.x(function (d) { - return d.x; // data type of d is VoronoiTestDatum -}); +voronoiLayout = voronoiLayout.x(d => d.x); // data type of d is VoronoiTestDatum numberAccessor = voronoiLayout.x(); // y(...) ------------------------------------------------------------- -voronoiLayout = voronoiLayout.y(function (d) { - return d.y; // data type of d is VoronoiTestDatum -}); +voronoiLayout = voronoiLayout.y(d => d.y); // data type of d is VoronoiTestDatum numberAccessor = voronoiLayout.y(); @@ -161,13 +154,11 @@ polygons = voronoiLayout.polygons(testData); // generated from Layout triangles = voronoiLayout.triangles(testData); - // Links --------------------------------------------------------------- // generated from Layout links = voronoiLayout.links(testData); - // --------------------------------------------------------------------- // Use VoronoiDiagram // --------------------------------------------------------------------- @@ -235,7 +226,6 @@ link = links[0]; testDatum = link.source; testDatum = link.target; - // find() =============================================================== let nearestSite: d3Voronoi.VoronoiSite | null; diff --git a/types/d3-voronoi/index.d.ts b/types/d3-voronoi/index.d.ts index 9bd270d11d..1a529e4a71 100644 --- a/types/d3-voronoi/index.d.ts +++ b/types/d3-voronoi/index.d.ts @@ -1,13 +1,14 @@ -// Type definitions for D3JS d3-voronoi module v1.1.0 +// Type definitions for D3JS d3-voronoi module 1.1 // Project: https://github.com/d3/d3-voronoi/ // Definitions by: Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// Last module patch version validated against: 1.1.0 + // -------------------------------------------------------------------------- // Shared Type Definitions and Interfaces // -------------------------------------------------------------------------- - /** * The VoronoiPoint interface is defined as a cue that the array is strictly of type [number, number] with two elements * for x and y coordinates. However, it is used as a base for interface definitions, and [number, number] @@ -80,10 +81,9 @@ export interface VoronoiCell { /** * An array of indexes into diagram.edges representing the cell’s polygon. */ - halfEdges: Array; + halfEdges: number[]; } - /** * Voronoi Edge in the diagram is an array [[x0, y0], [x1, y1]] with two additional properties: * left and right. @@ -128,7 +128,7 @@ export interface VoronoiLayout { * Computes the Voronoi diagram for the specified data points. * @param data Array of data elements */ - (data: Array): VoronoiDiagram; + (data: T[]): VoronoiDiagram; /** * Return the current x-coordinate accessor, @@ -206,24 +206,23 @@ export interface VoronoiLayout { * * @param data Array of data points. */ - polygons(data: Array): Array>; + polygons(data: T[]): Array>; /** * Return the Delaunay triangulation of the specified data array as an array of triangles. * Each triangle is a three-element array of elements from data. * * @param data Array of data points. */ - triangles(data: Array): Array>; + triangles(data: T[]): Array>; /** * Return the Delaunay triangulation of the specified data array as an array of links. * Each link has source and target attributes referring to elements in data. * * @param data Array of data points. */ - links(data: Array): Array>; + links(data: T[]): Array>; } - /** * Computed Voronoi diagram * @@ -276,7 +275,7 @@ export interface VoronoiDiagram { * @param y y-coordinate * @param radius Optional parameter for search radius around [x, y] */ - find(x: number, y:number, radius?:number): VoronoiSite | null; + find(x: number, y: number, radius?: number): VoronoiSite | null; } // -------------------------------------------------------------------------- diff --git a/types/d3-voronoi/tslint.json b/types/d3-voronoi/tslint.json new file mode 100644 index 0000000000..08b1465cd6 --- /dev/null +++ b/types/d3-voronoi/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "unified-signatures": false + } +} From 72c44b6d9ef2fd92f56363820de57ac5234b37b8 Mon Sep 17 00:00:00 2001 From: lax20attack Date: Fri, 19 May 2017 11:32:19 -0400 Subject: [PATCH 0256/1072] 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 09d7614303a45a52e0ec7742d874b65297731833 Mon Sep 17 00:00:00 2001 From: Christopher Blum Date: Fri, 19 May 2017 18:41:37 +0200 Subject: [PATCH 0257/1072] cropperjs - Added checkOrientation option --- types/cropperjs/index.d.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/types/cropperjs/index.d.ts b/types/cropperjs/index.d.ts index a82fa718f9..ca957ccc3f 100644 --- a/types/cropperjs/index.d.ts +++ b/types/cropperjs/index.d.ts @@ -86,6 +86,15 @@ declare namespace cropperjs { */ checkCrossOrigin?: boolean; /** + * Check the current image's Exif Orientation information. + * More exactly, read the Orientation value for rotating or flipping the image, and then override the Orientation + * value with 1 (the default value) to avoid some issues (1, 2) on iOS devices. + * Requires to set both the rotatable and scalable options to true at the same time. + * Note: Don't trust this all the time as some JPG images have incorrect (not standard) Orientation values. + * @default true + */ + checkOrientation?: boolean; + /** * Show the black modal above the image and under the crop box. * @default true */ From 9d9aad622f688044f0e94ab64451e53795e27077 Mon Sep 17 00:00:00 2001 From: Gabe Scholz Date: Fri, 19 May 2017 11:44:50 -0700 Subject: [PATCH 0258/1072] Add resolves and rejects matchers from Jest 20 --- types/jest/index.d.ts | 2 ++ types/jest/jest-tests.ts | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/types/jest/index.d.ts b/types/jest/index.d.ts index 36011e67a7..7ac5c7486b 100644 --- a/types/jest/index.d.ts +++ b/types/jest/index.d.ts @@ -178,6 +178,8 @@ declare namespace jest { interface Matchers { /** If you know how to test something, `.not` lets you test its opposite. */ not: Matchers; + resolves: Matchers; + rejects: Matchers; lastCalledWith(...args: any[]): void; /** Checks that a value is what you expect. It uses `===` to check strict equality. Don't use `toBe` with floating-point numbers. */ toBe(expected: any): void; diff --git a/types/jest/jest-tests.ts b/types/jest/jest-tests.ts index d951153842..0605724334 100644 --- a/types/jest/jest-tests.ts +++ b/types/jest/jest-tests.ts @@ -501,3 +501,18 @@ describe('Mocks', function () { anotherIns.testMethod.mockImplementation(() => 1); }); }); + +// https://facebook.github.io/jest/docs/en/expect.html#resolves +describe('resolves', function () { + it('unwraps the expected Promise', function () { + return expect(Promise.resolve('test')).resolves.toEqual('test'); + }); +}); + +// https://facebook.github.io/jest/docs/en/expect.html#rejects +describe('rejects', function () { + it('unwraps the expected Promise', function () { + const error = new Error('error'); + return expect(Promise.reject(error)).rejects.toBeDefined(); + }); +}); \ No newline at end of file From 208b943883cb70c294a3ef631a414c31d1bf42c0 Mon Sep 17 00:00:00 2001 From: Andy Date: Fri, 19 May 2017 13:16:24 -0700 Subject: [PATCH 0259/1072] google-map-react: Remove destructuring in declaration (#16644) --- types/google-map-react/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/google-map-react/index.d.ts b/types/google-map-react/index.d.ts index aedf13e13a..080dbe5762 100644 --- a/types/google-map-react/index.d.ts +++ b/types/google-map-react/index.d.ts @@ -98,7 +98,7 @@ export interface Props { onMapTypeIdChange?(args: any): void; distanceToMouse?(pt: Point, mousePos: Point): void; googleMapLoader?(bootstrapURLKeys: any): void; - onGoogleApiLoaded?({map, maps}: { map: any, maps: any }): void; + onGoogleApiLoaded?(maps: { map: any, maps: any }): void; yesIWantToUseGoogleMapApiInternals?: boolean; } From 1bb55eec1209c1b0fc22193022b8e3a45b7acc15 Mon Sep 17 00:00:00 2001 From: Andy Date: Fri, 19 May 2017 13:43:17 -0700 Subject: [PATCH 0260/1072] stamplay-js-sdk: Remove destructuring in declaration (#16648) --- types/stamplay-js-sdk/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/stamplay-js-sdk/index.d.ts b/types/stamplay-js-sdk/index.d.ts index 8189691a46..6f5d9726c2 100644 --- a/types/stamplay-js-sdk/index.d.ts +++ b/types/stamplay-js-sdk/index.d.ts @@ -9,7 +9,7 @@ declare namespace Stamplay { function Cobject(object: string): StamplayObject; interface Model { - signup({}): Promise; + signup(arg: any): Promise; new(): Model; // This is suspicious, but tests show model instances being constructable... get(property: string): any; set(property: string, value: any): void; From 6246d0d62bc14a1297e2d8ab5f300daf50949937 Mon Sep 17 00:00:00 2001 From: Aluan Haddad Date: Sat, 20 May 2017 10:12:03 -0400 Subject: [PATCH 0261/1072] 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 0262/1072] 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 0263/1072] 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 0264/1072] 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 0265/1072] 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 c1723fcd2148223955e3e4db945bc5eb41a73527 Mon Sep 17 00:00:00 2001 From: Oden Date: Sat, 20 May 2017 13:52:58 -0700 Subject: [PATCH 0266/1072] Add `redux-devtools-extension` to notNeededPackages. --- notNeededPackages.json | 6 + types/redux-devtools-extension/index.d.ts | 146 ------------------ types/redux-devtools-extension/package.json | 5 - .../redux-devtools-extension-tests.ts | 90 ----------- types/redux-devtools-extension/tsconfig.json | 22 --- types/redux-devtools-extension/tslint.json | 1 - 6 files changed, 6 insertions(+), 264 deletions(-) delete mode 100644 types/redux-devtools-extension/index.d.ts delete mode 100644 types/redux-devtools-extension/package.json delete mode 100644 types/redux-devtools-extension/redux-devtools-extension-tests.ts delete mode 100644 types/redux-devtools-extension/tsconfig.json delete mode 100644 types/redux-devtools-extension/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 25205b3c04..c89702a9f6 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -420,6 +420,12 @@ "sourceRepoURL": "https://github.com/tshelburne/redux-batched-actions", "asOfVersion": "0.1.5" }, + { + "libraryName": "redux-devtools-extension", + "typingsPackageName": "redux-devtools-extension", + "sourceRepoURL": "https://github.com/zalmoxisus/redux-devtools-extension", + "asOfVersion": "2.13.2" + }, { "libraryName": "redux-persist", "typingsPackageName": "redux-persist", diff --git a/types/redux-devtools-extension/index.d.ts b/types/redux-devtools-extension/index.d.ts deleted file mode 100644 index 6ef19104c4..0000000000 --- a/types/redux-devtools-extension/index.d.ts +++ /dev/null @@ -1,146 +0,0 @@ -// Type definitions for redux-devtools-extension 2.13 -// Project: https://github.com/zalmoxisus/redux-devtools-extension -// Definitions by: Daniel Perez Alvarez -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -import { - Action, - ActionCreator, - ActionCreatorsMapObject, - GenericStoreEnhancer -} from "redux"; - -export interface ReduxDevToolsSerializeOptions { - /** Serialization mode. */ - options?: any; - /** JSON replacer function used for both actions and states stringify. */ - replacer?(key: any, value: any): any; - /** JSON reviver function used for parsing the imported actions and states. */ - reviver?(key: any, value: any): any; - /** - * Automatically serialize/deserialize Immutable.js via - * `remotedev-serialize`. - */ - immutable?: any; - /** - * Immutable.js `Record` classes used to make possible restore its - * instances back when importing, persisting, etc. - */ - refs?: any[]; -} - -export interface ReduxDevToolsFeaturesOptions { - /** Start/pause recording of dispatched actions */ - pause?: boolean; - /** Lock/unlock dispatching actions and side effects */ - lock?: boolean; - /** Persist states on page reloading */ - persist?: boolean; - /** Export history of actions in a file */ - export?: boolean | 'custom'; - /** Import history of actions from a file */ - import?: boolean | 'custom'; - /** Jump back and forth (time travelling) */ - jump?: boolean; - /** Skip (cancel) actions */ - skip?: boolean; - /** Drag and drop actions in the history list */ - reorder?: boolean; - /** Dispatch custom actions or action creators */ - dispatch?: boolean; - /** Generate tests for the selected actions */ - test?: boolean; -} - -export interface ReduxDevToolsOptions { - /** The instance name to be showed on the monitor page. */ - name?: string; - /** Action creators functions to be available in the dispatcher. */ - actionCreators?: Array> | ActionCreatorsMapObject; - /** - * If more than one action is dispatched in the indicated interval in ms, - * all new actions will be collected and sent at once. It is the joint - * between performance and speed. When set to `0`, all actions will be sent - * instantly. Set it to a higher value when experiencing perf issues (also - * `maxAge` to a lower value). - */ - latency?: number; - /** - * Maximum allowed actions to be stored in the history tree. The oldest - * actions are removed once `maxAge` is reached. It's critical for - * performance. - */ - maxAge?: number; - /** Serialization options. */ - serialize?: ReduxDevToolsSerializeOptions; - /** - * Function which takes `action` object as argument, and should return - * `action` object back. - */ - actionSanitizer?(action: any): any; - /** - * Function which takes `state` object as argument, and should return - * `state` object back. - */ - stateSanitizer?(state: any): any; - /** - * Actions types to be hidden in the monitors (while passed to the - * reducers). If `actionsWhitelist` specified, `actionsBlacklist` is ignored. - */ - actionsBlacklist?: string | string[]; - /** - * Actions types to be shown in the monitors (while passed to the reducers). - * If `actionsWhitelist` specified, `actionsBlacklist` is ignored. - */ - actionsWhitelist?: string | string[]; - /** - * Called for every action before sending, takes `state` and `action` - * object, and returns `true` in case it allows sending the current data to - * the monitor. Use it as a more advanced version of - * `actionsBlacklist`/`actionsWhitelist` parameters. - */ - predicate?(state: any, action: any): boolean; - /** - * If specified as `false`, it will not record the changes till clicking on - * *Start recording* button. Available only for Redux enhancer, for others - * use `autoPause`. - */ - shouldRecordChanges?: boolean; - /** - * If specified, whenever clicking on *Pause recording* button and there are - * actions in the history log, will add this action type. If not specified, - * will commit when paused. Available only for Redux enhancer. - */ - pauseActionType?: string; - /** - * Auto-pauses when the extension’s window is not opened, and so has zero - * impact on your app when not in use. Not available for Redux enhancer (as - * it already does it but storing the data to be sent). - */ - autoPause?: boolean; - /** - * If specified as `true`, it will not allow any non-monitor actions to be - * dispatched till clicking on *Unlock changes* button. Available only for - * Redux enhancer. - */ - shouldStartLocked?: boolean; - /** - * If set to `false`, will not recompute the states on hot reloading (or on - * replacing the reducers). Available only for Redux enhancer. - */ - shouldHotReload?: boolean; - /** - * If specified as `true`, whenever there's an exception in reducers, the - * monitors will show the error message, and next actions will not be - * dispatched. - */ - shouldCatchErrors?: boolean; - /** - * If you want to restrict the extension, just specify the features you - * allow. - */ - features?: ReduxDevToolsFeaturesOptions; -} - -export function composeWithDevTools(options?: ReduxDevToolsOptions): (...funcs: GenericStoreEnhancer[]) => GenericStoreEnhancer; -export function composeWithDevTools(...funcs: GenericStoreEnhancer[]): GenericStoreEnhancer; diff --git a/types/redux-devtools-extension/package.json b/types/redux-devtools-extension/package.json deleted file mode 100644 index 36ce503807..0000000000 --- a/types/redux-devtools-extension/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "dependencies": { - "redux": "^3.6.0" - } -} diff --git a/types/redux-devtools-extension/redux-devtools-extension-tests.ts b/types/redux-devtools-extension/redux-devtools-extension-tests.ts deleted file mode 100644 index 45ac5c2651..0000000000 --- a/types/redux-devtools-extension/redux-devtools-extension-tests.ts +++ /dev/null @@ -1,90 +0,0 @@ -import { - Action, - Middleware, - Reducer, - applyMiddleware, - createStore -} from 'redux'; -import { composeWithDevTools } from 'redux-devtools-extension'; - -const composeEnhancers = composeWithDevTools(); - -const reducer: Reducer<{}> = () => ({}); -const middleware: Middleware[] = []; -const store = createStore(reducer, composeEnhancers( - applyMiddleware(...middleware) -)); - -const store2 = createStore(reducer, composeWithDevTools({ - serialize: { - options: { - undefined: true, - function: (fn: any) => fn.toString() - } - } -})); - -const store3 = createStore(reducer, composeWithDevTools({ - serialize: { - replacer: (key, value) => 'foo' - } -})); - -const store4 = createStore(reducer, composeWithDevTools({ - serialize: { - replacer: (key, value) => 'bar' - } -})); - -const store5 = createStore(reducer, composeWithDevTools({ - serialize: { - reviver: (key, value) => 'baz' - } -})); - -const store6 = createStore(reducer, composeWithDevTools({ - serialize: { - immutable: /* Immutable */ {} - } -})); - -const store7 = createStore(reducer, composeWithDevTools({ - serialize: { - immutable: /* Immutable */ {}, - refs: [/* Record */ {}] - } -})); - -const store8 = createStore(reducer, composeWithDevTools({ - actionSanitizer: (action) => action, - stateSanitizer: (state) => state -})); - -const store9 = createStore(reducer, composeWithDevTools({ - actionsBlacklist: 'SOME_ACTION' -})); - -const store10 = createStore(reducer, composeWithDevTools({ - predicate: (state, action) => state.dev.logLevel === 'VERBOSE' && !action.forwarded -})); - -const store11 = createStore(reducer, composeWithDevTools({ - shouldRecordChanges: true, - pauseActionType: '@@PAUSE', - autoPause: true, - shouldStartLocked: true, - shouldHotReload: true, - shouldCatchErrors: true, - features: { - pause: true, // start/pause recording of dispatched actions - lock: true, // lock/unlock dispatching actions and side effects - persist: true, // persist states on page reloading - export: 'custom', // export history of actions in a file - import: 'custom', // import history of actions from a file - jump: true, // jump back and forth (time travelling) - skip: true, // skip (cancel) actions - reorder: true, // drag and drop actions in the history list - dispatch: true, // dispatch custom actions or action creators - test: true // generate tests for the selected actions - } -})); diff --git a/types/redux-devtools-extension/tsconfig.json b/types/redux-devtools-extension/tsconfig.json deleted file mode 100644 index 6d8d644ea6..0000000000 --- a/types/redux-devtools-extension/tsconfig.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "redux-devtools-extension-tests.ts" - ] -} diff --git a/types/redux-devtools-extension/tslint.json b/types/redux-devtools-extension/tslint.json deleted file mode 100644 index 3db14f85ea..0000000000 --- a/types/redux-devtools-extension/tslint.json +++ /dev/null @@ -1 +0,0 @@ -{ "extends": "dtslint/dt.json" } 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 0267/1072] [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 0c3c2f895262e42fc4e1d14ae26e49a41d146440 Mon Sep 17 00:00:00 2001 From: Tim Baumann Date: Sun, 21 May 2017 18:03:44 +0200 Subject: [PATCH 0268/1072] Update prosemirror-menu to version 0.21 --- types/prosemirror-menu/index.d.ts | 19 ++++++------------- .../prosemirror-menu-tests.ts | 2 +- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/types/prosemirror-menu/index.d.ts b/types/prosemirror-menu/index.d.ts index 4d78e8ce62..e4936130eb 100644 --- a/types/prosemirror-menu/index.d.ts +++ b/types/prosemirror-menu/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for prosemirror-menu 0.18 +// Type definitions for prosemirror-menu 0.21 // Project: https://github.com/ProseMirror/prosemirror-menu // Definitions by: David Hahn // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -8,6 +8,7 @@ import { ProsemirrorNode } from 'prosemirror-model' import { EditorView } from 'prosemirror-view' import { EditorState } from 'prosemirror-state' import { Transaction } from 'prosemirror-state' +import { Plugin } from 'prosemirror-state' import { NodeType } from 'prosemirror-model' import { EditorProps } from 'prosemirror-view' @@ -23,14 +24,14 @@ declare module "prosemirror-menu" { } export interface MenuItemSpec { - run(p1: EditorState, fn: (p: Transaction) => void, p2: EditorView): void + run(p1: EditorState, fn: (p: Transaction) => void, p2: EditorView, ev: Event): void select?(p: EditorState): boolean - onDeselect?: string; + onDeselected?: string; active?(p: EditorState): boolean render?(p: EditorView): Node icon?: Object; label?: string; - title?: string; + title?: string | ((s: EditorState) => string); class: string; css: string; execEvent: string; @@ -55,14 +56,6 @@ declare module "prosemirror-menu" { export function redoItem(p: Object): MenuItem export function wrapItem(nodeType: NodeType, options: Object): MenuItem export function blockTypeItem(nodeType: NodeType, options: Object): MenuItem - export class MenuBarEditorView { - wrapper: Node; - editor: EditorView; - props: EditorProps; - update(props: EditorProps): void - updateState(state: EditorState): void - destroy(): void - - } + export function menuBar(options: { content: MenuElement[][], floating?: boolean }): Plugin } \ No newline at end of file diff --git a/types/prosemirror-menu/prosemirror-menu-tests.ts b/types/prosemirror-menu/prosemirror-menu-tests.ts index 3cd253c94d..0fee71a9cf 100644 --- a/types/prosemirror-menu/prosemirror-menu-tests.ts +++ b/types/prosemirror-menu/prosemirror-menu-tests.ts @@ -1,3 +1,3 @@ import * as menu from 'prosemirror-menu'; -let editorView = new menu.MenuBarEditorView(); \ No newline at end of file +let menuBarPlugin = menu.menuBar({ content: [], floating: false }); \ No newline at end of file From ce0c8389af31fdd110c8cbe9f2a05a9c98e08d55 Mon Sep 17 00:00:00 2001 From: huhuanming Date: Mon, 22 May 2017 00:44:27 +0800 Subject: [PATCH 0269/1072] 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 0270/1072] 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 0271/1072] 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 fa9e655aad0e15f1fe8e5c589b09a8a1834abcfe Mon Sep 17 00:00:00 2001 From: Dolan Date: Mon, 22 May 2017 03:05:00 +0100 Subject: [PATCH 0272/1072] Timer-machine types --- types/timer-machine/index.d.ts | 29 ++++++++++++ types/timer-machine/timer-machine-tests.ts | 54 ++++++++++++++++++++++ types/timer-machine/tsconfig.json | 22 +++++++++ types/timer-machine/tslint.json | 1 + 4 files changed, 106 insertions(+) create mode 100644 types/timer-machine/index.d.ts create mode 100644 types/timer-machine/timer-machine-tests.ts create mode 100644 types/timer-machine/tsconfig.json create mode 100644 types/timer-machine/tslint.json diff --git a/types/timer-machine/index.d.ts b/types/timer-machine/index.d.ts new file mode 100644 index 0000000000..49e63781ed --- /dev/null +++ b/types/timer-machine/index.d.ts @@ -0,0 +1,29 @@ +// Type definitions for timer-machine 1.1 +// Project: https://github.com/brentburg/timer-machine +// Definitions by: Dolan Miu +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export as namespace Timer; +export = Timer; + +declare namespace Timer { + type TimerEvent = "start" | "stop" | "time"; +} + +declare class Timer { + static get(reference: string): Timer; + static destroy(reference: string): Timer; + + constructor(started?: boolean); + + isStarted(): boolean; + isStopped(): boolean; + start(): void; + timeFromStart(): number; + stop(): void; + time(): number; + toggle(): void; + emitTime(): void; + valueOf(): number; + on(event: Timer.TimerEvent, callback?: () => void): void; +} diff --git a/types/timer-machine/timer-machine-tests.ts b/types/timer-machine/timer-machine-tests.ts new file mode 100644 index 0000000000..c9e7096316 --- /dev/null +++ b/types/timer-machine/timer-machine-tests.ts @@ -0,0 +1,54 @@ +import * as Timer from "timer-machine"; + +let myTimer = new Timer(); + +myTimer.start(); +myTimer.stop(); +myTimer.time(); + +Timer.get('my').start(); +Timer.get('my').time(); +Timer.destroy('my'); + +myTimer = Timer.get('my'); + +let timer1 = new Timer(); +timer1.start(); + +let timer2 = new Timer(true); +timer2.start(); + +let timer = new Timer(); +timer.stop(); +timer.start(); +timer.stop(); + +timer = new Timer(); +timer.isStarted(); +timer.toggle(); +timer.isStarted(); +timer.toggle(); +timer.isStarted(); + +timer = new Timer(); +timer.start(); +timer.timeFromStart() === timer.time(); + +timer = new Timer(); +timer.isStarted(); +timer.start(); +timer.isStarted(); + +timer = new Timer(); +timer.isStopped(); +timer.start(); +timer.isStopped(); + +timer.on('start', () => { +}); + +timer.on('stop', () => { +}); + +timer.on('time', () => { +}); diff --git a/types/timer-machine/tsconfig.json b/types/timer-machine/tsconfig.json new file mode 100644 index 0000000000..e29ee58719 --- /dev/null +++ b/types/timer-machine/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", + "timer-machine-tests.ts" + ] +} \ No newline at end of file diff --git a/types/timer-machine/tslint.json b/types/timer-machine/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/timer-machine/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From b8948098f4752d5cf0063bd17dcff3bfe8e2e439 Mon Sep 17 00:00:00 2001 From: Ruben Slabbert Date: Mon, 22 May 2017 12:13:35 +1000 Subject: [PATCH 0273/1072] 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 0274/1072] 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 0275/1072] 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 029457aac4d7a6dd9bbea62017d8ef1cbc9ab50d Mon Sep 17 00:00:00 2001 From: Tom Wanzek Date: Mon, 22 May 2017 10:05:32 -0400 Subject: [PATCH 0276/1072] [d3-path] [Chore] Update validated patch version (#16651) * This PR only updates the last patch version of d3-path this definition was validated against. No other changes necessary. It serves to create a new content hash to trigger publication to `npm/@types` after merge. --- types/d3-path/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/d3-path/index.d.ts b/types/d3-path/index.d.ts index 7315ced2cb..7c0f662018 100644 --- a/types/d3-path/index.d.ts +++ b/types/d3-path/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// Last module patch version validated against: 1.0.3 +// Last module patch version validated against: 1.0.5 /** * A D3 path serializer implementing CanvasPathMethods From 8117819ce704fe73c3ac9f0db5cb9dfbf2b70f01 Mon Sep 17 00:00:00 2001 From: Ragg Date: Sat, 20 May 2017 14:10:04 +0900 Subject: [PATCH 0277/1072] 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 6a7322a32d839131ce0754bac26df5d9455a5239 Mon Sep 17 00:00:00 2001 From: a-k-g Date: Mon, 22 May 2017 16:36:32 +0100 Subject: [PATCH 0278/1072] Add types for SHA1 and SHA256 message digests (#16665) --- types/node-forge/index.d.ts | 18 ++++++++++++++++++ types/node-forge/node-forge-tests.ts | 22 ++++++++++++++++++++-- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/types/node-forge/index.d.ts b/types/node-forge/index.d.ts index 7897158f62..0d53971843 100644 --- a/types/node-forge/index.d.ts +++ b/types/node-forge/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/digitalbazaar/forge // Definitions by: Seth Westphal // Kay Schecker +// Aakash Goenka // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare module "node-forge" { @@ -25,6 +26,7 @@ declare module "node-forge" { function privateKeyToPem(key: Key, maxline?: number): PEM; function publicKeyToPem(key: Key, maxline?: number): PEM; function publicKeyFromPem(pem: PEM): Key; + function privateKeyFromPem(pem: PEM): Key; function certificateToPem(cert: Certificate, maxline?: number): PEM; interface oids { @@ -273,4 +275,20 @@ declare module "node-forge" { function pkcs12FromAsn1(obj: any, strict?: boolean, password?: string) : Pkcs12Pfx; function pkcs12FromAsn1(obj: any, password?: string) : Pkcs12Pfx; } + + namespace md { + + interface MessageDigest { + update(msg: string, encoding?: string): MessageDigest; + digest(): util.ByteStringBuffer; + } + + namespace sha1 { + function create(): MessageDigest; + } + + namespace sha256 { + function create(): MessageDigest; + } + } } diff --git a/types/node-forge/node-forge-tests.ts b/types/node-forge/node-forge-tests.ts index 4815a5dfc5..3d34df3b43 100644 --- a/types/node-forge/node-forge-tests.ts +++ b/types/node-forge/node-forge-tests.ts @@ -5,8 +5,9 @@ let privateKeyPem = forge.pki.privateKeyToPem(keypair.privateKey); let publicKeyPem = forge.pki.publicKeyToPem(keypair.publicKey); let key = forge.pki.decryptRsaPrivateKey(privateKeyPem); let x: string = forge.ssh.privateKeyToOpenSSH(key); -let pemKey: forge.pki.PEM; +let pemKey: forge.pki.PEM = publicKeyPem; let publicKeyRsa = forge.pki.publicKeyFromPem(pemKey); +let privateKeyRsa = forge.pki.privateKeyFromPem(privateKeyPem); { let subjectPublicKeyInfo = forge.asn1.create(forge.asn1.Class.UNIVERSAL, forge.asn1.Type.SEQUENCE, true, [ @@ -67,7 +68,7 @@ if (forge.util.fillString('1', 5) !== '11111') throw Error('forge.util.fillStrin { let src: string; let encode: Uint8Array; - let decode : string; + let decode: string; src = 'Test'; encode = forge.util.text.utf8.encode(src); @@ -78,3 +79,20 @@ if (forge.util.fillString('1', 5) !== '11111') throw Error('forge.util.fillStrin decode = forge.util.text.utf16.decode(encode); if (src !== decode) throw Error('forge.util.text.utf8.encode / decode fail'); } + +{ + let md: forge.md.MessageDigest; + let hex: string; + + md = forge.md.sha256.create(); + md = md.update('Test'); + hex = md.digest().toHex(); + + if (hex.length !== 64) throw Error('forge.md.MessageDigest.update / digest fail'); + + md = forge.md.sha1.create(); + md = md.update('Test'); + hex = md.digest().toHex(); + + if (hex.length !== 40) throw Error('forge.md.MessageDigest.update / digest fail'); +} From 11c8e0986d44179affc172426def2b99cba31147 Mon Sep 17 00:00:00 2001 From: DaVarga Date: Mon, 22 May 2017 18:38:02 +0200 Subject: [PATCH 0279/1072] color: ColorParam can be a number --- types/color/color-tests.ts | 1 + types/color/index.d.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/types/color/color-tests.ts b/types/color/color-tests.ts index 7b1a48a945..2d05e86f05 100644 --- a/types/color/color-tests.ts +++ b/types/color/color-tests.ts @@ -3,6 +3,7 @@ import * as Color from "color" var color: Color.Color = Color("white") var colorOther: Color.Color = Color("black") var colorRGB: Color.Color = Color({ r : 0, g : 0, b : 0 }, "rgb") +var colorInt: Color.Color = Color(0x000000) var hex: string = color.hex() var percent: string = color.percentString() diff --git a/types/color/index.d.ts b/types/color/index.d.ts index 8d6016c7d8..a9fc18f29a 100644 --- a/types/color/index.d.ts +++ b/types/color/index.d.ts @@ -5,7 +5,7 @@ declare namespace Color { - type ColorParam = string | { [param: string]: number }; + type ColorParam = string | { [param: string]: number } | number; type ColorModel = "rgb" | "hsl" | "hsv" | "hwb" | "hcg" | "cmyk" | "xyz" | "lab" | "hex" | "gray" | "keyword"; From 2f931b8761d74733226669dbc24b8636878a5198 Mon Sep 17 00:00:00 2001 From: Jeremy Marzka Date: Mon, 22 May 2017 11:52:42 -0500 Subject: [PATCH 0280/1072] knex: first() should accept the same parameters as select() --- types/knex/index.d.ts | 2 +- types/knex/knex-tests.ts | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/types/knex/index.d.ts b/types/knex/index.d.ts index 16330b4e3a..f8fdb910f1 100644 --- a/types/knex/index.d.ts +++ b/types/knex/index.d.ts @@ -136,7 +136,7 @@ declare namespace Knex { decrement(columnName: string, amount?: number): QueryBuilder; // Others - first(...columns: string[]): QueryBuilder; + first: Select; debug(enabled?: boolean): QueryBuilder; pluck(column: string): QueryBuilder; diff --git a/types/knex/knex-tests.ts b/types/knex/knex-tests.ts index 920b347a70..9e372f29d0 100644 --- a/types/knex/knex-tests.ts +++ b/types/knex/knex-tests.ts @@ -401,6 +401,10 @@ knex.table('users').first('id', 'name').then(function(row) { console.log(row); }); +knex.table('users').first(knex.raw('round(sum(products)) as p')).then(function(row) { + console.log(row); +}); + // Using trx as a query builder: knex.transaction(function(trx) { From 52c064c24eb5b99ef778f7c1c094a903925789cc Mon Sep 17 00:00:00 2001 From: Andy Date: Mon, 22 May 2017 10:02:44 -0700 Subject: [PATCH 0281/1072] fs-extra: Callbacks must be non-optional for Promise overloads to work (#16614) --- types/fs-extra/fs-extra-tests.ts | 6 ++++++ types/fs-extra/index.d.ts | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/types/fs-extra/fs-extra-tests.ts b/types/fs-extra/fs-extra-tests.ts index 005857e48c..f24eaa4b1c 100644 --- a/types/fs-extra/fs-extra-tests.ts +++ b/types/fs-extra/fs-extra-tests.ts @@ -212,3 +212,9 @@ fs.lchmodSync(path, modeNum); fs.lchmodSync(path, modeStr); fs.statSync(path); fs.lstatSync(path); + +// $ExpectType Promise +fs.writeFile("foo.txt", "i am foo", { encoding: "utf-8" }); + +// $ExpectType Promise +fs.mkdtemp("foo"); diff --git a/types/fs-extra/index.d.ts b/types/fs-extra/index.d.ts index 481fbad644..960f2362b9 100644 --- a/types/fs-extra/index.d.ts +++ b/types/fs-extra/index.d.ts @@ -236,8 +236,8 @@ export function write(fd: number, buffer: Buffer, offset: number, length: number export function write(fd: number, data: any, offset: number, encoding?: string): Promise<[number, string]>; export function writeFile(file: string | Buffer | number, data: any, callback: (err: NodeJS.ErrnoException) => void): void; -export function writeFile(file: string | Buffer | number, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; export function writeFile(file: string | Buffer | number, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): Promise; +export function writeFile(file: string | Buffer | number, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback: (err: NodeJS.ErrnoException) => void): void; /** * Asynchronous mkdtemp - Creates a unique temporary directory. Generates six random characters to be appended behind a required prefix to create a unique temporary directory. @@ -245,8 +245,8 @@ export function writeFile(file: string | Buffer | number, data: any, options?: { * @param prefix * @param callback The created folder path is passed as a string to the callback's second parameter. */ -export function mkdtemp(prefix: string, callback?: (err: NodeJS.ErrnoException, folder: string) => void): void; export function mkdtemp(prefix: string): Promise; +export function mkdtemp(prefix: string, callback: (err: NodeJS.ErrnoException, folder: string) => void): void; export interface PathEntry { path: string; From d926bbe9f0b70e571cf988e1975053f2f8c8c865 Mon Sep 17 00:00:00 2001 From: mariajplmiranda Date: Mon, 22 May 2017 18:05:07 +0100 Subject: [PATCH 0282/1072] 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 f4a0d64d1a524d46eb23deec2533d5711a1ac3ef Mon Sep 17 00:00:00 2001 From: iuliust Date: Mon, 22 May 2017 20:57:42 +0200 Subject: [PATCH 0283/1072] fix(index.d.ts) typo replaced 'frictionStuffness' by 'frictionStiffness' --- types/p2/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/p2/index.d.ts b/types/p2/index.d.ts index e9b8b79054..89dda72b9c 100644 --- a/types/p2/index.d.ts +++ b/types/p2/index.d.ts @@ -384,7 +384,7 @@ declare namespace p2 { restitution: number; stiffness: number; relaxation: number; - frictionStuffness: number; + frictionStiffness: number; frictionRelaxation: number; surfaceVelocity: number; contactSkinSize: number; From 9f0275c3931a773debcd2357fe56333493db8444 Mon Sep 17 00:00:00 2001 From: Huw McNamara Date: Mon, 22 May 2017 20:30:14 +0100 Subject: [PATCH 0284/1072] 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 0285/1072] 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 0286/1072] 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 ff37e623c0037e388bb4d9f845e688547ea96361 Mon Sep 17 00:00:00 2001 From: Nate Silva Date: Mon, 22 May 2017 12:37:36 -0700 Subject: [PATCH 0287/1072] Added types for p-settle --- types/p-settle/index.d.ts | 28 ++++++++++++++++++++++++++++ types/p-settle/p-settle-tests.ts | 13 +++++++++++++ types/p-settle/tsconfig.json | 23 +++++++++++++++++++++++ types/p-settle/tslint.json | 1 + 4 files changed, 65 insertions(+) create mode 100644 types/p-settle/index.d.ts create mode 100644 types/p-settle/p-settle-tests.ts create mode 100644 types/p-settle/tsconfig.json create mode 100644 types/p-settle/tslint.json diff --git a/types/p-settle/index.d.ts b/types/p-settle/index.d.ts new file mode 100644 index 0000000000..2445106c0e --- /dev/null +++ b/types/p-settle/index.d.ts @@ -0,0 +1,28 @@ +// Type definitions for p-settle 2.0 +// Project: https://github.com/sindresorhus/p-settle#readme +// Definitions by: Nate Silva +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +interface SettledResult { + isFulfilled: boolean; + isRejected: boolean; + /** If the promise was fulfilled, the resolved value */ + value?: T; + /** If the promise was rejected, the reason */ + reason?: any; +} + +/** + * Returns a Promise that is fulfilled when all promises in `input` are settled. + * + * The fulfilled value is an array of objects with the following properties: + * + * * `isFulfilled` + * * `isRejected` + * * `value` or `reason` (Depending on whether the promise fulfilled or rejected) + * + * @param input + */ +declare function pSettle(input: Iterable>): Array>>; + +export = pSettle; diff --git a/types/p-settle/p-settle-tests.ts b/types/p-settle/p-settle-tests.ts new file mode 100644 index 0000000000..c762d3cc8c --- /dev/null +++ b/types/p-settle/p-settle-tests.ts @@ -0,0 +1,13 @@ +import pSettle = require('p-settle'); + +async function f() { + const promises: Array> = []; + for (let index = 0; index < 10; ++index) { + if (index % 3 === 0) { + promises.push(Promise.reject(new Error('i reject you'))); + } else { + promises.push(Promise.resolve('🦄')); + } + } + const results = await pSettle(promises); +} diff --git a/types/p-settle/tsconfig.json b/types/p-settle/tsconfig.json new file mode 100644 index 0000000000..a83a8b4f49 --- /dev/null +++ b/types/p-settle/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "target": "es6", + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "p-settle-tests.ts" + ] +} diff --git a/types/p-settle/tslint.json b/types/p-settle/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/p-settle/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 940ace74aba9f1eeb1f4b344b6226c7e6a17bdca Mon Sep 17 00:00:00 2001 From: Huw McNamara Date: Mon, 22 May 2017 20:48:58 +0100 Subject: [PATCH 0288/1072] 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 b5ae0602a23b6957be73c78be4ea1ef4bfd4aefd Mon Sep 17 00:00:00 2001 From: Nate Silva Date: Mon, 22 May 2017 13:24:03 -0700 Subject: [PATCH 0289/1072] Corrected return value definition --- types/p-settle/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/p-settle/index.d.ts b/types/p-settle/index.d.ts index 2445106c0e..b61d3d5ea0 100644 --- a/types/p-settle/index.d.ts +++ b/types/p-settle/index.d.ts @@ -23,6 +23,6 @@ interface SettledResult { * * @param input */ -declare function pSettle(input: Iterable>): Array>>; +declare function pSettle(input: Iterable>): Promise>>; export = pSettle; From d357ad09ab8188208c88a4b91d9e4ca41b9db896 Mon Sep 17 00:00:00 2001 From: Nate Silva Date: Mon, 22 May 2017 14:18:54 -0700 Subject: [PATCH 0290/1072] Use the pSettle namespace to export SettledResult --- types/p-settle/index.d.ts | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/types/p-settle/index.d.ts b/types/p-settle/index.d.ts index b61d3d5ea0..26acaccfb1 100644 --- a/types/p-settle/index.d.ts +++ b/types/p-settle/index.d.ts @@ -3,13 +3,15 @@ // Definitions by: Nate Silva // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -interface SettledResult { - isFulfilled: boolean; - isRejected: boolean; - /** If the promise was fulfilled, the resolved value */ - value?: T; - /** If the promise was rejected, the reason */ - reason?: any; +declare namespace pSettle { + interface SettledResult { + isFulfilled: boolean; + isRejected: boolean; + /** If the promise was fulfilled, the resolved value */ + value?: T; + /** If the promise was rejected, the reason */ + reason?: any; + } } /** @@ -23,6 +25,6 @@ interface SettledResult { * * @param input */ -declare function pSettle(input: Iterable>): Promise>>; +declare function pSettle(input: Iterable>): Promise>>; export = pSettle; From c73a5bfa8225086c4760b226094ea5e0142d4718 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Mon, 22 May 2017 15:18:27 -0700 Subject: [PATCH 0291/1072] Fixed overloads for better editing experience. --- types/ramda/index.d.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index d74b8b3e14..0a0a4e6cbb 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -839,7 +839,8 @@ declare namespace R { /** * Returns a lens whose focus is the specified path. - * See also view, set, over. + * See also view(lens: Lens, obj: T): U; + + view(lens: Lens): (obj: T) => U;, set, over. */ lensPath(path: Path): Lens; @@ -1727,8 +1728,8 @@ declare namespace R { * Returns a "view" of the given data structure, determined by the given lens. The lens's focus determines which * portion of the data structure is visible. */ - view(lens: Lens, obj: T): U; view(lens: Lens): (obj: T) => U; + view(lens: Lens, obj: T): U; /** * Tests the final argument by passing it to the given predicate function. If the predicate is satisfied, the function From 144706683f3d4e151003bff43770d80243c97596 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Mon, 22 May 2017 15:20:31 -0700 Subject: [PATCH 0292/1072] Fixed up accidental edit. --- types/ramda/index.d.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index 0a0a4e6cbb..9468024013 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -839,8 +839,7 @@ declare namespace R { /** * Returns a lens whose focus is the specified path. - * See also view(lens: Lens, obj: T): U; - + view(lens: Lens): (obj: T) => U;, set, over. + * See also view, set, over. */ lensPath(path: Path): Lens; From 6ca038a08fe6969ea14308faed8df8f67a987b8e Mon Sep 17 00:00:00 2001 From: Ashish Shubham Date: Mon, 22 May 2017 23:31:00 -0700 Subject: [PATCH 0293/1072] 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 0294/1072] @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 0295/1072] 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 0296/1072] 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 0297/1072] 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 0298/1072] 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 673e4d70ec792560b1173cb7822dcef68b89049e Mon Sep 17 00:00:00 2001 From: Bernd Hacker Date: Tue, 23 May 2017 11:45:51 +0200 Subject: [PATCH 0299/1072] add type definitions for HERE data lens --- types/heredatalens/heredatalens-tests.ts | 136 ++++ types/heredatalens/index.d.ts | 939 +++++++++++++++++++++++ types/heredatalens/tsconfig.json | 22 + types/heredatalens/tslint.json | 3 + 4 files changed, 1100 insertions(+) create mode 100644 types/heredatalens/heredatalens-tests.ts create mode 100644 types/heredatalens/index.d.ts create mode 100644 types/heredatalens/tsconfig.json create mode 100644 types/heredatalens/tslint.json diff --git a/types/heredatalens/heredatalens-tests.ts b/types/heredatalens/heredatalens-tests.ts new file mode 100644 index 0000000000..51fa56b380 --- /dev/null +++ b/types/heredatalens/heredatalens-tests.ts @@ -0,0 +1,136 @@ +/** + * Typescript definition tests for heredatalens + * + * Note: These tests are intended to test the definitions only + * in the sense of typing and call signature consistency. They + * are not intended as functional tests. + */ + +import './index'; + + +let service: H.datalens.Service; +let serviceOptions: H.datalens.Service.Options = { + subDomain: 'sub', + version: 'version', + access_token: 'token', + refresh_token: 'token', + domainSharding: ['a', 'b'], + baseUrl: 'url' +}; + +let queryTileProviderTileParamNames: H.datalens.QueryTileProvider.TileParamNames = { + x: 'x', + y: 'y', + z: 'z' +}; + +let queryTileProviderOptions: H.datalens.QueryTileProvider.Options = { + queryId: 'id', + queryParams: 'params', + tileParamNames: queryTileProviderTileParamNames +}; + +let queryTileProvider = new H.datalens.QueryTileProvider(service, queryTileProviderOptions); +queryTileProvider.setQueryId('some id'); +queryTileProvider.setQueryParams('some params'); +queryTileProvider.setTileParamNames(queryTileProviderTileParamNames); + + +service = new H.datalens.Service(serviceOptions); +service.request('method', 'endpoint', 'params', 'body', function(result) {}, function(error) {}).then(data => {}); +service.fetchQueryData('id', 'params', function(result) {}, function(error) {}).then(data => {}); +service.fetchQueryStats('id', 'query', function(result) {}, function(error) {}).then(data => {}); +service.fetchLayer('name', 'params', function(result) {}, function(error) {}).then(data => {}); +service.fetchLayerTile('name', 1, 2, 3, 'params', function(result) {}, function(error) {}).then(data => {}); +service.setTokens('token', 'refresh_token'); +service.configure('app_id', 'app_code', true, true, new H.service.Url('scheme', 'host')); + + +let provider = new H.datalens.Provider({ columns: ['1', '2'], rows: [[], []]}); +provider.getData(); +provider.setData({ columns: ['3', '4'], rows: [[], []]}); + + +let queryProviderOptions: H.datalens.QueryProvider.Options = { + queryId: 'id', + queryParams: 'params' +}; +let queryProvider = new H.datalens.QueryProvider({ columns: ['1', '2'], rows: [[], []]}, queryProviderOptions); +queryProvider.setQueryId('id'); +queryProvider.setQueryParams('params'); +queryProvider.reload(); +queryProvider.getData(); +queryProvider.setData({ columns: ['3', '4'], rows: [[], []]}); + + +let rasterLayerOptions: H.datalens.RasterLayer.Options = { + dataToRows: (): H.datalens.RasterLayer.Row[] => { return []; }, + rowToTilePoint: (): H.datalens.RasterLayer.TilePoint => { return { x: 1, y: 2 }; }, + buffer: (): number => { return 1; }, + renderTile: () => {} +}; + +let rasterLayer = new H.datalens.RasterLayer(); +rasterLayer.redraw(); + + +let heatmapLayerOptions: H.datalens.HeatmapLayer.Options = { + dataToRows: (): H.datalens.HeatmapLayer.Row[] => { return []; }, + rowToTilePoint: (): H.datalens.HeatmapLayer.TilePoint => { return { x: 1, y: 2, value: 5, count: 5 }; }, + bandwidth: 5, + valueRange: (): number[] => { return []; }, + countRange: (): number[] => { return []; }, + colorScale: (): string => { return '2'; }, + alphaScale: (): number => { return 1; }, + aggregation: H.datalens.HeatmapLayer.Aggregation.SUM, + inputScale: H.datalens.HeatmapLayer.InputScale.LINEAR +}; + +let heatmapLayer = new H.datalens.HeatmapLayer(queryTileProvider, heatmapLayerOptions); +heatmapLayer.getOptionsPerZoom(5); +heatmapLayer.dispose(); +heatmapLayer.redraw(); + + +let objectLayerOptions: H.datalens.ObjectLayer.Options = { + dataToRows: (): H.datalens.ObjectLayer.Row[] => { return []; }, + rowToMapObject: (): H.map.Object => { return new H.map.Object() }, + rowToStyle: (): H.datalens.ObjectLayer.ObjectStyleOptions => { return { icon: new H.map.Icon('x'), style: {}, arrows: {}, zIndex: 1 }; }, + dataDomains: 2, + clustering: { rowToDataPoint: (): H.clustering.DataPoint => { return; }, options: (): H.clustering.Provider.ClusteringOptions => { return {}; } } +} + +let objectLayer = new H.datalens.ObjectLayer(provider, objectLayerOptions); +objectLayer.redraw(); +objectLayer.updateObjectStyle(new H.map.Object, { icon: new H.map.Icon('x'), style: {}, arrows: {}, zIndex: 1 }); + + +let rawDataProviderOptions: H.datalens.RawDataProvider.Options = { + dataUrl: 'url', + dataToFeatures: (): H.datalens.RawDataProvider.Feature[] => { return []; }, + featuresToRows: (): H.datalens.ObjectLayer.Row[] => { return []; } +}; + +let rawDataProvider = new H.datalens.RawDataProvider(rawDataProviderOptions); + + +let spatialTileProviderOptions: H.datalens.SpatialTileProvider.Options = { + layerName: 'name', + queryParams: 'params' +}; + +let spatialProvider: H.datalens.SpatialTileProvider = new H.datalens.SpatialTileProvider(service, spatialTileProviderOptions); + +let spatialLayerOptions: H.datalens.SpatialLayer.Options = { + dataToRows: (): H.datalens.SpatialLayer.Row[] => { return []; }, + rowToSpatialId: (): string => { return 'asd'; }, + featureToSpatialId: (): string => { return 'asd'; }, + rowToStyle: (): any => { return; }, + defaultStyle: (): any => { return; }, + transformFeature: 1 +}; + +let spatialLayer = new H.datalens.SpatialLayer(provider, spatialProvider, spatialLayerOptions); + + diff --git a/types/heredatalens/index.d.ts b/types/heredatalens/index.d.ts new file mode 100644 index 0000000000..9c7c5d910c --- /dev/null +++ b/types/heredatalens/index.d.ts @@ -0,0 +1,939 @@ +// Type definitions for HERE Data Lens API for JavaScript v2.3.0-31 +// Project: https://developer.here.com/ +// Definitions by: Bernd Hacker +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare namespace H { + /** + * Data Lens REST API connector for HERE Maps API + * Data Lens JavaScript API is a module for HERE Maps API. + * It connects Data Lens REST API and provides data-driven styling of data on a map. + */ + namespace datalens { + /** + * HERE Maps API and Data Lens JavaScript API can be used to visualize data from different network sources. + * For each network source type, a service class is required. The service also stores API connection credentials. + * The service instance must be configured with a H.service.Platform instance. + */ + class Service implements H.service.IConfigurable { + /** + * Constructor + * @param options {H.datalens.Service.Options=} - Overrides the configuration from the H.service.Platform instance + */ + constructor(options?: H.datalens.Service.Options); + + /** + * This method makes an HTTP request to the Data Lens REST API. + * It makes any CRUD request (GET, PUT, POST, DELETE). + * This method can be used when implementing a custom provider or implementing data management. + * Otherwise existing providers are used to get data from the Data Lens REST API. + * @param method {string} - Any HTTP method (GET, PUT, POST, etc.) + * @param endpoint {string} - The REST API endpoint + * @param params {any=} - URL parameters + * @param body {any=} - The payload of the request + * @param onResult {function(any)=} - Callback called on a successful request with response data + * @param onError {function(Error)=} - Callback called on an unsuccessful request with the Error object + * @returns {Promise} - Response Promise + */ + request(method: string, endpoint: string, params?: any, body?: any, onResult?: (result: any) => void, onError?: (error: any) => void): Promise; + + /** + * This method fetches query data for a given query ID. + * This method can be used when implementing a custom provider. + * Otherwise existing providers are used to get data from the Data Lens REST API. + * @param queryId {string} - The ID of the Data Lens REST API query + * @param params {any=} - Query dynamic parameters + * @param onResult {function(any)=} - Callback called on a successful request with response data + * @param onError {function(Error)=} - Callback called on an unsuccessful request with the Error object + * @returns {Promise} - Response Promise + */ + fetchQueryData(queryId: string, params?: any, onResult?: (result: any) => void, onError?: (error: any) => void): Promise; + + /** + * This method fetches statistical data for the Data Lens query (eg minimum and maximum values for the query metric). + * It can be used to define visualization boundaries, scales and legends. + * @param queryId {string} - The ID of the Data Lens REST API query + * @param statsQuery {any} - A JSON object which defines a statistics query for the Data Lens query + * @param onResult {function(any)=} - Callback called on a successful request with response data + * @param onError {function(Error)=} - Callback called on an unsuccessful request with the Error object + * @returns {Promise} - Response Promise + */ + fetchQueryStats(queryId: string, statsQuery: any, onResult?: (result: any) => void, onError?: (error: any) => void): Promise; + + /** + * This method fetches a layer of geometries (eg buildings or administrative boundaries). + * @param layerName {string} - The name of the layer + * @param params {any=} - URL parameters (eg bounding box) + * @param onResult {function(any)=} - Callback called on a successful request with response data + * @param onError {function(Error)=} - Callback called on an unsuccessful request with the Error object + * @returns {Promise} - Response Promise + */ + fetchLayer(layerName: string, params?: any, onResult?: (result: any) => void, onError?: (error: any) => void): Promise; + + /** + * This method fetches vector tile data from the layer. + * @param layerName {string} + * @param x {H.datalens.QueryTileProvider.X} - Tile columns + * @param y {H.datalens.QueryTileProvider.Y} - Tile row + * @param z {H.datalens.QueryTileProvider.Zoom} - zoom level + * @param params {any=} - URL parameters (eg bounding box) + * @param onResult {function(any)=} - Callback called on a successful request with response data + * @param onError {function(Error)=} - Callback called on an unsuccessful request with the Error object + * @returns {Promise} - Typed array with tile data + */ + fetchLayerTile(layerName: string, x: H.datalens.QueryTileProvider.X, y: H.datalens.QueryTileProvider.Y, z: H.datalens.QueryTileProvider.Zoom, + params?: any, onResult?: (result: any) => void, onError?: (error: any) => void): Promise; + + /** + * Sets the access and refresh tokens used to authenticate all requests against the Data Lens REST API. + * Use this method to implement custom authentication to the Data Lens REST API. + * @param accessToken {string} - The token used to authenticate all requests + * @param refreshToken {string} - The token used to fetch a new access token after the previous access token has expired. + * When refreshToken is provided, Service will automatically update the expired accessToken. + */ + setTokens(accessToken: string, refreshToken: string): void; + + /** + * This method implements H.service.IConfigurable interface. It is called by the H.service.Platform instance. + * @param appId {string} - The appId + * @param appCode {string} - The appCode + * @param useHTTPS {boolean} - A flag to use HTTPS or not + * @param useCIT {boolean} - A flag to use the staging server (CIT) or not + * @param baseUrl {H.service.Url=} - The base URL for all requests to the Data Lens REST API + * @returns {H.datalens.Service} + */ + configure(appId: string, appCode: string, useHTTPS: boolean, useCIT: boolean, baseUrl?: H.service.Url): H.datalens.Service; + } + + namespace Service { + /** + * Overrides the H.datalens.Service configuration + * Normally the H.datalens.Service instance is configured with the H.service.Platform instance. + * This configuration can be overridden by specifying these options. + * It can be useful when the Data Lens environment is different from the HERE Platform environment. + * @property subDomain {string=} - Subdomain of the Data Lens REST API URL + * @property version {string=} - Pathname prefix of the Data Lens REST API endpoints + * @property access_token {string=} - The token used to authenticate all requests + * @property refresh_token {string=} - The token used to fetch a new access token after the previous access token has expired. + * When refresh_token is provided, Service will automatically update the expired access_token. + * @property domainSharding {string[]=} - To increase the number of simultaneous requests to the Data Lens REST API, domain sharding is used. + * This option can be used when the Data Lens environment does not support domain sharding. + * @property baseUrl {string=} - Defines an alternative host for the Data Lens REST API URL + */ + interface Options { + subDomain?: string; + version?: string; + access_token?: string; + refresh_token?: string; + domainSharding?: string[]; + baseUrl?: string; + } + + /** + * The format of Data Lens query data. + * The Data Lens query data has a table-like structure with named columns and rows. + * @property columns {string[]} - Column names + * @property rows {Array} - Rows of data + */ + interface Data { + columns: string[]; + rows: [any[]]; // rows : { Array. } + } + } + + /** + * Providers define interfaces for layers to access data. + * The input data can be stored locally or loaded from the network. Data can be loaded by tiles or in one chunk. + * This provider allows you to supply data stored locally or fetched using external tools. + */ + class Provider extends H.map.provider.Provider { + /** + * Constructor + * @param data {H.datalens.Service.Data=} - JSON object + * @param options {H.map.provider.Provider.Options=} - Configures data accessibility parameters + */ + constructor(data?: H.datalens.Service.Data, options?: H.map.provider.Provider.Options); + + /** + * Updates the provider data. When data is updated, the update event is triggered so that the consuming layers are redrawn. + * @param data {H.datalens.Service.Data} - JSON object + */ + setData(data: H.datalens.Service.Data): void; + + /** + * Retrieves the provider data. + * @returns {H.datalens.Service.Data} - JSON object + */ + getData(): H.datalens.Service.Data; + } + + /** + * Defines the source of the data for layers from a Data Lens query. + * Providers define interfaces for layers to access data. The input data can be stored locally or loaded from the network. + * Data can be loaded by tiles or in one chunk. This provider loads query data with the Data Lens REST API. + * Note that this provider must be used only for non-tiled queries. + */ + class QueryProvider extends H.datalens.Provider { + /** + * Constructor + * @param service {H.datalens.Service} - Data Lens REST API service + * @param options {H.datalens.QueryProvider.Options=} - Configures source query and data accessibility parameters + */ + constructor(data: H.datalens.Service.Data, options?: H.map.provider.Provider.Options); + + /** + * Updates the query ID to be used in the next call of the Data Lens REST API. + * Note that new data will be fetched only after the reload method is called. + * @param queryId {string} + */ + setQueryId(queryId: string): void; + + /** + * Updates the query's dynamic parameters to be used in the next call of the Data Lens REST API. + * Note that new data will be fetched only after the reload method is called. + * This method is normally used when updating your visualization. + * @param queryParams {any|null} - Query dynamic parameters + */ + setQueryParams(queryParams: any|null): void; + + /** + * Fetches new data from the Data Lens REST API. + * When data is fetched, the update event is triggered so that the consuming layers are redrawn. + */ + reload(): void; + + /** + * Updates the provider data. + * When data is updated, the update event is triggered so that the consuming layers are redrawn. + * @param data {H.datalens.Service.Data} - JSON object + */ + setData(data: H.datalens.Service.Data): void; + + /** + * Retrieves the provider data. + * @returns {H.datalens.Service.Data} - JSON object + */ + getData(): H.datalens.Service.Data; + } + + namespace QueryProvider { + /** + * Configures source query and data accessibility parameters for H.datalens.QueryProvider + * Specifies the query credentials and dynamic parameters required for fetching query data with the Data Lens REST API. Other options from H.datalens.Provider.Options are available. + * @property queryId {string} - The ID of the Data Lens REST API query + * @property queryParams {any=} - The query's dynamic parameters. The dynamic parameters can be used to filter data provided by the query. + */ + interface Options { + queryId: string; + queryParams?: any; + } + } + + /** + * Providers define interfaces for layers to access data. + * The input data can be stored locally or loaded from the network. Data can be loaded by tiles or in one chunk. + * This provider loads tiled query data with the Data Lens REST API. Tiled queries are used to load data only for the current viewport. + * This optimizes memory and network usage and enables progressive rendering. + */ + class QueryTileProvider extends H.map.provider.RemoteTileProvider { + /** + * Constructor + * @param service {H.datalens.Service} - Data Lens REST API service + * @param options {H.datalens.QueryTileProvider.Options} - Configures source query and data accessibility parameters + */ + constructor(service: H.datalens.Service, options: H.datalens.QueryTileProvider.Options); + + /** + * Updates the query ID to be used in the next call of the Data Lens REST API. + * Note that new data will be fetched only after the reload method is called. + * @param queryId {string} + */ + setQueryId(queryId: string): void; + + /** + * Updates the query's dynamic parameters to be used in the next call of the Data Lens REST API. + * Note that new data will be fetched only after the reload method is called. This method is normally used when updating your visualization. + * @param queryParams {any|null} + */ + setQueryParams(queryParams: any|null): void; + + /** + * Updates the names of the dynamic parameters that defines tiles. This method is only needed when the query ID is updated. + * Note that new data will be fetched only after the reload method is called. + * @param tileParamNames {H.datalens.QueryTileProvider.TileParamNames} - Names of the URI parameters that control the x/y/z of a tiled query + */ + setTileParamNames(tileParamNames: H.datalens.QueryTileProvider.TileParamNames): void; + } + + namespace QueryTileProvider { + /** + * Represents the names of the URI parameters that control the x/y/z of tiled query. + * When defining the Data Lens query, dynamic parameters that control tiling can be arbitrarily named. + * Names of these parameters must be specified to fetch tiles. + * @property x {string} - Name of the dynamic parameter that defines tile column + * @property y {string} - Name of the dynamic parameter that defines tile row + * @property z {string} - Name of the dynamic parameter that defines zoom level + */ + interface TileParamNames { + x: string; + y: string; + z: string; + } + + /** + * Configures source query and data accessibility parameters for H.datalens.QueryTileProvider + * Specifies the query credentials and dynamic parameters required for fetching tiled query data with the Data Lens REST API. + * Other options from H.datalens.Provider.Options are available. + * @property tileParamNames {H.datalens.QueryTileProvider.TileParamNames=} - Names of the URI parameters that control the x/y/z of a tiled query + * @property queryId {string} - The ID for the Data Lens REST API query + * @property queryParams {any=} - The query's dynamic parameters. The dynamic parameters can be used to filter data provided by the query. + */ + interface Options { + tileParamNames: H.datalens.QueryTileProvider.TileParamNames; + queryId: string; + queryParams?: string; + } + + /** + * Tile X coordinate (column) + * Coordinate in XYZ tile numbering scheme. + */ + type X = number; + + /** + * Tile Y coordinate (row) + * Coordinate in XYZ tile numbering scheme. + */ + type Y = number; + + /** + * Zoom level + * Coordinate in XYZ tile numbering scheme. May vary within range 1 to 20. + */ + type Zoom = number; + } + + /** + * Provides pixel-wise rendering of data. + * Layer used when you need to visualize more than 10k points. The layer requires source data to be located in pixel coordinates. + * The rendering is implemented by drawing directly on a canvas. The layer is often used together with a Data Lens query which groups rows by pixels. + * This reduces the amount of data delivered to the client. + */ + class RasterLayer extends H.map.layer.TileLayer { + /** + * Constructor + */ + constructor(); + + /** + * Default value for dataToRows callback option. + * It represents each row as an object where property names correspond to data column names. + */ + static defaultDataToRows: any; + + /** + * Force re-rendering of the layer. + * In the case where the callbacks passed to the layer options are not pure functions, you can call this method to force re-rendering. + */ + redraw(): void; + + /** + * This is a default implementation of renderTile callback. This method represents each point as a black 1x1 pixel square. + * @param points {Array} - Input data points within a tile + * @param canvas {HTMLCanvasElement} - The target canvas + */ + static defaultRenderTile(points: H.datalens.RasterLayer.TilePoint[], canvas: HTMLCanvasElement): void; + } + + namespace RasterLayer { + /** + * Defines data processing and rendering options for RasterLayer. + * The initial step of rendering is to split the tile data by rows, where each row represents a bucket. + * By default this step is processed with H.datalens.RasterLayer.defaultDataToRows. + * This behavior can be changed by defining the dataToRows callback. + * To collect the rows for a tile including buffer, the rows must be translated to H.datalens.RasterLayer.TilePoint. + * This translation must be specified with the rowToTilePoint callback. The final rendering on the tile canvas must be defined in renderTile. + * @property dataToRows {function(H.datalens.Service.Data, H.datalens.QueryTileProvider.X, H.datalens.QueryTileProvider.Y, H.datalens.QueryTileProvider.Zoom)=} - + * Defines how the input tile data is split by rows. You can specify this callback to define client-side aggregation and filtering. This callback is called for each tile. + * @property rowToTilePoint {function(H.datalens.RasterLayer.Row, H.datalens.RasterLayer.X, H.datalens.RasterLayer.Y)=} - + * Defines how the row is translated to the H.datalens.RasterLayer.TilePoint. This callback is called for each row that is returned from dataToRows. + * @property buffer {function(H.datalens.QueryTileProvider.Zoom)=} - Defines the buffer as a function of the zoom level. + * The buffer is a value (in pixels) that defines an extra area around each tile to capture data points from. + * This is done to avoid drawing edges between tiles. For example, if data points represented with circles with a maximum radius of 10 pixels, then the buffer must be 10 pixels. + * @property renderTile {function(Array, HTMLCanvasElement, H.datalens.QueryTileProvider.Zoom)=} - + * Defines how tile data is represented on a canvas. Input points for each tile are collected with respect to the buffer. + * For progressive rendering this callback may be called more than once for the tile. + */ + interface Options { + dataToRows?(data: H.datalens.Service.Data, x: H.datalens.QueryTileProvider.X, y: H.datalens.QueryTileProvider.Y, zoom: H.datalens.QueryTileProvider.Zoom): + H.datalens.RasterLayer.Row[]; + rowToTilePoint?(row: H.datalens.RasterLayer.Row, x: H.datalens.RasterLayer.X, y: H.datalens.RasterLayer.Y): H.datalens.RasterLayer.TilePoint; + buffer?(zoom: H.datalens.QueryTileProvider.Zoom): number; + renderTile?(points: H.datalens.RasterLayer.TilePoint[], canvas: HTMLCanvasElement, zoom: H.datalens.QueryTileProvider.Zoom): void; + } + + /** + * Defines the input data format for heat map rendering. + * To collect data rows for each tile with respect to the buffer, each row must be represented as a point within the map tile. + * @property x {number} - Row relative to tile + * @property y {number} - Column relative to tile + * @property data {H.datalens.RasterLayer.Row=} - Reference to source data row + */ + interface TilePoint { + x: number; + y: number; + data?: H.datalens.RasterLayer.Row; + } + + /** + * Tile X coordinate (column) + * Coordinate in XYZ tile numbering scheme. + */ + type X = number; + + /** + * Tile Y coordinate (row) + * Coordinate in XYZ tile numbering scheme. + */ + type Y = number; + + /** + * Slice of data (eg Data Lens query data row) that represents a data point. + * Each row is transformed into TilePoint and passed to renderTile callback. By default each row is an Object where property names correspond to data column names. + * This representation can be changed with the dataToRows callback. + */ + type Row = number; + } + + /** + * Provides functionality of value-based heat map with density alpha mask. + * Layer support different types of blending, including weighted average. Also it allows to apply alpha mask calculated by density. + * In most cases, the layer consumes data grouped by 1x1 pixels buckets. For proper averaging it requires aggregated value and count (number of rows in bucket) for each bucket. + * Blending of buckets is implemented via kernel density estimation (KDE) with a Gaussian kernel. + */ + class HeatmapLayer extends H.datalens.RasterLayer { + /** + * Constructor + * @param provider {H.datalens.QueryTileProvider} - Source of tiled data + * @param options {H.datalens.HeatmapLayer.Options} - Configuration for data processing and rendering + */ + constructor(provider: H.datalens.QueryTileProvider, options: H.datalens.HeatmapLayer.Options); + + /** + * Default value for dataToRows callback option. It represents each row as an object where property names correspond to data column names. + * @param data {H.datalens.Service.Data} + * @param x {H.datalens.QueryTileProvider.X} + * @param y {H.datalens.QueryTileProvider.Y} + * @param zoom {H.datalens.QueryTileProvider.Zoom} + * @returns {Array} + */ + static defaultDataToRows: (data: H.datalens.Service.Data, x: H.datalens.QueryTileProvider.X, y: H.datalens.QueryTileProvider.Y, zoom: H.datalens.QueryTileProvider.Zoom) => + H.datalens.HeatmapLayer.Row[]; + + /** + * Set of possible values for the inputScale option + * @type {H.datalens.HeatmapLayer.InputScale} + */ + static inputScale: H.datalens.HeatmapLayer.InputScale; + + /** + * Set of possible values for the aggregation option + * @type {H.datalens.HeatmapLayer.Aggregation} + */ + static aggregation: H.datalens.HeatmapLayer.Aggregation; + + /** + * @param zoom {number} - zoom level + * @return {H.datalens.HeatmapLayer.Options} + */ + getOptionsPerZoom(zoom: number): H.datalens.HeatmapLayer.Options; + + /** + * Removes listeners, and references to memory consuming objects, from this layer. Call this method when you no longer need the layer. + */ + dispose(): void; + + /** + * Force re-rendering of the layer. In the case where the callbacks passed to the layer options are not pure functions, you can call this method to force re-rendering. + */ + redraw(): void; + } + + namespace HeatmapLayer { + /** + * Defines data processing and rendering options for HeatmapLayer. + * The data processing flow of HeatmapLayer is similar to RasterLayer. The initial step of rendering is to split the tile data by rows, where each row represents a bucket. + * By default this step is processed with H.datalens.HeatmapLayer.defaultDataToRows. This behavior can be changed by defining the dataToRows callback. + * To collect the rows for a tile including buffer, the rows must be translated to H.datalens.HeatmapLayer.TilePoint. This translation must be specified with the rowToTilePoint callback. + * Other options define the blending options for the heat map. + * @property dataToRows {function(H.datalens.Service.Data, H.datalens.QueryTileProvider.X, H.datalens.QueryTileProvider.Y, H.datalens.QueryTileProvider.Zoom)=} - + * Defines how the input tile data is split by rows. You can specify this callback to define client-side aggregation and filtering. This callback is called for each tile. + * @property rowToTilePoint {function(H.datalens.HeatmapLayer.Row, H.datalens.HeatmapLayer.X, H.datalens.HeatmapLayer.Y)=} - + * Defines how the row is translated to the H.datalens.HeatmapLayer.TilePoint. This callback is called for each row that is returned from dataToRows. + * @property bandwidth {H.datalens.HeatmapLayer~Bandwidth | H.datalens.HeatmapLayer~BandwidthStop | Array. | + * H.datalens.HeatmapLayer~BandwidthCallback=} - Describes the bandwidth behavior in relation to current zoom level A numeric value sets it static across all levels + * An Object with zoom, value and optional zoomIncrementFactor (1 equals doubling on every zoom increment) defines a behavior across all zoom levels + * An Array of one or more zoom, value objects describes the behavior between the two defined levels and extrapolates the implied change outside of the defined range + * Alternatively defines the level of smoothing as a function of the zoom level. The callback must return a value in pixels. + * The cut-off of the Gaussian kernel is defined as 3 * bandwidth , a multiple (default 3) of bandwidth. + * @property valueRange {function(H.datalens.QueryTileProvider.Zoom)} - Defines the range for the color scale as a function of the zoom level. + * The returned value must be an array of 2 numbers. + * @property countRange {function(H.datalens.QueryTileProvider.Zoom)} - Defines the range for the density alpha mask as a function of the zoom level. + * When defined, the density alpha mask is applied. The returned value must be an array of 2 numbers. + * @property colorScale {function(number)} - Defines a color palette as a function of the normalized value. You can use D3.js library scale functions with the domain [0, 1]. + * @property alphaScale {function(number)} - Defines the alpha mask value as a function of the normalized count. + * You can use D3.js library scale functions with the domain [0, 1] and the range [0, 1]. + * @property aggregation {H.datalens.HeatmapLayer.Aggregation} - Specifies which type of aggregation was applied (eg. type of aggregation function for bucket in the Data Lens query). + * Possible values are SUM or AVERAGE. If the aggregation type is AVERAGE , then an averaged heat map is rendered. + * @property inputScale {H.datalens.HeatmapLayer.InputScale} - Defines the scale (eg logarithmic scale) of the TilePoint value. + * Note: if the value is not in a linear scale, then the aggregation in the source query must be defined with respect to the scale type. + * For example, before applying the average aggregation function in a query, the value must be transformed to the linear scale. This guarantees correct linear averaging of values. + */ + interface Options { + dataToRows?(data: H.datalens.Service.Data, x: H.datalens.QueryTileProvider.X, y: H.datalens.QueryTileProvider.Y, zoom: H.datalens.QueryTileProvider.Zoom): + H.datalens.HeatmapLayer.Row[]; + rowToTilePoint(row: H.datalens.HeatmapLayer.Row, x: H.datalens.HeatmapLayer.X, y: H.datalens.HeatmapLayer.Y): H.datalens.HeatmapLayer.TilePoint; + bandwidth?: H.datalens.HeatmapLayer.Bandwidth | H.datalens.HeatmapLayer.BandwidthStop | H.datalens.HeatmapLayer.BandwidthStop[] | H.datalens.HeatmapLayer.BandwidthCallback; + valueRange?(zoom: H.datalens.QueryTileProvider.Zoom): number[]; + countRange?(zoom: H.datalens.QueryTileProvider.Zoom): number[]; + colorScale?(scale: number): string; + alphaScale?(scale: number): number; + aggregation?: H.datalens.HeatmapLayer.Aggregation; + inputScale?: H.datalens.HeatmapLayer.InputScale; + } + + /** + * Tile X coordinate (column) + * Coordinate in XYZ tile numbering scheme. + */ + type X = number; + + /** + * Tile Y coordinate (row) + * Coordinate in XYZ tile numbering scheme. + */ + type Y = number; + + /** + * Slice of data (eg Data Lens query data row) that represents a data point. + * Each row is transformed into TilePoint and then rendered on a heat map. By default each row is an Object where property names correspond to data column names. + * This representation can be changed with the dataToRows callback. + */ + type Row = number; + + /** + * Defines a constant for the bandwidth + * A number that sets a constant for the bandwidth across all zoom levels. + */ + type Bandwidth = number; + + /** + * Sets the bandwidth for a given zoom level and uses this to calculate the increment or decrement of the bandwidth at other zoom levels + * This object defines the behavior of the bandwidth value across all zoom levels, initialized by a reference zoom level and its value at that level. + * The default behavior with zoomIncrementFactor = 1 doubles the bandwidth with every increasing zoom level and halves it on every decrease in zoom level. + * For example, a bandwidth of 10@zoom1 turns to 20@zoom2 and 5@zoom0. A zoomIncrementFactor of 0 effectively equals the bandwidth number, ignoring the provided zoom level. + * A zoomIncrementFactor of 0.5 mean a bandwidth increase of 50% compared to a factor of 1. So a bandwidth of 10@zoom1 computes to 15@zoom2. + */ + interface BandwidthStop { + zoom: number; + value: number; + zoomIncrementFactor?: number; + } + + /** + * TODO: this is missing in the documentation: https://developer.here.com/visualization/documentation/datalens/h-datalens-heatmaplayer-options.html + */ + type BandwidthCallback = () => void; + + /** + * Defines the input data format for heat map rendering. + * For heat map rendering, each row of data must be represented as a point within the map tile. + * @property x {number} - Row relative to tile + * @property y {number} - Column relative to tile + * @property value {number} - Value at the point (eg aggregated bucket value) + * @property count {number} - Number of contributors to the value at the point (eg number of rows in a bucket) + * @property data {H.datalens.HeatmapLayer.Row} - Reference to source data row + */ + interface TilePoint { + x: number; + y: number; + value: number; + count: number; + data?: H.datalens.HeatmapLayer.Row; + } + + /** + * Set of possible values for the aggregation option. + * If the heat map input data is buckets, then different types of aggregation can be applied to the rows in a bucket. + * The aggregation type is required for proper blending mode of the heat map. For the AVERAGE aggregation type, an averaged heat map is rendered. + * @property SUM {string} - Specifies that the sum aggregation was applied to the bucket value + * @property AVERAGE {string} - Specifies that the average aggregation was applied to the bucket value + */ + enum Aggregation { + SUM, + AVERAGE + } + + /** + * Set of possible values for the inputScale option. + * The input scale is required for proper heat map blending. If the input scale is not linear, then the TilePoint.value is converted to linear scale before calculating the sum or average. + * @property DB {string} - Decibel (dB) scale + * @property LINEAR {string} - Linear scale + * @property LOG {string} - Logarithmic scale + */ + enum InputScale { + DB, + LINEAR, + LOG + } + } + + /** + * Presents data as points or spatial map objects with data-driven styles and client-side clustering. + * Applicable for drawing interactive map objects like markers, polygons, circles and other instances of H.map.Object. Source of data can be either tiled or not tiled. + * Styles for objects can be parametrized with data rows and zoom level. Allows to create data-driven icons for markers like donuts or bars. + * Also enables clustering and data domains for visualizing up to 100k points or more. + */ + class ObjectLayer extends H.map.layer.ObjectLayer { + /** + * Constructor + * @param provider {H.map.provider.RemoteTileProvider | H.datalens.Provider | H.datalens.QueryProvider | H.datalens.QueryTileProvider} - Data source (tiled or not) + * @param options {H.datalens.ObjectLayer.Options} - Defines data processing, clustering and data-driven styling + */ + constructor(provider: H.map.provider.RemoteTileProvider | H.datalens.Provider | H.datalens.QueryProvider | H.datalens.QueryTileProvider, options: H.datalens.ObjectLayer.Options); + + /** + * Default value for dataToRows callback option. It represents each row as an object where property names correspond to data column names. + * @property data {H.datalens.Service.Data} + * @returns {Array} + */ + static defaultDataToRows(data: H.datalens.Service.Data): H.datalens.ObjectLayer.Row[]; + + /** + * A factory method for data-driven icons. The method allows you to build an icon from SVG markup or JsonML object. Provides caching of icons with the same markup. + * @param svg {string | Array} - SVG presented as markup or JsonML Array + * @param options {H.map.Icon.Options} - Icon options (eg size and anchor). Note that the default anchor is in the middle. + * @param options.size {H.math.ISize | number} - When the icon is a square, you can define the size as a number in pixels + * @returns {H.map.Icon} - Icon which can be used for marker or cluster + */ + static createIcon(svg: string | any[], options?: H.map.Icon.Options): H.map.Icon; + + /** + * Returns cache of icons created with the createIcon method. Can be used to clean the icon cache. + * @return {H.util.Cache} - Icon cache + */ + static getIconCache(): H.util.Cache; + + /** + * Force re-rendering of the layer. In the case where the callbacks passed to the layer options are not pure functions, you can call this method to force re-rendering. + */ + redraw(): void; + + /** + * Recalculates the style and applies it to the map object based on the new StyleState + * @param object {H.map.Object} - Map object + * @param state {H.datalens.ObjectLayer.StyleState} - New state + */ + updateObjectStyle(any: H.map.Object, state: H.datalens.ObjectLayer.StyleState): void; + } + + namespace ObjectLayer { + /** + * Defines data processing and data-driven styling for ObjectLayer + * The initial step of rendering is to split the tile data by rows, where each row represents a bucket. + * By default this step is processed with H.datalens.ObjectLayer.defaultDataToRows. This behavior can be changed by defining the dataToRows callback. + * In the next step each row must be presented as a map object with the rowToMapObject callback. Data-driven styling can be provided with the rowToStyle callback. + * @property dataToRows {function(H.datalens.Service.Data)=} - Defines how the input data is split by rows. You can specify this callback to define client-side aggregation and filtering. + * @property rowToMapObject {function(H.datalens.ObjectLayer.Row, H.datalens.QueryTileProvider.Zoom)} - Defines how each row is presented on the map (eg marker, polygon) + * @property rowToStyle {function(H.datalens.ObjectLayer.Row, H.datalens.QueryTileProvider.Zoom, H.datalens.ObjectLayer.StyleState)=} - + * Defines map object style and icon according to data row and zoom level. Also it can define different styles depending on the StyleState (eg hovered, selected). + * @property dataDomains {H.datalens.ObjectLayer.DataDomains=} - Defines quantization of data for improving data-driven styling performance + * @property clustering {H.datalens.ObjectLayer.Clustering=} - When present, client-side clustering is applied + */ + interface Options { + dataToRows?(data: H.datalens.Service.Data): H.datalens.ObjectLayer.Row[]; + rowToMapObject(row: H.datalens.ObjectLayer.Row, z: H.datalens.QueryTileProvider.Zoom): H.map.Object; + rowToStyle?(row: H.datalens.ObjectLayer.Row, z: H.datalens.QueryTileProvider.Zoom, styleState: H.datalens.ObjectLayer.StyleState): H.datalens.ObjectLayer.ObjectStyleOptions; + dataDomains?: H.datalens.ObjectLayer.DataDomains; + clustering?: H.datalens.ObjectLayer.Clustering; + } + + /** + * Defines client-side clustering in the ObjectLayer. + * When the clustering option is provided, rows returned from dataToRows go to the clustering.rowToDataPoint callback to be transformed to data points. + * Then, the data points are clustered according to clustering.options. Clustering produces clusters and noise points (data points that are not clustered). + * Clusters and noise points must be presented as map objects with the rowToMapObject callback and can be styled with the rowToStyle callback. + * @property rowToDataPoint {H.datalens.ObjectLayer.Row} - Defines data points from rows + * @property options {function(H.datalens.QueryTileProvider.Zoom)} - Defines clustering options as a function of the zoom level + */ + interface Clustering { + rowToDataPoint(row: H.datalens.ObjectLayer.Row): H.clustering.DataPoint; + options(zoom: H.datalens.QueryTileProvider.Zoom): H.clustering.Provider.ClusteringOptions; + } + + /** + * Slice of data (eg Data Lens query data row) that represents a data point. + * Each row is translated to map objects with the rowToMapObject callback. By default each row is an Object where property names correspond to data column names. + * This representation can be changed with the dataToRows callback. + */ + type Row = number; + + /** + * User defined modification of a data-driven style + * StyleState appears as a parameter in the rowToStyle callback. By default it is 'DEFAULT_STATE'. To change StyleState, use the ObjectLayer.updateObjectStyle method. + */ + type StyleState = any; + + /** + * Output from the rowToStyle callback. + * Defines the styles or the icon that is applied to the map object. + * @property icon {H.map.Icon} - Marker icon + * @property style {H.map.SpatialStyle.Options} - Spatial style + * @property arrows {H.map.ArrowStyle.Options} - Style of arrows to render along a polyline + * @property zIndex {number} - The z-index value of the map object, default is 0 + */ + interface ObjectStyleOptions { + icon: H.map.Icon; + style: H.map.SpatialStyle.Options; + arrows: H.map.ArrowStyle.Options; + zIndex: number; + } + + /** + * Input data quantization domain, used to optimize styling performance. + * The option must have properties corresponding to the properties of H.datalens.ObjectLayer.Row. Values must be represented as an Array of Numbers that defines the quantization domain. + * When provided, the input data will be quantized, and rowToStyle will be called only for quantized values. + */ + type DataDomains = any; + } + + /** + * Defines how to load data from a raw data file + * This provider defines the interface for loading data, such as geometries or coordinates, from a local or remote data file in GeoJSON or CSV format + */ + class RawDataProvider extends H.map.provider.RemoteTileProvider { + /** + * Constructor + * @param options {H.datalens.RawDataProvider.Options} - Configures options + */ + constructor(options: H.datalens.RawDataProvider.Options); + + /** + * Updates the data url. Note that new data will be fetched only after the reload method is called. + * @param dataUrl {string} + */ + setDataUrl(dataUrl: string): void; + } + + namespace RawDataProvider { + /** + * Defines options for RawDataProvider + * Options for RawDataProvider + * @property dataUrl - The data url to fetch + * @property dataToFeatures {function(any)=} - Defines how the input data is mapped to an array of GeoJSON features + * @property featuresToRows {function(Array, H.datalens.QueryTileProvider.X, H.datalens.QueryTileProvider.Y, H.datalens.QueryTileProvider.Zoom, + * H.datalens.RawDataProvider.TileSize, H.datalens.RawDataProvider.Helpers)=} - + * Defines how GeoJSON features on a tile should be mapped to data rows, which are inputs to layers such as ObjectLayer and HeatmapLayer + */ + interface Options { + dataUrl?: string; + dataToFeatures?(obj: any): H.datalens.RawDataProvider.Feature[]; + featuresToRows?(features: H.datalens.RawDataProvider.Feature[], x: H.datalens.QueryTileProvider.X, y: H.datalens.QueryTileProvider.Y, z: H.datalens.QueryTileProvider.Zoom, + tileSize: H.datalens.RawDataProvider.TileSize, helpers: H.datalens.RawDataProvider.Helpers): H.datalens.ObjectLayer.Row[]; + } + + /** + * A GeoJSON feature + * A GeoJSON feature object which conforms to the standard GeoJSON spec + */ + type Feature = any; + + /** + * Tile size + * The tile size in pixels. + */ + type TileSize = any; + + /** + * A helper class used in the worker thread + * This helper class provides convenience functions you can use in the worker thread + * @property latLngToPixel {function(H.datalens.RawDataProvider.Latitude, H.datalens.RawDataProvider.Longitude, H.datalens.QueryTileProvider.Zoom, H.datalens.RawDataProvider.TileSize)=} - + * Translates geographical coordinates (latitude, longitude) to world pixel coordinates. + * @property pixelToLatLng {function(H.datalens.RawDataProvider.PX, H.datalens.RawDataProvider.PY, H.datalens.QueryTileProvider.Zoom, H.datalens.RawDataProvider.TileSize)=} - + * Translates world pixel coordinates to geographical coordinates (latitude, longitude). + * @property parseCSV {function(any)=} - Takes CSV data as input, parses it, and return the parsed result. + */ + interface Helpers { + latLngToPixel?(latitude: H.datalens.RawDataProvider.Latitude, longitude: H.datalens.RawDataProvider.Longitude, z: H.datalens.QueryTileProvider.Zoom, + tileSize: H.datalens.RawDataProvider.TileSize): H.datalens.RawDataProvider.PixelCoordinates; + pixelToLatLng?(x: H.datalens.RawDataProvider.PX, y: H.datalens.RawDataProvider.PY, z: H.datalens.QueryTileProvider.Zoom, tileSize: H.datalens.RawDataProvider.TileSize): + H.datalens.RawDataProvider.GeoCoordinates; + parseCSV?(obj: any): any[]; + } + + /** + * Geographic coordinates + * A geographic coordinates pair [lat, lng] + */ + type GeoCoordinates = [number, number]; + + /** + * Latitude coordinate + * The latitude in the geographic coordinates pair + */ + type Latitude = number; + + /** + * Longitude coordinate + * The longitude in the geographic coordinates pair + */ + type Longitude = number; + + /** + * Pixel coordinates + * Pixel coordinates [px, py] pair + */ + type PixelCoordinates = [number, number]; + + /** + * Pixel coordinate in the x direction + * The x coordinate of the pixel coordinates pair [px, py] + */ + type PX = number; + + /** + * Pixel coordinate in the y direction + * The y coordinate of the pixel coordinates pair [px, py] + */ + type PY = number; + } + + /** + * Renders vector tiles using data-driven styles + * This layer binds the spatial data and user data, all provided by the Data Lens REST API. The layer renders geometry features using data-driven styles. + */ + class SpatialLayer extends H.map.layer.TileLayer { + /** + * Constructor + * @param dataProvider {H.datalens.Provider} - Source of tiled data (pass in null if data come from feature properties) + * @param spatialProvider {H.datalens.SpatialTileProvider} - Source of geometry data + * @param options {H.datalens.SpatialLayer.Options} - Configuration for data processing and rendering + */ + constructor(dataProvider: H.datalens.Provider, spatialProvider: H.datalens.SpatialTileProvider, options: H.datalens.SpatialLayer.Options); + + static DEFAULT_STATE: any; + static Spatial: any; + + /** + * Default value for dataToRows callback option. It represents each row as an object where property names correspond to data column names. + */ + static defaultDataToRows: any; + + /** + * Forces re-rendering of the layer. When the callbacks passed to the layer options are not pure functions, you can call this method to force re-rendering. + */ + redraw(): void; + + /** + * This method changes the state of a map object; for example, style on mouse event. + * @param {H.map.Object} spatial + * @param {H.datalens.SpatialLayer.StyleState} state + */ + updateSpatialStyle(spatial: H.map.Object, state: H.datalens.SpatialLayer.StyleState): void; + } + + namespace SpatialLayer { + /** + * Defines data processing and rendering options for SpatialLayer + * The initial step of rendering is to split the tile data by rows, where each row represents a bucket. + * By default this step is processed with H.datalens.SpatialLayer.defaultDataToRows. This behavior can be changed by defining the dataToRows callback. + * @property dataToRows {function(H.datalens.Service.Data, H.datalens.QueryTileProvider.X, H.datalens.QueryTileProvider.Y, H.datalens.QueryTileProvider.Zoom)=} - + * Defines how the input tile data is split by rows. You can specify this callback to define client-side aggregation and filtering. This callback is called for each tile. + * @property rowToSpatialId {function(H.datalens.SpatialLayer.Row)} - + * Defines how to get the spatial ID from a data row. This callback is called for each row that is returned from dataToRows. + * @property featureToSpatialId {function(H.datalens.SpatialLayer.Feature)} - + * Defines how to get the spatial ID from a geometry feature. This callback is called for each geometry feature in the vector tile. + * @property rowToStyle {function(H.datalens.SpatialLayer.Row, H.datalens.QueryTileProvider.Zoom, H.datalens.SpatialLayer.StyleState)} - + * Defines how the row is translated to map object style. This callback is called for each row that is returned from dataToRows. + * @property defaultStyle {function(H.datalens.QueryTileProvider.Zoom, H.datalens.SpatialLayer.StyleState)} - Defines the default map object style. + * @property transformFeature {H.datalens.SpatialLayer.transformFeature} - Defines how to transform the features. + */ + interface Options { + dataToRows?(data: H.datalens.Service.Data, x: H.datalens.QueryTileProvider.X, y: H.datalens.QueryTileProvider.Y, z: H.datalens.QueryTileProvider.Zoom): + H.datalens.SpatialLayer.Row[]; + rowToSpatialId(row: H.datalens.SpatialLayer.Row): string; + featureToSpatialId(feature: H.datalens.SpatialLayer.Feature): string; + rowToStyle(row: H.datalens.SpatialLayer.Row, z: H.datalens.QueryTileProvider.Zoom, styleState: H.datalens.SpatialLayer.StyleState): any; + defaultStyle(z: H.datalens.QueryTileProvider.Zoom, styleState: H.datalens.SpatialLayer.StyleState): any; + transformFeature: H.datalens.SpatialLayer.transformFeature; + } + + /** + * Defines modification of a data-driven style + * StyleState appears as a parameter in the rowToStyle callback. By default it is 'DEFAULT_STATE'. To change StyleState, use the SpatialLayer.updateSpatialStyle method. + */ + type StyleState = any; + + /** + * Defines a slice of data (eg Data Lens query data row) that represents a data point + * By default each row is an object where property names correspond to data column names. This representation can be changed with the dataToRows callback. + */ + type Row = any; + + /** + * Defines a geometry in the vector tile + * Each geometry is described by various properties, including a unique identifier which must be used to map the geometry to user data. + */ + type Feature = any; + + /** + * TODO: missing in documentation: https://developer.here.com/visualization/documentation/datalens/h-datalens-spatiallayer-options.html + */ + type transformFeature = any; + } + + /** + * Specifies how to access layer data (shapes, geometries) using the Data Lens REST API. + * This provider defines the interface for accessing shape layers via the Data Lens REST API. The input data is provided as vector tiles in the MapBox format (Protobuf). + * Data is loaded by tiles. + */ + class SpatialTileProvider extends H.map.provider.RemoteTileProvider { + /** + * Constructor + * @param service {H.datalens.Service} - Data Lens REST API service + * @param options {H.datalens.SpatialTileProvider.Options} - Configures layer name + */ + constructor(service: H.datalens.Service, options: H.datalens.SpatialTileProvider.Options); + + static VectorTile: any; + + /** + * Updates the layer name to be used in the next call of the Data Lens REST API. Note that new data will be fetched only after the reload method is called. + * @param {string} layerName + */ + setLayerName(layerName: string): void; + + /** + * Updates the query's dynamic parameters to be used in the next call of the Data Lens REST API. Note that new data will be fetched only after the reload method is called. + * This method is normally used when updating your visualization. + * @param {any|null} queryParams + */ + setQueryParams(queryParams: any | null): void; + } + + namespace SpatialTileProvider { + /** + * Defines layer name and data accessibility parameters for H.datalens.SpatialTileProvider + * This defines the layer name and dynamic parameters required for fetching tiled geometry data with the Data Lens REST API. Other options from H.datalens.Provider.Options are available. + * @property layerName {string} - The name of the layer to fetch with the Data Lens REST API query + * @property queryParams {any} - The query's dynamic parameters. The dynamic parameters can be used to filter data provided by the query. + */ + interface Options { + layerName: string; + queryParams?: any; + } + } + } +} diff --git a/types/heredatalens/tsconfig.json b/types/heredatalens/tsconfig.json new file mode 100644 index 0000000000..d687f69017 --- /dev/null +++ b/types/heredatalens/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts" + ] +} \ No newline at end of file diff --git a/types/heredatalens/tslint.json b/types/heredatalens/tslint.json new file mode 100644 index 0000000000..e60c15844f --- /dev/null +++ b/types/heredatalens/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file From 5cced096319d160a84587c0ae96c0d9fff73e9e5 Mon Sep 17 00:00:00 2001 From: Bernd Hacker Date: Tue, 23 May 2017 11:55:28 +0200 Subject: [PATCH 0300/1072] add missing test file to tsconfig.json --- types/heredatalens/tsconfig.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/heredatalens/tsconfig.json b/types/heredatalens/tsconfig.json index d687f69017..9c60b13753 100644 --- a/types/heredatalens/tsconfig.json +++ b/types/heredatalens/tsconfig.json @@ -17,6 +17,7 @@ "forceConsistentCasingInFileNames": true }, "files": [ - "index.d.ts" + "index.d.ts", + "heredatalens-tests.ts" ] } \ No newline at end of file From dceac2d5c127626f0e24344546b518a9fd91fe37 Mon Sep 17 00:00:00 2001 From: Ashish Shubham Date: Tue, 23 May 2017 03:04:26 -0700 Subject: [PATCH 0301/1072] 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 0302/1072] 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 0303/1072] [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 0304/1072] [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 0305/1072] [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 0306/1072] 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 0307/1072] 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 0308/1072] 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 0309/1072] 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 0310/1072] 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 0311/1072] 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 0312/1072] 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 0313/1072] 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 0314/1072] 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 0315/1072] 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 0316/1072] updated typescript version --- types/alexa-sdk/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/alexa-sdk/index.d.ts b/types/alexa-sdk/index.d.ts index 141d41743e..d051c44ccc 100644 --- a/types/alexa-sdk/index.d.ts +++ b/types/alexa-sdk/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs // Definitions by: Pete Beegle , Huw // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 export function handler(event: RequestBody, context: Context, callback?: Function): AlexaObject; export function CreateStateHandler(state: string, obj: any): any; From dd14b496587c5d4497378ab0da1a656ff03130f1 Mon Sep 17 00:00:00 2001 From: Gabe Scholz Date: Tue, 23 May 2017 12:01:10 -0700 Subject: [PATCH 0317/1072] Ensure that typings for resolves and rejects return type Matchers> --- types/jest/index.d.ts | 72 +++++++++++++++++++++------------------- types/jest/jest-tests.ts | 39 +++++++++++++++++----- 2 files changed, 68 insertions(+), 43 deletions(-) diff --git a/types/jest/index.d.ts b/types/jest/index.d.ts index 7ac5c7486b..9c96fd1615 100644 --- a/types/jest/index.d.ts +++ b/types/jest/index.d.ts @@ -159,7 +159,7 @@ declare namespace jest { * * @param {any} actual The value to apply matchers against. */ - (actual: any): Matchers; + (actual: any): Matchers; anything(): any; /** Matches anything that was created with the given constructor. You can use it inside `toEqual` or `toBeCalledWith` instead of a literal value. */ any(classType: any): any; @@ -175,69 +175,71 @@ declare namespace jest { stringMatching(str: string | RegExp): any; } - interface Matchers { + interface Matchers { /** If you know how to test something, `.not` lets you test its opposite. */ - not: Matchers; - resolves: Matchers; - rejects: Matchers; - lastCalledWith(...args: any[]): void; + not: Matchers; + /** Use resolves to unwrap the value of a fulfilled promise so any other matcher can be chained. If the promise is rejected the assertion fails. */ + resolves: Matchers>; + /** Unwraps the reason of a rejected promise so any other matcher can be chained. If the promise is fulfilled the assertion fails. */ + rejects: Matchers>; + lastCalledWith(...args: any[]): R; /** Checks that a value is what you expect. It uses `===` to check strict equality. Don't use `toBe` with floating-point numbers. */ - toBe(expected: any): void; + toBe(expected: any): R; /** Ensures that a mock function is called. */ - toBeCalled(): void; + toBeCalled(): R; /** Ensure that a mock function is called with specific arguments. */ - toBeCalledWith(...args: any[]): void; + toBeCalledWith(...args: any[]): R; /** Using exact equality with floating point numbers is a bad idea. Rounding means that intuitive things fail. */ - toBeCloseTo(expected: number, delta?: number): void; + toBeCloseTo(expected: number, delta?: number): R; /** Ensure that a variable is not undefined. */ - toBeDefined(): void; + toBeDefined(): R; /** When you don't care what a value is, you just want to ensure a value is false in a boolean context. */ - toBeFalsy(): void; + toBeFalsy(): R; /** For comparing floating point numbers. */ - toBeGreaterThan(expected: number): void; + toBeGreaterThan(expected: number): R; /** For comparing floating point numbers. */ - toBeGreaterThanOrEqual(expected: number): void; + toBeGreaterThanOrEqual(expected: number): R; /** Ensure that an object is an instance of a class. This matcher uses `instanceof` underneath. */ - toBeInstanceOf(expected: any): void + toBeInstanceOf(expected: any): R /** For comparing floating point numbers. */ - toBeLessThan(expected: number): void; + toBeLessThan(expected: number): R; /** For comparing floating point numbers. */ - toBeLessThanOrEqual(expected: number): void; + toBeLessThanOrEqual(expected: number): R; /** This is the same as `.toBe(null)` but the error messages are a bit nicer. So use `.toBeNull()` when you want to check that something is null. */ - toBeNull(): void; + toBeNull(): R; /** Use when you don't care what a value is, you just want to ensure a value is true in a boolean context. In JavaScript, there are six falsy values: `false`, `0`, `''`, `null`, `undefined`, and `NaN`. Everything else is truthy. */ - toBeTruthy(): void; + toBeTruthy(): R; /** Used to check that a variable is undefined. */ - toBeUndefined(): void; + toBeUndefined(): R; /** Used when you want to check that an item is in a list. For testing the items in the list, this uses `===`, a strict equality check. */ - toContain(expected: any): void; + toContain(expected: any): R; /** Used when you want to check that an item is in a list. For testing the items in the list, this matcher recursively checks the equality of all fields, rather than checking for object identity. */ - toContainEqual(expected: any): void; + toContainEqual(expected: any): R; /** Used when you want to check that two objects have the same value. This matcher recursively checks the equality of all fields, rather than checking for object identity. */ - toEqual(expected: any): void; + toEqual(expected: any): R; /** Ensures that a mock function is called. */ - toHaveBeenCalled(): boolean; + toHaveBeenCalled(): R; /** Ensures that a mock function is called an exact number of times. */ - toHaveBeenCalledTimes(expected: number): boolean; + toHaveBeenCalledTimes(expected: number): R; /** Ensure that a mock function is called with specific arguments. */ - toHaveBeenCalledWith(...params: any[]): boolean; + toHaveBeenCalledWith(...params: any[]): R; /** If you have a mock function, you can use `.toHaveBeenLastCalledWith` to test what arguments it was last called with. */ - toHaveBeenLastCalledWith(...params: any[]): boolean; + toHaveBeenLastCalledWith(...params: any[]): R; /** Used to check that an object has a `.length` property and it is set to a certain numeric value. */ - toHaveLength(expected: number): void; - toHaveProperty(propertyPath: string, value?: any): void; + toHaveLength(expected: number): R; + toHaveProperty(propertyPath: string, value?: any): R; /** Check that a string matches a regular expression. */ - toMatch(expected: string | RegExp): void; + toMatch(expected: string | RegExp): R; /** Used to check that a JavaScript object matches a subset of the properties of an objec */ - toMatchObject(expected: {}): void; + toMatchObject(expected: {}): R; /** This ensures that a value matches the most recent snapshot. Check out [the Snapshot Testing guide](http://facebook.github.io/jest/docs/snapshot-testing.html) for more information. */ - toMatchSnapshot(snapshotName?: string): void; + toMatchSnapshot(snapshotName?: string): R; /** Used to test that a function throws when it is called. */ - toThrow(error?: string | Constructable | RegExp): void; + toThrow(error?: string | Constructable | RegExp): R; /** If you want to test that a specific error is thrown inside a function. */ - toThrowError(error?: string | Constructable | RegExp): void; + toThrowError(error?: string | Constructable | RegExp): R; /** Used to test that a function throws a error matching the most recent snapshot when it is called. */ - toThrowErrorMatchingSnapshot(): void; + toThrowErrorMatchingSnapshot(): R; } interface Constructable { diff --git a/types/jest/jest-tests.ts b/types/jest/jest-tests.ts index 0605724334..eb86e1c861 100644 --- a/types/jest/jest-tests.ts +++ b/types/jest/jest-tests.ts @@ -503,16 +503,39 @@ describe('Mocks', function () { }); // https://facebook.github.io/jest/docs/en/expect.html#resolves -describe('resolves', function () { - it('unwraps the expected Promise', function () { - return expect(Promise.resolve('test')).resolves.toEqual('test'); +describe('resolves', function() { + it('unwraps the expected Promise', function() { + const expectation = expect(Promise.resolve('test')).resolves.toEqual('test'); + expect(expectation instanceof Promise).toBeTruthy(); + return expectation; + }); + + it('unwraps a .toHaveBeenCalledX', function(done) { + expect.assertions(2); + + const fn = jest.fn(); + return expect(Promise.resolve(fn)).resolves.toHaveBeenCalledTimes(0).then(val => { + expect(val).toEqual(true); + done(); + }); + }); + + it('unwraps a not.toHaveBeenCalledX', function(done) { + expect.assertions(2); + + const fn = jest.fn(); + return expect(Promise.resolve(fn)).resolves.not.toHaveBeenCalledTimes(1).then(val => { + expect(val).toEqual(true); + done(); + }); }); }); // https://facebook.github.io/jest/docs/en/expect.html#rejects -describe('rejects', function () { - it('unwraps the expected Promise', function () { - const error = new Error('error'); - return expect(Promise.reject(error)).rejects.toBeDefined(); +describe('rejects', function() { + it('unwraps the expected Promise', function() { + const expectation = expect(Promise.reject(new Error('error'))).rejects.toMatch('error'); + expect(expectation instanceof Promise).toBeTruthy(); + return expectation; }); -}); \ No newline at end of file +}); From e85e05d0b2f99fd2597ebeb7081e6607f453e7a0 Mon Sep 17 00:00:00 2001 From: Peter Burns Date: Tue, 23 May 2017 12:03:17 -0700 Subject: [PATCH 0318/1072] 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 0319/1072] [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 0320/1072] 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 0321/1072] 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 0322/1072] 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 0323/1072] 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 0324/1072] 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 0325/1072] 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 0326/1072] 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 0327/1072] 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 0328/1072] improve types of qrcode@0.8.2 --- types/qrcode/index.d.ts | 218 +++++++++++++++++++++++++++++++---- types/qrcode/qrcode-tests.ts | 58 ++++++++-- 2 files changed, 243 insertions(+), 33 deletions(-) diff --git a/types/qrcode/index.d.ts b/types/qrcode/index.d.ts index f3f355d90b..cb2ce4a9b7 100644 --- a/types/qrcode/index.d.ts +++ b/types/qrcode/index.d.ts @@ -1,35 +1,203 @@ -// Type definitions for qrcode +// Type definitions for qrcode 0.8.2 // Project: https://github.com/soldair/node-qrcode // Definitions by: York Yao // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -type QRCodeOptions = { - errorCorrectLevel?: "minimum" | "medium" | "high" | "max"; +/// + +import * as stream from "stream"; + +export interface QRCodeOptions { + /** + * QR Code version. If not specified the more suitable value will be calculated. + */ + version?: number; + /** + * Error correction level. + * Possible values are low, medium, quartile, high or L, M, Q, H. + * Default: M + */ + errorCorrectionLevel?: "low" | "medium" | "quartile" | "high" | "L" | "M" | "Q" | "H"; + /** + * Helper function used internally to convert a kanji to its Shift JIS value. + * Provide this function if you need support for Kanji mode. + */ + toSJISFunc?: Function; } -declare module "qrcode" { - var qrcode: { - toDataURL(text: string, callback: (error: Error, dataURL: string) => void): void; - toDataURL(text: string, options: QRCodeOptions, callback: (error: Error, dataURL: string) => void): void; - draw(text: string, callback: (error: Error, canvas: HTMLCanvasElement) => void): void; - draw(text: string, options: QRCodeOptions, callback: (error: Error, canvas: HTMLCanvasElement) => void): void; - drawSvg(text: string, callback: (error: Error, svgString: string) => void): void; - drawSvg(text: string, options: QRCodeOptions, callback: (error: Error, svgString: string) => void): void; - save(path: string, text: string, callback: (error: Error, written: any) => void): void; - save(path: string, text: string, options: QRCodeOptions, callback: (error: Error, written: any) => void): void; - drawText(text: string, callback: (error: Error) => void): void; - drawText(text: string, options: QRCodeOptions, callback: (error: Error) => void): void; - drawBitArray(text: string, callback: (error: Error, bits: any, width: number) => void): void; - drawBitArray(text: string, options: QRCodeOptions, callback: (error: Error, bits: any, width: number) => void): void; +export interface QRCodeToDataURLOptions extends QRCodeRenderersOptions { + /** + * Data URI format. + * Default: image/png + */ + type?: "image/png" | "image/jpeg" | "image/webp"; + rendererOpts?: { + /** + * A Number between 0 and 1 indicating image quality if the requested type is image/jpeg or image/webp. + * Default: 0.92 + */ + quality?: number; }; - export = qrcode; } -declare var QRCodeLib: { - QRCodeDraw: { - new (): { - draw(element: HTMLCanvasElement, text: string, callback: (error: Error, canvas: HTMLCanvasElement) => void): void; - draw(element: HTMLCanvasElement, text: string, options: QRCodeOptions, callback: (error: Error, canvas: HTMLCanvasElement) => void): void; - } +export interface QRCodeToStringOptions extends QRCodeOptions { + /** + * Output format. + * Default: utf8 + */ + type?: "utf8" | "svg" | "terminal"; +} + +export interface QRCodeToFileOptions extends QRCodeRenderersOptions { + /** + * Output format. + * Default: png + */ + type?: "png" | "svg" | "utf8"; + rendererOpts?: { + /** + * Compression level for deflate. + * Default: 9 + */ + deflateLevel?: number; + /** + * Compression strategy for deflate. + * Default: 3 + */ + deflateStrategy?: number; }; -}; +} + +export interface QRCodeRenderersOptions extends QRCodeOptions { + /** + * Define how much wide the quiet zone should be. + * Default: 4 + */ + margin?: number; + /** + * Scale factor. A value of 1 means 1px per modules (black dots). + * Default: 4 + */ + scale?: number; + color?: { + /** + * Color of dark module. Value must be in hex format (RGBA). + * Note: dark color should always be darker than color.light. + * Default: #000000ff + */ + dark?: string; + /** + * Color of light module. Value must be in hex format (RGBA). + * Default: #ffffffff + */ + light?: string; + }; +} + +export interface QRCodeSegment { + data: string; + mode: 'alphanumeric' | 'numeric'; +} + +export interface QRCode { + /** + * Bitmatrix class with modules data + */ + modules: any; + /** + * Calculated QR Code version + */ + version: number; + /** + * Error Correction Level + */ + errorCorrectionLevel: number; + /** + * Calculated Mask pattern + */ + maskPattern: any; + /** + * Generated segments + */ + segments: QRCodeSegment[]; +} + +/** + * Creates QR Code symbol and returns a qrcode object. + */ +export function create(text: string | QRCodeSegment[], options: QRCodeOptions): QRCode; + +/** + * Draws qr code symbol to canvas. + */ +export function toCanvas(canvasElement: HTMLCanvasElement, text: string | QRCodeSegment[], callback: (error: Error) => void): void; +/** + * Draws qr code symbol to canvas. + */ +export function toCanvas(canvasElement: HTMLCanvasElement, text: string | QRCodeSegment[], options: QRCodeOptions, callback: (error: Error) => void): void; +/** + * Draws qr code symbol to canvas. + */ +export function toCanvas(text: string | QRCodeSegment[], callback: (error: Error, canvas: HTMLCanvasElement) => void): void; +/** + * Draws qr code symbol to canvas. + */ +export function toCanvas(text: string | QRCodeSegment[], options: QRCodeOptions, callback: (error: Error, canvas: HTMLCanvasElement) => void): void; +/** + * Draws qr code symbol to node canvas. + */ +export function toCanvas(canvas: any, text: string | QRCodeSegment[], callback: (error: Error) => void): void; +/** + * Draws qr code symbol to node canvas. + */ +export function toCanvas(canvas: any, text: string | QRCodeSegment[], options: QRCodeOptions, callback: (error: Error) => void): void; + +/** + * Returns a Data URI containing a representation of the QR Code image. + */ +export function toDataURL(canvasElement: HTMLCanvasElement, text: string | QRCodeSegment[], callback: (error: Error, url: string) => void): void; +/** + * Returns a Data URI containing a representation of the QR Code image. + */ +export function toDataURL(canvasElement: HTMLCanvasElement, text: string | QRCodeSegment[], options: QRCodeToDataURLOptions, callback: (error: Error, url: string) => void): void; +/** + * Returns a Data URI containing a representation of the QR Code image. + */ +export function toDataURL(text: string | QRCodeSegment[], callback: (error: Error, url: string) => void): void; +/** + * Returns a Data URI containing a representation of the QR Code image. + */ +export function toDataURL(text: string | QRCodeSegment[], options: QRCodeToDataURLOptions, callback: (error: Error, url: string) => void): void; + +/** + * Returns a string representation of the QR Code. + * If choosen output format is svg it will returns a string containing xml code. + */ +export function toString(text: string | QRCodeSegment[], callback: (error: Error, string: string) => void): void; +/** + * Returns a string representation of the QR Code. + * If choosen output format is svg it will returns a string containing xml code. + */ +export function toString(text: string | QRCodeSegment[], options: QRCodeToStringOptions, callback: (error: Error, string: string) => void): void; + +/** + * Saves QR Code to image file. + * If options.type is not specified, the format will be guessed from file extension. + * Recognized extensions are png, svg, txt. + */ +export function toFile(path: string, text: string | QRCodeSegment[], callback: (error: Error) => void): void; +/** + * Saves QR Code to image file. + * If options.type is not specified, the format will be guessed from file extension. + * Recognized extensions are png, svg, txt. + */ +export function toFile(path: string, text: string | QRCodeSegment[], options: QRCodeToFileOptions, callback: (error: Error) => void): void; + +/** + * Writes QR Code image to stream. Only works with png format for now. + */ +export function toFileStream(stream: stream.Writable, text: string | QRCodeSegment[], callback: (error: Error) => void): void; +/** + * Writes QR Code image to stream. Only works with png format for now. + */ +export function toFileStream(stream: stream.Writable, text: string | QRCodeSegment[], options: QRCodeOptions, callback: (error: Error) => void): void; diff --git a/types/qrcode/qrcode-tests.ts b/types/qrcode/qrcode-tests.ts index eecfb4a0d1..6a94a5f580 100644 --- a/types/qrcode/qrcode-tests.ts +++ b/types/qrcode/qrcode-tests.ts @@ -1,14 +1,56 @@ import * as QRCode from 'qrcode'; -QRCode.toDataURL('i am a pony!', function (err, url) { +const canvas = document.getElementById('canvas') as HTMLCanvasElement; + +QRCode.toCanvas(canvas, 'sample text', function (error) { + if (error) console.error(error) + console.log('success!'); +}); + +QRCode.toDataURL('I am a pony!', function (err, url) { console.log(url); }); -var qrcodedraw = new QRCodeLib.QRCodeDraw(); - -qrcodedraw.draw(document.getElementById('test') as HTMLCanvasElement, "this text will be in the code!", function (error, canvas) { - if (error) { - return console.log('Error =( ', error); - } - console.log('success!'); +QRCode.toDataURL('some text', { errorCorrectionLevel: 'H' }, function (err, url) { + console.log(url); +}); + +QRCode.toDataURL('some text', { version: 2 }, function (err, url) { + console.log(url); +}); + +QRCode.toDataURL([ + { data: 'ABCDEFG', mode: 'alphanumeric' }, + { data: '0123456', mode: 'numeric' } +], function (err, url) { + console.log(url); +}); + +QRCode.toCanvas('text', { errorCorrectionLevel: 'H' }, function (err, canvas) { + if (err) throw err; +}); + +QRCode.toDataURL('text', { + errorCorrectionLevel: 'H', + type: 'image/jpeg', + rendererOpts: { + quality: 0.3 + } +}, function (err, url) { + if (err) throw err; +}); + +QRCode.toString('http://www.google.com', function (err, string) { + if (err) throw err; + console.log(string); +}); + +QRCode.toFile('path/to/filename.png', 'Some text', { + color: { + dark: '#00F', // Blue dots + light: '#0000' // Transparent background + } +}, function (err) { + if (err) throw err; + console.log('done'); }); From 5b4c1f883233a0018dbec1010d6da3e87b83bc3d Mon Sep 17 00:00:00 2001 From: Andrea Briganti Date: Wed, 24 May 2017 16:25:53 +0200 Subject: [PATCH 0329/1072] 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 0330/1072] 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 0331/1072] 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 0332/1072] 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 0333/1072] 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 0334/1072] 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 0335/1072] 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 0336/1072] 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 0337/1072] 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 0338/1072] 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 0339/1072] 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 0340/1072] 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 0341/1072] 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 0342/1072] 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 0343/1072] 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 0344/1072] 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 0345/1072] 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 0346/1072] 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 0347/1072] 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 0348/1072] 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 0349/1072] 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 0350/1072] 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 0351/1072] [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 0352/1072] [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 0353/1072] [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 0354/1072] [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 0355/1072] [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 649f8e44f145620cd9409aa8ac4ca87888a11796 Mon Sep 17 00:00:00 2001 From: Gabe Scholz Date: Mon, 29 May 2017 16:17:51 -0700 Subject: [PATCH 0356/1072] PR Fixes: - Fix Jest version - Add hasAssertions() --- types/jest/index.d.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/types/jest/index.d.ts b/types/jest/index.d.ts index 9c96fd1615..9abee06c9f 100644 --- a/types/jest/index.d.ts +++ b/types/jest/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Jest 19.2.0 +// Type definitions for Jest 20.0.4 // Project: http://facebook.github.io/jest/ // Definitions by: Asana , Ivo Stratev , jwbay , Alexey Svetliakov , Alex Jover Morales // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -167,6 +167,8 @@ declare namespace jest { arrayContaining(arr: any[]): any; /** Verifies that a certain number of assertions are called during a test. This is often useful when testing asynchronous code, in order to make sure that assertions in a callback actually got called. */ assertions(num: number): void; + /** Verifies that at least one assertion is called during a test. This is often useful when testing asynchronous code, in order to make sure that assertions in a callback actually got called. */ + hasAssertions(): void; /** You can use `expect.extend` to add your own matchers to Jest. */ extend(obj: ExpectExtendMap): void; /** Matches any object that recursively matches the provided keys. This is often handy in conjunction with other asymmetric matchers. */ From 4e4890ccc88561afcd2064dab10195db58e65929 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Tue, 30 May 2017 00:53:43 -0700 Subject: [PATCH 0357/1072] 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 0358/1072] 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 0359/1072] 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 0360/1072] 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 0361/1072] [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 0362/1072] 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 0363/1072] [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 0364/1072] 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 0365/1072] 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 0366/1072] 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 ( +