From 9c48bfe14b5f5219a630502ecafc3afa338734ef Mon Sep 17 00:00:00 2001 From: Ilia Beliaev Date: Thu, 5 Jul 2018 16:47:39 +0300 Subject: [PATCH 01/94] Added support for className option in ImageOverlayOptions. ImageOverlayOptions extends InteractiveLayerOptions as described in Leaflet docs. Added bubblingMouseEvents option to InteractiveLayerOptions. --- types/leaflet/index.d.ts | 4 +++- types/leaflet/leaflet-tests.ts | 23 +++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/types/leaflet/index.d.ts b/types/leaflet/index.d.ts index 89f9625114..47b2ebc515 100644 --- a/types/leaflet/index.d.ts +++ b/types/leaflet/index.d.ts @@ -390,6 +390,7 @@ export interface LayerOptions { export interface InteractiveLayerOptions extends LayerOptions { interactive?: boolean; + bubblingMouseEvents?: boolean; } export class Layer extends Evented { @@ -542,12 +543,13 @@ export namespace tileLayer { function wms(baseUrl: string, options?: WMSOptions): TileLayer.WMS; } -export interface ImageOverlayOptions extends LayerOptions { +export interface ImageOverlayOptions extends InteractiveLayerOptions { opacity?: number; alt?: string; interactive?: boolean; attribution?: string; crossOrigin?: boolean; + className?: string; } export class ImageOverlay extends Layer { diff --git a/types/leaflet/leaflet-tests.ts b/types/leaflet/leaflet-tests.ts index a22ab91248..1f6671cc8c 100644 --- a/types/leaflet/leaflet-tests.ts +++ b/types/leaflet/leaflet-tests.ts @@ -251,6 +251,29 @@ tileLayer = new L.TileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png'); tileLayer = new L.TileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', tileLayerOptions); tileLayer = new L.TileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png?{foo}&{bar}&{abc}', {foo: 'bar', bar: (data: any) => 'foo', abc: () => ''}); +// imageOverlay +let imageOverlayOptions: L.ImageOverlayOptions; +imageOverlayOptions = { + opacity: 100, + alt: 'alt', + interactive: true, + attribution: 'attribution', + crossOrigin: true, + className: 'className', + bubblingMouseEvents: false, + pane: 'pane' +}; + +const imageOverlayBounds = latLngBounds; +let imageOverlay: L.ImageOverlay; +imageOverlay = L.imageOverlay('https://www.google.ru/images/branding/googlelogo/2x/googlelogo_color_120x44dp.png', imageOverlayBounds); +imageOverlay = L.imageOverlay('https://www.google.ru/images/branding/googlelogo/2x/googlelogo_color_120x44dp.png', imageOverlayBounds, imageOverlayOptions); +imageOverlay = L.imageOverlay('https://www.google.ru/images/branding/googlelogo/2x/googlelogo_color_120x44dp.png', imageOverlayBounds, { + opacity: 100, + alt: 'alt', + className: 'className', +}); + const eventHandler = () => {}; const domEvent: Event = {} as Event; L.DomEvent From 7d7efddea88a05d3c0fc1c81c130de5b61f1c3eb Mon Sep 17 00:00:00 2001 From: ostap Date: Fri, 13 Jul 2018 22:16:14 +0300 Subject: [PATCH 02/94] initial --- types/better-queue/better-queue-tests.ts | 117 ++++++++++++++++++++ types/better-queue/index.d.ts | 135 +++++++++++++++++++++++ types/better-queue/tsconfig.json | 23 ++++ types/better-queue/tslint.json | 1 + 4 files changed, 276 insertions(+) create mode 100644 types/better-queue/better-queue-tests.ts create mode 100644 types/better-queue/index.d.ts create mode 100644 types/better-queue/tsconfig.json create mode 100644 types/better-queue/tslint.json diff --git a/types/better-queue/better-queue-tests.ts b/types/better-queue/better-queue-tests.ts new file mode 100644 index 0000000000..afdbbede76 --- /dev/null +++ b/types/better-queue/better-queue-tests.ts @@ -0,0 +1,117 @@ +import Queue = require('better-queue'); + +interface TestTask { + taskId: string; + taskPayload: any; +} + +interface TestResult { + some: string; +} + +new Queue((task, cb) => { + const test = task.anything; + console.log(task); +}); + +new Queue((task: TestTask, cb) => { + const id = task.taskId; + cb(null, 'result'); + cb(); +}, {}); + +const q = new Queue({ + process(task: TestTask, cb) { + const id = task.taskId; + cb(null, { some: 'prop' }); + }, + filter(task, cb) { + const id = task.taskId; + cb(null, task); + }, + merge(oldTask, newTask, cb) { + const oldId = oldTask.taskId; + const newId = newTask.taskId; + cb(null, newTask); + }, + priority(task, cb) { + const id = task.taskId; + cb(null, 10); + }, + precondition(cb) { + cb(null, true); + }, + afterProcessDelay: 1000, + autoResume: true, + batchDelay: 123, + batchDelayTimeout: 123, + batchSize: 123, + cancelIfRunning: true, + concurrent: 123, + failTaskOnProcessException: true, + filo: true, + id: 'taskId', + maxRetries: 1, + maxTimeout: 1, + retryDelay: 1, + storeMaxRetries: 1, + storeRetryTimeout: 1, + preconditionRetryTimeout: 1, + store: 'test' +}); + +new Queue({ + process(tasks: TestTask[], cb) { + const firstId = tasks[0].taskId; + cb(null, { some: 'prop' }); + } +}); + +new Queue(() => { }, { + id(task, cb) { + const id = task.taskId; + cb(null, 'taskId'); + } +}); + +new Queue(() => { }, { + store: { + type: 'test' + } +}); + +class TestStore implements Queue.Store { + connect(cb: (error: any, length: number) => void) { + cb(null, 1); + } + + getTask(taskId: any, cb: (error: any, task: TestTask) => void) { + cb(null, { taskId: '', taskPayload: '' }); + } + + deleteTask(taskId: any, cb: () => void) { + cb(); + } + + putTask(taskId: any, task: TestTask, priority: number, cb: (error: any) => void) { + cb(null); + } + + takeFirstN(n: number, cb: (error: any, lockId: string) => void) { + cb(null, ''); + } + + takeLastN(n: number, cb: (error: any, lockId: string) => void) { + cb(null, ''); + } + + getLock(lockId: string, cb: (error: any, tasks: { [taskId: string]: TestTask }) => void) { + cb(null, { + id: { taskId: 'id', taskPayload: 'payload' } + }); + } + + releaseLock(lockId: string, cb: (error: any) => void) { + cb(null); + } +} diff --git a/types/better-queue/index.d.ts b/types/better-queue/index.d.ts new file mode 100644 index 0000000000..8ee80281fb --- /dev/null +++ b/types/better-queue/index.d.ts @@ -0,0 +1,135 @@ +// Type definitions for better-queue 3.8 +// Project: https://github.com/diamondio/better-queue +// Definitions by: Ostap Nagovitsyn +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +/* =================== USAGE =================== + import * as Queue from "better-queue"; + var queue = new Queue(...); + =============================================== */ + +/// + +declare class BetterQueue extends NodeJS.EventEmitter { + constructor(options: BetterQueue.QueueOptions); + constructor(process: BetterQueue.ProcessFunction, options?: Partial>); + + push(task: T, cb?: (err: any, result?: K) => void): BetterQueue.Ticket; + + cancel(taskId: any, cb: () => void): void; + + pause(): void; + + resume(): void; + + destroy(cb: () => void): void; + + use(store: BetterQueue.Store): void; + + getStats(): BetterQueue.QueueStats; + + resetStats(): void; + + on(event: 'task_finish', listener: (taskId: any, result: K) => void): this; + on(event: 'task_failed', listener: (taskId: any, errorMessage: string) => void): this; + on(event: 'task_progress', listener: (taskId: any, completed: number, total: number) => void): this; + on(event: BetterQueue.QueueEvent, listener: (...args: any[]) => void): this; +} + +declare namespace BetterQueue { + interface QueueOptions { + process: ProcessFunction; + filter?(task: T, cb: (error: any, task: T) => void): void; + merge?(oldTask: T, newTask: T, cb: (error: any, mergedTask: T) => void): void; + priority?(task: T, cb: (error: any, priority: number) => void): void; + precondition?(cb: (error: any, passOrFail: boolean) => void): void; + id?: keyof T | ((task: T, cb: (error: any, id: keyof T) => void) => void); + cancelIfRunning?: boolean; + autoResume?: boolean; + failTaskOnProcessException?: boolean; + filo?: boolean; + batchSize?: number; + batchDelay?: number; + batchDelayTimeout?: number; + concurrent?: number; + maxTimeout?: number; + afterProcessDelay?: number; + maxRetries?: number; + retryDelay?: number; + storeMaxRetries?: number; + storeRetryTimeout?: number; + preconditionRetryTimeout?: number; + store?: string | StoreOptions | Store; + } + + type ProcessFunction = (task: T | T[], cb: ProcessFunctionCb) => void; + + type ProcessFunctionCb = (error?: any, result?: K) => void; + + type QueueEvent = + 'task_queued' + | 'task_accepted' + | 'task_started' + | 'task_finish' + | 'task_failed' + | 'task_progress' + | 'batch_finish' + | 'batch_failed' + | 'batch_progress' + | 'error'; + + type TicketEvent = + 'accept' + | 'queued' + | 'started' + | 'progress' + | 'finish' + | 'failed' + | 'error'; + + interface Store { + connect(cb: (error: any, length: number) => void): void; + + getTask(taskId: any, cb: (error: any, task: T) => void): void; + + deleteTask(taskId: any, cb: () => void): void; + + putTask(taskId: any, task: T, priority: number, cb: (error: any) => void): void; + + takeFirstN(n: number, cb: (error: any, lockId: string) => void): void; + + takeLastN(n: number, cb: (error: any, lockId: string) => void): void; + + getLock(lockId: string, cb: (error: any, tasks: { [taskId: string]: T }) => void): void; + + releaseLock(lockId: string, cb: (error: any) => void): void; + } + + interface StoreOptions { + type: string; + // store-specific options + [key: string]: any; + } + + class Ticket extends NodeJS.EventEmitter { + on(event: TicketEvent, listener: (...args: any[]) => void): this; + } + + interface TickerProgress { + eta: string; + pct: number; + complete: number; + total: number; + message: string; + } + + interface QueueStats { + total: number; + average: number; + successRate: number; + peak: number; + } +} + +export = BetterQueue; diff --git a/types/better-queue/tsconfig.json b/types/better-queue/tsconfig.json new file mode 100644 index 0000000000..78d86d651d --- /dev/null +++ b/types/better-queue/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "strictFunctionTypes": false + }, + "files": [ + "index.d.ts", + "better-queue-tests.ts" + ] +} diff --git a/types/better-queue/tslint.json b/types/better-queue/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/better-queue/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 949e297602d867552b11a7be3e8fa92104c5c469 Mon Sep 17 00:00:00 2001 From: ostap Date: Sun, 15 Jul 2018 23:23:58 +0300 Subject: [PATCH 03/94] strictFunctionTypes=true --- types/better-queue/better-queue-tests.ts | 22 ++++++++++++++++++---- types/better-queue/index.d.ts | 4 ++-- types/better-queue/tsconfig.json | 4 ++-- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/types/better-queue/better-queue-tests.ts b/types/better-queue/better-queue-tests.ts index afdbbede76..3df520f11c 100644 --- a/types/better-queue/better-queue-tests.ts +++ b/types/better-queue/better-queue-tests.ts @@ -9,18 +9,23 @@ interface TestResult { some: string; } -new Queue((task, cb) => { +new Queue((task) => { const test = task.anything; console.log(task); }); +new Queue((task: TestTask[]) => { + const test = task[0].taskId; + console.log(task); +}); + new Queue((task: TestTask, cb) => { const id = task.taskId; cb(null, 'result'); cb(); }, {}); -const q = new Queue({ +new Queue({ process(task: TestTask, cb) { const id = task.taskId; cb(null, { some: 'prop' }); @@ -61,8 +66,8 @@ const q = new Queue({ }); new Queue({ - process(tasks: TestTask[], cb) { - const firstId = tasks[0].taskId; + process(task: TestTask[], cb) { + const firstId = task[0].taskId; cb(null, { some: 'prop' }); } }); @@ -80,6 +85,15 @@ new Queue(() => { }, { } }); +const q = new Queue(() => {}) + +const testTask = {taskId: '', taskPayload: ''} + +q.push(testTask) +q.push(testTask, (error, result) => {}) + +q.cancel('id', () => {}) + class TestStore implements Queue.Store { connect(cb: (error: any, length: number) => void) { cb(null, 1); diff --git a/types/better-queue/index.d.ts b/types/better-queue/index.d.ts index 8ee80281fb..4fa342e958 100644 --- a/types/better-queue/index.d.ts +++ b/types/better-queue/index.d.ts @@ -15,9 +15,9 @@ declare class BetterQueue extends NodeJS.EventEmitter { constructor(options: BetterQueue.QueueOptions); constructor(process: BetterQueue.ProcessFunction, options?: Partial>); - push(task: T, cb?: (err: any, result?: K) => void): BetterQueue.Ticket; + push(task: T, cb?: (err: any, result: K) => void): BetterQueue.Ticket; - cancel(taskId: any, cb: () => void): void; + cancel(taskId: any, cb?: () => void): void; pause(): void; diff --git a/types/better-queue/tsconfig.json b/types/better-queue/tsconfig.json index 78d86d651d..4677f6a711 100644 --- a/types/better-queue/tsconfig.json +++ b/types/better-queue/tsconfig.json @@ -7,14 +7,14 @@ "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, + "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ "../" ], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": true, - "strictFunctionTypes": false + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", From 3fd8c38c77b77df391b7219290d129d4ca552270 Mon Sep 17 00:00:00 2001 From: ostap Date: Mon, 16 Jul 2018 09:19:33 +0300 Subject: [PATCH 04/94] strictFunctionTypes fix --- types/better-queue/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/better-queue/index.d.ts b/types/better-queue/index.d.ts index 4fa342e958..69861c5132 100644 --- a/types/better-queue/index.d.ts +++ b/types/better-queue/index.d.ts @@ -63,7 +63,8 @@ declare namespace BetterQueue { store?: string | StoreOptions | Store; } - type ProcessFunction = (task: T | T[], cb: ProcessFunctionCb) => void; + // TODO reflect task types somehow (task: T | T[]) + type ProcessFunction = (task: any, cb: ProcessFunctionCb) => void; type ProcessFunctionCb = (error?: any, result?: K) => void; From 334ab585d54fc4c9126ed3766ad8bd65035bb5b5 Mon Sep 17 00:00:00 2001 From: ostap Date: Mon, 16 Jul 2018 09:28:53 +0300 Subject: [PATCH 05/94] lint fix --- types/better-queue/better-queue-tests.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/types/better-queue/better-queue-tests.ts b/types/better-queue/better-queue-tests.ts index 3df520f11c..4a1aa4771e 100644 --- a/types/better-queue/better-queue-tests.ts +++ b/types/better-queue/better-queue-tests.ts @@ -85,14 +85,14 @@ new Queue(() => { }, { } }); -const q = new Queue(() => {}) +const q = new Queue(() => {}); -const testTask = {taskId: '', taskPayload: ''} +const testTask = {taskId: '', taskPayload: ''}; -q.push(testTask) -q.push(testTask, (error, result) => {}) +q.push(testTask); +q.push(testTask, (error, result) => {}); -q.cancel('id', () => {}) +q.cancel('id', () => {}); class TestStore implements Queue.Store { connect(cb: (error: any, length: number) => void) { From e840b49872d8d97d51883c79f57a7ec7bf6cc009 Mon Sep 17 00:00:00 2001 From: Romain Faust Date: Sun, 22 Jul 2018 17:22:30 +0200 Subject: [PATCH 06/94] Add koa-router's Router to koa's Context --- types/koa-router/index.d.ts | 5 ++++ types/koa-router/koa-router-tests.ts | 36 ++++++++++++++++------------ 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/types/koa-router/index.d.ts b/types/koa-router/index.d.ts index 7382dd91e6..f8a31e71cb 100644 --- a/types/koa-router/index.d.ts +++ b/types/koa-router/index.d.ts @@ -3,6 +3,7 @@ // Definitions by: Jerry Chin // Pavel Ivanov // JounQin +// Romain Faust // Definitions: https://github.com/hellopao/DefinitelyTyped // TypeScript Version: 2.3 @@ -51,6 +52,10 @@ declare namespace Router { * url params */ params: any; + /** + * the router instance + */ + router: Router; } export interface IMiddleware { diff --git a/types/koa-router/koa-router-tests.ts b/types/koa-router/koa-router-tests.ts index 1325da0de0..b2bec9ad0c 100644 --- a/types/koa-router/koa-router-tests.ts +++ b/types/koa-router/koa-router-tests.ts @@ -8,21 +8,27 @@ const router = new Router({ }); router - .param('id', function(id, ctx, next) { - next(); - }) - .get('/', function (ctx, next) { - ctx.body = 'Hello World!'; - }) - .post('/users', function (ctx, next) { - // ... - }) - .put('/users/:id', function (ctx, next) { - ctx.body = ctx.params.id; - }) - .del('/users/:id', function () { - // ... - }); + .param('id', function (id, ctx, next) { + next(); + }) + .get('/', function (ctx, next) { + ctx.body = 'Hello World!'; + }) + .get('/users/:id', function (ctx, next) { + ctx.body = ctx.router.url('user-accounts', { id: ctx.params.id }) + }) + .get('user-accounts', '/users/:id/accounts', function (ctx, next) { + // ... + }) + .post('/users', function (ctx, next) { + // ... + }) + .put('/users/:id', function (ctx, next) { + ctx.body = ctx.params.id; + }) + .del('/users/:id', function () { + // ... + }); router.get('user', '/users/:id', function (ctx) { ctx.body = "sdsd"; From ac3c6f5947dc65b98330082d26649935d555c986 Mon Sep 17 00:00:00 2001 From: Sean Genabe Date: Thu, 26 Jul 2018 07:13:37 +0800 Subject: [PATCH 07/94] Add typings for yoctodelay --- types/yoctodelay/index.d.ts | 12 ++++++++++++ types/yoctodelay/tsconfig.json | 23 +++++++++++++++++++++++ types/yoctodelay/tslint.json | 1 + types/yoctodelay/yoctodelay-tests.ts | 4 ++++ 4 files changed, 40 insertions(+) create mode 100644 types/yoctodelay/index.d.ts create mode 100644 types/yoctodelay/tsconfig.json create mode 100644 types/yoctodelay/tslint.json create mode 100644 types/yoctodelay/yoctodelay-tests.ts diff --git a/types/yoctodelay/index.d.ts b/types/yoctodelay/index.d.ts new file mode 100644 index 0000000000..ba4d2c6c58 --- /dev/null +++ b/types/yoctodelay/index.d.ts @@ -0,0 +1,12 @@ +// Type definitions for yoctodelay 1.1 +// Project: https://github.com/sindresorhus/yoctodelay#readme +// Definitions by: Sean Marvi Oliver Genabe +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/** + * Delay the promise and then resolve. + * @param ms Milliseconds to delay the promise. + */ +declare function delay(ms: number): Promise; + +export = delay; diff --git a/types/yoctodelay/tsconfig.json b/types/yoctodelay/tsconfig.json new file mode 100644 index 0000000000..6f4d1bf068 --- /dev/null +++ b/types/yoctodelay/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "strictFunctionTypes": true + }, + "files": [ + "index.d.ts", + "yoctodelay-tests.ts" + ] +} diff --git a/types/yoctodelay/tslint.json b/types/yoctodelay/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/yoctodelay/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/yoctodelay/yoctodelay-tests.ts b/types/yoctodelay/yoctodelay-tests.ts new file mode 100644 index 0000000000..67a0158d50 --- /dev/null +++ b/types/yoctodelay/yoctodelay-tests.ts @@ -0,0 +1,4 @@ +import delay = require('yoctodelay'); // delay is(ms: number) => Promise + +// $ExpectType Promise +delay(4); From f28e09e7b0db43fe9434d31bac20aca0c33c259b Mon Sep 17 00:00:00 2001 From: Daniel Dyla Date: Thu, 2 Aug 2018 16:54:07 -0400 Subject: [PATCH 08/94] Add typings file for dialogflow --- types/dialogflow/dialogflow-tests.ts | 10 + types/dialogflow/index.d.ts | 915 +++++++++++++++++++++++++++ types/dialogflow/tsconfig.json | 22 + types/dialogflow/tslint.json | 1 + 4 files changed, 948 insertions(+) create mode 100644 types/dialogflow/dialogflow-tests.ts create mode 100644 types/dialogflow/index.d.ts create mode 100644 types/dialogflow/tsconfig.json create mode 100644 types/dialogflow/tslint.json diff --git a/types/dialogflow/dialogflow-tests.ts b/types/dialogflow/dialogflow-tests.ts new file mode 100644 index 0000000000..aae5fc4ef9 --- /dev/null +++ b/types/dialogflow/dialogflow-tests.ts @@ -0,0 +1,10 @@ +import * as dialogflow from "dialogflow"; + +const agentsClient = new dialogflow.AgentsClient() +const contextsClient = new dialogflow.ContextsClient() +const entityTypesClient = new dialogflow.EntityTypesClient() +const intentsClient = new dialogflow.IntentsClient() +const sessionEntityTypesClient = new dialogflow.SessionEntityTypesClient() +const sessionsClient = new dialogflow.SessionsClient() + +// TODO: Add real significant tests diff --git a/types/dialogflow/index.d.ts b/types/dialogflow/index.d.ts new file mode 100644 index 0000000000..9c8d499a41 --- /dev/null +++ b/types/dialogflow/index.d.ts @@ -0,0 +1,915 @@ +// Type definitions for dialogflow 0.6 +// Project: https://github.com/dialogflow/dialogflow-nodejs-client-v2#readme +// Definitions by: Daniel Dyla +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export namespace v2 { + class AgentsClient { + constructor(options?: ClientOptions); + + servicePath: string; + port: number; + scopes: string[]; + + getProjectId(): Promise; + getProjectId(callback?: (error: Error, id: string) => string): void; + + getAgent( + request: GetAgentRequest, + options?: gax.CallOptions, + cb?: (err?: Error, agent?: Agent) => void, + ): Promise<[Agent]>; + searchAgents( + request: SearchAgentRequest, + options?: gax.CallOptions, + cb?: (err?: Error, agents?: Agent[], arg3?: any, response?: any) => void, + ): Promise; + searchAgentsStream( + request: SearchAgentRequest, + options?: gax.CallOptions, + ): NodeJS.ReadableStream; + trainAgent( + request: TrainAgentRequest, + options?: gax.CallOptions, + cb?: (err?: Error, operation?: gax.Operation) => void, + ): Promise<[gax.Operation]>; + exportAgent( + request: ExportAgentRequest, + options?: gax.CallOptions, + cb?: (err?: Error, operation?: gax.Operation) => void, + ): Promise<[gax.Operation]>; + importAgent( + request: ImportAgentRequest, + options?: gax.CallOptions, + cb?: (err?: Error, operation?: gax.Operation) => void, + ): Promise<[gax.Operation]>; + restoreAgent( + request: RestoreAgentRequest, + options?: gax.CallOptions, + cb?: (err?: Error, operation?: gax.Operation) => void, + ): Promise<[gax.Operation]>; + } + + class ContextsClient { + constructor(options?: ClientOptions); + + servicePath: string; + port: number; + scopes: string[]; + + getProjectId(): Promise; + getProjectId(callback?: (error: Error, id: string) => string): void; + + listContexts( + request: ListContextsRequest, + options?: gax.CallOptions, + ): Promise<[Context[]]>; + listContextsStream( + request: ListContextsRequest, + options?: gax.CallOptions, + ): NodeJS.ReadableStream; + getContext( + request: GetContextRequest, + options?: gax.CallOptions, + ): Promise<[Context]>; + createContext( + request: CreateContextReqeust, + options?: gax.CallOptions, + ): Promise<[Context]>; + updateContext( + request: UpdateContextRequest, + options?: gax.CallOptions, + ): Promise<[Context]>; + deleteContext( + request: DeleteContextRequest, + options?: gax.CallOptions, + ): Promise; + deleteAllContexts( + request: DeleteAllContextsRequest, + options?: gax.CallOptions, + ): Promise; + + sessionPath(project: string, session: string): string; + contextPath(project: string, session: string, context: string): string; + + matchProjectFromContextName(name: string): string; + matchSessionFromContextName(name: string): string; + matchContextFromContextName(name: string): string; + + matchProjectFromSessionName(name: string): string; + matchSessionFromSessionName(name: string): string; + } + + class EntityTypesClient { + constructor(options?: ClientOptions); + + servicePath: string; + port: number; + scopes: string[]; + + getProjectId(): Promise; + getProjectId(callback?: (error: Error, id: string) => string): void; + + listEntityTypes( + request: ListEntityTypesRequest, + options?: gax.CallOptions, + ): Promise<[EntityType[]]>; + + listEntityTypesStream( + request: ListEntityTypesRequest, + options?: gax.CallOptions, + ): NodeJS.ReadableStream; + + getEntityType( + request: GetEntityTypeRequest, + options?: gax.CallOptions, + ): Promise<[EntityType]>; + createEntityType( + request: CreateEntityTypeRequest, + options?: gax.CallOptions, + ): Promise<[EntityType]>; + updateEntityType( + request: UpdateEntityTypeRequest, + options?: gax.CallOptions, + ): Promise<[EntityType]>; + deleteEntityType( + request: DeleteEntityTypeRequest, + options?: gax.CallOptions, + ): Promise; + + // TODO: add batch style calls + // batchUpdateEntityTypes + // batchDeleteEntityTypes + // batchCreateEntities + // batchUpdateEntities + // batchDeleteEntities + + projectAgentPath(project: string): string; + entityTypePath(project: string, entityType: string): string; + matchProjectFromProjectAgentName(entityTypeName: string): string; + matchProjectFromEntityTypeName(entityTypeName: string): string; + matchEntityTypeFromEntityTypeName(entityTypeName: string): string; + } + + class IntentsClient { + constructor(options?: ClientOptions); + + servicePath: string; + port: number; + scopes: string[]; + + getProjectId(): Promise; + getProjectId(callback?: (error: Error, id: string) => string): void; + + listIntents( + request: ListIntentsRequest, + options?: gax.CallOptions, + ): Promise<[Intent[]]>; + getIntent( + request: GetIntentRequest, + options?: gax.CallOptions, + ): Promise<[Intent]>; + createIntent( + request: CreateIntentRequest, + options?: gax.CallOptions, + ): Promise<[Intent]>; + updateIntent( + request: UpdateIntentRequest, + options?: gax.CallOptions, + ): Promise<[Intent]>; + deleteIntent( + request: DeleteIntentRequest, + options?: gax.CallOptions, + ): Promise; + + // TODO: add batch style calls + // batchUpdateIntents(request: BatchUpdateIntentsRequest): void; + // batchDeleteIntents(request: BatchDeleteIntentsRequest): void; + + projectAgentPath(project: string): string; + intentPath(project: string, intent: string): string; + agentPath(project: string, agent: string): string; + + matchProjectFromProjectAgentName(projectAgentName: string): string; + matchProjectFromIntentName(intentName: string): string; + matchIntentFromIntentName(intentName: string): string; + matchProjectFromAgentName(agentName: string): string; + matchAgentFromAgentName(agentName: string): string; + } + + class SessionEntityTypesClient { + constructor(options?: ClientOptions); + + servicePath: string; + port: number; + scopes: string[]; + + getProjectId(): Promise; + getProjectId(callback?: (error: Error, id: string) => string): void; + + // TODO: add Session Entity Types service methods + } + + class SessionsClient { + constructor(options?: ClientOptions); + + servicePath: string; + port: number; + scopes: string[]; + + getProjectId(): Promise; + getProjectId(callback?: (error: Error, id: string) => string): void; + + detectIntent( + request: DetectIntentRequest, + options?: gax.CallOptions, + ): Promise; + streamingDetectIntent(options?: gax.CallOptions): Promise; + + sessionPath(projectId: string, sessionId: string): string; + } + } + + export namespace v2beta1 { + class AgentsClient extends v2.AgentsClient {} + class ContextsClient extends v2.ContextsClient { + environmentSessionPath( + project: string, + environment: string, + user: string, + session: string, + ): string; + + environmentContextPath( + project: string, + environment: string, + user: string, + session: string, + context: string, + ): string; + + matchProjectFromEnvironmentSessionName( + environmentSessionName: string, + ): string; + matchEnvironmentFromEnvironmentSessionName( + environmentSessionName: string, + ): string; + matchUserFromEnvironmentSessionName(environmentSessionName: string): string; + matchSessionFromEnvironmentSessionName( + environmentSessionName: string, + ): string; + + matchProjectFromEnvironmentContextName( + environmentContextName: string, + ): string; + matchEnvironmentFromEnvironmentContextName( + environmentContextName: string, + ): string; + matchUserFromEnvironmentContextName(environmentContextName: string): string; + matchSessionFromEnvironmentContextName( + environmentContextName: string, + ): string; + matchContextFromEnvironmentContextName( + environmentContextName: string, + ): string; + } + class EntityTypesClient extends v2.EntityTypesClient {} + class IntentsClient extends v2.IntentsClient {} + class SessionEntityTypesClient extends v2.SessionEntityTypesClient {} + class SessionsClient extends v2.SessionsClient { + environmentSessionPath( + project: string, + environment: string, + user: string, + session: string, + ): string; + + matchProjectFromEnvironmentSessionName( + environmentSessionName: string, + ): string; + matchEnvironmentFromEnvironmentSessionName( + environmentSessionName: string, + ): string; + matchUserFromEnvironmentSessionName(environmentSessionName: string): string; + matchSessionFromEnvironmentSessionName( + environmentSessionName: string, + ): string; + } + } + + export class AgentsClient extends v2.AgentsClient {} + export class ContextsClient extends v2.ContextsClient {} + export class EntityTypesClient extends v2.EntityTypesClient {} + export class IntentsClient extends v2.IntentsClient {} + export class SessionEntityTypesClient extends v2.SessionEntityTypesClient {} + export class SessionsClient extends v2.SessionsClient {} + + export namespace entities { + namespace DateTimeVariants { + type DateTime = { + date_time: string; + }; + + type DateTimePeriod = { + startDateTime: DateTime; + endDateTime: DateTime; + }; + + type DatePeriod = { + startDate: Date; + endDate: Date; + }; + type TimePeriod = { + startTime: string; + endTime: string; + }; + } + + type DateTime = + | string + | DateTimeVariants.DatePeriod + | DateTimeVariants.TimePeriod + | DateTimeVariants.DateTime + | DateTimeVariants.DateTimePeriod; + + type Duration = { + unit: string; + amount: number; + }; + + type Date = string; + + type Time = string; + } + + export namespace gax { + export interface BackoffSettings { + initialRetryDelayMillis: number; + retryDelayMultiplier: number; + maxRetryDelayMillis: number; + initialRpcTimeoutMillis: number; + maxRpcTimeoutMillis: number; + totalTimeoutMillis: number; + } + + export interface RetryOptions { + retryCodes: string[]; + backoffSettings: BackoffSettings; + } + + export interface CallOptions { + timeout?: number; + retry?: RetryOptions; + autoPaginate?: boolean; + pageToken?: any; + isBundling?: boolean; + longrunning?: BackoffSettings; + promise?: PromiseConstructor; + } + + export interface Operation { + grpcOp: longrunning.Operation; + longrunningDescriptor: any; + backoffSettings: BackoffSettings; + callOptions?: CallOptions; + } + } + + export namespace longrunning { + export type Operation = + | UnfinishedOperation + | FailedOperation + | SuccessfulOperation; + + export interface BaseOperation { + name: string; + metadata: any; + done: boolean; + } + + export interface UnfinishedOperation extends BaseOperation { + done: false; + } + + export interface FailedOperation extends BaseOperation { + done: true; + error: Status; + } + + export interface SuccessfulOperation extends BaseOperation { + done: true; + response: any; + } + + export interface Status { + code: number; + message: string; + details: any[]; + } + } + + export interface GetAgentRequest { + parent: string; + } + + export interface SearchAgentRequest { + parent: string; + pageSize?: number; + } + + export interface TrainAgentRequest { + parent: string; + } + + export interface ExportAgentRequest { + parent: string; + agentUri?: string; + } + + export interface ImportAgentRequest { + parent: string; + agentUri?: string; + agentContent?: string; + } + + export interface RestoreAgentRequest { + parent: string; + agentUri?: string; + agentContent?: string; + } + + export interface ListContextsRequest { + parent: string; + pageSize?: number; + } + + export interface GetContextRequest { + name: string; + } + + export interface CreateContextReqeust { + parent: string; + context: Context; + } + + export interface UpdateContextRequest { + context: Context; + updatemask?: any; + } + + export interface DeleteContextRequest { + name: string; + } + + export interface DeleteAllContextsRequest { + parent: string; + } + + export interface ListEntityTypesRequest { + parent: string; + languageCode?: string; + pageSize?: number; + } + + export interface GetEntityTypeRequest { + name: string; + languageCode?: string; + } + + export interface CreateEntityTypeRequest { + parent: string; + entityType: EntityType; + } + + export interface UpdateEntityTypeRequest { + entityType: EntityType; + languageCode?: string; + /** @link https://github.com/google/protobuf/blob/master/src/google/protobuf/field_mask.proto */ + updateMask?: any; + } + + export interface DeleteEntityTypeRequest { + name: string; + } + + export interface ListIntentsRequest { + parent: string; + languageCode?: string; + intentView?: IntentView; + pageSize?: number; + } + + export interface GetIntentRequest { + name: string; + languageCode?: string; + intentView?: IntentView; + } + + export interface CreateIntentRequest { + parent: string; + intent: Intent; + languageCode?: string; + intentView?: IntentView; + } + + export interface UpdateIntentRequest { + intent: Intent; + languageCode?: string; + updateMask?: any; + intentView?: IntentView; + } + + export interface DeleteIntentRequest { + name: string; + } + + export interface DetectIntentRequest { + session: string; + queryInput: QueryInput; + queryParams?: QueryParams; + inputAudio?: Buffer; + } + + export interface DetectIntentResponse { + responseId: string; + queryResult: QueryResult; + webhookStatus: Status; + } + + export interface QueryResult { + queryText: string; + laugnageCode: string; + speechRecognitionConfidence: number; + action: string; + parameters: any; + allRequiredParamsSent: boolean; + fulfillmentText: string; + fulfillmentMessages: Message[]; + webhookSource: string; + webhookPayload: any; + outputContexts: Context[]; + intent: Intent; + intentDetectionConfidence: number; + diagnosticInfo: any; + } + + export interface Status { + code: StatusCode; + message: string; + details: any[]; + } + + export enum StatusCode { + // Not an error; returned on success + // + // HTTP Mapping: 200 OK + OK = 0, + + // The operation was cancelled, typically by the caller. + // + // HTTP Mapping: 499 Client Closed Request + CANCELLED = 1, + + // Unknown error. For example, this error may be returned when + // a `Status` value received from another address space belongs to + // an error space that is not known in this address space. Also + // errors raised by APIs that do not return enough error information + // may be converted to this error. + // + // HTTP Mapping: 500 Internal Server Error + UNKNOWN = 2, + + // The client specified an invalid argument. Note that this differs + // from `FAILED_PRECONDITION`. `INVALID_ARGUMENT` indicates arguments + // that are problematic regardless of the state of the system + // (e.g., a malformed file name). + // + // HTTP Mapping: 400 Bad Request + INVALID_ARGUMENT = 3, + + // The deadline expired before the operation could complete. For operations + // that change the state of the system, this error may be returned + // even if the operation has completed successfully. For example, a + // successful response from a server could have been delayed long + // enough for the deadline to expire. + // + // HTTP Mapping: 504 Gateway Timeout + DEADLINE_EXCEEDED = 4, + + // Some requested entity (e.g., file or directory) was not found. + // + // Note to server developers: if a request is denied for an entire class + // of users, such as gradual feature rollout or undocumented whitelist, + // `NOT_FOUND` may be used. If a request is denied for some users within + // a class of users, such as user-based access control, `PERMISSION_DENIED` + // must be used. + // + // HTTP Mapping: 404 Not Found + NOT_FOUND = 5, + + // The entity that a client attempted to create (e.g., file or directory) + // already exists. + // + // HTTP Mapping: 409 Conflict + ALREADY_EXISTS = 6, + + // The caller does not have permission to execute the specified + // operation. `PERMISSION_DENIED` must not be used for rejections + // caused by exhausting some resource (use `RESOURCE_EXHAUSTED` + // instead for those errors). `PERMISSION_DENIED` must not be + // used if the caller can not be identified (use `UNAUTHENTICATED` + // instead for those errors). This error code does not imply the + // request is valid or the requested entity exists or satisfies + // other pre-conditions. + // + // HTTP Mapping: 403 Forbidden + PERMISSION_DENIED = 7, + + // The request does not have valid authentication credentials for the + // operation. + // + // HTTP Mapping: 401 Unauthorized + UNAUTHENTICATED = 16, + + // Some resource has been exhausted, perhaps a per-user quota, or + // perhaps the entire file system is out of space. + // + // HTTP Mapping: 429 Too Many Requests + RESOURCE_EXHAUSTED = 8, + + // The operation was rejected because the system is not in a state + // required for the operation's execution. For example, the directory + // to be deleted is non-empty, an rmdir operation is applied to + // a non-directory, etc. + // + // Service implementors can use the following guidelines to decide + // between `FAILED_PRECONDITION`, `ABORTED`, and `UNAVAILABLE`: + // (a) Use `UNAVAILABLE` if the client can retry just the failing call. + // (b) Use `ABORTED` if the client should retry at a higher level + // (e.g., when a client-specified test-and-set fails, indicating the + // client should restart a read-modify-write sequence). + // (c) Use `FAILED_PRECONDITION` if the client should not retry until + // the system state has been explicitly fixed. E.g., if an "rmdir" + // fails because the directory is non-empty, `FAILED_PRECONDITION` + // should be returned since the client should not retry unless + // the files are deleted from the directory. + // + // HTTP Mapping: 400 Bad Request + FAILED_PRECONDITION = 9, + + // The operation was aborted, typically due to a concurrency issue such as + // a sequencer check failure or transaction abort. + // + // See the guidelines above for deciding between `FAILED_PRECONDITION`, + // `ABORTED`, and `UNAVAILABLE`. + // + // HTTP Mapping: 409 Conflict + ABORTED = 10, + + // The operation was attempted past the valid range. E.g., seeking or + // reading past end-of-file. + // + // Unlike `INVALID_ARGUMENT`, this error indicates a problem that may + // be fixed if the system state changes. For example, a 32-bit file + // system will generate `INVALID_ARGUMENT` if asked to read at an + // offset that is not in the range [0,2^32-1], but it will generate + // `OUT_OF_RANGE` if asked to read from an offset past the current + // file size. + // + // There is a fair bit of overlap between `FAILED_PRECONDITION` and + // `OUT_OF_RANGE`. We recommend using `OUT_OF_RANGE` (the more specific + // error) when it applies so that callers who are iterating through + // a space can easily look for an `OUT_OF_RANGE` error to detect when + // they are done. + // + // HTTP Mapping: 400 Bad Request + OUT_OF_RANGE = 11, + + // The operation is not implemented or is not supported/enabled in this + // service. + // + // HTTP Mapping: 501 Not Implemented + UNIMPLEMENTED = 12, + + // Internal errors. This means that some invariants expected by the + // underlying system have been broken. This error code is reserved + // for serious errors. + // + // HTTP Mapping: 500 Internal Server Error + INTERNAL = 13, + + // The service is currently unavailable. This is most likely a + // transient condition, which can be corrected by retrying with + // a backoff. + // + // See the guidelines above for deciding between `FAILED_PRECONDITION`, + // `ABORTED`, and `UNAVAILABLE`. + // + // HTTP Mapping: 503 Service Unavailable + UNAVAILABLE = 14, + + // Unrecoverable data loss or corruption. + // + // HTTP Mapping: 500 Internal Server Error + DATA_LOSS = 15, + } + + export interface Agent { + parent: string; + displayName: string; + defaultLanguageCode: string; + supportedLanguageCodes?: string[]; + timeZone: string; + description?: string; + avatarUri?: string; + enableLogging?: boolean; + matchMode?: MatchMode; + classificationThreshold?: number; + } + + export interface Context { + name: string; + lifespanCount?: number; + parameters?: any; + } + + export interface EntityType { + name: string; + entities: EntitySynonyms[]; + displayName: string; + kind: EntityKind; + autoExpansionMode: EntityAutoExpansionMode; + } + + export enum MatchMode { + MATCH_MODE_UNSPECIFIED = "MATCH_MODE_UNSPECIFIED", + MATCH_MODE_HYBRID = "MATCH_MODE_HYBRID", + MATCH_MODE_ML_ONLY = "MATCH_MODE_ML_ONLY", + } + + export interface Credentials { + clientEmail?: string; + privateKey?: string; + } + + export interface ClientOptions { + credentials?: Credentials; + email?: string; + keyFilename?: string; + port?: number; + projectId?: string; + promise?: PromiseConstructor; + servicePath?: string; + } + + export interface EntitySynonyms { + synonyms: string[]; + value: string; + } + + export enum EntityKind { + KIND_MAP = "KIND_MAP", + KIND_LIST = "KIND_LIST", + } + + export enum EntityAutoExpansionMode { + AUTO_EXPANSION_MODE_DEFAULT = "AUTO_EXPANSION_MODE_DEFAULT", + AUTO_EXPANSION_MODE_UNSPECIFIED = "AUTO_EXPANSION_MODE_UNSPECIFIED", + } + + export enum IntentView { + INTENT_VIEW_UNSPECIFIED = "INTENT_VIEW_UNSPECIFIED", + INTENT_VIEW_FULL = "INTENT_VIEW_FULL", + } + + export interface Intent { + name: string; + displayName: string; + webhookState: string; + priority?: number; + isFallback?: boolean; + mlEnabled?: boolean; + inputContextNames?: string[]; + events?: string[]; + trainingPhrases?: TrainingPhrase[]; + action?: string; + outputContexts?: Context[]; + resetContexts?: boolean; + parameters?: Parameter[]; + messages?: Message[]; + defaultResponsePlatforms?: string[]; + rootFollowupIntentName: string; + parentFollowupIntentName: string; + followupIntentInfo?: FollowupIntentInfo[]; + } + + export interface TrainingPhrase { + name: string; + type: string; + parts: Part[]; + timesAddedCount?: number; + } + + export interface Part { + text: string; + entityType?: string; + alias?: string; + userDefined?: boolean; + } + + export interface Parameter { + name: string; + displayName: string; + value?: string; + defaultValue?: string; + entityTypeDisplayName?: string; + mandatory?: boolean; + prompts?: string[]; + isList?: boolean; + } + + export interface FollowupIntentInfo { + followupIntentName: string; + parentFollowupIntentName: string; + } + + export interface Message { + platform?: string; + text?: Text; + card?: Card; + payload?: any; + } + + export interface Text { + text: string[]; + } + + export interface Card { + title?: string; + subtitle?: string; + imageUri?: string; + buttons?: Button[]; + } + + export interface Button { + text?: string; + postback?: string; + } + + export interface EventInput { + name: string; + languageCode: string; + parameters?: any; + } + + export interface TextInput { + text: string; + languageCode: string; + } + + export interface QueryInput { + text?: TextInput; + event?: EventInput; + } + + export interface QueryParams { + timeZone?: string; + geoLocation?: LatLong; + contexts?: Context[]; + resetContexts?: boolean; + sessionEntityTypes?: SessionEntityType[]; + payload?: any; + } + + export interface LatLong { + latitude: number; + longitude: number; + } + + export interface SessionEntityType { + name: string; + entityOverrideMode: string; + entities: Entity[]; + } + + export interface Entity { + value: string; + synonyms: string[]; + } + + export interface WebhookRequest { + session: string; + responseId: string; + + queryResult: QueryResult; + originalDetectIntentRequest?: any; + } + + export interface WebhookResponse { + fulfillmentText?: string; + fulfillmentMessages?: Message[]; + source?: string; + payload?: any; + outputContexts?: Context[]; + followupEventInput?: EventInput; + } diff --git a/types/dialogflow/tsconfig.json b/types/dialogflow/tsconfig.json new file mode 100644 index 0000000000..3133bd6dcb --- /dev/null +++ b/types/dialogflow/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": ["node", "gax-nodejs"], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "dialogflow-tests.ts" + ] +} diff --git a/types/dialogflow/tslint.json b/types/dialogflow/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/dialogflow/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 964331d33485c37a063cad5895bf1c54551d61c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Sm=C3=B3=C5=82ka?= Date: Fri, 3 Aug 2018 09:48:32 +0200 Subject: [PATCH 09/94] kendo-ui: added missing drag and drop data definitions --- types/kendo-ui/index.d.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/types/kendo-ui/index.d.ts b/types/kendo-ui/index.d.ts index dc9f7d43f0..ca3a28e376 100644 --- a/types/kendo-ui/index.d.ts +++ b/types/kendo-ui/index.d.ts @@ -20299,16 +20299,19 @@ interface JQueryPromise { interface JQuery { + data(key: any): any; + kendoDraggable(): JQuery; kendoDraggable(options: kendo.ui.DraggableOptions): JQuery; + data(key: "kendoDraggable"): kendo.ui.Draggable; kendoDropTarget(): JQuery; kendoDropTarget(options: kendo.ui.DropTargetOptions): JQuery; + data(key: "kendoDropTarget"): kendo.ui.DropTarget; kendoDropTargetArea(): JQuery; kendoDropTargetArea(options: kendo.ui.DropTargetAreaOptions): JQuery; - - data(key: any): any; + data(key: "kendoDropTargetArea"): kendo.ui.DropTargetArea; kendoAlert(): JQuery; kendoAlert(options: kendo.ui.AlertOptions): JQuery; From 2c06bf7252757a765a9127c67205f0b6ef1c199b Mon Sep 17 00:00:00 2001 From: chris Date: Fri, 3 Aug 2018 20:00:10 -0500 Subject: [PATCH 10/94] Added signal to CredentialRequestOptions and CredentialCreationOptions interfaces. --- types/webappsec-credential-management/index.d.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/types/webappsec-credential-management/index.d.ts b/types/webappsec-credential-management/index.d.ts index 9ab3292c3b..12b2468c3e 100644 --- a/types/webappsec-credential-management/index.d.ts +++ b/types/webappsec-credential-management/index.d.ts @@ -314,6 +314,11 @@ interface CredentialRequestOptions { * This property specifies options for requesting a public-key signature. */ publicKey?: PublicKeyCredentialRequestOptions; + + /** + * This property lets the developer abort an ongoing get() operation. + */ + signal?: AbortSignal; } /** @@ -342,6 +347,10 @@ interface CredentialCreationOptions { * @see {@link https://w3c.github.io/webauthn/#dictionary-makecredentialoptions} */ publicKey?: PublicKeyCredentialCreationOptions; + /** + * @see {@link https://w3c.github.io/webappsec-credential-management/#dom-credentialrequestoptions-signal} + */ + signal?: AbortSignal; } /** From 84ccd818d7414b089b34a2ef6561e8710d93d66a Mon Sep 17 00:00:00 2001 From: chris Date: Fri, 3 Aug 2018 20:57:39 -0500 Subject: [PATCH 11/94] Updated TypeScript version in modified index file.. --- types/webappsec-credential-management/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/webappsec-credential-management/index.d.ts b/types/webappsec-credential-management/index.d.ts index 12b2468c3e..ad36b0318d 100644 --- a/types/webappsec-credential-management/index.d.ts +++ b/types/webappsec-credential-management/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/w3c/webappsec-credential-management // Definitions by: Iain McGinniss // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.2 +// TypeScript Version: 2.7 // Spec: https://www.w3.org/TR/2017/WD-credential-management-1-20170804 From 3721705444a3924f32a6b3c714ef1b94d7db548d Mon Sep 17 00:00:00 2001 From: chris Date: Fri, 3 Aug 2018 21:15:35 -0500 Subject: [PATCH 12/94] Fixed error in seemingly unrelated test case. --- .../webappsec-credential-management-tests.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/types/webappsec-credential-management/webappsec-credential-management-tests.ts b/types/webappsec-credential-management/webappsec-credential-management-tests.ts index 2afa9f8785..a475fa5379 100644 --- a/types/webappsec-credential-management/webappsec-credential-management-tests.ts +++ b/types/webappsec-credential-management/webappsec-credential-management-tests.ts @@ -214,7 +214,10 @@ function signOutDeprecated() { } navigator.credentials.requireUserMediation().then(() => { - document.location.assign('/'); + const location = document.location; + if (location) { + location.assign('/'); + } }); } @@ -224,7 +227,10 @@ function signOut() { } navigator.credentials.preventSilentAccess().then(() => { - document.location.assign('/'); + const location = document.location; + if (location) { + location.assign('/'); + } }); } From dc9936dd0e7a3765398fb79a0b6d3ab26e584f7c Mon Sep 17 00:00:00 2001 From: Paul Sowden Date: Sun, 5 Aug 2018 18:01:36 -0700 Subject: [PATCH 13/94] Add missing modifier property to Ripple See https://github.com/OnsenUI/OnsenUI/pull/2506 for identical change to upstream API. --- types/react-onsenui/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/react-onsenui/index.d.ts b/types/react-onsenui/index.d.ts index 91055d25b4..4f1ef5ef44 100644 --- a/types/react-onsenui/index.d.ts +++ b/types/react-onsenui/index.d.ts @@ -281,6 +281,7 @@ export class Ripple extends Component<{ color?: string, background?: string, disabled?: boolean, + modifier?: string, }, any> {} /*** Forms ***/ From 909037546a26fa0e989d111c9db03b92d1a5b34e Mon Sep 17 00:00:00 2001 From: Daniel Dyla Date: Mon, 6 Aug 2018 09:00:46 -0400 Subject: [PATCH 14/94] Fix linting issues --- types/dialogflow/dialogflow-tests.ts | 12 +- types/dialogflow/index.d.ts | 868 ++++++++++++++------------- types/dialogflow/tsconfig.json | 3 +- 3 files changed, 448 insertions(+), 435 deletions(-) diff --git a/types/dialogflow/dialogflow-tests.ts b/types/dialogflow/dialogflow-tests.ts index aae5fc4ef9..42d905839e 100644 --- a/types/dialogflow/dialogflow-tests.ts +++ b/types/dialogflow/dialogflow-tests.ts @@ -1,10 +1,10 @@ import * as dialogflow from "dialogflow"; -const agentsClient = new dialogflow.AgentsClient() -const contextsClient = new dialogflow.ContextsClient() -const entityTypesClient = new dialogflow.EntityTypesClient() -const intentsClient = new dialogflow.IntentsClient() -const sessionEntityTypesClient = new dialogflow.SessionEntityTypesClient() -const sessionsClient = new dialogflow.SessionsClient() +const agentsClient = new dialogflow.AgentsClient(); +const contextsClient = new dialogflow.ContextsClient(); +const entityTypesClient = new dialogflow.EntityTypesClient(); +const intentsClient = new dialogflow.IntentsClient(); +const sessionEntityTypesClient = new dialogflow.SessionEntityTypesClient(); +const sessionsClient = new dialogflow.SessionsClient(); // TODO: Add real significant tests diff --git a/types/dialogflow/index.d.ts b/types/dialogflow/index.d.ts index 9c8d499a41..96c4b11016 100644 --- a/types/dialogflow/index.d.ts +++ b/types/dialogflow/index.d.ts @@ -2,541 +2,553 @@ // Project: https://github.com/dialogflow/dialogflow-nodejs-client-v2#readme // Definitions by: Daniel Dyla // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.4 export namespace v2 { class AgentsClient { - constructor(options?: ClientOptions); + constructor(options?: ClientOptions); - servicePath: string; - port: number; - scopes: string[]; + servicePath: string; + port: number; + scopes: string[]; - getProjectId(): Promise; - getProjectId(callback?: (error: Error, id: string) => string): void; + getProjectId(): Promise; + getProjectId(callback?: (error: Error, id: string) => string): void; - getAgent( - request: GetAgentRequest, - options?: gax.CallOptions, - cb?: (err?: Error, agent?: Agent) => void, - ): Promise<[Agent]>; - searchAgents( - request: SearchAgentRequest, - options?: gax.CallOptions, - cb?: (err?: Error, agents?: Agent[], arg3?: any, response?: any) => void, - ): Promise; - searchAgentsStream( - request: SearchAgentRequest, - options?: gax.CallOptions, - ): NodeJS.ReadableStream; - trainAgent( - request: TrainAgentRequest, - options?: gax.CallOptions, - cb?: (err?: Error, operation?: gax.Operation) => void, - ): Promise<[gax.Operation]>; - exportAgent( - request: ExportAgentRequest, - options?: gax.CallOptions, - cb?: (err?: Error, operation?: gax.Operation) => void, - ): Promise<[gax.Operation]>; - importAgent( - request: ImportAgentRequest, - options?: gax.CallOptions, - cb?: (err?: Error, operation?: gax.Operation) => void, - ): Promise<[gax.Operation]>; - restoreAgent( - request: RestoreAgentRequest, - options?: gax.CallOptions, - cb?: (err?: Error, operation?: gax.Operation) => void, - ): Promise<[gax.Operation]>; + getAgent( + request: GetAgentRequest, + options?: gax.CallOptions, + cb?: (err?: Error, agent?: Agent) => void + ): Promise<[Agent]>; + searchAgents( + request: SearchAgentRequest, + options?: gax.CallOptions, + cb?: ( + err?: Error, + agents?: Agent[], + arg3?: any, + response?: any + ) => void + ): Promise; + searchAgentsStream( + request: SearchAgentRequest, + options?: gax.CallOptions + ): any; + trainAgent( + request: TrainAgentRequest, + options?: gax.CallOptions, + cb?: (err?: Error, operation?: gax.Operation) => void + ): Promise<[gax.Operation]>; + exportAgent( + request: ExportAgentRequest, + options?: gax.CallOptions, + cb?: (err?: Error, operation?: gax.Operation) => void + ): Promise<[gax.Operation]>; + importAgent( + request: ImportAgentRequest, + options?: gax.CallOptions, + cb?: (err?: Error, operation?: gax.Operation) => void + ): Promise<[gax.Operation]>; + restoreAgent( + request: RestoreAgentRequest, + options?: gax.CallOptions, + cb?: (err?: Error, operation?: gax.Operation) => void + ): Promise<[gax.Operation]>; } class ContextsClient { - constructor(options?: ClientOptions); + constructor(options?: ClientOptions); - servicePath: string; - port: number; - scopes: string[]; + servicePath: string; + port: number; + scopes: string[]; - getProjectId(): Promise; - getProjectId(callback?: (error: Error, id: string) => string): void; + getProjectId(): Promise; + getProjectId(callback?: (error: Error, id: string) => string): void; - listContexts( - request: ListContextsRequest, - options?: gax.CallOptions, - ): Promise<[Context[]]>; - listContextsStream( - request: ListContextsRequest, - options?: gax.CallOptions, - ): NodeJS.ReadableStream; - getContext( - request: GetContextRequest, - options?: gax.CallOptions, - ): Promise<[Context]>; - createContext( - request: CreateContextReqeust, - options?: gax.CallOptions, - ): Promise<[Context]>; - updateContext( - request: UpdateContextRequest, - options?: gax.CallOptions, - ): Promise<[Context]>; - deleteContext( - request: DeleteContextRequest, - options?: gax.CallOptions, - ): Promise; - deleteAllContexts( - request: DeleteAllContextsRequest, - options?: gax.CallOptions, - ): Promise; + listContexts( + request: ListContextsRequest, + options?: gax.CallOptions + ): Promise<[Context[]]>; + listContextsStream( + request: ListContextsRequest, + options?: gax.CallOptions + ): any; + getContext( + request: GetContextRequest, + options?: gax.CallOptions + ): Promise<[Context]>; + createContext( + request: CreateContextReqeust, + options?: gax.CallOptions + ): Promise<[Context]>; + updateContext( + request: UpdateContextRequest, + options?: gax.CallOptions + ): Promise<[Context]>; + deleteContext( + request: DeleteContextRequest, + options?: gax.CallOptions + ): Promise; + deleteAllContexts( + request: DeleteAllContextsRequest, + options?: gax.CallOptions + ): Promise; - sessionPath(project: string, session: string): string; - contextPath(project: string, session: string, context: string): string; + sessionPath(project: string, session: string): string; + contextPath(project: string, session: string, context: string): string; - matchProjectFromContextName(name: string): string; - matchSessionFromContextName(name: string): string; - matchContextFromContextName(name: string): string; + matchProjectFromContextName(name: string): string; + matchSessionFromContextName(name: string): string; + matchContextFromContextName(name: string): string; - matchProjectFromSessionName(name: string): string; - matchSessionFromSessionName(name: string): string; + matchProjectFromSessionName(name: string): string; + matchSessionFromSessionName(name: string): string; } class EntityTypesClient { - constructor(options?: ClientOptions); + constructor(options?: ClientOptions); - servicePath: string; - port: number; - scopes: string[]; + servicePath: string; + port: number; + scopes: string[]; - getProjectId(): Promise; - getProjectId(callback?: (error: Error, id: string) => string): void; + getProjectId(): Promise; + getProjectId(callback?: (error: Error, id: string) => string): void; - listEntityTypes( - request: ListEntityTypesRequest, - options?: gax.CallOptions, - ): Promise<[EntityType[]]>; + listEntityTypes( + request: ListEntityTypesRequest, + options?: gax.CallOptions + ): Promise<[EntityType[]]>; - listEntityTypesStream( - request: ListEntityTypesRequest, - options?: gax.CallOptions, - ): NodeJS.ReadableStream; + listEntityTypesStream( + request: ListEntityTypesRequest, + options?: gax.CallOptions + ): any; - getEntityType( - request: GetEntityTypeRequest, - options?: gax.CallOptions, - ): Promise<[EntityType]>; - createEntityType( - request: CreateEntityTypeRequest, - options?: gax.CallOptions, - ): Promise<[EntityType]>; - updateEntityType( - request: UpdateEntityTypeRequest, - options?: gax.CallOptions, - ): Promise<[EntityType]>; - deleteEntityType( - request: DeleteEntityTypeRequest, - options?: gax.CallOptions, - ): Promise; + getEntityType( + request: GetEntityTypeRequest, + options?: gax.CallOptions + ): Promise<[EntityType]>; + createEntityType( + request: CreateEntityTypeRequest, + options?: gax.CallOptions + ): Promise<[EntityType]>; + updateEntityType( + request: UpdateEntityTypeRequest, + options?: gax.CallOptions + ): Promise<[EntityType]>; + deleteEntityType( + request: DeleteEntityTypeRequest, + options?: gax.CallOptions + ): Promise; - // TODO: add batch style calls - // batchUpdateEntityTypes - // batchDeleteEntityTypes - // batchCreateEntities - // batchUpdateEntities - // batchDeleteEntities + // TODO: add batch style calls + // batchUpdateEntityTypes + // batchDeleteEntityTypes + // batchCreateEntities + // batchUpdateEntities + // batchDeleteEntities - projectAgentPath(project: string): string; - entityTypePath(project: string, entityType: string): string; - matchProjectFromProjectAgentName(entityTypeName: string): string; - matchProjectFromEntityTypeName(entityTypeName: string): string; - matchEntityTypeFromEntityTypeName(entityTypeName: string): string; + projectAgentPath(project: string): string; + entityTypePath(project: string, entityType: string): string; + matchProjectFromProjectAgentName(entityTypeName: string): string; + matchProjectFromEntityTypeName(entityTypeName: string): string; + matchEntityTypeFromEntityTypeName(entityTypeName: string): string; } class IntentsClient { - constructor(options?: ClientOptions); + constructor(options?: ClientOptions); - servicePath: string; - port: number; - scopes: string[]; + servicePath: string; + port: number; + scopes: string[]; - getProjectId(): Promise; - getProjectId(callback?: (error: Error, id: string) => string): void; + getProjectId(): Promise; + getProjectId(callback?: (error: Error, id: string) => string): void; - listIntents( - request: ListIntentsRequest, - options?: gax.CallOptions, - ): Promise<[Intent[]]>; - getIntent( - request: GetIntentRequest, - options?: gax.CallOptions, - ): Promise<[Intent]>; - createIntent( - request: CreateIntentRequest, - options?: gax.CallOptions, - ): Promise<[Intent]>; - updateIntent( - request: UpdateIntentRequest, - options?: gax.CallOptions, - ): Promise<[Intent]>; - deleteIntent( - request: DeleteIntentRequest, - options?: gax.CallOptions, - ): Promise; + listIntents( + request: ListIntentsRequest, + options?: gax.CallOptions + ): Promise<[Intent[]]>; + getIntent( + request: GetIntentRequest, + options?: gax.CallOptions + ): Promise<[Intent]>; + createIntent( + request: CreateIntentRequest, + options?: gax.CallOptions + ): Promise<[Intent]>; + updateIntent( + request: UpdateIntentRequest, + options?: gax.CallOptions + ): Promise<[Intent]>; + deleteIntent( + request: DeleteIntentRequest, + options?: gax.CallOptions + ): Promise; - // TODO: add batch style calls - // batchUpdateIntents(request: BatchUpdateIntentsRequest): void; - // batchDeleteIntents(request: BatchDeleteIntentsRequest): void; + // TODO: add batch style calls + // batchUpdateIntents(request: BatchUpdateIntentsRequest): void; + // batchDeleteIntents(request: BatchDeleteIntentsRequest): void; - projectAgentPath(project: string): string; - intentPath(project: string, intent: string): string; - agentPath(project: string, agent: string): string; + projectAgentPath(project: string): string; + intentPath(project: string, intent: string): string; + agentPath(project: string, agent: string): string; - matchProjectFromProjectAgentName(projectAgentName: string): string; - matchProjectFromIntentName(intentName: string): string; - matchIntentFromIntentName(intentName: string): string; - matchProjectFromAgentName(agentName: string): string; - matchAgentFromAgentName(agentName: string): string; + matchProjectFromProjectAgentName(projectAgentName: string): string; + matchProjectFromIntentName(intentName: string): string; + matchIntentFromIntentName(intentName: string): string; + matchProjectFromAgentName(agentName: string): string; + matchAgentFromAgentName(agentName: string): string; } class SessionEntityTypesClient { - constructor(options?: ClientOptions); + constructor(options?: ClientOptions); - servicePath: string; - port: number; - scopes: string[]; + servicePath: string; + port: number; + scopes: string[]; - getProjectId(): Promise; - getProjectId(callback?: (error: Error, id: string) => string): void; + getProjectId(): Promise; + getProjectId(callback?: (error: Error, id: string) => string): void; - // TODO: add Session Entity Types service methods + // TODO: add Session Entity Types service methods } class SessionsClient { - constructor(options?: ClientOptions); + constructor(options?: ClientOptions); - servicePath: string; - port: number; - scopes: string[]; + servicePath: string; + port: number; + scopes: string[]; - getProjectId(): Promise; - getProjectId(callback?: (error: Error, id: string) => string): void; + getProjectId(): Promise; + getProjectId(callback?: (error: Error, id: string) => string): void; - detectIntent( - request: DetectIntentRequest, - options?: gax.CallOptions, - ): Promise; - streamingDetectIntent(options?: gax.CallOptions): Promise; + detectIntent( + request: DetectIntentRequest, + options?: gax.CallOptions + ): Promise; + streamingDetectIntent(options?: gax.CallOptions): Promise; - sessionPath(projectId: string, sessionId: string): string; + sessionPath(projectId: string, sessionId: string): string; } - } +} - export namespace v2beta1 { +export namespace v2beta1 { class AgentsClient extends v2.AgentsClient {} class ContextsClient extends v2.ContextsClient { - environmentSessionPath( - project: string, - environment: string, - user: string, - session: string, - ): string; + environmentSessionPath( + project: string, + environment: string, + user: string, + session: string + ): string; - environmentContextPath( - project: string, - environment: string, - user: string, - session: string, - context: string, - ): string; + environmentContextPath( + project: string, + environment: string, + user: string, + session: string, + context: string + ): string; - matchProjectFromEnvironmentSessionName( - environmentSessionName: string, - ): string; - matchEnvironmentFromEnvironmentSessionName( - environmentSessionName: string, - ): string; - matchUserFromEnvironmentSessionName(environmentSessionName: string): string; - matchSessionFromEnvironmentSessionName( - environmentSessionName: string, - ): string; + matchProjectFromEnvironmentSessionName( + environmentSessionName: string + ): string; + matchEnvironmentFromEnvironmentSessionName( + environmentSessionName: string + ): string; + matchUserFromEnvironmentSessionName( + environmentSessionName: string + ): string; + matchSessionFromEnvironmentSessionName( + environmentSessionName: string + ): string; - matchProjectFromEnvironmentContextName( - environmentContextName: string, - ): string; - matchEnvironmentFromEnvironmentContextName( - environmentContextName: string, - ): string; - matchUserFromEnvironmentContextName(environmentContextName: string): string; - matchSessionFromEnvironmentContextName( - environmentContextName: string, - ): string; - matchContextFromEnvironmentContextName( - environmentContextName: string, - ): string; + matchProjectFromEnvironmentContextName( + environmentContextName: string + ): string; + matchEnvironmentFromEnvironmentContextName( + environmentContextName: string + ): string; + matchUserFromEnvironmentContextName( + environmentContextName: string + ): string; + matchSessionFromEnvironmentContextName( + environmentContextName: string + ): string; + matchContextFromEnvironmentContextName( + environmentContextName: string + ): string; } class EntityTypesClient extends v2.EntityTypesClient {} class IntentsClient extends v2.IntentsClient {} class SessionEntityTypesClient extends v2.SessionEntityTypesClient {} class SessionsClient extends v2.SessionsClient { - environmentSessionPath( - project: string, - environment: string, - user: string, - session: string, - ): string; + environmentSessionPath( + project: string, + environment: string, + user: string, + session: string + ): string; - matchProjectFromEnvironmentSessionName( - environmentSessionName: string, - ): string; - matchEnvironmentFromEnvironmentSessionName( - environmentSessionName: string, - ): string; - matchUserFromEnvironmentSessionName(environmentSessionName: string): string; - matchSessionFromEnvironmentSessionName( - environmentSessionName: string, - ): string; + matchProjectFromEnvironmentSessionName( + environmentSessionName: string + ): string; + matchEnvironmentFromEnvironmentSessionName( + environmentSessionName: string + ): string; + matchUserFromEnvironmentSessionName( + environmentSessionName: string + ): string; + matchSessionFromEnvironmentSessionName( + environmentSessionName: string + ): string; } - } +} - export class AgentsClient extends v2.AgentsClient {} - export class ContextsClient extends v2.ContextsClient {} - export class EntityTypesClient extends v2.EntityTypesClient {} - export class IntentsClient extends v2.IntentsClient {} - export class SessionEntityTypesClient extends v2.SessionEntityTypesClient {} - export class SessionsClient extends v2.SessionsClient {} +export class AgentsClient extends v2.AgentsClient {} +export class ContextsClient extends v2.ContextsClient {} +export class EntityTypesClient extends v2.EntityTypesClient {} +export class IntentsClient extends v2.IntentsClient {} +export class SessionEntityTypesClient extends v2.SessionEntityTypesClient {} +export class SessionsClient extends v2.SessionsClient {} - export namespace entities { +export namespace entities { namespace DateTimeVariants { - type DateTime = { - date_time: string; - }; + interface DateTime { + date_time: string; + } - type DateTimePeriod = { - startDateTime: DateTime; - endDateTime: DateTime; - }; + interface DateTimePeriod { + startDateTime: DateTime; + endDateTime: DateTime; + } - type DatePeriod = { - startDate: Date; - endDate: Date; - }; - type TimePeriod = { - startTime: string; - endTime: string; - }; + interface DatePeriod { + startDate: Date; + endDate: Date; + } + interface TimePeriod { + startTime: string; + endTime: string; + } } type DateTime = - | string - | DateTimeVariants.DatePeriod - | DateTimeVariants.TimePeriod - | DateTimeVariants.DateTime - | DateTimeVariants.DateTimePeriod; + | string + | DateTimeVariants.DatePeriod + | DateTimeVariants.TimePeriod + | DateTimeVariants.DateTime + | DateTimeVariants.DateTimePeriod; - type Duration = { - unit: string; - amount: number; - }; + interface Duration { + unit: string; + amount: number; + } type Date = string; type Time = string; - } +} - export namespace gax { - export interface BackoffSettings { - initialRetryDelayMillis: number; - retryDelayMultiplier: number; - maxRetryDelayMillis: number; - initialRpcTimeoutMillis: number; - maxRpcTimeoutMillis: number; - totalTimeoutMillis: number; +export namespace gax { + interface BackoffSettings { + initialRetryDelayMillis: number; + retryDelayMultiplier: number; + maxRetryDelayMillis: number; + initialRpcTimeoutMillis: number; + maxRpcTimeoutMillis: number; + totalTimeoutMillis: number; } - export interface RetryOptions { - retryCodes: string[]; - backoffSettings: BackoffSettings; + interface RetryOptions { + retryCodes: string[]; + backoffSettings: BackoffSettings; } - export interface CallOptions { - timeout?: number; - retry?: RetryOptions; - autoPaginate?: boolean; - pageToken?: any; - isBundling?: boolean; - longrunning?: BackoffSettings; - promise?: PromiseConstructor; + interface CallOptions { + timeout?: number; + retry?: RetryOptions; + autoPaginate?: boolean; + pageToken?: any; + isBundling?: boolean; + longrunning?: BackoffSettings; + promise?: PromiseConstructor; } - export interface Operation { - grpcOp: longrunning.Operation; - longrunningDescriptor: any; - backoffSettings: BackoffSettings; - callOptions?: CallOptions; + interface Operation { + grpcOp: longrunning.Operation; + longrunningDescriptor: any; + backoffSettings: BackoffSettings; + callOptions?: CallOptions; } - } +} - export namespace longrunning { - export type Operation = - | UnfinishedOperation - | FailedOperation - | SuccessfulOperation; +export namespace longrunning { + type Operation = + | UnfinishedOperation + | FailedOperation + | SuccessfulOperation; - export interface BaseOperation { - name: string; - metadata: any; - done: boolean; + interface BaseOperation { + name: string; + metadata: any; + done: boolean; } - export interface UnfinishedOperation extends BaseOperation { - done: false; + interface UnfinishedOperation extends BaseOperation { + done: false; } - export interface FailedOperation extends BaseOperation { - done: true; - error: Status; + interface FailedOperation extends BaseOperation { + done: true; + error: Status; } - export interface SuccessfulOperation extends BaseOperation { - done: true; - response: any; + interface SuccessfulOperation extends BaseOperation { + done: true; + response: any; } - export interface Status { - code: number; - message: string; - details: any[]; + interface Status { + code: number; + message: string; + details: any[]; } - } +} - export interface GetAgentRequest { +export interface GetAgentRequest { parent: string; - } +} - export interface SearchAgentRequest { +export interface SearchAgentRequest { parent: string; pageSize?: number; - } +} - export interface TrainAgentRequest { +export interface TrainAgentRequest { parent: string; - } +} - export interface ExportAgentRequest { +export interface ExportAgentRequest { parent: string; agentUri?: string; - } +} - export interface ImportAgentRequest { +export interface ImportAgentRequest { parent: string; agentUri?: string; agentContent?: string; - } +} - export interface RestoreAgentRequest { +export interface RestoreAgentRequest { parent: string; agentUri?: string; agentContent?: string; - } +} - export interface ListContextsRequest { +export interface ListContextsRequest { parent: string; pageSize?: number; - } +} - export interface GetContextRequest { +export interface GetContextRequest { name: string; - } +} - export interface CreateContextReqeust { +export interface CreateContextReqeust { parent: string; context: Context; - } +} - export interface UpdateContextRequest { +export interface UpdateContextRequest { context: Context; updatemask?: any; - } +} - export interface DeleteContextRequest { +export interface DeleteContextRequest { name: string; - } +} - export interface DeleteAllContextsRequest { +export interface DeleteAllContextsRequest { parent: string; - } +} - export interface ListEntityTypesRequest { +export interface ListEntityTypesRequest { parent: string; languageCode?: string; pageSize?: number; - } +} - export interface GetEntityTypeRequest { +export interface GetEntityTypeRequest { name: string; languageCode?: string; - } +} - export interface CreateEntityTypeRequest { +export interface CreateEntityTypeRequest { parent: string; entityType: EntityType; - } +} - export interface UpdateEntityTypeRequest { +export interface UpdateEntityTypeRequest { entityType: EntityType; languageCode?: string; /** @link https://github.com/google/protobuf/blob/master/src/google/protobuf/field_mask.proto */ updateMask?: any; - } +} - export interface DeleteEntityTypeRequest { +export interface DeleteEntityTypeRequest { name: string; - } +} - export interface ListIntentsRequest { +export interface ListIntentsRequest { parent: string; languageCode?: string; intentView?: IntentView; pageSize?: number; - } +} - export interface GetIntentRequest { +export interface GetIntentRequest { name: string; languageCode?: string; intentView?: IntentView; - } +} - export interface CreateIntentRequest { +export interface CreateIntentRequest { parent: string; intent: Intent; languageCode?: string; intentView?: IntentView; - } +} - export interface UpdateIntentRequest { +export interface UpdateIntentRequest { intent: Intent; languageCode?: string; updateMask?: any; intentView?: IntentView; - } +} - export interface DeleteIntentRequest { +export interface DeleteIntentRequest { name: string; - } +} - export interface DetectIntentRequest { +export interface DetectIntentRequest { session: string; queryInput: QueryInput; queryParams?: QueryParams; - inputAudio?: Buffer; - } + inputAudio?: any; +} - export interface DetectIntentResponse { +export interface DetectIntentResponse { responseId: string; queryResult: QueryResult; webhookStatus: Status; - } +} - export interface QueryResult { +export interface QueryResult { queryText: string; laugnageCode: string; speechRecognitionConfidence: number; @@ -551,15 +563,15 @@ export namespace v2 { intent: Intent; intentDetectionConfidence: number; diagnosticInfo: any; - } +} - export interface Status { +export interface Status { code: StatusCode; message: string; details: any[]; - } +} - export enum StatusCode { +export enum StatusCode { // Not an error; returned on success // // HTTP Mapping: 200 OK @@ -711,10 +723,10 @@ export namespace v2 { // Unrecoverable data loss or corruption. // // HTTP Mapping: 500 Internal Server Error - DATA_LOSS = 15, - } + DATA_LOSS = 15 +} - export interface Agent { +export interface Agent { parent: string; displayName: string; defaultLanguageCode: string; @@ -725,34 +737,34 @@ export namespace v2 { enableLogging?: boolean; matchMode?: MatchMode; classificationThreshold?: number; - } +} - export interface Context { +export interface Context { name: string; lifespanCount?: number; parameters?: any; - } +} - export interface EntityType { +export interface EntityType { name: string; entities: EntitySynonyms[]; displayName: string; kind: EntityKind; autoExpansionMode: EntityAutoExpansionMode; - } +} - export enum MatchMode { +export enum MatchMode { MATCH_MODE_UNSPECIFIED = "MATCH_MODE_UNSPECIFIED", MATCH_MODE_HYBRID = "MATCH_MODE_HYBRID", - MATCH_MODE_ML_ONLY = "MATCH_MODE_ML_ONLY", - } + MATCH_MODE_ML_ONLY = "MATCH_MODE_ML_ONLY" +} - export interface Credentials { +export interface Credentials { clientEmail?: string; privateKey?: string; - } +} - export interface ClientOptions { +export interface ClientOptions { credentials?: Credentials; email?: string; keyFilename?: string; @@ -760,29 +772,29 @@ export namespace v2 { projectId?: string; promise?: PromiseConstructor; servicePath?: string; - } +} - export interface EntitySynonyms { +export interface EntitySynonyms { synonyms: string[]; value: string; - } +} - export enum EntityKind { +export enum EntityKind { KIND_MAP = "KIND_MAP", - KIND_LIST = "KIND_LIST", - } + KIND_LIST = "KIND_LIST" +} - export enum EntityAutoExpansionMode { +export enum EntityAutoExpansionMode { AUTO_EXPANSION_MODE_DEFAULT = "AUTO_EXPANSION_MODE_DEFAULT", - AUTO_EXPANSION_MODE_UNSPECIFIED = "AUTO_EXPANSION_MODE_UNSPECIFIED", - } + AUTO_EXPANSION_MODE_UNSPECIFIED = "AUTO_EXPANSION_MODE_UNSPECIFIED" +} - export enum IntentView { +export enum IntentView { INTENT_VIEW_UNSPECIFIED = "INTENT_VIEW_UNSPECIFIED", - INTENT_VIEW_FULL = "INTENT_VIEW_FULL", - } + INTENT_VIEW_FULL = "INTENT_VIEW_FULL" +} - export interface Intent { +export interface Intent { name: string; displayName: string; webhookState: string; @@ -801,23 +813,23 @@ export namespace v2 { rootFollowupIntentName: string; parentFollowupIntentName: string; followupIntentInfo?: FollowupIntentInfo[]; - } +} - export interface TrainingPhrase { +export interface TrainingPhrase { name: string; type: string; parts: Part[]; timesAddedCount?: number; - } +} - export interface Part { +export interface Part { text: string; entityType?: string; alias?: string; userDefined?: boolean; - } +} - export interface Parameter { +export interface Parameter { name: string; displayName: string; value?: string; @@ -826,90 +838,90 @@ export namespace v2 { mandatory?: boolean; prompts?: string[]; isList?: boolean; - } +} - export interface FollowupIntentInfo { +export interface FollowupIntentInfo { followupIntentName: string; parentFollowupIntentName: string; - } +} - export interface Message { +export interface Message { platform?: string; text?: Text; card?: Card; payload?: any; - } +} - export interface Text { +export interface Text { text: string[]; - } +} - export interface Card { +export interface Card { title?: string; subtitle?: string; imageUri?: string; buttons?: Button[]; - } +} - export interface Button { +export interface Button { text?: string; postback?: string; - } +} - export interface EventInput { +export interface EventInput { name: string; languageCode: string; parameters?: any; - } +} - export interface TextInput { +export interface TextInput { text: string; languageCode: string; - } +} - export interface QueryInput { +export interface QueryInput { text?: TextInput; event?: EventInput; - } +} - export interface QueryParams { +export interface QueryParams { timeZone?: string; geoLocation?: LatLong; contexts?: Context[]; resetContexts?: boolean; sessionEntityTypes?: SessionEntityType[]; payload?: any; - } +} - export interface LatLong { +export interface LatLong { latitude: number; longitude: number; - } +} - export interface SessionEntityType { +export interface SessionEntityType { name: string; entityOverrideMode: string; entities: Entity[]; - } +} - export interface Entity { +export interface Entity { value: string; synonyms: string[]; - } +} - export interface WebhookRequest { +export interface WebhookRequest { session: string; responseId: string; queryResult: QueryResult; originalDetectIntentRequest?: any; - } +} - export interface WebhookResponse { +export interface WebhookResponse { fulfillmentText?: string; fulfillmentMessages?: Message[]; source?: string; payload?: any; outputContexts?: Context[]; followupEventInput?: EventInput; - } +} diff --git a/types/dialogflow/tsconfig.json b/types/dialogflow/tsconfig.json index 3133bd6dcb..366cf28866 100644 --- a/types/dialogflow/tsconfig.json +++ b/types/dialogflow/tsconfig.json @@ -7,11 +7,12 @@ "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, + "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ "../" ], - "types": ["node", "gax-nodejs"], + "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true }, From dcb8dc5ca2753474166f051ee6b0b407d1979f65 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Mon, 6 Aug 2018 10:36:53 -0700 Subject: [PATCH 15/94] polymer-ts: Ensure `PolymerBase#toggleAttribute` matches Element#toggleAttribute --- types/polymer-ts/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/polymer-ts/index.d.ts b/types/polymer-ts/index.d.ts index bf7daf936f..7ab10afa47 100644 --- a/types/polymer-ts/index.d.ts +++ b/types/polymer-ts/index.d.ts @@ -58,7 +58,7 @@ declare namespace polymer { setScrollDirection(direction: string, node: HTMLElement): void; shift(path: string, value: any): any; splice(path: string, start: number, deleteCount: number, ...items: any[]): any; - toggleAttribute(name: string, bool: boolean, node?: HTMLElement): void; + toggleAttribute(name: string, force?: boolean, node?: HTMLElement): boolean; toggleClass(name: string, bool: boolean, node?: HTMLElement): void; transform(transform: string, node?: HTMLElement): void; translate3d(x: any, y: any, z: any, node?: HTMLElement): void; From 1fad4c8cbdf5650a33a6391e34ea9386b40ce6eb Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Mon, 6 Aug 2018 10:33:44 -0700 Subject: [PATCH 16/94] phonegap: Fix "Notification" conflict with global interface --- types/phonegap/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/phonegap/index.d.ts b/types/phonegap/index.d.ts index 60ad5d2fd9..926140c3f9 100644 --- a/types/phonegap/index.d.ts +++ b/types/phonegap/index.d.ts @@ -526,7 +526,7 @@ declare var Media: { new(src: string, onSuccess: (arg: any) => any, onError: (error: any) => any): Media; } -interface Notification { +interface PhonegapNotification { alert(message: string, alertCallback: Function, title?: string, buttonName?: string): void; confirm(message: string, confirmCallback: Function, title?: string, buttonLabels?: string): void; confirm(message: string, confirmCallback: Function, title?: string, buttonLabels?: string[]): void; @@ -614,7 +614,7 @@ interface /*PhoneGapNavigator extends*/ Navigator { contacts: Contacts; device: Device; globalization: Globalization; - notification: Notification; + notification: PhonegapNotification; splashscreen: Splashscreen; } From 29b6ccff019e7652a060defe1c2bd3377af1a98e Mon Sep 17 00:00:00 2001 From: Alex Maclean Date: Tue, 7 Aug 2018 13:34:22 +1000 Subject: [PATCH 17/94] react sortable tree missing prop --- types/react-sortable-tree/index.d.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/types/react-sortable-tree/index.d.ts b/types/react-sortable-tree/index.d.ts index 0415db0414..3d0a7aa196 100644 --- a/types/react-sortable-tree/index.d.ts +++ b/types/react-sortable-tree/index.d.ts @@ -70,6 +70,12 @@ export interface OnDragPreviousAndNextLocation extends PreviousAndNextLocation { nextParent: TreeItem | null; } +export interface ShouldCopyData { + node: TreeItem, + prevPath: NumberArrayOrStringArray, + prevTreeIndex: number +} + export interface OnMovePreviousAndNextLocation extends PreviousAndNextLocation { nextParentNode: TreeItem | null; } @@ -186,6 +192,7 @@ export interface ReactSortableTreeProps { dndType?: string; placeholderRenderer?: PlaceholderRenderer; theme?: ThemeProps; + shouldCopyOnOutsideDrop?: boolean | ((data: ShouldCopyData) => boolean); } declare const SortableTree: React.ComponentClass; From f0d9be2343c4b9e499b9f618f6693cfcabdf4d0e Mon Sep 17 00:00:00 2001 From: Alex Maclean Date: Tue, 7 Aug 2018 13:36:39 +1000 Subject: [PATCH 18/94] Added myself! --- types/react-sortable-tree/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/react-sortable-tree/index.d.ts b/types/react-sortable-tree/index.d.ts index 3d0a7aa196..765cecf6c4 100644 --- a/types/react-sortable-tree/index.d.ts +++ b/types/react-sortable-tree/index.d.ts @@ -3,6 +3,7 @@ // Definitions by: Wouter Hardeman // Jovica Zoric // Kevin Perrine +// Alex Maclean // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 From b9cffcee563009ba1cad2fcf8e94432fc65b6abd Mon Sep 17 00:00:00 2001 From: Alex Maclean Date: Tue, 7 Aug 2018 14:27:33 +1000 Subject: [PATCH 19/94] semicolons? --- types/react-sortable-tree/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/react-sortable-tree/index.d.ts b/types/react-sortable-tree/index.d.ts index 765cecf6c4..e4678b399c 100644 --- a/types/react-sortable-tree/index.d.ts +++ b/types/react-sortable-tree/index.d.ts @@ -72,9 +72,9 @@ export interface OnDragPreviousAndNextLocation extends PreviousAndNextLocation { } export interface ShouldCopyData { - node: TreeItem, - prevPath: NumberArrayOrStringArray, - prevTreeIndex: number + node: TreeItem; + prevPath: NumberArrayOrStringArray; + prevTreeIndex: number; } export interface OnMovePreviousAndNextLocation extends PreviousAndNextLocation { From 4d292f7efdbd9ed8625bb52fd2117456fa0162b5 Mon Sep 17 00:00:00 2001 From: Alex Maclean Date: Tue, 7 Aug 2018 14:50:36 +1000 Subject: [PATCH 20/94] Fixed type --- types/react-sortable-tree/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-sortable-tree/index.d.ts b/types/react-sortable-tree/index.d.ts index e4678b399c..257e3aedf9 100644 --- a/types/react-sortable-tree/index.d.ts +++ b/types/react-sortable-tree/index.d.ts @@ -72,7 +72,7 @@ export interface OnDragPreviousAndNextLocation extends PreviousAndNextLocation { } export interface ShouldCopyData { - node: TreeItem; + node: TreeNode; prevPath: NumberArrayOrStringArray; prevTreeIndex: number; } From 9a2ef63a1e5fe4c1c7d3b75ea098402b88bc4977 Mon Sep 17 00:00:00 2001 From: Tyrone Dougherty Date: Tue, 7 Aug 2018 15:24:16 +1000 Subject: [PATCH 21/94] @types/highcharts - Add animation boolean parameter to the Chart#update method --- types/highcharts/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/highcharts/index.d.ts b/types/highcharts/index.d.ts index f24004fadb..afe1e51a98 100644 --- a/types/highcharts/index.d.ts +++ b/types/highcharts/index.d.ts @@ -6487,9 +6487,10 @@ declare namespace Highcharts { * @param [boolean] redraw Whether to redraw the chart. Defaults to true. * @param [boolean] oneToOne When true, the series, xAxis and yAxis collections will be updated one to one, and * items will be either added or removed to match the new updated options. Defaults to false. + * @param [boolean] animation Whether to apply animation, and optionally animation configuration. * @since 5.0.0 */ - update(options: Options, redraw?: boolean, oneToOne?: boolean): void; + update(options: Options, redraw?: boolean, oneToOne?: boolean, animation?: boolean): void; /** * This method is deprecated as of 2.0.1. Updating the chart position after a move operation is no longer necessary. * @since 1.2.5 From 0453260aef435a6b27221a2981f458ab5a52f291 Mon Sep 17 00:00:00 2001 From: Fabio Berta Date: Tue, 7 Aug 2018 15:05:30 +0200 Subject: [PATCH 22/94] add missing class properties --- types/viewport-mercator-project/index.d.ts | 58 +++++++++++++------ .../viewport-mercator-project-tests.ts | 2 + 2 files changed, 43 insertions(+), 17 deletions(-) diff --git a/types/viewport-mercator-project/index.d.ts b/types/viewport-mercator-project/index.d.ts index 4d93d755bd..1dd897229d 100644 --- a/types/viewport-mercator-project/index.d.ts +++ b/types/viewport-mercator-project/index.d.ts @@ -16,20 +16,26 @@ export type Coordinates = [number, number]; export type CoordinatesZ = [number, number, number]; +export type ViewMatrix = number[]; + +export type ProjectionMatrix = number[]; + export interface ViewportOptions { - width?: number; - height?: number; - longitude?: number; - latitude?: number; - zoom?: number; - pitch?: number; - bearing?: number; - altitude?: number; - farZMultiplier?: number; + width: number; + height: number; + viewMatrix?: ViewMatrix; + projectionMatrix?: ProjectionMatrix; } export class Viewport { + width: number; + height: number; + scale: number; + viewMatrix: ViewMatrix; + projectionMatrix: ProjectionMatrix; + constructor(opts?: ViewportOptions); + equals(viewport: Viewport): boolean; project(lngLat: Coordinates, opts?: ProjectOptions): Coordinates; project(lngLatZ: CoordinatesZ, opts?: ProjectOptions): CoordinatesZ; @@ -41,7 +47,32 @@ export type Padding = number | { top: number; right: number; bottom: number; lef export type Bounds = [Coordinates, Coordinates]; +export interface WebMercatorViewportOptions { + width?: number; + height?: number; + longitude?: number; + latitude?: number; + zoom?: number; + pitch?: number; + bearing?: number; + altitude?: number; + farZMultiplier?: number; +} + +// Type comes from https://github.com/uber-web/math.gl +export class Vector3 extends Array {} + export class WebMercatorViewport extends Viewport { + latitude: number; + longitude: number; + zoom: number; + pitch: number; + bearing: number; + altitude: number; + center: Vector3; + + constructor(opts?: WebMercatorViewportOptions); + projectFlat(lngLat: Coordinates, scale?: number): Coordinates; unprojectFlat(xy: Coordinates, scale?: number): Coordinates; getMapCenterByLngLatPosition(opts: { lngLat: Coordinates; pos: Coordinates }): Coordinates; @@ -78,14 +109,12 @@ export interface NormalizedViewportProps extends BaseViewportProps { export function normalizeViewportProps(props: ViewportProps): NormalizedViewportProps; -export function flyToViewport(startProps: BaseViewportProps, endProps: BaseViewportProps): BaseViewportProps; +export function flyToViewport(startProps: BaseViewportProps, endProps: BaseViewportProps, t: number): BaseViewportProps; export function lngLatToWorld(lngLat: Coordinates, scale: number): Coordinates; export function worldToLngLat(point: Coordinates, scale: number): Coordinates; -export type ProjectionMatrix = number[]; - export function worldToPixels(coordinates: Coordinates | CoordinatesZ, pixelProjectionMatrix: ProjectionMatrix): CoordinatesZ; export function pixelsToWorld(pixels: Coordinates | CoordinatesZ, pixelUnprojectionMatrix: ProjectionMatrix, targetZ?: number): CoordinatesZ; @@ -121,13 +150,8 @@ export function getDistanceScales(input: DistanceScalesInput): DistanceScales; export function getDistanceScales(input: HighPrecisionDistanceScalesInput): HighPrecisionDistanceScales; -// Type comes from https://github.com/uber-web/math.gl -export class Vector3 extends Array {} - export function getWorldPosition(input: { longitude: number; latitude: number; zoom: number; scale: number; meterOffset?: number; distanceScales?: DistanceScales }): Vector3; -export type ViewMatrix = number[]; - export function getViewMatrix(input: { height: number; pitch: number; bearing: number; altitude: number; center?: CoordinatesZ; flipY?: boolean }): ViewMatrix; export interface ProjectionParametersInput { diff --git a/types/viewport-mercator-project/viewport-mercator-project-tests.ts b/types/viewport-mercator-project/viewport-mercator-project-tests.ts index 5f2cc346b3..26fc54d466 100644 --- a/types/viewport-mercator-project/viewport-mercator-project-tests.ts +++ b/types/viewport-mercator-project/viewport-mercator-project-tests.ts @@ -6,6 +6,8 @@ import WebMercatorViewport, { const mercator = new WebMercatorViewport(); +const { width, height, scale, latitude, longitude, altitude, zoom, pitch, bearing, center, viewMatrix, projectionMatrix } = mercator; + const xy = mercator.project([0, 1]); const xyz = mercator.project([0, 1, 2]); From 29c908d7ad5fbbe1a5d0d807b2a86364a7977c94 Mon Sep 17 00:00:00 2001 From: Fabio Berta Date: Tue, 7 Aug 2018 15:08:43 +0200 Subject: [PATCH 23/94] width and height are optional --- types/viewport-mercator-project/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/viewport-mercator-project/index.d.ts b/types/viewport-mercator-project/index.d.ts index 1dd897229d..15b9fc373a 100644 --- a/types/viewport-mercator-project/index.d.ts +++ b/types/viewport-mercator-project/index.d.ts @@ -21,8 +21,8 @@ export type ViewMatrix = number[]; export type ProjectionMatrix = number[]; export interface ViewportOptions { - width: number; - height: number; + width?: number; + height?: number; viewMatrix?: ViewMatrix; projectionMatrix?: ProjectionMatrix; } From 98aaf81b5fdf6a2f7b3f1d719332740217f08381 Mon Sep 17 00:00:00 2001 From: James Garbutt <43081j@users.noreply.github.com> Date: Tue, 7 Aug 2018 15:06:35 +0100 Subject: [PATCH 24/94] [page] add `decodeURLComponents` option --- types/page/index.d.ts | 18 ++++++++++++------ types/page/page-tests.ts | 12 +++++++++++- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/types/page/index.d.ts b/types/page/index.d.ts index 0f9317c6a4..ef56afdc9b 100644 --- a/types/page/index.d.ts +++ b/types/page/index.d.ts @@ -1,7 +1,9 @@ // Type definitions for page v1.5.0 // Project: http://visionmedia.github.io/page.js/ // Definitions by: Alan Norbauer +// James Garbutt // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 declare namespace PageJS { interface Static { @@ -64,7 +66,7 @@ declare namespace PageJS { * * If you wish to load serve initial content from the server you likely will want to set dispatch to false. */ - (options: Options): void; + (options: Partial): void; /** * Register page's popstate / click bindings. If you're doing selective binding you'll like want to pass { click: false } to specify this yourself. The following options are available: * @@ -125,7 +127,7 @@ declare namespace PageJS { * * Identical to page([options]). */ - start(options: Options): void; + start(options: Partial): void; /** * Register page's popstate / click bindings. If you're doing selective binding you'll like want to pass { click: false } to specify this yourself. The following options are available: * @@ -205,19 +207,23 @@ declare namespace PageJS { /** * bind to click events (default = true) */ - click?: boolean; + click: boolean; /** * bind to popstate (default = true) */ - popstate?: boolean; + popstate: boolean; /** * perform initial dispatch (default = true) */ - dispatch?: boolean; + dispatch: boolean; /** * add #!before urls (default = false) */ - hashbang?: boolean; + hashbang: boolean; + /** + * remove URL encoding frfrom path components + */ + decodeURLComponents: boolean; } interface Callback { diff --git a/types/page/page-tests.ts b/types/page/page-tests.ts index 9d78998672..5d5b421d7e 100644 --- a/types/page/page-tests.ts +++ b/types/page/page-tests.ts @@ -13,6 +13,16 @@ page('/contact', contact); page('/contact/:contactName', contact); page('/contact/inline/:contactName', ctx => { }); page(); +page({ + click: false, + popstate: true, + dispatch: false, + hashbang: true, + decodeURLComponents: false +}); +page({ + hashbang: true +}); var index: PageJS.Callback = function() { document.querySelector('p') @@ -82,4 +92,4 @@ var show: PageJS.Callback = function (ctx) { function notfound() { document.querySelector('p') .textContent = 'not found'; -} \ No newline at end of file +} From 496621c80d1dea2ba5671edfde3397cb42f9a0fa Mon Sep 17 00:00:00 2001 From: Shalom Peles Date: Tue, 7 Aug 2018 19:10:51 +0300 Subject: [PATCH 25/94] add types for intrinsic-scale --- types/intrinsic-scale/index.d.ts | 15 ++++++++++++ .../intrinsic-scale/intrinsic-scale-tests.ts | 4 ++++ types/intrinsic-scale/tsconfig.json | 23 +++++++++++++++++++ types/intrinsic-scale/tslint.json | 1 + 4 files changed, 43 insertions(+) create mode 100644 types/intrinsic-scale/index.d.ts create mode 100644 types/intrinsic-scale/intrinsic-scale-tests.ts create mode 100644 types/intrinsic-scale/tsconfig.json create mode 100644 types/intrinsic-scale/tslint.json diff --git a/types/intrinsic-scale/index.d.ts b/types/intrinsic-scale/index.d.ts new file mode 100644 index 0000000000..7d61d2135e --- /dev/null +++ b/types/intrinsic-scale/index.d.ts @@ -0,0 +1,15 @@ +// Type definitions for intrinsic-scale 3.0 +// Project: https://github.com/bfred-it/intrinsic-scale#readme +// Definitions by: My Self +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + + +export function contain(parentWidth: number, parentHeight: number, childWidth: number, childHeight: number): IntrinsicScale; +export function cover(parentWidth: number, parentHeight: number, childWidth: number, childHeight: number): IntrinsicScale; + +export interface IntrinsicScale { + width: number, + height: number, + x: number, + y: number +} diff --git a/types/intrinsic-scale/intrinsic-scale-tests.ts b/types/intrinsic-scale/intrinsic-scale-tests.ts new file mode 100644 index 0000000000..714620478d --- /dev/null +++ b/types/intrinsic-scale/intrinsic-scale-tests.ts @@ -0,0 +1,4 @@ +import { cover, contain } from "."; + +const intrinsicScale = cover(100, 100, 50, 50); +const { x, y, width, height } = contain(1,2,3,4); diff --git a/types/intrinsic-scale/tsconfig.json b/types/intrinsic-scale/tsconfig.json new file mode 100644 index 0000000000..8fcff6913d --- /dev/null +++ b/types/intrinsic-scale/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", + "intrinsic-scale-tests.ts" + ] +} \ No newline at end of file diff --git a/types/intrinsic-scale/tslint.json b/types/intrinsic-scale/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/intrinsic-scale/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From a247b4cbcaf17d88d9201ecffba3aecbb7aa2264 Mon Sep 17 00:00:00 2001 From: Shalom Peles Date: Tue, 7 Aug 2018 19:15:42 +0300 Subject: [PATCH 26/94] fix lint errors --- types/intrinsic-scale/index.d.ts | 9 ++++----- types/intrinsic-scale/intrinsic-scale-tests.ts | 4 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/types/intrinsic-scale/index.d.ts b/types/intrinsic-scale/index.d.ts index 7d61d2135e..a2233cf69b 100644 --- a/types/intrinsic-scale/index.d.ts +++ b/types/intrinsic-scale/index.d.ts @@ -3,13 +3,12 @@ // Definitions by: My Self // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - export function contain(parentWidth: number, parentHeight: number, childWidth: number, childHeight: number): IntrinsicScale; export function cover(parentWidth: number, parentHeight: number, childWidth: number, childHeight: number): IntrinsicScale; export interface IntrinsicScale { - width: number, - height: number, - x: number, - y: number + width: number; + height: number; + x: number; + y: number; } diff --git a/types/intrinsic-scale/intrinsic-scale-tests.ts b/types/intrinsic-scale/intrinsic-scale-tests.ts index 714620478d..23c450572b 100644 --- a/types/intrinsic-scale/intrinsic-scale-tests.ts +++ b/types/intrinsic-scale/intrinsic-scale-tests.ts @@ -1,4 +1,4 @@ -import { cover, contain } from "."; +import { cover, contain } from "intrinsic-scale"; const intrinsicScale = cover(100, 100, 50, 50); -const { x, y, width, height } = contain(1,2,3,4); +const { x, y, width, height } = contain(1, 2, 3, 4); From 26fb039b45d56ba247efe8c1e114eb5f80b4b6fe Mon Sep 17 00:00:00 2001 From: Dima Danyliuk Date: Tue, 7 Aug 2018 21:38:31 +0300 Subject: [PATCH 27/94] Update types for "react-input-mask" v2.0.3 --- types/react-input-mask/v2/index.d.ts | 75 +++++++++++++++++++ .../v2/react-input-mask-tests.tsx | 13 ++++ types/react-input-mask/v2/tsconfig.json | 28 +++++++ types/react-input-mask/v2/tslint.json | 3 + 4 files changed, 119 insertions(+) create mode 100644 types/react-input-mask/v2/index.d.ts create mode 100644 types/react-input-mask/v2/react-input-mask-tests.tsx create mode 100644 types/react-input-mask/v2/tsconfig.json create mode 100644 types/react-input-mask/v2/tslint.json diff --git a/types/react-input-mask/v2/index.d.ts b/types/react-input-mask/v2/index.d.ts new file mode 100644 index 0000000000..5f36857eac --- /dev/null +++ b/types/react-input-mask/v2/index.d.ts @@ -0,0 +1,75 @@ +// Type definitions for react-input-mask 2.0.3 +// Project: https://github.com/sanniassin/react-input-mask +// Definitions by: Alexandre Paré +// Dima Danylyuk +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.9.2 + +declare module 'react-input-mask' { + import * as React from 'react'; + + export interface InputState { + value: string; + selection: Selection; + } + + export interface MaskOptions { + mask: string; + maskChar: string; + alwaysShowMask: boolean; + formatChars: Record; + permanents: number[]; + } + + interface Props extends React.InputHTMLAttributes { + /** + * Mask string. Format characters are: + * * `9`: `0-9` + * * `a`: `A-Z, a-z` + * * `\*`: `A-Z, a-z, 0-9` + * + * Any character can be escaped with backslash, which usually will appear as double backslash in JS strings. + * For example, German phone mask with unremoveable prefix +49 will look like `mask="+4\\9 99 999 99"` or `mask={"+4\\\\9 99 999 99"}` + */ + mask: string; + /** + * Character to cover unfilled editable parts of mask. Default character is "_". If set to null, unfilled parts will be empty, like in ordinary input. + */ + maskChar?: string | null; + /** + * Defines format characters with characters as keys and corresponding RegExp string as values. Default ones: + * ``` + * { + * "9": "[0-9]", + * "a": "[A-Za-z]", + * "*": "[A-Za-z0-9]" + * }``` + */ + formatChars?: { [key: string]: string }; + /** + * Show mask even in empty input without focus. + */ + alwaysShowMask?: boolean; + /** + * Use inputRef instead of ref if you need input node to manage focus, selection, etc. + */ + inputRef?: React.Ref; + + /** + * In case you need to implement more complex masking behavior, you can provide + * beforeMaskedValueChange function to change masked value and cursor position + * before it will be applied to the input. + */ + beforeMaskedValueChange?( + newState: InputState, + oldState: InputState, + userInput: string, + maskOptions: MaskOptions, + ): InputState; + } + + class ReactInputMask extends React.Component { + } + + export default ReactInputMask; +} diff --git a/types/react-input-mask/v2/react-input-mask-tests.tsx b/types/react-input-mask/v2/react-input-mask-tests.tsx new file mode 100644 index 0000000000..93c6b1f638 --- /dev/null +++ b/types/react-input-mask/v2/react-input-mask-tests.tsx @@ -0,0 +1,13 @@ +import ReactInputMask from 'react-input-mask'; +import * as React from 'react'; + +let ref: HTMLInputElement | null = null; + +
+ + + + + + ref = node} /> +
; diff --git a/types/react-input-mask/v2/tsconfig.json b/types/react-input-mask/v2/tsconfig.json new file mode 100644 index 0000000000..8b19948640 --- /dev/null +++ b/types/react-input-mask/v2/tsconfig.json @@ -0,0 +1,28 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "jsx": "react", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "paths": { + "react-input-mask": ["react-input-mask/v2"] + } + }, + "files": [ + "index.d.ts", + "react-input-mask-tests.tsx" + ] +} \ No newline at end of file diff --git a/types/react-input-mask/v2/tslint.json b/types/react-input-mask/v2/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/react-input-mask/v2/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} From 653ac8f1f7c0c53d9dca00ee59ea6259780fc736 Mon Sep 17 00:00:00 2001 From: shalomdotnet Date: Wed, 8 Aug 2018 05:20:30 +0300 Subject: [PATCH 28/94] add my github account --- types/intrinsic-scale/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/intrinsic-scale/index.d.ts b/types/intrinsic-scale/index.d.ts index a2233cf69b..56100aeb25 100644 --- a/types/intrinsic-scale/index.d.ts +++ b/types/intrinsic-scale/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for intrinsic-scale 3.0 // Project: https://github.com/bfred-it/intrinsic-scale#readme -// Definitions by: My Self +// Definitions by: shalomdotnet // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export function contain(parentWidth: number, parentHeight: number, childWidth: number, childHeight: number): IntrinsicScale; From bc0d108148258976cdc404b4eb6d2bf83bf6c5da Mon Sep 17 00:00:00 2001 From: taoqf Date: Wed, 8 Aug 2018 15:23:50 +0800 Subject: [PATCH 29/94] add type defination qiniu-js --- types/qiniu-js/index.d.ts | 371 +++++++++++++++++++++++++++++++ types/qiniu-js/qiniu-js-tests.ts | 50 +++++ types/qiniu-js/tsconfig.json | 24 ++ types/qiniu-js/tslint.json | 1 + 4 files changed, 446 insertions(+) create mode 100644 types/qiniu-js/index.d.ts create mode 100644 types/qiniu-js/qiniu-js-tests.ts create mode 100644 types/qiniu-js/tsconfig.json create mode 100644 types/qiniu-js/tslint.json diff --git a/types/qiniu-js/index.d.ts b/types/qiniu-js/index.d.ts new file mode 100644 index 0000000000..b47bc0528e --- /dev/null +++ b/types/qiniu-js/index.d.ts @@ -0,0 +1,371 @@ +// Type definitions for qiniu-js 2.4 +// Project: https://github.com/qiniu/js-sdk#readme +// Definitions by: taoqf +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +export as namespace qiniu; + +export interface Next { + total: { + loaded: number; // 已上传大小,单位为字节。 + total: number; // 本次上传的总量控制信息,单位为字节,注意这里的 total 跟文件大小并不一致。 + percent: number; // 当前上传进度,范围:0~100。 + }; +} + +export interface Error { + code: number; // 请求错误状态码,只有在 err.isRequestError 为 true 的时候才有效。可查阅码值对应说明。 + message: string; // 错误信息,包含错误码,当后端返回提示信息时也会有相应的错误信息。 + isRequestError: true | undefined; // 用于区分是否 xhr 请求错误;当 xhr 请求出现错误并且后端通过 HTTP 状态码返回了错误信息时,该参数为 true;否则为 undefined 。 + reqId: string; // xhr请求错误的 X-Reqid。 +} + +export interface AudioInfo { + bit_rate: string; + channels: number; + codec_name: string; + codec_type: string; + duration: string; + index: number; + nb_frames: string; + r_frame_rate: string; + sample_fmt: string; + sample_rate: string; + start_time: string; + tags: { + creation_time: string; + [key: string]: string; + }; +} + +export interface AvFormat { + bit_rate: string; + duration: string; + format_long_name: string; + format_name: string; + nb_streams: number; + size: string; + start_time: string; + tags: { + creation_time: string; + [key: string]: string; + }; +} + +export interface VideoInfo { + bit_rate: string; + codec_name: string; + codec_type: string; + display_aspect_ratio: string; + duration: string; + height: number; + index: number; + nb_frames: string; + pix_fmt: string; + r_frame_rate: string; + sample_aspect_ratio: string; + start_time: string; + tags: { + creation_time: string; + [key: string]: string; + }; + width: number; +} + +export interface AvAudioInfo { + audio: AudioInfo; + format: AvFormat; + video: VideoInfo; +} + +export interface AvImageInfo { + format: string; + width: number; + height: number; + colorModel: string; +} + +export interface CompletedResult { + avinfo?: AvAudioInfo; + imageInfo?: AvImageInfo; + key: string; + name: string; + size: number; + persistentid: string; + sec: string; + ext: string; + bucket: string; +} + +export interface Observer { + next(res: Next): void; + error(err: Error | string): void; + complete(res: CompletedResult): void; +} + +export interface Subscription { + unsubscribe(): void; +} + +export interface Observable { + subscribe(options: Observer): Subscription; + /** + * 订阅 + * + * @param next 接收上传进度信息 + * @param error 上传错误后触发;自动重试本身并不会触发该错误,而当重试次数到达上限后则可以触发。当不是 xhr 请求错误时,会把当前错误产生原因直接抛出,诸如 JSON 解析异常等;当产生 xhr 请求错误时,参数 err 为一个包含 code、message、isRequestError 三个属性的 object + * @param complete 接收上传完成后的后端返回信息,具体返回结构取决于后端sdk的配置,可参考[上传策略](https://developer.qiniu.com/kodo/manual/1206/put-policy)。 + * @returns + */ + subscribe(next: (obj: Next) => void, error?: (err: Error | string) => void, complete?: (obj: CompletedResult) => void): Subscription; +} + +export interface Extra { + fname: string; // 文件原文件名 + params: any; // 用来放置自定义变量 + mimeType: string[] | null; // 用来限制上传文件类型,为 null 时表示不对文件类型限制;限制类型放到数组里: ["image/png", "image/jpeg", "image/gif"] +} + +export interface Config { + useCdnDomain: boolean; + region: Region | string; +} + +/** + * 上传文件 + * @param file Blob 对象,上传的文件 + * @param key 文件资源名 + * @param token 上传验证信息,前端通过接口请求后端获得 + * @param putExtra + * @param config + */ +export function upload(file: Blob, key: string | null | undefined, token: string, putExtra: Partial, config: Partial): Observable; + +/** + * 返回创建文件的 url;当分片上传时,我们需要把分片返回的 ctx 信息拼接后通过该 url 上传给七牛以创建文件。 + * + * @param url 上传域名,可以通过qiniu.getUploadUrl()获得 + * @param size 文件大小 + * @param key 文件资源名 + * @param putExtra + * @returns + */ +export function createMkFileUrl(url: string, size: number, key: string, putExtra: Partial): string; + +export enum Region { + z0, // 代表华东区域 + z1, // 代表华北区域 + z2, // 代表华南区域 + na0, // 代表北美区域 + as0 // 代表新加坡区域 +} + +export namespace region { + const z0: Region; + const z1: Region; + const z2: Region; + const na0: Region; + const as0: Region; +} + +/** + * 接收参数为 config 对象,返回根据 config 里所配置信息的上传域名 + * + * @param config + * @param token + * @returns + */ +export function getUploadUrl(config: Partial, token: string): Promise; + +export interface Headers { + [key: string]: string; +} + +/** + * 返回 object,包含用来获得分片上传设置的头信息,参数为 token 字符串;当分片上传时,请求需要带该函数返回的头信息 + * + * @param token + * @returns + */ +export function getHeadersForChunkUpload(token: string): Headers; + +/** + * 返回 object,包含用来获得文件创建的头信息,参数为 token 字符串;当分片上传完需要把 ctx 信息传给七牛用来创建文件时,请求需要带该函数返回的头信息 + * + * @param token + * @returns + */ +export function getHeadersForMkFile(token: string): Headers; + +/** + * 返回[[k, v],...]格式的数组,k 为自定义变量 key 名,v 为自定义变量值,用来提取 putExtra.params 包含的自定义变量 + * + * @param params + * @returns + */ +export function filterParams(params: any): Array<[string, any]>; + +export interface CompressOptions { + quality: number; // 图片压缩质量,在图片格式为 image/jpeg 或 image/webp 的情况下生效,其他格式不会生效,可以从 0 到 1 的区间内选择图片的质量。默认值 0.92 + maxWidh: number; // 压缩图片的最大宽度值 + maxHeight: number; // 压缩图片的最大高度值 (注意:当 maxWidth 和 maxHeight 都不设置时,则采用原图尺寸大小) + noCompressIfLarger: boolean; // 为 true 时如果发现压缩后图片大小比原来还大,则返回源图片(即输出的 dist 直接返回了输入的 file);默认 false,即保证图片尺寸符合要求,但不保证压缩后的图片体积一定变小 +} + +/** + * 上传前图片压缩 + * + * @param file 要压缩的源图片,为 blob 对象,支持 image/png、image/jpeg、image/bmp、image/webp 这几种图片类型 + * @param options + * @returns + */ +export function compressImage(file: Blob, options: Partial): Promise<{ + dist: Blob; // 压缩后输出的 blob 对象,或原始的 file,具体看下面的 options 配置 + width: number; // 压缩后的图片宽度 + height: number; // 压缩后的图片高度 +}>; + +export interface WaterMarkOptions1 { + mode: 1; // 图片水印 + image: string; // 图片水印的Url,mode = 1 时 **必需** + dissolve: number; // 透明度,取值范围1-100,非必需,下同 + gravity: 'NorthWest' | 'North' | 'NorthEast' | 'West' | 'Center' | 'East' | 'SouthWest' | 'South' | 'SouthEast'; // 水印位置 + dx: number; // 横轴边距,单位:像素(px) + dy: number; // 纵轴边距,单位:像素(px) +} + +export interface WaterMarkOptions2 { + mode: 2; // 文字水印 + text: string; // 水印文字,mode = 2 时 **必需** + dissolve: number; // 透明度,取值范围1-100,非必需,下同 + gravity: 'NorthWest' | 'North' | 'NorthEast' | 'West' | 'Center' | 'East' | 'SouthWest' | 'South' | 'SouthEast'; // 水印位置 + fontsize: number; // 字体大小,单位: 缇 + font: string; // 水印文字字体 + dx: number; // 横轴边距,单位:像素(px) + dy: number; // 纵轴边距,单位:像素(px) + fill: string; // 水印文字颜色,RGB格式,可以是颜色名称 +} + +/** + * 水印 + * + * @param options 包含的具体水印参数解释见水印([watermark](https://developer.qiniu.com/dora/manual/1316/image-watermarking-processing-watermark)) + * @param key 文件资源名 + * @param domain 为七牛空间(bucket)对应的域名,选择某个空间后,可通过"空间设置->基本设置->域名设置"查看获取,前端可以通过接口请求后端得到 + * @returns 返回添加水印后的图片地址,可以赋值给 html 的 img 元素的 src 属性, 若未指定key,可以通过以下方式获得完整的 imgLink + * `imgLink = '/?' + imgLink` + * 为七牛空间(bucket)对应的域名,选择某个空间后,可通过"空间设置->基本设置->域名设置"查看获取 + */ +export function watermark(options: WaterMarkOptions1 | WaterMarkOptions2, key?: string, domain?: string): string; + +export interface ImageView2Options { + mode: 0 | 1 | 2 | 3 | 4 | 5; // 缩略模式,共6种[0-5] + w: number; // 具体含义由缩略模式决定 + h: number; // 具体含义由缩略模式决定 + q: number; // 新图的图像质量,取值范围:1-100 + format: 'jpg' | 'gif' | 'png' | 'webp' | string; // 新图的输出格式,取值范围:jpg,gif,png,webp等 +} + +/** + * 缩略 + * + * @param options 具体缩略参数解释见[图片基本处理(imageView2)](https://developer.qiniu.com/dora/manual/1279/basic-processing-images-imageview2) + * @param key + * @param domain + * @returns 返回处理后的图片url + */ +export function imageView2(options: Partial, key: string, domain: string): string; + +export interface ImageMogr2Options { + 'auto-orient': boolean; // 布尔值,是否根据原图EXIF信息自动旋正,便于后续处理,建议放在首位。 + strip: boolean; // 布尔值,是否去除图片中的元信息 + thumbnail: string; // 缩放操作参数 + crop: string; // 裁剪操作参数 + gravity: string; // 裁剪锚点参数 + quality: number; // 图片质量,取值范围1-100 + rotate: number; // 旋转角度,取值范围1-360,缺省为不旋转。 + format: string; // 新图的输出格式,取值范围:jpg,gif,png,webp等 + blur: string; // 高斯模糊参数 +} + +/** + * 返回处理后的图片url + * + * @param optoins 具体高级图像处理参数解释见[图像高级处理(imageMogr2)](https://developer.qiniu.com/dora/manual/1270/the-advanced-treatment-of-images-imagemogr2) + * @param key + * @param domain + * @returns 返回处理后的图片url + */ +export function imageMogr2(optoins: Partial, key: string, domain: string): string; + +export interface ImageInfo { + size: number; // 文件大小,单位:Bytes + format: 'png' | 'jpeg' | 'gif' | 'bmp'; // 图片类型,如png、jpeg、gif、bmp等。 + width: number; // 图片宽度,单位:像素(px) 。 + height: number; // 图片高度,单位:像素(px) 。 + colorModel: string; // 彩色空间,如palette16、ycbcr等。 + frameNumber: number; // 帧数,gif 图片会返回此项。 +} + +/** + * + * 图片基本信息 + * 具体 imageInfo 解释见[图片基本信息(imageInfo)](https://developer.qiniu.com/dora/manual/1269/pictures-basic-information-imageinfo) + * + * @param key + * @param domain + * @returns + */ +export function imageInfo(key: string, domain: string): Promise; + +export interface ExtendedInfo { + code: number; + error: string; + [key: string]: { + type: number; + val: string; + } | number | string; +} + +export interface ExtentInfoValue { + type: number; + val: string; +} + +export interface ExtentInfo { + [key: string]: ExtentInfoValue; + DateTime: ExtentInfoValue; + ExposureBiasValue: ExtentInfoValue; + ExposureTime: ExtentInfoValue; + Model: ExtentInfoValue; + ISOSpeedRatings: ExtentInfoValue; + ResolutionUnit: ExtentInfoValue; +} + +/** + * EXIF 信息 + * 具体 exif 解释见[图片 EXIF 信息(exif)](https://developer.qiniu.com/dora/manual/1260/photo-exif-information-exif) + * @param key + * @param domain + * @returns + */ +export function exif(key: string, domain: string): Promise; + +export interface WaterMarkFopOptions1 extends WaterMarkOptions1 { + fop: 'watermark'; +} + +export interface WaterMarkFopOptions2 extends WaterMarkOptions2 { + fop: 'watermark'; +} + +export interface ImageView2FopOptions extends ImageView2Options { + fop: 'imageView2'; +} + +export interface ImageMogr2FopOptions extends ImageMogr2Options { + fop: 'imageMogr2'; +} + +export function pipeline(fos: Array<(WaterMarkFopOptions1 | WaterMarkFopOptions2 | ImageView2FopOptions | ImageMogr2FopOptions)>, key: string, domain: string): string; diff --git a/types/qiniu-js/qiniu-js-tests.ts b/types/qiniu-js/qiniu-js-tests.ts new file mode 100644 index 0000000000..344f38b195 --- /dev/null +++ b/types/qiniu-js/qiniu-js-tests.ts @@ -0,0 +1,50 @@ +import { compressImage, region, upload } from 'qiniu-js'; + +const file: Blob = null as any; + +const config = { + useCdnDomain: true, + region: region.z2 +}; + +const key = 'key'; +const token = 'token'; + +const putExtra = { + fname: "", + params: {}, + mimeType: [] || null +}; + +(() => { + const observable = upload(file, key, token, putExtra, config); + + const subscription = observable.subscribe({ + next(res) { }, + complete(res) { }, + error(err) { } + }); // 上传开始 + subscription.unsubscribe(); // 上传取消 +})(); + +(() => { + const observable = upload(file, key, token, putExtra, config); + const subscription = observable.subscribe((res) => { }, (err) => { }, (res) => { }); // 这样传参形式也可以 +})(); + +(async () => { + // 图片上传前压缩: + const options = { + quality: 0.92, + noCompressIfLarger: true + // maxWidth: 1000, + // maxHeight: 618 + }; + const data = await compressImage(file, options); + const observable = upload(data.dist, key, token, putExtra, config); + const subscription = observable.subscribe({ + next(res) { }, + complete(res) { }, + error(err) { } + }); // 上传开始 +})(); diff --git a/types/qiniu-js/tsconfig.json b/types/qiniu-js/tsconfig.json new file mode 100644 index 0000000000..f8bc0667b7 --- /dev/null +++ b/types/qiniu-js/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "strictFunctionTypes": true, + "lib": [ + "dom", + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "qiniu-js-tests.ts" + ] +} \ No newline at end of file diff --git a/types/qiniu-js/tslint.json b/types/qiniu-js/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/qiniu-js/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From b42b620eab47bddd3dfaf66a3f0c36afe6c27736 Mon Sep 17 00:00:00 2001 From: Hassansin Date: Wed, 8 Aug 2018 14:35:24 +0600 Subject: [PATCH 30/94] Added definitions for `chartmogul-node` package * Added definitions for chartmogul-node [ch3038] * Added arpa [ch3038] * Added error definitions [ch3038] --- .../chartmogul-node/chartmogul-node-tests.ts | 277 ++++++++++++ types/chartmogul-node/common.d.ts | 28 ++ types/chartmogul-node/index.d.ts | 410 ++++++++++++++++++ types/chartmogul-node/tsconfig.json | 23 + types/chartmogul-node/tslint.json | 1 + 5 files changed, 739 insertions(+) create mode 100644 types/chartmogul-node/chartmogul-node-tests.ts create mode 100644 types/chartmogul-node/common.d.ts create mode 100644 types/chartmogul-node/index.d.ts create mode 100644 types/chartmogul-node/tsconfig.json create mode 100644 types/chartmogul-node/tslint.json diff --git a/types/chartmogul-node/chartmogul-node-tests.ts b/types/chartmogul-node/chartmogul-node-tests.ts new file mode 100644 index 0000000000..3a09a7597c --- /dev/null +++ b/types/chartmogul-node/chartmogul-node-tests.ts @@ -0,0 +1,277 @@ +import * as ChartMogul from 'chartmogul-node'; + +const config = new ChartMogul.Config("token", "secret", "baseURL"); +config.retries = 10; +config.getAccountToken(); // $ExpectType string +config.getSecretKey(); // $ExpectType string +config.VERSION; // $ExpectType string + +ChartMogul.Ping.ping(config); // $ExpectType Promise + +// $ExpectType Promise +ChartMogul.DataSource.create(config, { + name: "" +}); + +// $ExpectType Promise +ChartMogul.DataSource.retrieve(config, ""); + +// $ExpectType Promise<{}> +ChartMogul.DataSource.destroy(config, ""); + +// $ExpectType Promise +ChartMogul.DataSource.all(config, { + name: "" +}); + +ChartMogul.DataSource.all(config).then(data => { + data.data_sources[0]; // $ExpectType DataSource + data.data_sources[0].name; // $ExpectType string +}); + +// $ExpectType Promise +ChartMogul.Customer.create(config, { + data_source_uuid: "", + name: "", + external_id: "", + attributes: { + tags: ["important", "Prio1"], + custom: [ + {type: "String", key: "channel", value: "Facebook", source: "integration"}, + {type: "Integer", key: "age", value: 18} + ] + } +}); + +// $ExpectType Promise +ChartMogul.Customer.retrieve(config, ""); + +// $ExpectType Promise +ChartMogul.Customer.modify(config, "", {}); + +// $ExpectType Promise<{}> +ChartMogul.Customer.destroy(config, ""); + +// $ExpectType Promise> +ChartMogul.Customer.all(config, { + data_source_uuid: "" +}); + +ChartMogul.Customer.all(config).then(data => { + data.entries[0]; // $ExpectType Customer + data.entries[0].attributes!.stripe!['something']; // $ExpectType any + data.page!; // $ExpectType number +}); + +// $ExpectType Promise> +ChartMogul.Customer.search(config, { + email: "" +}); +// $ExpectType Promise<{}> +ChartMogul.Customer.merge(config, { + from: {customer_uuid: ""}, + into: {customer_uuid: ""} +}); +// $ExpectType Promise +ChartMogul.Customer.attributes(config, ""); + +// $ExpectType Promise +ChartMogul.Plan.create(config, { + data_source_uuid: "", + name: "", + interval_count: 1, + interval_unit: "", + external_id: "" +}); + +// $ExpectType Promise +ChartMogul.Plan.retrieve(config, ""); + +// $ExpectType Promise +ChartMogul.Plan.modify(config, "", { + name: "" +}); + +// $ExpectType Promise<{}> +ChartMogul.Plan.destroy(config, ""); + +ChartMogul.Plan.all(config, { + page: 1 +}).then(data => { + data.plans[0]; // $ExpectType Plan + data.plans[0].name!; // $ExpectType string + data.page!; // $ExpectType number +}); + +// $ExpectType Promise +ChartMogul.Invoice.retrieve(config, ""); + +// $ExpectType Promise +ChartMogul.Invoice.create(config, "", { + invoices: [ + { + external_id: "" + } + ] +}); + +// $ExpectType Promise<{}> +ChartMogul.Invoice.destroy(config, ""); +ChartMogul.Invoice.all(config, { + external_id: "" +}).then(data => { + data.invoices[0]; // $ExpectType Invoice + data.invoices[0].uuid!; // $ExpectType string + data.page!; // $ExpectType number +}); + +ChartMogul.Invoice.all(config, "", { + page: 1 +}).then(data => { + data.customer_uuid!; // $ExpectType string + data.invoices[0]; // $ExpectType Invoice + data.invoices[0].uuid!; // $ExpectType string + data.page!; // $ExpectType number +}); + +// $ExpectType Promise +ChartMogul.Transaction.create(config, "", { + type: "", + date: "", + result: "" +}); + +ChartMogul.Subscription.all(config, "", { + page: 1 +}).then(data => { + data.customer_uuid!; // $ExpectType string + data.subscriptions[0]; // $ExpectType Subscription + data.subscriptions[0].uuid; // $ExpectType string + data.current_page!; // $ExpectType number +}); + +ChartMogul.Subscription.cancel(config, "", { + cancelled_at: "" +}).then(data => { + data.customer_uuid; // $ExpectType string +}); + +// $ExpectType Promise> +ChartMogul.Tag.add(config, "", { + email: "", + tags: [""] +}); + +// $ExpectType Promise +ChartMogul.Tag.add(config, "", { + tags: [""] +}); + +// $ExpectType Promise +ChartMogul.Tag.remove(config, "", { + tags: [""] +}); + +// $ExpectType Promise +ChartMogul.CustomAttribute.add(config, "", { + custom: [ + {type: "", key: "", value: 0} + ] +}); +// $ExpectType Promise> +ChartMogul.CustomAttribute.add(config, "", { + email: "", + custom: [ + {type: "", key: "", value: 0} + ] +}); + +// $ExpectType Promise +ChartMogul.CustomAttribute.update(config, "", { + custom: { + pro: true, + channel: "" + } +}); + +ChartMogul.CustomAttribute.remove(config, "", { + custom: [""] +}).then(data => { + data.custom["key"]; // $ExpectType any +}); + +// $ExpectType Promise +ChartMogul.Metrics.all(config, { + 'start-date': '2015-01-01', + 'end-date': '2015-11-24', + interval: '', + geo: '', + plans: '' +}); + +// $ExpectType Promise> +ChartMogul.Metrics.mrr(config, { + 'start-date': '2015-01-01', + 'end-date': '2015-11-01' +}); + +// $ExpectType Promise> +ChartMogul.Metrics.arr(config, { + 'start-date': '2015-01-01', + 'end-date': '2015-11-01' +}); + +// $ExpectType Promise> +ChartMogul.Metrics.arpa(config, { + 'start-date': '2015-01-01', + 'end-date': '2015-11-01' +}); + +// $ExpectType Promise> +ChartMogul.Metrics.asp(config, { + 'start-date': '2015-01-01', + 'end-date': '2015-11-01' +}); + +// $ExpectType Promise> +ChartMogul.Metrics.customerCount(config, { + 'start-date': '2015-01-01', + 'end-date': '2015-11-01' +}); + +// $ExpectType Promise> +ChartMogul.Metrics.customerChurnRate(config, { + 'start-date': '2015-01-01', + 'end-date': '2015-11-01', + geo: '', + plans: '' +}); + +// $ExpectType Promise> +ChartMogul.Metrics.mrrChurnRate(config, { + 'start-date': '2015-01-01', + 'end-date': '2015-11-01' +}); + +ChartMogul.Metrics.ltv(config, { + 'start-date': '2015-01-01', + 'end-date': '2015-11-01' +}).then(data => { + data.entries[0].ltv; // $ExpectType number + data.summary; // $ExpectType Summary + data.summary.current; // $ExpectType number +}); + +// $ExpectType Promise> +ChartMogul.Metrics.Customer.subscriptions(config, "", { + page: 1 +}); + +ChartMogul.Metrics.Customer.activities(config, "", { + page: 1 +}).then(data => { + data.entries; // $ExpectType MetricsActivity[] + data.entries[0]; // $ExpectType MetricsActivity + data.entries[0]['activity-mrr']; // $ExpectType number + data.page!; // $ExpectType number +}); diff --git a/types/chartmogul-node/common.d.ts b/types/chartmogul-node/common.d.ts new file mode 100644 index 0000000000..ced10f98d7 --- /dev/null +++ b/types/chartmogul-node/common.d.ts @@ -0,0 +1,28 @@ +export interface Map { + [key: string]: any +} +export interface CursorParams { + page?: number; + per_page?: number; +} +export type Strings = string[]; + +export interface Cursor { + page?: number; + per_page?: number; + has_more?: boolean; + current_page?: number; + total_pages?: number; +} +export interface Entries extends Cursor { + entries: T[] +} +interface Summary { + current: number; + previous: number; + ['percentage-change']: number; +} +export interface EntriesSummary { + entries: T[]; + summary: Summary; +} \ No newline at end of file diff --git a/types/chartmogul-node/index.d.ts b/types/chartmogul-node/index.d.ts new file mode 100644 index 0000000000..c4bdce5aca --- /dev/null +++ b/types/chartmogul-node/index.d.ts @@ -0,0 +1,410 @@ +// Type definitions for chartmogul-node 1.0 +// Project: https://github.com/chartmogul/chartmogul-node +// Definitions by: ChartMogul +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import { Map, Cursor, CursorParams, Strings, Entries, EntriesSummary } from './common'; + +export class Config { + VERSION: string; + API_BASE: string; + retries: number; + + constructor(token: string, secret: string, base?: string); + getAccountToken(): string; + getSecretKey(): string; +} + +export namespace Ping { + function ping(config: Config): Promise; +} + +export namespace DataSource { + interface DataSource { + uuid?: string; + name: string; + created_at?: string; + status?: string; + system?: string; + } + interface DataSources { + data_sources: DataSource[]; + } + interface ListDataSourcesParams { + name?: string; + system?: string; + } + + function create(config: Config, data: DataSource): Promise; + function retrieve(config: Config, uuid: string): Promise; + function destroy(config: Config, uuid: string): Promise<{}>; + function all(config: Config, params?: ListDataSourcesParams): Promise; +} + +export namespace Customer { + interface Customer { + id?: number; + data_source_uuid?: string; + data_source_uuids?: Strings; + uuid?: string; + external_id?: string; + external_ids?: Strings; + name?: string; + email?: string; + status?: string; + ['customer-since']?: string; + attributes?: Attributes; + address?: { + address_zip?: string; + city?: string; + state?: string; + country?: string; + }; + mrr?: number; + arr?: number; + ['billing-system-url']?: string; + ['chartmogul-url']?: string; + ['billing-system-type']?: string; + currency?: string; + ['currency-sign']?: string; + company?: string; + country?: string; + state?: string; + city?: string; + zip?: string; + lead_created_at?: string; + free_trial_started_at?: string; + } + interface NewCustomer { + data_source_uuid: string; + external_id: string; + name: string; + email?: string; + company?: string; + country?: string; + state?: string; + city?: string; + zip?: string; + lead_created_at?: string; + free_trial_started_at?: string; + attributes?: NewAttributes; + } + interface UpdateCustomer { + name?: string; + email?: string; + company?: string; + country?: string; + state?: string; + city?: string; + zip?: string; + lead_created_at?: string; + free_trial_started_at?: string; + attributes?: NewAttributes; + } + interface NewAttributes { + tags?: Strings; + custom?: NewCustomAttributes[]; + } + interface NewCustomAttributes { + type?: string; + key: string; + value: any; + source?: string; + } + interface Attributes { + tags?: Strings; + stripe?: Map; + clearbit?: Map; + custom?: Map; + } + interface ListCustomersParams extends CursorParams { + data_source_uuid?: string; + status?: string; + system?: string; + external_id?: string; + } + interface SearchCustomersParams extends CursorParams { + email: string; + } + interface MergeID { + customer_uuid?: string; + external_id?: string; + } + interface MergeCustomersParams { + from: MergeID; + into: MergeID; + } + + function create(config: Config, data: NewCustomer): Promise; + function retrieve(config: Config, uuid: string): Promise; + function modify(config: Config, uuid: string, data: UpdateCustomer): Promise; + function destroy(config: Config, uuid: string): Promise<{}>; + function all(config: Config, params?: ListCustomersParams): Promise>; + function search(config: Config, params?: SearchCustomersParams): Promise>; + function merge(config: Config, params?: MergeCustomersParams): Promise<{}>; + function attributes(config: Config, uuid: string): Promise; +} + +export namespace Plan { + interface Plan { + uuid?: string; + data_source_uuid?: string; + external_id?: string; + name?: string; + interval_count?: number; + interval_unit?: string; + } + interface ListPlansParams extends CursorParams { + data_source_uuid?: string; + system?: string; + external_id?: string; + } + interface Plans extends Cursor { + plans: Plan[]; + } + + function create(config: Config, data: Plan): Promise; + function retrieve(config: Config, uuid: string): Promise; + function modify(config: Config, uuid: string, data: Plan): Promise; + function destroy(config: Config, uuid: string): Promise<{}>; + function all(config: Config, params?: ListPlansParams): Promise; +} + +export namespace Invoice { + interface Invoice { + uuid?: string; + customer_uuid?: string; + currency?: string; + data_source_uuid?: string; + date?: string; + due_date?: string; + external_id?: string; + line_items?: LineItem[]; + transactions?: Transaction[]; + } + interface LineItem { + uuid?: string; + account_code?: string; + amount_in_cents?: number; + cancelled_at?: string; + description?: string; + discount_amount_in_cents?: number; + discount_code?: string; + external_id?: string; + plan_uuid?: string; + prorated?: boolean; + quantity?: number; + service_period_end?: string; + service_period_start?: string; + subscription_external_id?: string; + subscription_uuid?: string; + tax_amount_in_cents?: number; + transaction_fees_in_cents?: number; + type?: string; + } + interface Transaction { + uuid?: string; + date?: string; + external_id?: string; + result?: string; + type?: string; + } + interface ListInvoicesParams extends CursorParams { + data_source_uuid?: string; + customer_uuid?: string; + external_id?: string; + } + interface Invoices extends Cursor { + customer_uuid?: string; + invoices: Invoice[]; + } + + function create(config: Config, uuid: string, data: { + invoices: Invoice[] + }): Promise; + function retrieve(config: Config, uuid: string): Promise; + function destroy(config: Config, uuid: string): Promise<{}>; + function all(config: Config, uuid: string, params?: ListInvoicesParams): Promise; + function all(config: Config, params?: ListInvoicesParams): Promise; +} + +export namespace Transaction { + interface Transaction { + uuid?: string; + date: string; + external_id?: string; + result: string; + type: string; + } + + function create(config: Config, uuid: string, data: Transaction): Promise; +} + +export namespace Subscription { + interface Subscription { + uuid: string; + external_id: string; + customer_uuid: string; + plan_uuid: string; + cancellation_dates: Strings; + data_source_uuid: string; + } + interface CancelSubscriptionParams { + cancelled_at?: string; + cancellation_dates?: Strings; + } + interface Subscriptions extends Cursor { + customer_uuid?: string; + subscriptions: Subscription[]; + } + + function all(config: Config, uuid: string, data: CursorParams): Promise; + function cancel(config: Config, uuid: string, data: CancelSubscriptionParams): Promise; +} + +export namespace Tag { + interface Tags { + tags: Strings; + } + interface TagsWithEmail { + email: string; + tags: Strings; + } + function add(config: Config, uuid: string, data: TagsWithEmail): Promise>; + function add(config: Config, uuid: string, data: Tags): Promise; + function remove(config: Config, uuid: string, data: Tags): Promise; +} + +export namespace CustomAttribute { + import NewCustomAttributes = Customer.NewCustomAttributes; + + interface CustomAttributes { + custom: Map; + } + function add(config: Config, uuid: string, data: { + email: string; + custom: NewCustomAttributes[]; + }): Promise>; + function add(config: Config, uuid: string, data: { + custom: NewCustomAttributes[]; + }): Promise; + function update(config: Config, uuid: string, data: CustomAttributes): Promise; + function remove(config: Config, uuid: string, data: { + custom: Strings; + }): Promise; +} + +export namespace Metrics { + interface Params extends ParamsNoInterval { + interval?: string; + } + interface ParamsNoInterval { + ['start-date']: string; + ['end-date']: string; + geo?: string; + plans?: string; + } + interface All { + entries: { + date: string; + ['customer-churn-rate']: number; + ['mrr-churn-rate']: number; + ltv: number; + customers: number; + asp: number; + arpa: number; + arr: number; + mrr: number; + }; + } + + interface MRR { + date: string; + mrr: number; + ['mrr-new-business']: number; + ['mrr-expansion']: number; + ['mrr-contraction']: number; + ['mrr-churn']: number; + ['mrr-reactivation']: number; + } + interface ARR { + date: string; + arr: number; + } + interface ARPA { + date: string; + arpa: number; + } + interface ASP { + date: string; + asp: number; + } + interface CustomerCount { + date: string; + customers: number; + } + interface CustomerChurnRate { + date: string; + ['customer-churn-rate']: number; + } + interface MRRChurnRate { + date: string; + ['mrr-churn-rate']: number; + } + interface LTV { + date: string; + ltv: number; + } + + function all(config: Config, params: Params): Promise; + function mrr(config: Config, params: Params): Promise>; + function arr(config: Config, params: Params): Promise>; + function asp(config: Config, params: Params): Promise>; + function arpa(config: Config, params: Params): Promise>; + function customerCount(config: Config, params: Params): Promise>; + function customerChurnRate(config: Config, params: ParamsNoInterval): Promise>; + function mrrChurnRate(config: Config, params: ParamsNoInterval): Promise>; + function ltv(config: Config, params: ParamsNoInterval): Promise>; + + namespace Customer { + interface MetricsSubscription { + id: number; + external_id: string; + plan: string; + quantity: number; + mrr: number; + arr: number; + status: string; + ['billing-cycle']: string; + ['billing-cycle-count']: number; + ['start-date']: string; + ['end-date']: string; + currency: string; + ['currency-sign']: string; + } + interface MetricsActivity { + id: number; + date: string; + ['activity-arr']: number; + ['activity-mrr']: number; + ['activity-mrr-movement']: number; + currency: string; + ['currency-sign']: string; + description: string; + type: string; + } + + function subscriptions(config: Config, uuid: string, params?: CursorParams): Promise>; + function activities(config: Config, uuid: string, params?: CursorParams): Promise>; + } +} + +export class ChartMogulError extends Error { + response: any; + httpStatus: number; +} +export class ConfigurationError extends ChartMogulError {} +export class ForbiddenError extends ChartMogulError {} +export class NotFoundError extends ChartMogulError {} +export class ResourceInvalidError extends ChartMogulError {} +export class SchemaInvalidError extends ChartMogulError {} diff --git a/types/chartmogul-node/tsconfig.json b/types/chartmogul-node/tsconfig.json new file mode 100644 index 0000000000..3b24d48da8 --- /dev/null +++ b/types/chartmogul-node/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", + "chartmogul-node-tests.ts" + ] +} diff --git a/types/chartmogul-node/tslint.json b/types/chartmogul-node/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/chartmogul-node/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From d0a82b0046a144c21fc8ab465f015be288e3b7d7 Mon Sep 17 00:00:00 2001 From: NoxWings Date: Wed, 8 Aug 2018 11:53:46 +0200 Subject: [PATCH 31/94] Update get-port types to 4.0 version --- types/get-port/get-port-tests.ts | 4 ++++ types/get-port/index.d.ts | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/types/get-port/get-port-tests.ts b/types/get-port/get-port-tests.ts index b6e59890d6..53a9e8e69b 100644 --- a/types/get-port/get-port-tests.ts +++ b/types/get-port/get-port-tests.ts @@ -7,3 +7,7 @@ getPort().then(port => { getPort({ port: 3000 }).then(port => { console.log(port); }); + +getPort({ port: [3000, 3001] }).then(port => { + console.log(port); +}); diff --git a/types/get-port/index.d.ts b/types/get-port/index.d.ts index 3f62b90c86..f8adb4851e 100644 --- a/types/get-port/index.d.ts +++ b/types/get-port/index.d.ts @@ -1,9 +1,9 @@ -// Type definitions for get-port 3.2 +// Type definitions for get-port 4.0 // Project: https://github.com/sindresorhus/get-port // Definitions by: York Yao // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare module "get-port" { - var getPort: (options?: { port?: number, host?: string }) => PromiseLike + var getPort: (options?: { port?: number | ReadonlyArray, host?: string }) => PromiseLike export = getPort; } From 18e0d40fbdf4b40bee636043d6aab4753f39267e Mon Sep 17 00:00:00 2001 From: Eugene Kulabuhov Date: Thu, 9 Aug 2018 00:00:13 +0300 Subject: [PATCH 32/94] Changed to UMD module https://www.typescriptlang.org/docs/handbook/modules.html#umd-modules Please check related issue: https://github.com/Microsoft/TypeScript/issues/26309 With this change using mapbox-gl without import in a module will throw an error: `[ts] 'mapboxgl' refers to a UMD global, but the current file is a module. Consider adding an import instead.` --- types/mapbox-gl/index.d.ts | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/types/mapbox-gl/index.d.ts b/types/mapbox-gl/index.d.ts index d85af4fd5a..78ce94cb56 100644 --- a/types/mapbox-gl/index.d.ts +++ b/types/mapbox-gl/index.d.ts @@ -6,6 +6,9 @@ /// +export = mapboxgl; +export as namespace mapboxgl; + declare namespace mapboxgl { let accessToken: string; let version: string; @@ -1286,11 +1289,3 @@ declare namespace mapboxgl { 'hillshade-accent-color-transition'?: Transition; } } - -declare module 'mapbox-gl' { - export = mapboxgl; -} - -declare module 'mapbox-gl/dist/mapbox-gl' { - export = mapboxgl; -} From a4b70cd857a7181c3cb98920c26ae127111d0450 Mon Sep 17 00:00:00 2001 From: taoqf Date: Thu, 9 Aug 2018 09:51:12 +0800 Subject: [PATCH 33/94] add tests for qiniu-js --- types/qiniu-js/qiniu-js-tests-global.ts | 48 +++++++++++++++++++++++++ types/qiniu-js/tsconfig.json | 3 +- 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 types/qiniu-js/qiniu-js-tests-global.ts diff --git a/types/qiniu-js/qiniu-js-tests-global.ts b/types/qiniu-js/qiniu-js-tests-global.ts new file mode 100644 index 0000000000..e3820d1438 --- /dev/null +++ b/types/qiniu-js/qiniu-js-tests-global.ts @@ -0,0 +1,48 @@ +const file: Blob = null as any; + +const config = { + useCdnDomain: true, + region: qiniu.region.z2 +}; + +const key = 'key'; +const token = 'token'; + +const putExtra = { + fname: "", + params: {}, + mimeType: [] || null +}; + +(() => { + const observable = qiniu.upload(file, key, token, putExtra, config); + + const subscription = observable.subscribe({ + next(res) { }, + complete(res) { }, + error(err) { } + }); // 上传开始 + subscription.unsubscribe(); // 上传取消 +})(); + +(() => { + const observable = qiniu.upload(file, key, token, putExtra, config); + const subscription = observable.subscribe((res) => { }, (err) => { }, (res) => { }); // 这样传参形式也可以 +})(); + +(async () => { + // 图片上传前压缩: + const options = { + quality: 0.92, + noCompressIfLarger: true + // maxWidth: 1000, + // maxHeight: 618 + }; + const data = await qiniu.compressImage(file, options); + const observable = qiniu.upload(data.dist, key, token, putExtra, config); + const subscription = observable.subscribe({ + next(res) { }, + complete(res) { }, + error(err) { } + }); // 上传开始 +})(); diff --git a/types/qiniu-js/tsconfig.json b/types/qiniu-js/tsconfig.json index f8bc0667b7..06bcf7058b 100644 --- a/types/qiniu-js/tsconfig.json +++ b/types/qiniu-js/tsconfig.json @@ -19,6 +19,7 @@ }, "files": [ "index.d.ts", - "qiniu-js-tests.ts" + "qiniu-js-tests.ts", + "qiniu-js-tests-global.ts" ] } \ No newline at end of file From c87bd1cf77fec8e6613f70374b5d3933be1304c0 Mon Sep 17 00:00:00 2001 From: taoqf Date: Thu, 9 Aug 2018 10:40:32 +0800 Subject: [PATCH 34/94] rename --- .../{qiniu-js-tests-global.ts => qiniu-js-global-tests.ts} | 0 types/qiniu-js/tsconfig.json | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename types/qiniu-js/{qiniu-js-tests-global.ts => qiniu-js-global-tests.ts} (100%) diff --git a/types/qiniu-js/qiniu-js-tests-global.ts b/types/qiniu-js/qiniu-js-global-tests.ts similarity index 100% rename from types/qiniu-js/qiniu-js-tests-global.ts rename to types/qiniu-js/qiniu-js-global-tests.ts diff --git a/types/qiniu-js/tsconfig.json b/types/qiniu-js/tsconfig.json index 06bcf7058b..fad7f8fa9b 100644 --- a/types/qiniu-js/tsconfig.json +++ b/types/qiniu-js/tsconfig.json @@ -20,6 +20,6 @@ "files": [ "index.d.ts", "qiniu-js-tests.ts", - "qiniu-js-tests-global.ts" + "qiniu-js-global-tests.ts" ] } \ No newline at end of file From 73218af4d743f14effb770d6d0be9ffa24f2b547 Mon Sep 17 00:00:00 2001 From: taoqf Date: Thu, 9 Aug 2018 10:58:21 +0800 Subject: [PATCH 35/94] move test file --- types/qiniu-js/{ => test}/qiniu-js-global-tests.ts | 0 types/qiniu-js/tsconfig.json | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename types/qiniu-js/{ => test}/qiniu-js-global-tests.ts (100%) diff --git a/types/qiniu-js/qiniu-js-global-tests.ts b/types/qiniu-js/test/qiniu-js-global-tests.ts similarity index 100% rename from types/qiniu-js/qiniu-js-global-tests.ts rename to types/qiniu-js/test/qiniu-js-global-tests.ts diff --git a/types/qiniu-js/tsconfig.json b/types/qiniu-js/tsconfig.json index fad7f8fa9b..15efaa0a4c 100644 --- a/types/qiniu-js/tsconfig.json +++ b/types/qiniu-js/tsconfig.json @@ -20,6 +20,6 @@ "files": [ "index.d.ts", "qiniu-js-tests.ts", - "qiniu-js-global-tests.ts" + "test/qiniu-js-global-tests.ts" ] } \ No newline at end of file From 9b8b697b902638e8bc8a4b88b3e557d3b048dfdb Mon Sep 17 00:00:00 2001 From: yasupeke Date: Thu, 9 Aug 2018 21:30:43 +0900 Subject: [PATCH 36/94] update react-paginate --- types/react-paginate/index.d.ts | 13 +- types/react-paginate/react-paginate-tests.tsx | 4 +- types/react-paginate/tsconfig.json | 12 +- types/react-paginate/v4/index.d.ts | 125 ++++++++++++++++++ .../v4/react-paginate-tests.tsx | 33 +++++ types/react-paginate/v4/tsconfig.json | 30 +++++ types/react-paginate/v4/tslint.json | 1 + 7 files changed, 202 insertions(+), 16 deletions(-) create mode 100644 types/react-paginate/v4/index.d.ts create mode 100644 types/react-paginate/v4/react-paginate-tests.tsx create mode 100644 types/react-paginate/v4/tsconfig.json create mode 100644 types/react-paginate/v4/tslint.json diff --git a/types/react-paginate/index.d.ts b/types/react-paginate/index.d.ts index 83d8c476c9..0e0daa376a 100644 --- a/types/react-paginate/index.d.ts +++ b/types/react-paginate/index.d.ts @@ -1,11 +1,8 @@ -// Type definitions for react-paginate 4.3 +// Type definitions for react-paginate 5.2 // Project: https://github.com/AdeleD/react-paginate -// Definitions by: Simon Hartcher -// Wouter Hardeman -// pegel03 -// Simon Archer +// Definitions by: Yasunori Ohoka // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.8 +// TypeScript Version: 2.9 import * as React from 'react'; @@ -48,7 +45,7 @@ interface ReactPaginateProps { /** * The method to call when a page is clicked. Exposes the current page object as an argument. */ - onPageChange?(selectedItem: {selected: number}): void; + onPageChange?(selectedItem: { selected: number }): void; /** * The initial page selected. @@ -122,4 +119,4 @@ interface ReactPaginateProps { } declare const ReactPaginate: React.ComponentClass; -export = ReactPaginate; +export default ReactPaginate; diff --git a/types/react-paginate/react-paginate-tests.tsx b/types/react-paginate/react-paginate-tests.tsx index 92d8659c0c..a98e8702a4 100644 --- a/types/react-paginate/react-paginate-tests.tsx +++ b/types/react-paginate/react-paginate-tests.tsx @@ -1,5 +1,5 @@ -import * as React from "react"; -import ReactPaginate = require("react-paginate"); +import * as React from 'react'; +import ReactPaginate from 'react-paginate'; class Test extends React.Component { render() { diff --git a/types/react-paginate/tsconfig.json b/types/react-paginate/tsconfig.json index 5653cee275..5c49c56d9e 100644 --- a/types/react-paginate/tsconfig.json +++ b/types/react-paginate/tsconfig.json @@ -1,8 +1,4 @@ { - "files": [ - "index.d.ts", - "react-paginate-tests.tsx" - ], "compilerOptions": { "module": "commonjs", "lib": [ @@ -21,5 +17,9 @@ "noEmit": true, "forceConsistentCasingInFileNames": true, "jsx": "react" - } -} \ No newline at end of file + }, + "files": [ + "index.d.ts", + "react-paginate-tests.tsx" + ] + } diff --git a/types/react-paginate/v4/index.d.ts b/types/react-paginate/v4/index.d.ts new file mode 100644 index 0000000000..736455f60f --- /dev/null +++ b/types/react-paginate/v4/index.d.ts @@ -0,0 +1,125 @@ +// Type definitions for react-paginate 4.3 +// Project: https://github.com/AdeleD/react-paginate +// Definitions by: Simon Hartcher +// Wouter Hardeman +// pegel03 +// Simon Archer +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +import * as React from 'react'; + +interface ReactPaginateProps { + /** + * The total number of pages. + */ + pageCount: number; + + /** + * The range of pages displayed. + */ + pageRangeDisplayed: number; + + /** + * The number of pages to display for margins. + */ + marginPagesDisplayed: number; + + /** + * Label for the `previous` button. + */ + previousLabel?: string | JSX.Element; + + /** + * Label for the `next` button. + */ + nextLabel?: string | JSX.Element; + + /** + * Label for ellipsis. + */ + breakLabel?: string | JSX.Element; + + /** + * The classname on tag `li` of the ellipsis element. + */ + breakClassName?: string | JSX.Element; + + /** + * The method to call when a page is clicked. Exposes the current page object as an argument. + */ + onPageChange?(selectedItem: { selected: number }): void; + + /** + * The initial page selected. + */ + initialPage?: number; + + /** + * To override selected page with parent prop. + */ + forcePage?: number; + + /** + * Disable onPageChange callback with initial page. Default: false + */ + disableInitialCallback?: boolean; + + /** + * The classname of the pagination container. + */ + containerClassName?: string; + + /** + * The classname on tag `li` of each page element. + */ + pageClassName?: string; + + /** + * The classname on tag `a` of each page element. + */ + pageLinkClassName?: string; + + /** + * The classname for the active page. + */ + activeClassName?: string; + + /** + * The classname on tag `li` of the `previous` button. + */ + previousClassName?: string; + + /** + * The classname on tag `li` of the `next` button. + */ + nextClassName?: string; + + /** + * The classname on tag `a` of the `previous` button. + */ + previousLinkClassName?: string; + + /** + * The classname on tag `a` of the `next` button. + */ + nextLinkClassName?: string; + + /** + * The classname for disabled `previous` and `next` buttons. + */ + disabledClassName?: string; + + /** + * The method is called to generate the href attribute value on tag a of each page element. + */ + hrefBuilder?(pageIndex: number): void; + + /** + * Extra context to add to the aria-label HTML attribute. + */ + extraAriaContext?: string; +} + +declare const ReactPaginate: React.ComponentClass; +export = ReactPaginate; diff --git a/types/react-paginate/v4/react-paginate-tests.tsx b/types/react-paginate/v4/react-paginate-tests.tsx new file mode 100644 index 0000000000..130db0248c --- /dev/null +++ b/types/react-paginate/v4/react-paginate-tests.tsx @@ -0,0 +1,33 @@ +import * as React from 'react'; +import ReactPaginate = require('react-paginate'); + +class Test extends React.Component { + render() { + return ( + null} + initialPage={2} + forcePage={3} + disableInitialCallback={false} + containerClassName={'container'} + pageClassName={'page-li'} + pageLinkClassName={'page-a'} + activeClassName={'active'} + previousClassName={'previous-li'} + nextClassName={'next-li'} + previousLinkClassName={'previous-a'} + nextLinkClassName={'next-a'} + disabledClassName={'disabled'} + hrefBuilder={(pageIndex: number) => null} + extraAriaContext={'aria'} + /> + ); + } +} diff --git a/types/react-paginate/v4/tsconfig.json b/types/react-paginate/v4/tsconfig.json new file mode 100644 index 0000000000..d6ee7a0357 --- /dev/null +++ b/types/react-paginate/v4/tsconfig.json @@ -0,0 +1,30 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "paths": { + "react-paginate": [ + "react-paginate/v4" + ] + }, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react" + }, + "files": [ + "index.d.ts", + "react-paginate-tests.tsx" + ] +} diff --git a/types/react-paginate/v4/tslint.json b/types/react-paginate/v4/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-paginate/v4/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 9afc9e1cdd15d3b8278929858de0b4f44149afd8 Mon Sep 17 00:00:00 2001 From: Ilia Beliaev Date: Thu, 9 Aug 2018 16:41:45 +0300 Subject: [PATCH 37/94] Added vue-select support. --- types/vue-select/index.d.ts | 98 ++++++++++++++++++++++++++++ types/vue-select/package.json | 6 ++ types/vue-select/tsconfig.json | 22 +++++++ types/vue-select/tslint.json | 1 + types/vue-select/vue-select-tests.ts | 11 ++++ types/vue2-datepicker/package.json | 3 +- 6 files changed, 140 insertions(+), 1 deletion(-) create mode 100644 types/vue-select/index.d.ts create mode 100644 types/vue-select/package.json create mode 100644 types/vue-select/tsconfig.json create mode 100644 types/vue-select/tslint.json create mode 100644 types/vue-select/vue-select-tests.ts diff --git a/types/vue-select/index.d.ts b/types/vue-select/index.d.ts new file mode 100644 index 0000000000..f43da99cf1 --- /dev/null +++ b/types/vue-select/index.d.ts @@ -0,0 +1,98 @@ +// Type definitions for vue-select 2.4.0 +// Project: https://github.com/sagalbot/vue-select#readme +// Definitions by: Ilia Beliaev +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// Typescript version: 2.4.0 + +export default VueSelect; + +export type Option = string | any | null; + +export type OptionConsumer = (option: Option) => void; + +export interface VueSelectProps { + value: Option; + options: Option[]; + disabled: boolean; + maxHeight: string; + searchable: boolean; + multiple: boolean; + placeholder: string; + transition: string; + clearSearchOnSelect: boolean; + closeOnSelect: boolean; + label: boolean; + getOptionLabel: (option: Option) => string; + onChange: OptionConsumer; + taggable: boolean; + tabindex: number | null; + pushTags: boolean; + filterable: boolean; + createOption: (option: Option) => Option; + resetOnOptionsChange: boolean; + noDrop: boolean; + inputId: string | null; + dir: string; +} + +export interface VueSelectData { + search: string; + open: boolean; + mutableValue: Option; + mutableOptions: Option[]; +} + +export interface VueSelectWatch { + value: (val: Option) => void; + mutableValue: (val: Option, old: Option) => void; + options: (val: Option) => void; + mutableOptions: () => void; + multiple: (reset: boolean) => void; + created: () => void; +} + +export interface VueSelectMethods { + select: OptionConsumer; + deselect: OptionConsumer; + clearSelection: () => void; + onAfterSelect: OptionConsumer; + toggleDropdown: (e: Event) => void; + isOptionSelected: (option: Option) => boolean; + onEscape: () => void; + onSearchBlur: () => void; + onSearchFocus: () => void; + maybeDeleteValue: () => void; + optionExists: (option: Option) => boolean; + maybePushTag: OptionConsumer; +} + +export interface VueSelectComputed { + dropdownClasses: () => DropdownClasses; + clearSearchOnBlur: () => boolean; + searching: () => boolean; + dropdownOpen: () => boolean; + searchPlaceholder: () => boolean; + filteredOptions: () => Option[]; + isValueEmpty: () => boolean; + valueAsArray: () => Option[]; + showClearButton: () => boolean; +} + +export interface DropdownClasses { + open: boolean; + single: boolean; + searching: boolean; + searchable: boolean; + unsearchable: boolean; + loading: boolean; + rtl: boolean; + disabled: boolean; +} + +export const VueSelect: { + props: VueSelectProps, + data: () => VueSelectData, + watch: VueSelectWatch, + methods: VueSelectMethods, + computed: VueSelectComputed, +} diff --git a/types/vue-select/package.json b/types/vue-select/package.json new file mode 100644 index 0000000000..faefc1b2f7 --- /dev/null +++ b/types/vue-select/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "vue": ">=2.0.0" + } +} diff --git a/types/vue-select/tsconfig.json b/types/vue-select/tsconfig.json new file mode 100644 index 0000000000..c757293eec --- /dev/null +++ b/types/vue-select/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "vue-select-tests.ts" + ] +} diff --git a/types/vue-select/tslint.json b/types/vue-select/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/vue-select/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/vue-select/vue-select-tests.ts b/types/vue-select/vue-select-tests.ts new file mode 100644 index 0000000000..fd4374b9cd --- /dev/null +++ b/types/vue-select/vue-select-tests.ts @@ -0,0 +1,11 @@ +import Vue from 'vue'; + +new Vue({ + el: '#app', + components: { + 'vue-select': VueSelect + }, + template: { + '' + } +}); diff --git a/types/vue2-datepicker/package.json b/types/vue2-datepicker/package.json index faefc1b2f7..5453d4179e 100644 --- a/types/vue2-datepicker/package.json +++ b/types/vue2-datepicker/package.json @@ -2,5 +2,6 @@ "private": true, "dependencies": { "vue": ">=2.0.0" - } + }, + "typeScriptVersion": "2.4.0" } From a4f1fac64bd1f745c2729ea1fc3f3cfe6406eb7c Mon Sep 17 00:00:00 2001 From: Ilia Beliaev Date: Thu, 9 Aug 2018 16:54:32 +0300 Subject: [PATCH 38/94] Fixed to work properly with lint. --- types/vue-select/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/vue-select/index.d.ts b/types/vue-select/index.d.ts index f43da99cf1..5934393505 100644 --- a/types/vue-select/index.d.ts +++ b/types/vue-select/index.d.ts @@ -94,5 +94,5 @@ export const VueSelect: { data: () => VueSelectData, watch: VueSelectWatch, methods: VueSelectMethods, - computed: VueSelectComputed, + computed: VueSelectComputed } From 1ff7ad1434054de6fd4d95e408cb4b6e1f6850b1 Mon Sep 17 00:00:00 2001 From: Ilia Beliaev Date: Thu, 9 Aug 2018 16:54:57 +0300 Subject: [PATCH 39/94] Fixed to work properly with lint. --- types/vue-select/index.d.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/types/vue-select/index.d.ts b/types/vue-select/index.d.ts index 5934393505..9a4e81d4f2 100644 --- a/types/vue-select/index.d.ts +++ b/types/vue-select/index.d.ts @@ -4,8 +4,12 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // Typescript version: 2.4.0 +import {VueConstructor} from 'vue'; + export default VueSelect; +export const VueSelect: VueSelectConstructor; + export type Option = string | any | null; export type OptionConsumer = (option: Option) => void; @@ -89,10 +93,10 @@ export interface DropdownClasses { disabled: boolean; } -export const VueSelect: { - props: VueSelectProps, - data: () => VueSelectData, - watch: VueSelectWatch, - methods: VueSelectMethods, - computed: VueSelectComputed +export interface VueSelectConstructor extends VueConstructor{ + props: VueSelectProps; + data: () => VueSelectData; + watch: VueSelectWatch; + methods: VueSelectMethods; + computed: VueSelectComputed; } From a85aec2a7afb85edb9b163e6368b6dc2092ef344 Mon Sep 17 00:00:00 2001 From: Ilia Beliaev Date: Thu, 9 Aug 2018 17:14:22 +0300 Subject: [PATCH 40/94] Changed type from string | any to any. --- types/vue-select/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/vue-select/index.d.ts b/types/vue-select/index.d.ts index 9a4e81d4f2..a718686d26 100644 --- a/types/vue-select/index.d.ts +++ b/types/vue-select/index.d.ts @@ -10,7 +10,7 @@ export default VueSelect; export const VueSelect: VueSelectConstructor; -export type Option = string | any | null; +export type Option = any | null; export type OptionConsumer = (option: Option) => void; From cf0e059ca109cfefecdfca2e68ca9d4efafdc8ea Mon Sep 17 00:00:00 2001 From: Ilia Beliaev Date: Thu, 9 Aug 2018 18:43:52 +0300 Subject: [PATCH 41/94] Fixed label type. Added tests. --- types/vue-select/index.d.ts | 2 +- types/vue-select/vue-select-tests.ts | 62 ++++++++++++++++++++++++++-- 2 files changed, 60 insertions(+), 4 deletions(-) diff --git a/types/vue-select/index.d.ts b/types/vue-select/index.d.ts index a718686d26..51ae9e4d56 100644 --- a/types/vue-select/index.d.ts +++ b/types/vue-select/index.d.ts @@ -25,7 +25,7 @@ export interface VueSelectProps { transition: string; clearSearchOnSelect: boolean; closeOnSelect: boolean; - label: boolean; + label: string; getOptionLabel: (option: Option) => string; onChange: OptionConsumer; taggable: boolean; diff --git a/types/vue-select/vue-select-tests.ts b/types/vue-select/vue-select-tests.ts index fd4374b9cd..17cf97b2be 100644 --- a/types/vue-select/vue-select-tests.ts +++ b/types/vue-select/vue-select-tests.ts @@ -1,11 +1,67 @@ import Vue from 'vue'; +import VueSelect, {Option} from 'vue-select'; + +const options = [ + { + name: 'SomeName' + }, + { + name: 'SomeName2' + } +] new Vue({ + el: '#app', + data: { + options, + value: null, + + }, components: { 'vue-select': VueSelect }, - template: { - '' - } + methods: { + getOptionLabel(option: Option) { + if (option && option.name) { + return option.name; + } + return ''; + }, + optionConsumer(option: Option) { + }, + optionToOption(option: Option) { + return option; + }, + onSearch(search: string, loading: (b: boolean) => void) { + loading(true); + } + }, + template: ` + + +` }); From e5d5e3587ce0b67f462ff8d450697ce14baee894 Mon Sep 17 00:00:00 2001 From: Ilia Beliaev Date: Thu, 9 Aug 2018 18:48:34 +0300 Subject: [PATCH 42/94] Linting. --- types/vue-select/index.d.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/types/vue-select/index.d.ts b/types/vue-select/index.d.ts index 51ae9e4d56..331fa7ec92 100644 --- a/types/vue-select/index.d.ts +++ b/types/vue-select/index.d.ts @@ -93,10 +93,10 @@ export interface DropdownClasses { disabled: boolean; } -export interface VueSelectConstructor extends VueConstructor{ - props: VueSelectProps; - data: () => VueSelectData; - watch: VueSelectWatch; - methods: VueSelectMethods; - computed: VueSelectComputed; +export interface VueSelectConstructor extends VueConstructor { + props: VueSelectProps; + data: () => VueSelectData; + watch: VueSelectWatch; + methods: VueSelectMethods; + computed: VueSelectComputed; } From 4804bb8762075ade689322260fd9f3d9a656ccb1 Mon Sep 17 00:00:00 2001 From: Ilia Beliaev Date: Thu, 9 Aug 2018 18:51:03 +0300 Subject: [PATCH 43/94] Reverted accidental change. --- types/vue2-datepicker/package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/types/vue2-datepicker/package.json b/types/vue2-datepicker/package.json index 5453d4179e..faefc1b2f7 100644 --- a/types/vue2-datepicker/package.json +++ b/types/vue2-datepicker/package.json @@ -2,6 +2,5 @@ "private": true, "dependencies": { "vue": ">=2.0.0" - }, - "typeScriptVersion": "2.4.0" + } } From c6192b5b9452356c48127438bfe73372028c699b Mon Sep 17 00:00:00 2001 From: Dima Danyliuk Date: Thu, 9 Aug 2018 20:52:49 +0300 Subject: [PATCH 44/94] Improve declaration file for "react-input-mask" - move declaration for previous major version into v1 folder - remove module declaration construction --- types/react-input-mask/index.d.ts | 102 +++++++++++------- .../react-input-mask-tests.tsx | 12 +-- types/react-input-mask/tslint.json | 4 +- types/react-input-mask/v1/index.d.ts | 49 +++++++++ .../v1/react-input-mask-tests.tsx | 13 +++ .../react-input-mask/{v2 => v1}/tsconfig.json | 2 +- types/react-input-mask/v1/tslint.json | 1 + types/react-input-mask/v2/index.d.ts | 75 ------------- .../v2/react-input-mask-tests.tsx | 13 --- types/react-input-mask/v2/tslint.json | 3 - 10 files changed, 136 insertions(+), 138 deletions(-) create mode 100644 types/react-input-mask/v1/index.d.ts create mode 100644 types/react-input-mask/v1/react-input-mask-tests.tsx rename types/react-input-mask/{v2 => v1}/tsconfig.json (91%) create mode 100644 types/react-input-mask/v1/tslint.json delete mode 100644 types/react-input-mask/v2/index.d.ts delete mode 100644 types/react-input-mask/v2/react-input-mask-tests.tsx delete mode 100644 types/react-input-mask/v2/tslint.json diff --git a/types/react-input-mask/index.d.ts b/types/react-input-mask/index.d.ts index c09719f871..ff618e8749 100644 --- a/types/react-input-mask/index.d.ts +++ b/types/react-input-mask/index.d.ts @@ -1,49 +1,73 @@ -// Type definitions for react-input-mask 1.2 +// Type definitions for react-input-mask 2.0 // Project: https://github.com/sanniassin/react-input-mask // Definitions by: Alexandre Paré +// Dima Danylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.8 +// TypeScript Version: 2.9 -import * as React from "react"; +import * as React from 'react'; -declare namespace ReactInputMask { - interface Props extends React.InputHTMLAttributes { - /** - * Mask string. Format characters are: - * * `9`: `0-9` - * * `a`: `A-Z, a-z` - * * `\*`: `A-Z, a-z, 0-9` - * - * Any character can be escaped with backslash, which usually will appear as double backslash in JS strings. - * For example, German phone mask with unremoveable prefix +49 will look like `mask="+4\\9 99 999 99"` or `mask={"+4\\\\9 99 999 99"}` - */ - mask: string; - /** - * Character to cover unfilled editable parts of mask. Default character is "_". If set to null, unfilled parts will be empty, like in ordinary input. - */ - maskChar?: string | null; - /** - * Defines format characters with characters as keys and corresponding RegExp string as values. Default ones: - * ``` - * { - * "9": "[0-9]", - * "a": "[A-Za-z]", - * "*": "[A-Za-z0-9]" - * }``` - */ - formatChars?: { [key: string]: string }; - /** - * Show mask even in empty input without focus. - */ - alwaysShowMask?: boolean; - /** - * Use inputRef instead of ref if you need input node to manage focus, selection, etc. - */ - inputRef?: React.Ref; - } +export interface InputState { + value: string; + selection: Selection; } -declare class ReactInputMask extends React.Component { +export interface MaskOptions { + mask: string; + maskChar: string; + alwaysShowMask: boolean; + formatChars: Record; + permanents: number[]; +} + +interface Props extends React.InputHTMLAttributes { + /** + * Mask string. Format characters are: + * * `9`: `0-9` + * * `a`: `A-Z, a-z` + * * `\*`: `A-Z, a-z, 0-9` + * + * Any character can be escaped with backslash, which usually will appear as double backslash in JS strings. + * For example, German phone mask with unremoveable prefix +49 will look like `mask="+4\\9 99 999 99"` or `mask={"+4\\\\9 99 999 99"}` + */ + mask: string; + /** + * Character to cover unfilled editable parts of mask. Default character is "_". If set to null, unfilled parts will be empty, like in ordinary input. + */ + maskChar?: string | null; + /** + * Defines format characters with characters as keys and corresponding RegExp string as values. Default ones: + * ``` + * { + * "9": "[0-9]", + * "a": "[A-Za-z]", + * "*": "[A-Za-z0-9]" + * }``` + */ + formatChars?: { [key: string]: string }; + /** + * Show mask even in empty input without focus. + */ + alwaysShowMask?: boolean; + /** + * Use inputRef instead of ref if you need input node to manage focus, selection, etc. + */ + inputRef?: React.Ref; + + /** + * In case you need to implement more complex masking behavior, you can provide + * beforeMaskedValueChange function to change masked value and cursor position + * before it will be applied to the input. + */ + beforeMaskedValueChange?( + newState: InputState, + oldState: InputState, + userInput: string, + maskOptions: MaskOptions, + ): InputState; +} + +export class ReactInputMask extends React.Component { } export default ReactInputMask; diff --git a/types/react-input-mask/react-input-mask-tests.tsx b/types/react-input-mask/react-input-mask-tests.tsx index a34b15ac99..93c6b1f638 100644 --- a/types/react-input-mask/react-input-mask-tests.tsx +++ b/types/react-input-mask/react-input-mask-tests.tsx @@ -4,10 +4,10 @@ import * as React from 'react'; let ref: HTMLInputElement | null = null;
- - - - - - ref = node} /> + + + + + + ref = node} />
; diff --git a/types/react-input-mask/tslint.json b/types/react-input-mask/tslint.json index 3db14f85ea..f93cf8562a 100644 --- a/types/react-input-mask/tslint.json +++ b/types/react-input-mask/tslint.json @@ -1 +1,3 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json" +} diff --git a/types/react-input-mask/v1/index.d.ts b/types/react-input-mask/v1/index.d.ts new file mode 100644 index 0000000000..c09719f871 --- /dev/null +++ b/types/react-input-mask/v1/index.d.ts @@ -0,0 +1,49 @@ +// Type definitions for react-input-mask 1.2 +// Project: https://github.com/sanniassin/react-input-mask +// Definitions by: Alexandre Paré +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +import * as React from "react"; + +declare namespace ReactInputMask { + interface Props extends React.InputHTMLAttributes { + /** + * Mask string. Format characters are: + * * `9`: `0-9` + * * `a`: `A-Z, a-z` + * * `\*`: `A-Z, a-z, 0-9` + * + * Any character can be escaped with backslash, which usually will appear as double backslash in JS strings. + * For example, German phone mask with unremoveable prefix +49 will look like `mask="+4\\9 99 999 99"` or `mask={"+4\\\\9 99 999 99"}` + */ + mask: string; + /** + * Character to cover unfilled editable parts of mask. Default character is "_". If set to null, unfilled parts will be empty, like in ordinary input. + */ + maskChar?: string | null; + /** + * Defines format characters with characters as keys and corresponding RegExp string as values. Default ones: + * ``` + * { + * "9": "[0-9]", + * "a": "[A-Za-z]", + * "*": "[A-Za-z0-9]" + * }``` + */ + formatChars?: { [key: string]: string }; + /** + * Show mask even in empty input without focus. + */ + alwaysShowMask?: boolean; + /** + * Use inputRef instead of ref if you need input node to manage focus, selection, etc. + */ + inputRef?: React.Ref; + } +} + +declare class ReactInputMask extends React.Component { +} + +export default ReactInputMask; diff --git a/types/react-input-mask/v1/react-input-mask-tests.tsx b/types/react-input-mask/v1/react-input-mask-tests.tsx new file mode 100644 index 0000000000..a34b15ac99 --- /dev/null +++ b/types/react-input-mask/v1/react-input-mask-tests.tsx @@ -0,0 +1,13 @@ +import ReactInputMask from 'react-input-mask'; +import * as React from 'react'; + +let ref: HTMLInputElement | null = null; + +
+ + + + + + ref = node} /> +
; diff --git a/types/react-input-mask/v2/tsconfig.json b/types/react-input-mask/v1/tsconfig.json similarity index 91% rename from types/react-input-mask/v2/tsconfig.json rename to types/react-input-mask/v1/tsconfig.json index 8b19948640..fddba7dc87 100644 --- a/types/react-input-mask/v2/tsconfig.json +++ b/types/react-input-mask/v1/tsconfig.json @@ -18,7 +18,7 @@ "noEmit": true, "forceConsistentCasingInFileNames": true, "paths": { - "react-input-mask": ["react-input-mask/v2"] + "react-input-mask": ["react-input-mask/v1"] } }, "files": [ diff --git a/types/react-input-mask/v1/tslint.json b/types/react-input-mask/v1/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-input-mask/v1/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/react-input-mask/v2/index.d.ts b/types/react-input-mask/v2/index.d.ts deleted file mode 100644 index 5f36857eac..0000000000 --- a/types/react-input-mask/v2/index.d.ts +++ /dev/null @@ -1,75 +0,0 @@ -// Type definitions for react-input-mask 2.0.3 -// Project: https://github.com/sanniassin/react-input-mask -// Definitions by: Alexandre Paré -// Dima Danylyuk -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.9.2 - -declare module 'react-input-mask' { - import * as React from 'react'; - - export interface InputState { - value: string; - selection: Selection; - } - - export interface MaskOptions { - mask: string; - maskChar: string; - alwaysShowMask: boolean; - formatChars: Record; - permanents: number[]; - } - - interface Props extends React.InputHTMLAttributes { - /** - * Mask string. Format characters are: - * * `9`: `0-9` - * * `a`: `A-Z, a-z` - * * `\*`: `A-Z, a-z, 0-9` - * - * Any character can be escaped with backslash, which usually will appear as double backslash in JS strings. - * For example, German phone mask with unremoveable prefix +49 will look like `mask="+4\\9 99 999 99"` or `mask={"+4\\\\9 99 999 99"}` - */ - mask: string; - /** - * Character to cover unfilled editable parts of mask. Default character is "_". If set to null, unfilled parts will be empty, like in ordinary input. - */ - maskChar?: string | null; - /** - * Defines format characters with characters as keys and corresponding RegExp string as values. Default ones: - * ``` - * { - * "9": "[0-9]", - * "a": "[A-Za-z]", - * "*": "[A-Za-z0-9]" - * }``` - */ - formatChars?: { [key: string]: string }; - /** - * Show mask even in empty input without focus. - */ - alwaysShowMask?: boolean; - /** - * Use inputRef instead of ref if you need input node to manage focus, selection, etc. - */ - inputRef?: React.Ref; - - /** - * In case you need to implement more complex masking behavior, you can provide - * beforeMaskedValueChange function to change masked value and cursor position - * before it will be applied to the input. - */ - beforeMaskedValueChange?( - newState: InputState, - oldState: InputState, - userInput: string, - maskOptions: MaskOptions, - ): InputState; - } - - class ReactInputMask extends React.Component { - } - - export default ReactInputMask; -} diff --git a/types/react-input-mask/v2/react-input-mask-tests.tsx b/types/react-input-mask/v2/react-input-mask-tests.tsx deleted file mode 100644 index 93c6b1f638..0000000000 --- a/types/react-input-mask/v2/react-input-mask-tests.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import ReactInputMask from 'react-input-mask'; -import * as React from 'react'; - -let ref: HTMLInputElement | null = null; - -
- - - - - - ref = node} /> -
; diff --git a/types/react-input-mask/v2/tslint.json b/types/react-input-mask/v2/tslint.json deleted file mode 100644 index f93cf8562a..0000000000 --- a/types/react-input-mask/v2/tslint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "dtslint/dt.json" -} From 48ec69d35f16441cec6954a8a55612cbc9b21508 Mon Sep 17 00:00:00 2001 From: ToastHawaii Date: Thu, 9 Aug 2018 22:13:51 +0200 Subject: [PATCH 45/94] Add type definition for dav --- types/dav/dav-tests.ts | 250 +++++++++++++ types/dav/index.d.ts | 804 ++++++++++++++++++++++++++++++++++++++++ types/dav/tsconfig.json | 23 ++ types/dav/tslint.json | 1 + 4 files changed, 1078 insertions(+) create mode 100644 types/dav/dav-tests.ts create mode 100644 types/dav/index.d.ts create mode 100644 types/dav/tsconfig.json create mode 100644 types/dav/tslint.json diff --git a/types/dav/dav-tests.ts b/types/dav/dav-tests.ts new file mode 100644 index 0000000000..6a31df698d --- /dev/null +++ b/types/dav/dav-tests.ts @@ -0,0 +1,250 @@ +import * as dav from "dav"; + +(() => { + const xhr = new dav.transport.Basic( + new dav.Credentials({ + username: 'xxx', + password: 'xxx' + }) + ); + + dav.createAccount({ server: 'http://dav.example.com', xhr }) + .then((account) => { + account.calendars.forEach(() => { + }); + }); + const client = new dav.Client(xhr); + + client.createAccount({ + server: 'http://dav.example.com', + accountType: 'carddav' + }).then((account) => { + account.addressBooks.forEach(() => { + }); + }); +})(); + +(() => { + const client = new dav.Client( + new dav.transport.Basic( + new dav.Credentials({ + username: 'xxx', + password: 'xxx' + }) + ), + { + baseUrl: 'https://mail.mozilla.com' + } + ); + + const req = dav.request.basic({ + method: 'PUT', + data: 'BEGIN:VCALENDAR\nEND:VCALENDAR', + etag: '12345' + }); + + client.send(req, '/calendars/123.ics') + .then(() => { }); +})(); + +(() => { + const xhr = new dav.transport.Basic( + new dav.Credentials({ + username: 'xxx', + password: 'xxx' + }) + ); + + const req = dav.request.basic({ + method: 'PUT', + data: 'BEGIN:VCALENDAR\nEND:VCALENDAR', + etag: '12345' + }); + + xhr.send(req, 'https://mail.mozilla.com/calendars/123.ics') + .then(() => { + }); +})(); + +dav.debug.enabled = true; + +(() => { + const xhr = new dav.transport.Basic( + new dav.Credentials({ + username: 'Killer BOB', + password: 'blacklodge' + }) + ); + + const client = new dav.Client(xhr, { baseUrl: 'https://mail.mozilla.com' }); + + const url = 'https://mail.mozilla.com/'; + const req = dav.request.basic({ + method: 'PUT', + data: 'BEGIN:VCALENDAR\nEND:VCALENDAR', + etag: 'abc123' + }); + + const sandbox = dav.createSandbox(); + client.send(req, url, { sandbox }); + xhr.send(req, url, { sandbox }); + + client.createAccount({ sandbox: {}, server: 'http://dav.example.com' }); + dav.createAccount({ + sandbox: {}, + server: 'http://dav.example.com', + xhr + }); + + let calendar = new dav.Calendar(); + client.createCalendarObject(calendar, { + data: 'BEGIN:VCALENDAR\nEND:VCALENDAR', + filename: 'test.ics' + }); + dav.createCalendarObject( + calendar, + { + data: 'BEGIN:VCALENDAR\nEND:VCALENDAR', + filename: 'test.ics', + xhr + }); + + let object = new dav.CalendarObject(); + client.updateCalendarObject(object); + dav.updateCalendarObject( + object, + { + xhr + } + ); + + object = new dav.CalendarObject(); + client.deleteCalendarObject(object); + dav.deleteCalendarObject( + object, + { + xhr + } + ); + + calendar = new dav.Calendar(); + client.syncCalendar(calendar, { syncMethod: 'webdav' }); + dav.syncCalendar( + calendar, + { + syncMethod: 'webdav', + xhr + } + ); + + let account = new dav.Account(); + client.syncCaldavAccount(account, { syncMethod: 'webdav' }); + dav.syncCaldavAccount( + account, + { + syncMethod: 'webdav', + xhr + } + ); + + let addressBook = new dav.AddressBook(); + client.createCard(addressBook, { + data: 'BEGIN:VCARD\nEND:VCARD', + filename: 'test.vcf' + }); + dav.createCard(addressBook, + { + data: 'BEGIN:VCARD\nEND:VCARD', + filename: 'test.vcf', + xhr + }); + + let vcard = new dav.VCard(); + client.updateCard(vcard); + dav.updateCard( + vcard, + { + xhr + } + ); + vcard = new dav.VCard(); + client.deleteCard(vcard); + dav.deleteCard( + vcard, + { + xhr + }); + + addressBook = new dav.AddressBook(); + client.syncAddressBook(addressBook, { + syncMethod: 'basic' + }); + + dav.syncAddressBook( + addressBook, + { + syncMethod: 'basic', + xhr + }); + + account = new dav.Account(); + client.syncCarddavAccount(account, { syncMethod: 'basic' }); + + dav.syncCarddavAccount( + account, + { + syncMethod: 'basic', + xhr + }); +})(); + +(() => { + const xhr = new dav.transport.Basic( + new dav.Credentials({ username: 'admin', password: 'admin' }) + ); + + const req: dav.Request = { + method: 'GET', + transformRequest: (xhr: any) => xhr + }; + + const sandbox = dav.createSandbox(); + xhr.send(req, 'http://127.0.0.1:1337', { sandbox }); + sandbox.requestList; + + xhr.send(req, 'http://127.0.0.1:1337'); +})(); + +(() => { + const credentials = new dav.Credentials({ + clientId: '605300196874-1ki833poa7uqabmh3hq' + + '6u1onlqlsi54h.apps.googleusercontent.com', + clientSecret: 'jQTKlOhF-RclGaGJot3HIcVf', + redirectUrl: 'https://oauth.gaiamobile.org/authenticated', + tokenUrl: 'https://accounts.google.com/o/oauth2/token', + authorizationCode: 'gareth' + }); + + const xhr = new dav.transport.OAuth2(credentials); + + const req = { method: 'GET' }; + + credentials.accessToken = 'EXPIRED'; + credentials.refreshToken = '1/oPHTPFgECWFPrs7KgHdis24u6Xl4E4EnRrkkiwLfzdk'; + credentials.expiration = Date.now() - 1; + + xhr.send(req, 'http://127.0.0.1:1337', { + retry: false + }); + + credentials.accessToken = 'Little Bear'; + credentials.refreshToken = 'spicy tamales'; + const expiration = credentials.expiration = Date.now() + 60 * 60 * 1000; + + credentials.accessToken = 'EXPIRED'; + credentials.refreshToken = 'raspberry pie'; + credentials.expiration = Date.now() + 60 * 60 * 1000; + + credentials.accessToken = 'EXPIRED'; + credentials.refreshToken = 'soda'; +})(); diff --git a/types/dav/index.d.ts b/types/dav/index.d.ts new file mode 100644 index 0000000000..6b1b09e326 --- /dev/null +++ b/types/dav/index.d.ts @@ -0,0 +1,804 @@ +// Type definitions for dav 1.7 +// Project: https://github.com/lambdabaa/dav/ +// Definitions by: ToastHawaii +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +export let version: string; + +/** + * Perform an initial download of a caldav or carddav account's data. + * @param options + * @returns a Promise which will be fulfilled with a dav.Account object. + */ +export function createAccount(options: CreateAccountOptions): Promise; + +export interface CreateAccountOptions { + /** + * one of 'caldav' or 'carddav'. Defaults to 'caldav'. + */ + accountType?: "caldav" | "carddav"; + + /** + * list of caldav filters to send with request. + */ + filters?: object[]; + + /** + * whether or not to load dav collections. + */ + loadCollections?: boolean; + + /** + * whether or not to load dav objects. + */ + loadObjects?: boolean; + + /** + * request sandox. + */ + sandbox?: Sandbox | {}; + + /** + * some url for server (needn't be base url). + */ + server: string; + + /** + * VTIMEZONE calendar object. + */ + timezone?: string; + + /** + * request sender. + */ + + xhr?: transport.Transport; +} + +/** + * Create a calendar object on the parameter calendar. + * @param calendar the calendar to put the object on. + * @param options + * @returns a Promise which will be fulfilled when the calendar has been created. + */ +export function createCalendarObject(calendar: Calendar, options: CreateCalendarObjectOptions): Promise; + +export interface CreateCalendarObjectOptions { + /** + * rfc 5545 VCALENDAR object. + */ + data: string; + + /** + * name for the calendar ics file. + */ + filename: string; + + /** + * request sandbox. + */ + sandbox?: Sandbox; + + /** + * request sender. + */ + xhr?: transport.Transport; +} + +/** + * Persist updates to the parameter calendar object to the server. + * @param calendarObject updated calendar object. + * @param options + * @returns a Promise which will be fulfilled when the calendar has been updated. + */ +export function updateCalendarObject(calendarObject: CalendarObject, options: UpdateCalendarObjectOptions): Promise; + +export interface UpdateCalendarObjectOptions { + /** + * request sandbox. + */ + sandbox?: Sandbox; + + /** + * request sender. + */ + xhr?: transport.Transport; +} + +/** + * Delete the parameter calendar object on the server. + * @param calendarObject target calendar object. + * @param options + * @returns a Promise which will be fulfilled when the calendar has been deleted. + */ +export function deleteCalendarObject(calendarObject: CalendarObject, options: DeleteCalendarObjectOptions): Promise; + +export interface DeleteCalendarObjectOptions { + /** + * request sandbox. + */ + sandbox?: Sandbox; + + /** + * request sender. + */ + xhr?: transport.Transport; +} + +/** + * Fetch changes from the remote server to the parameter calendar. + * @param calendar the calendar to fetch changes for. + * @param options + * @returns a Promise which will be fulfilled with an updated dav.Calendar object once sync is complete. + */ +export function syncCalendar(calendar: Calendar, options: SyncCalendarOptions): Promise; + +export interface SyncCalendarOptions { + /** + * list of caldav filters to send with request. + */ + filters?: object[]; + + /** + * request sandbox. + */ + sandbox?: Sandbox; + + /** + * either 'basic' or 'webdav'. If unspecified, will try to do webdav sync + * and failover to basic sync if rfc 6578 is not supported by the server. + */ + syncMethod?: "basic" | "webdav"; + + /** + * VTIMEZONE calendar object. + */ + timezone?: string; + + /** + * request sender. + */ + xhr?: transport.Transport; +} + +/** + * Fetch changes from the remote server to the account's calendars. + * @param account the calendar account to sync. + * @param options + * @returns a Promise which will be fulfilled with an updated dav.Account object once sync is complete. + */ +export function syncCaldavAccount(account: Account, options: SyncCaldavAccountOptions): Promise; + +export interface SyncCaldavAccountOptions { + /** + * list of caldav filters to send with request. + */ + filters?: object[]; + + /** + * request sandbox. + */ + sandbox?: Sandbox; + + /** + * either 'basic' or 'webdav'. If unspecified, will try to do webdav sync + * and failover to basic sync if rfc 6578 is not supported by the server. + */ + syncMethod?: "basic" | "webdav"; + + /** + * VTIMEZONE calendar object. + */ + timezone?: string; + + /** + * request sender. + */ + xhr?: transport.Transport; +} + +/** + * Create a vcard object on the parameter address book. + * @param addressBook the address book to put the object on. + * @param options + * @returns a Promise which will be fulfilled when the vcard has been created. + */ +export function createCard(addressBook: AddressBook, options: CreateCardOptions): Promise; + +export interface CreateCardOptions { + /** + * VCARD object. + */ + data: string; + /** + * name for the vcard vcf file. + */ + filename: string; + + /** + * request sandbox. + */ + sandbox?: Sandbox; + /** + * request sender. + */ + xhr?: transport.Transport; +} + +/** + * Persist updates to the parameter vcard object to the server. + * @param card updated vcard object. + * @param options + * @returns a Promise which will be fulfilled when the vcard has been updated. + */ +export function updateCard(card: VCard, options: UpdateCardOptions): Promise; + +export interface UpdateCardOptions { + /** + * request sandbox. + */ + sandbox?: Sandbox; + /** + * request sender. + */ + xhr?: transport.Transport; +} + +/** + * Delete the parameter vcard object on the server. + * @param card target vcard object. + * @param options + * @returns a Promise which will be fulfilled when the vcard has been deleted. + */ +export function deleteCard(card: VCard, options: DeleteCardOptions): Promise; + +export interface DeleteCardOptions { + /** + * request sandbox. + */ + sandbox?: Sandbox; + /** + * request sender. + */ + xhr?: transport.Transport; +} + +/** + * Fetch changes from the remote server to the parameter address books. + * @param addressBook the address book to fetch changes for. + * @param options + * @returns a Promise which will be fulfilled with an updated AddressBook object once sync is complete. + */ +export function syncAddressBook(addressBook: AddressBook, options: SyncAddressBookOptions): Promise; + +export interface SyncAddressBookOptions { + /** + * request sandbox. + */ + sandbox?: Sandbox; + /** + * either 'basic' or 'webdav'.If unspecified, will try to do webdav sync + * and failover to basic sync if rfc 6578 is not supported by the server. + */ + syncMethod?: "basic" | "webdav"; + + /** + * request sender. + */ + xhr?: transport.Transport; +} + +/** + * Fetch changes from the remote server to the account's address books. + * @param account the address book account to sync. + * @param options + * @returns a Promise which will be fulfilled with an updated Account object once sync is complete. + */ +export function syncCarddavAccount(account: Account, options: SyncCarddavAccountOptions): Promise; + +export interface SyncCarddavAccountOptions { + /** + * list of caldav filters to send with request. + */ + filters?: object[]; + + /** + * request sandbox. + */ + sandbox?: Sandbox; + + /** + * either 'basic' or 'webdav'. If unspecified, will try to do webdav sync + * and failover to basic sync if rfc 6578 is not supported by the server. + */ + syncMethod?: "basic" | "webdav"; + + /** + * VTIMEZONE calendar object. + */ + timezone?: string; + + /** + * request sender. + */ + xhr?: transport.Transport; +} + +/** + * Create a request sandbox. + */ +export class Sandbox { + constructor(); + + requestList: any[]; + + add(request: any): void; + + /** + * abort sandboxed requests as a group. + */ + abort(): void; +} + +/** + * @deprecated + */ +export function createSandbox(): Sandbox; + +export namespace transport { + class Transport { + /** + * @param credentials user authorization. + */ + constructor(credentials: Credentials); + + send(request: Request, url: string, options?: TransportOptions): Promise; + } + + interface TransportOptions { + /** + * request sandbox. + */ + sandbox?: Sandbox; + + retry?: boolean; + } + + class Basic extends Transport { + /** + * Create a new Basic object. This sends dav requests using http basic authentication. + * @param credentials user authorization. + */ + constructor(credentials: Credentials); + + /** + * + * @param request object with request info. + * @param url + * @param options + * @return a promise that will be resolved with an xhr request after + * its readyState is 4 or the result of applying an optional request + * `transformResponse` function to the xhr object after its readyState + * is 4. + */ + send(request: Request, url: string, options?: TransportOptions): Promise; + } + + /** + * Create a new OAuth2 object.This sends dav requests authorized via rfc 6749 oauth2. + * @param credentials user authorization. + */ + class OAuth2 extends Transport { + constructor(credentials: Credentials); + + /** + * + * @param request object with request info. + * @param url + * @param options + * @return a promise that will be resolved with an xhr request after + * its readyState is 4 or the result of applying an optional request + * `transformResponse` function to the xhr object after its readyState + * is 4. + */ + send(request: Request, url: string, options?: TransportOptions): Promise; + } +} + +export namespace request { + /** + * + * @param options + * @returns + */ + function addressBookQuery(options: AddressBookQueryOptions): string; + + interface AddressBookQueryOptions { + /** + * value for Depth header. + */ + depth?: string; + + /** + * list of props to request. + */ + props: object[]; + } + + /** + * + * @param options + * @returns + */ + function basic(options: BasicOptions): Request; + + interface BasicOptions { + /** + * put request body. + */ + data: string; + + /** + * http method. + */ + method: string; + + /** + * cached calendar object etag. + */ + etag: string; + } + + /** + * + * @param options + * @returns + */ + function calendarQuery(options: CalendarQueryOptions): string; + + interface CalendarQueryOptions { + /** + * value for Depth header. + */ + depth?: string; + + /** + * list of filters to send with request. + */ + filters: object[]; + + /** + * list of props to request. + */ + props: object[]; + + /** + * VTIMEZONE calendar object. + */ + timezone: string; + } + + /** + * + * @param options + * @returns + */ + function propfind(options: PropfindOptions): string; + + interface PropfindOptions { + /** + * value for Depth header. + */ + depth?: string; + + /** + * list of props to request. + */ + props: object[]; + } + + /** + * + * @param options + * @returns + */ + function syncCollection(options: SyncCollectionOptions): string; + + interface SyncCollectionOptions { + /** + * option value for Depth header. + */ + depth?: string; + + /** + * list of props to request. + */ + props: object[]; + + /** + * indicates scope of the sync report request. + */ + syncLevel: number; + + /** + * synchronization token provided by the server. + */ + syncToken: string; + } +} + +export class Client { + /** + * Create a new Client object. The client interface allows consumers to set + * their credentials and transport once and then make authorized requests + * without passing them to each request. Each of the other, public API + * methods should be available on Client objects. + * @param xhr request sender. + * @param options + */ + constructor(xhr: transport.Transport, options?: ClientOptions); + + /** + * Send a request using this client's transport (and perhaps baseUrl). + * @param req dav request. + * @param options + * @return a promise that will be resolved with an xhr request after + * its readyState is 4 or the result of applying an optional request + * `transformResponse` function to the xhr object after its readyState + * is 4. + */ + send(req: Request, uri: string, options?: ClientSendOptions): Promise; + + /** + * Perform an initial download of a caldav or carddav account's data. + * @param options + * @returns a Promise which will be fulfilled with a dav.Account object. + */ + createAccount(options?: CreateAccountOptions): Promise; + + /** + * Create a calendar object on the parameter calendar. + * @param calendar the calendar to put the object on. + * @param options + * @returns a Promise which will be fulfilled when the calendar has been created. + */ + createCalendarObject(calendar: Calendar, options?: CreateCalendarObjectOptions): Promise; + + /** + * Persist updates to the parameter calendar object to the server. + * @param calendarObject updated calendar object. + * @param options + * @returns a Promise which will be fulfilled when the calendar has been updated. + */ + updateCalendarObject(calendarObject: CalendarObject, options?: UpdateCalendarObjectOptions): Promise; + + /** + * Delete the parameter calendar object on the server. + * @param calendarObject target calendar object. + * @param options + * @returns a Promise which will be fulfilled when the calendar has been deleted. + */ + deleteCalendarObject(calendarObject: CalendarObject, options?: DeleteCalendarObjectOptions): Promise; + + /** + * Fetch changes from the remote server to the parameter calendar. + * @param calendar the calendar to fetch changes for. + * @param options + * @returns a Promise which will be fulfilled with an updated dav.Calendar object once sync is complete. + */ + syncCalendar(calendar: Calendar, options?: SyncCalendarOptions): Promise; + + /** + * Fetch changes from the remote server to the account's calendars. + * @param account the calendar account to sync. + * @param options + * @returns a Promise which will be fulfilled with an updated dav.Account object once sync is complete. + */ + syncCaldavAccount(account: Account, options?: SyncCaldavAccountOptions): Promise; + + /** + * Create a vcard object on the parameter address book. + * @param addressBook the address book to put the object on. + * @param options + * @returns a Promise which will be fulfilled when the vcard has been created. + */ + createCard(addressBook: AddressBook, options?: CreateCardOptions): Promise; + + /** + * Persist updates to the parameter vcard object to the server. + * @param card updated vcard object. + * @param options + * @returns a Promise which will be fulfilled when the vcard has been updated. + */ + updateCard(card: VCard, options?: UpdateCardOptions): Promise; + + /** + * + * Delete the parameter vcard object on the server. + * @param card target vcard object. + * @param options + * @returns a Promise which will be fulfilled when the vcard has been deleted. + */ + deleteCard(card: VCard, options?: DeleteCardOptions): Promise; + + /** + * Fetch changes from the remote server to the parameter address books. + * @param addressBook the address book to fetch changes for. + * @param options + * @returns a Promise which will be fulfilled with an updated AddressBook object once sync is complete. + */ + syncAddressBook(addressBook: AddressBook, options?: SyncAddressBookOptions): Promise; + + /** + * Fetch changes from the remote server to the account's address books. + * @param account the address book account to sync. + * @param options + * @returns a Promise which will be fulfilled with an updated Account object once sync is complete. + */ + syncCarddavAccount(account: Account, options?: SyncCarddavAccountOptions): Promise; +} + +export interface ClientOptions { + /** + * root url to resolve relative request urls with. + */ + baseUrl: string; +} + +export interface ClientSendOptions { + /** + * request sandbox. + */ + sandbox?: Sandbox; + /** + * relative url for request. + */ + url?: string; +} + +export type Partial = { + [P in keyof T]?: T[P]; +}; + +export class Account { + constructor(options?: AccountOptions); + server: string; + credentials: Credentials; + rootUrl: string; + principalUrl: string; + homeUrl: string; + calendars: Calendar[]; + addressBooks: AddressBook[]; +} + +export type AccountOptions = Partial; + +export class Credentials { + constructor(options?: CredentialsOptions); + + /** + * username (perhaps email) for calendar user. + */ + username: string; + + /** + * plaintext password for calendar user. + */ + password: string; + + /** + * oauth client id. + */ + clientId: string; + + /** + * oauth client secret. + */ + clientSecret: string; + + /** + * oauth code. + */ + authorizationCode: string; + + /** + * oauth redirect url. + */ + redirectUrl: string; + + /** + * oauth token url. + */ + tokenUrl: string; + + /** + * oauth access token. + */ + accessToken: string; + + /** + * oauth refresh token. + */ + refreshToken: string; + + /** + * unix time for access token expiration. + */ + expiration: number; +} +export type CredentialsOptions = Partial; + +export class DAVCollection { + constructor(options: DAVCollectionOptions); + data: string; + objects: T[]; + account: Account; + ctag: string; + description: string; + displayName: string; + reports: string[]; + resourcetype: string; + syncToken: string; + url: string; +} +export type DAVCollectionOptions = Partial>; + +export class AddressBook extends DAVCollection { + constructor(options?: AddressBookOptions); +} +export type AddressBookOptions = Partial; + +export class Calendar extends DAVCollection { + constructor(options?: CalendarOptions); + + components: string[]; + timezone: string; +} +export type CalendarOptions = Partial; + +export class DAVObject { + constructor(options: DAVObjectOptions); + data: string; + etag: string; + url: string; +} +export type DAVObjectOptions = Partial; + +export class CalendarObject extends DAVObject { + constructor(options?: CalendarObjectOptions); + calendar: Calendar; + calendarData: string; +} +export type CalendarObjectOptions = Partial; + +export class VCard extends DAVObject { + constructor(options?: VCardOptions); + addressBook: AddressBook; + addressData: string; +} + +export type VCardOptions = Partial; + +export class Request { + constructor(options?: RequestOptions); + method: string; + requestData?: string; + transformRequest?: (xhr: any) => any; + transformResponse?: (xhr: any) => any; + onerror?: (error: Error) => any; +} + +export type RequestOptions = Partial; + +export namespace debug { + let enabled: boolean; +} + +export namespace ns { + const CALENDAR_SERVER = 'http://calendarserver.org/ns/'; + const CALDAV_APPLE = 'http://apple.com/ns/ical/'; + const CALDAV = 'urn:ietf:params:xml:ns:caldav'; + const CARDDAV = 'urn:ietf:params:xml:ns:carddav'; + const DAV = 'DAV:'; +} diff --git a/types/dav/tsconfig.json b/types/dav/tsconfig.json new file mode 100644 index 0000000000..5de3437644 --- /dev/null +++ b/types/dav/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", + "dav-tests.ts" + ] +} \ No newline at end of file diff --git a/types/dav/tslint.json b/types/dav/tslint.json new file mode 100644 index 0000000000..2750cc0197 --- /dev/null +++ b/types/dav/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } \ No newline at end of file From 713219e64b3fb52b52f35db6f7b558b7e2913f2f Mon Sep 17 00:00:00 2001 From: Renaud Chaput Date: Thu, 9 Aug 2018 23:08:23 +0200 Subject: [PATCH 46/94] typed.js: remove package as typings are not included upstream --- notNeededPackages.json | 6 + types/typed.js/index.d.ts | 185 ------------------------------- types/typed.js/tsconfig.json | 24 ---- types/typed.js/tslint.json | 3 - types/typed.js/typed.js-tests.ts | 29 ----- 5 files changed, 6 insertions(+), 241 deletions(-) delete mode 100644 types/typed.js/index.d.ts delete mode 100644 types/typed.js/tsconfig.json delete mode 100644 types/typed.js/tslint.json delete mode 100644 types/typed.js/typed.js-tests.ts diff --git a/notNeededPackages.json b/notNeededPackages.json index 8b56dbd9b5..056aa81e5b 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -1530,6 +1530,12 @@ "sourceRepoURL": "https://github.com/samchon/tstl", "asOfVersion": "1.5.7" }, + { + "libraryName": "typed.js", + "typingsPackageName": "typed.js", + "sourceRepoURL": "https://github.com/mattboldt/typed.js", + "asOfVersion": "2.0.9" + }, { "libraryName": "TypeScript", "typingsPackageName": "typescript", diff --git a/types/typed.js/index.d.ts b/types/typed.js/index.d.ts deleted file mode 100644 index 45064e9c03..0000000000 --- a/types/typed.js/index.d.ts +++ /dev/null @@ -1,185 +0,0 @@ -// Type definitions for typed.js 2.0 -// Project: https://github.com/mattboldt/typed.js -// Definitions by: Davide Donadello -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -export default Typed; - -export class Typed { - constructor(elementId: string, options: TypedJsOptions); - - /** - * Toggle start() and stop() of the Typed instance - */ - toggle(): void; - - /** - * Stop typing / backspacing and enable cursor blinking - */ - stop(): void; - - /** - * Start typing / backspacing after being stopped - */ - start(): void; - - /** - * Destroy this instance of Typed - */ - destroy(): void; - - /** - * Reset Typed and optionally restarts - */ - reset(restart: boolean): void; -} - -export type TypedJsContentType = "html" | "null"; - -export interface TypedJsOptions { - /** - * Strings to be typed - */ - strings?: string[]; - - /** - * ID of element containing string children - */ - stringsElement?: string; - - /** - * Type speed in milliseconds - */ - typeSpeed?: number; - - /** - * Time before typing starts in milliseconds - */ - startDelay?: number; - - /** - * Backspacing speed in milliseconds - */ - backSpeed?: number; - - /** - * Only backspace what doesn't match the previous string - */ - smartBackspace?: boolean; - - /** - * Shuffle the strings - */ - shuffle?: boolean; - - /** - * Time before backspacing in milliseconds - */ - backDelay?: number; - - /** - * Fade out instead of backspace - */ - fadeOut?: boolean; - - /** - * Css class for fade animation - */ - fadeOutClass?: string; - - /** - * Fade out delay in milliseconds - */ - fadeOutDelay?: number; - - /** - * Loop strings - */ - loop?: boolean; - - /** - * Amount of loops - */ - loopCount?: number; - - /** - * Show cursor - */ - showCursor?: boolean; - - /** - * Character for cursor - */ - cursorChar?: string; - - /** - * Insert CSS for cursor and fadeOut into HTML - */ - autoInsertCss?: boolean; - - /** - * Attribute for typing - * Ex: input placeholder, value, or just HTML text - */ - attr?: string; - - /** - * Bind to focus and blur if el is text input - */ - bindInputFocusEvents?: boolean; - - /** - * 'html' or 'null' for plaintext - */ - contentType?: TypedJsContentType; - - /** - * All typing is complete - */ - onComplete?: (self: Typed) => void; - - /** - * Before each string is typed - */ - preStringTyped?: (arrayPos: number, self: Typed) => void; - - /** - * After each string is typed - */ - onStringTyped?: (arrayPos: number, self: Typed) => void; - - /** - * During looping, after last string is typed - */ - onLastStringBackspaced?: (self: Typed) => void; - - /** - * Typing has been stopped - */ - onTypingPaused?: (arrayPos: number, self: Typed) => void; - - /** - * Typing has been started after being stopped - */ - onTypingResumed?: (arrayPos: number, self: Typed) => void; - - /** - * After reset - */ - onReset?: (self: Typed) => void; - - /** - * After stop - */ - onStop?: (arrayPos: number, self: Typed) => void; - - /** - * After start - */ - onStart?: (arrayPos: number, self: Typed) => void; - - /** - * After destroy - */ - onDestroy?: (self: Typed) => void; -} diff --git a/types/typed.js/tsconfig.json b/types/typed.js/tsconfig.json deleted file mode 100644 index b018ca64fe..0000000000 --- a/types/typed.js/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true, - "esModuleInterop": true - }, - "files": [ - "index.d.ts", - "typed.js-tests.ts" - ] -} diff --git a/types/typed.js/tslint.json b/types/typed.js/tslint.json deleted file mode 100644 index e60c15844f..0000000000 --- a/types/typed.js/tslint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "dtslint/dt.json" -} \ No newline at end of file diff --git a/types/typed.js/typed.js-tests.ts b/types/typed.js/typed.js-tests.ts deleted file mode 100644 index 3e4bd0a137..0000000000 --- a/types/typed.js/typed.js-tests.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { Typed, TypedJsOptions } from 'typed.js'; - -// Create instance -const typed = new Typed(".element", { - strings: ["First sentence.", "& a second sentence."], - typeSpeed: 100, - startDelay: 0, - backSpeed: 50, - smartBackspace: true, - shuffle: true, - backDelay: 150, - loop: true, - showCursor: true, - autoInsertCss: true, - contentType: "html", - onComplete: (self: Typed) => { - // Complete!! - }, - onDestroy: (self: Typed) => { - // End!! - }, -}); - -// Methods -typed.reset(false); -typed.destroy(); -typed.start(); -typed.stop(); -typed.toggle(); From d7002d4d09fb0374a00ba8d01395c0c1e162b0b0 Mon Sep 17 00:00:00 2001 From: Ilia Beliaev Date: Fri, 10 Aug 2018 10:28:26 +0300 Subject: [PATCH 47/94] Fixes after running lint. --- types/vue-select/index.d.ts | 38 +++++++++++++--------------- types/vue-select/tsconfig.json | 4 ++- types/vue-select/vue-select-tests.ts | 12 ++++----- 3 files changed, 25 insertions(+), 29 deletions(-) diff --git a/types/vue-select/index.d.ts b/types/vue-select/index.d.ts index 331fa7ec92..ff8767e189 100644 --- a/types/vue-select/index.d.ts +++ b/types/vue-select/index.d.ts @@ -1,22 +1,18 @@ -// Type definitions for vue-select 2.4.0 +// Type definitions for vue-select 2.4 // Project: https://github.com/sagalbot/vue-select#readme // Definitions by: Ilia Beliaev // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// Typescript version: 2.4.0 +// TypeScript Version: 2.3 -import {VueConstructor} from 'vue'; +import { VueConstructor } from 'vue'; export default VueSelect; - export const VueSelect: VueSelectConstructor; - -export type Option = any | null; - -export type OptionConsumer = (option: Option) => void; +export type OptionConsumer = (option: any) => void; export interface VueSelectProps { - value: Option; - options: Option[]; + value: any; + options: any[]; disabled: boolean; maxHeight: string; searchable: boolean; @@ -26,13 +22,13 @@ export interface VueSelectProps { clearSearchOnSelect: boolean; closeOnSelect: boolean; label: string; - getOptionLabel: (option: Option) => string; + getOptionLabel: (option: any) => string; onChange: OptionConsumer; taggable: boolean; tabindex: number | null; pushTags: boolean; filterable: boolean; - createOption: (option: Option) => Option; + createOption: (option: any) => any; resetOnOptionsChange: boolean; noDrop: boolean; inputId: string | null; @@ -42,14 +38,14 @@ export interface VueSelectProps { export interface VueSelectData { search: string; open: boolean; - mutableValue: Option; - mutableOptions: Option[]; + mutableValue: any; + mutableOptions: any[]; } export interface VueSelectWatch { - value: (val: Option) => void; - mutableValue: (val: Option, old: Option) => void; - options: (val: Option) => void; + value: (val: any) => void; + mutableValue: (val: any, old: any) => void; + options: (val: any) => void; mutableOptions: () => void; multiple: (reset: boolean) => void; created: () => void; @@ -61,12 +57,12 @@ export interface VueSelectMethods { clearSelection: () => void; onAfterSelect: OptionConsumer; toggleDropdown: (e: Event) => void; - isOptionSelected: (option: Option) => boolean; + isOptionSelected: (option: any) => boolean; onEscape: () => void; onSearchBlur: () => void; onSearchFocus: () => void; maybeDeleteValue: () => void; - optionExists: (option: Option) => boolean; + optionExists: (option: any) => boolean; maybePushTag: OptionConsumer; } @@ -76,9 +72,9 @@ export interface VueSelectComputed { searching: () => boolean; dropdownOpen: () => boolean; searchPlaceholder: () => boolean; - filteredOptions: () => Option[]; + filteredOptions: () => any[]; isValueEmpty: () => boolean; - valueAsArray: () => Option[]; + valueAsArray: () => any[]; showClearButton: () => boolean; } diff --git a/types/vue-select/tsconfig.json b/types/vue-select/tsconfig.json index c757293eec..656897ba29 100644 --- a/types/vue-select/tsconfig.json +++ b/types/vue-select/tsconfig.json @@ -2,11 +2,13 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6" + "es6", + "dom" ], "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, + "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ "../" diff --git a/types/vue-select/vue-select-tests.ts b/types/vue-select/vue-select-tests.ts index 17cf97b2be..8fea33b2dc 100644 --- a/types/vue-select/vue-select-tests.ts +++ b/types/vue-select/vue-select-tests.ts @@ -1,5 +1,5 @@ import Vue from 'vue'; -import VueSelect, {Option} from 'vue-select'; +import VueSelect from 'vue-select'; const options = [ { @@ -8,29 +8,27 @@ const options = [ { name: 'SomeName2' } -] +]; new Vue({ - el: '#app', data: { options, value: null, - }, components: { 'vue-select': VueSelect }, methods: { - getOptionLabel(option: Option) { + getOptionLabel(option: any) { if (option && option.name) { return option.name; } return ''; }, - optionConsumer(option: Option) { + optionConsumer(option: any) { }, - optionToOption(option: Option) { + optionToOption(option: any) { return option; }, onSearch(search: string, loading: (b: boolean) => void) { From 25b51166162b36e5aa372d635b58606a8ff178ea Mon Sep 17 00:00:00 2001 From: wznuk Date: Fri, 10 Aug 2018 09:44:35 -0500 Subject: [PATCH 48/94] Added the "ImageryClarity" Basemaps The current version of this file is missing the "ImageryClartiy" basemap option, despite the fact the esri-leaflet supports it. --- types/esri-leaflet/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/esri-leaflet/index.d.ts b/types/esri-leaflet/index.d.ts index 3dbd351cb5..df1a9c3752 100644 --- a/types/esri-leaflet/index.d.ts +++ b/types/esri-leaflet/index.d.ts @@ -44,6 +44,7 @@ declare module 'leaflet' { | 'GrayLabels' | 'DarkGrayLabels' | 'ImageryLabels' + | 'ImageryClarity' | 'ImageryTransportation' | 'ShadedReliefLabels' | 'TerrainLabels'; From c8617e06e6125533299734bfb96efe31b238e815 Mon Sep 17 00:00:00 2001 From: Walker Burgin Date: Fri, 10 Aug 2018 08:49:48 -0700 Subject: [PATCH 49/94] Add orderable --- types/webpack-chain/index.d.ts | 17 +++++++++++++++-- types/webpack-chain/webpack-chain-tests.ts | 20 ++++++++++++++++++++ 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/types/webpack-chain/index.d.ts b/types/webpack-chain/index.d.ts index 691e4be9b9..033ef9951f 100644 --- a/types/webpack-chain/index.d.ts +++ b/types/webpack-chain/index.d.ts @@ -85,10 +85,14 @@ declare namespace Config { class Plugins extends TypedChainedMap> {} - class Plugin extends ChainedMap { + class Plugin extends ChainedMap implements Orderable { init(value: (plugin: PluginClass, args: any[]) => webpack.Plugin): this; use(plugin: PluginClass, args?: any[]): this; tap(f: (args: any[]) => any[]): this; + + // Orderable + before(name: string): this; + after(name: string): this; } class Module extends ChainedMap { @@ -231,11 +235,15 @@ declare namespace Config { interface LoaderOptions { [name: string]: any; } - class Use extends ChainedMap { + class Use extends ChainedMap implements Orderable { loader(value: string): this; options(value: LoaderOptions): this; tap(f: (options: LoaderOptions) => LoaderOptions): this; + + // Orderable + before(name: string): this; + after(name: string): this; } type DevTool = 'eval' | 'inline-source-map' | 'cheap-eval-source-map' | 'cheap-source-map' | @@ -255,4 +263,9 @@ declare namespace Config { interface PluginClass { new (...opts: any[]): webpack.Plugin; } + + interface Orderable { + before(name: string): this; + after(name: string): this; + } } diff --git a/types/webpack-chain/webpack-chain-tests.ts b/types/webpack-chain/webpack-chain-tests.ts index 8775fec7f9..e61cd4e304 100644 --- a/types/webpack-chain/webpack-chain-tests.ts +++ b/types/webpack-chain/webpack-chain-tests.ts @@ -46,8 +46,20 @@ config .use(webpack.DefinePlugin, []) .end() + .plugin('bar') + .use(webpack.DefinePlugin, []) + .before('foo') + .end() + + .plugin('baz') + .use(webpack.DefinePlugin, []) + .after('bar') + .end() + .plugins .delete('foo') + .delete('bar') + .delete('baz') .end() .devServer @@ -113,6 +125,14 @@ config .pre() .post() .end() + .rule('lint') + .test(/.js$/) + .use('eslint') + .loader('eslint-loader') + .options({}) + .after('compile') + .end() + .end() .rules .delete('compile') .end() From 3221d9567c1359e6a701674131edea8608481ea4 Mon Sep 17 00:00:00 2001 From: Walker Burgin Date: Fri, 10 Aug 2018 08:52:20 -0700 Subject: [PATCH 50/94] Fix tests --- types/webpack-chain/webpack-chain-tests.ts | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/types/webpack-chain/webpack-chain-tests.ts b/types/webpack-chain/webpack-chain-tests.ts index e61cd4e304..ffeeba1248 100644 --- a/types/webpack-chain/webpack-chain-tests.ts +++ b/types/webpack-chain/webpack-chain-tests.ts @@ -119,19 +119,17 @@ config .loader('babel-loader') .options({}) .end() - .uses - .delete('babel') - .end() - .pre() - .post() - .end() - .rule('lint') - .test(/.js$/) .use('eslint') .loader('eslint-loader') .options({}) .after('compile') .end() + .uses + .delete('babel') + .delete('eslint') + .end() + .pre() + .post() .end() .rules .delete('compile') From dee63e3c68dcc887549fd227be95ba6a27396ba9 Mon Sep 17 00:00:00 2001 From: Walker Burgin Date: Fri, 10 Aug 2018 08:54:30 -0700 Subject: [PATCH 51/94] Fix tests --- types/webpack-chain/webpack-chain-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/webpack-chain/webpack-chain-tests.ts b/types/webpack-chain/webpack-chain-tests.ts index ffeeba1248..f1d0daa5e2 100644 --- a/types/webpack-chain/webpack-chain-tests.ts +++ b/types/webpack-chain/webpack-chain-tests.ts @@ -122,7 +122,7 @@ config .use('eslint') .loader('eslint-loader') .options({}) - .after('compile') + .after('babel') .end() .uses .delete('babel') From a09e943aad6944410c388789981f5a16561b691b Mon Sep 17 00:00:00 2001 From: nju33 Date: Sun, 12 Aug 2018 04:20:29 +0900 Subject: [PATCH 52/94] add type definitions for nanoevents --- types/nanoevents/index.d.ts | 14 ++++++++++++++ types/nanoevents/nanoevents-tests.ts | 8 ++++++++ types/nanoevents/tsconfig.json | 24 ++++++++++++++++++++++++ types/nanoevents/tslint.json | 1 + types/nanoevents/unbind-all.d.ts | 5 +++++ 5 files changed, 52 insertions(+) create mode 100644 types/nanoevents/index.d.ts create mode 100644 types/nanoevents/nanoevents-tests.ts create mode 100644 types/nanoevents/tsconfig.json create mode 100644 types/nanoevents/tslint.json create mode 100644 types/nanoevents/unbind-all.d.ts diff --git a/types/nanoevents/index.d.ts b/types/nanoevents/index.d.ts new file mode 100644 index 0000000000..0da2f0add3 --- /dev/null +++ b/types/nanoevents/index.d.ts @@ -0,0 +1,14 @@ +// Type definitions for nanoevents 1.0 +// Project: https://github.com/ai/nanoevents#readme +// Definitions by: nju33 +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +declare function unbind(): void; + +declare class NanoEvents { + on(name: U, callBack: (arg: T[U]) => any): typeof unbind; + emit(name: U, value: T[U]): void; +} + +export = NanoEvents; diff --git a/types/nanoevents/nanoevents-tests.ts b/types/nanoevents/nanoevents-tests.ts new file mode 100644 index 0000000000..7e6eaa8cd8 --- /dev/null +++ b/types/nanoevents/nanoevents-tests.ts @@ -0,0 +1,8 @@ +import NanoEvents = require('nanoevents'); +import unbindAll = require('nanoevents/unbind-all'); + +const emitter = new NanoEvents<{foo: {foo: string}, bar: {bar: string}}>(); +const unbind = emitter.on('foo', action => action.foo); +emitter.emit('bar', {bar: 'test'}); +unbind(); +unbindAll(emitter); diff --git a/types/nanoevents/tsconfig.json b/types/nanoevents/tsconfig.json new file mode 100644 index 0000000000..d3291ed1d9 --- /dev/null +++ b/types/nanoevents/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "nanoevents-tests.ts", + "unbind-all.d.ts" + ] +} diff --git a/types/nanoevents/tslint.json b/types/nanoevents/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/nanoevents/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/nanoevents/unbind-all.d.ts b/types/nanoevents/unbind-all.d.ts new file mode 100644 index 0000000000..1f5662e493 --- /dev/null +++ b/types/nanoevents/unbind-all.d.ts @@ -0,0 +1,5 @@ +import NanoEmitter = require('.'); + +declare function unbindAll(emitter: NanoEmitter): void; + +export = unbindAll; From 6fd3f6882094c7230a4b5ff2b60d43cc765c2a07 Mon Sep 17 00:00:00 2001 From: DimaMukhin Date: Sat, 11 Aug 2018 17:39:38 -0700 Subject: [PATCH 53/94] added type definitions for koa-redis-cache --- types/koa-redis-cache/index.d.ts | 93 +++++++++++++++++++ .../koa-redis-cache/koa-redis-cache-tests.ts | 34 +++++++ types/koa-redis-cache/tsconfig.json | 22 +++++ types/koa-redis-cache/tslint.json | 1 + 4 files changed, 150 insertions(+) create mode 100644 types/koa-redis-cache/index.d.ts create mode 100644 types/koa-redis-cache/koa-redis-cache-tests.ts create mode 100644 types/koa-redis-cache/tsconfig.json create mode 100644 types/koa-redis-cache/tslint.json diff --git a/types/koa-redis-cache/index.d.ts b/types/koa-redis-cache/index.d.ts new file mode 100644 index 0000000000..2d983f862d --- /dev/null +++ b/types/koa-redis-cache/index.d.ts @@ -0,0 +1,93 @@ +// Type definitions for koa-redis-cache 3.0.1 +// Project: https://github.com/coderhaoxin/koa-redis-cache +// Definitions by: Dima Mukhin +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import * as Koa from "koa"; +import * as Redis from "redis"; + +type onErrorCallback = (error: Error) => void; + +type getPrefixCallback = (ctx: Koa.Context) => String; + +declare namespace cache { + interface CacheOptions { + /** + * redis key prefix, default is koa-redis-cache: + * If a function is supplied, its signature should be function(ctx) {} and it should return a string to use as the redis key prefix + */ + prefix?: String | getPrefixCallback; + + /** + * redis expire time (second), default is 30 * 60 (30 min) + */ + expire?: Number; + + /** + * if the passParam exists in the query string, skip the cache + */ + passParam?: String; + + /** + * max length of body size (in bytes) to cache. + * if the size of the body exceeds maxLength, the body will not be cached. + * default is: Infinity + */ + maxLength?: Number; + + /** + * the routes to cache, default is ['(.*)']. + * can be set to an array of routes (String), or an array of RouteOptions + */ + routes?: Array | Array; + + /** + * the routes to exclude, default is []. + * example: ['/api/(.*)', '/view/:id'] + */ + exclude?: Array; + + /** + * callback function for error, default is function() {} + */ + onerror?: onErrorCallback; + + /** + * redis options + */ + redis?: RedisOptions; + } + + interface RouteOptions { + /** + * the route to cache, example: '/api/(.*)' + */ + route: String; + + /** + * expiration time in seconds for cached responses for the route + */ + expire?: Number; + } + + interface RedisOptions { + /** + * host name of the redis server, default: 'localhost' + */ + host?: String, + + /** + * port number of the redis server, default: 6379 + */ + port?: Number, + + /** + * node_redis options + */ + options?: Redis.ClientOpts + } +} + +declare function cache(opts?: cache.CacheOptions): Koa.Middleware; + +export = cache; diff --git a/types/koa-redis-cache/koa-redis-cache-tests.ts b/types/koa-redis-cache/koa-redis-cache-tests.ts new file mode 100644 index 0000000000..9c5f528ba7 --- /dev/null +++ b/types/koa-redis-cache/koa-redis-cache-tests.ts @@ -0,0 +1,34 @@ +import * as Koa from "koa"; +import * as cache from 'koa-redis-cache'; + +const app = new Koa(); + +const routeOptions: Array = [ + { + route: '/api/test', + expire: 60 + }, + { + route: '/api/users' + } +]; + +const redisOptions: cache.RedisOptions = { + port: 6379, + host: 'localhost' +}; + +const options: cache.CacheOptions = { + prefix: (ctx: Koa.Context) => 'koa-redis-cache:', + expire: 30 * 30, + passParam: 'skip', + maxLength: 1024, + routes: routeOptions, + exclude: ['/api/(.*)', '/view/:id'], + onerror: (error: Error) => console.log(error), + redis: redisOptions +}; + +app.use(cache(options)); + +app.listen(80); diff --git a/types/koa-redis-cache/tsconfig.json b/types/koa-redis-cache/tsconfig.json new file mode 100644 index 0000000000..dbf782ccae --- /dev/null +++ b/types/koa-redis-cache/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "koa-redis-cache-tests.ts" + ] +} \ No newline at end of file diff --git a/types/koa-redis-cache/tslint.json b/types/koa-redis-cache/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/koa-redis-cache/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 8586e357ea6edf12d7484811ae86dccc98e2fec8 Mon Sep 17 00:00:00 2001 From: DimaMukhin Date: Sat, 11 Aug 2018 18:08:17 -0700 Subject: [PATCH 54/94] fixed failing tests --- types/koa-redis-cache/index.d.ts | 29 ++++++++++--------- .../koa-redis-cache/koa-redis-cache-tests.ts | 2 +- types/koa-redis-cache/tsconfig.json | 1 + 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/types/koa-redis-cache/index.d.ts b/types/koa-redis-cache/index.d.ts index 2d983f862d..58f7f120ca 100644 --- a/types/koa-redis-cache/index.d.ts +++ b/types/koa-redis-cache/index.d.ts @@ -1,14 +1,15 @@ -// Type definitions for koa-redis-cache 3.0.1 +// Type definitions for koa-redis-cache 3.0 // Project: https://github.com/coderhaoxin/koa-redis-cache // Definitions by: Dima Mukhin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 import * as Koa from "koa"; import * as Redis from "redis"; type onErrorCallback = (error: Error) => void; -type getPrefixCallback = (ctx: Koa.Context) => String; +type getPrefixCallback = (ctx: Koa.Context) => string; declare namespace cache { interface CacheOptions { @@ -16,36 +17,36 @@ declare namespace cache { * redis key prefix, default is koa-redis-cache: * If a function is supplied, its signature should be function(ctx) {} and it should return a string to use as the redis key prefix */ - prefix?: String | getPrefixCallback; + prefix?: string | getPrefixCallback; /** * redis expire time (second), default is 30 * 60 (30 min) */ - expire?: Number; + expire?: number; /** * if the passParam exists in the query string, skip the cache */ - passParam?: String; + passParam?: string; /** * max length of body size (in bytes) to cache. * if the size of the body exceeds maxLength, the body will not be cached. * default is: Infinity */ - maxLength?: Number; + maxLength?: number; /** * the routes to cache, default is ['(.*)']. - * can be set to an array of routes (String), or an array of RouteOptions + * can be set to an array of routes (string), or an array of RouteOptions */ - routes?: Array | Array; + routes?: RouteOptions[] | string[]; /** * the routes to exclude, default is []. * example: ['/api/(.*)', '/view/:id'] */ - exclude?: Array; + exclude?: string[]; /** * callback function for error, default is function() {} @@ -62,29 +63,29 @@ declare namespace cache { /** * the route to cache, example: '/api/(.*)' */ - route: String; + route: string; /** * expiration time in seconds for cached responses for the route */ - expire?: Number; + expire?: number; } interface RedisOptions { /** * host name of the redis server, default: 'localhost' */ - host?: String, + host?: string; /** * port number of the redis server, default: 6379 */ - port?: Number, + port?: number; /** * node_redis options */ - options?: Redis.ClientOpts + options?: Redis.ClientOpts; } } diff --git a/types/koa-redis-cache/koa-redis-cache-tests.ts b/types/koa-redis-cache/koa-redis-cache-tests.ts index 9c5f528ba7..b83d0b3aea 100644 --- a/types/koa-redis-cache/koa-redis-cache-tests.ts +++ b/types/koa-redis-cache/koa-redis-cache-tests.ts @@ -3,7 +3,7 @@ import * as cache from 'koa-redis-cache'; const app = new Koa(); -const routeOptions: Array = [ +const routeOptions: cache.RouteOptions[] = [ { route: '/api/test', expire: 60 diff --git a/types/koa-redis-cache/tsconfig.json b/types/koa-redis-cache/tsconfig.json index dbf782ccae..897679810e 100644 --- a/types/koa-redis-cache/tsconfig.json +++ b/types/koa-redis-cache/tsconfig.json @@ -7,6 +7,7 @@ "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, + "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ "../" From 42e2b3b3650e9744a51cda512c9d2283fc47d144 Mon Sep 17 00:00:00 2001 From: Josh Thomas Date: Sun, 12 Aug 2018 01:18:16 -0600 Subject: [PATCH 55/94] Add $stickyState.reset() to ui-router-extras typings http://christopherthielen.github.io/ui-router-extras/#/sticky --- types/ui-router-extras/index.d.ts | 6 ++++++ types/ui-router-extras/ui-router-extras-tests.ts | 9 ++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/types/ui-router-extras/index.d.ts b/types/ui-router-extras/index.d.ts index b36f030689..42f4926e87 100644 --- a/types/ui-router-extras/index.d.ts +++ b/types/ui-router-extras/index.d.ts @@ -131,6 +131,12 @@ declare module 'angular' { */ interface IStickyStateService { getInactiveStates(): IStickyState[]; + /* + * If there is an inactive state named inactiveStateName, this method exits that state. + * If stateParams is provided, then the state is only exited if the params match the inactive params. + * If inactiveStateName === '*', then all inactive states are exited + */ + reset(inactiveStateName: string, stateParams?: { [key: string]: string | string[] }): void; } /** diff --git a/types/ui-router-extras/ui-router-extras-tests.ts b/types/ui-router-extras/ui-router-extras-tests.ts index 5cc3ed122a..ef3f52ad79 100644 --- a/types/ui-router-extras/ui-router-extras-tests.ts +++ b/types/ui-router-extras/ui-router-extras-tests.ts @@ -16,7 +16,7 @@ myApp.config(($stateProvider: angular.ui.IStateProvider, $stickyStateProvider: a onReactivate: ($state: angular.ui.IState) => { const iAmInjectedByInjector = $state; }, - controller: ($previousState: angular.ui.IPreviousStateService, $deepstateRedirect: angular.ui.IDeepStateRedirectService) => { + controller: ($previousState: angular.ui.IPreviousStateService, $deepstateRedirect: angular.ui.IDeepStateRedirectService, $stickyState: angular.ui.IStickyStateService) => { $previousState.memo('test-memo1'); $previousState.memo('test-memo2', 'test-state-name2'); $previousState.memo('test-memo3', 'test-state-name3', {}); @@ -32,6 +32,13 @@ myApp.config(($stateProvider: angular.ui.IStateProvider, $stickyStateProvider: a stateParam1: ['value1', 'value2'], stateParam2: 'value' }); + + $stickyState.getInactiveStates(); + $stickyState.reset('state1'); + $stickyState.reset('state2', { + stateParam1: ['value1', 'value2'], + stateParam2: 'value' + }); }, views: { // named views are mandatory From 65e927604277f0cdaaa67664225f322c621c4ce6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Nore=C3=B1a?= Date: Sun, 12 Aug 2018 18:15:44 -0500 Subject: [PATCH 56/94] fix wrong and missing properties in the 3 components, add localeconfig --- types/react-native-calendars/index.d.ts | 617 ++++++++++-------- .../react-native-calendars-tests.tsx | 62 +- 2 files changed, 379 insertions(+), 300 deletions(-) diff --git a/types/react-native-calendars/index.d.ts b/types/react-native-calendars/index.d.ts index 3784c1f628..449085303a 100644 --- a/types/react-native-calendars/index.d.ts +++ b/types/react-native-calendars/index.d.ts @@ -1,170 +1,92 @@ -// Type definitions for react-native-calendars 1.20 +// Type definitions for react-native-calendarss 1.20 // Project: https://github.com/wix/react-native-calendars#readme // Definitions by: Tyler Zhang +// David Noreña // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 import * as React from 'react'; -import { ViewProps, StyleProp } from 'react-native'; +import { StyleProp, TextStyle, ViewStyle } from 'react-native'; +export import LocaleConfig = require('xdate'); export interface DateObject { - year: number; - month: number; day: number; - timestamp: number; dateString: string; + month: number; + timestamp: number; + year: number; } -export interface CalendarTheme { - backgroundColor?: string; - calendarBackground?: string; - textSectionTitleColor?: string; - selectedDayBackgroundColor?: string; - selectedDayTextColor?: string; - todayTextColor?: string; - dayTextColor?: string; - textDisabledColor?: string; - dotColor?: string; - selectedDotColor?: string; - arrowColor?: string; - monthTextColor?: string; - textDayFontFamily?: string; - textMonthFontFamily?: string; - textDayHeaderFontFamily?: string; - textMonthFontWeight?: string; - textDayFontSize?: number; - textMonthFontSize?: number; - textDayHeaderFontSize?: number; -} - -export interface DayComponentProps { - state: '' | 'selected' | 'disabled' | 'today'; - theme: CalendarTheme; - onPress: () => any; - onLongPress: () => any; - date: DateObject; - marking: false | Marking[]; -} - -export interface CalendarBaseProps { - /** - * Styles for the view - */ - style?: StyleProp; - - /** - * Specify theme properties to override specific styles for calendar parts. Default = {} - */ - theme?: CalendarTheme; - - /** - * Initially visible month. Default = Date() - */ - current?: Date | string; - - /** - * Minimum date that can be selected, dates before minDate will be grayed out. Default = undefined - */ - minDate?: Date | string; - - /** - * Maximum date that can be selected, dates after maxDate will be grayed out. Default = undefined - */ - maxDate?: Date | string; - - /** - * Handler which gets executed on day press. Default = undefined - */ - onDayPress?: (day: number) => void; - - /** - * Handler which gets executed on day long press. Default = undefined - */ - onDayLongPress?: (day: number) => void; - - /** - * Month format in calendar title. Formatting values: http://arshaw.com/xdate/#Formatting - */ - monthFormat?: string; - - /** - * Handler which gets executed when visible month changes in calendar. Default = undefined - */ - onMonthChange?: (month: number) => void; - - /** - * Hide month navigation arrows. Default = false - */ - hideArrows?: boolean; - - /** - * Replace default arrows with custom ones (direction can be 'left' or 'right') - */ - renderArrow?: (direction: 'left' | 'right') => React.ReactNode; - - /** - * Do not show days of other months in month page. Default = false - */ - hideExtraDays?: boolean; - - /** - * If hideArrows=false and hideExtraDays=false do not switch month when tapping on greyed out - * day from another month that is visible in calendar page. Default = false - */ - disableMonthChange?: boolean; - - /** - * If firstDay=1 week starts from Monday. Note that dayNames and dayNamesShort should still start from Sunday. - */ - firstDay?: number; - - /** - * Hide day names. Default = false - */ - hideDayNames?: boolean; - - /** - * Show week numbers to the left. Default = false - */ - showWeekNumbers?: boolean; - - /** - * Handler which gets executed when press arrow icon left. It receive a callback can go back month - */ - onPressArrowLeft?: (month: number) => void; - - /** - * Handler which gets executed when press arrow icon left. It receive a callback can go next month - */ - onPressArrowRight?: (month: number) => void; - - /** - * Custom day renderer - */ - dayComponent?: React.Component | React.SFC; -} - -export interface DotForMultiDot { +export interface CalendarDot { key: string; color: string; selectedDotColor?: string; } -export interface MultiDotMarking { - dots: DotForMultiDot[]; - selected?: boolean; - selectedColor?: string; - disabled?: boolean; +export interface CalendarTheme { + arrowColor?: string; + backgroundColor?: string; + calendarBackground?: string; + dayTextColor?: string; + dotColor?: string; + monthTextColor?: string; + selectedDayBackgroundColor?: string; + selectedDayTextColor?: string; + selectedDotColor?: string; + textDayFontFamily?: string; + textDayFontSize?: number; + textDayHeaderFontFamily?: string; + textDayHeaderFontSize?: number; + textDisabledColor?: string; + textMonthFontFamily?: string; + textMonthFontWeight?: string; + textMonthFontSize?: number; + textSectionTitleColor?: string; + todayTextColor?: string; +} + +export type DateCallbackHandler = (date: DateObject) => void; + +export type TCalendarDate = Date | DateObject | number | string | XDate; + +export interface MarkedDateCustomStyles { + container: StyleProp; + text: StyleProp; +} + +export interface CalendarDot { + key: string; + color: string; + selectedDotColor?: string; +} + +export interface CustomMarking { + customStyles: MarkedDateCustomStyles; } export interface DotMarking { - selected?: boolean; - marked?: boolean; - selectedColor?: string; - dotColor?: string; activeOpacity?: number; disabled?: boolean; disableTouchEvent?: boolean; + dotColor?: string; + marked?: boolean; + selected?: boolean; + selectedColor?: string; +} + +export interface MultiDotMarking { + disabled?: boolean; + dots: CalendarDot[]; + selected?: boolean; + selectedColor?: string; +} + +export interface MultiPeriodMarking { + periods: Array<{ + startingDay?: boolean; + endingDay?: boolean; + color?: string; + }>; } export interface PeriodMarking { @@ -176,29 +98,15 @@ export interface PeriodMarking { disabled?: boolean; } -export interface MultiPeriodMarking { - periods: Array<{ - startingDay?: boolean; - endingDay?: boolean; - color?: string; - }>; -} - -export interface CustomMarking { - customStyles: any; -} - export type Marking = - MultiDotMarking | - DotMarking | - PeriodMarking | - MultiPeriodMarking | - CustomMarking; + CustomMarking | DotMarking | + MultiDotMarking | MultiPeriodMarking | + PeriodMarking; -export interface MultiDotMarkingProps { - markingType: 'multi-dot'; +export interface CustomMarkingProps { + markingType: 'custom'; markedDates: { - [date: string]: MultiDotMarking; + [date: string]: CustomMarking; }; } @@ -209,17 +117,10 @@ export interface DotMarkingProps { }; } -export interface PeriodMarkingProps { - markingType: 'period'; +export interface MultiDotMarkingProps { + markingType: 'multi-dot'; markedDates: { - [date: string]: PeriodMarking; - }; -} - -export interface CustomMarkingProps { - markingType: 'custom'; - markedDates: { - [date: string]: CustomMarking; + [date: string]: MultiDotMarking; }; } @@ -234,6 +135,13 @@ export interface MultiPeriodMarkingProps { }; } +export interface PeriodMarkingProps { + markingType: 'period'; + markedDates: { + [date: string]: PeriodMarking; + }; +} + export type CalendarMarkingProps = MultiDotMarkingProps | DotMarkingProps | @@ -242,61 +150,217 @@ export type CalendarMarkingProps = CustomMarkingProps | {}; -export class Calendar extends React.Component {} +export interface DayComponentProps { + date: DateObject; + marking: false | Marking[]; + onPress: () => any; + onLongPress: () => any; + state: '' | 'selected' | 'disabled' | 'today'; + theme: CalendarTheme; +} + +export interface CalendarBaseProps { + /** + * Initially visible month. Default = Date() + */ + current?: TCalendarDate; + + /** + * Provide custom day rendering component. + */ + dayComponent?: React.Component | React.SFC; + + /** + * Disable days by default. Default = false + */ + disabledByDefault?: boolean; + + /** + * If hideArrows=false and hideExtraDays=false do not switch month when tapping on greyed out + * day from another month that is visible in calendar page. Default = false + */ + disableMonthChange?: boolean; + + /** + * Display loading indicator. Default = false + */ + displayLoadingIndicator?: boolean; + + /** + * If firstDay=1 week starts from Monday. Note that dayNames and dayNamesShort should still start from Sunday. + */ + firstDay?: number; + + /** + * Hide month navigation arrows. Default = false + */ + hideArrows?: boolean; + + /** + * Hide day names. Default = false + */ + hideDayNames?: boolean; + + /** + * Do not show days of other months in month page. Default = false + */ + hideExtraDays?: boolean; + + /** + * Maximum date that can be selected, dates after maxDate will be grayed out. Default = undefined + */ + maxDate?: TCalendarDate; + + /** + * Minimum date that can be selected, dates before minDate will be grayed out. Default = undefined + */ + minDate?: TCalendarDate; + + /** + * Month format in calendar title. Formatting values: http://arshaw.com/xdate/#Formatting + */ + monthFormat?: string; + + /** + * Handler which gets executed on day press. Default = undefined + */ + onDayPress?: DateCallbackHandler; + + /** + * Handler which gets executed on day long press. Default = undefined + */ + onDayLongPress?: DateCallbackHandler; + + /** + * Handler which gets executed when press arrow icon left. It receive a callback can go back month + */ + onPressArrowLeft?: (substractMonth: () => void) => void; + + /** + * Handler which gets executed when press arrow icon left. It receive a callback can go next month + */ + onPressArrowRight?: (addMonth: () => void) => void; + + /** + * Handler which gets executed when visible month changes in calendar. Default = undefined + */ + onMonthChange?: DateCallbackHandler; -export interface CalendarListBaseProps extends CalendarBaseProps { /** * Callback which gets executed when visible months change in scroll view. Default = undefined */ - onVisibleMonthsChange?: (months: number) => void; + onVisibleMonthsChange?: (months: DateObject[]) => void; /** - * Max amount of months allowed to scroll to the past. Default = 50 + * Replace default arrows with custom ones (direction can be 'left' or 'right') */ - pastScrollRange?: number; + renderArrow?: (direction: 'left' | 'right') => React.ReactNode; + + /** + * Show week numbers to the left. Default = false + */ + showWeekNumbers?: boolean; + + /** + * Calendar container style. + */ + style?: StyleProp; + + /** + * Specify theme properties to override specific styles for calendar parts. Default = {} + */ + theme?: CalendarTheme; +} + +export class Calendar extends React.Component { } + +export interface CalendarListBaseProps extends CalendarBaseProps { + /** + * Set custom calendar heigth. + */ + calendarHeight?: number; + + /** + * Set custom calendar width. + */ + calendarWidth?: number; /** * Max amount of months allowed to scroll to the future. Default = 50 */ futureScrollRange?: number; + /** + * Enable horizontal scrolling, default = false + */ + horizontal?: boolean; + + /** + * Enable paging on horizontal, default = false + */ + pagingEnabled?: boolean; + + /** + * Max amount of months allowed to scroll to the past. Default = 50 + */ + pastScrollRange?: number; + /** * Enable or disable scrolling of calendar list */ scrollEnabled?: boolean; + /** + * When true, the calendar list scrolls to top when the status bar is tapped. Default = true + */ + scrollsToTop?: boolean; + /** * Enable or disable vertical scroll indicator. Default = false */ showScrollIndicator?: boolean; - - /** - * Enable horizontal scrolling, default = false - */ - horizontal?: boolean; - - /** - * Enable paging on horizontal, default = false - */ - pagingEnabled?: boolean; - - /** - * Set custom calendarWidth. - */ - calendarWidth?: boolean; } -export class CalendarList extends React.Component {} +export class CalendarList extends React.Component { } -export interface AgendaProps { +export interface AgendaThemeStyle extends CalendarTheme { + agendaDayNumColor?: string; + agendaDayTextColor?: string; + agendaKnobColor?: string; + agendaTodayColor?: string; +} + +export interface AgendaItemsMap { + [date: string]: TItem[]; +} + +export interface AgendaProps { /** - * the list of items that have to be displayed in agenda. If you want to render item as empty date - * the value of date key kas to be an empty array []. If there exists no value for date key it is - * considered that the date in question is not yet loaded + * Display loading indicator. Default = false */ - items: { - [key: string]: T[]; - }; + displayLoadingIndicator?: boolean; + + /** + * If firstDay = 1 week starts from Monday. Note that dayNames and dayNamesShort should still start from Sunday. + */ + firstDay?: number; + + /** + * Max amount of months allowed to scroll to the future. Default = 50 + */ + futureScrollRange?: number; + + /** + * Hide knob button. Default = false + */ + hideKnob?: boolean; + + /** + * The list of items that have to be displayed in agenda. If you want to render item as empty date + * the value of date key kas to be an empty array []. If there exists no value for date key it is + * considered that the date in question is not yet loaded + */ + items?: AgendaItemsMap; /** * callback that gets called when items for a certain month should be loaded (month became visible) @@ -304,115 +368,100 @@ export interface AgendaProps { loadItemsForMonth?: (date: DateObject) => void; /** - * callback that fires when the calendar is opened or closed + * Maximum date that can be selected, dates after maxDate will be grayed out. Default = undefined */ - onCalendarToggled?: (calendarOpened: boolean) => void; - - /** - * callback that gets called on day press - */ - onDayPress?: (day: number) => void; - - /** - * callback that gets called when day changes while scrolling agenda list - */ - onDayChange?: (day: number) => void; - - /** - * initially selected day - */ - selected?: Date | string; + maxDate?: TCalendarDate; /** * Minimum date that can be selected, dates before minDate will be grayed out. Default = undefined */ - minDate?: Date | string; + minDate?: TCalendarDate; /** - * Maximum date that can be selected, dates after maxDate will be grayed out. Default = undefined + * Month format in calendar title. Formatting values: http://arshaw.com/xdate/#Formatting */ - maxDate?: Date | string; + monthFormat?: string; /** - * Max amount of months allowed to scroll to the past. Default = 50 + * Handler which gets executed on day press. Default = undefined + */ + onDayPress?: DateCallbackHandler; + + /** + * Handler which gets executed when the calendar is opened or closed. Default = undefined + */ + onCalendarToggled?: (calendarOpened: boolean) => void; + + /** + * Handler that gets called when day changes while scrolling agenda list. Default = undefined + */ + onDayChange?: DateCallbackHandler; + + /** + * If provided, a standard RefreshControl will be added for "Pull to Refresh" functionality. + * Make sure to also set the refreshing prop correctly. Default = undefined + */ + onRefresh?: () => void; + + /** + * Max amount of months allowed to scroll to the past. Default = 50 */ pastScrollRange?: number; /** - * Max amount of months allowed to scroll to the future. Default = 50 - */ - futureScrollRange?: number; - - /** - * specify how each item should be rendered in agenda - */ - renderItem: (item: T, firstItemInDay?: T) => React.ReactNode; - - /** - * specify how each date should be rendered. day can be undefined if the item is not first in that day. - */ - renderDay?: (day: DateObject | undefined, item: T) => React.ReactNode; - - /** - * specify how empty date content with no items should be rendered - */ - renderEmptyDate?: () => React.ReactNode; - - /** - * specify how agenda knob should look like - */ - renderKnob?: () => React.ReactNode; - - /** - * specify what should be rendered instead of ActivityIndicator - */ - renderEmptyData?: () => React.ReactNode; - - /** - * specify your item comparison function for increased performance - */ - rowHasChanged?: (r1: any, r2: any) => boolean; - - /** - * Hide knob button. Default = false - */ - hideKnob?: boolean; - - /** - * A RefreshControl component, used to provide pull-to-refresh funtionality for the ScrollView + * A RefreshControl component, used to provide pull-to-refresh funtionality for the ScrollView. */ refreshControl?: React.ReactNode; /** - * If provided, a standard RefreshControl will be added for "Pull to Refresh" functionality. - * Make sure to also set the refreshing prop correctly. - */ - onRefresh?: () => any; - - /** - * Set this true while waiting for new data from a refresh + * Set this true while waiting for new data from a refresh. */ refreshing?: boolean; /** - * Display loading indicator. Default = false + * Specify how each day should be rendered. + * Date can be undefined if the item has not property date. */ - displayLoadingIndicator?: boolean; + renderDay?: (date: DateObject | undefined, item: TItem) => React.ReactNode; /** - * agenda theme + * Specify what should be rendered instead of ActivityIndicator */ - theme?: { - agendaDayTextColor?: string; - agendaDayNumColor?: string; - agendaTodayColor?: string; - agendaKnobColor?: string; - } & CalendarTheme; + renderEmptyData?: () => React.ReactNode; /** - * agenda container style + * Specify how empty date content with no items should be rendered. */ - style?: StyleProp; + renderEmptyDate: () => React.ReactNode; + + /** + * Specify how each item should be rendered in agenda. + */ + renderItem: (item: TItem, firstDayInDay: boolean) => React.ReactNode; + + /** + * Specify how agenda knob should look like. + */ + renderKnob?: () => React.ReactNode; + + /** + * specify your item comparison function for increased performance + */ + rowHasChanged: (r1: TItem, r2: TItem) => boolean; + + /** + * Initially visible month. Default = Date() + */ + selected?: TCalendarDate; + + /** + * Agenda container style. + */ + style?: StyleProp; + + /** + * Specify theme properties to override specific styles for agenda parts. Default = {} + */ + theme?: AgendaThemeStyle; } - -export class Agenda extends React.Component & CalendarMarkingProps> {} +export class Agenda extends React.Component & CalendarMarkingProps> { } diff --git a/types/react-native-calendars/react-native-calendars-tests.tsx b/types/react-native-calendars/react-native-calendars-tests.tsx index 5b438937e1..3a095a597e 100644 --- a/types/react-native-calendars/react-native-calendars-tests.tsx +++ b/types/react-native-calendars/react-native-calendars-tests.tsx @@ -10,23 +10,23 @@ import { Calendar, CalendarList, Agenda } from "react-native-calendars"; // Maximum date that can be selected, dates after maxDate will be grayed out. Default = undefined maxDate={"2012-05-30"} // Handler which gets executed on day press. Default = undefined - onDayPress={day => { - console.log("selected day", day); + onDayPress={date => { + console.log("selected day", date.day); }} // Handler which gets executed on day long press. Default = undefined - onDayLongPress={day => { - console.log("selected day", day); + onDayLongPress={date => { + console.log("selected day", date.day); }} // Month format in calendar title. Formatting values: http://arshaw.com/xdate/#Formatting monthFormat={"yyyy MM"} // Handler which gets executed when visible month changes in calendar. Default = undefined - onMonthChange={month => { - console.log("month changed", month); + onMonthChange={date => { + console.log("month changed", date.month); }} // Hide month navigation arrows. Default = false hideArrows={true} // Replace default arrows with custom ones (direction can be 'left' or 'right') - renderArrow={direction =>
} + renderArrow={direction => } // Do not show days of other months in month page. Default = false hideExtraDays={true} // If hideArrows=false and hideExtraDays=false do not switch month when tapping on greyed out @@ -42,6 +42,7 @@ import { Calendar, CalendarList, Agenda } from "react-native-calendars"; onPressArrowLeft={substractMonth => console.log(substractMonth)} // Handler which gets executed when press arrow icon left. It receive a callback can go next month onPressArrowRight={addMonth => console.log(addMonth)} + disabledByDefault={true} />; { - console.log("selected day", day); + onDayPress={date => { + console.log("selected day", date.day); }} // Handler which gets executed on day long press. Default = undefined - onDayLongPress={day => { - console.log("selected day", day); + onDayLongPress={date => { + console.log("selected day", date.day); }} // Month format in calendar title. Formatting values: http://arshaw.com/xdate/#Formatting monthFormat={"yyyy MM"} // Handler which gets executed when visible month changes in calendar. Default = undefined - onMonthChange={month => { - console.log("month changed", month); + onMonthChange={date => { + console.log("month changed", date.month); }} // Hide month navigation arrows. Default = false hideArrows={true} // Replace default arrows with custom ones (direction can be 'left' or 'right') - renderArrow={direction =>
} + renderArrow={direction => } // Do not show days of other months in month page. Default = false hideExtraDays={true} // If hideArrows=false and hideExtraDays=false do not switch month when tapping on greyed out @@ -267,7 +268,7 @@ const workout = { key: "workout", color: "green" }; // Hide month navigation arrows. Default = false hideArrows={true} // Replace default arrows with custom ones (direction can be 'left' or 'right') - renderArrow={direction =>
} + renderArrow={direction => } // Do not show days of other months in month page. Default = false hideExtraDays={true} // If hideArrows=false and hideExtraDays=false do not switch month when tapping on greyed out @@ -283,6 +284,29 @@ const workout = { key: "workout", color: "green" }; onPressArrowLeft={substractMonth => console.log(substractMonth)} // Handler which gets executed when press arrow icon left. It receive a callback can go next month onPressArrowRight={addMonth => console.log(addMonth)} + // Disable days by default. Default = false + disabledByDefault={true} + // Display loading indicator. Default = false + displayLoadingIndicator={true} + // When true, the calendar list scrolls to top when the status bar is tapped. Default = true + scrollsToTop={true} + // Enable paging on horizontal, default = false + pagingEnabled={true} + // Provide custom day rendering component. + dayComponent={({ date, state }) => { + return ( + + + {date.day} + + + ); + }} />; { - return ; + return firstItemInDay ? : ; }} // specify how each date should be rendered. day can be undefined if the item is not first in that day. renderDay={(day, item) => { @@ -371,4 +395,10 @@ const workout = { key: "workout", color: "green" }; }} // agenda container style style={{}} + // Display loading indicator. Default = false + displayLoadingIndicator={true} + // If firstDay=1 week starts from Monday. Note that dayNames and dayNamesShort should still start from Sunday. + firstDay={1} + // Month format in calendar title. Formatting values: http://arshaw.com/xdate/#Formatting + monthFormat={"yyyy MM"} />; From 948f0f47bd7c5060a1631edcd0175cf1f665b8e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Nore=C3=B1a?= Date: Sun, 12 Aug 2018 18:25:49 -0500 Subject: [PATCH 57/94] fix for --- types/react-native-calendars/tslint.json | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/types/react-native-calendars/tslint.json b/types/react-native-calendars/tslint.json index 3db14f85ea..82403bc9ec 100644 --- a/types/react-native-calendars/tslint.json +++ b/types/react-native-calendars/tslint.json @@ -1 +1,6 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + "file-name-casing": [true, "kebab-case"] + } +} From 255979639d96d507a9c8ee6ce7dc712ee2019f12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Nore=C3=B1a?= Date: Sun, 12 Aug 2018 18:29:40 -0500 Subject: [PATCH 58/94] fix comments --- types/react-native-calendars/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-native-calendars/index.d.ts b/types/react-native-calendars/index.d.ts index 449085303a..b7a1736d2a 100644 --- a/types/react-native-calendars/index.d.ts +++ b/types/react-native-calendars/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-native-calendarss 1.20 +// Type definitions for react-native-calendars 1.20 // Project: https://github.com/wix/react-native-calendars#readme // Definitions by: Tyler Zhang // David Noreña From 36b6312eeed6a0bdaae2eb98270a27aba4cfbf58 Mon Sep 17 00:00:00 2001 From: Tyler Johnson Date: Tue, 14 Aug 2018 13:03:55 -0600 Subject: [PATCH 59/94] add typings for async getSource and runtime.SafeString class --- types/nunjucks/index.d.ts | 8 +++++++- types/nunjucks/nunjucks-tests.ts | 2 ++ types/nunjucks/tslint.json | 3 ++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/types/nunjucks/index.d.ts b/types/nunjucks/index.d.ts index d307bd27d5..1908f7e4c0 100644 --- a/types/nunjucks/index.d.ts +++ b/types/nunjucks/index.d.ts @@ -94,7 +94,7 @@ export function installJinjaCompat(): void; export interface ILoader { async?: boolean; - getSource(name: string): LoaderSource; + getSource(name: string, callback?: (err?: any, result?: LoaderSource) => void): LoaderSource | void; extend?(extender: ILoader): ILoader; } @@ -137,3 +137,9 @@ export class PrecompiledLoader extends Loader implements ILoader { init(searchPaths: string[], opts: any): void; getSource(name: string): LoaderSource; } + +export namespace runtime { + class SafeString { + constructor(...args: any[]); + } +} diff --git a/types/nunjucks/nunjucks-tests.ts b/types/nunjucks/nunjucks-tests.ts index 9f3afcddfe..91caf67a73 100644 --- a/types/nunjucks/nunjucks-tests.ts +++ b/types/nunjucks/nunjucks-tests.ts @@ -52,3 +52,5 @@ class MyLoader extends nunjucks.Loader implements nunjucks.ILoader { } env = new nunjucks.Environment(new MyLoader()); + +new nunjucks.runtime.SafeString(); diff --git a/types/nunjucks/tslint.json b/types/nunjucks/tslint.json index 2c7c1bed53..65fb79195f 100644 --- a/types/nunjucks/tslint.json +++ b/types/nunjucks/tslint.json @@ -1,6 +1,7 @@ { "extends": "dtslint/dt.json", "rules": { - "interface-name": false + "interface-name": false, + "no-unnecessary-class": false // to allow SafeString class } } From 44988b0a8102c27738d4a700cffae5d5ae0e4900 Mon Sep 17 00:00:00 2001 From: Tyler Johnson Date: Tue, 14 Aug 2018 13:12:01 -0600 Subject: [PATCH 60/94] WebLoader extends Loader, set version to 3.1 --- types/nunjucks/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/nunjucks/index.d.ts b/types/nunjucks/index.d.ts index 1908f7e4c0..b0a1e86508 100644 --- a/types/nunjucks/index.d.ts +++ b/types/nunjucks/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for nunjucks 3.0 +// Type definitions for nunjucks 3.1 // Project: http://mozilla.github.io/nunjucks/ // Definitions by: Ruben Slabbert // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -128,7 +128,7 @@ export class FileSystemLoader extends Loader implements ILoader { constructor(searchPaths?: string | string[], opts?: FileSystemLoaderOptions); } -export class WebLoader implements ILoader { +export class WebLoader extends Loader implements ILoader { constructor(baseUrl: string, opts?: any); getSource(name: string): LoaderSource; } From f0c300861b310dba0e22efc0f38e9a87a0944b4e Mon Sep 17 00:00:00 2001 From: Tyler Johnson Date: Tue, 14 Aug 2018 13:16:50 -0600 Subject: [PATCH 61/94] add missing safestring methods --- types/nunjucks/index.d.ts | 6 +++++- types/nunjucks/nunjucks-tests.ts | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/types/nunjucks/index.d.ts b/types/nunjucks/index.d.ts index b0a1e86508..e2bdbf2a8a 100644 --- a/types/nunjucks/index.d.ts +++ b/types/nunjucks/index.d.ts @@ -140,6 +140,10 @@ export class PrecompiledLoader extends Loader implements ILoader { export namespace runtime { class SafeString { - constructor(...args: any[]); + constructor(val: string); + val: string; + length: number; + valueOf(): string; + toString(): string; } } diff --git a/types/nunjucks/nunjucks-tests.ts b/types/nunjucks/nunjucks-tests.ts index 91caf67a73..6dd4d8fed7 100644 --- a/types/nunjucks/nunjucks-tests.ts +++ b/types/nunjucks/nunjucks-tests.ts @@ -53,4 +53,4 @@ class MyLoader extends nunjucks.Loader implements nunjucks.ILoader { env = new nunjucks.Environment(new MyLoader()); -new nunjucks.runtime.SafeString(); +new nunjucks.runtime.SafeString("an unsafe string"); From b6cf2fda64399bd99cf6fde97928ec2cbf91eeff Mon Sep 17 00:00:00 2001 From: jerray Date: Wed, 15 Aug 2018 13:58:19 +0800 Subject: [PATCH 62/94] Add server id property and persistence namespace --- types/mosca/index.d.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/types/mosca/index.d.ts b/types/mosca/index.d.ts index 178f150d05..aee3625d10 100644 --- a/types/mosca/index.d.ts +++ b/types/mosca/index.d.ts @@ -1,9 +1,11 @@ // Type definitions for mosca 2.8 // Project: https://github.com/mcollina/mosca // Definitions by: Joao Gabriel Gouveia +// Jerray Fu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export class Server { + id: string; opts: any; modernOpts: any; clients: any; @@ -83,3 +85,15 @@ export interface Message { qos: number; retain: boolean; } + +export namespace persistence { + interface Persistence { + wire(server: Server): void; + } + type FactoryFunc = (options: { [key: string]: any }) => Persistence; + + const Redis: FactoryFunc; + const Mongo: FactoryFunc; + const LevelUp: FactoryFunc; + const Memory: FactoryFunc; +} From a189348d36a194629731a789afdbb38a19bae408 Mon Sep 17 00:00:00 2001 From: Sean Genabe Date: Thu, 16 Aug 2018 00:11:56 +0800 Subject: [PATCH 63/94] Add typings for round-to --- types/round-to/index.d.ts | 28 ++++++++++++++++++++++++++++ types/round-to/round-to-tests.ts | 10 ++++++++++ types/round-to/tsconfig.json | 23 +++++++++++++++++++++++ types/round-to/tslint.json | 1 + 4 files changed, 62 insertions(+) create mode 100644 types/round-to/index.d.ts create mode 100644 types/round-to/round-to-tests.ts create mode 100644 types/round-to/tsconfig.json create mode 100644 types/round-to/tslint.json diff --git a/types/round-to/index.d.ts b/types/round-to/index.d.ts new file mode 100644 index 0000000000..73622c5012 --- /dev/null +++ b/types/round-to/index.d.ts @@ -0,0 +1,28 @@ +// Type definitions for round-to 3.0 +// Project: https://github.com/sindresorhus/round-to#readme +// Definitions by: Sean Marvi Oliver Genabe +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare namespace roundTo { + /** + * Round the decimals with `Math.ceil`. + * @param input Number to adjust. + * @param precision (Integer) number of decimal places. + */ + function up(input: number, precision: number): number; + /** + * Round the decimals with `Math.floor`. + * @param input Number to adjust. + * @param precision (Integer) number of decimal places. + */ + function down(input: number, precision: number): number; +} + +/** + * Round the decimals with `Math.round`. + * @param input Number to adjust. + * @param precision (integer) Number of decimal places. + */ +declare function roundTo(input: number, precision: number): number; + +export = roundTo; diff --git a/types/round-to/round-to-tests.ts b/types/round-to/round-to-tests.ts new file mode 100644 index 0000000000..60d4c21538 --- /dev/null +++ b/types/round-to/round-to-tests.ts @@ -0,0 +1,10 @@ +import roundTo = require('round-to'); + +// $ExpectType number +roundTo(1.234, 2); + +// $ExpectType number +roundTo.up(1.234, 2); + +// $ExpectType number +roundTo.down(1.234, 2); diff --git a/types/round-to/tsconfig.json b/types/round-to/tsconfig.json new file mode 100644 index 0000000000..633ed48869 --- /dev/null +++ b/types/round-to/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "strictFunctionTypes": true + }, + "files": [ + "index.d.ts", + "round-to-tests.ts" + ] +} diff --git a/types/round-to/tslint.json b/types/round-to/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/round-to/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From a2103fd6a7761592b62c03ad43af4a06334248ab Mon Sep 17 00:00:00 2001 From: 43081j <43081j@users.noreply.github.com> Date: Wed, 15 Aug 2018 21:12:18 +0100 Subject: [PATCH 64/94] add clipboard-api w3c draft --- .../dom-clipboard-api-tests.ts | 16 +++++++++++++ types/dom-clipboard-api/index.d.ts | 15 ++++++++++++ types/dom-clipboard-api/tsconfig.json | 24 +++++++++++++++++++ types/dom-clipboard-api/tslint.json | 5 ++++ 4 files changed, 60 insertions(+) create mode 100644 types/dom-clipboard-api/dom-clipboard-api-tests.ts create mode 100644 types/dom-clipboard-api/index.d.ts create mode 100644 types/dom-clipboard-api/tsconfig.json create mode 100644 types/dom-clipboard-api/tslint.json diff --git a/types/dom-clipboard-api/dom-clipboard-api-tests.ts b/types/dom-clipboard-api/dom-clipboard-api-tests.ts new file mode 100644 index 0000000000..9b0731d8f4 --- /dev/null +++ b/types/dom-clipboard-api/dom-clipboard-api-tests.ts @@ -0,0 +1,16 @@ +const clipboard = navigator.clipboard; + +let text: string; + +clipboard.writeText('foo'); +clipboard.readText().then((val) => { + text = val; +}); + +const transfer = new DataTransfer(); +transfer.setData('text/plain', 'foo'); + +clipboard.write(transfer); +clipboard.read().then((tf) => { + text = tf.getData('text/plain'); +}); diff --git a/types/dom-clipboard-api/index.d.ts b/types/dom-clipboard-api/index.d.ts new file mode 100644 index 0000000000..1af5f2c60a --- /dev/null +++ b/types/dom-clipboard-api/index.d.ts @@ -0,0 +1,15 @@ +// Type definitions for w3c Clipboard API 1.0 +// Project: https://w3c.github.io/clipboard-apis/ +// Definitions by: James Garbutt +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +interface Clipboard extends EventTarget { + read(): Promise; + readText(): Promise; + write(data: DataTransfer): Promise; + writeText(data: string): Promise; +} + +interface Navigator { + readonly clipboard: Clipboard; +} diff --git a/types/dom-clipboard-api/tsconfig.json b/types/dom-clipboard-api/tsconfig.json new file mode 100644 index 0000000000..230c5f16f6 --- /dev/null +++ b/types/dom-clipboard-api/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "dom-clipboard-api-tests.ts" + ] +} diff --git a/types/dom-clipboard-api/tslint.json b/types/dom-clipboard-api/tslint.json new file mode 100644 index 0000000000..495d29983d --- /dev/null +++ b/types/dom-clipboard-api/tslint.json @@ -0,0 +1,5 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + } +} From d723c81ce8becbe61712dbd6daf5321338080502 Mon Sep 17 00:00:00 2001 From: Tyler Johnson Date: Wed, 15 Aug 2018 18:10:53 -0600 Subject: [PATCH 65/94] add overloaded getSource method --- types/nunjucks/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/nunjucks/index.d.ts b/types/nunjucks/index.d.ts index e2bdbf2a8a..13869f0d60 100644 --- a/types/nunjucks/index.d.ts +++ b/types/nunjucks/index.d.ts @@ -94,7 +94,8 @@ export function installJinjaCompat(): void; export interface ILoader { async?: boolean; - getSource(name: string, callback?: (err?: any, result?: LoaderSource) => void): LoaderSource | void; + getSource(name: string): LoaderSource; + getSource(name: string, callback: (err?: any, result?: LoaderSource) => void): void; extend?(extender: ILoader): ILoader; } From 5de92434d4601a6a17f09b03f636699f0b103595 Mon Sep 17 00:00:00 2001 From: Keerthi Niranjan Date: Thu, 16 Aug 2018 11:25:07 +0530 Subject: [PATCH 66/94] Add ffi-napi module --- types/ffi-napi/ffi-napi-tests.ts | 106 +++++++++++++ types/ffi-napi/index.d.ts | 186 +++++++++++++++++++++++ types/ffi-napi/node-ffi-napi-buffer.d.ts | 50 ++++++ types/ffi-napi/tsconfig.json | 24 +++ types/ffi-napi/tslint.json | 8 + 5 files changed, 374 insertions(+) create mode 100644 types/ffi-napi/ffi-napi-tests.ts create mode 100644 types/ffi-napi/index.d.ts create mode 100644 types/ffi-napi/node-ffi-napi-buffer.d.ts create mode 100644 types/ffi-napi/tsconfig.json create mode 100644 types/ffi-napi/tslint.json diff --git a/types/ffi-napi/ffi-napi-tests.ts b/types/ffi-napi/ffi-napi-tests.ts new file mode 100644 index 0000000000..5965e23e12 --- /dev/null +++ b/types/ffi-napi/ffi-napi-tests.ts @@ -0,0 +1,106 @@ +import ffi = require('ffi-napi'); +import ref = require('ref-napi'); +import Struct = require('ref-struct-di'); +import Union = require('ref-union-di'); +import TArray = require('ref-array-di'); + +{ + const sqlite3 = ref.types.void; + const sqlite3Ptr = ref.refType(sqlite3); + const sqlite3PtrPtr = ref.refType(sqlite3Ptr); + const stringPtr = ref.refType(ref.types.CString); + + const libsqlite3 = ffi.Library('libsqlite3', { + sqlite3_open: [ 'int', [ 'string', sqlite3PtrPtr ] ], + sqlite3_close: [ 'int', [ sqlite3PtrPtr ] ], + sqlite3_exec: [ 'int', [ sqlite3PtrPtr, 'string', 'pointer', 'pointer', stringPtr ] ], + sqlite3_changes: [ 'int', [ sqlite3PtrPtr ]] + }); + + const dbPtrPtr = ref.alloc(sqlite3PtrPtr); + libsqlite3.sqlite3_open("test.sqlite3", dbPtrPtr); +} +{ + const func = ffi.ForeignFunction(new Buffer(10), 'int', [ 'int' ]); + func(-5); + func.async(-5, (err: any, res: any) => {}); +} +{ + const funcPtr = ffi.Callback('int', [ 'int' ], Math.abs); + const func = ffi.ForeignFunction(funcPtr, 'int', [ 'int' ]); +} +{ + const printfPointer = ffi.DynamicLibrary().get('printf'); + const printfGen = ffi.VariadicForeignFunction(printfPointer, 'void', [ 'string' ]); + printfGen()('Hello World!\n'); + printfGen('int')('This is an int: %d\n', 10); + printfGen('string')('This is a string: %s\n', 'hello'); +} +{ + ref.address(new Buffer(1)); + const intBuf = ref.alloc(ref.types.int); + const intWith4 = ref.alloc(ref.types.int, 4); + const buf0 = ref.allocCString('hello world'); + const type = ref.coerceType('int **'); + const val = ref.deref(intBuf); +} +{ + ref.isNull(new Buffer(1)); +} +{ + const str = ref.readCString(new Buffer('hello\0world\0'), 0); + const buf = ref.alloc('int64'); + ref.writeInt64BE(buf, 0, '9223372036854775807'); + const val = ref.readInt64BE(buf, 0); +} +{ + const voidPtrType = ref.refType(ref.types.void); + const buf = ref.alloc('int64'); + ref.writeInt64LE(buf, 0, '9223372036854775807'); +} +{ + const S1 = Struct({ a: ref.types.int }); + const S2 = new Struct({ a: 'int' }); +} +{ + const P = new Struct(); + P.defineProperty('a', ref.types.int); + P.defineProperty('d', 'long'); +} +{ + const SimpleStruct = Struct({ + first : ref.types.byte, + last : ref.types.byte + }); + + const ss = new SimpleStruct({ first: 50, last: 100 }); + ss.first += 200; +} +{ + const ST = Struct(); + const test: ref.Type = ST.fields['t'].type; +} +{ + const CharArray = TArray('char'); + const b = new Buffer('hello', 'ascii'); + const a = new CharArray(b); +} +{ + const Int32Array = TArray(ref.types.int32); + const input = [1, 4, 91, 123123, 5123512, 0, -1]; + const a = new Int32Array(input); +} +{ + const int = ref.types.int; + const IntArray = TArray(int); + + const buf = new Buffer(int.size * 3); + int.set(buf, int.size * 0, 5); + int.set(buf, int.size * 1, 8); + int.set(buf, int.size * 2, 0); + + const array = IntArray.untilZeros(buf); +} +{ + const refCharArr = TArray('char')([1, 3, 5], 2).ref(); +} diff --git a/types/ffi-napi/index.d.ts b/types/ffi-napi/index.d.ts new file mode 100644 index 0000000000..6cfd439e13 --- /dev/null +++ b/types/ffi-napi/index.d.ts @@ -0,0 +1,186 @@ +// Type definitions for node-ffi-napi 2.4 +// Project: https://github.com/node-ffi/node-ffi +// Definitions by: Keerthi Niranjan , Kiran Niranjan +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +/// + + +import ref = require('ref-napi'); +import StructType = require('ref-struct-di'); + +/** Provides a friendly API on-top of `DynamicLibrary` and `ForeignFunction`. */ +export interface Library { + /** The extension to use on libraries. */ + EXT: string; + + /** + * @param libFile name of library + * @param funcs hash of [retType, [...argType], opts?: {abi?, async?, varargs?}] + * @param lib hash that will be extended + */ + new (libFile: string, funcs?: {[key: string]: any[]}, lib?: object): any; + + /** + * @param libFile name of library + * @param funcs hash of [retType, [...argType], opts?: {abi?, async?, varargs?}] + * @param lib hash that will be extended + */ + (libFile: string, funcs?: {[key: string]: any[]}, lib?: object): any; +} +export const Library: Library; + +/** Get value of errno. */ +export function errno(): number; + +export interface Function extends ref.Type { + /** The type of return value. */ + retType: ref.Type; + /** The type of arguments. */ + argTypes: ref.Type[]; + /** Is set for node-ffi functions. */ + ffi_type: Buffer; + abi: number; + + /** Get a `Callback` pointer of this function type. */ + toPointer(fn: (...args: any[]) => any): Buffer; + /** Get a `ForeignFunction` of this function type. */ + toFunction(buf: Buffer): ForeignFunction; +} + +/** Creates and returns a type for a C function pointer. */ +export const Function: { + new (retType: ref.Type | string, argTypes: any[], abi?: number): Function; + (retType: ref.Type | string, argTypes: any[], abi?: number): Function; +}; + +export interface ForeignFunction { + (...args: any[]): any; + async(...args: any[]): void; +} + +/** + * Represents a foreign function in another library. Manages all of the aspects + * of function execution, including marshalling the data parameters for the + * function into native types and also unmarshalling the return from function + * execution. + */ +export const ForeignFunction: { + new (ptr: Buffer, retType: ref.Type | string, argTypes: any[], abi?: number): ForeignFunction; + (ptr: Buffer, retType: ref.Type | string, argTypes: any[], abi?: number): ForeignFunction; +}; + +export interface VariadicForeignFunction { + /** + * What gets returned is another function that needs to be invoked with the rest + * of the variadic types that are being invoked from the function. + */ + (...args: any[]): ForeignFunction; + + /** + * Return type as a property of the function generator to + * allow for monkey patching the return value in the very rare case where the + * return type is variadic as well + */ + returnType: any; +} + +/** + * For when you want to call to a C function with variable amount of arguments. + * i.e. `printf`. + * + * This function takes care of caching and reusing `ForeignFunction` instances that + * contain the same ffi_type argument signature. + */ +export const VariadicForeignFunction: { + new (ptr: Buffer, ret: ref.Type | string, fixedArgs: any[], abi?: number): VariadicForeignFunction; + (ptr: Buffer, ret: ref.Type | string, fixedArgs: any[], abi?: number): VariadicForeignFunction; +}; + +export interface DynamicLibrary { + /** Close library, returns the result of the `dlclose` system function. */ + close(): number; + /** Get a symbol from this library. */ + get(symbol: string): Buffer; + /** Get the result of the `dlerror` system function. */ + error(): string; +} + +/** + * This class loads and fetches function pointers for dynamic libraries + * (.so, .dylib, etc). After the libray's function pointer is acquired, then you + * call `get(symbol)` to retreive a pointer to an exported symbol. You need to + * call `get___` on the pointer to dereference it into its actual value, or + * turn the pointer into a callable function with `ForeignFunction`. + */ +export const DynamicLibrary: { + FLAGS: { + RTLD_LAZY: number; + RTLD_NOW: number; + RTLD_LOCAL: number; + RTLD_GLOBAL: number; + RTLD_NOLOAD: number; + RTLD_NODELETE: number; + RTLD_NEXT: Buffer; + RTLD_DEFAUL: Buffer; + } + + new (path?: string, mode?: number): DynamicLibrary; + (path?: string, mode?: number): DynamicLibrary; +}; + +/** + * Turns a JavaScript function into a C function pointer. + * The function pointer may be used in other C functions that + * accept C callback functions. + */ +export interface Callback { + new (retType: any, argTypes: any[], abi: number, fn: any): Buffer; + new (retType: any, argTypes: any[], fn: any): Buffer; + (retType: any, argTypes: any[], abi: number, fn: any): Buffer; + (retType: any, argTypes: any[], fn: any): Buffer; +} +export const Callback: Callback; + +export const ffiType: { + /** Get a `ffi_type *` Buffer appropriate for the given type. */ + (type: ref.Type | string): Buffer + FFI_TYPE: StructType; +}; + +export function CIF(retType: any, types: any[], abi?: any): Buffer; +export function CIF_var(retType: any, types: any[], numFixedArgs: number, abi?: any): Buffer; +export const HAS_OBJC: boolean; +export const FFI_TYPES: {[key: string]: Buffer}; +export const FFI_OK: number; +export const FFI_BAD_TYPEDEF: number; +export const FFI_BAD_ABI: number; +export const FFI_DEFAULT_ABI: number; +export const FFI_FIRST_ABI: number; +export const FFI_LAST_ABI: number; +export const FFI_SYSV: number; +export const FFI_UNIX64: number; +export const RTLD_LAZY: number; +export const RTLD_NOW: number; +export const RTLD_LOCAL: number; +export const RTLD_GLOBAL: number; +export const RTLD_NOLOAD: number; +export const RTLD_NODELETE: number; +export const RTLD_NEXT: Buffer; +export const RTLD_DEFAULT: Buffer; +export const LIB_EXT: string; +export const FFI_TYPE: StructType; + +/** Default types. */ +export const types: { + void: ref.Type; int64: ref.Type; ushort: ref.Type; + int: ref.Type; uint64: ref.Type; float: ref.Type; + uint: ref.Type; long: ref.Type; double: ref.Type; + int8: ref.Type; ulong: ref.Type; Object: ref.Type; + uint8: ref.Type; longlong: ref.Type; CString: ref.Type; + int16: ref.Type; ulonglong: ref.Type; bool: ref.Type; + uint16: ref.Type; char: ref.Type; byte: ref.Type; + int32: ref.Type; uchar: ref.Type; size_t: ref.Type; + uint32: ref.Type; short: ref.Type; +}; diff --git a/types/ffi-napi/node-ffi-napi-buffer.d.ts b/types/ffi-napi/node-ffi-napi-buffer.d.ts new file mode 100644 index 0000000000..fa817e1662 --- /dev/null +++ b/types/ffi-napi/node-ffi-napi-buffer.d.ts @@ -0,0 +1,50 @@ +// DefinitelyTyped: partial + +interface Buffer { + /** Shorthand for `ref.address`. */ + address(): number; + /** Shorthand for `ref.deref`. */ + deref(): any; + /** Shorthand for `ref.isNull`. */ + isNull(): boolean; + /** Shorthand for `ref.readCString`. */ + readCString(offset?: number): string; + /** Shorthand for `ref.readInt64BE`. */ + readInt64BE(offset?: number): string; + /** Shorthand for `ref.readInt64LE`. */ + readInt64LE(offset?: number): string; + /** Shorthand for `ref.readObject`. */ + readObject(offset?: number): string; + /** Shorthand for `ref.readPointer`. */ + readPointer(offset?: number): string; + /** Shorthand for `ref.readUInt64BE`. */ + readUInt64BE(offset?: number): string; + /** Shorthand for `ref.readUInt64LE`. */ + readUInt64LE(offset?: number): string; + /** Shorthand for `ref.ref`. */ + ref(): Buffer; + /** Shorthand for `ref.reinterpret`. */ + reinterpret(size: number, offset?: number): Buffer; + /** Shorthand for `ref.reinterpretUntilZeros`. */ + reinterpretUntilZeros(size: number, offset?: number): Buffer; + /** Shorthand for `ref.writeCString`. */ + writeCString(offset: number, input: string, encoding?: string): void; + /** Shorthand for `ref.writeInt64BE`. */ + writeInt64BE(offset: number, input: number | string): any; + /** Shorthand for `ref.writeInt64LE`. */ + writeInt64LE(offset: number, input: number | string): any; + /** Shorthand for `ref.writeObject`. */ + writeObject(offset: number, object: object): void; + /** Shorthand for `ref.writePointer`. */ + writePointer(offset: number, pointer: Buffer): void; + /** Shorthand for `ref.writeUInt64BE`. */ + writeUInt64BE(offset: number, input: number | string): any; + /** Shorthand for `ref.writeUInt64LE`. */ + writeUInt64LE(offset: number, input: number | string): any; + + /** + * Generate string for inspecting. + * String includes the hex-encoded memory address of the Buffer instance. + */ + inspect(): string; +} diff --git a/types/ffi-napi/tsconfig.json b/types/ffi-napi/tsconfig.json new file mode 100644 index 0000000000..c914c55679 --- /dev/null +++ b/types/ffi-napi/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "node-ffi-napi-buffer.d.ts", + "ffi-napi-tests.ts" + ] +} diff --git a/types/ffi-napi/tslint.json b/types/ffi-napi/tslint.json new file mode 100644 index 0000000000..c5fa24ca82 --- /dev/null +++ b/types/ffi-napi/tslint.json @@ -0,0 +1,8 @@ +{ + "extends": "dtslint/dt.json", + + "rules": { + "no-consecutive-blank-lines": [true, 3], + "ban-types": [false] + } +} From daf1f6c5a7535e6dfe71a5222a9f0399cb386b3e Mon Sep 17 00:00:00 2001 From: Keerthi Niranjan Date: Thu, 16 Aug 2018 11:28:01 +0530 Subject: [PATCH 67/94] Add ref-array-di module --- types/ref-array-di/index.d.ts | 62 +++++++++++++++++++++++++ types/ref-array-di/tsconfig.json | 22 +++++++++ types/ref-array-di/tslint.json | 79 ++++++++++++++++++++++++++++++++ 3 files changed, 163 insertions(+) create mode 100644 types/ref-array-di/index.d.ts create mode 100644 types/ref-array-di/tsconfig.json create mode 100644 types/ref-array-di/tslint.json diff --git a/types/ref-array-di/index.d.ts b/types/ref-array-di/index.d.ts new file mode 100644 index 0000000000..04a69fd1ef --- /dev/null +++ b/types/ref-array-di/index.d.ts @@ -0,0 +1,62 @@ +// Type definitions for ref-array-di 1.2 +// Project: https://github.com/node-ffi-napi/ref-array-di +// Definitions by: Keerthi Niranjan , Kiran Niranjan +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import ref = require('ref-napi'); + +interface ArrayType extends ref.Type { + BYTES_PER_ELEMENT: number; + fixedLength: number; + /** The reference to the base type. */ + type: ref.Type; + + /** + * Accepts a Buffer instance that should be an already-populated with data + * for the ArrayType. The "length" of the Array is determined by searching + * through the buffer's contents until an aligned NULL pointer is encountered. + */ + untilZeros(buffer: Buffer): { + [i: number]: T; length: number; toArray(): T[]; + toJSON(): T[]; inspect(): string; buffer: Buffer; ref(): Buffer; + }; + + new (length?: number): { + [i: number]: T; length: number; toArray(): T[]; + toJSON(): T[]; inspect(): string; buffer: Buffer; ref(): Buffer; + }; + new (data: number[], length?: number): { + [i: number]: T; length: number; toArray(): T[]; + toJSON(): T[]; inspect(): string; buffer: Buffer; ref(): Buffer; + }; + new (data: Buffer, length?: number): { + [i: number]: T; length: number; toArray(): T[]; + toJSON(): T[]; inspect(): string; buffer: Buffer; ref(): Buffer; + }; + (length?: number): { + [i: number]: T; length: number; toArray(): T[]; + toJSON(): T[]; inspect(): string; buffer: Buffer; ref(): Buffer; + }; + (data: number[], length?: number): { + [i: number]: T; length: number; toArray(): T[]; + toJSON(): T[]; inspect(): string; buffer: Buffer; ref(): Buffer; + }; + (data: Buffer, length?: number): { + [i: number]: T; length: number; toArray(): T[]; + toJSON(): T[]; inspect(): string; buffer: Buffer; ref(): Buffer; + }; +} + +/** + * The array type meta-constructor. + * The returned constructor's API is highly influenced by the WebGL + * TypedArray API. + */ +declare var ArrayType: { + new (type: ref.Type, length?: number): ArrayType; + new (type: string, length?: number): ArrayType; + (type: ref.Type, length?: number): ArrayType; + (type: string, length?: number): ArrayType; +}; + +export = ArrayType; diff --git a/types/ref-array-di/tsconfig.json b/types/ref-array-di/tsconfig.json new file mode 100644 index 0000000000..02963e3afd --- /dev/null +++ b/types/ref-array-di/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts" + ] +} \ No newline at end of file diff --git a/types/ref-array-di/tslint.json b/types/ref-array-di/tslint.json new file mode 100644 index 0000000000..a41bf5d19a --- /dev/null +++ b/types/ref-array-di/tslint.json @@ -0,0 +1,79 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "adjacent-overload-signatures": false, + "array-type": false, + "arrow-return-shorthand": false, + "ban-types": false, + "callable-types": false, + "comment-format": false, + "dt-header": false, + "eofline": false, + "export-just-namespace": false, + "import-spacing": false, + "interface-name": false, + "interface-over-type-literal": false, + "jsdoc-format": false, + "max-line-length": false, + "member-access": false, + "new-parens": false, + "no-any-union": false, + "no-boolean-literal-compare": false, + "no-conditional-assignment": false, + "no-consecutive-blank-lines": false, + "no-construct": false, + "no-declare-current-package": false, + "no-duplicate-imports": false, + "no-duplicate-variable": false, + "no-empty-interface": false, + "no-for-in-array": false, + "no-inferrable-types": false, + "no-internal-module": false, + "no-irregular-whitespace": false, + "no-mergeable-namespace": false, + "no-misused-new": false, + "no-namespace": false, + "no-object-literal-type-assertion": false, + "no-padding": false, + "no-redundant-jsdoc": false, + "no-redundant-jsdoc-2": false, + "no-redundant-undefined": false, + "no-reference-import": false, + "no-relative-import-in-test": false, + "no-self-import": false, + "no-single-declare-module": false, + "no-string-throw": false, + "no-unnecessary-callback-wrapper": false, + "no-unnecessary-class": false, + "no-unnecessary-generics": false, + "no-unnecessary-qualifier": false, + "no-unnecessary-type-assertion": false, + "no-useless-files": false, + "no-var-keyword": false, + "no-var-requires": false, + "no-void-expression": false, + "no-trailing-whitespace": false, + "object-literal-key-quotes": false, + "object-literal-shorthand": false, + "one-line": false, + "one-variable-per-declaration": false, + "only-arrow-functions": false, + "prefer-conditional-expression": false, + "prefer-const": false, + "prefer-declare-function": false, + "prefer-for-of": false, + "prefer-method-signature": false, + "prefer-template": false, + "radix": false, + "semicolon": false, + "space-before-function-paren": false, + "space-within-parens": false, + "strict-export-declare-modifiers": false, + "trim-file": false, + "triple-equals": false, + "typedef-whitespace": false, + "unified-signatures": false, + "void-return": false, + "whitespace": false + } +} From 07a3c48dc407ec2d2e0d780886a4024d9906142a Mon Sep 17 00:00:00 2001 From: Keerthi Niranjan Date: Thu, 16 Aug 2018 11:28:44 +0530 Subject: [PATCH 68/94] Add ref-napi module --- types/ref-napi/index.d.ts | 188 +++++++++++++++++++++++++++++++++++ types/ref-napi/tsconfig.json | 22 ++++ types/ref-napi/tslint.json | 79 +++++++++++++++ 3 files changed, 289 insertions(+) create mode 100644 types/ref-napi/index.d.ts create mode 100644 types/ref-napi/tsconfig.json create mode 100644 types/ref-napi/tslint.json diff --git a/types/ref-napi/index.d.ts b/types/ref-napi/index.d.ts new file mode 100644 index 0000000000..ab3b38d953 --- /dev/null +++ b/types/ref-napi/index.d.ts @@ -0,0 +1,188 @@ +// Type definitions for ref-napi 1.4 +// Project: https://github.com/node-ffi-napi/ref-napi +// Definitions by: Keerthi Niranjan , Kiran Niranjan +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +export interface Type { + /** The size in bytes required to hold this datatype. */ + size: number; + /** The current level of indirection of the buffer. */ + indirection: number; + /** To invoke when `ref.get` is invoked on a buffer of this type. */ + get(buffer: Buffer, offset: number): any; + /** To invoke when `ref.set` is invoked on a buffer of this type. */ + set(buffer: Buffer, offset: number, value: any): void; + /** The name to use during debugging for this datatype. */ + name?: string; + /** The alignment of this datatype when placed inside a struct. */ + alignment?: number; +} + +/** A Buffer that references the C NULL pointer. */ +export declare var NULL: Buffer; +/** A pointer-sized buffer pointing to NULL. */ +export declare var NULL_POINTER: Buffer; +/** Get the memory address of buffer. */ +export declare function address(buffer: Buffer): number; +/** Allocate the memory with the given value written to it. */ +export declare function alloc(type: Type, value?: any): Buffer; +/** Allocate the memory with the given value written to it. */ +export declare function alloc(type: string, value?: any): Buffer; + +/** + * Allocate the memory with the given string written to it with the given + * encoding (defaults to utf8). The buffer is 1 byte longer than the + * string itself, and is NULL terminated. + */ +export declare function allocCString(string: string, encoding?: string): Buffer; + +/** Coerce a type.*/ +export declare function coerceType(type: Type): Type; +/** Coerce a type. String are looked up from the ref.types object. */ +export declare function coerceType(type: string): Type; + +/** + * Get value after dereferencing buffer. + * That is, first it checks the indirection count of buffer's type, and + * if it's greater than 1 then it merely returns another Buffer, but with + * one level less indirection. + */ +export declare function deref(buffer: Buffer): any; + +/** Create clone of the type, with decremented indirection level by 1. */ +export declare function derefType(type: Type): Type; +/** Create clone of the type, with decremented indirection level by 1. */ +export declare function derefType(type: string): Type; +/** Represents the native endianness of the processor ("LE" or "BE"). */ +export declare var endianness: string; +/** Check the indirection level and return a dereferenced when necessary. */ +export declare function get(buffer: Buffer, offset?: number, type?: Type): any; +/** Check the indirection level and return a dereferenced when necessary. */ +export declare function get(buffer: Buffer, offset?: number, type?: string): any; +/** Get type of the buffer. Create a default type when none exists. */ +export declare function getType(buffer: Buffer): Type; +/** Check the NULL. */ +export declare function isNull(buffer: Buffer): boolean; +/** Read C string until the first NULL. */ +export declare function readCString(buffer: Buffer, offset?: number): string; + +/** + * Read a big-endian signed 64-bit int. + * If there is losing precision, then return a string, otherwise a number. + * @return {number|string} + */ +export declare function readInt64BE(buffer: Buffer, offset?: number): any; + +/** + * Read a little-endian signed 64-bit int. + * If there is losing precision, then return a string, otherwise a number. + * @return {number|string} + */ +export declare function readInt64LE(buffer: Buffer, offset?: number): any; + +/** Read a JS Object that has previously been written. */ +export declare function readObject(buffer: Buffer, offset?: number): Object; +/** Read data from the pointer. */ +export declare function readPointer(buffer: Buffer, offset?: number, + length?: number): Buffer; +/** + * Read a big-endian unsigned 64-bit int. + * If there is losing precision, then return a string, otherwise a number. + * @return {number|string} + */ +export declare function readUInt64BE(buffer: Buffer, offset?: number): any; + +/** + * Read a little-endian unsigned 64-bit int. + * If there is losing precision, then return a string, otherwise a number. + * @return {number|string} + */ +export declare function readUInt64LE(buffer: Buffer, offset?: number): any; + +/** Create pointer to buffer. */ +export declare function ref(buffer: Buffer): Buffer; +/** Create clone of the type, with incremented indirection level by 1. */ +export declare function refType(type: Type): Type; +/** Create clone of the type, with incremented indirection level by 1. */ +export declare function refType(type: string): Type; + +/** + * Create buffer with the specified size, with the same address as source. + * This function "attaches" source to the returned buffer to prevent it from + * being garbage collected. + */ +export declare function reinterpret(buffer: Buffer, size: number, + offset?: number): Buffer; +/** + * Scan past the boundary of the buffer's length until it finds size number + * of aligned NULL bytes. + */ +export declare function reinterpretUntilZeros(buffer: Buffer, size: number, + offset?: number): Buffer; + +/** Write pointer if the indirection is 1, otherwise write value. */ +export declare function set(buffer: Buffer, offset: number, value: any, type?: Type): void; +/** Write pointer if the indirection is 1, otherwise write value. */ +export declare function set(buffer: Buffer, offset: number, value: any, type?: string): void; +/** Write the string as a NULL terminated. Default encoding is utf8. */ +export declare function writeCString(buffer: Buffer, offset: number, + string: string, encoding?: string): void; +/** Write a big-endian signed 64-bit int. */ +export declare function writeInt64BE(buffer: Buffer, offset: number, input: number): void; +/** Write a big-endian signed 64-bit int. */ +export declare function writeInt64BE(buffer: Buffer, offset: number, input: string): void; +/** Write a little-endian signed 64-bit int. */ +export declare function writeInt64LE(buffer: Buffer, offset: number, input: number): void; +/** Write a little-endian signed 64-bit int. */ +export declare function writeInt64LE(buffer: Buffer, offset: number, input: string): void; + +/** + * Write the JS Object. This function "attaches" object to buffer to prevent + * it from being garbage collected. + */ +export declare function writeObject(buffer: Buffer, offset: number, object: Object): void; + +/** + * Write the memory address of pointer to buffer at the specified offset. This + * function "attaches" object to buffer to prevent it from being garbage collected. + */ +export declare function writePointer(buffer: Buffer, offset: number, + pointer: Buffer): void; + +/** Write a little-endian unsigned 64-bit int. */ +export declare function writeUInt64BE(buffer: Buffer, offset: number, input: number): void; +/** Write a little-endian unsigned 64-bit int. */ +export declare function writeUInt64BE(buffer: Buffer, offset: number, input: string): void; + +/** + * Attach object to buffer such. + * It prevents object from being garbage collected until buffer does. + */ +export declare function _attach(buffer: Buffer, object: Object): void; + +/** Same as ref.reinterpret, except that this version does not attach buffer. */ +export declare function _reinterpret(buffer: Buffer, size: number, + offset?: number): Buffer; +/** Same as ref.reinterpretUntilZeros, except that this version does not attach buffer. */ +export declare function _reinterpretUntilZeros(buffer: Buffer, size: number, + offset?: number): Buffer; +/** Same as ref.writePointer, except that this version does not attach pointer. */ +export declare function _writePointer(buffer: Buffer, offset: number, + pointer: Buffer): void; +/** Same as ref.writeObject, except that this version does not attach object. */ +export declare function _writeObject(buffer: Buffer, offset: number, object: Object): void; + +/** Default types. */ +export declare var types: { + void: Type; int64: Type; ushort: Type; + int: Type; uint64: Type; float: Type; + uint: Type; long: Type; double: Type; + int8: Type; ulong: Type; Object: Type; + uint8: Type; longlong: Type; CString: Type; + int16: Type; ulonglong: Type; bool: Type; + uint16: Type; char: Type; byte: Type; + int32: Type; uchar: Type; size_t: Type; + uint32: Type; short: Type; +}; diff --git a/types/ref-napi/tsconfig.json b/types/ref-napi/tsconfig.json new file mode 100644 index 0000000000..02963e3afd --- /dev/null +++ b/types/ref-napi/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts" + ] +} \ No newline at end of file diff --git a/types/ref-napi/tslint.json b/types/ref-napi/tslint.json new file mode 100644 index 0000000000..a41bf5d19a --- /dev/null +++ b/types/ref-napi/tslint.json @@ -0,0 +1,79 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "adjacent-overload-signatures": false, + "array-type": false, + "arrow-return-shorthand": false, + "ban-types": false, + "callable-types": false, + "comment-format": false, + "dt-header": false, + "eofline": false, + "export-just-namespace": false, + "import-spacing": false, + "interface-name": false, + "interface-over-type-literal": false, + "jsdoc-format": false, + "max-line-length": false, + "member-access": false, + "new-parens": false, + "no-any-union": false, + "no-boolean-literal-compare": false, + "no-conditional-assignment": false, + "no-consecutive-blank-lines": false, + "no-construct": false, + "no-declare-current-package": false, + "no-duplicate-imports": false, + "no-duplicate-variable": false, + "no-empty-interface": false, + "no-for-in-array": false, + "no-inferrable-types": false, + "no-internal-module": false, + "no-irregular-whitespace": false, + "no-mergeable-namespace": false, + "no-misused-new": false, + "no-namespace": false, + "no-object-literal-type-assertion": false, + "no-padding": false, + "no-redundant-jsdoc": false, + "no-redundant-jsdoc-2": false, + "no-redundant-undefined": false, + "no-reference-import": false, + "no-relative-import-in-test": false, + "no-self-import": false, + "no-single-declare-module": false, + "no-string-throw": false, + "no-unnecessary-callback-wrapper": false, + "no-unnecessary-class": false, + "no-unnecessary-generics": false, + "no-unnecessary-qualifier": false, + "no-unnecessary-type-assertion": false, + "no-useless-files": false, + "no-var-keyword": false, + "no-var-requires": false, + "no-void-expression": false, + "no-trailing-whitespace": false, + "object-literal-key-quotes": false, + "object-literal-shorthand": false, + "one-line": false, + "one-variable-per-declaration": false, + "only-arrow-functions": false, + "prefer-conditional-expression": false, + "prefer-const": false, + "prefer-declare-function": false, + "prefer-for-of": false, + "prefer-method-signature": false, + "prefer-template": false, + "radix": false, + "semicolon": false, + "space-before-function-paren": false, + "space-within-parens": false, + "strict-export-declare-modifiers": false, + "trim-file": false, + "triple-equals": false, + "typedef-whitespace": false, + "unified-signatures": false, + "void-return": false, + "whitespace": false + } +} From a36c55be2ced48e3d3ddba15e543ad2e2308ab63 Mon Sep 17 00:00:00 2001 From: Keerthi Niranjan Date: Thu, 16 Aug 2018 11:29:23 +0530 Subject: [PATCH 69/94] Add ref-struct-di module --- types/ref-struct-di/index.d.ts | 60 ++++++++++++++++ types/ref-struct-di/ref-struct-di-tests.ts | 12 ++++ types/ref-struct-di/tsconfig.json | 23 +++++++ types/ref-struct-di/tslint.json | 79 ++++++++++++++++++++++ 4 files changed, 174 insertions(+) create mode 100644 types/ref-struct-di/index.d.ts create mode 100644 types/ref-struct-di/ref-struct-di-tests.ts create mode 100644 types/ref-struct-di/tsconfig.json create mode 100644 types/ref-struct-di/tslint.json diff --git a/types/ref-struct-di/index.d.ts b/types/ref-struct-di/index.d.ts new file mode 100644 index 0000000000..dd3d878fc1 --- /dev/null +++ b/types/ref-struct-di/index.d.ts @@ -0,0 +1,60 @@ +// Type definitions for ref-struct-di 1.1 +// Project: https://github.com/node-ffi-napi/ref-struct-di +// Definitions by: Keerthi Niranjan , Kiran Niranjan +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +import ref = require('ref-napi'); + +/** + * This is the `constructor` of the Struct type that gets returned. + * + * Invoke it with `new` to create a new Buffer instance backing the struct. + * Pass it an existing Buffer instance to use that as the backing buffer. + * Pass in an Object containing the struct fields to auto-populate the + * struct with the data. + * + * @constructor + */ +interface StructType extends ref.Type { + /** Pass it an existing Buffer instance to use that as the backing buffer. */ + new (arg: Buffer, data?: {}): any; + new (data?: {}): any; + /** Pass it an existing Buffer instance to use that as the backing buffer. */ + (arg: Buffer, data?: {}): any; + (data?: {}): any; + + fields: { [key: string]: { type: ref.Type } }; + + /** + * Adds a new field to the struct instance with the given name and type. + * Note that this function will throw an Error if any instances of the struct + * type have already been created, therefore this function must be called at the + * beginning, before any instances are created. + */ + defineProperty(name: string, type: ref.Type): void; + + /** + * Adds a new field to the struct instance with the given name and type. + * Note that this function will throw an Error if any instances of the struct + * type have already been created, therefore this function must be called at the + * beginning, before any instances are created. + */ + defineProperty(name: string, type: string): void; + + /** + * Custom for struct type instances. + * @override + */ + toString(): string; +} + +/** The struct type meta-constructor. */ +declare var StructType: { + new (fields?: object, opt?: object): StructType; + new (fields?: any[]): StructType; + (fields?: object, opt?: object): StructType; + (fields?: any[]): StructType; +} + +export = StructType; diff --git a/types/ref-struct-di/ref-struct-di-tests.ts b/types/ref-struct-di/ref-struct-di-tests.ts new file mode 100644 index 0000000000..60b03e0cd5 --- /dev/null +++ b/types/ref-struct-di/ref-struct-di-tests.ts @@ -0,0 +1,12 @@ +import ref = require("ref-napi"); +import StructType = require("ref-struct-di"); + +const normalStruct = StructType({ + t: ref.types.uint8, + v: ref.types.long, +}); + +const packedStruct = StructType({ + t: ref.types.uint8, + v: ref.types.long, +}, {packed: true}); diff --git a/types/ref-struct-di/tsconfig.json b/types/ref-struct-di/tsconfig.json new file mode 100644 index 0000000000..fef426ba7a --- /dev/null +++ b/types/ref-struct-di/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "ref-struct-di-tests.ts" + ] +} diff --git a/types/ref-struct-di/tslint.json b/types/ref-struct-di/tslint.json new file mode 100644 index 0000000000..a41bf5d19a --- /dev/null +++ b/types/ref-struct-di/tslint.json @@ -0,0 +1,79 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "adjacent-overload-signatures": false, + "array-type": false, + "arrow-return-shorthand": false, + "ban-types": false, + "callable-types": false, + "comment-format": false, + "dt-header": false, + "eofline": false, + "export-just-namespace": false, + "import-spacing": false, + "interface-name": false, + "interface-over-type-literal": false, + "jsdoc-format": false, + "max-line-length": false, + "member-access": false, + "new-parens": false, + "no-any-union": false, + "no-boolean-literal-compare": false, + "no-conditional-assignment": false, + "no-consecutive-blank-lines": false, + "no-construct": false, + "no-declare-current-package": false, + "no-duplicate-imports": false, + "no-duplicate-variable": false, + "no-empty-interface": false, + "no-for-in-array": false, + "no-inferrable-types": false, + "no-internal-module": false, + "no-irregular-whitespace": false, + "no-mergeable-namespace": false, + "no-misused-new": false, + "no-namespace": false, + "no-object-literal-type-assertion": false, + "no-padding": false, + "no-redundant-jsdoc": false, + "no-redundant-jsdoc-2": false, + "no-redundant-undefined": false, + "no-reference-import": false, + "no-relative-import-in-test": false, + "no-self-import": false, + "no-single-declare-module": false, + "no-string-throw": false, + "no-unnecessary-callback-wrapper": false, + "no-unnecessary-class": false, + "no-unnecessary-generics": false, + "no-unnecessary-qualifier": false, + "no-unnecessary-type-assertion": false, + "no-useless-files": false, + "no-var-keyword": false, + "no-var-requires": false, + "no-void-expression": false, + "no-trailing-whitespace": false, + "object-literal-key-quotes": false, + "object-literal-shorthand": false, + "one-line": false, + "one-variable-per-declaration": false, + "only-arrow-functions": false, + "prefer-conditional-expression": false, + "prefer-const": false, + "prefer-declare-function": false, + "prefer-for-of": false, + "prefer-method-signature": false, + "prefer-template": false, + "radix": false, + "semicolon": false, + "space-before-function-paren": false, + "space-within-parens": false, + "strict-export-declare-modifiers": false, + "trim-file": false, + "triple-equals": false, + "typedef-whitespace": false, + "unified-signatures": false, + "void-return": false, + "whitespace": false + } +} From 15a706e124baacfb796ada019dd5a5413355bf42 Mon Sep 17 00:00:00 2001 From: Keerthi Niranjan Date: Thu, 16 Aug 2018 11:30:00 +0530 Subject: [PATCH 70/94] Add ref-union-di module --- types/ref-union-di/index.d.ts | 59 ++++++++++++++++++++++++ types/ref-union-di/tsconfig.json | 22 +++++++++ types/ref-union-di/tslint.json | 79 ++++++++++++++++++++++++++++++++ 3 files changed, 160 insertions(+) create mode 100644 types/ref-union-di/index.d.ts create mode 100644 types/ref-union-di/tsconfig.json create mode 100644 types/ref-union-di/tslint.json diff --git a/types/ref-union-di/index.d.ts b/types/ref-union-di/index.d.ts new file mode 100644 index 0000000000..29c7401df9 --- /dev/null +++ b/types/ref-union-di/index.d.ts @@ -0,0 +1,59 @@ +// Type definitions for ref-union-di 1.0 +// Project: https://github.com/node-ffi-napi/ref-union-di +// Definitions by: Keerthi Niranjan , Kiran Niranjan +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import ref = require('ref-napi'); + +/** + * This is the `constructor` of the Struct type that gets returned. + * + * Invoke it with `new` to create a new Buffer instance backing the union. + * Pass it an existing Buffer instance to use that as the backing buffer. + * Pass in an Object containing the union fields to auto-populate the + * union with the data. + * + * @constructor + */ +interface UnionType extends ref.Type { + /** Pass it an existing Buffer instance to use that as the backing buffer. */ + new (arg: Buffer, data?: {}): any; + new (data?: {}): any; + /** Pass it an existing Buffer instance to use that as the backing buffer. */ + (arg: Buffer, data?: {}): any; + (data?: {}): any; + + fields: { [key: string]: { type: ref.Type } }; + + /** + * Adds a new field to the union instance with the given name and type. + * Note that this function will throw an Error if any instances of the union + * type have already been created, therefore this function must be called at the + * beginning, before any instances are created. + */ + defineProperty(name: string, type: ref.Type): void; + + /** + * Adds a new field to the union instance with the given name and type. + * Note that this function will throw an Error if any instances of the union + * type have already been created, therefore this function must be called at the + * beginning, before any instances are created. + */ + defineProperty(name: string, type: string): void; + + /** + * Custom for union type instances. + * @override + */ + toString(): string; +} + +/** The union type meta-constructor. */ +declare var UnionType: { + new (fields?: {}): UnionType; + new (fields?: any[]): UnionType; + (fields?: {}): UnionType; + (fields?: any[]): UnionType; +} + +export = UnionType; diff --git a/types/ref-union-di/tsconfig.json b/types/ref-union-di/tsconfig.json new file mode 100644 index 0000000000..02963e3afd --- /dev/null +++ b/types/ref-union-di/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts" + ] +} \ No newline at end of file diff --git a/types/ref-union-di/tslint.json b/types/ref-union-di/tslint.json new file mode 100644 index 0000000000..a41bf5d19a --- /dev/null +++ b/types/ref-union-di/tslint.json @@ -0,0 +1,79 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "adjacent-overload-signatures": false, + "array-type": false, + "arrow-return-shorthand": false, + "ban-types": false, + "callable-types": false, + "comment-format": false, + "dt-header": false, + "eofline": false, + "export-just-namespace": false, + "import-spacing": false, + "interface-name": false, + "interface-over-type-literal": false, + "jsdoc-format": false, + "max-line-length": false, + "member-access": false, + "new-parens": false, + "no-any-union": false, + "no-boolean-literal-compare": false, + "no-conditional-assignment": false, + "no-consecutive-blank-lines": false, + "no-construct": false, + "no-declare-current-package": false, + "no-duplicate-imports": false, + "no-duplicate-variable": false, + "no-empty-interface": false, + "no-for-in-array": false, + "no-inferrable-types": false, + "no-internal-module": false, + "no-irregular-whitespace": false, + "no-mergeable-namespace": false, + "no-misused-new": false, + "no-namespace": false, + "no-object-literal-type-assertion": false, + "no-padding": false, + "no-redundant-jsdoc": false, + "no-redundant-jsdoc-2": false, + "no-redundant-undefined": false, + "no-reference-import": false, + "no-relative-import-in-test": false, + "no-self-import": false, + "no-single-declare-module": false, + "no-string-throw": false, + "no-unnecessary-callback-wrapper": false, + "no-unnecessary-class": false, + "no-unnecessary-generics": false, + "no-unnecessary-qualifier": false, + "no-unnecessary-type-assertion": false, + "no-useless-files": false, + "no-var-keyword": false, + "no-var-requires": false, + "no-void-expression": false, + "no-trailing-whitespace": false, + "object-literal-key-quotes": false, + "object-literal-shorthand": false, + "one-line": false, + "one-variable-per-declaration": false, + "only-arrow-functions": false, + "prefer-conditional-expression": false, + "prefer-const": false, + "prefer-declare-function": false, + "prefer-for-of": false, + "prefer-method-signature": false, + "prefer-template": false, + "radix": false, + "semicolon": false, + "space-before-function-paren": false, + "space-within-parens": false, + "strict-export-declare-modifiers": false, + "trim-file": false, + "triple-equals": false, + "typedef-whitespace": false, + "unified-signatures": false, + "void-return": false, + "whitespace": false + } +} From 003650d429c312298d2598a305b6d8de02b6651e Mon Sep 17 00:00:00 2001 From: michahell Date: Thu, 16 Aug 2018 16:41:40 +0200 Subject: [PATCH 71/94] expands parameter type of Office.mailbox.getCallbackTokenAsync() with { isRest: boolean } --- types/office-js/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/office-js/index.d.ts b/types/office-js/index.d.ts index f9eb56c8f5..624e45fec1 100644 --- a/types/office-js/index.d.ts +++ b/types/office-js/index.d.ts @@ -13586,7 +13586,7 @@ declare namespace Office { * asyncContext: Any state data that is passed to the asynchronous method. * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. The token is provided as a string in the asyncResult.value property. */ - getCallbackTokenAsync(options: Office.AsyncContextOptions, callback: (result: AsyncResult) => void): void; + getCallbackTokenAsync(options: Office.AsyncContextOptions & { isRest: boolean }, callback: (result: AsyncResult) => void): void; /** * Gets a string that contains a token used to get an attachment or item from an Exchange Server. * @@ -60490,4 +60490,4 @@ declare namespace Visio { //////////////////////////////////////////////////////////////// ////////////////////// End PowerPoint APIs ///////////////////// -//////////////////////////////////////////////////////////////// \ No newline at end of file +//////////////////////////////////////////////////////////////// From 165bdb88406525d73af3c052f6a9195eb87e4af1 Mon Sep 17 00:00:00 2001 From: michahell Date: Thu, 16 Aug 2018 16:59:31 +0200 Subject: [PATCH 72/94] changes getCallbackTokenAsync parameter union type... type to `|` iso `&` --- types/office-js/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/office-js/index.d.ts b/types/office-js/index.d.ts index 624e45fec1..10e8412382 100644 --- a/types/office-js/index.d.ts +++ b/types/office-js/index.d.ts @@ -13586,7 +13586,7 @@ declare namespace Office { * asyncContext: Any state data that is passed to the asynchronous method. * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. The token is provided as a string in the asyncResult.value property. */ - getCallbackTokenAsync(options: Office.AsyncContextOptions & { isRest: boolean }, callback: (result: AsyncResult) => void): void; + getCallbackTokenAsync(options: Office.AsyncContextOptions | { isRest: boolean }, callback: (result: AsyncResult) => void): void; /** * Gets a string that contains a token used to get an attachment or item from an Exchange Server. * From 6955d8d64f6c894e9a9b60037eaf3a967b2029e7 Mon Sep 17 00:00:00 2001 From: Manuel Heidrich Date: Thu, 16 Aug 2018 21:35:12 +0200 Subject: [PATCH 73/94] Fix toBase64Image --- types/chart.js/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/chart.js/index.d.ts b/types/chart.js/index.d.ts index 09230f6702..4e82fb9ff5 100644 --- a/types/chart.js/index.d.ts +++ b/types/chart.js/index.d.ts @@ -14,6 +14,7 @@ // Slavik Nychkalo // Francesco Benedetto // Alexandros Dorodoulis +// Manuel Heidrich // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -31,7 +32,7 @@ declare class Chart { stop: () => {}; resize: () => {}; clear: () => {}; - toBase64: () => string; + toBase64Image: () => string; generateLegend: () => {}; getElementAtEvent: (e: any) => {}; getElementsAtEvent: (e: any) => Array<{}>; From d01da3c1db003ec7df5e5c1da6bf722f96228b43 Mon Sep 17 00:00:00 2001 From: Will Caulfield Date: Thu, 16 Aug 2018 16:07:18 -0400 Subject: [PATCH 74/94] auth0-lock: add hideMainScreenTitle to Auth0LockThemeOptions --- types/auth0-lock/auth0-lock-tests.ts | 1 + types/auth0-lock/index.d.ts | 2 ++ 2 files changed, 3 insertions(+) diff --git a/types/auth0-lock/auth0-lock-tests.ts b/types/auth0-lock/auth0-lock-tests.ts index 618e4d562e..4b5c60e716 100644 --- a/types/auth0-lock/auth0-lock-tests.ts +++ b/types/auth0-lock/auth0-lock-tests.ts @@ -90,6 +90,7 @@ const themeOptions : Auth0LockConstructorOptions = { icon: 'http://baz.com/icon.png' } }, + hideMainScreenTitle: false, labeledSubmitButton: false, logo: "https://example.com/assets/logo.png", primaryColor: "green" diff --git a/types/auth0-lock/index.d.ts b/types/auth0-lock/index.d.ts index da1820352f..622ac3d36c 100644 --- a/types/auth0-lock/index.d.ts +++ b/types/auth0-lock/index.d.ts @@ -3,6 +3,7 @@ // Definitions by: Brian Caruso // Dan Caddigan // Larry Faudree +// Will Caulfield // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -75,6 +76,7 @@ interface Auth0LockThemeButtonOptions { interface Auth0LockThemeOptions { authButtons?: Auth0LockThemeButtonOptions; + hideMainScreenTitle?: boolean; labeledSubmitButton?: boolean; logo?: string; primaryColor?: string; From 46fd914aeb2c8183b1046bc02da68ef5f5be5a40 Mon Sep 17 00:00:00 2001 From: Alex Maclean Date: Fri, 17 Aug 2018 07:54:43 +1000 Subject: [PATCH 75/94] tests --- types/react-sortable-tree/react-sortable-tree-tests.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/react-sortable-tree/react-sortable-tree-tests.tsx b/types/react-sortable-tree/react-sortable-tree-tests.tsx index 6ed4b3e74b..695614caca 100644 --- a/types/react-sortable-tree/react-sortable-tree-tests.tsx +++ b/types/react-sortable-tree/react-sortable-tree-tests.tsx @@ -69,11 +69,13 @@ class Test extends React.Component { dndType="testNodeType" placeholderRenderer={PlaceholderRenderer} theme={theme} + shouldCopyOnOutsideDrop={true} /> {}} style={{width: "100px"}} + shouldCopyOnOutsideDrop={() => false} />
); From e5a5972e6fef4261cdf13d696d1a25a2bd456ea7 Mon Sep 17 00:00:00 2001 From: "idan.d" Date: Fri, 17 Aug 2018 01:21:01 +0300 Subject: [PATCH 76/94] strictly typed Schema set arguments --- types/mongoose/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/mongoose/index.d.ts b/types/mongoose/index.d.ts index 5eea1625b5..c24427498f 100644 --- a/types/mongoose/index.d.ts +++ b/types/mongoose/index.d.ts @@ -769,8 +769,8 @@ declare module "mongoose" { * @param key option name * @param value if not passed, the current option value is returned */ - set(key: string): any; - set(key: string, value: any): this; + set(key: T): SchemaOptions[T]; + set(key: T, value: SchemaOptions[T]): this; /** * Adds static "class" methods to Models compiled from this schema. From ecc4b01429190fcf8dcff200b5b695349b8fe8ad Mon Sep 17 00:00:00 2001 From: "idan.d" Date: Fri, 17 Aug 2018 01:39:26 +0300 Subject: [PATCH 77/94] changed mongoose tests for schema set method --- types/mongoose/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/mongoose/index.d.ts b/types/mongoose/index.d.ts index c24427498f..90bb04747f 100644 --- a/types/mongoose/index.d.ts +++ b/types/mongoose/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Mongoose 5.2.1 +// Type definitions for Mongoose 5.2.2 // Project: http://mongoosejs.com/ // Definitions by: horiuchi // sindrenm @@ -10,6 +10,7 @@ // jussikinnula // ondratra // alfirin +// Idan Dardikman // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 From 53b6b3a758ae77945af7b0a1238da547d7b6afa4 Mon Sep 17 00:00:00 2001 From: "idan.d" Date: Fri, 17 Aug 2018 01:43:13 +0300 Subject: [PATCH 78/94] Revert "changed mongoose tests for schema set method" This reverts commit ecc4b01429190fcf8dcff200b5b695349b8fe8ad. --- types/mongoose/index.d.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/types/mongoose/index.d.ts b/types/mongoose/index.d.ts index 90bb04747f..c24427498f 100644 --- a/types/mongoose/index.d.ts +++ b/types/mongoose/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Mongoose 5.2.2 +// Type definitions for Mongoose 5.2.1 // Project: http://mongoosejs.com/ // Definitions by: horiuchi // sindrenm @@ -10,7 +10,6 @@ // jussikinnula // ondratra // alfirin -// Idan Dardikman // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 From fb2be72adecc7dcc74df962c456edfa2e8acea05 Mon Sep 17 00:00:00 2001 From: "idan.d" Date: Fri, 17 Aug 2018 01:43:48 +0300 Subject: [PATCH 79/94] changed mongoose tests for schema set method --- types/mongoose/mongoose-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/mongoose/mongoose-tests.ts b/types/mongoose/mongoose-tests.ts index 2fe1e1b12e..02227c681d 100644 --- a/types/mongoose/mongoose-tests.ts +++ b/types/mongoose/mongoose-tests.ts @@ -429,7 +429,7 @@ schema.queue('m1', [1, 2, 3]).queue('m2', [[]]); schema.remove('path'); schema.remove(['path1', 'path2', 'path3']); schema.requiredPaths(true)[0].toLowerCase(); -schema.set('key', 999).set('key'); +schema.set('id', true).set('id'); schema.static('static', cb).static({ s1: cb, s2: cb From fd13f0321ae8150c9c9e4e86c8abdf58de0a5347 Mon Sep 17 00:00:00 2001 From: "idan.d" Date: Fri, 17 Aug 2018 01:44:35 +0300 Subject: [PATCH 80/94] updated mongoose minor version number --- types/mongoose/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/mongoose/index.d.ts b/types/mongoose/index.d.ts index c24427498f..90bb04747f 100644 --- a/types/mongoose/index.d.ts +++ b/types/mongoose/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Mongoose 5.2.1 +// Type definitions for Mongoose 5.2.2 // Project: http://mongoosejs.com/ // Definitions by: horiuchi // sindrenm @@ -10,6 +10,7 @@ // jussikinnula // ondratra // alfirin +// Idan Dardikman // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 From 2132a14ea96e61a3ef951d3dce3dad43e07d339c Mon Sep 17 00:00:00 2001 From: Tyrone Dougherty Date: Fri, 17 Aug 2018 11:11:59 +1000 Subject: [PATCH 81/94] @types/highcharts - add AnimationOptions type to ChartObject#update method signature and update tests accordingly --- types/highcharts/index.d.ts | 4 ++-- types/highcharts/test/index.ts | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/types/highcharts/index.d.ts b/types/highcharts/index.d.ts index afe1e51a98..2ec1d268d6 100644 --- a/types/highcharts/index.d.ts +++ b/types/highcharts/index.d.ts @@ -6487,10 +6487,10 @@ declare namespace Highcharts { * @param [boolean] redraw Whether to redraw the chart. Defaults to true. * @param [boolean] oneToOne When true, the series, xAxis and yAxis collections will be updated one to one, and * items will be either added or removed to match the new updated options. Defaults to false. - * @param [boolean] animation Whether to apply animation, and optionally animation configuration. + * @param [(boolean | AnimationOptions)] animation Whether to apply animation, and optionally animation configuration. * @since 5.0.0 */ - update(options: Options, redraw?: boolean, oneToOne?: boolean, animation?: boolean): void; + update(options: Options, redraw?: boolean, oneToOne?: boolean, animation?: boolean | AnimationOptions): void; /** * This method is deprecated as of 2.0.1. Updating the chart position after a move operation is no longer necessary. * @since 1.2.5 diff --git a/types/highcharts/test/index.ts b/types/highcharts/test/index.ts index 1d6e921461..963a53d9bb 100644 --- a/types/highcharts/test/index.ts +++ b/types/highcharts/test/index.ts @@ -2457,6 +2457,11 @@ function test_ChartObject() { chart.update( {}); chart.update( {}, true); chart.update( {}, true, true); + chart.update( {}, true, true, true); + chart.update( {}, true, true, { + delay: 500, + duration: 3000 + }); } function test_ElementObject() { From 628934f8e6f2f392726871e59550b3d25bfed667 Mon Sep 17 00:00:00 2001 From: Tyrone Dougherty Date: Fri, 17 Aug 2018 11:52:22 +1000 Subject: [PATCH 82/94] @types/highcharts - Define the AnimationOptions interface and update tests accordingly --- types/highcharts/index.d.ts | 20 ++++++++++++++++++++ types/highcharts/test/index.ts | 5 ++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/types/highcharts/index.d.ts b/types/highcharts/index.d.ts index 2ec1d268d6..fea56746da 100644 --- a/types/highcharts/index.d.ts +++ b/types/highcharts/index.d.ts @@ -474,6 +474,26 @@ declare namespace Highcharts { skipNullPoints?: boolean; } + interface AnimationOptions { + /** + * The animation duration in milliseconds. + */ + duration: number; + /** + * The name of an easing function as defined on the Math object. + */ + easing?: string; + /** + * A callback function to exectute when the animation finishes. + */ + complete?: () => void; + /** + * A callback function to execute on each step of each attribute or CSS property that's being animated. + * The first argument contains information about the animation and progress. + */ + step?: () => void; + } + interface AxisTitle { /** * Alignment of the title relative to the axis values. Possible values are 'low', 'middle' or 'high'. diff --git a/types/highcharts/test/index.ts b/types/highcharts/test/index.ts index 963a53d9bb..bafb4a7516 100644 --- a/types/highcharts/test/index.ts +++ b/types/highcharts/test/index.ts @@ -2458,9 +2458,8 @@ function test_ChartObject() { chart.update( {}, true); chart.update( {}, true, true); chart.update( {}, true, true, true); - chart.update( {}, true, true, { - delay: 500, - duration: 3000 + chart.update( {}, true, true, { + duration: 3000, }); } From 3e8de0faacdf61f0dccdc7b83edee2c51d83e79e Mon Sep 17 00:00:00 2001 From: Tyrone Dougherty Date: Fri, 17 Aug 2018 11:58:07 +1000 Subject: [PATCH 83/94] @types/highcharts - add missing time parameter (and its associated TimeOptions interface type) to the Options interface --- types/highcharts/index.d.ts | 44 +++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/types/highcharts/index.d.ts b/types/highcharts/index.d.ts index fea56746da..3d17b3b281 100644 --- a/types/highcharts/index.d.ts +++ b/types/highcharts/index.d.ts @@ -5712,6 +5712,46 @@ declare namespace Highcharts { y?: number | null; } + interface TimeOptions { + /** + * A custom Date class for advanced date handling. For example, JDate can be hooked in to handle Jalali dates. + * @default undefined + * @since 4.0.4 + */ + Date?: Date; + /** + * A callback to return the time zone offset for a given datetime. It takes the timestamp in terms of milliseconds since + * January 1 1970, and returns the timezone offset in minutes. This provides a hook for drawing time based charts in + * specific time zones using their local DST crossover dates, with the help of external libraries. + * @default undefined + * @since 4.1.0 + */ + getTimezoneOffset?: (timestamp: Date) => number; + /** + * Requires moment.js. If the timezone option is specified, it creates a default getTimezoneOffset function that looks + * up the specified timezone in moment.js. If moment.js is not included, this throws a Highcharts error in the console, + * but does not crash the chart. + * @default undefined + * @since 5.0.7 + */ + timezone?: string; + /** + * The timezone offset in minutes. Positive values are west, negative values are east of UTC, as in the ECMAScript + * getTimezoneOffset method. Use this to display UTC based data in a predefined time zone. + * @default 0 + * @since 3.0.8 + */ + timezoneOffset?: number; + /** + * Whether to use UTC time for axis scaling, tickmark placement and time display in Highcharts.dateFormat. + * Advantages of using UTC is that the time displays equally regardless of the user agent's time zone settings. + * Local time can be used when the data is loaded in real time or when correct Daylight Saving Time transitions are required. + * @default undefined + * @since 6.0.5 + */ + useUTC?: boolean; + } + interface TitleOptions { /** * The horizontal alignment of the title. Can be one of 'left', 'center' and 'right'. @@ -6138,6 +6178,10 @@ declare namespace Highcharts { * The chart's subtitle */ subtitle?: SubtitleOptions; + /** + * The chart's time options + */ + time?: TimeOptions; /** * The chart's main title. */ From e4d1d1b9a4a124e8cdfb0998e4710f34a8943512 Mon Sep 17 00:00:00 2001 From: Anuraag Agrawal Date: Fri, 17 Aug 2018 11:57:59 +0900 Subject: [PATCH 84/94] [@types/jws] Allow headers to have extra values. --- types/jws/index.d.ts | 1 + types/jws/jws-tests.ts | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/types/jws/index.d.ts b/types/jws/index.d.ts index f384fadefc..030d670f4a 100644 --- a/types/jws/index.d.ts +++ b/types/jws/index.d.ts @@ -149,4 +149,5 @@ export type Algorithm = 'HS256' | 'HS384' | 'HS512' | 'RS256' | export interface Header { alg: Algorithm; + [key: string]: string; } diff --git a/types/jws/jws-tests.ts b/types/jws/jws-tests.ts index d5271b24ca..c6e62378f8 100644 --- a/types/jws/jws-tests.ts +++ b/types/jws/jws-tests.ts @@ -20,6 +20,13 @@ const signature = jws.sign({ secret: 'has a van', }); +// jws.sign with extra header values +const signatureWithHeaderParams = jws.sign({ + header: { alg: 'HS256', foo: 'bar' }, + payload: 'h. jon benjamin', + secret: 'has a van', +}); + // jws.decode const message = jws.decode('djfakdid'); From c95ca69eacb01f86ff06ecd9c1999607cec44560 Mon Sep 17 00:00:00 2001 From: Tyrone Dougherty Date: Fri, 17 Aug 2018 13:40:07 +1000 Subject: [PATCH 85/94] Remove unnecessary whitespace --- types/highcharts/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/highcharts/index.d.ts b/types/highcharts/index.d.ts index 3d17b3b281..a71e07c925 100644 --- a/types/highcharts/index.d.ts +++ b/types/highcharts/index.d.ts @@ -5720,7 +5720,7 @@ declare namespace Highcharts { */ Date?: Date; /** - * A callback to return the time zone offset for a given datetime. It takes the timestamp in terms of milliseconds since + * A callback to return the time zone offset for a given datetime. It takes the timestamp in terms of milliseconds since * January 1 1970, and returns the timezone offset in minutes. This provides a hook for drawing time based charts in * specific time zones using their local DST crossover dates, with the help of external libraries. * @default undefined From f62ee2bc692958546a300ce540eee64d2d481941 Mon Sep 17 00:00:00 2001 From: Anuraag Agrawal Date: Fri, 17 Aug 2018 12:47:02 +0900 Subject: [PATCH 86/94] Use name instead since in this code we use key often for a different meaning. --- types/jws/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/jws/index.d.ts b/types/jws/index.d.ts index 030d670f4a..fdbf1851c4 100644 --- a/types/jws/index.d.ts +++ b/types/jws/index.d.ts @@ -149,5 +149,5 @@ export type Algorithm = 'HS256' | 'HS384' | 'HS512' | 'RS256' | export interface Header { alg: Algorithm; - [key: string]: string; + [name: string]: string; } From 3b1261a247a8f9568b01b3a9bb996095054c5d34 Mon Sep 17 00:00:00 2001 From: yasupeke Date: Fri, 17 Aug 2018 16:24:00 +0900 Subject: [PATCH 87/94] fix comment --- types/react-paginate/index.d.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/types/react-paginate/index.d.ts b/types/react-paginate/index.d.ts index 0e0daa376a..83a03ac838 100644 --- a/types/react-paginate/index.d.ts +++ b/types/react-paginate/index.d.ts @@ -1,8 +1,12 @@ // Type definitions for react-paginate 5.2 // Project: https://github.com/AdeleD/react-paginate -// Definitions by: Yasunori Ohoka +// Definitions by: Simon Hartcher +// Wouter Hardeman +// pegel03 +// Simon Archer +// Yasunori Ohoka // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.9 +// TypeScript Version: 2.8 import * as React from 'react'; From 9555e31a1ca6a697f3e03aa223b85c12da0be7e7 Mon Sep 17 00:00:00 2001 From: Sascha Englert Date: Fri, 17 Aug 2018 12:34:20 +0200 Subject: [PATCH 88/94] Added interfaces for Room and Rooms dictonaries --- types/socket.io/index.d.ts | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/types/socket.io/index.d.ts b/types/socket.io/index.d.ts index 2b5100abb2..4396299a32 100644 --- a/types/socket.io/index.d.ts +++ b/types/socket.io/index.d.ts @@ -696,6 +696,22 @@ declare namespace SocketIO { query: any; } + /** + * The interface describing a room + */ + interface Room { + sockets: {[id: string]: boolean } + } + + /** + * The interface describing a dictionary of rooms + * Where room is the name of the room + */ + + interface Rooms { + [room: string]: Room + } + /** * The interface used when dealing with rooms etc */ @@ -708,9 +724,8 @@ declare namespace SocketIO { /** * A dictionary of all the rooms that we have in this namespace - * The rooms are made of a `sockets` key which is the dictionary of sockets per ID */ - rooms: {[room: string]: {sockets: {[id: string]: boolean }, length: number }}; + rooms: Rooms; /** * A dictionary of all the socket ids that we're dealing with, and all From 794a2adf7dc0afd46267afcb99b1fa6039ae73d0 Mon Sep 17 00:00:00 2001 From: Sascha Englert Date: Fri, 17 Aug 2018 12:49:21 +0200 Subject: [PATCH 89/94] Added missing length field --- types/socket.io/index.d.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/types/socket.io/index.d.ts b/types/socket.io/index.d.ts index 4396299a32..6c12e444b0 100644 --- a/types/socket.io/index.d.ts +++ b/types/socket.io/index.d.ts @@ -700,7 +700,8 @@ declare namespace SocketIO { * The interface describing a room */ interface Room { - sockets: {[id: string]: boolean } + sockets: {[id: string]: boolean }; + length: number; } /** @@ -709,7 +710,7 @@ declare namespace SocketIO { */ interface Rooms { - [room: string]: Room + [room: string]: Room; } /** From bac1c2efce28bc074ba496671e1a65b4a1a5d029 Mon Sep 17 00:00:00 2001 From: Daniel Dyla Date: Fri, 17 Aug 2018 08:28:17 -0400 Subject: [PATCH 90/94] Remove optional ? from callback params http://www.typescriptlang.org/docs/handbook/declaration-files/do-s-and-don-ts.html#optional-parameters-in-callbacks --- types/dialogflow/index.d.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/types/dialogflow/index.d.ts b/types/dialogflow/index.d.ts index 96c4b11016..c847b662c2 100644 --- a/types/dialogflow/index.d.ts +++ b/types/dialogflow/index.d.ts @@ -18,16 +18,16 @@ export namespace v2 { getAgent( request: GetAgentRequest, options?: gax.CallOptions, - cb?: (err?: Error, agent?: Agent) => void + cb?: (err: Error, agent: Agent) => void ): Promise<[Agent]>; searchAgents( request: SearchAgentRequest, options?: gax.CallOptions, cb?: ( - err?: Error, - agents?: Agent[], - arg3?: any, - response?: any + err: Error, + agents: Agent[], + arg3: any, + response: any ) => void ): Promise; searchAgentsStream( @@ -37,22 +37,22 @@ export namespace v2 { trainAgent( request: TrainAgentRequest, options?: gax.CallOptions, - cb?: (err?: Error, operation?: gax.Operation) => void + cb?: (err: Error, operation: gax.Operation) => void ): Promise<[gax.Operation]>; exportAgent( request: ExportAgentRequest, options?: gax.CallOptions, - cb?: (err?: Error, operation?: gax.Operation) => void + cb?: (err: Error, operation: gax.Operation) => void ): Promise<[gax.Operation]>; importAgent( request: ImportAgentRequest, options?: gax.CallOptions, - cb?: (err?: Error, operation?: gax.Operation) => void + cb?: (err: Error, operation: gax.Operation) => void ): Promise<[gax.Operation]>; restoreAgent( request: RestoreAgentRequest, options?: gax.CallOptions, - cb?: (err?: Error, operation?: gax.Operation) => void + cb?: (err: Error, operation: gax.Operation) => void ): Promise<[gax.Operation]>; } From 9ce09927776770b74d4dbb2e3eaa55693bc9121e Mon Sep 17 00:00:00 2001 From: Francis Gulotta Date: Fri, 17 Aug 2018 06:17:42 -0700 Subject: [PATCH 91/94] iltorb: Add promised based api --- types/iltorb/iltorb-tests.ts | 8 ++++++++ types/iltorb/index.d.ts | 5 ++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/types/iltorb/iltorb-tests.ts b/types/iltorb/iltorb-tests.ts index 66bda251d4..202b9ebbd0 100644 --- a/types/iltorb/iltorb-tests.ts +++ b/types/iltorb/iltorb-tests.ts @@ -20,6 +20,14 @@ br.compress(Buffer.from('foo', 'utf8'), onCompress); br.compress(Buffer.from('foo', 'utf8'), opts, onCompress); +br + .compress(Buffer.from('foobar')) + .then(compressedData => { + br.decompress(compressedData).then(data => { + console.log(data.equals(Buffer.from('foobar'))); + }); + }); + const stream = br.compressStream(); stream.flush(); diff --git a/types/iltorb/index.d.ts b/types/iltorb/index.d.ts index 5ac707a51b..a1cf04844c 100644 --- a/types/iltorb/index.d.ts +++ b/types/iltorb/index.d.ts @@ -1,6 +1,7 @@ -// Type definitions for iltorb 2.0 +// Type definitions for iltorb 2.3 // Project: https://github.com/MayhemYDG/iltorb // Definitions by: Arturas Molcanovas +// Francis Gulotta // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -25,8 +26,10 @@ export type IltorbCallback = (err: Error | null | undefined, output: Buffer) => export function compress(buffer: Buffer, options: BrotliEncodeParams, callback: IltorbCallback): void; export function compress(buffer: Buffer, callback: IltorbCallback): void; +export function compress(buffer: Buffer, options?: BrotliEncodeParams): Promise; export function decompress(buffer: Buffer, callback: IltorbCallback): void; +export function decompress(buffer: Buffer): Promise; export function compressSync(buffer: Buffer, options?: BrotliEncodeParams): Buffer; export function decompressSync(buffer: Buffer): Buffer; From e6e7ed3a9e6d74d7cca78c0ff69908e4fd659d9d Mon Sep 17 00:00:00 2001 From: Romain Faust Date: Fri, 17 Aug 2018 15:36:49 +0200 Subject: [PATCH 92/94] [@types/gulp-jsonmin] Add type definitions --- types/gulp-jsonmin/gulp-jsonmin-tests.ts | 5 +++++ types/gulp-jsonmin/index.d.ts | 18 ++++++++++++++++++ types/gulp-jsonmin/tsconfig.json | 23 +++++++++++++++++++++++ types/gulp-jsonmin/tslint.json | 1 + 4 files changed, 47 insertions(+) create mode 100644 types/gulp-jsonmin/gulp-jsonmin-tests.ts create mode 100644 types/gulp-jsonmin/index.d.ts create mode 100644 types/gulp-jsonmin/tsconfig.json create mode 100644 types/gulp-jsonmin/tslint.json diff --git a/types/gulp-jsonmin/gulp-jsonmin-tests.ts b/types/gulp-jsonmin/gulp-jsonmin-tests.ts new file mode 100644 index 0000000000..5c0cf66cc3 --- /dev/null +++ b/types/gulp-jsonmin/gulp-jsonmin-tests.ts @@ -0,0 +1,5 @@ +import * as GulpJsonmin from 'gulp-jsonmin'; + +GulpJsonmin(); +GulpJsonmin({}); +GulpJsonmin({ verbose: true }); diff --git a/types/gulp-jsonmin/index.d.ts b/types/gulp-jsonmin/index.d.ts new file mode 100644 index 0000000000..16a4347dd2 --- /dev/null +++ b/types/gulp-jsonmin/index.d.ts @@ -0,0 +1,18 @@ +// Type definitions for gulp-jsonmin 1.1 +// Project: https://github.com/englercj/gulp-jsonmin +// Definitions by: Romain Faust +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +import { Transform } from 'stream'; + +declare function jsonmin(options?: jsonmin.Options): Transform; + +declare namespace jsonmin { + interface Options { + verbose?: boolean; + } +} + +export = jsonmin; diff --git a/types/gulp-jsonmin/tsconfig.json b/types/gulp-jsonmin/tsconfig.json new file mode 100644 index 0000000000..7f1244285f --- /dev/null +++ b/types/gulp-jsonmin/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", + "gulp-jsonmin-tests.ts" + ] +} diff --git a/types/gulp-jsonmin/tslint.json b/types/gulp-jsonmin/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/gulp-jsonmin/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 22b493043c6fb617245aff813a91271123e516be Mon Sep 17 00:00:00 2001 From: michahell Date: Fri, 17 Aug 2018 17:04:08 +0200 Subject: [PATCH 93/94] changes isRest parameter to union type `&` and optional `isRest?: boolean` argument --- types/office-js/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/office-js/index.d.ts b/types/office-js/index.d.ts index 10e8412382..b99714b1fd 100644 --- a/types/office-js/index.d.ts +++ b/types/office-js/index.d.ts @@ -13586,7 +13586,7 @@ declare namespace Office { * asyncContext: Any state data that is passed to the asynchronous method. * @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult. The token is provided as a string in the asyncResult.value property. */ - getCallbackTokenAsync(options: Office.AsyncContextOptions | { isRest: boolean }, callback: (result: AsyncResult) => void): void; + getCallbackTokenAsync(options: Office.AsyncContextOptions & { isRest?: boolean }, callback: (result: AsyncResult) => void): void; /** * Gets a string that contains a token used to get an attachment or item from an Exchange Server. * From 0834314448067ae57526f9a4cb8b5e27c5369e25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerhard=20St=C3=B6bich?= Date: Fri, 17 Aug 2018 17:28:18 +0200 Subject: [PATCH 94/94] [puppeteer/v0] Fix tests (#28199) --- types/puppeteer/v0/puppeteer-tests.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/puppeteer/v0/puppeteer-tests.ts b/types/puppeteer/v0/puppeteer-tests.ts index 913d46a789..963fb1c8c1 100644 --- a/types/puppeteer/v0/puppeteer-tests.ts +++ b/types/puppeteer/v0/puppeteer-tests.ts @@ -27,8 +27,8 @@ import * as puppeteer from "puppeteer"; // Get the "viewport" of the page, as reported by the page. const dimensions = await page.evaluate(() => { return { - width: document.documentElement.clientWidth, - height: document.documentElement.clientHeight, + width: document.documentElement!.clientWidth, + height: document.documentElement!.clientHeight, deviceScaleFactor: window.devicePixelRatio }; });