From 0fd670e6905fc612c386d0185a95be0107c68c34 Mon Sep 17 00:00:00 2001 From: "James W. Lane III" Date: Sat, 27 Jan 2018 12:28:01 -0600 Subject: [PATCH 001/210] Updated types for color 3.0.0 (#23205) * Updated for color 3.0.0 * Updated tsconfig.json * Updated tsconfig.json attempt 2 --- types/color/color-tests.ts | 4 +- types/color/index.d.ts | 8 +- types/color/v2/color-tests.ts | 65 ++++++++++++++++ types/color/v2/index.d.ts | 135 ++++++++++++++++++++++++++++++++++ types/color/v2/tsconfig.json | 28 +++++++ types/color/v2/tslint.json | 1 + 6 files changed, 235 insertions(+), 6 deletions(-) create mode 100644 types/color/v2/color-tests.ts create mode 100644 types/color/v2/index.d.ts create mode 100644 types/color/v2/tsconfig.json create mode 100644 types/color/v2/tslint.json diff --git a/types/color/color-tests.ts b/types/color/color-tests.ts index 4e475a0ce0..ac79ea42e9 100644 --- a/types/color/color-tests.ts +++ b/types/color/color-tests.ts @@ -25,8 +25,8 @@ const yellow: number = color.yellow(); const black: number = color.black(); const luminosity: number = color.luminosity(); const contrast: number = color.contrast(colorOther); -const dark: boolean = color.dark(); -const light: boolean = color.light(); +const isDark: boolean = color.isDark(); +const isLight: boolean = color.isLight(); const level: string = color.level(colorOther); const x: number = color.x(); diff --git a/types/color/index.d.ts b/types/color/index.d.ts index 8290b78129..716b8a9dcf 100644 --- a/types/color/index.d.ts +++ b/types/color/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for color 2.0 +// Type definitions for color 3.0 // Project: https://github.com/qix-/color#readme -// Definitions by: Junyoung Clare Jang +// Definitions by: Junyoung Clare Jang , James W. Lane // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -72,8 +72,8 @@ interface Color { luminosity(): number; contrast(color2: Color): number; level(color2: Color): 'AAA' | 'AA' | ''; - dark(): boolean; - light(): boolean; + isDark(): boolean; + isLight(): boolean; negate(): Color; lighten(ratio: number): Color; darken(ratio: number): Color; diff --git a/types/color/v2/color-tests.ts b/types/color/v2/color-tests.ts new file mode 100644 index 0000000000..4e475a0ce0 --- /dev/null +++ b/types/color/v2/color-tests.ts @@ -0,0 +1,65 @@ +import Color = require('color'); + +const color: Color = new Color("white"); +const colorOther: Color = new Color("black"); +const colorRGB: Color = new Color({ r: 0, g: 0, b: 0 }, "rgb"); +const colorInt: Color = new Color(0x000000); +const colorWithoutNew: Color = Color(0x000000); +const colorByStaticMethod: Color = Color.rgb({ r: 0, g: 0, b: 0 }); + +const hex: string = color.hex(); +const percent: string = color.percentString(); +const keyword: string = color.keyword(); +const alpha: number = color.alpha(); +const red: number = color.red(); +const green: number = color.green(); +const blue: number = color.blue(); +const hue: number = color.hue(); +const saturationl: number = color.saturationl(); +const lightness: number = color.lightness(); +const saturationv: number = color.saturationv(); +const value: number = color.value(); +const cyan: number = color.cyan(); +const magenta: number = color.magenta(); +const yellow: number = color.yellow(); +const black: number = color.black(); +const luminosity: number = color.luminosity(); +const contrast: number = color.contrast(colorOther); +const dark: boolean = color.dark(); +const light: boolean = color.light(); +const level: string = color.level(colorOther); + +const x: number = color.x(); +const y: number = color.y(); +const z: number = color.z(); +const l: number = color.l(); +const a: number = color.a(); +const b: number = color.b(); +const rgbNumber: number = color.rgbNumber(); + +const chain: Color = color + .alpha(0) + .red(0) + .green(0) + .blue(0) + .hue(0) + .saturationl(0) + .lightness(0) + .saturationv(0) + .value(0) + .cyan(0) + .magenta(0) + .yellow(0) + .black(0) + .negate() + .lighten(0) + .darken(0) + .saturate(0) + .desaturate(0) + .grayscale() + .whiten(0) + .blacken(0) + .opaquer(0) + .rotate(0) + .mix(colorOther, 0) + .hsl(); diff --git a/types/color/v2/index.d.ts b/types/color/v2/index.d.ts new file mode 100644 index 0000000000..8290b78129 --- /dev/null +++ b/types/color/v2/index.d.ts @@ -0,0 +1,135 @@ +// Type definitions for color 2.0 +// Project: https://github.com/qix-/color#readme +// Definitions by: Junyoung Clare Jang +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import convert = require('color-convert'); + +type ColorParam = Color | string | ArrayLike | number | { [key: string]: any }; + +interface Color { + toString(): string; + toJSON(): Color; + string(places?: number): string; + percentString(places?: number): string; + array(): number[]; + object(): { alpha?: number } & { [key: string]: number }; + unitArray(): number[]; + unitObject(): { r: number, g: number, b: number, alpha?: number }; + round(places?: number): Color; + alpha(): number; + alpha(val: number): Color; + red(): number; + red(val: number): Color; + green(): number; + green(val: number): Color; + blue(): number; + blue(val: number): Color; + hue(): number; + hue(val: number): Color; + saturationl(): number; + saturationl(val: number): Color; + lightness(): number; + lightness(val: number): Color; + saturationv(): number; + saturationv(val: number): Color; + value(): number; + value(val: number): Color; + chroma(): number; + chroma(val: number): Color; + gray(): number; + gray(val: number): Color; + white(): number; + white(val: number): Color; + wblack(): number; + wblack(val: number): Color; + cyan(): number; + cyan(val: number): Color; + magenta(): number; + magenta(val: number): Color; + yellow(): number; + yellow(val: number): Color; + black(): number; + black(val: number): Color; + x(): number; + x(val: number): Color; + y(): number; + y(val: number): Color; + z(): number; + z(val: number): Color; + l(): number; + l(val: number): Color; + a(): number; + a(val: number): Color; + b(): number; + b(val: number): Color; + keyword(): string; + keyword(val: string): Color; + hex(): string; + hex(val: string): Color; + rgbNumber(): number; + luminosity(): number; + contrast(color2: Color): number; + level(color2: Color): 'AAA' | 'AA' | ''; + dark(): boolean; + light(): boolean; + negate(): Color; + lighten(ratio: number): Color; + darken(ratio: number): Color; + saturate(ratio: number): Color; + desaturate(ratio: number): Color; + whiten(ratio: number): Color; + blacken(ratio: number): Color; + grayscale(): Color; + fade(ratio: number): Color; + opaquer(ratio: number): Color; + rotate(degrees: number): Color; + mix(mixinColor: Color, weight?: number): Color; + + rgb(...args: number[]): Color; + hsl(...args: number[]): Color; + hsv(...args: number[]): Color; + hwb(...args: number[]): Color; + cmyk(...args: number[]): Color; + xyz(...args: number[]): Color; + lab(...args: number[]): Color; + lch(...args: number[]): Color; + ansi16(...args: number[]): Color; + ansi256(...args: number[]): Color; + hcg(...args: number[]): Color; + apple(...args: number[]): Color; +} + +interface ColorConstructor { + (obj?: ColorParam, model?: keyof (typeof convert)): Color; + new(obj?: ColorParam, model?: keyof (typeof convert)): Color; + rgb(...val: number[]): Color; + rgb(color: ColorParam): Color; + hsl(...val: number[]): Color; + hsl(color: ColorParam): Color; + hsv(...val: number[]): Color; + hsv(color: ColorParam): Color; + hwb(...val: number[]): Color; + hwb(color: ColorParam): Color; + cmyk(...val: number[]): Color; + cmyk(color: ColorParam): Color; + xyz(...val: number[]): Color; + xyz(color: ColorParam): Color; + lab(...val: number[]): Color; + lab(color: ColorParam): Color; + lch(...val: number[]): Color; + lch(color: ColorParam): Color; + ansi16(...val: number[]): Color; + ansi16(color: ColorParam): Color; + ansi256(...val: number[]): Color; + ansi256(color: ColorParam): Color; + hcg(...val: number[]): Color; + hcg(color: ColorParam): Color; + apple(...val: number[]): Color; + apple(color: ColorParam): Color; +} + +declare const Color: ColorConstructor; + +export = Color; diff --git a/types/color/v2/tsconfig.json b/types/color/v2/tsconfig.json new file mode 100644 index 0000000000..8216dc0b05 --- /dev/null +++ b/types/color/v2/tsconfig.json @@ -0,0 +1,28 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "types": [], + "paths": { + "color": [ + "color/v2" + ] + }, + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "color-tests.ts" + ] +} diff --git a/types/color/v2/tslint.json b/types/color/v2/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/color/v2/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 4f48e84297ad697ea12db4d4e3cd9cbbce291319 Mon Sep 17 00:00:00 2001 From: Wichert Akkerman Date: Sat, 27 Jan 2018 19:32:13 +0100 Subject: [PATCH 002/210] Add defaultTransParent to react options. (#23109) --- types/i18next/index.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/types/i18next/index.d.ts b/types/i18next/index.d.ts index c510d824eb..61b59b32e1 100644 --- a/types/i18next/index.d.ts +++ b/types/i18next/index.d.ts @@ -103,6 +103,11 @@ declare namespace i18next { * set it to fallback to let passed namespaces to translated hoc act as fallbacks */ nsMode?: string; + /** + * set it to the default parent element created by the Trans component. + * @default div + */ + defaultTransParent?: string; } interface InitOptions { From abdde3dd3742d3c89d42acbeb0fcf2ce3a5f3dbd Mon Sep 17 00:00:00 2001 From: epicgirl1998 Date: Sat, 27 Jan 2018 20:32:32 +0200 Subject: [PATCH 003/210] chrome: add cssOrigin to tabs.InjectDetails (#23224) --- types/chrome/index.d.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/types/chrome/index.d.ts b/types/chrome/index.d.ts index 3d85d3be14..cd12179213 100644 --- a/types/chrome/index.d.ts +++ b/types/chrome/index.d.ts @@ -6050,6 +6050,12 @@ declare namespace chrome.tabs { * @since Chrome 39. */ matchAboutBlank?: boolean; + /** + * Optional. The origin of the CSS to inject. This may only be specified for CSS, not JavaScript. Defaults to "author". + * One of: "author", or "user" + * @since Chrome 66. + */ + cssOrigin?: string; } export interface CreateProperties { From 1248e5a0b15817e1a8546b8351a3afa757f217c2 Mon Sep 17 00:00:00 2001 From: Art Date: Sat, 27 Jan 2018 19:31:13 +0000 Subject: [PATCH 004/210] Add: cross-spawn types (#23228) * cross-spawn types * Add @inheritDoc annotation for IDEs that require it * Add sync methods * simplify typings * rm namespace comment --- types/cross-spawn/cross-spawn-tests.ts | 20 ++++++++++++++++++++ types/cross-spawn/index.d.ts | 16 ++++++++++++++++ types/cross-spawn/tsconfig.json | 23 +++++++++++++++++++++++ types/cross-spawn/tslint.json | 1 + 4 files changed, 60 insertions(+) create mode 100644 types/cross-spawn/cross-spawn-tests.ts create mode 100644 types/cross-spawn/index.d.ts create mode 100644 types/cross-spawn/tsconfig.json create mode 100644 types/cross-spawn/tslint.json diff --git a/types/cross-spawn/cross-spawn-tests.ts b/types/cross-spawn/cross-spawn-tests.ts new file mode 100644 index 0000000000..2f2fe11cd5 --- /dev/null +++ b/types/cross-spawn/cross-spawn-tests.ts @@ -0,0 +1,20 @@ +import * as spawn from 'cross-spawn'; +import * as cp from 'child_process'; + +const p1: cp.ChildProcess = spawn('my-cmd', ['foo', 'bar']); +const pw: cp.ChildProcess = spawn('my-cmd', ['foo', 'bar'], {env: process.env}); + +pw.on('error', (err: Error) => { + console.log(err); +}); + +const r1: Error = spawn.sync('foo').error; +const r2: string[] = spawn.sync('foo').output; +const r3: Buffer = spawn.sync('foo').stdout; +const r4: Buffer = spawn.sync('foo').stderr; +const r5: number = spawn.sync('foo').status; +const r6: string = spawn.sync('foo').signal; +const r7: string = spawn.sync('foo', {encoding: 'utf8'}).stdout; + +spawn.sync('foo', ['bar']); +spawn.sync('foo', ['bar'], {stdio: 'inherit'}); diff --git a/types/cross-spawn/index.d.ts b/types/cross-spawn/index.d.ts new file mode 100644 index 0000000000..8544b37528 --- /dev/null +++ b/types/cross-spawn/index.d.ts @@ -0,0 +1,16 @@ +// Type definitions for cross-spawn 6.0 +// Project: https://github.com/moxystudio/node-cross-spawn +// Definitions by: Alorel +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +import * as child_process from 'child_process'; + +declare function spawn(command: string, args?: string[], options?: child_process.SpawnOptions): child_process.ChildProcess; + +declare namespace spawn { + const sync: typeof child_process.spawnSync; +} + +export = spawn; diff --git a/types/cross-spawn/tsconfig.json b/types/cross-spawn/tsconfig.json new file mode 100644 index 0000000000..12426c3479 --- /dev/null +++ b/types/cross-spawn/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "cross-spawn-tests.ts" + ] +} diff --git a/types/cross-spawn/tslint.json b/types/cross-spawn/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/cross-spawn/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From d7e53619382abefb70e3f19ac1691cf97252b55b Mon Sep 17 00:00:00 2001 From: benstevens48 Date: Sat, 27 Jan 2018 19:32:21 +0000 Subject: [PATCH 005/210] Add types for koa-multer (#23227) * koa-multer initial commit * make requested changes to koa-multer --- types/koa-multer/index.d.ts | 134 +++++++++++++++++++++++++++ types/koa-multer/koa-multer-tests.ts | 32 +++++++ types/koa-multer/tsconfig.json | 23 +++++ types/koa-multer/tslint.json | 1 + 4 files changed, 190 insertions(+) create mode 100644 types/koa-multer/index.d.ts create mode 100644 types/koa-multer/koa-multer-tests.ts create mode 100644 types/koa-multer/tsconfig.json create mode 100644 types/koa-multer/tslint.json diff --git a/types/koa-multer/index.d.ts b/types/koa-multer/index.d.ts new file mode 100644 index 0000000000..1c518bdd61 --- /dev/null +++ b/types/koa-multer/index.d.ts @@ -0,0 +1,134 @@ +// Type definitions for koa-multer 1.0 +// Project: https://github.com/koa-modules/multer +// Definitions by: benstevens48 +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +/** + * @file + * These definitions are based on the type definitions for multer - https://github.com/expressjs/multer - found on DefinitelyTyped. + * + * Note that it is necessary to explicitly cast the `Context.req` object to type `multer.MulterIncomingMessage` + * to get the correct type for the patched `Context.req` object, as in the following example. + * ```ts + * import * as Koa from 'koa'; + * import * as Router from 'koa-router'; + * import * as multer from 'koa-multer'; + * + * async function uploadFile(ctx: Koa.Context){ + * let multerReq = ctx.req; + * let files = multerReq.files; + * let baseFilePath: string = ctx.params.path || ''; + * //... + * } + * + * let router = new Router(); + * router.put('/uploads/:path?', upload.array('files'), uploadFile); + * ``` + * The type cast is necessary since the type definitions for Koa do not allow for the `Context.req` property to be extended. + */ + +import * as Koa from 'koa'; +import { IncomingMessage } from 'http'; + +declare namespace multer { + interface File { + /** Field name specified in the form */ + fieldname: string; + /** Name of the file on the user's computer */ + originalname: string; + /** Encoding type of the file */ + encoding: string; + /** Mime type of the file */ + mimetype: string; + /** Size of the file in bytes */ + size: number; + /** The folder to which the file has been saved (DiskStorage) */ + destination: string; + /** The name of the file within the destination (DiskStorage) */ + filename: string; + /** Location of the uploaded file (DiskStorage) */ + path: string; + /** A Buffer of the entire file (MemoryStorage) */ + buffer: Buffer; + } + + interface MulterIncomingMessage extends IncomingMessage { + body: any; + file: File; + files: { + [fieldname: string]: File[]; + } | File[]; + } + + interface Field { + /** The field name. */ + name: string; + /** Optional maximum number of files per field to accept. */ + maxCount?: number; + } + + interface Options { + /** The destination directory for the uploaded files. */ + dest?: string; + /** The storage engine to use for uploaded files. */ + storage?: StorageEngine; + /** + * An object specifying the size limits of the following optional properties. This object is passed to busboy + * directly, and the details of properties can be found on https://github.com/mscdex/busboy#busboy-methods + */ + limits?: { + /** Max field name size (Default: 100 bytes) */ + fieldNameSize?: number; + /** Max field value size (Default: 1MB) */ + fieldSize?: number; + /** Max number of non- file fields (Default: Infinity) */ + fields?: number; + /** For multipart forms, the max file size (in bytes)(Default: Infinity) */ + fileSize?: number; + /** For multipart forms, the max number of file fields (Default: Infinity) */ + files?: number; + /** For multipart forms, the max number of parts (fields + files)(Default: Infinity) */ + parts?: number; + /** For multipart forms, the max number of header key=> value pairs to parse Default: 2000(same as node's http). */ + headerPairs?: number; + /** Keep the full path of files instead of just the base name (Default: false) */ + preservePath?: boolean; + }; + /** A function to control which files to upload and which to skip. */ + fileFilter?(req: IncomingMessage, file: File, callback: (error: Error | null, acceptFile: boolean) => void): void; + } + + interface StorageEngine { + _handleFile(req: IncomingMessage, file: File, callback: (error?: any, info?: File) => void): void; + _removeFile(req: IncomingMessage, file: File, callback: (error: Error) => void): void; + } + + interface DiskStorageOptions { + /** A function used to determine within which folder the uploaded files should be stored. Defaults to the system's default temporary directory. */ + destination?: string | ((req: IncomingMessage, file: File, callback: (error: Error | null, destination: string) => void) => void); + /** A function used to determine what the file should be named inside the folder. Defaults to a random name with no file extension. */ + filename?(req: IncomingMessage, file: File, callback: (error: Error | null, filename: string) => void): void; + } + + interface Instance { + /** In case you need to handle a text-only multipart form, you can use any of the multer methods (.single(), .array(), fields()), req.body contains the text fields */ + /** Accept a single file with the name fieldName. The single file will be stored in req.file. */ + single(fieldName?: string): Koa.Middleware; + /** Accept an array of files, all with the name fieldName. Optionally error out if more than maxCount files are uploaded. The array of files will be stored in req.files. */ + array(fieldName: string, maxCount?: number): Koa.Middleware; + /** Accept a mix of files, specified by fields. An object with arrays of files will be stored in req.files. */ + fields(fields: Field[]): Koa.Middleware; + /** Accepts all files that comes over the wire. An array of files will be stored in req.files. */ + any(): Koa.Middleware; + } + + /* The disk storage engine gives you full control on storing files to disk. */ + function diskStorage(options: DiskStorageOptions): StorageEngine; + /* The memory storage engine stores the files in memory as Buffer objects. */ + function memoryStorage(): StorageEngine; +} + +declare function multer(options?: multer.Options): multer.Instance; + +export = multer; diff --git a/types/koa-multer/koa-multer-tests.ts b/types/koa-multer/koa-multer-tests.ts new file mode 100644 index 0000000000..212b4d95b0 --- /dev/null +++ b/types/koa-multer/koa-multer-tests.ts @@ -0,0 +1,32 @@ +import * as Koa from 'koa'; +import * as multer from 'koa-multer'; + +const upload = multer({ + dest: 'uploads/', + fileFilter: (req, file, cb) => { + cb(null, true); + } +}); + +const app = new Koa(); + +app.use(upload.single('avatar')); + +app.use(upload.array('photos', 12)); + +const cpUpload = upload.fields([{ name: 'avatar', maxCount: 1 }, { name: 'gallery', maxCount: 8 }]); +app.use(cpUpload); + +const diskStorage = multer.diskStorage({ + destination(req, file, cb) { + cb(null, '/tmp/my-uploads'); + }, + filename(req, file, cb) { + cb(null, `${file.fieldname}-${Date.now()}`); + } +}); + +const diskUpload = multer({ storage: diskStorage }); + +const memoryStorage = multer.memoryStorage(); +const memoryUpload = multer({ storage: memoryStorage }); diff --git a/types/koa-multer/tsconfig.json b/types/koa-multer/tsconfig.json new file mode 100644 index 0000000000..63f7b13ec3 --- /dev/null +++ b/types/koa-multer/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "koa-multer-tests.ts" + ] +} diff --git a/types/koa-multer/tslint.json b/types/koa-multer/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/koa-multer/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 15c9a4af742232696768ac574c27b91d516e1994 Mon Sep 17 00:00:00 2001 From: Kyle Roach Date: Mon, 29 Jan 2018 05:14:07 -0400 Subject: [PATCH 006/210] Change MaskedView to MaskedViewIOS --- types/react-native/index.d.ts | 4 ++-- types/react-native/test/index.tsx | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index 28f26c8ec8..8d40ad33a3 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -8307,8 +8307,8 @@ export type ListView = ListViewStatic; export var MapView: MapViewStatic; export type MapView = MapViewStatic; -export var MaskedView: MaskedViewStatic; -export type MaskedView = MaskedViewStatic; +export var MaskedViewIOS: MaskedViewStatic; +export type MaskedViewIOS = MaskedViewStatic; export var Modal: ModalStatic; export type Modal = ModalStatic; diff --git a/types/react-native/test/index.tsx b/types/react-native/test/index.tsx index 666ad12aca..879a0c522d 100644 --- a/types/react-native/test/index.tsx +++ b/types/react-native/test/index.tsx @@ -43,7 +43,7 @@ import { RefreshControl, TabBarIOS, NativeModules, - MaskedView, + MaskedViewIOS, } from "react-native"; declare module "react-native" { @@ -359,9 +359,9 @@ class AlertTest extends React.Component { class MaskedViewTest extends React.Component { render() { return ( - }> + }> - + ); } } From f08ec1c02ffbc2c26297d5d6eae2e288053a8e8a Mon Sep 17 00:00:00 2001 From: Ahn Date: Mon, 29 Jan 2018 20:28:32 +0100 Subject: [PATCH 007/210] Remove global spyOn, pending, fail (#23226) --- types/jest/index.d.ts | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/types/jest/index.d.ts b/types/jest/index.d.ts index e0d73d5c9e..e3cac9b881 100644 --- a/types/jest/index.d.ts +++ b/types/jest/index.d.ts @@ -548,16 +548,6 @@ declare namespace jest { // Relevant parts of Jasmine's API are below so they can be changed and removed over time. // This file can't reference jasmine.d.ts since the globals aren't compatible. -declare function spyOn(object: any, method: string): jasmine.Spy; -/** - * If you call the function pending anywhere in the spec body, - * no matter the expectations, the spec will be marked pending. - */ -declare function pending(reason?: string): void; -/** - * Fails a test when called within one. - */ -declare function fail(error?: any): void; declare namespace jasmine { let DEFAULT_TIMEOUT_INTERVAL: number; function clock(): Clock; From 33b99a3fe95b81487ea91b131546eeab65f727d7 Mon Sep 17 00:00:00 2001 From: Jan Lohage Date: Mon, 29 Jan 2018 20:31:18 +0100 Subject: [PATCH 008/210] [@feathersjs] add missing dependency to @feathersjs/socketio and @feathersjs/primus packages, add reexports to @feathersjs/express (#23230) * [@feathersjs] add @feathersjs/socket-commons import to @feathersjs/socketio and @feathersjs/primus packages * [@feathersjs] fix ts version in @feathersjs/socketio and @feathersjs/primus packages * [@feathersjs] really fix ts version in @feathersjs/socketio and @feathersjs/primus packages * add express reexports --- types/feathersjs__express/index.d.ts | 32 ++++++++++++++++++++++++--- types/feathersjs__primus/index.d.ts | 3 +++ types/feathersjs__socketio/index.d.ts | 2 ++ 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/types/feathersjs__express/index.d.ts b/types/feathersjs__express/index.d.ts index 26e58ae565..eb49f00a78 100644 --- a/types/feathersjs__express/index.d.ts +++ b/types/feathersjs__express/index.d.ts @@ -7,7 +7,8 @@ import { Application as FeathersApplication } from '@feathersjs/feathers'; import * as express from 'express'; -export default function feathersExpress(app: FeathersApplication): express.Application & FeathersApplication; +export default function feathersExpress(app: FeathersApplication): Application; +export type Application = express.Application & FeathersApplication; export function errorHandler(options?: any): express.ErrorRequestHandler; export function notFound(): express.RequestHandler; @@ -17,6 +18,31 @@ export const rest: { }; /* - * Re-export of the express package. Can't be typed properly without just copying everything. + * Re-export of the express package. **/ -export const original: any; + +export { + CookieOptions, + Errback, + ErrorRequestHandler, + Express, + Handler, + IRoute, + IRouter, + IRouterHandler, + IRouterMatcher, + json, + MediaType, + NextFunction, + Request, + RequestHandler, + RequestParamHandler, + Response, + Router, + RouterOptions, + Send, + static, + urlencoded +} from 'express'; + +export const original: typeof express; diff --git a/types/feathersjs__primus/index.d.ts b/types/feathersjs__primus/index.d.ts index 9218a6a40e..5d93843822 100644 --- a/types/feathersjs__primus/index.d.ts +++ b/types/feathersjs__primus/index.d.ts @@ -2,6 +2,9 @@ // Project: http://feathersjs.com/ // Definitions by: Jan Lohage // Definitions: https://github.com/feathersjs-ecosystem/feathers-typescript +// TypeScript Version: 2.3 + +/// // primus removed its typings from the repo https://github.com/primus/primus/pull/623, as of 01/2018 there are none on DT export default function feathersPrimus(options: any, callback?: (primus: any) => void): () => void; diff --git a/types/feathersjs__socketio/index.d.ts b/types/feathersjs__socketio/index.d.ts index 3994f73537..34b78eb749 100644 --- a/types/feathersjs__socketio/index.d.ts +++ b/types/feathersjs__socketio/index.d.ts @@ -2,8 +2,10 @@ // Project: http://feathersjs.com/ // Definitions by: Jan Lohage // Definitions: https://github.com/feathersjs-ecosystem/feathers-typescript +// TypeScript Version: 2.3 /// +/// export default function feathersSocketIO(callback: (io: SocketIO.Server) => void): () => void; export default function feathersSocketIO(options: number | SocketIO.ServerOptions, callback?: (io: SocketIO.Server) => void): () => void; From fe8a8664808c50b25e6b5510fdb1c6fca344ec59 Mon Sep 17 00:00:00 2001 From: AJ Richardson Date: Mon, 29 Jan 2018 14:35:07 -0500 Subject: [PATCH 009/210] Zip different types (#23232) * lodash: _.get should with numeric keys, too. Also added some better tests. * lodash: add one more NumericDictionary overload for _.get * lodash: more reasonable index for _.get tests * lodash: zip should allow arrays of different types * Remove pointless namespace --- types/lodash/array/zip.d.ts | 96 +++++++++++++++ types/lodash/array/zipWith.d.ts | 208 ++++++++++++++++---------------- types/lodash/lodash-tests.ts | 34 ++++-- 3 files changed, 221 insertions(+), 117 deletions(-) diff --git a/types/lodash/array/zip.d.ts b/types/lodash/array/zip.d.ts index 70b50c88ca..cc8fa0be88 100644 --- a/types/lodash/array/zip.d.ts +++ b/types/lodash/array/zip.d.ts @@ -8,10 +8,68 @@ declare module "../index" { * @param arrays The arrays to process. * @return Returns the new array of grouped elements. */ + zip(arrays1: List, arrays2: List): Array<[T1, T2]>; + + /** + * @see _.zip + */ + zip(arrays1: List, arrays2: List, arrays3: List): Array<[T1, T2, T3]>; + + /** + * @see _.zip + */ + zip(arrays1: List, arrays2: List, arrays3: List, arrays4: List): Array<[T1, T2, T3, T4]>; + + /** + * @see _.zip + */ + zip(arrays1: List, arrays2: List, arrays3: List, arrays4: List, arrays5: List): Array<[T1, T2, T3, T4, T5]>; + + /** + * @see _.zip + */ zip(...arrays: Array | null | undefined>): T[][]; } interface LoDashImplicitWrapper { + /** + * @see _.zip + */ + zip( + this: LoDashImplicitWrapper>, + arrays2: List, + ): LoDashImplicitWrapper>; + + /** + * @see _.zip + */ + zip( + this: LoDashImplicitWrapper>, + arrays2: List, + arrays3: List, + ): LoDashImplicitWrapper>; + + /** + * @see _.zip + */ + zip( + this: LoDashImplicitWrapper>, + arrays2: List, + arrays3: List, + arrays4: List, + ): LoDashImplicitWrapper>; + + /** + * @see _.zip + */ + zip( + this: LoDashImplicitWrapper>, + arrays2: List, + arrays3: List, + arrays4: List, + arrays5: List, + ): LoDashImplicitWrapper>; + /** * @see _.zip */ @@ -22,6 +80,44 @@ declare module "../index" { } interface LoDashExplicitWrapper { + /** + * @see _.zip + */ + zip( + this: LoDashExplicitWrapper>, + arrays2: List, + ): LoDashExplicitWrapper>; + + /** + * @see _.zip + */ + zip( + this: LoDashExplicitWrapper>, + arrays2: List, + arrays3: List, + ): LoDashExplicitWrapper>; + + /** + * @see _.zip + */ + zip( + this: LoDashExplicitWrapper>, + arrays2: List, + arrays3: List, + arrays4: List, + ): LoDashExplicitWrapper>; + + /** + * @see _.zip + */ + zip( + this: LoDashExplicitWrapper>, + arrays2: List, + arrays3: List, + arrays4: List, + arrays5: List, + ): LoDashExplicitWrapper>; + /** * @see _.zip */ diff --git a/types/lodash/array/zipWith.d.ts b/types/lodash/array/zipWith.d.ts index 4db19f5d85..db4d709467 100644 --- a/types/lodash/array/zipWith.d.ts +++ b/types/lodash/array/zipWith.d.ts @@ -10,89 +10,110 @@ declare module "../index" { * @param [thisArg] The `this` binding of `iteratee`. * @return Returns the new array of grouped elements. */ - zipWith( - ...arrays: Array | null | undefined> - ): T[][]; - - /** - * @see _.zipWith - */ zipWith( - arrays: List | null | undefined, + arrays: List, iteratee: (value1: T) => TResult ): TResult[]; /** * @see _.zipWith */ - zipWith( - arrays: List | null | undefined, - arrays2: List | null | undefined, - iteratee: (value1: T, value2: T) => TResult + zipWith( + arrays1: List, + arrays2: List, + iteratee: (value1: T1, value2: T2) => TResult ): TResult[]; /** * @see _.zipWith */ - zipWith( - arrays: List | null | undefined, - arrays2: List | null | undefined, - arrays3: List | null | undefined, - iteratee: (value1: T, value2: T, value3: T) => TResult + zipWith( + arrays1: List, + arrays2: List, + arrays3: List, + iteratee: (value1: T1, value2: T2, value3: T3) => TResult ): TResult[]; /** * @see _.zipWith */ - zipWith( - arrays: List | null | undefined, - arrays2: List | null | undefined, - arrays3: List | null | undefined, - arrays4: List | null | undefined, - iteratee: (value1: T, value2: T, value3: T, value4: T) => TResult + zipWith( + arrays1: List, + arrays2: List, + arrays3: List, + arrays4: List, + iteratee: (value1: T1, value2: T2, value3: T3, value4: T4) => TResult ): TResult[]; /** * @see _.zipWith */ - zipWith( - arrays: List | null | undefined, - arrays2: List | null | undefined, - arrays3: List | null | undefined, - arrays4: List | null | undefined, - arrays5: List | null | undefined, - iteratee: (value1: T, value2: T, value3: T, value4: T, value5: T) => TResult + zipWith( + arrays1: List, + arrays2: List, + arrays3: List, + arrays4: List, + arrays5: List, + iteratee: (value1: T1, value2: T2, value3: T3, value4: T4, value5: T5) => TResult ): TResult[]; + /** + * @see _.zipWith + */ zipWith( ...iteratee: Array<((...group: T[]) => TResult) | List | null | undefined> ): TResult[]; } interface LoDashImplicitWrapper { - /** - * @see _.zipWith - */ - zipWith( - this: LoDashImplicitWrapper | null | undefined>, - ...arrays: Array | null | undefined> - ): LoDashImplicitWrapper; - /** * @see _.zipWith */ zipWith( - this: LoDashImplicitWrapper | null | undefined>, + this: LoDashImplicitWrapper>, iteratee: (value1: T) => TResult ): LoDashImplicitWrapper; /** * @see _.zipWith */ - zipWith( - this: LoDashImplicitWrapper | null | undefined>, - arrays2: List | null | undefined, - iteratee: (value1: T, value2: T) => TResult + zipWith( + this: LoDashImplicitWrapper>, + arrays2: List, + iteratee: (value1: T1, value2: T2) => TResult + ): LoDashImplicitWrapper; + + /** + * @see _.zipWith + */ + zipWith( + this: LoDashImplicitWrapper>, + arrays2: List, + arrays3: List, + iteratee: (value1: T1, value2: T2, value3: T3) => TResult + ): LoDashImplicitWrapper; + + /** + * @see _.zipWith + */ + zipWith( + this: LoDashImplicitWrapper>, + arrays2: List, + arrays3: List, + arrays4: List, + iteratee: (value1: T1, value2: T2, value3: T3, value4: T4) => TResult + ): LoDashImplicitWrapper; + + /** + * @see _.zipWith + */ + zipWith( + this: LoDashImplicitWrapper>, + arrays2: List, + arrays3: List, + arrays4: List, + arrays5: List, + iteratee: (value1: T1, value2: T2, value3: T3, value4: T4, value5: T5) => TResult ): LoDashImplicitWrapper; /** @@ -100,59 +121,59 @@ declare module "../index" { */ zipWith( this: LoDashImplicitWrapper | null | undefined>, - arrays2: List | null | undefined, - arrays3: List | null | undefined, - iteratee: (value1: T, value2: T, value3: T) => TResult - ): LoDashImplicitWrapper; - - /** - * @see _.zipWith - */ - zipWith( - this: LoDashImplicitWrapper | null | undefined>, - arrays2: List | null | undefined, - arrays3: List | null | undefined, - arrays4: List | null | undefined, - iteratee: (value1: T, value2: T, value3: T, value4: T) => TResult - ): LoDashImplicitWrapper; - - /** - * @see _.zipWith - */ - zipWith( - this: LoDashImplicitWrapper | null | undefined>, - arrays2: List | null | undefined, - arrays3: List | null | undefined, - arrays4: List | null | undefined, - arrays5: List | null | undefined, ...iteratee: Array<((...group: T[]) => TResult) | List | null | undefined> ): LoDashImplicitWrapper; } interface LoDashExplicitWrapper { - /** - * @see _.zipWith - */ - zipWith( - this: LoDashExplicitWrapper | null | undefined>, - ...arrays: Array | null | undefined> - ): LoDashExplicitWrapper; - /** * @see _.zipWith */ zipWith( - this: LoDashExplicitWrapper | null | undefined>, + this: LoDashExplicitWrapper>, iteratee: (value1: T) => TResult ): LoDashExplicitWrapper; /** * @see _.zipWith */ - zipWith( - this: LoDashExplicitWrapper | null | undefined>, - arrays2: List | null | undefined, - iteratee: (value1: T, value2: T) => TResult + zipWith( + this: LoDashExplicitWrapper>, + arrays2: List, + iteratee: (value1: T1, value2: T2) => TResult + ): LoDashExplicitWrapper; + + /** + * @see _.zipWith + */ + zipWith( + this: LoDashExplicitWrapper>, + arrays2: List, + arrays3: List, + iteratee: (value1: T1, value2: T2, value3: T3) => TResult + ): LoDashExplicitWrapper; + + /** + * @see _.zipWith + */ + zipWith( + this: LoDashExplicitWrapper>, + arrays2: List, + arrays3: List, + arrays4: List, + iteratee: (value1: T1, value2: T2, value3: T3, value4: T4) => TResult + ): LoDashExplicitWrapper; + + /** + * @see _.zipWith + */ + zipWith( + this: LoDashExplicitWrapper>, + arrays2: List, + arrays3: List, + arrays4: List, + arrays5: List, + iteratee: (value1: T1, value2: T2, value3: T3, value4: T4, value5: T5) => TResult ): LoDashExplicitWrapper; /** @@ -160,31 +181,6 @@ declare module "../index" { */ zipWith( this: LoDashExplicitWrapper | null | undefined>, - arrays2: List | null | undefined, - arrays3: List | null | undefined, - iteratee: (value1: T, value2: T, value3: T) => TResult - ): LoDashExplicitWrapper; - - /** - * @see _.zipWith - */ - zipWith( - this: LoDashExplicitWrapper | null | undefined>, - arrays2: List | null | undefined, - arrays3: List | null | undefined, - arrays4: List | null | undefined, - iteratee: (value1: T, value2: T, value3: T, value4: T) => TResult - ): LoDashExplicitWrapper; - - /** - * @see _.zipWith - */ - zipWith( - this: LoDashExplicitWrapper | null | undefined>, - arrays2: List | null | undefined, - arrays3: List | null | undefined, - arrays4: List | null | undefined, - arrays5: List | null | undefined, ...iteratee: Array<((...group: T[]) => TResult) | List | null | undefined> ): LoDashExplicitWrapper; } diff --git a/types/lodash/lodash-tests.ts b/types/lodash/lodash-tests.ts index 77cc1984eb..9baaa64815 100644 --- a/types/lodash/lodash-tests.ts +++ b/types/lodash/lodash-tests.ts @@ -3192,7 +3192,7 @@ namespace TestXor { } // _.zip -namespace TestZip { +{ let array: TResult[] | null | undefined = [] as any; let list: _.List | null | undefined = [] as any; @@ -3206,6 +3206,8 @@ namespace TestZip { result = _.zip(list); result = _.zip(list, array); result = _.zip(list, array, list); + + result = _.zip(list, array, list, array, list, array); } { @@ -3227,6 +3229,12 @@ namespace TestZip { result = _(list).chain().zip(array); result = _(list).chain().zip(array, list); } + + { + _.zip([1, 2], [3, 4]); // $ExpectType [number, number][] + _.zip([1, 2], ["a", "b"]); // $ExpectType [number, string][] + _.zip([1, 2], ["a", "b"], [true, false]); // $ExpectType [number, string, boolean][] + } } // _.zipObject @@ -3359,18 +3367,9 @@ namespace TestZipObject { } // _.zipWith -namespace TestZipWith { +{ type TestZipWithFn = (a1: number, a2: number) => number; - { - let result: number[][]; - result = _.zipWith([1, 2]); - result = _.zipWith([1, 2], [3, 4], [5, 6]); - result = _([1, 2]).zipWith().value(); - result = _([1, 2]).zipWith([3, 4], [5, 6]).value(); - result = _.chain([1, 2]).zipWith().value(); - result = _.chain([1, 2]).zipWith([3, 4], [5, 6]).value(); - } { let result: number[]; @@ -3511,6 +3510,19 @@ namespace TestZipWith { group; // $ExpectType number[] return 1; }).value(); + + result = _([1, 2]).zipWith(["a", "b"], (value1, value2) => { + value1; // $ExpectType number + value2; // $ExpectType string + return 1; + }).value(); + + result = _([1, 2]).zipWith(["a", "b"], [true, false], (value1, value2, value3) => { + value1; // $ExpectType number + value2; // $ExpectType string + value3; // $ExpectType boolean + return 1; + }).value(); } } From 6247574fa6e10e0bc08ed502caa6ef4c2f505611 Mon Sep 17 00:00:00 2001 From: JB Nizet Date: Mon, 29 Jan 2018 20:35:41 +0100 Subject: [PATCH 010/210] luxon: add changes introduced in versions 0.3.1 and 0.4.0 (#23235) --- types/luxon/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/luxon/index.d.ts b/types/luxon/index.d.ts index 327fe15ade..7229e45dc4 100644 --- a/types/luxon/index.d.ts +++ b/types/luxon/index.d.ts @@ -294,6 +294,7 @@ declare module 'luxon' { function eras(length?: EraLength, options?: InfoOptions): string[]; function features(): Features; function hasDST(zone: string | Zone): boolean; + function isValidIANAZone(zone: string): boolean; function meridiems(options?: InfoOptions): string[]; function months(length?: UnitLength, options?: UnitOptions): string[]; function monthsFormat(length?: UnitLength, options?: UnitOptions): string[]; From 89fca5987e7892f7d0ff5f3a30b9603fe5a9770c Mon Sep 17 00:00:00 2001 From: bruce-lindsay Date: Mon, 29 Jan 2018 14:41:03 -0500 Subject: [PATCH 011/210] cucumber 4.0.0 (#23241) * update for cucumber 4 removed members dropped from cucumber js according to changelog registerHandler, registerListener, Around added new module level exports replacing obsolete defineSupportCode callback add useForSnippets and perferForRegexpMatch to transform * make travis ci happy with v3 folder --- types/cucumber/cucumber-tests.ts | 334 +++++++++++++--------------- types/cucumber/index.d.ts | 33 ++- types/cucumber/v3/cucumber-tests.ts | 197 ++++++++++++++++ types/cucumber/v3/index.d.ts | 311 ++++++++++++++++++++++++++ types/cucumber/v3/tsconfig.json | 32 +++ types/cucumber/v3/tslint.json | 8 + 6 files changed, 732 insertions(+), 183 deletions(-) create mode 100644 types/cucumber/v3/cucumber-tests.ts create mode 100644 types/cucumber/v3/index.d.ts create mode 100644 types/cucumber/v3/tsconfig.json create mode 100644 types/cucumber/v3/tslint.json diff --git a/types/cucumber/cucumber-tests.ts b/types/cucumber/cucumber-tests.ts index f2aed9aec4..b7fa675095 100644 --- a/types/cucumber/cucumber-tests.ts +++ b/types/cucumber/cucumber-tests.ts @@ -1,6 +1,12 @@ import * as assert from "power-assert"; +import { setWorldConstructor, defineParameterType, After, AfterAll, Before, BeforeAll, Given, When, Then } from "cucumber"; import cucumber = require("cucumber"); +type Callback = cucumber.CallbackStepDefinition; +type Table = cucumber.TableDefinition; +type HookScenarioResult = cucumber.HookScenarioResult; +const Status = cucumber.Status; + // You can optionally declare your own world properties declare module "cucumber" { interface World { @@ -8,190 +14,166 @@ declare module "cucumber" { } } -function StepSample() { - type Callback = cucumber.CallbackStepDefinition; - type Table = cucumber.TableDefinition; - type HookScenarioResult = cucumber.HookScenarioResult; - const Status = cucumber.Status; - - cucumber.defineSupportCode(({setWorldConstructor, defineParameterType, After, AfterAll, Around, Before, BeforeAll, registerHandler, Given, When, Then}) => { - setWorldConstructor(function({attach, parameters}) { - this.attach = attach; - this.parameters = parameters; - this.visit = (url: string, callback: Callback) => { - callback(null, 'pending'); - }; - }); - - Before((scenarioResult: HookScenarioResult, callback: Callback) => { - console.log(scenarioResult.result.status === Status.FAILED); - callback(); - }); - - Before({ timeout: 1000 }, (scenarioResult: HookScenarioResult, callback: Callback) => { - console.log(scenarioResult.result.status === Status.FAILED); - callback(); - }); - - Before('@tag', (scenarioResult: HookScenarioResult, callback: Callback) => { - console.log(scenarioResult.result.status === Status.FAILED); - callback(); - }); - - BeforeAll((callback: Callback) => { - console.log("Before all"); - callback(); - }); - - BeforeAll({ timeout: 1000 }, (callback: Callback) => { - console.log("Before all"); - callback(); - }); - - BeforeAll('@tag', (callback: Callback) => { - console.log("Before all"); - callback(); - }); - - Around((scenarioResult: HookScenarioResult, runScenario: (error: string | null, callback?: () => void) => void) => { - if (scenarioResult.result.status === Status.FAILED) { - runScenario(null, () => { - console.log('finish tasks'); - }); - } - }); - - After((scenarioResult: HookScenarioResult, callback: Callback) => { - console.log("After"); - callback(); - }); - - After({ timeout: 1000 }, (scenarioResult: HookScenarioResult, callback: Callback) => { - console.log("After"); - callback(); - }); - - After('@tag', (scenarioResult: HookScenarioResult, callback: Callback) => { - console.log("After"); - callback(); - }); - - AfterAll((callback: Callback) => { - console.log("After all"); - callback(); - }); - - AfterAll({ timeout: 1000 }, (callback: Callback) => { - console.log("After all"); - callback(); - }); - - AfterAll('@tag', (callback: Callback) => { - console.log("After all"); - callback(); - }); - - registerHandler('AfterFeatures', (event: any, callback: () => void) => { - callback(); - }); - - Given(/^a variable set to (\d+)$/, (x: string) => { - console.log("the number is: " + x); - }); - - Given(/^a variable set to (\d+)$/, (x: number) => { - console.log(typeof x); - }); - - Given(/^I am on the Cucumber.js GitHub repository$/, function(callback: Callback) { - this.visit('https://github.com/cucumber/cucumber-js', callback); - }); - - When(/^I go to the README file$/, (title: string, callback: Callback) => { +function StepSampleWithoutDefineSupportCode() { + setWorldConstructor(function({attach, parameters}) { + this.attach = attach; + this.parameters = parameters; + this.visit = (url: string, callback: Callback) => { callback(null, 'pending'); - }); - - Then(/^I should see "(.*)" as the page title$/, {timeout: 60 * 1000}, function(title: string, callback: Callback) { - const pageTitle = this.browser.text('title'); - - if (title === pageTitle) { - callback(); - } else { - callback(new Error("Expected to be on page with title " + title)); - } - }); - - // Type for data_table.js on - // https://github.com/cucumber/cucumber-js/blob/a5fd8251918c278ab2e389226d165cedb44df14a/lib/cucumber/ast/data_table.js - - Given(/^a table step with Table raw$/, (table: Table) => { - const expected = [ - ['Cucumber', 'Cucumis sativus'], - ['Burr Gherkin', 'Cucumis anguria'] - ]; - const actual: string[][] = table.raw(); - assert.deepEqual(actual, expected); - }); - - Given(/^a table step with Table rows$/, (table: Table) => { - const expected = [ - ['Apricot', '5'], - ['Brocolli', '2'], - ['Cucumber', '10'] - ]; - const actual: string[][] = table.rows(); - assert.deepEqual(actual, expected); - }); - - Given(/^a table step with Table rowHash$/, (table: Table) => { - const expected = { - Cucumber: 'Cucumis sativus', - 'Burr Gherkin': 'Cucumis anguria' - }; - const actual: { [firstCol: string]: string } = table.rowsHash(); - assert.deepEqual(actual, expected); - }); - - Given(/^a table step$/, (table: Table) => { - const expected = [ - {Vegetable: 'Apricot', Rating: '5'}, - {Vegetable: 'Brocolli', Rating: '2'}, - {Vegetable: 'Cucumber', Rating: '10'} - ]; - const actual: Array<{ [colName: string]: string }> = table.hashes(); - assert.deepEqual(actual, expected); - }); - - defineParameterType({ - regexp: /particular/, - transformer: s => s.toUpperCase(), - typeName: 'param' // deprecated but still supported - }); - - defineParameterType({ - regexp: /particularly/, - transformer: s => s.toUpperCase(), - name: 'param' - }); - - Given('a {param} step', param => { - assert.equal(param, 'PARTICULAR'); - }); + }; }); - const fns: cucumber.SupportCodeConsumer[] = cucumber.getSupportCodeFns(); + Before((scenarioResult: HookScenarioResult, callback: Callback) => { + console.log(scenarioResult.result.status === Status.FAILED); + callback(); + }); - cucumber.clearSupportCodeFns(); -} + Before({ timeout: 1000 }, (scenarioResult: HookScenarioResult, callback: Callback) => { + console.log(scenarioResult.result.status === Status.FAILED); + callback(); + }); -function registerListener(): cucumber.EventListener { - const listener = Object.assign(cucumber.Listener(), { - handleBeforeScenarioEvent: (scenario: cucumber.events.ScenarioPayload, callback: () => void) => { - // do some interesting stuff ... + Before('@tag', (scenarioResult: HookScenarioResult, callback: Callback) => { + console.log(scenarioResult.result.status === Status.FAILED); + callback(); + }); + BeforeAll((callback: Callback) => { + console.log("Before all"); + callback(); + }); + + BeforeAll({ timeout: 1000 }, (callback: Callback) => { + console.log("Before all"); + callback(); + }); + + BeforeAll('@tag', (callback: Callback) => { + console.log("Before all"); + callback(); + }); + + After((scenarioResult: HookScenarioResult, callback: Callback) => { + console.log("After"); + callback(); + }); + + After({ timeout: 1000 }, (scenarioResult: HookScenarioResult, callback: Callback) => { + console.log("After"); + callback(); + }); + + After('@tag', (scenarioResult: HookScenarioResult, callback: Callback) => { + console.log("After"); + callback(); + }); + + AfterAll((callback: Callback) => { + console.log("After all"); + callback(); + }); + + AfterAll({ timeout: 1000 }, (callback: Callback) => { + console.log("After all"); + callback(); + }); + + AfterAll('@tag', (callback: Callback) => { + console.log("After all"); + callback(); + }); + + Given(/^a variable set to (\d+)$/, (x: string) => { + console.log("the number is: " + x); + }); + + Given(/^a variable set to (\d+)$/, (x: number) => { + console.log(typeof x); + }); + + Given(/^I am on the Cucumber.js GitHub repository$/, function(callback: Callback) { + this.visit('https://github.com/cucumber/cucumber-js', callback); + }); + + When(/^I go to the README file$/, (title: string, callback: Callback) => { + callback(null, 'pending'); + }); + + Then(/^I should see "(.*)" as the page title$/, {timeout: 60 * 1000}, function(title: string, callback: Callback) { + const pageTitle = this.browser.text('title'); + + if (title === pageTitle) { callback(); + } else { + callback(new Error("Expected to be on page with title " + title)); } }); - return listener; + // Type for data_table.js on + // https://github.com/cucumber/cucumber-js/blob/a5fd8251918c278ab2e389226d165cedb44df14a/lib/cucumber/ast/data_table.js + + Given(/^a table step with Table raw$/, (table: Table) => { + const expected = [ + ['Cucumber', 'Cucumis sativus'], + ['Burr Gherkin', 'Cucumis anguria'] + ]; + const actual: string[][] = table.raw(); + assert.deepEqual(actual, expected); + }); + + Given(/^a table step with Table rows$/, (table: Table) => { + const expected = [ + ['Apricot', '5'], + ['Brocolli', '2'], + ['Cucumber', '10'] + ]; + const actual: string[][] = table.rows(); + assert.deepEqual(actual, expected); + }); + + Given(/^a table step with Table rowHash$/, (table: Table) => { + const expected = { + Cucumber: 'Cucumis sativus', + 'Burr Gherkin': 'Cucumis anguria' + }; + const actual: { [firstCol: string]: string } = table.rowsHash(); + assert.deepEqual(actual, expected); + }); + + Given(/^a table step$/, (table: Table) => { + const expected = [ + {Vegetable: 'Apricot', Rating: '5'}, + {Vegetable: 'Brocolli', Rating: '2'}, + {Vegetable: 'Cucumber', Rating: '10'} + ]; + const actual: Array<{ [colName: string]: string }> = table.hashes(); + assert.deepEqual(actual, expected); + }); + + defineParameterType({ + regexp: /particular/, + transformer: s => s.toUpperCase(), + typeName: 'param' // deprecated but still supported + }); + + defineParameterType({ + regexp: /particularly/, + transformer: s => s.toUpperCase(), + name: 'param', + preferForRegexpMatch: false, + useForSnippets: false + }); + + Given('a {param} step', param => { + assert.equal(param, 'PARTICULAR'); + }); } + +// syntax defineSupportCode deprecated +function StepSample() { + cucumber.defineSupportCode((l) => { + }); +} + +const fns: cucumber.SupportCodeConsumer[] = cucumber.getSupportCodeFns(); +cucumber.clearSupportCodeFns(); diff --git a/types/cucumber/index.d.ts b/types/cucumber/index.d.ts index 8c2ad7020e..c222ad567a 100644 --- a/types/cucumber/index.d.ts +++ b/types/cucumber/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for cucumber-js 3.2 +// Type definitions for cucumber-js 4.0 // Project: https://github.com/cucumber/cucumber-js // Definitions by: Abraão Alves // Jan Molak @@ -49,6 +49,29 @@ export interface StepDefinitions { setDefaultTimeout(time: number): void; } +export function After(code: HookCode): void; +export function After(options: HookOptions | string, code: HookCode): void; +export function AfterAll(code: GlobalHookCode): void; +export function AfterAll(options: HookOptions | string, code: GlobalHookCode): void; +export function Before(code: HookCode): void; +export function Before(options: HookOptions | string, code: HookCode): void; +export function BeforeAll(code: GlobalHookCode): void; +export function BeforeAll(options: HookOptions | string, code: GlobalHookCode): void; + +export function defineParameterType(transform: Transform): void; +export function defineStep(pattern: RegExp | string, code: StepDefinitionCode): void; + +export function Given(pattern: RegExp | string, code: StepDefinitionCode): void; +export function Given(pattern: RegExp | string, options: StepDefinitionOptions, code: StepDefinitionCode): void; +export function setDefaultTimeout(time: number): void; +export function setDefinitionFunctionWrapper(fn: () => void, options?: {[key: string]: any}): void; +// tslint:disable-next-line ban-types +export function setWorldConstructor(world: ((this: World, init: {attach: Function, parameters: {[key: string]: any}}) => void) | {}): void; +export function Then(pattern: RegExp | string, options: StepDefinitionOptions, code: StepDefinitionCode): void; +export function Then(pattern: RegExp | string, code: StepDefinitionCode): void; +export function When(pattern: RegExp | string, options: StepDefinitionOptions, code: StepDefinitionCode): void; +export function When(pattern: RegExp | string, code: StepDefinitionCode): void; + export interface HookScenarioResult { sourceLocation: SourceLocation; result: ScenarioResult; @@ -98,12 +121,11 @@ export namespace pickle { export type HookCode = (this: World, scenario: HookScenarioResult, callback?: CallbackStepDefinition) => void; export type GlobalHookCode = (callback?: CallbackStepDefinition) => void; -// tslint:disable-next-line ban-types -export type AroundCode = (scenario: HookScenarioResult, runScenario?: (error: string, callback?: Function) => void) => void; - export interface Transform { regexp: RegExp; transformer(arg: string): any; + useForSnippets?: boolean; + preferForRegexpMatch?: boolean; name?: string; typeName?: string; // deprecated } @@ -122,12 +144,9 @@ export interface Hooks { After(options: HookOptions | string, code: HookCode): void; AfterAll(code: GlobalHookCode): void; AfterAll(options: HookOptions | string, code: GlobalHookCode): void; - Around(code: AroundCode): void; setDefaultTimeout(time: number): void; // tslint:disable-next-line ban-types setWorldConstructor(world: ((this: World, init: {attach: Function, parameters: {[key: string]: any}}) => void) | {}): void; - registerHandler(handlerOption: string, code: (event: any, callback: CallbackStepDefinition) => void): void; - registerListener(listener: EventListener): void; defineParameterType(transform: Transform): void; } diff --git a/types/cucumber/v3/cucumber-tests.ts b/types/cucumber/v3/cucumber-tests.ts new file mode 100644 index 0000000000..f2aed9aec4 --- /dev/null +++ b/types/cucumber/v3/cucumber-tests.ts @@ -0,0 +1,197 @@ +import * as assert from "power-assert"; +import cucumber = require("cucumber"); + +// You can optionally declare your own world properties +declare module "cucumber" { + interface World { + visit(url: string, callback: CallbackStepDefinition): void; + } +} + +function StepSample() { + type Callback = cucumber.CallbackStepDefinition; + type Table = cucumber.TableDefinition; + type HookScenarioResult = cucumber.HookScenarioResult; + const Status = cucumber.Status; + + cucumber.defineSupportCode(({setWorldConstructor, defineParameterType, After, AfterAll, Around, Before, BeforeAll, registerHandler, Given, When, Then}) => { + setWorldConstructor(function({attach, parameters}) { + this.attach = attach; + this.parameters = parameters; + this.visit = (url: string, callback: Callback) => { + callback(null, 'pending'); + }; + }); + + Before((scenarioResult: HookScenarioResult, callback: Callback) => { + console.log(scenarioResult.result.status === Status.FAILED); + callback(); + }); + + Before({ timeout: 1000 }, (scenarioResult: HookScenarioResult, callback: Callback) => { + console.log(scenarioResult.result.status === Status.FAILED); + callback(); + }); + + Before('@tag', (scenarioResult: HookScenarioResult, callback: Callback) => { + console.log(scenarioResult.result.status === Status.FAILED); + callback(); + }); + + BeforeAll((callback: Callback) => { + console.log("Before all"); + callback(); + }); + + BeforeAll({ timeout: 1000 }, (callback: Callback) => { + console.log("Before all"); + callback(); + }); + + BeforeAll('@tag', (callback: Callback) => { + console.log("Before all"); + callback(); + }); + + Around((scenarioResult: HookScenarioResult, runScenario: (error: string | null, callback?: () => void) => void) => { + if (scenarioResult.result.status === Status.FAILED) { + runScenario(null, () => { + console.log('finish tasks'); + }); + } + }); + + After((scenarioResult: HookScenarioResult, callback: Callback) => { + console.log("After"); + callback(); + }); + + After({ timeout: 1000 }, (scenarioResult: HookScenarioResult, callback: Callback) => { + console.log("After"); + callback(); + }); + + After('@tag', (scenarioResult: HookScenarioResult, callback: Callback) => { + console.log("After"); + callback(); + }); + + AfterAll((callback: Callback) => { + console.log("After all"); + callback(); + }); + + AfterAll({ timeout: 1000 }, (callback: Callback) => { + console.log("After all"); + callback(); + }); + + AfterAll('@tag', (callback: Callback) => { + console.log("After all"); + callback(); + }); + + registerHandler('AfterFeatures', (event: any, callback: () => void) => { + callback(); + }); + + Given(/^a variable set to (\d+)$/, (x: string) => { + console.log("the number is: " + x); + }); + + Given(/^a variable set to (\d+)$/, (x: number) => { + console.log(typeof x); + }); + + Given(/^I am on the Cucumber.js GitHub repository$/, function(callback: Callback) { + this.visit('https://github.com/cucumber/cucumber-js', callback); + }); + + When(/^I go to the README file$/, (title: string, callback: Callback) => { + callback(null, 'pending'); + }); + + Then(/^I should see "(.*)" as the page title$/, {timeout: 60 * 1000}, function(title: string, callback: Callback) { + const pageTitle = this.browser.text('title'); + + if (title === pageTitle) { + callback(); + } else { + callback(new Error("Expected to be on page with title " + title)); + } + }); + + // Type for data_table.js on + // https://github.com/cucumber/cucumber-js/blob/a5fd8251918c278ab2e389226d165cedb44df14a/lib/cucumber/ast/data_table.js + + Given(/^a table step with Table raw$/, (table: Table) => { + const expected = [ + ['Cucumber', 'Cucumis sativus'], + ['Burr Gherkin', 'Cucumis anguria'] + ]; + const actual: string[][] = table.raw(); + assert.deepEqual(actual, expected); + }); + + Given(/^a table step with Table rows$/, (table: Table) => { + const expected = [ + ['Apricot', '5'], + ['Brocolli', '2'], + ['Cucumber', '10'] + ]; + const actual: string[][] = table.rows(); + assert.deepEqual(actual, expected); + }); + + Given(/^a table step with Table rowHash$/, (table: Table) => { + const expected = { + Cucumber: 'Cucumis sativus', + 'Burr Gherkin': 'Cucumis anguria' + }; + const actual: { [firstCol: string]: string } = table.rowsHash(); + assert.deepEqual(actual, expected); + }); + + Given(/^a table step$/, (table: Table) => { + const expected = [ + {Vegetable: 'Apricot', Rating: '5'}, + {Vegetable: 'Brocolli', Rating: '2'}, + {Vegetable: 'Cucumber', Rating: '10'} + ]; + const actual: Array<{ [colName: string]: string }> = table.hashes(); + assert.deepEqual(actual, expected); + }); + + defineParameterType({ + regexp: /particular/, + transformer: s => s.toUpperCase(), + typeName: 'param' // deprecated but still supported + }); + + defineParameterType({ + regexp: /particularly/, + transformer: s => s.toUpperCase(), + name: 'param' + }); + + Given('a {param} step', param => { + assert.equal(param, 'PARTICULAR'); + }); + }); + + const fns: cucumber.SupportCodeConsumer[] = cucumber.getSupportCodeFns(); + + cucumber.clearSupportCodeFns(); +} + +function registerListener(): cucumber.EventListener { + const listener = Object.assign(cucumber.Listener(), { + handleBeforeScenarioEvent: (scenario: cucumber.events.ScenarioPayload, callback: () => void) => { + // do some interesting stuff ... + + callback(); + } + }); + + return listener; +} diff --git a/types/cucumber/v3/index.d.ts b/types/cucumber/v3/index.d.ts new file mode 100644 index 0000000000..8c2ad7020e --- /dev/null +++ b/types/cucumber/v3/index.d.ts @@ -0,0 +1,311 @@ +// Type definitions for cucumber-js 3.2 +// Project: https://github.com/cucumber/cucumber-js +// Definitions by: Abraão Alves +// Jan Molak +// Isaiah Soung +// BendingBender +// ErikSchierboom +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.4 + +export enum Status { + AMBIGUOUS = "ambiguous", + FAILED = "failed", + PASSED = "passed", + PENDING = "pending", + SKIPPED = "skipped", + UNDEFINED = "undefined" +} + +export interface World { + [key: string]: any; +} + +export interface CallbackStepDefinition { + pending(): PromiseLike; + (error?: any, pending?: string): void; +} + +export interface TableDefinition { + raw(): string[][]; + rows(): string[][]; + rowsHash(): { [firstCol: string]: string }; + hashes(): Array<{ [colName: string]: string }>; +} + +export type StepDefinitionCode = (this: World, ...stepArgs: any[]) => any; + +export interface StepDefinitionOptions { + timeout?: number; +} + +export interface StepDefinitions { + Given(pattern: RegExp | string, options: StepDefinitionOptions, code: StepDefinitionCode): void; + Given(pattern: RegExp | string, code: StepDefinitionCode): void; + When(pattern: RegExp | string, options: StepDefinitionOptions, code: StepDefinitionCode): void; + When(pattern: RegExp | string, code: StepDefinitionCode): void; + Then(pattern: RegExp | string, options: StepDefinitionOptions, code: StepDefinitionCode): void; + Then(pattern: RegExp | string, code: StepDefinitionCode): void; + setDefaultTimeout(time: number): void; +} + +export interface HookScenarioResult { + sourceLocation: SourceLocation; + result: ScenarioResult; + pickle: pickle.Pickle; +} + +export interface SourceLocation { + line: number; + url: string; +} + +export interface ScenarioResult { + duration: number; + status: Status; +} + +export namespace pickle { + interface Pickle { + language: string; + locations: Location[]; + name: string; + steps: Step[]; + tags: string[]; + } + + interface Location { + column: number; + line: number; + } + + interface Step { + arguments: Argument[]; + locations: Location[]; + text: string; + } + + interface Argument { + rows: Cell[]; + } + + interface Cell { + location: Location; + value: string; + } +} + +export type HookCode = (this: World, scenario: HookScenarioResult, callback?: CallbackStepDefinition) => void; +export type GlobalHookCode = (callback?: CallbackStepDefinition) => void; + +// tslint:disable-next-line ban-types +export type AroundCode = (scenario: HookScenarioResult, runScenario?: (error: string, callback?: Function) => void) => void; + +export interface Transform { + regexp: RegExp; + transformer(arg: string): any; + name?: string; + typeName?: string; // deprecated +} + +export interface HookOptions { + timeout?: number; + tags?: any; +} + +export interface Hooks { + Before(code: HookCode): void; + Before(options: HookOptions | string, code: HookCode): void; + BeforeAll(code: GlobalHookCode): void; + BeforeAll(options: HookOptions | string, code: GlobalHookCode): void; + After(code: HookCode): void; + After(options: HookOptions | string, code: HookCode): void; + AfterAll(code: GlobalHookCode): void; + AfterAll(options: HookOptions | string, code: GlobalHookCode): void; + Around(code: AroundCode): void; + setDefaultTimeout(time: number): void; + // tslint:disable-next-line ban-types + setWorldConstructor(world: ((this: World, init: {attach: Function, parameters: {[key: string]: any}}) => void) | {}): void; + registerHandler(handlerOption: string, code: (event: any, callback: CallbackStepDefinition) => void): void; + registerListener(listener: EventListener): void; + defineParameterType(transform: Transform): void; +} + +export class EventListener { + hear(event: events.Event, callback: () => void): void; + hasHandlerForEvent(event: events.Event): boolean; + buildHandlerNameForEvent(event: events.Event): string; + getHandlerForEvent(event: events.Event): EventHook; + buildHandlerName(shortName: string): string; + setHandlerForEvent(shortName: string, handler: EventListener): void; +} + +export function Listener(): EventListener; + +export namespace events { + interface Event { + name: string; + data: any; + } + + // tslint:disable-next-line no-empty-interface + interface EventPayload { + } + + interface FeaturesPayload extends EventPayload { + getFeatures(): any[]; // https://github.com/cucumber/cucumber-js/blob/dc698bf5bc10d591fa7adeec5fa21b2d90dc9679/lib/cucumber/runtime.js#L34 + } + + interface FeaturesResultPayload extends EventPayload { + duration: number; + scenarioResults: any[]; + success: boolean; + stepsResults: any[]; + strict: boolean; + } + + interface FeaturePayload extends EventPayload { + description: string; + keyword: string; + line: number; + name: string; + tags: Tag[]; + uri: string; + scenarios: Scenario[]; + } + + interface ScenarioPayload extends EventPayload { + feature: Feature; + exception: Error; + keyword: string; + lines: number[]; + name: string; + tags: Tag[]; + uri: string; + line: number; + description: string; + steps: Step[]; + } + + interface ScenarioResultPayload extends EventPayload { + duration: any; + failureException: Error; + scenario: Scenario; + status: Status; + stepResults: any[]; + } + + interface StepPayload extends EventPayload { + arguments: any; + line: number; + name: string; + scenario: Scenario; + uri: string; + isBackground: boolean; + keyword: string; + keywordType: string; + } + + interface StepResultPayload extends EventPayload { + ambiguousStepDefinitions: any; + attachments: any[]; + duration: any; + failureException: Error; + step: Step; + stepDefinition: StepDefinition; + status: Status; + } +} + +export interface StepDefinition { + // tslint:disable-next-line ban-types + code: Function; + line: number; + options: {}; + pattern: any; + uri: string; +} + +export interface Tag { + name: string; + line: number; +} + +export interface Step { + arguments: any; + line: number; + name: string; + scenario: Scenario; + uri: string; + isBackground: boolean; + keyword: string; + keywordType: string; +} + +export interface Scenario { + feature: Feature; + exception: Error; + keyword: string; + lines: number[]; + name: string; + tags: Tag[]; + uri: string; + line: number; + description: string; + steps: Step[]; +} + +export interface Feature { + description: string; + keyword: string; + line: number; + name: string; + tags: Tag[]; + uri: string; + scenarios: Scenario[]; +} + +export type EventHook = (event: events.Event, callback?: () => void) => void; + +export type SupportCodeConsumer = (stepDefinitions: StepDefinitions & Hooks) => void; + +export function defineSupportCode(consumer: SupportCodeConsumer): void; + +export function getSupportCodeFns(): SupportCodeConsumer[]; + +export function clearSupportCodeFns(): void; + +// https://github.com/cucumber/cucumber-js/commit/231183a8a11c985ef7ced1155b7a75f5120a34b6 +export class Formatter { + constructor(options?: any); + + log(data: any): void; +} + +export class SummaryFormatter extends Formatter { + indent(text: string, numberOfSpaces: number): any; +} + +export class PrettyFormatter extends SummaryFormatter { + formatTags(tags: Tag[]): any; + logIndented(text: string, level: number): void; + logStepResult(stepResult: any): void; +} + +export class ProgressFormatter extends SummaryFormatter { +} + +export class RerunFormatter extends Formatter { +} + +export class SnippetsFormatter extends Formatter { +} + +export class UsageFormatter extends Formatter { +} + +export class UsageJsonFormatter extends Formatter { +} + +export class JsonFormatter extends Formatter { +} diff --git a/types/cucumber/v3/tsconfig.json b/types/cucumber/v3/tsconfig.json new file mode 100644 index 0000000000..badf9c82ed --- /dev/null +++ b/types/cucumber/v3/tsconfig.json @@ -0,0 +1,32 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": false, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "types": [], + "paths": { + "cucumber": [ + "cucumber/v3" + ], + "cucumber/*": [ + "cucumber/v3/*" + ] + }, + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "cucumber-tests.ts" + ] +} \ No newline at end of file diff --git a/types/cucumber/v3/tslint.json b/types/cucumber/v3/tslint.json new file mode 100644 index 0000000000..215db37b37 --- /dev/null +++ b/types/cucumber/v3/tslint.json @@ -0,0 +1,8 @@ +{ + "extends": "dtslint/dt.json", + "no-any-union": false, + "rules": { + "no-any-union": false, + "no-unnecessary-generics": false + } +} From a28ebd0744b0b3272fd1795d087e603d24ab618d Mon Sep 17 00:00:00 2001 From: Jan Franciszek Cieslak Date: Mon, 29 Jan 2018 20:41:31 +0100 Subject: [PATCH 012/210] missing arg for marksAcross($end) (#23242) --- types/prosemirror-model/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/prosemirror-model/index.d.ts b/types/prosemirror-model/index.d.ts index 47741b200e..153358e3c6 100644 --- a/types/prosemirror-model/index.d.ts +++ b/types/prosemirror-model/index.d.ts @@ -832,7 +832,7 @@ export class ResolvedPos { * its parent node or its parent node isn't a textblock (in which * case no marks should be preserved). */ - marksAcross(): Mark[] | null | void; + marksAcross($end: ResolvedPos): Mark[] | null | void; /** * The depth up to which this position and the given (non-resolved) * position share the same parent nodes. From 71d5025d762442d511de2e4b4206d4178511827d Mon Sep 17 00:00:00 2001 From: KoalaHuman Date: Mon, 29 Jan 2018 22:44:02 +0300 Subject: [PATCH 013/210] [react-datepicker] updated typings for 1.1.0 (#23247) --- types/react-datepicker/index.d.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/types/react-datepicker/index.d.ts b/types/react-datepicker/index.d.ts index cb68e8f0b2..60309b7f20 100644 --- a/types/react-datepicker/index.d.ts +++ b/types/react-datepicker/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-datepicker 1.0 +// Type definitions for react-datepicker 1.1 // Project: https://github.com/Hacker0x01/react-datepicker // Definitions by: Rajab Shakirov , // Andrey Balokha , @@ -37,6 +37,7 @@ export interface ReactDatePickerProps { highlightDates?: any[]; id?: string; includeDates?: any[]; + includeTimes?: any[]; inline?: boolean; isClearable?: boolean; locale?: string; @@ -64,10 +65,13 @@ export interface ReactDatePickerProps { readOnly?: boolean; required?: boolean; scrollableYearDropdown?: boolean; + scrollableMonthYearDropdown?: boolean; selected?: moment.Moment | null; selectsEnd?: boolean; selectsStart?: boolean; + showDisabledMonthNavigation?: boolean; showMonthDropdown?: boolean; + showMonthYearDropdown?: boolean; showWeekNumbers?: boolean; showYearDropdown?: boolean; startDate?: moment.Moment; From bb7103dc31e040174216333350e3bd1ac99f547d Mon Sep 17 00:00:00 2001 From: woutervh- Date: Mon, 29 Jan 2018 20:44:42 +0100 Subject: [PATCH 014/210] Added missing FeatureCollection type field (#23249) --- types/geojson/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/geojson/index.d.ts b/types/geojson/index.d.ts index e6783255eb..85f02aaad0 100644 --- a/types/geojson/index.d.ts +++ b/types/geojson/index.d.ts @@ -161,5 +161,6 @@ export interface Feature extend * https://tools.ietf.org/html/rfc7946#section-3.3 */ export interface FeatureCollection extends GeoJsonObject { + type: "FeatureCollection"; features: Array>; } From cedbc9ed4d0bb0a6c74acf32f16b92b6723bcaa8 Mon Sep 17 00:00:00 2001 From: Andy Patterson Date: Mon, 29 Jan 2018 14:44:50 -0500 Subject: [PATCH 015/210] Use NodeRequire as callback parameter type (#23254) --- types/webpack-env/index.d.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/types/webpack-env/index.d.ts b/types/webpack-env/index.d.ts index 9d866cbba8..7320a438e9 100644 --- a/types/webpack-env/index.d.ts +++ b/types/webpack-env/index.d.ts @@ -31,8 +31,7 @@ declare namespace __WebpackModuleApi { * * This creates a chunk. The chunk can be named. If a chunk with this name already exists, the dependencies are merged into that chunk and that chunk is used. */ - ensure(paths: string[], callback: (require: (id: string) => any) => void, chunkName?: string): void; - ensure(paths: string[], callback: (require: (id: string) => T) => void, chunkName?: string): void; + ensure(paths: string[], callback: (require: NodeRequire) => void, chunkName?: string): void; context(path: string, deep?: boolean, filter?: RegExp): RequireContext; /** * Returns the module id of a dependency. The call is sync. No request to the server is fired. The compiler ensures that the dependency is available. From 9c90ba41432a9d429ab6d02fa6ff21cd39aabf43 Mon Sep 17 00:00:00 2001 From: Thea Lanherne Date: Mon, 29 Jan 2018 19:45:09 +0000 Subject: [PATCH 016/210] Add missing `drawerBackgroundColor` prop to react-navigation DrawerNavigatorConfig (#23255) --- types/react-navigation/index.d.ts | 1 + .../react-navigation-tests.tsx | 32 +++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/types/react-navigation/index.d.ts b/types/react-navigation/index.d.ts index 37d6360688..1c6f6716a9 100644 --- a/types/react-navigation/index.d.ts +++ b/types/react-navigation/index.d.ts @@ -550,6 +550,7 @@ export const DrawerItems: React.ComponentType; * Drawer Navigator */ export interface DrawerViewConfig { + drawerBackgroundColor?: string; drawerWidth?: number; drawerPosition?: 'left' | 'right'; contentComponent?: React.ComponentType; diff --git a/types/react-navigation/react-navigation-tests.tsx b/types/react-navigation/react-navigation-tests.tsx index 40d19f0fee..9b61d11c2d 100644 --- a/types/react-navigation/react-navigation-tests.tsx +++ b/types/react-navigation/react-navigation-tests.tsx @@ -5,6 +5,8 @@ import { ViewStyle, } from 'react-native'; import { + DrawerNavigator, + DrawerNavigatorConfig, NavigationAction, NavigationActions, NavigationBackAction, @@ -194,6 +196,36 @@ function renderBasicStackNavigator(): JSX.Element { ); } +/** + * Drawer navigator. + */ + +const drawerNavigatorScreenOptions: NavigationTabScreenOptions = { + title: 'title', +}; + +const drawerNavigatorConfig: DrawerNavigatorConfig = { + drawerBackgroundColor: '#777777', + contentOptions: { + activeTintColor: '#7A9B49', + inactiveTintColor: '#FFFFFF', + }, +}; + +const BasicDrawerNavigator = DrawerNavigator( + routeConfigMap, + stackNavigatorConfig, +); + +function renderBasicDrawerNavigator(): JSX.Element { + return ( + { }} + style={viewStyle} + /> + ); +} + interface CustomTransitionerProps { navigation: NavigationScreenProp; } From 175b31c5dc29d282cf0bc049e48f5efc2866b676 Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Mon, 29 Jan 2018 11:45:54 -0800 Subject: [PATCH 017/210] Fix spelling of "enableTouchControl" (#23261) Fixes #23259 --- types/swiper/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/swiper/index.d.ts b/types/swiper/index.d.ts index 5f4cf01298..65872facd2 100644 --- a/types/swiper/index.d.ts +++ b/types/swiper/index.d.ts @@ -320,8 +320,8 @@ declare class Swiper { enableMousewheelControl(): void; disableKeyboardControl(): void; enableKeyboardControl(): void; - disableTouchContro(): void; - enableTouchContro(): void; + disableTouchControl(): void; + enableTouchControl(): void; unsetGrabCursor(): void; setGrabCursor(): void; From 8433a74d300f63e0b12f956ebc8718dd39ca4eee Mon Sep 17 00:00:00 2001 From: "Matt R. Wilson" Date: Mon, 29 Jan 2018 12:57:16 -0700 Subject: [PATCH 018/210] [@types/request] Fill out Request and Response. (#23004) * [@types/request] Fill out Request and Response. This hold much more true to the actual lib where a `Request` and `Response` reference each other and the `Request` has most of the provided options merged onto it, plus other stuff. Makes use of the newly added `@types/caseless` to DRY up some of the header work. Updated version reference from 2.0 to 2.47 to cover both the addition of `caseless` and the removal of `getAgent` from the lib. I have a project that uses `request-promise-native`, these changes work in my testing and having the `Response` object typed allowed me to remove all my declaration merging files from the `request` namespace. * [@types/request] Update promise sub-libs. Update `request-promise` and `request-promise-native` to use new `Response` interface. --- types/request-promise-native/index.d.ts | 4 +- types/request-promise/index.d.ts | 2 +- types/request/index.d.ts | 150 ++++++++++++++++++------ types/request/request-tests.ts | 64 +++++++--- 4 files changed, 166 insertions(+), 54 deletions(-) diff --git a/types/request-promise-native/index.d.ts b/types/request-promise-native/index.d.ts index e4fc27a8c2..d13e4c8fd5 100644 --- a/types/request-promise-native/index.d.ts +++ b/types/request-promise-native/index.d.ts @@ -17,11 +17,11 @@ declare namespace requestPromise { interface RequestPromiseOptions extends request.CoreOptions { simple?: boolean; - transform?(body: any, response: http.IncomingMessage, resolveWithFullResponse?: boolean): any; + transform?(body: any, response: request.Response, resolveWithFullResponse?: boolean): any; resolveWithFullResponse?: boolean; } - type FullResponse = request.RequestResponse; + type FullResponse = request.Response; type OptionsWithUri = request.UriOptions & RequestPromiseOptions; type OptionsWithUrl = request.UrlOptions & RequestPromiseOptions; type Options = OptionsWithUri | OptionsWithUrl; diff --git a/types/request-promise/index.d.ts b/types/request-promise/index.d.ts index 8e811a415e..8b2382d049 100644 --- a/types/request-promise/index.d.ts +++ b/types/request-promise/index.d.ts @@ -23,7 +23,7 @@ declare namespace requestPromise { interface RequestPromiseOptions extends request.CoreOptions { simple?: boolean; - transform?(body: any, response: http.IncomingMessage, resolveWithFullResponse?: boolean): any; + transform?(body: any, response: request.Response, resolveWithFullResponse?: boolean): any; transform2xxOnly?: boolean; resolveWithFullResponse?: boolean; } diff --git a/types/request/index.d.ts b/types/request/index.d.ts index c35adefa86..71f41ff794 100644 --- a/types/request/index.d.ts +++ b/types/request/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for request 2.0 +// Type definitions for request 2.47 // Project: https://github.com/request/request // Definitions by: Carlos Ballesteros Velasco , // bonnici , @@ -14,11 +14,13 @@ /// +import caseless = require('caseless'); import stream = require('stream'); import http = require('http'); import https = require('https'); import fs = require('fs'); import FormData = require('form-data'); +import net = require('net'); import tough = require('tough-cookie'); import { Url } from 'url'; @@ -113,7 +115,7 @@ declare namespace request { interface CoreOptions { baseUrl?: string; - callback?: (error: any, response: RequestResponse, body: any) => void; + callback?: RequestCallback; jar?: CookieJar | boolean; formData?: { [key: string]: any }; form?: { [key: string]: any } | string; @@ -177,32 +179,7 @@ declare namespace request { type OptionsWithUrl = UrlOptions & CoreOptions; type Options = OptionsWithUri | OptionsWithUrl; - type RequestCallback = (error: any, response: RequestResponse, body: any) => void; - - type ResponseRequest = CoreOptions & { - uri: Url; - }; - - interface RequestResponse extends http.IncomingMessage { - request: ResponseRequest; - body: any; - timingStart?: number; - timings?: { - socket: number; - lookup: number; - connect: number; - response: number; - end: number; - }; - timingPhases?: { - wait: number; - dns: number; - tcp: number; - firstByte: number; - download: number; - total: number; - }; - } + type RequestCallback = (error: any, response: Response, body: any) => void; interface HttpArchiveRequest { url?: string; @@ -232,32 +209,32 @@ declare namespace request { body: any; } - interface Request extends stream.Stream { + interface Request extends caseless.Httpified, stream.Stream { readable: boolean; writable: boolean; + explicitMethod?: true; - getAgent(): http.Agent; - // start(): void; - // abort(): void; + debug(...args: any[]): void; pipeDest(dest: any): void; - setHeader(name: string, value: string, clobber?: boolean): Request; - setHeaders(headers: Headers): Request; qs(q: object, clobber?: boolean): Request; form(): FormData; form(form: any): Request; multipart(multipart: RequestPart[]): Request; json(val: any): Request; aws(opts: AWSOptions, now?: boolean): Request; + hawk(opts: HawkOptions): void; auth(username: string, password: string, sendImmediately?: boolean, bearer?: string): Request; oauth(oauth: OAuthOptions): Request; jar(jar: CookieJar): Request; on(event: string, listener: (...args: any[]) => void): this; on(event: 'request', listener: (req: http.ClientRequest) => void): this; - on(event: 'response', listener: (resp: http.IncomingMessage) => void): this; + on(event: 'response', listener: (resp: Response) => void): this; on(event: 'data', listener: (data: Buffer | string) => void): this; on(event: 'error', listener: (e: Error) => void): this; - on(event: 'complete', listener: (resp: http.IncomingMessage, body?: string | Buffer) => void): this; + on(event: 'complete', listener: (resp: Response, body?: string | Buffer) => void): this; + on(event: 'pipe', listener: (src: stream.Readable) => void): this; + on(event: 'socket', listener: (src: net.Socket) => void): this; write(buffer: Buffer | string, cb?: (err?: Error) => void): boolean; write(str: string, encoding?: string, cb?: (err?: Error) => void): boolean; @@ -269,9 +246,95 @@ declare namespace request { resume(): void; abort(): void; destroy(): void; - toJSON(): object; + toJSON(): RequestAsJSON; + + // several of the CoreOptions are copied onto the request instance + host?: string; + port?: number; + followAllRedirects?: boolean; + followOriginalHttpMethod?: boolean; + maxRedirects?: number; + removeRefererHeader?: boolean; + encoding?: string | null; + timeout?: number; + localAddress?: string; + strictSSL?: boolean; + rejectUnauthorized?: boolean; + time?: boolean; + gzip?: boolean; + preambleCRLF?: boolean; + postambleCRLF?: boolean; + withCredentials?: boolean; + key?: Buffer; + cert?: Buffer; + passphrase?: string; + ca?: string | Buffer | string[] | Buffer[]; + har?: HttpArchiveRequest; + + // set in `Request.prototype.init` + headers: Headers; + method: string; + pool: false | { [key: string]: http.Agent | https.Agent }; + dests: stream.Readable[]; + callback?: RequestCallback; + uri: Url & { href: string, pathname: string }; + proxy: null | string | Url; + tunnel: boolean; + setHost: boolean; + path: string; + agent: false | http.Agent | https.Agent; + body: Buffer | Buffer[] | string | string[] | stream.Readable; + timing?: boolean; + src?: stream.Readable; + + // set in `Request.prototype.start` + href: string; + startTime?: number; + startTimeNow?: number; + timings?: { + socket: number; + lookup: number; + connect: number; + response: number; + end: number; + }; + + // set in `Request.prototype.onRequestResponse` + elapsedTime?: number; + response?: Response; } + interface Response extends http.IncomingMessage { + statusCode: number; + statusMessage: string; + request: Request; + body: any; // Buffer, string, stream.Readable, or a plain object if `json` was truthy + caseless: caseless.Caseless; // case-insensitive access to headers + toJSON(): ResponseAsJSON; + + timingStart?: number; + elapsedTime?: number; + timings?: { + socket: number; + lookup: number; + connect: number; + response: number; + end: number; + }; + timingPhases?: { + wait: number; + dns: number; + tcp: number; + firstByte: number; + download: number; + total: number; + }; + } + + // aliases for backwards compatibility + type ResponseRequest = Request; + type RequestResponse = Response; + interface Headers { [key: string]: any; } @@ -305,6 +368,19 @@ declare namespace request { bucket?: string; } + interface RequestAsJSON { + uri: Url; + method: string; + headers: Headers; + } + + interface ResponseAsJSON { + statusCode: number; + body: any; + headers: Headers; + request: RequestAsJSON; + } + type Cookie = tough.Cookie; interface CookieJar { diff --git a/types/request/request-tests.ts b/types/request/request-tests.ts index bffb522876..5f56f3bc9d 100644 --- a/types/request/request-tests.ts +++ b/types/request/request-tests.ts @@ -7,23 +7,23 @@ import request = require('request'); import stream = require('stream'); import urlModule = require('url'); -const value: any = 'value'; +let value: any; let str: string; let strOrUndef: string | undefined; let strOrTrueOrUndef: string | true | undefined; const buffer: NodeBuffer = new Buffer('foo'); -const num = 0; +let num = 0; let bool: boolean; let date: Date; let obj: object; const dest = 'foo'; const uri = 'foo-bar'; -const headers: request.Headers = {}; +let headers: request.Headers = {}; -let agent: http.Agent; let write: stream.Writable = new stream.Writable(); let req: request.Request = request(uri, function callback() {}); +let res: request.Response; let form: FormData; const bodyArr: request.RequestPart[] = [{ @@ -126,14 +126,14 @@ const opt: request.OptionsWithUri = { opt.uri = str; // --- --- --- --- --- --- --- --- --- --- --- --- +let strOrFalse: string | false; +strOrFalse = req.setHeader(str, str); +strOrFalse = req.setHeader(str, str, bool); +req.setHeader({str}); +strOrFalse = req.hasHeader(str); +strOrUndef = req.getHeader(str); +bool = req.removeHeader(str); -agent = req.getAgent(); -// req.start(); -// req.abort(); -req.pipeDest(dest); -req = req.setHeader(str, str); -req = req.setHeader(str, str, bool); -req = req.setHeaders(headers); req = req.qs(obj); req = req.qs(obj, bool); req = req.form(obj); @@ -147,6 +147,7 @@ req = req.jar(jar); write = req.pipe(write); write = req.pipe(write, value); req.pipe(req); +req.pipeDest(dest); req.write(value); req.end(str); req.end(buffer); @@ -155,6 +156,19 @@ req.resume(); req.abort(); req.destroy(); +strOrUndef = req.host; +str = req.method; +str = req.path; +str = req.href; +str = req.uri.href; +str = req.uri.pathname; +value = req.body; +headers = req.headers; +value = req.headers['foo']; + +if (req.response) { + res = req.response; +} // --- --- --- --- --- --- --- --- --- --- --- --- req = request(uri); @@ -227,8 +241,30 @@ r.post(options); request .get('http://example.com/example.png') -.on('response', (response: any) => { - // check response +.on('response', (response) => { + res = response; + num = response.statusCode; + str = response.statusMessage; + req = response.request; + value = response.body; + strOrUndef = response.caseless.get('foo'); + strOrFalse = response.caseless.has('content-type'); + + if (response.timings) { + num = response.timings.socket; + num = response.timings.lookup; + num = response.timings.connect; + num = response.timings.response; + num = response.timings.end; + } + if (response.timingPhases) { + num = response.timingPhases.wait; + num = response.timingPhases.dns; + num = response.timingPhases.tcp; + num = response.timingPhases.firstByte; + num = response.timingPhases.download; + num = response.timingPhases.total; + } }) .pipe(request.put('http://another.com/another.png')); @@ -247,7 +283,7 @@ request.get('http://google.com/img.png').pipe(request.put('http://mysite.com/img request .get('http://google.com/img.png') - .on('response', (response: any) => { + .on('response', (response) => { console.log(response.statusCode); // 200 console.log(response.headers['content-type']); // 'image/png' }) From 204f9d15c7a4b6016fde974618d1b77e4c23c2b5 Mon Sep 17 00:00:00 2001 From: Punit Gupta Date: Tue, 30 Jan 2018 01:32:28 +0530 Subject: [PATCH 019/210] Add types for '@storybook/vue' package (#23048) * feat(storybook__vue): Add @storybook/vue types * fix(storybook__vue): Add generic param to ComponentOptions * fix(storybook__vue): Fix linting issues * fix(storybook__vue): Fix build errors * fix(storybook__vue): Minor bug fix --- types/storybook__vue/index.d.ts | 39 +++++++++++++++ types/storybook__vue/package.json | 6 +++ types/storybook__vue/storybook__vue-tests.ts | 50 ++++++++++++++++++++ types/storybook__vue/tsconfig.json | 29 ++++++++++++ types/storybook__vue/tslint.json | 3 ++ 5 files changed, 127 insertions(+) create mode 100644 types/storybook__vue/index.d.ts create mode 100644 types/storybook__vue/package.json create mode 100644 types/storybook__vue/storybook__vue-tests.ts create mode 100644 types/storybook__vue/tsconfig.json create mode 100644 types/storybook__vue/tslint.json diff --git a/types/storybook__vue/index.d.ts b/types/storybook__vue/index.d.ts new file mode 100644 index 0000000000..13e6099724 --- /dev/null +++ b/types/storybook__vue/index.d.ts @@ -0,0 +1,39 @@ +// Type definitions for @storybook/vue 3.3 +// Project: https://github.com/storybooks/storybook +// Definitions by: Punit Gupta +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 +// Created with the help of storybook__react types + +/// + +import Vue, { ComponentOptions } from 'vue'; + +// Story can be used as template or component +export type StoryFunction = () => ComponentOptions | string; +export type StoryDecorator = (story: () => ComponentOptions, context: { kind: string, story: string }) => ComponentOptions | null; + +export interface Story { + readonly kind: string; + add(storyName: string, getStory: StoryFunction): this; + addDecorator(decorator: StoryDecorator): this; +} + +export interface Addon { + [addonName: string]: (storyName: string, storyFn: StoryFunction) => void; +} +export interface StoryStore { + fileName: string | undefined; + kind: string; + stories: StoryObject[]; +} +export interface StoryObject { + name: string; + render: StoryFunction; +} + +export function addDecorator(decorator: StoryDecorator): void; +export function configure(loaders: () => void, module: NodeModule): void; +export function getStorybook(): StoryStore[]; +export function setAddon(addon: Addon): void; +export function storiesOf(kind: string, module: NodeModule): Story; diff --git a/types/storybook__vue/package.json b/types/storybook__vue/package.json new file mode 100644 index 0000000000..667aabc813 --- /dev/null +++ b/types/storybook__vue/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "vue": "^2.0.0" + } +} \ No newline at end of file diff --git a/types/storybook__vue/storybook__vue-tests.ts b/types/storybook__vue/storybook__vue-tests.ts new file mode 100644 index 0000000000..7c5c786ab7 --- /dev/null +++ b/types/storybook__vue/storybook__vue-tests.ts @@ -0,0 +1,50 @@ +import Vue, { ComponentOptions } from 'vue'; +import { addDecorator, configure, getStorybook, setAddon, storiesOf, StoryFunction, Story } from '@storybook/vue'; + +interface CustomStory extends Story { + addCentered(storyName: string, storyFn: StoryFunction): this; +} + +const addCenteredAddon = { + addCentered(this: Story, storyName: string, storyFn: StoryFunction): void { + console.log(this.kind); + this.add(storyName, storyFn); + } +}; + +const Decorator = (story: () => ComponentOptions) => { + const wrapper = story(); + return { + components: { wrapper }, + template: '
', + data() { + return { borderStyle: 'medium solid red' }; + } + }; +}; + +addDecorator(Decorator); +configure(() => undefined, module); +getStorybook().forEach(({ fileName, kind, stories }) => stories.forEach(({ name, render }) => render())); +setAddon(addCenteredAddon); + +storiesOf('Storybook__vue', module) + .addDecorator(Decorator) + .add('story as a template', () => '
') + .add('story as a component', () => ({ + components: {}, + template: '
' + })); + +(storiesOf('Custom_Story', module) as CustomStory) + .addCentered('custom story', () => ({ + template: '
' + })) + .add('story as a template', () => '
') + .add('story as a component', () => ({ + components: {}, + template: '
' + })) + .addCentered('custom story', () => ({ + template: '
' + })); diff --git a/types/storybook__vue/tsconfig.json b/types/storybook__vue/tsconfig.json new file mode 100644 index 0000000000..a472ebed8a --- /dev/null +++ b/types/storybook__vue/tsconfig.json @@ -0,0 +1,29 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "dom", + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "paths": { + "@storybook/vue": [ + "storybook__vue" + ] + }, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "storybook__vue-tests.ts" + ] +} \ No newline at end of file diff --git a/types/storybook__vue/tslint.json b/types/storybook__vue/tslint.json new file mode 100644 index 0000000000..e60c15844f --- /dev/null +++ b/types/storybook__vue/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file From 3c02bc73f802c857797af9480417cfb974aa6dca Mon Sep 17 00:00:00 2001 From: Kurt Preston Date: Mon, 29 Jan 2018 14:06:10 -0600 Subject: [PATCH 020/210] [gulp-nodemon] Adding args, nodeArgs, scriptPosition to Options (#23096) --- types/gulp-nodemon/gulp-nodemon-tests.ts | 2 ++ types/gulp-nodemon/index.d.ts | 3 +++ 2 files changed, 5 insertions(+) diff --git a/types/gulp-nodemon/gulp-nodemon-tests.ts b/types/gulp-nodemon/gulp-nodemon-tests.ts index 364536f778..4c36b42aa9 100644 --- a/types/gulp-nodemon/gulp-nodemon-tests.ts +++ b/types/gulp-nodemon/gulp-nodemon-tests.ts @@ -29,6 +29,8 @@ nodemon({ }); return tasks } + , nodeArgs: ['--trace-warnings'] + , args: ['-t'] }); diff --git a/types/gulp-nodemon/index.d.ts b/types/gulp-nodemon/index.d.ts index 7c5491f596..de08560463 100644 --- a/types/gulp-nodemon/index.d.ts +++ b/types/gulp-nodemon/index.d.ts @@ -69,6 +69,9 @@ declare namespace nodemon { execMap?: { [key: string]: string | boolean | number; }; events?: { [key: string]: string; }; restartable?: string; + args?: string[]; + nodeArgs?: string[]; + scriptPosition?: number; } interface EventEmitter extends NodeJS.EventEmitter { From 37c1b1dfea24c2d29665a003ca73ef6acbbc5970 Mon Sep 17 00:00:00 2001 From: Georgii Dolzhykov Date: Mon, 29 Jan 2018 22:12:25 +0200 Subject: [PATCH 021/210] AngularJS: 1) fix for $q.reject in then callbacks, 2) types for $error and $pending (#23115) * AngularJS: 1) fix an issue with $q.reject in then callbacks, 2) types for $error and $pending Fixes #21333 * Promise typings from lib.d.ts + IPromise hack --- types/angular/angular-tests.ts | 210 ++++++++++++++++++++++++--------- types/angular/index.d.ts | 49 +++++--- 2 files changed, 185 insertions(+), 74 deletions(-) diff --git a/types/angular/angular-tests.ts b/types/angular/angular-tests.ts index 795e74a058..7f5649befb 100644 --- a/types/angular/angular-tests.ts +++ b/types/angular/angular-tests.ts @@ -548,80 +548,158 @@ namespace TestPromise { const promise: angular.IPromise = null; const $q: angular.IQService = null; - const assertPromiseType = (arg: angular.IPromise) => arg; const reject = $q.reject(); // promise.then - assertPromiseType(promise.then((result) => any)); - assertPromiseType(promise.then((result) => any, (any) => any)); - assertPromiseType(promise.then((result) => any, (any) => any, (any) => any)); + // $ExpectType IPromise + promise.then(result => any); + // $ExpectType IPromise + promise.then(result => any, any => any); + // $ExpectType IPromise + promise.then(result => any, any => any, any => any); - assertPromiseType(promise.then((result) => reject)); - assertPromiseType(promise.then((result) => reject, (any) => reject)); - assertPromiseType(promise.then((result) => reject, (any) => reject, (any) => any)); + // $ExpectType IPromise + promise.then(result => reject); + // $ExpectType IPromise + promise.then(result => reject, any => reject); + // $ExpectType IPromise + promise.then(result => reject, any => reject, any => any); - assertPromiseType(promise.then((result) => result)); - assertPromiseType(promise.then((result) => tresult)); - assertPromiseType(promise.then((result) => tresultPromise)); - assertPromiseType(promise.then((result) => result, (any) => any)); - assertPromiseType(promise.then((result) => result, (any) => any, (any) => any)); - assertPromiseType(promise.then((result) => result, (any) => reject, (any) => any)); + // $ExpectType IPromise + promise.then(result => result); + // $ExpectType IPromise + promise.then(result => tresult); + // $ExpectType IPromise + promise.then(result => tresultPromise); + // $ExpectType IPromise + promise.then(result => result, any => any); + // $ExpectType IPromise + promise.then(result => result, any => Math.random()); + // $ExpectType IPromise + promise.then(result => result, any => any, any => any); + // $ExpectType IPromise + promise.then(result => result, any => Math.random(), any => any); + // $ExpectType IPromise + promise.then(result => result, any => reject, any => any); - assertPromiseType | TResult>(promise.then((result) => anyOf2(reject, result))); - assertPromiseType(promise.then((result) => anyOf3(result, tresultPromise, reject))); - assertPromiseType(promise.then( - (result) => anyOf3(reject, result, tresultPromise), - (reason) => anyOf3(reject, tresult, tresultPromise) - )); + // $ExpectType IPromise + promise.then(result => anyOf2(reject, result)); + // $ExpectType IPromise + promise.then(result => anyOf3(result, tresultPromise, reject)); + // $ExpectType IPromise + promise.then( + result => anyOf3(reject, result, tresultPromise), + reason => anyOf3(reject, tresult, tresultPromise) + ); - assertPromiseType>(promise.then((result) => tresultHttpPromise)); + // $ExpectType IPromise> + promise.then(result => tresultHttpPromise); - assertPromiseType(promise.then((result) => result, (any) => tother)); - assertPromiseType | angular.IPromise | TOther | angular.IPromise>(promise.then( - (result) => anyOf3(reject, result, totherPromise), - (reason) => anyOf3(reject, tother, tresultPromise) - )); + // $ExpectType IPromise + promise.then(result => result, any => tother); - assertPromiseType(promise.then( - (result) => anyOf3(tresultPromise, result, totherPromise) - )); + // These are broken and seemingly can't be made to work + // with the current limitations of TypeScript. - assertPromiseType(promise.then((result) => result, (any) => tother, (any) => any)); - assertPromiseType(promise.then((result) => tresultPromise, (any) => totherPromise)); - assertPromiseType(promise.then((result) => tresultPromise, (any) => totherPromise, (any) => any)); - assertPromiseType>(promise.then((result) => tresultHttpPromise, (any) => totherHttpPromise)); - assertPromiseType>(promise.then((result) => tresultHttpPromise, (any) => totherHttpPromise, (any) => any)); + // xExpectType IPromise + // promise.then(result => anyOf2(result, totherPromise)); + // xExpectType IPromise + // promise.then(result => anyOf3(reject, result, totherPromise)); + // xExpectType IPromise + // const a4 = promise.then( + // result => anyOf3(reject, result, totherPromise), + // reason => anyOf3(reject, tother, tresultPromise) + // ); - assertPromiseType(promise.then((result) => tother)); - assertPromiseType(promise.then((result) => tother, (any) => any)); - assertPromiseType(promise.then((result) => tother, (any) => any, (any) => any)); - assertPromiseType(promise.then((result) => totherPromise)); - assertPromiseType(promise.then((result) => totherPromise, (any) => any)); - assertPromiseType(promise.then((result) => totherPromise, (any) => any, (any) => any)); - assertPromiseType>(promise.then((result) => totherHttpPromise)); - assertPromiseType>(promise.then((result) => totherHttpPromise, (any) => any)); - assertPromiseType>(promise.then((result) => totherHttpPromise, (any) => any, (any) => any)); + // $ExpectType IPromise + promise.then(result => + anyOf3(tresultPromise, result, totherPromise) + ); - assertPromiseType(promise.then((result) => tresult, (any) => tother).then(ambiguous => isTResult(ambiguous) ? ambiguous.c : ambiguous.f)); + // $ExpectType IPromise + promise.then(result => result, any => tother, any => any); + // $ExpectType IPromise + promise.then(result => tresultPromise, any => totherPromise); + // $ExpectType IPromise + promise.then(result => tresultPromise, any => totherPromise, any => any); + // $ExpectType IPromise | IHttpResponse> + promise.then(result => tresultHttpPromise, any => totherHttpPromise); + // $ExpectType IPromise | IHttpResponse> + promise.then(result => tresultHttpPromise, any => totherHttpPromise, any => any); + + // $ExpectType IPromise + promise.then(result => tother); + // $ExpectType IPromise + promise.then(result => tother, any => any); + // $ExpectType IPromise + promise.then(result => tother, any => any, any => any); + // $ExpectType IPromise + promise.then(result => totherPromise); + // $ExpectType IPromise + promise.then(result => totherPromise, any => any); + // $ExpectType IPromise + promise.then(result => totherPromise, any => any, any => any); + // $ExpectType IPromise> + promise.then(result => totherHttpPromise); + // $ExpectType IPromise + promise.then(result => totherHttpPromise, any => any); + // $ExpectType IPromise + promise.then(result => totherHttpPromise, any => any, any => any); + + // $ExpectType IPromise + promise + .then(result => tresult, any => tother) + .then(ambiguous => (isTResult(ambiguous) ? ambiguous.c : ambiguous.f)); + + // promise.then + $q.reject: + + // $ExpectType IPromise + $q.resolve(true).then(result => Math.random() > 0.5 ? Math.random() : $q.reject()); + // $ExpectType IPromise + $q.resolve(true).then(result => Math.random() > 0.5 ? Math.random() : $q.reject('a')); + // $ExpectType IPromise + $q.resolve().then(() => $q.reject('a')); + // $ExpectType IPromise + $q.resolve().then(() => { + if (Math.random() > 0.5) $q.reject(); + }); // promise.catch - assertPromiseType(promise.catch((err) => err)); - assertPromiseType(promise.catch((err) => any)); - assertPromiseType(promise.catch((err) => tresult)); - assertPromiseType>(promise.catch((err) => anyOf2(tresult, reject))); - assertPromiseType(promise.catch((err) => anyOf3(tresult, tresultPromise, reject))); - assertPromiseType(promise.catch((err) => tresultPromise)); - assertPromiseType>(promise.catch((err) => tresultHttpPromise)); - assertPromiseType(promise.catch((err) => tother)); - assertPromiseType(promise.catch((err) => totherPromise)); - assertPromiseType>(promise.catch((err) => totherHttpPromise)); + // $ExpectType IPromise + promise.catch(err => err); + // $ExpectType IPromise + promise.catch(err => any); + // $ExpectType IPromise + promise.catch(err => tresult); + // $ExpectType IPromise + promise.catch(err => anyOf2(tresult, reject)); + // $ExpectType IPromise + promise.catch(err => anyOf3(tresult, tresultPromise, reject)); + // $ExpectType IPromise + promise.catch(err => tresultPromise); + // $ExpectType IPromise> + promise.catch(err => tresultHttpPromise); + // $ExpectType IPromise + promise.catch(err => tother); + // $ExpectType IPromise + promise.catch(err => totherPromise); + // $ExpectType IPromise> + promise.catch(err => totherHttpPromise); - assertPromiseType(promise.catch((err) => tother).then(ambiguous => isTResult(ambiguous) ? ambiguous.c : ambiguous.f)); + // $ExpectType IPromise + promise + .catch(err => tother) + .then( + ambiguous => (isTResult(ambiguous) ? ambiguous.c : ambiguous.f) + ); // promise.finally - assertPromiseType(promise.finally(() => any)); - assertPromiseType(promise.finally(() => tresult)); - assertPromiseType(promise.finally(() => tother)); + // $ExpectType IPromise + promise.finally(() => any); + // $ExpectType IPromise + promise.finally(() => tresult); + // $ExpectType IPromise + promise.finally(() => tother); } function test_angular_forEach() { @@ -1187,6 +1265,24 @@ function NgModelControllerTyping() { }; } +// FormController +angular.module('app').directive('formDebugChecker', () => { + return { + require: '^^form', + link: (scope, el, attrs, ctrl) => { + const form = ctrl as angular.IFormController; + el.on('click', () => { + const report = [] as string[]; + angular.forEach(form.$error, (controls, validationErrorKey) => { + const names = controls.map(control => control.$name); + report.push(`${validationErrorKey}: ${controls.length} control(s) (${names.join(', ')})`); + }); + console.log(`This form has ${report.length} error(s).\n${report.join('\n')}`); + }); + } + }; +}); + let $filter: angular.IFilterService; function testFilter() { diff --git a/types/angular/index.d.ts b/types/angular/index.d.ts index efbabaa302..32a5c74b52 100644 --- a/types/angular/index.d.ts +++ b/types/angular/index.d.ts @@ -357,9 +357,9 @@ declare namespace angular { $valid: boolean; $invalid: boolean; $submitted: boolean; - $error: any; - $name: string; - $pending: any; + $error: { [validationErrorKey: string]: Array }; + $name?: string; + $pending?: { [validationErrorKey: string]: Array }; $addControl(control: INgModelController | IFormController): void; $removeControl(control: INgModelController | IFormController): void; $setValidity(validationErrorKey: string, isValid: boolean, control: INgModelController | IFormController): void; @@ -399,8 +399,8 @@ declare namespace angular { $parsers: IModelParser[]; $formatters: IModelFormatter[]; $viewChangeListeners: IModelViewChangeListener[]; - $error: any; - $name: string; + $error: { [validationErrorKey: string]: boolean }; + $name?: string; $touched: boolean; $untouched: boolean; @@ -408,7 +408,7 @@ declare namespace angular { $validators: IModelValidators; $asyncValidators: IAsyncModelValidators; - $pending: any; + $pending?: { [validationErrorKey: string]: boolean }; $pristine: boolean; $dirty: boolean; $valid: boolean; @@ -1103,28 +1103,43 @@ declare namespace angular { interface IPromise { /** - * Regardless of when the promise was or will be resolved or rejected, then calls one of the success or error callbacks asynchronously as soon as the result is available. The callbacks are called with a single argument: the result or rejection reason. Additionally, the notify callback may be called zero or more times to provide a progress indication, before the promise is resolved or rejected. - * The successCallBack may return IPromise for when a $q.reject() needs to be returned - * This method returns a new promise which is resolved or rejected via the return value of the successCallback, errorCallback. It also notifies via the return value of the notifyCallback method. The promise can not be resolved or rejected from the notifyCallback method. + * Regardless of when the promise was or will be resolved or rejected, then calls one of + * the success or error callbacks asynchronously as soon as the result is available. The + * callbacks are called with a single argument: the result or rejection reason. + * Additionally, the notify callback may be called zero or more times to provide a + * progress indication, before the promise is resolved or rejected. + * The `successCallBack` may return `IPromise` for when a `$q.reject()` needs to + * be returned. + * This method returns a new promise which is resolved or rejected via the return value + * of the `successCallback`, `errorCallback`. It also notifies via the return value of + * the `notifyCallback` method. The promise can not be resolved or rejected from the + * `notifyCallback` method. */ - then(successCallback: (promiseValue: T) => IPromise|TResult, errorCallback?: null, notifyCallback?: (state: any) => any): IPromise; - then(successCallback: (promiseValue: T) => IPromise|TResult2, errorCallback?: null, notifyCallback?: (state: any) => any): IPromise; - - then(successCallback: (promiseValue: T) => IPromise|TResult, errorCallback: (reason: any) => IPromise|TCatch, notifyCallback?: (state: any) => any): IPromise; - then(successCallback: (promiseValue: T) => IPromise|TResult2, errorCallback: (reason: any) => IPromise|TCatch2, notifyCallback?: (state: any) => any): IPromise; + then( + successCallback?: + | ((value: T) => IPromise | IPromise | TResult1) + | null, + errorCallback?: + | ((reason: any) => IPromise | IPromise | TResult2) + | null, + notifyCallback?: (state: any) => any + ): IPromise; /** * Shorthand for promise.then(null, errorCallback) */ - catch(onRejected: (reason: any) => IPromise|TCatch): IPromise; - catch(onRejected: (reason: any) => IPromise|TCatch2): IPromise; + catch( + onRejected?: + | ((reason: any) => IPromise | IPromise | TResult) + | null + ): IPromise; /** * Allows you to observe either the fulfillment or rejection of a promise, but to do so without modifying the final value. This is useful to release resources or do some clean-up that needs to be done whether the promise was rejected or resolved. See the full specification for more information. * * Because finally is a reserved word in JavaScript and reserved keywords are not supported as property names by ES3, you'll need to invoke the method like promise['finally'](callback) to make your code IE8 and Android 2.x compatible. */ - finally(finallyCallback: () => any): IPromise; + finally(finallyCallback: () => void): IPromise; } interface IDeferred { From 48d55d55fa40180035db615ec8fa57793c2f77ab Mon Sep 17 00:00:00 2001 From: Stephen Wilcox Date: Mon, 29 Jan 2018 12:15:27 -0800 Subject: [PATCH 022/210] Update chai-string definitions for 1.4.0 (#23118) --- types/chai-string/chai-string-tests.ts | 100 +++++++++++++++++++++++++ types/chai-string/index.d.ts | 10 ++- 2 files changed, 109 insertions(+), 1 deletion(-) diff --git a/types/chai-string/chai-string-tests.ts b/types/chai-string/chai-string-tests.ts index 615a6c1f95..dc798c102a 100644 --- a/types/chai-string/chai-string-tests.ts +++ b/types/chai-string/chai-string-tests.ts @@ -51,6 +51,90 @@ describe('chai-string', function() { }); + + describe('#containIgnoreSpaces', function () { + + it('should return true', function () { + var str1 = '1234abcdef56', + str2 = '1234a\nb\tc\r d ef56'; + str1.should.containIgnoreSpaces(str2); + }); + + it('should return true (2)', function () { + var str1 = 'abcdef', + str2 = 'a\nb\tc\r d ef'; + str1.should.containIgnoreSpaces(str2); + }); + + it('should return false', function () { + var str1 = 'abdef', + str2 = 'a\nb\tc\r d ef'; + str1.should.not.containIgnoreSpaces(str2); + }); + }); + + describe('#containIgnoreCase', function () { + + it('should return true', function () { + var str1 = 'abcdef', + str2 = 'cDe'; + str1.should.containIgnoreCase(str2); + }); + + it('should return true (2)', function () { + 'abcdef'.should.containIgnoreCase('cDe'); + }); + + it('should return true (3)', function () { + var str1 = 'abcdef', + str2 = 'AbCdeF'; + str1.should.containIgnoreCase(str2); + }); + + it('should return false', function () { + var str1 = 'abcdef', + str2 = 'efg'; + str1.should.not.containIgnoreCase(str2); + }); + + it('should return false (3)', function () { + var str1 = 'abcdef', + str2 = 'zabcd'; + str1.should.not.containIgnoreCase(str2); + }); + }); + + describe('#indexOf', function () { + + it('should return true', function () { + var str = 'abcabd', + substr = 'ab', + index = 0; + str.indexOf(substr, index).should.be.true; + }); + + it('should return true (2)', function () { + var str = 'abcabd', + substr = 'ca', + index = 2; + str.indexOf(substr, index).should.be.true; + }); + + it('should return true (3)', function () { + var str = 'ababab', + substr = 'ba', + index = 1; + str.indexOf(substr, index).should.be.true; + }); + + it('should return false', function () { + var str = 'abcaab', + substr = 'da', + index = 1; + str.indexOf(substr, index).should.be.false; + }); + }); + describe('tdd alias', function() { let str: string; let str2: string; @@ -92,6 +176,14 @@ describe('chai-string', function() { assert.notEqualIgnoreSpaces(str, str2 + 'g'); }); + it('.containIgnoreSpaces', function () { + assert.containIgnoreSpaces(str, str2); + }); + + it('.notContainIgnoreSpaces', function () { + assert.notContainIgnoreSpaces(str, str2 + 'g'); + }); + it('.singleLine', function() { assert.singleLine(str); }); @@ -125,5 +217,13 @@ describe('chai-string', function() { assert.entriesCount('', 'ab', 0); }); + it('.indexOf', function () { + assert.indexOf('abcabd', 'ab', 0); + assert.indexOf('abcabd', 'ca', 2); + assert.indexOf('ababab', 'ba', 1); + assert.indexOf('ababab', 'ba', 1); + 'ababab'.indexOf('ba', 1).should.be.true; + }); + }); }); diff --git a/types/chai-string/index.d.ts b/types/chai-string/index.d.ts index fad380cf07..bc990104be 100644 --- a/types/chai-string/index.d.ts +++ b/types/chai-string/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for chai-string 1.1.4 +// Type definitions for chai-string 1.4.0 // Project: https://github.com/onechiporenko/chai-string // Definitions by: Nick Malaguti // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -14,10 +14,13 @@ declare global { endWith(expected: string, message?: string): Assertion; equalIgnoreCase(expected: string, message?: string): Assertion; equalIgnoreSpaces(expected: string, message?: string): Assertion; + containIgnoreCase(expected: string, msg?: string): Assertion; + containIgnoreSpaces(expected: string, msg?: string): Assertion; singleLine(message?: string): Assertion; reverseOf(message?: string): Assertion; palindrome(message?: string): Assertion; entriesCount(substr: string, expected: number, message?: string): Assertion; + indexOf(str: string, substr: string, index: number, msg?: string): Assertion; } interface Assert { @@ -29,6 +32,10 @@ declare global { notEqualIgnoreCase(val: string, exp: string, msg?: string): void; equalIgnoreSpaces(val: string, exp: string, msg?: string): void; notEqualIgnoreSpaces(val: string, exp: string, msg?: string): void; + containIgnoreCase(val: string, exp: string, msg?: string): void; + notContainIgnoreCase(val: string, exp: string, msg?: string): void; + containIgnoreSpaces(val: string, exp: string, msg?: string): void; + notContainIgnoreSpaces(val: string, exp: string, msg?: string): void; singleLine(val: string, msg?: string): void; notSingleLine(val: string, msg?: string): void; reverseOf(val: string, exp: string, msg?: string): void; @@ -36,6 +43,7 @@ declare global { palindrome(val: string, msg?: string): void; notPalindrome(val: string, msg?: string): void; entriesCount(str: string, substr: string, count: number, msg?: string): void; + indexOf(str: string, substr: string, index: number, msg?: string): void; } } } From 257c8bc48a08620b77088af209ff3f4153221784 Mon Sep 17 00:00:00 2001 From: Phil McCloghry-Laing Date: Tue, 30 Jan 2018 07:24:25 +1100 Subject: [PATCH 023/210] [semver] Upgrade to 5.5, add typing for coerce (#23120) --- types/semver/index.d.ts | 8 +++++++- types/semver/semver-tests.ts | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/types/semver/index.d.ts b/types/semver/index.d.ts index 8b1bedbb58..06221be8af 100644 --- a/types/semver/index.d.ts +++ b/types/semver/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for semver 5.4 +// Type definitions for semver 5.5 // Project: https://github.com/npm/node-semver // Definitions by: Bart van der Schoor // BendingBender @@ -143,6 +143,12 @@ export function outside(version: string | SemVer, range: string | Range, hilo: ' */ export function intersects(range1: string | Range, range2: string | Range, loose?: boolean): boolean; +// Coercion +/** + * Coerces a string to semver if possible + */ +export function coerce(version: string | SemVer): SemVer | null; + export class SemVer { constructor(version: string | SemVer, loose?: boolean); diff --git a/types/semver/semver-tests.ts b/types/semver/semver-tests.ts index 753ddeb638..5935f1fe5f 100644 --- a/types/semver/semver-tests.ts +++ b/types/semver/semver-tests.ts @@ -65,6 +65,9 @@ bool = semver.ltr(version, str, loose); bool = semver.outside(version, str, '<', loose); bool = semver.intersects(str, str, loose); +// Coercion +sem = semver.coerce(str); + let ver = new semver.SemVer(str, bool); str = ver.raw; bool = ver.loose; From 7968b99ad1365f85fdd7ebd606abe1e2c672d1dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Fern=C3=A1ndez=20Haro?= Date: Mon, 29 Jan 2018 20:26:24 +0000 Subject: [PATCH 024/210] async-lock: Generics in returned values (#23131) * async-lock: Generics in returned values * Revert promise with "done" test to prove it still works as before * Add test where fn is a promise --- types/async-lock/async-lock-tests.ts | 8 ++++++++ types/async-lock/index.d.ts | 16 +++++++++++----- types/async-lock/tslint.json | 2 -- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/types/async-lock/async-lock-tests.ts b/types/async-lock/async-lock-tests.ts index 259749d4f0..c6866d270b 100644 --- a/types/async-lock/async-lock-tests.ts +++ b/types/async-lock/async-lock-tests.ts @@ -10,6 +10,14 @@ lock.acquire("key", (done) => { done(); }).then(() => { /* ... */ }); +lock.acquire("key", () => "stringValue") +// Check returned value's type is inherited properly + .then((str) => str.replace("s", "S")); + +lock.acquire("key", async () => "stringValue") +// Check returned value's type is inherited properly + .then((str) => str.replace("s", "S")); + lock.acquire([ "key1", "key2" ], (done) => { done(); }, (err, ret) => { /* ... */ }); diff --git a/types/async-lock/index.d.ts b/types/async-lock/index.d.ts index 4a19590d73..5527482748 100644 --- a/types/async-lock/index.d.ts +++ b/types/async-lock/index.d.ts @@ -1,11 +1,12 @@ // Type definitions for async-lock // Project: https://github.com/rain1017/async-lock -// Definitions by: ElisĆ©e MAURER +// Definitions by: ElisĆ©e MAURER , Alejandro // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 -interface AsyncLockDoneCallback { - (err?: Error, ret?: any): void; +interface AsyncLockDoneCallback { + (err?: Error, ret?: T): void; } interface AsyncLockOptions { @@ -18,8 +19,13 @@ interface AsyncLockOptions { declare class AsyncLock { constructor(options?: AsyncLockOptions); - acquire(key: string | string[], fn: (done: AsyncLockDoneCallback) => any, cb: AsyncLockDoneCallback, opts?: AsyncLockOptions): void; - acquire(key: string | string[], fn: (done: AsyncLockDoneCallback) => any, opts?: AsyncLockOptions): PromiseLike; + acquire(key: string | string[], + fn: (() => T | PromiseLike) | ((done: AsyncLockDoneCallback) => any), + opts?: AsyncLockOptions): PromiseLike; + acquire(key: string | string[], + fn: (done: AsyncLockDoneCallback) => any, + cb: AsyncLockDoneCallback, + opts?: AsyncLockOptions): void; isBusy(): boolean; } diff --git a/types/async-lock/tslint.json b/types/async-lock/tslint.json index a41bf5d19a..35039ba334 100644 --- a/types/async-lock/tslint.json +++ b/types/async-lock/tslint.json @@ -8,13 +8,11 @@ "callable-types": false, "comment-format": false, "dt-header": false, - "eofline": false, "export-just-namespace": false, "import-spacing": false, "interface-name": false, "interface-over-type-literal": false, "jsdoc-format": false, - "max-line-length": false, "member-access": false, "new-parens": false, "no-any-union": false, From af63181104d64fdf9839fc50c03eaacaa7179ec1 Mon Sep 17 00:00:00 2001 From: koprinkov Date: Mon, 29 Jan 2018 22:28:45 +0200 Subject: [PATCH 025/210] @types/react-table onFetchData definition updated and pages added to ControlledStateOverrideProps (#23141) * onFetchData definition updated and pages added to ControlledStateOverrideProps * .tsx alignment --- types/react-table/index.d.ts | 5 ++++- types/react-table/react-table-tests.tsx | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/types/react-table/index.d.ts b/types/react-table/index.d.ts index fed845fd49..1800a9d745 100644 --- a/types/react-table/index.d.ts +++ b/types/react-table/index.d.ts @@ -167,7 +167,7 @@ export interface TableProps extends PadRowComponent: () => React.ReactNode; /** Server-side callbacks */ - onFetchData: () => void; + onFetchData: (state: any, instance: any) => void; } export interface ControlledStateOverrideProps { @@ -177,6 +177,9 @@ export interface ControlledStateOverrideProps { /** Default: undefined */ pageSize: number | undefined; + /** Default: undefined */ + pages: number | undefined; + /** Default: undefined */ sorting: number; diff --git a/types/react-table/react-table-tests.tsx b/types/react-table/react-table-tests.tsx index a5609394ce..3230e4c5da 100644 --- a/types/react-table/react-table-tests.tsx +++ b/types/react-table/react-table-tests.tsx @@ -93,6 +93,7 @@ const Component = (props: {}) => { PadRowComponent={() =>  } page={undefined} pageSize={undefined} + pages={undefined} sorted={[]} filtered={[]} resized={[]} @@ -106,7 +107,7 @@ const Component = (props: {}) => { indexKey='_index' groupedByPivotKey='_groupedByPivot' className='' - onFetchData={() => null} + onFetchData={(state, instance) => null} style={{}} column={{ Cell: undefined, From 9cbe2c545935a1eb59d6a034460df2f32b373448 Mon Sep 17 00:00:00 2001 From: Alex Koehler Date: Mon, 29 Jan 2018 14:31:57 -0600 Subject: [PATCH 026/210] Added scale, scaleX and scaleY functions to cropperjs class type. (#23150) --- types/cropperjs/index.d.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/types/cropperjs/index.d.ts b/types/cropperjs/index.d.ts index cca1d6a39b..60b508dd8f 100644 --- a/types/cropperjs/index.d.ts +++ b/types/cropperjs/index.d.ts @@ -488,6 +488,21 @@ declare class cropperjs { */ rotateTo(degree: number): void; + /** + * Scale the image. + */ + scale(scaleX: number, scaleY?: number): void; + + /** + * Scale the abscissa of the image. + */ + scaleX(scaleX: number): void; + + /** + * Scale the ordinate of the image. + */ + scaleY(scaleY: number): void; + /** * Clear the crop box. */ From fb4fc8d1c27ac7468c69bcf9b4782d6f98baa698 Mon Sep 17 00:00:00 2001 From: Shawn Clabough Date: Mon, 29 Jan 2018 12:34:02 -0800 Subject: [PATCH 027/210] Update index.d.ts for Kendo-UI GridColumn definition (#23166) Since the command property of a GridColumn can be an array of strings or string, for example: { command: ["edit", "destroy"], title: "kendo", width: "250px" } { command: "destroy", title: "kendo", width: "250px" } The current definition is command?: GridColumnCommandItem[]; but it should be string|(string|GridColumnCommandItem)[]; Following documentation at https://docs.telerik.com/kendo-ui/api/jsp/grid/column-commanditem --- types/kendo-ui/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/kendo-ui/index.d.ts b/types/kendo-ui/index.d.ts index 97b840e2cf..6ea7fea725 100644 --- a/types/kendo-ui/index.d.ts +++ b/types/kendo-ui/index.d.ts @@ -3810,7 +3810,7 @@ declare namespace kendo.ui { aggregates?: any; attributes?: any; columns?: any; - command?: GridColumnCommandItem[]; + command?: string|(string|GridColumnCommandItem)[]; editable?: Function; encoded?: boolean; field?: string; @@ -20341,4 +20341,4 @@ interface JQuery { kendoWindow(options: kendo.ui.WindowOptions): JQuery; data(key: "kendoWindow"): kendo.ui.Window; -} \ No newline at end of file +} From 23faf2563674055700ca831b9e70b75b7fa46c8f Mon Sep 17 00:00:00 2001 From: Omar Diab Date: Mon, 29 Jan 2018 15:36:21 -0500 Subject: [PATCH 028/210] Knex.join: table can be a subquery (#23177) * Allow tableName in joins to be QueryCallback * Add tests for join with callback as table --- types/knex/index.d.ts | 12 ++++++------ types/knex/knex-tests.ts | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 6 deletions(-) diff --git a/types/knex/index.d.ts b/types/knex/index.d.ts index 7531082758..99b6a10476 100644 --- a/types/knex/index.d.ts +++ b/types/knex/index.d.ts @@ -183,12 +183,12 @@ declare namespace Knex { interface Join { (raw: Raw): QueryBuilder; - (tableName: TableName, clause: (this: JoinClause, join: JoinClause) => void): QueryBuilder; - (tableName: TableName, columns: { [key: string]: string | number | Raw }): QueryBuilder; - (tableName: TableName, raw: Raw): QueryBuilder; - (tableName: TableName, column1: string, column2: string): QueryBuilder; - (tableName: TableName, column1: string, raw: Raw): QueryBuilder; - (tableName: TableName, column1: string, operator: string, column2: string): QueryBuilder; + (tableName: TableName | QueryCallback, clause: (this: JoinClause, join: JoinClause) => void): QueryBuilder; + (tableName: TableName | QueryCallback, columns: { [key: string]: string | number | Raw }): QueryBuilder; + (tableName: TableName | QueryCallback, raw: Raw): QueryBuilder; + (tableName: TableName | QueryCallback, column1: string, column2: string): QueryBuilder; + (tableName: TableName | QueryCallback, column1: string, raw: Raw): QueryBuilder; + (tableName: TableName | QueryCallback, column1: string, operator: string, column2: string): QueryBuilder; } interface JoinClause { diff --git a/types/knex/knex-tests.ts b/types/knex/knex-tests.ts index d861db3c05..3aaefb6909 100644 --- a/types/knex/knex-tests.ts +++ b/types/knex/knex-tests.ts @@ -459,6 +459,44 @@ knex.select('*').from('accounts').joinRaw('natural full join table1').where('id' knex.select('*').from('accounts').join(knex.raw('natural full join table1')).where('id', 1); +knex.select('*').from('accounts') + .join(function() { + this.select('*').from('accounts').as('special_accounts'); + }, 'special_accounts.a', '=', 'accounts.b'); +knex.select('*').from('accounts') + .leftJoin(function() { + this.select('*').from('accounts').as('special_accounts'); + }, 'special_accounts.a', '=', 'accounts.b'); +knex.select('*').from('accounts') + .leftOuterJoin(function() { + this.select('*').from('accounts').as('special_accounts'); + }, 'special_accounts.a', '=', 'accounts.b'); +knex.select('*').from('accounts') + .rightJoin(function() { + this.select('*').from('accounts').as('special_accounts'); + }, 'special_accounts.a', '=', 'accounts.b'); +knex.select('*').from('accounts') + .rightOuterJoin(function() { + this.select('*').from('accounts').as('special_accounts'); + }, 'special_accounts.a', '=', 'accounts.b'); +knex.select('*').from('accounts') + .innerJoin(function() { + this.select('*').from('accounts').as('special_accounts'); + }, 'special_accounts.a', '=', 'accounts.b'); +knex.select('*').from('accounts') + .crossJoin(function() { + this.select('*').from('accounts').as('special_accounts'); + }, 'special_accounts.a', '=', 'accounts.b'); +knex.select('*').from('accounts') + .fullOuterJoin(function() { + this.select('*').from('accounts').as('special_accounts'); + }, 'special_accounts.a', '=', 'accounts.b'); +knex.select('*').from('accounts') + .outerJoin(function() { + this.select('*').from('accounts').as('special_accounts'); + }, 'special_accounts.a', '=', 'accounts.b'); + + knex('customers') .distinct('first_name', 'last_name') .select(); From 3dca396263125d066912eb5e1899e20dc53c49ca Mon Sep 17 00:00:00 2001 From: Calvin Huang Date: Tue, 30 Jan 2018 04:38:32 +0800 Subject: [PATCH 029/210] Since the official document said: "Hit type is the type of hit", it would be much clear if we use type to define HitType instead of an enum. (#23184) --- types/google.analytics/index.d.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/types/google.analytics/index.d.ts b/types/google.analytics/index.d.ts index b0412a362f..b7d4a8a6f4 100644 --- a/types/google.analytics/index.d.ts +++ b/types/google.analytics/index.d.ts @@ -39,9 +39,8 @@ interface GoogleAnalytics { declare namespace UniversalAnalytics { // https://developers.google.com/analytics/devguides/collection/analyticsjs/method-reference - enum HitType { - 'pageview', 'screenview', 'event', 'transaction', 'item', 'social', 'exception', 'timing' - } + // https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#hitType + type HitType = 'pageview' | 'screenview' | 'event' | 'transaction' | 'item' | 'social' | 'exception' | 'timing'; // https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference @@ -294,7 +293,7 @@ declare namespace UniversalAnalytics { flashVersion?: string; forceSSL?: boolean; hitCallback?(): void; - hitType?: string; + hitType?: HitType; hostname?: string; id?: string; javaEnabled?: boolean; From d8c895891bc16ce8719638225548a3327c9655cf Mon Sep 17 00:00:00 2001 From: BrennanCB Date: Mon, 29 Jan 2018 22:41:59 +0200 Subject: [PATCH 030/210] Added IControl interface in add/remove Control (#23187) The API documentation specifies that controls only need to implement IControl interface, however the current addControl requires Control class. Suggestion is to overload the addControl and removeControl methods to allow for this, while to not break the existing controls like NavigationControl. --- types/mapbox-gl/index.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/types/mapbox-gl/index.d.ts b/types/mapbox-gl/index.d.ts index 1f0edaf412..47f62556c3 100644 --- a/types/mapbox-gl/index.d.ts +++ b/types/mapbox-gl/index.d.ts @@ -26,8 +26,12 @@ declare namespace mapboxgl { constructor(options?: MapboxOptions); addControl(control: Control, position?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left'): this; + + addControl(control: IControl, position?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left'): this; removeControl(control: Control): this; + + removeControl(control: IControl): this; addClass(klass: string, options?: mapboxgl.StyleOptions): this; From 8fc55719bb73a527007de06037afdbf49e06a08b Mon Sep 17 00:00:00 2001 From: jlaamanen Date: Mon, 29 Jan 2018 22:43:22 +0200 Subject: [PATCH 031/210] Added proxyTimeout to ServerOptions (#23189) --- types/http-proxy/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/http-proxy/index.d.ts b/types/http-proxy/index.d.ts index 962a9ecdb6..811789af33 100644 --- a/types/http-proxy/index.d.ts +++ b/types/http-proxy/index.d.ts @@ -197,6 +197,8 @@ declare namespace Server { autoRewrite?: boolean; /** Rewrites the location protocol on (301 / 302 / 307 / 308) redirects to 'http' or 'https'.Default: null. */ protocolRewrite?: string; + /** Timeout (in milliseconds) when proxy receives no response from target. Default: 120000 (2 minutes) */ + proxyTimeout?: number; } } From 0571eabcdc484b50bfa48a5f3b290e26e326af78 Mon Sep 17 00:00:00 2001 From: Evtushenko Alexandr Date: Tue, 30 Jan 2018 03:45:16 +0700 Subject: [PATCH 032/210] Update `react-overlays` to v0.8, fix `transition` prop type in `react-overlays` library, remove `react-overlays/Transition` (#23206) * Add `react-overlays/Overlay` component test. * Fix `react-overlays/Overlay` and `react-overlays/Modal` components. * Remove `react-overlays/Transition`. * Set `react-overlays` version to v0.8. --- types/react-overlays/index.d.ts | 3 +- types/react-overlays/lib/Modal.d.ts | 5 +- types/react-overlays/lib/Overlay.d.ts | 3 +- types/react-overlays/lib/Transition.d.ts | 56 ------------------- types/react-overlays/lib/index.d.ts | 2 - .../test/react-overlays-tests-individual.tsx | 41 +++++++++----- .../test/react-overlays-tests-transition.tsx | 12 ++++ .../test/react-overlays-tests.tsx | 41 +++++++++----- types/react-overlays/tsconfig.json | 3 +- 9 files changed, 74 insertions(+), 92 deletions(-) delete mode 100644 types/react-overlays/lib/Transition.d.ts create mode 100644 types/react-overlays/test/react-overlays-tests-transition.tsx diff --git a/types/react-overlays/index.d.ts b/types/react-overlays/index.d.ts index e97c7e3761..5d33d8da37 100644 --- a/types/react-overlays/index.d.ts +++ b/types/react-overlays/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for React Overlays 0.6 +// Type definitions for React Overlays 0.8 // Project: https://github.com/react-bootstrap/react-overlays // Definitions by: Aaron Beall // Vito Samson @@ -15,7 +15,6 @@ export { Overlay, Portal, Position, - Transition, RootCloseWrapper, } from './lib'; diff --git a/types/react-overlays/lib/Modal.d.ts b/types/react-overlays/lib/Modal.d.ts index 13a397f3b5..f626a30119 100644 --- a/types/react-overlays/lib/Modal.d.ts +++ b/types/react-overlays/lib/Modal.d.ts @@ -1,5 +1,6 @@ import * as React from 'react'; import { TransitionCallbacks } from 'react-overlays'; +import { TransitionProps } from 'react-transition-group/Transition'; import * as ModalManager from './ModalManager'; import { PortalProps } from './Portal'; @@ -88,13 +89,13 @@ interface ModalProps extends TransitionCallbacks, PortalProps { * A `react-transition-group@2.0.0` `` component used * to control animations for the dialog component. */ - transition?: Element; + transition?: React.ComponentType; /** * A `react-transition-group@2.0.0` `` component used * to control animations for the backdrop components. */ - backdropTransition?: Element; + backdropTransition?: React.ComponentType; /** * When `true` The modal will automatically shift focus to itself when it opens, and diff --git a/types/react-overlays/lib/Overlay.d.ts b/types/react-overlays/lib/Overlay.d.ts index 66a87b16c2..7df97f3cc3 100644 --- a/types/react-overlays/lib/Overlay.d.ts +++ b/types/react-overlays/lib/Overlay.d.ts @@ -1,5 +1,6 @@ import * as React from 'react'; import { TransitionCallbacks } from 'react-overlays'; +import { TransitionProps } from 'react-transition-group/Transition'; import { PortalProps } from './Portal'; import { PositionProps } from './Position'; @@ -29,5 +30,5 @@ interface OverlayProps extends TransitionCallbacks, PortalProps, PositionProps { * A `react-transition-group@2.0.0` `` component * used to animate the overlay as it changes visibility. */ - transition?: Element; + transition?: React.ComponentType; } diff --git a/types/react-overlays/lib/Transition.d.ts b/types/react-overlays/lib/Transition.d.ts deleted file mode 100644 index 7f57e7b0c8..0000000000 --- a/types/react-overlays/lib/Transition.d.ts +++ /dev/null @@ -1,56 +0,0 @@ -import * as React from 'react'; -import { TransitionCallbacks } from 'react-overlays'; - -declare class Transition extends React.Component { } -declare namespace Transition { } -export = Transition; - -interface TransitionProps extends TransitionCallbacks { - className?: string; - - /** - * Show the component; triggers the enter or exit animation - */ - in?: boolean; - - /** - * Unmount the component (remove it from the DOM) when it is not shown - */ - unmountOnExit?: boolean; - - /** - * Run the enter animation when the component mounts, if it is initially - * shown - */ - transitionAppear?: boolean; - - /** - * A Timeout for the animation, in milliseconds, to ensure that a node doesn't - * transition indefinately if the browser transitionEnd events are - * canceled or interrupted. - * - * By default this is set to a high number (5 seconds) as a failsafe. You should consider - * setting this to the duration of your animation (or a bit above it). - */ - timeout?: number; - - /** - * CSS class or classes applied when the component is exited - */ - exitedClassName?: string; - - /** - * CSS class or classes applied while the component is exiting - */ - exitingClassName?: string; - - /** - * CSS class or classes applied when the component is entered - */ - enteredClassName?: string; - - /** - * CSS class or classes applied while the component is entering - */ - enteringClassName?: string; -} diff --git a/types/react-overlays/lib/index.d.ts b/types/react-overlays/lib/index.d.ts index bc08d18d77..6ea153cd5a 100644 --- a/types/react-overlays/lib/index.d.ts +++ b/types/react-overlays/lib/index.d.ts @@ -5,7 +5,6 @@ import * as ModalManager from './ModalManager'; import * as Overlay from './Overlay'; import * as Portal from './Portal'; import * as Position from './Position'; -import * as Transition from './Transition'; import * as RootCloseWrapper from './RootCloseWrapper'; export { @@ -16,6 +15,5 @@ export { Overlay, Portal, Position, - Transition, RootCloseWrapper, }; diff --git a/types/react-overlays/test/react-overlays-tests-individual.tsx b/types/react-overlays/test/react-overlays-tests-individual.tsx index fbf2506331..95aa3618b3 100644 --- a/types/react-overlays/test/react-overlays-tests-individual.tsx +++ b/types/react-overlays/test/react-overlays-tests-individual.tsx @@ -1,6 +1,5 @@ import * as React from "react"; -import * as Transition from 'react-overlays/lib/Transition'; import * as Portal from 'react-overlays/lib/Portal'; import * as Modal from 'react-overlays/lib/Modal'; import * as Position from 'react-overlays/lib/Position'; @@ -9,19 +8,7 @@ import * as Affix from 'react-overlays/lib/Affix'; import * as AutoAffix from 'react-overlays/lib/AutoAffix'; import * as RootCloseWrapper from 'react-overlays/lib/RootCloseWrapper'; -function testTransition() { - return ( - -
Test
-
- ); -} +import { OverlayFade } from './react-overlays-tests-transition'; class TestAffix extends React.Component { render(): JSX.Element { @@ -35,6 +22,32 @@ class TestAffix extends React.Component { } } +class TestOverlay extends React.Component<{}, {open: boolean}> { + target: HTMLElement | null = null; + state = {open: false}; + + render(): JSX.Element { + const { open } = this.state; + + return ( +
+ + + this.target} + transition={OverlayFade} + onHide={() => this.setState({open: false})} + placement="bottom"> +
Popover content
+
+
+ ); + } +} + class TestRootCloseWrapper extends React.Component { handleRootClose = () => { }; render() { diff --git a/types/react-overlays/test/react-overlays-tests-transition.tsx b/types/react-overlays/test/react-overlays-tests-transition.tsx new file mode 100644 index 0000000000..e1e04d7dda --- /dev/null +++ b/types/react-overlays/test/react-overlays-tests-transition.tsx @@ -0,0 +1,12 @@ +import * as React from 'react'; +import { CSSTransition } from 'react-transition-group'; +import { TransitionProps } from 'react-transition-group/Transition'; + +export function OverlayFade(props: TransitionProps): JSX.Element { + return ( + + ); +} diff --git a/types/react-overlays/test/react-overlays-tests.tsx b/types/react-overlays/test/react-overlays-tests.tsx index dde53d76bc..cbb2046fbc 100644 --- a/types/react-overlays/test/react-overlays-tests.tsx +++ b/types/react-overlays/test/react-overlays-tests.tsx @@ -1,7 +1,6 @@ import * as React from "react"; import { - Transition, Portal, Modal, Position, @@ -11,19 +10,7 @@ import { RootCloseWrapper, } from "react-overlays"; -function testTransition() { - return ( - -
Test
-
- ); -} +import { OverlayFade } from './react-overlays-tests-transition'; class TestAffix extends React.Component { render(): JSX.Element { @@ -37,6 +24,32 @@ class TestAffix extends React.Component { } } +class TestOverlay extends React.Component<{}, {open: boolean}> { + target: HTMLElement | null = null; + state = {open: false}; + + render(): JSX.Element { + const { open } = this.state; + + return ( +
+ + + this.target} + transition={OverlayFade} + onHide={() => this.setState({open: false})} + placement="bottom"> +
Popover content
+
+
+ ); + } +} + class TestRootCloseWrapper extends React.Component { handleRootClose = () => { }; render() { diff --git a/types/react-overlays/tsconfig.json b/types/react-overlays/tsconfig.json index 78f037e583..33066cce2e 100644 --- a/types/react-overlays/tsconfig.json +++ b/types/react-overlays/tsconfig.json @@ -21,6 +21,7 @@ "files": [ "index.d.ts", "test/react-overlays-tests.tsx", - "test/react-overlays-tests-individual.tsx" + "test/react-overlays-tests-individual.tsx", + "test/react-overlays-tests-transition.tsx" ] } \ No newline at end of file From 220171257e23e54f307b872e1b4b1410134326c2 Mon Sep 17 00:00:00 2001 From: dmitryshindin Date: Mon, 29 Jan 2018 23:48:18 +0300 Subject: [PATCH 033/210] Fix order function for tooltip, update description for order (#23211) --- types/c3/c3-tests.ts | 17 +++++++++++++++++ types/c3/index.d.ts | 3 ++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/types/c3/c3-tests.ts b/types/c3/c3-tests.ts index c449235fba..7ac2f0ccd8 100644 --- a/types/c3/c3-tests.ts +++ b/types/c3/c3-tests.ts @@ -1882,6 +1882,23 @@ function tooltip_order() { }); } +function tooltip_order_function() { + const chart = c3.generate({ + data: { + columns: [ + ["data1", 30, 200, 100, 400, 150, 250], + ["data2", 50, 20, 10, 40, 15, 25] + ] + }, + tooltip: { + order: (data1, data2) => { + return data1.id - data2.id; + // return data2.id - data2.id in case we want desc order + } + } + }); +} + //////////////////////// // Chart options Tests //////////////////////// diff --git a/types/c3/index.d.ts b/types/c3/index.d.ts index ccbbab7d7f..d68027f7d5 100644 --- a/types/c3/index.d.ts +++ b/types/c3/index.d.ts @@ -744,8 +744,9 @@ export interface TooltipOptions { contents?(data: any, defaultTitleFormat: string, defaultValueFormat: string, color: any): string; /** * Set tooltip values order + * Available Values: desc, asc, any[], function (data1, data2) { ... }, null */ - order?: string | any[] | ((data: Data) => boolean); + order?: string | any[] | ((data1: any, data2: any) => number) | null; } export interface SubchartOptions { From 3f42f1936818e5e2651390c586beba6bbd1fb6eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20G=C3=BCrtler?= Date: Mon, 29 Jan 2018 21:50:15 +0100 Subject: [PATCH 034/210] jwplayer: Correct return type for getSafeRegion() function (#23220) See https://developer.jwplayer.com/jw-player/docs/javascript-api-reference/#jwplayergetsaferegion --- types/jwplayer/index.d.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/types/jwplayer/index.d.ts b/types/jwplayer/index.d.ts index 32c3521f22..87a7526267 100644 --- a/types/jwplayer/index.d.ts +++ b/types/jwplayer/index.d.ts @@ -2,6 +2,7 @@ // Project: http://developer.longtailvideo.com/trac/ // Definitions by: Martin Duparc // Tomer Kruvi +// Philipp Gürtler // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // JW Player is the leading HTML5 & Flash video player, optimized for mobile and the desktop. Easy enough for beginners, advanced enough for pros. @@ -224,6 +225,13 @@ interface EventCallback { (param: T): void; } +interface Region { + x: 0; // x and y will always be 0 according to https://developer.jwplayer.com/jw-player/docs/javascript-api-reference/#jwplayergetsaferegion + y: 0; + width: number; + height: number; +} + interface JWPlayer { addButton(icon: string, label: string, handler: () => void, id: string): void; getAudioTracks(): any[]; @@ -243,7 +251,7 @@ interface JWPlayer { getPosition(): number; getQualityLevels(): any[]; getRenderingMode(): string; - getSafeRegion(): any[]; + getSafeRegion(): Region; getState(): string; getVolume(): number; getEnvironment(): Environment; From 6a187f6d4476403da23a2a77c3315d3bb573cc1b Mon Sep 17 00:00:00 2001 From: Andy Date: Mon, 29 Jan 2018 12:51:25 -0800 Subject: [PATCH 035/210] Reword instructions for updating to a new major version (#23223) --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 854cae7e40..c50d026338 100644 --- a/README.md +++ b/README.md @@ -256,7 +256,7 @@ When it graduates draft mode, we may remove it from DefinitelyTyped and deprecat #### I want to update a package to a new major version -Before making your change, please create a new subfolder with the current version e.g. `v2`, and copy existing files to it. You will need to: +If you intend to continue updating the older version of the package, you may create a new subfolder with the current version e.g. `v2`, and copy existing files to it. If so, you will need to: 1. Update the relative paths in `tsconfig.json` as well as `tslint.json`. 2. Add path mapping rules to ensure that tests are running against the intended version. @@ -279,7 +279,8 @@ For example [history v2 `tsconfig.json`](https://github.com/DefinitelyTyped/Defi } ``` -Please note that unless upgrading something backwards-compatible like `node`, all packages depending of the updated package need a path mapping to it, as well as packages depending on *those*. +If there are other packages on DefinitelyTyped that are incompatible with the new version, you will need to add path mappings to the old version. You will also need to do this for packages depending on packages depending on the old version. + For example, `react-router` depends on `history@2`, so [react-router `tsconfig.json`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react-router/tsconfig.json) has a path mapping to `"history": [ "history/v2" ]`; transitively `react-router-bootstrap` (which depends on `react-router`) also adds a path mapping in its [tsconfig.json](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react-router-bootstrap/tsconfig.json). From cd4561ee0e562ab1f077cca062987c9e72c67304 Mon Sep 17 00:00:00 2001 From: Tim Stackhouse Date: Tue, 30 Jan 2018 13:46:22 -0500 Subject: [PATCH 036/210] [sinon-stub-promise] Update typings to support chainable calls and signatures of v2.1.0+ (#23174) --- types/sinon-stub-promise/index.d.ts | 21 ++++++--- .../sinon-stub-promise-tests.ts | 44 +++++++++++++++++-- 2 files changed, 55 insertions(+), 10 deletions(-) diff --git a/types/sinon-stub-promise/index.d.ts b/types/sinon-stub-promise/index.d.ts index 2df6502e11..6de3b17b2a 100644 --- a/types/sinon-stub-promise/index.d.ts +++ b/types/sinon-stub-promise/index.d.ts @@ -1,21 +1,30 @@ -// Type definitions for sinon-stub-promise v1.1.0 +// Type definitions for sinon-stub-promise v2.1.0 // Project: https://github.com/substantial/sinon-stub-promise // Definitions by: Thiago Temple +// Tim Stackhouse // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 /// declare module 'sinon' { - interface SinonPromise extends Function { - resolves(value?: any): void; - rejects(value?: any): void; + interface SinonThenable { + resolved: boolean; + rejected: boolean; + resolveValue: any; + rejectValue: any; + then(onFulfill: (resolveValue?: any) => void, onReject?: (rejectValue?: any) => void): SinonThenable; + catch(onReject: (rejectValue?: any) => void): SinonThenable; + finally(callback: () => void): SinonThenable; } interface SinonStub { - returnsPromise(): SinonPromise; + thenable: SinonThenable; + returnsPromise(): SinonStub; + resolves(value?: any): SinonStub; + rejects(value?: any): SinonStub; } } declare function sinonStubPromise(sinon: sinon.SinonStatic): void; -export = sinonStubPromise; \ No newline at end of file +export = sinonStubPromise; diff --git a/types/sinon-stub-promise/sinon-stub-promise-tests.ts b/types/sinon-stub-promise/sinon-stub-promise-tests.ts index 7840272bd6..f9b1c59d4d 100644 --- a/types/sinon-stub-promise/sinon-stub-promise-tests.ts +++ b/types/sinon-stub-promise/sinon-stub-promise-tests.ts @@ -1,13 +1,49 @@ import * as sinon from 'sinon'; + +function testReturnsPromise() { + const stub = sinon.stub().returnsPromise(); +} + function testResolve() { - var promise = sinon.stub().returnsPromise(); - promise.resolves('test val'); + const stub = sinon + .stub() + .returnsPromise() + .resolves("test val"); } function testReject() { - var promise = sinon.stub().returnsPromise(); - promise.rejects('test val'); + const stub = sinon + .stub() + .returnsPromise() + .rejects("test val"); } +function testThenableThen() { + const stub = sinon.stub().returnsPromise(); + const thenable = stub.thenable; + thenable.then(() => {}); + thenable.then(resolveValue => {}); + thenable.then(() => {}, () => {}); + thenable.then(() => {}, rejectValue => {}); + thenable.then(resolveValue => {}, rejectValue => {}); +} + +function testThenableCatch() { + const stub = sinon.stub().returnsPromise(); + const thenable = stub.thenable; + thenable.catch(() => {}); + thenable.catch(rejectValue => {}); +} + +function testThenableFinally() { + const stub = sinon.stub().returnsPromise(); + const thenable = stub.thenable; + thenable.finally(() => {}); +} + +testReturnsPromise(); testResolve(); testReject(); +testThenableThen(); +testThenableCatch(); +testThenableFinally(); From 2b2aaf8b2dbbafc1eb19e57bfc3b26da0a79709a Mon Sep 17 00:00:00 2001 From: Matthew Scharley Date: Wed, 31 Jan 2018 05:55:19 +1100 Subject: [PATCH 037/210] bull: Add Queue#getWaiting (#23148) * bull: Add Queue#getWaiting * bull: Add isLocal flags for pause/resume * bull: Fix JobCounts#waiting --- types/bull/index.d.ts | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/types/bull/index.d.ts b/types/bull/index.d.ts index 28070ad44f..6cc4f5ed1d 100644 --- a/types/bull/index.d.ts +++ b/types/bull/index.d.ts @@ -228,11 +228,11 @@ declare namespace Bull { } interface JobCounts { - wait: number; active: number; completed: number; failed: number; delayed: number; + waiting: number; } interface JobInformation { @@ -384,21 +384,27 @@ declare namespace Bull { /** * Returns a promise that resolves when the queue is paused. - * The pause is global, meaning that all workers in all queue instances for a given queue will be paused. - * A paused queue will not process new jobs until resumed, - * but current jobs being processed will continue until they are finalized. + * + * A paused queue will not process new jobs until resumed, but current jobs being processed will continue until + * they are finalized. The pause can be either global or local. If global, all workers in all queue instances + * for a given queue will be paused. If local, just this worker will stop processing new jobs after the current + * lock expires. This can be useful to stop a worker from taking new jobs prior to shutting down. * * Pausing a queue that is already paused does nothing. */ - pause(): Promise; + pause(isLocal?: boolean): Promise; /** * Returns a promise that resolves when the queue is resumed after being paused. - * The resume is global, meaning that all workers in all queue instances for a given queue will be resumed. + * + * The resume can be either local or global. If global, all workers in all queue instances for a given queue + * will be resumed. If local, only this worker will be resumed. Note that resuming a queue globally will not + * resume workers that have been paused locally; for those, resume(true) must be called directly on their + * instances. * * Resuming a queue that is not paused does nothing. */ - resume(): Promise; + resume(isLocal?: boolean): Promise; /** * Returns a promise that returns the number of jobs in the queue, waiting or paused. @@ -445,6 +451,11 @@ declare namespace Bull { */ getFailed(start?: number, end?: number): Promise; + /** + * Returns a promise that will return an array with the waiting jobs between start and end. + */ + getWaiting(start?: number, end?: number): Promise; + /** * Returns JobInformation of repeatable jobs (ordered descending). Provide a start and/or an end * index to limit the number of results. Start defaults to 0, end to -1 and asc to false. From 3f1f38b16bbdc777ff03347c81af0b163517fa7a Mon Sep 17 00:00:00 2001 From: SoraYama Date: Wed, 31 Jan 2018 03:00:58 +0800 Subject: [PATCH 038/210] Update index.d.ts (#23021) * Update index.d.ts add containPixel in interface ECharts. * Update index.d.ts 1. fix quotation marks in Japanese 2. desperate interface `finder` 3. change const `graphic` to interface * add getMap add getMap method declaration * Update index.d.ts 1. changed all comments to JSDoc type; 2. fix `graphic` variable & add interface `Graphic`; 3. add TypeScript version instruction; 4. changed `mapObj` interface to CamelCase; * delete import for travis --- types/echarts/index.d.ts | 95 ++++++++++++++++++++-------------------- 1 file changed, 47 insertions(+), 48 deletions(-) diff --git a/types/echarts/index.d.ts b/types/echarts/index.d.ts index 2880216e46..1f42f8030c 100644 --- a/types/echarts/index.d.ts +++ b/types/echarts/index.d.ts @@ -2,6 +2,7 @@ // Project: http://echarts.baidu.com/ // Definitions by: Xie Jingyang , AntiMoron // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 declare namespace echarts { function init(dom: HTMLDivElement | HTMLCanvasElement, theme?: Object | string, opts?: { @@ -9,13 +10,13 @@ declare namespace echarts { renderer?: string }): ECharts; - const graphic: { + const graphic: Graphic; + + interface Graphic { clipPointsByRect(points: number[][], rect: ERectangle): number[][]; clipRectByRect(targetRect: ERectangle, rect: ERectangle): ERectangle; - LinearGradient: { new (x: number, y: number, x2: number, y2: number, colorStops: Array, globalCoord?: boolean): LinearGradient } - - }; - + LinearGradient: { new(x: number, y: number, x2: number, y2: number, colorStops: Array, globalCoord?: boolean): LinearGradient } + } function connect(group: string | Array): void; @@ -29,6 +30,15 @@ declare namespace echarts { function registerTheme(themeName: string, theme: Object): void; + interface MapObj { + /** geoJson data for map */ + geoJson: object, + /** special areas fro map */ + specialAreas: object + } + + function getMap(mapName: string): MapObj; + interface LinearGradient { colorStops: Array; global: boolean; @@ -39,9 +49,8 @@ declare namespace echarts { y2: number } - interface ECharts { - group: string; + group: string setOption(option: EChartOption, notMerge?: boolean, notRefreshImmediately?: boolean): void @@ -66,20 +75,20 @@ declare namespace echarts { hideLoading(): void getDataURL(opts: { - // åÆ¼å‡ŗēš„ę ¼å¼ļ¼ŒåÆé€‰ png, jpeg + /** åÆ¼å‡ŗēš„ę ¼å¼ļ¼ŒåÆé€‰ png, jpeg */ type?: string, - // åÆ¼å‡ŗēš„å›¾ē‰‡åˆ†č¾ØēŽ‡ęÆ”ä¾‹ļ¼Œé»˜č®¤äøŗ 1怂 + /** åÆ¼å‡ŗēš„å›¾ē‰‡åˆ†č¾ØēŽ‡ęÆ”ä¾‹ļ¼Œé»˜č®¤äøŗ 1怂*/ pixelRatio?: number, - // åÆ¼å‡ŗēš„å›¾ē‰‡čƒŒę™Æč‰²ļ¼Œé»˜č®¤ä½æē”Ø option é‡Œēš„ backgroundColor + /** åÆ¼å‡ŗēš„å›¾ē‰‡čƒŒę™Æč‰²ļ¼Œé»˜č®¤ä½æē”Ø option é‡Œēš„ backgroundColor */ backgroundColor?: string }): string getConnectedDataURL(opts: { - // åÆ¼å‡ŗēš„ę ¼å¼ļ¼ŒåÆé€‰ png, jpeg + /** åÆ¼å‡ŗēš„ę ¼å¼ļ¼ŒåÆé€‰ png, jpeg */ type: string, - // åÆ¼å‡ŗēš„å›¾ē‰‡åˆ†č¾ØēŽ‡ęÆ”ä¾‹ļ¼Œé»˜č®¤äøŗ 1怂 + /** åÆ¼å‡ŗēš„å›¾ē‰‡åˆ†č¾ØēŽ‡ęÆ”ä¾‹ļ¼Œé»˜č®¤äøŗ 1怂 */ pixelRatio: number, - // åÆ¼å‡ŗēš„å›¾ē‰‡čƒŒę™Æč‰²ļ¼Œé»˜č®¤ä½æē”Ø option é‡Œēš„ backgroundColor + /** åÆ¼å‡ŗēš„å›¾ē‰‡čƒŒę™Æč‰²ļ¼Œé»˜č®¤ä½æē”Ø option é‡Œēš„ backgroundColor */ backgroundColor: string }): string @@ -89,42 +98,32 @@ declare namespace echarts { dispose(): void - // č½¬ę¢é€»č¾‘ē‚¹åˆ°åƒē“  - convertToPixel(finder: { - seriesIndex?: number, - seriesId?: string, - seriesName?: string, - geoIndex?: number, - geoId?: string, - geoName?: string, - xAxisIndex?: number, - xAxisId?: string, - xAxisName?: string, - yAxisIndex?: number, - yAxisId?: string, - yAxisName?: string, - gridIndex?: number, - gridId?: string - gridName?: string - } | string, value: string | Array): string | Array + /** č½¬ę¢é€»č¾‘ē‚¹åˆ°åƒē“  */ + convertToPixel(finder: ConvertFinder | string, value: string | Array): string | Array - convertFromPixel(finder: { - seriesIndex?: number, - seriesId?: string, - seriesName?: string, - geoIndex?: number, - geoId?: string, - geoName?: string, - xAxisIndex?: number, - xAxisId?: string, - xAxisName?: string, - yAxisIndex?: number, - yAxisId?: string, - yAxisName?: string, - gridIndex?: number, - gridId?: string - gridName?: string - } | string, value: Array | string): Array | string + convertFromPixel(finder: ConvertFinder | string, value: Array | string): Array | string + + containPixel(finder: ConvertFinder | string, + /** č¦č¢«åˆ¤ę–­ēš„ē‚¹ļ¼Œäøŗåƒē“ åę ‡å€¼ļ¼Œä»„ echarts å®žä¾‹ēš„ dom čŠ‚ē‚¹ēš„å·¦äøŠč§’äøŗåę ‡ [0, 0] 点。*/ + value: any[]): boolean + } + + interface ConvertFinder { + seriesIndex?: number, + seriesId?: string, + seriesName?: string, + geoIndex?: number, + geoId?: string, + geoName?: string, + xAxisIndex?: number, + xAxisId?: string, + xAxisName?: string, + yAxisIndex?: number, + yAxisId?: string, + yAxisName?: string, + gridIndex?: number, + gridId?: string + gridName?: string } interface ERectangle { From a0b24ba3d75a9e8b97347733de7edb1ca6b78b03 Mon Sep 17 00:00:00 2001 From: John Kleinschmidt Date: Tue, 30 Jan 2018 14:03:31 -0500 Subject: [PATCH 039/210] Update electron-packager fo 10.1 (#23191) --- .../electron-packager-tests.ts | 169 +++++++++++++++++- types/electron-packager/index.d.ts | 13 +- 2 files changed, 173 insertions(+), 9 deletions(-) diff --git a/types/electron-packager/electron-packager-tests.ts b/types/electron-packager/electron-packager-tests.ts index 482c49bbff..4b87704a38 100644 --- a/types/electron-packager/electron-packager-tests.ts +++ b/types/electron-packager/electron-packager-tests.ts @@ -1,8 +1,16 @@ import * as packager from "electron-packager"; -function callback(err: Error, appPath: string) { +function callback(err: Error, appPaths: string[]) { const msg = err.message; - const index = appPath.indexOf("test"); + const index = appPaths.indexOf("test"); +} + +function completeFunction(buildPath: string, electronVersion: string, platform: string, arch: string, callbackFn: () => void) { + callbackFn(); +} + +function ignoreFunction(path: string) { + return true; } packager({ @@ -10,20 +18,38 @@ packager({ name: "myapplication", platform: "win32", arch: "all", - electronVersion: "0.34.0" + electronVersion: "0.34.0", + win32metadata: { + CompanyName: "Acme CO", + FileDescription: "My application", + OriginalFilename: "myapp.exe", + ProductName: "Application", + InternalName: "roadrunner", + "requested-execution-level": "highestAvailable", + "application-manifest": "manifest.xml" + } }, callback); packager({ dir: ".", name: "myapplication", electronVersion: "0.34.0", - all: true + all: true, + win32metadata: { + CompanyName: "Acme CO", + FileDescription: "My application", + OriginalFilename: "myapp.exe", + ProductName: "Application", + InternalName: "roadrunner", + "requested-execution-level": "requireAdministrator", + "application-manifest": "manifest.xml" + } }, callback); packager({ dir: ".", name: "myapplication", - platform: "win32", + platform: "all", arch: "all", electronVersion: "0.34.0" }, callback); @@ -34,3 +60,136 @@ packager({ electronVersion: "0.34.0", all: true }, callback); + +packager({ + dir: ".", + name: "myapplication", + electronVersion: "0.34.0", + arch: "arm64", + executableName: "myapp" +}, callback); + +packager({ + dir: ".", + afterCopy: [ + completeFunction + ], + afterExtract: [ + completeFunction + ], + afterPrune: [ + completeFunction + ], + appCopyright: "Copyright", + appVersion: "1.0", + arch: "ia32", + asar: false, + buildVersion: "1.2.3", + derefSymlinks: true, + download: { + cache: "./zips", + mirror: "https://10.1.2.105/", + quiet: true, + strictSSL: true + }, + extraResource: "foo.js", + icon: "foo.ico", + ignore: /ab+c/, + out: "out", + overwrite: true, + packageManager: false, + prune: true, + quiet: true, + tmpdir: "/tmp", + win32metadata: { + CompanyName: "Acme CO", + FileDescription: "My application", + OriginalFilename: "myapp.exe", + ProductName: "Application", + InternalName: "roadrunner", + "requested-execution-level": "asInvoker", + "application-manifest": "manifest.xml" + } +}, callback); + +packager({ + dir: ".", + arch: "x64", + asar: true, + derefSymlinks: false, + download: { + cache: "./zips", + mirror: "https://10.1.2.105/", + quiet: false, + strictSSL: true + }, + extraResource: [ + "foo.js", + "bar.js" + ], + ignore: [ + /ab+c/, + new RegExp('abc') + ], + overwrite: false, + packageManager: "npm", + platform: "darwin", + prune: false, + quiet: false, + tmpdir: "false", + appBundleId: "123456", + appCategoryType: "public.app-category.developer-tools", + extendInfo: "plist.txt", + helperBundleId: "23223f", + osxSign: true +}, callback); + +packager({ + dir: ".", + arch: "armv7l", + asar: { + ordering: "order.txt", + unpack: "*.js", + unpackDir: "sub_dir" + }, + download: { + cache: "./zips", + mirror: "https://10.1.2.105/", + quiet: false, + strictSSL: false + }, + ignore: ignoreFunction, + packageManager: "cnpm", + platform: "linux" +}, callback); + +packager({ + dir: ".", + arch: [ + "ia32", + "x64" + ], + download: { + cache: "./zips", + mirror: "https://10.1.2.105/", + quiet: true, + strictSSL: false + }, + packageManager: "yarn", + platform: "mas", + extendInfo: { + foo: "bar" + }, + osxSign: { + identity: "myidentity", + entitlements: "path/to/my.entitlements", + "entitlements-inherit": "path/to/inherit.entitlements" + }, + protocols: [{ + name: "myappproto", + schemes: [ + "myapp", + "myapp2" + ] + }] +}, callback); diff --git a/types/electron-packager/index.d.ts b/types/electron-packager/index.d.ts index de33fa3499..6e430ecdb2 100644 --- a/types/electron-packager/index.d.ts +++ b/types/electron-packager/index.d.ts @@ -1,7 +1,8 @@ -// Type definitions for electron-packager 8.7 +// Type definitions for electron-packager 10.1 // Project: https://github.com/electron-userland/electron-packager // Definitions by: Maxime LUCE // Juan Jimenez-Anca +// John Kleinschmidt // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -31,8 +32,8 @@ declare namespace electronPackager { type ignoreFunction = (path: string) => boolean; type onCompleteFn = (buildPath: string, electronVersion: string, platform: string, arch: string, callbackFn: () => void) => void; - type arch = "ia32" | "x64" | "armv7l" | "all"; - type packageManager = "npm" | "cnpm" | "yarn"; + type arch = "ia32" | "x64" | "armv7l" | "arm64" |"all"; + type packageManager = "npm" | "cnpm" | "yarn" | false; type platform = "linux" | "win32" | "darwin" | "mas" | "all"; interface AsarOptions { @@ -94,7 +95,7 @@ declare namespace electronPackager { * Arbitrary combinations of individual architectures are also supported via a comma-delimited string or array of strings. * The non-all values correspond to the architecture names used by Electron releases. This value is not restricted to the official set if download.mirror is set. */ - arch?: arch; + arch?: arch | arch[]; /** * Whether to package the application's source code into an archive, using Electron's archive format */ @@ -120,6 +121,10 @@ declare namespace electronPackager { * One or more files to be copied directly into the app's Contents/Resources directory for OS X target platforms, and the resources directory for other target platforms. */ extraResource?: string | string[]; + /** + * The name of the executable file, sans file extension. Defaults to the value for the name parameter + */ + executableName?: string; /** * The local path to the icon file, if the target platform supports setting embedding an icon. */ From 73518ca44a9f8e7f02b01887fe852af4ba2bf768 Mon Sep 17 00:00:00 2001 From: Markus Tacker Date: Tue, 30 Jan 2018 20:04:01 +0100 Subject: [PATCH 040/210] fix(aws-lambda): AuthResponseContext children may be objects (#23192) If used with a custom authorizer, there will be a claims object with the parsed JSON web token. See https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html --- types/aws-lambda/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/aws-lambda/index.d.ts b/types/aws-lambda/index.d.ts index 8c95011f87..09070fb13c 100644 --- a/types/aws-lambda/index.d.ts +++ b/types/aws-lambda/index.d.ts @@ -457,7 +457,7 @@ export interface Statement { * http://docs.aws.amazon.com/apigateway/latest/developerguide/use-custom-authorizer.html#api-gateway-custom-authorizer-output */ export interface AuthResponseContext { - [name: string]: string | number | boolean; + [name: string]: any; } /** From c51ad6b34bd7865cf622eca7966a75a9b7202651 Mon Sep 17 00:00:00 2001 From: EreckGordon Date: Tue, 30 Jan 2018 12:17:14 -0700 Subject: [PATCH 041/210] import and use `Url` properly (#23225) * import and use `Url` properly currently imports a `URL` from 'url' library, except that `URL` does not exist; however `Url` does exist. Discovered upon trying to run tsc and getting the following error message: `node_modules/@types/nodemailer/lib/mailer/index.d.ts(6,10): error TS2305: Module '"url"' has no exported member 'URL'.` As soon as I replaced `URL` with `Url` tsc correctly compiled. * missed one :o --- types/nodemailer/lib/mailer/index.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/types/nodemailer/lib/mailer/index.d.ts b/types/nodemailer/lib/mailer/index.d.ts index f08c2d085d..bd9dd7ba8d 100644 --- a/types/nodemailer/lib/mailer/index.d.ts +++ b/types/nodemailer/lib/mailer/index.d.ts @@ -3,7 +3,7 @@ import { EventEmitter } from 'events'; import { Socket } from 'net'; import { Readable } from 'stream'; -import { URL } from 'url'; +import { Url } from 'url'; import { SentMessageInfo, Transport, TransportOptions } from '../..'; import * as shared from '../shared'; @@ -34,7 +34,7 @@ declare namespace Mail { /** String, Buffer or a Stream contents for the attachmentent */ content?: string | Buffer | Readable; /** path to a file or an URL (data uris are allowed as well) if you want to stream the file instead of including it (better for larger attachments) */ - path?: string | URL; + path?: string | Url; } interface Attachment extends AttachmentLike { @@ -175,11 +175,11 @@ declare class Mail extends EventEmitter { setupProxy(proxyUrl: string): void; set(key: 'oauth2_provision_cb', value: (user: string, renew: boolean, callback: (err: Error | null, accessToken?: string, expires?: number) => void) => void): Map; - set(key: 'proxy_handler_http' | 'proxy_handler_https' | 'proxy_handler_socks' | 'proxy_handler_socks5' | 'proxy_handler_socks4' | 'proxy_handler_socks4a', value: (proxy: URL, options: TransportOptions, callback: (err: Error | null, socketOptions?: { connection: Socket }) => void) => void): Map; + set(key: 'proxy_handler_http' | 'proxy_handler_https' | 'proxy_handler_socks' | 'proxy_handler_socks5' | 'proxy_handler_socks4' | 'proxy_handler_socks4a', value: (proxy: Url, options: TransportOptions, callback: (err: Error | null, socketOptions?: { connection: Socket }) => void) => void): Map; set(key: string, value: any): Map; get(key: 'oauth2_provision_cb'): (user: string, renew: boolean, callback: (err: Error | null, accessToken: string, expires: number) => void) => void; - get(key: 'proxy_handler_http' | 'proxy_handler_https' | 'proxy_handler_socks' | 'proxy_handler_socks5' | 'proxy_handler_socks4' | 'proxy_handler_socks4a'): (proxy: URL, options: TransportOptions, callback: (err: Error | null, socketOptions: { connection: Socket }) => void) => void; + get(key: 'proxy_handler_http' | 'proxy_handler_https' | 'proxy_handler_socks' | 'proxy_handler_socks5' | 'proxy_handler_socks4' | 'proxy_handler_socks4a'): (proxy: Url, options: TransportOptions, callback: (err: Error | null, socketOptions: { connection: Socket }) => void) => void; get(key: string): any; addListener(event: 'error', listener: (err: Error) => void): this; From f616142675c39436a50cc8de1834e666addce0bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20S=C3=A1nchez?= Date: Tue, 30 Jan 2018 20:18:44 +0100 Subject: [PATCH 042/210] [Expo] Rename gitExponentPushTokenAsync to use new name (#23248) --- types/expo/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/expo/index.d.ts b/types/expo/index.d.ts index c9c0ca88f3..caa1066c39 100644 --- a/types/expo/index.d.ts +++ b/types/expo/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/expo/expo-sdk // Definitions by: Konstantin Kai // Martynas KadiÅ”a +// Sergio SĆ”nchez // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 @@ -1213,7 +1214,7 @@ export namespace Notifications { type LocalNotificationId = string | number; function addListener(listener: (notification: Notification) => any): EventSubscription; - function getExponentPushTokenAsync(): Promise; + function getExpoPushTokenAsync(): Promise; function presentLocalNotificationAsync(localNotification: LocalNotification): Promise; function scheduleLocalNotificationAsync( localNotification: LocalNotification, From b3bc318cf2167c4b37248c1c9207da59f6f9641b Mon Sep 17 00:00:00 2001 From: CodeAnimal Date: Tue, 30 Jan 2018 19:20:05 +0000 Subject: [PATCH 043/210] Update Stripe package with missing subscription items properties (#23263) * Abstract `billing` type into a type alias * Add `items` property to Subscription interfaces, deprecate `plan` * Add tests * Complete tests * Correct unit test --- types/stripe/index.d.ts | 56 ++++++++++++++++++++++++++++++------ types/stripe/stripe-tests.ts | 33 ++++++++++----------- 2 files changed, 65 insertions(+), 24 deletions(-) diff --git a/types/stripe/index.d.ts b/types/stripe/index.d.ts index ef2c9971b7..c3fd4853b7 100644 --- a/types/stripe/index.d.ts +++ b/types/stripe/index.d.ts @@ -4216,6 +4216,7 @@ declare namespace Stripe { namespace subscriptions { type SubscriptionStatus = "trialing" | "active" | "past_due" | "canceled" | "unpaid"; + type SubscriptionBilling = "charge_automatically" | "send_invoice"; /** * Subscriptions allow you to charge a customer's card on a recurring basis. A subscription ties a customer to * a particular plan you've created: https://stripe.com/docs/api#create_plan @@ -4325,14 +4326,14 @@ declare namespace Stripe { * end of the cycle using the default source attached to the customer. When sending an invoice, Stripe will email your customer an * invoice with payment instructions. */ - billing: "charge_automatically" | "send_invoice"; + billing: SubscriptionBilling; } interface ISubscriptionCustCreationOptions extends IDataOptionsWithMetadata { /** - * The identifier of the plan to subscribe the customer to. + * @deprecated Use items property instead. */ - plan: string; + plan?: string; /** * A positive decimal (with at most two decimal places) between 1 and 100. This represents the percentage of the subscription invoice @@ -4375,14 +4376,14 @@ declare namespace Stripe { /** * List of subscription items, each with an attached plan. */ - items?: ISubscriptionCreationItem; + items?: ISubscriptionCreationItem[]; /** * Either "charge_automatically", or "send_invoice". When charging automatically, Stripe will attempt to pay this subscription at the end of the * cycle using the default source attached to the customer. When sending an invoice, Stripe will email your customer an invoice with payment * instructions. Defaults to "charge_automatically". */ - billing?: "charge_automatically" | "send_invoice"; + billing?: SubscriptionBilling; } interface ISubscriptionCreationOptions extends ISubscriptionCustCreationOptions { @@ -4407,7 +4408,7 @@ declare namespace Stripe { coupon?: string; /** - * The identifier of the plan to update the subscription to. If omitted, the subscription will not change plans. + * @deprecated Use items property instead. */ plan?: string; @@ -4453,7 +4454,12 @@ declare namespace Stripe { * cycle using the default source attached to the customer. When sending an invoice, Stripe will email your customer an invoice with payment * instructions. */ - billing?: "charge_automatically" | "send_invoice"; + billing?: SubscriptionBilling; + + /** + * List of subscription items, each with an attached plan. + */ + items?: ISubscriptionUpdateItem[]; } interface ISubscriptionCancellationOptions extends IDataOptions { @@ -4467,7 +4473,7 @@ declare namespace Stripe { /** * The billing mode of the subscriptions to retrieve. Either "charge_automatically" or "send_invoice". */ - billing?: "charge_automatically" | "send_invoice"; + billing?: SubscriptionBilling; /** * The ID of the customer whose subscriptions will be retrieved @@ -4496,6 +4502,40 @@ declare namespace Stripe { */ quantity?: number } + + interface ISubscriptionUpdateItem { + /** + * SubscriptionItem to update. + */ + id?: string; + + /** + * Delete all usage for a given subscription item. Only allowed when deleted is set to true and the current plan’s + * usage_type is metered. + */ + clear_usage?: boolean; + + /** + * Delete the specified item if set to true. + */ + deleted?: boolean; + + /** + * Set of key/value pairs that you can attach to an object. It can be useful for storing additional information about + * the object in a structured format. + */ + metadata?: IOptionsMetadata; + + /** + * Plan ID for this item. + */ + plan?: string; + + /** + * Quantity for this item. + */ + quantity?: number + } } namespace subscriptionItems { diff --git a/types/stripe/stripe-tests.ts b/types/stripe/stripe-tests.ts index d9ad735f9c..99cf3795db 100644 --- a/types/stripe/stripe-tests.ts +++ b/types/stripe/stripe-tests.ts @@ -251,11 +251,12 @@ stripe.customers.create({ customer.cards.list().then(function (cards) {}); customer.cards.del("card_17xMvXBoqMA9o2xkq6W5gamx").then(function (confirmation) {}); - customer.subscriptions.create({ plan: "gold" }).then(function (subscription) { }); - customer.subscriptions.create({ plan: "gold", trial_end: "now" }).then(function (subscription) { }); - customer.subscriptions.create({ plan: "gold", trial_end: 1516881177 }).then(function (subscription) { }); - customer.subscriptions.retrieve("sub_8Eluur5KoIKxuy").then(function (subscription) { }); - customer.subscriptions.update("sub_8Eluur5KoIKxuy", { plan: "silver" }).then(function (subscription) { }); + customer.subscriptions.create({ items: [{ plan: "gold" }] }).then(function (subscription) { }); + customer.subscriptions.create({ items: [{ plan: "gold" }], trial_end: "now" }).then(function (subscription) { }); + customer.subscriptions.create({ items: [{ plan: "gold" }], trial_end: 1516881177 }).then(function (subscription) { }); + customer.subscriptions.retrieve("sub_8Eluur5KoIKxuy").then(function (subscription) { + customer.subscriptions.update("sub_8Eluur5KoIKxuy", { items: [{ id: subscription.items.data[0].id, plan: "silver" }] }).then(function (subscription) { }); + }); customer.subscriptions.update("sub_8Eluur5KoIKxuy", { trial_end: "now" }); customer.subscriptions.update("sub_8Eluur5KoIKxuy", { trial_end: 1516881177 }); customer.subscriptions.list().then(function (subscriptions) { }); @@ -504,12 +505,12 @@ stripe.customers.retrieveSubscription("cus_5rfJKDJkuxzh5Q", "sub_5rfJxnBLGSwsYp" // asynchronously called }); -stripe.customers.updateSubscription("cus_5rfJKDJkuxzh5Q", "sub_5rfJxnBLGSwsYp", { plan: "platypi-dev" }, +stripe.customers.updateSubscription("cus_5rfJKDJkuxzh5Q", "sub_5rfJxnBLGSwsYp", { items: [{ id: "si_62U5U5BoqBA2o2xp6Eqcl6J7", plan: "platypi-dev" }] }, function (err, subscription) { // asynchronously called } ); -stripe.customers.updateSubscription("cus_5rfJKDJkuxzh5Q", "sub_5rfJxnBLGSwsYp", { plan: "platypi-dev" }).then(function (subscription) { +stripe.customers.updateSubscription("cus_5rfJKDJkuxzh5Q", "sub_5rfJxnBLGSwsYp", { items: [{ id: "si_62U5U5BoqBA2o2xp6Eqcl6J7", plan: "platypi-dev" }] }).then(function (subscription) { // asynchronously called }); @@ -1134,11 +1135,18 @@ stripe.plans.list().then(function (plans) { //#region Subscriptions tests // ################################################################################## -stripe.subscriptions.create({ plan: "platypi-dev", customer: "cus_5rfJKDJkuxzh5Q" }, function(err, subscription) { +stripe.subscriptions.create({ items: [{ plan: "platypi-dev" }], customer: "cus_5rfJKDJkuxzh5Q" }, function(err, subscription) { // asynchronously called }); -stripe.subscriptions.create({ plan: "platypi-dev", customer: "cus_5rfJKDJkuxzh5Q" }).then(function(subscription) { +stripe.subscriptions.create({ items: [{ plan: "platypi-dev" }], customer: "cus_5rfJKDJkuxzh5Q" }).then(function(subscription) { // asynchronously called + + stripe.subscriptions.update("sub_8QwCiwZ9tmMSpt", { items: [{ id: subscription.items.data[0].id, plan: "platypi" }] }, function(err, subscription) { + // asynchronously called + }); + stripe.subscriptions.update("sub_8QwCiwZ9tmMSpt", { items: [{ id: subscription.items.data[0].id, plan: "platypi" }] }).then(function(subscription) { + // asynchronously called + }); }); stripe.subscriptions.retrieve("sub_8QwCiwZ9tmMSpt", function(err, subscription) { @@ -1154,13 +1162,6 @@ stripe.subscriptions.retrieve("sub_8QwCiwZ9tmMSpt").then(function(subscription) } }); -stripe.subscriptions.update("sub_8QwCiwZ9tmMSpt", { plan: "platypi" }, function(err, subscription) { - // asynchronously called -}); -stripe.subscriptions.update("sub_8QwCiwZ9tmMSpt", { plan: "platypi" }).then(function(subscription) { - // asynchronously called -}); - stripe.subscriptions.del("sub_8QwCiwZ9tmMSpt", function(err, subscription) { // asynchronously called }); From 5beff6a9207d0ba0f96cabb634ade7fdedda097e Mon Sep 17 00:00:00 2001 From: Kevin Nacios Date: Tue, 30 Jan 2018 14:22:36 -0500 Subject: [PATCH 044/210] Add types for humanize-string (#23266) * Add types for humanize-string * remove namespace --- .../humanize-string/humanize-string-tests.ts | 4 ++++ types/humanize-string/index.d.ts | 8 +++++++ types/humanize-string/tsconfig.json | 23 +++++++++++++++++++ types/humanize-string/tslint.json | 1 + 4 files changed, 36 insertions(+) create mode 100644 types/humanize-string/humanize-string-tests.ts create mode 100644 types/humanize-string/index.d.ts create mode 100644 types/humanize-string/tsconfig.json create mode 100644 types/humanize-string/tslint.json diff --git a/types/humanize-string/humanize-string-tests.ts b/types/humanize-string/humanize-string-tests.ts new file mode 100644 index 0000000000..851746f088 --- /dev/null +++ b/types/humanize-string/humanize-string-tests.ts @@ -0,0 +1,4 @@ +import humanizeString = require('humanize-string'); + +humanizeString('UnicornsAndRainbows'); +humanizeString('unicorns_and-Rainbows_andPonies '); diff --git a/types/humanize-string/index.d.ts b/types/humanize-string/index.d.ts new file mode 100644 index 0000000000..ba8bc4e867 --- /dev/null +++ b/types/humanize-string/index.d.ts @@ -0,0 +1,8 @@ +// Type definitions for humanize-string 1.0 +// Project: https://github.com/sindresorhus/humanize-string/ +// Definitions by: Kevin Nacios +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare function humanizeString(text: string): string; + +export = humanizeString; diff --git a/types/humanize-string/tsconfig.json b/types/humanize-string/tsconfig.json new file mode 100644 index 0000000000..a0ec92be13 --- /dev/null +++ b/types/humanize-string/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "humanize-string-tests.ts" + ] +} diff --git a/types/humanize-string/tslint.json b/types/humanize-string/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/humanize-string/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 4c1b2958ab27ed5620be5e4c99b74a5b1fcd2782 Mon Sep 17 00:00:00 2001 From: LachlanStuart Date: Wed, 31 Jan 2018 08:23:31 +1300 Subject: [PATCH 045/210] add types for promise-queue (#23267) --- types/promise-queue/index.d.ts | 55 ++++++++++++++++++++++ types/promise-queue/promise-queue-tests.ts | 11 +++++ types/promise-queue/tsconfig.json | 23 +++++++++ types/promise-queue/tslint.json | 1 + 4 files changed, 90 insertions(+) create mode 100644 types/promise-queue/index.d.ts create mode 100644 types/promise-queue/promise-queue-tests.ts create mode 100644 types/promise-queue/tsconfig.json create mode 100644 types/promise-queue/tslint.json diff --git a/types/promise-queue/index.d.ts b/types/promise-queue/index.d.ts new file mode 100644 index 0000000000..efeaf04909 --- /dev/null +++ b/types/promise-queue/index.d.ts @@ -0,0 +1,55 @@ +// Type definitions for promise-queue 2.2 +// Project: https://github.com/azproduction/promise-queue +// Definitions by: Lachlan Stuart +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = PromiseQueue; + +declare class PromiseQueue { + /** + * + * @param maxPendingPromises [Infinity] Number of promises that can run at once. + * @param maxQueuedPromises [Infinity] Number of promises generators that can be in the queue at once. + * `add()` will return a rejected promise if this limit would be exceeded. + * @param options [{}] See QueueOptions + */ + constructor(maxPendingPromises?: number, maxQueuedPromises?: number, options?: PromiseQueue.QueueOptions); + + /** + * Enqueue a promise generator. When the number of running promises is less than `maxPendingPromises`, + * this function will be called and the returned promise will be held as a running promise until it + * rejects or resolves. + * + * @throws If the global `Promise` is undefined and `Queue.configure` hasn't been called. + * @param promiseGenerator A function that returns a promise when called. + * @returns A promise that forwards the resolution/rejection of the promise returned by `promiseGenerator`, + * or immediately rejects if `maxQueuedPromise` is exceeded. + */ + add(promiseGenerator: () => Promise): Promise; + + /** + * Returns the number of promiseGenerators waiting in queue. + */ + getPendingLength(): number; + + /** + * Returns the number of in-flight promises + */ + getQueueLength(): number; + + /** + * Set which promise constructor to use for the value returned by PromiseQueue#add. + * If this isn't called, the global `Promise` constructor is used. + * @param GlobalPromise A constructor for Promises + */ + static configure(GlobalPromise: PromiseConstructor): void; +} + +declare namespace PromiseQueue { + interface QueueOptions { + /** + * Callback that is called when the queue is empty and all pending promises have resolved + */ + onEmpty(): void; + } +} diff --git a/types/promise-queue/promise-queue-tests.ts b/types/promise-queue/promise-queue-tests.ts new file mode 100644 index 0000000000..fb3764c98f --- /dev/null +++ b/types/promise-queue/promise-queue-tests.ts @@ -0,0 +1,11 @@ +import * as PromiseQueue from 'promise-queue'; + +PromiseQueue.configure(Promise); + +const queue1 = new PromiseQueue(); +const queue2 = new PromiseQueue(1, 1, {onEmpty: () => null}); + +const queuedPromise: Promise = queue1.add(() => Promise.resolve(123)); + +const running: number = queue1.getPendingLength(); +const inQueue: number = queue1.getQueueLength(); diff --git a/types/promise-queue/tsconfig.json b/types/promise-queue/tsconfig.json new file mode 100644 index 0000000000..3487f5aa3e --- /dev/null +++ b/types/promise-queue/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "promise-queue-tests.ts" + ] +} diff --git a/types/promise-queue/tslint.json b/types/promise-queue/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/promise-queue/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 1748b088ab9d36f4d351e0d45c0cd00db628ea60 Mon Sep 17 00:00:00 2001 From: Cory Deppen Date: Tue, 30 Jan 2018 14:27:04 -0500 Subject: [PATCH 046/210] Allow resolveWeak to return a string (#23270) Handles cases where module ids are hashed. --- types/webpack-env/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/webpack-env/index.d.ts b/types/webpack-env/index.d.ts index 7320a438e9..1f03a25647 100644 --- a/types/webpack-env/index.d.ts +++ b/types/webpack-env/index.d.ts @@ -42,7 +42,7 @@ declare namespace __WebpackModuleApi { /** * Like require.resolve, but doesn’t include the module into the bundle. It’s a weak dependency. */ - resolveWeak(path: string): number; + resolveWeak(path: string): number | string; /** * Ensures that the dependency is available, but don’t execute it. This can be use for optimizing the position of a module in the chunks. */ From f78769eea6a1f3363895fa970348899d0df37827 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ph=E1=BA=A1m=20D=C6=B0=C6=A1ng=20Nh=E1=BA=ADt=20Nam?= Date: Wed, 31 Jan 2018 02:31:34 +0700 Subject: [PATCH 047/210] conf: add onDidChange method for v1 (#23273) * conf: add onDidChange method for v1 * conf: remove v1 history cause by mistake --- types/conf/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/conf/index.d.ts b/types/conf/index.d.ts index 9f88a88355..e58dc3ede7 100644 --- a/types/conf/index.d.ts +++ b/types/conf/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for conf 1.1 +// Type definitions for conf 1.4 // Project: https://github.com/sindresorhus/conf // Definitions by: Sam Verschueren // BendingBender @@ -24,6 +24,7 @@ declare class Conf implements Iterable<[string, T]> { has(key: string): boolean; delete(key: string): void; clear(): void; + onDidChange(key: string, callback: (oldVal: any, newVal: any) => void): void; [Symbol.iterator](): Iterator<[string, T]>; } From d337ba060d6149d4fe3af2458b423b96f5eef0cb Mon Sep 17 00:00:00 2001 From: dherman Date: Tue, 30 Jan 2018 14:32:09 -0500 Subject: [PATCH 048/210] add missing `multiple` property to the Request class (#23274) --- types/mssql/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/mssql/index.d.ts b/types/mssql/index.d.ts index a551d15ba8..272abb5e39 100644 --- a/types/mssql/index.d.ts +++ b/types/mssql/index.d.ts @@ -251,6 +251,7 @@ export declare class Request extends events.EventEmitter { public parameters: IRequestParameters; public verbose: boolean; public canceled: boolean; + public multiple: boolean; public stream: any; public constructor(connection?: ConnectionPool); public constructor(transaction: Transaction); From 97bc67099cbd46ecd6a3e59e2cfe2dfcefe44121 Mon Sep 17 00:00:00 2001 From: Passakorn Suppakityothin Date: Wed, 31 Jan 2018 02:33:47 +0700 Subject: [PATCH 049/210] Add "namespace" attribute to options interface (#23280) --- types/memcached/index.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/types/memcached/index.d.ts b/types/memcached/index.d.ts index fffbb57c82..8e330fa88d 100644 --- a/types/memcached/index.d.ts +++ b/types/memcached/index.d.ts @@ -280,5 +280,9 @@ declare namespace Memcached { * 5000, the idle timeout for the connections. */ idle ?: number; + /** + * '', sentinel to prepend to all memcache keys for namespacing the entries. + */ + namespace ?: string; } } From 849190ba67f0397eac8ae973a01c543c46f23907 Mon Sep 17 00:00:00 2001 From: Clark Stevenson Date: Tue, 30 Jan 2018 19:34:59 +0000 Subject: [PATCH 050/210] Updates pixi.js to 4.7.0 (#23281) * Updates pixi.js to 4.7.0 * Bump pixi.js header version to 4.7 --- types/pixi.js/index.d.ts | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/types/pixi.js/index.d.ts b/types/pixi.js/index.d.ts index b053b46790..6d7dfaf351 100644 --- a/types/pixi.js/index.d.ts +++ b/types/pixi.js/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Pixi.js 4.6 +// Type definitions for Pixi.js 4.7 // Project: https://github.com/pixijs/pixi.js/tree/dev // Definitions by: clark-stevenson // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -63,6 +63,7 @@ declare namespace PIXI { let PRECISION: string; let UPLOADS_PER_FRAME: number; let CAN_UPLOAD_SAME_BUFFER: boolean; + let MESH_CANVAS_PADDING: number; } ////////////////////////////////////////////////////////////////////////////// @@ -208,6 +209,7 @@ declare namespace PIXI { renderer: PIXI.WebGLRenderer | PIXI.CanvasRenderer; stage: Container; ticker: ticker.Ticker; + loader: loaders.Loader; readonly screen: Rectangle; stop(): void; @@ -497,6 +499,7 @@ declare namespace PIXI { drawCircle(x: number, y: number, radius: number): Graphics; drawEllipse(x: number, y: number, width: number, height: number): Graphics; drawPolygon(path: number[] | Point[] | Polygon): Graphics; + drawStar(x: number, y: number, points: number, radius: number, innerRadius: number, rotation?: number): Graphics; clear(): Graphics; isFastRect(): boolean; protected _renderCanvas(renderer: CanvasRenderer): void; @@ -1737,7 +1740,9 @@ declare namespace PIXI { // shader - class Shader extends glCore.GLShader { } + class Shader extends glCore.GLShader { + constructor(gl: WebGLRenderingContext, vertexSrc: string | string[], fragmentSrc: string | string[], attributeLocations?: { [key: string]: number }, precision?: string); + } ////////////////////////////////////////////////////////////////////////////// ////////////////////////////EXTRACT/////////////////////////////////////////// @@ -2163,7 +2168,7 @@ declare namespace PIXI { // pixi loader extends // https://github.com/englercj/resource-loader/ - // 2.0.9 + // 2.1.1 class MiniSignalBinding { //tslint:disable-next-line:ban-types forbidden-types @@ -2251,6 +2256,8 @@ declare namespace PIXI { onStart: MiniSignal; onComplete: MiniSignal; + concurrency: number; + add(...params: any[]): this; //tslint:disable-next-line:ban-types forbidden-types add(name: string, url: string, options?: LoaderOptions, cb?: Function): this; @@ -2268,6 +2275,7 @@ declare namespace PIXI { protected _prepareUrl(url: string): string; //tslint:disable-next-line:ban-types forbidden-types protected _loadResource(resource: Resource, dequeue: Function): void; + protected _onStart(): void; protected _onComplete(): void; protected _onLoad(resource: Resource): void; @@ -2523,7 +2531,11 @@ declare namespace PIXI { ////////////////////////////////////////////////////////////////////////////// namespace particles { interface ParticleContainerProperties { + /** + * DEPRECIATED - Use `vertices` + */ scale?: boolean; + vertices?: boolean; position?: boolean; rotation?: boolean; uvs?: boolean; @@ -2531,7 +2543,7 @@ declare namespace PIXI { alpha?: boolean; } class ParticleContainer extends Container { - constructor(maxSize?: number, properties?: ParticleContainerProperties, batchSize?: number, autoSize?: boolean); + constructor(maxSize?: number, properties?: ParticleContainerProperties, batchSize?: number, autoResize?: boolean); protected _tint: number; protected tintRgb: number | any[]; tint: number; From 5a8fffbd9118e8de801d6cc797d397b21ce3b2a9 Mon Sep 17 00:00:00 2001 From: Egor Shulga Date: Tue, 30 Jan 2018 22:36:16 +0300 Subject: [PATCH 051/210] [react-native-navigation] Add type definitions (#23283) * [react-native-tab-view] SceneMap should support all React.ComponentType's * [react-native-navigation] Add typings * [react-native-navigation] add navigator.setStyle() method --- types/react-native-navigation/index.d.ts | 270 ++++++++++++++++++ .../react-native-navigation-tests.tsx | 66 +++++ types/react-native-navigation/tsconfig.json | 24 ++ types/react-native-navigation/tslint.json | 1 + 4 files changed, 361 insertions(+) create mode 100644 types/react-native-navigation/index.d.ts create mode 100644 types/react-native-navigation/react-native-navigation-tests.tsx create mode 100644 types/react-native-navigation/tsconfig.json create mode 100644 types/react-native-navigation/tslint.json diff --git a/types/react-native-navigation/index.d.ts b/types/react-native-navigation/index.d.ts new file mode 100644 index 0000000000..893a904f73 --- /dev/null +++ b/types/react-native-navigation/index.d.ts @@ -0,0 +1,270 @@ +// Type definitions for react-native-navigation 1.1 +// Project: https://github.com/wix/react-native-navigation +// Definitions by: Egor Shulga +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import * as React from 'react'; + +export namespace Navigation { + function registerComponent(screenID: string, generator: () => React.ComponentType, store?: any, provider?: any): void; + function startTabBasedApp(params: TabBasedApp): void; + function startSingleScreenApp(params: SingleScreenApp): void; + function showModal(params: ModalScreen): void; + function dismissModal(params?: { animationType?: 'none' | 'slide-down' }): void; + function dismissAllModals(params?: { animationType?: 'none' | 'slide-down' }): void; + function showLightBox(params?: LightBox): void; + function dismissLightBox(): void; + function handleDeepLink(params?: { link: string; payload?: string; }): void; + function registerScreen(screenId: string, generator: () => React.ComponentType): void; + function getCurrentlyVisibleScreenId(): Promise; +} + +export interface TabBasedApp { + tabs: TabScreen[]; + tabsStyle?: { + tabBarButtonColor?: string; + tabBarSelectedButtonColor?: string; + tabBarBackgroundColor?: string; + initialTabIndex?: number; + }; + appStyle?: { + orientation?: 'auto' | 'landscape' | 'portrait'; + bottomTabBadgeTextColor?: string; + bottomTabBadgeBackgroundColor?: string; + backButtonImage?: any; + hideBackButtonTitle?: boolean; + }; + drawer?: Drawer; + passProps?: object; + animationType?: 'none' | 'slide-down' | 'fade'; +} + +export interface TabScreen { + label?: string; + screen: string; + icon?: any; + selectedIcon?: any; + title?: string; + navigatorStyle?: NavigatorStyle; + navigatorButtons?: NavigatorButtons; +} + +export interface SingleScreenApp { + screen: Screen; + drawer?: Drawer; + passProps?: object; + animationType?: 'none' | 'slide-down' | 'fade'; +} + +export interface Screen { + screen: string; + title?: string; + navigatorStyle?: NavigatorStyle; + navigatorButtons?: NavigatorButtons; +} + +export interface ModalScreen extends Screen { + passProps?: object; + animationType?: 'slide-up' | 'none'; +} + +export interface ResetScreen extends Screen { + passProps?: object; + animated?: boolean; + animationType?: 'fade' | 'slide-horizontal'; +} + +export interface PushedScreen extends ResetScreen { + titleImage?: any; + backButtonTitle?: string; + backButtonHidden?: boolean; + previewView?: React.Component | number; + previewHeight?: number; + previewCommit?: boolean; + previewActions?: Action[]; +} + +export interface Action { + id: string; + title: string; + style?: 'selected' | 'destructive'; + actions: Action[]; +} + +export interface LightBox { + screen: string; + passProps?: object; + style?: { + backgroundBlur?: 'dark' | 'light' | 'xlight' | 'none'; + backgroundColor?: string; + }; + adjustSoftInput?: 'nothing' | 'pan' | 'resize' | 'unspecified'; +} + +export interface Navigator { + push(params: PushedScreen): void; + pop(params?: { animated?: boolean; animationType?: 'fade' | 'slide-horizontal'; }): void; + popToRoot(params?: { animated?: boolean; animationType?: 'fade' | 'slide-horizontal'; }): void; + resetTo(params: PushedScreen): void; + showModal(params: ModalScreen): void; + dismissModal(params?: { animationType?: 'none' | 'slide-down' }): void; + dismissAllModals(params?: { animationType?: 'none' | 'slide-down' }): void; + showLightBox(params: LightBox): void; + dismissLightBox(): void; + showInAppNotification(params?: { screen: string; passProps?: object; autoDismissTimerSec?: number }): void; + handleDeepLink(params: { link: string }): void; + setButtons(params: NavigatorButtons & { animated?: boolean }): void; + setTitle(params: { title: string }): void; + setSubTitle(params: { subtitle: string }): void; + toggleDrawer(params: { side: 'left' | 'right'; animated?: boolean; to?: 'open' | 'closed' }): void; + setDrawerEnabled(params: { side: 'left' | 'right'; enabled: boolean }): void; + toggleTabs(params: { to: 'hidden' | 'shown'; animated?: boolean }): void; + setTabBadge(params?: { tabIndex?: number; badge?: number; badgeColor?: string; }): void; + setTabButton(params?: { tabIndex?: number; icon?: any; selectedIcon?: any; label?: string; }): void; + switchToTab(params?: { tabIndex?: number }): void; + toggleNavBar(params: { to: 'hidden' | 'shown'; animated?: boolean }): void; + setOnNavigatorEvent(callback: (event: { id: string }) => void): void; + addOnNavigatorEvent(callback: (event: { id: string }) => void): () => void; + screenIsCurrentlyVisible(): Promise; + setStyle(params: NavigatorStyle): void; +} + +export class ScreenVisibilityListener { + constructor(params: ScreenVisibilityListenerParams); + register(): void; + unregister(): void; +} + +export interface ScreenVisibilityListenerParams { + willAppear?: (params: ListenerParams) => void; + didAppear?: (params: ListenerParams) => void; + willDisappear?: (params: ListenerParams) => void; + didDisappear?: (params: ListenerParams) => void; +} + +export interface ListenerParams { + screen: string; + startTime: number; + endTime: number; + commandType: string; +} + +export type NavigationComponentProps

= + P & { + navigator: Navigator; + }; + +export interface NavigatorStyle { + navBarTextColor?: string; + navBarTextFontSize?: number; + navBarTextFontFamily?: string; + navBarBackgroundColor?: string; + navBarCustomView?: string; + navBarComponentAlignment?: 'center' | 'fill'; + navBarCustomViewInitialProps?: object; + navBarButtonColor?: string; + topBarElevationShadowEnabled?: boolean; + navBarHidden?: boolean; + navBarHideOnScroll?: boolean; + navBarTranslucent?: boolean; + navBarTransparent?: boolean; + navBarNoBorder?: boolean; + drawUnderNavBar?: boolean; + drawUnderTabBar?: boolean; + navBarBlur?: boolean; + tabBarHidden?: boolean; + statusBarHidden?: boolean; + statusBarTextColorScheme?: string; + navBarSubtitleColor?: string; + navBarSubtitleFontFamily?: string; + navBarSubtitleFontSize?: number; + screenBackgroundColor?: string; + orientation?: 'auto ' | 'landscape' | 'portrait'; + disabledButtonColor?: string; + // iOS only + statusBarTextColorSchemeSingleScreen?: string; + statusBarHideWithNavBar?: boolean; + statusBarBlur?: boolean; + disabledBackGesture?: boolean; + disabledSimultaneousGesture?: boolean; + screenBackgroundImageName?: string; + rootBackgroundImageName?: string; + navBarButtonFontSize?: number; + navBarButtonFontWeight?: string | number; + navBarLeftButtonFontSize?: number; + navBarLeftButtonColor?: string; + navBarLeftButtonFontWeight?: string | number; + navBarRightButtonFontSize?: number; + navBarRightButtonColor?: string; + navBarRightButtonFontWeight?: string | number; + topBarShadowColor?: string; + topBarShadowOpacity?: number; + topBarShadowOffset?: number; + topBarShadowRadius?: number; + preferredContentSize?: { width: number, height: number }; + modalPresentationStyle?: 'formSheet' | 'pageSheet' | 'overFullScreen' | 'overCurrentContext' | 'fullScreen'; + largeTitle?: boolean; + // Android only + navigationBarColor?: string; + navBarTitleTextCentered?: boolean; + navBarButtonFontFamily?: string; + statusBarColor?: string; + drawUnderStatusBar?: boolean; + collapsingToolBarImage?: object; + collapsingToolBarCollapsedColor?: string; + navBarTextFontBold?: boolean; + navBarHeight?: number; + navBarTopPadding?: number; + topTabsHeight?: number; + topBarBorderColor?: string; + topBarBorderWidth?: number; +} + +export interface NavigatorButtons { + leftButtons?: NavigatorButton[]; + rightButtons?: NavigatorButton[]; +} + +export type IdAndroid = 'back' | 'cancel' | 'accept' | 'sideMenu'; + +export type SystemItemIOS = 'done' | 'cancel' | 'edit' | 'save' | 'add' | + 'flexibleSpace' | 'fixedSpace' | 'compose' | 'reply' | 'action' | 'organize' | + 'bookmarks' | 'search' | 'refresh' | 'stop' | 'camera' | 'trash' | 'play' | + 'pause' | 'rewind' | 'fastForward' | 'undo' | 'redo'; + +export interface NavigatorButton { + id: string | IdAndroid; + title?: string; + icon?: any; + component?: string; + passProps?: object; + testID?: string; + disabled?: boolean; + disableIconTint?: boolean; + buttonColor?: string; + buttonFontSize?: number; + buttonFontWeight?: string | number; + systemItem?: SystemItemIOS; +} + +export interface FABAndroid { + collapsedId?: string; + collapsedIcon?: any; + collapsedIconColor?: string; + expendedId?: string; + expendedIcon?: any; + expendedIconColor?: string; + backgroundColor?: string; + actions?: NavigatorButton[]; +} + +export interface Drawer { + left?: { + screen: string; + }; + right?: { + screen: string; + }; + disableOpenGesture?: boolean; +} diff --git a/types/react-native-navigation/react-native-navigation-tests.tsx b/types/react-native-navigation/react-native-navigation-tests.tsx new file mode 100644 index 0000000000..292b0fb375 --- /dev/null +++ b/types/react-native-navigation/react-native-navigation-tests.tsx @@ -0,0 +1,66 @@ +import * as React from 'react'; +import { Text, View } from 'react-native'; +import { Navigation, NavigationComponentProps, NavigatorStyle, NavigatorButtons } from 'react-native-navigation'; + +class Screen1 extends React.Component> { + static navigatorButtons: NavigatorButtons = { + leftButtons: [{ + id: 'sideMenu' + }] + }; + + componentDidMount() { + this.props.navigator.push({ screen: 'example.Screen2' }); + } + + render() { + return ( + + Screen 1 + + ); + } +} + +class Screen2 extends React.Component { + static navigatorStyle: NavigatorStyle = { + drawUnderNavBar: true, + navBarTranslucent: true + }; + + componentDidMount() { + this.props.navigator.resetTo({ screen: 'example.Screen1' }); + } + + render() { + return ( + + Screen 2 + + ); + } +} + +const Drawer = (props: NavigationComponentProps) => { + return ( + + Drawer + + ); +}; + +Navigation.registerComponent('example.Screen1', () => Screen1); +Navigation.registerComponent('example.Screen2', () => Screen2); +Navigation.registerComponent('example.Drawer', () => Drawer); + +Navigation.startSingleScreenApp({ + screen: { + screen: 'example.Screen1', + title: 'Screen 1', + }, + drawer: { + left: { + screen: 'example.Drawer', + } + } +}); diff --git a/types/react-native-navigation/tsconfig.json b/types/react-native-navigation/tsconfig.json new file mode 100644 index 0000000000..715f1f9e62 --- /dev/null +++ b/types/react-native-navigation/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react-native" + }, + "files": [ + "index.d.ts", + "react-native-navigation-tests.tsx" + ] +} diff --git a/types/react-native-navigation/tslint.json b/types/react-native-navigation/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-native-navigation/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From f173bc7f72e4ae23536c2e3091742342a759b6cf Mon Sep 17 00:00:00 2001 From: Pierantonio Cangianiello Date: Tue, 30 Jan 2018 20:37:40 +0100 Subject: [PATCH 052/210] [serialport] Add SerialPort.list() (#23284) * Add SerialPort.list() Adding `list()` static method to `SerialPort` class. See [here](https://github.com/node-serialport/node-serialport/blob/master/lib/serialport.js#L612) * Update index.d.ts --- types/serialport/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/serialport/index.d.ts b/types/serialport/index.d.ts index 74a4f90e42..84b5790fd4 100644 --- a/types/serialport/index.d.ts +++ b/types/serialport/index.d.ts @@ -34,6 +34,8 @@ declare class SerialPort extends Stream.Duplex { on(event: string, callback?: (data?: any) => void): this; static Binding: SerialPort.BaseBinding; + + static list(): Promise; } declare namespace SerialPort { From ed1e090ecffe4e5d3604a13ce4bb3cb4edda908f Mon Sep 17 00:00:00 2001 From: vlascik Date: Tue, 30 Jan 2018 20:50:19 +0100 Subject: [PATCH 053/210] Name default exports to help with auto-imports (#23287) --- types/ember/index.d.ts | 84 +++++++++++++++++++++++------------------- 1 file changed, 46 insertions(+), 38 deletions(-) diff --git a/types/ember/index.d.ts b/types/ember/index.d.ts index 5f041b9df6..22ff839774 100755 --- a/types/ember/index.d.ts +++ b/types/ember/index.d.ts @@ -3284,7 +3284,7 @@ declare module 'ember' { declare module '@ember/application' { import Ember from 'ember'; - export default Ember.Application; + export default class Application extends Ember.Application { } export const getOwner: typeof Ember.getOwner; export const onLoad: typeof Ember.onLoad; export const runLoadHooks: typeof Ember.runLoadHooks; @@ -3299,22 +3299,23 @@ declare module '@ember/application/deprecations' { declare module '@ember/application/globals-resolver' { import Ember from 'ember'; - export default Ember.DefaultResolver; + export default class GlobalsResolver extends Ember.DefaultResolver { } } declare module '@ember/application/instance' { import Ember from 'ember'; - export default Ember.ApplicationInstance; + export default class ApplicationInstance extends Ember.ApplicationInstance { } } declare module '@ember/application/resolver' { import Ember from 'ember'; - export default Ember.Resolver; + export default class Resolver extends Ember.Resolver { } } declare module '@ember/array' { import Ember from 'ember'; - export default Ember.Array; + const EmberArray: typeof Ember.Array; + export default EmberArray; export const A: typeof Ember.A; export const isArray: typeof Ember.isArray; export const makeArray: typeof Ember.makeArray; @@ -3322,43 +3323,44 @@ declare module '@ember/array' { declare module '@ember/array/mutable' { import Ember from 'ember'; - export default Ember.MutableArray; + const MutableArray: typeof Ember.MutableArray; + export default MutableArray; } declare module '@ember/array/proxy' { import Ember from 'ember'; - export default Ember.ArrayProxy; + export default class ArrayProxy extends Ember.ArrayProxy { } } declare module '@ember/component' { import Ember from 'ember'; - export default Ember.Component; + export default class Component extends Ember.Component { } } declare module '@ember/component/checkbox' { import Ember from 'ember'; - export default Ember.Checkbox; + export default class Checkbox extends Ember.Checkbox { } } declare module '@ember/component/helper' { import Ember from 'ember'; - export default Ember.Helper; + export default class Helper extends Ember.Helper { } export const helper: typeof Ember.Helper.helper; } declare module '@ember/component/text-area' { import Ember from 'ember'; - export default Ember.TextArea; + export default class TextArea extends Ember.TextArea { } } declare module '@ember/component/text-field' { import Ember from 'ember'; - export default Ember.TextField; + export default class TextField extends Ember.TextField { } } declare module '@ember/controller' { import Ember from 'ember'; - export default Ember.Controller; + export default class Controller extends Ember.Controller { } export const inject: typeof Ember.inject.controller; } @@ -3375,28 +3377,29 @@ declare module '@ember/debug' { declare module '@ember/debug/container-debug-adapter' { import Ember from 'ember'; - export default Ember.ContainerDebugAdapter; + export default class ContainerDebugAdapter extends Ember.ContainerDebugAdapter { } } declare module '@ember/debug/data-adapter' { import Ember from 'ember'; - export default Ember.DataAdapter; + export default class DataAdapter extends Ember.DataAdapter { } } declare module '@ember/engine' { import Ember from 'ember'; - export default Ember.Engine; + export default class Engine extends Ember.Engine { } export const getEngineParent: typeof Ember.getEngineParent; } declare module '@ember/engine/instance' { import Ember from 'ember'; - export default Ember.EngineInstance; + export default class EngineInstance extends Ember.EngineInstance { } } declare module '@ember/enumerable' { import Ember from 'ember'; - export default Ember.Enumerable; + const Enumerable: typeof Ember.Enumerable; + export default Enumerable; } declare module '@ember/instrumentation' { @@ -3409,17 +3412,17 @@ declare module '@ember/instrumentation' { declare module '@ember/map' { import Ember from 'ember'; - export default Ember.Map; + export default class EmberMap extends Ember.Map { } } declare module '@ember/map/with-default' { import Ember from 'ember'; - export default Ember.MapWithDefault; + export default class MapWithDefault extends Ember.MapWithDefault { } } declare module '@ember/object' { import Ember from 'ember'; - export default Ember.Object; + export default class EmberObject extends Ember.Object { } export const aliasMethod: typeof Ember.aliasMethod; export const computed: typeof Ember.computed; export const defineProperty: typeof Ember.defineProperty; @@ -3434,7 +3437,7 @@ declare module '@ember/object' { declare module '@ember/object/computed' { import Ember from 'ember'; - export default Ember.ComputedProperty; + export default class ComputedProperty extends Ember.ComputedProperty { } export const alias: typeof Ember.computed.alias; export const and: typeof Ember.computed.and; export const bool: typeof Ember.computed.bool; @@ -3472,12 +3475,13 @@ declare module '@ember/object/computed' { declare module '@ember/object/core' { import Ember from 'ember'; - export default Ember.CoreObject; + export default class CoreObject extends Ember.CoreObject { } } declare module '@ember/object/evented' { import Ember from 'ember'; - export default Ember.Evented; + const Evented: typeof Ember.Evented; + export default Evented; export const on: typeof Ember.on; } @@ -3497,12 +3501,14 @@ declare module '@ember/object/internals' { declare module '@ember/object/mixin' { import Ember from 'ember'; - export default Ember.Mixin; + const Mixin: typeof Ember.Mixin; + export default Mixin; } declare module '@ember/object/observable' { import Ember from 'ember'; - export default Ember.Observable; + const Observable: typeof Ember.Observable; + export default Observable; } declare module '@ember/object/observers' { @@ -3513,12 +3519,13 @@ declare module '@ember/object/observers' { declare module '@ember/object/promise-proxy-mixin' { import Ember from 'ember'; - export default Ember.PromiseProxyMixin; + const PromiseProxyMixin: typeof Ember.PromiseProxyMixin; + export default PromiseProxyMixin; } declare module '@ember/object/proxy' { import Ember from 'ember'; - export default Ember.ObjectProxy; + export default class ObjectProxy extends Ember.ObjectProxy { } } declare module '@ember/polyfills' { @@ -3532,42 +3539,43 @@ declare module '@ember/polyfills' { declare module '@ember/routing/auto-location' { import Ember from 'ember'; - export default Ember.AutoLocation; + export default class AutoLocation extends Ember.AutoLocation { } } declare module '@ember/routing/hash-location' { import Ember from 'ember'; - export default Ember.HashLocation; + export default class HashLocation extends Ember.HashLocation { } } declare module '@ember/routing/history-location' { import Ember from 'ember'; - export default Ember.HistoryLocation; + export default class HistoryLocation extends Ember.HistoryLocation { } } declare module '@ember/routing/link-component' { import Ember from 'ember'; - export default Ember.LinkComponent; + export default class LinkComponent extends Ember.LinkComponent { } } declare module '@ember/routing/location' { import Ember from 'ember'; - export default Ember.Location; + const Location: typeof Ember.Location; + export default Location; } declare module '@ember/routing/none-location' { import Ember from 'ember'; - export default Ember.NoneLocation; + export default class NoneLocation extends Ember.NoneLocation { } } declare module '@ember/routing/route' { import Ember from 'ember'; - export default Ember.Route; + export default class Route extends Ember.Route { } } declare module '@ember/routing/router' { import Ember from 'ember'; - export default Ember.Router; + export default class EmberRouter extends Ember.Router { } } declare module '@ember/runloop' { @@ -3589,7 +3597,7 @@ declare module '@ember/runloop' { declare module '@ember/service' { import Ember from 'ember'; - export default Ember.Service; + export default class Service extends Ember.Service { } export const inject: typeof Ember.inject.service; } @@ -3619,7 +3627,7 @@ declare module '@ember/test' { declare module '@ember/test/adapter' { import Ember from 'ember'; - export default Ember.Test.Adapter; + export default class TestAdapter extends Ember.Test.Adapter { } } declare module '@ember/utils' { From 49d9ce703903b3f22ddbc20378eef6b75a39ff42 Mon Sep 17 00:00:00 2001 From: Philip Bulley Date: Tue, 30 Jan 2018 19:59:52 +0000 Subject: [PATCH 054/210] Adds support for any property to TweenConfig (#23290) --- types/gsap/TweenConfig.d.ts | 3 +++ types/gsap/gsap-tests.ts | 17 ++++++++++++++--- types/gsap/index.d.ts | 2 +- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/types/gsap/TweenConfig.d.ts b/types/gsap/TweenConfig.d.ts index 59c472bea2..33cde9c6ae 100644 --- a/types/gsap/TweenConfig.d.ts +++ b/types/gsap/TweenConfig.d.ts @@ -1,6 +1,9 @@ declare namespace gsap { export interface TweenConfig { + /** Any tweenable property */ + [p: string]: any; + /** Amount of delay in seconds (or frames for frames-based tweens) before the animation should begin.*/ delay?: number; diff --git a/types/gsap/gsap-tests.ts b/types/gsap/gsap-tests.ts index 048a9d522e..36192141be 100644 --- a/types/gsap/gsap-tests.ts +++ b/types/gsap/gsap-tests.ts @@ -1,8 +1,19 @@ -import { TweenLite } from 'gsap'; +import { TweenLite, TweenMax } from 'gsap'; -const tween = TweenLite +const tweenLiteExample = TweenLite .to(document.getElementById('some-div'), 1, { width: '200px', - height: '200px' + height: '200px', + x: '100px', + y: '200px' }) .seek(0.5); + +const tweenMaxExample = TweenMax + .to(document.getElementById('some-div'), 1, { + width: '200px', + height: '200px', + x: '100px', + y: '200px' + }) + .seek(0.5); diff --git a/types/gsap/index.d.ts b/types/gsap/index.d.ts index cebefcf1c9..77d589603a 100644 --- a/types/gsap/index.d.ts +++ b/types/gsap/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for GSAP 1.19 // Project: http://greensock.com/ -// Definitions by: VILIC VANE , Robert S , Richard Fox +// Definitions by: VILIC VANE , Robert S , Richard Fox , Philip Bulley // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// From 014b08e5931223ea2400195f3cccb668f7c89821 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20R=C3=A4dlinger?= Date: Tue, 30 Jan 2018 22:10:24 +0100 Subject: [PATCH 055/210] IntlProvider add initialNow prop (#23246) --- types/react-intl/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/react-intl/index.d.ts b/types/react-intl/index.d.ts index 7fc19e41ab..383fdef681 100644 --- a/types/react-intl/index.d.ts +++ b/types/react-intl/index.d.ts @@ -7,6 +7,7 @@ // Karol Janyst , // Brian Houser , // Krister Kari +// Martin Raedlinger // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -189,6 +190,7 @@ declare namespace ReactIntl { defaultLocale?: string; defaultFormats?: any; textComponent?: any; + initialNow?: any; } } From 9b5b28fdd41be42ef41d7811ce6a456fe5d6e2c6 Mon Sep 17 00:00:00 2001 From: Alberto Vasquez Date: Tue, 30 Jan 2018 22:46:16 -0500 Subject: [PATCH 056/210] [config] Adding type definition for toObject Adding type definition toObject(config?: any): any; --- types/config/index.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/types/config/index.d.ts b/types/config/index.d.ts index ea5e5a940a..a18e765012 100644 --- a/types/config/index.d.ts +++ b/types/config/index.d.ts @@ -3,6 +3,7 @@ // Definitions by: Roman Korneev // Forrest Bice // James Donald +// Alberto Vasquez // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -39,6 +40,9 @@ declare namespace c { // Return the sources for the configurations getConfigSources(): IConfigSource[]; + + // Returns a new deep copy of the current config object, or any part of the config if provided. + toObject(config?: any): any; /** * This allows module developers to attach their configurations onto From 73e70076ff60993badba273f85653ea47d9b8710 Mon Sep 17 00:00:00 2001 From: Samuel Edwin Date: Wed, 31 Jan 2018 23:50:38 +0700 Subject: [PATCH 057/210] Add justify option to TextStyle --- types/react-native/index.d.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index 8d40ad33a3..6cb72a0041 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -758,11 +758,7 @@ export interface TextStyle extends TextStyleIOS, TextStyleAndroid, ViewStyle { fontWeight?: "normal" | "bold" | "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900"; letterSpacing?: number; lineHeight?: number; - /** - * Specifies text alignment. - * The value 'justify' is only supported on iOS. - */ - textAlign?: "auto" | "left" | "right" | "center"; + textAlign?: "auto" | "left" | "right" | "center" | "justify"; textDecorationLine?: "none" | "underline" | "line-through" | "underline line-through"; textDecorationStyle?: "solid" | "double" | "dotted" | "dashed"; textDecorationColor?: string; From 05b4c4f3646c3128545b95c8bf868863ab7b2aa5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Tabille=20Manjabosco?= Date: Wed, 31 Jan 2018 16:27:11 -0200 Subject: [PATCH 058/210] Add missing properties "defaultSortDirection" and "headerStyle" to ColumnProps --- types/react-virtualized/dist/es/Table.d.ts | 8 ++++++-- types/react-virtualized/react-virtualized-tests.tsx | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/types/react-virtualized/dist/es/Table.d.ts b/types/react-virtualized/dist/es/Table.d.ts index 97fe20b657..87f79de86d 100644 --- a/types/react-virtualized/dist/es/Table.d.ts +++ b/types/react-virtualized/dist/es/Table.d.ts @@ -74,6 +74,8 @@ export type ColumnProps = { columnData?: any; /** Uniquely identifies the row-data attribute correspnding to this cell */ dataKey: any; + /** Default sort order when clicked for the first time. Valid options include "ASC" and "DESC". Defaults to "ASC" */ + defaultSortDirection?: SortDirectionType; /** If sort is enabled for the table at large, disable it for this column */ disableSort?: boolean; /** Flex grow style; defaults to 0 */ @@ -87,6 +89,10 @@ export type ColumnProps = { * ({ columnData: object, dataKey: string, disableSort: boolean, label: string, sortBy: string, sortDirection: string }): PropTypes.node */ headerRenderer?: TableHeaderRenderer; + /** Optional inline style to apply to this column's header */ + headerStyle?: React.CSSProperties; + /** Optional id to set on the column header; used for aria-describedby */ + id?: string; /** Header label for this column */ label?: string; /** Maximum width of column; this property will only be used if :flexGrow is > 0. */ @@ -97,8 +103,6 @@ export type ColumnProps = { style?: React.CSSProperties; /** Flex basis (width) for this column; This value can grow or shrink based on :flexGrow and :flexShrink properties. */ width: number; - /** Optional id to set on the column header; used for aria-describedby */ - id?: string; } export class Column extends Component { static propTypes: { diff --git a/types/react-virtualized/react-virtualized-tests.tsx b/types/react-virtualized/react-virtualized-tests.tsx index c5958ab96c..d912c1f28f 100644 --- a/types/react-virtualized/react-virtualized-tests.tsx +++ b/types/react-virtualized/react-virtualized-tests.tsx @@ -1546,12 +1546,14 @@ export class TableExample extends PureComponent<{}, any> { } dataKey='index' disableSort={!this._isSortEnabled()} + defaultSortDirection={SortDirection.DESC} width={60} /> } From 5af4ae7bf0724fdf096d565b1d51cc6f80ef8923 Mon Sep 17 00:00:00 2001 From: Yoyo Zhou Date: Wed, 31 Jan 2018 12:04:27 -0800 Subject: [PATCH 059/210] kafka-node: fix message value to be string or Buffer (#23201) --- types/kafka-node/index.d.ts | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/types/kafka-node/index.d.ts b/types/kafka-node/index.d.ts index e5aa9cf0a8..71d1fd6728 100644 --- a/types/kafka-node/index.d.ts +++ b/types/kafka-node/index.d.ts @@ -3,6 +3,8 @@ // Definitions by: Daniel Imrie-Situnayake , Bill , Michael Haan , Amiram Korach // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +/// + // # Classes export class Client { constructor(connectionString: string, clientId?: string, options?: ZKOptions, noBatchOptions?: AckBatchOptions, sslOptions?: any); @@ -88,24 +90,24 @@ export class Offset { } export class KeyedMessage { - constructor(key: string, message: string); + constructor(key: string, value: string | Buffer); } // # Interfaces export interface Message { - topic: string; - value: string; - offset?: number; - partition?: number; - highWaterOffset?: number; - key?: string; -} + topic: string; + value: string | Buffer; + offset?: number; + partition?: number; + highWaterOffset?: number; + key?: string; + } export interface ProducerOptions { - requireAcks?: number; - ackTimeoutMs?: number; - partitionerType?: number; + requireAcks?: number; + ackTimeoutMs?: number; + partitionerType?: number; } export interface KafkaClientOptions { From c8e5d4efd968ba4bc9df8b6e06c82a29b48148d6 Mon Sep 17 00:00:00 2001 From: JR Date: Wed, 31 Jan 2018 20:11:16 +0000 Subject: [PATCH 060/210] Update index.d.ts (#23216) Added optional className prop on `ReduxToastrProps` to support https://github.com/diegoddox/react-redux-toastr/issues/103 --- types/react-redux-toastr/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/react-redux-toastr/index.d.ts b/types/react-redux-toastr/index.d.ts index 29570b99a2..125e0f138e 100644 --- a/types/react-redux-toastr/index.d.ts +++ b/types/react-redux-toastr/index.d.ts @@ -100,6 +100,7 @@ interface ReduxToastrProps { toastr?: ToastrState; transitionIn?: transitionInType; transitionOut?: transitionOutType; + className?: string; } interface ToastrEmitter { From 5f07b0f39bf6f52302c1c1f3cee2d2ec4f8f1c9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomek=20=C5=81aziuk?= Date: Wed, 31 Jan 2018 21:15:55 +0100 Subject: [PATCH 061/210] [react-loadable] ability to import types which were unavailable (#23218) * import/export * contributors * fix namespace --- types/react-loadable/index.d.ts | 9 ++++++--- types/react-loadable/test/index.tsx | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/types/react-loadable/index.d.ts b/types/react-loadable/index.d.ts index 8b591d3f3a..08c5b52e39 100644 --- a/types/react-loadable/index.d.ts +++ b/types/react-loadable/index.d.ts @@ -1,12 +1,15 @@ // Type definitions for react-loadable 5.3 // Project: https://github.com/thejameskyle/react-loadable#readme -// Definitions by: Diogo Franco , Oden S. , Ian Ker-Seymer +// Definitions by: Diogo Franco +// Oden S. +// Ian Ker-Seymer +// Tomek Łaziuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 /// -declare namespace Loadable { +declare namespace LoadableExport { interface LoadingComponentProps { isLoading: boolean; pastDelay: boolean; @@ -182,7 +185,7 @@ declare namespace Loadable { } } -declare const LoadableExport: Loadable.Loadable; +declare const LoadableExport: LoadableExport.Loadable; /* tslint:disable-next-line */ declare module "react-loadable" { diff --git a/types/react-loadable/test/index.tsx b/types/react-loadable/test/index.tsx index 5045fdf125..7d25d849a7 100644 --- a/types/react-loadable/test/index.tsx +++ b/types/react-loadable/test/index.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import Loadable = require('react-loadable'); +import * as Loadable from 'react-loadable'; class LoadingComponent extends React.Component { render() { From cd92f62f153d923b65941958d2d90d8699a78ee3 Mon Sep 17 00:00:00 2001 From: Mykola Date: Wed, 31 Jan 2018 12:20:20 -0800 Subject: [PATCH 062/210] Fix typo (#23277) --- types/mongoose/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/mongoose/index.d.ts b/types/mongoose/index.d.ts index 7ac3ee7e41..3cf4e4ca2a 100644 --- a/types/mongoose/index.d.ts +++ b/types/mongoose/index.d.ts @@ -694,7 +694,7 @@ declare module "mongoose" { } interface SchemaOptions { - /** defaults to null (which means use the connection's autoIndex option) */ + /** defaults to false (which means use the connection's autoIndex option) */ autoIndex?: boolean; /** defaults to true */ bufferCommands?: boolean; From c08ff42c6244ad335b5be2c11419dce4ca37d40b Mon Sep 17 00:00:00 2001 From: Florian Keller Date: Wed, 31 Jan 2018 21:23:00 +0100 Subject: [PATCH 063/210] Add types for ed2curve (#23286) --- types/ed2curve/ed2curve-tests.ts | 9 +++++++++ types/ed2curve/index.d.ts | 34 ++++++++++++++++++++++++++++++++ types/ed2curve/tsconfig.json | 23 +++++++++++++++++++++ types/ed2curve/tslint.json | 1 + 4 files changed, 67 insertions(+) create mode 100644 types/ed2curve/ed2curve-tests.ts create mode 100644 types/ed2curve/index.d.ts create mode 100644 types/ed2curve/tsconfig.json create mode 100644 types/ed2curve/tslint.json diff --git a/types/ed2curve/ed2curve-tests.ts b/types/ed2curve/ed2curve-tests.ts new file mode 100644 index 0000000000..bb26cf5b49 --- /dev/null +++ b/types/ed2curve/ed2curve-tests.ts @@ -0,0 +1,9 @@ +import * as ed2curve from 'ed2curve'; +import * as nacl from 'tweetnacl'; + +const myKeyPair = nacl.sign.keyPair(); + +const newPublicKey = ed2curve.convertPublicKey(myKeyPair.publicKey); +const newSecretKey = ed2curve.convertSecretKey(myKeyPair.secretKey); + +const newKeyPair = ed2curve.convertKeyPair(myKeyPair); diff --git a/types/ed2curve/index.d.ts b/types/ed2curve/index.d.ts new file mode 100644 index 0000000000..5dd9b1e748 --- /dev/null +++ b/types/ed2curve/index.d.ts @@ -0,0 +1,34 @@ +// Type definitions for ed2curve 0.2 +// Project: https://github.com/dchest/ed2curve-js +// Definitions by: Florian Keller +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +export as namespace ed2curve; + +export type Ed25519PublicKey = Uint8Array; +export type Ed25519SecretKey = Uint8Array; +export type Curve25519PublicKey = Uint8Array; +export type Curve25519SecretKey = Uint8Array; + +export interface Ed25519KeyPair { + publicKey: Ed25519PublicKey; + secretKey: Ed25519SecretKey; +} + +export interface Curve25519KeyPair { + publicKey: Curve25519PublicKey; + secretKey: Curve25519SecretKey; +} + +/** + * Converts Ed25519 public key to Curve25519 public key. + * montgomeryX = (edwardsY + 1)*inverse(1 - edwardsY) mod p + */ +export function convertPublicKey(publicKey: Ed25519PublicKey): Curve25519PublicKey | null; + +/** Converts Ed25519 secret key to Curve25519 secret key. */ +export function convertSecretKey(secretKey: Ed25519SecretKey): Curve25519SecretKey | null; + +/** Converts Ed25519 key pair to Curve25519 key pair. */ +export function convertKeyPair(keyPair: Ed25519KeyPair): Curve25519KeyPair; diff --git a/types/ed2curve/tsconfig.json b/types/ed2curve/tsconfig.json new file mode 100644 index 0000000000..38f4c49228 --- /dev/null +++ b/types/ed2curve/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "ed2curve-tests.ts" + ] +} diff --git a/types/ed2curve/tslint.json b/types/ed2curve/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/ed2curve/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 2b7d8a255ece3358b73e3aa8c98a5ccdc406f234 Mon Sep 17 00:00:00 2001 From: ArtworkAD Date: Wed, 31 Jan 2018 21:25:06 +0100 Subject: [PATCH 064/210] [qrcode]improve types of qrcode@1.2.0 (#23289) * [qrcode]improve types of qrcode@1.2.0 Add toDataURL with promise as response * [qrcode]improve types of qrcode@1.2.0 - add similar methods for toCanvas - method with short signature comes before method with long signature * [qrcode]improve types of qrcode@1.2.0 - toFile promise - toFileStream promise - toString promise --- types/qrcode/index.d.ts | 70 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/types/qrcode/index.d.ts b/types/qrcode/index.d.ts index cb2ce4a9b7..c04a07c20f 100644 --- a/types/qrcode/index.d.ts +++ b/types/qrcode/index.d.ts @@ -127,65 +127,127 @@ export interface QRCode { */ export function create(text: string | QRCodeSegment[], options: QRCodeOptions): QRCode; +/** + * Draws qr code symbol to canvas. + */ +export function toCanvas(canvasElement: HTMLCanvasElement, text: string | QRCodeSegment[]): Promise; /** * 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): Promise; /** * 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[]): Promise; /** * 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): Promise; /** * 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[]): Promise; /** * 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): Promise; /** * 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[]): Promise; /** * 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): Promise; /** * 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[]): Promise; /** * 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): Promise; /** * 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[]): Promise; /** * 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): Promise; /** * 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[]): Promise; /** * 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): Promise; /** * Saves QR Code to image file. * If options.type is not specified, the format will be guessed from file extension. @@ -193,10 +255,18 @@ export function toFile(path: string, text: string | QRCodeSegment[], callback: ( */ 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[]): Promise; /** * 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): Promise; /** * Writes QR Code image to stream. Only works with png format for now. */ From f720993a036964faa979a9549e79cf0830a380c8 Mon Sep 17 00:00:00 2001 From: Philippe D'Alva Date: Wed, 31 Jan 2018 15:30:44 -0500 Subject: [PATCH 065/210] @types/zeromq - Update monitor function by adding numOfEvents parameter (#23295) --- types/zeromq/index.d.ts | 9 ++++++--- types/zeromq/zeromq-tests.ts | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/types/zeromq/index.d.ts b/types/zeromq/index.d.ts index 949a5f567b..189d60fc29 100644 --- a/types/zeromq/index.d.ts +++ b/types/zeromq/index.d.ts @@ -1,6 +1,8 @@ -// Type definitions for zeromq 4.5 +// Type definitions for zeromq 4.6 // Project: https://github.com/zeromq/zeromq.js -// Definitions by: Dave McKeown , Erik Mavrinac +// Definitions by: Dave McKeown +// Erik Mavrinac +// Philippe D'Alva // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // // Forked from the DefinitelyTyped 'zmq' project originally created by Dave McKeown, @@ -149,9 +151,10 @@ export class Socket { * Each event receives the parameters: (eventValue, eventEndpointAddrress, error) * * @param timer interval in ms > 0 or Undefined for default + * @param numOfEvents The maximum number of events to read on each interval, default is 1, use 0 for reading all events * @return for chaining */ - monitor(interval?: number): Socket; + monitor(interval?: number, numOfEvents?: number): Socket; /** * Close the socket. diff --git a/types/zeromq/zeromq-tests.ts b/types/zeromq/zeromq-tests.ts index a49de9cc7d..a1230957a7 100644 --- a/types/zeromq/zeromq-tests.ts +++ b/types/zeromq/zeromq-tests.ts @@ -37,6 +37,7 @@ function test5() { }); sock.monitor(); sock.monitor(10); + sock.monitor(10, 2); } function test6() { From 63cf738f9bd82396b56100afe34279a3d91a9754 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Wed, 31 Jan 2018 12:31:13 -0800 Subject: [PATCH 066/210] React typings typo: it's vs its (#23296) "its" as the plural, not "it's" as "it is". --- 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 83ab445356..c39e5eeb6c 100644 --- a/types/react/index.d.ts +++ b/types/react/index.d.ts @@ -3723,7 +3723,7 @@ declare namespace React { // ---------------------------------------------------------------------- interface ErrorInfo { /** - * Captures which component contained the exception, and it's ancestors. + * Captures which component contained the exception, and its ancestors. */ componentStack: string; } From 97e14b8a814b531b8d2de4e0a1990c3eba94c707 Mon Sep 17 00:00:00 2001 From: x22x22 Date: Thu, 1 Feb 2018 04:32:06 +0800 Subject: [PATCH 067/210] [node-forge]add forge.pki.createCertificate() and supplement interface Certificate (#23298) * add forge.pki.createCertificate() add forge.pki.createCertificate() * [node-forge]add forge.pki.createCertificate() and supplement interface Certificate [node-forge]add forge.pki.createCertificate() and supplement interface Certificate - [x] Use a meaningful title for the pull request. Include the name of the package modified. - [x] 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: - [x] Provide a URL to documentation or source code which provides context for the suggested changes: https://github.com/x22x22/forge/blob/74b7472b2143735fca0c68a7f20ba32c4fbd5397/lib/x509.js#L910 - [ ] Increase the version number in the header if appropriate. - [ ] If you are making substantial changes, consider adding a `tslint.json` containing `{ "extends": "dtslint/dt.json" }`. * [node-forge]add forge.pki.createCertificate() and supplement interface Certificate [node-forge]add forge.pki.createCertificate() and supplement interface Certificate - [x] Use a meaningful title for the pull request. Include the name of the package modified. - [x] 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: - [x] Provide a URL to documentation or source code which provides context for the suggested changes: https://github.com/x22x22/forge/blob/74b7472b2143735fca0c68a7f20ba32c4fbd5397/lib/x509.js#L910 - [ ] Increase the version number in the header if appropriate. - [ ] If you are making substantial changes, consider adding a `tslint.json` containing `{ "extends": "dtslint/dt.json" }`. * [node-forge]add forge.pki.createCertificate() and supplement interface Certificate [node-forge]add forge.pki.createCertificate() and supplement interface Certificate * [node-forge]add forge.pki.createCertificate() and supplement interface Certificate [node-forge]add forge.pki.createCertificate() and supplement interface Certificate --- types/node-forge/index.d.ts | 57 ++++++++++++++++- types/node-forge/node-forge-tests.ts | 93 ++++++++++++++++++++++------ 2 files changed, 127 insertions(+), 23 deletions(-) diff --git a/types/node-forge/index.d.ts b/types/node-forge/index.d.ts index a5d3f078fe..2784d95fa3 100644 --- a/types/node-forge/index.d.ts +++ b/types/node-forge/index.d.ts @@ -14,7 +14,7 @@ declare module "node-forge" { type Utf8 = string; type OID = string; - namespace pem { + namespace pem { interface EncodeOptions { maxline?: number; @@ -32,7 +32,7 @@ declare module "node-forge" { function encode(msg: ObjectPEM, options?: EncodeOptions): string; function decode(str: string): ObjectPEM[]; } - + namespace pki { type PEM = string; @@ -79,10 +79,11 @@ declare module "node-forge" { interface CertificateField extends CertificateFieldOptions { valueConstructed?: boolean; valueTagClass?: asn1.Class; - value?: any[]; + value?: any[] | string; extensions?: any[]; } + interface Certificate { version: number; serialNumber: string; @@ -107,11 +108,61 @@ declare module "node-forge" { extensions: any[]; publicKey: any; md: any; + /** + * Sets the subject of this certificate. + * + * @param attrs the array of subject attributes to use. + * @param uniqueId an optional a unique ID to use. + */ + setSubject(attrs: CertificateField[], uniqueId?: string): void; + /** + * Sets the subject of this certificate. + * + * @param attrs the array of subject attributes to use. + * @param uniqueId an optional a unique ID to use. + */ + setIssuer(attrs: CertificateField[], uniqueId?: string): void; + /** + * Sets the extensions of this certificate. + * + * @param exts the array of extensions to use. + */ + setExtensions(exts: any[]): void; + /** + * Gets an extension by its name or id. + * + * @param options the name to use or an object with: + * name the name to use. + * id the id to use. + * + * @return the extension or null if not found. + */ + getExtension(options: string | {name: string;} | {id: number;}): {} | undefined; + + /** + * Signs this certificate using the given private key. + * + * @param key the private key to sign with. + * @param md the message digest object to use (defaults to forge.md.sha1). + */ + sign(key: pki.Key, md: md.MessageDigest): void; + /** + * Attempts verify the signature on the passed certificate using this + * certificate's public key. + * + * @param child the certificate to verify. + * + * @return true if verified, false if not. + */ + verify(child: Certificate): boolean; + } function certificateFromAsn1(obj: asn1.Asn1, computeHash?: boolean): Certificate; function decryptRsaPrivateKey(pem: PEM, passphrase?: string): Key; + + function createCertificate(): Certificate; } namespace ssh { diff --git a/types/node-forge/node-forge-tests.ts b/types/node-forge/node-forge-tests.ts index 63ccca6c70..29b8267714 100644 --- a/types/node-forge/node-forge-tests.ts +++ b/types/node-forge/node-forge-tests.ts @@ -1,4 +1,4 @@ -import * as forge from "node-forge"; +import * as forge from 'node-forge'; let keypair = forge.pki.rsa.generateKeyPair({ bits: 512 }); let privateKeyPem = forge.pki.privateKeyToPem(keypair.privateKey); @@ -8,19 +8,23 @@ let x: string = forge.ssh.privateKeyToOpenSSH(key); let pemKey: forge.pki.PEM = publicKeyPem; let publicKeyRsa = forge.pki.publicKeyFromPem(pemKey); let privateKeyRsa = forge.pki.privateKeyFromPem(privateKeyPem); +let cert = forge.pki.createCertificate(); { let subjectPublicKeyInfo = forge.asn1.create(forge.asn1.Class.UNIVERSAL, forge.asn1.Type.SEQUENCE, true, [ forge.asn1.create(forge.asn1.Class.UNIVERSAL, forge.asn1.Type.SEQUENCE, true, [ - forge.asn1.create(forge.asn1.Class.UNIVERSAL, forge.asn1.Type.OID, false, - forge.asn1.oidToDer(forge.pki.oids['rsaEncryption']).getBytes(), + forge.asn1.create( + forge.asn1.Class.UNIVERSAL, + forge.asn1.Type.OID, + false, + forge.asn1.oidToDer(forge.pki.oids['rsaEncryption']).getBytes() ), - forge.asn1.create(forge.asn1.Class.UNIVERSAL, forge.asn1.Type.NULL, false, ''), + forge.asn1.create(forge.asn1.Class.UNIVERSAL, forge.asn1.Type.NULL, false, '') ]), forge.asn1.create(forge.asn1.Class.UNIVERSAL, forge.asn1.Type.BITSTRING, false, [ forge.asn1.create(forge.asn1.Class.UNIVERSAL, forge.asn1.Type.SEQUENCE, true, [ forge.asn1.create(forge.asn1.Class.UNIVERSAL, forge.asn1.Type.INTEGER, false, []), - forge.asn1.create(forge.asn1.Class.UNIVERSAL, forge.asn1.Type.INTEGER, false, []), + forge.asn1.create(forge.asn1.Class.UNIVERSAL, forge.asn1.Type.INTEGER, false, []) ]) ]) ]); @@ -52,12 +56,14 @@ if (forge.util.fillString('1', 5) !== '11111') throw Error('forge.util.fillStrin src = new Uint8Array(2); encode = forge.util.binary.hex.encode(src); decode = forge.util.binary.hex.decode(encode); - if (encode !== '0000' || src.byteLength !== decode.byteLength) throw Error('forge.util.binary.hex.encode / decode fail'); + if (encode !== '0000' || src.byteLength !== decode.byteLength) + throw Error('forge.util.binary.hex.encode / decode fail'); src = new Uint8Array(2); encode = forge.util.binary.base64.encode(src); decode = forge.util.binary.base64.decode(encode); - if (encode !== 'AAA=' || src.byteLength !== decode.byteLength) throw Error('forge.util.binary.base64.encode / decode fail'); + if (encode !== 'AAA=' || src.byteLength !== decode.byteLength) + throw Error('forge.util.binary.base64.encode / decode fail'); src = new Uint8Array(10); encode = forge.util.binary.raw.encode(src); @@ -97,7 +103,6 @@ if (forge.util.fillString('1', 5) !== '11111') throw Error('forge.util.fillStrin if (hex.length !== 40) throw Error('forge.md.MessageDigest.update / digest fail'); } - { let md: forge.md.MessageDigest; let hex: string; @@ -110,26 +115,74 @@ if (forge.util.fillString('1', 5) !== '11111') throw Error('forge.util.fillStrin } { - let payload = { "asd": "asd" } - let cipher = forge.cipher.createCipher( - "3DES-ECB", - forge.util.createBuffer(key, "raw") - ); + let payload = { asd: 'asd' }; + let cipher = forge.cipher.createCipher('3DES-ECB', forge.util.createBuffer(key, 'raw')); cipher.start(); - cipher.update(forge.util.createBuffer(JSON.stringify(payload), "raw")); + cipher.update(forge.util.createBuffer(JSON.stringify(payload), 'raw')); cipher.finish(); let encrypted = cipher.output; let token = forge.util.encode64(encrypted.getBytes()); - let decipher = forge.cipher.createDecipher( - "3DES-ECB", - forge.util.createBuffer(key, "raw") - ); + let decipher = forge.cipher.createDecipher('3DES-ECB', forge.util.createBuffer(key, 'raw')); decipher.start(); - decipher.update(forge.util.createBuffer(forge.util.decode64(token), "raw")); + decipher.update(forge.util.createBuffer(forge.util.decode64(token), 'raw')); decipher.finish(); let decrypted = decipher.output as forge.util.ByteStringBuffer; let content = JSON.parse(forge.util.encodeUtf8(decrypted.getBytes())); if (content.asd == payload.asd) throw Error('forge.cipher.createCipher failed'); -} \ No newline at end of file +} + +{ + cert.publicKey = keypair.publicKey; + cert.serialNumber = new Date().getTime() + ''; + cert.validity.notBefore = new Date(); + cert.validity.notAfter = new Date(); + cert.validity.notAfter.setFullYear(cert.validity.notAfter.getFullYear() + 20); + const attrs = [ + { + name: 'commonName', + value: 'x22x22' + }, + { + name: 'countryName', + value: 'GitHub' + }, + { + shortName: 'ST', + value: 'GitHub' + }, + { + name: 'localityName', + value: 'GitHub' + }, + { + name: 'organizationName', + value: 'x22x22' + }, + { + shortName: 'OU', + value: 'https://github.com/x22x22' + } + ]; + cert.setSubject(attrs); + cert.setIssuer(attrs); + cert.setExtensions([ + { + name: 'basicConstraints', + critical: true, + cA: true + }, + { + name: 'keyUsage', + critical: true, + keyCertSign: true + }, + { + name: 'subjectKeyIdentifier' + } + ]); + + // self-sign certificate + cert.sign(keypair.privateKey, forge.md.sha256.create()); +} From 1d7a6e1f41f4790ee5165c9b23835601cb189e25 Mon Sep 17 00:00:00 2001 From: Pkthunder Date: Wed, 31 Jan 2018 15:32:52 -0500 Subject: [PATCH 068/210] Update index.d.ts (#23301) see paper.js docs: http://paperjs.org/reference/project/#addlayer-layer http://paperjs.org/reference/project/#insertlayer-index-item --- types/paper/index.d.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/types/paper/index.d.ts b/types/paper/index.d.ts index 5bd4315bfd..3f57526a19 100644 --- a/types/paper/index.d.ts +++ b/types/paper/index.d.ts @@ -3237,6 +3237,16 @@ declare module paper { * Deselects all selected items in the project. */ deselectAll(): void; + + /** + * Adds the specified layer at the end of the this project’s layers list. + */ + addLayer(layer: Layer): Layer; + + /** + * Inserts the specified layer at the specified index in this project’s layers list. + */ + insertLayer(index: number, layer: Layer): Layer; /** * Perform a hit-test on the items contained within the project at the location of the specified point. From 99614fa92018ee6023c6dbc6b8ceebff19be5626 Mon Sep 17 00:00:00 2001 From: Gustavo Henke Date: Thu, 1 Feb 2018 07:33:34 +1100 Subject: [PATCH 069/210] @storybook/addon-knobs: add button() knob (#23302) --- types/storybook__addon-knobs/index.d.ts | 2 ++ types/storybook__addon-knobs/storybook__addon-knobs-tests.tsx | 3 +++ 2 files changed, 5 insertions(+) diff --git a/types/storybook__addon-knobs/index.d.ts b/types/storybook__addon-knobs/index.d.ts index c2f8c954ec..f725abb47c 100644 --- a/types/storybook__addon-knobs/index.d.ts +++ b/types/storybook__addon-knobs/index.d.ts @@ -46,6 +46,8 @@ export function date(name: string, value?: Date): Date; export function array(name: string, value: T[], separator?: string): T[]; +export function button(name: string, handler: () => any): void; + export interface WrapStoryProps { context?: object; storyFn?: RenderFunction; diff --git a/types/storybook__addon-knobs/storybook__addon-knobs-tests.tsx b/types/storybook__addon-knobs/storybook__addon-knobs-tests.tsx index 9e1c1dbd6b..18d8d0a29e 100644 --- a/types/storybook__addon-knobs/storybook__addon-knobs-tests.tsx +++ b/types/storybook__addon-knobs/storybook__addon-knobs-tests.tsx @@ -11,6 +11,7 @@ import { select, date, array, + button, knob, } from '@storybook/addon-knobs'; @@ -58,6 +59,8 @@ stories.add('with all knobs', () => { const genericKnob: X = knob('Some generic knob', { value: 'a', type: 'text' }); + button('Some button', () => console.log('Button knob clicked')); + const style = { ...customStyle, fontWeight: bold ? 800 as 800 : 400 as 400, // tslint:disable-line no-unnecessary-type-assertion From 0db2724abb05212b385634fd3d4fdbe0ba4b0cd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anderson=20Fria=C3=A7a?= Date: Wed, 31 Jan 2018 17:35:04 -0300 Subject: [PATCH 070/210] Adding missing type on jquery-mask-plugin (#23304) --- types/jquery-mask-plugin/index.d.ts | 5 ++++- types/jquery-mask-plugin/jquery-mask-plugin-tests.ts | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/types/jquery-mask-plugin/index.d.ts b/types/jquery-mask-plugin/index.d.ts index a142d0a97e..342045a204 100644 --- a/types/jquery-mask-plugin/index.d.ts +++ b/types/jquery-mask-plugin/index.d.ts @@ -1,6 +1,8 @@ // Type definitions for jQuery Mask Plugin 1.14 // Project: https://igorescobar.github.io/jQuery-Mask-Plugin/ -// Definitions by: Anže Videnič , Igor Escobar +// Definitions by: Anže Videnič +// Igor Escobar +// Anderson FriaƧa // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -25,6 +27,7 @@ declare namespace jQueryMask { selectOnFocus?: boolean; reverse?: boolean; clearIfNotMatch?: boolean; + placeholder?: string; onComplete?(value: string, e: Event, $element: JQuery, options: Options): void; onKeyPress?(value: string, e: Event, $element: JQuery, options: Options): void; onChange?(value: string, e: Event, $element: JQuery, options: Options): void; diff --git a/types/jquery-mask-plugin/jquery-mask-plugin-tests.ts b/types/jquery-mask-plugin/jquery-mask-plugin-tests.ts index 310cec421b..90ac9f7a00 100644 --- a/types/jquery-mask-plugin/jquery-mask-plugin-tests.ts +++ b/types/jquery-mask-plugin/jquery-mask-plugin-tests.ts @@ -27,6 +27,9 @@ $(document).ready(() => { placeholder: "__/__/____" } }); + $('.placeholder2').mask("00/00/0000", { + placeholder: "__/__/____" + }); $('.fallback').mask("00r00r0000", { translation: { r: { From 962a9ec91974abd33080fd04f89ce860039cc2fe Mon Sep 17 00:00:00 2001 From: Oliver Joseph Ash Date: Wed, 31 Jan 2018 20:35:27 +0000 Subject: [PATCH 071/210] Lodash: `zip`: add undefined to return values (#23305) * Lodash: `zip`: add undefined to return values * Lodash: `zip`: correct generic typo * Lodash: `zip`: add undefined to return values for other overloads * Lodash: `zip`: use `` for tests --- types/lodash/array/zip.d.ts | 32 ++++++++++---------- types/lodash/lodash-tests.ts | 57 +++++++++++++++++++++--------------- 2 files changed, 49 insertions(+), 40 deletions(-) diff --git a/types/lodash/array/zip.d.ts b/types/lodash/array/zip.d.ts index cc8fa0be88..e6051f64a7 100644 --- a/types/lodash/array/zip.d.ts +++ b/types/lodash/array/zip.d.ts @@ -8,27 +8,27 @@ declare module "../index" { * @param arrays The arrays to process. * @return Returns the new array of grouped elements. */ - zip(arrays1: List, arrays2: List): Array<[T1, T2]>; + zip(arrays1: List, arrays2: List): Array<[T1 | undefined, T2 | undefined]>; /** * @see _.zip */ - zip(arrays1: List, arrays2: List, arrays3: List): Array<[T1, T2, T3]>; + zip(arrays1: List, arrays2: List, arrays3: List): Array<[T1 | undefined, T2 | undefined, T3 | undefined]>; /** * @see _.zip */ - zip(arrays1: List, arrays2: List, arrays3: List, arrays4: List): Array<[T1, T2, T3, T4]>; + zip(arrays1: List, arrays2: List, arrays3: List, arrays4: List): Array<[T1 | undefined, T2 | undefined, T3 | undefined, T4 | undefined]>; /** * @see _.zip */ - zip(arrays1: List, arrays2: List, arrays3: List, arrays4: List, arrays5: List): Array<[T1, T2, T3, T4, T5]>; + zip(arrays1: List, arrays2: List, arrays3: List, arrays4: List, arrays5: List): Array<[T1 | undefined, T2 | undefined, T3 | undefined, T4 | undefined, T5 | undefined]>; /** * @see _.zip */ - zip(...arrays: Array | null | undefined>): T[][]; + zip(...arrays: Array | null | undefined>): (T | undefined)[][]; } interface LoDashImplicitWrapper { @@ -38,7 +38,7 @@ declare module "../index" { zip( this: LoDashImplicitWrapper>, arrays2: List, - ): LoDashImplicitWrapper>; + ): LoDashImplicitWrapper>; /** * @see _.zip @@ -47,7 +47,7 @@ declare module "../index" { this: LoDashImplicitWrapper>, arrays2: List, arrays3: List, - ): LoDashImplicitWrapper>; + ): LoDashImplicitWrapper>; /** * @see _.zip @@ -57,7 +57,7 @@ declare module "../index" { arrays2: List, arrays3: List, arrays4: List, - ): LoDashImplicitWrapper>; + ): LoDashImplicitWrapper>; /** * @see _.zip @@ -68,7 +68,7 @@ declare module "../index" { arrays3: List, arrays4: List, arrays5: List, - ): LoDashImplicitWrapper>; + ): LoDashImplicitWrapper>; /** * @see _.zip @@ -76,7 +76,7 @@ declare module "../index" { zip( this: LoDashImplicitWrapper | null | undefined>, ...arrays: Array | null | undefined> - ): LoDashImplicitWrapper; + ): LoDashImplicitWrapper>>; } interface LoDashExplicitWrapper { @@ -86,7 +86,7 @@ declare module "../index" { zip( this: LoDashExplicitWrapper>, arrays2: List, - ): LoDashExplicitWrapper>; + ): LoDashExplicitWrapper>; /** * @see _.zip @@ -95,7 +95,7 @@ declare module "../index" { this: LoDashExplicitWrapper>, arrays2: List, arrays3: List, - ): LoDashExplicitWrapper>; + ): LoDashExplicitWrapper>; /** * @see _.zip @@ -105,7 +105,7 @@ declare module "../index" { arrays2: List, arrays3: List, arrays4: List, - ): LoDashExplicitWrapper>; + ): LoDashExplicitWrapper>; /** * @see _.zip @@ -116,7 +116,7 @@ declare module "../index" { arrays3: List, arrays4: List, arrays5: List, - ): LoDashExplicitWrapper>; + ): LoDashExplicitWrapper>; /** * @see _.zip @@ -124,6 +124,6 @@ declare module "../index" { zip( this: LoDashExplicitWrapper | null | undefined>, ...arrays: Array | null | undefined> - ): LoDashExplicitWrapper; + ): LoDashExplicitWrapper>>; } -} \ No newline at end of file +} diff --git a/types/lodash/lodash-tests.ts b/types/lodash/lodash-tests.ts index 9baaa64815..e0c02f2b2d 100644 --- a/types/lodash/lodash-tests.ts +++ b/types/lodash/lodash-tests.ts @@ -3197,43 +3197,52 @@ namespace TestXor { let list: _.List | null | undefined = [] as any; { - let result: TResult[][]; + // $ExpectType (TResult | undefined)[][] + _.zip(array); + // $ExpectType (TResult | undefined)[][] + _.zip(array, list); + // $ExpectType (TResult | undefined)[][] + _.zip(array, list, array); - result = _.zip(array); - result = _.zip(array, list); - result = _.zip(array, list, array); + // $ExpectType (TResult | undefined)[][] + _.zip(list); + // $ExpectType (TResult | undefined)[][] + _.zip(list, array); + // $ExpectType (TResult | undefined)[][] + _.zip(list, array, list); - result = _.zip(list); - result = _.zip(list, array); - result = _.zip(list, array, list); - - result = _.zip(list, array, list, array, list, array); + // $ExpectType (TResult | undefined)[][] + _.zip(list, array, list, array, list, array); } { - let result: _.LoDashImplicitArrayWrapper; + // $ExpectType LoDashImplicitWrapper<(TResult | undefined)[][]> + _(array).zip(list); + // $ExpectType LoDashImplicitWrapper<(TResult | undefined)[][]> + _(array).zip(list, array); - result = _(array).zip(list); - result = _(array).zip(list, array); - - result = _(list).zip(array); - result = _(list).zip(array, list); + // $ExpectType LoDashImplicitWrapper<(TResult | undefined)[][]> + _(list).zip(array); + // $ExpectType LoDashImplicitWrapper<(TResult | undefined)[][]> + _(list).zip(array, list); } { - let result: _.LoDashExplicitArrayWrapper; + // $ExpectType LoDashExplicitWrapper<(TResult | undefined)[][]> + _(array).chain().zip(list); + // $ExpectType LoDashExplicitWrapper<(TResult | undefined)[][]> + _(array).chain().zip(list, array); - result = _(array).chain().zip(list); - result = _(array).chain().zip(list, array); - - result = _(list).chain().zip(array); - result = _(list).chain().zip(array, list); + // $ExpectType LoDashExplicitWrapper<(TResult | undefined)[][]> + _(list).chain().zip(array); + // $ExpectType LoDashExplicitWrapper<(TResult | undefined)[][]> + _(list).chain().zip(array, list); } { - _.zip([1, 2], [3, 4]); // $ExpectType [number, number][] - _.zip([1, 2], ["a", "b"]); // $ExpectType [number, string][] - _.zip([1, 2], ["a", "b"], [true, false]); // $ExpectType [number, string, boolean][] + _.zip([1, 2], [3, 4]); // $ExpectType [number | undefined, number | undefined][] + _.zip([1, 2], ["a", "b"]); // $ExpectType [number | undefined, string | undefined][] + _.zip([1, 2], ["a", "b"], [true, false]); // $ExpectType [number | undefined, string | undefined, boolean | undefined][] } } From 0b755d302fd60e6e686a71091af468222a190364 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anderson=20Fria=C3=A7a?= Date: Wed, 31 Jan 2018 17:38:12 -0300 Subject: [PATCH 072/210] Types for bootstrap-growl-ifightcrime (#23308) * Types for bootstrap-growl-ifightcrime * necessary adjustments * Adding types for values --- .../bootstrap-growl-ifightcrime-tests.ts | 25 ++++++ types/bootstrap-growl-ifightcrime/index.d.ts | 78 +++++++++++++++++++ .../bootstrap-growl-ifightcrime/tsconfig.json | 24 ++++++ types/bootstrap-growl-ifightcrime/tslint.json | 1 + 4 files changed, 128 insertions(+) create mode 100644 types/bootstrap-growl-ifightcrime/bootstrap-growl-ifightcrime-tests.ts create mode 100644 types/bootstrap-growl-ifightcrime/index.d.ts create mode 100644 types/bootstrap-growl-ifightcrime/tsconfig.json create mode 100644 types/bootstrap-growl-ifightcrime/tslint.json diff --git a/types/bootstrap-growl-ifightcrime/bootstrap-growl-ifightcrime-tests.ts b/types/bootstrap-growl-ifightcrime/bootstrap-growl-ifightcrime-tests.ts new file mode 100644 index 0000000000..78f92fcf71 --- /dev/null +++ b/types/bootstrap-growl-ifightcrime/bootstrap-growl-ifightcrime-tests.ts @@ -0,0 +1,25 @@ +// basic usage +$(document).ready(() => { + $.bootstrapGrowl('Message to show in alert'); +}); + +// with options example +let offsetOptions: BootstrapGrowlIfightcrime.OffsetOption = { + from: 'top', + amount: 20 +}; + +let options: BootstrapGrowlIfightcrime.Options = { + ele: 'body', + type: 'info', + offset: offsetOptions, + align: 'right', + width: 250, + delay: 4000, + allow_dismiss: true, + stackup_spacing: 10 +}; + +$(document).ready(() => { + $.bootstrapGrowl('Alert with options', options); +}); diff --git a/types/bootstrap-growl-ifightcrime/index.d.ts b/types/bootstrap-growl-ifightcrime/index.d.ts new file mode 100644 index 0000000000..45755682ea --- /dev/null +++ b/types/bootstrap-growl-ifightcrime/index.d.ts @@ -0,0 +1,78 @@ +// Type definitions for Bootstrap Growl Ifightcrime 1.1 +// Project: https://github.com/ifightcrime/bootstrap-growl +// Definitions by: Anderson FriaƧa +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +/// + +declare namespace BootstrapGrowlIfightcrime { + type OffsetPositionType = 'top' | 'bottom'; + + type AlertType = 'info' | 'danger' | 'success' | 'warning' | string | null; + + type AlignType = 'left' | 'center' | 'right'; + + interface OffsetOption { + /** + * Position: top or bottom + */ + from?: OffsetPositionType; + + /** + * Offset amount + */ + amount?: number; + } + + interface Options { + /** + * Which element to append to + */ + ele?: string; + + /** + * Values of (null, 'info', 'danger', 'success', 'warning') or another value + */ + type?: AlertType; + + /** + * Offset Options + */ + offset?: OffsetOption; + + /** + * 'left', 'right', or 'center' + */ + align?: AlignType; + + /** + * Integer + */ + width?: number; + + /** + * Time while the message will be displayed. It's not equivalent to the *demo* timeOut! + */ + delay?: number; + + /** + * If true then will display a cross to close the popup. + */ + allow_dismiss?: boolean; + + /** + * Spacing between consecutively stacked growls. + */ + stackup_spacing?: number; + } +} +interface JQueryStatic { + /** + * Show standard Bootstrap alerts into hovering "Growl-like" notifications + * @param message to show. + * @param options should be an options object. + * @returns The element. + */ + bootstrapGrowl: (message: string, options?: BootstrapGrowlIfightcrime.Options) => JQuery; +} diff --git a/types/bootstrap-growl-ifightcrime/tsconfig.json b/types/bootstrap-growl-ifightcrime/tsconfig.json new file mode 100644 index 0000000000..dbeadea241 --- /dev/null +++ b/types/bootstrap-growl-ifightcrime/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "bootstrap-growl-ifightcrime-tests.ts" + ] +} \ No newline at end of file diff --git a/types/bootstrap-growl-ifightcrime/tslint.json b/types/bootstrap-growl-ifightcrime/tslint.json new file mode 100644 index 0000000000..4e88071852 --- /dev/null +++ b/types/bootstrap-growl-ifightcrime/tslint.json @@ -0,0 +1 @@ +{"extends": "dtslint/dt.json"} From 00aad235f1d0582b28af599062cc9d6f0a3031a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zsolt=20Kov=C3=A1cs?= Date: Wed, 31 Jan 2018 21:40:26 +0100 Subject: [PATCH 073/210] Add types for jquery-awesome-cursor (#23311) --- types/jquery-awesome-cursor/index.d.ts | 34 ++++++++++ .../jquery-awesome-cursor-tests.ts | 64 +++++++++++++++++++ types/jquery-awesome-cursor/tsconfig.json | 23 +++++++ types/jquery-awesome-cursor/tslint.json | 1 + 4 files changed, 122 insertions(+) create mode 100644 types/jquery-awesome-cursor/index.d.ts create mode 100644 types/jquery-awesome-cursor/jquery-awesome-cursor-tests.ts create mode 100644 types/jquery-awesome-cursor/tsconfig.json create mode 100644 types/jquery-awesome-cursor/tslint.json diff --git a/types/jquery-awesome-cursor/index.d.ts b/types/jquery-awesome-cursor/index.d.ts new file mode 100644 index 0000000000..1137b16b75 --- /dev/null +++ b/types/jquery-awesome-cursor/index.d.ts @@ -0,0 +1,34 @@ +// Type definitions for jquery-awesome-cursor 0.3 +// Project: https://jwarby.github.io/jquery-awesome-cursor +// Definitions by: Zsolt KovĆ”cs +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +/// +declare namespace JQueryAwesomeCursor { + type flip = "horizontal" | "vertical" | "both"; + type cssHandler = (name: string) => void; + + interface Options { + color?: string; + size?: number; + hotspot?: number[] | string; + flip?: flip; + rotate?: number; + outline?: string; + font?: Font; + } + + interface Font { + family: string; + cssClass: string | cssHandler; + } +} + +interface JQueryStatic { + awesomeCursor(icon: string, options?: JQueryAwesomeCursor.Options): JQuery; +} + +interface JQuery { + awesomeCursor(icon: string, options?: JQueryAwesomeCursor.Options): JQuery; +} diff --git a/types/jquery-awesome-cursor/jquery-awesome-cursor-tests.ts b/types/jquery-awesome-cursor/jquery-awesome-cursor-tests.ts new file mode 100644 index 0000000000..cd47f56ff9 --- /dev/null +++ b/types/jquery-awesome-cursor/jquery-awesome-cursor-tests.ts @@ -0,0 +1,64 @@ +// Default +jQuery.awesomeCursor('pencil'); + +// Color +jQuery.awesomeCursor('pencil', { + color: '#ff0000' +}); + +// Size +jQuery.awesomeCursor('pencil', { + size: 32 +}); + +// Hotspot +jQuery.awesomeCursor('pencil', { + hotspot: [0, 17] +}); +jQuery.awesomeCursor('pencil', { + hotspot: 'bottom left' +}); + +// Flip +jQuery.awesomeCursor('pencil', { + flip: 'horizontal' +}); +jQuery.awesomeCursor('pencil', { + flip: 'vertical' +}); +jQuery.awesomeCursor('pencil', { + flip: 'both' +}); + +// Rotate +jQuery.awesomeCursor('pencil', { + rotate: 45 +}); + +// Outline +jQuery.awesomeCursor('pencil', { + outline: 'red' +}); + +// Different font +jQuery.awesomeCursor('brush', { + font: { + family: 'typicons', + cssClass: 'typcn typcn-%s' + } +}); +jQuery.awesomeCursor('brush', { + font: { + family: 'typicons', + cssClass: (name) => { + return 'typcn typcn-' + name; + } + } +}); + +// Mixed +jQuery.awesomeCursor('long-arrow-left', { + color: 'red', + hotspot: 'top left', + rotate: 45, +}); diff --git a/types/jquery-awesome-cursor/tsconfig.json b/types/jquery-awesome-cursor/tsconfig.json new file mode 100644 index 0000000000..cb81088d83 --- /dev/null +++ b/types/jquery-awesome-cursor/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "jquery-awesome-cursor-tests.ts" + ] +} \ No newline at end of file diff --git a/types/jquery-awesome-cursor/tslint.json b/types/jquery-awesome-cursor/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/jquery-awesome-cursor/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 0efc1b6933ce9e8b0ea09059a966ca715d7b1ad6 Mon Sep 17 00:00:00 2001 From: Wenchen Li Date: Wed, 31 Jan 2018 15:42:11 -0500 Subject: [PATCH 074/210] Make videoId optional in PlayerOptions (#23315) It could be optional based on the "Example 1: Use API with existing