From e670e0731cad74822fb9f7329f2f4dead346e7c5 Mon Sep 17 00:00:00 2001 From: rlindgren Date: Fri, 20 Oct 2017 12:01:00 -0400 Subject: [PATCH 001/252] Fix doWhilst, doUntil definitions and tests --- types/async/index.d.ts | 4 ++-- types/async/test/index.ts | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/types/async/index.d.ts b/types/async/index.d.ts index 80f2888a8b..7c32079086 100644 --- a/types/async/index.d.ts +++ b/types/async/index.d.ts @@ -174,9 +174,9 @@ export function parallel(tasks: Dictionary>, callback? export function parallelLimit(tasks: Array>, limit: number, callback?: AsyncResultArrayCallback): void; export function parallelLimit(tasks: Dictionary>, limit: number, callback?: AsyncResultObjectCallback): void; export function whilst(test: () => boolean, fn: AsyncVoidFunction, callback: ErrorCallback): void; -export function doWhilst(fn: AsyncVoidFunction, test: () => boolean, callback: ErrorCallback): void; +export function doWhilst(fn: AsyncVoidFunction, test: (result?: any) => boolean, callback: ErrorCallback): void; export function until(test: () => boolean, fn: AsyncVoidFunction, callback: ErrorCallback): void; -export function doUntil(fn: AsyncVoidFunction, test: () => boolean, callback: ErrorCallback): void; +export function doUntil(fn: AsyncVoidFunction, test: (result?: any) => boolean, callback: ErrorCallback): void; export function during(test: (testCallback : AsyncBooleanResultCallback) => void, fn: AsyncVoidFunction, callback: ErrorCallback): void; export function doDuring(fn: AsyncVoidFunction, test: (testCallback: AsyncBooleanResultCallback) => void, callback: ErrorCallback): void; export function forever(next: (next : ErrorCallback) => void, errBack: ErrorCallback) : void; diff --git a/types/async/test/index.ts b/types/async/test/index.ts index 821ccd0650..3c6c2f5dfe 100644 --- a/types/async/test/index.ts +++ b/types/async/test/index.ts @@ -239,16 +239,16 @@ async.parallelLimit({ function whileFn(callback: any) { - count++; - setTimeout(callback, 1000); + setTimeout(() => callback(null, ++count), 1000); } function whileTest() { return count < 5; } +function doWhileTest(count: number) { return count < 5; } var count = 0; async.whilst(whileTest, whileFn, function (err) { }); async.until(whileTest, whileFn, function (err) { }); -async.doWhilst(whileFn, whileTest, function (err) { }); -async.doUntil(whileFn, whileTest, function (err) { }); +async.doWhilst(whileFn, doWhileTest, function (err) { }); +async.doUntil(whileFn, doWhileTest, function (err) { }); async.during(function (testCallback) { testCallback(new Error(), false); }, function (callback) { callback() }, function (error) { console.log(error) }); async.doDuring(function (callback) { callback() }, function (testCallback) { testCallback(new Error(), false); }, function (error) { console.log(error) }); From 6fb077d3e6c38d0bde5012462c22975c4da18cd9 Mon Sep 17 00:00:00 2001 From: rlindgren Date: Mon, 23 Oct 2017 10:07:19 -0400 Subject: [PATCH 002/252] iteratee should be of type AsyncFunction --- types/async/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/async/index.d.ts b/types/async/index.d.ts index 7c32079086..c94c8058c2 100644 --- a/types/async/index.d.ts +++ b/types/async/index.d.ts @@ -174,9 +174,9 @@ export function parallel(tasks: Dictionary>, callback? export function parallelLimit(tasks: Array>, limit: number, callback?: AsyncResultArrayCallback): void; export function parallelLimit(tasks: Dictionary>, limit: number, callback?: AsyncResultObjectCallback): void; export function whilst(test: () => boolean, fn: AsyncVoidFunction, callback: ErrorCallback): void; -export function doWhilst(fn: AsyncVoidFunction, test: (result?: any) => boolean, callback: ErrorCallback): void; +export function doWhilst(fn: AsyncFunction, test: (result?: any) => boolean, callback: ErrorCallback): void; export function until(test: () => boolean, fn: AsyncVoidFunction, callback: ErrorCallback): void; -export function doUntil(fn: AsyncVoidFunction, test: (result?: any) => boolean, callback: ErrorCallback): void; +export function doUntil(fn: AsyncFunction, test: (result?: any) => boolean, callback: ErrorCallback): void; export function during(test: (testCallback : AsyncBooleanResultCallback) => void, fn: AsyncVoidFunction, callback: ErrorCallback): void; export function doDuring(fn: AsyncVoidFunction, test: (testCallback: AsyncBooleanResultCallback) => void, callback: ErrorCallback): void; export function forever(next: (next : ErrorCallback) => void, errBack: ErrorCallback) : void; From caca8d17390931c80e2d71b2d3234681f7a0b5f8 Mon Sep 17 00:00:00 2001 From: Andy Date: Mon, 23 Oct 2017 09:20:54 -0700 Subject: [PATCH 003/252] ns-api: Fix lint (#20888) --- types/ns-api/index.d.ts | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/types/ns-api/index.d.ts b/types/ns-api/index.d.ts index db66f109f3..267bb319c5 100644 --- a/types/ns-api/index.d.ts +++ b/types/ns-api/index.d.ts @@ -11,9 +11,8 @@ interface nsApi { * Vertrektijden - departure times * * @callback callback - * @param station {string} - Station ID - * @param callback {function} - `function (err, data) {}` - * @returns {void} + * @param station - Station ID + * @param callback - `function (err, data) {}` */ vertrektijden(station: string, callback: (err: string, data: {}) => void): void; @@ -21,9 +20,8 @@ interface nsApi { * Reisadvies - travel advise * * @callback callback - * @param params {object} - Parameters - * @param callback {function} - `function (err, data) {}` - * @returns {void} + * @param params - Parameters + * @param callback - `function (err, data) {}` */ reisadvies(params: {}, callback: (err: string, data: {}) => void): void; @@ -31,9 +29,8 @@ interface nsApi { * Prijzen - tariffs * * @callback callback - * @param params {object} - Parameters - * @param callback {function} - `function (err, data) {}` - * @returns {void} + * @param params - Parameters + * @param callback - `function (err, data) {}` */ prijzen(params: {}, callback: (err: any, data: {}) => void): void; @@ -41,8 +38,8 @@ interface nsApi { * List available stations * * @callback callback - * @param [treeKey] {string} - Group by this key - * @param callback {function} - `function (err, data) {}` + * @param [treeKey] - Group by this key + * @param callback - `function (err, data) {}` */ stations(treeKey: string, callback: (err: string, data: {}) => void): void; stations(callback: (err: string, data: {}) => void): void; @@ -51,8 +48,8 @@ interface nsApi { * List disruptions * * @callback callback - * @param params {object} - Parameters - * @param callback {function} - `function (err, data) {}` + * @param params - Parameters + * @param callback - `function (err, data) {}` */ storingen(params: {}, callback: (err: string, data: {}) => void): void; } From f251c616502fdfb6f8808881c2646bdc9a373760 Mon Sep 17 00:00:00 2001 From: Andy Date: Mon, 23 Oct 2017 09:41:40 -0700 Subject: [PATCH 004/252] later: Fix lint (#20883) --- types/later/index.d.ts | 262 +++++++++++++++++------------------------ 1 file changed, 106 insertions(+), 156 deletions(-) diff --git a/types/later/index.d.ts b/types/later/index.d.ts index 66bf8e5dae..71d53983b0 100644 --- a/types/later/index.d.ts +++ b/types/later/index.d.ts @@ -23,115 +23,79 @@ declare namespace later { } interface Recurrence { - /** Time in seconds from midnight. - */ + /** Time in seconds from midnight. */ t?: number[]; - /** Seconds in minute. - */ + /** Seconds in minute. */ s?: number[]; - /** Minutes in hour. - */ + /** Minutes in hour. */ m?: number[]; - /** Hour in day. - */ + /** Hour in day. */ h?: number[]; - /** Day of the month. - */ + /** Day of the month. */ D?: number[]; - /** Day in week. - */ + /** Day in week. */ dw?: number[]; - /** Nth day of the week in month. - */ + /** Nth day of the week in month. */ dc?: number[]; - /** Day in year. - */ + /** Day in year. */ dy?: number[]; - /** Week in month. - */ + /** Week in month. */ wm?: number[]; - /** ISO week in year. - */ + /** ISO week in year. */ wy?: number[]; - /** Month in year. - */ + /** Month in year. */ M?: number[]; - /** Year. - */ + /** Year. */ Y?: number[]; - /** After modifiers. - */ + /** After modifiers. */ t_a?: number[]; - /** After modifiers. - */ + /** After modifiers. */ s_a?: number[]; - /** After modifiers. - */ + /** After modifiers. */ m_a?: number[]; - /** After modifiers. - */ + /** After modifiers. */ h_a?: number[]; - /** After modifiers. - */ + /** After modifiers. */ D_a?: number[]; - /** After modifiers. - */ + /** After modifiers. */ dw_a?: number[]; - /** After modifiers. - */ + /** After modifiers. */ dc_a?: number[]; - /** After modifiers. - */ + /** After modifiers. */ dy_a?: number[]; - /** After modifiers. - */ + /** After modifiers. */ wm_a?: number[]; - /** After modifiers. - */ + /** After modifiers. */ wy_a?: number[]; - /** After modifiers. - */ + /** After modifiers. */ M_a?: number[]; - /** After modifiers. - */ + /** After modifiers. */ Y_a?: number[]; - /** Before modifiers. - */ + /** Before modifiers. */ t_b?: number[]; - /** Before modifiers. - */ + /** Before modifiers. */ s_b?: number[]; - /** Before modifiers. - */ + /** Before modifiers. */ m_b?: number[]; - /** Before modifiers. - */ + /** Before modifiers. */ h_b?: number[]; - /** Before modifiers. - */ + /** Before modifiers. */ D_b?: number[]; - /** Before modifiers. - */ + /** Before modifiers. */ dw_b?: number[]; - /** Before modifiers. - */ + /** Before modifiers. */ dc_b?: number[]; - /** Before modifiers. - */ + /** Before modifiers. */ dy_b?: number[]; - /** Before modifiers. - */ + /** Before modifiers. */ wm_b?: number[]; - /** Before modifiers. - */ + /** Before modifiers. */ wy_b?: number[]; - /** Before modifiers. - */ + /** Before modifiers. */ M_b?: number[]; - /** Before modifiers. - */ + /** Before modifiers. */ Y_b?: number[]; /* @@ -151,15 +115,15 @@ declare namespace later { /** * Create schedule data by parsing a cron string * - * @param {string} [input] - A string value to parse. - * @param {boolean} [hasSeconds] - Whether the cron expression has second part. + * @param [input] - A string value to parse. + * @param [hasSeconds] - Whether the cron expression has second part. */ cron(input?: string, hasSeconds?: boolean): ScheduleData; /** * Create schedule data by paring a human readable string. * - * @param {string} [input] - A string value to parse. + * @param [input] - A string value to parse. */ text(input?: string): ScheduleData; } @@ -178,9 +142,9 @@ declare namespace later { * Date.now() by default, end date is unspecified. Start date must be * smaller than end date. * - * @param {number} numberOfInst: The number of instances to return - * @param {Date} dateFrom: The earliest a valid instance can occur - * @param {Date} dateTo: The latest a valid instance can occur + * @param numberOfInst: The number of instances to return + * @param dateFrom: The earliest a valid instance can occur + * @param dateTo: The latest a valid instance can occur */ next(numberOfInst: number, dateFrom?: Date, dateTo?: Date): Date[]; @@ -190,9 +154,9 @@ declare namespace later { * Date.now() by default, end date is unspecified. Start date must be * greater than end date. * - * @param {number} numberOfInst: The number of ranges to return - * @param {Date} dateFrom: The earliest a valid range can occur - * @param {Date} dateTo: The latest a valid range can occur + * @param numberOfInst: The number of ranges to return + * @param dateFrom: The earliest a valid range can occur + * @param dateTo: The latest a valid range can occur */ nextRange(numberOfInst: number, dateFrom?: Date, dateTo?: Date): Date[]; @@ -202,9 +166,9 @@ declare namespace later { * Date.now() by default, end date is unspecified. Start date must be * greater than end date. * - * @param {number} numberOfInst: The number of instances to return - * @param {Date} dateFrom: The earliest a valid instance can occur - * @param {Date} dateTo: The latest a valid instance can occur + * @param numberOfInst: The number of instances to return + * @param dateFrom: The earliest a valid instance can occur + * @param dateTo: The latest a valid instance can occur */ prev(numberOfInst: number, dateFrom?: Date, dateTo?: Date): Date[]; @@ -214,59 +178,46 @@ declare namespace later { * Date.now() by default, end date is unspecified. Start date must be * greater than end date. * - * @param {number} numberOfInst: The number of ranges to return - * @param {Date} dateFrom: The earliest a valid range can occur - * @param {Date} dateTo: The latest a valid range can occur + * @param numberOfInst: The number of ranges to return + * @param dateFrom: The earliest a valid range can occur + * @param dateTo: The latest a valid range can occur */ prevRange(numberOfInst: number, dateFrom?: Date, dateTo?: Date): Date[]; } interface RecurrenceBuilder extends ScheduleData { - /** a time period - */ + /** a time period */ second(): RecurrenceBuilder; - /** a time period - */ + /** a time period */ minute(): RecurrenceBuilder; - /** a time period - */ + /** a time period */ hour(): RecurrenceBuilder; - /** a time period - */ + /** a time period */ time(): RecurrenceBuilder; - /** a time period - */ + /** a time period */ dayOfWeek(): RecurrenceBuilder; - /** a time period - */ + /** a time period */ dayOfWeekCount(): RecurrenceBuilder; - /** a time period - */ + /** a time period */ dayOfMonth(): RecurrenceBuilder; - /** a time period - */ + /** a time period */ dayOfYear(): RecurrenceBuilder; - /** a time period - */ + /** a time period */ weekOfMonth(): RecurrenceBuilder; - /** a time period - */ + /** a time period */ weekOfYear(): RecurrenceBuilder; - /** a time period - */ + /** a time period */ month(): RecurrenceBuilder; - /** a time period - */ + /** a time period */ year(): RecurrenceBuilder; - /** a time period - */ + /** a time period */ fullDate(): RecurrenceBuilder; /** * Specifies one or more specific vals of a time period information provider. * When used to specify a time, a string indicating the 24-hour time may be used. * - * @param {number[]} values - A list of values. + * @param values - A list of values. */ on(...values: number[]): RecurrenceBuilder; /** @@ -287,15 +238,15 @@ declare namespace later { /** * Preceed a time period. * - * @param {number} start - A number representing your start value. - * @param {number} end - A number representing your end value. + * @param start - A number representing your start value. + * @param end - A number representing your end value. */ between(start: number, end: number): RecurrenceBuilder; /** * Preceed a time period. * - * @param {string} start - A string representing your start value. - * @param {string} end - A string representing your end value. + * @param start - A string representing your start value. + * @param end - A string representing your end value. */ between(start: string, end: string): RecurrenceBuilder; @@ -378,12 +329,12 @@ declare namespace later { * Builds and returns a new Date using the specified values. Date * returned is either using Local time or UTC based on isLocal. * - * @param {number} [Y]: Four digit year - * @param {number} [M]: Month between 1 and 12, defaults to 1 - * @param {number} [D]: Date between 1 and 31, defaults to 1 - * @param {number} [h]: Hour between 0 and 23, defaults to 0 - * @param {number} [m]: Minute between 0 and 59, defaults to 0 - * @param {number} [s]: Second between 0 and 59, defaults to 0 + * @param [Y]: Four digit year + * @param [M]: Month between 1 and 12, defaults to 1 + * @param [D]: Date between 1 and 31, defaults to 1 + * @param [h]: Hour between 0 and 23, defaults to 0 + * @param [m]: Minute between 0 and 59, defaults to 0 + * @param [s]: Second between 0 and 59, defaults to 0 */ next(Y?: number, M?: number, D?: number, h?: number, m?: number, s?: number): Date; @@ -391,12 +342,12 @@ declare namespace later { * Builds and returns a new Date using the specified values. Date * returned is either using Local time or UTC based on isLocal. * - * @param {number} [Y]: Four digit year - * @param {number} [M]: Month between 0 and 11, defaults to 11 - * @param {number} [D]: Date between 1 and 31, defaults to last day of month - * @param {number} [h]: Hour between 0 and 23, defaults to 23 - * @param {number} [m]: Minute between 0 and 59, defaults to 59 - * @param {number} [s]: Second between 0 and 59, defaults to 59 + * @param [Y]: Four digit year + * @param [M]: Month between 0 and 11, defaults to 11 + * @param [D]: Date between 1 and 31, defaults to last day of month + * @param [h]: Hour between 0 and 23, defaults to 23 + * @param [m]: Minute between 0 and 59, defaults to 59 + * @param [s]: Second between 0 and 59, defaults to 59 */ prev(Y?: number, M?: number, D?: number, h?: number, m?: number, s?: number): Date; @@ -405,10 +356,10 @@ declare namespace later { * next largest time period. Used primarily when a constraint has a * variable extent. * - * @param {Date} d: Date - * @param {number} val: Value - * @param {IModifier} constraint: A modifier - * @param {ITimePeriod} period: A time period + * @param d: Date + * @param val: Value + * @param constraint: A modifier + * @param period: A time period */ nextRollover(d: Date, val: number, constraint: Modifier, period: TimePeriod): Date; @@ -417,10 +368,10 @@ declare namespace later { * previous largest time period. Used primarily when a constraint has a * variable extent. * - * @param {Date} d: Date - * @param {number} val: Value - * @param {IModifier} constraint: A modifier - * @param {ITimePeriod} period: A time period + * @param d: Date + * @param val: Value + * @param constraint: A modifier + * @param period: A time period */ prevRollover(d: Date, val: number, constraint: Modifier, period: TimePeriod): Date; } @@ -439,15 +390,15 @@ declare namespace later { /** * The value of this time period for the date specified. * - * @param {Date} date - The given date. + * @param date - The given date. */ val(date: Date): number; /** * True if the specified value is valid for the specified date, false otherwise. * - * @param {Date} date - The given date. - * @param {any} value - The value to test for the date. + * @param date - The given date. + * @param value - The value to test for the date. */ isValid(date: Date, value: any): boolean; @@ -456,7 +407,7 @@ declare namespace later { * If the minimum value is not 0, 0 can be specified in schedules to indicate the maximum value. * This makes working with non - constant extents(like days in a month) easier. * - * @param {Date} [date] - The given date. + * @param [date] - The given date. */ extent(date?: Date): number[]; @@ -464,7 +415,7 @@ declare namespace later { * The first second in which the value is the same as the value of the specified date. * For example, the start of an hour would be the hour with 0 minutes and 0 seconds. * - * @param {Date} date - The given date. + * @param date - The given date. */ start(date: Date): Date; @@ -472,7 +423,7 @@ declare namespace later { * The last second in which the value is the same as the value of the specified date. * For example, the end of an hour would be the hour with 59 minutes and 59 seconds. * - * @param {Date} date - The given date. + * @param date - The given date. */ end(date: Date): Date; @@ -480,8 +431,8 @@ declare namespace later { * Returns the next date where the value is the value specified. * Sets the value to 1 if value specified is greater than the max allowed value. * - * @param {Date} date - The given date. - * @param {any} value - The value to test for the date. + * @param date - The given date. + * @param value - The value to test for the date. */ next(date: Date, value: any): Date; @@ -489,8 +440,8 @@ declare namespace later { * Returns the previous date where the value is the value specified. * Sets the value to the max allowed value if the value specified is greater than the max allowed value. * - * @param {Date} date - The given date. - * @param {any} value - The value to test for the date. + * @param date - The given date. + * @param value - The value to test for the date. */ prev(date: Date, value: any): Date; } @@ -499,8 +450,8 @@ declare namespace later { /** * Creates a new modified constraint. * - * @param {ITimePeriod} constraint: The constraint to be modified - * @param {number} value: The starting value of the after constraint + * @param constraint: The constraint to be modified + * @param value: The starting value of the after constraint */ (constraint: TimePeriod, value: number): TimePeriod; } @@ -530,22 +481,21 @@ declare namespace later { */ parse: ParseStatic; - /** Date Provider - */ + /** Date Provider */ date: DateProvider; /** * Set timeout on window using given recurrence next. * - * @param {function} callback - A callback called after first instance of recurrence pattern. - * @param {Later.IReccurence} - A recurrence instance. + * @param callback - A callback called after first instance of recurrence pattern. + * @param - A recurrence instance. */ setTimeout(callback: () => void, time: ScheduleData): Timer; /** * Set interval on window using given recurrence * - * @param {function} callback - A callback called after each instance of recurrence pattern. - * @param {Later.IReccurence} - A recurrence instance. + * @param callback - A callback called after each instance of recurrence pattern. + * @param - A recurrence instance. */ setInterval(callback: () => void, time: ScheduleData): Timer; From ba1ed4e100205e627d169f98890a3df6ca5589c1 Mon Sep 17 00:00:00 2001 From: kmccoan-allocadia Date: Mon, 23 Oct 2017 09:45:25 -0700 Subject: [PATCH 005/252] Added new package @types/artillery (#20779) * Artillery types for beforeRequest & afterResponse hooks * Remove unnecessary linting rule in Artillery project * Update Artillery tests to define variables to ensure proper compilation usage * Fix compilation errors in test & move typescript decl to line 5 --- types/artillery/artillery-tests.ts | 13 +++++++++++++ types/artillery/index.d.ts | 13 +++++++++++++ types/artillery/tsconfig.json | 23 +++++++++++++++++++++++ types/artillery/tslint.json | 3 +++ 4 files changed, 52 insertions(+) create mode 100644 types/artillery/artillery-tests.ts create mode 100644 types/artillery/index.d.ts create mode 100644 types/artillery/tsconfig.json create mode 100644 types/artillery/tslint.json diff --git a/types/artillery/artillery-tests.ts b/types/artillery/artillery-tests.ts new file mode 100644 index 0000000000..b79c3f1c52 --- /dev/null +++ b/types/artillery/artillery-tests.ts @@ -0,0 +1,13 @@ +import { ScenarioContext, Next } from 'artillery'; + +const scenarioContext: ScenarioContext = {vars: {}}; +scenarioContext.vars = {}; +scenarioContext.vars.testing = "value"; +scenarioContext.vars.testing2 = 1; + +const next: Next = (error?: Error) => { + // do nothing. +}; + +next(); +next(new Error()); diff --git a/types/artillery/index.d.ts b/types/artillery/index.d.ts new file mode 100644 index 0000000000..d3c00d87d7 --- /dev/null +++ b/types/artillery/index.d.ts @@ -0,0 +1,13 @@ +// Type definitions for artillery 1.6 +// Project: https://github.com/shoreditch-ops/artillery#readme +// Definitions by: Kira McCoan +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 +import * as request from 'request'; +import * as events from 'events'; + +export interface ScenarioContext { vars: {[key: string]: any}; } +export type Next = (err?: Error) => void; +export type ResponseRequest = request.ResponseRequest; +export type RequestResponse = request.RequestResponse; +export type EventEmitter = events.EventEmitter; diff --git a/types/artillery/tsconfig.json b/types/artillery/tsconfig.json new file mode 100644 index 0000000000..0ad4bae0ee --- /dev/null +++ b/types/artillery/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", + "artillery-tests.ts" + ] +} diff --git a/types/artillery/tslint.json b/types/artillery/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/artillery/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} From 3aec4e16b28c0cec1121f1acbe402df15e5a873f Mon Sep 17 00:00:00 2001 From: Andy Date: Mon, 23 Oct 2017 11:12:47 -0700 Subject: [PATCH 006/252] restify-cors-middleware: Fix lint (#20914) --- types/restify-cors-middleware/index.d.ts | 25 ++++++++++-------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/types/restify-cors-middleware/index.d.ts b/types/restify-cors-middleware/index.d.ts index d7b92d25a9..09588d1da9 100644 --- a/types/restify-cors-middleware/index.d.ts +++ b/types/restify-cors-middleware/index.d.ts @@ -10,11 +10,20 @@ import { RequestHandler } from 'restify'; declare namespace corsMiddleware { interface Options { - origins: string[]; + /** + * an array of whitelisted origins + * can be both strings and regular expressions + */ + origins: Array; + /** user defined headers to allow */ allowHeaders: string[]; + /** user defined headers to expose */ exposeHeaders: string[]; + /** if true, uses creds */ credentials?: boolean; + /** ms to cache preflight requests */ preflightMaxAge?: number; + /** customize preflight request handling */ preflightStrategy?: any; } @@ -24,19 +33,5 @@ declare namespace corsMiddleware { } } -/** - * @public - * @param {Object} options an options object - * @param {Array} [options.origins] an array of whitelisted origins, can be - * both strings and regular expressions - * @param {Boolean} [options.credentials] if true, uses creds - * @param {Array} [options.allowHeaders] user defined headers to allow - * @param {Array} [options.exposeHeaders] user defined headers to expose - * @param {Number} [options.preflightMaxAge] ms to cache preflight requests - * @param {Object | Function} [options.preflightStrategy] - * customize preflight request handling - * @returns {Object} returns an object with actual and preflight handlers - */ declare function corsMiddleware(options: corsMiddleware.Options): corsMiddleware.CorsMiddleware; - export = corsMiddleware; From c9c658b338e31caf927f4c1c101a5e142004563d Mon Sep 17 00:00:00 2001 From: Andy Date: Mon, 23 Oct 2017 11:13:56 -0700 Subject: [PATCH 007/252] rdf-js: Fix lint (#20912) --- types/rdf-js/index.d.ts | 100 ++++++++++++++++++++-------------------- 1 file changed, 50 insertions(+), 50 deletions(-) diff --git a/types/rdf-js/index.d.ts b/types/rdf-js/index.d.ts index 33a4557bbd..9911043b48 100644 --- a/types/rdf-js/index.d.ts +++ b/types/rdf-js/index.d.ts @@ -28,8 +28,8 @@ export interface Term { value: string; /** - * @param {RDF.Term} other The term to compare with. - * @return {boolean} If the termType is equal and the contents are equal (as defined by concrete subclasses). + * @param other The term to compare with. + * @return If the termType is equal and the contents are equal (as defined by concrete subclasses). */ equals(other: Term): boolean; } @@ -48,8 +48,8 @@ export interface NamedNode extends Term { value: string; /** - * @param {RDF.Term} other The term to compare with. - * @return {boolean} True if and only if other has termType "NamedNode" and the same `value`. + * @param other The term to compare with. + * @return True if and only if other has termType "NamedNode" and the same `value`. */ equals(other: Term): boolean; } @@ -71,8 +71,8 @@ export interface BlankNode extends Term { value: string; /** - * @param {RDF.Term} other The term to compare with. - * @return {boolean} True if and only if other has termType "BlankNode" and the same `value`. + * @param other The term to compare with. + * @return True if and only if other has termType "BlankNode" and the same `value`. */ equals(other: Term): boolean; } @@ -101,8 +101,8 @@ export interface Literal extends Term { datatype: NamedNode; /** - * @param {RDF.Term} other The term to compare with. - * @return {boolean} True if and only if other has termType "Literal" + * @param other The term to compare with. + * @return True if and only if other has termType "Literal" * and the same `value`, `language`, and `datatype`. */ equals(other: Term): boolean; @@ -122,8 +122,8 @@ export interface Variable extends Term { value: string; /** - * @param {RDF.Term} other The term to compare with. - * @return {boolean} True if and only if other has termType "Variable" and the same `value`. + * @param other The term to compare with. + * @return True if and only if other has termType "Variable" and the same `value`. */ equals(other: Term): boolean; } @@ -143,8 +143,8 @@ export interface DefaultGraph extends Term { value: ""; /** - * @param {RDF.Term} other The term to compare with. - * @return {boolean} True if and only if other has termType "DefaultGraph". + * @param other The term to compare with. + * @return True if and only if other has termType "DefaultGraph". */ equals(other: Term): boolean; } @@ -184,8 +184,8 @@ export interface Quad { graph: Term; /** - * @param {RDF.Quad} other The term to compare with. - * @return {boolean} True if and only if the argument is a) of the same type b) has all components equal. + * @param other The term to compare with. + * @return True if and only if the argument is a) of the same type b) has all components equal. */ equals(other: Quad): boolean; } @@ -203,15 +203,15 @@ export interface Triple extends Quad {} */ export interface DataFactory { /** - * @param {string} value The IRI for the named node. - * @return {RDF.NamedNode} A new instance of NamedNode. + * @param value The IRI for the named node. + * @return A new instance of NamedNode. * @see NamedNode */ namedNode(value: string): NamedNode; /** - * @param {string} value The optional blank node identifier. - * @return {RDF.BlankNode} A new instance of BlankNode. + * @param value The optional blank node identifier. + * @return A new instance of BlankNode. * If the `value` parameter is undefined a new identifier * for the blank node is generated for each call. * @see BlankNode @@ -219,35 +219,35 @@ export interface DataFactory { blankNode(value?: string): BlankNode; /** - * @param {string} value The literal value. - * @param {string | RDF.NamedNode} languageOrDatatype The optional language or datatype. + * @param value The literal value. + * @param languageOrDatatype The optional language or datatype. * If `languageOrDatatype` is a NamedNode, * then it is used for the value of `NamedNode.datatype`. * Otherwise `languageOrDatatype` is used for the value * of `NamedNode.language`. - * @return {RDF.Literal} A new instance of Literal. + * @return A new instance of Literal. * @see Literal */ literal(value: string, languageOrDatatype?: string | NamedNode): Literal; /** * This method is optional. - * @param {string} value The variable name - * @return {RDF.Variable} A new instance of Variable. + * @param value The variable name + * @return A new instance of Variable. * @see Variable */ variable?(value: string): Variable; /** - * @return {RDF.DefaultGraph} An instance of DefaultGraph. + * @return An instance of DefaultGraph. */ defaultGraph(): DefaultGraph; /** - * @param {RDF.Term} subject The triple subject term. - * @param {RDF.Term} predicate The triple predicate term. - * @param {RDF.Term} object The triple object term. - * @return {RDF.Quad} A new instance of Quad with `Quad.graph` set to DefaultGraph. + * @param subject The triple subject term. + * @param predicate The triple predicate term. + * @param object The triple object term. + * @return A new instance of Quad with `Quad.graph` set to DefaultGraph. * @see Quad * @see Triple * @see DefaultGraph @@ -255,11 +255,11 @@ export interface DataFactory { triple(subject: Term, predicate: Term, object: Term): Quad; /** - * @param {RDF.Term} subject The quad subject term. - * @param {RDF.Term} predicate The quad predicate term. - * @param {RDF.Term} object The quad object term. - * @param {RDF.Term} graph The quad graph term. - * @return {RDF.Quad} A new instance of Quad. + * @param subject The quad subject term. + * @param predicate The quad predicate term. + * @param object The quad object term. + * @param graph The quad graph term. + * @return A new instance of Quad. * @see Quad */ quad(subject: Term, predicate: Term, object: Term, graph?: Term): Quad; @@ -286,7 +286,7 @@ export interface Stream extends EventEmitter { * This method pulls a quad out of the internal buffer and returns it. * If there is no quad available, then it will return null. * - * @return {RDF.Quad} A quad from the internal buffer, or null if none is available. + * @return A quad from the internal buffer, or null if none is available. */ read(): Quad; } @@ -302,11 +302,11 @@ export interface Source { /** * Returns a stream that processes all quads matching the pattern. * - * @param {RDF.Term | RegExp} subject The optional exact subject or subject regex to match. - * @param {RDF.Term | RegExp} predicate The optional exact predicate or predicate regex to match. - * @param {RDF.Term | RegExp} object The optional exact object or object regex to match. - * @param {RDF.Term | RegExp} graph The optional exact graph or graph regex to match. - * @return {RDF.Stream} The resulting quad stream. + * @param subject The optional exact subject or subject regex to match. + * @param predicate The optional exact predicate or predicate regex to match. + * @param object The optional exact object or object regex to match. + * @param graph The optional exact graph or graph regex to match. + * @return The resulting quad stream. */ match(subject?: Term | RegExp, predicate?: Term | RegExp, object?: Term | RegExp, graph?: Term | RegExp) : Stream; @@ -327,8 +327,8 @@ export interface Sink { * Depending on the use case, subtypes of EventEmitter or Stream are used. * @see Stream * - * @param {RDF.Stream} stream The stream that will be consumed. - * @return {"events".internal.EventEmitter} The resulting event emitter. + * @param stream The stream that will be consumed. + * @return The resulting event emitter. */ import(stream: Stream): EventEmitter; } @@ -348,8 +348,8 @@ export interface Store extends Source, Sink { * The end and error events are used like described in the Stream interface. * @see Stream * - * @param {RDF.Stream} stream The stream that will be consumed. - * @return {"events".internal.EventEmitter} The resulting event emitter. + * @param stream The stream that will be consumed. + * @return The resulting event emitter. */ remove(stream: Stream): EventEmitter; @@ -359,11 +359,11 @@ export interface Store extends Source, Sink { * The `end` and `error` events are used like described in the Stream interface. * @see Stream * - * @param {RDF.Term | RegExp} subject The optional exact subject or subject regex to match. - * @param {RDF.Term | RegExp} predicate The optional exact predicate or predicate regex to match. - * @param {RDF.Term | RegExp} object The optional exact object or object regex to match. - * @param {RDF.Term | RegExp} graph The optional exact graph or graph regex to match. - * @return {"events".internal.EventEmitter} The resulting event emitter. + * @param subject The optional exact subject or subject regex to match. + * @param predicate The optional exact predicate or predicate regex to match. + * @param object The optional exact object or object regex to match. + * @param graph The optional exact graph or graph regex to match. + * @return The resulting event emitter. */ removeMatches(subject?: Term | RegExp, predicate?: Term | RegExp, object?: Term | RegExp, graph?: Term | RegExp) : EventEmitter; @@ -374,8 +374,8 @@ export interface Store extends Source, Sink { * The `end` and `error` events are used like described in the Stream interface. * @see Stream * - * @param {RDF.Term | string} graph The graph term or string to match. - * @return {"events".internal.EventEmitter} The resulting event emitter. + * @param graph The graph term or string to match. + * @return The resulting event emitter. */ deleteGraph(graph: Term | string): EventEmitter; } From 9b9ece0dbc3106666730ee7651b8979f5284504c Mon Sep 17 00:00:00 2001 From: Bradley Ayers Date: Tue, 24 Oct 2017 05:16:45 +1100 Subject: [PATCH 008/252] Fix react-beautiful-dnd event handler types. (#20864) --- types/react-beautiful-dnd/index.d.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/types/react-beautiful-dnd/index.d.ts b/types/react-beautiful-dnd/index.d.ts index d01c4ef81e..785c91c889 100644 --- a/types/react-beautiful-dnd/index.d.ts +++ b/types/react-beautiful-dnd/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for react-beautiful-dnd 2.3 // Project: https://github.com/atlassian/react-beautiful-dnd // Definitions by: varHarrie +// Bradley Ayers // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 @@ -73,9 +74,9 @@ export class Droppable extends React.Component {} export type DraggableStyle = any; export interface DragHandleProps { - onMouseDown(event: MouseEvent): void; - onKeyDown(event: KeyboardEvent): void; - onClick(event: MouseEvent): void; + onMouseDown: React.MouseEventHandler; + onKeyDown: React.KeyboardEventHandler; + onClick: React.MouseEventHandler; tabIndex: number; 'aria-grabbed': boolean; draggable: boolean; From 58189ba82658b361d309cc782606c0530b527b8c Mon Sep 17 00:00:00 2001 From: thom Date: Mon, 23 Oct 2017 20:17:14 +0200 Subject: [PATCH 009/252] Update index.d.ts (#20866) In the latest version an options for disabling warnings has been added: https://github.com/gaearon/react-hot-loader/pull/669 --- types/react-hot-loader/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/react-hot-loader/index.d.ts b/types/react-hot-loader/index.d.ts index ecf84d2ffe..6bd1234259 100644 --- a/types/react-hot-loader/index.d.ts +++ b/types/react-hot-loader/index.d.ts @@ -13,6 +13,7 @@ interface ErrorReporterProps { export interface AppContainerProps { children?: React.ReactElement, errorReporter?: React.ComponentClass | React.StatelessComponent + warnings?: boolean } export class AppContainer extends React.Component {} From 343099bb28c5c2b2db4d8989c644d54857c10d09 Mon Sep 17 00:00:00 2001 From: Andrew Goodale Date: Fri, 20 Oct 2017 14:28:16 -0400 Subject: [PATCH 010/252] Remove `Navigator` and `NavigationExperimental` since they are not in RN >=0.44 --- types/react-native-tab-view/index.d.ts | 10 +- types/react-native/index.d.ts | 655 ------------------------- 2 files changed, 9 insertions(+), 656 deletions(-) diff --git a/types/react-native-tab-view/index.d.ts b/types/react-native-tab-view/index.d.ts index 92fc92a21d..492287a754 100644 --- a/types/react-native-tab-view/index.d.ts +++ b/types/react-native-tab-view/index.d.ts @@ -9,7 +9,7 @@ import { Animated, StyleProp, ViewStyle, - NavigationTransitionSpec, + EasingFunction } from 'react-native' export type Key = { key: string } @@ -53,6 +53,14 @@ export type TransitionProps = { progress: number } +export type NavigationTransitionSpec = { + duration?: number, + // An easing function from `Easing`. + easing?: EasingFunction, + // A timing function such as `Animated.timing`. + timing?: (value: Animated.Value, config: any) => any, +} + export type TransitionConfigurator = ( currentTransitionProps: TransitionProps, nextTransitionProps: TransitionProps diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index 3f02a5f6c5..8d33f271af 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -4744,77 +4744,6 @@ export interface TouchableNativeFeedbackStatic extends TouchableMixin, React.Cla Ripple( color: string, borderless?: boolean ): RippleBackgroundPropType } - -export interface LeftToRightGesture { - // If the gesture can end and restart during one continuous touch - isDetachable: boolean; - // How far the swipe must drag to start transitioning - gestureDetectMovement: number; - // Amplitude of release velocity that is considered still - notMoving: number; - // Fraction of directional move required. - directionRatio: number; - // Velocity to transition with when the gesture release was "not moving" - snapVelocity: number; - // Region that can trigger swipe. iOS default is 30px from the left edge - edgeHitWidth: number; - // Ratio of gesture completion when non-velocity release will cause action - stillCompletionRatio: number; - fullDistance: any; - direction: string; -} - -export interface JumpGesture extends LeftToRightGesture { - overswipe: { - frictionConstant: number - frictionByDistance: number - } -} - -// see /NavigatorSceneConfigs.js -export interface SceneConfig { - // A list of all gestures that are enabled on this scene - gestures?: { - pop?: LeftToRightGesture, - }, - - // Rebound spring parameters when transitioning FROM this scene - springFriction: number; - springTension: number; - - // Velocity to start at when transitioning without gesture - defaultTransitionVelocity: number; - - // Animation interpolators for horizontal transitioning: - animationInterpolators: { - into: () => boolean, - out: () => boolean - }; -} - -export interface JumpSceneConfig extends SceneConfig { - gestures: { - pop?: LeftToRightGesture - jumpBack: JumpGesture - jumpForward: JumpGesture - } -} - -// see /NavigatorSceneConfigs.js -export interface SceneConfigs { - PushFromRight: SceneConfig; - PushFromLeft: SceneConfig; - FloatFromRight: SceneConfig; - FloatFromLeft: SceneConfig; - FloatFromBottom: SceneConfig; - FloatFromBottomAndroid: SceneConfig; - FadeAndroid: SceneConfig; - HorizontalSwipeJump: SceneConfig; - HorizontalSwipeJumpFromRight: SceneConfig; - VerticalUpSwipeJump: SceneConfig; - VerticalDownSwipeJump: SceneConfig; -} - export interface Route { component?: React.ComponentType id?: string @@ -4831,87 +4760,9 @@ export interface Route { index?: number onRightButtonPress?: () => void rightButtonTitle?: string - sceneConfig?: SceneConfig wrapperStyle?: any } - -/** - * @see https://facebook.github.io/react-native/docs/navigator.html#content - */ -export interface NavigatorProperties { - /** - * Optional function that allows configuration about scene animations and gestures. - * Will be invoked with `route` and `routeStack` parameters, where `route` - * corresponds to the current scene being rendered by the `Navigator` and - * `routeStack` is the set of currently mounted routes that the navigator - * could transition to. The function should return a scene configuration object. - * @param route - * @param routeStack - */ - configureScene?: (route: Route, routeStack: Route[]) => SceneConfig - /** - * Specify a route to start on. - * A route is an object that the navigator will use to identify each scene to render. - * initialRoute must be a route in the initialRouteStack if both props are provided. - * The initialRoute will default to the last item in the initialRouteStack. - */ - initialRoute?: Route - /** - * Provide a set of routes to initially mount. - * Required if no initialRoute is provided. - * Otherwise, it will default to an array containing only the initialRoute - */ - initialRouteStack?: Route[] - - /** - * Optionally provide a navigation bar that persists across scene transitions - */ - navigationBar?: React.ReactElement - - /** - * Optionally provide the navigator object from a parent Navigator - */ - navigator?: Navigator - - /** - * @deprecated Use navigationContext.addListener('willfocus', callback) instead. - */ - onDidFocus?: () => any - - /** - * @deprecated Use navigationContext.addListener('willfocus', callback) instead. - */ - onWillFocus?: () => any - - /** - * Required function which renders the scene for a given route. - * Will be invoked with the route and the navigator object - * @param route - * @param navigator - */ - renderScene: ( route: Route, navigator: Navigator ) => React.ReactElement - - /** - * Styles to apply to the container of each scene - */ - sceneStyle?: StyleProp - -} - -/** - * Class that contains the info and methods for app navigation. - */ -export interface NavigationContext { - parent: NavigationContext; - top: NavigationContext; - currentRoute: any; - appendChild(childContext: NavigationContext): void; - addListener(eventType: string, listener: () => void, useCapture?: boolean): NativeEventSubscription; - emit(eventType: string, data: any, didEmitCallback?: () => void): void; - dispose(): void; -} - interface InteractionMixin { createInteractionHandle(): number clearInteractionHandle(clearHandle: number): void @@ -4940,209 +4791,6 @@ interface SubscribableMixin { addListenerOn( eventEmitter: any, eventType: string, listener: () => any, context: any ): void } -/** - * Use Navigator to transition between different scenes in your app. - * To accomplish this, provide route objects to the navigator to identify each scene, - * and also a renderScene function that the navigator can use to render the scene for a given route. - * - * To change the animation or gesture properties of the scene, provide a configureScene prop to get the config object for a given route. - * See Navigator.SceneConfigs for default animations and more info on scene config options. - * @see https://facebook.github.io/react-native/docs/navigator.html - */ -export interface NavigatorStatic extends TimerMixin, InteractionMixin, SubscribableMixin, React.ComponentClass { - SceneConfigs: SceneConfigs; - NavigationBar: NavigatorStatic.NavigationBarStatic; - BreadcrumbNavigationBar: NavigatorStatic.BreadcrumbNavigationBarStatic; - - navigationContext: NavigationContext; - - /** - * returns the current list of routes - */ - getCurrentRoutes(): Route[]; - - /** - * Jump backward without unmounting the current scen - */ - jumpBack(): void; - - /** - * Jump forward to the next scene in the route stack - */ - jumpForward(): void; - - /** - * Transition to an existing scene without unmounting - */ - jumpTo(route: Route): void; - - /** - * Navigate forward to a new scene, squashing any scenes that you could jumpForward to - */ - push(route: Route): void; - - /** - * Transition back and unmount the current scene - */ - pop(): void; - - /** - * Go back N scenes at once. When N=1, behavior matches `pop()`. - * When N is invalid(negative or bigger than current routes count), do nothing. - * @param {number} n The number of scenes to pop. Should be an integer. - */ - popN(n: number): void - - /** - * Replace the current scene with a new route - */ - replace(route: Route): void; - - /** - * Replace a scene as specified by an index - */ - replaceAtIndex(route: Route, index: number): void; - - /** - * Replace the previous scene - */ - replacePrevious(route: Route): void; - - /** - * Reset every scene with an array of routes - */ - immediatelyResetRouteStack(routes: Route[]): void; - - /** - * Pop to a particular scene, as specified by its route. All scenes after it will be unmounted - */ - popToRoute(route: Route): void; - - /** - * Pop to the first scene in the stack, unmounting every other scene - */ - popToTop(): void; - - /** - * Replace the previous scene and pop to it. - */ - replacePreviousAndPop( route: Route ): void; - - /** - * Navigate to a new scene and reset route stack. - */ - resetTo( route: Route ): void; - -} - -export namespace NavigatorStatic { - - - export interface NavState { - routeStack: Route[] - presentedIndex: number - } - - // @see NavigationBarStyle.ios.js - export interface NavigationBarStyle { - General: { - NavBarHeight: number - StatusBarHeight: number - TotalNavHeight: number - }, - Interpolators: { - // Animating *into* the center stage from the right - RightToCenter: () => boolean - // Animating out of the center stage, to the left - CenterToLeft: () => boolean - // Both stages (animating *past* the center stage) - RightToLeft: () => boolean - }, - Stages: { - Left: { - Title: FlexStyle - LeftButton: FlexStyle - RightButton: FlexStyle - }, - Center: { - Title: FlexStyle - LeftButton: FlexStyle - RightButton: FlexStyle - }, - Right: { - Title: FlexStyle - LeftButton: FlexStyle - RightButton: FlexStyle - }, - } - } - - - export interface NavigationBarRouteMapper { - Title: (route: Route, nav: Navigator, index: number, navState: NavState) => JSX.Element | null; - LeftButton: (route: Route, nav: Navigator, index: number, navState: NavState) => JSX.Element | null; - RightButton: (route: Route, nav: Navigator, index: number, navState: NavState) => JSX.Element | null; - } - - /** - * @see NavigatorNavigationBar.js - */ - export interface NavigationBarProperties { - navigator?: Navigator - routeMapper?: NavigationBarRouteMapper - navState?: NavState - navigationStyles?: NavigationBarStyle - style?: StyleProp - } - - export interface NavigationBarStatic extends React.ComponentClass { - Styles: NavigationBarStyle - StylesAndroid: NavigationBarStyle; - StylesIOS: NavigationBarStyle; - - /** - * Stop transtion, immediately resets the cached state and re-render the - * whole view. - */ - immediatelyRefresh(): void; - } - - export type NavigationBar = NavigationBarStatic - export var NavigationBar: NavigationBarStatic - - - export interface BreadcrumbNavigationBarStyle { - //TODO &see NavigatorBreadcrumbNavigationBar.js - } - - export interface BreadcrumbNavigationBarRouteMapper { - rightContentForRoute: (route: Route, navigator: Navigator) => React.ReactElement - titleContentForRoute: (route: Route, navigator: Navigator) => React.ReactElement - iconForRoute: (route: Route, navigator: Navigator) => React.ReactElement - //in samples... - separatorForRoute: (route: Route, navigator: Navigator) => React.ReactElement - } - - /** - * @see NavigatorNavigationBar.js - */ - export interface BreadcrumbNavigationBarProperties { - navigator?: Navigator - routeMapper?: BreadcrumbNavigationBarRouteMapper - navState?: NavState - style?: StyleProp - } - - export interface BreadcrumbNavigationBarStatic extends React.ComponentClass { - Styles: BreadcrumbNavigationBarStyle - - immediatelyRefresh(): void - } - - export type BreadcrumbNavigationBar = BreadcrumbNavigationBarStatic - var BreadcrumbNavigationBar: BreadcrumbNavigationBarStatic - -} // @see https://github.com/facebook/react-native/blob/0.34-stable\Libraries\StyleSheet\StyleSheetTypes.js export namespace StyleSheet { @@ -8496,303 +8144,6 @@ export interface ImageStoreStatic { ): void } -export interface TabsReducerStatic { - JumpToAction(index: number): any; -} - -export type TabsReducerFunction = (params: any) => any; - -export interface NavigationTab { - key: string; -} - -export interface NavigationAction { - type: string; -} - -export interface NavigationRoute { - key: string; - title?: string; -} - -export interface NavigationState extends NavigationRoute { - index: number; - routes: NavigationRoute[]; -} - -export type NavigationRenderer = ( - route: NavigationState, - onNavigate: (action: NavigationAction) => boolean -) => JSX.Element; - -interface SubViewProps extends NavigationSceneRendererProps { - onNavigateBack?(): void; -} - -type SubViewRenderer = (subViewProps: SubViewProps) => JSX.Element | null; - -export interface NavigationHeaderProps extends NavigationSceneRendererProps { - onNavigateBack?(): void, - renderLeftComponent?: SubViewRenderer, - renderRightComponent?: SubViewRenderer, - renderTitleComponent?: SubViewRenderer, - style?: StyleProp, - viewProps?: any, - statusBarHeight?: number | NavigationAnimatedValue -} - -export interface NavigationHeaderStatic extends React.ComponentClass { - Title: NavigationHeaderTitleStatic - HEIGHT: number -} - -export interface NavigationHeaderTitleProps { - children?: JSX.Element, - style?: StyleProp, - textStyle?: StyleProp, - viewProps?: any -} - -export interface NavigationHeaderTitleStatic extends React.ComponentClass { -} - -export interface NavigationCardStackProps { - /** - * Custom style applied to the card. - */ - cardStyle?: StyleProp - /** - * Custom style interpolator for the card. - */ - cardStyleInterpolator?: (props: NavigationSceneRendererProps) => StyleProp - /** - * Direction of the cards movement. Value could be `horizontal` or - * `vertical`. Default value is `horizontal`. - */ - direction?: 'horizontal' | 'vertical' - /** - * The distance from the edge of the card which gesture response can start - * for. Defaults value is `30`. - */ - gestureResponseDistance?: number - /** - * Enable gestures. Default value is true - */ - enableGestures?: boolean, - /** - * The controlled navigation state. Typically, the navigation state - * look like this: - * - * ```js - * const navigationState = { - * index: 0, // the index of the selected route. - * routes: [ // A list of routes. - * {key: 'page 1'}, // The 1st route. - * {key: 'page 2'}, // The second route. - * ], - * }; - * ``` - */ - navigationState: NavigationState, - /** - * Callback that is called when the "back" action is performed. - * This happens when the back button is pressed or the back gesture is - * performed. - */ - onNavigateBack?: () => any, - /** - * Function that renders the header. - */ - renderHeader?: NavigationSceneRenderer, - /** - * Function that renders the a scene for a route. - */ - renderScene: NavigationSceneRenderer, - /** - * Custom style applied to the cards stack. - */ - style?: StyleProp, -} - -// Object Instances - -export type NavigationAnimatedValue = Animated.Value; - -// Value & Structs. - -export type NavigationGestureDirection = 'horizontal' | 'vertical'; - -export type NavigationLayout = { - height: NavigationAnimatedValue, - initHeight: number, - initWidth: number, - isMeasured: boolean, - width: NavigationAnimatedValue, -}; - -export type NavigationScene = { - index: number, - isActive: boolean, - isStale: boolean, - key: string, - route: NavigationRoute, -}; - -// Similar to `NavigationTransitionProps`, except that the prop `scene` -// represents the scene for the renderer to render. -export interface NavigationSceneRendererProps { - layout: NavigationLayout, - navigationState: NavigationState, - position: NavigationAnimatedValue, - progress: NavigationAnimatedValue, - scenes: Array, - scene: NavigationScene, - gestureResponseDistance?: number, -} - -export interface NavigationSceneRenderer extends React.StatelessComponent { -} - -export interface NavigationPropTypes { - // helpers - extractSceneRendererProps(props: NavigationSceneRendererProps): NavigationSceneRendererProps - - // Bundled propTypes. - SceneRendererProps: { - layout: string, - navigationState: string, - position: string, - progress: string, - scene: string, - scenes: NavigationScene[], - } - - // propTypes - SceneRenderer: any, // TODO: fix this - action: NavigationAction, - navigationState: NavigationState, - navigationRoute: NavigationRoute, - panHandlers: GestureResponderHandlers, -} - -export interface NavigationCardProps extends React.ComponentClass { - onComponentRef: (ref: any) => void, - onNavigateBack?: () => any, - panHandlers?: GestureResponderHandlers, - pointerEvents: string, - renderScene: NavigationSceneRenderer, - style?: StyleProp, -} - -export interface NavigationCardStackStatic extends React.ComponentClass { -} - -export interface NavigationCardStatic extends React.ComponentClass { -} - -/** - * Utilities to perform atomic operation with navigate state and routes. - * - * ```javascript - * const state1 = {key: 'page 1'}; - * const state2 = NavigationStateUtils.push(state1, {key: 'page 2'}); - * ``` - */ -export interface NavigationStateUtils { - get(state: NavigationState, key: string): NavigationRoute - indexOf(state: NavigationState, key: string): number - has(state: NavigationState, key: string): boolean - push(state: NavigationState, route: NavigationRoute): NavigationState - pop(state: NavigationState): NavigationState - jumpToIndex(state: NavigationState, index: number): NavigationState - jumpTo(state: NavigationState, key: string): NavigationState - back(state: NavigationState): NavigationState - forward(state: NavigationState): NavigationState - replaceAt( - state: NavigationState, - key: string, - route: NavigationRoute - ): NavigationState - replaceAtIndex( - state: NavigationState, - index: number, - route: NavigationRoute - ): NavigationState - reset( - state: NavigationState, - routes: Array, - index?: number - ): NavigationState -} - -export type NavigationTransitionProps = { - // The layout of the transitioner of the scenes. - layout: NavigationLayout, - - // The navigation state of the transitioner. - navigationState: NavigationState, - - // The progressive index of the transitioner's navigation state. - position: NavigationAnimatedValue, - - // The value that represents the progress of the transition when navigation - // state changes from one to another. Its numberic value will range from 0 - // to 1. - // progress.__getAnimatedValue() < 1 : transtion is happening. - // progress.__getAnimatedValue() == 1 : transtion completes. - progress: NavigationAnimatedValue, - - // All the scenes of the transitioner. - scenes: Array, - - // The active scene, corresponding to the route at - // `navigationState.routes[navigationState.index]`. - scene: NavigationScene, - - // The gesture distance for `horizontal` and `vertical` transitions - gestureResponseDistance?: number, -} -export type NavigationTransitionSpec = { - duration?: number, - // An easing function from `Easing`. - easing?: EasingFunction, - // A timing function such as `Animated.timing`. - timing?: (value: NavigationAnimatedValue, config: any) => any, -} -export interface NavigationTransitionerProps { - configureTransition?: ( - a: NavigationTransitionProps, - b?: NavigationTransitionProps - ) => NavigationTransitionSpec, - navigationState: NavigationState, - onTransitionEnd?: () => void, - onTransitionStart?: () => void, - render: (a: NavigationTransitionProps, b?: NavigationTransitionProps) => any, - style: any, -} - -export interface NavigationTransitioner extends React.ComponentClass { -} - -export interface NavigationCard extends React.ComponentClass { -} - -export interface NavigationExperimentalStatic { - // Core - StateUtils: NavigationStateUtils - - // Views - Transitioner: NavigationTransitioner, - - //AnimatedView: NavigationAnimatedViewStatic; - // CustomComponents: - Card: NavigationCard, - CardStack: NavigationCardStackStatic; - Header: NavigationHeaderStatic; - - PropTypes: NavigationPropTypes, -} - // // Interfacing with Native Modules // https://facebook.github.io/react-native/docs/native-modules-ios.html @@ -8937,9 +8288,6 @@ export type MaskedView = MaskedViewStatic export var Modal: ModalStatic export type Modal = ModalStatic -export var Navigator: NavigatorStatic -export type Navigator = NavigatorStatic - export var NavigatorIOS: NavigatorIOSStatic export type NavigatorIOS = NavigatorIOSStatic @@ -9145,9 +8493,6 @@ export type Vibration = VibrationStatic export var Dimensions: Dimensions; export var ShadowPropTypesIOS: ShadowPropTypesIOSStatic; -export type NavigationExperimental = NavigationExperimentalStatic; -export var NavigationExperimental: NavigationExperimentalStatic; - export type Easing = EasingStatic; export var Easing: EasingStatic; From 0d6c547a4cc2eb01a171e56ff68dc5cb5f114baa Mon Sep 17 00:00:00 2001 From: Andy Date: Mon, 23 Oct 2017 11:30:32 -0700 Subject: [PATCH 011/252] undertaker: Fix lint (#20926) --- types/undertaker/index.d.ts | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/types/undertaker/index.d.ts b/types/undertaker/index.d.ts index b19ad4ac79..f4dcb58417 100644 --- a/types/undertaker/index.d.ts +++ b/types/undertaker/index.d.ts @@ -46,20 +46,20 @@ declare class Undertaker extends EventEmitter { /** * Returns the registered function. - * @param {string} taskName - Task name. + * @param taskName - Task name. */ task(taskName: string): Undertaker.TaskFunction; /** * Register the task by the taskName. - * @param {string} taskName - Task name. - * @param {TaskFunction} fn - Task function. + * @param taskName - Task name. + * @param fn - Task function. */ task(taskName: string, fn: Undertaker.TaskFunction): void; /** * Register the task by the name property of the function. - * @param {TaskFunction} fn - Task function. + * @param fn - Task function. */ task(fn: Undertaker.TaskFunction): void; @@ -70,7 +70,7 @@ declare class Undertaker extends EventEmitter { * * When the returned function is executed, the tasks or functions will be executed in series, * each waiting for the prior to finish. If an error occurs, execution will stop. - * @param {...Undertaker.Task[]} tasks - List of tasks. + * @param tasks - List of tasks. */ series(...tasks: Undertaker.Task[]): Undertaker.TaskFunction; @@ -81,7 +81,7 @@ declare class Undertaker extends EventEmitter { * * When the returned function is executed, the tasks or functions will be executed in series, * each waiting for the prior to finish. If an error occurs, execution will stop. - * @param {Undertaker.Task[]} tasks - List of tasks. + * @param tasks - List of tasks. */ series(tasks: Undertaker.Task[]): Undertaker.TaskFunction; @@ -92,7 +92,7 @@ declare class Undertaker extends EventEmitter { * * When the returned function is executed, the tasks or functions will be executed in parallel, * all being executed at the same time. If an error occurs, all execution will complete. - * @param {...Undertaker.Task[]} tasks - list of tasks. + * @param tasks - list of tasks. */ parallel(...tasks: Undertaker.Task[]): Undertaker.TaskFunction; @@ -103,7 +103,7 @@ declare class Undertaker extends EventEmitter { * * When the returned function is executed, the tasks or functions will be executed in parallel, * all being executed at the same time. If an error occurs, all execution will complete. - * @param {Undertaker.Task[]} tasks - list of tasks. + * @param tasks - list of tasks. */ parallel(tasks: Undertaker.Task[]): Undertaker.TaskFunction; @@ -115,21 +115,21 @@ declare class Undertaker extends EventEmitter { /** * The tasks from the current registry will be transferred to it * and the current registry will be replaced with the new registry. - * @param {Registry} registry - Instance of registry. + * @param registry - Instance of registry. */ registry(registry: Registry): void; /** * Optionally takes an object (options) and returns an object representing the tree of registered tasks. - * @param {Undertaker.TreeOptions} options - Tree options. + * @param options - Tree options. */ tree(options?: Undertaker.TreeOptions): Undertaker.TreeResult; /** * Takes a string or function (task) and returns a timestamp of the last time the task was run successfully. * The time will be the time the task started. Returns undefined if the task has not been run. - * @param {Undertaker.Task} task - Task. - * @param {number} [timeResolution] - Time resolution. + * @param task - Task. + * @param [timeResolution] - Time resolution. */ lastRun(task: Undertaker.Task, timeResolution?: number): number; } From 98a8c5710ddf518040bb0a05549dd25428d591ff Mon Sep 17 00:00:00 2001 From: Andy Date: Mon, 23 Oct 2017 11:31:40 -0700 Subject: [PATCH 012/252] koa-morgan: Fix lint (#20896) --- types/koa-morgan/index.d.ts | 65 ++++++++++--------------------------- 1 file changed, 18 insertions(+), 47 deletions(-) diff --git a/types/koa-morgan/index.d.ts b/types/koa-morgan/index.d.ts index f9cbc249c0..b4be38122b 100644 --- a/types/koa-morgan/index.d.ts +++ b/types/koa-morgan/index.d.ts @@ -23,28 +23,22 @@ declare namespace morgan { * Public interface of morgan logger */ interface KoaMorgan { - /*** + /** * Create a new morgan logger middleware function using the given format and options. The * format argument may be a string of a predefined name (see below for the names), * or a string of a format string containing defined tokens. - * @param format - * @param options */ (format: string, options?: Options): Koa.Middleware; - /*** + /** * Standard Apache combined log output. * :remote-addr - :remote-user [:date] ":method :url HTTP/:http-version" :status :res[content-length] ":referrer" ":user-agent" - * @param format - * @param options */ (format: 'combined', options?: Options): Koa.Middleware; - /*** + /** * Standard Apache common log output. * :remote-addr - :remote-user [:date] ":method :url HTTP/:http-version" :status :res[content-length] - * @param format - * @param options */ (format: 'common', options?: Options): Koa.Middleware; @@ -52,32 +46,24 @@ declare namespace morgan { * Concise output colored by response status for development use. The :status token will be colored red for * server error codes, yellow for client error codes, cyan for redirection codes, and uncolored for all other codes. * :method :url :status :response-time ms - :res[content-length] - * @param format - * @param options */ (format: 'dev', options?: Options): Koa.Middleware; - /*** + /** * Shorter than default, also including response time. * :remote-addr :remote-user :method :url HTTP/:http-version :status :res[content-length] - :response-time ms - * @param format - * @param options */ (format: 'short', options?: Options): Koa.Middleware; - /*** + /** * The minimal output. * :method :url :status :res[content-length] - :response-time ms - * @param format - * @param options */ (format: 'tiny', options?: Options): Koa.Middleware; - /*** + /** * Create a new morgan logger middleware function using the given format and options. The format argument may be a * custom format function which adheres to the signature. - * @param format - * @param options */ (format: FormatFn, options?: Options): Koa.Middleware; @@ -124,88 +110,73 @@ declare namespace morgan { type StreamOptions = originalMorgan.StreamOptions; - /*** + /** * Morgan accepts these properties in the options object. */ interface Options { - /*** + /** * Buffer duration before writing logs to the stream, defaults to false. When set to true, defaults to 1000 ms. */ buffer?: boolean; - /*** + /** * Write log line on request instead of response. This means that a requests will be logged even if the server * crashes, but data from the response cannot be logged (like the response code). */ immediate?: boolean; - /*** + /** * Function to determine if logging is skipped, defaults to false. This function will be called as skip(req, res). */ skip?: (req: IncomingMessage, res: ServerResponse) => boolean; - /*** + /** * Output stream for writing log lines, defaults to process.stdout. - * @param str */ stream?: StreamOptions; } } -/*** +/** * Create a new morgan logger middleware function using the given format and options. The format argument may be a string * of a predefined name (see below for the names), or a string of a format string containing defined tokens. - * @param format - * @param options */ declare function morgan(format: string, options?: morgan.Options): Koa.Middleware; -/*** +/** * Standard Apache combined log output. * :remote-addr - :remote-user [:date] ":method :url HTTP/:http-version" :status :res[content-length] ":referrer" ":user-agent" - * @param format - * @param options */ declare function morgan(format: 'combined', options?: morgan.Options): Koa.Middleware; -/*** +/** * Standard Apache common log output. * :remote-addr - :remote-user [:date] ":method :url HTTP/:http-version" :status :res[content-length] - * @param format - * @param options */ declare function morgan(format: 'common', options?: morgan.Options): Koa.Middleware; -/*** +/** * Concise output colored by response status for development use. The :status token will be colored red for server error codes, * yellow for client error codes, cyan for redirection codes, and uncolored for all other codes. * :method :url :status :response-time ms - :res[content-length] - * @param format - * @param options */ declare function morgan(format: 'dev', options?: morgan.Options): Koa.Middleware; -/*** +/** * Shorter than default, also including response time. * :remote-addr :remote-user :method :url HTTP/:http-version :status :res[content-length] - :response-time ms - * @param format - * @param options */ declare function morgan(format: 'short', options?: morgan.Options): Koa.Middleware; -/*** +/** * The minimal output. * :method :url :status :res[content-length] - :response-time ms - * @param format - * @param options */ declare function morgan(format: 'tiny', options?: morgan.Options): Koa.Middleware; -/*** +/** * Create a new morgan logger middleware function using the given format and options. The format argument may be a * custom format function which adheres to the signature. - * @param format - * @param options */ declare function morgan(custom: (req: IncomingMessage, res: ServerResponse) => string): Koa.Middleware; From b9c5f5256a6f7a839bd95d3f5a9c56dfbf2243ac Mon Sep 17 00:00:00 2001 From: Janeene Beeforth Date: Tue, 24 Oct 2017 04:32:02 +1000 Subject: [PATCH 013/252] Create typescript definitions for the react-dnd-multi-backend library. (#20790) * Create typescript definitions for the react-dnd-multi-backend library. https://github.com/LouisBrunner/react-dnd-multi-backend * Attempt to fix relative path to index. --- types/react-dnd-multi-backend/index.d.ts | 115 ++++++++++++++++++ .../lib/HTML5toTouch.d.ts | 11 ++ .../react-dnd-multi-backend-tests.tsx | 60 +++++++++ types/react-dnd-multi-backend/tsconfig.json | 26 ++++ types/react-dnd-multi-backend/tslint.json | 1 + 5 files changed, 213 insertions(+) create mode 100644 types/react-dnd-multi-backend/index.d.ts create mode 100644 types/react-dnd-multi-backend/lib/HTML5toTouch.d.ts create mode 100644 types/react-dnd-multi-backend/react-dnd-multi-backend-tests.tsx create mode 100644 types/react-dnd-multi-backend/tsconfig.json create mode 100644 types/react-dnd-multi-backend/tslint.json diff --git a/types/react-dnd-multi-backend/index.d.ts b/types/react-dnd-multi-backend/index.d.ts new file mode 100644 index 0000000000..25029631cb --- /dev/null +++ b/types/react-dnd-multi-backend/index.d.ts @@ -0,0 +1,115 @@ +// Type definitions for react-dnd-multi-backend 3.0 +// Project: https://github.com/LouisBrunner/react-dnd-multi-backend +// Definitions by: Janeene Beeforth +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import { CSSProperties, PureComponent } from "react"; +import { Backend } from "react-dnd"; + +/** + * Callback function type definition for checking whether an event represents a transition between + * dragging and dropping. + * @param event Touch/Mouse/Keyboard/etc UI Event. + * @returns True if the event triggers the start of a transition. + */ +export type CheckFunction = (event: E) => boolean; + +/** + * Drag and drop Transition interface. + */ +export interface Transition { + /** + * ??? + */ + _isMBTransition: boolean; + /** + * Event type that this transition should check against. This will be an HTML event, such as + * "dragstart", "touchstart", etc. + */ + event: string; + /** + * Check function to use for this transition. + */ + check: CheckFunction; +} + +/** + * Function to create a custom/new Transition. + * @param eventType EventType string to identify the type of event being tested. This will be an + * HTML event, such as "dragstart", "touchstart", etc. + * @param check The CheckFunction to use to verify if an event matches the event type. + * @returns A Transition to indicate when a particular Backend should be used. + */ +export function createTransition(eventType: string, check: CheckFunction): Transition; + +/** + * Declaration for a Drag and Drop backend to be used. + */ +export interface BackendDeclaration { + /** + * Backend - e.g. the one provided by react-dnd-html5-backend. + */ + backend: Backend; + /** + * Flag to indicate that this backend needs to have a custom preview generated. This is mainly + * used for backends such as the react-dnd-touch-backend, where there is no default preview + * available. + */ + preview?: boolean; + /** + * The transition that this backend should be used for. + */ + transition?: Transition; +} + +/** + * The declaration for the list of backends to be used. + */ +export interface Backends { + /** + * The array of backends to use. The first backend in the list is used as the default backend. + * This means that you can start with the html5 backend, and fall-back to a touch backend if + * the event is not one that is compatible with the html5 backend. + */ + backends: BackendDeclaration[]; +} + +/** + * Properties for the Preview class + */ +export interface PreviewProps { + /** + * Callback function to generate a preview object when dragging. This preview will only be used + * with backends that have the 'preview' flag set to true. + * @param type: the type of the item (monitor.getItemType()) + * @param item: the item being dragged (monitor.getItem()) + * @param style: an object representing the style to use for the item, it should be passed to + * your component's style property and is used for positioning. + * @returns The JSX element to display for the drag preview. + */ + generator(type: string, item: any, style: CSSProperties): JSX.Element; +} + +/** + * Class to use when generating a custom preview for a dragged item. + * This is frequently used with the Touch backend to provide a preview on mobile devices. + */ +export class Preview extends PureComponent {} + +/** + * Pre-existing/default react-dnd-touch-backend transition available to use. + * This transition has the setting for "enableMouseEvents" turned on. + */ +export const TouchTransition: Transition; +/** + * Pre-existing/default react-dnd-html5-backend transition available to use. + */ +export const HTML5DragTransition: Transition; + +/** + * Primary construction function for react-dnd-multi-backend. + * @param backends The list of backends in descending order of preference to use for drag and drop. + * @returns A backend definition compatible with react-dnd. + */ +export default function(backends: Backends): Backend; diff --git a/types/react-dnd-multi-backend/lib/HTML5toTouch.d.ts b/types/react-dnd-multi-backend/lib/HTML5toTouch.d.ts new file mode 100644 index 0000000000..40c4ad627d --- /dev/null +++ b/types/react-dnd-multi-backend/lib/HTML5toTouch.d.ts @@ -0,0 +1,11 @@ +import { Backends } from '../'; + +/** + * Most commonly used set of Backends. + * The default backend is the react-dnd-html5-backend. + * The second backend is the react-dnd-touch-backend with enableMouseEvents = true, + * preview = true, and the transition triggering on the "touchstart" event. + */ +declare const HTML5ToTouch: Backends; + +export default HTML5ToTouch; diff --git a/types/react-dnd-multi-backend/react-dnd-multi-backend-tests.tsx b/types/react-dnd-multi-backend/react-dnd-multi-backend-tests.tsx new file mode 100644 index 0000000000..cbe6136585 --- /dev/null +++ b/types/react-dnd-multi-backend/react-dnd-multi-backend-tests.tsx @@ -0,0 +1,60 @@ +// Examples based on documentation at https://github.com/LouisBrunner/react-dnd-multi-backend + +import * as React from 'react'; +import * as ReactDnd from 'react-dnd'; +import MultiBackend, { Backends, createTransition, Preview, TouchTransition, HTML5DragTransition } from 'react-dnd-multi-backend'; +import HTML5toTouch from 'react-dnd-multi-backend/lib/HTML5toTouch'; +import HTML5Backend from 'react-dnd-html5-backend'; +import TouchBackend from 'react-dnd-touch-backend'; + +const component = () => null; + +/** + * Most common use case - using the default HTML5 with Touch as a fallback. + */ +const multiDndComponent = ReactDnd.DragDropContext(MultiBackend(HTML5toTouch))(component); + +/** + * Creating a custom list of backends, including creating a touch transition. + */ +const CustomBackends: Backends = { + backends: [{ + backend: HTML5Backend + }, + { + backend: TouchBackend({ enableMouseEvents: false }), + preview: true, + transition: createTransition('touchstart', (event: TouchEvent) => { + return event.touches != null; + }) + }, + { + backend: HTML5Backend, + transition: HTML5DragTransition, + preview: true + }, + { + backend: TouchBackend({}), + transition: TouchTransition + }] +}; +const multiCustomBackendsComponent = ReactDnd.DragDropContext(MultiBackend(CustomBackends))(component); + +/** + * Testing the Preview component. + */ +class App extends React.Component { + generator = (type: string, item: any, style: React.CSSProperties) => + (type === 'card') + ?
{item.label}
+ :
+ + render() { + return ( +
+ +
A page of text
+
+ ); + } +} diff --git a/types/react-dnd-multi-backend/tsconfig.json b/types/react-dnd-multi-backend/tsconfig.json new file mode 100644 index 0000000000..e9857447ef --- /dev/null +++ b/types/react-dnd-multi-backend/tsconfig.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react" + }, + "files": [ + "index.d.ts", + "lib/HTML5toTouch.d.ts", + "react-dnd-multi-backend-tests.tsx" + ] +} diff --git a/types/react-dnd-multi-backend/tslint.json b/types/react-dnd-multi-backend/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-dnd-multi-backend/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 95e5dfa7628348e270ba647614d7b6012d508e36 Mon Sep 17 00:00:00 2001 From: Andy Date: Mon, 23 Oct 2017 11:35:16 -0700 Subject: [PATCH 014/252] jui-core: Fix lint (#20899) --- types/jui-core/index.d.ts | 395 ++++++++------------------------------ 1 file changed, 78 insertions(+), 317 deletions(-) diff --git a/types/jui-core/index.d.ts b/types/jui-core/index.d.ts index c3c2cb895a..5a607f5721 100644 --- a/types/jui-core/index.d.ts +++ b/types/jui-core/index.d.ts @@ -9,206 +9,126 @@ export const jui: JuiStatic; export interface UtilBase { - /** - * @property browser check browser agent - * @property {Boolean} browser.webkit Webkit 브라우저 체크 - * @property {Boolean} browser.mozilla Mozilla 브라우저 체크 - * @property {Boolean} browser.msie IE 브라우저 체크 - */ + /** check browser agent */ browser: { + /** Webkit 브라우저 체크 */ webkit: boolean, + /** Mozilla 브라우저 체크 */ mozilla: boolean, + /** IE 브라우저 체크 */ msie: boolean }; - /** - * @property {Boolean} isTouch - * check touch device - */ isTouch: boolean; /** - * @method inherit - * * 프로토타입 기반의 상속 제공 * - * @param {Function} ctor base Class - * @param {Function} superCtor super Class + * @param ctor base Class + * @param superCtor super Class */ inherit(ctor: ((...args: any[]) => any), superCtor: ((...args: any[]) => any)): void; /** - * @method extend - * * implements object extend - * - * @param {Object|Function} origin - * @param {Object|Function} add - * @param {Boolean} skip - * @return {Object} */ extend(origin: any, add: any, skip: boolean): any; /** * convert px to integer - * @param {String or Number} px - * @return {Number} */ pxToInt(px: string | number): number; /** - * @method clone * implements object clone - * @param {Array/Object} obj 복사할 객체 - * @return {Array} + * @param obj 복사할 객체 */ clone(obj: any): any[]; /** - * @method deepClone * implements object deep clone - * @param obj - * @param emit - * @return {*} */ deepClone(obj: any, emit: any): any[]; /** - * @method sort * use QuickSort - * @param {Array} array - * @return {QuickSort} */ sort(array: any[]): UtilQuickSort; /** - * @method runtime - * * caculate callback runtime - * - * @param {String} name - * @param {Function} callback */ runtime(name: string, callback: ((...args: any[]) => void)): void; /** - * @method template * parsing template string - * @param html - * @param obj */ template(html: string, obj?: any): ((obj: any) => string) | string; /** - * @method resize * add event in window resize event - * @param {Function} callback - * @param {Number} ms delay time + * @param ms delay time */ resize(callback: ((...args: any[]) => void), ms: number): void; /** - * @method index - * * IndexParser 객체 생성 - * - * @return {KeyParser} */ index(): UtilKeyParser; /** - * @method chunk * split array by length - * @param {Array} arr - * @param {Number} len - * @return {Array} */ chunk(arr: any[], len: number): any[]; /** - * @method typeCheck * check data type - * @param {String} t type string - * @param {Object} v value object - * @return {Boolean} + * @param t type string + * @param v value object */ typeCheck(typeName: string, value: any): boolean; typeCheckObj(uiObj: any, list: any): void; /** - * @method dataToCsv - * * data 를 csv 로 변환한다. * - * @param {Array} keys - * @param {Array} dataList - * @param {Number} dataSize - * @return {String} 변환된 csv 문자열 + * @return 변환된 csv 문자열 */ dataToCsv(keys: string[], dataList: any[], dataSize: number): string; - /** - * @method dataToCsv2 - * - * @param {Object} options - * @return {String} - */ dataToCsv2(options: any): string; /** - * @method fileToCsv - * * file 에서 csv 컨텐츠 로드 - * - * @param {File} file - * @param {Function} callback */ fileToCsv(fileText: string, callback: ((data: any) => void)): void; /** - * @method csvToBase64 - * * csv 다운로드 링크로 변환 * - * @param {String} csv - * @return {String} data uri string + * @return data uri string */ csvToBase64(csv: string): string; - /** - * @method csvToData - * - * @param {Array} keys - * @param {String} csv - * @param {Number} csvNumber - * @return {Array} - */ csvToData(keys: string[], csv: string, csvNumber: number): any[]; /** - * @method getCsvFields * * csv 에서 필드 얻어오기 * - * @param {Array} fields - * @param {Array} csvFields - * @return {Array} */ getCsvFields(fields: string[], csvFields: string[]): string[]; /** - * @method svgToBase64 * * xml 문자열로 svg datauri 생성 * - * @param {String} xml - * @return {String} 변환된 data uri 링크 + * @return 변환된 data uri 링크 */ svgToBase64(xml: string): string; /** - * @method dateFormat * * implements date format function * @@ -216,104 +136,73 @@ export interface UtilBase { * yy : 2 digits year * y : 1 digit year * - * @param {Date} date - * @param {String} format date format string - * @param {Boolean} utc - * @return {string} + * @param format date format string */ dateFormat(date: Date, format: string, utc?: boolean): string; /** - * @method createId * * 유니크 아이디 생성 * - * @param {String} key prefix string - * @return {String} 생성된 아이디 문자열 + * @param key prefix string + * @return 생성된 아이디 문자열 */ createId(key: string): string; /** - * @method btoa - * * Base64 인코딩 - * - * @return {String} */ btoa(input: any): string; /** - * @method atob - * * Base64 디코딩 - * - * @return {Any} */ atob(input: string): any; /** * implement async loop without blocking ui * - * @param {Number} total loop count - * @param {Object} context - * @returns {Function} + * @param total loop count */ timeLoop(total: number, context?: any): ((index: number) => void); /** - * @method loop - * * 최적화된 루프 생성 (5단계로 나눔) * - * @param {Number} total loop count - * @param {Object} [context=null] - * @return {Function} 최적화된 루프 콜백 (index, groupIndex 2가지 파라미터를 받는다.) + * @param total loop count + * @return 최적화된 루프 콜백 (index, groupIndex 2가지 파라미터를 받는다.) */ loop(total: number, context?: any): ((index: number, groupIndex: number) => void); /** - * @method loopArray - * * 배열을 사용해서 최적화된 루프로 생성한다. * * - * @param {Array} data 루프로 생성될 배열 - * @param {Object} [context=null] - * @return {Function} 최적화된 루프 콜백 (data, index, groupIndex 3가지 파라미터를 받는다.) + * @param data 루프로 생성될 배열 + * @return 최적화된 루프 콜백 (data, index, groupIndex 3가지 파라미터를 받는다.) */ loopArray(data: any[], context?: any): ((data: any, index: number, groupIndex: number) => void); /** - * @method makeIndex - * * 배열의 키 기반 인덱스를 생성한다. * * 개별 값 별로 멀티 인덱스를 생성한다. * - * @param {Array} data - * @param {String} keyField - * @return {Object} 생성된 인덱스 + * @return 생성된 인덱스 */ makeIndex(data: any[], keyField: string): any; /** - * @method startsWith * Check that it matches the starting string search string. * - * @param {String} string - * @param {String} searchString - * @param {Number} [position=0] - * @return {Number} position + * @return position */ startsWith(str: string, searchString: string, position?: number): number; /** - * @method endsWith * Check that it matches the end of a string search string. * - * @param {String} string - * @param {String} searchString - * @return {Number} position + * @return position */ endsWith(str: string, searchString: string, position?: number): number; @@ -332,46 +221,36 @@ export interface UtilBase { export interface JuiStatic { /** - * @method ready - * * ready 타임에 실행될 callback 정의 - * - * @param {Function} callback */ ready(depends?: string[], callback?: (...args: any[]) => void): void; /** - * @method defineUI - * * 사용자가 실제로 사용할 수 있는 UI 클래스를 정의 * - * @param {String} name 모듈 로드와 상속에 사용될 이름을 정한다. - * @param {Array} depends 'define'이나 'defineUI'로 정의된 클래스나 객체를 인자로 받을 수 있다. - * @param {Function} callback UI 클래스를 해당 콜백 함수 내에서 클래스 형태로 구현하고 리턴해야 한다. + * @param name 모듈 로드와 상속에 사용될 이름을 정한다. + * @param depends 'define'이나 'defineUI'로 정의된 클래스나 객체를 인자로 받을 수 있다. + * @param callback UI 클래스를 해당 콜백 함수 내에서 클래스 형태로 구현하고 리턴해야 한다. */ defineUI(name: string, depends: string[], callback: () => void, parent?: string): void; /** - * @method define - * * UI 클래스에서 사용될 클래스를 정의하고, 자유롭게 상속할 수 있는 클래스를 정의 * - * @param {String} name 모듈 로드와 상속에 사용될 이름을 정한다. - * @param {Array} depends 'define'이나 'defineUI'로 정의된 클래스나 객체를 인자로 받을 수 있다. - * @param {Function} callback UI 클래스를 해당 콜백 함수 내에서 클래스 형태로 구현하고 리턴해야 한다. - * @param {String} parent 상속받을 클래스 + * @param name 모듈 로드와 상속에 사용될 이름을 정한다. + * @param depends 'define'이나 'defineUI'로 정의된 클래스나 객체를 인자로 받을 수 있다. + * @param callback UI 클래스를 해당 콜백 함수 내에서 클래스 형태로 구현하고 리턴해야 한다. + * @param parent 상속받을 클래스 */ define(name: string, depends: string[], callback: () => void, parent?: string): void; /** - * @method redefine - * * UI 클래스에서 사용될 클래스를 정의하고, 자유롭게 상속할 수 있는 클래스를 정의 * - * @param {String} name 모듈 로드와 상속에 사용될 이름을 정한다. - * @param {Array} depends 'define'이나 'defineUI'로 정의된 클래스나 객체를 인자로 받을 수 있다. - * @param {Function} callback UI 클래스를 해당 콜백 함수 내에서 클래스 형태로 구현하고 리턴해야 한다. - * @param {String} parent 상속받을 클래스 + * @param name 모듈 로드와 상속에 사용될 이름을 정한다. + * @param depends 'define'이나 'defineUI'로 정의된 클래스나 객체를 인자로 받을 수 있다. + * @param callback UI 클래스를 해당 콜백 함수 내에서 클래스 형태로 구현하고 리턴해야 한다. + * @param parent 상속받을 클래스 */ redefine(name: string, depends: string[], callback: () => void, parent?: string): void; @@ -379,60 +258,48 @@ export interface JuiStatic { * define과 defineUI로 정의된 클래스 또는 객체를 가져온다. * * @param name 가져온 클래스 또는 객체의 이름 - * @return {*} */ include(name: string): any; /** * define과 defineUI로 정의된 모든 클래스와 객체를 가져온다. - * - * @return {Array} */ includeAll(): any[]; /** - * @method add * Adds a component object created * - * @param {Object} ui UI instance + * @param ui UI instance */ add(uiIns: any): void; /** - * @method emit * Generates a custom event to an applicable component * - * @param {String} key Selector or UI type - * @param {String} type Event type - * @param {Array} args Event arguments + * @param key Selector or UI type + * @param type Event type + * @param args Event arguments */ emit(key: string, type: string, args: any[]): void; /** - * @method get * Gets a component currently created * - * @param {Integer/String} key - * @returns {Object/Array} UI instance + * @returns UI instance */ get(key: number | string): any; /** - * @method getAll * Gets all components currently created * - * @return {Array} UI instances + * @return UI instances */ getAll(): any[]; /** - * @method create * It is possible to create a component dynamically after the ready point * - * @param {String} type UI type - * @param {String/DOMElement} selector - * @param {Object} options - * @return {Object} + * @param type UI type */ create(type: string, selector: any, options?: {}): any; } @@ -449,93 +316,69 @@ export interface UICore { root?: any; /** - * @method emit * Generates a custom event. The first parameter is the type of a custom event. A function defined as an option or on method is called * - * @param {String} type Event type - * @param {Function} args Event Arguments - * @return {Mixed} + * @param type Event type + * @param args Event Arguments */ emit(type: string, args: () => void): any; /** - * @method on * A callback function defined as an on method is run when an emit method is called * - * @param {String} type Event type - * @param {Function} callback + * @param type Event type */ on(type: string, callback: () => void): void; /** - * @method off * Removes a custom event of an applicable type or callback handler * - * @param {String} type Event type + * @param type Event type */ off(type: string): void; /** - * @method addValid * Check the parameter type of a UI method and generates an alarm when a wrong value is entered * - * @param {String} name Method name - * @param {Array} params Parameters + * @param name Method name + * @param params Parameters */ addValid(name: string, params: any[]): void; /** - * @method callBefore * Sets a callback function that is called before a UI method is run * - * @param {String} name Method name - * @param {Function} callback - * @return {Mixed} + * @param name Method name */ callBefore(name: string, callback: () => void): void; /** - * @method callAfter * Sets a callback function that is called after a UI method is run * - * @param {String} name Method name - * @param {Function} callback - * @return {Mixed} + * @param name Method name */ callAfter(name: string, callback: () => void): void; /** - * @method callDelay * Sets a callback function and the delay time before/after a UI method is run * - * @param {String} name Method name - * @param {Function} callback + * @param name Method name */ callDelay(name: string, callObj: () => void): void; /** - * @method setTpl * Dynamically defines the template method of a UI * - * @param {String} name Template name - * @param {String} html Template markup + * @param name Template name + * @param html Template markup */ setTpl(name: string, html: string): void; /** - * @method setOption * Dynamically defines the options of a UI - * - * @param {String} key - * @param {Mixed} value */ setOption(key: string, value: any): void; - /** - * @method destroy - * Removes all events set in a UI obejct and the DOM element - * - */ destroy(): void; } @@ -544,11 +387,7 @@ export interface UIEvent extends UICore { root?: any; /** - * @method find * Get the child element of the root element - * - * @param {String/HTMLElement} Selector - * @returns {*|jQuery} */ find(selector: any): JQuery; } @@ -560,8 +399,6 @@ export class ColorScale { export interface UtilColor { /** - * @method format - * * convert color to format string * * // hex @@ -573,15 +410,12 @@ export interface UtilColor { * // rgba * color.format({ r : 255, g : 255, b : 255, a : 0.5 }, 'rgb') // rgba(255, 255, 255, 0.5); * - * @param {Object} obj obj has r, g, b and a attributes - * @param {"hex"/"rgb"} type format string type - * @returns {*} + * @param obj obj has r, g, b and a attributes + * @param type format string type */ format(obj: any, type: string): string; /** - * @method scale - * * get color scale * * var c = color.scale().domain('#FF0000', '#00FF00'); @@ -592,84 +426,68 @@ export interface UtilColor { * // get middle color list * c.ticks(20); // return array , [startColor, ......, endColor ] * - * @returns {func} scale function + * @returns scale function */ scale(): ColorScale; /** - * @method map - * * create color map * * var colorList = color.map(['#352a87', '#0f5cdd', '#00b5a6', '#ffc337', '#fdff00'], count) * - * @param {Array} color_list - * @param {Number} count a divide number - * @returns {Array} converted color list + * @param count a divide number + * @returns converted color list */ map(color_list: string[], count: number): string[]; /** - * @method rgb - * * parse string to rgb color * * color.rgb("#FF0000") === { r : 255, g : 0, b : 0 } * * color.rgb("rgb(255, 0, 0)") == { r : 255, g : 0, b : } * - * @param {String} str color string - * @returns {Object} rgb object + * @param str color string + * @returns rgb object */ rgb(str: string): any; /** - * @method HSVtoRGB - * * convert hsv to rgb * * color.HSVtoRGB(0,0,1) === #FFFFF === { r : 255, g : 0, b : 0 } * - * @param {Number} H hue color number (min : 0, max : 360) - * @param {Number} S Saturation number (min : 0, max : 1) - * @param {Number} V Value number (min : 0, max : 1 ) - * @returns {Object} + * @param H hue color number (min : 0, max : 360) + * @param S Saturation number (min : 0, max : 1) + * @param V Value number (min : 0, max : 1 ) */ HSVtoRGB(H: number, S: number, V: number): any; /** - * @method RGBtoHSV - * * convert rgb to hsv * * color.RGBtoHSV(0, 0, 255) === { h : 240, s : 1, v : 1 } === '#FFFF00' * - * @param {Number} R red color value - * @param {Number} G green color value - * @param {Number} B blue color value - * @return {Object} hsv color code + * @param R red color value + * @param G green color value + * @param B blue color value + * @return hsv color code */ RGBtoHSV(R: number, G: number, B: number): any; /** - * @method lighten - * * rgb 컬러 밝은 농도로 변환 * - * @param {String} color RGB color code - * @param {Number} rate 밝은 농도 - * @return {String} + * @param color RGB color code + * @param rate 밝은 농도 */ lighten(color: string, rate: number): string; /** - * @method darken - * * rgb 컬러 어두운 농도로 변환 * - * @param {String} color RGB color code - * @param {Number} rate 어두운 농도 - * @return {String} + * @param color RGB color code + * @param rate 어두운 농도 */ darken(color: string, rate: number): string; } @@ -680,63 +498,20 @@ export interface UtilBase64 { } export interface UtilKeyParser { - /** - * @method isIndexDepth - * - * @param {String} index - * @return {Boolean} - */ isIndexDepth(index: string): boolean; - - /** - * @method getIndexList - * - * @param {String} index - * @return {Array} - */ getIndexList(index: string): boolean; - - /** - * @method changeIndex - * - * - * @param {String} index - * @param {String} targetIndex - * @param {String} rootIndex - * @return {String} - */ changeIndex(index: string, targetIndex: string, rootIndex: string): string; - - /** - * @method getNextIndex - * - * @param {String} index - * @return {String} - */ getNextIndex(index: string): string; - - /** - * @method getParentIndex - * - * - * @param {String} index - * @returns {*} - */ getParentIndex(index: string): string; } export interface UtilMath { /** - * @method rotate - * * 2d rotate * - * @param {Number} x - * @param {Number} y - * @param {Number} radian roate 할 radian - * @return {Object} - * @return {Number} return.x 변환된 x - * @return {Number} return.y 변환된 y + * @param radian roate 할 radian + * @return return.x 변환된 x + * @return return.y 변환된 y * */ rotate(x: number, y: number, radian: number): any; @@ -744,35 +519,26 @@ export interface UtilMath { resize(maxWidth: number, maxHeight: number, objectWidth: number, objectHeight: number): any; /** - * @method radian - * * convert degree to radian * - * @param {Number} degree - * @return {Number} radian + * @return radian */ radian(degree: number): number; /** - * @method degree - * * convert radian to degree * - * @param {Number} radian - * @return {Number} degree + * @return degree */ degree(radian: number): number; angle(x1: number, y1: number, x2: number, y2: number): number; /** - * @method interpolateNumber - * * a, b 의 중간값 계산을 위한 callback 함수 만들기 * - * @param {Number} a first value - * @param {Number} b second value - * @return {Function} + * @param a first value + * @param b second value */ interpolateNumber(a: number, b: number): () => void; @@ -793,11 +559,6 @@ export interface UtilMath { /** * 특정 구간의 값을 자동으로 계산 - * - * @param {Object} min - * @param {Object} max - * @param {Object} ticks - * @param {Object} isNice */ nice(min: number, max: number, ticks: number, isNice: boolean): any; From 1f9ccc2e90b3732ee307ca545250f928ff30beb1 Mon Sep 17 00:00:00 2001 From: Andy Date: Mon, 23 Oct 2017 11:35:43 -0700 Subject: [PATCH 015/252] markerclustererplus: Fix lint (#20894) --- types/markerclustererplus/index.d.ts | 212 ++++++++++++--------------- 1 file changed, 97 insertions(+), 115 deletions(-) diff --git a/types/markerclustererplus/index.d.ts b/types/markerclustererplus/index.d.ts index c358ce088b..3277d1ba64 100644 --- a/types/markerclustererplus/index.d.ts +++ b/types/markerclustererplus/index.d.ts @@ -43,7 +43,8 @@ interface ClusterIconStyle { * property for the label text shown on the cluster icon. */ textDecoration?: string; - /** [fontWeight="bold"] The value of the CSS font-weight + /** + * [fontWeight="bold"] The value of the CSS font-weight * property for the label text shown on the cluster icon. */ fontWeight?: string; @@ -68,14 +69,9 @@ interface ClusterIconStyle { } /** - * @name ClusterIconInfo - * @class This class is an object containing general information about a cluster icon. This is * the object that a calculator function returns. * - * @property {string} text The text of the label to be shown on the cluster icon. - * @property {number} index The index plus 1 of the element in the styles * array to be used to style the cluster icon. - * @property {string} title The tooltip to display when the mouse moves over the cluster icon. * If this value is undefined or "", title is set to the * value of the title property passed to the MarkerClusterer. */ @@ -89,12 +85,10 @@ declare class ClusterIcon extends google.maps.OverlayView { /** * A cluster icon. * - * @constructor * @extends google.maps.OverlayView - * @param {Cluster} cluster The cluster with which the icon is to be associated. - * @param {Array} [styles] An array of {@link ClusterIconStyle} defining the cluster icons + * @param cluster The cluster with which the icon is to be associated. + * @param [styles] An array of {@link ClusterIconStyle} defining the cluster icons * to use for various cluster sizes. - * @private */ constructor(cluster: Cluster, styles: ClusterIconStyle[]); @@ -126,30 +120,30 @@ declare class ClusterIcon extends google.maps.OverlayView { /** * Sets the icon styles to the appropriate element in the styles array. * - * @param {ClusterIconInfo} style The icon label text and styles index. + * @param style The icon label text and styles index. */ useStyle(style: ClusterIconInfo): void; /** * Sets the position at which to center the icon. * - * @param {google.maps.LatLng} center The latlng to set as the center. + * @param center The latlng to set as the center. */ setCenter(center: google.maps.LatLng): void; /** * Creates the cssText style parameter based on the position of the icon. * - * @param {google.maps.Point} pos The position of the icon. - * @return {string} The CSS style text. + * @param pos The position of the icon. + * @return The CSS style text. */ createCss(pos: google.maps.Point): string; /** * Returns the position at which to place the DIV depending on the latlng. * - * @param {google.maps.LatLng} latLng The position in latlng. - * @return {google.maps.Point} The position in pixels. + * @param latLng The position in latlng. + * @return The position in pixels. */ getPosFromLatLng_(latLng: google.maps.LatLng): google.maps.Point; } @@ -158,8 +152,7 @@ declare class Cluster { /** * Creates a single cluster that manages a group of proximate markers. * Used internally, do not call this constructor directly. - * @constructor - * @param {MarkerClusterer} mc The MarkerClusterer object with which this + * @param mc The MarkerClusterer object with which this * cluster is associated. */ constructor(mc: MarkerClusterer); @@ -169,7 +162,7 @@ declare class Cluster { * a click, mouseover, or mouseout event handler * for the MarkerClusterer object. * - * @return {number} The number of markers in the cluster. + * @return The number of markers in the cluster. */ getSize(): number; @@ -178,7 +171,7 @@ declare class Cluster { * a click, mouseover, or mouseout event handler * for the MarkerClusterer object. * - * @return {Array} The array of markers in the cluster. + * @return The array of markers in the cluster. */ getMarkers(): google.maps.Marker[]; @@ -187,14 +180,14 @@ declare class Cluster { * a click, mouseover, or mouseout event handler * for the MarkerClusterer object. * - * @return {google.maps.LatLng} The center of the cluster. + * @return The center of the cluster. */ getCenter(): google.maps.LatLng; /** * Returns the map with which the cluster is associated. * - * @return {google.maps.Map} The map. + * @return The map. * @ignore */ getMap(): google.maps.Map; @@ -202,7 +195,7 @@ declare class Cluster { /** * Returns the MarkerClusterer object with which the cluster is associated. * - * @return {MarkerClusterer} The associated marker clusterer. + * @return The associated marker clusterer. * @ignore */ getMarkerClusterer(): MarkerClusterer; @@ -210,7 +203,7 @@ declare class Cluster { /** * Returns the bounds of the cluster. * - * @return {google.maps.LatLngBounds} the cluster bounds. + * @return the cluster bounds. * @ignore */ getBounds(): google.maps.LatLngBounds; @@ -225,8 +218,8 @@ declare class Cluster { /** * Adds a marker to the cluster. * - * @param {google.maps.Marker} marker The marker to be added. - * @return {boolean} True if the marker was added. + * @param marker The marker to be added. + * @return True if the marker was added. * @ignore */ addMarker(marker: google.maps.Marker): boolean; @@ -234,8 +227,8 @@ declare class Cluster { /** * Determines if a marker lies within the cluster's bounds. * - * @param {google.maps.Marker} marker The marker to check. - * @return {boolean} True if the marker lies in the bounds. + * @param marker The marker to check. + * @return True if the marker lies in the bounds. * @ignore */ isMarkerInClusterBounds(marker: google.maps.Marker): boolean; @@ -253,8 +246,8 @@ declare class Cluster { /** * Determines if a marker has already been added to the cluster. * - * @param {google.maps.Marker} marker The marker to check. - * @return {boolean} True if the marker has already been added. + * @param marker The marker to check. + * @return True if the marker has already been added. */ isMarkerAlreadyAdded_(marker: google.maps.Marker): boolean; } @@ -267,7 +260,8 @@ type Calculator = (markers: google.maps.Marker[], clusterIconStylesCount: number interface MarkerClustererOptions { /** [gridSize=60] The grid size of a cluster in pixels. The grid is a square. */ gridSize?: number; - /** [maxZoom=null] The maximum zoom level at which clustering is enabled or + /** + * [maxZoom=null] The maximum zoom level at which clustering is enabled or * null if clustering is to be enabled at all zoom levels. */ maxZoom?: number; @@ -384,11 +378,10 @@ interface MarkerClustererOptions { declare class MarkerClusterer extends google.maps.OverlayView { /** * Creates a MarkerClusterer object with the options specified in {@link MarkerClustererOptions}. - * @constructor * @extends google.maps.OverlayView - * @param {google.maps.Map} map The Google map to attach to. - * @param {Array.} [markers] The markers to be added to the cluster. - * @param {MarkerClustererOptions} [options] The optional parameters. + * @param map The Google map to attach to. + * @param [markers] The markers to be added to the cluster. + * @param [options] The optional parameters. */ constructor(map: google.maps.Map, markers?: google.maps.Marker[], options?: MarkerClustererOptions); @@ -425,182 +418,182 @@ declare class MarkerClusterer extends google.maps.OverlayView { /** * Returns the value of the gridSize property. * - * @return {number} The grid size. + * @return The grid size. */ getGridSize(): number; /** * Sets the value of the gridSize property. * - * @param {number} gridSize The grid size. + * @param gridSize The grid size. */ setGridSize(gridSize: number): void; /** * Returns the value of the minimumClusterSize property. * - * @return {number} The minimum cluster size. + * @return The minimum cluster size. */ getMinimumClusterSize(): number; /** * Sets the value of the minimumClusterSize property. * - * @param {number} minimumClusterSize The minimum cluster size. + * @param minimumClusterSize The minimum cluster size. */ setMinimumClusterSize(minimumClusterSize: number): void; /** * Returns the value of the maxZoom property. * - * @return {number} The maximum zoom level. + * @return The maximum zoom level. */ getMaxZoom(): number; /** * Sets the value of the maxZoom property. * - * @param {number} maxZoom The maximum zoom level. + * @param maxZoom The maximum zoom level. */ setMaxZoom(maxZoom: number): void; /** * Returns the value of the styles property. * - * @return {Array} The array of styles defining the cluster markers to be used. + * @return The array of styles defining the cluster markers to be used. */ getStyles(): ClusterIconStyle[]; /** * Sets the value of the styles property. * - * @param {Array.} styles The array of styles to use. + * @param styles The array of styles to use. */ setStyles(styles: ClusterIconStyle[]): void; /** * Returns the value of the title property. * - * @return {string} The content of the title text. + * @return The content of the title text. */ getTitle(): string; /** * Sets the value of the title property. * - * @param {string} title The value of the title property. + * @param title The value of the title property. */ setTitle(title: string): void; /** * Returns the value of the zoomOnClick property. * - * @return {boolean} True if zoomOnClick property is set. + * @return True if zoomOnClick property is set. */ getZoomOnClick(): boolean; /** * Sets the value of the zoomOnClick property. * - * @param {boolean} zoomOnClick The value of the zoomOnClick property. + * @param zoomOnClick The value of the zoomOnClick property. */ setZoomOnClick(zoomOnClick: boolean): void; /** * Returns the value of the averageCenter property. * - * @return {boolean} True if averageCenter property is set. + * @return True if averageCenter property is set. */ getAverageCenter(): boolean; /** * Sets the value of the averageCenter property. * - * @param {boolean} averageCenter The value of the averageCenter property. + * @param averageCenter The value of the averageCenter property. */ setAverageCenter(averageCenter: boolean): void; /** * Returns the value of the ignoreHidden property. * - * @return {boolean} True if ignoreHidden property is set. + * @return True if ignoreHidden property is set. */ getIgnoreHidden(): boolean; /** * Sets the value of the ignoreHidden property. * - * @param {boolean} ignoreHidden The value of the ignoreHidden property. + * @param ignoreHidden The value of the ignoreHidden property. */ setIgnoreHidden(ignoreHidden: boolean): void; /** * Returns the value of the enableRetinaIcons property. * - * @return {boolean} True if enableRetinaIcons property is set. + * @return True if enableRetinaIcons property is set. */ getEnableRetinaIcons(): boolean; /** * Sets the value of the enableRetinaIcons property. * - * @param {boolean} enableRetinaIcons The value of the enableRetinaIcons property. + * @param enableRetinaIcons The value of the enableRetinaIcons property. */ setEnableRetinaIcons(enableRetinaIcons: boolean): void; /** * Returns the value of the imageExtension property. * - * @return {string} The value of the imageExtension property. + * @return The value of the imageExtension property. */ getImageExtension(): string; /** * Sets the value of the imageExtension property. * - * @param {string} imageExtension The value of the imageExtension property. + * @param imageExtension The value of the imageExtension property. */ setImageExtension(imageExtension: string): void; /** * Returns the value of the imagePath property. * - * @return {string} The value of the imagePath property. + * @return The value of the imagePath property. */ getImagePath(): string; /** * Sets the value of the imagePath property. * - * @param {string} imagePath The value of the imagePath property. + * @param imagePath The value of the imagePath property. */ setImagePath(imagePath: string): void; /** * Returns the value of the imageSizes property. * - * @return {Array} The value of the imageSizes property. + * @return The value of the imageSizes property. */ getImageSizes(): number[]; /** * Sets the value of the imageSizes property. * - * @param {Array} imageSizes The value of the imageSizes property. + * @param imageSizes The value of the imageSizes property. */ setImageSizes(imageSizes: number[]): void; /** * Returns the value of the calculator property. * - * @return {function} the value of the calculator property. + * @return the value of the calculator property. */ getCalculator(): Calculator; /** * Sets the value of the calculator property. * - * @param {function(Array., number)} calculator The value + * @param calculator The value * of the calculator property. */ setCalculator(calculator: Calculator): void; @@ -608,70 +601,70 @@ declare class MarkerClusterer extends google.maps.OverlayView { /** * Sets the value of the hideLabel property. * - * @param {boolean} printable The value of the hideLabel property. + * @param printable The value of the hideLabel property. */ setHideLabel(printable: boolean): void; /** * Returns the value of the hideLabel property. * - * @return {boolean} the value of the hideLabel property. + * @return the value of the hideLabel property. */ getHideLabel(): boolean; /** * Returns the value of the batchSizeIE property. * - * @return {number} the value of the batchSizeIE property. + * @return the value of the batchSizeIE property. */ getBatchSizeIE(): number; /** * Sets the value of the batchSizeIE property. * - * @param {number} batchSizeIE The value of the batchSizeIE property. + * @param batchSizeIE The value of the batchSizeIE property. */ setBatchSizeIE(batchSizeIE: number): void; /** * Returns the value of the clusterClass property. * - * @return {string} the value of the clusterClass property. + * @return the value of the clusterClass property. */ getClusterClass(): string; /** * Sets the value of the clusterClass property. * - * @param {string} clusterClass The value of the clusterClass property. + * @param clusterClass The value of the clusterClass property. */ setClusterClass(clusterClass: string): void; /** * Returns the array of markers managed by the clusterer. * - * @return {Array} The array of markers managed by the clusterer. + * @return The array of markers managed by the clusterer. */ getMarkers(): google.maps.Marker[]; /** * Returns the number of markers managed by the clusterer. * - * @return {number} The number of markers. + * @return The number of markers. */ getTotalMarkers(): number; /** * Returns the current array of clusters formed by the clusterer. * - * @return {Array} The array of clusters formed by the clusterer. + * @return The array of clusters formed by the clusterer. */ getClusters(): Cluster[]; /** * Returns the number of clusters formed by the clusterer. * - * @return {number} The number of clusters formed by the clusterer. + * @return The number of clusters formed by the clusterer. */ getTotalClusters(): number; @@ -679,8 +672,8 @@ declare class MarkerClusterer extends google.maps.OverlayView { * Adds a marker to the clusterer. The clusters are redrawn unless * noDraw is set to true. * - * @param {google.maps.Marker} marker The marker to add. - * @param {boolean} [noDraw] Set to true to prevent redrawing. + * @param marker The marker to add. + * @param [noDraw] Set to true to prevent redrawing. */ addMarker(marker: google.maps.Marker, noDraw?: boolean): void; @@ -688,15 +681,15 @@ declare class MarkerClusterer extends google.maps.OverlayView { * Adds an array of markers to the clusterer. The clusters are redrawn unless * noDraw is set to true. * - * @param {Array.} markers The markers to add. - * @param {boolean} [noDraw] Set to true to prevent redrawing. + * @param markers The markers to add. + * @param [noDraw] Set to true to prevent redrawing. */ addMarkers(markers: google.maps.Marker[], noDraw?: boolean): void; /** * Pushes a marker to the clusterer. * - * @param {google.maps.Marker} marker The marker to add. + * @param marker The marker to add. */ pushMarkerTo_(marker: google.maps.Marker): void; @@ -705,10 +698,10 @@ declare class MarkerClusterer extends google.maps.OverlayView { * noDraw is set to true. Returns true if the * marker was removed from the clusterer. * - * @param {google.maps.Marker} marker The marker to remove. - * @param {boolean} [noDraw] Set to true to prevent redrawing. - * @param {boolean} [noMapRemove] Set to true to prevent removal from map but still removing from cluster management - * @return {boolean} True if the marker was removed from the clusterer. + * @param marker The marker to remove. + * @param [noDraw] Set to true to prevent redrawing. + * @param [noMapRemove] Set to true to prevent removal from map but still removing from cluster management + * @return True if the marker was removed from the clusterer. */ removeMarker(marker: google.maps.Marker, noDraw?: boolean, noMapRemove?: boolean): boolean; @@ -717,19 +710,19 @@ declare class MarkerClusterer extends google.maps.OverlayView { * noDraw is set to true. Returns true if markers * were removed from the clusterer. * - * @param {Array.} markers The markers to remove. - * @param {boolean} [noDraw] Set to true to prevent redrawing. - * @param {boolean} [noMapRemove] Set to true to prevent removal from map but still removing from cluster management - * @return {boolean} True if markers were removed from the clusterer. + * @param markers The markers to remove. + * @param [noDraw] Set to true to prevent redrawing. + * @param [noMapRemove] Set to true to prevent removal from map but still removing from cluster management + * @return True if markers were removed from the clusterer. */ removeMarkers(markers: google.maps.Marker[], noDraw?: boolean, noMapRemove?: boolean): boolean; /** * Removes a marker and returns true if removed, false if not. * - * @param {google.maps.Marker} marker The marker to remove - * @param {boolean} removeFromMap set to true to explicitly remove from map as well as cluster manangement - * @return {boolean} Whether the marker was removed or not + * @param marker The marker to remove + * @param removeFromMap set to true to explicitly remove from map as well as cluster manangement + * @return Whether the marker was removed or not */ removeMarker_(marker: google.maps.Marker, removeFromMap?: boolean): boolean; @@ -748,8 +741,8 @@ declare class MarkerClusterer extends google.maps.OverlayView { /** * Returns the current bounds extended by the grid size. * - * @param {google.maps.LatLngBounds} bounds The bounds to extend. - * @return {google.maps.LatLngBounds} The extended bounds. + * @param bounds The bounds to extend. + * @return The extended bounds. * @ignore */ getExtendedBounds(bounds: google.maps.LatLngBounds): google.maps.LatLngBounds; @@ -763,7 +756,7 @@ declare class MarkerClusterer extends google.maps.OverlayView { * Removes all clusters from the map. The markers are also removed from the map * if hide is set to true. * - * @param {boolean} [hide] Set to true to also remove the markers + * @param [hide] Set to true to also remove the markers * from the map. */ resetViewport_(hide?: boolean): void; @@ -771,9 +764,9 @@ declare class MarkerClusterer extends google.maps.OverlayView { /** * Calculates the distance between two latlng locations in km. * - * @param {google.maps.LatLng} p1 The first lat lng point. - * @param {google.maps.LatLng} p2 The second lat lng point. - * @return {number} The distance between the two points in km. + * @param p1 The first lat lng point. + * @param p2 The second lat lng point. + * @return The distance between the two points in km. * @see http://www.movable-type.co.uk/scripts/latlong.html */ distanceBetweenPoints_(p1: google.maps.LatLng, p2: google.maps.LatLng): number; @@ -781,16 +774,16 @@ declare class MarkerClusterer extends google.maps.OverlayView { /** * Determines if a marker is contained in a bounds. * - * @param {google.maps.Marker} marker The marker to check. - * @param {google.maps.LatLngBounds} bounds The bounds to check against. - * @return {boolean} True if the marker is in the bounds. + * @param marker The marker to check. + * @param bounds The bounds to check against. + * @return True if the marker is in the bounds. */ isMarkerInBounds_(marker: google.maps.Marker, bounds: google.maps.LatLngBounds): boolean; /** * Adds a marker to a cluster, or creates a new cluster. * - * @param {google.maps.Marker} marker The marker to add. + * @param marker The marker to add. */ addToClosestCluster_(marker: google.maps.Marker): void; @@ -798,7 +791,7 @@ declare class MarkerClusterer extends google.maps.OverlayView { * Creates the clusters. This is done in batches to avoid timeout errors * in some browsers when there is a huge number of markers. * - * @param {number} iFirst The index of the first marker in the batch of + * @param iFirst The index of the first marker in the batch of * markers to be added to clusters. */ createClusters_(iFirst: number): void; @@ -806,9 +799,9 @@ declare class MarkerClusterer extends google.maps.OverlayView { /** * Extends an object's prototype by another's. * - * @param {object} obj1 The object to be extended. - * @param {object} obj2 The object to extend with. - * @return {object} The new extended object. + * @param obj1 The object to be extended. + * @param obj2 The object to extend with. + * @return The new extended object. * @ignore */ extend(obj1: object, obj2: object): object; @@ -817,10 +810,9 @@ declare class MarkerClusterer extends google.maps.OverlayView { * The default function for determining the label text and style * for a cluster icon. * - * @param {Array.} markers The array of markers represented by the cluster. - * @param {number} numStyles The number of marker styles available. - * @return {ClusterIconInfo} The information resource for the cluster. - * @constant + * @param markers The array of markers represented by the cluster. + * @param numStyles The number of marker styles available. + * @return The information resource for the cluster. * @ignore */ static CALCULATOR: Calculator; @@ -828,40 +820,30 @@ declare class MarkerClusterer extends google.maps.OverlayView { /** * The number of markers to process in one batch. * - * @type {number} - * @constant */ static BATCH_SIZE: number; /** * The number of markers to process in one batch (IE only). * - * @type {number} - * @constant */ static BATCH_SIZE_IE: number; /** * The default root name for the marker cluster images. * - * @type {string} - * @constant */ static IMAGE_PATH: string; /** * The default extension name for the marker cluster images. * - * @type {string} - * @constant */ static IMAGE_EXTENSION: string; /** * The default array of sizes for the marker cluster images. * - * @type {Array.} - * @constant */ static IMAGE_SIZES: number[]; } From 9079d176664fffa7d6c87609ff45839bb8dd1c56 Mon Sep 17 00:00:00 2001 From: makepost Date: Mon, 23 Oct 2017 21:37:58 +0300 Subject: [PATCH 016/252] [express] Body parsing middleware included in 4.16 (#20624) * express.json() and express.urlencoded() * Express: Add tslint.json --- types/express/express-tests.ts | 135 ++++++++++++++++++--------------- types/express/index.d.ts | 16 +++- types/express/tslint.json | 12 +++ 3 files changed, 99 insertions(+), 64 deletions(-) create mode 100644 types/express/tslint.json diff --git a/types/express/express-tests.ts b/types/express/express-tests.ts index 62e9fc7124..0c1081b49b 100644 --- a/types/express/express-tests.ts +++ b/types/express/express-tests.ts @@ -1,109 +1,122 @@ import * as express from 'express'; namespace express_tests { - - var app = express(); + const app = express(); app.engine('jade', require('jade').__express); app.engine('html', require('ejs').renderFile); express.static.mime.define({ - 'application/fx': ['fx'] + 'application/fx': ['fx'] }); app.use('/static', express.static(__dirname + '/public')); // simple logger - app.use(function(req, res, next) { - console.log('%s %s', req.method, req.url); - next(); + app.use((req, res, next) => { + console.log('%s %s', req.method, req.url); + next(); }); - app.use(function(err: any, req: express.Request, res: express.Response, next: express.NextFunction) { - console.error(err); - next(err); + app.use((err: any, req: express.Request, res: express.Response, next: express.NextFunction) => { + console.error(err); + next(err); }); + app.get('/', (req, res) => { + res.send('hello world'); + }); - app.get('/', function(req, res) { - res.send('hello world'); + // Accept json app-wide or on one endpoint. + app.use(express.json({ limit: "200kb" })); + app.post('/echo', express.json(), (req, res) => { + res.json(req.body); + }); + + // Accept urlencoded app-wide or on one endpoint. + app.use(express.urlencoded({ + extended: false, + parameterLimit: 16 + })); + app.post('/search', express.urlencoded(), (req, res) => { + res.json(Object.keys(req.body)); }); const router = express.Router({ caseSensitive: true, mergeParams: true, strict: true }); - const pathStr: string = 'test'; + const pathStr = 'test'; const pathRE: RegExp = /test/; const path = true ? pathStr : pathRE; router.get(path); - router.put(path) + router.put(path); router.post(path); router.delete(path); router.get(pathStr); - router.put(pathStr) + router.put(pathStr); router.post(pathStr); router.delete(pathStr); router.get(pathRE); - router.put(pathRE) + router.put(pathRE); router.post(pathRE); router.delete(pathRE); - router.use((req, res, next) => { next(); }) + router.use((req, res, next) => { next(); }); router.route('/users') - .get((req, res, next) => { - let types: string[] = req.accepts(); - let type: string | false = req.accepts('json'); - type = req.accepts(['json', 'text']); - type = req.accepts('json', 'text'); + .get((req, res, next) => { + const types: string[] = req.accepts(); + let type: string | false = req.accepts('json'); + type = req.accepts(['json', 'text']); + type = req.accepts('json', 'text'); - let charsets: string[] = req.acceptsCharsets(); - let charset: string | false = req.acceptsCharsets('utf-8'); - charset = req.acceptsCharsets(['utf-8', 'utf-16']); - charset = req.acceptsCharsets('utf-8', 'utf-16'); + const charsets: string[] = req.acceptsCharsets(); + let charset: string | false = req.acceptsCharsets('utf-8'); + charset = req.acceptsCharsets(['utf-8', 'utf-16']); + charset = req.acceptsCharsets('utf-8', 'utf-16'); - let encodings: string[] = req.acceptsEncodings(); - let encoding: string | false = req.acceptsEncodings('gzip'); - encoding = req.acceptsEncodings(['gzip', 'deflate']); - encoding = req.acceptsEncodings('gzip', 'deflate'); + const encodings: string[] = req.acceptsEncodings(); + let encoding: string | false = req.acceptsEncodings('gzip'); + encoding = req.acceptsEncodings(['gzip', 'deflate']); + encoding = req.acceptsEncodings('gzip', 'deflate'); - let languages: string[] = req.acceptsLanguages(); - let language: string | false = req.acceptsLanguages('en'); - language = req.acceptsLanguages(['en', 'ja']); - language = req.acceptsLanguages('en', 'ja'); + const languages: string[] = req.acceptsLanguages(); + let language: string | false = req.acceptsLanguages('en'); + language = req.acceptsLanguages(['en', 'ja']); + language = req.acceptsLanguages('en', 'ja'); - // downcasting - req.get('set-cookie') as undefined; - req.get('set-cookie') as string[]; - const setCookieHeader1 = req.get('set-cookie'); - if (setCookieHeader1 !== undefined) { - const setCookieHeader2: string[] = setCookieHeader1; - } - req.get('header') as undefined; - req.get('header') as string; - const header1 = req.get('header'); - if (header1 !== undefined) { - const header2: string = header1; - } + // downcasting + req.get('set-cookie') as undefined; + req.get('set-cookie') as string[]; + const setCookieHeader1 = req.get('set-cookie'); + if (setCookieHeader1 !== undefined) { + const setCookieHeader2: string[] = setCookieHeader1; + } + req.get('header') as undefined; + req.get('header') as string; + const header1 = req.get('header'); + if (header1 !== undefined) { + const header2: string = header1; + } - // upcasting - const setCookieHeader3: string[] | undefined = req.get('set-cookie'); - const header3: string | undefined = req.header('header'); + // upcasting + const setCookieHeader3: string[] | undefined = req.get('set-cookie'); + const header3: string | undefined = req.header('header'); - req.headers.existingHeader as string; - req.headers.nonExistingHeader as any as undefined; + req.headers.existingHeader as string; + req.headers.nonExistingHeader as any as undefined; - res.send(req.query['token']); - }); + res.send(req.query['token']); + }); - router.get('/user/:id', function(req, res, next) { - if (req.params.id == 0) next('route'); - else next(); - }, function(req, res, next) { - res.render('regular'); + router.get('/user/:id', (req, res, next) => { + if (Number(req.params.id) === 0) next('route'); + else next(); + }, (req, res, next) => { + res.render('regular'); }); app.use((req, res, next) => { - // hacky trick, router is just a handler - router(req, res, next); + // hacky trick, router is just a handler + router(req, res, next); }); app.use(router); @@ -120,9 +133,7 @@ namespace express_tests { ***************************/ import * as http from 'http'; - namespace node_tests { - { // http.createServer can take express application const app: express.Application = express(); diff --git a/types/express/index.d.ts b/types/express/index.d.ts index e127d6d5ed..59f60e92df 100644 --- a/types/express/index.d.ts +++ b/types/express/index.d.ts @@ -14,6 +14,7 @@ /// /// +import * as bodyParser from "body-parser"; import * as serveStatic from "serve-static"; import * as core from "express-serve-static-core"; @@ -23,12 +24,23 @@ import * as core from "express-serve-static-core"; declare function e(): core.Express; declare namespace e { + /** + * This is a built-in middleware function in Express. It parses incoming requests with JSON payloads and is based on body-parser. + * @since 4.16.0 + */ + var json: typeof bodyParser.json; /** - * This is the only built-in middleware function in Express. It serves static files and is based on serve-static. + * This is a built-in middleware function in Express. It serves static files and is based on serve-static. */ var static: typeof serveStatic; + /** + * This is a built-in middleware function in Express. It parses incoming requests with urlencoded payloads and is based on body-parser. + * @since 4.16.0 + */ + var urlencoded: typeof bodyParser.urlencoded; + export function Router(options?: RouterOptions): core.Router; interface RouterOptions { @@ -60,7 +72,7 @@ declare namespace e { interface Handler extends core.Handler { } interface IRoute extends core.IRoute { } interface IRouter extends core.IRouter { } - interface IRouterHandler extends core.IRouterHandler { } + interface IRouterHandler extends core.IRouterHandler { } interface IRouterMatcher extends core.IRouterMatcher { } interface MediaType extends core.MediaType { } interface NextFunction extends core.NextFunction { } diff --git a/types/express/tslint.json b/types/express/tslint.json new file mode 100644 index 0000000000..7b39baf22b --- /dev/null +++ b/types/express/tslint.json @@ -0,0 +1,12 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + // Not sure if changing these won't break apps. + "interface-name": false, + "no-empty-interface": false, + "no-namespace": false, + "no-reference-import": false, + "no-var-keyword": false, + "strict-export-declare-modifiers": false + } +} \ No newline at end of file From 9fe8f1b8a46f523cec18336004c0c92d5ec8d7e8 Mon Sep 17 00:00:00 2001 From: Ivan Gabriele Date: Mon, 23 Oct 2017 20:39:55 +0200 Subject: [PATCH 017/252] argon2-browser: create typings (#20753) --- types/argon2-browser/argon2-browser-tests.ts | 20 +++++++++++++ types/argon2-browser/index.d.ts | 31 ++++++++++++++++++++ types/argon2-browser/tsconfig.json | 23 +++++++++++++++ types/argon2-browser/tslint.json | 1 + 4 files changed, 75 insertions(+) create mode 100644 types/argon2-browser/argon2-browser-tests.ts create mode 100644 types/argon2-browser/index.d.ts create mode 100644 types/argon2-browser/tsconfig.json create mode 100644 types/argon2-browser/tslint.json diff --git a/types/argon2-browser/argon2-browser-tests.ts b/types/argon2-browser/argon2-browser-tests.ts new file mode 100644 index 0000000000..1c1d77032c --- /dev/null +++ b/types/argon2-browser/argon2-browser-tests.ts @@ -0,0 +1,20 @@ +import { argon2 } from 'argon2-browser'; + +const mandatoryOptions = { + pass: 'Qwerty12?', + salt: 'Salty' +}; + +(async () => { + (await argon2.hash(mandatoryOptions)).encoded; // string + (await argon2.hash(mandatoryOptions)).hash; // Uint8Array + (await argon2.hash(mandatoryOptions)).hashHex; // string + + (await argon2.hash({ ...mandatoryOptions, distPath: 'path' })).encoded; // string + (await argon2.hash({ ...mandatoryOptions, hashLen: 24 })).encoded; // string + (await argon2.hash({ ...mandatoryOptions, mem: 1024 })).encoded; // string + (await argon2.hash({ ...mandatoryOptions, parallelism: 1 })).encoded; // string + (await argon2.hash({ ...mandatoryOptions, time: 1 })).encoded; // string + (await argon2.hash({ ...mandatoryOptions, type: argon2.ArgonType.Argon2d })).encoded; // string + (await argon2.hash({ ...mandatoryOptions, type: argon2.ArgonType.Argon2i })).encoded; // string +})(); diff --git a/types/argon2-browser/index.d.ts b/types/argon2-browser/index.d.ts new file mode 100644 index 0000000000..5e7a5b571b --- /dev/null +++ b/types/argon2-browser/index.d.ts @@ -0,0 +1,31 @@ +// Type definitions for argon2-browser 1.1 +// Project: https://github.com/antelle/argon2-browser#readme +// Definitions by: Ivan Gabriele +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +export namespace argon2 { + function hash(options: Argon2BrowserHashOptions): Promise; + + interface Argon2BrowserHashOptions { + distPath?: string; + hashLen?: number; + mem?: number; + parallelism?: number; + pass: string; + salt: string; + time?: number; + type?: ArgonType; + } + + interface Argon2BrowserHashResult { + encoded: string; + hash: Uint8Array; + hashHex: string; + } + + enum ArgonType { + Argon2d = 0, + Argon2i = 1 + } +} diff --git a/types/argon2-browser/tsconfig.json b/types/argon2-browser/tsconfig.json new file mode 100644 index 0000000000..a380778b29 --- /dev/null +++ b/types/argon2-browser/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", + "argon2-browser-tests.ts" + ] +} diff --git a/types/argon2-browser/tslint.json b/types/argon2-browser/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/argon2-browser/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 8abe0458f0dc164ac66f322eb3b5e87afb4d28dd Mon Sep 17 00:00:00 2001 From: Piotr Roszatycki Date: Mon, 23 Oct 2017 20:41:03 +0200 Subject: [PATCH 018/252] Type definitions for ultra-strftime 1.0 (#20869) --- types/ultra-strftime/index.d.ts | 59 ++++++++++++++++++++ types/ultra-strftime/tsconfig.json | 23 ++++++++ types/ultra-strftime/tslint.json | 3 + types/ultra-strftime/ultra-strftime-tests.ts | 41 ++++++++++++++ 4 files changed, 126 insertions(+) create mode 100644 types/ultra-strftime/index.d.ts create mode 100644 types/ultra-strftime/tsconfig.json create mode 100644 types/ultra-strftime/tslint.json create mode 100644 types/ultra-strftime/ultra-strftime-tests.ts diff --git a/types/ultra-strftime/index.d.ts b/types/ultra-strftime/index.d.ts new file mode 100644 index 0000000000..f02d27d43f --- /dev/null +++ b/types/ultra-strftime/index.d.ts @@ -0,0 +1,59 @@ +// Type definitions for ultra-strftime 1.0 +// Project: https://github.com/xio4/ultra_strftime +// Definitions by: Piotr Roszatycki +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare function strftime(fmt: string, d?: Date, locale?: strftime.Locale, options?: strftime.Options): string; +declare function strftime(fmt: string, locale?: strftime.Locale, options?: strftime.Options): string; + +declare namespace strftime { + type StrftimeFunction = (fmt: string, d?: Date, options?: Options) => string; + + interface LocaleFormats { + /** equivalent to %m/%d/%y in en_US */ + D: string; + /** equivalent to %Y-%m-%d in en_US */ + F: string; + /** equivalent to %H:%M in en_US */ + R: string; + /** equivalent to %D in en_US */ + X: string; + /** equivalent to %a %b %d %X %Y %Z in en_US */ + c: string; + /** equivalent to %I:%M:%S %p in en_US */ + r: string; + /** equivalent to %H:%M:%S in en_US */ + T: string; + /** equivalent to %e-%b-%Y in en_US */ + v: string; + /** equivalent to %T in en_US */ + x: string; + } + + interface Locale { + days: string[]; + shortDays: string[]; + months: string[]; + shortMonths: string[]; + AM: string; + PM: string; + am: string; + pm: string; + formats: LocaleFormats; + } + + interface Options { + timezone?: string | number; + utc?: boolean; + } + + function strftimeUTC(fmt: string, d?: Date, locale?: Locale): string; + function strftimeTZ(fmt: string, d: Date, locale: Locale, timezone: number): string; + function strftimeTZ(fmt: string, d: Date, timezone: number): string; + function localizedStrftime(locale: Locale): StrftimeFunction; + + function strftime(fmt: string, d?: Date, locale?: Locale, options?: Options): string; + function strftime(fmt: string, locale?: Locale, options?: Options): string; +} + +export = strftime; diff --git a/types/ultra-strftime/tsconfig.json b/types/ultra-strftime/tsconfig.json new file mode 100644 index 0000000000..3b9461c0b6 --- /dev/null +++ b/types/ultra-strftime/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", + "ultra-strftime-tests.ts" + ] +} \ No newline at end of file diff --git a/types/ultra-strftime/tslint.json b/types/ultra-strftime/tslint.json new file mode 100644 index 0000000000..e60c15844f --- /dev/null +++ b/types/ultra-strftime/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file diff --git a/types/ultra-strftime/ultra-strftime-tests.ts b/types/ultra-strftime/ultra-strftime-tests.ts new file mode 100644 index 0000000000..4439425663 --- /dev/null +++ b/types/ultra-strftime/ultra-strftime-tests.ts @@ -0,0 +1,41 @@ +import * as strftime from "ultra-strftime"; + +const it_IT = { + days: ['domenica', 'lunedi', 'martedi', 'mercoledi', 'giovedi', 'venerdi', 'sabato'], + shortDays: ['dom', 'lun', 'mar', 'mer', 'gio', 'ven', 'sab'], + months: ['gennaio', 'febbraio', 'marzo', 'aprile', 'maggio', 'giugno', 'luglio', 'agosto', 'settembre', 'ottobre', 'novembre', 'dicembre'], + shortMonths: ['gen', 'feb', 'mar', 'apr', 'mag', 'giu', 'lug', 'ago', 'set', 'ott', 'nov', 'dic'], + AM: 'AM', + PM: 'PM', + am: 'am', + pm: 'pm', + formats: { + D: '%m/%d/%y', + F: '%Y-%m-%d', + R: '%H:%M', + X: '%T', + c: '%a %b %d %X %Y', + r: '%I:%M:%S %p', + T: '%H:%M:%S', + v: '%e-%b-%Y', + x: '%D' + } +}; + +strftime('%B %d, %Y %H:%M:%S'); +strftime('%B %d, %Y %H:%M:%S', new Date(1307472705067)); +strftime('%B %d, %Y %H:%M:%S', new Date(1307472705067), it_IT); +strftime('%B %d, %Y %H:%M:%S', new Date(1307472705067), it_IT, { timezone: -420 }); +strftime('%B %d, %Y %H:%M:%S', new Date(1307472705067), it_IT, { timezone: '-0700' }); +strftime('%B %d, %Y %H:%M:%S', new Date(1307472705067), it_IT, { utc: true }); + +const strftimeIT = strftime.localizedStrftime(it_IT); +strftimeIT('%B %d, %Y %H:%M:%S'); +strftimeIT('%B %d, %Y %H:%M:%S', new Date(1307472705067)); + +strftime.strftimeUTC('%B %d, %y %H:%M:%S', new Date(1307472705067), it_IT); +strftime.strftimeUTC('%B %d, %y %H:%M:%S', new Date(1307472705067)); +strftime.strftimeUTC('%B %d, %y %H:%M:%S'); + +strftime.strftimeTZ('%B %d, %y %H:%M:%S', new Date(1307472705067), it_IT, -420); +strftime.strftimeTZ('%B %d, %y %H:%M:%S', new Date(1307472705067), -420); From 1840c35cad653a42d63f471abe2c76d84dae5e34 Mon Sep 17 00:00:00 2001 From: Andy Date: Mon, 23 Oct 2017 11:44:29 -0700 Subject: [PATCH 019/252] restify: Fix lint (#20913) --- types/restify/index.d.ts | 405 ++++++++--------------------------- types/restify/tslint.json | 6 +- types/restify/v4/index.d.ts | 114 ++-------- types/restify/v4/tslint.json | 1 + 4 files changed, 119 insertions(+), 407 deletions(-) diff --git a/types/restify/index.d.ts b/types/restify/index.d.ts index 8cc5fa6635..3711ee6f2c 100644 --- a/types/restify/index.d.ts +++ b/types/restify/index.d.ts @@ -64,9 +64,6 @@ export interface AddressInterface { export interface Server extends http.Server { /** * Returns the server address. Wraps node's address(). - * @public - * @function address - * @returns {String} */ address(): AddressInterface; @@ -78,106 +75,83 @@ export interface Server extends http.Server { * server.listen(80, '127.0.0.1') * server.listen('/tmp/server.sock') * - * @public - * @function listen * @throws {TypeError} - * @param {Function} callback optionally get notified when listening. - * @returns {undefined} + * @param callback optionally get notified when listening. */ listen(...args: any[]): any; /** * Shuts down this server, and invokes callback (optionally) when done. * Wraps node's close(). - * @public - * @function close - * @param {Function} callback optional callback to invoke when done. - * @returns {undefined} + * @param callback optional callback to invoke when done. */ close(...args: any[]): any; /** * Returns the number of currently inflight requests. - * @public - * @function inflightRequests - * @returns {Number} */ inflightRequests(): number; /** * Mounts a chain on the given path against this HTTP verb * - * @public - * @function del - * @param {String | Object} opts if string, the URL to handle. + * @param opts if string, the URL to handle. * if options, the URL to handle, at minimum. - * @returns {Route} the newly created route. + * @returns the newly created route. */ del(opts: string | RegExp | RouteOptions, ...handlers: RequestHandlerType[]): Route | boolean; /** * Mounts a chain on the given path against this HTTP verb * - * @public - * @function get - * @param {String | Object} opts if string, the URL to handle. + * @param opts if string, the URL to handle. * if options, the URL to handle, at minimum. - * @returns {Route} the newly created route. + * @returns the newly created route. */ get(opts: string | RegExp | RouteOptions, ...handlers: RequestHandlerType[]): Route | boolean; /** * Mounts a chain on the given path against this HTTP verb * - * @public - * @function head - * @param {String | Object} opts if string, the URL to handle. + * @param opts if string, the URL to handle. * if options, the URL to handle, at minimum. - * @returns {Route} the newly created route. + * @returns the newly created route. */ head(opts: string | RegExp | RouteOptions, ...handlers: RequestHandlerType[]): Route | boolean; /** * Mounts a chain on the given path against this HTTP verb * - * @public - * @function opts - * @param {String | Object} opts if string, the URL to handle. + * @param opts if string, the URL to handle. * if options, the URL to handle, at minimum. - * @returns {Route} the newly created route. + * @returns the newly created route. */ opts(opts: string | RegExp | RouteOptions, ...handlers: RequestHandlerType[]): Route | boolean; /** * Mounts a chain on the given path against this HTTP verb * - * @public - * @function post - * @param {String | Object} opts if string, the URL to handle. + * @param opts if string, the URL to handle. * if options, the URL to handle, at minimum. - * @returns {Route} the newly created route. + * @returns the newly created route. */ post(opts: string | RegExp | RouteOptions, ...handlers: RequestHandlerType[]): Route | boolean; /** * Mounts a chain on the given path against this HTTP verb * - * @public - * @function put - * @param {String | Object} opts if string, the URL to handle. + * @param opts if string, the URL to handle. * if options, the URL to handle, at minimum. - * @returns {Route} the newly created route. + * @returns the newly created route. */ put(opts: string | RegExp | RouteOptions, ...handlers: RequestHandlerType[]): Route | boolean; /** * Mounts a chain on the given path against this HTTP verb * - * @public - * @function patch - * @param {String | Object} opts if string, the URL to handle. + * @param opts if string, the URL to handle. * if options, the URL to handle, at minimum. - * @returns {Route} the newly created route. + * @returns the newly created route. */ patch(opts: string | RegExp | RouteOptions, ...handlers: RequestHandlerType[]): Route | boolean; @@ -195,11 +169,9 @@ export interface Server extends http.Server { * // load the user's information here, always making sure to call next() * }); * - * @public - * @function param - * @param {String} name The name of the URL param to respond to - * @param {Function} fn The middleware function to execute - * @returns {Object} returns self + * @param name The name of the URL param to respond to + * @param fn The middleware function to execute + * @returns returns self */ param(name: string, fn: RequestHandler): Server; @@ -216,24 +188,19 @@ export interface Server extends http.Server { * // do stuff that only applies to routes of this API version * }); * - * @public - * @function versionedUse - * @param {String|Array} versions the version(s) the URL to respond to - * @param {Function} fn the middleware function to execute, the + * @param versions the version(s) the URL to respond to + * @param fn the middleware function to execute, the * fourth parameter will be the selected * version - * @returns {undefined} */ versionedUse(versions: string | string[], fn: RequestHandler): Server; /** * Removes a route from the server. * You pass in the route 'blob' you got from a mount call. - * @public - * @function rm * @throws {TypeError} on bad input. - * @param {String} route the route name. - * @returns {Boolean} true if route was removed, false if not. + * @param route the route name. + * @returns true if route was removed, false if not. */ rm(route: string): boolean; @@ -242,9 +209,7 @@ export interface Server extends http.Server { * routes. * * You can pass in any combination of functions or array of functions. - * @public - * @function use - * @returns {Object} returns self + * @returns returns self */ use(...handlers: RequestHandlerType[]): Server; @@ -252,25 +217,17 @@ export interface Server extends http.Server { * Gives you hooks to run _before_ any routes are located. This gives you * a chance to intercept the request and change headers, etc., that routing * depends on. Note that req.params will _not_ be set yet. - * @public - * @function pre - * @returns {Object} returns self + * @returns returns self */ pre(...pre: RequestHandlerType[]): Server; /** * toString() the server for easy reading/output. - * @public - * @function toString - * @returns {String} */ toString(): string; /** * Return debug information about the server. - * @public - * @method getDebugInfo - * @returns {Object} */ getDebugInfo(): any; @@ -311,52 +268,39 @@ export interface RouterOptions { export interface Router { /** * takes an object of route params and query params, and 'renders' a URL. - * @public - * @function render - * @param {String} routeName the route name - * @param {Object} params an object of route params - * @param {Object} query an object of query params - * @returns {String} + * @param routeName the route name + * @param params an object of route params + * @param query an object of query params */ render(routeName: string, params: any, query?: any): string; /** * adds a route. - * @public - * @function mount - * @param {Object} options an options object - * @returns {String} returns the route name if creation is successful. + * @param options an options object + * @returns returns the route name if creation is successful. */ mount(options: RouteOptions): string | boolean; /** * unmounts a route. - * @public - * @function unmount - * @param {String} name the route name - * @returns {String} the name of the deleted route. + * @param name the route name + * @returns the name of the deleted route. */ unmount(name: string): string; /** * get a route from the router. - * @public - * @function get - * @param {String} name the name of the route to retrieve - * @param {Object} req the request object - * @param {Function} cb callback function - * @returns {undefined} + * @param name the name of the route to retrieve + * @param req the request object + * @param cb callback function */ get(name: string, req: Request, cb: FindRouteCallback): void; /** * find a route from inside the router, handles versioned routes. - * @public - * @function find - * @param {Object} req the request object - * @param {Object} res the response object - * @param {Function} callback callback function - * @returns {undefined} + * @param req the request object + * @param res the response object + * @param callback callback function */ find(req: Request, res: Response, callback: FindRouteCallback): void; @@ -364,26 +308,20 @@ export interface Router { * Find a route by path. Scans the route list for a route with the same RegEx. * i.e. /foo/:param1/:param2 would match an existing route with different * parameter names /foo/:id/:name since the compiled RegExs match. - * @public - * @function findByPath - * @param {String | RegExp} path a path to find a route for. - * @param {Object} options an options object - * @returns {Object} returns the route if a match is found + * @param path a path to find a route for. + * @param options an options object + * @returns returns the route if a match is found */ findByPath(path: string | RegExp): Route; /** * toString() serialization. - * @public - * @function toString - * @returns {String} */ toString(): string; /** * Return information about the routes registered in the router. - * @public - * @returns {object} The routes in the router. + * @returns The routes in the router. */ getDebugInfo(): any; @@ -426,108 +364,69 @@ export interface Request extends http.IncomingMessage { /** * checks if the accept header is present and has the value requested. * e.g., req.accepts('html'); - * @public - * @function accepts - * @param {String | Array} types an array of accept type headers - * @returns {Boolean} + * @param types an array of accept type headers */ accepts(types: string | string[]): boolean; /** * checks if the request accepts the encoding types. - * @public - * @function acceptsEncoding - * @param {String | Array} types an array of accept type headers - * @returns {Boolean} + * @param types an array of accept type headers */ acceptsEncoding(types: string | string[]): boolean; /** * gets the content-length header off the request. - * @public - * @function getContentLength - * @returns {Number} */ getContentLength(): number; /** * pass through to getContentLength. - * @public - * @function contentLength - * @returns {Number} */ contentLength(): number; /** * gets the content-type header. - * @public - * @function getContentType - * @returns {String} */ getContentType(): string; /** * pass through to getContentType. - * @public - * @function contentType - * @returns {Number} */ contentType(): string; /** * retrieves the complete URI requested by the client. - * @public - * @function getHref - * @returns {String} */ getHref(): string; /** * pass through to getHref. - * @public - * @function href - * @returns {String} */ href(): string; /** * retrieves the request uuid. was created when the request was setup. - * @public - * @function getId - * @returns {String} */ getId(): string; /** * pass through to getId. - * @public - * @function id - * @returns {String} */ id(): string; /** * retrieves the cleaned up url path. * e.g., /foo?a=1 => /foo - * @public - * @function getPath - * @returns {String} */ getPath(): string; /** * pass through to getPath. - * @public - * @function path - * @returns {String} */ path(): string; /** * returns the raw query string - * @public - * @function getQuery - * @returns {String} */ getQuery(): string; @@ -541,129 +440,84 @@ export interface Request extends http.IncomingMessage { /** * returns ms since epoch when request was setup. - * @public - * @function time - * @returns {Number} */ time(): number; /** * returns a parsed URL object. - * @public - * @function getUrl - * @returns {Object} */ getUrl(): url.Url; /** * returns the accept-version header. - * @public - * @function getVersion - * @returns {String} */ getVersion(): string; /** * pass through to getVersion. - * @public - * @function version - * @returns {String} */ version(): string; /** * returns the version of the route that matched. - * @public - * @function matchedVersion - * @returns {String} */ matchedVersion(): string; /** * returns any header off the request. also, 'correct' any * correctly spelled 'referrer' header to the actual spelling used. - * @public - * @function header - * @param {String} name the name of the header - * @param {String} value default value if header isn't found on the req - * @returns {String} + * @param name the name of the header + * @param value default value if header isn't found on the req */ header(name: string, value?: string): string; /** * returns any trailer header off the request. also, 'correct' any * correctly spelled 'referrer' header to the actual spelling used. - * @public - * @function trailer - * @param {String} name the name of the header - * @param {String} value default value if header isn't found on the req - * @returns {String} + * @param name the name of the header + * @param value default value if header isn't found on the req */ trailer(name: string, value?: string): string; /** * Check if the incoming request contains the Content-Type header field, and * if it contains the given mime type. - * @public - * @function is - * @param {String} type a content-type header value - * @returns {Boolean} + * @param type a content-type header value */ is(type: string): boolean; /** * Check if the incoming request is chunked. - * @public - * @function isChunked - * @returns {Boolean} */ isChunked(): boolean; /** * Check if the incoming request is kept alive. - * @public - * @function isKeepAlive - * @returns {Boolean} */ isKeepAlive(): boolean; /** * Check if the incoming request is encrypted. - * @public - * @function isSecure - * @returns {Boolean} */ isSecure(): boolean; /** * Check if the incoming request has been upgraded. - * @public - * @function isUpgradeRequest - * @returns {Boolean} */ isUpgradeRequest(): boolean; /** * Check if the incoming request is an upload verb. - * @public - * @function isUpload - * @returns {Boolean} */ isUpload(): boolean; /** * toString serialization - * @public - * @function toString - * @returns {String} */ toString(): string; /** * retrieves the user-agent header. - * @public - * @function userAgent - * @returns {String} */ userAgent(): string; @@ -671,28 +525,19 @@ export interface Request extends http.IncomingMessage { * Start the timer for a request handler function. You must explicitly invoke * endHandlerTimer() after invoking this function. Otherwise timing information * will be inaccurate. - * @public - * @function startHandlerTimer - * @param {String} handlerName The name of the handler. - * @returns {undefined} + * @param handlerName The name of the handler. */ startHandlerTimer(handlerName: string): void; /** * Stop the timer for a request handler function. - * @public - * @function endHandlerTimer - * @param {String} handlerName The name of the handler. - * @returns {undefined} + * @param handlerName The name of the handler. */ endHandlerTimer(handlerName: string): void; /** * returns the connection state of the request. current valid values are * 'close' and 'aborted'. - * @public - * @function connectionState - * @returns {String} */ connectionState(): string; @@ -705,9 +550,6 @@ export interface Request extends http.IncomingMessage { * versions: [], * name: 'getpingname' * } - * @public - * @function getRoute - * @returns {Object} */ getRoute(): RouteSpec; @@ -741,74 +583,54 @@ export interface Response extends http.ServerResponse { /** * sets the cache-control header. `type` defaults to _public_, * and options currently only takes maxAge. - * @public - * @function cache - * @param {String} type value of the header - * @param {Object} [options] an options object - * @returns {String} the value set to the header + * @param type value of the header + * @param [options] an options object + * @returns the value set to the header */ cache(type: string, options?: CacheOptions): string; /** * sets the cache-control header. `type` defaults to _public_, * and options currently only takes maxAge. - * @public - * @function cache - * @param {Object} [options] an options object - * @returns {String} the value set to the header + * @param [options] an options object + * @returns the value set to the header */ cache(options?: CacheOptions): string; /** * turns off all cache related headers. - * @public - * @function noCache - * @returns {Object} self, the response object + * @returns self, the response object */ noCache(): Response; /** * Appends the provided character set to the response's Content-Type. * e.g., res.charSet('utf-8'); - * @public - * @function charSet - * @param {String} type char-set value - * @returns {Object} self, the response object + * @param type char-set value + * @returns self, the response object */ charSet(type: string): Response; /** * retrieves a header off the response. - * @public - * @function get - * @param {Object} name the header name - * @returns {String} + * @param name the header name */ get(name: string): string; /** * retrieves all headers off the response. - * @public - * @function getHeaders - * @returns {Object} */ getHeaders(): any; /** * pass through to getHeaders. - * @public - * @function headers - * @returns {Object} */ headers(): any; /** * sets headers on the response. - * @public - * @function header - * @param {String} name the name of the header - * @param {String} value the value of the header - * @returns {Object} + * @param name the name of the header + * @param value the value of the header */ header(name: string, value?: any): any; @@ -816,12 +638,9 @@ export interface Response extends http.ServerResponse { * short hand method for: * res.contentType = 'json'; * res.send({hello: 'world'}); - * @public - * @function json - * @param {Number} code http status code - * @param {Object} object value to json.stringify - * @param {Object} [headers] headers to set on the response - * @returns {Object} + * @param code http status code + * @param object value to json.stringify + * @param [headers] headers to set on the response */ json(code: number, object: any, headers?: { [header: string]: string }): any; @@ -829,97 +648,77 @@ export interface Response extends http.ServerResponse { * short hand method for: * res.contentType = 'json'; * res.send({hello: 'world'}); - * @public - * @function json - * @param {Object} object value to json.stringify - * @param {Object} [headers] headers to set on the response - * @returns {Object} + * @param object value to json.stringify + * @param [headers] headers to set on the response */ json(object: any, headers?: { [header: string]: string }): any; /** * sets the link heaader. - * @public - * @function link - * @param {String} l the link key - * @param {String} rel the link value - * @returns {String} the header value set to res + * @param l the link key + * @param rel the link value + * @returns the header value set to res */ link(l: string, rel: string): string; /** * sends the response object. pass through to internal __send that uses a * formatter based on the content-type header. - * @public - * @function send - * @param {Number} [code] http status code - * @param {Object | Buffer | Error} [body] the content to send - * @param {Object} [headers] any add'l headers to set - * @returns {Object} the response object + * @param [code] http status code + * @param [body] the content to send + * @param [headers] any add'l headers to set + * @returns the response object */ send(code?: any, body?: any, headers?: { [header: string]: string }): any; /** * sends the response object. pass through to internal __send that skips * formatters entirely and sends the content as is. - * @public - * @function sendRaw - * @param {Number} [code] http status code - * @param {Object | Buffer | Error} [body] the content to send - * @param {Object} [headers] any add'l headers to set - * @returns {Object} the response object + * @param [code] http status code + * @param [body] the content to send + * @param [headers] any add'l headers to set + * @returns the response object */ sendRaw(code?: any, body?: any, headers?: { [header: string]: string }): any; /** * sets a header on the response. - * @public - * @function set - * @param {String} name name of the header - * @param {String} val value of the header - * @returns {Object} self, the response object + * @param name name of the header + * @param val value of the header + * @returns self, the response object */ set(name: string, val: string): Response; /** * sets the http status code on the response. - * @public - * @function status - * @param {Number} code http status code - * @returns {Number} the status code passed in + * @param code http status code + * @returns the status code passed in */ status(code: number): number; /** * toString() serialization. - * @public - * @function toString - * @returns {String} */ toString(): string; - /** redirect is sugar method for redirecting. + /** + * redirect is sugar method for redirecting. * res.redirect(301, 'www.foo.com', next); * `next` is mandatory, to complete the response and trigger audit logger. - * @public - * @param {Number} code the status code - * @param {String} url to redirect to - * @param {Function} next fn + * @param code the status code + * @param url to redirect to + * @param next fn * @emits redirect - * @function redirect - * @return {undefined} */ redirect(code: number, url: string, next: Next): void; - /** redirect is sugar method for redirecting. + /** + * redirect is sugar method for redirecting. * res.redirect({...}, next); * `next` is mandatory, to complete the response and trigger audit logger. - * @public - * @param {Object | String} options the options or url to redirect to - * @param {Function} next fn + * @param options the options or url to redirect to + * @param next fn * @emits redirect - * @function redirect - * @return {undefined} */ redirect(options: object | string, next: Next): void; @@ -1076,9 +875,6 @@ export namespace plugins { */ function context(): RequestHandler; - /** - * - */ function dedupeSlashes(): RequestHandler; /** @@ -1140,9 +936,6 @@ export namespace plugins { */ printLog?: boolean; - /** - * - */ body?: boolean; } @@ -1232,14 +1025,8 @@ export namespace plugins { */ rejectUnknown?: boolean; - /** - * - */ reviver?: any; - /** - * - */ maxFieldsSize?: number; } @@ -1376,7 +1163,7 @@ export namespace plugins { function gzipResponse(options?: any): RequestHandler; interface ServeStatic { - appendRequestPath?: boolean | undefined; + appendRequestPath?: boolean; directory?: string; maxAge?: number; match?: any; @@ -1409,9 +1196,6 @@ export namespace plugins { */ err: Error; - /** - * - */ metrics: MetricsCallbackOptions; req: Request; @@ -1522,9 +1306,6 @@ export namespace pre { */ function context(): RequestHandler; - /** - * - */ function dedupeSlashes(): RequestHandler; /** diff --git a/types/restify/tslint.json b/types/restify/tslint.json index f93cf8562a..f0f7a6f17a 100644 --- a/types/restify/tslint.json +++ b/types/restify/tslint.json @@ -1,3 +1,7 @@ { - "extends": "dtslint/dt.json" + "extends": "dtslint/dt.json", + "rules": { + // TODO + "no-unnecessary-class": false + } } diff --git a/types/restify/v4/index.d.ts b/types/restify/v4/index.d.ts index 37c2b11487..877300c23a 100644 --- a/types/restify/v4/index.d.ts +++ b/types/restify/v4/index.d.ts @@ -36,101 +36,68 @@ export interface requestAuthorization { export interface Request extends http.IncomingMessage { /** * builds an absolute URI for the request. - * @private - * @function absoluteUri - * @param {String} path a url path - * @returns {String} + * @param path a url path */ absoluteUri(path: string): string; /** * returns any header off the request. also, 'correct' any * correctly spelled 'referrer' header to the actual spelling used. - * @public - * @function header - * @param {String} name the name of the header - * @param {String} value default value if header isn't found on the req - * @returns {String} + * @param name the name of the header + * @param value default value if header isn't found on the req */ header(name: string, value?: string): string; /** * returns any trailer header off the request. also, 'correct' any * correctly spelled 'referrer' header to the actual spelling used. - * @public - * @function trailer - * @param {String} name the name of the header - * @param {String} value default value if header isn't found on the req - * @returns {String} + * @param name the name of the header + * @param value default value if header isn't found on the req */ trailer(name: string, value?: string): string; /** * checks if the accept header is present and has the value requested. * e.g., req.accepts('html'); - * @public - * @function accepts - * @param {String | Array} types an array of accept type headers - * @returns {Boolean} + * @param types an array of accept type headers */ accepts(types: string | string[]): boolean; /** * checks if the request accepts the encoding types. - * @public - * @function acceptsEncoding - * @param {String | Array} types an array of accept type headers - * @returns {Boolean} + * @param types an array of accept type headers */ acceptsEncoding(types: string | string[]): boolean; /** * Check if the incoming request contains the Content-Type header field, and * if it contains the given mime type. - * @public - * @function is - * @param {String} type a content-type header value - * @returns {Boolean} + * @param type a content-type header value */ is(type: string): boolean; /** * Check if the incoming request is chunked. - * @public - * @function isChunked - * @returns {Boolean} */ isChunked(): boolean; /** * Check if the incoming request is kept alive. - * @public - * @function isKeepAlive - * @returns {Boolean} */ isKeepAlive(): boolean; /** * Check if the incoming request has been upgraded. - * @public - * @function isUpgradeRequest - * @returns {Boolean} */ isUpgradeRequest(): boolean; /** * Check if the incoming request is an upload verb. - * @public - * @function isUpload - * @returns {Boolean} */ isUpload(): boolean; /** * retrieves the user-agent header. - * @public - * @function userAgent - * @returns {String} */ userAgent(): string; @@ -138,19 +105,13 @@ export interface Request extends http.IncomingMessage { * Start the timer for a request handler function. You must explicitly invoke * endHandlerTimer() after invoking this function. Otherwise timing information * will be inaccurate. - * @public - * @function startHandlerTimer - * @param {String} handlerName The name of the handler. - * @returns {undefined} + * @param handlerName The name of the handler. */ startHandlerTimer(handlerName: string): void; /** * Stop the timer for a request handler function. - * @public - * @function endHandlerTimer - * @param {String} handlerName The name of the handler. - * @returns {undefined} + * @param handlerName The name of the handler. */ endHandlerTimer(handlerName: string): void; @@ -158,23 +119,16 @@ export interface Request extends http.IncomingMessage { /** * gets the content-length header off the request. - * @public - * @function getContentLength - * @returns {Number} */ getContentLength(): number; /** * @see getContentLength - * @function contentLength */ contentLength(): number; /** * gets the content-type header. - * @public - * @function getContentType - * @returns {String} */ getContentType(): string; @@ -185,9 +139,6 @@ export interface Request extends http.IncomingMessage { /** * retrieves the complete URI requested by the client. - * @public - * @function getHref - * @returns {String} */ getHref(): string; @@ -199,9 +150,6 @@ export interface Request extends http.IncomingMessage { log: Logger; /** * retrieves the request uuid. was created when the request was setup. - * @public - * @function getId - * @returns {String} */ getId(): string; @@ -213,9 +161,6 @@ export interface Request extends http.IncomingMessage { /** * retrieves the cleaned up url path. * e.g., /foo?a=1 => /foo - * @public - * @function getPath - * @returns {String} */ getPath(): string; @@ -226,9 +171,6 @@ export interface Request extends http.IncomingMessage { /** * returns the raw query string - * @public - * @function getQuery - * @returns {String} */ getQuery(): string; @@ -241,25 +183,16 @@ export interface Request extends http.IncomingMessage { /** * returns ms since epoch when request was setup. - * @public - * @function time - * @returns {Number} */ time(): number; /** * returns a parsed URL object. - * @public - * @function getUrl - * @returns {Object} */ getUrl(): url.Url; /** * returns the accept-version header. - * @public - * @function getVersion - * @returns {String} */ getVersion(): string; @@ -272,9 +205,6 @@ export interface Request extends http.IncomingMessage { /** * Check if the incoming request is encrypted. - * @public - * @function isSecure - * @returns {Boolean} */ isSecure(): boolean; /** available when bodyParser plugin is used */ @@ -290,8 +220,6 @@ export interface Request extends http.IncomingMessage { /** * Timer object used to identify how long a specific handler took to run * - * @property {String} name The name of the handler. - * @property {Array} time A tuple of [seconds, nanoseconds], how long the handler took. */ export interface HandlerTiming { name: string; @@ -362,33 +290,31 @@ export interface Router { /** * Takes an object of route params and query params, and 'renders' a URL - * @param {String} routeName the route name - * @param {Object} params an object of route params - * @param {Object} query an object of query params - * @returns {String} + * @param routeName the route name + * @param params an object of route params + * @param query an object of query params */ render(routeName: string, params: any, query?: any): string; /** * adds a route. - * @param {Object} options an options object - * @returns {String} returns the route name if creation is successful. + * @param options an options object + * @returns returns the route name if creation is successful. */ mount(options: any): string | boolean; /** * unmounts a route. - * @param {String} name the route name - * @returns {String} the name of the deleted route (or false if it was not matched) + * @param name the route name + * @returns the name of the deleted route (or false if it was not matched) */ unmount(name: string): string | boolean; /** * finds the route for a given request and response. - * @param {Request} req the request object - * @param {Response} res the response object - * @param {Function} callback operation callback - * @returns {undefined} + * @param req the request object + * @param res the response object + * @param callback operation callback */ find(req: Request, res: Response, callback: (err: Error, route: Route) => void): void; } diff --git a/types/restify/v4/tslint.json b/types/restify/v4/tslint.json index ef6af29df5..6f99b78fae 100644 --- a/types/restify/v4/tslint.json +++ b/types/restify/v4/tslint.json @@ -2,6 +2,7 @@ "extends": "dtslint/dt.json", "rules": { // TODO + "no-unnecessary-class": false, "no-var-keyword": false } } From 9fee92dff8db2a92ce0384a01c15c4297293feb0 Mon Sep 17 00:00:00 2001 From: Andrej Hazucha Date: Mon, 23 Oct 2017 20:48:44 +0200 Subject: [PATCH 020/252] [inline-style-prefixer] allowing ES2015 module syntax (#18533) * [inline-style-prefixer] allowing "import * as InlineStylePrefixer from 'inline-style-prefixer';" syntax * [inline-style-prefixer] removing redundant export --- types/inline-style-prefixer/index.d.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/types/inline-style-prefixer/index.d.ts b/types/inline-style-prefixer/index.d.ts index f5b496f25a..8c730fff2f 100644 --- a/types/inline-style-prefixer/index.d.ts +++ b/types/inline-style-prefixer/index.d.ts @@ -4,15 +4,15 @@ // dpetrezselyova // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -export = InlineStylePrefixer; - -interface Configuration { - userAgent?: string; - keepUnprefixed?: boolean; +declare namespace InlineStylePrefixer { + interface Configuration { + userAgent?: string; + keepUnprefixed?: boolean; + } } declare class InlineStylePrefixer { - constructor(cfg?: Configuration); + constructor(cfg?: InlineStylePrefixer.Configuration); prefix(style: CSSStyleDeclaration): CSSStyleDeclaration; @@ -24,3 +24,5 @@ declare class InlineStylePrefixer { // support for React.CSSProperties static prefixAll(style: T): T; } + +export = InlineStylePrefixer; From 03b389dc02fa2da163b414730d2f8c631f526544 Mon Sep 17 00:00:00 2001 From: Andy Date: Mon, 23 Oct 2017 11:56:03 -0700 Subject: [PATCH 021/252] oniguruma: Fix lint (#20904) --- types/oniguruma/index.d.ts | 176 +++++++++++++++++++++---------------- 1 file changed, 98 insertions(+), 78 deletions(-) diff --git a/types/oniguruma/index.d.ts b/types/oniguruma/index.d.ts index 4734ae39ee..e25c2aca58 100644 --- a/types/oniguruma/index.d.ts +++ b/types/oniguruma/index.d.ts @@ -3,14 +3,16 @@ // Definitions by: smhxx // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/** An (error, match) callback function to be invoked after an asynchronous - * search operation is completed. The type of T varies slightly based on the - * method being called. +/** + * An (error, match) callback function to be invoked after an asynchronous + * search operation is completed. The type of T varies slightly based on the + * method being called. */ export type Callback = (error: Error, match: T) => void; -/** An object representing a range within a search string, corresponding to - * either a full-string match, or a capturing group within a match. +/** + * An object representing a range within a search string, corresponding to + * either a full-string match, or a capturing group within a match. */ export interface CaptureIndex { /** The index of the capturing group, or 0 for a full-string match */ @@ -23,8 +25,9 @@ export interface CaptureIndex { length: number; } -/** An object representing one successful regex match between a pattern and a - * search string. +/** + * An object representing one successful regex match between a pattern and a + * search string. */ export interface Match { /** The index of the best pattern match */ @@ -33,12 +36,14 @@ export interface Match { captureIndices: CaptureIndex[]; } -/** An object representing a single regex pattern, which can be used to - * interrogate strings for matches against that pattern. +/** + * An object representing a single regex pattern, which can be used to + * interrogate strings for matches against that pattern. */ export class OnigRegExp { - /** Create a new regex with the given pattern - * @param pattern A string pattern + /** + * Create a new regex with the given pattern + * @param pattern A string pattern */ constructor(pattern: string); @@ -47,104 +52,117 @@ export class OnigRegExp { /** The OnigScanner instance used internally for regex matching */ readonly scanner: OnigScanner; - /** Augment the capture indices for the given Match object by extracting - * the substrings associated with each capture, assinging them to the - * CaptureIndex object's 'match' property - * @param string The search string from which 'match' resulted - * @param match The Match object containing the matches of the search - * @return An array of CaptureIndex objects which have been augmented with - * the original text that triggered the match + /** + * Augment the capture indices for the given Match object by extracting + * the substrings associated with each capture, assinging them to the + * CaptureIndex object's 'match' property + * @param string The search string from which 'match' resulted + * @param match The Match object containing the matches of the search + * @return An array of CaptureIndex objects which have been augmented with + * the original text that triggered the match */ captureIndicesForMatch(string: any, match: Match): Array; - /** Search the string for a match starting at the given position. - * @param string The string to search. - * @param startPosition The optional position to start at, defaults to 0 - * @param callback The (error, match) function to call when done. Match will - * be null if no matches were found. Otherwise, match will be an - * array of objects for each matched group. + /** + * Search the string for a match starting at the given position. + * @param string The string to search. + * @param startPosition The optional position to start at, defaults to 0 + * @param callback The (error, match) function to call when done. Match will + * be null if no matches were found. Otherwise, match will be an + * array of objects for each matched group. */ search(string: string, startPosition: number, callback: Callback): void; - /** Search the string for a match starting at the beginning of the string. - * @param string The string to search. - * @param callback The (error, match) function to call when done. Match will - * be null if no matches were found. Otherwise, match will be an - * array of objects for each matched group. + /** + * Search the string for a match starting at the beginning of the string. + * @param string The string to search. + * @param callback The (error, match) function to call when done. Match will + * be null if no matches were found. Otherwise, match will be an + * array of objects for each matched group. */ search(string: string, callback: Callback): void; - /** Synchronously search the string for a match starting at the given - * position. - * @param string The string to search. - * @param startPosition The optional position to start at, defaults to 0 - * @return An array of objects representing each matched group, or null if - * there were no matches. + /** + * Synchronously search the string for a match starting at the given + * position. + * @param string The string to search. + * @param startPosition The optional position to start at, defaults to 0 + * @return An array of objects representing each matched group, or null if + * there were no matches. */ searchSync(string: string, startPosition?: number): CaptureIndex[] | null; - /** Test if this regular expression matches the given string. - * @param string The string to test against. - * @param callback The (error, matches) function to call when done. Matches - * will be true if at least one match was found, or false otherwise. + /** + * Test if this regular expression matches the given string. + * @param string The string to test against. + * @param callback The (error, matches) function to call when done. Matches + * will be true if at least one match was found, or false otherwise. */ test(sring: string, callback: Callback): void; - /** Synchronously test if this regular expression matches the given string. - * @param string The string to test against. - * @return True if there is at least one match, or false otherwise. + /** + * Synchronously test if this regular expression matches the given string. + * @param string The string to test against. + * @return True if there is at least one match, or false otherwise. */ testSync(string: string): boolean; } -/** An object representing one OR MORE regex patterns, which can be used to - * interrogate strings for matches against any of the supplied patterns. +/** + * An object representing one OR MORE regex patterns, which can be used to + * interrogate strings for matches against any of the supplied patterns. */ export class OnigScanner { - /** Create a new scanner with the given patterns. - * @param patterns An array of string patterns. + /** + * Create a new scanner with the given patterns. + * @param patterns An array of string patterns. */ constructor(patterns: ReadonlyArray); - /** Find the next match from a given position - * @param string The string to search - * @param startPosition The optional position to start at, defaults to 0 - * @param callback The (error, match) function to be called when done. Match - * will be null when there is no match. - * @return void + /** + * Find the next match from a given position + * @param string The string to search + * @param startPosition The optional position to start at, defaults to 0 + * @param callback The (error, match) function to be called when done. Match + * will be null when there is no match. */ findNextMatch(string: string, startPosition: number, callback: Callback): void; - /** Find the next match from the beginning of a string - * @param string The string to search - * @param callback The (error, match) function to be called when done. Match - * will be null when there is no match. - * @return void + /** + * Find the next match from the beginning of a string + * @param string The string to search + * @param callback The (error, match) function to be called when done. Match + * will be null when there is no match. */ findNextMatch(string: string, callback: Callback): void; - /** Synchronously find the next match from a given position - * @param string The string to search - * @param startPosition The optional position to start at, defaults to 0 - * @return An object containing details about the match, or null if no match + /** + * Synchronously find the next match from a given position + * @param string The string to search + * @param startPosition The optional position to start at, defaults to 0 + * @return An object containing details about the match, or null if no match */ findNextMatchSync(string: string, startPosition?: number): Match | null; - /** Coerce the provided value into either a string primitive or a wrapped - * OnigString object. - * @param value A value of any type - * @return A string primitive or OnigString object representing 'value' + /** + * Coerce the provided value into either a string primitive or a wrapped + * OnigString object. + * @param value A value of any type + * @return A string primitive or OnigString object representing 'value' */ private convertToString(value: any): string | OnigString; - /** Coerce the provided value into a number - * @param value A value of any type - * @return A number representing 'value' + /** + * Coerce the provided value into a number + * @param value A value of any type + * @return A number representing 'value' */ private convertToNumber(value: any): number; } -/** An object class used internally as a wrapper for JavaScript string - * primitives. +/** + * An object class used internally as a wrapper for JavaScript string + * primitives. */ export class OnigString { - /** Wrap a string primitive in a new OnigString object - * @param string The string primitive to be wrapped + /** + * Wrap a string primitive in a new OnigString object + * @param string The string primitive to be wrapped */ constructor(string: string); @@ -153,14 +171,16 @@ export class OnigString { /** The string primitive wrapped by the object */ readonly content: string; - /** Returns a reference the string primitive wrapped by the object - * @return A reference to the wrapped string primitive + /** + * Returns a reference the string primitive wrapped by the object + * @return A reference to the wrapped string primitive */ toString(): string; - /** Returns a substring of the string primitive wrapped by the object - * @param start The index of the first character to include - * @param end The index before which the substring should end - * @return A new string primitive containing the specified index range + /** + * Returns a substring of the string primitive wrapped by the object + * @param start The index of the first character to include + * @param end The index before which the substring should end + * @return A new string primitive containing the specified index range */ substring(start: number, end: number): string; } From d5844afa20f46cf71a99daf546f0f5e19c06379b Mon Sep 17 00:00:00 2001 From: Neonit Date: Mon, 23 Oct 2017 21:13:32 +0200 Subject: [PATCH 022/252] adjust typeCast type in MySqlConnectionConfig (#20431) The underlying node-mysql package supports a function as typeCast value (alternative to a boolean), thus its type has been set to any in the respective types package (@types/mysql). https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/mysql/index.d.ts#L217 --- types/knex/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/knex/index.d.ts b/types/knex/index.d.ts index 3399c5aa52..71e3e0562a 100644 --- a/types/knex/index.d.ts +++ b/types/knex/index.d.ts @@ -563,7 +563,7 @@ declare namespace Knex { connectTimeout?: number; stringifyObjects?: boolean; insecureAuth?: boolean; - typeCast?: boolean; + typeCast?: any; queryFormat?: (query: string, values: any) => string; supportBigNumbers?: boolean; bigNumberStrings?: boolean; From 0cc18fa090d64d634bae825558788092d9097d22 Mon Sep 17 00:00:00 2001 From: Ed Bishop Date: Mon, 23 Oct 2017 20:27:08 +0100 Subject: [PATCH 023/252] Added indexWait and fixed the return type for get. (#20521) * Fixed the return type for get. Fixed the return type for get as it returns a single result not a cursor. * Update index.d.ts --- types/rethinkdb/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/rethinkdb/index.d.ts b/types/rethinkdb/index.d.ts index f27b91b775..fca73dfdb6 100644 --- a/types/rethinkdb/index.d.ts +++ b/types/rethinkdb/index.d.ts @@ -238,11 +238,12 @@ declare module "rethinkdb" { indexCreate(name: string, index?: ExpressionFunction): Operation; indexDrop(name: string): Operation; indexList(): Operation; + indexWait(name?: string): Operation>; insert(obj: any[], options?: InsertOptions): Operation; insert(obj: any, options?: InsertOptions): Operation; - get(key: string): Sequence; // primary key + get(key: string): Operation; getAll(key: string, index?: Index): Sequence; // without index defaults to primary key getAll(...keys: string[]): Sequence; wait(WaitOptions?: WaitOptions): WaitResult; From 43a6d928698d889c5d53c93eb7e8a223f4816a72 Mon Sep 17 00:00:00 2001 From: dlebrecht Date: Mon, 23 Oct 2017 21:43:58 +0200 Subject: [PATCH 024/252] Bitcoinjs (#20556) * added inputs to transaction builder * verify should return boolean, fixed inputs * added property private key (d) in ECPair class --- types/bitcoinjs-lib/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/bitcoinjs-lib/index.d.ts b/types/bitcoinjs-lib/index.d.ts index 4caa6e1e2d..ac78171dc8 100644 --- a/types/bitcoinjs-lib/index.d.ts +++ b/types/bitcoinjs-lib/index.d.ts @@ -66,6 +66,8 @@ export class ECPair { constructor(d: null | undefined, Q: any, options?: { compressed?: boolean, network?: Network }); // Q should be ECPoint, but not sure how to define such type + d: BigInteger; + getAddress(): string; getNetwork(): Network; From b731a1b609130fa432e1fe63b151297f3f28389f Mon Sep 17 00:00:00 2001 From: "ohze.net" Date: Tue, 24 Oct 2017 02:48:02 +0700 Subject: [PATCH 025/252] cropperjs: make CropBoxData's fields optional; add getCroppedCanvas (v1.1.0) 's new options; add & fix tslint (#20560) * cropperjs: make CropBoxData's fields optional * cropperjs: Added 4 new options to getCroppedCanvas method: minWidth, minHeight, maxWidth and maxHeight. see https://github.com/fengyuanchen/cropperjs/releases/tag/v1.1.0 * cropperjs: tslint --- types/cropperjs/cropperjs-tests.ts | 6 +- types/cropperjs/index.d.ts | 542 +++++++++++++++-------------- types/cropperjs/tslint.json | 1 + 3 files changed, 277 insertions(+), 272 deletions(-) create mode 100644 types/cropperjs/tslint.json diff --git a/types/cropperjs/cropperjs-tests.ts b/types/cropperjs/cropperjs-tests.ts index 2c57656b78..4895c3052c 100644 --- a/types/cropperjs/cropperjs-tests.ts +++ b/types/cropperjs/cropperjs-tests.ts @@ -1,9 +1,9 @@ import * as Cropper from 'cropperjs'; -var image = document.getElementById('image'); -var cropper = new Cropper(image, { +const image = document.getElementById('image'); +const cropper = new Cropper(image, { aspectRatio: 16 / 9, - crop: function(e) { + crop(e) { console.log(e.detail.x); console.log(e.detail.y); console.log(e.detail.width); diff --git a/types/cropperjs/index.d.ts b/types/cropperjs/index.d.ts index ca957ccc3f..e99dd88831 100644 --- a/types/cropperjs/index.d.ts +++ b/types/cropperjs/index.d.ts @@ -1,259 +1,260 @@ -// Type definitions for cropperjs +// Type definitions for cropperjs 1.1 // Project: https://github.com/fengyuanchen/cropperjs // Definitions by: Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 declare namespace cropperjs { - export enum CropperViewMods { + enum CropperViewMods { CropBoxIsJustWithInTheContainer = 0, CropBoxShouldBeWithInTheCanvas = 1, CanvasShouldNotBeWithInTheContainer = 2, ContainerSshouldBeWithInTheCanvas = 3 } - export interface CropperReadyEvent extends CustomEvent { } - export interface CropperCropEvent extends CustomEvent { + type CropperReadyEvent = CustomEvent; + interface CropperCropEvent extends CustomEvent { detail: Data; } - export interface CropperCropStepEvent extends CustomEvent { + interface CropperCropStepEvent extends CustomEvent { detail: CropStepData; } - export interface CropperZoomEvent extends CustomEvent { + interface CropperZoomEvent extends CustomEvent { detail: ZoomData; } - export interface CropperOptions { + interface CropperOptions { /** - * Function called when crop box is ready - */ - ready?: (event: CropperReadyEvent) => void; + * Function called when crop box is ready + */ + ready?(event: CropperReadyEvent): void; /** - * Function called when crop box is moved or resized - */ - crop?: (event: CropperCropEvent) => void; + * Function called when crop box is moved or resized + */ + crop?(event: CropperCropEvent): void; /** - * Function called at start of crop box being moved or resized - */ - cropstart?: (event: CropperCropStepEvent) => void; + * Function called at start of crop box being moved or resized + */ + cropstart?(event: CropperCropStepEvent): void; /** - * Function called when crop box is moved - */ - cropmove?: (event: CropperCropStepEvent) => void; + * Function called when crop box is moved + */ + cropmove?(event: CropperCropStepEvent): void; /** - * Function called when crop box is finished being moved or resized - */ - cropend?: (event: CropperCropStepEvent) => void; + * Function called when crop box is finished being moved or resized + */ + cropend?(event: CropperCropStepEvent): void; /** * Function called when a cropper instance starts to zoom in or zoom out its canvas (image wrapper). */ - zoom?: (event: CropperZoomEvent) => void; + zoom?(event: CropperZoomEvent): void; /** - * Define the view mode of the cropper. - * @default 0 - */ + * Define the view mode of the cropper. + * @default 0 + */ viewMode?: CropperViewMods; /** - * Define the dragging mode of the cropper. - * 'crop': create a new crop box - * 'move': move the canvas - * 'none': do nothing - */ + * Define the dragging mode of the cropper. + * 'crop': create a new crop box + * 'move': move the canvas + * 'none': do nothing + */ dragMode?: string; /** - * Set the aspect ratio of the crop box. By default, the crop box is free ratio. - * @default Nan - */ + * Set the aspect ratio of the crop box. By default, the crop box is free ratio. + * @default Nan + */ aspectRatio?: number; /** - * The previous cropped data if you had stored, will be passed to setData method automatically. - * @default null - */ - data?: Object; + * The previous cropped data if you had stored, will be passed to setData method automatically. + * @default null + */ + data?: object; /** - * Add extra elements (containers) for previewing. - * Valid selector for Document.querySelectorAll - * @default '' - */ + * Add extra elements (containers) for previewing. + * Valid selector for Document.querySelectorAll + * @default '' + */ preview?: string; /** - * Rebuild the cropper when resize the window. - * @default true - */ + * Rebuild the cropper when resize the window. + * @default true + */ responsive?: boolean; /** - * By default, the plugin will check the image origin, and if it is a cross-origin image, - * a crossOrigin attribute will be added to the image element and a timestamp will be added to the image url to reload the image for "getCroppedCanvas". - * By adding crossOrigin attribute to image will stop adding timestamp to image url, and stop reload of image. - * @default true - */ + * By default, the plugin will check the image origin, and if it is a cross-origin image, + * a crossOrigin attribute will be added to the image element and a timestamp will be added to the image url to reload the image for "getCroppedCanvas". + * By adding crossOrigin attribute to image will stop adding timestamp to image url, and stop reload of image. + * @default true + */ checkCrossOrigin?: boolean; /** - * Check the current image's Exif Orientation information. - * More exactly, read the Orientation value for rotating or flipping the image, and then override the Orientation - * value with 1 (the default value) to avoid some issues (1, 2) on iOS devices. - * Requires to set both the rotatable and scalable options to true at the same time. - * Note: Don't trust this all the time as some JPG images have incorrect (not standard) Orientation values. - * @default true - */ + * Check the current image's Exif Orientation information. + * More exactly, read the Orientation value for rotating or flipping the image, and then override the Orientation + * value with 1 (the default value) to avoid some issues (1, 2) on iOS devices. + * Requires to set both the rotatable and scalable options to true at the same time. + * Note: Don't trust this all the time as some JPG images have incorrect (not standard) Orientation values. + * @default true + */ checkOrientation?: boolean; /** - * Show the black modal above the image and under the crop box. - * @default true - */ + * Show the black modal above the image and under the crop box. + * @default true + */ modal?: boolean; /** - * Show the dashed lines above the crop box. - * @default true - */ + * Show the dashed lines above the crop box. + * @default true + */ guides?: boolean; /** - * Show the center indicator above the crop box. - * @default true - */ + * Show the center indicator above the crop box. + * @default true + */ center?: boolean; /** - * Show the white modal above the crop box (highlight the crop box). - * @default true - */ + * Show the white modal above the crop box (highlight the crop box). + * @default true + */ highlight?: boolean; /** - * Show the grid background of the container. - * @default true - */ + * Show the grid background of the container. + * @default true + */ background?: boolean; /** - * Enable to crop the image automatically when initialize. - * @default true - */ + * Enable to crop the image automatically when initialize. + * @default true + */ autoCrop?: boolean; /** - * A number between 0 and 1. Define the automatic cropping area size (percentage). - * @default 0.8 (80% of the image) - */ + * A number between 0 and 1. Define the automatic cropping area size (percentage). + * @default 0.8 (80% of the image) + */ autoCropArea?: number; /** - * Enable to move the image. - * @default true - */ + * Enable to move the image. + * @default true + */ movable?: boolean; /** - * Enable to rotate the image. - * @default true - */ + * Enable to rotate the image. + * @default true + */ rotatable?: boolean; /** - * Enable to restore the cropped area after resizing the window. - * @default true - */ + * Enable to restore the cropped area after resizing the window. + * @default true + */ restore?: boolean; /** - * Enable to scale the image. - * @default true - */ + * Enable to scale the image. + * @default true + */ scalable?: boolean; /** - * Enable to zoom the image. - * @default true - */ + * Enable to zoom the image. + * @default true + */ zoomable?: boolean; /** - * Enable to zoom the image by dragging touch. - * @default true - */ + * Enable to zoom the image by dragging touch. + * @default true + */ zoomOnTouch?: boolean; /** - * Enable to zoom the image by wheeling mouse. - * @default true - */ + * Enable to zoom the image by wheeling mouse. + * @default true + */ zoomOnWheel?: boolean; /** - * Define zoom ratio when zoom the image by wheeling mouse. - * @default 0.1 - */ + * Define zoom ratio when zoom the image by wheeling mouse. + * @default 0.1 + */ wheelZoomRatio?: number; /** - * Enable to move the crop box. - * @default true - */ + * Enable to move the crop box. + * @default true + */ cropBoxMovable?: boolean; /** - * Enable to resize the crop box. - * @default true - */ + * Enable to resize the crop box. + * @default true + */ cropBoxResizable?: boolean; /** - * Enable to toggle drag mode between "crop" and "move" when click twice on the cropper. - * @default true - */ + * Enable to toggle drag mode between "crop" and "move" when click twice on the cropper. + * @default true + */ toggleDragModeOnDblclick?: boolean; /** - * The minimum width of the container - * @default 200 - */ + * The minimum width of the container + * @default 200 + */ minContainerWidth?: number; /** - * The minimum height of the container. - * @default 100 - */ + * The minimum height of the container. + * @default 100 + */ minContainerHeight?: number; /** - * The minimum width of the canvas (image wrapper). - * @default 0 - */ + * The minimum width of the canvas (image wrapper). + * @default 0 + */ minCanvasWidth?: number; /** - * The minimum height of the canvas (image wrapper). - * @default 0 - */ + * The minimum height of the canvas (image wrapper). + * @default 0 + */ minCanvasHeight?: number; /** - * The minimum width of the crop box. - * @default 0 - */ + * The minimum width of the crop box. + * @default 0 + */ minCropBoxWidth?: number; /** - * The minimum height of the crop box. - * @default 0 - */ + * The minimum height of the crop box. + * @default 0 + */ minCropBoxHeight?: number; /** - * This function will be called when a cropper instance starts to load an image. - * Return false to prevent to build - * @default null - */ - build?: () => boolean; + * This function will be called when a cropper instance starts to load an image. + * Return false to prevent to build + * @default null + */ + build?(): boolean; /** - * This function will be called when a cropper instance has built completely. - * @default null - */ - built?: () => void; + * This function will be called when a cropper instance has built completely. + * @default null + */ + built?(): void; } interface Data { /** - * the offset left of the cropped area - */ + * the offset left of the cropped area + */ x: number; /** - * the offset top of the cropped area - */ + * the offset top of the cropped area + */ y: number; /** - * the width of the cropped area - */ + * the width of the cropped area + */ width: number; /** - * the height of the cropped area - */ + * the height of the cropped area + */ height: number; /** - * the rotated degrees of the image - */ + * the rotated degrees of the image + */ rotate: number; /** - * the scaling factor to apply on the abscissa of the image - */ + * the scaling factor to apply on the abscissa of the image + */ scaleX: number; /** - * the scaling factor to apply on the ordinate of the image - */ + * the scaling factor to apply on the ordinate of the image + */ scaleY: number; } interface CropStepData { @@ -284,7 +285,7 @@ declare namespace cropperjs { } interface ZoomData { /** - * The original event that was triggered + * The original event that was triggered * Options: wheel, touchmove */ originalEvent: Event; @@ -299,104 +300,108 @@ declare namespace cropperjs { } interface ContainerData { /** - * The current width of the container - */ + * The current width of the container + */ width: number; /** - * The current height of the container - */ + * The current height of the container + */ height: number; } interface CropBoxData { /** - * the offset left of the crop box - */ - left: number; + * the offset left of the crop box + */ + left?: number; /** - * the offset top of the crop box - */ - top: number; + * the offset top of the crop box + */ + top?: number; /** - * the width of the crop box - */ - width: number; + * the width of the crop box + */ + width?: number; /** - * the height of the crop box - */ - height: number; + * the height of the crop box + */ + height?: number; } interface CanvasData { /** - * offset left of the canvas - */ + * offset left of the canvas + */ left: number; /** - * new offset top of the canvas - */ + * new offset top of the canvas + */ top: number; /** - * new width of the canvas - */ + * new width of the canvas + */ width: number; /** - * new height of the canvas - */ + * new height of the canvas + */ height: number; } interface ImageData { /** - * the offset left of the image - */ + * the offset left of the image + */ left: number; /** - * the offset top of the image - */ + * the offset top of the image + */ top: number; /** - * the width of the image - */ + * the width of the image + */ width: number; /** - * the height of the image - */ + * the height of the image + */ height: number; /** - * the natural width of the image - */ + * the natural width of the image + */ naturalWidth: number; /** - * the natural height of the image - */ + * the natural height of the image + */ naturalHeight: number; /** - * the aspect ratio of the image - */ + * the aspect ratio of the image + */ aspectRatio: number; /** - * the rotated degrees of the image if rotated - */ + * the rotated degrees of the image if rotated + */ rotate: number; /** - * the scaling factor to apply on the abscissa of the image if scaled - */ + * the scaling factor to apply on the abscissa of the image if scaled + */ scaleX: number; /** - * the scaling factor to apply on the ordinate of the image if scaled - */ + * the scaling factor to apply on the ordinate of the image if scaled + */ scaleY: number; } interface CroppedCanvasOptions { /** - * the destination width of the output canvas - */ + * the destination width of the output canvas + */ width?: number; + minWidth?: number; + maxWidth?: number; /** - * the destination height of the output canvas - */ + * the destination height of the output canvas + */ height?: number; + minHeight?: number; + maxHeight?: number; /** - * a color to fill any alpha values in the output canvas - */ + * a color to fill any alpha values in the output canvas + */ fillColor?: string; } } @@ -409,144 +414,143 @@ declare class cropperjs { crop(): void; /** - * Clear the crop box. - */ + * Clear the crop box. + */ reset(): void; /** - * Replace the image's src and rebuild the cropper. - * @param url A new image url - */ + * Replace the image's src and rebuild the cropper. + * @param url A new image url + */ replace(url: string): void; /** - * Enable (unfreeze) the cropper. - */ + * Enable (unfreeze) the cropper. + */ enable(): void; /** - * Disable (freeze) the cropper - */ + * Disable (freeze) the cropper + */ disable(): void; /** - * Destroy the cropper and remove the instance from the image. - */ + * Destroy the cropper and remove the instance from the image. + */ destroy(): void; /** - * Move the canvas (image wrapper) with relative offsets. - * @param offsetX Moving size (px) in the horizontal direction. - * @param offsetY Moving size (px) in the vertical direction. - * If not present, its default value is offsetX. - */ + * Move the canvas (image wrapper) with relative offsets. + * @param offsetX Moving size (px) in the horizontal direction. + * @param offsetY Moving size (px) in the vertical direction. + * If not present, its default value is offsetX. + */ move(offsetX: number, offsetY?: number): void; /** - * Move the canvas (image wrapper) to an absolute point. - * @param x The left value of the canvas - * @param y The top value of the canvas - * If not present, its default value is x. - */ + * Move the canvas (image wrapper) to an absolute point. + * @param x The left value of the canvas + * @param y The top value of the canvas + * If not present, its default value is x. + */ moveTo(x: number, y?: number): void; /** - * Zoom the canvas (image wrapper) with a relative ratio. - * Zoom in: requires a positive number (ratio > 0) - * Zoom out: requires a negative number (ratio < 0) - */ + * Zoom the canvas (image wrapper) with a relative ratio. + * Zoom in: requires a positive number (ratio > 0) + * Zoom out: requires a negative number (ratio < 0) + */ zoom(ratio: number): void; /** - * Zoom the canvas (image wrapper) to an absolute ratio. - * Zoom in: requires a positive number (ratio > 0) - * Zoom out: requires a negative number (ratio < 0) - */ + * Zoom the canvas (image wrapper) to an absolute ratio. + * Zoom in: requires a positive number (ratio > 0) + * Zoom out: requires a negative number (ratio < 0) + */ zoomTo(ratio: number): void; /** - * Rotate the canvas (image wrapper) with a relative degree. - * Rotate right: requires a positive number (degree > 0) - * Rotate left: requires a negative number (degree < 0) - */ + * Rotate the canvas (image wrapper) with a relative degree. + * Rotate right: requires a positive number (degree > 0) + * Rotate left: requires a negative number (degree < 0) + */ rotate(degree: number): void; /** - * Rotate the canvas (image wrapper) to an absolute degree. - * Rotate right: requires a positive number (degree > 0) - * Rotate left: requires a negative number (degree < 0) - */ + * Rotate the canvas (image wrapper) to an absolute degree. + * Rotate right: requires a positive number (degree > 0) + * Rotate left: requires a negative number (degree < 0) + */ rotateTo(degree: number): void; /** - * Clear the crop box. - */ + * Clear the crop box. + */ clear(): void; /** - * Output the cropped area position and size data (base on the original image). - */ + * Output the cropped area position and size data (base on the original image). + */ getData(rounded?: boolean): cropperjs.Data; /** - * Change the cropped area position and size with new data (base on the original image). - */ + * Change the cropped area position and size with new data (base on the original image). + */ setData(data: cropperjs.Data): void; /** - * Output the container size data. - */ + * Output the container size data. + */ getContainerData(): cropperjs.ContainerData; /** - * Output the image position, size and other related data. - */ + * Output the image position, size and other related data. + */ getImageData(): cropperjs.ImageData; /** - * Output the canvas (image wrapper) position and size data. - */ + * Output the canvas (image wrapper) position and size data. + */ getCanvasData(): cropperjs.CanvasData & { /** - * the natural width of the canvas (read only) - */ + * the natural width of the canvas (read only) + */ naturalWidth: number; /** - * the natural height of the canvas (read only) - */ + * the natural height of the canvas (read only) + */ naturalHeight: number; }; /** - * Change the canvas (image wrapper) position and size with new data. - */ + * Change the canvas (image wrapper) position and size with new data. + */ setCanvasData(data: cropperjs.CanvasData): void; /** - * Output the crop box position and size data. - */ + * Output the crop box position and size data. + */ getCropBoxData(): cropperjs.CropBoxData; /** - * Change the crop box position and size with new data. - */ + * Change the crop box position and size with new data. + */ setCropBoxData(data: cropperjs.CropBoxData): void; /** - * Get a canvas drawn the cropped image. - */ + * Get a canvas drawn the cropped image. + */ getCroppedCanvas(options?: cropperjs.CroppedCanvasOptions): HTMLCanvasElement; /** - * Change the aspect ratio of the crop box. - */ + * Change the aspect ratio of the crop box. + */ setAspectRatio(aspectRatio: number): void; /** - * Change the drag mode. - */ + * Change the drag mode. + */ setDragMode(mode?: 'none' | 'crop' | 'move'): void; - } export = cropperjs; diff --git a/types/cropperjs/tslint.json b/types/cropperjs/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/cropperjs/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 58206d9fd36e2ea90402f3a08a6a6d5978c9467b Mon Sep 17 00:00:00 2001 From: Anton Myzenkov Date: Mon, 23 Oct 2017 22:50:54 +0300 Subject: [PATCH 026/252] [mongodb] Fix db.listCollections to use the optional parameter "filter" (#20562) * [mongodb] Fix db.listCollections Fix db.listCollections to return the information of a all collections. * [mongodb] Fix db.listCollections Added overload function for db.listCollections * [mongodb] Fix db.listCollections Fix db.listCollections to return the information of a all collections. --- types/mongodb/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/mongodb/index.d.ts b/types/mongodb/index.d.ts index d8e646670e..19cf0136e2 100644 --- a/types/mongodb/index.d.ts +++ b/types/mongodb/index.d.ts @@ -265,7 +265,7 @@ export class Db extends EventEmitter { indexInformation(name: string, options?: { full?: boolean, readPreference?: ReadPreference | string }): Promise; indexInformation(name: string, options: { full?: boolean, readPreference?: ReadPreference | string }, callback: MongoCallback): void; //http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#listCollections - listCollections(filter: Object, options?: { batchSize?: number, readPreference?: ReadPreference | string }): CommandCursor; + listCollections(filter?: Object, options?: { batchSize?: number, readPreference?: ReadPreference | string }): CommandCursor; //http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#logout logout(callback: MongoCallback): void; logout(options?: { dbName?: string }): Promise; From 76c122d1a44d2e81b513b40a332c45fb3bbd10ae Mon Sep 17 00:00:00 2001 From: nihiluis Date: Mon, 23 Oct 2017 21:56:04 +0200 Subject: [PATCH 027/252] add version property to Config for pg compatibility (#20584) --- types/knex/index.d.ts | 1 + types/knex/knex-tests.ts | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/types/knex/index.d.ts b/types/knex/index.d.ts index 71e3e0562a..6b09871f76 100644 --- a/types/knex/index.d.ts +++ b/types/knex/index.d.ts @@ -488,6 +488,7 @@ declare namespace Knex { debug?: boolean; client?: string; dialect?: string; + version?: string; connection?: string | ConnectionConfig | MariaSqlConnectionConfig | MySqlConnectionConfig | MsSqlConnectionConfig | Sqlite3ConnectionConfig | SocketConnectionConfig; pool?: PoolConfig; diff --git a/types/knex/knex-tests.ts b/types/knex/knex-tests.ts index 4c0ef8a209..de5414eac0 100644 --- a/types/knex/knex-tests.ts +++ b/types/knex/knex-tests.ts @@ -22,6 +22,20 @@ var knex = Knex({ } }); +var knex = Knex({ + debug: true, + client: 'pg', + version: '9.5', + connection: { + user : 'your_database_user', + password: 'your_database_password', + server : 'your_database_server', + options : { + database: 'myapp_test' + } + } +}); + var knex = Knex({ debug: true, client: 'mssql', From 2091df4cbf03a446ecefb81c1d49eee5ceb94925 Mon Sep 17 00:00:00 2001 From: samsonkeung Date: Mon, 23 Oct 2017 12:56:46 -0700 Subject: [PATCH 028/252] @type/ramda: Add type definition for startsWith (#20594) * added type definition for startsWith in Ramda * linting --- types/ramda/index.d.ts | 7 +++++-- types/ramda/ramda-tests.ts | 9 +++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index 776c074b73..0897dda51f 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -10,6 +10,7 @@ // Jordan Quagliatini // Simon Højberg // Charles-Philippe Clermont +// Samson Keung // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 @@ -1638,8 +1639,10 @@ declare namespace R { /** * Checks if a list starts with the provided values */ - startsWith(a: any, list: any): boolean; - startsWith(a: any): (list: any) => boolean; + startsWith(a: string, list: string): boolean; + startsWith(a: string): (list: string) => boolean; + startsWith(a: T | T[], list: T[]): boolean; + startsWith(a: T | T[]): (list: T[]) => boolean; /** * Subtracts two numbers. Equivalent to `a - b` but curried. diff --git a/types/ramda/ramda-tests.ts b/types/ramda/ramda-tests.ts index 973edf29e3..fdf53e7ab4 100644 --- a/types/ramda/ramda-tests.ts +++ b/types/ramda/ramda-tests.ts @@ -1883,6 +1883,15 @@ class Rectangle { const b: number[][] = R.splitWhen(R.equals(2))([1, 2, 3, 1, 2, 3]); // => [[1], [2, 3, 1, 2, 3]] }; +() => { + R.startsWith("a", "abc"); // => true + R.startsWith("a")("abc"); // => true + R.startsWith(1, [1, 2, 3]); // => true + R.startsWith(1)([1, 2, 3]); // => true + R.startsWith([1], [1, 2, 3]); // => true + R.startsWith([1])([1, 2, 3]); // => true +}; + () => { R.add(2, 3); // => 5 R.add(7)(10); // => 17 From a65d75a7cd7e42f3f92e2e9bc7935f932c644b1b Mon Sep 17 00:00:00 2001 From: Scott Date: Tue, 24 Oct 2017 03:57:17 +0800 Subject: [PATCH 029/252] Types/lodash-es auto-gen typings (#18725) * chore(generation): add script to generate typings automatically * docs: add a readme.md to state unfinished types * fix: improve generation and tsconfig files * chore(generate): add prettier to format generated code * feat(lodash-es): generate files and remove codes 1. noconflict and runincontext aren't inside lodash-es 2. seq-like function are removed temporarily. see readme.md * feat(lodash): add a bash script to generate all modules and remove lodash-es related code in lodash/scripts * fix(lodash-es): apply the new approach to declare types for default export constraints in typescript v2.6 see https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#arbitrary-expressions-are-forbidden-in-export-assignments-in-ambient-contexts --- types/lodash-es/README.md | 1 + types/lodash-es/array.d.ts | 67 +++ types/lodash-es/array.default.d.ts | 134 +++++ types/lodash-es/chain.d.ts | 2 - types/lodash-es/collection.d.ts | 30 + types/lodash-es/collection.default.d.ts | 60 ++ types/lodash-es/conforms.d.ts | 2 + types/lodash-es/conformsTo.d.ts | 2 + types/lodash-es/date.d.ts | 3 + types/lodash-es/date.default.d.ts | 6 + types/lodash-es/defaultTo.d.ts | 2 + types/lodash-es/function.d.ts | 25 + types/lodash-es/function.default.d.ts | 50 ++ types/lodash-es/index.d.ts | 605 ++++++++++---------- types/lodash-es/lang.d.ts | 58 ++ types/lodash-es/lang.default.d.ts | 116 ++++ types/lodash-es/lodash-es-tests.ts | 604 ++++++++++++++++++- types/lodash-es/math.d.ts | 17 + types/lodash-es/math.default.d.ts | 34 ++ types/lodash-es/multiply.d.ts | 2 + types/lodash-es/noConflict.d.ts | 2 - types/lodash-es/number.d.ts | 5 + types/lodash-es/number.default.d.ts | 10 + types/lodash-es/object.d.ts | 49 ++ types/lodash-es/object.default.d.ts | 98 ++++ types/lodash-es/runInContext.d.ts | 2 - types/lodash-es/scripts/generate-modules.ts | 180 ++++++ types/lodash-es/scripts/tsconfig.json | 10 + types/lodash-es/string.d.ts | 33 ++ types/lodash-es/string.default.d.ts | 66 +++ types/lodash-es/stubArray.d.ts | 2 + types/lodash-es/stubFalse.d.ts | 2 + types/lodash-es/stubObject.d.ts | 2 + types/lodash-es/stubString.d.ts | 2 + types/lodash-es/stubTrue.d.ts | 2 + types/lodash-es/tap.d.ts | 2 - types/lodash-es/templateSettings.d.ts | 2 + types/lodash-es/thru.d.ts | 2 - types/lodash-es/tsconfig.json | 41 +- types/lodash-es/util.d.ts | 34 ++ types/lodash-es/util.default.d.ts | 68 +++ types/lodash/scripts/generate-all.sh | 15 + types/lodash/scripts/generate-modules.ts | 37 +- 43 files changed, 2129 insertions(+), 357 deletions(-) create mode 100644 types/lodash-es/README.md create mode 100644 types/lodash-es/array.d.ts create mode 100644 types/lodash-es/array.default.d.ts delete mode 100644 types/lodash-es/chain.d.ts create mode 100644 types/lodash-es/collection.d.ts create mode 100644 types/lodash-es/collection.default.d.ts create mode 100644 types/lodash-es/conforms.d.ts create mode 100644 types/lodash-es/conformsTo.d.ts create mode 100644 types/lodash-es/date.d.ts create mode 100644 types/lodash-es/date.default.d.ts create mode 100644 types/lodash-es/defaultTo.d.ts create mode 100644 types/lodash-es/function.d.ts create mode 100644 types/lodash-es/function.default.d.ts create mode 100644 types/lodash-es/lang.d.ts create mode 100644 types/lodash-es/lang.default.d.ts create mode 100644 types/lodash-es/math.d.ts create mode 100644 types/lodash-es/math.default.d.ts create mode 100644 types/lodash-es/multiply.d.ts delete mode 100644 types/lodash-es/noConflict.d.ts create mode 100644 types/lodash-es/number.d.ts create mode 100644 types/lodash-es/number.default.d.ts create mode 100644 types/lodash-es/object.d.ts create mode 100644 types/lodash-es/object.default.d.ts delete mode 100644 types/lodash-es/runInContext.d.ts create mode 100644 types/lodash-es/scripts/generate-modules.ts create mode 100644 types/lodash-es/scripts/tsconfig.json create mode 100644 types/lodash-es/string.d.ts create mode 100644 types/lodash-es/string.default.d.ts create mode 100644 types/lodash-es/stubArray.d.ts create mode 100644 types/lodash-es/stubFalse.d.ts create mode 100644 types/lodash-es/stubObject.d.ts create mode 100644 types/lodash-es/stubString.d.ts create mode 100644 types/lodash-es/stubTrue.d.ts delete mode 100644 types/lodash-es/tap.d.ts create mode 100644 types/lodash-es/templateSettings.d.ts delete mode 100644 types/lodash-es/thru.d.ts create mode 100644 types/lodash-es/util.d.ts create mode 100644 types/lodash-es/util.default.d.ts create mode 100644 types/lodash/scripts/generate-all.sh diff --git a/types/lodash-es/README.md b/types/lodash-es/README.md new file mode 100644 index 0000000000..1116eee9f3 --- /dev/null +++ b/types/lodash-es/README.md @@ -0,0 +1 @@ +TODO: There is not much use cases for `seq`-like functions when using `lodash-es`, So I quit adding types for `seq`-like functions. If someone wants this kink of types, you can setup another PR. Also see Here https://github.com/lodash/lodash/issues/3298. diff --git a/types/lodash-es/array.d.ts b/types/lodash-es/array.d.ts new file mode 100644 index 0000000000..968a9649f8 --- /dev/null +++ b/types/lodash-es/array.d.ts @@ -0,0 +1,67 @@ +import { default as chunk } from "./chunk"; +import { default as compact } from "./compact"; +import { default as concat } from "./concat"; +import { default as difference } from "./difference"; +import { default as differenceBy } from "./differenceBy"; +import { default as differenceWith } from "./differenceWith"; +import { default as drop } from "./drop"; +import { default as dropRight } from "./dropRight"; +import { default as dropRightWhile } from "./dropRightWhile"; +import { default as dropWhile } from "./dropWhile"; +import { default as fill } from "./fill"; +import { default as findIndex } from "./findIndex"; +import { default as findLastIndex } from "./findLastIndex"; +import { default as first } from "./first"; +import { default as flatten } from "./flatten"; +import { default as flattenDeep } from "./flattenDeep"; +import { default as flattenDepth } from "./flattenDepth"; +import { default as fromPairs } from "./fromPairs"; +import { default as head } from "./head"; +import { default as indexOf } from "./indexOf"; +import { default as initial } from "./initial"; +import { default as intersection } from "./intersection"; +import { default as intersectionBy } from "./intersectionBy"; +import { default as intersectionWith } from "./intersectionWith"; +import { default as join } from "./join"; +import { default as last } from "./last"; +import { default as lastIndexOf } from "./lastIndexOf"; +import { default as nth } from "./nth"; +import { default as pull } from "./pull"; +import { default as pullAll } from "./pullAll"; +import { default as pullAllBy } from "./pullAllBy"; +import { default as pullAllWith } from "./pullAllWith"; +import { default as pullAt } from "./pullAt"; +import { default as remove } from "./remove"; +import { default as reverse } from "./reverse"; +import { default as slice } from "./slice"; +import { default as sortedIndex } from "./sortedIndex"; +import { default as sortedIndexBy } from "./sortedIndexBy"; +import { default as sortedIndexOf } from "./sortedIndexOf"; +import { default as sortedLastIndex } from "./sortedLastIndex"; +import { default as sortedLastIndexBy } from "./sortedLastIndexBy"; +import { default as sortedLastIndexOf } from "./sortedLastIndexOf"; +import { default as sortedUniq } from "./sortedUniq"; +import { default as sortedUniqBy } from "./sortedUniqBy"; +import { default as tail } from "./tail"; +import { default as take } from "./take"; +import { default as takeRight } from "./takeRight"; +import { default as takeRightWhile } from "./takeRightWhile"; +import { default as takeWhile } from "./takeWhile"; +import { default as union } from "./union"; +import { default as unionBy } from "./unionBy"; +import { default as unionWith } from "./unionWith"; +import { default as uniq } from "./uniq"; +import { default as uniqBy } from "./uniqBy"; +import { default as uniqWith } from "./uniqWith"; +import { default as unzip } from "./unzip"; +import { default as unzipWith } from "./unzipWith"; +import { default as without } from "./without"; +import { default as xor } from "./xor"; +import { default as xorBy } from "./xorBy"; +import { default as xorWith } from "./xorWith"; +import { default as zip } from "./zip"; +import { default as zipObject } from "./zipObject"; +import { default as zipObjectDeep } from "./zipObjectDeep"; +import { default as zipWith } from "./zipWith"; + +export { default } from "./array.default"; diff --git a/types/lodash-es/array.default.d.ts b/types/lodash-es/array.default.d.ts new file mode 100644 index 0000000000..d0abfaff10 --- /dev/null +++ b/types/lodash-es/array.default.d.ts @@ -0,0 +1,134 @@ +import chunk from "./chunk"; +import compact from "./compact"; +import concat from "./concat"; +import difference from "./difference"; +import differenceBy from "./differenceBy"; +import differenceWith from "./differenceWith"; +import drop from "./drop"; +import dropRight from "./dropRight"; +import dropRightWhile from "./dropRightWhile"; +import dropWhile from "./dropWhile"; +import fill from "./fill"; +import findIndex from "./findIndex"; +import findLastIndex from "./findLastIndex"; +import first from "./first"; +import flatten from "./flatten"; +import flattenDeep from "./flattenDeep"; +import flattenDepth from "./flattenDepth"; +import fromPairs from "./fromPairs"; +import head from "./head"; +import indexOf from "./indexOf"; +import initial from "./initial"; +import intersection from "./intersection"; +import intersectionBy from "./intersectionBy"; +import intersectionWith from "./intersectionWith"; +import join from "./join"; +import last from "./last"; +import lastIndexOf from "./lastIndexOf"; +import nth from "./nth"; +import pull from "./pull"; +import pullAll from "./pullAll"; +import pullAllBy from "./pullAllBy"; +import pullAllWith from "./pullAllWith"; +import pullAt from "./pullAt"; +import remove from "./remove"; +import reverse from "./reverse"; +import slice from "./slice"; +import sortedIndex from "./sortedIndex"; +import sortedIndexBy from "./sortedIndexBy"; +import sortedIndexOf from "./sortedIndexOf"; +import sortedLastIndex from "./sortedLastIndex"; +import sortedLastIndexBy from "./sortedLastIndexBy"; +import sortedLastIndexOf from "./sortedLastIndexOf"; +import sortedUniq from "./sortedUniq"; +import sortedUniqBy from "./sortedUniqBy"; +import tail from "./tail"; +import take from "./take"; +import takeRight from "./takeRight"; +import takeRightWhile from "./takeRightWhile"; +import takeWhile from "./takeWhile"; +import union from "./union"; +import unionBy from "./unionBy"; +import unionWith from "./unionWith"; +import uniq from "./uniq"; +import uniqBy from "./uniqBy"; +import uniqWith from "./uniqWith"; +import unzip from "./unzip"; +import unzipWith from "./unzipWith"; +import without from "./without"; +import xor from "./xor"; +import xorBy from "./xorBy"; +import xorWith from "./xorWith"; +import zip from "./zip"; +import zipObject from "./zipObject"; +import zipObjectDeep from "./zipObjectDeep"; +import zipWith from "./zipWith"; + +declare const defaultExport: { + chunk: typeof chunk; + compact: typeof compact; + concat: typeof concat; + difference: typeof difference; + differenceBy: typeof differenceBy; + differenceWith: typeof differenceWith; + drop: typeof drop; + dropRight: typeof dropRight; + dropRightWhile: typeof dropRightWhile; + dropWhile: typeof dropWhile; + fill: typeof fill; + findIndex: typeof findIndex; + findLastIndex: typeof findLastIndex; + first: typeof first; + flatten: typeof flatten; + flattenDeep: typeof flattenDeep; + flattenDepth: typeof flattenDepth; + fromPairs: typeof fromPairs; + head: typeof head; + indexOf: typeof indexOf; + initial: typeof initial; + intersection: typeof intersection; + intersectionBy: typeof intersectionBy; + intersectionWith: typeof intersectionWith; + join: typeof join; + last: typeof last; + lastIndexOf: typeof lastIndexOf; + nth: typeof nth; + pull: typeof pull; + pullAll: typeof pullAll; + pullAllBy: typeof pullAllBy; + pullAllWith: typeof pullAllWith; + pullAt: typeof pullAt; + remove: typeof remove; + reverse: typeof reverse; + slice: typeof slice; + sortedIndex: typeof sortedIndex; + sortedIndexBy: typeof sortedIndexBy; + sortedIndexOf: typeof sortedIndexOf; + sortedLastIndex: typeof sortedLastIndex; + sortedLastIndexBy: typeof sortedLastIndexBy; + sortedLastIndexOf: typeof sortedLastIndexOf; + sortedUniq: typeof sortedUniq; + sortedUniqBy: typeof sortedUniqBy; + tail: typeof tail; + take: typeof take; + takeRight: typeof takeRight; + takeRightWhile: typeof takeRightWhile; + takeWhile: typeof takeWhile; + union: typeof union; + unionBy: typeof unionBy; + unionWith: typeof unionWith; + uniq: typeof uniq; + uniqBy: typeof uniqBy; + uniqWith: typeof uniqWith; + unzip: typeof unzip; + unzipWith: typeof unzipWith; + without: typeof without; + xor: typeof xor; + xorBy: typeof xorBy; + xorWith: typeof xorWith; + zip: typeof zip; + zipObject: typeof zipObject; + zipObjectDeep: typeof zipObjectDeep; + zipWith: typeof zipWith; +}; +export default defaultExport; diff --git a/types/lodash-es/chain.d.ts b/types/lodash-es/chain.d.ts deleted file mode 100644 index 968e2c0a4e..0000000000 --- a/types/lodash-es/chain.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -import { chain } from "lodash"; -export default chain; diff --git a/types/lodash-es/collection.d.ts b/types/lodash-es/collection.d.ts new file mode 100644 index 0000000000..14f6ab3987 --- /dev/null +++ b/types/lodash-es/collection.d.ts @@ -0,0 +1,30 @@ +import { default as countBy } from "./countBy"; +import { default as each } from "./each"; +import { default as eachRight } from "./eachRight"; +import { default as every } from "./every"; +import { default as filter } from "./filter"; +import { default as find } from "./find"; +import { default as findLast } from "./findLast"; +import { default as flatMap } from "./flatMap"; +import { default as flatMapDeep } from "./flatMapDeep"; +import { default as flatMapDepth } from "./flatMapDepth"; +import { default as forEach } from "./forEach"; +import { default as forEachRight } from "./forEachRight"; +import { default as groupBy } from "./groupBy"; +import { default as includes } from "./includes"; +import { default as invokeMap } from "./invokeMap"; +import { default as keyBy } from "./keyBy"; +import { default as map } from "./map"; +import { default as orderBy } from "./orderBy"; +import { default as partition } from "./partition"; +import { default as reduce } from "./reduce"; +import { default as reduceRight } from "./reduceRight"; +import { default as reject } from "./reject"; +import { default as sample } from "./sample"; +import { default as sampleSize } from "./sampleSize"; +import { default as shuffle } from "./shuffle"; +import { default as size } from "./size"; +import { default as some } from "./some"; +import { default as sortBy } from "./sortBy"; + +export { default } from "./collection.default"; diff --git a/types/lodash-es/collection.default.d.ts b/types/lodash-es/collection.default.d.ts new file mode 100644 index 0000000000..80849edfc0 --- /dev/null +++ b/types/lodash-es/collection.default.d.ts @@ -0,0 +1,60 @@ +import countBy from "./countBy"; +import each from "./each"; +import eachRight from "./eachRight"; +import every from "./every"; +import filter from "./filter"; +import find from "./find"; +import findLast from "./findLast"; +import flatMap from "./flatMap"; +import flatMapDeep from "./flatMapDeep"; +import flatMapDepth from "./flatMapDepth"; +import forEach from "./forEach"; +import forEachRight from "./forEachRight"; +import groupBy from "./groupBy"; +import includes from "./includes"; +import invokeMap from "./invokeMap"; +import keyBy from "./keyBy"; +import map from "./map"; +import orderBy from "./orderBy"; +import partition from "./partition"; +import reduce from "./reduce"; +import reduceRight from "./reduceRight"; +import reject from "./reject"; +import sample from "./sample"; +import sampleSize from "./sampleSize"; +import shuffle from "./shuffle"; +import size from "./size"; +import some from "./some"; +import sortBy from "./sortBy"; + +declare const defaultExport: { + countBy: typeof countBy; + each: typeof each; + eachRight: typeof eachRight; + every: typeof every; + filter: typeof filter; + find: typeof find; + findLast: typeof findLast; + flatMap: typeof flatMap; + flatMapDeep: typeof flatMapDeep; + flatMapDepth: typeof flatMapDepth; + forEach: typeof forEach; + forEachRight: typeof forEachRight; + groupBy: typeof groupBy; + includes: typeof includes; + invokeMap: typeof invokeMap; + keyBy: typeof keyBy; + map: typeof map; + orderBy: typeof orderBy; + partition: typeof partition; + reduce: typeof reduce; + reduceRight: typeof reduceRight; + reject: typeof reject; + sample: typeof sample; + sampleSize: typeof sampleSize; + shuffle: typeof shuffle; + size: typeof size; + some: typeof some; + sortBy: typeof sortBy; +}; +export default defaultExport; diff --git a/types/lodash-es/conforms.d.ts b/types/lodash-es/conforms.d.ts new file mode 100644 index 0000000000..f2cc0fe6ea --- /dev/null +++ b/types/lodash-es/conforms.d.ts @@ -0,0 +1,2 @@ +import { conforms } from "lodash"; +export default conforms; diff --git a/types/lodash-es/conformsTo.d.ts b/types/lodash-es/conformsTo.d.ts new file mode 100644 index 0000000000..23bf438ebe --- /dev/null +++ b/types/lodash-es/conformsTo.d.ts @@ -0,0 +1,2 @@ +import { conformsTo } from "lodash"; +export default conformsTo; diff --git a/types/lodash-es/date.d.ts b/types/lodash-es/date.d.ts new file mode 100644 index 0000000000..63dfcfc79d --- /dev/null +++ b/types/lodash-es/date.d.ts @@ -0,0 +1,3 @@ +import { default as now } from "./now"; + +export { default } from "./date.default"; diff --git a/types/lodash-es/date.default.d.ts b/types/lodash-es/date.default.d.ts new file mode 100644 index 0000000000..cc7ad11223 --- /dev/null +++ b/types/lodash-es/date.default.d.ts @@ -0,0 +1,6 @@ +import now from "./now"; + +declare const defaultExport: { + now: typeof now; +}; +export default defaultExport; diff --git a/types/lodash-es/defaultTo.d.ts b/types/lodash-es/defaultTo.d.ts new file mode 100644 index 0000000000..a514d56369 --- /dev/null +++ b/types/lodash-es/defaultTo.d.ts @@ -0,0 +1,2 @@ +import { defaultTo } from "lodash"; +export default defaultTo; diff --git a/types/lodash-es/function.d.ts b/types/lodash-es/function.d.ts new file mode 100644 index 0000000000..3f60c35a06 --- /dev/null +++ b/types/lodash-es/function.d.ts @@ -0,0 +1,25 @@ +import { default as after } from "./after"; +import { default as ary } from "./ary"; +import { default as before } from "./before"; +import { default as bind } from "./bind"; +import { default as bindKey } from "./bindKey"; +import { default as curry } from "./curry"; +import { default as curryRight } from "./curryRight"; +import { default as debounce } from "./debounce"; +import { default as defer } from "./defer"; +import { default as delay } from "./delay"; +import { default as flip } from "./flip"; +import { default as memoize } from "./memoize"; +import { default as negate } from "./negate"; +import { default as once } from "./once"; +import { default as overArgs } from "./overArgs"; +import { default as partial } from "./partial"; +import { default as partialRight } from "./partialRight"; +import { default as rearg } from "./rearg"; +import { default as rest } from "./rest"; +import { default as spread } from "./spread"; +import { default as throttle } from "./throttle"; +import { default as unary } from "./unary"; +import { default as wrap } from "./wrap"; + +export { default } from "./function.default"; diff --git a/types/lodash-es/function.default.d.ts b/types/lodash-es/function.default.d.ts new file mode 100644 index 0000000000..1e3766e959 --- /dev/null +++ b/types/lodash-es/function.default.d.ts @@ -0,0 +1,50 @@ +import after from "./after"; +import ary from "./ary"; +import before from "./before"; +import bind from "./bind"; +import bindKey from "./bindKey"; +import curry from "./curry"; +import curryRight from "./curryRight"; +import debounce from "./debounce"; +import defer from "./defer"; +import delay from "./delay"; +import flip from "./flip"; +import memoize from "./memoize"; +import negate from "./negate"; +import once from "./once"; +import overArgs from "./overArgs"; +import partial from "./partial"; +import partialRight from "./partialRight"; +import rearg from "./rearg"; +import rest from "./rest"; +import spread from "./spread"; +import throttle from "./throttle"; +import unary from "./unary"; +import wrap from "./wrap"; + +declare const defaultExport: { + after: typeof after; + ary: typeof ary; + before: typeof before; + bind: typeof bind; + bindKey: typeof bindKey; + curry: typeof curry; + curryRight: typeof curryRight; + debounce: typeof debounce; + defer: typeof defer; + delay: typeof delay; + flip: typeof flip; + memoize: typeof memoize; + negate: typeof negate; + once: typeof once; + overArgs: typeof overArgs; + partial: typeof partial; + partialRight: typeof partialRight; + rearg: typeof rearg; + rest: typeof rest; + spread: typeof spread; + throttle: typeof throttle; + unary: typeof unary; + wrap: typeof wrap; +}; +export default defaultExport; diff --git a/types/lodash-es/index.d.ts b/types/lodash-es/index.d.ts index 7389fc7900..13695ae66b 100644 --- a/types/lodash-es/index.d.ts +++ b/types/lodash-es/index.d.ts @@ -1,306 +1,307 @@ -// Type definitions for lodash-es 4.14 +// Type definitions for lodash-es 4.17 // Project: http://lodash.com/ -// Definitions by: Stephen Lautier +// Definitions by: Stephen Lautier , e-cloud // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 -// Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts - -export { - add, - after, - ary, - assign, - assignIn, - assignInWith, - assignWith, - at, - attempt, - before, - bind, - bindAll, - bindKey, - camelCase, - capitalize, - castArray, - ceil, - chain, - chunk, - clamp, - clone, - cloneDeep, - cloneDeepWith, - cloneWith, - compact, - concat, - cond, - constant, - countBy, - create, - curry, - curryRight, - debounce, - deburr, - defaults, - defaultsDeep, - defer, - delay, - difference, - differenceBy, - differenceWith, - divide, - drop, - dropRight, - dropRightWhile, - dropWhile, - each, - eachRight, - endsWith, - entries, - entriesIn, - eq, - escape, - escapeRegExp, - every, - extend, - extendWith, - fill, - filter, - find, - findIndex, - findKey, - findLast, - findLastIndex, - findLastKey, - first, - flatMap, - flatMapDeep, - flatMapDepth, - flatten, - flattenDeep, - flattenDepth, - flip, - floor, - flow, - flowRight, - forEach, - forEachRight, - forIn, - forInRight, - forOwn, - forOwnRight, - fromPairs, - functions, - functionsIn, - get, - groupBy, - gt, - gte, - has, - hasIn, - head, - identity, - includes, - indexOf, - initial, - inRange, - intersection, - intersectionBy, - intersectionWith, - invert, - invertBy, - invoke, - invokeMap, - isArguments, - isArray, - isArrayBuffer, - isArrayLike, - isArrayLikeObject, - isBoolean, - isBuffer, - isDate, - isElement, - isEmpty, - isEqual, - isEqualWith, - isError, - isFinite, - isFunction, - isInteger, - isLength, - isMap, - isMatch, - isMatchWith, - isNaN, - isNative, - isNil, - isNull, - isNumber, - isObject, - isObjectLike, - isPlainObject, - isRegExp, - isSafeInteger, - isSet, - isString, - isSymbol, - isTypedArray, - isUndefined, - isWeakMap, - isWeakSet, - iteratee, - join, - kebabCase, - keyBy, - keys, - keysIn, - last, - lastIndexOf, - lowerCase, - lowerFirst, - lt, - lte, - map, - mapKeys, - mapValues, - matches, - matchesProperty, - max, - maxBy, - mean, - meanBy, - memoize, - merge, - mergeWith, - method, - methodOf, - min, - minBy, - mixin, - negate, - noConflict, - noop, - now, - nth, - nthArg, - omit, - omitBy, - once, - orderBy, - over, - overArgs, - overEvery, - overSome, - pad, - padEnd, - padStart, - parseInt, - partial, - partialRight, - partition, - pick, - pickBy, - property, - propertyOf, - pull, - pullAll, - pullAllBy, - pullAllWith, - pullAt, - random, - range, - rangeRight, - rearg, - reduce, - reduceRight, - reject, - remove, - repeat, - replace, - rest, - result, - reverse, - round, - runInContext, - sample, - sampleSize, - set, - setWith, - shuffle, - size, - slice, - snakeCase, - some, - sortBy, - sortedIndex, - sortedIndexBy, - sortedIndexOf, - sortedLastIndex, - sortedLastIndexBy, - sortedLastIndexOf, - sortedUniq, - sortedUniqBy, - split, - spread, - startCase, - startsWith, - subtract, - sum, - sumBy, - tail, - take, - takeRight, - takeRightWhile, - takeWhile, - tap, - template, - throttle, - thru, - times, - toArray, - toFinite, - toInteger, - toLength, - toLower, - toNumber, - toPairs, - toPairsIn, - toPath, - toPlainObject, - toSafeInteger, - toString, - toUpper, - transform, - trim, - trimEnd, - trimStart, - truncate, - unary, - unescape, - union, - unionBy, - unionWith, - uniq, - uniqBy, - uniqueId, - uniqWith, - unset, - unzip, - unzipWith, - update, - updateWith, - upperCase, - upperFirst, - values, - valuesIn, - without, - words, - wrap, - xor, - xorBy, - xorWith, - zip, - zipObject, - zipObjectDeep, - zipWith -} from "lodash"; +export { default as add } from "./add"; +export { default as after } from "./after"; +export { default as ary } from "./ary"; +export { default as assign } from "./assign"; +export { default as assignIn } from "./assignIn"; +export { default as assignInWith } from "./assignInWith"; +export { default as assignWith } from "./assignWith"; +export { default as at } from "./at"; +export { default as attempt } from "./attempt"; +export { default as before } from "./before"; +export { default as bind } from "./bind"; +export { default as bindAll } from "./bindAll"; +export { default as bindKey } from "./bindKey"; +export { default as camelCase } from "./camelCase"; +export { default as capitalize } from "./capitalize"; +export { default as castArray } from "./castArray"; +export { default as ceil } from "./ceil"; +export { default as chunk } from "./chunk"; +export { default as clamp } from "./clamp"; +export { default as clone } from "./clone"; +export { default as cloneDeep } from "./cloneDeep"; +export { default as cloneDeepWith } from "./cloneDeepWith"; +export { default as cloneWith } from "./cloneWith"; +export { default as compact } from "./compact"; +export { default as concat } from "./concat"; +export { default as cond } from "./cond"; +export { default as conforms } from "./conforms"; +export { default as conformsTo } from "./conformsTo"; +export { default as constant } from "./constant"; +export { default as countBy } from "./countBy"; +export { default as create } from "./create"; +export { default as curry } from "./curry"; +export { default as curryRight } from "./curryRight"; +export { default as debounce } from "./debounce"; +export { default as deburr } from "./deburr"; +export { default as defaultTo } from "./defaultTo"; +export { default as defaults } from "./defaults"; +export { default as defaultsDeep } from "./defaultsDeep"; +export { default as defer } from "./defer"; +export { default as delay } from "./delay"; +export { default as difference } from "./difference"; +export { default as differenceBy } from "./differenceBy"; +export { default as differenceWith } from "./differenceWith"; +export { default as divide } from "./divide"; +export { default as drop } from "./drop"; +export { default as dropRight } from "./dropRight"; +export { default as dropRightWhile } from "./dropRightWhile"; +export { default as dropWhile } from "./dropWhile"; +export { default as each } from "./each"; +export { default as eachRight } from "./eachRight"; +export { default as endsWith } from "./endsWith"; +export { default as entries } from "./entries"; +export { default as entriesIn } from "./entriesIn"; +export { default as eq } from "./eq"; +export { default as escape } from "./escape"; +export { default as escapeRegExp } from "./escapeRegExp"; +export { default as every } from "./every"; +export { default as extend } from "./extend"; +export { default as extendWith } from "./extendWith"; +export { default as fill } from "./fill"; +export { default as filter } from "./filter"; +export { default as find } from "./find"; +export { default as findIndex } from "./findIndex"; +export { default as findKey } from "./findKey"; +export { default as findLast } from "./findLast"; +export { default as findLastIndex } from "./findLastIndex"; +export { default as findLastKey } from "./findLastKey"; +export { default as first } from "./first"; +export { default as flatMap } from "./flatMap"; +export { default as flatMapDeep } from "./flatMapDeep"; +export { default as flatMapDepth } from "./flatMapDepth"; +export { default as flatten } from "./flatten"; +export { default as flattenDeep } from "./flattenDeep"; +export { default as flattenDepth } from "./flattenDepth"; +export { default as flip } from "./flip"; +export { default as floor } from "./floor"; +export { default as flow } from "./flow"; +export { default as flowRight } from "./flowRight"; +export { default as forEach } from "./forEach"; +export { default as forEachRight } from "./forEachRight"; +export { default as forIn } from "./forIn"; +export { default as forInRight } from "./forInRight"; +export { default as forOwn } from "./forOwn"; +export { default as forOwnRight } from "./forOwnRight"; +export { default as fromPairs } from "./fromPairs"; +export { default as functions } from "./functions"; +export { default as functionsIn } from "./functionsIn"; +export { default as get } from "./get"; +export { default as groupBy } from "./groupBy"; +export { default as gt } from "./gt"; +export { default as gte } from "./gte"; +export { default as has } from "./has"; +export { default as hasIn } from "./hasIn"; +export { default as head } from "./head"; +export { default as identity } from "./identity"; +export { default as inRange } from "./inRange"; +export { default as includes } from "./includes"; +export { default as indexOf } from "./indexOf"; +export { default as initial } from "./initial"; +export { default as intersection } from "./intersection"; +export { default as intersectionBy } from "./intersectionBy"; +export { default as intersectionWith } from "./intersectionWith"; +export { default as invert } from "./invert"; +export { default as invertBy } from "./invertBy"; +export { default as invoke } from "./invoke"; +export { default as invokeMap } from "./invokeMap"; +export { default as isArguments } from "./isArguments"; +export { default as isArray } from "./isArray"; +export { default as isArrayBuffer } from "./isArrayBuffer"; +export { default as isArrayLike } from "./isArrayLike"; +export { default as isArrayLikeObject } from "./isArrayLikeObject"; +export { default as isBoolean } from "./isBoolean"; +export { default as isBuffer } from "./isBuffer"; +export { default as isDate } from "./isDate"; +export { default as isElement } from "./isElement"; +export { default as isEmpty } from "./isEmpty"; +export { default as isEqual } from "./isEqual"; +export { default as isEqualWith } from "./isEqualWith"; +export { default as isError } from "./isError"; +export { default as isFinite } from "./isFinite"; +export { default as isFunction } from "./isFunction"; +export { default as isInteger } from "./isInteger"; +export { default as isLength } from "./isLength"; +export { default as isMap } from "./isMap"; +export { default as isMatch } from "./isMatch"; +export { default as isMatchWith } from "./isMatchWith"; +export { default as isNaN } from "./isNaN"; +export { default as isNative } from "./isNative"; +export { default as isNil } from "./isNil"; +export { default as isNull } from "./isNull"; +export { default as isNumber } from "./isNumber"; +export { default as isObject } from "./isObject"; +export { default as isObjectLike } from "./isObjectLike"; +export { default as isPlainObject } from "./isPlainObject"; +export { default as isRegExp } from "./isRegExp"; +export { default as isSafeInteger } from "./isSafeInteger"; +export { default as isSet } from "./isSet"; +export { default as isString } from "./isString"; +export { default as isSymbol } from "./isSymbol"; +export { default as isTypedArray } from "./isTypedArray"; +export { default as isUndefined } from "./isUndefined"; +export { default as isWeakMap } from "./isWeakMap"; +export { default as isWeakSet } from "./isWeakSet"; +export { default as iteratee } from "./iteratee"; +export { default as join } from "./join"; +export { default as kebabCase } from "./kebabCase"; +export { default as keyBy } from "./keyBy"; +export { default as keys } from "./keys"; +export { default as keysIn } from "./keysIn"; +export { default as last } from "./last"; +export { default as lastIndexOf } from "./lastIndexOf"; +export { default as lowerCase } from "./lowerCase"; +export { default as lowerFirst } from "./lowerFirst"; +export { default as lt } from "./lt"; +export { default as lte } from "./lte"; +export { default as map } from "./map"; +export { default as mapKeys } from "./mapKeys"; +export { default as mapValues } from "./mapValues"; +export { default as matches } from "./matches"; +export { default as matchesProperty } from "./matchesProperty"; +export { default as max } from "./max"; +export { default as maxBy } from "./maxBy"; +export { default as mean } from "./mean"; +export { default as meanBy } from "./meanBy"; +export { default as memoize } from "./memoize"; +export { default as merge } from "./merge"; +export { default as mergeWith } from "./mergeWith"; +export { default as method } from "./method"; +export { default as methodOf } from "./methodOf"; +export { default as min } from "./min"; +export { default as minBy } from "./minBy"; +export { default as mixin } from "./mixin"; +export { default as multiply } from "./multiply"; +export { default as negate } from "./negate"; +export { default as noop } from "./noop"; +export { default as now } from "./now"; +export { default as nth } from "./nth"; +export { default as nthArg } from "./nthArg"; +export { default as omit } from "./omit"; +export { default as omitBy } from "./omitBy"; +export { default as once } from "./once"; +export { default as orderBy } from "./orderBy"; +export { default as over } from "./over"; +export { default as overArgs } from "./overArgs"; +export { default as overEvery } from "./overEvery"; +export { default as overSome } from "./overSome"; +export { default as pad } from "./pad"; +export { default as padEnd } from "./padEnd"; +export { default as padStart } from "./padStart"; +export { default as parseInt } from "./parseInt"; +export { default as partial } from "./partial"; +export { default as partialRight } from "./partialRight"; +export { default as partition } from "./partition"; +export { default as pick } from "./pick"; +export { default as pickBy } from "./pickBy"; +export { default as property } from "./property"; +export { default as propertyOf } from "./propertyOf"; +export { default as pull } from "./pull"; +export { default as pullAll } from "./pullAll"; +export { default as pullAllBy } from "./pullAllBy"; +export { default as pullAllWith } from "./pullAllWith"; +export { default as pullAt } from "./pullAt"; +export { default as random } from "./random"; +export { default as range } from "./range"; +export { default as rangeRight } from "./rangeRight"; +export { default as rearg } from "./rearg"; +export { default as reduce } from "./reduce"; +export { default as reduceRight } from "./reduceRight"; +export { default as reject } from "./reject"; +export { default as remove } from "./remove"; +export { default as repeat } from "./repeat"; +export { default as replace } from "./replace"; +export { default as rest } from "./rest"; +export { default as result } from "./result"; +export { default as reverse } from "./reverse"; +export { default as round } from "./round"; +export { default as sample } from "./sample"; +export { default as sampleSize } from "./sampleSize"; +export { default as set } from "./set"; +export { default as setWith } from "./setWith"; +export { default as shuffle } from "./shuffle"; +export { default as size } from "./size"; +export { default as slice } from "./slice"; +export { default as snakeCase } from "./snakeCase"; +export { default as some } from "./some"; +export { default as sortBy } from "./sortBy"; +export { default as sortedIndex } from "./sortedIndex"; +export { default as sortedIndexBy } from "./sortedIndexBy"; +export { default as sortedIndexOf } from "./sortedIndexOf"; +export { default as sortedLastIndex } from "./sortedLastIndex"; +export { default as sortedLastIndexBy } from "./sortedLastIndexBy"; +export { default as sortedLastIndexOf } from "./sortedLastIndexOf"; +export { default as sortedUniq } from "./sortedUniq"; +export { default as sortedUniqBy } from "./sortedUniqBy"; +export { default as split } from "./split"; +export { default as spread } from "./spread"; +export { default as startCase } from "./startCase"; +export { default as startsWith } from "./startsWith"; +export { default as stubArray } from "./stubArray"; +export { default as stubFalse } from "./stubFalse"; +export { default as stubObject } from "./stubObject"; +export { default as stubString } from "./stubString"; +export { default as stubTrue } from "./stubTrue"; +export { default as subtract } from "./subtract"; +export { default as sum } from "./sum"; +export { default as sumBy } from "./sumBy"; +export { default as tail } from "./tail"; +export { default as take } from "./take"; +export { default as takeRight } from "./takeRight"; +export { default as takeRightWhile } from "./takeRightWhile"; +export { default as takeWhile } from "./takeWhile"; +export { default as template } from "./template"; +export { default as templateSettings } from "./templateSettings"; +export { default as throttle } from "./throttle"; +export { default as times } from "./times"; +export { default as toArray } from "./toArray"; +export { default as toFinite } from "./toFinite"; +export { default as toInteger } from "./toInteger"; +export { default as toLength } from "./toLength"; +export { default as toLower } from "./toLower"; +export { default as toNumber } from "./toNumber"; +export { default as toPairs } from "./toPairs"; +export { default as toPairsIn } from "./toPairsIn"; +export { default as toPath } from "./toPath"; +export { default as toPlainObject } from "./toPlainObject"; +export { default as toSafeInteger } from "./toSafeInteger"; +export { default as toString } from "./toString"; +export { default as toUpper } from "./toUpper"; +export { default as transform } from "./transform"; +export { default as trim } from "./trim"; +export { default as trimEnd } from "./trimEnd"; +export { default as trimStart } from "./trimStart"; +export { default as truncate } from "./truncate"; +export { default as unary } from "./unary"; +export { default as unescape } from "./unescape"; +export { default as union } from "./union"; +export { default as unionBy } from "./unionBy"; +export { default as unionWith } from "./unionWith"; +export { default as uniq } from "./uniq"; +export { default as uniqBy } from "./uniqBy"; +export { default as uniqWith } from "./uniqWith"; +export { default as uniqueId } from "./uniqueId"; +export { default as unset } from "./unset"; +export { default as unzip } from "./unzip"; +export { default as unzipWith } from "./unzipWith"; +export { default as update } from "./update"; +export { default as updateWith } from "./updateWith"; +export { default as upperCase } from "./upperCase"; +export { default as upperFirst } from "./upperFirst"; +export { default as values } from "./values"; +export { default as valuesIn } from "./valuesIn"; +export { default as without } from "./without"; +export { default as words } from "./words"; +export { default as wrap } from "./wrap"; +export { default as xor } from "./xor"; +export { default as xorBy } from "./xorBy"; +export { default as xorWith } from "./xorWith"; +export { default as zip } from "./zip"; +export { default as zipObject } from "./zipObject"; +export { default as zipObjectDeep } from "./zipObjectDeep"; +export { default as zipWith } from "./zipWith"; diff --git a/types/lodash-es/lang.d.ts b/types/lodash-es/lang.d.ts new file mode 100644 index 0000000000..c3566b5da2 --- /dev/null +++ b/types/lodash-es/lang.d.ts @@ -0,0 +1,58 @@ +import { default as castArray } from "./castArray"; +import { default as clone } from "./clone"; +import { default as cloneDeep } from "./cloneDeep"; +import { default as cloneDeepWith } from "./cloneDeepWith"; +import { default as cloneWith } from "./cloneWith"; +import { default as conformsTo } from "./conformsTo"; +import { default as eq } from "./eq"; +import { default as gt } from "./gt"; +import { default as gte } from "./gte"; +import { default as isArguments } from "./isArguments"; +import { default as isArray } from "./isArray"; +import { default as isArrayBuffer } from "./isArrayBuffer"; +import { default as isArrayLike } from "./isArrayLike"; +import { default as isArrayLikeObject } from "./isArrayLikeObject"; +import { default as isBoolean } from "./isBoolean"; +import { default as isBuffer } from "./isBuffer"; +import { default as isDate } from "./isDate"; +import { default as isElement } from "./isElement"; +import { default as isEmpty } from "./isEmpty"; +import { default as isEqual } from "./isEqual"; +import { default as isEqualWith } from "./isEqualWith"; +import { default as isError } from "./isError"; +import { default as isFinite } from "./isFinite"; +import { default as isFunction } from "./isFunction"; +import { default as isInteger } from "./isInteger"; +import { default as isLength } from "./isLength"; +import { default as isMap } from "./isMap"; +import { default as isMatch } from "./isMatch"; +import { default as isMatchWith } from "./isMatchWith"; +import { default as isNaN } from "./isNaN"; +import { default as isNative } from "./isNative"; +import { default as isNil } from "./isNil"; +import { default as isNull } from "./isNull"; +import { default as isNumber } from "./isNumber"; +import { default as isObject } from "./isObject"; +import { default as isObjectLike } from "./isObjectLike"; +import { default as isPlainObject } from "./isPlainObject"; +import { default as isRegExp } from "./isRegExp"; +import { default as isSafeInteger } from "./isSafeInteger"; +import { default as isSet } from "./isSet"; +import { default as isString } from "./isString"; +import { default as isSymbol } from "./isSymbol"; +import { default as isTypedArray } from "./isTypedArray"; +import { default as isUndefined } from "./isUndefined"; +import { default as isWeakMap } from "./isWeakMap"; +import { default as isWeakSet } from "./isWeakSet"; +import { default as lt } from "./lt"; +import { default as lte } from "./lte"; +import { default as toArray } from "./toArray"; +import { default as toFinite } from "./toFinite"; +import { default as toInteger } from "./toInteger"; +import { default as toLength } from "./toLength"; +import { default as toNumber } from "./toNumber"; +import { default as toPlainObject } from "./toPlainObject"; +import { default as toSafeInteger } from "./toSafeInteger"; +import { default as toString } from "./toString"; + +export { default } from "./lang.default"; diff --git a/types/lodash-es/lang.default.d.ts b/types/lodash-es/lang.default.d.ts new file mode 100644 index 0000000000..f69042a062 --- /dev/null +++ b/types/lodash-es/lang.default.d.ts @@ -0,0 +1,116 @@ +import castArray from "./castArray"; +import clone from "./clone"; +import cloneDeep from "./cloneDeep"; +import cloneDeepWith from "./cloneDeepWith"; +import cloneWith from "./cloneWith"; +import conformsTo from "./conformsTo"; +import eq from "./eq"; +import gt from "./gt"; +import gte from "./gte"; +import isArguments from "./isArguments"; +import isArray from "./isArray"; +import isArrayBuffer from "./isArrayBuffer"; +import isArrayLike from "./isArrayLike"; +import isArrayLikeObject from "./isArrayLikeObject"; +import isBoolean from "./isBoolean"; +import isBuffer from "./isBuffer"; +import isDate from "./isDate"; +import isElement from "./isElement"; +import isEmpty from "./isEmpty"; +import isEqual from "./isEqual"; +import isEqualWith from "./isEqualWith"; +import isError from "./isError"; +import isFinite from "./isFinite"; +import isFunction from "./isFunction"; +import isInteger from "./isInteger"; +import isLength from "./isLength"; +import isMap from "./isMap"; +import isMatch from "./isMatch"; +import isMatchWith from "./isMatchWith"; +import isNaN from "./isNaN"; +import isNative from "./isNative"; +import isNil from "./isNil"; +import isNull from "./isNull"; +import isNumber from "./isNumber"; +import isObject from "./isObject"; +import isObjectLike from "./isObjectLike"; +import isPlainObject from "./isPlainObject"; +import isRegExp from "./isRegExp"; +import isSafeInteger from "./isSafeInteger"; +import isSet from "./isSet"; +import isString from "./isString"; +import isSymbol from "./isSymbol"; +import isTypedArray from "./isTypedArray"; +import isUndefined from "./isUndefined"; +import isWeakMap from "./isWeakMap"; +import isWeakSet from "./isWeakSet"; +import lt from "./lt"; +import lte from "./lte"; +import toArray from "./toArray"; +import toFinite from "./toFinite"; +import toInteger from "./toInteger"; +import toLength from "./toLength"; +import toNumber from "./toNumber"; +import toPlainObject from "./toPlainObject"; +import toSafeInteger from "./toSafeInteger"; +import toString from "./toString"; + +declare const defaultExport: { + castArray: typeof castArray; + clone: typeof clone; + cloneDeep: typeof cloneDeep; + cloneDeepWith: typeof cloneDeepWith; + cloneWith: typeof cloneWith; + conformsTo: typeof conformsTo; + eq: typeof eq; + gt: typeof gt; + gte: typeof gte; + isArguments: typeof isArguments; + isArray: typeof isArray; + isArrayBuffer: typeof isArrayBuffer; + isArrayLike: typeof isArrayLike; + isArrayLikeObject: typeof isArrayLikeObject; + isBoolean: typeof isBoolean; + isBuffer: typeof isBuffer; + isDate: typeof isDate; + isElement: typeof isElement; + isEmpty: typeof isEmpty; + isEqual: typeof isEqual; + isEqualWith: typeof isEqualWith; + isError: typeof isError; + isFinite: typeof isFinite; + isFunction: typeof isFunction; + isInteger: typeof isInteger; + isLength: typeof isLength; + isMap: typeof isMap; + isMatch: typeof isMatch; + isMatchWith: typeof isMatchWith; + isNaN: typeof isNaN; + isNative: typeof isNative; + isNil: typeof isNil; + isNull: typeof isNull; + isNumber: typeof isNumber; + isObject: typeof isObject; + isObjectLike: typeof isObjectLike; + isPlainObject: typeof isPlainObject; + isRegExp: typeof isRegExp; + isSafeInteger: typeof isSafeInteger; + isSet: typeof isSet; + isString: typeof isString; + isSymbol: typeof isSymbol; + isTypedArray: typeof isTypedArray; + isUndefined: typeof isUndefined; + isWeakMap: typeof isWeakMap; + isWeakSet: typeof isWeakSet; + lt: typeof lt; + lte: typeof lte; + toArray: typeof toArray; + toFinite: typeof toFinite; + toInteger: typeof toInteger; + toLength: typeof toLength; + toNumber: typeof toNumber; + toPlainObject: typeof toPlainObject; + toSafeInteger: typeof toSafeInteger; + toString: typeof toString; +}; +export default defaultExport; diff --git a/types/lodash-es/lodash-es-tests.ts b/types/lodash-es/lodash-es-tests.ts index f849e811b6..741526c851 100644 --- a/types/lodash-es/lodash-es-tests.ts +++ b/types/lodash-es/lodash-es-tests.ts @@ -1,3 +1,605 @@ +import add from "lodash-es/add"; +import after from "lodash-es/after"; +import ary from "lodash-es/ary"; +import assign from "lodash-es/assign"; +import assignIn from "lodash-es/assignIn"; +import assignInWith from "lodash-es/assignInWith"; +import assignWith from "lodash-es/assignWith"; +import at from "lodash-es/at"; +import attempt from "lodash-es/attempt"; +import before from "lodash-es/before"; +import bind from "lodash-es/bind"; +import bindAll from "lodash-es/bindAll"; +import bindKey from "lodash-es/bindKey"; +import camelCase from "lodash-es/camelCase"; +import capitalize from "lodash-es/capitalize"; +import castArray from "lodash-es/castArray"; +import ceil from "lodash-es/ceil"; +import chunk from "lodash-es/chunk"; +import clamp from "lodash-es/clamp"; +import clone from "lodash-es/clone"; +import cloneDeep from "lodash-es/cloneDeep"; +import cloneDeepWith from "lodash-es/cloneDeepWith"; +import cloneWith from "lodash-es/cloneWith"; +import compact from "lodash-es/compact"; +import concat from "lodash-es/concat"; +import cond from "lodash-es/cond"; +import conforms from "lodash-es/conforms"; +import conformsTo from "lodash-es/conformsTo"; +import constant from "lodash-es/constant"; +import countBy from "lodash-es/countBy"; +import create from "lodash-es/create"; +import curry from "lodash-es/curry"; +import curryRight from "lodash-es/curryRight"; +import debounce from "lodash-es/debounce"; +import deburr from "lodash-es/deburr"; +import defaultTo from "lodash-es/defaultTo"; +import defaults from "lodash-es/defaults"; +import defaultsDeep from "lodash-es/defaultsDeep"; +import defer from "lodash-es/defer"; +import delay from "lodash-es/delay"; +import difference from "lodash-es/difference"; +import differenceBy from "lodash-es/differenceBy"; +import differenceWith from "lodash-es/differenceWith"; +import divide from "lodash-es/divide"; +import drop from "lodash-es/drop"; +import dropRight from "lodash-es/dropRight"; +import dropRightWhile from "lodash-es/dropRightWhile"; +import dropWhile from "lodash-es/dropWhile"; +import each from "lodash-es/each"; +import eachRight from "lodash-es/eachRight"; +import endsWith from "lodash-es/endsWith"; +import entries from "lodash-es/entries"; +import entriesIn from "lodash-es/entriesIn"; +import eq from "lodash-es/eq"; +import escape from "lodash-es/escape"; +import escapeRegExp from "lodash-es/escapeRegExp"; +import every from "lodash-es/every"; +import extend from "lodash-es/extend"; +import extendWith from "lodash-es/extendWith"; +import fill from "lodash-es/fill"; +import filter from "lodash-es/filter"; +import find from "lodash-es/find"; +import findIndex from "lodash-es/findIndex"; +import findKey from "lodash-es/findKey"; +import findLast from "lodash-es/findLast"; +import findLastIndex from "lodash-es/findLastIndex"; +import findLastKey from "lodash-es/findLastKey"; +import first from "lodash-es/first"; +import flatMap from "lodash-es/flatMap"; +import flatMapDeep from "lodash-es/flatMapDeep"; +import flatMapDepth from "lodash-es/flatMapDepth"; +import flatten from "lodash-es/flatten"; +import flattenDeep from "lodash-es/flattenDeep"; +import flattenDepth from "lodash-es/flattenDepth"; +import flip from "lodash-es/flip"; +import floor from "lodash-es/floor"; +import flow from "lodash-es/flow"; +import flowRight from "lodash-es/flowRight"; +import forEach from "lodash-es/forEach"; +import forEachRight from "lodash-es/forEachRight"; +import forIn from "lodash-es/forIn"; +import forInRight from "lodash-es/forInRight"; +import forOwn from "lodash-es/forOwn"; +import forOwnRight from "lodash-es/forOwnRight"; +import fromPairs from "lodash-es/fromPairs"; +import functions from "lodash-es/functions"; +import functionsIn from "lodash-es/functionsIn"; +import get from "lodash-es/get"; +import groupBy from "lodash-es/groupBy"; +import gt from "lodash-es/gt"; +import gte from "lodash-es/gte"; +import has from "lodash-es/has"; +import hasIn from "lodash-es/hasIn"; +import head from "lodash-es/head"; +import identity from "lodash-es/identity"; +import inRange from "lodash-es/inRange"; +import includes from "lodash-es/includes"; +import indexOf from "lodash-es/indexOf"; +import initial from "lodash-es/initial"; +import intersection from "lodash-es/intersection"; +import intersectionBy from "lodash-es/intersectionBy"; +import intersectionWith from "lodash-es/intersectionWith"; +import invert from "lodash-es/invert"; +import invertBy from "lodash-es/invertBy"; +import invoke from "lodash-es/invoke"; +import invokeMap from "lodash-es/invokeMap"; +import isArguments from "lodash-es/isArguments"; +import isArray from "lodash-es/isArray"; +import isArrayBuffer from "lodash-es/isArrayBuffer"; +import isArrayLike from "lodash-es/isArrayLike"; +import isArrayLikeObject from "lodash-es/isArrayLikeObject"; +import isBoolean from "lodash-es/isBoolean"; +import isBuffer from "lodash-es/isBuffer"; +import isDate from "lodash-es/isDate"; +import isElement from "lodash-es/isElement"; +import isEmpty from "lodash-es/isEmpty"; +import isEqual from "lodash-es/isEqual"; +import isEqualWith from "lodash-es/isEqualWith"; +import isError from "lodash-es/isError"; +import isFinite from "lodash-es/isFinite"; +import isFunction from "lodash-es/isFunction"; +import isInteger from "lodash-es/isInteger"; +import isLength from "lodash-es/isLength"; +import isMap from "lodash-es/isMap"; +import isMatch from "lodash-es/isMatch"; +import isMatchWith from "lodash-es/isMatchWith"; +import isNaN from "lodash-es/isNaN"; +import isNative from "lodash-es/isNative"; +import isNil from "lodash-es/isNil"; +import isNull from "lodash-es/isNull"; +import isNumber from "lodash-es/isNumber"; +import isObject from "lodash-es/isObject"; +import isObjectLike from "lodash-es/isObjectLike"; +import isPlainObject from "lodash-es/isPlainObject"; +import isRegExp from "lodash-es/isRegExp"; +import isSafeInteger from "lodash-es/isSafeInteger"; +import isSet from "lodash-es/isSet"; +import isString from "lodash-es/isString"; +import isSymbol from "lodash-es/isSymbol"; +import isTypedArray from "lodash-es/isTypedArray"; +import isUndefined from "lodash-es/isUndefined"; +import isWeakMap from "lodash-es/isWeakMap"; +import isWeakSet from "lodash-es/isWeakSet"; +import iteratee from "lodash-es/iteratee"; +import join from "lodash-es/join"; import kebabCase from "lodash-es/kebabCase"; +import keyBy from "lodash-es/keyBy"; +import keys from "lodash-es/keys"; +import keysIn from "lodash-es/keysIn"; +import last from "lodash-es/last"; +import lastIndexOf from "lodash-es/lastIndexOf"; +import lowerCase from "lodash-es/lowerCase"; +import lowerFirst from "lodash-es/lowerFirst"; +import lt from "lodash-es/lt"; +import lte from "lodash-es/lte"; +import map from "lodash-es/map"; +import mapKeys from "lodash-es/mapKeys"; +import mapValues from "lodash-es/mapValues"; +import matches from "lodash-es/matches"; +import matchesProperty from "lodash-es/matchesProperty"; +import max from "lodash-es/max"; +import maxBy from "lodash-es/maxBy"; +import mean from "lodash-es/mean"; +import meanBy from "lodash-es/meanBy"; +import memoize from "lodash-es/memoize"; +import merge from "lodash-es/merge"; +import mergeWith from "lodash-es/mergeWith"; +import method from "lodash-es/method"; +import methodOf from "lodash-es/methodOf"; +import min from "lodash-es/min"; +import minBy from "lodash-es/minBy"; +import mixin from "lodash-es/mixin"; +import multiply from "lodash-es/multiply"; +import negate from "lodash-es/negate"; +import noop from "lodash-es/noop"; +import now from "lodash-es/now"; +import nth from "lodash-es/nth"; +import nthArg from "lodash-es/nthArg"; +import omit from "lodash-es/omit"; +import omitBy from "lodash-es/omitBy"; +import once from "lodash-es/once"; +import orderBy from "lodash-es/orderBy"; +import over from "lodash-es/over"; +import overArgs from "lodash-es/overArgs"; +import overEvery from "lodash-es/overEvery"; +import overSome from "lodash-es/overSome"; +import pad from "lodash-es/pad"; +import padEnd from "lodash-es/padEnd"; +import padStart from "lodash-es/padStart"; +import parseInt from "lodash-es/parseInt"; +import partial from "lodash-es/partial"; +import partialRight from "lodash-es/partialRight"; +import partition from "lodash-es/partition"; +import pick from "lodash-es/pick"; +import pickBy from "lodash-es/pickBy"; +import property from "lodash-es/property"; +import propertyOf from "lodash-es/propertyOf"; +import pull from "lodash-es/pull"; +import pullAll from "lodash-es/pullAll"; +import pullAllBy from "lodash-es/pullAllBy"; +import pullAllWith from "lodash-es/pullAllWith"; +import pullAt from "lodash-es/pullAt"; +import random from "lodash-es/random"; +import range from "lodash-es/range"; +import rangeRight from "lodash-es/rangeRight"; +import rearg from "lodash-es/rearg"; +import reduce from "lodash-es/reduce"; +import reduceRight from "lodash-es/reduceRight"; +import reject from "lodash-es/reject"; +import remove from "lodash-es/remove"; +import repeat from "lodash-es/repeat"; +import replace from "lodash-es/replace"; +import rest from "lodash-es/rest"; +import result from "lodash-es/result"; +import reverse from "lodash-es/reverse"; +import round from "lodash-es/round"; +import sample from "lodash-es/sample"; +import sampleSize from "lodash-es/sampleSize"; +import set from "lodash-es/set"; +import setWith from "lodash-es/setWith"; +import shuffle from "lodash-es/shuffle"; +import size from "lodash-es/size"; +import slice from "lodash-es/slice"; +import snakeCase from "lodash-es/snakeCase"; +import some from "lodash-es/some"; +import sortBy from "lodash-es/sortBy"; +import sortedIndex from "lodash-es/sortedIndex"; +import sortedIndexBy from "lodash-es/sortedIndexBy"; +import sortedIndexOf from "lodash-es/sortedIndexOf"; +import sortedLastIndex from "lodash-es/sortedLastIndex"; +import sortedLastIndexBy from "lodash-es/sortedLastIndexBy"; +import sortedLastIndexOf from "lodash-es/sortedLastIndexOf"; +import sortedUniq from "lodash-es/sortedUniq"; +import sortedUniqBy from "lodash-es/sortedUniqBy"; +import split from "lodash-es/split"; +import spread from "lodash-es/spread"; +import startCase from "lodash-es/startCase"; +import startsWith from "lodash-es/startsWith"; +import stubArray from "lodash-es/stubArray"; +import stubFalse from "lodash-es/stubFalse"; +import stubObject from "lodash-es/stubObject"; +import stubString from "lodash-es/stubString"; +import stubTrue from "lodash-es/stubTrue"; +import subtract from "lodash-es/subtract"; +import sum from "lodash-es/sum"; +import sumBy from "lodash-es/sumBy"; +import tail from "lodash-es/tail"; +import take from "lodash-es/take"; +import takeRight from "lodash-es/takeRight"; +import takeRightWhile from "lodash-es/takeRightWhile"; +import takeWhile from "lodash-es/takeWhile"; +import template from "lodash-es/template"; +import templateSettings from "lodash-es/templateSettings"; +import throttle from "lodash-es/throttle"; +import times from "lodash-es/times"; +import toArray from "lodash-es/toArray"; +import toFinite from "lodash-es/toFinite"; +import toInteger from "lodash-es/toInteger"; +import toLength from "lodash-es/toLength"; +import toLower from "lodash-es/toLower"; +import toNumber from "lodash-es/toNumber"; +import toPairs from "lodash-es/toPairs"; +import toPairsIn from "lodash-es/toPairsIn"; +import toPath from "lodash-es/toPath"; +import toPlainObject from "lodash-es/toPlainObject"; +import toSafeInteger from "lodash-es/toSafeInteger"; +import toString from "lodash-es/toString"; +import toUpper from "lodash-es/toUpper"; +import transform from "lodash-es/transform"; +import trim from "lodash-es/trim"; +import trimEnd from "lodash-es/trimEnd"; +import trimStart from "lodash-es/trimStart"; +import truncate from "lodash-es/truncate"; +import unary from "lodash-es/unary"; +import unescape from "lodash-es/unescape"; +import union from "lodash-es/union"; +import unionBy from "lodash-es/unionBy"; +import unionWith from "lodash-es/unionWith"; +import uniq from "lodash-es/uniq"; +import uniqBy from "lodash-es/uniqBy"; +import uniqWith from "lodash-es/uniqWith"; +import uniqueId from "lodash-es/uniqueId"; +import unset from "lodash-es/unset"; +import unzip from "lodash-es/unzip"; +import unzipWith from "lodash-es/unzipWith"; +import update from "lodash-es/update"; +import updateWith from "lodash-es/updateWith"; +import upperCase from "lodash-es/upperCase"; +import upperFirst from "lodash-es/upperFirst"; +import values from "lodash-es/values"; +import valuesIn from "lodash-es/valuesIn"; +import without from "lodash-es/without"; +import words from "lodash-es/words"; +import wrap from "lodash-es/wrap"; +import xor from "lodash-es/xor"; +import xorBy from "lodash-es/xorBy"; +import xorWith from "lodash-es/xorWith"; +import zip from "lodash-es/zip"; +import zipObject from "lodash-es/zipObject"; +import zipObjectDeep from "lodash-es/zipObjectDeep"; +import zipWith from "lodash-es/zipWith"; -kebabCase("chickenWings"); +import { + add as add1, + after as after1, + ary as ary1, + assign as assign1, + assignIn as assignIn1, + assignInWith as assignInWith1, + assignWith as assignWith1, + at as at1, + attempt as attempt1, + before as before1, + bind as bind1, + bindAll as bindAll1, + bindKey as bindKey1, + camelCase as camelCase1, + capitalize as capitalize1, + castArray as castArray1, + ceil as ceil1, + chunk as chunk1, + clamp as clamp1, + clone as clone1, + cloneDeep as cloneDeep1, + cloneDeepWith as cloneDeepWith1, + cloneWith as cloneWith1, + compact as compact1, + concat as concat1, + cond as cond1, + conforms as conforms1, + conformsTo as conformsTo1, + constant as constant1, + countBy as countBy1, + create as create1, + curry as curry1, + curryRight as curryRight1, + debounce as debounce1, + deburr as deburr1, + defaultTo as defaultTo1, + defaults as defaults1, + defaultsDeep as defaultsDeep1, + defer as defer1, + delay as delay1, + difference as difference1, + differenceBy as differenceBy1, + differenceWith as differenceWith1, + divide as divide1, + drop as drop1, + dropRight as dropRight1, + dropRightWhile as dropRightWhile1, + dropWhile as dropWhile1, + each as each1, + eachRight as eachRight1, + endsWith as endsWith1, + entries as entries1, + entriesIn as entriesIn1, + eq as eq1, + escape as escape1, + escapeRegExp as escapeRegExp1, + every as every1, + extend as extend1, + extendWith as extendWith1, + fill as fill1, + filter as filter1, + find as find1, + findIndex as findIndex1, + findKey as findKey1, + findLast as findLast1, + findLastIndex as findLastIndex1, + findLastKey as findLastKey1, + first as first1, + flatMap as flatMap1, + flatMapDeep as flatMapDeep1, + flatMapDepth as flatMapDepth1, + flatten as flatten1, + flattenDeep as flattenDeep1, + flattenDepth as flattenDepth1, + flip as flip1, + floor as floor1, + flow as flow1, + flowRight as flowRight1, + forEach as forEach1, + forEachRight as forEachRight1, + forIn as forIn1, + forInRight as forInRight1, + forOwn as forOwn1, + forOwnRight as forOwnRight1, + fromPairs as fromPairs1, + functions as functions1, + functionsIn as functionsIn1, + get as get1, + groupBy as groupBy1, + gt as gt1, + gte as gte1, + has as has1, + hasIn as hasIn1, + head as head1, + identity as identity1, + inRange as inRange1, + includes as includes1, + indexOf as indexOf1, + initial as initial1, + intersection as intersection1, + intersectionBy as intersectionBy1, + intersectionWith as intersectionWith1, + invert as invert1, + invertBy as invertBy1, + invoke as invoke1, + invokeMap as invokeMap1, + isArguments as isArguments1, + isArray as isArray1, + isArrayBuffer as isArrayBuffer1, + isArrayLike as isArrayLike1, + isArrayLikeObject as isArrayLikeObject1, + isBoolean as isBoolean1, + isBuffer as isBuffer1, + isDate as isDate1, + isElement as isElement1, + isEmpty as isEmpty1, + isEqual as isEqual1, + isEqualWith as isEqualWith1, + isError as isError1, + isFinite as isFinite1, + isFunction as isFunction1, + isInteger as isInteger1, + isLength as isLength1, + isMap as isMap1, + isMatch as isMatch1, + isMatchWith as isMatchWith1, + isNaN as isNaN1, + isNative as isNative1, + isNil as isNil1, + isNull as isNull1, + isNumber as isNumber1, + isObject as isObject1, + isObjectLike as isObjectLike1, + isPlainObject as isPlainObject1, + isRegExp as isRegExp1, + isSafeInteger as isSafeInteger1, + isSet as isSet1, + isString as isString1, + isSymbol as isSymbol1, + isTypedArray as isTypedArray1, + isUndefined as isUndefined1, + isWeakMap as isWeakMap1, + isWeakSet as isWeakSet1, + iteratee as iteratee1, + join as join1, + kebabCase as kebabCase1, + keyBy as keyBy1, + keys as keys1, + keysIn as keysIn1, + last as last1, + lastIndexOf as lastIndexOf1, + lowerCase as lowerCase1, + lowerFirst as lowerFirst1, + lt as lt1, + lte as lte1, + map as map1, + mapKeys as mapKeys1, + mapValues as mapValues1, + matches as matches1, + matchesProperty as matchesProperty1, + max as max1, + maxBy as maxBy1, + mean as mean1, + meanBy as meanBy1, + memoize as memoize1, + merge as merge1, + mergeWith as mergeWith1, + method as method1, + methodOf as methodOf1, + min as min1, + minBy as minBy1, + mixin as mixin1, + multiply as multiply1, + negate as negate1, + noop as noop1, + now as now1, + nth as nth1, + nthArg as nthArg1, + omit as omit1, + omitBy as omitBy1, + once as once1, + orderBy as orderBy1, + over as over1, + overArgs as overArgs1, + overEvery as overEvery1, + overSome as overSome1, + pad as pad1, + padEnd as padEnd1, + padStart as padStart1, + parseInt as parseInt1, + partial as partial1, + partialRight as partialRight1, + partition as partition1, + pick as pick1, + pickBy as pickBy1, + property as property1, + propertyOf as propertyOf1, + pull as pull1, + pullAll as pullAll1, + pullAllBy as pullAllBy1, + pullAllWith as pullAllWith1, + pullAt as pullAt1, + random as random1, + range as range1, + rangeRight as rangeRight1, + rearg as rearg1, + reduce as reduce1, + reduceRight as reduceRight1, + reject as reject1, + remove as remove1, + repeat as repeat1, + replace as replace1, + rest as rest1, + result as result1, + reverse as reverse1, + round as round1, + sample as sample1, + sampleSize as sampleSize1, + set as set1, + setWith as setWith1, + shuffle as shuffle1, + size as size1, + slice as slice1, + snakeCase as snakeCase1, + some as some1, + sortBy as sortBy1, + sortedIndex as sortedIndex1, + sortedIndexBy as sortedIndexBy1, + sortedIndexOf as sortedIndexOf1, + sortedLastIndex as sortedLastIndex1, + sortedLastIndexBy as sortedLastIndexBy1, + sortedLastIndexOf as sortedLastIndexOf1, + sortedUniq as sortedUniq1, + sortedUniqBy as sortedUniqBy1, + split as split1, + spread as spread1, + startCase as startCase1, + startsWith as startsWith1, + stubArray as stubArray1, + stubFalse as stubFalse1, + stubObject as stubObject1, + stubString as stubString1, + stubTrue as stubTrue1, + subtract as subtract1, + sum as sum1, + sumBy as sumBy1, + tail as tail1, + take as take1, + takeRight as takeRight1, + takeRightWhile as takeRightWhile1, + takeWhile as takeWhile1, + template as template1, + templateSettings as templateSettings1, + throttle as throttle1, + times as times1, + toArray as toArray1, + toFinite as toFinite1, + toInteger as toInteger1, + toLength as toLength1, + toLower as toLower1, + toNumber as toNumber1, + toPairs as toPairs1, + toPairsIn as toPairsIn1, + toPath as toPath1, + toPlainObject as toPlainObject1, + toSafeInteger as toSafeInteger1, + toString as toString1, + toUpper as toUpper1, + transform as transform1, + trim as trim1, + trimEnd as trimEnd1, + trimStart as trimStart1, + truncate as truncate1, + unary as unary1, + unescape as unescape1, + union as union1, + unionBy as unionBy1, + unionWith as unionWith1, + uniq as uniq1, + uniqBy as uniqBy1, + uniqWith as uniqWith1, + uniqueId as uniqueId1, + unset as unset1, + unzip as unzip1, + unzipWith as unzipWith1, + update as update1, + updateWith as updateWith1, + upperCase as upperCase1, + upperFirst as upperFirst1, + values as values1, + valuesIn as valuesIn1, + without as without1, + words as words1, + wrap as wrap1, + xor as xor1, + xorBy as xorBy1, + xorWith as xorWith1, + zip as zip1, + zipObject as zipObject1, + zipObjectDeep as zipObjectDeep1, + zipWith as zipWith1 +} from "lodash-es"; diff --git a/types/lodash-es/math.d.ts b/types/lodash-es/math.d.ts new file mode 100644 index 0000000000..76a54e63cd --- /dev/null +++ b/types/lodash-es/math.d.ts @@ -0,0 +1,17 @@ +import { default as add } from "./add"; +import { default as ceil } from "./ceil"; +import { default as divide } from "./divide"; +import { default as floor } from "./floor"; +import { default as max } from "./max"; +import { default as maxBy } from "./maxBy"; +import { default as mean } from "./mean"; +import { default as meanBy } from "./meanBy"; +import { default as min } from "./min"; +import { default as minBy } from "./minBy"; +import { default as multiply } from "./multiply"; +import { default as round } from "./round"; +import { default as subtract } from "./subtract"; +import { default as sum } from "./sum"; +import { default as sumBy } from "./sumBy"; + +export { default } from "./math.default"; diff --git a/types/lodash-es/math.default.d.ts b/types/lodash-es/math.default.d.ts new file mode 100644 index 0000000000..59e31e5788 --- /dev/null +++ b/types/lodash-es/math.default.d.ts @@ -0,0 +1,34 @@ +import add from "./add"; +import ceil from "./ceil"; +import divide from "./divide"; +import floor from "./floor"; +import max from "./max"; +import maxBy from "./maxBy"; +import mean from "./mean"; +import meanBy from "./meanBy"; +import min from "./min"; +import minBy from "./minBy"; +import multiply from "./multiply"; +import round from "./round"; +import subtract from "./subtract"; +import sum from "./sum"; +import sumBy from "./sumBy"; + +declare const defaultExport: { + add: typeof add; + ceil: typeof ceil; + divide: typeof divide; + floor: typeof floor; + max: typeof max; + maxBy: typeof maxBy; + mean: typeof mean; + meanBy: typeof meanBy; + min: typeof min; + minBy: typeof minBy; + multiply: typeof multiply; + round: typeof round; + subtract: typeof subtract; + sum: typeof sum; + sumBy: typeof sumBy; +}; +export default defaultExport; diff --git a/types/lodash-es/multiply.d.ts b/types/lodash-es/multiply.d.ts new file mode 100644 index 0000000000..1098871600 --- /dev/null +++ b/types/lodash-es/multiply.d.ts @@ -0,0 +1,2 @@ +import { multiply } from "lodash"; +export default multiply; diff --git a/types/lodash-es/noConflict.d.ts b/types/lodash-es/noConflict.d.ts deleted file mode 100644 index 75499c13e3..0000000000 --- a/types/lodash-es/noConflict.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -import { noConflict } from "lodash"; -export default noConflict; diff --git a/types/lodash-es/number.d.ts b/types/lodash-es/number.d.ts new file mode 100644 index 0000000000..32a19d3c39 --- /dev/null +++ b/types/lodash-es/number.d.ts @@ -0,0 +1,5 @@ +import { default as clamp } from "./clamp"; +import { default as inRange } from "./inRange"; +import { default as random } from "./random"; + +export { default } from "./number.default"; diff --git a/types/lodash-es/number.default.d.ts b/types/lodash-es/number.default.d.ts new file mode 100644 index 0000000000..0c96c62d27 --- /dev/null +++ b/types/lodash-es/number.default.d.ts @@ -0,0 +1,10 @@ +import clamp from "./clamp"; +import inRange from "./inRange"; +import random from "./random"; + +declare const defaultExport: { + clamp: typeof clamp; + inRange: typeof inRange; + random: typeof random; +}; +export default defaultExport; diff --git a/types/lodash-es/object.d.ts b/types/lodash-es/object.d.ts new file mode 100644 index 0000000000..34b2bbea2d --- /dev/null +++ b/types/lodash-es/object.d.ts @@ -0,0 +1,49 @@ +import { default as assign } from "./assign"; +import { default as assignIn } from "./assignIn"; +import { default as assignInWith } from "./assignInWith"; +import { default as assignWith } from "./assignWith"; +import { default as at } from "./at"; +import { default as create } from "./create"; +import { default as defaults } from "./defaults"; +import { default as defaultsDeep } from "./defaultsDeep"; +import { default as entries } from "./entries"; +import { default as entriesIn } from "./entriesIn"; +import { default as extend } from "./extend"; +import { default as extendWith } from "./extendWith"; +import { default as findKey } from "./findKey"; +import { default as findLastKey } from "./findLastKey"; +import { default as forIn } from "./forIn"; +import { default as forInRight } from "./forInRight"; +import { default as forOwn } from "./forOwn"; +import { default as forOwnRight } from "./forOwnRight"; +import { default as functions } from "./functions"; +import { default as functionsIn } from "./functionsIn"; +import { default as get } from "./get"; +import { default as has } from "./has"; +import { default as hasIn } from "./hasIn"; +import { default as invert } from "./invert"; +import { default as invertBy } from "./invertBy"; +import { default as invoke } from "./invoke"; +import { default as keys } from "./keys"; +import { default as keysIn } from "./keysIn"; +import { default as mapKeys } from "./mapKeys"; +import { default as mapValues } from "./mapValues"; +import { default as merge } from "./merge"; +import { default as mergeWith } from "./mergeWith"; +import { default as omit } from "./omit"; +import { default as omitBy } from "./omitBy"; +import { default as pick } from "./pick"; +import { default as pickBy } from "./pickBy"; +import { default as result } from "./result"; +import { default as set } from "./set"; +import { default as setWith } from "./setWith"; +import { default as toPairs } from "./toPairs"; +import { default as toPairsIn } from "./toPairsIn"; +import { default as transform } from "./transform"; +import { default as unset } from "./unset"; +import { default as update } from "./update"; +import { default as updateWith } from "./updateWith"; +import { default as values } from "./values"; +import { default as valuesIn } from "./valuesIn"; + +export { default } from "./object.default"; diff --git a/types/lodash-es/object.default.d.ts b/types/lodash-es/object.default.d.ts new file mode 100644 index 0000000000..16cf6a9157 --- /dev/null +++ b/types/lodash-es/object.default.d.ts @@ -0,0 +1,98 @@ +import assign from "./assign"; +import assignIn from "./assignIn"; +import assignInWith from "./assignInWith"; +import assignWith from "./assignWith"; +import at from "./at"; +import create from "./create"; +import defaults from "./defaults"; +import defaultsDeep from "./defaultsDeep"; +import entries from "./entries"; +import entriesIn from "./entriesIn"; +import extend from "./extend"; +import extendWith from "./extendWith"; +import findKey from "./findKey"; +import findLastKey from "./findLastKey"; +import forIn from "./forIn"; +import forInRight from "./forInRight"; +import forOwn from "./forOwn"; +import forOwnRight from "./forOwnRight"; +import functions from "./functions"; +import functionsIn from "./functionsIn"; +import get from "./get"; +import has from "./has"; +import hasIn from "./hasIn"; +import invert from "./invert"; +import invertBy from "./invertBy"; +import invoke from "./invoke"; +import keys from "./keys"; +import keysIn from "./keysIn"; +import mapKeys from "./mapKeys"; +import mapValues from "./mapValues"; +import merge from "./merge"; +import mergeWith from "./mergeWith"; +import omit from "./omit"; +import omitBy from "./omitBy"; +import pick from "./pick"; +import pickBy from "./pickBy"; +import result from "./result"; +import set from "./set"; +import setWith from "./setWith"; +import toPairs from "./toPairs"; +import toPairsIn from "./toPairsIn"; +import transform from "./transform"; +import unset from "./unset"; +import update from "./update"; +import updateWith from "./updateWith"; +import values from "./values"; +import valuesIn from "./valuesIn"; + +declare const defaultExport: { + assign: typeof assign; + assignIn: typeof assignIn; + assignInWith: typeof assignInWith; + assignWith: typeof assignWith; + at: typeof at; + create: typeof create; + defaults: typeof defaults; + defaultsDeep: typeof defaultsDeep; + entries: typeof entries; + entriesIn: typeof entriesIn; + extend: typeof extend; + extendWith: typeof extendWith; + findKey: typeof findKey; + findLastKey: typeof findLastKey; + forIn: typeof forIn; + forInRight: typeof forInRight; + forOwn: typeof forOwn; + forOwnRight: typeof forOwnRight; + functions: typeof functions; + functionsIn: typeof functionsIn; + get: typeof get; + has: typeof has; + hasIn: typeof hasIn; + invert: typeof invert; + invertBy: typeof invertBy; + invoke: typeof invoke; + keys: typeof keys; + keysIn: typeof keysIn; + mapKeys: typeof mapKeys; + mapValues: typeof mapValues; + merge: typeof merge; + mergeWith: typeof mergeWith; + omit: typeof omit; + omitBy: typeof omitBy; + pick: typeof pick; + pickBy: typeof pickBy; + result: typeof result; + set: typeof set; + setWith: typeof setWith; + toPairs: typeof toPairs; + toPairsIn: typeof toPairsIn; + transform: typeof transform; + unset: typeof unset; + update: typeof update; + updateWith: typeof updateWith; + values: typeof values; + valuesIn: typeof valuesIn; +}; +export default defaultExport; diff --git a/types/lodash-es/runInContext.d.ts b/types/lodash-es/runInContext.d.ts deleted file mode 100644 index dcfba9ffed..0000000000 --- a/types/lodash-es/runInContext.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -import { runInContext } from "lodash"; -export default runInContext; diff --git a/types/lodash-es/scripts/generate-modules.ts b/types/lodash-es/scripts/generate-modules.ts new file mode 100644 index 0000000000..2b74b55b33 --- /dev/null +++ b/types/lodash-es/scripts/generate-modules.ts @@ -0,0 +1,180 @@ +// Usage: ts-node generate-modules.ts + +/// + +import * as fs from "fs"; +import { STATUS_CODES } from "http"; +import { get } from "https"; +import * as path from "path"; +import * as prettier from 'prettier'; + +const GROUP_WITH_DEFAULTS = [ + 'array', + 'collection', + 'function', + 'date', + 'lang', + 'math', + 'number', + 'object', + 'string', + 'util', +]; + +const SPECIAL_DEFAULTS = ['seq']; + +const SPECIAL_DEFAULTS_OF_SEQ = [ + 'at', + 'lodash', + 'reverse', + 'value', +]; + +const SRC_REGEXP = /default\s\{([^\}]+)}/; + +main().catch(console.error); + +async function main() { + const versionObject = await getPackageVersion(); + + const results = await getDefaultsDefinitions(versionObject.fullVersion); + + const extractedResults = results.map(extractDefaults).map(arr => arr.sort()); + + const tsFiles = []; + + GROUP_WITH_DEFAULTS.forEach((group, index) => { + console.log(group); + + // output per file per module + extractedResults[index].forEach((module) => { + console.log(` ${module}`); + // Generate local module + const moduleFilename = `${module}.d.ts`; + tsFiles.push(moduleFilename); + writeFileSync(path.join("..", moduleFilename), `import { ${module} } from "lodash";\nexport default ${module};\n`); + }); + + // output default + const defaultModule = `${group}.default.d.ts`; + tsFiles.push(defaultModule); + + console.log(' ' + defaultModule); + + writeFileSync(path.join("..", defaultModule), `${extractedResults[index].map(val => `import ${val} from "./${val}";`).join('\n')}\n +declare const defaultExport: {\n${extractedResults[index].map(val => `${val}: typeof ${val};`).join('\n')} }; +export default defaultExport;\n`); + + // output group file + const groupFilename = `${group}.d.ts`; + tsFiles.push(groupFilename); + + console.log(' ' + groupFilename); + + writeFileSync(path.join("..", groupFilename), `${extractedResults[index].map(val => `import { default as ${val} } from "./${val}";`).join('\n')}\n +export { default } from './${group}.default';\n`); + }); + + const flattenModules = extractedResults.reduce((acc, cur) => acc.concat(cur), []).sort(); + + // output full + console.log('index.d.ts'); + writeFileSync(path.join('..', 'index.d.ts'), globalDefinitionText('lodash-es', versionObject.majorMinor, + `${flattenModules.map(val => `export { default as ${val} } from "./${val}";`).join('\n')}\n`)); + + // output test file + console.log('lodash-es-tests.ts'); + writeFileSync(path.join('..', 'lodash-es-tests.ts'), `${flattenModules.map(val => `import ${val} from "lodash-es/${val}";`).join('\n')}\n +import { ${flattenModules.map(val => `${val} as ${val}1`).join(',')}} from 'lodash-es';\n`); + + // output tsconfig + console.log('tsconfig.json'); + tsFiles.sort().unshift('index.d.ts', 'lodash-es-tests.ts'); + writeFileSync(path.join('..', 'tsconfig.json'), tsconfig(tsFiles)); +} + +function formatFile(contents) { + return prettier.format(contents, { + parser: 'typescript' + }); +} + +function writeFileSync(filePath: string, contents) { + const source = filePath.endsWith('ts') ? formatFile(contents) : contents; + fs.writeFileSync(filePath, source); +} + +function extractDefaults(source) { + return SRC_REGEXP.exec(source)[1].split(',').map((val) => val.trim()); +} + +async function getDefaultsDefinitions(fullVersion) { + return Promise.all(GROUP_WITH_DEFAULTS.map( + (group) => loadString(`https://unpkg.com/lodash-es@${fullVersion}/${group}.default.js`) + )); +} + +async function getPackageVersion() { + const fullName = "lodash-es"; + const url = `https://registry.npmjs.org/${fullName.toLowerCase()}`; + const npmInfo = JSON.parse(await loadString(url)); + const fullVersion = npmInfo["dist-tags"].latest; + const majorMinor = fullVersion.split(".").slice(0, 2).join("."); + + return { + fullVersion, + majorMinor + }; +} + +function globalDefinitionText(fullName, majorMinor, allModulesImports): string { + return ` +// Type definitions for ${fullName} ${majorMinor} +// Project: http://lodash.com/ +// Definitions by: Stephen Lautier , e-cloud +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +${allModulesImports} +`.trim() + '\n'; +} + +function tsconfig(files) { + return JSON.stringify({ + compilerOptions: { + module: "commonjs", + lib: [ + "es6" + ], + noImplicitAny: true, + noImplicitThis: true, + strictNullChecks: true, + strictFunctionTypes: true, + baseUrl: "../", + typeRoots: [ + "../" + ], + types: [], + noEmit: true, + forceConsistentCasingInFileNames: true + }, + files + }, undefined, 4) + '\n'; +} + +function tslint() { + return `{ "extends": "dtslint/dt.json" }\n`; +} + +function loadString(url: string): Promise { + return new Promise((resolve, reject) => { + get(url, (res) => { + if (res.statusCode !== 200) { + return reject(new Error(`HTTP Error ${res.statusCode}: ${STATUS_CODES[res.statusCode || 500]} for ${url}`)); + } + let rawData = ""; + res.on("data", chunk => rawData += chunk); + res.on("end", () => resolve(rawData)); + }).on("error", reject); + }); +} diff --git a/types/lodash-es/scripts/tsconfig.json b/types/lodash-es/scripts/tsconfig.json new file mode 100644 index 0000000000..a06b8ed24f --- /dev/null +++ b/types/lodash-es/scripts/tsconfig.json @@ -0,0 +1,10 @@ +{ + "compilerOptions": { + "target": "es6", + "baseUrl": "../..", + "typeRoots": [ + "../../" + ], + "types": [] + } +} \ No newline at end of file diff --git a/types/lodash-es/string.d.ts b/types/lodash-es/string.d.ts new file mode 100644 index 0000000000..9093015217 --- /dev/null +++ b/types/lodash-es/string.d.ts @@ -0,0 +1,33 @@ +import { default as camelCase } from "./camelCase"; +import { default as capitalize } from "./capitalize"; +import { default as deburr } from "./deburr"; +import { default as endsWith } from "./endsWith"; +import { default as escape } from "./escape"; +import { default as escapeRegExp } from "./escapeRegExp"; +import { default as kebabCase } from "./kebabCase"; +import { default as lowerCase } from "./lowerCase"; +import { default as lowerFirst } from "./lowerFirst"; +import { default as pad } from "./pad"; +import { default as padEnd } from "./padEnd"; +import { default as padStart } from "./padStart"; +import { default as parseInt } from "./parseInt"; +import { default as repeat } from "./repeat"; +import { default as replace } from "./replace"; +import { default as snakeCase } from "./snakeCase"; +import { default as split } from "./split"; +import { default as startCase } from "./startCase"; +import { default as startsWith } from "./startsWith"; +import { default as template } from "./template"; +import { default as templateSettings } from "./templateSettings"; +import { default as toLower } from "./toLower"; +import { default as toUpper } from "./toUpper"; +import { default as trim } from "./trim"; +import { default as trimEnd } from "./trimEnd"; +import { default as trimStart } from "./trimStart"; +import { default as truncate } from "./truncate"; +import { default as unescape } from "./unescape"; +import { default as upperCase } from "./upperCase"; +import { default as upperFirst } from "./upperFirst"; +import { default as words } from "./words"; + +export { default } from "./string.default"; diff --git a/types/lodash-es/string.default.d.ts b/types/lodash-es/string.default.d.ts new file mode 100644 index 0000000000..99a3848abb --- /dev/null +++ b/types/lodash-es/string.default.d.ts @@ -0,0 +1,66 @@ +import camelCase from "./camelCase"; +import capitalize from "./capitalize"; +import deburr from "./deburr"; +import endsWith from "./endsWith"; +import escape from "./escape"; +import escapeRegExp from "./escapeRegExp"; +import kebabCase from "./kebabCase"; +import lowerCase from "./lowerCase"; +import lowerFirst from "./lowerFirst"; +import pad from "./pad"; +import padEnd from "./padEnd"; +import padStart from "./padStart"; +import parseInt from "./parseInt"; +import repeat from "./repeat"; +import replace from "./replace"; +import snakeCase from "./snakeCase"; +import split from "./split"; +import startCase from "./startCase"; +import startsWith from "./startsWith"; +import template from "./template"; +import templateSettings from "./templateSettings"; +import toLower from "./toLower"; +import toUpper from "./toUpper"; +import trim from "./trim"; +import trimEnd from "./trimEnd"; +import trimStart from "./trimStart"; +import truncate from "./truncate"; +import unescape from "./unescape"; +import upperCase from "./upperCase"; +import upperFirst from "./upperFirst"; +import words from "./words"; + +declare const defaultExport: { + camelCase: typeof camelCase; + capitalize: typeof capitalize; + deburr: typeof deburr; + endsWith: typeof endsWith; + escape: typeof escape; + escapeRegExp: typeof escapeRegExp; + kebabCase: typeof kebabCase; + lowerCase: typeof lowerCase; + lowerFirst: typeof lowerFirst; + pad: typeof pad; + padEnd: typeof padEnd; + padStart: typeof padStart; + parseInt: typeof parseInt; + repeat: typeof repeat; + replace: typeof replace; + snakeCase: typeof snakeCase; + split: typeof split; + startCase: typeof startCase; + startsWith: typeof startsWith; + template: typeof template; + templateSettings: typeof templateSettings; + toLower: typeof toLower; + toUpper: typeof toUpper; + trim: typeof trim; + trimEnd: typeof trimEnd; + trimStart: typeof trimStart; + truncate: typeof truncate; + unescape: typeof unescape; + upperCase: typeof upperCase; + upperFirst: typeof upperFirst; + words: typeof words; +}; +export default defaultExport; diff --git a/types/lodash-es/stubArray.d.ts b/types/lodash-es/stubArray.d.ts new file mode 100644 index 0000000000..569f1671c4 --- /dev/null +++ b/types/lodash-es/stubArray.d.ts @@ -0,0 +1,2 @@ +import { stubArray } from "lodash"; +export default stubArray; diff --git a/types/lodash-es/stubFalse.d.ts b/types/lodash-es/stubFalse.d.ts new file mode 100644 index 0000000000..b5f3f56e4c --- /dev/null +++ b/types/lodash-es/stubFalse.d.ts @@ -0,0 +1,2 @@ +import { stubFalse } from "lodash"; +export default stubFalse; diff --git a/types/lodash-es/stubObject.d.ts b/types/lodash-es/stubObject.d.ts new file mode 100644 index 0000000000..118c59e7d0 --- /dev/null +++ b/types/lodash-es/stubObject.d.ts @@ -0,0 +1,2 @@ +import { stubObject } from "lodash"; +export default stubObject; diff --git a/types/lodash-es/stubString.d.ts b/types/lodash-es/stubString.d.ts new file mode 100644 index 0000000000..c1b6ffb801 --- /dev/null +++ b/types/lodash-es/stubString.d.ts @@ -0,0 +1,2 @@ +import { stubString } from "lodash"; +export default stubString; diff --git a/types/lodash-es/stubTrue.d.ts b/types/lodash-es/stubTrue.d.ts new file mode 100644 index 0000000000..fd701f4752 --- /dev/null +++ b/types/lodash-es/stubTrue.d.ts @@ -0,0 +1,2 @@ +import { stubTrue } from "lodash"; +export default stubTrue; diff --git a/types/lodash-es/tap.d.ts b/types/lodash-es/tap.d.ts deleted file mode 100644 index f6e1710b43..0000000000 --- a/types/lodash-es/tap.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -import { tap } from "lodash"; -export default tap; diff --git a/types/lodash-es/templateSettings.d.ts b/types/lodash-es/templateSettings.d.ts new file mode 100644 index 0000000000..9ed8ffd880 --- /dev/null +++ b/types/lodash-es/templateSettings.d.ts @@ -0,0 +1,2 @@ +import { templateSettings } from "lodash"; +export default templateSettings; diff --git a/types/lodash-es/thru.d.ts b/types/lodash-es/thru.d.ts deleted file mode 100644 index 4140290e7e..0000000000 --- a/types/lodash-es/thru.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -import { thru } from "lodash"; -export default thru; diff --git a/types/lodash-es/tsconfig.json b/types/lodash-es/tsconfig.json index a3f03eab48..7f69811c3c 100644 --- a/types/lodash-es/tsconfig.json +++ b/types/lodash-es/tsconfig.json @@ -21,6 +21,8 @@ "lodash-es-tests.ts", "add.d.ts", "after.d.ts", + "array.d.ts", + "array.default.d.ts", "ary.d.ts", "assign.d.ts", "assignIn.d.ts", @@ -36,23 +38,29 @@ "capitalize.d.ts", "castArray.d.ts", "ceil.d.ts", - "chain.d.ts", "chunk.d.ts", "clamp.d.ts", "clone.d.ts", "cloneDeep.d.ts", "cloneDeepWith.d.ts", "cloneWith.d.ts", + "collection.d.ts", + "collection.default.d.ts", "compact.d.ts", "concat.d.ts", "cond.d.ts", + "conforms.d.ts", + "conformsTo.d.ts", "constant.d.ts", "countBy.d.ts", "create.d.ts", "curry.d.ts", "curryRight.d.ts", + "date.d.ts", + "date.default.d.ts", "debounce.d.ts", "deburr.d.ts", + "defaultTo.d.ts", "defaults.d.ts", "defaultsDeep.d.ts", "defer.d.ts", @@ -102,6 +110,8 @@ "forOwn.d.ts", "forOwnRight.d.ts", "fromPairs.d.ts", + "function.d.ts", + "function.default.d.ts", "functions.d.ts", "functionsIn.d.ts", "get.d.ts", @@ -112,10 +122,10 @@ "hasIn.d.ts", "head.d.ts", "identity.d.ts", + "inRange.d.ts", "includes.d.ts", "indexOf.d.ts", "initial.d.ts", - "inRange.d.ts", "intersection.d.ts", "intersectionBy.d.ts", "intersectionWith.d.ts", @@ -166,6 +176,8 @@ "keyBy.d.ts", "keys.d.ts", "keysIn.d.ts", + "lang.d.ts", + "lang.default.d.ts", "last.d.ts", "lastIndexOf.d.ts", "lowerCase.d.ts", @@ -177,6 +189,8 @@ "mapValues.d.ts", "matches.d.ts", "matchesProperty.d.ts", + "math.d.ts", + "math.default.d.ts", "max.d.ts", "maxBy.d.ts", "mean.d.ts", @@ -189,12 +203,16 @@ "min.d.ts", "minBy.d.ts", "mixin.d.ts", + "multiply.d.ts", "negate.d.ts", - "noConflict.d.ts", "noop.d.ts", "now.d.ts", "nth.d.ts", "nthArg.d.ts", + "number.d.ts", + "number.default.d.ts", + "object.d.ts", + "object.default.d.ts", "omit.d.ts", "omitBy.d.ts", "once.d.ts", @@ -233,7 +251,6 @@ "result.d.ts", "reverse.d.ts", "round.d.ts", - "runInContext.d.ts", "sample.d.ts", "sampleSize.d.ts", "set.d.ts", @@ -256,6 +273,13 @@ "spread.d.ts", "startCase.d.ts", "startsWith.d.ts", + "string.d.ts", + "string.default.d.ts", + "stubArray.d.ts", + "stubFalse.d.ts", + "stubObject.d.ts", + "stubString.d.ts", + "stubTrue.d.ts", "subtract.d.ts", "sum.d.ts", "sumBy.d.ts", @@ -264,10 +288,9 @@ "takeRight.d.ts", "takeRightWhile.d.ts", "takeWhile.d.ts", - "tap.d.ts", "template.d.ts", + "templateSettings.d.ts", "throttle.d.ts", - "thru.d.ts", "times.d.ts", "toArray.d.ts", "toFinite.d.ts", @@ -294,8 +317,8 @@ "unionWith.d.ts", "uniq.d.ts", "uniqBy.d.ts", - "uniqueId.d.ts", "uniqWith.d.ts", + "uniqueId.d.ts", "unset.d.ts", "unzip.d.ts", "unzipWith.d.ts", @@ -303,6 +326,8 @@ "updateWith.d.ts", "upperCase.d.ts", "upperFirst.d.ts", + "util.d.ts", + "util.default.d.ts", "values.d.ts", "valuesIn.d.ts", "without.d.ts", @@ -316,4 +341,4 @@ "zipObjectDeep.d.ts", "zipWith.d.ts" ] -} \ No newline at end of file +} diff --git a/types/lodash-es/util.d.ts b/types/lodash-es/util.d.ts new file mode 100644 index 0000000000..aa043a6138 --- /dev/null +++ b/types/lodash-es/util.d.ts @@ -0,0 +1,34 @@ +import { default as attempt } from "./attempt"; +import { default as bindAll } from "./bindAll"; +import { default as cond } from "./cond"; +import { default as conforms } from "./conforms"; +import { default as constant } from "./constant"; +import { default as defaultTo } from "./defaultTo"; +import { default as flow } from "./flow"; +import { default as flowRight } from "./flowRight"; +import { default as identity } from "./identity"; +import { default as iteratee } from "./iteratee"; +import { default as matches } from "./matches"; +import { default as matchesProperty } from "./matchesProperty"; +import { default as method } from "./method"; +import { default as methodOf } from "./methodOf"; +import { default as mixin } from "./mixin"; +import { default as noop } from "./noop"; +import { default as nthArg } from "./nthArg"; +import { default as over } from "./over"; +import { default as overEvery } from "./overEvery"; +import { default as overSome } from "./overSome"; +import { default as property } from "./property"; +import { default as propertyOf } from "./propertyOf"; +import { default as range } from "./range"; +import { default as rangeRight } from "./rangeRight"; +import { default as stubArray } from "./stubArray"; +import { default as stubFalse } from "./stubFalse"; +import { default as stubObject } from "./stubObject"; +import { default as stubString } from "./stubString"; +import { default as stubTrue } from "./stubTrue"; +import { default as times } from "./times"; +import { default as toPath } from "./toPath"; +import { default as uniqueId } from "./uniqueId"; + +export { default } from "./util.default"; diff --git a/types/lodash-es/util.default.d.ts b/types/lodash-es/util.default.d.ts new file mode 100644 index 0000000000..62eb3c070a --- /dev/null +++ b/types/lodash-es/util.default.d.ts @@ -0,0 +1,68 @@ +import attempt from "./attempt"; +import bindAll from "./bindAll"; +import cond from "./cond"; +import conforms from "./conforms"; +import constant from "./constant"; +import defaultTo from "./defaultTo"; +import flow from "./flow"; +import flowRight from "./flowRight"; +import identity from "./identity"; +import iteratee from "./iteratee"; +import matches from "./matches"; +import matchesProperty from "./matchesProperty"; +import method from "./method"; +import methodOf from "./methodOf"; +import mixin from "./mixin"; +import noop from "./noop"; +import nthArg from "./nthArg"; +import over from "./over"; +import overEvery from "./overEvery"; +import overSome from "./overSome"; +import property from "./property"; +import propertyOf from "./propertyOf"; +import range from "./range"; +import rangeRight from "./rangeRight"; +import stubArray from "./stubArray"; +import stubFalse from "./stubFalse"; +import stubObject from "./stubObject"; +import stubString from "./stubString"; +import stubTrue from "./stubTrue"; +import times from "./times"; +import toPath from "./toPath"; +import uniqueId from "./uniqueId"; + +declare const defaultExport: { + attempt: typeof attempt; + bindAll: typeof bindAll; + cond: typeof cond; + conforms: typeof conforms; + constant: typeof constant; + defaultTo: typeof defaultTo; + flow: typeof flow; + flowRight: typeof flowRight; + identity: typeof identity; + iteratee: typeof iteratee; + matches: typeof matches; + matchesProperty: typeof matchesProperty; + method: typeof method; + methodOf: typeof methodOf; + mixin: typeof mixin; + noop: typeof noop; + nthArg: typeof nthArg; + over: typeof over; + overEvery: typeof overEvery; + overSome: typeof overSome; + property: typeof property; + propertyOf: typeof propertyOf; + range: typeof range; + rangeRight: typeof rangeRight; + stubArray: typeof stubArray; + stubFalse: typeof stubFalse; + stubObject: typeof stubObject; + stubString: typeof stubString; + stubTrue: typeof stubTrue; + times: typeof times; + toPath: typeof toPath; + uniqueId: typeof uniqueId; +}; +export default defaultExport; diff --git a/types/lodash/scripts/generate-all.sh b/types/lodash/scripts/generate-all.sh new file mode 100644 index 0000000000..2f79589533 --- /dev/null +++ b/types/lodash/scripts/generate-all.sh @@ -0,0 +1,15 @@ +# If some one want to update lodash modules, you must run this script under the same dir where it lives. +# Or you can run them(generate-modules.ts) separately by hand +#!/usr/bin/env bash + +npm i ts-node -g + +ts-node ./generate-modules.ts + +cd ../../../ + +npm i prettier -D + +cd types/lodash-es/scripts + +ts-node ./generate-modules.ts diff --git a/types/lodash/scripts/generate-modules.ts b/types/lodash/scripts/generate-modules.ts index 32bbc0ec25..a15462ba11 100644 --- a/types/lodash/scripts/generate-modules.ts +++ b/types/lodash/scripts/generate-modules.ts @@ -18,25 +18,15 @@ async function main(): Promise { } } - const lodashEsDir = path.join("..", "..", "lodash-es"); - // Generate lodash/tsconfig.json fs.writeFileSync(path.join("..", "tsconfig.json"), lodashTsconfig(all)); - // Generate lodash-es index and tsconfig - fs.writeFileSync(path.join(lodashEsDir, "index.d.ts"), lodashEsIndex(all)); - //`export {\n ${all.join(",\n ")}\n} from "lodash";\n`); - fs.writeFileSync(path.join(lodashEsDir, "tsconfig.json"), lodashEsTsconfig(all)); - for (const module of all) { console.log(module); // Generate local module fs.writeFileSync(path.join("..", `${module}.d.ts`), `import { ${module} } from "./index";\nexport = ${module};\n`); - // Generate lodash-es module - fs.writeFileSync(path.join(lodashEsDir, `${module}.d.ts`), `import { ${module} } from "lodash";\nexport default ${module};\n`); - // Generate `lodash.foo` module if (!notOnNpm.has(module)) { const dir = path.join("..", "..", `lodash.${module.toLowerCase()}`); @@ -84,6 +74,7 @@ function compilerOptions(): object { "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, + "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ "../" @@ -92,21 +83,6 @@ function compilerOptions(): object { "noEmit": true, "forceConsistentCasingInFileNames": true }; -}; - -function lodashEsIndex(moduleNames: ReadonlyArray): string { - return `// Type definitions for lodash-es 4.14 -// Project: http://lodash.com/ -// Definitions by: Stephen Lautier -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.2 - -// Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts - -export { - ${moduleNames.join(",\n ")} -} from "lodash"; -`; } function lodashTsconfig(moduleNames: ReadonlyArray): string { @@ -120,17 +96,6 @@ function lodashTsconfig(moduleNames: ReadonlyArray): string { }, undefined, 4); } -function lodashEsTsconfig(moduleNames: ReadonlyArray): string { - return JSON.stringify({ - compilerOptions: compilerOptions(), - files: [ - "index.d.ts", - "lodash-es-tests.ts", - ...moduleNames.map(m => `${m}.d.ts`), - ] - }, undefined, 4); -} - function lodashDotFooTsconfig(): string { return JSON.stringify({ compilerOptions: compilerOptions(), From 95457f71ef80433a231b48f0c5e811a5beafb941 Mon Sep 17 00:00:00 2001 From: Andy Date: Mon, 23 Oct 2017 12:59:15 -0700 Subject: [PATCH 030/252] selenium-webdriver: Fix lint (#20918) --- types/selenium-webdriver/tslint.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/types/selenium-webdriver/tslint.json b/types/selenium-webdriver/tslint.json index 5ffc468766..5ae3225834 100644 --- a/types/selenium-webdriver/tslint.json +++ b/types/selenium-webdriver/tslint.json @@ -10,6 +10,10 @@ "no-empty-interface": false, "no-inferrable-types": false, "no-any-union": false, + "no-redundant-jsdoc": false, + "no-redundant-jsdoc-2": false, + "no-redundant-undefined": false, + "no-unnecessary-class": false, "no-unnecessary-generics": false, "prefer-const": false, "semicolon": false, From ddd0f06bbffb432ff0427fd1807746354e290db4 Mon Sep 17 00:00:00 2001 From: Andy Date: Mon, 23 Oct 2017 13:01:49 -0700 Subject: [PATCH 031/252] rx-lite: Fix lint (#20916) --- types/rx-lite/index.d.ts | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/types/rx-lite/index.d.ts b/types/rx-lite/index.d.ts index 331145e0dd..16646b0473 100644 --- a/types/rx-lite/index.d.ts +++ b/types/rx-lite/index.d.ts @@ -327,21 +327,21 @@ declare namespace Rx { /** * Projects each notification of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence. - * @param {Function} onNext A transform function to apply to each element; the second parameter of the function represents the index of the source element. - * @param {Function} onError A transform function to apply when an error occurs in the source sequence. - * @param {Function} onCompleted A transform function to apply when the end of the source sequence is reached. - * @param {Any} [thisArg] An optional "this" to use to invoke each transform. - * @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function corresponding to each notification in the input sequence. + * @param onNext A transform function to apply to each element; the second parameter of the function represents the index of the source element. + * @param onError A transform function to apply when an error occurs in the source sequence. + * @param onCompleted A transform function to apply when the end of the source sequence is reached. + * @param [thisArg] An optional "this" to use to invoke each transform. + * @returns An observable sequence whose elements are the result of invoking the one-to-many transform function corresponding to each notification in the input sequence. */ selectManyObserver(onNext: (value: T, index: number) => Observable, onError: (exception: any) => Observable, onCompleted: () => Observable, thisArg?: any): Observable; /** * Projects each notification of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence. - * @param {Function} onNext A transform function to apply to each element; the second parameter of the function represents the index of the source element. - * @param {Function} onError A transform function to apply when an error occurs in the source sequence. - * @param {Function} onCompleted A transform function to apply when the end of the source sequence is reached. - * @param {Any} [thisArg] An optional "this" to use to invoke each transform. - * @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function corresponding to each notification in the input sequence. + * @param onNext A transform function to apply to each element; the second parameter of the function represents the index of the source element. + * @param onError A transform function to apply when an error occurs in the source sequence. + * @param onCompleted A transform function to apply when the end of the source sequence is reached. + * @param [thisArg] An optional "this" to use to invoke each transform. + * @returns An observable sequence whose elements are the result of invoking the one-to-many transform function corresponding to each notification in the input sequence. */ flatMapObserver(onNext: (value: T, index: number) => Observable, onError: (exception: any) => Observable, onCompleted: () => Observable, thisArg?: any): Observable; @@ -426,7 +426,7 @@ declare namespace Rx { * @since 2.2.28 * @param selector Selector to invoke for every item in the current subscription. * @param [thisArg] An optional context to invoke with the selector parameter. - * @returns {An exclusive observable with only the results that happen when subscribed. + * @returns An exclusive observable with only the results that happen when subscribed. */ exclusiveMap(selector: (value: I, index: number, source: Observable) => R, thisArg?: any): Observable; From f30198b018e5c87d853d1d85edeb262f496d9d09 Mon Sep 17 00:00:00 2001 From: Andy Date: Mon, 23 Oct 2017 13:02:16 -0700 Subject: [PATCH 032/252] sharp: Fix lint (#20919) --- types/sharp/index.d.ts | 208 ++++++++++++++++++++--------------------- 1 file changed, 103 insertions(+), 105 deletions(-) diff --git a/types/sharp/index.d.ts b/types/sharp/index.d.ts index 710416f109..530501dd13 100644 --- a/types/sharp/index.d.ts +++ b/types/sharp/index.d.ts @@ -9,10 +9,10 @@ import { Duplex } from "stream"; /** * Creates a sharp instance from an image - * @param {string} input Buffer containing JPEG, PNG, WebP, GIF, SVG, TIFF or raw pixel image data, or String containing the path to an JPEG, PNG, WebP, GIF, SVG or TIFF image file. - * @param {sharp.SharpOptions} options Object with optional attributes. + * @param input Buffer containing JPEG, PNG, WebP, GIF, SVG, TIFF or raw pixel image data, or String containing the path to an JPEG, PNG, WebP, GIF, SVG or TIFF image file. + * @param options Object with optional attributes. * @throws {Error} Invalid parameters - * @returns {sharp.SharpInstance} A sharp instance that can be used to chain operations + * @returns A sharp instance that can be used to chain operations */ declare function sharp(input?: string | Buffer, options?: sharp.SharpOptions): sharp.SharpInstance; declare namespace sharp { @@ -22,24 +22,23 @@ declare namespace sharp { * Gets, or when options are provided sets, the limits of libvips' operation cache. * Existing entries in the cache will be trimmed after any change in limits. * This method always returns cache statistics, useful for determining how much working memory is required for a particular task. - * @param {boolean|sharp.CacheOptions} options Object with the cache options, or Boolean where true uses default cache settings and false removes all caching. - * @returns {Object} + * @param options Object with the cache options, or Boolean where true uses default cache settings and false removes all caching. */ function cache(options?: boolean | CacheOptions): CacheResult; /** * Gets, or when a concurrency is provided sets, the number of threads libvips' should create to process each image. - * @param {number} concurrency concurrency value + * @param concurrency concurrency value */ function concurrency(threads?: number): number; /** * Provides access to internal task counters. - * @returns {sharp.SharpCounters} Object containing task counters + * @returns Object containing task counters */ function counters(): SharpCounters; /** * Get and set use of SIMD vector unit instructions. - * @param {boolean} enable enable or disable use of SIMD vector unit instructions - * @returns {boolean} true if usage of SIMD vector unit instructions is enabled + * @param enable enable or disable use of SIMD vector unit instructions + * @returns true if usage of SIMD vector unit instructions is enabled */ function simd(enable?: boolean): boolean; const kernel: KernelEnum; @@ -82,67 +81,67 @@ declare namespace sharp { interface SharpInstance extends Duplex { /** * Fast access to image metadata without decoding any compressed image data. - * @returns {SharpInstance} A sharp instance that can be used to chain operations + * @returns A sharp instance that can be used to chain operations */ metadata(callback: (err: Error, metadata: Metadata) => void): SharpInstance; /** * Fast access to image metadata without decoding any compressed image data. - * @returns {Promise} A promise that fulfills with a metadata object. + * @returns A promise that fulfills with a metadata object. */ metadata(): Promise; /** * Take a "snapshot" of the Sharp instance, returning a new instance. - * @returns {SharpInstance} A sharp instance that can be used to chain operations + * @returns A sharp instance that can be used to chain operations */ clone(): SharpInstance; /** * An advanced setting that switches the libvips access method to VIPS_ACCESS_SEQUENTIAL. - * @param {boolean} sequentialRead true to enable and false to disable (defaults to true) - * @returns {SharpInstance} A sharp instance that can be used to chain operations + * @param sequentialRead true to enable and false to disable (defaults to true) + * @returns A sharp instance that can be used to chain operations */ sequentialRead(sequentialRead?: boolean): SharpInstance; /** * Do not process input images where the number of pixels (width _ height) exceeds this limit. - * @param {number|boolean} pixels An integral Number of pixels, zero or false to remove limit, true to use default limit. + * @param pixels An integral Number of pixels, zero or false to remove limit, true to use default limit. * @throws {Error} Invalid limit - * @returns {SharpInstance} A sharp instance that can be used to chain operations + * @returns A sharp instance that can be used to chain operations */ limitInputPixels(pixels: number | boolean): SharpInstance; /** * Resize image to width x height. By default, the resized image is centre cropped to the exact size specified. - * @param {number} width pixels wide the resultant image should be, between 1 and 16383 (0x3FFF). Use null or undefined to auto-scale the width to match the height. - * @param {number} height pixels high the resultant image should be, between 1 and 16383. Use null or undefined to auto-scale the height to match the width. - * @param {ResizeOptions} options resize options + * @param width pixels wide the resultant image should be, between 1 and 16383 (0x3FFF). Use null or undefined to auto-scale the width to match the height. + * @param height pixels high the resultant image should be, between 1 and 16383. Use null or undefined to auto-scale the height to match the width. + * @param options resize options * @throws {Error} Invalid parameters - * @returns {SharpInstance} A sharp instance that can be used to chain operations + * @returns A sharp instance that can be used to chain operations */ resize(width?: number, height?: number, options?: ResizeOptions): SharpInstance; /** * Crop the resized image to the exact size specified, the default behaviour. - * @param {number|string} crop A member of sharp.gravity to crop to an edge/corner or sharp.strategy to crop dynamically. (optional, default 'centre') + * @param crop A member of sharp.gravity to crop to an edge/corner or sharp.strategy to crop dynamically. (optional, default 'centre') * @throws {Error} Invalid parameters - * @returns {SharpInstance} A sharp instance that can be used to chain operations + * @returns A sharp instance that can be used to chain operations */ crop(crop?: number | string): SharpInstance; /** * Preserving aspect ratio, resize the image to the maximum width or height specified then embed on a background of the exact width and height specified. - * @returns {SharpInstance} A sharp instance that can be used to chain operations + * @returns A sharp instance that can be used to chain operations */ embed(): SharpInstance; /** * Preserving aspect ratio, resize the image to be as large as possible while ensuring its dimensions are less than or equal to the width and height specified. - * @returns {SharpInstance} A sharp instance that can be used to chain operations + * @returns A sharp instance that can be used to chain operations */ max(): SharpInstance; /** * Preserving aspect ratio, resize the image to be as small as possible while ensuring its dimensions are greater than or equal to the width and height specified. - * @returns {SharpInstance} A sharp instance that can be used to chain operations + * @returns A sharp instance that can be used to chain operations */ min(): SharpInstance; /** * Do not enlarge the output image if the input image width or height are already less than the required dimensions. - * @param {boolean} withoutEnlargement true to enable and false to disable (defaults to true) - * @returns {SharpInstance} A sharp instance that can be used to chain operations + * @param withoutEnlargement true to enable and false to disable (defaults to true) + * @returns A sharp instance that can be used to chain operations */ withoutEnlargement(withoutEnlargement?: boolean): SharpInstance; /** @@ -151,99 +150,99 @@ declare namespace sharp { ignoreAspectRatio(): SharpInstance; /** * Extract a region of the image. - * @param {Region} region Region to extract + * @param region Region to extract * @throws {Error} Invalid parameters - * @returns {SharpInstance} A sharp instance that can be used to chain operations + * @returns A sharp instance that can be used to chain operations */ extract(region: Region): SharpInstance; /** * Trim "boring" pixels from all edges that contain values within a percentage similarity of the top-left pixel. - * @param {number} tolerance value between 1 and 99 representing the percentage similarity. (optional, default 10) + * @param tolerance value between 1 and 99 representing the percentage similarity. (optional, default 10) * @throws {Error} Invalid parameters - * @returns {SharpInstance} A sharp instance that can be used to chain operations + * @returns A sharp instance that can be used to chain operations */ trim(tolerance?: number): SharpInstance; /** * Set the background for the embed, flatten and extend operations. The default background is {r: 0, g: 0, b: 0, alpha: 1}, black without transparency. - * @param {RGBA|string} rgba String or Object parsed by the color module to extract values for red, green, blue and alpha. + * @param rgba String or Object parsed by the color module to extract values for red, green, blue and alpha. * @throws {Error} Invalid parameter - * @returns {SharpInstance} A sharp instance that can be used to chain operations + * @returns A sharp instance that can be used to chain operations */ background(rgba?: RGBA | string): SharpInstance; // Wait for typings to fetch latest color typings from DT /** * Merge alpha transparency channel, if any, with background. - * @param {boolean} flatten true to enable and false to disable (defaults to true) - * @returns {SharpInstance} A sharp instance that can be used to chain operations + * @param flatten true to enable and false to disable (defaults to true) + * @returns A sharp instance that can be used to chain operations */ flatten(flatten?: boolean): SharpInstance; /** * Extends/pads the edges of the image with the colour provided to the background method. - * @param {number|ExtendOptions} extend single pixel count to add to all edges or an Object with per-edge counts + * @param extend single pixel count to add to all edges or an Object with per-edge counts * @throws {Error} Invalid parameters - * @returns {SharpInstance} A sharp instance that can be used to chain operations + * @returns A sharp instance that can be used to chain operations */ extend(extend: number | ExtendOptions): SharpInstance; /** * Produce the "negative" of the image. - * @param {boolean} negate true to enable and false to disable (defaults to true) - * @returns {SharpInstance} A sharp instance that can be used to chain operations + * @param negate true to enable and false to disable (defaults to true) + * @returns A sharp instance that can be used to chain operations */ negate(negate?: boolean): SharpInstance; /** * Rotate the output image by either an explicit angle or auto-orient based on the EXIF Orientation tag. - * @param {number} angle 0, 90, 180 or 270. (optional, default auto) + * @param angle 0, 90, 180 or 270. (optional, default auto) * @throws {Error} Invalid parameters - * @returns {SharpInstance} A sharp instance that can be used to chain operations + * @returns A sharp instance that can be used to chain operations */ rotate(angle?: number): SharpInstance; /** * Flip the image about the vertical Y axis. - * @param {boolean} flip true to enable and false to disable (defaults to true) - * @returns {SharpInstance} A sharp instance that can be used to chain operations + * @param flip true to enable and false to disable (defaults to true) + * @returns A sharp instance that can be used to chain operations */ flip(flip?: boolean): SharpInstance; /** * Flop the image about the horizontal X axis. - * @param {boolean} flop true to enable and false to disable (defaults to true) - * @returns {SharpInstance} A sharp instance that can be used to chain operations + * @param flop true to enable and false to disable (defaults to true) + * @returns A sharp instance that can be used to chain operations */ flop(flop?: boolean): SharpInstance; /** * Blur the image. - * @param {number} sigma a value between 0.3 and 1000 representing the sigma of the Gaussian mask, where sigma = 1 + radius / 2. + * @param sigma a value between 0.3 and 1000 representing the sigma of the Gaussian mask, where sigma = 1 + radius / 2. * @throws {Error} Invalid parameters - * @returns {SharpInstance} A sharp instance that can be used to chain operations + * @returns A sharp instance that can be used to chain operations */ blur(sigma?: number): SharpInstance; /** * Convolve the image with the specified kernel. - * @param {Kernel} kernel the specified kernel + * @param kernel the specified kernel * @throws {Error} Invalid parameters - * @returns {SharpInstance} A sharp instance that can be used to chain operations + * @returns A sharp instance that can be used to chain operations */ convolve(kernel: Kernel): SharpInstance; /** * Sharpen the image. - * @param {number} sigma the sigma of the Gaussian mask, where sigma = 1 + radius / 2. - * @param {number} flat the level of sharpening to apply to "flat" areas. (optional, default 1.0) - * @param {number} jagged the level of sharpening to apply to "jagged" areas. (optional, default 2.0) + * @param sigma the sigma of the Gaussian mask, where sigma = 1 + radius / 2. + * @param flat the level of sharpening to apply to "flat" areas. (optional, default 1.0) + * @param jagged the level of sharpening to apply to "jagged" areas. (optional, default 2.0) * @throws {Error} Invalid parameters - * @returns {SharpInstance} A sharp instance that can be used to chain operations + * @returns A sharp instance that can be used to chain operations */ sharpen(sigma?: number, flat?: number, jagged?: number): SharpInstance; /** * Any pixel value greather than or equal to the threshold value will be set to 255, otherwise it will be set to 0. - * @param {number} threshold a value in the range 0-255 representing the level at which the threshold will be applied. (optional, default 128) - * @param {ThresholdOptions} options threshold options + * @param threshold a value in the range 0-255 representing the level at which the threshold will be applied. (optional, default 128) + * @param options threshold options * @throws {Error} Invalid parameters - * @returns {SharpInstance} A sharp instance that can be used to chain operations + * @returns A sharp instance that can be used to chain operations */ threshold(threshold?: number, options?: ThresholdOptions): SharpInstance; /** * Apply a gamma correction by reducing the encoding (darken) pre-resize at a factor of 1/gamma then increasing the encoding (brighten) post-resize at a factor of gamma. - * @param {number} gamma value between 1.0 and 3.0. (optional, default 2.2) + * @param gamma value between 1.0 and 3.0. (optional, default 2.2) * @throws {Error} Invalid parameters - * @returns {SharpInstance} A sharp instance that can be used to chain operations + * @returns A sharp instance that can be used to chain operations */ gamma(gamma?: number): SharpInstance; /** @@ -254,8 +253,8 @@ declare namespace sharp { * By default the output image will be web-friendly sRGB and contain three (identical) color channels. * This may be overridden by other sharp operations such as toColourspace('b-w'), which will produce an output image containing one color channel. * An alpha channel may be present, and will be unchanged by the operation. - * @param {boolean} grayscale true to enable and false to disable (defaults to true) - * @returns {SharpInstance} A sharp instance that can be used to chain operations + * @param grayscale true to enable and false to disable (defaults to true) + * @returns A sharp instance that can be used to chain operations */ grayscale(grayscale?: boolean): SharpInstance; /** @@ -265,157 +264,156 @@ declare namespace sharp { * By default the output image will be web-friendly sRGB and contain three (identical) color channels. * This may be overridden by other sharp operations such as toColourspace('b-w'), which will produce an output image containing one color channel. * An alpha channel may be present, and will be unchanged by the operation. - * @param {boolean} greyscale true to enable and false to disable (defaults to true) - * @returns {SharpInstance} A sharp instance that can be used to chain operations + * @param greyscale true to enable and false to disable (defaults to true) + * @returns A sharp instance that can be used to chain operations */ greyscale(greyscale?: boolean): SharpInstance; /** * Enhance output image contrast by stretching its luminance to cover the full dynamic range. - * @param {boolean} normalize true to enable and false to disable (defaults to true) - * @returns {SharpInstance} A sharp instance that can be used to chain operations + * @param normalize true to enable and false to disable (defaults to true) + * @returns A sharp instance that can be used to chain operations */ normalize(normalize?: boolean): SharpInstance; /** * Alternative spelling of normalise. * Enhance output image contrast by stretching its luminance to cover the full dynamic range. - * @param {boolean} normalise true to enable and false to disable (defaults to true) + * @param normalise true to enable and false to disable (defaults to true) */ normalise(normalise?: boolean): SharpInstance; /** * Overlay (composite) an image over the processed (resized, extracted etc.) image. - * @param {string|Buffer} image Buffer containing image data or String containing the path to an image file. - * @param {OverlayOptions} options overlay options - * @returns {SharpInstance} A sharp instance that can be used to chain operations + * @param image Buffer containing image data or String containing the path to an image file. + * @param options overlay options + * @returns A sharp instance that can be used to chain operations */ overlayWith(image: string | Buffer, options?: OverlayOptions): SharpInstance; /** * Set the output colourspace. - * @param {string} colourspace output colourspace e.g. srgb, rgb, cmyk, lab, b-w ... + * @param colourspace output colourspace e.g. srgb, rgb, cmyk, lab, b-w ... * @throws {Error} Invalid parameters - * @returns {SharpInstance} A sharp instance that can be used to chain operations + * @returns A sharp instance that can be used to chain operations */ toColourspace(colourspace?: string): SharpInstance; /** * Alternative spelling of toColourspace. * Set the output colorspace. - * @param {string} colorspace output colourspace e.g. srgb, rgb, cmyk, lab, b-w ... + * @param colorspace output colourspace e.g. srgb, rgb, cmyk, lab, b-w ... * @throws {Error} Invalid parameters - * @returns {SharpInstance} A sharp instance that can be used to chain operations + * @returns A sharp instance that can be used to chain operations */ toColorspace(colorspace: string): SharpInstance; /** * Extract a single channel from a multi-channel image. - * @param {number|string} channel zero-indexed band number to extract, or red, green or blue as alternative to 0, 1 or 2 respectively. + * @param channel zero-indexed band number to extract, or red, green or blue as alternative to 0, 1 or 2 respectively. * @throws {Error} Invalid channel - * @returns {SharpInstance} A sharp instance that can be used to chain operations + * @returns A sharp instance that can be used to chain operations */ extractChannel(channel: number | string): SharpInstance; /** * Join one or more channels to the image. The meaning of the added channels depends on the output colourspace, set with toColourspace(). - * @param {string|string[]|Buffer|Buffer[]} channels one or more images (file paths, Buffers). - * @param {{raw:Raw}} options image options + * @param channels one or more images (file paths, Buffers). + * @param options image options * @throws {Error} Invalid parameters - * @returns {SharpInstance} A sharp instance that can be used to chain operations + * @returns A sharp instance that can be used to chain operations */ joinChannel(channels: string | string[] | Buffer | Buffer[], options?: { raw: Raw }): SharpInstance; /** * Perform a bitwise boolean operation on all input image channels (bands) to produce a single channel output image. - * @param {string} boolOp one of and, or or eor to perform that bitwise operation, like the C logic operators &, | and ^ respectively. - * @returns {SharpInstance} A sharp instance that can be used to chain operations + * @param boolOp one of and, or or eor to perform that bitwise operation, like the C logic operators &, | and ^ respectively. + * @returns A sharp instance that can be used to chain operations */ bandbool(boolOp: string): SharpInstance; /** * Perform a bitwise boolean operation with operand image. - * @param {string|Buffer} image Buffer containing image data or String containing the path to an image file. - * @param {strip} operator one of and, or or eor to perform that bitwise operation, like the C logic operators &, | and ^ respectively. - * @param {{raw:Raw}} options describes operand when using raw pixel data. + * @param image Buffer containing image data or String containing the path to an image file. + * @param operator one of and, or or eor to perform that bitwise operation, like the C logic operators &, | and ^ respectively. + * @param options describes operand when using raw pixel data. * @throws {Error} Invalid parameters - * @returns {SharpInstance} A sharp instance that can be used to chain operations + * @returns A sharp instance that can be used to chain operations */ boolean(operand: string | Buffer, operator: string, options?: { raw: Raw }): SharpInstance; /** * Write output image data to a file. - * @param {string} fileOut The path to write the image data to. - * @param {Function} callback Callback function called on completion with two arguments (err, info). info contains the output image format, size (bytes), width, height and channels. + * @param fileOut The path to write the image data to. + * @param callback Callback function called on completion with two arguments (err, info). info contains the output image format, size (bytes), width, height and channels. * @throws {Error} Invalid parameters - * @returns {SharpInstance} A sharp instance that can be used to chain operations + * @returns A sharp instance that can be used to chain operations */ toFile(fileOut: string, callback: (err: Error, info: OutputInfo) => void): SharpInstance; /** * Write output image data to a file. - * @param {string} fileOut The path to write the image data to. + * @param fileOut The path to write the image data to. * @throws {Error} Invalid parameters - * @returns {Promise} A promise that fulfills with an object containing informations on the resulting file + * @returns A promise that fulfills with an object containing informations on the resulting file */ toFile(fileOut: string): Promise; /** * Write output to a Buffer. JPEG, PNG, WebP, and RAW output are supported. By default, the format will match the input image, except GIF and SVG input which become PNG output. - * @param {Function} callback Callback function called on completion with three arguments (err, buffer, info). + * @param callback Callback function called on completion with three arguments (err, buffer, info). * err is an error message, if any. * buffer is the output image data. * info contains the output image format, size (bytes), width, height and channels. * A Promises/A+ promise is returned when callback is not provided. - * @returns {SharpInstance} A sharp instance that can be used to chain operations + * @returns A sharp instance that can be used to chain operations */ toBuffer(callback: (err: Error, buffer: Buffer, info: OutputInfo) => void): SharpInstance; /** * Write output to a Buffer. JPEG, PNG, WebP, and RAW output are supported. By default, the format will match the input image, except GIF and SVG input which become PNG output. - * @returns {Promise} A promise that fulfills with the resulting Buffer + * @returns A promise that fulfills with the resulting Buffer */ toBuffer(): Promise; /** * Use these JPEG options for output image. - * @param {JpegOptions} options Output options. + * @param options Output options. * @throws {Error} Invalid options - * @returns {SharpInstance} A sharp instance that can be used to chain operations + * @returns A sharp instance that can be used to chain operations */ jpeg(options?: JpegOptions): SharpInstance; /** * Use these PNG options for output image. - * @param {PngOptions} options Output options. + * @param options Output options. * @throws {Error} Invalid options - * @returns {SharpInstance} A sharp instance that can be used to chain operations + * @returns A sharp instance that can be used to chain operations */ png(options?: PngOptions): SharpInstance; /** * Use these WebP options for output image. - * @param {OutputOptions} options Output options. + * @param options Output options. * @throws {Error} Invalid options - * @returns {SharpInstance} A sharp instance that can be used to chain operations + * @returns A sharp instance that can be used to chain operations */ webp(options?: OutputOptions): SharpInstance; /** * Use these TIFF options for output image. - * @param {OutputOptions} options Output options. + * @param options Output options. * @throws {Error} Invalid options - * @returns {SharpInstance} A sharp instance that can be used to chain operations + * @returns A sharp instance that can be used to chain operations */ tiff(options?: OutputOptions): SharpInstance; /** * Force output to be raw, uncompressed uint8 pixel data. - * @returns {SharpInstance} A sharp instance that can be used to chain operations + * @returns A sharp instance that can be used to chain operations */ raw(): SharpInstance; /** * Force output to a given format. - * @param {string|AvailableFormatInfo} format a String or an Object with an 'id' attribute - * @param {OutputOptions|JpegOptions|PngOptions} options output options + * @param format a String or an Object with an 'id' attribute + * @param options output options * @throws {Error} Unsupported format or options - * @returns {SharpInstance} A sharp instance that can be used to chain operations + * @returns A sharp instance that can be used to chain operations */ toFormat(format: string | AvailableFormatInfo, options?: OutputOptions | JpegOptions | PngOptions): SharpInstance; /** * Include all metadata (EXIF, XMP, IPTC) from the input image in the output image. * The default behaviour, when withMetadata is not used, is to strip all metadata and convert to the device-independent sRGB colour space. * This will also convert to and add a web-friendly sRGB ICC profile. - * @param {Metadata} * @throws {Error} Invalid parameters. */ withMetadata(metadata?: Metadata): SharpInstance; /** * Use tile-based deep zoom (image pyramid) output. Set the format and options for tile images via the toFormat, jpeg, png or webp functions. * Use a .zip or .szi file extension with toFile to write to a compressed archive file format. - * @param {TileOptions} options options + * @param options options */ tile(options: TileOptions): SharpInstance; } From f997198b92536cc9b3ef6b90e8202a0fc87668b3 Mon Sep 17 00:00:00 2001 From: Andy Date: Mon, 23 Oct 2017 13:02:26 -0700 Subject: [PATCH 033/252] sharp-timer: Fix lint (#20920) --- types/sharp-timer/index.d.ts | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/types/sharp-timer/index.d.ts b/types/sharp-timer/index.d.ts index 6bc54e4713..944da76b4f 100644 --- a/types/sharp-timer/index.d.ts +++ b/types/sharp-timer/index.d.ts @@ -35,7 +35,6 @@ export class Timer { /** * Gets a boolean value to indicate the enabled state * of the current Timer instance. - * @readonly * @default true */ readonly enabled: boolean; @@ -43,7 +42,6 @@ export class Timer { /** * Gets a boolean value to indicate the stopped state * of the current Timer instance. - * @readonly * @default false */ readonly stopped: boolean; @@ -121,37 +119,31 @@ export class Stopwatch { /** * Gets the elapsed time in this format: * hrs:mins:secs:ms - * @readonly */ readonly elapsed: string; /** * Gets the elapsed time in milliseconds. - * @readonly */ readonly elapsedMilliseconds: number; /** * Gets the elapsed time in seconds. - * @readonly */ readonly elapsedSeconds: number; /** * Gets the elapsed time in minutes. - * @readonly */ readonly elapsedMinutes: number; /** * Gets the elapsed hours in hours. - * @readonly */ readonly elapsedHours: number; /** * Gets the isRunning state of the current Stopwatch instance. - * @readonly * @default false */ readonly isRunning: boolean; @@ -204,31 +196,26 @@ export class Timespan { /** * Gets the time interval in milliseconds. - * @readonly */ readonly milliseconds: number; /** * Gets the time interval in seconds. - * @readonly */ readonly seconds: number; /** * Gets the time interval in minutes. - * @readonly */ readonly minutes: number; /** * Gets the time interval in hours. - * @readonly */ readonly hours: number; /** * Gets the time interval in days. - * @readonly */ readonly days: number; From 866d98de66107df05eb46dd6206bcbcf0c9fadea Mon Sep 17 00:00:00 2001 From: makepost Date: Mon, 23 Oct 2017 23:02:35 +0300 Subject: [PATCH 034/252] ExpressRateLimit: Fix handler property (#20613) --- types/express-rate-limit/express-rate-limit-tests.ts | 7 ++++++- types/express-rate-limit/index.d.ts | 12 ++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/types/express-rate-limit/express-rate-limit-tests.ts b/types/express-rate-limit/express-rate-limit-tests.ts index fab5badeb8..677c46254b 100644 --- a/types/express-rate-limit/express-rate-limit-tests.ts +++ b/types/express-rate-limit/express-rate-limit-tests.ts @@ -11,7 +11,12 @@ const createAccountLimiter = new RateLimit({ delayAfter: 1, // begin slowing down responses after the first request delayMs: 3 * 1000, // slow down subsequent responses by 3 seconds per request max: 5, // start blocking after 5 requests - message: "Too many accounts created from this IP, please try again after an hour" + message: "Too many accounts created from this IP, please try again after an hour", + handler: (req, _, next) => next(new Error(`TooManyRequests: ${req.ip}`)) +}); + +const callbackWithFewerParams = new RateLimit({ + handler: (req, res) => res.status(429).json(`TooManyRequests: ${req.ip}`) }); class SomeStore implements RateLimit.Store { diff --git a/types/express-rate-limit/index.d.ts b/types/express-rate-limit/index.d.ts index 86b8d497b0..5ae2013aef 100644 --- a/types/express-rate-limit/index.d.ts +++ b/types/express-rate-limit/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for express-rate-limit 2.8 +// Type definitions for express-rate-limit 2.9 // Project: https://github.com/nfriedly/express-rate-limit -// Definitions by: Cyril Schumacher +// Definitions by: Cyril Schumacher , makepost // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped import express = require("express"); @@ -17,15 +17,15 @@ declare namespace RateLimit { interface Options { delayAfter?: number; delayMs?: number; - handlers?(req?: express.Request, res?: express.Response, next?: express.NextFunction): any; + handler?(req: express.Request, res: express.Response, next: express.NextFunction): any; headers?: boolean; - keyGenerator?(req?: express.Request, res?: express.Response): string; + keyGenerator?(req: express.Request, res: express.Response): string; max?: number; message?: string; - skip?(req?: express.Request, res?: express.Response): boolean; + skip?(req: express.Request, res: express.Response): boolean; statusCode?: number; store?: Store; - onLimitReached?(req?: express.Request, res?: express.Response, optionsUsed?: Options): void; + onLimitReached?(req: express.Request, res: express.Response, optionsUsed: Options): void; windowMs?: number; } } From d6b8621c81d8786e50bb8b96d9759330155f5f94 Mon Sep 17 00:00:00 2001 From: Andy Date: Mon, 23 Oct 2017 13:02:42 -0700 Subject: [PATCH 035/252] prismjs: Fix lint (#20909) --- types/prismjs/index.d.ts | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/types/prismjs/index.d.ts b/types/prismjs/index.d.ts index 1476f56291..06775720af 100644 --- a/types/prismjs/index.d.ts +++ b/types/prismjs/index.d.ts @@ -14,9 +14,9 @@ export const hooks: Hooks; * This is the most high-level function in Prism’s API. It fetches all the elements that have a .language-xxxx class and * then calls Prism.highlightElement() on each one of them. * - * @param {boolean} async Whether to use Web Workers to improve performance and avoid blocking the UI when highlighting + * @param async Whether to use Web Workers to improve performance and avoid blocking the UI when highlighting * very large chunks of code. False by default. - * @param {Function} callback An optional callback to be invoked after the highlighting is done. Mostly useful when async + * @param callback An optional callback to be invoked after the highlighting is done. Mostly useful when async * is true, since in that case, the highlighting is done asynchronously. */ export function highlightAll(async: boolean, callback?: (element: Element) => void): void; @@ -24,11 +24,11 @@ export function highlightAll(async: boolean, callback?: (element: Element) => vo /** * Highlights the code inside a single element. * - * @param {Elment} element The element containing the code. It must have a class of language-xxxx to be processed, + * @param element The element containing the code. It must have a class of language-xxxx to be processed, * where xxxx is a valid language identifier. - * @param {boolean} async Whether to use Web Workers to improve performance and avoid blocking the UI when + * @param async Whether to use Web Workers to improve performance and avoid blocking the UI when * highlighting very large chunks of code. False by default. - * @param {Function} callback An optional callback to be invoked after the highlighting is done. + * @param callback An optional callback to be invoked after the highlighting is done. * Mostly useful when async is true, since in that case, the highlighting is done asynchronously. */ export function highlightElement(element: Element, async: boolean, callback?: (element: Element) => void): void; @@ -37,11 +37,10 @@ export function highlightElement(element: Element, async: boolean, callback?: (e * Low-level function, only use if you know what you’re doing. It accepts a string of text as input and the language * definitions to use, and returns a string with the HTML produced. * - * @param {string} text A string with the code to be highlighted. - * @param {LanguageDefinition} grammer - An object containing the tokens to use. Usually a language definition like + * @param text A string with the code to be highlighted. + * @param grammer - An object containing the tokens to use. Usually a language definition like * Prism.languages.markup - * @param {LanguageDefinition} language - * @returns {string} The highlighted HTML + * @returns The highlighted HTML */ export function highlight(text: string, grammer: LanguageDefinition, language?: LanguageDefinition): string; @@ -51,10 +50,10 @@ export function highlight(text: string, grammer: LanguageDefinition, language?: * nested tokens, the function is called recursively on each of these tokens. This method could be useful in other * contexts as well, as a very crude parser. * - * @param {string} text A string with the code to be highlighted. - * @param {LanguageDefinition} grammar An object containing the tokens to use. Usually a language definition like + * @param text A string with the code to be highlighted. + * @param grammar An object containing the tokens to use. Usually a language definition like * Prism.languages.markup - * @returns {Array} An array of strings, tokens (class Prism.Token) and other arrays. + * @returns An array of strings, tokens (class Prism.Token) and other arrays. */ export function tokenize(text: string, grammar: LanguageDefinition): Array; From d452e22756f7b5f006b82c6a6c5195f1e0c93484 Mon Sep 17 00:00:00 2001 From: Andy Date: Mon, 23 Oct 2017 13:03:00 -0700 Subject: [PATCH 036/252] heremaps: Fix lint (#20927) --- types/heremaps/tslint.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/types/heremaps/tslint.json b/types/heremaps/tslint.json index 81562efc97..3db820d5e5 100644 --- a/types/heremaps/tslint.json +++ b/types/heremaps/tslint.json @@ -3,6 +3,9 @@ "rules": { // TODOs "interface-name": false, - "no-unnecessary-qualifier": false + "no-unnecessary-class": false, + "no-unnecessary-qualifier": false, + "no-redundant-jsdoc": false, + "no-redundant-jsdoc-2": false } } \ No newline at end of file From ee770f3624302dbaf741c3106aa7e32266c4d789 Mon Sep 17 00:00:00 2001 From: Andy Date: Mon, 23 Oct 2017 13:03:45 -0700 Subject: [PATCH 037/252] hexo-fs: Fix lint (#20877) --- types/hexo-fs/index.d.ts | 64 ---------------------------------------- 1 file changed, 64 deletions(-) diff --git a/types/hexo-fs/index.d.ts b/types/hexo-fs/index.d.ts index b1b9ef0405..25fd7d706b 100644 --- a/types/hexo-fs/index.d.ts +++ b/types/hexo-fs/index.d.ts @@ -91,24 +91,14 @@ export let accessSync: ((path: PathLike, mode?: number) => void) | undefined; // // appendFile /** * Appends data to a file. - * @param path - * @param data - * @param callback */ export function appendFile(path: string, data: any, callback?: (err: any) => void): Promise; /** * Appends data to a file. - * @param path - * @param data - * @param options - * @param callback */ export function appendFile(path: string, data: any, options: string | AppendFileOptions, callback?: (err: any) => void): Promise; /** * Synchronous version of fs.appendFile. - * @param path - * @param data - * @param options */ export function appendFileSync(path: string, data: any, options?: string | AppendFileOptions): void; @@ -131,23 +121,14 @@ export { closeSync }; // copy /** * Copies a directory from src to dest. It returns an array of copied files. - * @param src - * @param dest - * @param callback */ export function copyDir(src: string, dest: string, callback?: (err: any, value?: string[]) => void): Promise; /** * Copies a directory from src to dest. It returns an array of copied files. - * @param dest - * @param options - * @param callback */ export function copyDir(src: string, dest: string, options?: DirectoryOptions, callback?: (err: any, value?: string[]) => void): Promise; /** * Copies a file from src to dest. - * @param src - * @param dest - * @param callback */ export function copyFile(src: PathLike, dest: string, callback?: (err: any) => void): Promise; @@ -157,8 +138,6 @@ export { createReadStream, createWriteStream }; // emptyDir /** * Deletes all files in a directory. It returns an array of deleted files. - * @param path - * @param callback */ export function emptyDir(path: string, callback?: (err: any, value?: string | string[]) => void): Promise; export function emptyDir( @@ -171,28 +150,20 @@ export function emptyDirSync(path: string, options?: DirectoryOptions & { exclud // ensurePath /** * Ensures the given path is available to use or appends a number to the path. - * @param path - * @param callback */ export function ensurePath(path: string, callback?: (err: any, value?: string) => void): Promise; /** * Synchronous version of `fs.ensurePath`. - * @param path */ export function ensurePathSync(path: string): string; // ensureWriteStream /** * Creates the parent directories if they does not exist and returns a writable stream. - * @param path - * @param callback */ export function ensureWriteStream(path: string, callback?: (err: any, value?: WriteStream) => void): Promise; /** * Creates the parent directories if they does not exist and returns a writable stream. - * @param path - * @param options - * @param callback */ export function ensureWriteStream( path: string, @@ -208,8 +179,6 @@ export function ensureWriteStream( ): Promise; /** * Synchronous version of fs.ensureWriteStream. - * @param path - * @param options */ export function ensureWriteStreamSync(path: string, options?: string | { flags?: string; @@ -224,12 +193,10 @@ export function ensureWriteStreamSync(path: string, options?: string | { /** * Test whether or not the given `path` exists by checking with the file system. * @param path checking if exists. - * @param callback */ export function exists(path: PathLike, callback?: (exist: boolean) => void): Promise; /** * Synchronous version of `fs.exists`. - * @param path */ export function existsSync(path: PathLike): boolean; @@ -244,22 +211,14 @@ export { linkSync }; // listDir /** * Lists files in a directory. - * @param path - * @param callback */ export function listDir(path: string, callback?: (err: any, value?: string[]) => void): Promise; /** * Lists files in a directory. - * @param path - * @param options - * @param callback */ export function listDir(path: string, options?: DirectoryOptions, callback?: (err: any, value?: string[]) => void): Promise; /** * Synchronous version of `fs.listDir`. - * @param path - * @param options - * @param parent */ export function listDirSync(path: string, options?: DirectoryOptions, parent?: string): string | string[]; @@ -270,13 +229,10 @@ export { mkdirSync }; // mkdirs /** * Creates a directory and its parent directories if they does not exist. - * @param path - * @param callback */ export function mkdirs(path: PathLike, callback?: (err: any) => void): Promise; /** * Synchronous version of `fs.mkdirs`. - * @param path */ export function mkdirsSync(path: string): void; @@ -307,15 +263,10 @@ export { readdirSync }; // readFile /** * Reads the entire contents of a file. - * @param path - * @param callback */ export function readFile(path: PathLike | number, callback?: (err: any, value?: string) => void): Promise; /** * Reads the entire contents of a file. - * @param path - * @param options - * @param callback */ export function readFile( path: PathLike | number, @@ -324,8 +275,6 @@ export function readFile( ): Promise; /** * Synchronous version of `fs.readFile`. - * @param path - * @param options */ export function readFileSync(path: PathLike | number, options?: { encoding?: string; flag?: string; escape?: boolean; }): string; @@ -375,9 +324,6 @@ import { FSWatcher, WatchOptions } from 'chokidar'; * Watches changes of a file or a directory. * * See Chokidar API for more info. - * @param path - * @param options - * @param callback */ export function watch(path: string | string[], options?: WatchOptions, callback?: (err: any, value?: FSWatcher) => void): Promise; export { watchFile, unwatchFile }; @@ -401,17 +347,10 @@ export { writeSync }; // writeFile /** * Writes data to a file. - * @param path - * @param data - * @param callback */ export function writeFile(path: string, data: any, callback?: (err: any) => void): Promise; /** * Writes data to a file. - * @param path - * @param data - * @param options - * @param callback */ export function writeFile( path: string, @@ -421,9 +360,6 @@ export function writeFile( ): Promise; /** * Synchronous version of `fs.writeFile`. - * @param path - * @param data - * @param options */ export function writeFileSync(path: string, data: any, options?: string | { encoding?: string | null; mode?: string | number; flag?: string }): void; From 799ccb82d34a48d849d0ab1126ba3e8769937ba8 Mon Sep 17 00:00:00 2001 From: Andy Date: Mon, 23 Oct 2017 13:04:11 -0700 Subject: [PATCH 038/252] i18n: Fix lint (#20878) --- types/i18n/index.d.ts | 136 +++++++++++++++++++++--------------------- 1 file changed, 67 insertions(+), 69 deletions(-) diff --git a/types/i18n/index.d.ts b/types/i18n/index.d.ts index 534b46b186..03dceb40e9 100644 --- a/types/i18n/index.d.ts +++ b/types/i18n/index.d.ts @@ -159,15 +159,15 @@ declare namespace i18n { /** * Configure current i18n instance - * @param {ConfigurationOptions} options - configuration options for i18n + * @param options - configuration options for i18n */ function configure(options: ConfigurationOptions): void; /** * Initialize i18n middleware for express - * @param {Express.Request} request - Current express request - * @param {Express.Response} response - Current express response - * @param {Function} next - Callback to continue process + * @param request - Current express request + * @param response - Current express response + * @param next - Callback to continue process */ function init(request: Express.Request, response: Express.Response, next?: () => void): void; @@ -175,15 +175,15 @@ declare namespace i18n { /** * Translate the given phrase using locale configuration - * @param {string | TranslateOptions} phraseOrOptions - The phrase to translate or options for translation - * @returns {string} The translated phrase + * @param phraseOrOptions - The phrase to translate or options for translation + * @returns The translated phrase */ function __(phraseOrOptions: string | TranslateOptions, ...replace: string[]): string; /** * Translate the given phrase using locale configuration - * @param {string | TranslateOptions} phraseOrOptions - The phrase to translate or options for translation - * @param {Replacements} replacements - An object containing replacements - * @returns {string} The translated phrase + * @param phraseOrOptions - The phrase to translate or options for translation + * @param replacements - An object containing replacements + * @returns The translated phrase */ function __(phraseOrOptions: string | TranslateOptions, replacements: Replacements): string; @@ -193,17 +193,17 @@ declare namespace i18n { /** * Translate with plural condition the given phrase and count using locale configuration - * @param {PluralOptions} options - Options for plural translate - * @param {number} [count] - The number which allow to select from plural to singular - * @returns {string} The translated phrase + * @param options - Options for plural translate + * @param [count] - The number which allow to select from plural to singular + * @returns The translated phrase */ function __n(options: PluralOptions, count?: number): string; /** * Translate with plural condition the given phrase and count using locale configuration - * @param {string} singular - The singular phrase to translate if count is <= 1 - * @param {string} plural - The plural phrase to translate if count is > 1 - * @param {number | string} count - The number which allow to select from plural to singular - * @returns {string} The translated phrase + * @param singular - The singular phrase to translate if count is <= 1 + * @param plural - The plural phrase to translate if count is > 1 + * @param count - The number which allow to select from plural to singular + * @returns The translated phrase */ function __n(singular: string, plural: string, count: number | string): string; @@ -213,15 +213,15 @@ declare namespace i18n { /** * Translate the given phrase using locale configuration and MessageFormat - * @param {string | TranslateOptions} phraseOrOptions - The phrase to translate or options for translation - * @returns {string} The translated phrase + * @param phraseOrOptions - The phrase to translate or options for translation + * @returns The translated phrase */ function __mf(phraseOrOptions: string | TranslateOptions, ...replace: any[]): string; /** * Translate the given phrase using locale configuration and MessageFormat - * @param {string | TranslateOptions} phraseOrOptions - The phrase to translate or options for translation - * @param {Replacements} replacements - An object containing replacements - * @returns {string} The translated phrase + * @param phraseOrOptions - The phrase to translate or options for translation + * @param replacements - An object containing replacements + * @returns The translated phrase */ function __mf(phraseOrOptions: string | TranslateOptions, replacements: Replacements): string; @@ -231,8 +231,8 @@ declare namespace i18n { /** * Returns a list of translations for a given phrase in each language. - * @param {string} phrase - The phrase to get translations in each language - * @returns {string[]} The phrase in each language + * @param phrase - The phrase to get translations in each language + * @returns The phrase in each language */ function __l(phrase: string): string[]; @@ -242,8 +242,8 @@ declare namespace i18n { /** * Returns a hashed list of translations for a given phrase in each language. - * @param {string} phrase - The phrase to get translations in each language - * @returns {HashedList[]} The phrase in each language + * @param phrase - The phrase to get translations in each language + * @returns The phrase in each language */ function __h(phrase: string): HashedList[]; @@ -253,36 +253,35 @@ declare namespace i18n { /** * Change the current active locale - * @param {string} locale - The locale to set as default + * @param locale - The locale to set as default */ function setLocale(locale: string): void; /** * Change the current active locale for specified response - * @param {Express.Request | Express.Response} response - The request or response to change locale on - * @param {string} locale - The locale to set as default - * @param {boolean} [inheritance=false] - Disables inheritance if true + * @param response - The request or response to change locale on + * @param locale - The locale to set as default + * @param [inheritance=false] - Disables inheritance if true */ // tslint:disable-next-line:unified-signatures function setLocale(requestOrResponse: Express.Request | Express.Response, locale: string, inheritance?: boolean): void; /** * Change the current active locale for specified response - * @param {any | any[]} objects - The object(s) to change locale on - * @param {string} locale - The locale to set as default - * @param {boolean} [inheritance=false] - Disables inheritance if true + * @param objects - The object(s) to change locale on + * @param locale - The locale to set as default + * @param [inheritance=false] - Disables inheritance if true */ // tslint:disable-next-line:unified-signatures function setLocale(objects: any | any[], locale: string, inheritance?: boolean): void; /** * Get the current active locale for specified request - * @param {Express.Request} [request] - The request to get locale for - * @returns {string} The current locale in request + * @param [request] - The request to get locale for + * @returns The current locale in request */ function getLocale(request?: Express.Request): string; /** * Get a list with all configured locales - * @returns {string[]} */ function getLocales(): string[]; @@ -292,20 +291,20 @@ declare namespace i18n { /** * Get the current global catalog - * @returns {GlobalCatalog} The current global catalog + * @returns The current global catalog */ function getCatalog(): GlobalCatalog; /** * Get the catalog for the given locale - * @param {string} locale - The locale to get catalog for - * @returns {LocaleCatalog} The specified locale catalog + * @param locale - The locale to get catalog for + * @returns The specified locale catalog */ function getCatalog(locale: string): LocaleCatalog; /** * Get the current active locale catalog for specified request - * @param {Express.Request} request - The request to get locale catalog for - * @param {string} [locale] - The locale to get catalog for - * @returns {LocaleCatalog} The current locale catalog for the specified request + * @param request - The request to get locale catalog for + * @param [locale] - The locale to get catalog for + * @returns The current locale catalog for the specified request */ function getCatalog(request: Express.Request, locale?: string): LocaleCatalog; @@ -313,13 +312,12 @@ declare namespace i18n { /** * Override the current request locale by using the query param (?locale=en) - * @param {Express.Request} [request] - The request to override locale for + * @param [request] - The request to override locale for */ function overrideLocaleFromQuery(request?: Express.Request): void; /** * Get current i18n-node version - * @member {string} */ const version: string; } @@ -331,15 +329,15 @@ interface i18nAPI { /** * Translate the given phrase using locale configuration - * @param {string | TranslateOptions} phraseOrOptions - The phrase to translate or options for translation - * @returns {string} The translated phrase + * @param phraseOrOptions - The phrase to translate or options for translation + * @returns The translated phrase */ __(phraseOrOptions: string | i18n.TranslateOptions, ...replace: string[]): string; /** * Translate the given phrase using locale configuration - * @param {string | TranslateOptions} phraseOrOptions - The phrase to translate or options for translation - * @param {i18n.Replacements} replacements - An object containing replacements - * @returns {string} The translated phrase + * @param phraseOrOptions - The phrase to translate or options for translation + * @param replacements - An object containing replacements + * @returns The translated phrase */ __(phraseOrOptions: string | i18n.TranslateOptions, replacements: i18n.Replacements): string; @@ -349,17 +347,17 @@ interface i18nAPI { /** * Translate with plural condition the given phrase and count using locale configuration - * @param {PluralOptions} options - Options for plural translate - * @param {number} [count] - The number which allow to select from plural to singular - * @returns {string} The translated phrase + * @param options - Options for plural translate + * @param [count] - The number which allow to select from plural to singular + * @returns The translated phrase */ __n(options: i18n.PluralOptions, count?: number): string; /** * Translate with plural condition the given phrase and count using locale configuration - * @param {string} singular - The singular phrase to translate if count is <= 1 - * @param {string} plural - The plural phrase to translate if count is > 1 - * @param {number | string} count - The number which allow to select from plural to singular - * @returns {string} The translated phrase + * @param singular - The singular phrase to translate if count is <= 1 + * @param plural - The plural phrase to translate if count is > 1 + * @param count - The number which allow to select from plural to singular + * @returns The translated phrase */ __n(singular: string, plural: string, count: number | string): string; @@ -369,15 +367,15 @@ interface i18nAPI { /** * Translate the given phrase using locale configuration and MessageFormat - * @param {string | TranslateOptions} phraseOrOptions - The phrase to translate or options for translation - * @returns {string} The translated phrase + * @param phraseOrOptions - The phrase to translate or options for translation + * @returns The translated phrase */ __mf(phraseOrOptions: string | i18n.TranslateOptions, ...replace: any[]): string; /** * Translate the given phrase using locale configuration and MessageFormat - * @param {string | TranslateOptions} phraseOrOptions - The phrase to translate or options for translation - * @param {i18n.Replacements} replacements - An object containing replacements - * @returns {string} The translated phrase + * @param phraseOrOptions - The phrase to translate or options for translation + * @param replacements - An object containing replacements + * @returns The translated phrase */ __mf(phraseOrOptions: string | i18n.TranslateOptions, replacements: i18n.Replacements): string; @@ -387,8 +385,8 @@ interface i18nAPI { /** * Returns a list of translations for a given phrase in each language. - * @param {string} phrase - The phrase to get translations in each language - * @returns {string[]} The phrase in each language + * @param phrase - The phrase to get translations in each language + * @returns The phrase in each language */ __l(phrase: string): string[]; @@ -398,8 +396,8 @@ interface i18nAPI { /** * Returns a hashed list of translations for a given phrase in each language. - * @param {string} phrase - The phrase to get translations in each language - * @returns {HashedList[]} The phrase in each language + * @param phrase - The phrase to get translations in each language + * @returns The phrase in each language */ __h(phrase: string): i18n.HashedList[]; @@ -407,25 +405,25 @@ interface i18nAPI { /** * Get the current active locale - * @returns {string} The current locale in request + * @returns The current locale in request */ getLocale(): string; /** * Change the current active locale - * @param {string} locale - The locale to set as default + * @param locale - The locale to set as default */ setLocale(locale: string): void; /** * Get the current global catalog - * @returns {GlobalCatalog} The current global catalog + * @returns The current global catalog */ getCatalog(): i18n.GlobalCatalog; /** * Get the catalog for the given locale - * @param {string} locale - The locale to get catalog for - * @returns {LocaleCatalog} The specified locale catalog + * @param locale - The locale to get catalog for + * @returns The specified locale catalog */ getCatalog(locale?: string): i18n.LocaleCatalog; } From 52f261e047dc9ea605e979ae6328c377f9f00fad Mon Sep 17 00:00:00 2001 From: Jean-Francois Cere Date: Mon, 23 Oct 2017 16:05:55 -0400 Subject: [PATCH 039/252] Update Materialize-Css for missing SideNavOptions and fix lint (#20597) --- types/materialize-css/index.d.ts | 56 +++++++------ .../materialize-css/materialize-css-tests.ts | 80 +++++++++---------- types/materialize-css/tslint.json | 7 ++ 3 files changed, 78 insertions(+), 65 deletions(-) create mode 100644 types/materialize-css/tslint.json diff --git a/types/materialize-css/index.d.ts b/types/materialize-css/index.d.ts index 1cb283e2d7..13b32c985d 100644 --- a/types/materialize-css/index.d.ts +++ b/types/materialize-css/index.d.ts @@ -1,8 +1,9 @@ -// Type definitions for materialize-css v0.100.1 +// Type definitions for materialize-css 0.100 // Project: http://materializecss.com/ // Definitions by: Erik Lieben // Leon Yu // Sukhdeep Singh +// Jean-Francois Cere // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -10,7 +11,6 @@ /// declare namespace Materialize { - /** * The collapsible options */ @@ -35,8 +35,8 @@ declare namespace Materialize { interface TooltipOptions { /** - * The delay before the tooltip shows (in milliseconds) - */ + * The delay before the tooltip shows (in milliseconds) + */ delay: number; /** * Tooltip text. Can use custom HTML if you set the html option @@ -60,7 +60,6 @@ declare namespace Materialize { * The dropdown options */ interface DropDownOptions { - /** * The duration of the transition enter in milliseconds. * @default `300` @@ -73,7 +72,6 @@ declare namespace Materialize { */ outDuration?: number; - /** * If true, constrainWidth to the size of the dropdown activator. * @default `true` @@ -107,14 +105,13 @@ declare namespace Materialize { * * @default `false` */ - stopPropagation?: boolean + stopPropagation?: boolean; } /** * The slider options */ interface SliderOptions { - /** * Set to false to hide slide indicators. * @default `true` @@ -191,7 +188,6 @@ declare namespace Materialize { * The modal options */ interface ModalOptions { - /** * Modal can be dismissed by clicking outside of the modal. * @default `true` @@ -243,7 +239,6 @@ declare namespace Materialize { * The push pin options */ interface PushpinOptions { - /** * The distance in pixels from the top of the page where the element becomes fixed. * @default `0` @@ -288,31 +283,45 @@ declare namespace Materialize { */ interface SideNavOptions { /** + * The sideNav width. * @default `240` */ menuWidth?: number; /** - * The horizontal origin + * The horizontal origin. * @default `'left'` */ edge?: string; /** - * Closes side-nav on clicks, useful for Angular/Meteor + * Closes sideNav on clicks, useful for Angular/Meteor. * @default `false` */ closeOnClick?: boolean; /** - * Choose whether you can drag to open on touch screens + * Choose whether you can drag to open on touch screens. * @default `true` */ draggable?: boolean; + + /** + * Execute a callback function when sideNav is opened. + * + * The callback provides a parameter which refers to the sideNav being opened. + */ + onOpen?: Function; + + /** + * Execute a callback function when sideNav is closed. + * + * The callback provides a parameter which refers to the sideNav being closed. + */ + onClose?: Function; } interface ScrollFireOptions { - /** * The selector for the element that is being tracked. */ @@ -357,16 +366,16 @@ declare namespace Materialize { } interface ChipDataObject { - tag: string, - image?: string, - id?: number + tag: string; + image?: string; + id?: number; } interface ChipOptions { /** * Set the chip data */ - data?: Materialize.ChipDataObject[]; + data?: ChipDataObject[]; /** * Set first placeholder when there are no tags */ @@ -386,7 +395,7 @@ declare namespace Materialize { /** * Set autocompleteOptions */ - autocompleteOptions?: Materialize.AutoCompleteOptions; + autocompleteOptions?: AutoCompleteOptions; } interface AutoCompleteOptions { @@ -408,7 +417,6 @@ declare namespace Materialize { * @default `1` */ minLength?: number; - } interface Toast { @@ -422,7 +430,6 @@ declare namespace Materialize { * The Materialize object */ interface Materialize { - /** * Displays a toast message on screen * @@ -462,7 +469,7 @@ declare namespace Materialize { /** * Toast functions */ - Toast: Materialize.Toast; + Toast: Toast; } } @@ -472,7 +479,7 @@ declare namespace Materialize { * @see http://www.typescriptlang.org/docs/handbook/declaration-merging.html */ declare namespace Pickadate { - export interface TimeOptions { + interface TimeOptions { /** * Set default time such as : 'now', '1:30AM', '16:30'. * @default `'now'` @@ -523,7 +530,6 @@ declare namespace Pickadate { declare var Materialize: Materialize.Materialize; interface JQuery { - /** * open Fixed Action Button */ @@ -694,4 +700,4 @@ interface JQuery { * @param string action : either `'open'` or `'close'` */ tapTarget(action?: string): JQuery; -} \ No newline at end of file +} diff --git a/types/materialize-css/materialize-css-tests.ts b/types/materialize-css/materialize-css-tests.ts index 1490dbfd3c..50586ab104 100644 --- a/types/materialize-css/materialize-css-tests.ts +++ b/types/materialize-css/materialize-css-tests.ts @@ -1,17 +1,12 @@ - - // Buttons - $('.fixed-action-btn').openFAB(); $('.fixed-action-btn').closeFAB(); // Forms - Select - $('select').material_select(); $('select').material_select('destroy'); // Forms - Date Picker - $('.datepicker').pickadate({ selectMonths: true, // Creates a dropdown to control month selectYears: 15 // Creates a dropdown of 15 years to control year @@ -26,10 +21,8 @@ $(".dropdown-button").dropdown({ hover: false }); $(".button-collapse").sideNav(); - - // Collapsible -var collapseHtml = '
    ' + +let collapseHtml = '
      ' + '
    • ' + '
      filter_dramaFirst
      ' + '

      Lorem ipsum dolor sit amet.

      ' + @@ -44,25 +37,25 @@ var collapseHtml = '
        ' + '' + '
      '; -$(collapseHtml).collapsible({ accordion: false, onClose: function () { alert('Closed'); } }); -$(collapseHtml).collapsible({ accordion: true, onOpen: function () { alert('Opened'); } }); +$(collapseHtml).collapsible({ accordion: false, onClose: () => { alert('Closed'); } }); +$(collapseHtml).collapsible({ accordion: true, onOpen: () => { alert('Opened'); } }); // Dialogs - Toasts Materialize.toast('I am a toast!', 4000); Materialize.toast('I am a toast!', 3000, 'rounded'); Materialize.toast('I am a toast!', 3000, 'rounded', () => console.log('callback')); -var $toastContent = $('I am toast content'); +let $toastContent = $('I am toast content'); Materialize.toast($toastContent, 5000); Materialize.Toast.removeAll(); // Dialogs - Tooltip -var tooltipHtml = '
      Hover me!'; +let tooltipHtml = 'Hover me!'; $(tooltipHtml).tooltip(); $(tooltipHtml).tooltip({ delay: 100 }); $(tooltipHtml).tooltip('remove'); // DropDown -var dropDownHtml = 'Drop Me!'; +let dropDownHtml = 'Drop Me!'; $(dropDownHtml).dropdown({ inDuration: 300, outDuration: 225, @@ -72,16 +65,15 @@ $(dropDownHtml).dropdown({ belowOrigin: false, // Displays dropdown below the button alignment: 'left', // Displays dropdown with edge aligned to the left of button stopPropagation: false // Stops event propagation - }); $(dropDownHtml).dropdown({}); // Media - materialbox -var materialboxHtml = ''; +let materialboxHtml = ''; $(materialboxHtml).materialbox(); // Media - slider -var sliderHtml = '
      ' + +let sliderHtml = '
      ' + '
        ' + '
      • ' + ' ' + @@ -122,7 +114,6 @@ $(sliderHtml).slider({ indicators: true, height: 5, transition: 4 }); $(sliderHtml).slider({ indicators: true, height: 5, transition: 4, interval: 5 }); // Carousel - $('.carousel').carousel(); $('.carousel').carousel({}); $('.carousel').carousel({ duration: 200, dist: -100, shift: 500, padding: 6000, fullWidth: true, indicators: false, noWrap: false }); @@ -134,9 +125,8 @@ $('.carousel').carousel('next', 3); // Move next n times. $('.carousel').carousel('prev'); $('.carousel').carousel('prev', 4); // Move prev n times. - // Modals -var modalhtml = '