diff --git a/notNeededPackages.json b/notNeededPackages.json index 62f6bbb802..edcc79ebd7 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -834,6 +834,12 @@ "sourceRepoURL": "https://github.com/blakeembrey/is-lower-case", "asOfVersion": "1.1.2" }, + { + "libraryName": "is-online", + "typingsPackageName": "is-online", + "sourceRepoURL": "https://github.com/sindresorhus/is-online", + "asOfVersion": "8.1.0" + }, { "libraryName": "is-plain-object", "typingsPackageName": "is-plain-object", @@ -1152,6 +1158,13 @@ "sourceRepoURL": "https://github.com/sindresorhus/p-event", "asOfVersion": "3.0.0" }, + { + "libraryName": "p-limit", + "typingsPackageName": "p-limit", + "sourceRepoURL": "https://github.com/sindresorhus/p-limit", + "asOfVersion": "2.2.0" + + }, { "libraryName": "p-map", "typingsPackageName": "p-map", @@ -1164,6 +1177,12 @@ "sourceRepoURL": "https://github.com/sindresorhus/p-pipe", "asOfVersion": "2.0.1" }, + { + "libraryName": "p-queue", + "typingsPackageName": "p-queue", + "sourceRepoURL": "https://github.com/sindresorhus/p-queue", + "asOfVersion": "3.2.1" + }, { "libraryName": "p-throttle", "typingsPackageName": "p-throttle", diff --git a/types/cypress-axe/index.d.ts b/types/cypress-axe/index.d.ts index 507a5f773d..3ba776e14f 100644 --- a/types/cypress-axe/index.d.ts +++ b/types/cypress-axe/index.d.ts @@ -1,12 +1,21 @@ -// Type definitions for cypress-axe 0.3 +// Type definitions for cypress-axe 0.4 // Project: https://github.com/avanslaars/cypress-axe#readme // Definitions by: Justin Hall // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 -declare namespace Cypress { - interface Chainable { - injectAxe(): void; - checkA11y(): void; +import { ElementContext, RunOptions } from 'axe-core'; + +declare module 'axe-core' { + interface Node {} +} + +declare global { + namespace Cypress { + interface Chainable { + injectAxe(): void; + checkA11y(context?: ElementContext, options?: RunOptions): void; + configureAxe(options?: RunOptions): void; + } } } diff --git a/types/cypress-axe/package.json b/types/cypress-axe/package.json new file mode 100644 index 0000000000..71df6dd355 --- /dev/null +++ b/types/cypress-axe/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "axe-core": "^3.1.2" + } +} diff --git a/types/cypress-axe/tslint.json b/types/cypress-axe/tslint.json index 3db14f85ea..4f44991c3c 100644 --- a/types/cypress-axe/tslint.json +++ b/types/cypress-axe/tslint.json @@ -1 +1,6 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + "no-empty-interface": false + } +} diff --git a/types/electron-spellchecker/index.d.ts b/types/electron-spellchecker/index.d.ts index fc10d13f34..6db76278d2 100644 --- a/types/electron-spellchecker/index.d.ts +++ b/types/electron-spellchecker/index.d.ts @@ -1,5 +1,5 @@ // Type definitions for electron-spellchecker 1.1 -// Project: https://github.com/paulcbetts/electron-spellchecker +// Project: https://github.com/electron-userland/electron-spellchecker // Definitions by: Daniel Perez Alvarez // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 diff --git a/types/flexmonster/index.d.ts b/types/flexmonster/index.d.ts index 2c5ea0b0ec..fad76ca64d 100644 --- a/types/flexmonster/index.d.ts +++ b/types/flexmonster/index.d.ts @@ -1,5 +1,5 @@ // Type definitions for flexmonster 2.6 -// Project: https://flexmonster.com +// Project: https://flexmonster.com/ // Definitions by: Flexmonster // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -135,6 +135,7 @@ declare namespace Flexmonster { showGridAndCharts(type?: string, position?: string, multiple?: boolean): void; sortingMethod(hierarchyName: string, compareFunction: (a: string, b: string) => boolean): void; sortValues(axisName: string, type: string, tuple: number[], measure: MeasureObject): void; + toolbar: Toolbar; updateData(object: DataSource | object[]): void; version: string; fusioncharts?: { @@ -179,6 +180,7 @@ declare namespace Flexmonster { dataSourceInfo?: string; dataSourceType?: string; fieldSeparator?: string; + thousandSeparator?: string; filename?: string; ignoreQuotedLineBreaks?: boolean; proxyUrl?: string; @@ -191,6 +193,8 @@ declare namespace Flexmonster { hash?: string; username?: string; password?: string; + requestHeader?: object; + subquery?: string; } interface Slice { @@ -276,6 +280,7 @@ declare namespace Flexmonster { saveAllFormats?: boolean; showDrillThroughConfigurator?: boolean; grouping?: boolean; + showAllFieldsDrillThrough?: boolean; } interface PrintOptions { @@ -343,6 +348,7 @@ declare namespace Flexmonster { useOlapFormattingInExcel?: boolean; useCustomizeCellForData?: boolean; excelExportAll?: boolean; + requestHeader?: object; } interface Hierarchy { @@ -463,6 +469,34 @@ declare namespace Flexmonster { interface Toolbar { getTabs: () => ToolbarTab[]; + // Connect tab + connectLocalCSVHandler: () => void; + connectLocalJSONHandler: () => void; + connectRemoteCSV: () => void; + connectRemoteJSON: () => void; + connectOLAP: () => void; + // Open tab + openLocalReport: () => void; + openRemoteReport: () => void; + // Save tab + saveHandler: () => void; + // Export tab + printHandler: () => void; + exportHandler: (type: string) => void; + // Grid tab + gridHandler: () => void; + // Charts tab + chartsHandler: (type: string) => void; + chartsMultipleHandler: () => void; + // Format tab + formatCellsHandler: () => void; + conditionalFormattingHandler: () => void; + // Options tab + optionsHandler: () => void; + // Fields tab + fieldsHandler: () => void; + // Fullscreen tab + fullscreenHandler: () => void; } interface ToolbarTab { diff --git a/types/google.script.client-side/google.script.client-side-tests.ts b/types/google.script.client-side/google.script.client-side-tests.ts index 5e3c059c01..57867f8456 100644 --- a/types/google.script.client-side/google.script.client-side-tests.ts +++ b/types/google.script.client-side/google.script.client-side-tests.ts @@ -1,7 +1,7 @@ google.script.url.getLocation(location => { - location.hash; // $ExpectedType string - location.parameter; // $ExpectedType { [key: string]: string } - location.parameters; // $ExpectedType { [key: string]: ReadonlyArray } + location.hash; // $ExpectType string + location.parameter; // $ExpectType { [key: string]: string; } + location.parameters; // $ExpectType { [key: string]: ReadonlyArray; } }); google.script.history.push(null); @@ -13,10 +13,10 @@ google.script.history.replace({ timestamp: Date.now() }, { foo: 'bar', fiz: 'baz google.script.history.replace({ timestamp: Date.now() }, { foo: ['bar', 'cat'], fiz: 'baz' }, 'anchor1'); google.script.history.setChangeHandler(e => { - e.state; // $ExpectedType google.script.history.State - e.location.hash; // $ExpectedType string - e.location.parameter; // $ExpectedType { [key: string]: string } - e.location.parameters; // $ExpectedType { [key: string]: ReadonlyArray } + e.state; // $ExpectType State + e.location.hash; // $ExpectType string + e.location.parameter; // $ExpectType { [key: string]: string; } + e.location.parameters; // $ExpectType { [key: string]: ReadonlyArray; } }); google.script.host.origin; // $ExpectType string @@ -25,15 +25,79 @@ google.script.host.editor.focus(); google.script.host.setHeight(450); google.script.host.setWidth(300); -google.script.run.withSuccessHandler(() => {}).executeScript({ message: 'test for google.script.run' }); +google.script.run.withSuccessHandler(() => {}); // $ExpectType Runner +google.script.run.withFailureHandler(() => {}); // $ExpectType Runner +google.script.run.withUserObject({}); // $ExpectType Runner google.script.run .withSuccessHandler(value => {}) - .withFailureHandler(error => {}) - .getEmail(); + .withFailureHandler(error => { + error; // $ExpectType Error + }); google.script.run .withSuccessHandler((value, userObject) => {}) - .withFailureHandler((error, userObject) => {}) - .withUserObject({}) - .getSomeData(Date.now(), { options: 'none' }, 'anchor1', true, null); + .withFailureHandler((error, userObject) => { + error; // $ExpectType Error + }) + .withUserObject({}); + +google.script.run.testFunctionWithoutParameter(); +google.script.run.testFunctionWithNumber(0); +google.script.run.testFunctionWithBoolean(true); +google.script.run.testFunctionWithString(""); +google.script.run.testFunctionWithNull(null); +google.script.run.testFunctionWithArray([ + 0, + true, + "", + null, + undefined, + [], + { + number: 0, + boolean: true, + string: "", + nullValue: null, + undef: undefined, + array: [0, true, "", null, undefined, [], {}], + object: {} + } +]); +google.script.run.testFunctionWithObject({ + number: 0, + boolean: true, + string: "", + nullValue: null, + undef: undefined, + array: [0, true, "", null, undefined, [], {}], + object: {} +}); +google.script.run.testFunctionWithMultipleParameters( + 0, + true, + "", + null, + undefined, + [ + 0, + true, + "", + null, + undefined, + [], + {} + ], + { + number: 0, + boolean: true, + string: "", + nullValue: null, + undef: undefined, + array: [0, true, "", null, undefined, [], {}], + object: {} + } +); +google.script.run.testFunctionWithForm(new HTMLFormElement()); +google.script.run.testFunctionWithDateError(new Date()); // $ExpectError +google.script.run.testFunctionWithFunctionError(() => {}); // $ExpectError diff --git a/types/google.script.client-side/index.d.ts b/types/google.script.client-side/index.d.ts index 7d497fd6c2..23e92255a7 100644 --- a/types/google.script.client-side/index.d.ts +++ b/types/google.script.client-side/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for non-npm package Google Apps Script Client-side API 0.0 +// Type definitions for non-npm package Google Apps Script Client-side API 0.1 // Project: https://developers.google.com/apps-script/guides/html/reference/host // Definitions by: clomie // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -118,12 +118,14 @@ declare namespace google.script { const run: Runner; - interface Runner { + type Parameter = number | boolean | string | { [index: number]: Parameter } | { [key: string]: Parameter } | null | undefined; + + type Runner = { /** * Executes the server-side Apps Script function with the corresponding name. */ - [functionName: string]: (...args: any[]) => void; - + [functionName: string]: (first?: Parameter | HTMLFormElement, ...rest: Parameter[]) => void; + } & { /** * Sets a callback function to run if the server-side function throws an exception. * Without a failure handler, failures are logged to the JavaScript console. @@ -147,5 +149,5 @@ declare namespace google.script { * User objects cannot, however, be objects constructed with the new operator */ withUserObject(object: any): Runner; - } + }; } diff --git a/types/google.script.client-side/tsconfig.json b/types/google.script.client-side/tsconfig.json index 83c99e2f06..e573df04f9 100644 --- a/types/google.script.client-side/tsconfig.json +++ b/types/google.script.client-side/tsconfig.json @@ -2,7 +2,8 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6" + "es6", + "dom" ], "noImplicitAny": true, "noImplicitThis": true, diff --git a/types/is-online/index.d.ts b/types/is-online/index.d.ts deleted file mode 100644 index 04fa123c44..0000000000 --- a/types/is-online/index.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -// Type definitions for is-online 8.0 -// Project: https://github.com/sindresorhus/is-online#readme -// Definitions by: BendingBender -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -export = isOnline; - -/** - * Check if the internet connection is up. - * - * The following checks are run in parallel: - * - Retrieve [icanhazip.com](https://github.com/major/icanhaz) via HTTPS - * - Query `myip.opendns.com` on OpenDNS (Node.js only) - * - Retrieve Apple's Captive Portal test page (Node.js only) - * - * When the first check succeeds, the returned Promise is resolved to `true`. - */ -declare function isOnline(options?: isOnline.Options): Promise; - -declare namespace isOnline { - interface Options { - /** - * Milliseconds to wait for a server to respond. - * @default 5000 - */ - timeout?: number; - /** - * Internet Protocol version to use. This is an advanced option that is usually not necessary to be set, - * but it can prove useful to specifically assert IPv6 connectivity. - * @default 'v4' - */ - version?: 'v4' | 'v6'; - } -} diff --git a/types/is-online/is-online-tests.ts b/types/is-online/is-online-tests.ts deleted file mode 100644 index 74dbda5efa..0000000000 --- a/types/is-online/is-online-tests.ts +++ /dev/null @@ -1,6 +0,0 @@ -import isOnline = require('is-online'); - -isOnline(); // $ExpectType Promise -isOnline({ timeout: 10 }); // $ExpectType Promise -isOnline({ version: 'v4' }); // $ExpectType Promise -isOnline({ version: 'v6' }); // $ExpectType Promise diff --git a/types/is-online/tsconfig.json b/types/is-online/tsconfig.json deleted file mode 100644 index 7009c26024..0000000000 --- a/types/is-online/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "is-online-tests.ts" - ] -} diff --git a/types/is-online/tslint.json b/types/is-online/tslint.json deleted file mode 100644 index 3db14f85ea..0000000000 --- a/types/is-online/tslint.json +++ /dev/null @@ -1 +0,0 @@ -{ "extends": "dtslint/dt.json" } diff --git a/types/mathjs/index.d.ts b/types/mathjs/index.d.ts index 20fb7154cb..285aed9e56 100644 --- a/types/mathjs/index.d.ts +++ b/types/mathjs/index.d.ts @@ -1,5 +1,5 @@ // Type definitions for mathjs 5.0 -// Project: http://mathjs.org/ +// Project: https://mathjs.org/ // Definitions by: Ilya Shestakov , // Andy Patterson , // Brad Besserman diff --git a/types/office-js-preview/index.d.ts b/types/office-js-preview/index.d.ts index b55d2cbb42..3a0f28b574 100644 --- a/types/office-js-preview/index.d.ts +++ b/types/office-js-preview/index.d.ts @@ -962,11 +962,11 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * - * - * - * + * + * + * + * + * *
Office for Windows desktop Office Online (in browser) Office for iPad
Excel Y Y Y
Outlook Y (Mailbox 1.3)
PowerPoint Y Y Y
Word Y Y Y
Office for Windows desktop Office Online (in browser) Office for iPad
Excel Y Y Y
Outlook Y (Mailbox 1.3: without options
Mailbox Preview: with options)
PowerPoint Y Y Y
Word Y Y Y
* * @param options Optional. An object literal that contains one or more of the following properties. @@ -974,7 +974,7 @@ declare namespace Office { * this value indicates of the handled event should continue execution or be canceled. * For example, an add-in that handles the ItemSend event can set allowEvent = false to cancel sending of the message. */ - completed(options?: any): void; + completed(options?: { allowEvent: boolean }): void; } /** diff --git a/types/office-js/index.d.ts b/types/office-js/index.d.ts index f976e947ec..21017ce4be 100644 --- a/types/office-js/index.d.ts +++ b/types/office-js/index.d.ts @@ -962,11 +962,11 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * - * - * - * + * + * + * + * + * *
Office for Windows desktop Office Online (in browser) Office for iPad
Excel Y Y Y
Outlook Y (Mailbox 1.3)
PowerPoint Y Y Y
Word Y Y Y
Office for Windows desktop Office Online (in browser) Office for iPad
Excel Y Y Y
Outlook Y (Mailbox 1.3: without options
Mailbox Preview: with options)
PowerPoint Y Y Y
Word Y Y Y
* * @param options Optional. An object literal that contains one or more of the following properties. @@ -974,7 +974,7 @@ declare namespace Office { * this value indicates of the handled event should continue execution or be canceled. * For example, an add-in that handles the ItemSend event can set allowEvent = false to cancel sending of the message. */ - completed(options?: any): void; + completed(options?: { allowEvent: boolean }): void; } /** diff --git a/types/p-limit/index.d.ts b/types/p-limit/index.d.ts deleted file mode 100644 index de7b0a07d9..0000000000 --- a/types/p-limit/index.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -// Type definitions for p-limit 2.1 -// Project: https://github.com/sindresorhus/p-limit#readme -// Definitions by: BendingBender -// Linus Unnebäck -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 3.0 - -export = pLimit; - -/** - * Run multiple promise-returning & async functions with limited concurrency. - * @param concurrency Concurrency limit. Minimum: `1`. - * @returns A `limit` function. - */ -declare function pLimit(concurrency: number): pLimit.Limit; - -declare namespace pLimit { - interface Limit { - /** - * Returns the promise returned by calling `fn(...args)`. - * - * @param fn Promise-returning/async function. - * @param args Any arguments to pass through to `fn`. - * Support for passing arguments on to the `fn` is provided in order to be able to avoid - * creating unnecessary closures. You probably don't need this optimization unless you're - * pushing a lot of functions. - */ - ( - fn: (...args: TArgs) => PromiseLike | R, - ...args: TArgs - ): Promise; - - /** - * The number of promises that are currently running. - */ - readonly activeCount: number; - - /** - * The number of promises that are waiting to run (i.e. their internal `fn` was not called yet). - */ - readonly pendingCount: number; - } -} diff --git a/types/p-limit/p-limit-tests.ts b/types/p-limit/p-limit-tests.ts deleted file mode 100644 index 3f9fb51083..0000000000 --- a/types/p-limit/p-limit-tests.ts +++ /dev/null @@ -1,23 +0,0 @@ -import pLimit = require('p-limit'); - -const limit = pLimit(1); - -const input = [ - limit(() => Promise.resolve('foo')), - limit(() => Promise.resolve('bar')), - limit(() => Promise.resolve(undefined)), -]; - -Promise.all(input); // $ExpectType Promise<(string | undefined)[]> - -limit((a: string) => '', 'test').then(v => { - v; // $ExpectType string -}); -limit((a: string, b: number) => Promise.resolve(''), 'test', 1).then(v => { - v; // $ExpectType string -}); - -limit.activeCount; // $ExpectType number -limit.activeCount = 1; // $ExpectError -limit.pendingCount; // $ExpectType number -limit.pendingCount = 1; // $ExpectError diff --git a/types/p-limit/tsconfig.json b/types/p-limit/tsconfig.json deleted file mode 100644 index 4634bf6300..0000000000 --- a/types/p-limit/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "p-limit-tests.ts" - ] -} \ No newline at end of file diff --git a/types/p-limit/tslint.json b/types/p-limit/tslint.json deleted file mode 100644 index 3db14f85ea..0000000000 --- a/types/p-limit/tslint.json +++ /dev/null @@ -1 +0,0 @@ -{ "extends": "dtslint/dt.json" } diff --git a/types/p-queue/index.d.ts b/types/p-queue/index.d.ts deleted file mode 100644 index 96fda8426a..0000000000 --- a/types/p-queue/index.d.ts +++ /dev/null @@ -1,160 +0,0 @@ -// Type definitions for p-queue 3.1 -// Project: https://github.com/sindresorhus/p-queue#readme -// Definitions by: BendingBender -// Evan Shortiss -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 - -/// - -import { EventEmitter } from 'events'; - -export = PQueue; - -/** - * Promise queue with concurrency control. - */ -declare class PQueue< - TEnqueueOptions extends PQueue.QueueAddOptions = PQueue.DefaultAddOptions -> extends EventEmitter { - /** - * Size of the queue. - */ - readonly size: number; - - /** - * Number of pending promises. - */ - readonly pending: number; - - /** - * Whether the queue is currently paused. - */ - readonly isPaused: boolean; - - constructor(opts?: PQueue.Options); - - /** - * Adds a sync or async task to the queue. Always returns a promise. - * @param fn Promise-returning/async function. - * @param opts - */ - add(fn: PQueue.Task, opts?: TEnqueueOptions): Promise; - - /** - * Same as `.add()`, but accepts an array of sync or async functions - * and returns a promise that resolves when all functions are resolved. - * @param fn Array of Promise-returning/async functions. - */ - addAll(fns: Array>, opts?: TEnqueueOptions): Promise; - - /** - * Returns a promise that settles when the queue becomes empty. - * - * Can be called multiple times. Useful if you for example add - * additional items at a later time. - */ - onEmpty(): Promise; - - /** - * Returns a promise that settles when the queue becomes empty, and all - * promises have completed; `queue.size === 0 && queue.pending === 0`. - * - * The difference with `.onEmpty` is that `.onIdle` guarantees that all work - * from the queue has finished. `.onEmpty` merely signals that the queue is - * empty, but it could mean that some promises haven't completed yet. - */ - onIdle(): Promise; - - /** - * Start (or resume) executing enqueued tasks within concurrency limit. - * No need to call this if queue is not paused - * (via `options.autoStart = false` or by `.pause()` method.) - */ - start(): void; - - /** - * Clear the queue. - */ - clear(): void; - - /** - * Put queue execution on hold. - */ - pause(): void; - - addListener(event: 'active', listener: () => void): this; - on(event: 'active', listener: () => void): this; - once(event: 'active', listener: () => void): this; - prependListener(event: 'active', listener: () => void): this; - prependOnceListener(event: 'active', listener: () => void): this; - removeListener(event: 'active', listener: () => void): this; - off(event: 'active', listener: () => void): this; - removeAllListeners(event?: 'active'): this; - listeners(event: 'active'): Array<() => void>; - rawListeners(event: 'active'): Array<() => void>; - emit(event: 'active'): boolean; - eventNames(): Array<'active'>; - listenerCount(type: 'active'): number; -} - -declare namespace PQueue { - interface QueueAddOptions { - [key: string]: any; - } - - interface QueueClassConstructor { - new (): QueueClass; - } - - interface QueueClass { - size: number; - - enqueue(run: () => void, options?: TEnqueueOptions): void; - - dequeue(): (() => void) | undefined; - } - - interface Options { - /** - * Concurrency limit. Minimum: `1`. - * @default Infinity - */ - concurrency?: number; - /** - * Whether queue tasks within concurrency limit, are auto-executed as soon as they're added. - * @default true - */ - autoStart?: boolean; - /** - * Class with a `enqueue` and `dequeue` method, and a `size` getter. See the - * [Custom QueueClass](https://github.com/sindresorhus/p-queue#custom-queueclass) section. - */ - queueClass?: QueueClassConstructor; - /** - * The max number of runs in the given interval of time. Minimum: `1`. - * @default Infinity - */ - intervalCap?: number; - /** - * The length of time in milliseconds before the interval count resets. Must be finite. Minimum: `0`. - * @default 0 - */ - interval?: number; - /** - * Whether the task must finish in the given interval or will be carried over into the next interval count. - * @default false - */ - carryoverConcurrencyCount?: boolean; - } - - interface DefaultAddOptions { - /** - * Priority of operation. Operations with greater priority will be scheduled first. - * @default 0 - */ - priority?: number; - } - - type Task = (() => PromiseLike) | (() => T); -} diff --git a/types/p-queue/p-queue-tests.ts b/types/p-queue/p-queue-tests.ts deleted file mode 100644 index 4ce6fbb13e..0000000000 --- a/types/p-queue/p-queue-tests.ts +++ /dev/null @@ -1,49 +0,0 @@ -import PQueue = require('p-queue'); - -const queue = new PQueue({ concurrency: 1 }); -new PQueue({ autoStart: false }); -new PQueue({ intervalCap: 1 }); -new PQueue({ interval: 0 }); -new PQueue({ carryoverConcurrencyCount: true }); - -queue.add(() => Promise.resolve('sindresorhus.com')); // $ExpectType Promise -queue.add(() => 'sindresorhus.com'); // $ExpectType Promise -queue.add(() => 'sindresorhus.com', { priority: 1 }); // $ExpectType Promise - -queue.addAll([() => Promise.resolve('oh'), () => 'hi']); // $ExpectType Promise -queue.addAll([() => Promise.resolve('oh'), () => 1]); // $ExpectType Promise<(string | number)[]> -queue.addAll([() => Promise.resolve('oh'), () => 'hi'], { priority: 1 }); // $ExpectType Promise - -queue.onEmpty(); // $ExpectType Promise -queue.onIdle(); // $ExpectType Promise -queue.start(); -queue.pause(); -queue.clear(); - -queue.size; // $ExpectType number -queue.size = 1; // $ExpectError -queue.pending; // $ExpectType number -queue.pending = 5; // $ExpectError -queue.isPaused; // $ExpectType boolean -queue.isPaused = true; // $ExpectError - -class QueueClass implements PQueue.QueueClass<{ any: string }> { - private readonly queue: Array<() => void>; - - size = 0; - - constructor() { - this.queue = []; - } - - enqueue(run: () => void, options: { any: string }) { - this.queue.push(run); - } - - dequeue() { - return this.queue.shift(); - } -} - -const queue2 = new PQueue({ queueClass: QueueClass }); -queue2.add(() => Promise.resolve(), { any: 'hi' }); diff --git a/types/p-queue/tsconfig.json b/types/p-queue/tsconfig.json deleted file mode 100644 index b3dd5e5314..0000000000 --- a/types/p-queue/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "p-queue-tests.ts" - ] -} \ No newline at end of file diff --git a/types/p-queue/tslint.json b/types/p-queue/tslint.json deleted file mode 100644 index 3db14f85ea..0000000000 --- a/types/p-queue/tslint.json +++ /dev/null @@ -1 +0,0 @@ -{ "extends": "dtslint/dt.json" } diff --git a/types/p-queue/v2/index.d.ts b/types/p-queue/v2/index.d.ts deleted file mode 100644 index 568de0ca1d..0000000000 --- a/types/p-queue/v2/index.d.ts +++ /dev/null @@ -1,103 +0,0 @@ -// Type definitions for p-queue 2.3 -// Project: https://github.com/sindresorhus/p-queue#readme -// Definitions by: BendingBender -// Evan Shortiss -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -export = PQueue; - -declare class PQueue { - /** - * Size of the queue. - */ - size: number; - - /** - * Number of pending promises. - */ - pending: number; - - /** - * Whether the queue is currently paused. - */ - isPaused: boolean; - - constructor(opts?: PQueue.Options); - - /** - * Returns the promise returned by calling fn. - * @param fn Promise-returning/async function. - */ - add(fn: PQueue.Task, opts?: O): Promise; - - /** - * Same as .add(), but accepts an array of async functions and - * returns a promise that resolves when all async functions are resolved. - * @param fn Array of Promise-returning/async functions. - */ - addAll(fns: Array>, opts?: O): Promise; - - /** - * Returns a promise that settles when the queue becomes empty. - * Can be called multiple times. Useful if you for example add - * additional items at a later time. - */ - onEmpty(): Promise; - - /** - * Returns a promise that settles when the queue becomes empty, and all - * promises have completed; queue.size === 0 && queue.pending === 0. - * The difference with .onEmpty is that .onIdle guarantees that all work - * from the queue has finished. .onEmpty merely signals that the queue is - * empty, but it could mean that some promises haven't completed yet. - */ - onIdle(): Promise; - - /** - * Start (or resume) executing enqueued tasks within concurrency limit. - * No need to call this if queue is not paused (via options.autoStart = false - * or by .pause() method.) - */ - start(): void; - - /** - * Clear the queue. - */ - clear(): void; - - /** - * Put queue execution on hold. - */ - pause(): void; -} - -declare namespace PQueue { - interface QueueAddOptions { - [key: string]: any; - } - - interface QueueClassConstructor { - new(): QueueClass; - } - - interface QueueClass { - size: number; - - enqueue(run: () => void, options?: O): void; - - dequeue(): (() => void) | undefined; - } - - interface Options { - concurrency?: number; - autoStart?: boolean; - queueClass?: QueueClassConstructor; - } - - interface DefaultAddOptions { - priority?: number; - } - - type Task = () => Promise; -} diff --git a/types/p-queue/v2/p-queue-tests.ts b/types/p-queue/v2/p-queue-tests.ts deleted file mode 100644 index fcd48c852d..0000000000 --- a/types/p-queue/v2/p-queue-tests.ts +++ /dev/null @@ -1,51 +0,0 @@ -import PQueue = require("p-queue"); - -const queue = new PQueue({ concurrency: 1 }); - -queue - .add(() => Promise.resolve("sindresorhus.com")) - .then(sindre => { - const str: string = sindre; - }); - -queue.addAll([() => Promise.resolve("oh"), () => Promise.resolve("hi")]).then(r => { - r.indexOf("h"); -}); - -Promise.resolve((): Promise => Promise.resolve("unicorn")) - .then(task => queue.add(task, { priority: 5 })) - .then(unicorn => { - const str: string = unicorn; - }); - -queue.onEmpty().then(() => {}); -queue.onIdle().then(() => {}); -queue.start(); -queue.pause(); -queue.clear(); - -let num: number; -num = queue.size; -num = queue.pending; -const paused = queue.isPaused; - -class QueueClass implements PQueue.QueueClass<{ any: string }> { - private readonly queue: Array<() => void>; - - size = 0; - - constructor() { - this.queue = []; - } - - enqueue(run: () => void, options: { any: string }) { - this.queue.push(run); - } - - dequeue() { - return this.queue.shift(); - } -} - -const queue2 = new PQueue({ queueClass: QueueClass }); -queue2.add(() => Promise.resolve(), { any: "hi" }); diff --git a/types/p-queue/v2/tsconfig.json b/types/p-queue/v2/tsconfig.json deleted file mode 100644 index 49d979aa06..0000000000 --- a/types/p-queue/v2/tsconfig.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../../", - "typeRoots": [ - "../../" - ], - "paths": { - "p-queue": [ "p-queue/v2" ] - }, - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "p-queue-tests.ts" - ] -} diff --git a/types/p-queue/v2/tslint.json b/types/p-queue/v2/tslint.json deleted file mode 100644 index 3db14f85ea..0000000000 --- a/types/p-queue/v2/tslint.json +++ /dev/null @@ -1 +0,0 @@ -{ "extends": "dtslint/dt.json" } diff --git a/types/sinon/ts3.1/sinon-tests.ts b/types/sinon/ts3.1/sinon-tests.ts index 0f07193704..d8f5170aba 100644 --- a/types/sinon/ts3.1/sinon-tests.ts +++ b/types/sinon/ts3.1/sinon-tests.ts @@ -1,5 +1,4 @@ import sinon = require("sinon"); -import Bluebird = require("bluebird"); function testSandbox() { const obj = {}; @@ -427,7 +426,7 @@ function testStub() { const obj = class { foo() { } promiseFunc() { return Promise.resolve('foo'); } - promiseLikeFunc() { return {} as any as Bluebird; } + promiseLikeFunc() { return Promise.resolve('foo') as PromiseLike; } }; const instance = new obj(); diff --git a/types/tern/index.d.ts b/types/tern/index.d.ts index ef01c0e289..7ef634e6a6 100644 --- a/types/tern/index.d.ts +++ b/types/tern/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for tern 0.22 +// Type definitions for tern 0.23 // Project: https://github.com/ternjs/tern // Definitions by: Nikolaj Kappler // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -11,5 +11,5 @@ // thus if you want to use undocumented APIs, you should extends these definitions with // ambient declaration merging: https://www.typescriptlang.org/docs/handbook/declaration-merging.html -export * from "./lib/tern"; export * from "./lib/infer"; +export * from "./lib/tern"; diff --git a/types/tern/lib/infer/index.d.ts b/types/tern/lib/infer/index.d.ts index 58e83ea1c7..b8cc01e68f 100644 --- a/types/tern/lib/infer/index.d.ts +++ b/types/tern/lib/infer/index.d.ts @@ -1,12 +1,14 @@ import * as ESTree from "estree"; +import { Server } from "../tern"; export { }; // #### Context #### interface ContextConstructor { - new(defs: any[]): Context; + new(defs: any[], parent: Server): Context; } export const Context: ContextConstructor; export interface Context { + parent?: Server; topScope: Scope; /** The primitive number type. */ num: Type; @@ -15,8 +17,10 @@ export interface Context { /** The primitive boolean type. */ bool: Type; } +/** Returns the current context object. */ export function cx(): Context; -export function withContext(context: Context, f: () => void): void; +/** Calls f with the current context bound to context. Basically, all code that does something with the inference engine should be wrapped in such a call. */ +export function withContext(context: Context, f: () => R): R; // #### Analysis #### /** Parse a piece of code for use by Tern. Will automatically fall back to the error-tolerant parser if the regular parser can’t parse the code. */ @@ -59,6 +63,7 @@ export interface Obj extends Type { hasProp(prop: string): AVal | null; /** Looks up the given property, or defines it if it did not yet exist (in which case it will be associated with the given AST node). */ defProp(prop: string, originNode?: ESTree.Node): AVal; + getType(): Obj; } interface FnConstructor { @@ -66,18 +71,27 @@ interface FnConstructor { } /** Constructor for the type that implements functions. Inherits from `Obj`. The `AVal` types are used to track the input and output types of the function. */ export const Fn: FnConstructor; -export type Fn = Obj; +export interface Fn extends Obj { + readonly args?: AVal[]; + readonly argNames?: string[]; + self?: Type; + readonly retval: AVal; + isArrowFn(): boolean; + getType(): Fn; +} interface ArrConstructor { /** Constructor that creates an array type with the given content type. */ - new(contentType: AVal): Arr; + new(contentType?: AVal): Arr; } export const Arr: ArrConstructor; -export type Arr = Obj; +export interface Arr extends Obj { + getType(): Arr; +} export interface Type extends AVal { /** The name of the type, if any. */ - name: string; + name: string | undefined; /** The origin file of the type. */ origin: string; /** @@ -88,10 +102,9 @@ export interface Type extends AVal { originNode?: ESTree.Node; /** Return a string that describes the type. maxDepth indicates the depth to which inner types should be shown. */ toString(maxDepth: number): string; - /** Get an `AVal` that represents the named property of this type. */ - getProp(prop: string): AVal; /** Call the given function for all properties of the object, including properties that are added in the future. */ forAllProps(f: (prop: string, val: AVal, local: boolean) => void): void; + getType(): Type; } // #### Abstract Values #### @@ -131,13 +144,23 @@ export interface AVal { * Asks the AVal if it contains a function type. Useful when * you aren’t interested in other kinds of types. */ - getFunctionType(): Type | undefined; + getFunctionType(): Fn | undefined; + /** Get an `AVal` that represents the named property of this type. */ + getProp(prop: string): AVal; + /** + * Asks the AVal if it contains an Object type. Useful when + * you aren’t interested in other kinds of types. + */ + getObjType(): Obj | null; /** * Abstract values that are used to represent variables * or properties will have, when possible, an `originNode` * property pointing to an AST node. */ originNode?: ESTree.Node; + + readonly types: Type[]; + readonly propertyOf?: Obj; } export const ANull: ANull; @@ -170,7 +193,8 @@ export interface Constraint extends AVal { // #### Scopes #### interface ScopeConstructor { - new(parent?: Scope): Scope; + new(): Scope; + new(parent: Scope, originNode: ESTree.Node): Scope; } export const Scope: ScopeConstructor; export interface Scope extends Obj { @@ -199,7 +223,7 @@ export function findExpressionAround(ast: ESTree.Program, start: number | undefi /** Similar to `findExpressionAround`, except that it use the same AST walker as `findExpressionAt`. */ export function findClosestExpression(ast: ESTree.Program, start: number | undefined, end: number, scope?: Scope): { node: ESTree.Node, state: Scope } | null; /** Determine an expression for the given node and scope (as returned by the functions above). Will return an `AVal` or plain `Type`. */ -export function expressionType(expr: { node: ESTree.Node, state: Scope }): AVal | Type; +export function expressionType(expr: { node: ESTree.Node, state: Scope | null }): AVal | Type; /** Find the scope at a given position in the syntax tree. The `scope` parameter can be used to override the scope used for code that isn’t wrapped in any function. */ export function scopeAt(ast: ESTree.Program, pos: number, scope?: Scope): Scope; /** diff --git a/types/tern/lib/tern/index.d.ts b/types/tern/lib/tern/index.d.ts index 7ecb4ac73e..22001ed075 100644 --- a/types/tern/lib/tern/index.d.ts +++ b/types/tern/lib/tern/index.d.ts @@ -1,5 +1,5 @@ import * as ESTree from "estree"; -import { Scope, Type } from "../infer"; +import { Context, Scope, Type } from "../infer"; export { }; @@ -48,6 +48,10 @@ interface TernConstructor { export const Server: TernConstructor; export interface Server { + readonly cx: Context; + readonly options: ConstructorOptions; + readonly files: File[]; + readonly plugins: any; /** * Add a set of type definitions to the server. If `atFront` is true, they will be added before all other * existing definitions. Otherwise, they are added at the back. @@ -93,10 +97,12 @@ export interface Server { request( doc: D & { query?: Q }, callback: ( - error: Error | undefined, + error: string | null, response: (D extends { query: undefined } ? {} : D extends { query: Query } ? QueryResult : {}) | undefined ) => void ): void; + reset(): void; + signal(event: keyof Events, file: File): void; } // #### JSON Protocol #### @@ -156,6 +162,7 @@ export interface File { scope: Scope; ast: ESTree.Program; type?: "full" | "part" | "delete"; + asLineChar?(nodePosition: number): Position; } export interface BaseQuery { diff --git a/types/tinymce/index.d.ts b/types/tinymce/index.d.ts index b38d96d45c..e50feb0b5d 100644 --- a/types/tinymce/index.d.ts +++ b/types/tinymce/index.d.ts @@ -394,7 +394,7 @@ export class Editor extends util.Observable { addCommand(name: string, callback: (ui: boolean, value: {}) => boolean, scope?: {}): void; - addContextToolbar(predicate: () => void, items: string): void; + addContextToolbar(predicate: () => boolean, items: string): void; addMenuItem(name: string, settings: {}): void; @@ -414,7 +414,7 @@ export class Editor extends util.Observable { execCallback(name: string): {}; - execCommand(cmd: string, ui: boolean, value?: any, args?: {}): void; + execCommand(cmd: string, ui?: boolean, value?: any, args?: {}): void; focus(skipFocus: boolean): void; @@ -838,7 +838,7 @@ export namespace dom { insertAfter(node: Element, referenceNode: Element): Element | T[]; - is(elm: Node, selector: string): void; + is(elm: Node, selector: string): boolean; isBlock(node: Node): boolean; @@ -1072,7 +1072,7 @@ export namespace dom { setContent(content: string, args?: {}): void; - setCursorLocation(node?: html.Node, offset?: number): void; + setCursorLocation(node?: Node, offset?: number): void; setNode(elm: Element): Element;